what-core 0.6.5 → 0.6.7

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.
@@ -1,2 +1,2 @@
1
- var E=!(typeof process<"u"),w=null;var M=null,z=null,I=null,oe=!1,Z=0,D=[],K=!1,Ne=new WeakMap,Te=Symbol("needs_upstream");function U(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return M&&(r.add(M),M.deps.push(r)),t;E&&oe&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&ie(r))}return o.set=i=>{E&&oe&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i=="function"?i(t):i;Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&ie(r))},o.peek=()=>t,o.subscribe=i=>B(()=>i(o())),o._signal=!0,E&&(o._subs=r,n&&(o._debugName=n)),E&&w&&w.onSignalCreate(o),o}function se(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=Ne.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function B(e,n){let t=ke(e);t._level=1;let r=M;M=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{M=r}se(t),n?.stable&&(t._stable=!0);let o=()=>Be(t);return z&&z.disposals.push(o),o}function ke(e,n){let t={fn:e,deps:[],lazy:n||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null};return E&&w&&w.onEffectCreate(t),t}function De(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){E&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let t=M;M=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:e}),E&&console.warn("[what] Error in stable effect:",r)}finally{M=t}E&&w?.onEffectRun&&w.onEffectRun(e);return}if(ce(e),e._cleanup){try{e._cleanup()}catch(t){w?.onError&&w.onError(t,{type:"effect-cleanup",effect:e}),E&&console.warn("[what] Error in effect cleanup:",t)}e._cleanup=null}let n=M;M=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===Te||w?.onError&&w.onError(t,{type:"effect",effect:e}),t}finally{M=n}E&&w?.onEffectRun&&w.onEffectRun(e)}function Be(e){if(e.disposed=!0,E&&w&&w.onEffectDispose(e),ce(e),e._cleanup){try{e._cleanup()}catch(n){E&&console.warn("[what] Error in effect cleanup on dispose:",n)}e._cleanup=null}}function ce(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var Q=0,R=null,q=0;function ie(e){if(Q===0){Q=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(Z===0&&n._stable){let t=M;M=null;try{let r=n.fn();if(typeof r=="function"){if(n._cleanup)try{n._cleanup()}catch{}n._cleanup=r}}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:n}),E&&console.warn("[what] Error in stable effect:",r)}finally{M=t}}else if(!n._pending){n._pending=!0;let t=n._level,r=D.length;r>0&&D[r-1]._level>t&&(K=!0),D.push(n)}}if(q>0){let n=0;for(;n<q;){let t=R[n];R[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(Z===0&&r._stable){let o=M;M=null;try{let i=r.fn();if(typeof i=="function"){if(r._cleanup)try{r._cleanup()}catch{}r._cleanup=i}}catch(i){w?.onError&&w.onError(i,{type:"effect",effect:r}),E&&console.warn("[what] Error in stable effect:",i)}finally{M=o}}else if(!r._pending){r._pending=!0;let o=r._level,i=D.length;i>0&&D[i-1]._level>o&&(K=!0),D.push(r)}}}q=0}}finally{Q=0}Z===0&&D.length>0&&He()}else R===null&&(R=[]),q>=R.length?R.push(e):R[q]=e,q++}var Y=!1;function He(){Y||(Y=!0,queueMicrotask(()=>{Y=!1,$e()}))}var F=!1;function $e(){if(!F){F=!0;try{let e=0;for(;D.length>0&&e<25;){let n=D;D=[],n.length>1&&K&&n.sort((t,r)=>t._level-r._level),K=!1;for(let t=0;t<n.length;t++){let r=n[t];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;De(r),!r._computed&&r.deps.length!==o&&se(r)}}e++}if(e>=25){for(let n=0;n<D.length;n++)D[n]._pending=!1;if(D.length=0,E){let t=D.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${t.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected")}}finally{F=!1}}}function J(e){let n=M;M=null;try{return e()}finally{M=n}}function W(e){let n=z,t=I,r={disposals:[],owner:I,children:[],_disposed:!1};I&&I.children.push(r),z=r,I=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)fe(r.children[i]);r.children.length=0;for(let i=r.disposals.length-1;i>=0;i--)r.disposals[i]();if(r.disposals.length=0,r.owner){let i=r.owner.children.indexOf(r);i>=0&&r.owner.children.splice(i,1)}}})}finally{z=n,I=t}}function fe(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)fe(e.children[n]);e.children.length=0;for(let n=e.disposals.length-1;n>=0;n--)e.disposals[n]();e.disposals.length=0}}var le=null;function ae(e){le=e}function ue(e,n){let t=n||le?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var Oe=null;function pe(e){Oe=e}var je=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),ve="http://www.w3.org/2000/svg",me=new Set,X=new WeakMap;function Re(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function ee(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function de(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let n of e.cleanups)try{n()}catch(t){console.error("[what] cleanup error:",t)}if(e.effects)for(let n of e.effects)try{n()}catch{}if(e.hooks){for(let n of e.hooks)if(n&&typeof n.cleanup=="function")try{n.cleanup()}catch(t){console.error("[what] hook cleanup error:",t)}}if(e._cleanupCallbacks)for(let n of e._cleanupCallbacks)try{n()}catch(t){console.error("[what] onCleanup error:",t)}E&&w?.onComponentUnmount&&w.onComponentUnmount(e),me.delete(e)}}function O(e){if(!e)return;e._componentCtx&&de(e._componentCtx);let n=X.get(e);if(n&&de(n),e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let t in e._propEffects)try{e._propEffects[t]()}catch{}if(e.childNodes)for(let t of e.childNodes)O(t)}function $(e,n,t){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Re(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],a=document.createDocumentFragment();a.appendChild(r),a.appendChild(o);let s=B(()=>{let l=e(),c=l==null||l===!1||l===!0?[]:Array.isArray(l)?l:[l],d=o.parentNode;if(d){for(let u of i)O(u),u.parentNode===d&&d.removeChild(u);i=[];for(let u of c){let _=$(u,d,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);d.insertBefore(_,o);for(let g of y)i.push(g)}else d.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,a}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=$(o,n,t);i&&r.appendChild(i)}return r}return ee(e)&&typeof e.tag=="function"||ee(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?he(e,n,t):ee(e)?Ue(e,n,t):document.createTextNode(String(e))}var N=[];function ge(){return N[N.length-1]}ae(ge);pe(ge);function he(e,n,t){let{tag:r,props:o,children:i}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let h=r;r=function(p){return new h(p).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return We(e,n);if(r==="__suspense"||e.tag==="__suspense")return Ie(e,n);if(r==="__portal"||e.tag==="__portal")return qe(e,n);let a={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:N[N.length-1]||null,_errorBoundary:(()=>{let h=N[N.length-1];for(;h;){if(h._errorBoundary)return h._errorBoundary;h=h._parentCtx}return null})()},s=document.createComment("c:start"),l=document.createComment("c:end");X.set(s,a),a._startComment=s,a._endComment=l;let c=document.createDocumentFragment();c._componentCtx=a,a._wrapper=s,me.add(a),E&&w?.onComponentMount&&w.onComponentMount(a);let d=i.length===0?void 0:i.length===1?i[0]:i,u=U({...o,children:d});a._propsSignal=u;let _=new Proxy({},{get(h,b){return u()[b]},has(h,b){let p=u();return b in p},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,b){let p=u();if(b in p)return{value:p[b],writable:!1,enumerable:!0,configurable:!0}}});N.push(a);let y;try{y=r(_)}catch(h){if(N.pop(),!ue(h,a))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(l),c}N.pop(),a.mounted=!0,a._mountCallbacks&&queueMicrotask(()=>{if(!a.disposed)for(let h of a._mountCallbacks)try{h()}catch(b){console.error("[what] onMount error:",b)}}),c.appendChild(s);let g=Array.isArray(y)?y:[y];for(let h of g){let b=$(h,c,t);b&&c.appendChild(b)}return c.appendChild(l),c}function We(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,a=e.children,s=document.createComment("eb:start"),l=document.createComment("eb:end"),c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_errorBoundary:r,_startComment:s,_endComment:l};X.set(s,c);let d=document.createDocumentFragment();d._componentCtx=c,d.appendChild(s),d.appendChild(l);let u=B(()=>{let _=t();if(N.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==l;){let g=s.nextSibling;O(g),g.parentNode.removeChild(g)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=a,y=Array.isArray(y)?y:[y];for(let g of y){let h=$(g,n);h&&(l.parentNode?l.parentNode.insertBefore(h,l):d.insertBefore(h,l))}N.pop()});return c.effects.push(u),d}function Ie(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,a=document.createComment("sb:start"),s=document.createComment("sb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_startComment:a,_endComment:s};X.set(a,l);let c=document.createDocumentFragment();c._componentCtx=l,c.appendChild(a),c.appendChild(s);let d=B(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(N.push(l),a.parentNode)for(;a.nextSibling&&a.nextSibling!==s;){let g=a.nextSibling;O(g),g.parentNode.removeChild(g)}for(let g of y){let h=$(g,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}N.pop()});return l.effects.push(d),c}function qe(e,n){let{container:t}=e.props,r=e.children;if(!t)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null},i=document.createComment("portal");i._componentCtx=o;let a=[];for(let s of r){let l=$(s,t);l&&(t.appendChild(l),a.push(l))}return o._cleanupCallbacks=[()=>{for(let s of a)O(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function Ue(e,n,t){let{tag:r,props:o,children:i}=e,a=t||je.has(r),s=a?document.createElementNS(ve,r):document.createElement(r);o&&Ve(s,o,{},a);for(let l of i){let c=$(l,s,a&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function Ve(e,n,t,r){n=n||{},t=t||{};for(let o in n)if(!(o==="key"||o==="children")){if(o==="ref"){typeof n.ref=="function"?n.ref(e):n.ref&&(n.ref.current=e);continue}ye(e,o,n[o],r)}}function ye(e,n,t,r){if(typeof t=="function"&&!(n.startsWith("on")&&n.length>2)&&n!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[n])try{e._propEffects[n]()}catch{}e._propEffects[n]=B(()=>{let o=t();ye(e,n,o,r)});return}if(n.startsWith("on")&&n.length>2){let o=n.slice(2),i=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),i=!0);let a=o.toLowerCase(),s=i?a+"_capture":a,l=e._events?.[s];if(l&&l._original===t||(l&&e.removeEventListener(a,l,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),J(()=>t(u)));c._original=t,e._events[s]=c;let d=t._eventOpts;e.addEventListener(a,c,d||i||void 0);return}if(n==="className"||n==="class"){r?e.setAttribute("class",t||""):e.className=t||"";return}if(n==="style"){if(typeof t=="string")e.style.cssText=t,e._prevStyle=null;else if(typeof t=="object"){let o=e._prevStyle||{};for(let i in o)i in t||(e.style[i]="");for(let i in t)e.style[i]=t[i]??"";e._prevStyle={...t}}return}if(n==="dangerouslySetInnerHTML"){e.innerHTML=t?.__html??"";return}if(n==="innerHTML"){if(t==null)return;if(t&&typeof t=="object"&&"__html"in t)e.innerHTML=t.__html??"";else{E&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof t=="boolean"){t?e.setAttribute(n,""):e.removeAttribute(n);return}if(n.startsWith("data-")||n.startsWith("aria-")){e.setAttribute(n,t);return}if(r){t===!1||t==null?e.removeAttribute(n):e.setAttribute(n,t===!0?"":String(t));return}n in e?e[n]=t:e.setAttribute(n,t)}function Pe(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return $({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}var _e=new Set(["href","src","action","formaction","formAction"]);function ze(e){if(typeof e!="string")return!0;let n=e.trim().replace(/[\s\x00-\x1f]/g,"").toLowerCase();return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}var Ge={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},Ke=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function Ee(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Le(e){let n=e.trim(),t=Ee(n);if(Ke.has(t))return Je(n);let r=Ge[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let a=i.content.firstChild;for(let s=0;s<r.depth;s++)a=a.firstChild;return a.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var Ce=!1;function Se(e){return E&&!Ce&&(Ce=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Le(e)}function Je(e){let n=e.trim();if(Ee(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function Xe(e,n,t){if(typeof n=="function"){let r=null;return B(()=>{r=be(e,n(),r,t||null)}),r}return be(e,n,null,t||null)}function Ze(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function Qe(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function Ye(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function we(e){return e==null?[]:Array.isArray(e)?e:[e]}function Me(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)Me(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):Ze(e)?(t.push(e),t):Qe(e)?(t.push($(e,n,Ye(n))),t):(t.push(document.createTextNode(String(e))),t)}function Fe(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function be(e,n,t,r){if(!e||typeof e.insertBefore!="function")return E&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=we(t);for(let d=0;d<c.length;d++){let u=c[d];u.parentNode===e&&(O(u),e.removeChild(u))}return null}if((typeof n=="string"||typeof n=="number")&&t&&!Array.isArray(t)&&t.nodeType===3){let c=String(n);return t.textContent!==c&&(t.textContent=c),t}let i=Me(n,e,[]),a=we(t);if(Fe(a,i))return t;let s=new Set(i);for(let c=0;c<a.length;c++){let d=a[c];!s.has(d)&&d.parentNode===e&&(O(d),e.removeChild(d))}let l=o;for(let c=i.length-1;c>=0;c--){let d=i[c];(d.parentNode!==e||d.nextSibling!==l)&&(l&&l.parentNode!==e&&(l=null),l?e.insertBefore(d,l):e.appendChild(d)),l=d}return i.length===0?null:i.length===1?i[0]:i}function et(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,a)=>{let s=[],l=[],c=[],d=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,a||null),B(()=>{let _=e()||[];r?ot(i,u,s,_,l,c,n,r,d):tt(i,u,s,_,l,c,n),s=_.slice()}),u}}function tt(e,n,t,r,o,i,a){let s=r.length,l=t.length;if(s===0){if(l>0){for(let p=0;p<l;p++)i[p]?.(),o[p]?.parentNode===e&&(O(o[p]),e.removeChild(o[p]));o.length=0,i.length=0}return}if(l===0){let p=document.createDocumentFragment();for(let m=0;m<s;m++){let x=r[m],S=W(T=>(i[m]=T,a(x,m)));o[m]=S,p.appendChild(S)}e.insertBefore(p,n);return}let c=0,d=Math.min(l,s);for(;c<d&&t[c]===r[c];)c++;if(c===l&&c===s)return;let u=l-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),g=new Array(s);for(let p=0;p<c;p++)y[p]=o[p],g[p]=i[p];for(let p=_+1;p<s;p++){let m=u+1+(p-_-1);y[p]=o[m],g[p]=i[m]}let h=_-c+1,b=u-c+1;if(h===0)for(let p=c;p<=u;p++)i[p]?.(),o[p]?.parentNode&&o[p].parentNode.removeChild(o[p]);else if(b===0){let p=c<s&&y[_+1]?y[_+1]:n,m=document.createDocumentFragment();for(let x=c;x<=_;x++){let S=r[x],T=x;y[x]=W(k=>(g[T]=k,a(S,T))),m.appendChild(y[x])}e.insertBefore(m,p)}else nt(e,n,t,r,o,i,a,c,u,_,y,g);o.length=s,i.length=s;for(let p=0;p<s;p++)o[p]=y[p],i[p]=g[p]}function nt(e,n,t,r,o,i,a,s,l,c,d,u){let _=new Map;for(let m=s;m<=l;m++)_.set(t[m],m);let y=c-s+1,g=new Int32Array(y);g.fill(-1);for(let m=s;m<=c;m++){let x=_.get(r[m]);x!==void 0&&(_.delete(r[m]),d[m]=o[x],u[m]=i[x],g[m-s]=x)}for(let[,m]of _)i[m]?.(),o[m]?.parentNode&&o[m].parentNode.removeChild(o[m]);let h=y-rt(g,y),b=new Uint8Array(y);if(h>1){let m=new Int32Array(h),x=new Int32Array(h),S=0;for(let k=0;k<y;k++)g[k]!==-1&&(m[S]=g[k],x[S]=k,S++);let T=Ae(m,h);for(let k=0;k<T.length;k++)b[x[T[k]]]=1}else if(h===1){for(let m=0;m<y;m++)if(g[m]!==-1){b[m]=1;break}}for(let m=s;m<=c;m++)if(!d[m]){let x=r[m],S=m;d[m]=W(T=>(u[S]=T,a(x,S)))}let p=c+1<d.length&&d[c+1]?d[c+1]:n;for(let m=c;m>=s;m--){let x=m-s;(g[x]===-1||!b[x])&&(p&&p.parentNode!==e&&(p=n),e.insertBefore(d[m],p)),p=d[m]}}function rt(e,n){let t=0;for(let r=0;r<n;r++)e[r]===-1&&t++;return t}function Ae(e,n){if(n===0)return[];if(n===1)return[0];let t=new Int32Array(n),r=new Int32Array(n),o=1;t[0]=0,r[0]=-1;for(let s=1;s<n;s++)if(e[s]>e[t[o-1]])r[s]=t[o-1],t[o++]=s;else{let l=0,c=o-1;for(;l<c;){let d=l+c>>1;e[t[d]]<e[s]?l=d+1:c=d}t[l]=s,r[s]=l>0?t[l-1]:-1}let i=new Array(o),a=t[o-1];for(let s=o-1;s>=0;s--)i[s]=a,a=r[a];return i}function ot(e,n,t,r,o,i,a,s,l){let c=r.length,d=t.length;if(c===0){if(d>0){for(let f=0;f<d;f++)i[f]?.(),o[f]?.parentNode===e&&(O(o[f]),e.removeChild(o[f]));o.length=0,i.length=0,l&&l.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<c;C++){let L=r[C],H=C,A;if(l){let v=s(L),P=U(L);A=P,l.set(v,{itemSig:P})}else A=L;let j=W(v=>(i[H]=v,a(A,H)));o[C]=j,f.appendChild(j)}e.insertBefore(f,n);return}let u=0,_=Math.min(d,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let f=s(t[u]),C=s(r[u]);if(f!==C)break;l&&l.get(f).itemSig.set(r[u]),u++}let y=d-1,g=c-1;for(;y>=u&&g>=u;){if(t[y]===r[g]){y--,g--;continue}let f=s(t[y]),C=s(r[g]);if(f!==C)break;l&&l.get(f).itemSig.set(r[g]),y--,g--}if(u>y&&u>g)return;let h=new Array(c),b=new Array(c);for(let f=0;f<u;f++)h[f]=o[f],b[f]=i[f];for(let f=g+1;f<c;f++){let C=y+1+(f-g-1);h[f]=o[C],b[f]=i[C]}let p=g-u+1;if(y-u+1===0){let f=g+1<c&&h[g+1]?h[g+1]:n,C=document.createDocumentFragment();for(let L=u;L<=g;L++){let H=r[L],A=L,j;if(l){let v=s(H),P=U(H);j=P,l.set(v,{itemSig:P})}else j=H;h[L]=W(v=>(b[A]=v,a(j,A))),C.appendChild(h[L])}e.insertBefore(C,f),te(o,i,h,b,c);return}if(p===0){for(let f=u;f<=y;f++)i[f]?.(),o[f]?.parentNode&&e.removeChild(o[f]),l&&l.delete(s(t[f]));te(o,i,h,b,c);return}let x=new Map;for(let f=u;f<=y;f++)x.set(s(t[f]),f);let S=new Int32Array(p);S.fill(-1);for(let f=u;f<=g;f++){let C=s(r[f]),L=x.get(C);L!==void 0&&(x.delete(C),h[f]=o[L],b[f]=i[L],S[f-u]=L,l&&r[f]!==t[L]&&l.get(C).itemSig.set(r[f]))}for(let[f,C]of x)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),l&&l.delete(f);for(let f=u;f<=g;f++)if(!h[f]){let C=r[f],L=f,H;if(l){let A=s(C),j=U(C);H=j,l.set(A,{itemSig:j})}else H=C;h[f]=W(A=>(b[L]=A,a(H,L)))}let T=0,k=!0,re=-1;for(let f=0;f<p;f++)S[f]!==-1&&(T++,S[f]<=re&&(k=!1),re=S[f]);let G=new Uint8Array(p);if(k)for(let f=0;f<p;f++)S[f]!==-1&&(G[f]=1);else if(T>1){let f=new Int32Array(T),C=new Int32Array(T),L=0;for(let A=0;A<p;A++)S[A]!==-1&&(f[L]=S[A],C[L]=A,L++);let H=Ae(f,T);for(let A=0;A<H.length;A++)G[C[H[A]]]=1}else if(T===1){for(let f=0;f<p;f++)if(S[f]!==-1){G[f]=1;break}}let V=g+1<h.length&&h[g+1]?h[g+1]:n;for(let f=g;f>=u;f--){let C=f-u;(S[C]===-1||!G[C])&&(V&&V.parentNode!==e&&(V=n),e.insertBefore(h[f],V)),V=h[f]}te(o,i,h,b,c)}function te(e,n,t,r,o){e.length=o,n.length=o;for(let i=0;i<o;i++)e[i]=t[i],n[i]=r[i]}function it(e,n){for(let t in n){let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}typeof r=="function"&&!t.startsWith("on")?t==="class"||t==="className"?B(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?B(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):B(()=>{ne(e,t,r())}):ne(e,t,r)}}function ne(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if((_e.has(n)||_e.has(n.toLowerCase()))&&!ze(t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`);return}if(n==="class"||n==="className")e.className=t||"";else if(n==="dangerouslySetInnerHTML")e.innerHTML=t?.__html??"";else if(n==="innerHTML")t&&typeof t=="object"&&"__html"in t?e.innerHTML=t.__html??"":typeof console<"u"&&t!=null&&t!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style"){if(typeof t=="string")e.style.cssText=t;else if(typeof t=="object")for(let r in t)e.style[r]=t[r]??""}else n.startsWith("data-")||n.startsWith("aria-")?e.setAttribute(n,t):typeof t=="boolean"?t?e.setAttribute(n,""):e.removeAttribute(n):n in e?e[n]=t:e.setAttribute(n,t)}}var xe=new Set;function st(e){for(let n of e)xe.has(n)||(xe.add(n),document.addEventListener(n,t=>{let r=t.target,o="$$"+n;for(;r;){let i=r[o];if(i&&(i(t),t.cancelBubble))return;r=r.parentNode}}))}function ct(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function ft(e,n){B(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}export{Pe as _$createComponent,Le as _$template,Se as _template,ft as classList,st as delegateEvents,B as effect,Xe as insert,et as mapArray,ct as on,ne as setProp,it as spread,Se as template,J as untrack};
1
+ var E=!(typeof process<"u"),w=null;var A=null,z=null,V=null,ce=!1,Y=0,D=[],K=!1,De=new WeakMap,Be=Symbol("needs_upstream");function I(e,n){let t=e,r=new Set;function o(...i){if(i.length===0)return A&&(r.add(A),A.deps.push(r)),t;E&&ce&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i[0]=="function"?i[0](t):i[0];Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&fe(r))}return o.set=i=>{E&&ce&&console.warn("[what] Signal.set() called inside a computed function. This may cause infinite loops. Use effect() instead."+(n?` (signal: ${n})`:""));let a=typeof i=="function"?i(t):i;Object.is(t,a)||(t=a,E&&w&&w.onSignalUpdate(o),r.size>0&&fe(r))},o.peek=()=>t,o.subscribe=i=>B(()=>i(o())),o._signal=!0,E&&(o._subs=r,n&&(o._debugName=n)),E&&w&&w.onSignalCreate(o),o}function le(e){let n=0,t=e.deps;for(let r=0;r<t.length;r++){let o=De.get(t[r]);if(o){let i=o._level;i>n&&(n=i)}}e._level=n+1}function B(e,n){let t=$e(e);t._level=1;let r=A;A=t;try{let i=t.fn();typeof i=="function"&&(t._cleanup=i)}finally{A=r}le(t),n?.stable&&(t._stable=!0);let o=()=>Oe(t);return z&&z.disposals.push(o),o}function $e(e,n){let t={fn:e,deps:[],lazy:n||!1,_onNotify:null,disposed:!1,_pending:!1,_stable:!1,_level:0,_computed:!1,_computedSubs:null,_isDirty:null,_markDirty:null};return E&&w&&w.onEffectCreate(t),t}function He(e){if(e.disposed)return;if(e._stable){if(e._cleanup){try{e._cleanup()}catch(r){E&&console.warn("[what] Error in effect cleanup:",r)}e._cleanup=null}let t=A;A=null;try{let r=e.fn();typeof r=="function"&&(e._cleanup=r)}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:e}),E&&console.warn("[what] Error in stable effect:",r)}finally{A=t}E&&w?.onEffectRun&&w.onEffectRun(e);return}if(ae(e),e._cleanup){try{e._cleanup()}catch(t){w?.onError&&w.onError(t,{type:"effect-cleanup",effect:e}),E&&console.warn("[what] Error in effect cleanup:",t)}e._cleanup=null}let n=A;A=e;try{let t=e.fn();typeof t=="function"&&(e._cleanup=t)}catch(t){throw t===Be||w?.onError&&w.onError(t,{type:"effect",effect:e}),t}finally{A=n}E&&w?.onEffectRun&&w.onEffectRun(e)}function Oe(e){if(e.disposed=!0,E&&w&&w.onEffectDispose(e),ae(e),e._cleanup){try{e._cleanup()}catch(n){E&&console.warn("[what] Error in effect cleanup on dispose:",n)}e._cleanup=null}}function ae(e){let n=e.deps;for(let t=0;t<n.length;t++)n[t].delete(e);n.length=0}var F=0,U=null,W=0;function fe(e){if(F===0){F=1;try{for(let n of e)if(!n.disposed){if(n._onNotify)n._onNotify();else if(Y===0&&n._stable){let t=A;A=null;try{let r=n.fn();if(typeof r=="function"){if(n._cleanup)try{n._cleanup()}catch{}n._cleanup=r}}catch(r){w?.onError&&w.onError(r,{type:"effect",effect:n}),E&&console.warn("[what] Error in stable effect:",r)}finally{A=t}}else if(!n._pending){n._pending=!0;let t=n._level,r=D.length;r>0&&D[r-1]._level>t&&(K=!0),D.push(n)}}if(W>0){let n=0;for(;n<W;){let t=U[n];U[n]=null,n++;for(let r of t)if(!r.disposed){if(r._onNotify)r._onNotify();else if(Y===0&&r._stable){let o=A;A=null;try{let i=r.fn();if(typeof i=="function"){if(r._cleanup)try{r._cleanup()}catch{}r._cleanup=i}}catch(i){w?.onError&&w.onError(i,{type:"effect",effect:r}),E&&console.warn("[what] Error in stable effect:",i)}finally{A=o}}else if(!r._pending){r._pending=!0;let o=r._level,i=D.length;i>0&&D[i-1]._level>o&&(K=!0),D.push(r)}}}W=0}}finally{F=0}Y===0&&D.length>0&&je()}else U===null&&(U=[]),W>=U.length?U.push(e):U[W]=e,W++}var ee=!1;function je(){ee||(ee=!0,queueMicrotask(()=>{ee=!1,Re()}))}var te=!1;function Re(){if(!te){te=!0;try{let e=0;for(;D.length>0&&e<25;){let n=D;D=[],n.length>1&&K&&n.sort((t,r)=>t._level-r._level),K=!1;for(let t=0;t<n.length;t++){let r=n[t];if(r._pending=!1,!r.disposed&&!r._onNotify){let o=r.deps.length;He(r),!r._computed&&r.deps.length!==o&&le(r)}}e++}if(e>=25){for(let n=0;n<D.length;n++)D[n]._pending=!1;if(D.length=0,E){let t=D.slice(0,3).map(r=>r.fn?.name||r.fn?.toString().slice(0,60)||"(anonymous)");console.warn(`[what] Possible infinite effect loop detected (25 iterations). Likely cause: an effect writes to a signal it also reads, creating a cycle. Use untrack() to read signals without subscribing. Looping effects: ${t.join(", ")}`)}else console.warn("[what] Possible infinite effect loop detected")}}finally{te=!1}}}function J(e){let n=A;A=null;try{return e()}finally{A=n}}function v(e){let n=z,t=V,r={disposals:[],owner:V,children:[],_disposed:!1};V&&V.children.push(r),z=r,V=r;try{return e(()=>{if(!r._disposed){r._disposed=!0;for(let i=r.children.length-1;i>=0;i--)ue(r.children[i]);r.children.length=0;for(let i=r.disposals.length-1;i>=0;i--)r.disposals[i]();if(r.disposals.length=0,r.owner){let i=r.owner.children.indexOf(r);i>=0&&r.owner.children.splice(i,1)}}})}finally{z=n,V=t}}function ue(e){if(!e._disposed){e._disposed=!0;for(let n=e.children.length-1;n>=0;n--)ue(e.children[n]);e.children.length=0;for(let n=e.disposals.length-1;n>=0;n--)e.disposals[n]();e.disposals.length=0}}var pe=null;function de(e){pe=e}function he(e,n){let t=n||pe?.();for(;t;){if(t._errorBoundary)return t._errorBoundary(e),!0;t=t._parentCtx}return!1}var Ue=null;function me(e){Ue=e}var ve=new Set(["href","src","action","formaction","poster","cite","background","xlink:href"]),Ve=new Set(["srcset"]);function ne(e){return String(e).toLowerCase()}function We(e){return String(e).trim().replace(/[\s\x00-\x1f\x7f]/g,"").toLowerCase()}function ge(e){if(typeof e!="string")return!0;let n=We(e);return!(n.startsWith("javascript:")||n.startsWith("data:")||n.startsWith("vbscript:"))}function Ie(e){return typeof e!="string"?!0:e.split(",").every(n=>{let t=n.trim().split(/\s+/,1)[0]||"";return t===""||ge(t)})}function qe(e){return ve.has(ne(e))}function Pe(e){return Ve.has(ne(e))}function X(e,n){return Pe(e)?Ie(n):qe(e)?ge(n):!0}function Z(e){return e==="className"?"class":e==="htmlFor"?"for":ne(e)==="formaction"?"formaction":e}var ze=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","symbol","clipPath","mask","pattern","image","text","tspan","textPath","foreignObject","linearGradient","radialGradient","stop","marker","animate","animateTransform","animateMotion","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),Ge="http://www.w3.org/2000/svg",Ce=new Set,Q=new WeakMap;function Ke(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function re(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function ye(e){if(!e.disposed){if(e.disposed=!0,e.cleanups)for(let n of e.cleanups)try{n()}catch(t){console.error("[what] cleanup error:",t)}if(e.effects)for(let n of e.effects)try{n()}catch{}if(e.hooks){for(let n of e.hooks)if(n&&typeof n.cleanup=="function")try{n.cleanup()}catch(t){console.error("[what] hook cleanup error:",t)}}if(e._cleanupCallbacks)for(let n of e._cleanupCallbacks)try{n()}catch(t){console.error("[what] onCleanup error:",t)}E&&w?.onComponentUnmount&&w.onComponentUnmount(e),Ce.delete(e)}}function O(e){if(!e)return;e._componentCtx&&ye(e._componentCtx);let n=Q.get(e);if(n&&ye(n),e._dispose)try{e._dispose()}catch{}if(e._propEffects)for(let t in e._propEffects)try{e._propEffects[t]()}catch{}if(e.childNodes)for(let t of e.childNodes)O(t)}function H(e,n,t){if(e==null||e===!1||e===!0)return document.createComment("");if(typeof e=="string"||typeof e=="number")return document.createTextNode(String(e));if(Ke(e))return e;if(typeof e=="function"){let r=document.createComment("fn"),o=document.createComment("/fn"),i=[],a=document.createDocumentFragment();a.appendChild(r),a.appendChild(o);let s=B(()=>{let l=e(),c=l==null||l===!1||l===!0?[]:Array.isArray(l)?l:[l],d=o.parentNode;if(d){for(let u of i)O(u),u.parentNode===d&&d.removeChild(u);i=[];for(let u of c){let _=H(u,d,n?._isSvg);if(_)if(_.nodeType===11){let y=Array.from(_.childNodes);d.insertBefore(_,o);for(let g of y)i.push(g)}else d.insertBefore(_,o),i.push(_)}}});return r._dispose=s,o._dispose=s,a}if(Array.isArray(e)){let r=document.createDocumentFragment();for(let o of e){let i=H(o,n,t);i&&r.appendChild(i)}return r}return re(e)&&typeof e.tag=="function"||re(e)&&(e.tag==="__errorBoundary"||e.tag==="__suspense"||e.tag==="__portal")?_e(e,n,t):re(e)?Qe(e,n,t):document.createTextNode(String(e))}var N=[];function we(){return N[N.length-1]}de(we);me(we);function _e(e,n,t){let{tag:r,props:o,children:i}=e;if(typeof r=="function"&&(r.prototype?.isReactComponent||r.prototype?.render)){let h=r;r=function(p){return new h(p).render()},r.displayName=h.displayName||h.name||"ClassComponent"}if(r==="__errorBoundary"||e.tag==="__errorBoundary")return Je(e,n);if(r==="__suspense"||e.tag==="__suspense")return Xe(e,n);if(r==="__portal"||e.tag==="__portal")return Ze(e,n);let a={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,Component:r,_parentCtx:N[N.length-1]||null,_errorBoundary:(()=>{let h=N[N.length-1];for(;h;){if(h._errorBoundary)return h._errorBoundary;h=h._parentCtx}return null})()},s=document.createComment("c:start"),l=document.createComment("c:end");Q.set(s,a),a._startComment=s,a._endComment=l;let c=document.createDocumentFragment();c._componentCtx=a,a._wrapper=s,Ce.add(a),E&&w?.onComponentMount&&w.onComponentMount(a);let d=i.length===0?void 0:i.length===1?i[0]:i,u=I({...o,children:d});a._propsSignal=u;let _=new Proxy({},{get(h,b){return u()[b]},has(h,b){let p=u();return b in p},ownKeys(){let h=u();return Reflect.ownKeys(h)},getOwnPropertyDescriptor(h,b){let p=u();if(b in p)return{value:p[b],writable:!1,enumerable:!0,configurable:!0}}});N.push(a);let y;try{y=r(_)}catch(h){if(N.pop(),!he(h,a))throw console.error("[what] Uncaught error in component:",r.name||"Anonymous",h),h;return c.appendChild(s),c.appendChild(l),c}N.pop(),a.mounted=!0,a._mountCallbacks&&queueMicrotask(()=>{if(!a.disposed)for(let h of a._mountCallbacks)try{h()}catch(b){console.error("[what] onMount error:",b)}}),c.appendChild(s);let g=Array.isArray(y)?y:[y];for(let h of g){let b=H(h,c,t);b&&c.appendChild(b)}return c.appendChild(l),c}function Je(e,n){let{errorState:t,handleError:r,fallback:o,reset:i}=e.props,a=e.children,s=document.createComment("eb:start"),l=document.createComment("eb:end"),c={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_errorBoundary:r,_startComment:s,_endComment:l};Q.set(s,c);let d=document.createDocumentFragment();d._componentCtx=c,d.appendChild(s),d.appendChild(l);let u=B(()=>{let _=t();if(N.push(c),s.parentNode)for(;s.nextSibling&&s.nextSibling!==l;){let g=s.nextSibling;O(g),g.parentNode.removeChild(g)}let y;_?y=typeof o=="function"?[o({error:_,reset:i})]:[o]:y=a,y=Array.isArray(y)?y:[y];for(let g of y){let h=H(g,n);h&&(l.parentNode?l.parentNode.insertBefore(h,l):d.insertBefore(h,l))}N.pop()});return c.effects.push(u),d}function Xe(e,n){let{boundary:t,fallback:r,loading:o}=e.props,i=e.children,a=document.createComment("sb:start"),s=document.createComment("sb:end"),l={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null,_startComment:a,_endComment:s};Q.set(a,l);let c=document.createDocumentFragment();c._componentCtx=l,c.appendChild(a),c.appendChild(s);let d=B(()=>{let _=o()?[r]:i,y=Array.isArray(_)?_:[_];if(N.push(l),a.parentNode)for(;a.nextSibling&&a.nextSibling!==s;){let g=a.nextSibling;O(g),g.parentNode.removeChild(g)}for(let g of y){let h=H(g,n);h&&(s.parentNode?s.parentNode.insertBefore(h,s):c.insertBefore(h,s))}N.pop()});return l.effects.push(d),c}function Ze(e,n){let{container:t}=e.props,r=e.children;if(!t)return console.warn("[what] Portal: target container not found"),document.createComment("portal:empty");let o={hooks:[],hookIndex:0,effects:[],cleanups:[],mounted:!1,disposed:!1,_parentCtx:N[N.length-1]||null},i=document.createComment("portal");i._componentCtx=o;let a=[];for(let s of r){let l=H(s,t);l&&(t.appendChild(l),a.push(l))}return o._cleanupCallbacks=[()=>{for(let s of a)O(s),s.parentNode&&s.parentNode.removeChild(s)}],i}function Qe(e,n,t){let{tag:r,props:o,children:i}=e,a=t||ze.has(r),s=a?document.createElementNS(Ge,r):document.createElement(r);o&&Ye(s,o,{},a);for(let l of i){let c=H(l,s,a&&r!=="foreignObject");c&&s.appendChild(c)}return s._vnode=e,s}function Ye(e,n,t,r){n=n||{},t=t||{};for(let o in n)if(!(o==="key"||o==="children")){if(o==="ref"){typeof n.ref=="function"?n.ref(e):n.ref&&(n.ref.current=e);continue}be(e,o,n[o],r)}}function be(e,n,t,r){if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(n));return}if(typeof t=="function"&&!(n.startsWith("on")&&n.length>2)&&n!=="ref"){if(e._propEffects||(e._propEffects={}),e._propEffects[n])try{e._propEffects[n]()}catch{}e._propEffects[n]=B(()=>{let o=t();be(e,n,o,r)});return}if(n.startsWith("on")&&n.length>2){let o=n.slice(2),i=!1;o.endsWith("Capture")&&(o=o.slice(0,-7),i=!0);let a=o.toLowerCase(),s=i?a+"_capture":a,l=e._events?.[s];if(l&&l._original===t||(l&&e.removeEventListener(a,l,i),t==null))return;e._events||(e._events={});let c=u=>(u.nativeEvent||(u.nativeEvent=u),J(()=>t(u)));c._original=t,e._events[s]=c;let d=t._eventOpts;e.addEventListener(a,c,d||i||void 0);return}if(n==="className"||n==="class"){r?e.setAttribute("class",t||""):e.className=t||"";return}if(n==="style"){if(typeof t=="string")e.style.cssText=t,e._prevStyle=null;else if(typeof t=="object"){let o=e._prevStyle||{};for(let i in o)i in t||(e.style[i]="");for(let i in t)e.style[i]=t[i]??"";e._prevStyle={...t}}return}if(n==="dangerouslySetInnerHTML"){e.innerHTML=t?.__html??"";return}if(n==="innerHTML"){if(t==null)return;if(t&&typeof t=="object"&&"__html"in t)e.innerHTML=t.__html??"";else{E&&console.warn("[what] innerHTML received a raw string. This is a security risk (XSS). Use innerHTML={{ __html: trustedString }} or dangerouslySetInnerHTML={{ __html: trustedString }} instead.");return}return}if(typeof t=="boolean"){t?e.setAttribute(n,""):e.removeAttribute(n);return}if(n.startsWith("data-")||n.startsWith("aria-")){e.setAttribute(n,t);return}if(r){t===!1||t==null?e.removeAttribute(n):e.setAttribute(n,t===!0?"":String(t));return}n in e?e[n]=t:e.setAttribute(n,t)}function Fe(e,n,t){if(t&&t.length>0){let r=t.length===1?t[0]:t;n=n?{...n,children:r}:{children:r}}return H({tag:e,props:n||{},children:t||[],key:null,_vnode:!0})}var et={tr:{depth:2,wrap:"<table><tbody>",unwrap:"</tbody></table>"},td:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},th:{depth:3,wrap:"<table><tbody><tr>",unwrap:"</tr></tbody></table>"},thead:{depth:1,wrap:"<table>",unwrap:"</table>"},tbody:{depth:1,wrap:"<table>",unwrap:"</table>"},tfoot:{depth:1,wrap:"<table>",unwrap:"</table>"},colgroup:{depth:1,wrap:"<table>",unwrap:"</table>"},col:{depth:1,wrap:"<table>",unwrap:"</table>"},caption:{depth:1,wrap:"<table>",unwrap:"</table>"}},tt=new Set(["svg","path","circle","rect","line","polyline","polygon","ellipse","g","defs","use","text","tspan","foreignObject","clipPath","mask","pattern","linearGradient","radialGradient","stop","marker","symbol","image","animate","animateTransform","animateMotion","set","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feImage","feMorphology","feSpecularLighting","feTile","feTurbulence","feDistantLight","fePointLight","feSpotLight"]);function Ae(e){let n=e.match(/^<([a-zA-Z][a-zA-Z0-9]*)/);return n?n[1]:""}function Me(e){let n=e.trim(),t=Ae(n);if(tt.has(t))return nt(n);let r=et[t];if(r){let i=document.createElement("template");return i.innerHTML=r.wrap+n+r.unwrap,()=>{let a=i.content.firstChild;for(let s=0;s<r.depth;s++)a=a.firstChild;return a.cloneNode(!0)}}let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}var xe=!1;function Ne(e){return E&&!xe&&(xe=!0,console.warn("[what] template() is a compiler internal. Use JSX instead. Direct calls with user input can lead to XSS vulnerabilities.")),Me(e)}function nt(e){let n=e.trim();if(Ae(n)==="svg"){let o=document.createElement("template");return o.innerHTML=n,()=>o.content.firstChild.cloneNode(!0)}let r=document.createElement("template");return r.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg">${n}</svg>`,()=>r.content.firstChild.firstChild.cloneNode(!0)}function rt(e,n,t){if(typeof n=="function"){let r=null;return B(()=>{r=Se(e,n(),r,t||null)}),r}return Se(e,n,null,t||null)}function ot(e){return!e||typeof e!="object"?!1:typeof Node<"u"&&e instanceof Node?!0:typeof e.nodeType=="number"&&typeof e.nodeName=="string"}function it(e){return!!e&&typeof e=="object"&&(e._vnode===!0||"tag"in e)}function st(e){return typeof SVGElement<"u"&&e instanceof SVGElement&&e.tagName.toLowerCase()!=="foreignobject"}function Ee(e){return e==null?[]:Array.isArray(e)?e:[e]}function Te(e,n,t){if(e==null||typeof e=="boolean")return t;if(Array.isArray(e)){for(let r=0;r<e.length;r++)Te(e[r],n,t);return t}return typeof e=="string"||typeof e=="number"?(t.push(document.createTextNode(String(e))),t):ot(e)?(t.push(e),t):it(e)?(t.push(H(e,n,st(n))),t):(t.push(document.createTextNode(String(e))),t)}function ct(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Se(e,n,t,r){if(!e||typeof e.insertBefore!="function")return E&&console.warn("[what] reconcileInsert called with invalid parent:",e),t;let o=r||null;if(n==null||typeof n=="boolean"){let c=Ee(t);for(let d=0;d<c.length;d++){let u=c[d];u.parentNode===e&&(O(u),e.removeChild(u))}return null}if((typeof n=="string"||typeof n=="number")&&t&&!Array.isArray(t)&&t.nodeType===3){let c=String(n);return t.textContent!==c&&(t.textContent=c),t}let i=Te(n,e,[]),a=Ee(t);if(ct(a,i))return t;let s=new Set(i);for(let c=0;c<a.length;c++){let d=a[c];!s.has(d)&&d.parentNode===e&&(O(d),e.removeChild(d))}let l=o;for(let c=i.length-1;c>=0;c--){let d=i[c];(d.parentNode!==e||d.nextSibling!==l)&&(l&&l.parentNode!==e&&(l=null),l?e.insertBefore(d,l):e.appendChild(d)),l=d}return i.length===0?null:i.length===1?i[0]:i}function ft(e,n,t){let r=t?.key,o=t?.raw||!1;return(i,a)=>{let s=[],l=[],c=[],d=r&&!o?new Map:null,u=document.createComment("/list");return i.insertBefore(u,a||null),B(()=>{let _=e()||[];r?pt(i,u,s,_,l,c,n,r,d):lt(i,u,s,_,l,c,n),s=_.slice()}),u}}function lt(e,n,t,r,o,i,a){let s=r.length,l=t.length;if(s===0){if(l>0){for(let p=0;p<l;p++)i[p]?.(),o[p]?.parentNode===e&&(O(o[p]),e.removeChild(o[p]));o.length=0,i.length=0}return}if(l===0){let p=document.createDocumentFragment();for(let m=0;m<s;m++){let x=r[m],L=v(T=>(i[m]=T,a(x,m)));o[m]=L,p.appendChild(L)}e.insertBefore(p,n);return}let c=0,d=Math.min(l,s);for(;c<d&&t[c]===r[c];)c++;if(c===l&&c===s)return;let u=l-1,_=s-1;for(;u>=c&&_>=c&&t[u]===r[_];)u--,_--;let y=new Array(s),g=new Array(s);for(let p=0;p<c;p++)y[p]=o[p],g[p]=i[p];for(let p=_+1;p<s;p++){let m=u+1+(p-_-1);y[p]=o[m],g[p]=i[m]}let h=_-c+1,b=u-c+1;if(h===0)for(let p=c;p<=u;p++)i[p]?.(),o[p]?.parentNode&&o[p].parentNode.removeChild(o[p]);else if(b===0){let p=c<s&&y[_+1]?y[_+1]:n,m=document.createDocumentFragment();for(let x=c;x<=_;x++){let L=r[x],T=x;y[x]=v(k=>(g[T]=k,a(L,T))),m.appendChild(y[x])}e.insertBefore(m,p)}else at(e,n,t,r,o,i,a,c,u,_,y,g);o.length=s,i.length=s;for(let p=0;p<s;p++)o[p]=y[p],i[p]=g[p]}function at(e,n,t,r,o,i,a,s,l,c,d,u){let _=new Map;for(let m=s;m<=l;m++)_.set(t[m],m);let y=c-s+1,g=new Int32Array(y);g.fill(-1);for(let m=s;m<=c;m++){let x=_.get(r[m]);x!==void 0&&(_.delete(r[m]),d[m]=o[x],u[m]=i[x],g[m-s]=x)}for(let[,m]of _)i[m]?.(),o[m]?.parentNode&&o[m].parentNode.removeChild(o[m]);let h=y-ut(g,y),b=new Uint8Array(y);if(h>1){let m=new Int32Array(h),x=new Int32Array(h),L=0;for(let k=0;k<y;k++)g[k]!==-1&&(m[L]=g[k],x[L]=k,L++);let T=ke(m,h);for(let k=0;k<T.length;k++)b[x[T[k]]]=1}else if(h===1){for(let m=0;m<y;m++)if(g[m]!==-1){b[m]=1;break}}for(let m=s;m<=c;m++)if(!d[m]){let x=r[m],L=m;d[m]=v(T=>(u[L]=T,a(x,L)))}let p=c+1<d.length&&d[c+1]?d[c+1]:n;for(let m=c;m>=s;m--){let x=m-s;(g[x]===-1||!b[x])&&(p&&p.parentNode!==e&&(p=n),e.insertBefore(d[m],p)),p=d[m]}}function ut(e,n){let t=0;for(let r=0;r<n;r++)e[r]===-1&&t++;return t}function ke(e,n){if(n===0)return[];if(n===1)return[0];let t=new Int32Array(n),r=new Int32Array(n),o=1;t[0]=0,r[0]=-1;for(let s=1;s<n;s++)if(e[s]>e[t[o-1]])r[s]=t[o-1],t[o++]=s;else{let l=0,c=o-1;for(;l<c;){let d=l+c>>1;e[t[d]]<e[s]?l=d+1:c=d}t[l]=s,r[s]=l>0?t[l-1]:-1}let i=new Array(o),a=t[o-1];for(let s=o-1;s>=0;s--)i[s]=a,a=r[a];return i}function pt(e,n,t,r,o,i,a,s,l){let c=r.length,d=t.length;if(c===0){if(d>0){for(let f=0;f<d;f++)i[f]?.(),o[f]?.parentNode===e&&(O(o[f]),e.removeChild(o[f]));o.length=0,i.length=0,l&&l.clear()}return}if(d===0){let f=document.createDocumentFragment();for(let C=0;C<c;C++){let S=r[C],$=C,M;if(l){let R=s(S),P=I(S);M=P,l.set(R,{itemSig:P})}else M=S;let j=v(R=>(i[$]=R,a(M,$)));o[C]=j,f.appendChild(j)}e.insertBefore(f,n);return}let u=0,_=Math.min(d,c);for(;u<_;){if(t[u]===r[u]){u++;continue}let f=s(t[u]),C=s(r[u]);if(f!==C)break;l&&l.get(f).itemSig.set(r[u]),u++}let y=d-1,g=c-1;for(;y>=u&&g>=u;){if(t[y]===r[g]){y--,g--;continue}let f=s(t[y]),C=s(r[g]);if(f!==C)break;l&&l.get(f).itemSig.set(r[g]),y--,g--}if(u>y&&u>g)return;let h=new Array(c),b=new Array(c);for(let f=0;f<u;f++)h[f]=o[f],b[f]=i[f];for(let f=g+1;f<c;f++){let C=y+1+(f-g-1);h[f]=o[C],b[f]=i[C]}let p=g-u+1;if(y-u+1===0){let f=g+1<c&&h[g+1]?h[g+1]:n,C=document.createDocumentFragment();for(let S=u;S<=g;S++){let $=r[S],M=S,j;if(l){let R=s($),P=I($);j=P,l.set(R,{itemSig:P})}else j=$;h[S]=v(R=>(b[M]=R,a(j,M))),C.appendChild(h[S])}e.insertBefore(C,f),oe(o,i,h,b,c);return}if(p===0){for(let f=u;f<=y;f++)i[f]?.(),o[f]?.parentNode&&e.removeChild(o[f]),l&&l.delete(s(t[f]));oe(o,i,h,b,c);return}let x=new Map;for(let f=u;f<=y;f++)x.set(s(t[f]),f);let L=new Int32Array(p);L.fill(-1);for(let f=u;f<=g;f++){let C=s(r[f]),S=x.get(C);S!==void 0&&(x.delete(C),h[f]=o[S],b[f]=i[S],L[f-u]=S,l&&r[f]!==t[S]&&l.get(C).itemSig.set(r[f]))}for(let[f,C]of x)i[C]?.(),o[C]?.parentNode&&e.removeChild(o[C]),l&&l.delete(f);for(let f=u;f<=g;f++)if(!h[f]){let C=r[f],S=f,$;if(l){let M=s(C),j=I(C);$=j,l.set(M,{itemSig:j})}else $=C;h[f]=v(M=>(b[S]=M,a($,S)))}let T=0,k=!0,se=-1;for(let f=0;f<p;f++)L[f]!==-1&&(T++,L[f]<=se&&(k=!1),se=L[f]);let G=new Uint8Array(p);if(k)for(let f=0;f<p;f++)L[f]!==-1&&(G[f]=1);else if(T>1){let f=new Int32Array(T),C=new Int32Array(T),S=0;for(let M=0;M<p;M++)L[M]!==-1&&(f[S]=L[M],C[S]=M,S++);let $=ke(f,T);for(let M=0;M<$.length;M++)G[C[$[M]]]=1}else if(T===1){for(let f=0;f<p;f++)if(L[f]!==-1){G[f]=1;break}}let q=g+1<h.length&&h[g+1]?h[g+1]:n;for(let f=g;f>=u;f--){let C=f-u;(L[C]===-1||!G[C])&&(q&&q.parentNode!==e&&(q=n),e.insertBefore(h[f],q)),q=h[f]}oe(o,i,h,b,c)}function oe(e,n,t,r,o){e.length=o,n.length=o;for(let i=0;i<o;i++)e[i]=t[i],n[i]=r[i]}function dt(e,n){for(let t in n){let r=n[t];if(t.startsWith("on")&&t.length>2){let o=t.slice(2).toLowerCase();e.addEventListener(o,r);continue}typeof r=="function"&&!t.startsWith("on")?t==="class"||t==="className"?B(()=>{e.className=r()||""}):t==="style"&&typeof r()=="object"?B(()=>{let o=r();for(let i in o)e.style[i]=o[i]??""}):B(()=>{ie(e,t,r())}):ie(e,t,r)}}function ie(e,n,t){if(n==="ref"){typeof t=="function"?t(e):t&&typeof t=="object"&&(t.current=e);return}if(n!=="key"){if(!X(n,t)){typeof console<"u"&&console.warn(`[what] Blocked unsafe URL in "${n}" attribute: ${t}`),e.removeAttribute(Z(n));return}if(n==="class"||n==="className")e.className=t||"";else if(n==="dangerouslySetInnerHTML")e.innerHTML=t?.__html??"";else if(n==="innerHTML")t&&typeof t=="object"&&"__html"in t?e.innerHTML=t.__html??"":typeof console<"u"&&t!=null&&t!==""&&console.warn('[what] Plain string innerHTML is not allowed. Use { __html: "..." } or dangerouslySetInnerHTML={{ __html: "..." }} instead.');else if(n==="style"){if(typeof t=="string")e.style.cssText=t;else if(typeof t=="object")for(let r in t)e.style[r]=t[r]??""}else n.startsWith("data-")||n.startsWith("aria-")?e.setAttribute(n,t):typeof t=="boolean"?t?e.setAttribute(n,""):e.removeAttribute(n):n in e?e[n]=t:e.setAttribute(n,t)}}var Le=new Set;function ht(e){for(let n of e)Le.has(n)||(Le.add(n),document.addEventListener(n,t=>{let r=t.target,o="$$"+n;for(;r;){let i=r[o];if(i&&(i(t),t.cancelBubble))return;r=r.parentNode}}))}function mt(e,n,t){return e.addEventListener(n,t),()=>e.removeEventListener(n,t)}function gt(e,n){B(()=>{for(let t in n){let r=typeof n[t]=="function"?n[t]():n[t];e.classList.toggle(t,!!r)}})}export{Fe as _$createComponent,Me as _$template,Ne as _template,gt as classList,ht as delegateEvents,B as effect,rt as insert,ft as mapArray,mt as on,ie as setProp,dt as spread,Ne as template,J as untrack};
2
2
  //# sourceMappingURL=compiler.min.js.map