const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/builder-io-Bc6El7l5.js","assets/vendor-BmRNukEL.js","assets/vendor-DXOeSP1F.css","assets/index-PU-0vjEQ.js","assets/index-BXA319rR.css","assets/customComponents-OF_LsCnH.js","assets/slug-content-tJJ8QcYi.js","assets/useStaticPage-BFUBKL47.js","assets/slug-content-RU2OMyzC.css","assets/internal-C3mGdaT2.js"])))=>i.map(i=>d[i]);
import{F as k,ax as w,m as s,r as x,N as V,P as B,Q as C,R as o,_ as m,W as d,e as b,ae as g,X as T,ab as h}from"./vendor-BmRNukEL.js";import{a6 as L,am as M,N}from"./index-PU-0vjEQ.js";function D(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 F={class:"matcher"},Q={key:3},W=k({__name:"matcher",props:{pathMatch:{}},setup(f){const a=f,v={builderIo:1,slugContent:2,internal:3},l=g(()=>h(()=>import("./builder-io-Bc6El7l5.js"),__vite__mapDeps([0,1,2,3,4,5]))),i=g(()=>h(()=>import("./slug-content-tJJ8QcYi.js"),__vite__mapDeps([6,1,2,3,4,7,8]))),y=g(()=>h(()=>import("./internal-C3mGdaT2.js"),__vite__mapDeps([9,1,2]))),A=w(),{modulesSettings:E,themeContext:O}=L(),u=s(()=>({...v,...O.value.settings.previewers_settings?.priorities})),P=M("view"),I=s(()=>E.value?.find(e=>e.moduleId==="VirtoCommerce.BuilderIO")),R=s(()=>I.value?.settings.find(e=>e.name==="BuilderIO.Enable")?.value),S=s(()=>I.value?.settings.find(e=>e.name==="BuilderIO.PublicApiKey")?.value),r=x({builderIo:{id:"builderIo",priority:u.value.builderIo,state:"initial",isActive:R.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=D(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 U=s(()=>Array.isArray(a.pathMatch)?a.pathMatch:["/"]);return V(P,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",F,[r.value.slugContent.isActive?(o(),m(b(i),{key:0,"is-visible":c.value==="slugContent","path-match":U.value,onSetState:t[0]||(t[0]=n=>_(n,"slugContent"))},null,8,["is-visible","path-match"])):d("",!0),r.value.builderIo.isActive?(o(),m(b(l),{key:1,"is-visible":c.value==="builderIo","api-key":S.value,onSetState:t[1]||(t[1]=n=>_(n,"builderIo"))},null,8,["is-visible","api-key"])):d("",!0),r.value.internal.isActive?(o(),m(b(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",Q,[T(p)])):d("",!0),c.value?d("",!0):(o(),m(N,{key:4}))])}}});export{W as default};
//# sourceMappingURL=matcher-BAlKa6v9.js.map
