1import{k as V,J as G,i as b,u as L,D as K,c as C,N as I,M as $,O as W,m as Q,p as X,a as Y,d as Z,f as P,e as R,v as E,ab as U,W as ee,V as te,o as ae,R as se}from"./Do1nZpFk.js";import{$ as f}from"./DxvX61I1.js";import{u as oe}from"./B1LHqWUq.js";import"./BM5aYONo.js";const ne={key:0},de={__name:"post",async setup(re){var T,x,M;let o,h;const{$_:N}=V(),y=G(),{contentIsReady:k,initHydration:q}=useContentHydration(),J=b({}),A=b({}),B=b([]);q(7500);const j=ee(),{project:s,blogPostStore:D}=L();let i=y.query.slug;const u=y.query.preview,H=b(""),S=`pk-b-${i}`,v=K(S),O={"Cache-Control":"no-cache"},g=C(()=>s.getProject.id);console.log("slug",i),console.log("hash",u);const{data:F}=([o,h]=I(()=>U(`post-${i}`,()=>{if(!g.value)throw $({statusCode:500,statusMessage:"Project not initialized"});return $fetch(`${j.public.blogApiBase}/api/projects/${g.value}/blog/posts/${i}`,{headers:O,params:{...!!u&&{hash:u},password:v.value?v.value:encodeURIComponent(v)}})},{server:!0,lazy:!0,immediate:!!i&&!!g.value})),o=await o,h(),o),c=F.value,e=c&&typeof c=="object"&&"data"in c&&c.data&&typeof c.data=="object"&&!Array.isArray(c.data)?c.data:c||null;if(!e){const t=u?` (slug=${i}, hash=${String(u).slice(0,8)}â¦)`:` (slug=${i})`;throw $({statusCode:404,statusMessage:"Post Not Found"+t})}const{data:z}=([o,h]=I(()=>U("template",()=>{if(!g.value)throw $({statusCode:500,statusMessage:"Project not initialized"});return $fetch(`${j.public.blogApiBase}/api/projects/${g.value}/blog/posts/layout`,{headers:O,params:{type:"post_template"}})})),o=await o,h(),o),l=z.value,d=l&&typeof l=="object"&&"data"in l&&l.data&&typeof l.data=="object"&&!Array.isArray(l.data)?l.data:l||null;if(!d)throw $({statusCode:404,statusMessage:"Post Template Not Found"});if(C(()=>{var t,r;return y.query.hash?(t=s==null?void 0:s.getProject)==null?void 0:t.css_file_draft:(r=s==null?void 0:s.getProject)==null?void 0:r.css_file}),e.password_protection&&typeof e.incorrect_password=="boolean")[o,h]=I(()=>te({path:`/restriction/blog/${i}`,query:{pk:S,hash:u}})),await o,h();else{J.value=JSON.parse(d.content),A.value=y.query.hash&&e.content_draft?JSON.parse(e.content_draft):JSON.parse(e.content),H.value=s.getGlobalStyle.font.googleFonts+d.fonts+e.fonts,e.current_content=A.value,s.setPage({...e,is_blog:!0}),D.setPost(e),B.value=typeof JSON.parse(d.has_sidebar)=="object"?JSON.parse(d.has_sidebar):[d.has_sidebar];const{meta:t}=oe({meta_title:e.title,slug:`blog/${e.slug}`,meta_description:e.seo_description||e.description,updated_at:e.updated_at},{src:e.cover,id:"blog-image"}),r=[];u&&r.push({href:e.css_file_draft,rel:"stylesheet",type:"text/css"});const _=C(()=>{const m=a=>{try{const n=new URL(a.includes("://")?a:`http://${a}`);return!!n.hostname&&n.hostname.includes(".")}catch{return!1}};try{const a=s.getProject;let n=a.canonical_url;n||(n=a.domain?a.domain:a.subdomain+".estage.site");const w=e.canonical_url;let p=w;return m(w)||(w?p=`${n.replace(/\/$/,"")}/blog/${w.replace(/^\//,"")}`:p=`${n.replace(/\/$/,"")}/blog/${e.slug}`),p=p.includes("://")?p:`https://${p}`,p}catch(a){return console.error("error :>> ",a),null}});if(_.value&&r.push({rel:"canonical",href:_.value}),s.getGlobalStyle.favicon){const m=t.link.findIndex(a=>a.rel==="icon");m!==-1&&t.link.splice(m,1)}W({...t,meta:[...t.meta,{name:"author",content:(T=e==null?void 0:e.author)==null?void 0:T.name},{name:"article:published_time",content:f(e==null?void 0:e.post_date).toISOString()},{name:"article:modified_time",content:f(e==null?void 0:e.updated_at).toISOString()},{name:"publish_date",property:"og:publish_date",content:f(e==null?void 0:e.post_date).toISOString()}],script:[...t.script,{type:"application/ld+json",innerHTML:JSON.stringify({"@context":"https://schema.org","@type":"BlogPosting",headline:e==null?void 0:e.title,image:e==null?void 0:e.cover,datePublished:f(e==null?void 0:e.post_date).toISOString(),dateModified:f(e==null?void 0:e.updated_at).toISOString(),author:{"@type":"Person",name:(x=e==null?void 0:e.author)==null?void 0:x.name,url:(M=e==null?void 0:e.author)==null?void 0:M.personal_link}}),hid:S}],link:r})}return Q(k,async t=>{if(!t)return;await se();const r=await new Promise(m=>{const a=()=>{const n=document.querySelector(".page");n?m(n):requestAnimationFrame(a)};a()});r.style.minHeight=null;const _=N.get(e,["integration_scripts","integrations"],[]);_.includes("Intercom")&&window.Intercom&&window.Intercom("update",{hide_default_lau
1ncher:!1}),_.includes("CrispChat")&&window.$crisp&&$__CRISP_INSTANCE.push(["do","chat:show"]),setTimeout(()=>dispatchEvent(new Event("load")),100)},{once:!0}),X(()=>{{const t=N.get(e,["integration_scripts","integrations"],[]);!t.includes("Intercom")&&window.Intercom&&(Intercom("hide"),window.Intercom("update",{hide_default_launcher:!0})),!t.includes("CrispChat")&&window.$__CRISP_INSTANCE&&$__CRISP_INSTANCE.push(["do","chat:hide"])}}),(t,r)=>P(k)?(ae(),Y("div",ne,[R("pre",null,E(P(e)),1),R("pre",null,E(P(d)),1)])):Z("",!0)}};export{de as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.