vite-plugin-kiru 0.28.0-preview.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1766,7 +1766,7 @@ var dist_default2 = `var We="production";if(We!=="development"&&We!=="production
|
|
|
1766
1766
|
|
|
1767
1767
|
\${r.map(o=>\` at \${o}\`).join(\`
|
|
1768
1768
|
\`)}
|
|
1769
|
-
\`}function Br(e){let t=Rt(e);if(l){let r=Gr(e);r&&(t=\`\${t} (\${r})\`)}return t}function Rt(e){return e.displayName??(e.name||"Anonymous Function")}function Gr(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var we={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},$=new Map,H=new Map;function ee(e,t=!1){return y.isSignal(e)?t?e.value:e.peek():e}var Ye=()=>{$.forEach(e=>e()),$.clear()};var ae={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ot(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ot(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},qr=e=>{let t=e.target;!e.isTrusted||!t||ae.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ot=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,qr,{passive:!0})}};var rt=!1,Je=!1,Dt=e=>{e.preventDefault(),e.stopPropagation(),Je=!0},le=null;function Pt(){rt=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Dt)}function Lt(){Je&&(le.removeEventListener("blur",Dt),le.isConnected&&le.focus(),Je=!1),rt=!1}function Ze(e,t){if(typeof e=="function"){e(t);return}if(y.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function Vt(e){let t=e.type;return t=="#text"?Xr(e):Ge.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Xr(e){let{nodeValue:t}=e.props;if(!y.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return et(e,n,t),n}function Yr(e,t,r){let n=Qe.get(e)??{},o=n[t]=s=>{if(rt){s.preventDefault(),s.stopPropagation();return}r(s)};return Qe.set(e,n),o}var Qe=new WeakMap;function $t(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=C.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(be.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&Ze(a,null),u&&Ze(u,t));return}if(be.isEvent(i)){if(a!==u||C.current==="hydrate"){let c=i.replace(Tt,""),d=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,d?Qe.get(e)?.[c]:a),i in n&&t.addEventListener(c,d?Yr(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(y.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(y.isSignal(u))return en(e,t,i,u,a);Ae(t,i,u,a);return}y.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function Jr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Ht(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Zr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Qr=["progress","meter","number","range"];function en(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((p,v)=>{Ae(t,r,p,v),l&&window.__kiru?.profilingContext?.emit("signalAttrUpdate",J(e))}),Ae(t,r,n.peek(),ee(o));let u=Zr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,d=c?p=>Ht(t,p):p=>t[a]=p,x=p=>{d(p),l&&window.__kiru?.profilingContext?.emit("signalAttrUpdate",J(e))},S=p=>{n.sneak(p),n.notify({filter:v=>v!==x})},m;if(a==="value"){let p=Qr.indexOf(t.type)!==-1;m=()=>{let v=t.value;c?v=Jr(t):typeof n.peek()=="number"&&p&&(v=t.valueAsNumber),S(v)}}else m=p=>{let v=p.target[a];a==="currentTime"&&n.peek()===v||S(v)};t.addEventListener(u,m);let g=n.subscribe(x);return s[r]=()=>{t.removeEventListener(u,m),g()},Ae(t,a,n.peek(),ee(o))}function et(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru?.profilingContext?.emit("signalTextUpdate",J(e)))})}function Ft(e){let t=ae.nextChild();if(!t)throw new _({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(Ge.has(r)||(r=r.toLowerCase()),e.type!==r)throw new _({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){$t(e);return}y.isSignal(e.props.nodeValue)&&et(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;ae.bumpChildIndex();let i=String(ee(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,y.isSignal(s.props.nodeValue)&&et(s,a,s.props.nodeValue),n=o,o=o.sibling}}function Nt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function tn(e,t,r){let n=qe.has(t);Nt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var rn=["INPUT","TEXTAREA"],nn=e=>rn.indexOf(e.nodeName)>-1;function Ae(e,t,r,n){if(r!==n)switch(t){case"style":return an(e,r,n);case"className":return sn(e,r);case"innerHTML":return on(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Ht(e,r);let o=r==null?"":String(r);if(nn(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return tn(e,Ut(t),r)}}function on(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function sn(e,t){let r=ee(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function an(e,t,r){if(Nt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function ln(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new _({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function un(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=It(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function It(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(A|V))){let o=cn(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function cn(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function zt(e){if(C.current==="hydrate")return W(e,ye);let t={node:e.dom?e:ln(e)};tt(e,t,(e.flags&A)>0),e.dom&&!(e.flags&V)&&jt(e,t,!1),ye(e)}function tt(e,t,r){let n=e.child;for(;n;){if(n.flags&he){n.flags&A&&fn(n,t),ye(n),n=n.sibling;continue}n.dom?(tt(n,{node:n},!1),n.flags&V||jt(n,t,r)):tt(n,t,(n.flags&A)>0||r),ye(n),n=n.sibling}}function jt(e,t,r){(r||!e.dom.isConnected||e.flags&A)&&un(e,t),(!e.prev||e.flags&P)&&$t(e),t.lastChild=e.dom}function Wt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=J(e)),W(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru?.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&Ze(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function fn(e,t){if(!e.child)return;let r=[];if(Kt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=It(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Kt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Kt(r.child,t),r=r.sibling}function Bt(e){return typeof e=="function"&&typeof e[Ce]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Z)return Z({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Bt(e)&&(n.flags|=Te,n.arePropsEqual=e[Ce].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Gt(s)&&(n.props.key=s.toString()),qt(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Z({children:e,key:t}){return f(X,t?{key:t}:null,e)}var it;function Oe(e,t){return l&&(it=J(e)),Array.isArray(t)?(l&&(rr in t&&hn(e,t),gn(e,t)),dn(e,t)):pn(e,t)}function pn(e,t){let r=e.child;if(r===null)return Zt(e,t);let n=r.sibling,o=Yt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ot(e,r):n&&ot(e,n),o;{let s=nr(r),i=Qt(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Me(i,0,0)}return s.forEach(a=>Re(e,a)),i}}function dn(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Yt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Re(e,o),i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return ot(e,o),r;if(o===null){for(;a<t.length;a++){let c=Zt(e,t[a]);c!==null&&(i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=nr(o);for(;a<t.length;a++){let c=Qt(u,e,a,t[a]);if(c!==null){let d=c.prev;if(d!==null){let x=d.props.key;u.delete(x===void 0?d.index:x)}i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Re(e,c)),r}function Yt(e,t,r){let n=t?.props.key;return er(r)?n!==void 0||t?.type==="#text"&&y.isSignal(t.props.nodeValue)?null:Xt(e,t,""+r):y.isSignal(r)?t&&t.props.nodeValue!==r?null:Xt(e,t,r):ue(r)?r.props.key!==n?null:mn(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&st(r),Jt(e,t,r)):null}function Xt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&ve(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=P),t.sibling=null,t}function mn(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=T(n)),n===X)return Jt(e,t,o.children||[],o);if(t?.type===n)return l&&ve(),t.index=0,t.sibling=null,typeof n=="string"?tr(t.props,o)&&(t.flags|=P):t.flags|=P,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function Jt(e,t,r,n={}){if(t===null||t.type!==X){l&&U();let o=f(X,{children:r,...n});return K(o,e),o}return l&&ve(),t.props={...t.props,...n,children:r},t.flags|=P,t.sibling=null,t}function Zt(e,t){if(er(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(y.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ue(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=A,r}if(Array.isArray(t)){l&&(U(),st(t));let r=Z({children:t});return K(r,e),r}return null}function Me(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=A,t):o}else return e.flags|=A,t}function Qt(e,t,r,n){if(y.isSignal(n)||typeof n=="string"&&n!==""||typeof n=="number"||typeof n=="bigint"){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&y.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=A,i.index=r,i}if(ue(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&ve(),typeof s=="string"?tr(u.props,i)&&(u.flags|=P):u.flags|=P,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=A,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&st(n),s)return l&&ve(),s.flags|=P,s.props.children=n,s;l&&U();let i=Z({children:n});return K(i,t),i.flags|=A,i.index=r,i}return null}function er(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function tr(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function ve(){"window"in globalThis&&window.__kiru?.profilingContext?.emit("updateNode",it)}function U(){"window"in globalThis&&window.__kiru?.profilingContext?.emit("createNode",it)}var rr=Symbol("kiru:marked-list-child");function st(e){Object.assign(e,{[rr]:!0})}function nr(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Re(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ot(e,t){for(;t;)Re(e,t),t=t.sibling}function gn(e,t){let r=new Set,n=!1;for(let o of t){if(!ue(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=ir(e);or(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function hn(e,t){let r=!1,n=!1;for(let o of t){if(!ue(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=ir(e);or(\`\${o} component produced a child in a list without a valid key prop\`)}}function or(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var nt=new WeakMap;function ir(e){if(nt.has(e))return nt.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return nt.set(e,n),n}var B,G=[],de=!1,lt=[],De=[],ut=!1,ct=!1,ft=!1,pt=0,sr=[],dt=[],ar=-1;function gt(e){if(de){lt.push(e);return}e()}function Pe(){de&&(window.cancelAnimationFrame(ar),lr())}function ht(e){e.flags|=se,G.push(e),de=!0,Pe()}function O(e){if(C.current==="hydrate")return gt(()=>mt(e));mt(e)}function wn(){de||(de=!0,ar=window.requestAnimationFrame(lr))}function bn(){for(de=!1;lt.length;)lt.shift()()}function mt(e){if(ut&&(ct=!0),M.current===e){l&&window.__kiru?.profilingContext?.emit("updateDirtied",B),ft=!0;return}if(!(e.flags&(se|pe))){if(e.flags|=se,!G.length)return G.push(e),wn();G.push(e)}}function yn(e){W(e,t=>t.flags|=pe),De.push(e)}var vn=(e,t)=>t.depth-e.depth,te=null;function lr(){if(l){let t=De[0]??G[0];t?(B=J(t),window.__kiru?.profilingContext?.beginTick(B)):B=null}let e=1;for(Pt();G.length;){G.length>e&&G.sort(vn),te=G.shift(),e=G.length;let t=te.flags;if(!(t&pe)&&t&se){let r=te;for(;r=xn(r););for(;De.length;)Wt(De.pop());zt(te),te.flags&=~se}}if(Lt(),ut=!0,at(sr),ut=!1,ct)return _n(),at(dt),ct=!1,pt++,l&&(window.__kiru?.profilingContext?.endTick(B),window.__kiru?.profilingContext?.emit("updateDirtied",B)),Pe();pt=0,bn(),at(dt),l&&(window.__kiru.emit("update",B),window.__kiru?.profilingContext?.emit("update",B),window.__kiru?.profilingContext?.endTick(B))}function xn(e){let t=!0;try{typeof e.type=="string"?kn(e):wt(e.type)?En(e):t=Sn(e)}catch(n){l&&window.__kiru?.emit("error",B,n instanceof Error?n:new Error(String(n)));let o=ur(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<te.depth&&(te=o),o}if(_.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(yn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(sr.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(dt.push(...r.effects),r.effects=void 0),r===te)return;if(r.sibling)return r.sibling;r=r.parent,C.current==="hydrate"&&r?.dom&&ae.pop()}}function En(e){let{props:t,type:r}=e,n=t.children;if(r===oe){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(mt)}else if(r===ie){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Oe(e,n)}function Sn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&Te){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=he,!1;e.flags&=~he}try{M.current=e;let i,a=0;do{if(e.flags&=~se,ft=!1,Y.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=T(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(Y.current<u){for(let c=Y.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=Y.current,e.hookSig.length=Y.current}}if(delete e.hmrUpdated,++a>Be)throw new _({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(ft);return e.child=Oe(e,i),!0}finally{M.current=null}}function kn(e){let{props:t,type:r}=e;l&&bt(e),e.dom||(C.current==="hydrate"?Ft(e):e.dom=Vt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Oe(e,t.children),e.child&&C.current==="hydrate"&&ae.push(e.dom))}function _n(){if(pt>Be)throw new _("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function at(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var cr;(function(e){e.Start="start",e.End="end"})(cr||(cr={}));var me=null,fr=new Set;function h(e,t,r){let n=M.current;if(n||Cn(e),l&&me!==null&&!fr.has(e+me))throw fr.add(e+me),new _({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${me}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=Y.current++,i=n.hooks?.at(s);if(l){me=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{me=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function Cn(e){throw new _(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function F(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function R(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var pr,y=class e{constructor(t,r){this[pr]=!0,this.$id=Ve(),this.$value=t,r&&(this.displayName=r),l?(H.set(this.$id,new Set),this.$initialValue=yt(t),this[k]={provide:()=>this,inject:n=>{this.$initialValue===n.$initialValue&&(this.$value=n.$value),H.get(this.$id)?.clear?.(),H.delete(this.$id),this.$id=n.$id,n.__next=this},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=T(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?T(this).$value:this.$value}sneak(t){if(l){let r=T(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(H.get(this.$id).add(t),()=>H.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return H.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=T(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ke in t}static subscribers(t){return l?H.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=M.current,n=we.current();if(n){(!r||r&&w())&&n.set(t.$id,t);return}if(!r||!w())return;let o=t.subscribe(()=>O(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){H.delete(t.$id);return}t.$subs.clear()}};pr=Ke;var Le=(e,t)=>new y(e,t),E=(e,t)=>h("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>y.dispose(r.signal),r.signal=new y(e,t)),r.signal});function $e(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;$.delete(t);let a=!!M.current&&!w();a||(i=new Map,we.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[d,x]of r)i.has(d)||(x(),r.delete(d));let c=()=>{$.size||queueMicrotask(Ye),$.set(t,s)};for(let[d,x]of i){if(r.has(d))continue;let S=x.subscribe(c);r.set(d,S)}we.stack.pop()}return u}var xe=class e extends y{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[k].inject;this[k]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}y.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),y.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=T(t);$.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=T(t),{$id:n,$getter:o,$unsubs:s}=r,i=$e({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!H?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},dr=(e,t)=>new xe(e,t),vt=(e,t)=>h("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>xe.dispose(r.signal),r.signal=dr(e,t)),r.signal));var Ee=class e{constructor(t,r){if(this.id=Ve(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[k]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru?.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){$.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=T(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=$e({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function mr(e,t){if(typeof e=="function")return new Ee(e);let r=e,n=t;return new Ee(n,r)}function Se(e,t){if(w())return h("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=mr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}var be={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!be.internalProps.includes(e)&&!be.isEvent(e)};function Ut(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():At.get(e)||e}}function yt(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function T(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function w(){return C.current==="dom"||C.current==="hydrate"}function ue(e){return typeof e=="object"&&e!==null&&"type"in e}function wt(e){return e===X||e===oe||e===ie}function gr(e){return e.type===X}function J(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function ye(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(P|A|pe)}function hr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function W(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&W(r,t),r=r.sibling}function Xe(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function ur(e){return Xe(e,t=>t.type===ie)}function bt(e){if("children"in e.props&&e.props.innerHTML)throw new _({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new _({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Gt(e){return typeof e=="string"||typeof e=="number"}function qt(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||y.isSignal(e)}var Tn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Ve(e=10,t=Tn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});function wr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&k in e&&typeof e[k]=="object"&&!!e[k]}function br(){let e=new Map,t=null,r=null,n=!1,o=()=>n,s=!1,i=[],a=[];return{register:S=>{if(r===null)throw new Error("[kiru]: HMR could not register: No active module");let m=new Set;for(let[g,p]of Object.entries(S)){let v=r.hotVars.get(g);if(p.value.__devtoolsFileLink=p.link,typeof p.value=="function"&&v?.value&&(v.value.__next=p.value),p.type==="createStore"&&window.__kiru.stores.add(g,p.value),r.hotVars.set(g,p),!!v){if(wr(v.value)&&wr(p.value)){p.value[k].inject(v.value[k].provide()),v.value[k].destroy();continue}v.type==="component"&&p.type==="component"&&window.__kiru.apps.forEach(fe=>{W(fe.rootNode,ge=>{ge.type===v.value&&(ge.type=p.value,m.add(fe),ge.hmrUpdated=!0)})})}}if(m.forEach(g=>g.rootNode&&O(g.rootNode)),n=!1,i.length){let g=0;for(;g<i.length;g++){let p=i[g],v=r.unnamedWatchers[g];v&&(p[k].inject(v[k].provide()),v[k].destroy()),r.unnamedWatchers[g]=p}for(;g<r.unnamedWatchers.length;g++)r.unnamedWatchers[g][k].destroy();r.unnamedWatchers.length=i.length,i.length=0}r=null,t=null},prepare:S=>{let m=e.get(S);if(n=!!m,!m)m={hotVars:new Map,unnamedWatchers:[]},e.set(S,m);else for(;a.length;)a.shift()();r=m,t=S},isReplacement:o,signals:{registerNextWatch(){s=!0},isWaitingForNextWatchCall(){return s},pushWatch(S){i.push(S),s=!1}},onHmr:S=>{a.push(S)},getCurrentFilePath(){return t}}}function yr(){let e=new Map,t=new Map;return{appStats:t,emit:(r,n)=>{e.get(r)?.forEach(o=>o(n))},addEventListener:(r,n)=>{e.has(r)||e.set(r,new Set),e.get(r).add(n)},removeEventListener:(r,n)=>{e.has(r)&&e.get(r).delete(n)},mountDuration:r=>{let n=t.get(r);return n?n.mountDuration:0},totalTicks:r=>{let n=t.get(r);return n?n.totalTicks:0},lastTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps[n.timestamps.length-1];return o.end-o.start},averageTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps.filter(s=>s.end!==1/0);return o.reduce((s,i)=>s+(i.end-i.start),0)/o.length},beginTick:r=>{t.has(r)||t.set(r,{mountDuration:1/0,timestamps:[],totalTicks:0});let n=t.get(r);n.totalTicks++,n.timestamps.push({start:performance.now(),end:1/0})},endTick:r=>{if(!t.has(r))return;let n=t.get(r),o=n.timestamps[n.timestamps.length-1];o.end=performance.now(),n.mountDuration===1/0&&(n.mountDuration=o.end-o.start),n.timestamps.length>100&&n.timestamps.shift()}}}function An(){let e=new Map,t=new Set;function r(i,a){e.has(i)||(e.set(i,a),o())}function n(i){e.has(i)&&(e.delete(i),o())}function o(){let i=Object.fromEntries(e);t.forEach(a=>a(i))}function s(i){return t.add(i),i(Object.fromEntries(e)),()=>t.delete(i)}return{add:r,delete:n,subscribe:s,get size(){return e.size}}}function vr(){let e=new Set,t=new Map,r,n,o;function s(c,d,x){t.get(c)?.forEach(S=>S(d,x))}function i(c,d){t.has(c)||t.set(c,new Set),t.get(c).add(d)}function a(c,d){t.get(c)?.delete(d)}let u={get apps(){return Array.from(e)},get stores(){return r},get HMRContext(){return n},get profilingContext(){return o},emit:s,on:i,off:a};return i("mount",c=>e.add(c)),i("unmount",c=>e.delete(c)),l&&(n=br(),o=yr(),r=An()),u}var Mn=0;function xr(e,t,r){let n=f(t.nodeName.toLowerCase(),{});if(l){if(t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");t.__kiruNode=n}n.dom=t,n.flags|=V;let o=Mn++,s=r?.name??\`App-\${o}\`,i={id:o,name:s,rootNode:n,render:a,unmount:u};l&&(n.app=i,window.__kiru?.emit("mount",i));function a(c){n.props.children=c,ht(n)}function u(){n.props.children=null,ht(n),l&&(delete t.__kiruNode,delete n.app,window.__kiru?.emit("unmount",i))}return a(e),i}function ce(e){return w()?h("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function Er(e){let t={[_t]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(oe,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[k]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{W(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,O(i))})})},destroy:()=>{},provide:()=>t}}return t}function Q(e,t){return w()?h("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),R(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(w())return h("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function re(e,t){if(w())return h("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function ke(e,t){return w()?h("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return w()?h("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Da="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function _r(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);re(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>kr(n.current),[]);let o=Q(i=>{kr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=Q(i=>{n.current=window.setTimeout(()=>o(i),On(i,e.duration))},[e.duration]);return e.element(t)}var Sr=150;function On(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??Sr;case"exited":return t?.out??Sr}}function kr(e){e!=null&&window.clearTimeout(e)}var Cr;l&&"window"in globalThis&&((Cr=globalThis.window).__kiru??(Cr.__kiru=vr()));var Tr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var He="kiru.devtools.anchorPosition",Ar={x:-16,y:-16};var xt=(e,t,r)=>{if(!t.current)return{...Ar};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},Mr=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!gr(r)){t=r;break}r=r.parent}return t},Rr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Dr={arrayChunkSize:10,objectKeysChunkSize:100};function Pr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Pr(e[n],t[n]))return!1;return!0}var Ln={...Dr},Or=localStorage.getItem("kiru.devtools.userSettings");if(Or)try{let e=JSON.parse(Or);Pr(Dr,e)&&(Ln=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var Tu=Er({userSettings:null,saveUserSettings:()=>{}});var Lu=Object.freeze(()=>{});var Fn="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var Et=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},D=new Et(Fn);var nc=Symbol.for("devtools.hookGroup");var L=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var Fe=()=>{let e=E({x:0,y:0}),t=E({x:0,y:0}),r=E({x:0,y:0});return L("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Ne="window"in globalThis&&"ResizeObserver"in globalThis.window,Lr=(e,t,r=void 0)=>w()?Ne?h("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{R([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Ne,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{F(o)}})):{isSupported:Ne,start:()=>{},stop:()=>{}}:{isSupported:Ne,start:()=>{},stop:()=>{}};var Ie="window"in globalThis&&"MutationObserver"in globalThis.window,Vr=(e,t,r=void 0)=>w()?Ie?h("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):R([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ie,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{F(o)}})):{isSupported:Ie,start:()=>{},stop:()=>{}}:{isSupported:Ie,start:()=>{},stop:()=>{}};var ze=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=E(0),i=E(0),a=E(0),u=E(0),c=E(0),d=E(0),x=E(0),S=E(0),m=()=>{let g=e.current;if(!g){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,d.value=0,x.value=0,S.value=0;return}let p=g.getBoundingClientRect();s.value=p.width,i.value=p.height,a.value=p.top,u.value=p.right,c.value=p.bottom,d.value=p.left,x.value=p.x,S.value=p.y};return Lr(e,m),Vr(e,m,{attributeFilter:["style","class"]}),L("scroll",()=>{r&&m()},{capture:!0,passive:!0}),L("resize",()=>{n&&m()},{passive:!0}),re(()=>{o&&m()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:d,x,y:S,update:m}};var $r=(e,t)=>{if(!w())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return h("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{F(o),s()}}))};var Hr=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=E(null),a=$r(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Fr=()=>{let{mouse:e}=Fe(),t=E(null),r=I(null),n=I(null),o=ze(r),s=E({x:-16,y:-16}),i=E({x:-16,y:-16}),a=E({width:window.innerWidth,height:window.innerHeight}),u=E("bottom"),c=I(null);re(()=>{let m=localStorage.getItem(He);if(m==null)return;let g=JSON.parse(m);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=g.snapSide,i.value=xt(g,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let d=vt(()=>{let{x:m,y:g}=e.value;if(t.value===null)return null;let{x:p,y:v}=t.value;return{x:m-p,y:g-v}});L("dragstart",m=>{m.preventDefault(),t.value={x:m.x,y:m.y},s.value=i.value},{ref:()=>r.current}),L("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let x=Q(()=>{if(n.current==null)return;let m=n.current.offsetWidth;if(u.value==="right"){let g=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let g=Math.min(0,i.value.y);i.value={x:(m-o.width.value)*-1+16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(m-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(m-o.width.value)*-1+16),y:-16}}},[]);Se([d,e],(m,g)=>{if(m===null||!n.current)return;let{x:p,y:v}=g,fe=n.current.offsetWidth,ge=v>=window.innerHeight-100,kt=v<=100;if(!kt&&!ge){let ne=p>window.innerWidth/2;u.value=ne?"right":"left"}else u.value=kt?"top":"bottom";if(u.value==="right"){let ne=Math.min(-16,s.value.y+m.y);i.value={x:-16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let ne=Math.min(0,s.value.y+m.y);i.value={x:(fe-o.width.value)*-1+16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let ne=Math.min(-16,s.value.x+m.x);i.value={x:Math.max(ne,(fe-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Kr=Math.min(-16,s.value.x+m.x);i.value={y:-16,x:Math.max(Kr,(fe-o.width.value)*-1+16)}});let S=Q(()=>{n.current!==null&&(i.value=xt({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return L("resize",S),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:x}};var z=Le(!1);"window"in globalThis&&D.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var q=Le(null);var Nr="kiru-devtools-popup-size",je=()=>{let e=q.value;return Q(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Nr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(D.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};D.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Nr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var Ir=()=>{let e=je(),{mouse:t}=Fe(),r=Hr({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=ke(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(d=>d.rootNode==null||o.__kiruNode==null?!1:hr(d.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=ke(()=>o?Mr(o):null,[o]),a=I(null),u=ze(a);return N(()=>z.subscribe(d=>{r[d?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=Rr(i,o)??null:a.current=null},[i,o]),L("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let d=x=>{x.__devtoolsSelection={node:i,app:s},D.send({type:"select-node"}),D.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,x.focus()};q.value?d(q.value):e().then(x=>d(x))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function zr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function jr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Nn=()=>{z.value=!z.value,D.send({type:"set-inspect-enabled",value:z.value})};function In(e,t){let{damping:r}=t,n=E(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function St(){let e=E(!1),t=je(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Fr(),a=i.value==="left"||i.value==="right",u=I(!1),c=In(r.value,{damping:.4});return Se([r],c.set),re(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Z,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(_r,{in:e.value,duration:{in:40,out:150},element:d=>{if(d==="exited")return null;let x=d==="entered"?"1":"0.5",S=d==="entered"?"1":"0";return f(Z,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${x})\`,opacity:S},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(zr,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Nn,style:{transform:\`scale(\${x})\`,opacity:S},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f(jr,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(Tr,null))),f(Ir,null))}var Wr=\`*, ::before, ::after {
|
|
1769
|
+
\`}function Br(e){let t=Rt(e);if(l){let r=Gr(e);r&&(t=\`\${t} (\${r})\`)}return t}function Rt(e){return e.displayName??(e.name||"Anonymous Function")}function Gr(e){return e.toString().match(/\\/\\/ \\[kiru_devtools\\]:(.*)/)?.[1]??null}var we={stack:new Array,current:function(){return this.stack[this.stack.length-1]}},$=new Map,H=new Map;function ee(e,t=!1){return y.isSignal(e)?t?e.value:e.peek():e}var Ye=()=>{$.forEach(e=>e()),$.clear()};var ae={parentStack:[],childIdxStack:[],eventDeferrals:new Map,parent:function(){return this.parentStack[this.parentStack.length-1]},clear:function(){this.parentStack.length=0,this.childIdxStack.length=0},pop:function(){this.parentStack.pop(),this.childIdxStack.pop()},push:function(e){this.parentStack.push(e),this.childIdxStack.push(0)},currentChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]]},nextChild:function(){return this.parentStack[this.parentStack.length-1].childNodes[this.childIdxStack[this.childIdxStack.length-1]++]},bumpChildIndex:function(){this.childIdxStack[this.childIdxStack.length-1]++},captureEvents:function(e){Ot(e,!0),this.eventDeferrals.set(e,[])},resetEvents:function(e){this.eventDeferrals.delete(e)},releaseEvents:function(e){Ot(e,!1);let t=this.eventDeferrals.get(e);for(;t?.length;)t.shift()()}},qr=e=>{let t=e.target;!e.isTrusted||!t||ae.eventDeferrals.get(t)?.push(()=>t.dispatchEvent(e))},Ot=(e,t)=>{for(let r in e)if(r.startsWith("on")){let n=r.substring(2);e[t?"addEventListener":"removeEventListener"](n,qr,{passive:!0})}};var rt=!1,Je=!1,Dt=e=>{e.preventDefault(),e.stopPropagation(),Je=!0},le=null;function Pt(){rt=!0,le=document.activeElement,le&&le!==document.body&&le.addEventListener("blur",Dt)}function Lt(){Je&&(le.removeEventListener("blur",Dt),le.isConnected&&le.focus(),Je=!1),rt=!1}function Ze(e,t){if(typeof e=="function"){e(t);return}if(y.isSignal(e)){e.sneak(t),e.notify({filter:r=>typeof r=="function"});return}e.current=t}function Vt(e){let t=e.type;return t=="#text"?Xr(e):Ge.has(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function Xr(e){let{nodeValue:t}=e.props;if(!y.isSignal(t))return document.createTextNode(t);let r=t.peek()??"",n=document.createTextNode(r);return et(e,n,t),n}function Yr(e,t,r){let n=Qe.get(e)??{},o=n[t]=s=>{if(rt){s.preventDefault(),s.stopPropagation();return}r(s)};return Qe.set(e,n),o}var Qe=new WeakMap;function $t(e){let t=e.dom,r=e.prev?.props??{},n=e.props??{},o=new Set([...Object.keys(r),...Object.keys(n)]),s=C.current==="hydrate";o.forEach(i=>{let a=r[i],u=n[i];if(be.internalProps.includes(i)&&i!=="innerHTML"){i==="ref"&&a!==u&&(a&&Ze(a,null),u&&Ze(u,t));return}if(be.isEvent(i)){if(a!==u||C.current==="hydrate"){let c=i.replace(Tt,""),d=c==="focus"||c==="blur";i in r&&t.removeEventListener(c,d?Qe.get(e)?.[c]:a),i in n&&t.addEventListener(c,d?Yr(e,c,u):u)}return}if(!(t instanceof Text)){if(a===u||s&&t.getAttribute(i)===u)return;if(y.isSignal(a)&&e.cleanups){let c=e.cleanups[i];c&&(c(),delete e.cleanups[i])}if(y.isSignal(u))return en(e,t,i,u,a);Ae(t,i,u,a);return}y.isSignal(u)||t.nodeValue!==u&&(t.nodeValue=u)})}function Jr(e){return e.multiple?Array.from(e.selectedOptions).map(t=>t.value):e.value}function Ht(e,t){if(!e.multiple||t===void 0||t===null||t===""){e.value=t;return}Array.from(e.options).forEach(r=>{r.selected=t.indexOf(r.value)>-1})}var Zr={value:"input",checked:"change",open:"toggle",volume:"volumechange",playbackRate:"ratechange",currentTime:"timeupdate"},Qr=["progress","meter","number","range"];function en(e,t,r,n,o){let s=e.cleanups??(e.cleanups={}),[i,a]=r.split(":");if(i!=="bind")return s[r]=n.subscribe((p,v)=>{Ae(t,r,p,v),l&&window.__kiru?.profilingContext?.emit("signalAttrUpdate",J(e))}),Ae(t,r,n.peek(),ee(o));let u=Zr[a];if(!u){l&&console.error(\`[kiru]: \${a} is not a valid element binding attribute.\`);return}let c=t instanceof HTMLSelectElement,d=c?p=>Ht(t,p):p=>t[a]=p,x=p=>{d(p),l&&window.__kiru?.profilingContext?.emit("signalAttrUpdate",J(e))},S=p=>{n.sneak(p),n.notify({filter:v=>v!==x})},m;if(a==="value"){let p=Qr.indexOf(t.type)!==-1;m=()=>{let v=t.value;c?v=Jr(t):typeof n.peek()=="number"&&p&&(v=t.valueAsNumber),S(v)}}else m=p=>{let v=p.target[a];a==="currentTime"&&n.peek()===v||S(v)};t.addEventListener(u,m);let g=n.subscribe(x);return s[r]=()=>{t.removeEventListener(u,m),g()},Ae(t,a,n.peek(),ee(o))}function et(e,t,r){(e.cleanups??(e.cleanups={})).nodeValue=r.subscribe((n,o)=>{n!==o&&(t.nodeValue=n,l&&window.__kiru?.profilingContext?.emit("signalTextUpdate",J(e)))})}function Ft(e){let t=ae.nextChild();if(!t)throw new _({message:"Hydration mismatch - no node found",vNode:e});let r=t.nodeName;if(Ge.has(r)||(r=r.toLowerCase()),e.type!==r)throw new _({message:\`Hydration mismatch - expected node of type \${e.type.toString()} but received \${r}\`,vNode:e});if(e.dom=t,e.type!=="#text"&&!(e.flags&V)){$t(e);return}y.isSignal(e.props.nodeValue)&&et(e,t,e.props.nodeValue);let n=e,o=e.sibling;for(;o&&o.type==="#text";){let s=o;ae.bumpChildIndex();let i=String(ee(n.props.nodeValue)??""),a=n.dom.splitText(i.length);s.dom=a,y.isSignal(s.props.nodeValue)&&et(s,a,s.props.nodeValue),n=o,o=o.sibling}}function Nt(e,t,r,n=!1){if(r===null)return e.removeAttribute(t),!0;switch(typeof r){case"undefined":case"function":case"symbol":return e.removeAttribute(t),!0;case"boolean":if(n&&!r)return e.removeAttribute(t),!0}return!1}function tn(e,t,r){let n=qe.has(t);Nt(e,t,r,n)||e.setAttribute(t,n&&typeof r=="boolean"?"":String(r))}var rn=["INPUT","TEXTAREA"],nn=e=>rn.indexOf(e.nodeName)>-1;function Ae(e,t,r,n){if(r!==n)switch(t){case"style":return an(e,r,n);case"className":return sn(e,r);case"innerHTML":return on(e,r);case"muted":e.muted=!!r;return;case"value":if(e.nodeName==="SELECT")return Ht(e,r);let o=r==null?"":String(r);if(nn(e)){e.value=o;return}e.setAttribute("value",o);return;case"checked":if(e.nodeName==="INPUT"){e.checked=!!r;return}e.setAttribute("checked",String(r));return;default:return tn(e,Ut(t),r)}}function on(e,t){if(t==null||typeof t=="boolean"){e.innerHTML="";return}e.innerHTML=String(t)}function sn(e,t){let r=ee(t);if(!r)return e.removeAttribute("class");e.setAttribute("class",r)}function an(e,t,r){if(Nt(e,"style",t))return;if(typeof t=="string"){e.setAttribute("style",t);return}let n={};typeof r=="string"?e.setAttribute("style",""):typeof r=="object"&&r&&(n=r);let o=t;new Set([...Object.keys(n),...Object.keys(o)]).forEach(i=>{let a=n[i],u=o[i];if(a!==u){if(u===void 0){e.style[i]="";return}e.style[i]=u}})}function ln(e){let t=e.parent,r=t?.dom;for(;t&&!r;)t=t.parent,r=t?.dom;if(!r||!t){if(!e.parent&&e.dom)return e;throw new _({message:"No DOM parent found while attempting to place node.",vNode:e})}return t}function un(e,t){let{node:r,lastChild:n}=t,o=e.dom;if(n){n.after(o);return}let s=It(e,r);if(s){r.dom.insertBefore(o,s);return}r.dom.appendChild(o)}function It(e,t){let r=e;for(;r;){let n=r.sibling;for(;n;){if(!(n.flags&(A|V))){let o=cn(n);if(o?.isConnected)return o}n=n.sibling}if(r=r.parent,!r||r.flags&V||r===t)return}}function cn(e){let t=e;for(;t;){if(t.dom)return t.dom;if(t.flags&V)return;t=t.child}}function zt(e){if(C.current==="hydrate")return W(e,ye);let t={node:e.dom?e:ln(e)};tt(e,t,(e.flags&A)>0),e.dom&&!(e.flags&V)&&jt(e,t,!1),ye(e)}function tt(e,t,r){let n=e.child;for(;n;){if(n.flags&he){n.flags&A&&fn(n,t),ye(n),n=n.sibling;continue}n.dom?(tt(n,{node:n},!1),n.flags&V||jt(n,t,r)):tt(n,t,(n.flags&A)>0||r),ye(n),n=n.sibling}}function jt(e,t,r){(r||!e.dom.isConnected||e.flags&A)&&un(e,t),(!e.prev||e.flags&P)&&$t(e),t.lastChild=e.dom}function Wt(e){e===e.parent?.child&&(e.parent.child=e.sibling);let t;l&&(t=J(e)),W(e,r=>{let{hooks:n,subs:o,cleanups:s,dom:i,props:{ref:a}}=r;for(o?.forEach(u=>u()),s&&Object.values(s).forEach(u=>u());n?.length;)n.pop().cleanup?.();l&&(window.__kiru?.profilingContext?.emit("removeNode",t),i instanceof Element&&delete i.__kiruNode),i&&(a&&Ze(a,null),i.isConnected&&!(r.flags&V)&&i.remove(),delete r.dom)}),e.parent=null}function fn(e,t){if(!e.child)return;let r=[];if(Kt(e.child,r),r.length===0)return;let{node:n,lastChild:o}=t;if(o)o.after(...r);else{let s=It(e,n),i=n.dom;s?s.before(...r):i.append(...r)}t.lastChild=r[r.length-1]}function Kt(e,t){let r=e;for(;r;)r.dom?t.push(r.dom):r.child&&Kt(r.child,t),r=r.sibling}function Bt(e){return typeof e=="function"&&typeof e[Ce]?.arePropsEqual=="function"}function f(e,t=null,...r){if(e===Z)return Z({children:r,...t});let n={type:e,flags:0,index:0,depth:0,props:{},parent:null,sibling:null,child:null,prev:null,deletions:null};if(Bt(e)&&(n.flags|=Te,n.arePropsEqual=e[Ce].arePropsEqual),t!==null){let{key:s,ref:i,...a}=t;Gt(s)&&(n.props.key=s.toString()),qt(i)&&(n.props.ref=i),Object.assign(n.props,a)}let o=r.length===1?r[0]:r.length>1?r:null;return o!==null&&(n.props.children=o),n}function Z({children:e,key:t}){return f(X,t?{key:t}:null,e)}var it;function Oe(e,t){return l&&(it=J(e)),Array.isArray(t)?(l&&(rr in t&&hn(e,t),gn(e,t)),dn(e,t)):pn(e,t)}function pn(e,t){let r=e.child;if(r===null)return Zt(e,t);let n=r.sibling,o=Yt(e,r,t);if(o!==null)return r&&r!==o&&!o.prev?ot(e,r):n&&ot(e,n),o;{let s=nr(r),i=Qt(s,e,0,t);if(i!==null){let a=i.prev;if(a!==null){let u=a.props.key;s.delete(u===void 0?a.index:u)}Me(i,0,0)}return s.forEach(a=>Re(e,a)),i}}function dn(e,t){let r=null,n=null,o=e.child,s=null,i=0,a=0;for(;o!==null&&a<t.length;a++){o.index>a?(s=o,o=null):s=o.sibling;let c=Yt(e,o,t[a]);if(c===null){o===null&&(o=s);break}o&&!c.prev&&Re(e,o),i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c,o=s}if(a===t.length)return ot(e,o),r;if(o===null){for(;a<t.length;a++){let c=Zt(e,t[a]);c!==null&&(i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c)}return r}let u=nr(o);for(;a<t.length;a++){let c=Qt(u,e,a,t[a]);if(c!==null){let d=c.prev;if(d!==null){let x=d.props.key;u.delete(x===void 0?d.index:x)}i=Me(c,i,a),n===null?r=c:n.sibling=c,n=c}}return u.forEach(c=>Re(e,c)),r}function Yt(e,t,r){let n=t?.props.key;return er(r)?n!==void 0||t?.type==="#text"&&y.isSignal(t.props.nodeValue)?null:Xt(e,t,""+r):y.isSignal(r)?t&&t.props.nodeValue!==r?null:Xt(e,t,r):ue(r)?r.props.key!==n?null:mn(e,t,r):Array.isArray(r)?n!==void 0?null:(l&&st(r),Jt(e,t,r)):null}function Xt(e,t,r){if(t===null||t.type!=="#text"){l&&U();let o=f("#text",{nodeValue:r});return K(o,e),o}return l&&ve(),t.props.nodeValue!==r&&(t.props.nodeValue=r,t.flags|=P),t.sibling=null,t}function mn(e,t,r){let{type:n,props:o}=r;if(l&&typeof n=="function"&&(n=T(n)),n===X)return Jt(e,t,o.children||[],o);if(t?.type===n)return l&&ve(),t.index=0,t.sibling=null,typeof n=="string"?tr(t.props,o)&&(t.flags|=P):t.flags|=P,t.props=o,t.memoizedProps=r.memoizedProps,t;l&&U();let s=f(n,o);return K(s,e),s}function Jt(e,t,r,n={}){if(t===null||t.type!==X){l&&U();let o=f(X,{children:r,...n});return K(o,e),o}return l&&ve(),t.props={...t.props,...n,children:r},t.flags|=P,t.sibling=null,t}function Zt(e,t){if(er(t)){l&&U();let r=f("#text",{nodeValue:""+t});return K(r,e),r}if(y.isSignal(t)){l&&U();let r=f("#text",{nodeValue:t});return K(r,e),r}if(ue(t)){l&&U();let r=f(t.type,t.props);return K(r,e),r.flags|=A,r}if(Array.isArray(t)){l&&(U(),st(t));let r=Z({children:t});return K(r,e),r}return null}function Me(e,t,r){e.index=r;let n=e.prev;if(n!==null){let o=n.index;return o<t?(e.flags|=A,t):o}else return e.flags|=A,t}function Qt(e,t,r,n){if(y.isSignal(n)||typeof n=="string"&&n!==""||typeof n=="number"||typeof n=="bigint"){let s=e.get(r);if(s){if(s.props.nodeValue===n)return s;s.type==="#text"&&y.isSignal(s.props.nodeValue)&&s.cleanups?.nodeValue?.()}l&&U();let i=f("#text",{nodeValue:n});return K(i,t),i.flags|=A,i.index=r,i}if(ue(n)){let{type:s,props:i}=n,a=i.key,u=e.get(a===void 0?r:a);if(u?.type===s)return l&&ve(),typeof s=="string"?tr(u.props,i)&&(u.flags|=P):u.flags|=P,u.props=i,u.sibling=null,u.index=r,u;l&&U();let c=f(n.type,n.props);return K(c,t),c.flags|=A,c.index=r,c}if(Array.isArray(n)){let s=e.get(r);if(l&&st(n),s)return l&&ve(),s.flags|=P,s.props.children=n,s;l&&U();let i=Z({children:n});return K(i,t),i.flags|=A,i.index=r,i}return null}function er(e){return typeof e=="string"&&e!==""||typeof e=="number"||typeof e=="bigint"}function tr(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!0;for(let o of r)if(!(o==="children"||o==="key")&&e[o]!==t[o])return!0;return!1}function K(e,t){e.parent=t,e.depth=t.depth+1}function ve(){"window"in globalThis&&window.__kiru?.profilingContext?.emit("updateNode",it)}function U(){"window"in globalThis&&window.__kiru?.profilingContext?.emit("createNode",it)}var rr=Symbol("kiru:marked-list-child");function st(e){Object.assign(e,{[rr]:!0})}function nr(e){let t=new Map;for(;e;){let r=e.props.key;t.set(r===void 0?e.index:r,e),e=e.sibling}return t}function Re(e,t){e.deletions===null?e.deletions=[t]:e.deletions.push(t)}function ot(e,t){for(;t;)Re(e,t),t=t.sibling}function gn(e,t){let r=new Set,n=!1;for(let o of t){if(!ue(o))continue;let s=o.props.key;if(typeof s=="string"){if(!n&&r.has(s)){let i=ir(e);or(\`\${i} component produced a child in a list with a duplicate key prop: "\${s}". Keys should be unique so that components maintain their identity across updates\`),n=!0}r.add(s)}}}function hn(e,t){let r=!1,n=!1;for(let o of t){if(!ue(o))continue;typeof o.props.key=="string"?r=!0:n=!0}if(n&&r){let o=ir(e);or(\`\${o} component produced a child in a list without a valid key prop\`)}}function or(e){let t=\`[kiru]: \${e}. See https://kirujs.dev/keys-warning for more information.\`;console.error(t)}var nt=new WeakMap;function ir(e){if(nt.has(e))return nt.get(e);let t=e.parent,r;for(;!r&&t;)typeof t.type=="function"&&(r=t.type),t=t.parent;let n=\`<\${r?.displayName||r?.name||"Anonymous Function"} />\`;return nt.set(e,n),n}var B,G=[],de=!1,lt=[],De=[],ut=!1,ct=!1,ft=!1,pt=0,sr=[],dt=[],ar=-1;function gt(e){if(de){lt.push(e);return}e()}function Pe(){de&&(window.cancelAnimationFrame(ar),lr())}function ht(e){e.flags|=se,G.push(e),de=!0,Pe()}function O(e){if(C.current==="hydrate")return gt(()=>mt(e));mt(e)}function wn(){de||(de=!0,ar=window.requestAnimationFrame(lr))}function bn(){for(de=!1;lt.length;)lt.shift()()}function mt(e){if(ut&&(ct=!0),M.current===e){l&&window.__kiru?.profilingContext?.emit("updateDirtied",B),ft=!0;return}if(!(e.flags&(se|pe))){if(e.flags|=se,!G.length)return G.push(e),wn();G.push(e)}}function yn(e){W(e,t=>t.flags|=pe),De.push(e)}var vn=(e,t)=>t.depth-e.depth,te=null;function lr(){if(l){let t=De[0]??G[0];t?(B=J(t),window.__kiru?.profilingContext?.beginTick(B)):B=null}let e=1;for(Pt();G.length;){G.length>e&&G.sort(vn),te=G.shift(),e=G.length;let t=te.flags;if(!(t&pe)&&t&se){let r=te;for(;r=xn(r););for(;De.length;)Wt(De.pop());zt(te),te.flags&=~se}}if(Lt(),ut=!0,at(sr),ut=!1,ct)return _n(),at(dt),ct=!1,pt++,l&&(window.__kiru?.profilingContext?.endTick(B),window.__kiru?.profilingContext?.emit("updateDirtied",B)),Pe();pt=0,bn(),at(dt),l&&(window.__kiru.emit("update",B),window.__kiru?.profilingContext?.emit("update",B),window.__kiru?.profilingContext?.endTick(B))}function xn(e){let t=!0;try{typeof e.type=="string"?kn(e):wt(e.type)?En(e):t=Sn(e)}catch(n){l&&window.__kiru?.emit("error",B,n instanceof Error?n:new Error(String(n)));let o=ur(e);if(o){let s=o.error=n instanceof Error?n:new Error(String(n));return o.props.onError?.(s),o.depth<te.depth&&(te=o),o}if(_.isKiruError(n)){if(n.customNodeStack&&setTimeout(()=>{throw new Error(n.customNodeStack)}),n.fatal)throw n;console.error(n);return}setTimeout(()=>{throw n})}if(e.deletions!==null&&(e.deletions.forEach(yn),e.deletions=null),t&&e.child)return e.child;let r=e;for(;r;){if(r.immediateEffects&&(sr.push(...r.immediateEffects),r.immediateEffects=void 0),r.effects&&(dt.push(...r.effects),r.effects=void 0),r===te)return;if(r.sibling)return r.sibling;r=r.parent,C.current==="hydrate"&&r?.dom&&ae.pop()}}function En(e){let{props:t,type:r}=e,n=t.children;if(r===oe){let{props:{dependents:o,value:s},prev:i}=e;o.size&&i&&i.props.value!==s&&o.forEach(mt)}else if(r===ie){let o=e,{error:s}=o;s&&(n=typeof t.fallback=="function"?t.fallback(s):t.fallback,delete o.error)}e.child=Oe(e,n)}function Sn(e){let{type:t,props:r,subs:n,prev:o,flags:s}=e;if(s&Te){if(e.memoizedProps=r,o?.memoizedProps&&e.arePropsEqual(o.memoizedProps,r)&&!e.hmrUpdated)return e.flags|=he,!1;e.flags&=~he}try{M.current=e;let i,a=0;do{if(e.flags&=~se,ft=!1,Y.current=0,n&&(n.forEach(u=>u()),n.clear()),l){if(i=T(t)(r),e.hmrUpdated&&e.hooks&&e.hookSig){let u=e.hooks.length;if(Y.current<u){for(let c=Y.current;c<u;c++)e.hooks[c].cleanup?.();e.hooks.length=Y.current,e.hookSig.length=Y.current}}if(delete e.hmrUpdated,++a>Be)throw new _({message:"Too many re-renders. Kiru limits the number of renders to prevent an infinite loop.",fatal:!0,vNode:e});continue}i=t(r)}while(ft);return e.child=Oe(e,i),!0}finally{M.current=null}}function kn(e){let{props:t,type:r}=e;l&&bt(e),e.dom||(C.current==="hydrate"?Ft(e):e.dom=Vt(e),l&&e.dom instanceof Element&&(e.dom.__kiruNode=e)),r!=="#text"&&(e.child=Oe(e,t.children),e.child&&C.current==="hydrate"&&ae.push(e.dom))}function _n(){if(pt>Be)throw new _("Maximum update depth exceeded. This can happen when a component repeatedly calls setState during render or in useLayoutEffect. Kiru limits the number of nested updates to prevent infinite loops.")}function at(e){for(let t=0;t<e.length;t++)e[t]();e.length=0}var cr;(function(e){e.Start="start",e.End="end"})(cr||(cr={}));var me=null,fr=new Set;function h(e,t,r){let n=M.current;if(n||Cn(e),l&&me!==null&&!fr.has(e+me))throw fr.add(e+me),new _({message:\`Nested primitive "useHook" calls are not supported. "\${e}" was called inside "\${me}". Strange will most certainly happen.\`,vNode:n});let o=(a,u)=>{if(u?.immediate){(n.immediateEffects??(n.immediateEffects=[])).push(a);return}(n.effects??(n.effects=[])).push(a)},s=Y.current++,i=n.hooks?.at(s);if(l){me=e,n.hooks??(n.hooks=[]),n.hookSig??(n.hookSig=[]),n.hookSig[s]?n.hookSig[s]!==e&&(console.warn(\`[kiru]: hooks must be called in the same order. Hook "\${e}" was called in place of "\${n.hookSig[s]}". Strange things may happen.\`),i?.cleanup?.(),n.hooks.length=s,n.hookSig.length=s,i=void 0):n.hookSig[s]=e;let a;i?a=i:(a=typeof t=="function"?t():{...t},a.name=e),n.hooks[s]=a;try{return r({hook:a,isInit:!i,isHMR:n.hmrUpdated,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(u){throw u}finally{me=null}}try{let a=i??(typeof t=="function"?t():{...t});return n.hooks??(n.hooks=[]),n.hooks[s]=a,r({hook:a,isInit:!i,update:()=>O(n),queueEffect:o,vNode:n,index:s})}catch(a){throw a}}function Cn(e){throw new _(\`Hook "\${e}" must be used at the top level of a component or inside another composite hook.\`)}function F(e){e.cleanup&&(e.cleanup(),e.cleanup=void 0)}function R(e,t){return e===void 0||t===void 0||e.length!==t.length||e.length>0&&t.some((r,n)=>!Object.is(r,e[n]))}var pr,y=class e{constructor(t,r){this[pr]=!0,this.$id=Ve(),this.$value=t,r&&(this.displayName=r),l?(H.set(this.$id,new Set),this.$initialValue=yt(t),this[k]={provide:()=>this,inject:n=>{H.get(this.$id)?.clear?.(),H.delete(this.$id),this.$id=n.$id,n.__next=this,this.$initialValue===n.$initialValue?this.$value=n.$value:this.notify()},destroy:()=>{}}):this.$subs=new Set}get value(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),t.$value}return e.entangle(this),this.$value}set value(t){if(l){let r=T(this);if(Object.is(r.$value,t))return;r.$prevValue=r.$value,r.$value=t,r.notify();return}Object.is(this.$value,t)||(this.$prevValue=this.$value,this.$value=t,this.notify())}peek(){return this.onBeforeRead?.(),l?T(this).$value:this.$value}sneak(t){if(l){let r=T(this);r.$prevValue=r.$value,r.$value=t;return}this.$prevValue=this.$value,this.$value=t}toString(){if(this.onBeforeRead?.(),l){let t=T(this);return e.entangle(t),\`\${t.$value}\`}return e.entangle(this),\`\${this.$value}\`}subscribe(t){return l?(H.get(this.$id).add(t),()=>H.get(this.$id)?.delete(t)):(this.$subs.add(t),()=>this.$subs.delete(t))}notify(t){if(l)return H.get(this.$id)?.forEach(r=>{if(t?.filter&&!t.filter(r))return;let{$value:n,$prevValue:o}=T(this);return r(n,o)});this.$subs.forEach(r=>{if(!(t?.filter&&!t.filter(r)))return r(this.$value,this.$prevValue)})}static isSignal(t){return typeof t=="object"&&!!t&&Ke in t}static subscribers(t){return l?H.get(t.$id):t.$subs}static makeReadonly(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&!r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},configurable:!0})}static makeWritable(t){let r=Object.getOwnPropertyDescriptor(t,"value");return r&&r.writable?t:Object.defineProperty(t,"value",{get:function(){return e.entangle(this),this.$value},set:function(n){this.$value=n,this.notify()},configurable:!0})}static entangle(t){let r=M.current,n=we.current();if(n){(!r||r&&w())&&n.set(t.$id,t);return}if(!r||!w())return;let o=t.subscribe(()=>O(r));(r.subs??(r.subs=new Set)).add(o)}static configure(t,r){t.onBeforeRead=r}static dispose(t){if(t.$isDisposed=!0,l){H.delete(t.$id);return}t.$subs.clear()}};pr=Ke;var Le=(e,t)=>new y(e,t),E=(e,t)=>h("useSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&(n&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()}),set:({value:s})=>{r.signal.value=s}},initialArgs:[e,t]}),o)){let[s,i]=r.dev.initialArgs;(s!==e||i!==t)&&(r.cleanup?.(),n=!0,r.dev.initialArgs=[e,t])}return n&&(r.cleanup=()=>y.dispose(r.signal),r.signal=new y(e,t)),r.signal});function $e(e){let{id:t,subs:r,fn:n,deps:o=[],onDepChanged:s}=e,i;$.delete(t);let a=!!M.current&&!w();a||(i=new Map,we.stack.push(i));let u=n(...o.map(c=>c.value));if(!a){for(let[d,x]of r)i.has(d)||(x(),r.delete(d));let c=()=>{$.size||queueMicrotask(Ye),$.set(t,s)};for(let[d,x]of i){if(r.has(d))continue;let S=x.subscribe(c);r.set(d,S)}we.stack.pop()}return u}var xe=class e extends y{constructor(t,r){if(super(void 0,r),this.$getter=t,this.$unsubs=new Map,this.$isDirty=!0,l){let n=this[k].inject;this[k]={provide:()=>this,inject:o=>{n(o),e.stop(o),this.$isDirty=o.$isDirty},destroy:()=>{}}}y.configure(this,()=>{this.$isDirty&&(l&&this.$isDisposed||e.run(this))})}get value(){return super.value}set value(t){}subscribe(t){return this.$isDirty&&e.run(this),super.subscribe(t)}static dispose(t){e.stop(t),y.dispose(t)}static stop(t){let{$id:r,$unsubs:n}=T(t);$.delete(r),n.forEach(o=>o()),n.clear(),t.$isDirty=!0}static run(t){let r=T(t),{$id:n,$getter:o,$unsubs:s}=r,i=$e({id:n,subs:s,fn:()=>o(r.$value),onDepChanged:()=>{if(r.$isDirty=!0,l){if(!H?.get(n)?.size)return}else if(!t.$subs.size)return;e.run(r),!Object.is(r.$value,r.$prevValue)&&r.notify()}});r.sneak(i),r.$isDirty=!1}},dr=(e,t)=>new xe(e,t),vt=(e,t)=>h("useComputedSignal",{signal:null},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({displayName:r.signal.displayName,value:r.signal.peek()})}},o&&(r.cleanup?.(),n=!0)),n&&(r.cleanup=()=>xe.dispose(r.signal),r.signal=dr(e,t)),r.signal));var Ee=class e{constructor(t,r){if(this.id=Ve(),this.getter=t,this.deps=r,this.unsubs=new Map,this.isRunning=!1,this.cleanup=null,l&&(this[k]={provide:()=>this,inject:n=>{n.isRunning||this.stop()},destroy:()=>{this.stop()}},"window"in globalThis)){let n=window.__kiru.HMRContext.signals;n.isWaitingForNextWatchCall()&&n.pushWatch(this)}this.start()}start(){if(!this.isRunning){if(this.isRunning=!0,l&&"window"in globalThis&&window.__kiru?.HMRContext?.isReplacement())return queueMicrotask(()=>{this.isRunning&&e.run(this)});e.run(this)}}stop(){$.delete(this.id),this.unsubs.forEach(t=>t()),this.unsubs.clear(),this.cleanup?.(),this.cleanup=null,this.isRunning=!1}static run(t){let r=T(t),{id:n,getter:o,unsubs:s,deps:i}=r;r.cleanup=$e({id:n,subs:s,fn:o,deps:i,onDepChanged:()=>{r.cleanup?.(),e.run(r)}})??null}};function mr(e,t){if(typeof e=="function")return new Ee(e);let r=e,n=t;return new Ee(n,r)}function Se(e,t){if(w())return h("useWatch",{watcher:null},({hook:r,isInit:n,isHMR:o})=>{if(l&&o&&(r.cleanup?.(),n=!0),n){let s=r.watcher=mr(e,t);r.cleanup=()=>s.stop()}return r.watcher})}var be={internalProps:["children","ref","key","innerHTML"],isEvent:e=>e.startsWith("on"),isProperty:e=>!be.internalProps.includes(e)&&!be.isEvent(e)};function Ut(e){switch(e){case"className":return"class";case"htmlFor":return"for";case"tabIndex":case"formAction":case"formMethod":case"formEncType":case"contentEditable":case"spellCheck":case"allowFullScreen":case"autoPlay":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"noModule":case"noValidate":case"popoverTarget":case"popoverTargetAction":case"playsInline":case"readOnly":case"itemscope":case"rowSpan":case"crossOrigin":return e.toLowerCase();default:return e.indexOf("-")>-1?e:e.startsWith("aria")?"aria-"+e.substring(4).toLowerCase():At.get(e)||e}}function yt(e,t={functions:!0}){let r=new WeakSet;return JSON.stringify(e,(n,o)=>{if(typeof o=="object"&&o!==null){if(r.has(o))return"[CIRCULAR]";r.add(o)}return typeof o=="function"?t.functions?o.toString():\`[FUNCTION (\${o.name||"anonymous"})]\`:o})}function T(e){let t=e;if(l)for(;"__next"in t;)t=t.__next;return t}function w(){return C.current==="dom"||C.current==="hydrate"}function ue(e){return typeof e=="object"&&e!==null&&"type"in e}function wt(e){return e===X||e===oe||e===ie}function gr(e){return e.type===X}function J(e){let t=e;for(;t;){if(t.app)return e.app=t.app;t=t.parent}return null}function ye(e){let{props:{children:t,...r},memoizedProps:n,index:o}=e;e.prev={props:r,memoizedProps:n,index:o},e.flags&=~(P|A|pe)}function hr(e,t){if(t.depth<e.depth)return!1;if(e===t)return!0;let r=!1,n=[e];for(;n.length;){let o=n.pop();if(o===t)return!0;o.child&&n.push(o.child),r&&o.sibling&&n.push(o.sibling),r=!0}return!1}function W(e,t){t(e);let r=e.child;for(;r;)t(r),r.child&&W(r,t),r=r.sibling}function Xe(e,t){let r=e.parent;for(;r;){if(t(r))return r;r=r.parent}return null}function ur(e){return Xe(e,t=>t.type===ie)}function bt(e){if("children"in e.props&&e.props.innerHTML)throw new _({message:"Cannot use both children and innerHTML on an element",vNode:e});for(let t in e.props)if("bind:"+t in e.props)throw new _({message:\`Cannot use both bind:\${t} and \${t} on an element\`,vNode:e})}function Gt(e){return typeof e=="string"||typeof e=="number"}function qt(e){return typeof e=="function"||typeof e=="object"&&!!e&&"current"in e||y.isSignal(e)}var Tn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";function Ve(e=10,t=Tn){let r="";for(let n=0;n<e;n++)r+=t[Math.random()*t.length|0];return r}var j=Object.freeze(()=>{});function wr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&k in e&&typeof e[k]=="object"&&!!e[k]}function br(){let e=new Map,t=null,r=null,n=!1,o=()=>n,s=!1,i=[],a=[];return{register:S=>{if(r===null)throw new Error("[kiru]: HMR could not register: No active module");let m=new Set;for(let[g,p]of Object.entries(S)){let v=r.hotVars.get(g);if(p.value.__devtoolsFileLink=p.link,typeof p.value=="function"&&v?.value&&(v.value.__next=p.value),p.type==="createStore"&&window.__kiru.stores.add(g,p.value),r.hotVars.set(g,p),!!v){if(wr(v.value)&&wr(p.value)){p.value[k].inject(v.value[k].provide()),v.value[k].destroy();continue}v.type==="component"&&p.type==="component"&&window.__kiru.apps.forEach(fe=>{W(fe.rootNode,ge=>{ge.type===v.value&&(ge.type=p.value,m.add(fe),ge.hmrUpdated=!0)})})}}if(m.forEach(g=>g.rootNode&&O(g.rootNode)),n=!1,i.length){let g=0;for(;g<i.length;g++){let p=i[g],v=r.unnamedWatchers[g];v&&(p[k].inject(v[k].provide()),v[k].destroy()),r.unnamedWatchers[g]=p}for(;g<r.unnamedWatchers.length;g++)r.unnamedWatchers[g][k].destroy();r.unnamedWatchers.length=i.length,i.length=0}r=null,t=null},prepare:S=>{let m=e.get(S);if(n=!!m,!m)m={hotVars:new Map,unnamedWatchers:[]},e.set(S,m);else for(;a.length;)a.shift()();r=m,t=S},isReplacement:o,signals:{registerNextWatch(){s=!0},isWaitingForNextWatchCall(){return s},pushWatch(S){i.push(S),s=!1}},onHmr:S=>{a.push(S)},getCurrentFilePath(){return t}}}function yr(){let e=new Map,t=new Map;return{appStats:t,emit:(r,n)=>{e.get(r)?.forEach(o=>o(n))},addEventListener:(r,n)=>{e.has(r)||e.set(r,new Set),e.get(r).add(n)},removeEventListener:(r,n)=>{e.has(r)&&e.get(r).delete(n)},mountDuration:r=>{let n=t.get(r);return n?n.mountDuration:0},totalTicks:r=>{let n=t.get(r);return n?n.totalTicks:0},lastTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps[n.timestamps.length-1];return o.end-o.start},averageTickDuration:r=>{let n=t.get(r);if(!n)return 0;let o=n.timestamps.filter(s=>s.end!==1/0);return o.reduce((s,i)=>s+(i.end-i.start),0)/o.length},beginTick:r=>{t.has(r)||t.set(r,{mountDuration:1/0,timestamps:[],totalTicks:0});let n=t.get(r);n.totalTicks++,n.timestamps.push({start:performance.now(),end:1/0})},endTick:r=>{if(!t.has(r))return;let n=t.get(r),o=n.timestamps[n.timestamps.length-1];o.end=performance.now(),n.mountDuration===1/0&&(n.mountDuration=o.end-o.start),n.timestamps.length>100&&n.timestamps.shift()}}}function An(){let e=new Map,t=new Set;function r(i,a){e.has(i)||(e.set(i,a),o())}function n(i){e.has(i)&&(e.delete(i),o())}function o(){let i=Object.fromEntries(e);t.forEach(a=>a(i))}function s(i){return t.add(i),i(Object.fromEntries(e)),()=>t.delete(i)}return{add:r,delete:n,subscribe:s,get size(){return e.size}}}function vr(){let e=new Set,t=new Map,r,n,o;function s(c,d,x){t.get(c)?.forEach(S=>S(d,x))}function i(c,d){t.has(c)||t.set(c,new Set),t.get(c).add(d)}function a(c,d){t.get(c)?.delete(d)}let u={get apps(){return Array.from(e)},get stores(){return r},get HMRContext(){return n},get profilingContext(){return o},emit:s,on:i,off:a};return i("mount",c=>e.add(c)),i("unmount",c=>e.delete(c)),l&&(n=br(),o=yr(),r=An()),u}var Mn=0;function xr(e,t,r){let n=f(t.nodeName.toLowerCase(),{});if(l){if(t.__kiruNode)throw new Error("[kiru]: container in use - call unmount on the previous app first.");t.__kiruNode=n}n.dom=t,n.flags|=V;let o=Mn++,s=r?.name??\`App-\${o}\`,i={id:o,name:s,rootNode:n,render:a,unmount:u};l&&(n.app=i,window.__kiru?.emit("mount",i));function a(c){n.props.children=c,ht(n)}function u(){n.props.children=null,ht(n),l&&(delete t.__kiruNode,delete n.app,window.__kiru?.emit("unmount",i))}return a(e),i}function ce(e){return w()?h("useState",{state:void 0,dispatch:j},({hook:t,isInit:r,update:n,isHMR:o})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.state}),set:({value:s})=>t.state=s},initialArgs:[e]}),o)){let[s]=t.dev.initialArgs;s!==e&&(r=!0,t.dev.initialArgs=[e])}return r&&(t.state=typeof e=="function"?e():e,t.dispatch=s=>{let i=typeof s=="function"?s(t.state):s;Object.is(t.state,i)||(t.state=i,n())}),[t.state,t.dispatch]}):[typeof e=="function"?e():e,j]}function Er(e){let t={[_t]:!0,Provider:({value:r,children:n})=>{let[o]=ce(()=>new Set);return f(oe,{value:r,ctx:t,dependents:o},typeof n=="function"?n(r):n)},default:()=>e,set displayName(r){this.Provider.displayName=r},get displayName(){return this.Provider.displayName||"Anonymous Context"}};if(l){let r=t;r[k]={inject:n=>{let o=t.Provider;window.__kiru.apps.forEach(s=>{W(s.rootNode,i=>{i.type===n.Provider&&(i.type=o,i.hmrUpdated=!0,O(i))})})},destroy:()=>{},provide:()=>t}}return t}function Q(e,t){return w()?h("useCallback",{callback:e,deps:t},({hook:r,isHMR:n})=>(l&&(r.dev={devtools:{get:()=>({callback:r.callback,dependencies:r.deps})}},n&&(r.deps=[])),R(t,r.deps)&&(r.deps=t,r.callback=e),r.callback)):e}function N(e,t){if(w())return h("useEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)}))})}function re(e,t){if(w())return h("useLayoutEffect",{deps:t},({hook:r,isInit:n,isHMR:o,queueEffect:s})=>{l&&(r.dev={devtools:{get:()=>({callback:e,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,F(r),s(()=>{let i=e();typeof i=="function"&&(r.cleanup=i)},{immediate:!0}))})}function ke(e,t){return w()?h("useMemo",{deps:t,value:void 0},({hook:r,isInit:n,isHMR:o})=>(l&&(r.dev={devtools:{get:()=>({value:r.value,dependencies:r.deps})}},o&&(n=!0)),(n||R(t,r.deps))&&(r.deps=t,r.value=e()),r.value)):e()}function I(e){return w()?h("useRef",{ref:{current:e}},({hook:t,isInit:r,isHMR:n})=>{if(l&&(r&&(t.dev={devtools:{get:()=>({value:t.ref.current}),set:({value:o})=>t.ref.current=o},initialArgs:[t.ref.current]}),n)){let[o]=t.dev.initialArgs;o!==e&&(t.ref={current:e},t.dev.initialArgs=[e])}return t.ref}):{current:e}}var Da="window"in globalThis?window.__KIRU_LAZY_CACHE??(window.__KIRU_LAZY_CACHE=new Map):new Map;function _r(e){let[t,r]=ce(e.initialState||"exited"),n=I(null);re(()=>{e.in&&t!=="entered"&&t!=="entering"?(o("entering"),s("entered")):!e.in&&t!=="exited"&&t!=="exiting"&&(o("exiting"),s("exited"))},[e.in,t]),N(()=>()=>kr(n.current),[]);let o=Q(i=>{kr(n.current),r(i),(i==="entered"||i==="exited")&&e.onTransitionEnd&&e.onTransitionEnd(i)},[]),s=Q(i=>{n.current=window.setTimeout(()=>o(i),On(i,e.duration))},[e.duration]);return e.element(t)}var Sr=150;function On(e,t){if(typeof t=="number")return t;switch(e){case"entered":return t?.in??Sr;case"exited":return t?.out??Sr}}function kr(e){e!=null&&window.clearTimeout(e)}var Cr;l&&"window"in globalThis&&((Cr=globalThis.window).__kiru??(Cr.__kiru=vr()));var Tr=()=>f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},f("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"}));var He="kiru.devtools.anchorPosition",Ar={x:-16,y:-16};var xt=(e,t,r)=>{if(!t.current)return{...Ar};let n=window.innerWidth/e.width,o=window.innerHeight/e.height,s=null,i=null;return e.snapSide==="left"?s=(t.current.offsetWidth-r.width.value)*-1+16:e.snapSide==="right"?s=-16:e.snapSide==="bottom"?i=-16:e.snapSide==="top"&&(i=(window.innerHeight-r.height.value)*-1+16),{x:s??e.x*n,y:i??e.y*o}},Mr=e=>{if(e==null)return null;let t=null,r=e?.__kiruNode?.parent;for(;r;){if(typeof r.type=="function"&&!gr(r)){t=r;break}r=r.parent}return t},Rr=(e,t)=>{let r=[],n=[t.__kiruNode];for(;n.length;){let s=n.pop();if(s===e)break;s?.dom&&r.push(s),s?.parent&&n.push(s.parent)}if(r.length===0)return;let o=r[r.length-1].dom;return o instanceof Element?o:void 0};var Dr={arrayChunkSize:10,objectKeysChunkSize:100};function Pr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let n in r)if(typeof t[n]!=typeof e[n]||typeof e[n]=="object"&&!Pr(e[n],t[n]))return!1;return!0}var Ln={...Dr},Or=localStorage.getItem("kiru.devtools.userSettings");if(Or)try{let e=JSON.parse(Or);Pr(Dr,e)&&(Ln=e)}catch(e){console.error("kiru.devtools.userSettings error",e)}var Tu=Er({userSettings:null,saveUserSettings:()=>{}});var Lu=Object.freeze(()=>{});var Fn="kiru-devtools";"window"in globalThis&&(window.__devtoolsSelection??(window.__devtoolsSelection=null));var Et=class extends BroadcastChannel{send(t){super.postMessage(t)}removeEventListener(t){return super.removeEventListener("message",t)}addEventListener(t){return super.addEventListener("message",t)}},D=new Et(Fn);var nc=Symbol.for("devtools.hookGroup");var L=(e,t,r={})=>{N(()=>{let n=window,o=r?.ref?.();return o?n=o:r.ref&&console.warn("useEventListener ref failed, using window"),n.addEventListener(e,t,r),()=>{n.removeEventListener(e,t,r)}},[t])};var Fe=()=>{let e=E({x:0,y:0}),t=E({x:0,y:0}),r=E({x:0,y:0});return L("mousemove",n=>{e.value={x:n.x,y:n.y},t.value={x:n.movementX,y:n.movementY},r.value={x:n.clientX,y:n.clientY}}),{mouse:e,delta:t,client:r}};var Ne="window"in globalThis&&"ResizeObserver"in globalThis.window,Lr=(e,t,r=void 0)=>w()?Ne?h("useResizeObserver",{resizeObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n&&(o.resizeObserver=new ResizeObserver(t),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null}),s(()=>{R([e.current],o.deps)&&(o.deps=[e.current],o.resizeObserver?.disconnect?.(),e.current&&o.resizeObserver?.observe(e.current,r))}),{isSupported:Ne,start:()=>{o.resizeObserver==null&&(o.resizeObserver=new ResizeObserver(t),e.current&&o.resizeObserver.observe(e.current,r),o.cleanup=()=>{o.resizeObserver?.disconnect?.(),o.resizeObserver=null})},stop:()=>{F(o)}})):{isSupported:Ne,start:()=>{},stop:()=>{}}:{isSupported:Ne,start:()=>{},stop:()=>{}};var Ie="window"in globalThis&&"MutationObserver"in globalThis.window,Vr=(e,t,r=void 0)=>w()?Ie?h("useMutationObserver",{mutationObserver:null,deps:[e.current]},({isInit:n,hook:o,queueEffect:s})=>(n?(s(()=>{o.deps=[e.current],o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r)}),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null}):R([e.current],o.deps)&&(o.deps=[e.current],o.mutationObserver?.disconnect?.(),e.current&&o.mutationObserver?.observe(e.current,r)),{isSupported:Ie,start:()=>{o.mutationObserver==null&&(o.mutationObserver=new MutationObserver(t),e.current&&o.mutationObserver.observe(e.current,r),o.cleanup=()=>{o.mutationObserver?.disconnect?.(),o.mutationObserver=null})},stop:()=>{F(o)}})):{isSupported:Ie,start:()=>{},stop:()=>{}}:{isSupported:Ie,start:()=>{},stop:()=>{}};var ze=(e,t={windowScroll:!0,windowResize:!0})=>{let r=t?.windowScroll??!0,n=t?.windowResize??!0,o=t.immediate??!0,s=E(0),i=E(0),a=E(0),u=E(0),c=E(0),d=E(0),x=E(0),S=E(0),m=()=>{let g=e.current;if(!g){s.value=0,i.value=0,a.value=0,u.value=0,c.value=0,d.value=0,x.value=0,S.value=0;return}let p=g.getBoundingClientRect();s.value=p.width,i.value=p.height,a.value=p.top,u.value=p.right,c.value=p.bottom,d.value=p.left,x.value=p.x,S.value=p.y};return Lr(e,m),Vr(e,m,{attributeFilter:["style","class"]}),L("scroll",()=>{r&&m()},{capture:!0,passive:!0}),L("resize",()=>{n&&m()},{passive:!0}),re(()=>{o&&m()},[]),{width:s,height:i,top:a,right:u,bottom:c,left:d,x,y:S,update:m}};var $r=(e,t)=>{if(!w())return{isActive:t?.immediate??!1,start:()=>null,stop:()=>null};let r=t?.fpsLimit?1e3/t.fpsLimit:null;return h("useRafFn",()=>({callback:e,refId:null,previousFrameTimestamp:0,isActive:t?.immediate??!1,rafLoop:()=>{}}),({isInit:n,hook:o,update:s})=>(o.callback=e,n&&(o.rafLoop=i=>{if(o.isActive===!1)return;o.previousFrameTimestamp||(o.previousFrameTimestamp=i);let a=i-o.previousFrameTimestamp;if(r&&a<r){o.refId=window.requestAnimationFrame(o.rafLoop);return}o.previousFrameTimestamp=i,o.callback({delta:a,timestamp:i}),o.refId=window.requestAnimationFrame(o.rafLoop)}),n&&t?.immediate&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s()),{isActive:o.isActive,start:()=>{o.isActive!==!0&&(o.isActive=!0,o.refId=window.requestAnimationFrame(o.rafLoop),o.cleanup=()=>{o.refId!=null&&window.cancelAnimationFrame(o.refId),o.isActive=!1},s())},stop:()=>{F(o),s()}}))};var Hr=e=>{let{x:t,y:r,multiple:n,immediate:o=!0}=e,s=E(null),a=$r(()=>{s.value=n?document.elementsFromPoint(t,r)??[]:document.elementFromPoint(t,r)??null},{immediate:o});return{element:s,...a}};var Fr=()=>{let{mouse:e}=Fe(),t=E(null),r=I(null),n=I(null),o=ze(r),s=E({x:-16,y:-16}),i=E({x:-16,y:-16}),a=E({width:window.innerWidth,height:window.innerHeight}),u=E("bottom"),c=I(null);re(()=>{let m=localStorage.getItem(He);if(m==null)return;let g=JSON.parse(m);a.value.width=window.innerWidth,a.value.height=window.innerHeight,u.value=g.snapSide,i.value=xt(g,n,o)},[Math.round(o.width.value),Math.round(o.height.value)]);let d=vt(()=>{let{x:m,y:g}=e.value;if(t.value===null)return null;let{x:p,y:v}=t.value;return{x:m-p,y:g-v}});L("dragstart",m=>{m.preventDefault(),t.value={x:m.x,y:m.y},s.value=i.value},{ref:()=>r.current}),L("mouseup",()=>{c.current&&(clearTimeout(c.current),c.current=null),t.peek()&&(t.value=null,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))});let x=Q(()=>{if(n.current==null)return;let m=n.current.offsetWidth;if(u.value==="right"){let g=Math.min(-16,i.value.y);i.value={x:-16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="left"){let g=Math.min(0,i.value.y);i.value={x:(m-o.width.value)*-1+16,y:Math.max(g,(window.innerHeight-o.height.value)*-1+16)}}else if(u.value==="top"){let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(m-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}else{let g=Math.min(-16,i.value.x);i.value={x:Math.max(g,(m-o.width.value)*-1+16),y:-16}}},[]);Se([d,e],(m,g)=>{if(m===null||!n.current)return;let{x:p,y:v}=g,fe=n.current.offsetWidth,ge=v>=window.innerHeight-100,kt=v<=100;if(!kt&&!ge){let ne=p>window.innerWidth/2;u.value=ne?"right":"left"}else u.value=kt?"top":"bottom";if(u.value==="right"){let ne=Math.min(-16,s.value.y+m.y);i.value={x:-16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="left"){let ne=Math.min(0,s.value.y+m.y);i.value={x:(fe-o.width.value)*-1+16,y:Math.max(ne,(window.innerHeight-o.height.value)*-1+16)};return}else if(u.value==="top"){let ne=Math.min(-16,s.value.x+m.x);i.value={x:Math.max(ne,(fe-o.width.value)*-1+16),y:(window.innerHeight-o.height.value)*-1+16};return}let Kr=Math.min(-16,s.value.x+m.x);i.value={y:-16,x:Math.max(Kr,(fe-o.width.value)*-1+16)}});let S=Q(()=>{n.current!==null&&(i.value=xt({width:a.value.width,height:a.value.height,x:i.value.x,y:i.value.y,snapSide:u.value},n,o),a.value.width=window.innerWidth,a.value.height=window.innerHeight,localStorage.setItem(He,JSON.stringify({...i.value,...a.value,snapSide:u.value})))},[Math.round(o.width.value),Math.round(o.height.value)]);return L("resize",S),{anchorRef:r,anchorCoords:i,viewPortRef:n,startMouse:t,elementBound:o,snapSide:u,updateAnchorPos:x}};var z=Le(!1);"window"in globalThis&&D.addEventListener(e=>{e.data.type==="set-inspect-enabled"&&(z.value=e.data.value)});var q=Le(null);var Nr="kiru-devtools-popup-size",je=()=>{let e=q.value;return Q(()=>new Promise((r,n)=>{if(e)if(e.closed)q.value=null;else return e.focus(),r(e);let o=sessionStorage.getItem(Nr),s=o?JSON.parse(o):{width:Math.floor(Math.min(1920,window.screen.width)/2),height:Math.floor(Math.min(1080,window.screen.height)/2)},i=\`popup,width=\${s.width},height=\${s.height};\`,a=window.open(window.__KIRU_DEVTOOLS_PATHNAME__,"_blank",i);if(!a)return console.error("[kiru]: Unable to open devtools window"),n();let u=c=>{c.data.type==="ready"&&(D.removeEventListener(u),console.debug("[kiru]: devtools window opened"),r(a),q.value=a,a.onbeforeunload=()=>{console.debug("[kiru]: devtools window closed"),q.value=null})};D.addEventListener(u),a.onresize=()=>{sessionStorage.setItem(Nr,JSON.stringify({width:a.innerWidth,height:a.innerHeight}))}}),[e])};var Ir=()=>{let e=je(),{mouse:t}=Fe(),r=Hr({x:t.value.x,y:t.value.y,immediate:!1}),n=r.element.value,o=z.value?n:null,s=ke(()=>{if(o&&window.__kiru){let c=window.__kiru.apps.find(d=>d.rootNode==null||o.__kiruNode==null?!1:hr(d.rootNode,o.__kiruNode));return c?.rootNode==null?null:c}return null},[o]),i=ke(()=>o?Mr(o):null,[o]),a=I(null),u=ze(a);return N(()=>z.subscribe(d=>{r[d?"start":"stop"]()}),[]),N(()=>{i&&o?a.current=Rr(i,o)??null:a.current=null},[i,o]),L("click",c=>{if(z.value===!0&&i&&s){c.preventDefault();let d=x=>{x.__devtoolsSelection={node:i,app:s},D.send({type:"select-node"}),D.send({type:"set-inspect-enabled",value:!1}),z.value=!1,a.current=null,x.focus()};q.value?d(q.value):e().then(x=>d(x))}}),i&&f("div",{className:"bg-[crimson]/80 fixed grid place-content-center pointer-events-none z-10 top-0 left-0",style:{width:\`\${u?.width}px\`,height:\`\${u?.height}px\`,transform:\`translate(\${u.x}px, \${u.y}px)\`}},f("p",null,i.type.name))};function zr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 -960 960 960",fill:"currentColor",...e},f("path",{d:"M710-150q-63 0-106.5-43.5T560-300q0-63 43.5-106.5T710-450q63 0 106.5 43.5T860-300q0 63-43.5 106.5T710-150Zm0-80q29 0 49.5-20.5T780-300q0-29-20.5-49.5T710-370q-29 0-49.5 20.5T640-300q0 29 20.5 49.5T710-230Zm-270-30H200q-17 0-28.5-11.5T160-300q0-17 11.5-28.5T200-340h240q17 0 28.5 11.5T480-300q0 17-11.5 28.5T440-260ZM250-510q-63 0-106.5-43.5T100-660q0-63 43.5-106.5T250-810q63 0 106.5 43.5T400-660q0 63-43.5 106.5T250-510Zm0-80q29 0 49.5-20.5T320-660q0-29-20.5-49.5T250-730q-29 0-49.5 20.5T180-660q0 29 20.5 49.5T250-590Zm510-30H520q-17 0-28.5-11.5T480-660q0-17 11.5-28.5T520-700h240q17 0 28.5 11.5T800-660q0 17-11.5 28.5T760-620Zm-50 320ZM250-660Z"}))}function jr(e){return f("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-square-mouse-pointer",...e},f("path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"}),f("path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"}))}var Nn=()=>{z.value=!z.value,D.send({type:"set-inspect-enabled",value:z.value})};function In(e,t){let{damping:r}=t,n=E(e),o=I(e);return N(()=>{let s=null,i=()=>{if(Math.sqrt(Math.pow(o.current.x-n.value.x,2)+Math.pow(o.current.y-n.value.y,2))<5)return;let u=n.value.x+(o.current.x-n.value.x)*r,c=n.value.y+(o.current.y-n.value.y)*r;n.value={x:u,y:c},s=window.requestAnimationFrame(i)};return s=window.requestAnimationFrame(i),()=>{s!=null&&window.cancelAnimationFrame(s)}},[e.x,e.y]),Object.assign(n,{set:(s,i)=>{o.current=s,i?.hard&&(n.value=s)}})}function St(){let e=E(!1),t=je(),{anchorCoords:r,anchorRef:n,viewPortRef:o,startMouse:s,snapSide:i}=Fr(),a=i.value==="left"||i.value==="right",u=I(!1),c=In(r.value,{damping:.4});return Se([r],c.set),re(()=>{u.current===!1&&c.set(r.value,{hard:!0}),u.current=!0},[]),f(Z,null,f("div",{ref:o,className:"w-full h-0 fixed top-0 left-0 z-[-9999] overflow-scroll pointer-events-none"}),f("div",{ref:n,draggable:!0,className:\`flex \${a?"flex-col":""} \${e.value?"rounded-3xl":"rounded-full"} p-1 gap-1 items-center will-change-transform bg-crimson\`,style:{transform:\`translate3d(\${Math.round(c.value.x)}px, \${Math.round(c.value.y)}px, 0)\`}},f(_r,{in:e.value,duration:{in:40,out:150},element:d=>{if(d==="exited")return null;let x=d==="entered"?"1":"0.5",S=d==="entered"?"1":"0";return f(Z,null,f("button",{title:"Open Devtools",onclick:t,style:{transform:\`scale(\${x})\`,opacity:S},className:"transition text-white rounded-full p-1 hover:bg-[#0003]"},f(zr,{width:16,height:16})),f("button",{title:"Toggle Component Inspection",onclick:Nn,style:{transform:\`scale(\${x})\`,opacity:S},className:\`transition text-white rounded-full p-1 hover:bg-[#0003] \${z.value?"bg-[#0003]":""}\`},f(jr,{width:16,height:16})))}}),f("button",{className:"bg-crimson rounded-full p-1"+(s.value?" pointer-events-none":""),onclick:()=>e.value=!e.value,tabIndex:-1},f(Tr,null))),f(Ir,null))}var Wr=\`*, ::before, ::after {
|
|
1770
1770
|
--tw-border-spacing-x: 0;
|
|
1771
1771
|
--tw-border-spacing-y: 0;
|
|
1772
1772
|
--tw-translate-x: 0;
|