const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/builder-io-iYdRUoj9.js","assets/vendor-CsGITfgk.js","assets/vendor-DXOeSP1F.css","assets/index-GCDRvGOr.js","assets/index-CuRKiloU.css","assets/customComponents-CTvMze4c.js","assets/slug-content-BOUvm609.js","assets/useSlugInfo-vjQlUSx_.js","assets/useStaticPage-D0oZlZQH.js","assets/slug-content-RU2OMyzC.css","assets/internal-D-p1edoR.js"])))=>i.map(i=>d[i]);
import{M as P,ai as w,E as s,r as x,ax as V,U as B,N as C,O as o,R as m,a8 as d,e as g,an as b,X as T,ak as h}from"./vendor-CsGITfgk.js";import{a3 as L,ai as M,ca as D}from"./index-GCDRvGOr.js";function N(f){const a=f.filter(i=>i.isActive&&i.state!=="empty").sort((i,y)=>i.priority-y.priority);if(!a.length)return null;const v=a.find(i=>i.state==="redirect"),l=a.filter(i=>i.state!=="redirect");return!l.length&&v?v:l?.[0].state==="ready"?l[0]:"loader"}const j={class:"matcher"},F={key:3},X=P({__name:"matcher",props:{pathMatch:{}},setup(f){const a=f,v={builderIo:1,slugContent:2,internal:3},l=b(()=>h(()=>import("./builder-io-iYdRUoj9.js"),__vite__mapDeps([0,1,2,3,4,5]))),i=b(()=>h(()=>import("./slug-content-BOUvm609.js"),__vite__mapDeps([6,1,2,3,4,7,8,9]))),y=b(()=>h(()=>import("./internal-D-p1edoR.js"),__vite__mapDeps([10,1,2]))),A=w(),{modulesSettings:E,themeContext:O}=L(),u=s(()=>({...v,...O.value.settings.previewers_settings?.priorities})),R=M("view"),I=s(()=>E.value?.find(e=>e.moduleId==="VirtoCommerce.BuilderIO")),S=s(()=>I.value?.settings.find(e=>e.name==="BuilderIO.Enable")?.value),U=s(()=>I.value?.settings.find(e=>e.name==="BuilderIO.PublicApiKey")?.value),r=x({builderIo:{id:"builderIo",priority:u.value.builderIo,state:"initial",isActive:S.value},slugContent:{id:"slugContent",priority:u.value.slugContent,state:"initial",isActive:!0},internal:{id:"internal",priority:u.value.internal,state:"initial",isActive:!0}}),c=s(()=>{const e=N(Object.values(r.value));if(e&&e!=="loader"){if(e.state==="redirect"&&e.redirectUrl){const t=e.redirectUrl;/^(https?:\/\/|www\.)/i.test(t)?location.href=t:A.replace({path:t})}return e.id}return e});function _(e,t){const{state:p,redirectUrl:n}=e;r.value[t]&&(r.value[t].state=p,r.value[t].redirectUrl=n)}const k=s(()=>Array.isArray(a.pathMatch)?a.pathMatch:["/"]);return V(R,e=>{e==="default"?r.value.slugContent.priority=Math.min(...Object.values(u.value))-1:r.value.slugContent.priority=u.value.slugContent,window.scrollTo({top:0,behavior:"smooth"})},{immediate:!0}),(e,t)=>{const p=B("VcLoaderOverlay");return o(),C("div",j,[r.value.slugContent.isActive?(o(),m(g(i),{key:0,"is-visible":c.value==="slugContent","path-match":k.value,onSetState:t[0]||(t[0]=n=>_(n,"slugContent"))},null,8,["is-visible","path-match"])):d("",!0),r.value.builderIo.isActive?(o(),m(g(l),{key:1,"is-visible":c.value==="builderIo","api-key":U.value,onSetState:t[1]||(t[1]=n=>_(n,"builderIo"))},null,8,["is-visible","api-key"])):d("",!0),r.value.internal.isActive?(o(),m(g(y),{key:2,"is-visible":c.value==="internal",onSetState:t[2]||(t[2]=n=>_(n,"internal"))},null,8,["is-visible"])):d("",!0),c.value==="loader"?(o(),C("div",F,[T(p)])):d("",!0),c.value?d("",!0):(o(),m(D,{key:4}))])}}});export{X as default};
//# sourceMappingURL=matcher-ChgmHMaR.js.map
