Files
NebulaShell/website/blog/_astro/client.svelte.9vP7DkWT.js
2026-04-10 20:00:25 +08:00

2 lines
1.2 KiB
JavaScript

import{ai as u,a9 as m,aj as v,v as y,C as _,y as h,x as $,a4 as g}from"./template.CyUWgh-J.js";import{u as b,h as x,m as j}from"./render.C4NccAY7.js";import"./utils.DonxBMOE.js";function c(e){return(a,...l)=>{var n=e(...l),t;if(y)t=_,h();else{var i=n.render().trim(),o=u(i);t=$(o),a.before(t)}const s=n.setup?.(t);m(t,t),typeof s=="function"&&v(s)}}const p=new WeakMap;var L=e=>async(a,l,n,{client:t})=>{if(!e.hasAttribute("ssr"))return;let i,o,s={};for(const[r,f]of Object.entries(n))o??={},r==="default"?(o.default=!0,i=c(()=>({render:()=>`<astro-slot>${f}</astro-slot>`}))):o[r]=c(()=>({render:()=>`<astro-slot name="${r}">${f}</astro-slot>`})),r==="default"?s.children=c(()=>({render:()=>`<astro-slot>${f}</astro-slot>`})):s[r]=c(()=>({render:()=>`<astro-slot name="${r}">${f}</astro-slot>`}));const d={...l,children:i,$$slots:o,...s};if(p.has(e))p.get(e).setProps(d);else{const r=k(a,e,d,t!=="only");p.set(e,r),e.addEventListener("astro:unmount",()=>r.destroy(),{once:!0})}};function k(e,a,l,n){let t=g(l);const i=n?x:j;n||(a.innerHTML="");const o=i(e,{target:a,props:t});return{setProps(s){Object.assign(t,s);for(const d in t)d in s||delete t[d]},destroy(){b(o)}}}export{L as default};