/home/devfahim/www/fluentlab.devfahim.site/wp-content/plugins/thim-elementor-kit/build/admin.js
(()=>{"use strict";var e={493:(e,t,n)=>{var r=n(609),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return l((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),s(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},609:e=>{e.exports=window.React},888:(e,t,n)=>{e.exports=n(493)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const r=window.wp.element,o=window.wp.i18n,i=window.wp.components,a=window.wp.apiFetch;var l=n.n(a),s=n(609),c=Object.prototype.hasOwnProperty;const u=new WeakMap,d=()=>{},m=d(),h=Object,p=e=>e===m,f=e=>"function"==typeof e,g=(e,t)=>({...e,...t}),y=e=>f(e.then),v={},E={},w="undefined",_=typeof window!=w,k=typeof document!=w,b=_&&"Deno"in window,S=(e,t)=>{const n=u.get(e);return[()=>!p(t)&&e.get(t)||v,r=>{if(!p(t)){const o=e.get(t);t in E||(E[t]=o),n[5](t,g(o,r),o||v)}},n[6],()=>!p(t)&&t in E?E[t]:!p(t)&&e.get(t)||v]};let C=!0;const[O,x]=_&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[d,d],T={isOnline:()=>C,isVisible:()=>{const e=k&&document.visibilityState;return p(e)||"hidden"!==e}},L={initFocus:e=>(k&&document.addEventListener("visibilitychange",e),O("focus",e),()=>{k&&document.removeEventListener("visibilitychange",e),x("focus",e)}),initReconnect:e=>{const t=()=>{C=!0,e()},n=()=>{C=!1};return O("online",t),O("offline",n),()=>{x("online",t),x("offline",n)}}},R=!s.useId,P=!_||b,D=P?s.useEffect:s.useLayoutEffect,j="undefined"!=typeof navigator&&navigator.connection,M=!P&&j&&(["slow-2g","2g"].includes(j.effectiveType)||j.saveData),F=new WeakMap,I=(e,t)=>h.prototype.toString.call(e)===`[object ${t}]`;let V=0;const N=e=>{const t=typeof e,n=I(e,"Date"),r=I(e,"RegExp"),o=I(e,"Object");let i,a;if(h(e)!==e||n||r)i=n?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(i=F.get(e),i)return i;if(i=++V+"~",F.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=N(e[a])+",";F.set(e,i)}if(o){i="#";const t=h.keys(e).sort();for(;!p(a=t.pop());)p(e[a])||(i+=a+":"+N(e[a])+",");F.set(e,i)}}return i},W=e=>{if(f(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?N(e):"",t]};let A=0;const B=()=>++A;async function q(...e){const[t,n,r,o]=e,i=g({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const l=i.rollbackOnError;let s=i.optimisticData;const c=i.throwOnError;if(f(n)){const e=n,r=[],o=t.keys();for(const n of o)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&r.push(n);return Promise.all(r.map(d))}return d(n);async function d(n){const[o]=W(n);if(!o)return;const[d,h]=S(t,o),[g,v,E,w]=u.get(t),_=()=>{const e=g[o];return(f(i.revalidate)?i.revalidate(d().data,n):!1!==i.revalidate)&&(delete E[o],delete w[o],e&&e[0])?e[0](2).then((()=>d().data)):d().data};if(e.length<3)return _();let k,b=r;const C=B();v[o]=[C,0];const O=!p(s),x=d(),T=x.data,L=x._c,R=p(L)?T:L;if(O&&(s=f(s)?s(R,T):s,h({data:s,_c:R})),f(b))try{b=b(R)}catch(e){k=e}if(b&&y(b)){if(b=await b.catch((e=>{k=e})),C!==v[o][0]){if(k)throw k;return b}k&&O&&(e=>"function"==typeof l?l(e):!1!==l)(k)&&(a=!0,h({data:R,_c:m}))}if(a&&!k)if(f(a)){const e=a(b,R);h({data:e,error:m,_c:m})}else h({data:b,error:m,_c:m});if(v[o][1]=B(),Promise.resolve(_()).then((()=>{h({_c:m})})),!k)return b;if(c)throw k}}const K=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},$=(e,t)=>{if(!u.has(e)){const n=g(L,t),r=Object.create(null),o=q.bind(m,e);let i=d;const a=Object.create(null),l=(e,t)=>{const n=a[e]||[];return a[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},s=(t,n,r)=>{e.set(t,n);const o=a[t];if(o)for(const e of o)e(n,r)},c=()=>{if(!u.has(e)&&(u.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,s,l]),!P)){const t=n.initFocus(setTimeout.bind(m,K.bind(m,r,0))),o=n.initReconnect(setTimeout.bind(m,K.bind(m,r,1)));i=()=>{t&&t(),o&&o(),u.delete(e)}}};return c(),[e,o,c,i]}return[e,u.get(e)[4]]},[U,z]=$(new Map),H=g({onLoadingSlow:d,onSuccess:d,onError:d,onErrorRetry:(e,__,t,n,r)=>{const o=t.errorRetryCount,i=r.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*t.errorRetryInterval;!p(o)&&i>o||setTimeout(n,a,r)},onDiscarded:d,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:M?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:M?5e3:3e3,compare:function e(t,n){var r,o;if(t===n)return!0;if(t&&n&&(r=t.constructor)===n.constructor){if(r===Date)return t.getTime()===n.getTime();if(r===RegExp)return t.toString()===n.toString();if(r===Array){if((o=t.length)===n.length)for(;o--&&e(t[o],n[o]););return-1===o}if(!r||"object"==typeof t){for(r in o=0,t){if(c.call(t,r)&&++o&&!c.call(n,r))return!1;if(!(r in n)||!e(t[r],n[r]))return!1}return Object.keys(n).length===o}}return t!=t&&n!=n},isPaused:()=>!1,cache:U,mutate:z,fallback:{}},T),J=(e,t)=>{const n=g(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:a}=t;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=g(o,a))}return n},Q=(0,s.createContext)({}),G=_&&window.__SWR_DEVTOOLS_USE__,X=G?window.__SWR_DEVTOOLS_USE__:[],Y=X.concat((e=>(t,n,r)=>e(t,n&&((...e)=>{const[r]=W(t),[,,,o]=u.get(U);if(r.startsWith("$inf$"))return n(...e);const i=o[r];return p(i)?n(...e):(delete o[r],i)}),r)));G&&(window.__SWR_DEVTOOLS_REACT__=s);var Z=n(888);const ee=()=>{};ee(),new WeakMap;const te=s.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e}}),ne={dedupe:!0},re=(h.defineProperty((e=>{const{value:t}=e,n=(0,s.useContext)(Q),r=f(t),o=(0,s.useMemo)((()=>r?t(n):t),[r,n,t]),i=(0,s.useMemo)((()=>r?o:J(n,o)),[r,n,o]),a=o&&o.provider,l=(0,s.useRef)(m);a&&!l.current&&(l.current=$(a(i.cache||U),o));const c=l.current;return c&&(i.cache=c[0],i.mutate=c[1]),D((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,s.createElement)(Q.Provider,g(e,{value:i}))}),"defaultValue",{value:H}),oe=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:a,revalidateOnMount:l,revalidateIfStale:c,refreshInterval:d,refreshWhenHidden:h,refreshWhenOffline:v,keepPreviousData:E}=n,[k,b,C,O]=u.get(r),[x,T]=W(e),L=(0,s.useRef)(!1),j=(0,s.useRef)(!1),M=(0,s.useRef)(x),F=(0,s.useRef)(t),I=(0,s.useRef)(n),V=()=>I.current,N=()=>V().isVisible()&&V().isOnline(),[A,K,$,U]=S(r,x),z=(0,s.useRef)({}).current,H=p(a)?p(n.fallback)?m:n.fallback[x]:a,J=(e,t)=>{for(const n in z){const r=n;if("data"===r){if(!o(e[r],t[r])){if(!p(e[r]))return!1;if(!o(ae,t[r]))return!1}}else if(t[r]!==e[r])return!1}return!0},Q=(0,s.useMemo)((()=>{const e=!!x&&!!t&&(p(l)?!V().isPaused()&&!i&&!1!==c:l),n=t=>{const n=g(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},r=A(),o=U(),a=n(r),s=r===o?a:n(o);let u=a;return[()=>{const e=n(A());return J(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>s]}),[r,x]),G=(0,Z.useSyncExternalStore)((0,s.useCallback)((e=>$(x,((t,n)=>{J(n,t)||e()}))),[r,x]),Q[0],Q[1]),X=!L.current,Y=k[x]&&k[x].length>0,ee=G.data,re=p(ee)?H&&y(H)?te(H):H:ee,oe=G.error,ie=(0,s.useRef)(re),ae=E?p(ee)?p(ie.current)?re:ie.current:ee:re,le=!(Y&&!p(oe))&&(X&&!p(l)?l:!V().isPaused()&&(i?!p(re)&&c:p(re)||c)),se=!!(x&&t&&X&&le),ce=p(G.isValidating)?se:G.isValidating,ue=p(G.isLoading)?se:G.isLoading,de=(0,s.useCallback)((async e=>{const t=F.current;if(!x||!t||j.current||V().isPaused())return!1;let r,i,a=!0;const l=e||{},s=!C[x]||!l.dedupe,c=()=>R?!j.current&&x===M.current&&L.current:x===M.current,u={isValidating:!1,isLoading:!1},d=()=>{K(u)},h=()=>{const e=C[x];e&&e[1]===i&&delete C[x]},g={isValidating:!0};p(A().data)&&(g.isLoading=!0);try{if(s&&(K(g),n.loadingTimeout&&p(A().data)&&setTimeout((()=>{a&&c()&&V().onLoadingSlow(x,n)}),n.loadingTimeout),C[x]=[t(T),B()]),[r,i]=C[x],r=await r,s&&setTimeout(h,n.dedupingInterval),!C[x]||C[x][1]!==i)return s&&c()&&V().onDiscarded(x),!1;u.error=m;const e=b[x];if(!p(e)&&(i<=e[0]||i<=e[1]||0===e[1]))return d(),s&&c()&&V().onDiscarded(x),!1;const l=A().data;u.data=o(l,r)?l:r,s&&c()&&V().onSuccess(r,x,n)}catch(e){h();const t=V(),{shouldRetryOnError:n}=t;t.isPaused()||(u.error=e,s&&c()&&(t.onError(e,x,t),(!0===n||f(n)&&n(e))&&(V().revalidateOnFocus&&V().revalidateOnReconnect&&!N()||t.onErrorRetry(e,x,t,(e=>{const t=k[x];t&&t[0]&&t[0](3,e)}),{retryCount:(l.retryCount||0)+1,dedupe:!0}))))}return a=!1,d(),!0}),[x,r]),me=(0,s.useCallback)(((...e)=>q(r,M.current,...e)),[]);if(D((()=>{F.current=t,I.current=n,p(ee)||(ie.current=ee)})),D((()=>{if(!x)return;const e=de.bind(m,ne);let t=0;if(V().revalidateOnFocus){const e=Date.now();t=e+V().focusThrottleInterval}const n=((e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const e=r.indexOf(n);e>=0&&(r[e]=r[r.length-1],r.pop())}})(x,k,((n,r={})=>{if(0==n){const n=Date.now();V().revalidateOnFocus&&n>t&&N()&&(t=n+V().focusThrottleInterval,e())}else if(1==n)V().revalidateOnReconnect&&N()&&e();else{if(2==n)return de();if(3==n)return de(r)}}));return j.current=!1,M.current=x,L.current=!0,K({_k:T}),le&&(p(re)||P?e():(r=e,_&&typeof window.requestAnimationFrame!=w?window.requestAnimationFrame(r):setTimeout(r,1))),()=>{j.current=!0,n()};var r}),[x]),D((()=>{let e;function t(){const t=f(d)?d(A().data):d;t&&-1!==e&&(e=setTimeout(n,t))}function n(){A().error||!h&&!V().isVisible()||!v&&!V().isOnline()?t():de(ne).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[d,h,v,x]),(0,s.useDebugValue)(ae),i&&p(re)&&x){if(!R&&P)throw new Error("Fallback data is required when using Suspense in SSR.");F.current=t,I.current=n,j.current=!1;const e=O[x];if(!p(e)){const t=me(e);te(t)}if(!p(oe))throw oe;{const e=de(ne);p(ae)||(e.status="fulfilled",e.value=!0),te(e)}}return{mutate:me,get data(){return z.data=!0,ae},get error(){return z.error=!0,oe},get isValidating(){return z.isValidating=!0,ce},get isLoading(){return z.isLoading=!0,ue}}},function(...e){const t=g(H,(0,s.useContext)(Q)),[n,r,o]=(e=>f(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}])(e),i=J(t,o);let a=oe;const{use:l}=i,c=(l||[]).concat(Y);for(let e=c.length;e--;)a=c[e](a);return a(n,r||i.fetcher||null,i)});var oe;const ie=window.lodash,ae=window.wp.url;function le({value:e,onChange:t,type:n}){const[a,s]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),{data:d,error:m,isLoading:h}=re((0,ae.addQueryArgs)("/thim-ekit/select-query-conditions",{search:c,type:n}),(e=>l()({path:e}))),p=(0,r.useCallback)((0,ie.debounce)((e=>u(e)),600),[]);return(0,r.createElement)("div",{style:{flex:1}},(0,r.createElement)(i.Dropdown,{style:{width:"100%"},placement:"bottom center",renderToggle:({isOpen:t,onToggle:n})=>(0,r.createElement)("button",{type:"button",className:"components-button is-secondary",style:{minWidth:160,width:"100%",maxWidth:280,height:36,justifyContent:"space-between",color:"rgb(30, 30, 30)"},onClick:n},(0,r.createElement)("span",{style:{display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},d&&d.find((t=>t.id===e))?.title||"Select"),(0,r.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",role:"img","aria-hidden":"true",focusable:"false"},(0,r.createElement)("path",{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}))),renderContent:({onToggle:e})=>(0,r.createElement)(r.Fragment,null,m?(0,r.createElement)("p",null,(0,o.__)("Error")):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.TextControl,{value:a,style:{minWidth:200},onChange:e=>{s(e),p(e)}}),h&&(0,r.createElement)(i.Spinner,null),d&&d.length>0&&d.map((n=>(0,r.createElement)(i.MenuItem,{key:n.id,onClick:()=>{t(n.id),e()}},n.title)))))}))}function se({conditions:e,setConditions:t,type:n}){const a=new URL(location.href),l=n||a.searchParams.get("thim_elementor_type"),s=(n,r,o)=>{const i=[...e];i[n][r]=o,t(i)};return(0,r.createElement)("div",null,e.map(((n,a)=>(0,r.createElement)("div",{key:a,style:{display:"flex",gap:10,paddingBottom:5}},(0,r.createElement)("div",{style:{flex:1}},(0,r.createElement)(i.SelectControl,{style:{height:36},value:n.comparison,options:[{label:(0,o.__)("Include","thim-elementor-kit-pro"),value:"include"},{label:(0,o.__)("Exclude","thim-elementor-kit-pro"),value:"exclude"}],onChange:e=>s(a,"comparison",e)})),(0,r.createElement)("div",{style:{flex:1}},(0,r.createElement)(i.SelectControl,{style:{height:36},value:n.type,options:thimEKit?.list_conditions?.[l],onChange:e=>s(a,"type",e)})),thimEKit?.list_conditions?.[l].find((e=>e.value===n.type))?.is_query&&(0,r.createElement)(le,{type:n.type,value:n.query,onChange:e=>s(a,"query",e)}),(0,r.createElement)(i.Button,{variant:"secondary",style:{height:36},label:"Remove",showTooltip:!0,onClick:()=>(n=>{const r=[...e];r.splice(n,1),t(r)})(a)},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{width:20,height:20}},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})))))),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>t([...e,{comparison:"include",type:"all",query:null}])},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{width:18,height:18}},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})),(0,o.__)("Add condition","thim-elementor-kit-pro")))}const ce="undefined"!=typeof thimEKit?thimEKit.types:[];function ue({open:e,setOpen:t}){const[n,a]=(0,r.useState)(""),[s,c]=(0,r.useState)(""),[u,d]=(0,r.useState)([]),[m,h]=(0,r.useState)([]),[p,f]=(0,r.useState)({id:0,isPro:!1}),[g,y]=(0,r.useState)(!1),[v,E]=(0,r.useState)("post"),[w,_]=(0,r.useState)(!1),[k,b]=(0,r.useState)({status:"",message:""}),{data:S,error:C,isLoading:O}=re("/thim-ekit/get-layout-libraries",(e=>l()({path:e})));return(0,r.useEffect)((()=>{if(S){const e=[],t=[];S?.free?.[n]&&(Object.entries(S.free[n]).forEach((([t,n])=>{n?.loop_type&&n?.loop_type!==v||e.push({...n,id:parseFloat(t),isPro:!1})})),e.sort(((e,t)=>e.priority-t.priority))),S?.theme?.[n]&&(Object.entries(S.theme[n]).forEach((([e,n])=>{n?.loop_type&&n?.loop_type!==v||t.push({...n,id:parseFloat(e),isPro:!0})})),t.sort(((e,t)=>e.priority-t.priority))),h([...e,...t])}}),[S,n,v]),(0,r.useEffect)((()=>{!function(){const e=new URL(location.href).searchParams.get("thim_elementor_type");e&&a(e)}()}),[]),(0,r.createElement)(i.SlotFillProvider,null,(0,r.createElement)(i.Modal,{className:"thim-ekit__modal",focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,title:(0,o.__)("Add new template","thim-elementor-kit"),onRequestClose:()=>t(!1)},(0,r.createElement)(r.Fragment,null,(0,r.createElement)("form",{onSubmit:e=>{e.preventDefault(),async function(){_(!0);try{const e=await l()({path:"thim-ekit/create-template",method:"POST",data:{name:s,type:n,sticky:g,conditions:u,layout:p,loopType:v}});b({status:e.status,message:e.message||""}),_(!1),e?.data?.redirect&&(window.location.href=e.data.redirect)}catch(e){b({status:"error",message:e.message||""}),_(!1)}}()}},(0,r.createElement)(i.SelectControl,{label:(0,o.__)("Select the type","thim-elementor-kit"),value:n,onChange:e=>{a(e),f({id:0,isPro:!1})},options:ce}),(0,r.createElement)(i.TextControl,{label:(0,o.__)("Template name","thim-elementor-kit"),placeholder:(0,o.__)("Enter template nameā¦","thim-elementor-kit"),value:s,onChange:e=>c(e)}),"header"===n&&(0,r.createElement)(i.CheckboxControl,{label:(0,o.__)("Enable sticky","thim-elementor-kit"),checked:g,onChange:y}),"loop_item"===n&&thimEKit?.loop_item?.post_type&&(0,r.createElement)(i.SelectControl,{label:(0,o.__)("Select post type","thim-elementor-kit"),value:v,onChange:e=>{E(e),f({id:0,isPro:!1})},options:thimEKit?.loop_item?.post_type||[]}),thimEKit?.list_conditions?.[n]&&(0,r.createElement)(i.BaseControl,{id:"thim-elementor-kit-pro-conditions",label:(0,o.__)("Conditions","thim-elementor-kit")},(0,r.createElement)(se,{conditions:u,setConditions:d,type:n})),n&&(0,r.createElement)(r.Fragment,null,O?(0,r.createElement)(i.Spinner,null):(0,r.createElement)(r.Fragment,null,!C&&m.length>0&&(0,r.createElement)(i.BaseControl,{id:"thim-elementor-kit-layouts",label:(0,o.__)("Select Layouts","thim-elementor-kit")},(0,r.createElement)("div",{className:"thim-elementor-kit-layouts"},m.map((e=>(0,r.createElement)("div",{key:e.id,className:"thim-elementor-kit-layouts__item "+(e.id===p.id?"thim-elementor-kit-layouts__item--active":""),onClick:()=>f({id:e.id!==p.id?e.id:0,isPro:e.isPro}),onKeyDown:()=>f({id:e.id!==p.id?e.id:0,isPro:e.isPro}),"aria-hidden":"true"},(0,r.createElement)("img",{src:e.thumbnail,alt:e?.title||""}),e.isPro&&(0,r.createElement)("span",{className:"thim-elementor-kit-layouts__item__pro"},(0,o.__)("Pro","thim-elementor-kit")),e.title&&(0,r.createElement)("span",{className:"thim-elementor-kit-layouts__item__label"},e.title)))))))),(0,r.createElement)("div",{style:{display:"flex",gap:10,margin:"20px 0 0 0",borderTop:"1px solid #eee",paddingTop:20}},(0,r.createElement)(i.Button,{variant:"primary",type:"submit",icon:w?(0,r.createElement)(i.Spinner,null):""},(0,o.__)("Create template","thim-elementor-kit")))),k.status&&(0,r.createElement)(i.Notice,{status:k.status,isDismissible:!1},(0,r.createElement)("p",{dangerouslySetInnerHTML:{__html:k?.message||(0,o.__)("No data available","thim-elementor-kit")}})))),(0,r.createElement)(i.Popover.Slot,null))}function de({open:e,setOpen:t,postID:n}){const[a,s]=(0,r.useState)(""),[c,u]=(0,r.useState)(""),[d,m]=(0,r.useState)([]);return(0,r.useEffect)((()=>{e&&async function(){s("fetch");const e=await l()({path:`/thim-ekit/get-conditions?postID=${n}`});e&&m(e),s("")}()}),[]),(0,r.createElement)(i.SlotFillProvider,null,(0,r.createElement)(i.Modal,{className:"thim-edit-module__modal",focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,title:(0,o.__)("Edit template","thim-elementor-kit-pro"),onRequestClose:()=>t(!1)},"fetch"===a?(0,r.createElement)("div",{style:{textAlign:"center",padding:20}},(0,r.createElement)(i.Spinner,{style:{height:"20px",width:"20px"}})):(0,r.createElement)("div",{className:"thim-edit-module__modal__content",style:{paddingTop:5}},(0,r.createElement)(se,{conditions:d,setConditions:m}),(0,r.createElement)("div",{style:{display:"flex",gap:10,margin:"20px 0 0 0",borderTop:"1px solid #eee",paddingTop:20}},(0,r.createElement)(i.Button,{variant:"primary",onClick:async()=>{try{s("save");const e=await l()({path:"/thim-ekit/save-conditions",method:"POST",data:{conditions:d,postID:n}});if(!e?.success)throw new Error(e?.message||(0,o.__)("Something went wrong!","thim-elementor-kit"));t(!1)}catch(e){u(e.message)}finally{s("")}},disabled:""!==a},"save"===a&&(0,r.createElement)(i.Spinner,{style:{margin:"0 5px 0 0"}}),(0,o.__)("Save","thim-elementor-kit-pro")),(0,r.createElement)(i.Button,{variant:"secondary",text:"Close",onClick:()=>t(!1)})),c&&(0,r.createElement)("div",{style:{margin:"10px -15px 0"}},(0,r.createElement)(i.Notice,{status:"error",isDismissible:!1},c)))),(0,r.createElement)(i.Popover.Slot,null))}ce.unshift({value:"",label:(0,o.__)("Default","thim-elementor-kit")}),(()=>{const[e,t]=W("/thim-ekit/get-layout-libraries"),[,,,n]=u.get(U);if(n[e])return n[e];const r=(o=t,l()({path:o}));var o;n[e]=r})(),(0,r.render)((0,r.createElement)((function(){const[e,t]=(0,r.useState)(!1),[n,a]=(0,r.useState)(0),[l,s]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=document.querySelector(".page-title-action"),n=document.querySelector(".wp-heading-inline");function r(){-1!==location.hash.indexOf("edit_condition_")&&(a(location.hash.replace("#edit_condition_","")),s(!0),location.hash=""),"#add_new"===location.hash&&(t(!0),location.hash="")}return e&&e.remove(),n&&n.remove(),r(),window.addEventListener("hashchange",(()=>{r()}),!1),()=>{window.removeEventListener("hashchange",(()=>{r()}),!1)}}),[]),(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"thim-ekit"},(0,r.createElement)("div",{className:"thim-ekit__inner"},(0,r.createElement)("h1",{className:"thim-ekit__heading"},(0,o.__)("Thim Elementor Templates","thim-elementor-kit")),(0,r.createElement)(i.Button,{variant:"primary",onClick:()=>t(!e)},(0,o.__)("Add new","thim-elementor-kit"))),(0,r.createElement)("div",null,(0,r.createElement)("a",{href:"https://thimpress.com/contact-us/",className:"thim-ekit__contact"},(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},(0,r.createElement)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z"})),(0,o.__)("Contact us","thim-elementor-kit")))),e&&(0,r.createElement)(ue,{open:e,setOpen:t}),l&&(0,r.createElement)(de,{open:l,setOpen:s,postID:n}))}),null),document.getElementById("thim-elementor-header"))})();