(function(){"use strict";var gt={1609:(function(e){e.exports=window.React}),3593:(function(e,t,n){e.exports=n(3691)}),3691:(function(e,t,n){/** @license React v17.0.2
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */n(9645);var r=n(1609),a=60103;if(t.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var c=Symbol.for;a=c("react.element"),t.Fragment=c("react.fragment")}var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function g(d,o,m){var p,f={},w=null,j=null;m!==void 0&&(w=""+m),o.key!==void 0&&(w=""+o.key),o.ref!==void 0&&(j=o.ref);for(p in o)i.call(o,p)&&!l.hasOwnProperty(p)&&(f[p]=o[p]);if(d&&d.defaultProps)for(p in o=d.defaultProps,o)f[p]===void 0&&(f[p]=o[p]);return{$$typeof:a,type:d,key:w,ref:j,props:f,_owner:s.current}}t.jsx=g,t.jsxs=g}),8140:(function(e,t,n){/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var r=n(1609);function a(f,w){return f===w&&(f!==0||1/f===1/w)||f!==f&&w!==w}var c=typeof Object.is=="function"?Object.is:a,s=r.useState,i=r.useEffect,l=r.useLayoutEffect,g=r.useDebugValue;function d(f,w){var j=w(),$=s({inst:{value:j,getSnapshot:w}}),u=$[0].inst,z=$[1];return l(function(){u.value=j,u.getSnapshot=w,o(u)&&z({inst:u})},[f,j,w]),i(function(){return o(u)&&z({inst:u}),f(function(){o(u)&&z({inst:u})})},[f]),g(j),j}function o(f){var w=f.getSnapshot;f=f.value;try{var j=w();return!c(f,j)}catch{return!0}}function m(f,w){return w()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:d;t.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:p}),8279:(function(e,t,n){e.exports=n(8140)}),9645:(function(e){/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function c(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var i={},l=0;l<10;l++)i["_"+String.fromCharCode(l)]=l;var g=Object.getOwnPropertyNames(i).map(function(o){return i[o]});if(g.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(o){d[o]=o}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}e.exports=c()?Object.assign:function(s,i){for(var l,g=a(s),d,o=1;o<arguments.length;o++){l=Object(arguments[o]);for(var m in l)n.call(l,m)&&(g[m]=l[m]);if(t){d=t(l);for(var p=0;p<d.length;p++)r.call(l,d[p])&&(g[d[p]]=l[d[p]])}}return g}})},Ue={};function P(e){var t=Ue[e];if(t!==void 0)return t.exports;var n=Ue[e]={exports:{}};return gt[e](n,n.exports,P),n.exports}(function(){P.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return P.d(t,{a:t}),t}})(),(function(){P.d=function(e,t){for(var n in t)P.o(t,n)&&!P.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){P.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var dn={},h=P(3593),v=window.wp.i18n,Be=window.wp.blocks,mt=window.wp.serverSideRender,$e=P.n(mt),D=window.wp.components,ue=window.wp.blockEditor,wt=(e=>(e[e.Search=1]="Search",e[e.Settings=2]="Settings",e[e.Results=3]="Results",e))(wt||{}),bt=({instance:e,shortcodeType:t})=>{let n="wd_asp";const r=parseInt(t.toString());return r===2?n="wpdreams_asp_settings":r===3&&(n="wpdreams_ajaxsearchpro_results"),`[${n} id=${e}]`},b=P(1609),He=P(8279);const ze=0,Je=1,Ge=2,Ke=3;var Ye=Object.prototype.hasOwnProperty;function me(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&me(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(Ye.call(e,n)&&++r&&!Ye.call(t,n)||!(n in t)||!me(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const q=new WeakMap,U=()=>{},C=U(),fe=Object,_=e=>e===C,A=e=>typeof e=="function",B=(e,t)=>({...e,...t}),Qe=e=>A(e.then),we={},de={},be="undefined",oe=typeof window!=be,xe=typeof document!=be,xt=oe&&"Deno"in window,St=()=>oe&&typeof window.requestAnimationFrame!=be,Xe=(e,t)=>{const n=q.get(e);return[()=>!_(t)&&e.get(t)||we,r=>{if(!_(t)){const a=e.get(t);t in de||(de[t]=a),n[5](t,B(a,r),a||we)}},n[6],()=>!_(t)&&t in de?de[t]:!_(t)&&e.get(t)||we]};let Se=!0;const jt=()=>Se,[je,ye]=oe&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[U,U],yt=()=>{const e=xe&&document.visibilityState;return _(e)||e!=="hidden"},Ot=e=>(xe&&document.addEventListener("visibilitychange",e),je("focus",e),()=>{xe&&document.removeEventListener("visibilitychange",e),ye("focus",e)}),Et=e=>{const t=()=>{Se=!0,e()},n=()=>{Se=!1};return je("online",t),je("offline",n),()=>{ye("online",t),ye("offline",n)}},Rt={isOnline:jt,isVisible:yt},Ct={initFocus:Ot,initReconnect:Et},Ze=!b.useId,Y=!oe||xt,Tt=e=>St()?window.requestAnimationFrame(e):setTimeout(e,1),pe=Y?b.useEffect:b.useLayoutEffect,Oe=typeof navigator<"u"&&navigator.connection,et=!Y&&Oe&&(["slow-2g","2g"].includes(Oe.effectiveType)||Oe.saveData),_e=new WeakMap,Dt=e=>fe.prototype.toString.call(e),Ee=(e,t)=>e===`[object ${t}]`;let Pt=0;const Re=e=>{const t=typeof e,n=Dt(e),r=Ee(n,"Date"),a=Ee(n,"RegExp"),c=Ee(n,"Object");let s,i;if(fe(e)===e&&!r&&!a){if(s=_e.get(e),s)return s;if(s=++Pt+"~",_e.set(e,s),Array.isArray(e)){for(s="@",i=0;i<e.length;i++)s+=Re(e[i])+",";_e.set(e,s)}if(c){s="#";const l=fe.keys(e).sort();for(;!_(i=l.pop());)_(e[i])||(s+=i+":"+Re(e[i])+",");_e.set(e,s)}}else s=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return s},Ce=e=>{if(A(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Re(e):"",[e,t]};let It=0;const Te=()=>++It;async function tt(...e){const[t,n,r,a]=e,c=B({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let s=c.populateCache;const i=c.rollbackOnError;let l=c.optimisticData;const g=m=>typeof i=="function"?i(m):i!==!1,d=c.throwOnError;if(A(n)){const m=n,p=[],f=t.keys();for(const w of f)!/^\$(inf|sub)\$/.test(w)&&m(t.get(w)._k)&&p.push(w);return Promise.all(p.map(o))}return o(n);async function o(m){const[p]=Ce(m);if(!p)return;const[f,w]=Xe(t,p),[j,$,u,z]=q.get(t),Q=()=>{const N=j[p];return(A(c.revalidate)?c.revalidate(f().data,m):c.revalidate!==!1)&&(delete u[p],delete z[p],N&&N[0])?N[0](Ge).then(()=>f().data):f().data};if(e.length<3)return Q();let T=r,F,k=!1;const X=Te();$[p]=[X,0];const S=!_(l),Z=f(),M=Z.data,ee=Z._c,J=_(ee)?M:ee;if(S&&(l=A(l)?l(J,M):l,w({data:l,_c:J})),A(T))try{T=T(J)}catch(N){F=N,k=!0}if(T&&Qe(T))if(T=await T.catch(N=>{F=N,k=!0}),X!==$[p][0]){if(k)throw F;return T}else k&&S&&g(F)&&(s=!0,w({data:J,_c:C}));if(s&&!k)if(A(s)){const N=s(T,J);w({data:N,error:C,_c:C})}else w({data:T,error:C,_c:C});if($[p][1]=Te(),Promise.resolve(Q()).then(()=>{w({_c:C})}),k){if(d)throw F;return}return T}}const nt=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},rt=(e,t)=>{if(!q.has(e)){const n=B(Ct,t),r=Object.create(null),a=tt.bind(C,e);let c=U;const s=Object.create(null),i=(d,o)=>{const m=s[d]||[];return s[d]=m,m.push(o),()=>m.splice(m.indexOf(o),1)},l=(d,o,m)=>{e.set(d,o);const p=s[d];if(p)for(const f of p)f(o,m)},g=()=>{if(!q.has(e)&&(q.set(e,[r,Object.create(null),Object.create(null),Object.create(null),a,l,i]),!Y)){const d=n.initFocus(setTimeout.bind(C,nt.bind(C,r,ze))),o=n.initReconnect(setTimeout.bind(C,nt.bind(C,r,Je)));c=()=>{d&&d(),o&&o(),q.delete(e)}}};return g(),[e,a,g,c]}return[e,q.get(e)[4]]},Lt=(e,t,n,r,a)=>{const c=n.errorRetryCount,s=a.retryCount,i=~~((Math.random()+.5)*(1<<(s<8?s:8)))*n.errorRetryInterval;!_(c)&&s>c||setTimeout(r,i,a)},At=me,[De,Nt]=rt(new Map),st=B({onLoadingSlow:U,onSuccess:U,onError:U,onErrorRetry:Lt,onDiscarded:U,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:et?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:et?5e3:3e3,compare:At,isPaused:()=>!1,cache:De,mutate:Nt,fallback:{}},Rt),ot=(e,t)=>{const n=B(e,t);if(t){const{use:r,fallback:a}=e,{use:c,fallback:s}=t;r&&c&&(n.use=r.concat(c)),a&&s&&(n.fallback=B(a,s))}return n},Pe=(0,b.createContext)({}),Vt=e=>{const{value:t}=e,n=(0,b.useContext)(Pe),r=A(t),a=(0,b.useMemo)(()=>r?t(n):t,[r,n,t]),c=(0,b.useMemo)(()=>r?a:ot(n,a),[r,n,a]),s=a&&a.provider,i=(0,b.useRef)(C);s&&!i.current&&(i.current=rt(s(c.cache||De),a));const l=i.current;return l&&(c.cache=l[0],c.mutate=l[1]),pe(()=>{if(l)return l[2]&&l[2](),l[3]},[]),(0,b.createElement)(Pe.Provider,B(e,{value:c}))},Ft="$inf$",at=oe&&window.__SWR_DEVTOOLS_USE__,kt=at?window.__SWR_DEVTOOLS_USE__:[],Mt=()=>{at&&(window.__SWR_DEVTOOLS_REACT__=b)},it=e=>A(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Wt=()=>{const e=(0,b.useContext)(Pe);return(0,b.useMemo)(()=>B(st,e),[e])},_n=(e,t)=>{if(IS_SERVER)return;const[n,r]=serialize(e),[,,,a]=SWRGlobalState.get(cache);if(a[n])return a[n];const c=t(r);return a[n]=c,c},qt=e=>(t,n,r)=>e(t,n&&((...c)=>{const[s]=Ce(t),[,,,i]=q.get(De);if(s.startsWith(Ft))return n(...c);const l=i[s];return _(l)?n(...c):(delete i[s],l)}),r),Ut=kt.concat(qt),Bt=e=>function(...n){const r=Wt(),[a,c,s]=it(n),i=ot(r,s);let l=e;const{use:g}=i,d=(g||[]).concat(Ut);for(let o=d.length;o--;)l=d[o](l);return l(a,c||i.fetcher||null,i)},$t=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const a=r.indexOf(n);a>=0&&(r[a]=r[r.length-1],r.pop())}},hn=(e,t)=>(...n)=>{const[r,a,c]=it(n),s=(c.use||[]).concat(t);return e(r,a,{...c,use:s})};Mt();const Ht=void 0,Ie=null,ct=e=>e===Ht,zt=e=>typeof e=="function",he=new WeakMap,Jt=e=>Ie.prototype.toString.call(e),Le=(e,t)=>e===`[object ${t}]`;let Gt=0;const Ae=e=>{const t=typeof e,n=Jt(e),r=Le(n,"Date"),a=Le(n,"RegExp"),c=Le(n,"Object");let s,i;if(Ie(e)===e&&!r&&!a){if(s=he.get(e),s)return s;if(s=++Gt+"~",he.set(e,s),Array.isArray(e)){for(s="@",i=0;i<e.length;i++)s+=Ae(e[i])+",";he.set(e,s)}if(c){s="#";const l=Ie.keys(e).sort();for(;!ct(i=l.pop());)ct(e[i])||(s+=i+":"+Ae(e[i])+",");he.set(e,s)}}else s=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return s},Kt=e=>{if(zt(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Ae(e):"",[e,t]},gn=e=>Kt(e)[0],Ne=b.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}}),Ve={dedupe:!0},lt=Promise.resolve(C),Yt=()=>U,Qt=(e,t,n)=>{const{cache:r,compare:a,suspense:c,fallbackData:s,revalidateOnMount:i,revalidateIfStale:l,refreshInterval:g,refreshWhenHidden:d,refreshWhenOffline:o,keepPreviousData:m,strictServerPrefetchWarning:p}=n,[f,w,j,$]=q.get(r),[u,z]=Ce(e),Q=(0,b.useRef)(!1),T=(0,b.useRef)(!1),F=(0,b.useRef)(u),k=(0,b.useRef)(t),X=(0,b.useRef)(n),S=()=>X.current,Z=()=>S().isVisible()&&S().isOnline(),[M,ee,J,N]=Xe(r,u),te=(0,b.useRef)({}).current,ne=_(s)?_(n.fallback)?C:n.fallback[u]:s,ut=(x,y)=>{for(const O in te){const E=O;if(E==="data"){if(!a(x[E],y[E])&&(!_(x[E])||!a(ge,y[E])))return!1}else if(y[E]!==x[E])return!1}return!0},ke=!Q.current,ft=(0,b.useMemo)(()=>{const x=M(),y=N(),O=R=>{const V=B(R);return delete V._k,(()=>{if(!u||!t||S().isPaused())return!1;if(ke&&!_(i))return i;const le=_(ne)?V.data:ne;return _(le)||l})()?{isValidating:!0,isLoading:!0,...V}:V},E=O(x),W=x===y?E:O(y);let I=E;return[()=>{const R=O(M());return ut(R,I)?(I.data=R.data,I.isLoading=R.isLoading,I.isValidating=R.isValidating,I.error=R.error,I):(I=R,R)},()=>W]},[r,u]),re=(0,He.useSyncExternalStore)((0,b.useCallback)(x=>J(u,(y,O)=>{ut(O,y)||x()}),[r,u]),ft[0],ft[1]),an=f[u]&&f[u].length>0,se=re.data,G=_(se)?ne&&Qe(ne)?Ne(ne):ne:se,ve=re.error,Me=(0,b.useRef)(G),ge=m?_(se)?_(Me.current)?G:Me.current:se:G,K=u&&_(G),ae=(0,b.useRef)(null);!Y&&(0,He.useSyncExternalStore)(Yt,()=>(ae.current=!1,ae),()=>(ae.current=!0,ae));const cn=ae.current;p&&cn&&!c&&K&&console.warn(`Missing pre-initiated data for serialized key "${u}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const dt=!u||!t||S().isPaused()||an&&!_(ve)?!1:ke&&!_(i)?i:c?_(G)?!1:l:_(G)||l,pt=ke&&dt,ln=_(re.isValidating)?pt:re.isValidating,un=_(re.isLoading)?pt:re.isLoading,ie=(0,b.useCallback)(async x=>{const y=k.current;if(!u||!y||T.current||S().isPaused())return!1;let O,E,W=!0;const I=x||{},R=!j[u]||!I.dedupe,V=()=>Ze?!T.current&&u===F.current&&Q.current:u===F.current,ce={isValidating:!1,isLoading:!1},le=()=>{ee(ce)},ht=()=>{const L=j[u];L&&L[1]===E&&delete j[u]},vt={isValidating:!0};_(M().data)&&(vt.isLoading=!0);try{if(R&&(ee(vt),n.loadingTimeout&&_(M().data)&&setTimeout(()=>{W&&V()&&S().onLoadingSlow(u,n)},n.loadingTimeout),j[u]=[y(z),Te()]),[O,E]=j[u],O=await O,R&&setTimeout(ht,n.dedupingInterval),!j[u]||j[u][1]!==E)return R&&V()&&S().onDiscarded(u),!1;ce.error=C;const L=w[u];if(!_(L)&&(E<=L[0]||E<=L[1]||L[1]===0))return le(),R&&V()&&S().onDiscarded(u),!1;const H=M().data;ce.data=a(H,O)?H:O,R&&V()&&S().onSuccess(O,u,n)}catch(L){ht();const H=S(),{shouldRetryOnError:We}=H;H.isPaused()||(ce.error=L,R&&V()&&(H.onError(L,u,H),(We===!0||A(We)&&We(L))&&(!S().revalidateOnFocus||!S().revalidateOnReconnect||Z())&&H.onErrorRetry(L,u,H,fn=>{const qe=f[u];qe&&qe[0]&&qe[0](Ke,fn)},{retryCount:(I.retryCount||0)+1,dedupe:!0})))}return W=!1,le(),!0},[u,r]),_t=(0,b.useCallback)((...x)=>tt(r,F.current,...x),[]);if(pe(()=>{k.current=t,X.current=n,_(se)||(Me.current=se)}),pe(()=>{if(!u)return;const x=ie.bind(C,Ve);let y=0;S().revalidateOnFocus&&(y=Date.now()+S().focusThrottleInterval);const E=$t(u,f,(W,I={})=>{if(W==ze){const R=Date.now();S().revalidateOnFocus&&R>y&&Z()&&(y=R+S().focusThrottleInterval,x())}else if(W==Je)S().revalidateOnReconnect&&Z()&&x();else{if(W==Ge)return ie();if(W==Ke)return ie(I)}});return T.current=!1,F.current=u,Q.current=!0,ee({_k:z}),dt&&(j[u]||(_(G)||Y?x():Tt(x))),()=>{T.current=!0,E()}},[u]),pe(()=>{let x;function y(){const E=A(g)?g(M().data):g;E&&x!==-1&&(x=setTimeout(O,E))}function O(){!M().error&&(d||S().isVisible())&&(o||S().isOnline())?ie(Ve).then(y):y()}return y(),()=>{x&&(clearTimeout(x),x=-1)}},[g,d,o,u]),(0,b.useDebugValue)(ge),c){if(!Ze&&Y&&K)throw new Error("Fallback data is required when using Suspense in SSR.");K&&(k.current=t,X.current=n,T.current=!1);const x=$[u],y=!_(x)&&K?_t(x):lt;if(Ne(y),!_(ve)&&K)throw ve;const O=K?ie(Ve):lt;!_(ge)&&K&&(O.status="fulfilled",O.value=!0),Ne(O)}return{mutate:_t,get data(){return te.data=!0,ge},get error(){return te.error=!0,ve},get isValidating(){return te.isValidating=!0,ln},get isLoading(){return te.isLoading=!0,un}}},mn=fe.defineProperty(Vt,"defaultValue",{value:st}),Xt=Bt(Qt);var Zt=window.wp.apiFetch,en=P.n(Zt),Fe=()=>{const e=s=>en()({path:s}).then(i=>i),t="/ajax-search-pro/options/search_instance/list",{data:n,isLoading:r,mutate:a,error:c}=Xt(t,e,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return c?{data:void 0,error:c,isLoading:r,mutate:a}:{data:n||[],error:void 0,isLoading:r,mutate:a}};const tn={apiVersion:3,title:(0,v.__)("Ajax Search Pro","ajax-search-pro"),icon:(0,h.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"512",height:"512",viewBox:"0 0 512 512",children:(0,h.jsx)("path",{d:"M460.355 421.59l-106.51-106.512c20.04-27.553 31.884-61.437 31.884-98.037C385.73 124.935 310.792 50 218.685 50c-92.106 0-167.04 74.934-167.04 167.04 0 92.107 74.935 167.042 167.04 167.042 34.912 0 67.352-10.773 94.184-29.158L419.945 462l40.41-40.41zM100.63 217.04c0-65.095 52.96-118.055 118.056-118.055 65.098 0 118.057 52.96 118.057 118.056 0 65.097-52.96 118.057-118.057 118.057-65.096 0-118.055-52.96-118.055-118.056z"})}),category:"widgets",keywords:[(0,v.__)("search","ajax-search-pro"),(0,v.__)("ajax","ajax-search-pro")],attributes:{instance:{type:"number",default:1},scType:{type:"number",default:1}},edit:({attributes:e,setAttributes:t,isSelected:n})=>{let{instance:r,scType:a}=e;a=Math.round(Math.max(1,Math.min(3,a)));const c=!n&&a===1,s=(0,ue.useBlockProps)({className:c?void 0:"asp-shortcode-controls"}),i=f=>{t({scType:parseInt(f)})},l=f=>{t({instance:parseInt(f)})},{data:g,error:d,isLoading:o}=Fe();if(o||g===void 0)return(0,v.__)("Loading search instances...","ajax-search-pro");const m=g.map(f=>parseInt(f.id));if(r=m.includes(r)?r:m[0],t({scType:a,instance:r}),c)return(0,h.jsx)("div",{...s,children:(0,h.jsx)($e(),{block:"ajax-search-pro/block-asp-main",attributes:e})});const p=[{label:"None",value:"0"}].concat(g.map(f=>({label:f.name,value:String(f.id)})));return(0,h.jsxs)("div",{...s,children:[(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Ajax Search Pro:","ajax-search-pro"),labelPosition:"side",value:a.toString(),options:[{value:"1",label:(0,v.__)("Search bar","ajax-search-pro")},{value:"2",label:(0,v.__)("Search settings","ajax-search-pro")},{value:"3",label:(0,v.__)("Search results","ajax-search-pro")}],onChange:i}),(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Search ID:","ajax-search-pro"),labelPosition:"side",value:r.toString(),options:p,onChange:l})]})},save:({attributes:e})=>{const{instance:t,scType:n}=e;return(0,h.jsx)(bt,{instance:t,shortcodeType:n})}};(0,Be.registerBlockType)("ajax-search-pro/block-asp-main",tn);var nn=window.wp.hooks;const rn=["core/query","generateblocks/query","blocksy/query"],sn=(0,h.jsxs)(h.Fragment,{children:[(0,v.__)("Selecting the search instance above will enable live search and filter for the query loop block for that search bar.","ajax-search-pro"),(0,h.jsx)(D.ExternalLink,{href:"https://documentation.ajaxsearchpro.com/behavior/results_page_live_loader",children:(0,v.__)("Learn more.","ajax-search-pro")})]});function on(e){return t=>{const{name:n,attributes:r,setAttributes:a}=t;if(!rn.includes(n))return(0,h.jsx)(e,{...t});const{asp_override_id:c,className:s}=r,{data:i,error:l,isLoading:g}=Fe();if(g||i===void 0)return(0,h.jsx)(h.Fragment,{children:(0,v.__)("Loading...","ajax-search-pro")});const d=[{label:"None",value:"0"}].concat(i.map(o=>({label:o.name,value:String(o.id)})));return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(e,{...t}),(0,h.jsx)(ue.InspectorControls,{children:(0,h.jsx)(D.PanelBody,{title:(0,v.__)("Ajax Search Pro","ajax-search-pro"),children:(0,h.jsx)(D.PanelRow,{children:(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Live search target","ajax-search-pro"),options:d,help:sn,defaultValue:c,onChange:o=>{const m=(s||"").split(" ").filter(p=>!p.includes("asp_es_"));o!=="0"&&m.push("asp_es_"+o),a({asp_override_id:parseInt(o),className:m.join(" ")})}})})})})]})}}(0,nn.addFilter)("editor.BlockEdit","ajax-search-pro/add-query-loop-controls",on),(0,Be.registerBlockType)("ajax-search-pro/user-searches",{apiVersion:3,title:(0,v.__)("ASP User Searches","ajax-search-pro"),icon:"chart-bar",category:"widgets",keywords:[(0,v.__)("search","ajax-search-pro"),(0,v.__)("statistics","ajax-search-pro"),(0,v.__)("popular","ajax-search-pro")],supports:{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0}},attributes:{mode:{type:"string",default:"popular"},asp_id:{type:"number",default:0},limit:{type:"number",default:10},separator:{type:"string",default:", "},action:{type:"string",default:"none"},target_id:{type:"number",default:0}},edit:({attributes:e,setAttributes:t})=>{const{mode:n,asp_id:r,limit:a,separator:c,action:s,target_id:i}=e,{data:l}=Fe(),g=(0,ue.useBlockProps)(),d=[{label:(0,v.__)("All instances","ajax-search-pro"),value:"0"},...(l??[]).map(o=>({label:o.name,value:String(o.id)}))];return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ue.InspectorControls,{children:(0,h.jsxs)(D.PanelBody,{title:(0,v.__)("User Searches Settings","ajax-search-pro"),children:[(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Mode","ajax-search-pro"),value:n,options:[{label:(0,v.__)("Popular searches","ajax-search-pro"),value:"popular"},{label:(0,v.__)("Latest searches","ajax-search-pro"),value:"latest"}],onChange:o=>t({mode:o})}),(0,h.jsx)(D.RangeControl,{label:(0,v.__)("Number of phrases","ajax-search-pro"),value:a,min:1,max:100,onChange:o=>t({limit:o})}),(0,h.jsx)(D.TextControl,{label:(0,v.__)("Separator","ajax-search-pro"),value:c,onChange:o=>t({separator:o})}),(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Source instance","ajax-search-pro"),value:String(r),options:d,onChange:o=>t({asp_id:parseInt(o)})}),(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Action on click","ajax-search-pro"),value:s,options:[{label:(0,v.__)("None","ajax-search-pro"),value:"none"},{label:(0,v.__)("Redirect to search","ajax-search-pro"),value:"redirect"},{label:(0,v.__)("Trigger live search","ajax-search-pro"),value:"trigger"}],onChange:o=>t({action:o})}),(s==="trigger"||s==="redirect")&&(0,h.jsx)(D.SelectControl,{label:(0,v.__)("Target instance","ajax-search-pro"),value:String(i),options:d,onChange:o=>t({target_id:parseInt(o)})})]})}),(0,h.jsx)("div",{...g,children:(0,h.jsx)($e(),{block:"ajax-search-pro/user-searches",attributes:e})})]})},save:()=>null})})();
