import{F as g,r as i,aN as k,c1 as w,ch as S,ci as C,cj as K,a3 as V,aH as I,m as p,bW as R,Q as _,W as A,R as B,X as E,e as L,c2 as M}from"./vendor-DJC-2VPc.js";import{K as N}from"./index-BZco6cza.js";import{b as T}from"./customComponents-BVNdRjEP.js";const j=g({__name:"builder-io",props:{apiKey:{},isVisible:{type:Boolean}},emits:["setState"],setup(d,{emit:m}){const v=m,l=d,t=i(!1),a=i(null),o=i(!1);function f(){a.value=null,t.value=!1,o.value=!1}k(()=>{u(window.location.pathname)}),w((e,r)=>{e.path!==r.path&&(f(),u(e.path))});async function u(e){l.apiKey&&(o.value=!0,s("loading"),a.value=await S({model:"page",apiKey:l.apiKey,options:C(new URLSearchParams(location.search)),userAttributes:{urlPath:e}}),o.value=!1,t.value=!!a.value||K(),t.value?s("ready"):s("empty"))}function s(e){v("setState",{state:e})}const c=V(null),y=I(c),n=p(()=>!!y.value&&!!a.value?.data),h=p(()=>N(a.value?.data?.title).title.value);R({title:()=>n.value?h.value:void 0,keywords:()=>n.value?a.value?.data?.keywords:void 0,description:()=>n.value?a.value?.data?.description:void 0});const b=()=>T;return(e,r)=>e.isVisible&&t.value?(B(),_("div",{key:0,ref_key:"builderIoAnchor",ref:c},[E(L(M),{model:"page",content:a.value,"api-key":e.apiKey,"custom-components":b()},null,8,["content","api-key","custom-components"])],512)):A("",!0)}});export{j as default};
//# sourceMappingURL=builder-io-DPHx3FtX.js.map
