8 lines
2.6 KiB
TypeScript
8 lines
2.6 KiB
TypeScript
![]() |
/**
|
||
|
* This file is prebuilt from packages/astro/src/runtime/server/astro-island.ts
|
||
|
* Do not edit this directly, but instead edit that file and rerun the prebuild
|
||
|
* to generate this file.
|
||
|
*/
|
||
|
declare const _default: "(()=>{var d;{let h={0:t=>t,1:t=>JSON.parse(t,a),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,a)),5:t=>new Set(JSON.parse(t,a)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(JSON.parse(t)),9:t=>new Uint16Array(JSON.parse(t)),10:t=>new Uint32Array(JSON.parse(t))},a=(t,e)=>{if(t===\"\"||!Array.isArray(e))return e;let[r,n]=e;return r in h?h[r](n):void 0};customElements.get(\"astro-island\")||customElements.define(\"astro-island\",(d=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=async()=>{var o;if(!this.hydrator||!this.isConnected)return;let e=(o=this.parentElement)==null?void 0:o.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let r=this.querySelectorAll(\"astro-slot\"),n={},c=this.querySelectorAll(\"template[data-astro-template]\");for(let s of c){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute(\"data-astro-template\")||\"default\"]=s.innerHTML,s.remove())}for(let s of r){let i=s.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[s.getAttribute(\"name\")||\"default\"]=s.innerHTML)}let l=this.hasAttribute(\"props\")?JSON.parse(this.getAttribute(\"props\"),a):{};await this.hydrator(this)(this.Component,l,n,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))}}connectedCallback(){!this.hasAttribute(\"await-children\")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((e,r)=>{r.disconnect(),setTimeout(()=>this.childrenConnectedCallback(),0)}).observe(this,{childList:!0})}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}start(){let e=JSON.parse(this.getAttribute(\"opts\")),r=this.getAttribute(\"client\");if(Astro[r]===void 0){window.addEventListener(`astro:${r}`,()=>this.start(),{once:!0});return}Astro[r](async()=>{let n=this.getAttribute(\"renderer-url\"),[c,{default:l}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),o=this.getAttribute(\"component-export\")||\"default\";if(!o.includes(\".\"))this.Component=c[o];else{this.Component=c;for(let s of o.split(\".\"))this.Component=this.Component[s]}return this.hydrator=l,this.hydrate},e,this)}attributeChangedCallback(){this.hydrate()}},d.observedAttributes=[\"props\"],d))}})();";
|
||
|
export default _default;
|