HOME


Mini Shell 1.0
DIR: /home/otwalrll/.trash/wp-content/plugins/formidable/js/
Upload File :
Current File : /home/otwalrll/.trash/wp-content/plugins/formidable/js/form-templates.js
/*! For license information please see form-templates.js.LICENSE.txt */
(()=>{var t={588:t=>{t.exports=function(t,e){var r,n,o=0;function a(){var a,i,c=r,l=arguments.length;t:for(;c;){if(c.args.length===arguments.length){for(i=0;i<l;i++)if(c.args[i]!==arguments[i]){c=c.next;continue t}return c!==r&&(c===n&&(n=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=r,c.prev=null,r.prev=c,r=c),c.val}c=c.next}for(a=new Array(l),i=0;i<l;i++)a[i]=arguments[i];return c={args:a,val:t.apply(null,a)},r?(r.prev=c,c.next=r):n=c,o===e.maxSize?(n=n.prev).next=null:o++,r=c,c.val}return e=e||{},a.clear=function(){r=null,n=null,o=0},a}},975:(t,e,r)=>{var n;!function(){"use strict";var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(t){return function(t,e){var r,n,i,c,l,u,s,f,p,m=1,d=t.length,h="";for(n=0;n<d;n++)if("string"==typeof t[n])h+=t[n];else if("object"==typeof t[n]){if((c=t[n]).keys)for(r=e[m],i=0;i<c.keys.length;i++){if(null==r)throw new Error(a('[sprintf] Cannot access property "%s" of undefined value "%s"',c.keys[i],c.keys[i-1]));r=r[c.keys[i]]}else r=c.param_no?e[c.param_no]:e[m++];if(o.not_type.test(c.type)&&o.not_primitive.test(c.type)&&r instanceof Function&&(r=r()),o.numeric_arg.test(c.type)&&"number"!=typeof r&&isNaN(r))throw new TypeError(a("[sprintf] expecting number but found %T",r));switch(o.number.test(c.type)&&(f=r>=0),c.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,c.width?parseInt(c.width):0);break;case"e":r=c.precision?parseFloat(r).toExponential(c.precision):parseFloat(r).toExponential();break;case"f":r=c.precision?parseFloat(r).toFixed(c.precision):parseFloat(r);break;case"g":r=c.precision?String(Number(r.toPrecision(c.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=c.precision?r.substring(0,c.precision):r;break;case"t":r=String(!!r),r=c.precision?r.substring(0,c.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=c.precision?r.substring(0,c.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=c.precision?r.substring(0,c.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}o.json.test(c.type)?h+=r:(!o.number.test(c.type)||f&&!c.sign?p="":(p=f?"+":"-",r=r.toString().replace(o.sign,"")),u=c.pad_char?"0"===c.pad_char?"0":c.pad_char.charAt(1):" ",s=c.width-(p+r).length,l=c.width&&s>0?u.repeat(s):"",h+=c.align?p+r+l:"0"===u?p+l+r:l+p+r)}return h}(function(t){if(c[t])return c[t];for(var e,r=t,n=[],a=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){a|=1;var i=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))i.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(u[1])}e[2]=i}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}r=r.substring(e[0].length)}return c[t]=n}(t),arguments)}function i(t,e){return a.apply(null,[t].concat(e||[]))}var c=Object.create(null);e.sprintf=a,e.vsprintf=i,"undefined"!=typeof window&&(window.sprintf=a,window.vsprintf=i,void 0===(n=function(){return{sprintf:a,vsprintf:i}}.call(e,r,e,t))||(t.exports=n))}()}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";var t,e,n,o,a=window.frmGlobal,i=a.url,c=a.nonce,l=a.canAccessApplicationDashboard,u=a.applicationsUrl,s=window.frmFormTemplatesVars,f=s.FEATURED_TEMPLATES_KEYS,p=s.upgradeLink,m="frm-form-templates",d="frm_hidden",h="frm-hide-js",y="frm-current",v={ALL_TEMPLATES:"all-templates",AVAILABLE_TEMPLATES:"available-templates",FREE_TEMPLATES:"free-templates",FAVORITES:"favorites",CUSTOM:"custom",SEARCH:"search"},g="440px",b="550px",w=new URL(window.location.href),E=w.searchParams,x=function(t){return E.has(t)},T=r(588),S=r.n(T),_=r(975),L=r.n(_),O=S()(console.error);function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function k(t,e,r){return n=function(t,e){if("object"!=A(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e),(e="symbol"==A(n)?n:String(n))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t;var n}t={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},e=["(","?"],n={")":["("],":":["?","?:"]},o=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var I={"!":function(t){return!t},"*":function(t,e){return t*e},"/":function(t,e){return t/e},"%":function(t,e){return t%e},"+":function(t,e){return t+e},"-":function(t,e){return t-e},"<":function(t,e){return t<e},"<=":function(t,e){return t<=e},">":function(t,e){return t>e},">=":function(t,e){return t>=e},"==":function(t,e){return t===e},"!=":function(t,e){return t!==e},"&&":function(t,e){return t&&e},"||":function(t,e){return t||e},"?:":function(t,e,r){if(t)throw e;return r}};var j={contextDelimiter:"",onMissingKey:null};function C(t,e){var r;for(r in this.data=t,this.pluralForms={},this.options={},j)this.options[r]=void 0!==e&&r in e?e[r]:j[r]}function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){k(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}C.prototype.getPluralForm=function(r,a){var i,c,l,u,s=this.pluralForms[r];return s||("function"!=typeof(l=(i=this.data[r][""])["Plural-Forms"]||i["plural-forms"]||i.plural_forms)&&(c=function(t){var e,r,n;for(e=t.split(";"),r=0;r<e.length;r++)if(0===(n=e[r].trim()).indexOf("plural="))return n.substr(7)}(i["Plural-Forms"]||i["plural-forms"]||i.plural_forms),u=function(r){var a=function(r){for(var a,i,c,l,u=[],s=[];a=r.match(o);){for(i=a[0],(c=r.substr(0,a.index).trim())&&u.push(c);l=s.pop();){if(n[i]){if(n[i][0]===l){i=n[i][1]||i;break}}else if(e.indexOf(l)>=0||t[l]<t[i]){s.push(l);break}u.push(l)}n[i]||s.push(i),r=r.substr(a.index+i.length)}return(r=r.trim())&&u.push(r),u.concat(s.reverse())}(r);return function(t){return function(t,e){var r,n,o,a,i,c,l=[];for(r=0;r<t.length;r++){if(i=t[r],a=I[i]){for(n=a.length,o=Array(n);n--;)o[n]=l.pop();try{c=a.apply(null,o)}catch(t){return t}}else c=e.hasOwnProperty(i)?e[i]:+i;l.push(c)}return l[0]}(a,t)}}(c),l=function(t){return+u({n:t})}),s=this.pluralForms[r]=l),s(a)},C.prototype.dcnpgettext=function(t,e,r,n,o){var a,i,c;return a=void 0===o?0:this.getPluralForm(t,o),i=r,e&&(i=e+this.options.contextDelimiter+r),(c=this.data[t][i])&&c[a]?c[a]:(this.options.onMissingKey&&this.options.onMissingKey(r,t),0===a?r:n)};var B={"":{plural_forms:function(t){return 1===t?0:1}}},M=/^i18n\.(n?gettext|has_translation)(_|$)/;const N=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},D=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},q=function(t,e){return function(r,n,o){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=t[e];if(D(r)&&N(n))if("function"==typeof o)if("number"==typeof a){var c={callback:o,priority:a,namespace:n};if(i[r]){var l,u=i[r].handlers;for(l=u.length;l>0&&!(a>=u[l-1].priority);l--);l===u.length?u[l]=c:u.splice(l,0,c),i.__current.forEach((function(t){t.name===r&&t.currentIndex>=l&&t.currentIndex++}))}else i[r]={handlers:[c],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,n,o,a)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}},G=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n,o){var a=t[e];if(D(n)&&(r||N(o))){if(!a[n])return 0;var i=0;if(r)i=a[n].handlers.length,a[n]={runs:a[n].runs,handlers:[]};else for(var c=a[n].handlers,l=function(t){c[t].namespace===o&&(c.splice(t,1),i++,a.__current.forEach((function(e){e.name===n&&e.currentIndex>=t&&e.currentIndex--})))},u=c.length-1;u>=0;u--)l(u);return"hookRemoved"!==n&&t.doAction("hookRemoved",n,o),i}}},R=function(t,e){return function(r,n){var o=t[e];return void 0!==n?r in o&&o[r].handlers.some((function(t){return t.namespace===n})):r in o}},H=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n){var o=t[e];o[n]||(o[n]={handlers:[],runs:0}),o[n].runs++;for(var a=o[n].handlers,i=arguments.length,c=new Array(i>1?i-1:0),l=1;l<i;l++)c[l-1]=arguments[l];if(!a||!a.length)return r?c[0]:void 0;var u={name:n,currentIndex:0};for(o.__current.push(u);u.currentIndex<a.length;){var s=a[u.currentIndex].callback.apply(null,c);r&&(c[0]=s),u.currentIndex++}return o.__current.pop(),r?c[0]:void 0}},z=function(t,e){return function(){var r,n,o=t[e];return null!==(r=null===(n=o.__current[o.__current.length-1])||void 0===n?void 0:n.name)&&void 0!==r?r:null}},V=function(t,e){return function(r){var n=t[e];return void 0===r?void 0!==n.__current[0]:!!n.__current[0]&&r===n.__current[0].name}},Y=function(t,e){return function(r){var n=t[e];if(D(r))return n[r]&&n[r].runs?n[r].runs:0}};var U=new function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=q(this,"actions"),this.addFilter=q(this,"filters"),this.removeAction=G(this,"actions"),this.removeFilter=G(this,"filters"),this.hasAction=R(this,"actions"),this.hasFilter=R(this,"filters"),this.removeAllActions=G(this,"actions",!0),this.removeAllFilters=G(this,"filters",!0),this.doAction=H(this,"actions"),this.applyFilters=H(this,"filters",!0),this.currentAction=z(this,"actions"),this.currentFilter=z(this,"filters"),this.doingAction=V(this,"actions"),this.doingFilter=V(this,"filters"),this.didAction=Y(this,"actions"),this.didFilter=Y(this,"filters")},$=(U.addAction,U.addFilter,U.removeAction,U.removeFilter,U.hasAction,U.hasFilter,U.removeAllActions,U.removeAllFilters,U.doAction,U.applyFilters,U.currentAction,U.currentFilter,U.doingAction,U.doingFilter,U.didAction,U.didFilter,U.actions,U.filters,function(t,e,r){var n=new C({}),o=new Set,a=function(){o.forEach((function(t){return t()}))},i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";n.data[e]=P(P(P({},B),n.data[e]),t),n.data[e][""]=P(P({},B[""]),n.data[e][""])},c=function(t,e){i(t,e),a()},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",e=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return n.data[t]||i(void 0,t),n.dcnpgettext(t,e,r,o,a)},u=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default"},s=function(t,e,n){var o=l(n,e,t);return r?(o=r.applyFilters("i18n.gettext_with_context",o,t,e,n),r.applyFilters("i18n.gettext_with_context_"+u(n),o,t,e,n)):o};if(r){var f=function(t){M.test(t)&&a()};r.addAction("hookAdded","core/i18n",f),r.addAction("hookRemoved","core/i18n",f)}return{getLocaleData:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return n.data[t]},setLocaleData:c,resetLocaleData:function(t,e){n.data={},n.pluralForms={},c(t,e)},subscribe:function(t){return o.add(t),function(){return o.delete(t)}},__:function(t,e){var n=l(e,void 0,t);return r?(n=r.applyFilters("i18n.gettext",n,t,e),r.applyFilters("i18n.gettext_"+u(e),n,t,e)):n},_x:s,_n:function(t,e,n,o){var a=l(o,void 0,t,e,n);return r?(a=r.applyFilters("i18n.ngettext",a,t,e,n,o),r.applyFilters("i18n.ngettext_"+u(o),a,t,e,n,o)):a},_nx:function(t,e,n,o,a){var i=l(a,o,t,e,n);return r?(i=r.applyFilters("i18n.ngettext_with_context",i,t,e,n,o,a),r.applyFilters("i18n.ngettext_with_context_"+u(a),i,t,e,n,o,a)):i},isRTL:function(){return"rtl"===s("ltr","text direction")},hasTranslation:function(t,e,o){var a,i,c=e?e+""+t:t,l=!(null===(a=n.data)||void 0===a||null===(i=a[null!=o?o:"default"])||void 0===i||!i[c]);return r&&(l=r.applyFilters("i18n.has_translation",l,t,e,o),l=r.applyFilters("i18n.has_translation_"+u(o),l,t,e,o)),l}}}(0,0,U));$.getLocaleData.bind($),$.setLocaleData.bind($),$.resetLocaleData.bind($),$.subscribe.bind($);var Z=$.__.bind($),K=($._x.bind($),$._n.bind($),$._nx.bind($),$.isRTL.bind($),$.hasTranslation.bind($),window.frmDom),J=K.tag,X=K.div,Q=K.a,W=K.img;function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function rt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?et(Object(r),!0).forEach((function(e){var n,o,a,i;n=t,o=e,a=r[e],i=function(t,e){if("object"!=tt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==tt(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):et(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function nt(t){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(t)}function ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function at(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ot(Object(r),!0).forEach((function(e){var n,o,a,i;n=t,o=e,a=r[e],i=function(t,e){if("object"!=nt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==nt(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var it=null;function ct(){var t,e,r,n,o,a,c,l,u,s,f,p,h;r={bodyContent:document.getElementById("post-body-content"),headerCancelButton:document.getElementById("frm-publishing").querySelector("a"),createFormButton:document.getElementById("".concat(m,"-create-form")),pageTitle:document.getElementById("".concat(m,"-page-title")),pageTitleText:document.getElementById("".concat(m,"-page-title-text")),pageTitleDivider:document.getElementById("".concat(m,"-page-title-divider")),upsellBanner:document.getElementById("".concat(m,"-upsell-banner")),extraTemplateCountElements:document.querySelectorAll(".".concat(m,"-extra-templates-count"))},n=document.getElementById("".concat(m,"-list")),o={templatesList:n,templateItems:n.querySelectorAll(".frm-card-item"),availableTemplateItems:n.querySelectorAll(".frm-card-item:not(.".concat(m,"-locked-item)")),freeTemplateItems:n.querySelectorAll(".frm-card-item.frm-free-template"),twinFeaturedTemplateItems:n.querySelectorAll(".".concat(m,"-featured-item")),firstLockedFreeTemplate:n.querySelector(".frm-free-template"),featuredTemplatesList:document.getElementById("".concat(m,"-featured-list"))},a=document.getElementById("".concat(m,"-custom-list-section")),c={customTemplatesSection:a,customTemplateItems:a.querySelectorAll(".frm-card-item"),customTemplatesTitle:document.getElementById("".concat(m,"-custom-list-title")),customTemplatesList:document.getElementById("".concat(m,"-custom-list"))},l=document.getElementById("".concat(m,"-sidebar")),u=document.querySelector(".".concat(m,'-cat-item[data-category="').concat(v.FAVORITES,'"]')),s={sidebar:l,favoritesCategory:u,favoritesCategoryCountEl:u.querySelector(".".concat(m,"-cat-count")),searchInput:document.getElementById("template-search-input"),allTemplatesCategory:document.querySelector(".".concat(m,'-cat-item[data-category="').concat(v.ALL_TEMPLATES,'"]')),availableTemplatesCategory:document.querySelector(".".concat(m,'-cat-item[data-category="').concat(v.AVAILABLE_TEMPLATES,'"]')),freeTemplatesCategory:document.querySelector(".".concat(m,'-cat-item[data-category="').concat(v.FREE_TEMPLATES,'"]'))},f=document.getElementById("".concat(m,"-modal")),p={modal:f,modalItems:null==f?void 0:f.querySelectorAll(".".concat(m,"-modal-item")),showCreateTemplateModalButton:document.getElementById("frm-show-create-template-modal"),createTemplateModal:document.getElementById("frm-create-template-modal"),createTemplateFormsDropdown:document.getElementById("frm-create-template-modal-forms-select"),createTemplateName:document.getElementById("frm_create_template_name"),createTemplateDescription:document.getElementById("frm_create_template_description"),createTemplateButton:document.getElementById("frm-create-template-button"),renewAccountModal:document.getElementById("frm-renew-modal"),leaveEmailModal:document.getElementById("frm-leave-email-modal"),leaveEmailModalInput:document.getElementById("frm_leave_email"),leaveEmailModalApiEmailForm:document.getElementById("frmapi-email-form"),leaveEmailModalGetCodeButton:document.getElementById("frm-get-code-button"),codeFromEmailModal:document.getElementById("frm-code-from-email-modal"),codeFromEmailModalInput:document.getElementById("frm_code_from_email"),upgradeModal:document.getElementById("frm-form-upgrade-modal"),upgradeModalTemplateNames:null==f?void 0:f.querySelectorAll(".frm-upgrade-modal-template-name"),upgradeModalPlansIcons:null==f?void 0:f.querySelectorAll(".frm-upgrade-modal-plan-icon"),upgradeModalLink:document.getElementById("frm-upgrade-modal-link")},h={newTemplateForm:document.getElementById("frm-new-template"),newTemplateNameInput:document.getElementById("frm_template_name"),newTemplateDescriptionInput:document.getElementById("frm_template_desc"),newTemplateLinkInput:document.getElementById("frm_link"),newTemplateActionInput:document.getElementById("frm_action_type")},it=rt(rt(rt(rt(rt(rt({},r),o),c),s),p),h),function(){var t;if(!it.emptyState){var e,r=((e=Q({className:"button button-primary frm-button-primary"})).setAttribute("role","button"),X({id:"".concat(m,"-empty-state"),className:"frm-flex-col frm-flex-center frm-gap-md ".concat(d),children:[W({src:"".concat(i,"/images/form-templates/empty-state.svg"),alt:Z("Empty State","formidable")}),X({className:"frmcenter",children:[J("h2",{className:"".concat(m,"-title frm-mb-0")}),J("p",{className:"".concat(m,"-text frm-mb-0")})]}),e]}));null===(t=it.bodyContent)||void 0===t||t.appendChild(r);var n=function(){var t=document.querySelector("#".concat(m,"-empty-state"));return{emptyState:t,emptyStateTitle:null==t?void 0:t.querySelector(".".concat(m,"-title")),emptyStateText:null==t?void 0:t.querySelector(".".concat(m,"-text")),emptyStateButton:null==t?void 0:t.querySelector(".button")}}();it=at(at({},it),n)}}(),e=null===(t=it.bodyContent)||void 0===t?void 0:t.children,it=at(at({},it),{},{bodyContentChildren:e})}function lt(){return it}function ut(t){it=at(at({},it),t)}var st,ft=window.frmDom,pt=ft.tag,mt=ft.div,dt=ft.span,ht=ft.a,yt=ft.img,vt="".concat(i,"/images/applications/thumbnails");function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}function bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function wt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?bt(Object(r),!0).forEach((function(e){var n,o,a,i;n=t,o=e,a=r[e],i=function(t,e){if("object"!=gt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==gt(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var Et=null,xt=function(){return Et},Tt=function(t){Et=wt(wt({},Et),t)},St=function(t){var e;return null!==(e=Reflect.get(Et,t))&&void 0!==e?e:null},_t=function(t,e){Reflect.has(Et,t)&&Reflect.set(Et,t,e)},Lt=function(t){return v.CUSTOM===t},Ot=function(t){return!!It(t)&&t.classList.contains("".concat(m,"-favorite-item"))},At=function(t){return!!It(t)&&t.classList.contains("".concat(m,"-custom-item"))},kt=function(t){return"string"==typeof t&&/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(t)},It=function(t){return t instanceof HTMLElement||console.warn("Invalid argument: Element must be an instance of HTMLElement")||!1},jt="frm_hidden",Ct=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Pt(t)}))},Ft=function(t){var e;return null===(e=Array.from(t))||void 0===e?void 0:e.forEach((function(t){return Bt(t)}))},Pt=function(t){return null==t?void 0:t.classList.remove(jt)},Bt=function(t){return null==t?void 0:t.classList.add(jt)};function Mt(t){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mt(t)}function Nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Dt(n.key),n)}}function Dt(t){var e=function(t,e){if("object"!=Mt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=Mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Mt(e)?e:String(e)}var qt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.elements=e,this.cssFilePath="admin/animations.css",this.type=r,this.initOnceInAllInstances(),this.prepareElements()}var e,r;return e=t,r=[{key:"fadeIn",value:function(){var t=this;this.applyStyleToElements((function(e){e.classList.add("frm-fadein-up"),e.addEventListener("animationend",(function(){t.resetOpacity(),e.classList.remove("frm-fadein-up")}),{once:!0})}))}},{key:"cascadeFadeIn",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.03;setTimeout((function(){t.applyStyleToElements((function(t,r){t.classList.remove("frm-animate"),t.style.transitionDelay=(r+1)*e+"s"}))}),200)}},{key:"initOnceInAllInstances",value:function(){!0!==t.init&&(t.init=!0,this.loadCssFile())}},{key:"getCssFileUrl",value:function(){return window.frmGlobal?window.frmGlobal.url+"/css/"+this.cssFilePath:""}},{key:"loadCssFile",value:function(){var t=document.createElement("link");t.href=this.getCssFileUrl(),t.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(t)}},{key:"prepareElements",value:function(){var t=this;this.applyStyleToElements((function(e){"default"===t.type&&(e.style.opacity="0.0"),"cascade"===t.type&&e.classList.add("frm-init-cascade-animation"),"cascade-3d"===t.type&&e.classList.add("frm-init-fadein-3d"),e.classList.add("frm-animate")}))}},{key:"resetOpacity",value:function(){this.applyStyleToElements((function(t){return t.style.opacity="1.0"}))}},{key:"applyStyleToElements",value:function(t){this.elements instanceof Element?t(this.elements,0):0<this.elements.length&&this.elements.forEach((function(e,r){return t(e,r)}))}}],r&&Nt(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Gt=Promise.resolve(),Rt=window.frmDom.util.onClickPreventDefault;function Ht(t){return Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(t)}function zt(){zt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var T=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Ht(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=O(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(Ht(e)+" is not iterable")}return g.prototype=b,o(T,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new _(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},S(T),u(T,l,"Generator"),u(T,i,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Vt(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function Yt(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Vt(a,n,o,i,c,"next",t)}function c(t){Vt(a,n,o,i,c,"throw",t)}i(void 0)}))}}var Ut=null;function $t(){return($t=Yt(zt().mark((function t(){var e,r,n;return zt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=window.frmAdminBuild,r=e.initModal,n=e.offsetModalY,(Ut=r("#frm-form-templates-modal",g))&&n(Ut,"103px"),x("free-templates")&&(lt().leaveEmailModal&&qe()),Kt(),wp.hooks.addAction("frmAdmin.beforeOpenConfirmModal","frmFormTemplates",(function(t){var e=t.$info;e.dialog("option","width",b),n(e,"103px")}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Zt(){return Ut}function Kt(){return Jt.apply(this,arguments)}function Jt(){return Jt=Yt(zt().mark((function t(){var e,r,n,o,a,i,c,l,u;return zt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=lt(),r=e.leaveEmailModalApiEmailForm){t.next=3;break}return t.abrupt("return");case 3:return n=r.getAttribute("data-url"),t.prev=4,t.next=7,fetch(n);case 7:return a=t.sent,t.next=10,a.json();case 10:o=t.sent,t.next=17;break;case 13:return t.prev=13,t.t0=t.catch(4),console.error("An error occurred:",t.t0),t.abrupt("return");case 17:if(o.renderedHtml){t.next=20;break}return console.warn("renderedHtml is not available."),t.abrupt("return");case 20:i=o.renderedHtml,c=/<link\b[^>]*(formidableforms.css|action=frmpro_css)[^>]*>/gi,i=i.replace(c,""),r.innerHTML=i,l=r.querySelector("form"),u=l.querySelector('[type="email"]:not(.frm_verify)'),ut({leaveEmailModalHiddenForm:l,leaveEmailModalHiddenInput:u});case 27:case"end":return t.stop()}}),t,null,[[4,13]])}))),Jt.apply(this,arguments)}function Xt(t){var e=lt().pageTitleText,r=t||St("selectedCategoryEl").querySelector(".frm-form-templates-cat-text").textContent;e.textContent=r}var Qt={},Wt=function(t){var e=t.currentTarget,r=e.getAttribute("data-category"),n=lt().bodyContent,o=new qt(n),a=xt(),i=a.selectedCategory,c=a.selectedCategoryEl,l=a.notEmptySearchText;i!==r&&(i=wp.hooks.applyFilters("frmFormTemplates.selectedCategory",r),c.classList.remove(y),(c=e).classList.add(y),Tt({selectedCategory:i,selectedCategoryEl:c}),l&&se(),function(t){var e=lt(),r=e.bodyContentChildren,n=e.pageTitle,o=e.showCreateTemplateModalButton,a=e.templatesList,i=e.templateItems;switch(v.ALL_TEMPLATES!==t&&Ft(r),Xt(),Bt(o),Pt(n),t){case v.ALL_TEMPLATES:!function(){var t=lt(),e=t.bodyContentChildren,r=t.pageTitleDivider,n=t.templateItems,o=t.twinFeaturedTemplateItems,a=t.customTemplatesSection,i=t.emptyState,c=t.applicationTemplates;Ct([].concat(Ae(e),Ae(n))),Ft([r].concat(Ae(o),[a,i,c]))}();break;case v.AVAILABLE_TEMPLATES:!function(){if(0!==xt().availableTemplatesCount){var t=lt(),e=t.templatesList,r=t.templateItems,n=t.availableTemplateItems;Ft(r),Ct([e].concat(Ae(n)))}else!function(){var t=lt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",v.AVAILABLE_TEMPLATES);var o=lt(),a=o.emptyStateTitle,i=o.emptyStateText,c=xt().extraTemplatesCount;a.textContent=Z("No Templates Available","formidable"),i.textContent=function(t){try{for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return L().sprintf.apply(L(),[t].concat(r))}catch(e){return O("sprintf error: \n\n"+e.toString()),t}}(Z("Upgrade to PRO for %s+ options or explore Free Templates.","formidable"),c),Ft([e,n]),Pt(r)}()}();break;case v.FREE_TEMPLATES:!function(){var t=lt(),e=t.templatesList,r=t.templateItems,n=t.freeTemplateItems;Ft(r),Ct([e].concat(Ae(n)))}();break;case v.FAVORITES:!function(){var t=xt().favoritesCount;if(0!==t.total){var e=lt(),r=e.bodyContent,n=e.templatesList,o=e.templateItems,a=e.customTemplatesSection,i=e.customTemplatesTitle,c=e.customTemplatesList,l=e.customTemplateItems;Ft(o);var u=[],s=r.querySelectorAll(".".concat(m,"-favorite-item"));if(u.push.apply(u,Ae(s)),t.default>0&&u.push(n),t.custom>0){var f=Array.from(l).filter((function(t){return!Ot(t)}));Ft(f),u.push(a),u.push(c),0===t.default?Bt(i):u.push(i)}Ct(u)}else Ie()}();break;case v.CUSTOM:!function(){if(0!==xt().customCount){var t=lt(),e=t.showCreateTemplateModalButton,r=t.pageTitleDivider,n=t.customTemplatesSection,o=t.customTemplatesList,a=t.customTemplatesTitle,i=t.customTemplateItems;Bt(a),Ct([e,r,n,o].concat(Ae(i)))}else!function(){var t=lt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",v.CUSTOM);var o=lt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=Z("You currently have no templates.","formidable"),i.textContent=Z("You haven't created any form templates. Begin now to simplify your workflow and save time.","formidable"),n.textContent=Z("Create Template","formidable"),Bt(e),Ct([r,n])}()}();break;default:Ft(i),Ct([a].concat(Ae(Qt[t])))}}(i),o.fadeIn())};function te(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Wt(t))}var ee=function(){var t=lt(),e=t.createFormButton,r=t.newTemplateForm,n=t.newTemplateNameInput,o=t.newTemplateActionInput,a=window.frmAdminBuild.installNewForm;n.value="",o.value="frm_install_form",a(r,"frm_install_form",e)};var re=".".concat(m,"-item-favorite-button"),ne="".concat(re," use"),oe="#frm_heart_solid_icon",ae="#frm_heart_icon",ie=function(t){var e,r=t.currentTarget,n=lt(),o=n.templatesList,a=n.featuredTemplatesList,i=n.favoritesCategoryCountEl,c=n.customTemplatesTitle,l=r.closest(".frm-card-item"),u=l.dataset.id,s=Ot(l),p=At(l),d=function(t){return!!It(t)&&f.includes(Number(t.dataset.id))}(l),h=null;if(l.classList.toggle("".concat(m,"-favorite-item"),!s),d){var y=l.closest("#".concat(m,"-list"))?a:o;y&&(h=y.querySelector('.frm-card-item[data-id="'.concat(u,'"]'))).classList.toggle("".concat(m,"-favorite-item"),!s)}var g,b,w=xt(),E=w.selectedCategory,x=w.favoritesCount,T=s?"remove":"add",S=l.querySelector(ne),_=null===(e=h)||void 0===e?void 0:e.querySelector(ne);"add"===T?(++x.total,p?++x.custom:++x.default,S.setAttribute("xlink:href",oe),null==_||_.setAttribute("xlink:href",oe)):(--x.total,p?--x.custom:--x.default,S.setAttribute("xlink:href",ae),null==_||_.setAttribute("xlink:href",ae)),i.textContent=x.total,_t("favoritesCount",x),g=E,v.FAVORITES===g&&(0===x.total&&Ie(),Bt(l),0===x.default&&Bt(o),0!==x.custom&&0!==x.default||Bt(c)),b=function(){return t=u,e=T,r=p,n=new FormData,o=frmDom.ajax.doJsonPost,n.append("template_id",t),n.append("operation",e),n.append("is_custom_template",r),o("add_or_remove_favorite_template",n);var t,e,r,n,o},Gt=Gt.then(b).catch(b)};var ce=function(t){var e=t.currentTarget,r=e.closest(".frm-card-item"),n=function(t){return!!It(t)&&t.classList.contains("".concat(m,"-locked-item"))}(r),o=At(r);if(n||!o)if(t.preventDefault(),_t("selectedTemplate",r),n)!function(t){var e=t.dataset.requiredPlan;switch(e){case"basic":case"plus":case"business":case"elite":Ne(e,t);break;case"renew":De();break;case"free":qe()}}(r);else{var a=lt(),i=a.newTemplateForm,c=a.newTemplateNameInput,l=a.newTemplateDescriptionInput,u=a.newTemplateLinkInput,s=a.newTemplateActionInput,f=window.frmAdminBuild.installNewForm,p=r.querySelector(".frm-form-template-name").textContent.trim(),d=r.querySelector(".frm-form-templates-item-description").textContent.trim(),h="frm_install_template";c.value=p,l.value=d,s.value=h,u.value=e.href,f(i,h,e)}};var le=window.frmDom.search.init;function ue(t,e){var r=t.foundSomething,n=t.notEmptySearchText;if(!e||"search"!==e.type||""!==e.target.value){var o=xt(),a=lt().allTemplatesCategory;_t("notEmptySearchText",n),o.notEmptySearchText||o.selectedCategory?(o.selectedCategory&&(function(t){var e=lt(),r=e.bodyContent,n=e.bodyContentChildren,o=e.pageTitle,a=e.templatesList,i=e.applicationTemplates,c=new qt(r);t&&St("selectedCategoryEl").classList.remove(y),Ft(n),Xt(Z("Search Result","formidable")),Ct([o,a,i]),c.fadeIn()}(n),n&&_t("selectedCategory","")),function(t){if(t){var e,r=lt().emptyState;if(e=r,"none"!==window.getComputedStyle(e).getPropertyValue("display")){var n=lt().pageTitle;Bt(r),Pt(n)}var o=lt(),a=o.templatesList,i=o.applicationTemplates,c=o.applicationTemplatesTitle,l=o.applicationTemplatesList;Ct([a,i,c]),0===a.offsetHeight&&Ft([a,c]),0===(null==l?void 0:l.offsetHeight)&&Bt(i)}else!function(){var t,e=xt().notEmptySearchText,r=lt(),n=r.pageTitle,o=r.emptyState,a=r.emptyStateButton,i=r.applicationTemplates;if(v.SEARCH!==(null===(t=o.dataset)||void 0===t?void 0:t.view)){o.setAttribute("data-view",v.SEARCH);var c=lt(),l=c.emptyStateTitle,u=c.emptyStateText;l.textContent=Z("No templates found","formidable"),u.textContent=Z("Sorry, we didn't find any templates that match your criteria.","formidable"),a.textContent=Z("Start from Scratch","formidable"),Ft([n,i]),Ct([o,a])}else e?(Pt(o),Ft([n,i])):(Bt(o),o.removeAttribute("data-view"))}()}(r)):a.dispatchEvent(new Event("click",{bubbles:!0}))}}function se(){var t=lt().searchInput;t.value="",t.dispatchEvent(new Event("input",{bubbles:!0}))}var fe=function(){var t=xt().selectedCategory;Lt(t)||(_t("selectedCategory",""),se(),lt().searchInput.focus())};var pe=function(){var t=xt().selectedCategory;Lt(t)&&Re()},me=function(){var t=lt().createTemplateFormsDropdown,e=t.value;if(e&&"no-forms"!==e){de(!1);var r=t.options[t.selectedIndex],n=r.dataset.description.trim(),o=r.dataset.name.trim(),a=" ".concat(Z("Template","formidable"));o.endsWith(a)||(o+=a);var i=lt(),c=i.createTemplateName,l=i.createTemplateDescription;c.value=o,l.value=n}else de(!0)},de=function(t){var e=lt(),r=e.createTemplateName,n=e.createTemplateDescription,o=e.createTemplateButton;[r,n].forEach((function(e){e.disabled=t,t&&(e.value="")})),o.classList.toggle("disabled",t)},he=function(){var t=window.frmAdminBuild.installNewForm,e="frm_create_template",r=lt(),n=r.newTemplateForm,o=r.newTemplateActionInput,a=r.newTemplateNameInput,i=r.newTemplateDescriptionInput,c=r.newTemplateLinkInput,l=r.createTemplateName,u=r.createTemplateDescription,s=r.createTemplateFormsDropdown,f=r.createTemplateButton;o.value=e,a.value=l.value.trim(),i.value=u.value.trim(),c.value=s.value,t(n,e,f)};function ye(t){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(t)}function ve(){ve=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var T=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==ye(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=O(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(ye(e)+" is not iterable")}return g.prototype=b,o(T,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new _(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},S(T),u(T,l,"Generator"),u(T,i,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function ge(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}var be=function(){var t,e=(t=ve().mark((function t(){var e,r,n,o,a,i,c,l,u,s,f,p,m;return ve().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=lt(),n=r.leaveEmailModalInput,o=n.value.trim()){t.next=5;break}return ze("empty"),t.abrupt("return");case 5:if(kt(o)){t.next=8;break}return ze("invalid"),t.abrupt("return");case 8:if(a=lt(),i=a.leaveEmailModalHiddenForm,c=a.leaveEmailModalHiddenInput,i){t.next=11;break}return t.abrupt("return");case 11:return c.value=o,(l=new FormData(i)).append("action","frm_forms_preview"),t.prev=14,t.next=17,fetch(i.getAttribute("action"),{method:"POST",body:l});case 17:return s=t.sent,t.next=20,s.text();case 20:f=t.sent,p=new DOMParser,u=p.parseFromString(f,"text/html"),t.next=29;break;case 25:return t.prev=25,t.t0=t.catch(14),console.error("An error occurred:",t.t0),t.abrupt("return");case 29:(m=null===(e=u.querySelector(".frm_message"))||void 0===e?void 0:e.textContent.trim())&&m.indexOf("Thanks!")>=0?Ge():ze("invalid");case 31:case"end":return t.stop()}}),t,null,[[14,25]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){ge(a,n,o,i,c,"next",t)}function c(t){ge(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Ee(){Ee=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var T=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==we(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=O(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(we(e)+" is not iterable")}return g.prototype=b,o(T,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new _(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},S(T),u(T,l,"Generator"),u(T,i,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function xe(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}var Te=function(){var t,e=(t=Ee().mark((function t(){var e,r,n,o,a,i,l,u,s,f,p,d;return Ee().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=lt(),r=e.codeFromEmailModalInput,n=r.value.trim()){t.next=5;break}return Ve("empty"),t.abrupt("return");case 5:return o=xt(),a=o.selectedTemplate,(i=new FormData).append("action","template_api_signup"),i.append("nonce",c),i.append("code",n),i.append("key",a.dataset.key),t.prev=11,t.next=14,fetch(ajaxurl,{method:"POST",body:i});case 14:return u=t.sent,t.next=17,u.json();case 17:l=t.sent,t.next=24;break;case 20:return t.prev=20,t.t0=t.catch(11),console.error("An error occurred:",t.t0),t.abrupt("return");case 24:if(l.success){t.next=30;break}return f=(null===(s=l)||void 0===s||null===(s=s.data)||void 0===s?void 0:s[0])||{},p=f.message,Ve(p?"custom":"wrong-code",p),Pt(document.getElementById("frm_code_from_email_options")),t.abrupt("return");case 30:if(!x("free-templates")){t.next=33;break}return window.location.href=("free-templates",E.delete("free-templates"),w.search=E.toString(),w.toString()),t.abrupt("return");case 33:if(l.data&&l.data.url){t.next=35;break}return t.abrupt("return");case 35:a.classList.remove("".concat(m,"-locked-item")),(d=a.querySelector(".frm-form-templates-use-template-button")).setAttribute("href",l.data.url),d.dispatchEvent(new Event("click",{bubbles:!0}));case 39:case"end":return t.stop()}}),t,null,[[11,20]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){xe(a,n,o,i,c,"next",t)}function c(t){xe(a,n,o,i,c,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}(),Se=function(){var t=lt(),e=t.leaveEmailModal,r=t.codeFromEmailModal;Bt(r),Pt(e)},_e=function(){var t=lt(),e=t.codeFromEmailModalInput,r=t.leaveEmailModalGetCodeButton;e.value="",Ft(document.querySelectorAll("#frm_code_from_email_options, #frm_code_from_email_error")),r.dispatchEvent(new Event("click",{bubbles:!0}))};var Le=function(t){if(!t.target.closest("a")){var e=t.currentTarget;window.location.href=e.dataset.href}};function Oe(t){var e;(function(t){if(t&&t.length){var e=t.map((function(t){return function(t){var e=t.name,r=t.key,n=t.hasLiteThumbnail?"".concat(vt,"/").concat(r,".png"):"".concat(vt,"/placeholder.svg");return pt("li",{className:"frm-card-item",data:{href:"".concat(u,"&triggerViewApplicationModal=1&template=").concat(r),"frm-search-text":e.toLowerCase()},children:[mt({className:"".concat(m,"-item-icon"),child:yt({src:n})}),mt({className:"".concat(m,"-item-body"),children:[dt({text:Z("Ready Made Solution","formidable"),className:"frm-meta-tag frm-orange-tag frm-text-xs"}),pt("h3",{text:e,className:"frm-text-sm frm-font-medium frm-m-0"}),ht({text:Z("See all applications","formidable"),className:"frm-text-xs frm-font-semibold",href:u})]})]})}(t)}));st=mt({id:"".concat(m,"-applications"),className:d,children:[pt("h2",{text:Z("Application Templates"),className:"frm-text-sm frm-mb-sm"}),pt("ul",{className:"".concat(m,"-list ").concat(m,"-grid-layout"),children:e})]})}})(t.templates),(e=lt()).applicationTemplates||(e.bodyContent.appendChild(st),ut({applicationTemplates:st,applicationTemplatesTitle:st.querySelector("h2"),applicationTemplatesList:st.querySelector(".".concat(m,"-list")),applicationTemplateItems:st.querySelectorAll(".frm-card-item")})),lt().applicationTemplateItems.forEach((function(t){t.addEventListener("click",Le)}))}function Ae(t){return function(t){if(Array.isArray(t))return ke(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ke(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ke(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ke(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ie(){var t=lt(),e=t.pageTitle,r=t.emptyState,n=t.emptyStateButton;r.setAttribute("data-view",v.FAVORITES);var o=lt(),a=o.emptyStateTitle,i=o.emptyStateText;a.textContent=Z("No favorites","formidable"),i.textContent=Z("You haven't added any templates to your favorites yet.","formidable"),Ft([e,n]),Pt(r)}function je(t){return je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(t)}function Ce(){Ce=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),c=new I(n||[]);return o(i,"_invoke",{value:L(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",m="suspendedYield",d="executing",h="completed",y={};function v(){}function g(){}function b(){}var w={};u(w,i,(function(){return this}));var E=Object.getPrototypeOf,x=E&&E(E(j([])));x&&x!==r&&n.call(x,i)&&(w=x);var T=b.prototype=v.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,i,c){var l=f(t[o],t,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==je(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function L(e,r,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===h){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var l=O(c,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?h:m,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=h,n.method="throw",n.arg=u.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function j(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(je(e)+" is not iterable")}return g.prototype=b,o(T,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,l,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},S(_.prototype),u(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new _(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},S(T),u(T,l,"Generator"),u(T,i,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Fe(t,e,r,n,o,a,i){try{var c=t[a](i),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function Pe(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){Fe(a,n,o,i,c,"next",t)}function c(t){Fe(a,n,o,i,c,"throw",t)}i(void 0)}))}}var Be=function(t){return Pe(Ce().mark((function e(){var r,n,o,a,i,c,l=arguments;return Ce().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Zt()){e.next=3;break}return e.abrupt("return");case 3:for(n=lt(),o=n.modalItems,Ft(o),r.dialog("option","width",g),a=l.length,i=new Array(a),c=0;c<a;c++)i[c]=l[c];return e.next=9,null==t?void 0:t.apply(void 0,i);case 9:r.dialog("open");case 10:case"end":return e.stop()}}),e)})))},Me={basic:["basic","plus","business","elite"],plus:["plus","business","elite"],business:["business","elite"],elite:["elite"]},Ne=Be((function(t,e){var r=e.querySelector(".frm-form-template-name").textContent.trim(),n=lt(),o=n.upgradeModal,a=n.upgradeModalTemplateNames,i=n.upgradeModalPlansIcons,c=n.upgradeModalLink;a.forEach((function(t){return t.textContent=r})),i.forEach((function(e){var r=e.dataset.plan,n=Me[t].includes(r);e.classList.toggle("frm_green",n),e.querySelector("svg > use").setAttribute("xlink:href",n?"#frm_checkmark_icon":"#frm_close_icon")}));var l=e.dataset.slug?"-".concat(e.dataset.slug):"";c.href=p+l,Pt(o)})),De=Be((function(){var t=lt().renewAccountModal;Pt(t)})),qe=Be((function(){var t=lt().leaveEmailModal;Pt(t)})),Ge=Be((function(){var t=lt().codeFromEmailModal;Pt(t)})),Re=Be((function(){Zt().dialog("option","width",b);var t=lt().createTemplateModal;Pt(t)})),He=function(t,e,r,n){var o=document.querySelector(t),a=document.querySelector(e);if(n){var i=a.querySelector('span[frm-error="'.concat(r,'"]'));i&&(i.textContent=n)}a.setAttribute("frm-error",r),Pt(a),o.addEventListener("keyup",(function(){Bt(a)}),{once:!0})},ze=function(t){He("#frm_leave_email","#frm_leave_email_error",t)},Ve=function(t,e){He("#frm_code_from_email","#frm_code_from_email_error",t,e)};const Ye=function(){var t,e,r,n,o,a,i,c;ct(),function(){var t=window.frmFormTemplatesVars,e=t.templatesCount,r=t.favoritesCount,n=t.customCount,o=lt(),a=o.allTemplatesCategory,i=o.availableTemplateItems,c=o.freeTemplateItems,l=o.firstLockedFreeTemplate,u=i.length,s=e-u;Et={selectedCategory:v.ALL_TEMPLATES,selectedCategoryEl:a,selectedTemplate:l,notEmptySearchText:!1,favoritesCount:r,customCount:Number(n),availableTemplatesCount:u,freeTemplatesCount:c.length,extraTemplatesCount:s}}(),l&&(0,frmDom.ajax.doJsonFetch)("get_applications_data&view=templates").then(Oe),function(){var t=lt(),e=t.sidebar,r=t.searchInput,n=t.bodyContent,o=t.twinFeaturedTemplateItems,a=t.availableTemplatesCategory,i=t.freeTemplatesCategory,c=new qt(n);if(r.value="",Ft(o),a){var l=xt().availableTemplatesCount;a.querySelector(".frm-form-templates-cat-count").textContent=l}var u=xt().freeTemplatesCount;i.querySelector(".frm-form-templates-cat-count").textContent=u,0===u&&Bt(i);var s,f=lt().extraTemplateCountElements,p=xt().extraTemplatesCount;f.forEach((function(t){return t.textContent=p})),n.classList.remove(h),e.classList.remove(h),c.fadeIn(),Pt(e),x("return_page")&&(s=lt().headerCancelButton,new qt(s).fadeIn())}(),function(){$t.apply(this,arguments)}(),lt().templateItems.forEach((function(t){t.getAttribute("data-categories").split(",").forEach((function(e){Qt[e]||(Qt[e]=[]),Qt[e].push(t)}))})),document.querySelectorAll(".".concat(m,"-cat-item")).forEach((function(t){Rt(t,Wt),t.addEventListener("keydown",te)})),c=lt().createFormButton,Rt(c,ee),document.querySelectorAll(re).forEach((function(t){return Rt(t,ie)})),document.querySelectorAll(".".concat(m,"-use-template-button")).forEach((function(t){return t.addEventListener("click",ce)})),i=lt().searchInput,le(i,"frm-card-item",{handleSearchResult:ue}),a=lt().emptyStateButton,Rt(a,fe),function(){var t=lt(),e=t.createTemplateFormsDropdown,r=t.createTemplateButton,n=t.showCreateTemplateModalButton,o=t.emptyStateButton;Rt(n,pe),Rt(o,pe),e.addEventListener("change",me),Rt(r,he)}(),o=lt().leaveEmailModalGetCodeButton,Rt(o,be),t=document.getElementById("frm-confirm-email-address"),e=document.getElementById("frm-code-modal-back-button"),r=document.getElementById("frm-change-email-address"),n=document.getElementById("frm-resend-code"),Rt(t,Te),Rt(e,Se),Rt(r,Se),Rt(n,_e)};var Ue;Ue=function(){wp.hooks.doAction("frmFormTemplates.beforeInitialize",{getAppState:xt,setAppState:Tt}),Ye(),wp.hooks.doAction("frmFormTemplates.afterInitialize",{getAppState:xt,setAppState:Tt}),wp.hooks.doAction("frm_new_form_modal_form",jQuery("#frm-new-template"))},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",Ue):Ue())})()})();