sibujs 4.5.0 → 4.7.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/README.md +1 -1
- package/dist/browser.cjs +326 -133
- package/dist/browser.d.cts +46 -14
- package/dist/browser.d.ts +46 -14
- package/dist/browser.js +8 -6
- package/dist/build.cjs +2094 -1033
- package/dist/build.d.cts +133 -44
- package/dist/build.d.ts +133 -44
- package/dist/build.js +1372 -574
- package/dist/cdn.dev.global.js +10 -10
- package/dist/cdn.full.dev.global.js +11 -11
- package/dist/cdn.full.global.js +10 -10
- package/dist/cdn.global.js +10 -10
- package/dist/{chunk-2DCGACUU.js → chunk-2BPG2XDA.js} +251 -66
- package/dist/{chunk-IXKSNWV5.js → chunk-2INLLLMZ.js} +1 -1
- package/dist/{chunk-4PMLNECI.js → chunk-3QWBSL5R.js} +98 -29
- package/dist/{chunk-KKLW7YWL.js → chunk-4AWA2PVD.js} +275 -144
- package/dist/chunk-5HZXGZ6T.js +24 -0
- package/dist/{chunk-PCT43HW3.js → chunk-7LUJQAOJ.js} +1 -1
- package/dist/{chunk-5DXA2J44.js → chunk-7XHATCIH.js} +5 -2
- package/dist/chunk-BC2SECJD.js +44 -0
- package/dist/{chunk-TBYTO6BS.js → chunk-BSY63EM6.js} +136 -80
- package/dist/{chunk-FTIR4QW2.js → chunk-DKXRACVN.js} +6 -8
- package/dist/{chunk-ONOHFDLG.js → chunk-FNJXNGYZ.js} +3 -3
- package/dist/{chunk-XZZOBQAY.js → chunk-FQRUXCEE.js} +6 -5
- package/dist/{chunk-NIOYEGBQ.js → chunk-HURREPU2.js} +27 -13
- package/dist/chunk-J6FW5TV6.js +233 -0
- package/dist/{chunk-UGRX3S57.js → chunk-JWKYU5GV.js} +22 -4
- package/dist/chunk-NYNYSPK7.js +318 -0
- package/dist/{chunk-RBTPLM32.js → chunk-RUSSKG6G.js} +13 -12
- package/dist/{chunk-7LN645I6.js → chunk-SLM3IA34.js} +3 -3
- package/dist/{chunk-R25EFXXC.js → chunk-TUCPL2HB.js} +3 -3
- package/dist/{chunk-B3WHI2QA.js → chunk-UNWRJRKC.js} +55 -31
- package/dist/{chunk-KEISJXBU.js → chunk-UOL2ECCS.js} +44 -17
- package/dist/{chunk-RJE2BNI4.js → chunk-VZSG24LS.js} +108 -45
- package/dist/{chunk-RIXRAYIU.js → chunk-WEQ3DMVL.js} +10 -4
- package/dist/{chunk-3JZ4L5TJ.js → chunk-WOLJZUFQ.js} +354 -90
- package/dist/{chunk-S373NSMK.js → chunk-XYV3EDB7.js} +283 -123
- package/dist/{chunk-VZKNK2V7.js → chunk-XZR4PXRE.js} +296 -38
- package/dist/{chunk-GW3SCCZG.js → chunk-Z3OHK6QT.js} +153 -110
- package/dist/{chunk-OMJJM3KM.js → chunk-ZVL7TY4K.js} +287 -130
- package/dist/{contracts-DBdg9J_a.d.ts → contracts-CLqzJnOV.d.ts} +36 -17
- package/dist/{contracts-DBdg9J_a.d.cts → contracts-CTOJXu-x.d.cts} +36 -17
- package/dist/{customElement-OB9CIsc5.d.cts → customElement-MmInOW1U.d.cts} +21 -0
- package/dist/{customElement-OB9CIsc5.d.ts → customElement-MmInOW1U.d.ts} +21 -0
- package/dist/data.cjs +410 -155
- package/dist/data.d.cts +166 -12
- package/dist/data.d.ts +166 -12
- package/dist/data.js +12 -9
- package/dist/devtools.cjs +98 -61
- package/dist/devtools.js +7 -8
- package/dist/dispose-GEIG2KOF.js +28 -0
- package/dist/ecosystem.cjs +372 -126
- package/dist/ecosystem.d.cts +20 -3
- package/dist/ecosystem.d.ts +20 -3
- package/dist/ecosystem.js +12 -12
- package/dist/extras.cjs +2366 -909
- package/dist/extras.d.cts +11 -9
- package/dist/extras.d.ts +11 -9
- package/dist/extras.js +39 -28
- package/dist/index.cjs +421 -158
- package/dist/index.d.cts +213 -171
- package/dist/index.d.ts +213 -171
- package/dist/index.js +24 -27
- package/dist/motion.cjs +118 -44
- package/dist/motion.js +5 -5
- package/dist/patterns.cjs +344 -53
- package/dist/patterns.d.cts +28 -9
- package/dist/patterns.d.ts +28 -9
- package/dist/patterns.js +8 -8
- package/dist/performance.cjs +325 -220
- package/dist/performance.d.cts +2 -2
- package/dist/performance.d.ts +2 -2
- package/dist/performance.js +8 -9
- package/dist/plugin-DVgSnTfK.d.cts +112 -0
- package/dist/plugin-DVgSnTfK.d.ts +112 -0
- package/dist/plugins.cjs +664 -233
- package/dist/plugins.d.cts +127 -14
- package/dist/plugins.d.ts +127 -14
- package/dist/plugins.js +96 -42
- package/dist/signal-EotCj4hS.d.cts +110 -0
- package/dist/signal-EotCj4hS.d.ts +110 -0
- package/dist/{ssr-BiPRdZ6n.d.cts → ssr-Bli9XRW5.d.cts} +5 -0
- package/dist/{ssr-BiPRdZ6n.d.ts → ssr-Bli9XRW5.d.ts} +5 -0
- package/dist/{ssr-Y7XOEPEN.js → ssr-XOTUASDO.js} +4 -5
- package/dist/ssr.cjs +229 -84
- package/dist/ssr.d.cts +9 -3
- package/dist/ssr.d.ts +9 -3
- package/dist/ssr.js +11 -12
- package/dist/{startup-BMpaiMhP.d.ts → startup-BLfSeL15.d.cts} +73 -22
- package/dist/{startup-BMpaiMhP.d.cts → startup-BLfSeL15.d.ts} +73 -22
- package/dist/tagFactory-8qL9LCIx.d.cts +156 -0
- package/dist/tagFactory-BL2fymez.d.ts +156 -0
- package/dist/testing.cjs +2503 -2191
- package/dist/testing.d.cts +56 -5
- package/dist/testing.d.ts +56 -5
- package/dist/testing.js +580 -307
- package/dist/types-CJFViL6Q.d.cts +26 -0
- package/dist/types-CJFViL6Q.d.ts +26 -0
- package/dist/ui.cjs +732 -329
- package/dist/ui.d.cts +41 -7
- package/dist/ui.d.ts +41 -7
- package/dist/ui.js +151 -56
- package/dist/widgets.cjs +267 -291
- package/dist/widgets.js +9 -10
- package/package.json +4 -2
- package/dist/chunk-2WLZ6757.js +0 -149
- package/dist/chunk-CCSJMTRN.js +0 -15
- package/dist/chunk-QKRPLZ2V.js +0 -108
- package/dist/chunk-VUF4ALSW.js +0 -60
- package/dist/chunk-WWV3SJ3L.js +0 -131
- package/dist/dispose-46BOMMQJ.js +0 -19
- package/dist/plugin-D30wlGW5.d.cts +0 -71
- package/dist/plugin-D30wlGW5.d.ts +0 -71
- package/dist/tagFactory-DVoDpHye.d.cts +0 -215
- package/dist/tagFactory-DVoDpHye.d.ts +0 -215
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`||e==="\r"||e==="\f"}function
|
|
1
|
+
"use strict";(()=>{var eo=Object.defineProperty;var St=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var sn=(e,n)=>{for(var t in n)eo(e,t,{get:n[t],enumerable:!0})};var en={};sn(en,{DynamicComponent:()=>sc,ErrorBoundary:()=>Wa,ErrorDisplay:()=>Ut,Fragment:()=>lc,KeepAlive:()=>pc,Loading:()=>Ja,MAX_DRAIN_TEARDOWNS:()=>me,Portal:()=>bc,SVG_NS:()=>I,Suspense:()=>Qn,__resetIdCounter:()=>Cr,a:()=>ki,abbr:()=>_i,action:()=>Ga,address:()=>li,area:()=>Xi,array:()=>yc,article:()=>ri,aside:()=>ci,asyncDerived:()=>Sc,audio:()=>Zi,autoResize:()=>Er,b:()=>Ci,base:()=>Ks,batch:()=>z,bdi:()=>Ai,bdo:()=>Ni,bindDynamic:()=>Wn,blockquote:()=>gi,body:()=>ei,br:()=>Ri,button:()=>Ze,canvas:()=>fs,caption:()=>hs,catchError:()=>Ya,catchErrorAsync:()=>Xa,center:()=>ga,checkLeaks:()=>mn,circle:()=>Gs,cite:()=>Li,clickOutside:()=>xr,clipPath:()=>sa,code:()=>Ht,col:()=>ys,colgroup:()=>vs,context:()=>Qa,copyOnClick:()=>wr,createId:()=>_r,customElement:()=>ya,data:()=>Mi,datalist:()=>Cs,dd:()=>bi,deepEqual:()=>We,deepSignal:()=>xc,defer:()=>Bc,defs:()=>ia,del:()=>gs,derived:()=>He,details:()=>Vs,dfn:()=>Pi,dialog:()=>js,disableSSR:()=>sr,dispose:()=>j,div:()=>M,dl:()=>hi,dt:()=>yi,each:()=>cc,effect:()=>Z,ellipse:()=>Ys,em:()=>Di,embed:()=>rs,enableSSR:()=>ir,enhance:()=>gt,enhanceAll:()=>Lc,enqueueBatchedSignal:()=>$e,external:()=>Oa,fieldset:()=>As,figcaption:()=>vi,figure:()=>Si,font:()=>ba,footer:()=>ii,form:()=>Ns,g:()=>Xs,getAction:()=>Sr,getRequestScopedCache:()=>or,getRuntimeErrorHandler:()=>ln,getSSRStore:()=>De,getSlot:()=>hc,h1:()=>ui,h2:()=>di,h3:()=>$t,h4:()=>fi,h5:()=>pi,h6:()=>mi,head:()=>Qo,header:()=>oi,hr:()=>xi,html:()=>$r,i:()=>$i,iframe:()=>os,img:()=>Qi,input:()=>Rs,ins:()=>bs,isBatching:()=>$a,isSSR:()=>le,kbd:()=>Oi,label:()=>Ls,lazy:()=>Zn,lazyIsland:()=>Pc,legend:()=>Ms,li:()=>Ti,line:()=>Zs,linearGradient:()=>la,link:()=>Us,longPress:()=>Tr,main:()=>ai,map:()=>es,mark:()=>Hi,marker:()=>ma,marquee:()=>ha,mask:()=>aa,match:()=>nc,math:()=>ds,menu:()=>Fs,meta:()=>Js,meter:()=>Ps,mount:()=>mc,mountIslands:()=>Hc,nav:()=>si,nextTick:()=>Fc,noscript:()=>ps,object:()=>is,ol:()=>wi,on:()=>Aa,onCleanup:()=>ka,onMount:()=>dt,onUnmount:()=>tr,optgroup:()=>Ds,option:()=>$s,output:()=>Os,p:()=>Dt,param:()=>ss,path:()=>Qs,pattern:()=>ca,picture:()=>as,polygon:()=>ea,polyline:()=>ta,portal:()=>cs,pre:()=>Ot,progress:()=>Hs,q:()=>Ii,radialGradient:()=>ua,reactiveArray:()=>vc,rect:()=>na,ref:()=>Tc,registerAction:()=>qe,registerComponent:()=>rc,registerDisposer:()=>C,registerIsland:()=>Dc,replaceChildrenSafely:()=>Q,reportDrainRunaway:()=>Se,reportError:()=>R,resolveComponent:()=>ic,retrack:()=>we,rp:()=>Bi,rt:()=>Vi,ruby:()=>ji,runInSSRContext:()=>ar,s:()=>Fi,samp:()=>zi,script:()=>ms,section:()=>ni,select:()=>Is,setGlobalErrorHandler:()=>Za,setMaxDrainIterations:()=>Fn,setRuntimeErrorHandler:()=>cn,show:()=>ec,signal:()=>A,slot:()=>qs,small:()=>qi,source:()=>ls,span:()=>F,stop:()=>da,store:()=>wc,strict:()=>_c,strictEffect:()=>Cc,strong:()=>Wi,style:()=>Le,sub:()=>Ki,summary:()=>zs,sup:()=>Ui,svg:()=>us,symbol:()=>pa,table:()=>Ss,tagFactory:()=>p,takePendingError:()=>ct,tbody:()=>xs,td:()=>Ts,template:()=>Ws,text:()=>ra,textarea:()=>Bs,tfoot:()=>ws,th:()=>Es,thead:()=>ks,time:()=>Ji,title:()=>ti,tr:()=>_s,track:()=>ts,transition:()=>jc,trapFocus:()=>kr,trustHTML:()=>qr,tspan:()=>oa,u:()=>Gi,ul:()=>Ei,unregisterComponent:()=>oc,unregisterDisposer:()=>Je,unregisterIsland:()=>$c,untracked:()=>ce,use:()=>fa,var_:()=>Yi,video:()=>ns,watch:()=>Ec,when:()=>tc,withSSR:()=>cr,writable:()=>kc});var an=Symbol.for("sibujs.runtime-errors.v1");function xt(){let e=globalThis,n=e[an];if(n)return n;let t={handler:null,handlerDepth:0};return e[an]=t,t}function cn(e){let n=xt(),t=n.handler;return n.handler=e,t}function ln(){return xt().handler}function Tt(e){if(e instanceof Error)return e;let n=typeof e=="string"?e:`Non-Error value thrown: ${to(e)}`;return new Error(n,{cause:e})}function to(e){if(typeof e=="symbol")return e.toString();try{return typeof e=="object"&&e!==null?JSON.stringify(e):String(e)}catch{return Object.prototype.toString.call(e)}}function no(e){return e.name?`${e.phase} "${e.name}"`:e.phase}var ro=Symbol.for("sibujs.reactive.v1");function oo(e){let n=globalThis[ro];return n?.untracked?n.untracked(e):e()}var io="sibu:error-propagate";function so(e,n){let t=n.node;if(!t||typeof CustomEvent>"u")return!1;let r=ao(t);if(!r)return!1;try{let o=new CustomEvent(io,{bubbles:!0,cancelable:!0,detail:{error:e,context:n}});return r.dispatchEvent(o)===!1}catch{return!1}}function ao(e){let t=e;for(;t;){if(t.nodeType===1&&typeof t.dispatchEvent=="function")return t;t=t.parentNode}let r=e;return typeof r.dispatchEvent=="function"?r:null}function co(e,n){typeof console>"u"||console.error(`[SibuJS] Uncaught error during ${no(n)}: ${e.message}`,e)}function R(e,n){let t=Tt(e);oo(()=>{if(so(t,n))return;let r=xt(),o=r.handler;if(o&&r.handlerDepth===0){r.handlerDepth++;try{o(e instanceof Error?e:t,n);return}catch(i){if(typeof console<"u"){let s=i instanceof Error?i.message:String(i);console.error(`[SibuJS] runtime error handler itself threw: ${s}`,i)}}finally{r.handlerDepth--}}co(t,n)})}function de(){return typeof globalThis.__SIBU_DEV__<"u"?!!globalThis.__SIBU_DEV__:!0}function V(e,n){if(!e)throw new Error(`[SibuJS] ${n}`)}function oe(e){{let n=e();n&&console.warn(`[SibuJS] ${n}`)}}function O(e){console.warn(`[SibuJS] ${e}`)}var fe=new WeakMap,me=1e4;function Se(e,n,t){typeof console>"u"||console.error(`[SibuJS ${e}] runaway cleanup: stopped after running ${n} teardowns with ${t} still queued. Cleanup production did not stabilize before the teardown safety ceiling was reached \u2014 the remaining work was NOT run.`,{executed:n,remaining:t})}var ke=0;function rt(e){let n=e;for(;n?.closed;)n=n.forwardTo;return n??null}var te=[];function un(){return rt(te[te.length-1])}function dn(e){return e===null&&te.length===0?!1:(te.push(rt(e)),!0)}function fn(){te.pop()}function C(e,n){let t=fe.get(e);t||(t=[],fe.set(e,t)),t.push(n),ke++;let r=rt(te[te.length-1]);r&&r.entries.push([e,n])}function pn(e){let n={entries:[],closed:!1},t=n.entries;te.push(n);let r;try{r=e()}catch(i){let s=0;try{for(;t.length>0;){if(s>=me){Se("rollback",s,t.length);break}let[a,c]=t.pop();if(Je(a,c)){s++;try{c()}catch(u){R(u,{phase:"cleanup",name:"disposer"})}}}}finally{n.closed=!0,t.length=0,te.pop()}throw i}n.closed=!0,te.pop();let o=rt(te[te.length-1]);if(o){for(let i of t)fe.get(i[0])?.includes(i[1])&&o.entries.push(i);n.forwardTo=o}return t.length=0,r}function Je(e,n){let t=fe.get(e);if(!t)return!1;let r=t.indexOf(n);return r===-1?!1:(t.splice(r,1),ke--,t.length===0&&fe.delete(e),!0)}function j(e){let n=[e],t=[];for(;n.length>0;){let r=n.pop();t.push(r);let o=Array.from(r.childNodes);for(let i=0;i<o.length;i++)n.push(o[i])}for(let r=t.length-1;r>=0;r--)lo(t[r])}function lo(e){if(!fe.has(e))return;let n=0,t=!1;for(;!t;){let r=fe.get(e);if(!r||r.length===0)break;let o=r.slice();fe.delete(e),ke-=o.length;for(let i=0;i<o.length;i++){if(n>=me){let s=o.slice(i),a=fe.get(e);fe.set(e,a?s.concat(a):s),ke+=s.length,Se("dispose",n,s.length+(a?.length??0)),t=!0;break}n++;try{o[i]()}catch(s){R(s,{phase:"cleanup",name:"disposer"})}}}}function Q(e,...n){for(let r=0;r<n.length;r++){let o=n[r];o.parentNode?.removeChild(o)}let t=Array.from(e.childNodes);for(let r=0;r<t.length;r++)j(t[r]);e.replaceChildren(...n)}function mn(e=0){return e>0&&ke>e&&O(`checkLeaks: ${ke} active DOM bindings detected. Expected \u2264${e}. This may indicate a component was removed from the DOM without calling dispose().`),ke}function uo(e){return e.replace(/[\x00-\x20\x7f-\x9f]+/g,"")}function Ie(e){if(e.length<3)return!1;let n=e.toLowerCase();return n[0]==="o"&&n[1]==="n"&&n.charCodeAt(2)>=97&&n.charCodeAt(2)<=122}var fo=["http:","https:","mailto:","tel:","ftp:"],po=/^[\x00-\x20\x7f-\x9f]+|[\x00-\x20\x7f-\x9f]+$/g;function vn(e){let n=uo(e).trim();if(!n)return"";let t=e.replace(po,""),r=n.toLowerCase(),o=-1;for(let s=0;s<r.length;s++){let a=r.charCodeAt(s);if(a===58){o=s;break}if(a===47||a===63||a===35)break}if(o===-1)return t;let i=r.slice(0,o+1);return/^[a-z][a-z0-9+.-]*:$/.test(i)&&fo.indexOf(i)===-1?"":t}var mo=/^\s+\d+(\.\d+)?[wx]$/;function go(e){let n=e.split(","),t=[];for(let r=0;r<n.length;r++){let o=n[r].trim();if(!o)continue;let i=o.match(/^(\S+)(\s+.+)?$/);if(!i||i[2]!==void 0&&!mo.test(i[2]))continue;let s=vn(i[1]);s&&t.push(i[2]?`${s}${i[2]}`:s)}return t.join(", ")}var bo=/[(:@\\]/;function ho(e){return e===" "||e===" "||e===`
|
|
2
|
+
`||e==="\r"||e==="\f"}function gn(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"}function yo(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(r!=="\\"){n+=r;continue}if(t+1>=e.length)break;let o=e[t+1];if(o===`
|
|
3
3
|
`||o==="\f"){t+=1;continue}if(o==="\r"){t+=e[t+2]===`
|
|
4
|
-
`?2:1;continue}if(
|
|
5
|
-
`?2:1);let a=Number.parseInt(i,16),c=a===0||a>1114111||a>=55296&&a<=57343;n+=c?"\uFFFD":String.fromCodePoint(a),t=s-1;continue}n+=o,t+=1}return n}var sn=["url(","expression(","javascript:","vbscript:","-moz-binding","behavior:","@import","image-set(","filter:progid"];function Yr(e){if(!e)return"an element";let n=e.tagName.toLowerCase(),t=e.getAttribute("id");t&&(n+=`#${t}`);let r=e.getAttribute("class");return r&&(n+=`.${r.trim().split(/\s+/).slice(0,3).join(".")}`),`<${n}>`}var gt=new Set,an=100,cn=!1;function un(e,n,t){ee(()=>{let r=["url() in an inline style is an exfiltration channel: the browser fetches it immediately and the URL's path or query can carry page data off-origin","expression() executes arbitrary script in legacy engines","the javascript: scheme executes script","the vbscript: scheme executes script","-moz-binding loads and runs remote XBL","behavior: loads and runs a remote HTC script","@import pulls in a remote stylesheet","image-set() fetches remote images, the same exfiltration channel as url()","filter:progid activates legacy scriptable filters"],o=t?.property?`${t.property}: ${e}`:e,i=Yr(t?.element),s=`${i}|${o}`;return gt.has(s)?"":gt.size>=an?cn?"":(cn=!0,`${an} distinct dropped style declarations have been reported; suppressing further ones for the rest of this session so they cannot flood the console. The declarations are still dropped \u2014 only the reporting stops. Fix the reported ones and reload to see any that remain.`):(gt.add(s),`style declaration "${o}" was dropped by the style sanitizer on ${i} \u2014 ${r[n]}. The element renders without it, which usually looks like a missing image rather than an error. Sanctioned alternatives: for a content image use an <img> element (or a <picture>); for decoration, put the rule in a stylesheet and set a class instead \u2014 stylesheet CSS is not sanitized, only inline style attributes are. If this declaration is not yours, it came from untrusted data and the drop just prevented an exfiltration.`)})}function bt(e){if(!Ur.test(e))return-1;let t=(e.includes("\\")?Gr(e):e).toLowerCase().replace(/\s+/g,"");for(let r=0;r<sn.length;r++)if(t.includes(sn[r]))return r;return-1}function Ye(e,n){let t=bt(e);return t===-1?e:(un(e,t,n),"")}function Ze(e,n){let t=String(e);if(t.trim()==="")return"";if(typeof document>"u")return Ye(t,n)===""?"":t;let r=document.createElement("div");try{r.style.cssText=t}catch{return""}let o=[];for(let i=0;i<r.style.length;i++){let s=r.style[i],a=r.style.getPropertyValue(s),c=bt(a);if(c===-1&&(c=bt(`${s}:${a}`)),c!==-1){un(a,c,{property:s,element:n?.element});continue}let u=r.style.getPropertyPriority(s);o.push(`${s}: ${a}${u?` !${u}`:""}`)}return o.join("; ")}var Zr=new Set(["href","xlink:href","src","action","formaction","formtarget","cite","poster","background","srcset","ping","data","manifest"]),Xr=new Set(["srcdoc"]);function dn(e){return Xr.has(e.toLowerCase())}function fn(e,n,t){let r=e.toLowerCase();return r==="srcset"?Kr(n):Zr.has(r)?ln(n):r==="style"?Ze(n,t):n}var Qr="http://www.w3.org/1999/xhtml",eo="http://www.w3.org/2000/svg",to="http://www.w3.org/1999/xlink",no="http://www.w3.org/XML/1998/namespace",ro=new Set(["checked","disabled","selected"]);function oo(e){return e.namespaceURI===null||e.namespaceURI===Qr}function pn(e,n,t){e[n]=t}function io(e,n){if(e.namespaceURI!==eo)return null;let t=n.toLowerCase();return t.startsWith("xlink:")?to:t.startsWith("xml:")?no:null}function te(e,n,t,r={}){let o=io(e,n),i=o?n.slice(n.indexOf(":")+1):n;if(Ne(n))return O(`${r.label??"setSafeAttribute"}: refusing to set event-handler attribute "${n}". Its value would be evaluated as JavaScript. Use on:{ ${n.slice(2)}: fn } instead.`),o?e.removeAttributeNS(o,i):e.removeAttribute(n),!1;if(t==null)return o?e.removeAttributeNS(o,i):e.removeAttribute(n),!0;if(dn(n))return O(`${r.label??"setSafeAttribute"}: refusing to set "${n}". The browser parses this attribute as a nested HTML document, so a generic string value cannot be made safe \u2014 attribute escaping is undone before the parse. Build the frame's content another way.`),o?e.removeAttributeNS(o,i):e.removeAttribute(n),!1;let s=oo(e),a=s?n.toLowerCase():n;if(typeof t=="boolean"){if(n.length>5&&n.slice(0,5).toLowerCase()==="aria-"){let m=t?"true":"false";return(o?e.getAttributeNS(o,i):e.getAttribute(n))!==m&&(o?e.setAttributeNS(o,n,m):e.setAttribute(n,m)),!0}return s&&ro.has(a)&&a in e?pn(e,a,t):t?o?e.setAttributeNS(o,n,""):e.setAttribute(n,""):o?e.removeAttributeNS(o,i):e.removeAttribute(n),!0}let c=String(t);if(r.syncValueProperty!==!1&&s&&(a==="value"||a==="checked")&&a in e)return pn(e,a,a==="checked"?!!t:c),!0;let u=fn(n,c,{element:e});return(o?e.getAttributeNS(o,i):e.getAttribute(n))===u||(o?e.setAttributeNS(o,n,u):e.setAttribute(n,u)),!0}var so=4096,ht=[];function ao(){return{sig:null,sub:null,epoch:0,depVersion:0,sigPrev:null,sigNext:null,subPrev:null,subNext:null,prevActive:null}}function co(e,n,t){let r=ht.pop();if(r)return r.sig=e,r.sub=n,r.epoch=t,r;let o=ao();return o.sig=e,o.sub=n,o.epoch=t,o}function mn(e){e.sig=null,e.sub=null,e.sigPrev=null,e.sigNext=null,e.subPrev=null,e.subNext=null,e.prevActive=null,ht.length<so&&ht.push(e)}function lo(e,n){let t=e.subsHead??null;n.sigPrev=null,n.sigNext=t,t?t.sigPrev=n:e.subsTail=n,e.subsHead=n,e.__sc=(e.__sc??0)+1}function gn(e){let n=e.sig;if(!n)return;let t=e.sigPrev,r=e.sigNext;t?t.sigNext=r:n.subsHead=r,r?r.sigPrev=t:n.subsTail=t,n.__sc=(n.__sc??1)-1,n.__activeNode===e&&(n.__activeNode=e.prevActive),n.__sc===0&&(n.subsHead=null,n.subsTail=null)}function uo(e,n){let t=e.depsTail??null;n.subPrev=t,n.subNext=null,t?t.subNext=n:e.depsHead=n,e.depsTail=n}function fo(e){let n=e.sub;if(!n)return;let t=e.subPrev,r=e.subNext;t?t.subNext=r:n.depsHead=r,r?r.subPrev=t:n.depsTail=t}var re=null,le=null,me=0,ge=[],ne=new Set,po=[];function mo(e){try{e()}catch(n){let t=e;P(n,{phase:t._errorPhase??"effect",name:t.__name,node:t._errorNode})}}function go(e){let n=e.depsHead??null;if(n===null)return!0;for(;n!==null;){let t=n.sig;if(t===null)return!0;if(t._d===!0&&t._validate!==void 0)try{t._validate()}catch{return!0}if(n.depVersion!==t.__v)return!0;n=n.subNext}return!1}var se=0,ue=!1;function vt(){se===0&&(le=re,re=null,ue=!0),se++}function xt(){se--,se===0&&(re=le,le=null,ue=!1)}function bn(){return ue}function hn(e){vt();try{return e()}finally{xt()}}var bo=0;function St(e,n){let t=re,r=0,o=null;ue&&(r=se,o=le,se=0,le=null,ue=!1),re=n;let i=n,s=++bo;i._epoch=s,i._structDirty=!1;for(let a=i.depsHead??null;a!==null;a=a.subNext){let c=a.sig;a.prevActive=c.__activeNode??null,c.__activeNode=a}try{e()}finally{re=t,r!==0&&(se=r,le=o,ue=!0);let a=i.depsHead??null;for(;a!==null;){let c=a.subNext,u=a.sig;u.__activeNode=a.prevActive,a.prevActive=null,a.epoch!==s&&(fo(a),gn(a),mn(a)),a=c}}}function yn(e,n){if(!n)return Tt(e);Re(n);let t=re,r=0,o=null;ue&&(r=se,o=le,se=0,le=null,ue=!1),re=n;try{e()}finally{re=t,r!==0&&(se=r,le=o,ue=!0);let s=n;for(let a=s.depsHead??null;a!==null;a=a.subNext){let c=a.sig;c.__activeNode=a.prevActive,a.prevActive=null}}let i=n;return i._dispose??(i._dispose=()=>Re(n))}function Tt(e,n){let t=()=>{let o=r;if(!(o._disposed||o._reentrant)){o._reentrant=!0;try{St(e,r)}finally{o._reentrant=!1}}},r=t;r.depsHead=null,r.depsTail=null,r._epoch=0,r._structDirty=!1,r._hasComputedDep=!1,r._runEpoch=0,r._runs=0,r._reentrant=!1,r._disposed=!1,r._errorPhase="binding",r._errorNode=n;try{t()}catch(o){throw r._disposed=!0,r._errorNode=void 0,Re(r),o}return r._dispose??(r._dispose=()=>{r._disposed=!0,r._errorNode=void 0,Re(r)})}function vn(e){if(!re)return;let n=re,t=e,r=n._epoch??0,o=t.__activeNode??null;if(o!==null&&o.sub===n){o.epoch=r,o.depVersion=t.__v??Number.NaN;return}t._validate!==void 0&&(n._hasComputedDep=!0);let i=co(e,n,r);i.depVersion=t.__v??Number.NaN,i.prevActive=o,t.__activeNode=i,uo(n,i),lo(t,i),n._structDirty=!0}function Re(e){let n=e,t=n.depsHead??null;for(n.depsHead=null,n.depsTail=null;t;){let r=t.subNext;gn(t),mn(t),t=r}}var Xe=1e3,Qe=1e6,et=0,ye=new Set;function xn(e){let n=Xe;return Number.isFinite(e)&&e>0&&(Xe=Math.floor(e)),n}function Sn(e){let n=Qe;return Number.isFinite(e)&&e>0&&(Qe=Math.floor(e)),n}function ho(e){let n=e;return n._runEpoch!==et?(n._runEpoch=et,n._runs=1,!1):(n._runs=(n._runs??0)+1,n._runs>Xe)}function yo(e){let n=e.__name??"<unnamed>";P(new Error(`subscriber "${n}" fired more than ${Xe} times \u2014 likely a write-reads-self cycle between effects/signals. This subscriber is quarantined for the rest of this update; other pending work still runs.`),{phase:"scheduler",name:n})}function vo(){P(new Error(`Notification drain exceeded ${Qe} iterations \u2014 absolute safety net tripped. Breaking to prevent infinite loop.`),{phase:"scheduler"})}function Tn(){let e=0;for(;e<ge.length;){if(e>=Qe){vo();break}let n=ge[e++];if(ne.delete(n),!(ye.size>0&&ye.has(n))&&!(n._hasComputedDep===!0&&!go(n))){if(ho(n)){yo(n),ye.add(n);continue}mo(n)}}}function En(){if(!(me>0)){me++,et++;try{Tn()}finally{me--,me===0&&(ge.length=0,ne.clear(),ye.size>0&&ye.clear())}}}function yt(e){e();let n=e._sig;if(!n)return;let t=po,r=t.length;for(t.push(n);t.length>r;){let i=t.pop().subsHead??null;for(;i;){let s=i.sub;if(s)if(s._c){let a=s._sig;a?(!a._d||a._f===!0)&&(a._d=!0,a._f=!1,t.push(a)):s()}else ne.has(s)||(ne.add(s),ge.push(s));i=i.sigNext}}}function wn(e){let t=e.subsHead??null;for(;t;){let r=t.sub;r&&(r._c?yt(r):ne.has(r)||(ne.add(r),ge.push(r))),t=t.sigNext}}function kn(e){let t=e.subsHead;if(t){if(me>0){let r=t;for(;r;){let o=r.sub;o&&(o._c?yt(o):ne.has(o)||(ne.add(o),ge.push(o))),r=r.sigNext}return}me++,et++;try{let r=t;for(;r;){let o=r.sub;o&&(o._c?yt(o):ne.has(o)||(ne.add(o),ge.push(o))),r=r.sigNext}Tn()}finally{me--,me===0&&(ge.length=0,ne.clear(),ye.size>0&&ye.clear())}}}function _n(e){return e.__sc??0}function An(e){let n=e,t=[],r=n.depsHead??null;for(;r;)r.sig&&t.push(r.sig),r=r.subNext;return t}function Cn(e,n){let t=e.subsHead??null;for(;t;){let r=t.sub;r&&n(r),t=t.sigNext}}var Ln="4.5.0",Nn=Symbol.for("sibujs.reactive.v1");function So(){let e=globalThis,n=e[Nn];if(n)return!n.__dupWarned&&(n.__dupWarned=!0,O(`Multiple instances of the reactive runtime detected on this page (active: ${n.version}, duplicate: ${Ln}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`)),n;let t={suspendTracking:vt,resumeTracking:xt,isTrackingSuspended:bn,untracked:hn,retrack:St,track:yn,reactiveBinding:Tt,recordDependency:vn,cleanup:Re,setMaxSubscriberRepeats:xn,setMaxDrainIterations:Sn,drainNotificationQueue:En,queueSignalNotification:wn,notifySubscribers:kn,getSubscriberCount:_n,getSubscriberDeps:An,forEachSubscriber:Cn,version:Ln};return e[Nn]=t,t}var K=So(),ve=K.suspendTracking,xe=K.resumeTracking,Rn=K.isTrackingSuspended,Be=K.untracked,be=K.retrack,Q=K.track,J=K.reactiveBinding,Se=K.recordDependency,Ve=K.cleanup,rl=K.setMaxSubscriberRepeats,Mn=K.setMaxDrainIterations,Pn=K.drainNotificationQueue,Hn=K.queueSignalNotification,Me=K.notifySubscribers,ol=K.getSubscriberCount,il=K.getSubscriberDeps,sl=K.forEachSubscriber;function tt(e,n,t){if(Ne(n))return te(e,n,"",{label:`bindAttribute("${n}")`}),()=>{};function r(){let o;try{o=t()}catch(i){P(i,{phase:"binding",name:`bindAttribute("${n}")`,node:e});return}te(e,n,o,{label:`bindAttribute("${n}")`})}return J(r,e)}function $n(e,n,t){let r=null;function o(){let s;try{s=typeof n=="function"?n():n}catch(c){P(c,{phase:"binding",name:"bindDynamic (name getter)",node:e});return}let a;try{a=typeof t=="function"?t():t}catch(c){P(c,{phase:"binding",name:"bindDynamic (value getter)",node:e});return}r!==null&&r!==s&&(e.removeAttribute(r),r=null),te(e,s,a,{label:"bindDynamic"})&&(r=s)}let i=J(o,e);return()=>{i(),r!==null&&e.removeAttribute(r)}}var Et=["data-focus-key","id","name"],To=new Set(["text","search","url","tel","password",""]);function Eo(e){let n=e.tagName;if(!(n==="TEXTAREA"||n==="INPUT"&&To.has(e.type.toLowerCase())))return{start:null,end:null,direction:null};let r=e;return{start:r.selectionStart,end:r.selectionEnd,direction:r.selectionDirection}}function Fe(e){if(e.length===0||typeof document>"u")return null;let n=document.activeElement;if(!n||n===document.body)return null;let t=!1;for(let i=0;i<e.length;i++){let s=e[i];if(s===n||s.nodeType===1&&s.contains(n)){t=!0;break}}if(!t)return null;let r=null,o=null;for(let i=0;i<Et.length;i++){let s=n.getAttribute(Et[i]);if(s){r=Et[i],o=s;break}}return{el:n,attr:r,value:o,tag:n.tagName,...Eo(n)}}function wo(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function ko(e,n){let t=null,r=0;for(let o=0;o<e.length;o++){let i=e[o];if(i.nodeType!==1)continue;let s=i;s.matches(n)&&(r++,t??(t=s));let a=s.querySelectorAll(n);for(let c=0;c<a.length;c++)r++,t??(t=a[c]);if(r>1)return{el:null,count:r}}return r===1?{el:t,count:r}:{el:null,count:r}}function Dn(e,n){if(e.focus(),n.start!==null&&typeof e.setSelectionRange=="function"){let t=e,r=t.value.length,o=Math.min(n.start,r),i=Math.min(n.end??o,r);t.setSelectionRange(o,i,n.direction??"none")}}function Pe(e,n,t){if(!e||typeof document>"u")return;let r=document.activeElement;if(r===e.el||r&&r!==document.body&&r!==document.documentElement)return;if(e.el.isConnected){Dn(e.el,e);return}let o=!1;if(e.attr&&e.value){let{el:i,count:s}=ko(n,`[${e.attr}=${wo(e.value)}]`);if(i&&i.tagName===e.tag){Dn(i,e);return}o=s>1}ee(()=>{let i=e.attr?` (${e.attr}="${e.value}")`:"",s=o?`several elements in the rebuilt subtree share ${e.attr}="${e.value}", so there is no way to tell which one the user was in \u2014 a shared name (a radio group) identifies a GROUP, not a control. Add a unique id or data-focus-key to each`:"no element in the rebuilt subtree carries the same identity. Give it a stable id, name, or data-focus-key that the rebuild reproduces";return`${t}: a reactive rebuild discarded the focused element <${e.tag.toLowerCase()}>${i} and could not re-establish it, so focus fell back to <body>. An in-progress edit ends here, and an in-progress IME composition is lost outright \u2014 a composition belongs to the DOM node, so it cannot survive the node being destroyed. ${s}, or stop the rebuild from happening: key the subtree with match(() => shapeKey(), { \u2026 }) so it is re-created only when the shape actually changes, and drive the rest with reactive attributes and text children, which mutate nodes in place instead of replacing them.`})}function Te(e,n){let t=[];function r(){let o;try{o=n()}catch(l){P(l,{phase:"binding",name:"bindChildNode",node:e});return}let i=Fe(t);if(o==null||typeof o=="boolean"){for(let l=0;l<t.length;l++){let m=t[l];V(m),m.parentNode&&m.parentNode.removeChild(m)}t.length=0,Pe(i,t,"bindChildNode");return}let s=e.parentNode;if(!s){t.length=0;return}let a;if(Array.isArray(o)){a=[];let l=new Set;for(let m=0;m<o.length;m++){let b=o[m];if(b==null||typeof b=="boolean")continue;let f=b instanceof Node?b:document.createTextNode(String(b));if(l.has(f)){O("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");continue}l.add(f),a.push(f)}}else a=[o instanceof Node?o:document.createTextNode(String(o))];let c;if(t.length>0&&a.length>0){let l=new Set(t);c=new Set;for(let m=0;m<a.length;m++)l.has(a[m])&&c.add(a[m])}for(let l=0;l<t.length;l++){let m=t[l];c?.has(m)||(V(m),m.parentNode&&m.parentNode.removeChild(m))}let u=e;for(let l=0;l<a.length;l++){let m=a[l];u.nextSibling!==m&&s.insertBefore(m,u.nextSibling),u=m}t=a,Pe(i,a,"bindChildNode")}return J(r,e)}var D="http://www.w3.org/2000/svg",_o=new Set(["script","iframe","object","embed","frame","frameset"]);function Ao(e){return _o.has(e.toLowerCase())}var Co=new Set(["config","location","history","document","window","navigator","name","top","parent","self","frames"]);var wt=new Set,On=100,In=!1,Bn=new Map;function Lo(e){let n=Bn.get(e);return n!==void 0||(n=e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Bn.set(e,n)),n}function No(e,n){if(typeof n=="function"){let r=J(()=>{e.setAttribute("style",Ze(String(n()),{element:e}))},e);_(e,r);return}if(typeof n=="string"){e.setAttribute("style",Ze(n,{element:e}));return}let t=e;for(let r in n){let o=n[r],i=Lo(r);if(typeof o=="function"){let s=o,a=J(()=>{t.style.setProperty(i,Ye(String(s()),{property:i,element:e}))},e);_(e,a)}else t.style.setProperty(i,Ye(String(o),{property:i,element:e}))}}function Ro(e,n){if(typeof n=="string"){e.setAttribute("class",n);return}if(typeof n=="function"){let i=J(()=>{e.setAttribute("class",n())},e);_(e,i);return}let t=n,r=!1,o="";for(let i in t){let s=t[i];if(typeof s=="function"){r=!0;break}s&&(o=o?`${o} ${i}`:i)}if(r){let s=J(()=>{let a="";for(let c in t){let u=t[c];(typeof u=="function"?u():u)&&(a=a?`${a} ${c}`:c)}e.setAttribute("class",a)},e);_(e,s)}else e.setAttribute("class",o)}function kt(e,n){if(typeof n=="string"){e.textContent=n;return}if(typeof n=="number"){e.textContent=String(n);return}if(!(typeof n=="boolean"||n==null)){if(typeof n=="function"){let t=document.createComment("");e.appendChild(t),_(e,Te(t,n));return}if(n instanceof Node){e.appendChild(n);return}if(Array.isArray(n))for(let t=0;t<n.length;t++){let r=n[t];if(typeof r=="function"){let o=document.createComment("");e.appendChild(o),_(e,Te(o,r))}else if(r instanceof Node)e.appendChild(r);else if(Array.isArray(r))for(let o=0;o<r.length;o++){let i=r[o];if(typeof i=="function"){let s=document.createComment("");e.appendChild(s),_(e,Te(s,i))}else i instanceof Node?e.appendChild(i):i!=null&&typeof i!="boolean"&&e.appendChild(document.createTextNode(String(i)))}else r!=null&&typeof r!="boolean"&&e.appendChild(document.createTextNode(String(r)))}}}var d=(e,n)=>{let t=Ao(e);return(r,o)=>{if(t)throw new Error(`tagFactory: refusing to create <${e}> \u2014 tag is blocked for security reasons.`);let i=n?document.createElementNS(n,e):document.createElement(e);if(r===void 0)return i;if(typeof r=="string")return o!==void 0?(i.setAttribute("class",r),kt(i,o),i):(ee(()=>{let f=r.trim().split(/\s+/);if(f.length<2)return"";let p=0;for(let h=0;h<f.length;h++){let y=f[h];if(!/^-?[A-Za-z_][A-Za-z0-9_:/.-]*$/.test(y))return"";/[-:/0-9]/.test(y)&&p++}if(p<2)return"";let g=`${e}|${r}`;return wt.has(g)?"":wt.size>=On?In?"":(In=!0,`tagFactory: ${On} distinct lone-string class warnings have been reported; suppressing further ones for the rest of this session so they cannot flood the console. Fix the reported ones and reload to see any that remain.`):(wt.add(g),`tagFactory: lone string "${r}" looks like a class list but is being rendered as TEXT. For a class, use ${e}({ class: "${r}" }) \u2014 or ${e}("${r}", children) to set the class AND add children.`)}),i.textContent=r,i);if(typeof r=="number")return i.textContent=String(r),i;if(Array.isArray(r)||r instanceof Node||typeof r=="function")return kt(i,r),i;let s=r,a=s.class;a!=null&&Ro(i,a);let c=s.id;c!=null&&(typeof c=="string"&&Co.has(c.toLowerCase())&&O(`tagFactory: element id="${c}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`),i.id=c);let u=o!==void 0?o:s.nodes;u!=null&&kt(i,u);let l=s.on;if(l)for(let f in l){let p=l[f];typeof p=="function"?i.addEventListener(f,p):O(`tagFactory: on.${f} handler is not a function (got ${typeof p}). Event listener was not attached.`)}let m=s.style;m!=null&&No(i,m);let b=s.ref;b&&(b.current=i);for(let f in s)switch(f){case"class":case"id":case"nodes":case"on":case"style":case"ref":case"onElement":continue;default:{let p=s[f];if(p==null||Ne(f))continue;typeof p=="function"?_(i,tt(i,f,p)):te(i,f,p,{syncValueProperty:!1,label:"tagFactory"})}}return s.onElement&&typeof s.onElement=="function"&&s.onElement(i),i}};var Nl=d("html"),Mo=d("head"),Po=d("body"),Ho=d("title"),R=d("div"),F=d("span"),$o=d("section"),Do=d("article"),Oo=d("header"),Io=d("footer"),Bo=d("nav"),Vo=d("main"),Fo=d("aside"),jo=d("address"),_t=d("p"),zo=d("h1"),qo=d("h2"),At=d("h3"),Wo=d("h4"),Ko=d("h5"),Uo=d("h6"),Jo=d("blockquote"),Go=d("dd"),Yo=d("dl"),Zo=d("dt"),Xo=d("figcaption"),Qo=d("figure"),ei=d("hr"),ti=d("li"),ni=d("ol"),ri=d("ul"),Ct=d("pre"),oi=d("a"),ii=d("abbr"),si=d("b"),ai=d("bdi"),ci=d("bdo"),li=d("br"),ui=d("cite"),Lt=d("code"),di=d("data"),fi=d("dfn"),pi=d("em"),mi=d("i"),gi=d("kbd"),bi=d("mark"),hi=d("q"),yi=d("rp"),vi=d("rt"),xi=d("ruby"),Si=d("s"),Ti=d("samp"),Ei=d("small"),wi=d("strong"),ki=d("sub"),_i=d("sup"),Ai=d("time"),Ci=d("u"),Li=d("var"),Ni=d("area"),Ri=d("audio"),Mi=d("img"),Pi=d("map"),Hi=d("track"),$i=d("video"),Di=d("embed"),Oi=d("iframe"),Ii=d("object"),Bi=d("param"),Vi=d("picture"),Fi=d("portal"),ji=d("source"),zi=d("svg",D),qi=d("math"),Wi=d("canvas"),Ki=d("noscript"),Ui=d("script"),Ji=d("del"),Gi=d("ins"),Yi=d("caption"),Zi=d("col"),Xi=d("colgroup"),Qi=d("table"),es=d("tbody"),ts=d("td"),ns=d("tfoot"),rs=d("th"),os=d("thead"),is=d("tr"),je=d("button"),ss=d("datalist"),as=d("fieldset"),cs=d("form"),ls=d("input"),us=d("label"),ds=d("legend"),fs=d("meter"),ps=d("optgroup"),ms=d("option"),gs=d("output"),bs=d("progress"),hs=d("select"),ys=d("textarea"),vs=d("details"),xs=d("dialog"),Ss=d("menu"),Ts=d("summary"),Es=d("slot"),ws=d("template"),ks=d("base"),_s=d("link"),As=d("meta"),Ee=d("style"),Cs=d("circle",D),Ls=d("ellipse",D),Ns=d("g",D),Rs=d("line",D),Ms=d("path",D),Ps=d("polygon",D),Hs=d("polyline",D),$s=d("rect",D),Ds=d("text",D),Os=d("tspan",D),Is=d("defs",D),Bs=d("clipPath",D),Vs=d("mask",D),Fs=d("pattern",D),js=d("linearGradient",D),zs=d("radialGradient",D),qs=d("stop",D),Ws=d("use",D),Ks=d("symbol",D),Us=d("marker",D),Js=d("center"),Gs=d("font"),Ys=d("marquee"),Zs=e=>d(e);var Nt="__sibuPendingError";function Vn(e,n){let t=()=>e.parentNode?(P(n,{phase:"render",name:"lazy",node:e}),!0):!1;t()||queueMicrotask(()=>{t()||(e[Nt]=n)})}function nt(e){let n=e,t=n[Nt];if(t instanceof Error)return delete n[Nt],t}function Fn(e){let n=null;return function(){if(n)return n();let r=R({class:"sibu-lazy"}),o=!1;return e().then(i=>{if(o)return;n=i.default;let s=n();X(r,s)}).catch(i=>{if(o)return;let s=i instanceof Error?i:new Error(String(i));X(r,R({class:"sibu-lazy-error"},`Failed to load component: ${s.message}`)),Vn(r,s)}),r.appendChild(F("sibu-lazy-loading","Loading...")),_(r,()=>{o=!0}),r}}function jn({nodes:e,fallback:n}){let t=R({class:"sibu-suspense"}),r=n();t.appendChild(r);let o=!1,i=null,s=null;return _(t,()=>{o=!0,i&&(i.disconnect(),i=null),s&&!t.contains(s)&&V(s)}),queueMicrotask(()=>{if(!o)try{let a=e();if(s=a,a.classList.contains("sibu-lazy")){if(!a.querySelector(".sibu-lazy-loading")){X(t,a);return}i=new MutationObserver(()=>{if(o)return;a.querySelector(".sibu-lazy-loading")||(i?.disconnect(),i=null,X(t,a))}),i.observe(a,{childList:!0,subtree:!0})}else X(t,a)}catch(a){let c=a instanceof Error?a:new Error(String(a));Vn(t,c)}}),t}function Ht(e,n){try{return e()}catch(t){let r=n.toLowerCase().includes("unmount")?"cleanup":"effect";P(t,{phase:r,name:n});return}}function Rt(e,n,t){let r=Ht(e,n);typeof r=="function"&&t&&_(t,r)}var He=new WeakMap,we=new WeakMap,de=new Set,fe=new Set,$e=null,rt=0,Xs=256;function Mt(e){let n=He.get(e);if(n){He.delete(e),de.delete(e);for(let t of n)try{t()}catch{}}}function Pt(e){we.get(e)&&queueMicrotask(()=>{if(e.isConnected)return;let t=we.get(e);if(t){we.delete(e),fe.delete(e);for(let r of t)try{r()}catch{}}})}function Qs(e){if(de.size===0||e.nodeType!==1)return;let n=e;if(de.has(n)&&n.isConnected&&Mt(n),n.firstElementChild)for(let t of Array.from(de))t!==n&&t.isConnected&&n.contains(t)&&Mt(t)}function ea(e){if(fe.size===0||e.nodeType!==1)return;let n=e;if(fe.has(n)&&!n.isConnected&&Pt(n),n.firstElementChild)for(let t of Array.from(fe))t!==n&&!t.isConnected&&n.contains(t)&&Pt(t)}function ta(){if(de.size>0)for(let e of Array.from(de))e.isConnected&&Mt(e);if(fe.size>0)for(let e of Array.from(fe))e.isConnected||Pt(e)}function zn(){$e||typeof document>"u"||($e=new MutationObserver(e=>{for(let n of e)if(n.type==="childList"){if(n.addedNodes.length>0)for(let t=0;t<n.addedNodes.length;t++)Qs(n.addedNodes[t]);if(n.removedNodes.length>0)for(let t=0;t<n.removedNodes.length;t++)ea(n.removedNodes[t])}rt+=e.length,rt>=Xs&&(rt=0,ta()),$t()}),$e.observe(document.body,{childList:!0,subtree:!0}))}function $t(){$e&&de.size===0&&fe.size===0&&($e.disconnect(),$e=null,rt=0)}function na(e,n){let t=He.get(e);return t||(t=[],He.set(e,t)),t.push(n),de.add(e),zn(),()=>{let r=He.get(e);if(r){let o=r.indexOf(n);o!==-1&&r.splice(o,1),r.length===0&&(He.delete(e),de.delete(e))}$t()}}function ra(e,n){let t=we.get(e);return t||(t=[],we.set(e,t)),t.push(n),fe.add(e),zn(),()=>{let r=we.get(e);if(r){let o=r.indexOf(n);o!==-1&&r.splice(o,1),r.length===0&&(we.delete(e),fe.delete(e))}$t()}}function ot(e,n){if(!(typeof document>"u"))if(n){let t=!1;if(_(n,()=>{t=!0}),n.isConnected){queueMicrotask(()=>{t||Rt(e,"onMount",n)});return}queueMicrotask(()=>{if(t)return;if(n.isConnected){Rt(e,"onMount",n);return}let r=na(n,()=>{t||Rt(e,"onMount",n)});_(n,r)})}else queueMicrotask(()=>{Ht(e,"onMount")})}function oa(e,n){if(typeof document>"u")return;let t=!1,r=()=>{t||(t=!0,Ht(e,"onUnmount"))};_(n,r);let o=()=>{if(t)return;let i=ra(n,r);_(n,i)};n.isConnected?o():ot(()=>{o()},n)}function ia(e,n){_(n,e)}var Dt=Symbol.for("sibujs.ssr.v1");function sa(){let e=null;try{if(typeof process<"u"&&process.versions&&process.versions.node){let n=null,t=process.getBuiltinModule;typeof t=="function"?n=t("node:async_hooks"):typeof dt=="function"&&(n=dt("async_hooks")),n&&(e=new n.AsyncLocalStorage)}}catch{e=null}return{als:e,fallbackStore:{ssr:!1,suspenseIdCounter:0,locale:void 0},fallbackDepth:0}}var ke=globalThis[Dt]??(globalThis[Dt]=sa()),ze=ke.als,ae=ke.fallbackStore;ke.fallbackDepth??(ke.fallbackDepth=0);var qn=!1;function aa(){if(qn||ze||!(typeof process<"u"&&!!process.versions?.node))return;qn=!0;let n=process.versions.node;O(`SSR request isolation is UNAVAILABLE on this runtime (Node ${n}). AsyncLocalStorage could not be loaded, so concurrent requests share one SSR store: request state and the query cache can bleed between them. Node >= 22.3 is required for isolated SSR under ESM; the CommonJS build works on older versions. A fully synchronous render is unaffected.`)}function _e(){if(ze){let e=ze.getStore();if(e)return e}return ae}function oe(){return _e().ssr}function Wn(e){if(!oe())return null;let n=_e(),t=n.caches??(n.caches=new Map),r=t.get(e);return r||(r=new Map,t.set(e,r)),r}function Kn(){_e().ssr=!0}function Un(){_e().ssr=!1}function Jn(e){let n={ssr:!0,suspenseIdCounter:0,locale:void 0};if(ze)return ze.run(n,e);aa();let t=ae.ssr,r=ae.suspenseIdCounter,o=ae.locale;ae.ssr=!0,ae.suspenseIdCounter=0,ae.locale=void 0,ke.fallbackDepth++;try{return e()}finally{ke.fallbackDepth--,ae.ssr=t,ae.suspenseIdCounter=r,ae.locale=o}}function Gn(e){let n=_e(),t=n.ssr;n.ssr=!0;try{return e()}finally{t||(n.ssr=!1)}}var Xn=globalThis;function ca(e,n){let t,r=!0;return()=>{let o=e();if(r)r=!1,t=o,Be(()=>n(o,void 0));else{let i=t;t=o,Be(()=>n(o,i))}}}var Yn=100;function Ot(e){let n=e.userCleanups;if(n.length!==0){e.userCleanups=[];for(let t=n.length-1;t>=0;t--)try{n[t]()}catch(r){P(r,{phase:"cleanup"})}}}function Zn(e){let n=1;do e.rerunPending=!1,e.userCleanups.length>0&&Ot(e),be(e.bodyFn,e.subscriber);while(e.rerunPending&&++n<=Yn);e.rerunPending&&(e.rerunPending=!1,P(new Error(`effect re-requested itself ${Yn}+ times \u2014 likely a write-reads-self cycle. Breaking to prevent infinite loop.`),{phase:"effect"}))}function la(e){if(e.disposed)return;e.disposed=!0;let n=Xn.__SIBU_DEVTOOLS_GLOBAL_HOOK__;if(n)try{n.emit("effect:destroy",{effectFn:e.fn})}catch{}try{e.userCleanups.length>0&&Ot(e)}catch(t){typeof console<"u"&&console.warn("[SibuJS effect] onCleanup threw during dispose:",t)}try{Ve(e.subscriber)}catch(t){typeof console<"u"&&console.warn("[SibuJS effect] dispose threw:",t)}}function Y(e,n){if(I(typeof e=="function","effect: argument must be a function."),oe())return()=>{};let t={fn:e,onError:n?.onError,userCleanups:[],running:!1,rerunPending:!1,disposed:!1,onCleanup:null,subscriber:null,bodyFn:null};t.onCleanup=s=>{t.userCleanups.push(s)};let r=t.onError;t.bodyFn=r?()=>{try{t.fn(t.onCleanup)}catch(s){r(s)}}:()=>{t.fn(t.onCleanup)};let o=(()=>{if(!t.disposed){if(t.running){t.rerunPending=!0;return}t.running=!0;try{t.rerunPending=!1,t.userCleanups.length>0&&Ot(t),be(t.bodyFn,o),t.rerunPending&&Zn(t)}finally{t.running=!1,t.rerunPending=!1}}});o.depsHead=null,o.depsTail=null,o._epoch=0,o._structDirty=!1,o._hasComputedDep=!1,o._errorPhase="effect",o._runEpoch=0,o._runs=0,t.subscriber=o,t.running=!0;try{be(t.bodyFn,t.subscriber),t.rerunPending&&Zn(t)}finally{t.running=!1,t.rerunPending=!1}let i=Xn.__SIBU_DEVTOOLS_GLOBAL_HOOK__;return i&&i.emit("effect:create",{effectFn:e}),()=>la(t)}var qe=0,It=new Set;function ua(e){qe++;try{return e()}finally{qe--,qe===0&&pa()}}function da(e){return qe===0?!1:(It.add(e),!0)}function fa(){return qe>0}function pa(){try{for(let e of It)Hn(e)}finally{It.clear()}Pn()}var Qn=Symbol.for("sibujs.reactive.batch.v1");function ma(){let e=globalThis,n=e[Qn];if(n)return n;let t={batch:ua,enqueueBatchedSignal:da,isBatching:fa};return e[Qn]=t,t}var Bt=ma(),q=Bt.batch,Ae=Bt.enqueueBatchedSignal,ga=Bt.isBatching;var Vt=globalThis;function C(e,n){let t={value:e,__v:0,__sc:0,subsHead:null,subsTail:null,__activeNode:null,__name:void 0,_d:!1,_validate:void 0},r=n?.name,o=n?.equals;r&&(t.__name=r);function i(){return Se(t),t.value}i.__signal=t,r&&(i.__name=r);let s;if(o?s=a=>{let c=t.value,u=typeof a=="function"?a(c):a;if(!o(c,u)){if(t.value=u,t.__v++,!0){let l=Vt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;l&&l.emit("signal:update",{signal:t,name:r,oldValue:c,newValue:u})}Ae(t)||Me(t)}}:s=a=>{let c=t.value,u=typeof a=="function"?a(c):a;if(Object.is(u,c))return;t.value=u,t.__v++;let l=Vt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;l&&l.emit("signal:update",{signal:t,name:r,oldValue:c,newValue:u}),Ae(t)||Me(t)},!0){let a=Vt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;a&&a.emit("signal:create",{signal:t,name:r,getter:i,initial:e})}return[i,s]}function ba(e){let[n,t]=C(0,e?.name?{name:e.name}:void 0);return{track(){n()},invalidate(){t(r=>r+1)}}}var ha=`
|
|
4
|
+
`?2:1;continue}if(gn(o)){let i="",s=t+1;for(;s<e.length&&i.length<6&&gn(e[s]);)i+=e[s],s++;s<e.length&&ho(e[s])&&(s+=e[s]==="\r"&&e[s+1]===`
|
|
5
|
+
`?2:1);let a=Number.parseInt(i,16),c=a===0||a>1114111||a>=55296&&a<=57343;n+=c?"\uFFFD":String.fromCodePoint(a),t=s-1;continue}n+=o,t+=1}return n}var bn=["url(","expression(","javascript:","vbscript:","-moz-binding","behavior:","@import","image-set(","filter:progid"];function vo(e){if(!e)return"an element";let n=e.tagName.toLowerCase(),t=e.getAttribute("id");t&&(n+=`#${t}`);let r=e.getAttribute("class");return r&&(n+=`.${r.trim().split(/\s+/).slice(0,3).join(".")}`),`<${n}>`}var wt=new Set,hn=100,yn=!1;function Sn(e,n,t){oe(()=>{let r=["url() in an inline style is an exfiltration channel: the browser fetches it immediately and the URL's path or query can carry page data off-origin","expression() executes arbitrary script in legacy engines","the javascript: scheme executes script","the vbscript: scheme executes script","-moz-binding loads and runs remote XBL","behavior: loads and runs a remote HTC script","@import pulls in a remote stylesheet","image-set() fetches remote images, the same exfiltration channel as url()","filter:progid activates legacy scriptable filters"],o=t?.property?`${t.property}: ${e}`:e,i=vo(t?.element),s=`${i}|${o}`;return wt.has(s)?"":wt.size>=hn?yn?"":(yn=!0,`${hn} distinct dropped style declarations have been reported; suppressing further ones for the rest of this session so they cannot flood the console. The declarations are still dropped \u2014 only the reporting stops. Fix the reported ones and reload to see any that remain.`):(wt.add(s),`style declaration "${o}" was dropped by the style sanitizer on ${i} \u2014 ${r[n]}. The element renders without it, which usually looks like a missing image rather than an error. Sanctioned alternatives: for a content image use an <img> element (or a <picture>); for decoration, put the rule in a stylesheet and set a class instead \u2014 stylesheet CSS is not sanitized, only inline style attributes are. If this declaration is not yours, it came from untrusted data and the drop just prevented an exfiltration.`)})}function Et(e){if(!bo.test(e))return-1;let t=(e.includes("\\")?yo(e):e).toLowerCase().replace(/\s+/g,"");for(let r=0;r<bn.length;r++)if(t.includes(bn[r]))return r;return-1}function Ge(e,n){let t=Et(e);return t===-1?e:(Sn(e,t,n),"")}function ot(e,n){let t=String(e);if(t.trim()==="")return"";if(typeof document>"u")return Ge(t,n)===""?"":t;let r=document.createElement("div");try{r.style.cssText=t}catch{return""}let o=[];for(let i=0;i<r.style.length;i++){let s=r.style[i],a=r.style.getPropertyValue(s),c=Et(a);if(c===-1&&(c=Et(`${s}:${a}`)),c!==-1){Sn(a,c,{property:s,element:n?.element});continue}let u=r.style.getPropertyPriority(s);o.push(`${s}: ${a}${u?` !${u}`:""}`)}return o.join("; ")}var So=new Set(["href","xlink:href","src","action","formaction","formtarget","cite","poster","background","srcset","ping","data","manifest"]),xo=new Set(["srcdoc"]);function xn(e){return xo.has(e.toLowerCase())}function Tn(e,n,t){let r=e.toLowerCase();return r==="srcset"?go(n):So.has(r)?vn(n):r==="style"?ot(n,t):n}var To="http://www.w3.org/1999/xhtml",wo="http://www.w3.org/2000/svg",Eo="http://www.w3.org/1999/xlink",ko="http://www.w3.org/XML/1998/namespace",_o=new Set(["checked","disabled","selected"]);function Co(e){return e.namespaceURI===null||e.namespaceURI===To}function wn(e,n,t){e[n]=t}function Ao(e,n){if(e.namespaceURI!==wo)return null;let t=n.toLowerCase();return t.startsWith("xlink:")?Eo:t.startsWith("xml:")?ko:null}function ie(e,n,t,r={}){let o=Ao(e,n),i=o?n.slice(n.indexOf(":")+1):n;if(Ie(n))return O(`${r.label??"setSafeAttribute"}: refusing to set event-handler attribute "${n}". Its value would be evaluated as JavaScript. Use on:{ ${n.slice(2)}: fn } instead.`),o?e.removeAttributeNS(o,i):e.removeAttribute(n),!1;if(t==null)return o?e.removeAttributeNS(o,i):e.removeAttribute(n),!0;if(xn(n))return O(`${r.label??"setSafeAttribute"}: refusing to set "${n}". The browser parses this attribute as a nested HTML document, so a generic string value cannot be made safe \u2014 attribute escaping is undone before the parse. Build the frame's content another way.`),o?e.removeAttributeNS(o,i):e.removeAttribute(n),!1;let s=Co(e),a=s?n.toLowerCase():n;if(typeof t=="boolean"){if(n.length>5&&n.slice(0,5).toLowerCase()==="aria-"){let h=t?"true":"false";return(o?e.getAttributeNS(o,i):e.getAttribute(n))!==h&&(o?e.setAttributeNS(o,n,h):e.setAttribute(n,h)),!0}return s&&_o.has(a)&&a in e?wn(e,a,t):t?o?e.setAttributeNS(o,n,""):e.setAttribute(n,""):o?e.removeAttributeNS(o,i):e.removeAttribute(n),!0}let c=String(t);if(r.syncValueProperty!==!1&&s&&(a==="value"||a==="checked")&&a in e)return wn(e,a,a==="checked"?!!t:c),!0;let u=Tn(n,c,{element:e});return(o?e.getAttributeNS(o,i):e.getAttribute(n))===u||(o?e.setAttributeNS(o,n,u):e.setAttribute(n,u)),!0}var No=4096,kt=[];function Ro(){return{sig:null,sub:null,epoch:0,depVersion:0,sigPrev:null,sigNext:null,subPrev:null,subNext:null,prevActive:null}}function Lo(e,n,t){let r=kt.pop();if(r)return r.sig=e,r.sub=n,r.epoch=t,r;let o=Ro();return o.sig=e,o.sub=n,o.epoch=t,o}function En(e){e.sig=null,e.sub=null,e.sigPrev=null,e.sigNext=null,e.subPrev=null,e.subNext=null,e.prevActive=null,kt.length<No&&kt.push(e)}function Mo(e,n){let t=e.subsHead??null;n.sigPrev=null,n.sigNext=t,t?t.sigPrev=n:e.subsTail=n,e.subsHead=n,e.__sc=(e.__sc??0)+1}function kn(e){let n=e.sig;if(!n)return;let t=e.sigPrev,r=e.sigNext;t?t.sigNext=r:n.subsHead=r,r?r.sigPrev=t:n.subsTail=t,n.__sc=(n.__sc??1)-1,n.__activeNode===e&&(n.__activeNode=e.prevActive),n.__sc===0&&(n.subsHead=null,n.subsTail=null)}function Po(e,n){let t=e.depsTail??null;n.subPrev=t,n.subNext=null,t?t.subNext=n:e.depsHead=n,e.depsTail=n}function Do(e){let n=e.sub;if(!n)return;let t=e.subPrev,r=e.subNext;t?t.subNext=r:n.depsHead=r,r?r.subPrev=t:n.depsTail=t}var ae=null,ge=null,xe=0,Te=[],se=new Set,$o=[];function Oo(e){try{e()}catch(n){let t=e;R(n,{phase:t._errorPhase??"effect",name:t.__name,node:t._errorNode})}}function Ho(e){let n=e.depsHead??null;if(n===null)return!0;for(;n!==null;){let t=n.sig;if(t===null)return!0;if(t._d===!0&&t._validate!==void 0)try{t._validate()}catch{return!0}if(n.depVersion!==t.__v)return!0;n=n.subNext}return!1}var pe=0,be=!1;function Ct(){pe===0&&(ge=ae,ae=null,be=!0),pe++}function At(){pe--,pe===0&&(ae=ge,ge=null,be=!1)}function _n(){return be}function Cn(e){Ct();try{return e()}finally{At()}}var Io=0;function Nt(e,n){let t=ae,r=0,o=null;be&&(r=pe,o=ge,pe=0,ge=null,be=!1),ae=n;let i=n;i._cap===void 0&&(i._cap=un());let s=++Io;i._epoch=s,i._structDirty=!1;for(let a=i.depsHead??null;a!==null;a=a.subNext){let c=a.sig;a.prevActive=c.__activeNode??null,c.__activeNode=a}try{e()}finally{ae=t,r!==0&&(pe=r,ge=o,be=!0);let a=i.depsHead??null;for(;a!==null;){let c=a.subNext,u=a.sig;u.__activeNode=a.prevActive,a.prevActive=null,a.epoch!==s&&(Do(a),kn(a),En(a)),a=c}}}function An(e,n){if(!n)return Rt(e);Be(n);let t=ae,r=0,o=null;be&&(r=pe,o=ge,pe=0,ge=null,be=!1),ae=n;try{e()}finally{ae=t,r!==0&&(pe=r,ge=o,be=!0);let s=n;for(let a=s.depsHead??null;a!==null;a=a.subNext){let c=a.sig;c.__activeNode=a.prevActive,a.prevActive=null}}let i=n;return i._dispose??(i._dispose=()=>Be(n))}function Rt(e,n){let t=()=>{let o=r;if(!(o._disposed||o._reentrant)){o._reentrant=!0;try{Nt(e,r)}finally{o._reentrant=!1}}},r=t;r.depsHead=null,r.depsTail=null,r._epoch=0,r._structDirty=!1,r._hasComputedDep=!1,r._runEpoch=0,r._runs=0,r._reentrant=!1,r._disposed=!1,r._errorPhase="binding",r._errorNode=n;try{t()}catch(o){throw r._disposed=!0,r._errorNode=void 0,Be(r),o}return r._dispose??(r._dispose=()=>{r._disposed=!0,r._errorNode=void 0,Be(r)})}function Nn(e){if(!ae)return;let n=ae,t=e,r=n._epoch??0,o=t.__activeNode??null;if(o!==null&&o.sub===n){o.epoch=r,o.depVersion=t.__v??Number.NaN;return}t._validate!==void 0&&(n._hasComputedDep=!0);let i=Lo(e,n,r);i.depVersion=t.__v??Number.NaN,i.prevActive=o,t.__activeNode=i,Po(n,i),Mo(t,i),n._structDirty=!0}function Be(e){let n=e,t=n.depsHead??null;for(n.depsHead=null,n.depsTail=null;t;){let r=t.subNext;kn(t),En(t),t=r}}var it=1e3,st=1e6,at=0,_e=new Set;function Rn(e){let n=it;return Number.isFinite(e)&&e>0&&(it=Math.floor(e)),n}function Ln(e){let n=st;return Number.isFinite(e)&&e>0&&(st=Math.floor(e)),n}function Bo(e){let n=e;return n._runEpoch!==at?(n._runEpoch=at,n._runs=1,!1):(n._runs=(n._runs??0)+1,n._runs>it)}function Vo(e){let n=e.__name??"<unnamed>";R(new Error(`subscriber "${n}" fired more than ${it} times \u2014 likely a write-reads-self cycle between effects/signals. This subscriber is quarantined for the rest of this update; other pending work still runs.`),{phase:"scheduler",name:n})}function jo(){R(new Error(`Notification drain exceeded ${st} iterations \u2014 absolute safety net tripped. Breaking to prevent infinite loop.`),{phase:"scheduler"})}function Mn(){let e=0;for(;e<Te.length;){if(e>=st){jo();break}let n=Te[e++];if(se.delete(n),_e.size>0&&_e.has(n)||n._hasComputedDep===!0&&!Ho(n))continue;if(Bo(n)){Vo(n),_e.add(n);continue}let t=dn(n._cap??null);try{Oo(n)}finally{t&&fn()}}}function Pn(){if(!(xe>0)){xe++,at++;try{Mn()}finally{xe--,xe===0&&(Te.length=0,se.clear(),_e.size>0&&_e.clear())}}}function _t(e){e();let n=e._sig;if(!n)return;let t=$o,r=t.length;for(t.push(n);t.length>r;){let i=t.pop().subsHead??null;for(;i;){let s=i.sub;if(s)if(s._c){let a=s._sig;a?(!a._d||a._f===!0)&&(a._d=!0,a._f=!1,t.push(a)):s()}else se.has(s)||(se.add(s),Te.push(s));i=i.sigNext}}}function Dn(e){let t=e.subsHead??null;for(;t;){let r=t.sub;r&&(r._c?_t(r):se.has(r)||(se.add(r),Te.push(r))),t=t.sigNext}}function $n(e){let t=e.subsHead;if(t){if(xe>0){let r=t;for(;r;){let o=r.sub;o&&(o._c?_t(o):se.has(o)||(se.add(o),Te.push(o))),r=r.sigNext}return}xe++,at++;try{let r=t;for(;r;){let o=r.sub;o&&(o._c?_t(o):se.has(o)||(se.add(o),Te.push(o))),r=r.sigNext}Mn()}finally{xe--,xe===0&&(Te.length=0,se.clear(),_e.size>0&&_e.clear())}}}function On(e){return e.__sc??0}function Hn(e){let n=e,t=[],r=n.depsHead??null;for(;r;)r.sig&&t.push(r.sig),r=r.subNext;return t}function In(e,n){let t=e.subsHead??null;for(;t;){let r=t.sub;r&&n(r),t=t.sigNext}}var Bn="4.7.0",Vn=Symbol.for("sibujs.reactive.v1");function zo(){let e=globalThis,n=e[Vn];if(n)return!n.__dupWarned&&(n.__dupWarned=!0,O(`Multiple instances of the reactive runtime detected on this page (active: ${n.version}, duplicate: ${Bn}). Reactivity is NOT broken and no bundler configuration is required: every copy routes through the first one via a global registry, so signal writes still reach subscribers registered by any copy. This is only a SIZE issue \u2014 the duplicate copy's bytes are downloaded and parsed for nothing. If you want them back, de-duplicate sibujs in your bundler (Vite: resolve.dedupe: ['sibujs']). Mismatched VERSIONS above are worth fixing regardless, since only the first one loaded is used.`)),n;let t={suspendTracking:Ct,resumeTracking:At,isTrackingSuspended:_n,untracked:Cn,retrack:Nt,track:An,reactiveBinding:Rt,recordDependency:Nn,cleanup:Be,setMaxSubscriberRepeats:Rn,setMaxDrainIterations:Ln,drainNotificationQueue:Pn,queueSignalNotification:Dn,notifySubscribers:$n,getSubscriberCount:On,getSubscriberDeps:Hn,forEachSubscriber:In,version:Bn};return e[Vn]=t,t}var U=zo(),Ce=U.suspendTracking,Ae=U.resumeTracking,jn=U.isTrackingSuspended,ce=U.untracked,we=U.retrack,ne=U.track,G=U.reactiveBinding,Ne=U.recordDependency,Re=U.cleanup,El=U.setMaxSubscriberRepeats,Fn=U.setMaxDrainIterations,zn=U.drainNotificationQueue,qn=U.queueSignalNotification,Ve=U.notifySubscribers,kl=U.getSubscriberCount,_l=U.getSubscriberDeps,Cl=U.forEachSubscriber;function Ye(e,n,t){if(Ie(n))return ie(e,n,"",{label:`bindAttribute("${n}")`}),()=>{};function r(){let o;try{o=t()}catch(i){R(i,{phase:"binding",name:`bindAttribute("${n}")`,node:e});return}ie(e,n,o,{label:`bindAttribute("${n}")`})}return G(r,e)}function Wn(e,n,t){let r=null;function o(){let s;try{s=typeof n=="function"?n():n}catch(c){R(c,{phase:"binding",name:"bindDynamic (name getter)",node:e});return}let a;try{a=typeof t=="function"?t():t}catch(c){R(c,{phase:"binding",name:"bindDynamic (value getter)",node:e});return}r!==null&&r!==s&&(e.removeAttribute(r),r=null),ie(e,s,a,{label:"bindDynamic"})&&(r=s)}let i=G(o,e);return()=>{i(),r!==null&&e.removeAttribute(r)}}var Lt=["data-focus-key","id","name"],qo=new Set(["text","search","url","tel","password",""]);function Wo(e){let n=e.tagName;if(!(n==="TEXTAREA"||n==="INPUT"&&qo.has(e.type.toLowerCase())))return{start:null,end:null,direction:null};let r=e;return{start:r.selectionStart,end:r.selectionEnd,direction:r.selectionDirection}}function Xe(e){if(e.length===0||typeof document>"u")return null;let n=document.activeElement;if(!n||n===document.body)return null;let t=!1;for(let i=0;i<e.length;i++){let s=e[i];if(s===n||s.nodeType===1&&s.contains(n)){t=!0;break}}if(!t)return null;let r=null,o=null;for(let i=0;i<Lt.length;i++){let s=n.getAttribute(Lt[i]);if(s){r=Lt[i],o=s;break}}return{el:n,attr:r,value:o,tag:n.tagName,...Wo(n)}}function Ko(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uo(e,n){let t=null,r=0;for(let o=0;o<e.length;o++){let i=e[o];if(i.nodeType!==1)continue;let s=i;s.matches(n)&&(r++,t??(t=s));let a=s.querySelectorAll(n);for(let c=0;c<a.length;c++)r++,t??(t=a[c]);if(r>1)return{el:null,count:r}}return r===1?{el:t,count:r}:{el:null,count:r}}function Kn(e,n){if(e.focus(),n.start!==null&&typeof e.setSelectionRange=="function"){let t=e,r=t.value.length,o=Math.min(n.start,r),i=Math.min(n.end??o,r);t.setSelectionRange(o,i,n.direction??"none")}}function je(e,n,t){if(!e||typeof document>"u")return;let r=document.activeElement;if(r===e.el||r&&r!==document.body&&r!==document.documentElement)return;if(e.el.isConnected){Kn(e.el,e);return}let o=!1;if(e.attr&&e.value){let{el:i,count:s}=Uo(n,`[${e.attr}=${Ko(e.value)}]`);if(i&&i.tagName===e.tag){Kn(i,e);return}o=s>1}oe(()=>{let i=e.attr?` (${e.attr}="${e.value}")`:"",s=o?`several elements in the rebuilt subtree share ${e.attr}="${e.value}", so there is no way to tell which one the user was in \u2014 a shared name (a radio group) identifies a GROUP, not a control. Add a unique id or data-focus-key to each`:"no element in the rebuilt subtree carries the same identity. Give it a stable id, name, or data-focus-key that the rebuild reproduces";return`${t}: a reactive rebuild discarded the focused element <${e.tag.toLowerCase()}>${i} and could not re-establish it, so focus fell back to <body>. An in-progress edit ends here, and an in-progress IME composition is lost outright \u2014 a composition belongs to the DOM node, so it cannot survive the node being destroyed. ${s}, or stop the rebuild from happening: key the subtree with match(() => shapeKey(), { \u2026 }) so it is re-created only when the shape actually changes, and drive the rest with reactive attributes and text children, which mutate nodes in place instead of replacing them.`})}function he(e,n){let t=[];function r(){let o;try{o=n()}catch(f){R(f,{phase:"binding",name:"bindChildNode",node:e});return}let i=Xe(t);if(o==null||typeof o=="boolean"){for(let f=0;f<t.length;f++){let h=t[f];j(h),h.parentNode&&h.parentNode.removeChild(h)}t.length=0,je(i,t,"bindChildNode");return}let s=e.parentNode;if(!s){t.length=0;return}let a;if(Array.isArray(o)){a=[];let f=new Set;for(let h=0;h<o.length;h++){let b=o[h];if(b==null||typeof b=="boolean")continue;let m=b instanceof Node?b:document.createTextNode(String(b));if(f.has(m)){O("bindChildNode: duplicate node reference in array \u2014 only the first occurrence is rendered.");continue}f.add(m),a.push(m)}}else a=[o instanceof Node?o:document.createTextNode(String(o))];let c;if(t.length>0&&a.length>0){let f=new Set(t);c=new Set;for(let h=0;h<a.length;h++)f.has(a[h])&&c.add(a[h])}for(let f=0;f<t.length;f++){let h=t[f];c?.has(h)||(j(h),h.parentNode&&h.parentNode.removeChild(h))}let u=e;for(let f=0;f<a.length;f++){let h=a[f];u.nextSibling!==h&&s.insertBefore(h,u.nextSibling),u=h}t=a,je(i,a,"bindChildNode")}return G(r,e)}var I="http://www.w3.org/2000/svg",Jo=new Set(["script","iframe","object","embed","frame","frameset"]);function Go(e){return Jo.has(e.toLowerCase())}var Yo=new Set(["config","location","history","document","window","navigator","name","top","parent","self","frames"]);var Mt=new Set,Un=100,Jn=!1,Gn=new Map;function Yn(e){let n=Gn.get(e);return n!==void 0||(n=e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Gn.set(e,n)),n}function Xo(e,n){if(typeof n=="function"){let r=n,o=[],i=!1,s=G(()=>{let a=r();if(a===null||typeof a!="object"){o=[],i=!0,e.setAttribute("style",ot(String(a),{element:e}));return}let c=e.style;i&&(e.removeAttribute("style"),i=!1);let u=[];for(let f in a){let h=a[f];if(h==null)continue;let b=Yn(f);u.push(b),c.setProperty(b,Ge(String(h),{property:b,element:e}))}for(let f=0;f<o.length;f++)u.indexOf(o[f])===-1&&c.removeProperty(o[f]);o=u},e);C(e,s);return}if(typeof n=="string"){e.setAttribute("style",ot(n,{element:e}));return}let t=e;for(let r in n){let o=n[r],i=Yn(r);if(typeof o=="function"){let s=o,a=G(()=>{t.style.setProperty(i,Ge(String(s()),{property:i,element:e}))},e);C(e,a)}else t.style.setProperty(i,Ge(String(o),{property:i,element:e}))}}function Zo(e,n){if(typeof n=="string"){e.setAttribute("class",n);return}if(typeof n=="function"){let i=G(()=>{let s=n();s==null||s===!1?e.removeAttribute("class"):e.setAttribute("class",s)},e);C(e,i);return}let t=n,r=!1,o="";for(let i in t){let s=t[i];if(typeof s=="function"){r=!0;break}s&&(o=o?`${o} ${i}`:i)}if(r){let s=G(()=>{let a="";for(let c in t){let u=t[c];(typeof u=="function"?u():u)&&(a=a?`${a} ${c}`:c)}e.setAttribute("class",a)},e);C(e,s)}else e.setAttribute("class",o)}function Pt(e,n){if(typeof n=="string"){e.textContent=n;return}if(typeof n=="number"){e.textContent=String(n);return}if(!(typeof n=="boolean"||n==null)){if(typeof n=="function"){let t=document.createComment("");e.appendChild(t),C(e,he(t,n));return}if(n instanceof Node){e.appendChild(n);return}if(Array.isArray(n))for(let t=0;t<n.length;t++){let r=n[t];if(typeof r=="function"){let o=document.createComment("");e.appendChild(o),C(e,he(o,r))}else if(r instanceof Node)e.appendChild(r);else if(Array.isArray(r))for(let o=0;o<r.length;o++){let i=r[o];if(typeof i=="function"){let s=document.createComment("");e.appendChild(s),C(e,he(s,i))}else i instanceof Node?e.appendChild(i):i!=null&&typeof i!="boolean"&&e.appendChild(document.createTextNode(String(i)))}else r!=null&&typeof r!="boolean"&&e.appendChild(document.createTextNode(String(r)))}}}function p(e,n){let t=Go(e);return(r,o)=>{if(t)throw new Error(`tagFactory: refusing to create <${e}> \u2014 tag is blocked for security reasons.`);let i=n?document.createElementNS(n,e):document.createElement(e);if(r===void 0)return i;if(typeof r=="string")return o!==void 0?(i.setAttribute("class",r),Pt(i,o),i):(oe(()=>{let m=r.trim().split(/\s+/);if(m.length<2)return"";let l=0;for(let g=0;g<m.length;g++){let y=m[g];if(!/^-?[A-Za-z_][A-Za-z0-9_:/.-]*$/.test(y))return"";/[-:/0-9]/.test(y)&&l++}if(l<2)return"";let d=`${e}|${r}`;return Mt.has(d)?"":Mt.size>=Un?Jn?"":(Jn=!0,`tagFactory: ${Un} distinct lone-string class warnings have been reported; suppressing further ones for the rest of this session so they cannot flood the console. Fix the reported ones and reload to see any that remain.`):(Mt.add(d),`tagFactory: lone string "${r}" looks like a class list but is being rendered as TEXT. For a class, use ${e}({ class: "${r}" }) \u2014 or ${e}("${r}", children) to set the class AND add children.`)}),i.textContent=r,i);if(typeof r=="number")return i.textContent=String(r),i;if(Array.isArray(r)||r instanceof Node||typeof r=="function")return Pt(i,r),i;let s=r,a=s.class;a!=null&&Zo(i,a);let c=s.id;typeof c=="function"?C(i,Ye(i,"id",c)):c!=null&&(typeof c=="string"&&Yo.has(c.toLowerCase())&&O(`tagFactory: element id="${c}" matches a common global and may cause DOM clobbering. Avoid setting ids from untrusted input.`),i.id=c);let u=o!==void 0?o:s.nodes;u!=null&&Pt(i,u);let f=s.on;if(f)for(let m in f){let l=f[m];typeof l=="function"?i.addEventListener(m,l):O(`tagFactory: on.${m} handler is not a function (got ${typeof l}). Event listener was not attached.`)}let h=s.style;h!=null&&Xo(i,h);let b=s.ref;b&&(b.current=i);for(let m in s)switch(m){case"class":case"id":case"nodes":case"on":case"style":case"ref":case"onElement":continue;default:{let l=s[m];if(l==null||Ie(m))continue;typeof l=="function"?C(i,Ye(i,m,l)):ie(i,m,l,{syncValueProperty:!1,label:"tagFactory"})}}return typeof s.onElement=="function"&&s.onElement(i),i}}var Xl=p("html"),Qo=p("head"),ei=p("body"),ti=p("title"),M=p("div"),F=p("span"),ni=p("section"),ri=p("article"),oi=p("header"),ii=p("footer"),si=p("nav"),ai=p("main"),ci=p("aside"),li=p("address"),Dt=p("p"),ui=p("h1"),di=p("h2"),$t=p("h3"),fi=p("h4"),pi=p("h5"),mi=p("h6"),gi=p("blockquote"),bi=p("dd"),hi=p("dl"),yi=p("dt"),vi=p("figcaption"),Si=p("figure"),xi=p("hr"),Ti=p("li"),wi=p("ol"),Ei=p("ul"),Ot=p("pre"),ki=p("a"),_i=p("abbr"),Ci=p("b"),Ai=p("bdi"),Ni=p("bdo"),Ri=p("br"),Li=p("cite"),Ht=p("code"),Mi=p("data"),Pi=p("dfn"),Di=p("em"),$i=p("i"),Oi=p("kbd"),Hi=p("mark"),Ii=p("q"),Bi=p("rp"),Vi=p("rt"),ji=p("ruby"),Fi=p("s"),zi=p("samp"),qi=p("small"),Wi=p("strong"),Ki=p("sub"),Ui=p("sup"),Ji=p("time"),Gi=p("u"),Yi=p("var"),Xi=p("area"),Zi=p("audio"),Qi=p("img"),es=p("map"),ts=p("track"),ns=p("video"),rs=p("embed"),os=p("iframe"),is=p("object"),ss=p("param"),as=p("picture"),cs=p("portal"),ls=p("source"),us=p("svg",I),ds=p("math"),fs=p("canvas"),ps=p("noscript"),ms=p("script"),gs=p("del"),bs=p("ins"),hs=p("caption"),ys=p("col"),vs=p("colgroup"),Ss=p("table"),xs=p("tbody"),Ts=p("td"),ws=p("tfoot"),Es=p("th"),ks=p("thead"),_s=p("tr"),Ze=p("button"),Cs=p("datalist"),As=p("fieldset"),Ns=p("form"),Rs=p("input"),Ls=p("label"),Ms=p("legend"),Ps=p("meter"),Ds=p("optgroup"),$s=p("option"),Os=p("output"),Hs=p("progress"),Is=p("select"),Bs=p("textarea"),Vs=p("details"),js=p("dialog"),Fs=p("menu"),zs=p("summary"),qs=p("slot"),Ws=p("template"),Ks=p("base"),Us=p("link"),Js=p("meta"),Le=p("style"),Gs=p("circle",I),Ys=p("ellipse",I),Xs=p("g",I),Zs=p("line",I),Qs=p("path",I),ea=p("polygon",I),ta=p("polyline",I),na=p("rect",I),ra=p("text",I),oa=p("tspan",I),ia=p("defs",I),sa=p("clipPath",I),aa=p("mask",I),ca=p("pattern",I),la=p("linearGradient",I),ua=p("radialGradient",I),da=p("stop",I),fa=p("use",I),pa=p("symbol",I),ma=p("marker",I),ga=p("center"),ba=p("font"),ha=p("marquee"),ya=e=>p(e);var It="__sibuPendingError";function Xn(e,n){let t=()=>e.parentNode?(R(n,{phase:"render",name:"lazy",node:e}),!0):!1;t()||queueMicrotask(()=>{t()||(e[It]=n)})}function ct(e){let n=e,t=n[It];if(t instanceof Error)return delete n[It],t}function Zn(e){let n=null;return function(){if(n)return n();let r=M({class:"sibu-lazy"}),o=!1;return e().then(i=>{if(o)return;n=i.default;let s=n();Q(r,s)}).catch(i=>{if(o)return;let s=i instanceof Error?i:new Error(String(i));Q(r,M({class:"sibu-lazy-error"},`Failed to load component: ${s.message}`)),Xn(r,s)}),r.appendChild(F("sibu-lazy-loading","Loading...")),C(r,()=>{o=!0}),r}}function Qn({nodes:e,fallback:n}){let t=M({class:"sibu-suspense"}),r=n();t.appendChild(r);let o=!1,i=null,s=null;return C(t,()=>{o=!0,i&&(i.disconnect(),i=null),s&&!t.contains(s)&&j(s)}),queueMicrotask(()=>{if(!o)try{let a=e();if(s=a,a.classList.contains("sibu-lazy")){if(!a.querySelector(".sibu-lazy-loading")){Q(t,a);return}i=new MutationObserver(()=>{if(o)return;a.querySelector(".sibu-lazy-loading")||(i?.disconnect(),i=null,Q(t,a))}),i.observe(a,{childList:!0,subtree:!0})}else Q(t,a)}catch(a){let c=a instanceof Error?a:new Error(String(a));Xn(t,c)}}),t}function ut(e,n){try{return e()}catch(t){let r=n.toLowerCase().includes("unmount")?"cleanup":"effect";R(t,{phase:r,name:n});return}}function Bt(e,n,t,r){let o=ut(e,n);typeof o=="function"&&(r()||!t.isConnected?ut(o,"onUnmount"):tr(o,t))}var Fe=new WeakMap,Me=new WeakMap,ye=new Set,ve=new Set,ze=null,lt=0,va=256;function Vt(e){let n=Fe.get(e);if(n){Fe.delete(e),ye.delete(e);for(let t of n)try{t()}catch{}}}function jt(e){Me.get(e)&&queueMicrotask(()=>{if(e.isConnected)return;let t=Me.get(e);if(t){Me.delete(e),ve.delete(e);for(let r of t)try{r()}catch{}}})}function Sa(e){if(ye.size===0||e.nodeType!==1)return;let n=e;if(ye.has(n)&&n.isConnected&&Vt(n),n.firstElementChild)for(let t of Array.from(ye))t!==n&&t.isConnected&&n.contains(t)&&Vt(t)}function xa(e){if(ve.size===0||e.nodeType!==1)return;let n=e;if(ve.has(n)&&!n.isConnected&&jt(n),n.firstElementChild)for(let t of Array.from(ve))t!==n&&!t.isConnected&&n.contains(t)&&jt(t)}function Ta(){if(ye.size>0)for(let e of Array.from(ye))e.isConnected&&Vt(e);if(ve.size>0)for(let e of Array.from(ve))e.isConnected||jt(e)}function er(){ze||typeof document>"u"||(ze=new MutationObserver(e=>{for(let n of e)if(n.type==="childList"){if(n.addedNodes.length>0)for(let t=0;t<n.addedNodes.length;t++)Sa(n.addedNodes[t]);if(n.removedNodes.length>0)for(let t=0;t<n.removedNodes.length;t++)xa(n.removedNodes[t])}lt+=e.length,lt>=va&&(lt=0,Ta()),Ft()}),ze.observe(document.body,{childList:!0,subtree:!0}))}function Ft(){ze&&ye.size===0&&ve.size===0&&(ze.disconnect(),ze=null,lt=0)}function wa(e,n){let t=Fe.get(e);return t||(t=[],Fe.set(e,t)),t.push(n),ye.add(e),er(),()=>{let r=Fe.get(e);if(r){let o=r.indexOf(n);o!==-1&&r.splice(o,1),r.length===0&&(Fe.delete(e),ye.delete(e))}Ft()}}function Ea(e,n){let t=Me.get(e);return t||(t=[],Me.set(e,t)),t.push(n),ve.add(e),er(),()=>{let r=Me.get(e);if(r){let o=r.indexOf(n);o!==-1&&r.splice(o,1),r.length===0&&(Me.delete(e),ve.delete(e))}Ft()}}function dt(e,n){if(!(typeof document>"u"))if(n){let t=!1,r=()=>t;if(C(n,()=>{t=!0}),n.isConnected){queueMicrotask(()=>{t||Bt(e,"onMount",n,r)});return}queueMicrotask(()=>{if(t)return;if(n.isConnected){Bt(e,"onMount",n,r);return}let o=wa(n,()=>{t||Bt(e,"onMount",n,r)});C(n,o)})}else queueMicrotask(()=>{ut(e,"onMount")})}function tr(e,n){if(typeof document>"u")return;let t=!1,r=()=>{t||(t=!0,ut(e,"onUnmount"))};C(n,r);let o=()=>{if(t)return;let i=Ea(n,r);C(n,i)};n.isConnected?o():dt(()=>{o()},n)}function ka(e,n){C(n,e)}function re(e,n,t){try{e.emit(n,t)}catch{}}var zt=Symbol.for("sibujs.ssr.v1");function _a(){let e=null;try{if(typeof process<"u"&&process.versions&&process.versions.node){let n=null,t=process.getBuiltinModule;typeof t=="function"?n=t("node:async_hooks"):typeof St=="function"&&(n=St("async_hooks")),n&&(e=new n.AsyncLocalStorage)}}catch{e=null}return{als:e,fallbackStore:{ssr:!1,suspenseIdCounter:0,locale:void 0},fallbackDepth:0}}var Ee=globalThis[zt]??(globalThis[zt]=_a()),Pe=Ee.als,X=Ee.fallbackStore;Ee.fallbackDepth??(Ee.fallbackDepth=0);var nr=!1;function Ca(){if(nr||Pe||!(typeof process<"u"&&!!process.versions?.node))return;nr=!0;let n=process.versions.node;O(`SSR request isolation is UNAVAILABLE on this runtime (Node ${n}). AsyncLocalStorage could not be loaded, so concurrent requests share one SSR store: request state and the query cache can bleed between them. Node >= 22.3 is required for isolated SSR under ESM; the CommonJS build works on older versions. A fully synchronous render is unaffected.`)}function De(){if(Pe){let e=Pe.getStore();if(e)return e}return X}function rr(){return Pe?Pe.getStore()??null:Ee.fallbackDepth>0?X:null}function le(){return De().ssr}function or(e){if(!le())return null;let n=De(),t=n.caches??(n.caches=new Map),r=t.get(e);return r||(r=new Map,t.set(e,r)),r}function ir(){De().ssr=!0}function sr(){De().ssr=!1}function ar(e){let n={ssr:!0,suspenseIdCounter:0,idCounter:0,locale:void 0};if(Pe)return Pe.run(n,e);Ca();let t=X.ssr,r=X.suspenseIdCounter,o=X.idCounter,i=X.locale;X.ssr=!0,X.suspenseIdCounter=0,X.idCounter=0,X.locale=void 0,Ee.fallbackDepth++;try{return e()}finally{Ee.fallbackDepth--,X.ssr=t,X.suspenseIdCounter=r,X.idCounter=o,X.locale=i}}function cr(e){let n=De(),t=n.ssr;n.ssr=!0;try{return e()}finally{t||(n.ssr=!1)}}var dr=globalThis;function Aa(e,n){let t,r=!0;return()=>{let o=e();if(r)r=!1,t=o,ce(()=>n(o,void 0));else{let i=t;t=o,ce(()=>n(o,i))}}}var lr=100;function ft(e){let n=e.userCleanups;if(n.length!==0){e.userCleanups=[];for(let t=n.length-1;t>=0;t--)try{n[t]()}catch(r){R(r,{phase:"cleanup"})}}}function ur(e){let n=1;do e.rerunPending=!1,e.userCleanups.length>0&&ft(e),we(e.bodyFn,e.subscriber);while(e.rerunPending&&++n<=lr);e.rerunPending&&(e.rerunPending=!1,R(new Error(`effect re-requested itself ${lr}+ times \u2014 likely a write-reads-self cycle. Breaking to prevent infinite loop.`),{phase:"effect"}))}function Na(e){if(e.disposed)return;e.disposed=!0;let n=dr.__SIBU_DEVTOOLS_GLOBAL_HOOK__;if(n)try{n.emit("effect:destroy",{effectFn:e.fn})}catch{}try{e.userCleanups.length>0&&ft(e)}catch(t){typeof console<"u"&&console.warn("[SibuJS effect] onCleanup threw during dispose:",t)}try{Re(e.subscriber)}catch(t){typeof console<"u"&&console.warn("[SibuJS effect] dispose threw:",t)}}function Z(e,n){if(V(typeof e=="function","effect: argument must be a function."),le())return()=>{};let t={fn:e,onError:n?.onError,userCleanups:[],running:!1,rerunPending:!1,disposed:!1,onCleanup:null,subscriber:null,bodyFn:null};t.onCleanup=s=>{t.userCleanups.push(s)};let r=t.onError;t.bodyFn=r?()=>{try{t.fn(t.onCleanup)}catch(s){r(s)}}:()=>{t.fn(t.onCleanup)};let o=(()=>{if(!t.disposed){if(t.running){t.rerunPending=!0;return}t.running=!0;try{t.rerunPending=!1,t.userCleanups.length>0&&ft(t),we(t.bodyFn,o),t.rerunPending&&ur(t)}finally{t.running=!1,t.rerunPending=!1}}});o.depsHead=null,o.depsTail=null,o._epoch=0,o._structDirty=!1,o._hasComputedDep=!1,o._errorPhase="effect",o._runEpoch=0,o._runs=0,t.subscriber=o,t.running=!0;try{we(t.bodyFn,t.subscriber),t.rerunPending&&ur(t)}catch(s){throw t.disposed=!0,t.userCleanups.length>0&&ft(t),Re(t.subscriber),s}finally{t.running=!1,t.rerunPending=!1}let i=dr.__SIBU_DEVTOOLS_GLOBAL_HOOK__;return i&&re(i,"effect:create",{effectFn:e}),()=>Na(t)}var Qe=0,qt=new Set;function Ra(e){Qe++;try{return e()}finally{Qe--,Qe===0&&Pa()}}function La(e){return Qe===0?!1:(qt.add(e),!0)}function Ma(){return Qe>0}function Pa(){try{for(let e of qt)qn(e)}finally{qt.clear()}zn()}var fr=Symbol.for("sibujs.reactive.batch.v1");function Da(){let e=globalThis,n=e[fr];if(n)return n;let t={batch:Ra,enqueueBatchedSignal:La,isBatching:Ma};return e[fr]=t,t}var Wt=Da(),z=Wt.batch,$e=Wt.enqueueBatchedSignal,$a=Wt.isBatching;var Kt=globalThis;function A(e,n){let t={value:e,__v:0,__sc:0,subsHead:null,subsTail:null,__activeNode:null,__name:void 0,_d:!1,_validate:void 0},r=n?.name,o=n?.equals;r&&(t.__name=r);function i(){return Ne(t),t.value}i.__signal=t,r&&(i.__name=r);let s;if(o?s=a=>{let c=t.value,u=typeof a=="function"?a(c):a;if(!o(c,u)){if(t.value=u,t.__v++,!0){let f=Kt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;f&&re(f,"signal:update",{signal:t,name:r,oldValue:c,newValue:u})}$e(t)||Ve(t)}}:s=a=>{let c=t.value,u=typeof a=="function"?a(c):a;if(Object.is(u,c))return;t.value=u,t.__v++;let f=Kt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;f&&re(f,"signal:update",{signal:t,name:r,oldValue:c,newValue:u}),$e(t)||Ve(t)},!0){let a=Kt.__SIBU_DEVTOOLS_GLOBAL_HOOK__;a&&re(a,"signal:create",{signal:t,name:r,getter:i,initial:e})}return[i,s]}function Oa(e){let[n,t]=A(0,e?.name?{name:e.name}:void 0);return{track(){n()},invalidate(){t(r=>r+1)}}}var Ha=`
|
|
6
6
|
.sibu-error-display {
|
|
7
7
|
border: 1px solid var(--sibu-err-border, #e5484d);
|
|
8
8
|
border-radius: 10px;
|
|
@@ -183,11 +183,11 @@
|
|
|
183
183
|
border: 1px solid #3a3a4e;
|
|
184
184
|
}
|
|
185
185
|
.sibu-error-display .sibu-err-btn-reload:hover { background: #2a2b40; }
|
|
186
|
-
`,
|
|
187
|
-
`);for(let r of t){let o=r.trim(),i=o.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);if(i){n.push({fn:i[1]||"(anonymous)",loc:i[2]||i[3]||""});continue}let s=o.match(/^(.+?)@(.+)$/);s&&n.push({fn:s[1]||"(anonymous)",loc:s[2]||""})}return n}function
|
|
186
|
+
`,pr=!1;function Ia(){if(pr||typeof document>"u")return;let e=Le({nodes:Ha});document.head.appendChild(e),pr=!0}function Ba(e){let n=[],t=e.split(`
|
|
187
|
+
`);for(let r of t){let o=r.trim(),i=o.match(/^at\s+(?:(.+?)\s+\((.+)\)|(.+))$/);if(i){n.push({fn:i[1]||"(anonymous)",loc:i[2]||i[3]||""});continue}let s=o.match(/^(.+?)@(.+)$/);s&&n.push({fn:s[1]||"(anonymous)",loc:s[2]||""})}return n}function mr(e){if(e instanceof Error){let n=e.code??e.name??"ERROR",t=e.message||"Unknown error",r=e.stack??"",o=Ba(r),i=e.cause,s=i!=null?mr(i):null;return{code:n,message:t,stack:r,frames:o,cause:s}}return{code:"NON_ERROR",message:typeof e=="string"?e:JSON.stringify(e),stack:"",frames:[],cause:null}}function Va(e,n,t){let r=[];r.push(t),r.push(`[${e.code}] ${e.message}`),e.stack&&(r.push(""),r.push("Stack Trace:"),r.push(e.stack));let o=e.cause;for(;o;){if(r.push(""),r.push("Caused by:"),r.push(` [${o.code}] ${o.message}`),o.stack){let i=o.stack.split(`
|
|
188
188
|
`).map(s=>` ${s}`).join(`
|
|
189
189
|
`);r.push(i)}o=o.cause}if(n&&Object.keys(n).length>0){r.push(""),r.push("Metadata:");for(let[i,s]of Object.entries(n))r.push(` ${i}: ${String(s)}`)}return r.push(""),r.push("Environment:"),r.push(` Timestamp: ${new Date().toISOString()}`),typeof location<"u"&&r.push(` URL: ${location.href}`),typeof navigator<"u"&&navigator.userAgent&&r.push(` User Agent: ${navigator.userAgent}`),r.join(`
|
|
190
|
-
`)}function
|
|
190
|
+
`)}function gr(e){let n=e.map((t,r)=>M({class:"sibu-err-frame",nodes:[F({class:"sibu-err-line",nodes:String(r+1)}),F({class:"sibu-err-fn",nodes:t.fn}),F({class:"sibu-err-loc",nodes:` \u2014 ${t.loc}`})]}));return Ot({class:"sibu-err-stack",nodes:n})}function br(e){return e?[M({class:"sibu-err-cause-label",nodes:"Caused by"}),M({class:"sibu-err-section",nodes:[M({class:"sibu-err-section-head",nodes:[F({nodes:`[${e.code}] ${e.message}`}),F({nodes:""})]}),e.frames.length>0?gr(e.frames):M({class:"sibu-err-stack",nodes:"(no stack)"})]}),...br(e.cause)]:[]}function ja(e){let n=[];for(let[r,o]of Object.entries(e)){n.push(document.createElement("dt")),n[n.length-1].textContent=r;let i=document.createElement("dd");i.textContent=o==null?"(null)":String(o),n.push(i)}let t=document.createElement("dl");t.className="sibu-err-meta";for(let r of n)t.appendChild(r);return t}function Ut(e){Ia();let n=e.severity??"error",t=mr(e.error),r=e.alwaysShowDetails??de(),o=e.title??t.message,i=new Date().toISOString().replace("T"," ").slice(0,19),[s,a]=A("Copy"),c=Ze({class:"sibu-err-copy-btn",nodes:()=>s(),on:{click:()=>{let m=Va(t,e.metadata,o);typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(m).then(()=>{a("Copied!"),setTimeout(()=>a("Copy"),1500)},()=>{a("Copy failed"),setTimeout(()=>a("Copy"),1500)})}}}),u=M({class:"sibu-err-header",nodes:[Ht({class:"sibu-err-icon",nodes:t.code}),$t({class:"sibu-err-title",nodes:o}),c,F({class:"sibu-err-timestamp",nodes:i})]}),f=[Dt({class:"sibu-err-message",nodes:t.message})];r&&t.frames.length>0&&f.push(M({class:"sibu-err-section",nodes:[M({class:"sibu-err-section-head",nodes:[F({nodes:"Stack Trace"})]}),gr(t.frames)]})),r&&f.push(...br(t.cause)),r&&e.metadata&&Object.keys(e.metadata).length>0&&f.push(M({class:"sibu-err-section",nodes:[M({class:"sibu-err-section-head",nodes:[F({nodes:"Metadata"})]}),ja(e.metadata)]}));let h=[];e.onRetry&&h.push(Ze({class:"sibu-err-btn sibu-err-btn-retry",nodes:e.retryLabel??"Retry",on:{click:e.onRetry}})),!e.hideReload&&typeof location<"u"&&h.push(Ze({class:"sibu-err-btn sibu-err-btn-reload",nodes:"Reload Page",on:{click:()=>location.reload()}})),h.length>0&&f.push(M({class:"sibu-err-actions",nodes:h}));let b=M({class:"sibu-err-body",nodes:f});return M({class:"sibu-error-display","data-severity":n,nodes:[u,b]})}var Fa=`
|
|
191
191
|
.sibu-error-boundary {
|
|
192
192
|
position: relative;
|
|
193
193
|
}
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
.sibu-error-fallback .sibu-error-btn-reload:hover {
|
|
342
342
|
background: #3a3a4e;
|
|
343
343
|
}
|
|
344
|
-
`,
|
|
344
|
+
`,za=Symbol("sibujs.ErrorBoundary.resetKeyThrew"),hr=!1;function qa(){if(!hr&&typeof document<"u"){let e=Le({nodes:Fa});document.head.appendChild(e),hr=!0}}function Wa(e,n){let t=typeof e=="function"?e:n,r=typeof e=="function"?{}:e,{fallback:o,onError:i,resetKeys:s}=r;qa();let[a,c]=A(null),u=()=>{h(),c(null)},f=null,h=()=>{if(!f)return;let v=f;f=null,v()},b=v=>{let x=new Array(v.length);for(let E=0;E<v.length;E++)try{x[E]=v[E]()}catch(D){R(D,{phase:"effect",name:"ErrorBoundary.resetKeys"}),x[E]=za}return x},m=()=>{let v=s;if(!v||v.length===0)return;h();let x=null;f=Z(()=>{let E=b(v);if(x===null){x=E;return}let D=E.length!==x.length;if(!D){for(let B=0;B<E.length;B++)if(!Object.is(E[B],x[B])){D=!0;break}}x=E,D&&u()})},l=v=>{let x=Tt(v);if(c(x),m(),i)try{i(x)}catch(E){R(E,{phase:"render",name:"ErrorBoundary onError callback"})}return x},d=(v,x)=>Ut({error:v,severity:"error",onRetry:x}),g=v=>{let x=o||d;try{return x(v,u)}catch(E){return queueMicrotask(()=>{R(E,{phase:"render",name:"ErrorBoundary fallback",node:y.parentNode?y:void 0})}),document.createComment("error-boundary-failed")}},y=M({class:"sibu-error-boundary",nodes:()=>{let v=a();if(v)return g(v);try{let x=t();if(x&&typeof x.then=="function"){let E=M({class:"sibu-error-async"});E.appendChild(F({class:"sibu-lazy-loading",nodes:"Loading..."}));let D=!1;return C(E,()=>{D=!0}),x.then(B=>{if(D){j(B);return}Q(E,B)}).catch(B=>{if(D)return;let W=l(B);Q(E,g(W))}),E}return x}catch(x){let E=l(x);return g(E)}}}),S=v=>{if(a())return;let E=v.detail?.error;E&&(v.preventDefault(),v.stopPropagation(),l(E))};return y.addEventListener("sibu:error-propagate",S),dt(()=>{let v=document.createTreeWalker(y,NodeFilter.SHOW_ELEMENT),x=[],E=v.currentNode;for(;E;){let D=ct(E);D&&x.push(D),E=v.nextNode()}if(x.length===1)l(x[0]);else if(x.length>1){let D=globalThis.AggregateError;l(D?new D(x,`${x.length} pre-mount errors caught by ErrorBoundary`):new Error(x.map(B=>B.message).join("; ")))}},y),C(y,()=>{h(),y.removeEventListener("sibu:error-propagate",S)}),y}var Ka=`
|
|
345
345
|
@keyframes sibu-spin {
|
|
346
346
|
to { transform: rotate(360deg); }
|
|
347
347
|
}
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
.sibu-loading-lg .sibu-loading-spinner { width: 40px; height: 40px; border-width: 4px; }
|
|
395
395
|
.sibu-loading-lg .sibu-loading-dot { width: 12px; height: 12px; }
|
|
396
396
|
.sibu-loading-lg .sibu-loading-dots { gap: 6px; }
|
|
397
|
-
`,ir=!1;function Aa(){!ir&&typeof document<"u"&&(document.head.appendChild(Ee({nodes:_a})),ir=!0)}function Ca(e={}){Aa();let{text:n,variant:t="spinner",size:r="md"}=e,o=r!=="md"?` sibu-loading-${r}`:"";return t==="dots"?R({class:`sibu-loading${o}`,role:"status","aria-live":"polite","aria-label":n?void 0:"Loading",nodes:[R({class:"sibu-loading-dots",nodes:[F({class:"sibu-loading-dot"}),F({class:"sibu-loading-dot"}),F({class:"sibu-loading-dot"})]}),n?F({class:"sibu-loading-text",nodes:n}):null].filter(Boolean)}):R({class:`sibu-loading${o}`,role:"status","aria-live":"polite","aria-label":n?void 0:"Loading",nodes:[R({class:"sibu-loading-spinner"}),n?F({class:"sibu-loading-text",nodes:n}):null].filter(Boolean)})}var jt=Symbol.for("sibujs.actions.v1"),sr=globalThis[jt]??(globalThis[jt]=new Map);function De(e,n){sr.set(e,n)}function ar(e){return sr.get(e)}function La(e,n,t){let r=typeof n=="string"?ar(n):n;if(!r)throw new Error(`[SibuJS] No action registered under the name "${n}". Register it with registerAction() before applying it by name.`);let o=r(e,t);typeof o=="function"&&_(e,o)}var cr=(e,n)=>{let t=r=>{e.contains(r.target)||n()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},lr=(e,n)=>{let t=n.duration??500,r=null,o=()=>{r=setTimeout(()=>{n.callback(),r=null},t)},i=()=>{r!==null&&(clearTimeout(r),r=null)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",i),e.addEventListener("pointerleave",i),()=>{i(),e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",i),e.removeEventListener("pointerleave",i)}},ur=(e,n)=>{let t=()=>{let r=typeof n=="function"?n():e.textContent??"";navigator.clipboard.writeText(r)};return e.addEventListener("click",t),()=>e.removeEventListener("click",t)},dr=e=>{let n=()=>{e.style.overflow="hidden",e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return n(),e.addEventListener("input",n),()=>e.removeEventListener("input",n)},fr=e=>{let n='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',t=r=>{if(r.key!=="Tab")return;let o=Array.from(e.querySelectorAll(n));if(o.length===0)return;let i=o[0],s=o[o.length-1];r.shiftKey&&document.activeElement===i?(r.preventDefault(),s.focus()):!r.shiftKey&&document.activeElement===s&&(r.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)};De("clickOutside",cr);De("longPress",lr);De("copyOnClick",ur);De("autoResize",dr);De("trapFocus",fr);var Ce=null;function Na(e,n){try{let t=e();return t&&typeof t.then=="function"&&t.catch(r=>{n?n(r,"async"):Ce?Ce(r,"async"):console.error("Unhandled async error in Sibu.catchError:",r)}),t}catch(t){return n?n(t,"sync"):Ce?Ce(t,"sync"):console.error("Unhandled error in Sibu.catchError:",t),null}}async function Ra(e,n){try{return await e()}catch(t){return n?n(t,"async"):Ce?Ce(t,"async"):console.error("Unhandled async error in Sibu.catchErrorAsync:",t),null}}function Ma(e){Ce=e}function Pa(e){let[n,t]=C(e),r=i=>{!!0||!oe()||O(`context.${i}() called during SSR. SibuJS context() is application-global \u2014 it is NOT isolated per request, so a concurrent request can observe this value. Do not use context() for request-specific SSR data; pass it explicitly or use request-scoped storage instead.`)};return{provide(i){r("provide");let s=n();return t(i),()=>t(s)},use(){return n},get(){return n()},set(i){r("set"),t(i)},withContext(i,s){r("withContext");let a=n();t(i);try{let c=s();return c!==null&&typeof c?.then=="function"&&O("context.withContext() received an async callback. Scoping is synchronous only \u2014 the previous value is restored as soon as the callback returns its promise, so anything after an `await` runs outside the scope."),c}finally{t(a)}}}}var zt=Symbol.for("sibujs.createId.v1"),qt=globalThis[zt]??(globalThis[zt]={n:0});function Ha(e="sibu"){return qt.n++,`${e}-${qt.n}`}function $a(){qt.n=0}function Da(e,n){let t=typeof n=="function"?n():n;return _(t,J(()=>{t.style.display=e()?"":"none"},t)),t}function pr(e,n,t,r,o){let i=typeof t=="function"?t():t;if(i==null||typeof i=="boolean")return{node:null,owned:!1};let s=i instanceof Node?i:document.createTextNode(String(i)),a=s===t,c=r.has(s),u=!a&&!c;return r.add(s),c&&ee(()=>`${o}: ${a?"a branch was given as an element rather than a function":"a branch factory returned a node it had already returned"}, so the SAME node is being re-attached \u2014 any state it accumulated while detached (input value, scroll position, classes set imperatively) comes back with it. Its reactive bindings are left intact rather than disposed, because the node is not this directive's to tear down. Return a FRESH node per call (\`() => div(\u2026)\`) for rebuild semantics, or keep this form deliberately when the reuse is what you want.`),e.insertBefore(s,n.nextSibling),{node:s,owned:u}}function Oa(e,n,t){let r=document.createComment("when"),o=null,i,s=!1,a=new WeakSet,c=!1,u=()=>{let l=e(),m=r.parentNode;if(!m||s&&l===i)return;i=l;let b=o?Fe([o]):null;o?.parentNode&&(c&&V(o),o.parentNode.removeChild(o),o=null);let p=pr(m,r,l?n:t!==void 0?t:null,a,"when");o=p.node,c=p.owned,Pe(b,o?[o]:[],"when"),s=!0};return _(r,J(u,r)),s||queueMicrotask(()=>{!s&&r.parentNode&&u()}),r}function Ia(e,n,t){let r=document.createComment("match"),o=null,i,s=!1,a=new WeakSet,c=!1,u=()=>{let l=String(e()),m=r.parentNode;if(!m||s&&l===i)return;i=l;let b=o?Fe([o]):null;o?.parentNode&&(c&&V(o),o.parentNode.removeChild(o),o=null);let f=Object.hasOwn(n,l)?n[l]:t,p=pr(m,r,f??null,a,"match");o=p.node,c=p.owned,Pe(b,o?[o]:[],"match"),s=!0};return _(r,J(u,r)),s||queueMicrotask(()=>{!s&&r.parentNode&&u()}),r}var Wt=new Map;function Ba(e,n){Wt.set(e,n)}function Va(e){Wt.delete(e)}function mr(e){let n=Wt.get(e);return n?n():R({nodes:`[Component "${e}" not found]`})}function Fa(e){let n=R({class:"sibu-dynamic"});function t(){let o=e(),i;typeof o=="function"?i=o():i=mr(o),X(n,i)}let r=Q(t);return _(n,r),n}function gr(e){return typeof e=="function"?gr(e()):e instanceof Node?e:document.createTextNode(String(e))}function ja(e,n){if(n===0)return[];let t=[],r=new Array(n);for(let a=0;a<n;a++){let c=e[a],u=0,l=t.length;for(;u<l;){let m=u+l>>1;e[t[m]]<c?u=m+1:l=m}t[u]=a,r[a]=u>0?t[u-1]:-1}let o=t.length,i=new Array(o),s=t[o-1];for(let a=o-1;a>=0;a--)i[a]=s,s=r[s];return i}function za(e,n,t){I(typeof e=="function","each: first argument must be a function that returns an array."),I(typeof n=="function","each: second argument must be a render function."),I(t&&typeof t.key=="function","each: options.key must be a function that returns a unique key per item.");let r=document.createComment("each:anchor"),o=document.createComment("each:end"),i=[],s=[],a=i,c=0,u=new Map,l=new Map,m=[],b=[],f=[],p=0,g=[],h=[],y=new Uint8Array(0),x=new Map,v=[],E=[],L=new Map,B=!1,j=!1,pe=!1,lt=t.key,Ue=()=>{if(pe)return;let w=e(),k=w.length,M=r.parentNode;if(!M)return;j||(M.insertBefore(o,r.nextSibling),j=!0),h.length<k&&(h=new Array(k));for(let T=0;T<k;T++)h[T]=lt(w[T]);let H=h;g.length<k&&(g=new Array(k)),l.clear(),L.clear();for(let T=0;T<k;T++)L.has(H[T])&&O(`each: duplicate key "${String(H[T])}" at index ${T} (first seen at ${L.get(H[T])}). Keys must be unique \u2014 duplicates cause rows to be dropped or mis-ordered.`),L.set(H[T],T);p=0;for(let T=0;T<k;T++){let U=H[T],Zt=u.get(U),Ie;if(Zt!==void 0)Ie=Zt,m[p]=Ie,b[p]=w[T],f[p]=T,p++;else{let[Xt,Cr]=C(w[T]),[Qt,Lr]=C(T),ut;try{ve();try{ut=gr(n(Xt,Qt))}finally{xe()}}catch(Nr){let Rr=H[T];ut=document.createComment(`each:error:${T}`),queueMicrotask(()=>{P(Nr,{phase:"render",name:`each row (key="${String(Rr)}")`,node:r.parentNode?r:void 0})})}Ie={node:ut,item:Xt,setItem:Cr,index:Qt,setIndex:Lr}}l.set(U,Ie),g[T]=Ie.node}for(let[T,U]of u)l.has(T)||(V(U.node),U.node.parentNode&&M.removeChild(U.node));if(k===0){c=0;let T=u;u=l,l=T,B=!0,p=0;return}x.clear();for(let T=0;T<c;T++)x.set(a[T],T);v.length<k&&(v=new Array(k),E=new Array(k));let W=0;for(let T=0;T<k;T++){let U=x.get(H[T]);U!==void 0&&(v[W]=T,E[W]=U,W++)}let Oe=ja(E,W);y.length<k?y=new Uint8Array(k):y.fill(0,0,k);for(let T=0;T<Oe.length;T++)y[v[Oe[T]]]=1;let G=o;for(let T=k-1;T>=0;T--){let U=g[T];y[T]||U.nextSibling!==G&&M.insertBefore(U,G),G=U}let z=a===i?s:i;z.length<k&&(z.length=k);for(let T=0;T<k;T++)z[T]=H[T];a=z,c=k;let Z=u;u=l,l=Z,B=!0,A()};function A(){if(p===0)return;let w=p;p=0,q(()=>{for(let k=0;k<w;k++){let M=m[k];M.setItem(b[k]),M.setIndex(f[k]),m[k]=void 0,b[k]=void 0}})}let S=Q(Ue);return _(r,()=>{if(!pe){pe=!0,S();for(let w of u.values())V(w.node),w.node.parentNode?.removeChild(w.node);o.parentNode&&o.parentNode.removeChild(o),j=!1,u.clear(),l.clear(),L.clear(),x.clear(),c=0,m.length=0,b.length=0,f.length=0,p=0}}),B||queueMicrotask(()=>{!B&&!pe&&r.parentNode&&Ue()}),r}function qa(e){let n=document.createDocumentFragment();for(let t of e)if(!(t==null||typeof t=="boolean"))if(Array.isArray(t))for(let r of t)r==null||typeof r=="boolean"||n.appendChild(br(r));else n.appendChild(br(t));return n}function br(e){if(e==null)return document.createTextNode("");if(e instanceof Node)return e;if(typeof e=="function"){let n=e();return n instanceof Node?n:document.createTextNode(String(n??""))}return document.createTextNode(String(e))}var Wa=new Set(["script","style"]),Ka=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hr=new Set(["svg","circle","ellipse","g","line","path","polygon","polyline","rect","text","tspan","defs","clipPath","mask","pattern","linearGradient","radialGradient","stop","use","symbol","marker"]),yr=new WeakMap;function Ua(e){let n=e.length-1,t=e[0];for(let f=0;f<n;f++)t+=`\0${f}\0${e[f+1]}`;let r=0,o=t.length;function i(){for(;r<o&&(t[r]===" "||t[r]===" "||t[r]===`
|
|
398
|
-
`||t[r]==="\r");)r++}function s(){if(t.charCodeAt(r)!==0)return-1;let f=r;r++;let p=0;for(;r<o&&t.charCodeAt(r)!==0;)p=p*10+(t.charCodeAt(r)-48),r++;return r<o&&r++,p<0||p>=n?(r=f,-1):p}function a(){let f=r;for(;r<o;){let p=t.charCodeAt(r);if(p>=97&&p<=122||p>=65&&p<=90||p>=48&&p<=57||p===45)r++;else break}return t.slice(f,r)}function c(){if(i(),t[r]!=="=")return{kind:"bool"};r++,i();let f=s();if(f>=0)return{kind:"expr",idx:f};let p=t[r];if(p==='"'||p==="'"){r++;let g=[],h=[],y="";for(;r<o&&t[r]!==p;){let x=s();x>=0?(g.push(y),y="",h.push(x)):y+=t[r++]}return r<o&&r++,g.push(y),h.length===0?{kind:"static",value:g[0]}:{kind:"mixed",statics:g,exprs:h}}{let g=[],h=[],y="";for(;r<o;){let x=t.charCodeAt(r);if(x===32||x===9||x===10||x===13||x===62)break;let v=s();v>=0?(g.push(y),y="",h.push(v)):y+=t[r++]}return g.push(y),h.length===0?{kind:"static",value:g[0]}:{kind:"mixed",statics:g,exprs:h}}}function u(){let f=[];for(;r<o&&(i(),!(t[r]===">"||t[r]==="/"));){let p=r;for(;r<o;){let y=t.charCodeAt(r);if(y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===45||y===58||y===95||y===46)r++;else break}let g=t.slice(p,r);if(!g)break;let h=c();g.startsWith("on:")?h.kind==="expr"&&f.push({t:3,name:g.slice(3),idx:h.idx}):h.kind==="bool"?f.push({t:4,name:g}):h.kind==="static"?f.push({t:0,name:g,value:h.value}):h.kind==="expr"?f.push({t:1,name:g,idx:h.idx}):h.kind==="mixed"&&f.push({t:2,name:g,statics:h.statics,exprs:h.exprs})}return f}function l(f){return f.replace(/\s+/g," ")}function m(f){let p="";for(;r<o&&t[r]!=="<";){let h=s();if(h>=0){let y=l(p);y&&f.push({t:1,value:y}),p="",f.push({t:2,idx:h})}else p+=t[r++]}let g=l(p);g&&f.push({t:1,value:g})}function b(){let f=[];for(;r<o&&!(t[r]==="<"&&r+1<o&&t[r+1]==="/");)if(t[r]==="<"){let p=t[r+1];if(p==="!"){if(t.startsWith("<!--",r)){let v=t.indexOf("-->",r+4);r=v===-1?o:v+3}else if(t.startsWith("<![CDATA[",r)){let v=t.indexOf("]]>",r+9);r=v===-1?o:v+3}else{let v=t.indexOf(">",r);r=v===-1?o:v+1}continue}if(p==="?"){let v=t.indexOf(">",r);r=v===-1?o:v+1;continue}if(!(p>="a"&&p<="z")&&!(p>="A"&&p<="Z")){f.push({t:1,value:"<"}),r++;continue}r++;let g=a(),h=u();i();let y=Ka.has(g),x=t[r]==="/";if(x&&r++,r<o&&r++,y||x)f.push({t:0,el:{tag:g,svg:hr.has(g),attrs:h,children:[]}});else{let v=b();if(Wa.has(g.toLowerCase())){for(let E=0;E<v.length;E++)if(v[E].t===2)throw new Error(`html: dynamic \${...} expressions are not allowed inside <${g}> (raw-text context). Build the content separately and append it as a Node.`)}t[r]==="<"&&r+1<o&&t[r+1]==="/"&&(r+=2,a(),i(),r<o&&t[r]===">"&&r++),f.push({t:0,el:{tag:g,svg:hr.has(g),attrs:h,children:v}})}}else m(f);return f}return b()}function Kt(e,n){let t=e.svg?document.createElementNS(D,e.tag):document.createElement(e.tag);for(let r=0;r<e.attrs.length;r++){let o=e.attrs[r];switch(o.t){case 0:t.setAttribute(o.name,o.value);break;case 1:{let i=o.name,s=n[o.idx];typeof s=="function"?_(t,tt(t,i,s)):te(t,i,s,{syncValueProperty:!1,label:"html"});break}case 2:{let i=o.statics[0];for(let s=0;s<o.exprs.length;s++){let a=n[o.exprs[s]];i+=(a==null?"":String(a))+o.statics[s+1]}te(t,o.name,i,{syncValueProperty:!1,label:"html"});break}case 3:{let i=n[o.idx];typeof i=="function"?t.addEventListener(o.name,i):O(`html: on:${o.name} handler is not a function (got ${typeof i}). Event listener was not attached.`);break}case 4:t.setAttribute(o.name,"");break}}for(let r=0;r<e.children.length;r++){let o=e.children[r];switch(o.t){case 0:t.appendChild(Kt(o.el,n));break;case 1:t.appendChild(document.createTextNode(o.value));break;case 2:{let i=n[o.idx];if(typeof i=="function"){let s=document.createComment("");t.appendChild(s),_(t,Te(s,i))}else if(i instanceof Node)t.appendChild(i);else if(Array.isArray(i))for(let s=0;s<i.length;s++){let a=i[s];a instanceof Node?t.appendChild(a):a!=null&&typeof a!="boolean"&&t.appendChild(document.createTextNode(String(a)))}else i!=null&&typeof i!="boolean"&&t.appendChild(document.createTextNode(String(i)));break}}}return t}function vr(e,...n){let t=yr.get(e);if(t||(t=Ua(e),yr.set(e,t)),t.length===1&&t[0].t===0)return Kt(t[0].el,n);let r=document.createElement("div");for(let o=0;o<t.length;o++){let i=t[o];switch(i.t){case 0:r.appendChild(Kt(i.el,n));break;case 1:r.appendChild(document.createTextNode(i.value));break;case 2:{let s=n[i.idx];if(s instanceof Node)r.appendChild(s);else if(typeof s=="function"){let a=document.createComment("bind:htm");r.appendChild(a),_(r,Te(a,s))}else if(Array.isArray(s))for(let a=0;a<s.length;a++){let c=s[a];c instanceof Node?r.appendChild(c):c!=null&&typeof c!="boolean"&&r.appendChild(document.createTextNode(String(c)))}else s!=null&&typeof s!="boolean"&&r.appendChild(document.createTextNode(String(s)));break}}}return r.childNodes.length===1&&r.firstChild instanceof Element?r.firstChild:r}function Ja(e,n,t){let r=document.createComment("keep-alive"),o=new Map,i=[],s=t?.max??10;s===0&&ie()&&O("KeepAlive: unbounded cache (max: 0). Cached subtrees will never be evicted \u2014 set `max` to bound memory.");let a,c=null,u=!1,l=!1,m=()=>{if(l)return;let f=e(),p=r.parentNode;if(!p||u&&f===a)return;c?.parentNode&&p.removeChild(c),a=f;let g=o.get(f);if(g){let h=i.indexOf(f);h!==-1&&(i.splice(h,1),i.push(f))}else{let h=n[f];if(!h){c=null,u=!0;return}if(g=h(),g instanceof DocumentFragment){let y=document.createElement("div");y.style.display="contents",y.appendChild(g),g=y}if(o.set(f,g),i.push(f),s>0&&i.length>s){let y=i.shift(),x=o.get(y);x&&(V(x),x.parentNode&&x.parentNode.removeChild(x),o.delete(y))}}p.insertBefore(g,r.nextSibling),c=g,u=!0},b=Q(m);return u||queueMicrotask(()=>{!u&&r.parentNode&&m()}),_(r,()=>{l=!0,b();for(let f of o.values())V(f),f.parentNode&&f.parentNode.removeChild(f);o.clear(),i.length=0,c=null}),r}function Ga(e,n){if(!n)throw new Error("[SibuJS mount] container element not found. Make sure the DOM element exists before calling mount().");I(typeof e=="function"||e instanceof Node,"mount: first argument must be a component function or a DOM Node.");let t=typeof performance<"u"?performance.now():0,r=typeof e=="function"?e():e,o=typeof performance<"u"?performance.now()-t:0;n.appendChild(r);let i=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;return i&&i.emit("app:init",{rootElement:r,container:n,duration:o}),{node:r,unmount(){i&&i.emit("app:unmount",{rootElement:r}),V(r),r.parentNode&&r.parentNode.removeChild(r)}}}function Ya(e,n){let t=document.createComment("portal"),r=n||document.body,o=null,i=!1;return queueMicrotask(()=>{if(!i)try{o=e(),r.appendChild(o)}catch(s){queueMicrotask(()=>{P(s,{phase:"render",name:"Portal",node:t.parentNode?t:void 0})})}}),_(t,()=>{i=!0,o&&(V(o),o.remove(),o=null)}),t}function Za(e,n="default"){return e?.[n]}function Xa(e=[]){let[n,t]=C([...e]);return[n,{push(...o){t(i=>[...i,...o])},pop(){let o;return t(i=>{let s=[...i];return o=s.pop(),s}),o},shift(){let o;return t(i=>{let s=[...i];return o=s.shift(),s}),o},unshift(...o){t(i=>[...o,...i])},splice(o,i=0,...s){let a=[];return t(c=>{let u=[...c];return a=u.splice(o,i,...s),u}),a},remove(o){t(i=>i.filter((s,a)=>a!==o))},removeWhere(o){t(i=>{let s=i.findIndex(o);return s===-1?i:i.filter((a,c)=>c!==s)})},set(o){t([...o])},update(o,i){t(s=>s.map((a,c)=>c===o?i:a))},updateWhere(o,i){t(s=>s.map(a=>o(a)?i(a):a))},sort(o){t(i=>[...i].sort(o))},reverse(){t(o=>[...o].reverse())},filter(o){t(i=>i.filter(o))},map(o){t(i=>i.map(o))},clear(){t([])}}]}function Qa(e=[]){let n=[...e],t=null,r={__v:0};function o(){t=null,r.__v++,Ae(r)||Me(r)}function i(){if(Se(r),t===null){let a=n.slice();t=Object.freeze(a)}return t}return[i,{push(...a){a.length!==0&&(n.push(...a),o())},pop(){if(n.length===0)return;let a=n.pop();return o(),a},shift(){if(n.length===0)return;let a=n.shift();return o(),a},unshift(...a){a.length!==0&&(n.unshift(...a),o())},splice(a,c=0,...u){let l=n.splice(a,c,...u);return(l.length>0||u.length>0)&&o(),l},remove(a){a<0||a>=n.length||(n.splice(a,1),o())},removeWhere(a){let c=n.findIndex(a);c!==-1&&(n.splice(c,1),o())},set(a){n=[...a],o()},update(a,c){a<0||a>=n.length||Object.is(n[a],c)||(n[a]=c,o())},updateWhere(a,c){let u=!1;for(let l=0;l<n.length;l++)if(a(n[l])){let m=c(n[l]);Object.is(n[l],m)||(n[l]=m,u=!0)}u&&o()},sort(a){n.length<=1||(n.sort(a),o())},reverse(){n.length<=1||(n.reverse(),o())},filter(a){let c=n.filter(a);c.length!==n.length&&(n=c,o())},map(a){let c=!1;for(let u=0;u<n.length;u++){let l=a(n[u],u);Object.is(n[u],l)||(n[u]=l,c=!0)}c&&o()},clear(){n.length!==0&&(n=[],o())}}]}function ec(e,n){let[t,r]=C(n),[o,i]=C(!1),[s,a]=C(null),[c,u]=C(0),l=0,m=!1,b=null,f=()=>{if(b===null)return;let g=b;b=null;try{g.abort()}catch{}},p=Y(()=>{if(c(),m)return;f();let g=++l,h=typeof AbortController<"u"?new AbortController:null;b=h,q(()=>{i(!0),a(null)});let y=()=>m||g!==l,x;try{x=e({signal:h?h.signal:void 0})}catch(v){if(y())return;q(()=>{a(v),i(!1)});return}x.then(v=>{y()||(b=null,q(()=>{r(v),i(!1)}))},v=>{y()||(b=null,q(()=>{a(v),i(!1)}))})});return{value:t,loading:o,error:s,refresh:()=>{m||u(g=>g+1)},dispose:()=>{m||(m=!0,p(),f())}}}function We(e,n,t){if(Object.is(e,n))return!0;if(e==null||n==null||typeof e!=typeof n||typeof e!="object")return!1;let r=e,o=n;if(r.constructor!==o.constructor)return!1;if(e instanceof Date)return e.getTime()===n.getTime();if(e instanceof RegExp){let c=n;return e.source===c.source&&e.flags===c.flags}t||(t=new Map);let i=t.get(r);if(i?.has(o))return!0;if(i||(i=new Set,t.set(r,i)),i.add(o),e instanceof Map){let c=n;if(e.size!==c.size)return!1;for(let[u,l]of e)if(!c.has(u)||!We(l,c.get(u),t))return!1;return!0}if(e instanceof Set){let c=n;if(e.size!==c.size)return!1;for(let u of e)if(!c.has(u))return!1;return!0}if(e instanceof ArrayBuffer){let c=new Uint8Array(e),u=new Uint8Array(n);if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++)if(c[l]!==u[l])return!1;return!0}if(e instanceof DataView){if(!(n instanceof DataView)||e.byteLength!==n.byteLength)return!1;for(let c=0;c<e.byteLength;c++)if(e.getUint8(c)!==n.getUint8(c))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){let c=e,u=n;if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++)if(c[l]!==u[l])return!1;return!0}if(Array.isArray(e))return!Array.isArray(n)||e.length!==n.length?!1:e.every((c,u)=>We(c,n[u],t));let s=Object.keys(r),a=Object.keys(o);return s.length!==a.length?!1:s.every(c=>Object.hasOwn(o,c)&&We(r[c],o[c],t))}function tc(e){return C(e,{equals:(n,t)=>We(n,t)})}function Le(e,n){I(typeof e=="function","derived: argument must be a getter function.");let t=n?.name,r=n?.equals,o={};o._d=!1,o._init=!1,o._f=!1,o._g=e,o.__v=0;let i=!1,s=!1,a,c=()=>{o._d||s||(o._d=!0)};c._c=1,c._sig=o;let u=()=>{let p=e();o._v=r&&o._init&&r(o._v,p)?o._v:p,o._d=!1,o._init=!0};Q(()=>{let p=!0;try{o._v=e(),o._d=!1,o._init=!0,p=!1}finally{p&&(o._d=!0)}},c);let l=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__,m=()=>{if(!o._d||s||a!==void 0)return;let p=o._v;i=!0;try{be(u,c),Object.is(p,o._v)||o.__v++}catch(g){a={error:g},o.__v++,s?o._d=!0:o._f=!0}finally{i=!1,s&&Ve(c)}l&&!s&&!Object.is(p,o._v)&&l.emit("computed:update",{signal:o,oldValue:p,newValue:o._v})};o._validate=m;let b=()=>{let{error:p}=a;throw a=void 0,s&&(o._d=!1),p};function f(){if(i)throw new Error(`[SibuJS] Circular dependency detected in derived${t?` "${t}"`:""}. A derived signal cannot read itself (directly or through a chain).`);return Rn()||s?(o._d&&(m(),a!==void 0&&b()),o._v):(o._d&&(m(),a!==void 0&&(Se(o),b())),Se(o),o._v)}return t&&(f.__name=t,o.__name=t),f.__signal=o,f.dispose=()=>{if(s)return;s=!0,o._d=a!==void 0,Ve(c);let p=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;if(p)try{p.emit("computed:destroy",{signal:o,getter:f})}catch{}},l&&l.emit("computed:create",{signal:o,name:t,getter:f}),f}function nc(e){let[n,t]=C(e);return{get current(){return n()},set current(r){t(r)}}}function rc(e){I(e!==null&&typeof e=="object"&&!Array.isArray(e),"store: argument must be a plain object. For arrays, use array() instead.");let n={};Object.keys(e).forEach(c=>{let[u,l]=C(e[c]);n[c]=[u,l]});let t=new Proxy({},{get(c,u){if(typeof u=="string"&&Object.hasOwn(n,u)){let l=n[u][0];return l()}return Reflect.get(c,u)},set(){throw new Error("[SibuJS store] Direct mutation is not allowed. Use actions.setState() to update store properties.")}}),r=()=>{let c={};return Object.keys(n).forEach(u=>{c[u]=n[u][0]()}),c};return[t,{setState:c=>{let u=r(),l=typeof c=="function"?c(u):c;q(()=>{Object.entries(l).forEach(([m,b])=>{Object.hasOwn(n,m)&&n[m][1](b)})})},reset:()=>{q(()=>{Object.keys(e).forEach(c=>{let u=n[c][1];u(e[c])})})},subscribe:c=>{let u=!0;return Y(()=>{let l=r();if(u){u=!1;return}ve();try{c(l)}finally{xe()}})},subscribeKey:(c,u)=>{let l,m=!0;return Y(()=>{let b=n[c][0]();if(m){l=b,m=!1;return}if(!Object.is(b,l)){let f=l;l=b,ve();try{u(b,f)}finally{xe()}}})},getSnapshot:r}]}function oc(e,n){if(I(typeof e=="function","watch: first argument must be a getter function."),I(typeof n=="function","watch: second argument must be a callback function."),oe())return()=>{};let t,r=!0;return Q(()=>{let s=e();if(r){t=s,r=!1;return}if(!Object.is(s,t)){let a=t;t=s,ve();try{n(s,a)}finally{xe()}}})}function ic(e,n,t){return[Le(e,t),i=>{q(()=>n(i))}]}function sc(e){let n=e();return ie()&&queueMicrotask(()=>{try{e()}catch(t){console.warn("[SibuJS strict] second run threw:",t)}}),n}function ac(e){if(!ie())return Y(e);let n=Y(e),t=null;return queueMicrotask(()=>{try{t=Y(e)}catch(r){console.warn("[SibuJS strictEffect] second run threw:",r)}}),()=>{n(),t&&t()}}var Ut="data-sibu-enhanced",Jt=new WeakMap;function xr(e,n){let t=0;for(;e.length>0;){let r=e.splice(0);for(let o=0;o<r.length;o++){if(t>=Je){let i=r.length-o+e.length;e.length=0,Ge(n,t,i);return}t++;try{r[o]()}catch(i){typeof console<"u"&&console.error(`[SibuJS ${n}] teardown error:`,i)}}}}var Sr=["text","attr","class","show","on","cleanup"];function Tr(e,n){if(n==null)return e;if(typeof n!="string")return n;let t=n.startsWith("@")?`[data-ref="${n.slice(1)}"]`:n;try{return e.querySelector(t)}catch{return null}}function Ke(e,n){return oe()?()=>{}:J(n,e)}function cc(e){if(e instanceof HTMLInputElement){if(e.type==="checkbox")return e.checked;if(e.type==="number"||e.type==="range")return e.value===""?null:Number(e.value)}return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions,n=>n.value):e.value}function lc(e,n){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked=!!n;return}if(e instanceof HTMLSelectElement&&e.multiple){let r=Array.isArray(n)?n.map(String):[];for(let o of Array.from(e.options))o.selected=r.includes(o.value);return}let t=n==null?"":String(n);e.value!==t&&(e.value=t)}function uc(e,n,t,r){let o=`ctx.each[${r}]`;if(ie())for(let i of Object.keys(t))I(Sr.includes(i),`${o}: unknown binding "${i}". Expected one of: ${Sr.join(", ")}.`);if(t.text!==void 0&&(I(typeof t.text=="function",`${o}: "text" must be a function returning the value.`),e.text(n,t.text)),t.attr!==void 0)for(let i of Object.keys(t.attr)){let s=t.attr[i];I(typeof s=="function",`${o}: attr["${i}"] must be a function returning the value.`),e.attr(n,i,s)}if(t.class!==void 0)for(let i of Object.keys(t.class)){let s=t.class[i];I(typeof s=="function",`${o}: class["${i}"] must be a function returning a boolean.`),e.classed(n,i,s)}if(t.show!==void 0&&(I(typeof t.show=="function",`${o}: "show" must be a function returning a boolean.`),e.show(n,t.show)),t.on!==void 0)for(let i of Object.keys(t.on)){let s=t.on[i];I(typeof s=="function",`${o}: on["${String(i)}"] must be a function.`),e.on(n,i,s)}t.cleanup!==void 0&&(I(typeof t.cleanup=="function",`${o}: "cleanup" must be a function.`),e.cleanup(t.cleanup))}function it(e,n){let t=typeof e=="string"?typeof document<"u"?document.querySelector(e):null:e;if(!t)return typeof console<"u"&&console.warn(`[SibuJS enhance] no element matched ${JSON.stringify(e)} \u2014 nothing enhanced.`),()=>{};if(t.getAttribute(Ut)==="true")return ie()&&typeof console<"u"&&console.warn("[SibuJS enhance] element is already enhanced; ignoring re-enhance.",t),()=>{};let r=[],o=Symbol("sibujs.enhance"),i=!1,s=!1,a=b=>s?(ee(()=>`enhance: ctx.${b}() was called after this enhancement was rolled back or disposed, so it was ignored. The setup is still running past the point where its transaction ended \u2014 usually an async setup continuing after an await, or a callback it queued before it threw. Registrations made now would belong to nothing: the root carries no enhancement marker and the disposer has already run, so nothing could ever release them.`),!0):!1,c=(b,f,p)=>{if(a(b))return;let g=Tr(t,f);if(!g){typeof console<"u"&&console.warn(`[SibuJS enhance] target ${JSON.stringify(f)} not found under`,t);return}p(g)},u={root:t,ref:b=>Tr(t,b),refs:b=>{let f=b.startsWith("@")?`[data-ref="${b.slice(1)}"]`:b;try{return Array.from(t.querySelectorAll(f))}catch{return[]}},on:(b,f,p,g)=>{c("on",b,h=>{let y=x=>p(x,h);h.addEventListener(f,y,g),r.push(()=>h.removeEventListener(f,y,g))})},text:(b,f)=>{c("text",b,p=>{r.push(Ke(p,()=>{let g=f(),h=g==null?"":String(g);p.textContent!==h&&(p.textContent=h)}))})},attr:(b,f,p)=>{c("attr",b,g=>{r.push(Ke(g,()=>{let h=p(),y=h==null?null:String(h);te(g,f,y,{syncValueProperty:!1,label:"enhance attr()"})}))})},classed:(b,f,p)=>{c("classed",b,g=>{r.push(Ke(g,()=>{g.classList.toggle(f,!!p())}))})},show:(b,f)=>{c("show",b,p=>{let g=p.hidden;r.push(Ke(p,()=>{p.hidden=!f()})),r.push(()=>{p.hidden=g})})},model:(b,f,p)=>{c("model",b,g=>{let h=g,[y,x]=f,v=p?.event??(h instanceof HTMLSelectElement||h instanceof HTMLInputElement&&(h.type==="checkbox"||h.type==="radio")?"change":"input");r.push(Ke(g,()=>{lc(h,y())}));let E=()=>x(cc(h));h.addEventListener(v,E),r.push(()=>h.removeEventListener(v,E))})},each:(b,f)=>{if(a("each"))return;I(typeof f=="function","ctx.each: second argument must be a function.");let p=typeof b=="string"?u.refs(b):Array.from(b);for(let g=0;g<p.length;g++){let h=p[g],y=f(h,g);y!=null&&uc(u,h,y,g)}},cleanup:b=>{a("cleanup")||r.push(b)}},l;try{l=n(u);let b=l;if(b&&typeof b.then=="function")throw b.then(void 0,f=>{ee(()=>`enhance: the promise returned by the setup also rejected: ${String(f)}`)}),new Error("[SibuJS enhance] the setup returned a promise, so its work did not complete inside the enhancement transaction. If it is a lazy import, register it as lazyIsland(() => import(\u2026)): an unwrapped loader is called as a setup, so its module is fetched but the setup it resolves to is discarded. If it is an async setup, make it synchronous \u2014 this enhancement has been rolled back, and ctx registrations made after this point are ignored.")}catch(b){throw xr(r,"enhance"),s=!0,b}typeof l=="function"&&r.push(l);let m=()=>{i||(i=!0,Jt.get(t)===o&&(Jt.delete(t),t.removeAttribute(Ut)),mt(t,m),xr(r,"enhance"),s=!0)};return _(t,m),Jt.set(t,o),t.setAttribute(Ut,"true"),m}function dc(e,n){if(typeof document>"u")return()=>{};let t=[];try{for(let r of Array.from(document.querySelectorAll(e)))t.push(it(r,n))}catch(r){for(let o=t.length-1;o>=0;o--)try{t[o]()}catch(i){typeof console<"u"&&console.error("[SibuJS enhanceAll] rollback error:",i)}throw t.length=0,r}return()=>{for(let r of t.splice(0))r()}}function Er(e,n){let t=globalThis;return t[e]??(t[e]=n())}var fc=/^[A-Za-z0-9_-]+$/,wr=Symbol.for("sibujs.islands.lazy"),st=Er(Symbol.for("sibujs.islands.registry.v1"),()=>new Map);function pc(e){return e[wr]=!0,e}function mc(e,n){if(!fc.test(e))throw new Error(`[SibuJS islands] name must match [A-Za-z0-9_-]+ (got: ${JSON.stringify(e.slice(0,32))})`);st.set(e,n)}function gc(e){st.delete(e)}async function bc(e){if(typeof e=="function"&&e[wr]){let n=await e(),t=n.default??n;return typeof t=="function"?t:null}return e}function hc(e=typeof document<"u"?document:null,n={}){if(!e||typeof e.querySelectorAll!="function")return()=>{};let t=[],r=[],o=!1;for(let i of Array.from(e.querySelectorAll("[data-sibu-island]"))){if(i.getAttribute("data-sibu-enhanced")==="true")continue;let s=i.getAttribute("data-sibu-island")??"";if(!st.has(s)){typeof console<"u"&&console.warn(`[SibuJS islands] no island registered for "${s}" \u2014 skipping. Call registerIsland("${s}", ...).`);continue}let a=!1,c=()=>{if(a||o)return;a=!0;let l=st.get(s);l&&bc(l).then(m=>{if(!o){if(!m){typeof console<"u"&&console.warn(`[SibuJS islands] "${s}" loader produced no setup.`);return}try{let b=it(i,m);if(o){b();return}r.push(b),i.setAttribute("data-sibu-hydrated","true")}catch(b){typeof console<"u"&&console.error(`[SibuJS islands] "${s}" failed to mount:`,b)}}}).catch(m=>{typeof console<"u"&&console.error(`[SibuJS islands] "${s}" failed to load:`,m)})},u=i.getAttribute("data-sibu-load")||"load";t.push(yc(u,i,c,n))}return()=>{o=!0;for(let i of t.splice(0))i();for(let i of r.splice(0))i()}}function yc(e,n,t,r){switch(e){case"idle":{if(typeof requestIdleCallback<"u"){let i=requestIdleCallback(t);return()=>cancelIdleCallback(i)}let o=setTimeout(t,1);return()=>clearTimeout(o)}case"visible":{if(typeof IntersectionObserver>"u")return queueMicrotask(t),()=>{};let o=new IntersectionObserver(i=>{for(let s of i)s.isIntersecting&&(o.disconnect(),t())},{rootMargin:r.rootMargin,threshold:r.threshold});return o.observe(n),()=>o.disconnect()}case"interaction":{let o=["pointerdown","focusin","keydown","touchstart"],i=()=>{s(),t()},s=()=>{for(let a of o)n.removeEventListener(a,i)};for(let a of o)n.addEventListener(a,i,{passive:!0});return s}case"media":{let o=n.getAttribute("data-sibu-media")||"(min-width: 0px)";if(typeof matchMedia>"u")return queueMicrotask(t),()=>{};let i=matchMedia(o);if(i.matches)return queueMicrotask(t),()=>{};let s=()=>{i.matches&&(i.removeEventListener("change",s),t())};return i.addEventListener("change",s),()=>i.removeEventListener("change",s)}default:return queueMicrotask(t),()=>{}}}function kr(e){return e}var qd=1024*1024;function vc(e){let[n,t]=C(e()),r=!1,o=!1,i=n(),s=()=>{r=!1,!o&&t(i)},a=()=>{r||(r=!0,queueMicrotask(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(s):s()}))},c=Q(()=>{i=e(),a()}),u=(()=>n());return u.dispose=()=>{o||(o=!0,c())},u}var _r=16;function xc(e){let n=globalThis;if(typeof n.requestIdleCallback=="function"){n.requestIdleCallback(e,{timeout:_r*4});return}if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>e());return}setTimeout(e,_r)}function Sc(){let[e,n]=C(!1);function t(r){n(!0),xc(()=>{let o;try{o=r()}catch{n(!1);return}o&&typeof o.then=="function"?o.then(()=>n(!1),()=>n(!1)):n(!1)})}return{pending:e,start:t}}function Tc(){return new Promise(e=>{queueMicrotask(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):e()})})}var ct={};en(ct,{RenderProp:()=>Hc,assertType:()=>jc,compose:()=>Pc,createGuard:()=>zc,createSlots:()=>Dc,defineComponent:()=>Oc,defineSlottedComponent:()=>Ic,defineStrictComponent:()=>Fc,globalStore:()=>Nc,machine:()=>wc,optimistic:()=>_c,optimisticList:()=>Ac,persisted:()=>kc,timeline:()=>Cc,validateProps:()=>Ar,validators:()=>Vc,withBoundary:()=>$c,withDefaults:()=>Mc,withProps:()=>Bc,withWrapper:()=>Rc});var Ec=new Set(["__proto__","constructor","prototype"]);function Yt(e){return Ec.has(e)}function at(e){let n={};for(let t of Object.keys(e))Yt(t)||(n[t]=e[t]);return n}function wc(e){let[n,t]=C(e.initial),[r,o]=C(e.context||{}),i=e.states[e.initial];i?.entry&&i.entry(r());function s(u){let l=n(),m=e.states[l];if(!m?.on)return;let b=m.on[u];if(!b)return;let f,p,g;typeof b=="string"?f=b:(f=b.target,p=b.guard,g=b.action);let h=r();if(p&&!p(h))return;if(m.exit&&m.exit(h),g){let x=g(h),v={...h,...at(x)};o(v)}t(f);let y=e.states[f];y?.entry&&y.entry(r())}function a(u){return n()===u}function c(u){let l=n(),m=e.states[l];if(!m?.on)return!1;let b=m.on[u];return b?typeof b=="string"?!0:b.guard?b.guard(r()):!0:!1}return{state:n,context:r,send:s,matches:a,can:c}}function kc(e,n,t={}){let r=(()=>{try{return t.session?typeof sessionStorage<"u"?sessionStorage:null:typeof localStorage<"u"?localStorage:null}catch{return null}})(),o=t.serialize||JSON.stringify,i=(y,x)=>Yt(y)?void 0:x,s=t.deserialize||(y=>JSON.parse(y,i)),a=t.encrypt,c=t.decrypt,u=t.session?!1:t.syncTabs??!0,l=n;try{let y=r?r.getItem(e):null;if(y!==null){c&&(y=c(y));let x=s(y);l=t.validate&&!t.validate(x)?n:x}}catch{}let[m,b]=C(l),f=!1,p=Y(()=>{let y=m();if(!f)try{let x=o(y);a&&(x=a(x)),r?.setItem(e,x)}catch{}}),g=null;return u&&r&&typeof window<"u"&&(g=y=>{if(!(y.storageArea!==r||y.key!==e)){if(y.newValue===null){f=!0;try{b(n)}finally{f=!1}return}try{let x=y.newValue;c&&(x=c(x));let v=s(x);if(t.validate&&!t.validate(v))return;f=!0;try{b(v)}finally{f=!1}}catch{}}},window.addEventListener("storage",g)),Object.defineProperty(b,"dispose",{value:()=>{p(),g&&typeof window<"u"&&(window.removeEventListener("storage",g),g=null)},enumerable:!1,writable:!1,configurable:!1}),[m,b]}function _c(e){let[n,t]=C(e),[r,o]=C(!1),i=0,s=0;async function a(c,u){let l=++s,m=n();t(c),i++,o(!0);try{let b=await u();s===l&&t(b)}catch{s===l&&t(m)}finally{i--,i<=0&&(i=0,o(!1))}}return{value:n,pending:r,update:a}}function Ac(e){let n=0,t=0,r=0,o=new Map,i=[];for(let A of e){let S={id:n++,key:t++,base:A,claims:[],visible:!0,refs:0};o.set(S.id,S),i.push(S.id)}function s(A){let S=A.claims;return S.length>0?S[S.length-1].value:A.base}function a(A,S){let N=A.claims;for(let w=N.length-1;w>=0;w--)if(N[w].opId<S)return N[w].value;return A.base}function c(A,S,N){let w={opId:S,value:N,settled:!1},k=A.claims,M=k.length;for(;M>0&&k[M-1].opId>S;)M--;return k.splice(M,0,w),w}function u(A,S){let N=A.claims.indexOf(S);N!==-1&&A.claims.splice(N,1)}function l(A){let S=A.claims,N=0;for(;N<S.length&&S[N].settled;)A.base=S[N].value,N++;N>0&&S.splice(0,N)}let[m,b]=C(i.map(A=>s(o.get(A)))),[f,p]=C(!1),g=0,h=new Set;function y(){let A=new Array(i.length);for(let S=0;S<i.length;S++)A[S]=s(o.get(i[S]));return A}function x(A){q(()=>{let S=!1;try{S=A()}finally{p(g>0),S&&b(y())}})}function v(A){let S=o.get(A);return!S||!S.visible?!1:(S.visible=!1,i=i.filter(N=>N!==A),!0)}function E(A){let S=[];for(let H of A){let W=o.get(H);!W||W.visible||h.has(H)||S.push(H)}if(S.length===0)return!1;let N=new Array(i.length+S.length),w=0,k=0,M=0;for(;w<i.length&&k<S.length;){let H=o.get(i[w]).key,W=o.get(S[k]).key;N[M++]=H<=W?i[w++]:S[k++]}for(;w<i.length;)N[M++]=i[w++];for(;k<S.length;)N[M++]=S[k++];for(let H of S)o.get(H).visible=!0;return i=N,!0}function L(A){for(let S of A){let N=o.get(S);N&&N.refs++}}function B(A){for(let S of A){let N=o.get(S);N&&(N.refs--,N.refs<=0&&!N.visible&&(o.delete(S),h.delete(S)))}}function j(A){if(B(A),g--,g<=0&&(g=0,h.clear(),o.size!==i.length))for(let[S,N]of o)N.visible||o.delete(S)}async function pe(A,S){let N=++r,w={id:n++,key:t++,base:A,claims:[],visible:!1,refs:1},k=c(w,N,A);x(()=>(o.set(w.id,w),w.visible=!0,i=[...i,w.id],g++,!0));let M,H=!1;try{M=await S()}catch{H=!0}x(()=>{try{if(H)return h.add(w.id),u(w,k),v(w.id);let W=s(w);return k.value=M,k.settled=!0,l(w),w.visible&&!Object.is(W,s(w))}finally{j([w.id])}})}async function lt(A,S){let N=++r,w=[];for(let M of i)A(a(o.get(M),N))&&w.push(M);x(()=>{if(L(w),g++,w.length===0)return!1;let M=new Set(w);for(let H of w){let W=o.get(H);W&&(W.visible=!1)}return i=i.filter(H=>!M.has(H)),!0});let k=!1;try{await S()}catch{k=!0}x(()=>{try{if(!k){for(let M of w)h.add(M);return!1}return E(w)}finally{j(w)}})}async function Ue(A,S,N){let w=++r,k=[];for(let G of i){let z=o.get(G),Z=a(z,w);A(Z)&&k.push({row:z,nextValue:{...Z,...S}})}let M=k.map(G=>G.row.id),H=[];x(()=>{L(M),g++;let G=!1;for(let z of k){let Z=s(z.row);H.push(c(z.row,w,z.nextValue)),z.row.visible&&!Object.is(Z,s(z.row))&&(G=!0)}return G});let W,Oe=!1;try{W=await N()}catch{Oe=!0}x(()=>{try{let G=!1;for(let z=0;z<H.length;z++){let Z=k[z].row,T=H[z],U=s(Z);Oe?u(Z,T):(T.value=W,T.settled=!0),l(Z),Z.visible&&!Object.is(U,s(Z))&&(G=!0)}return G}finally{j(M)}})}return{items:m,pending:f,add:pe,remove:lt,update:Ue}}function Cc(e,n=100){let[t,r]=C([e]),[o,i]=C(0),s=Le(()=>t()[o()]),a=Le(()=>o()>0),c=Le(()=>o()<t().length-1);function u(g){let h=s(),y=typeof g=="function"?g(h):g;if(Object.is(y,h))return;let x=t(),v=o(),E=x.slice(0,v+1);E.push(y),q(()=>{E.length>n?(E.shift(),r(E),i(E.length-1)):(r(E),i(v+1))})}function l(){a()&&i(o()-1)}function m(){c()&&i(o()+1)}function b(){q(()=>{r([e]),i(0)})}function f(g){let h=t();g>=0&&g<h.length&&i(g)}function p(){s.dispose(),a.dispose(),c.dispose()}return{value:s,set:u,undo:l,redo:m,canUndo:a,canRedo:c,history:t,index:o,reset:b,jumpTo:f,dispose:p}}function Lc(e){if(typeof structuredClone=="function")return structuredClone(e);let n=new WeakSet,t=r=>{if(r===null||typeof r!="object")return r;if(n.has(r))throw new Error("deepClone: circular reference");if(n.add(r),r instanceof Date)return new Date(r.getTime());if(r instanceof Map){let i=new Map;for(let[s,a]of r)i.set(t(s),t(a));return i}if(r instanceof Set){let i=new Set;for(let s of r)i.add(t(s));return i}if(Array.isArray(r))return r.map(t);let o={};for(let i of Object.keys(r))i!=="__proto__"&&(o[i]=t(r[i]));return o};return t(e)}function Nc(e){let n=Lc(e.state),[t,r]=C({...n}),o=new Set,i=e.middleware||[];function s(l,m){let b=e.actions[l];if(!b)throw new Error(`Unknown action: ${String(l)}`);let f=()=>{let h=t(),y=b(h,m),x=at(y);r({...h,...x});let v=t();for(let E of o)E(v)};if(i.length===0){f();return}let p=0,g=()=>{if(p<i.length){let h=i[p++];h(t(),String(l),m,g)}else f()};g()}function a(l){return()=>l(t())}function c(l){return o.add(l),()=>o.delete(l)}function u(){r({...n});for(let l of o)l(t())}return{getState:t,select:a,dispatch:s,subscribe:c,reset:u}}function Rc(e,n){return t=>n(e,t)}function Mc(e,n){return t=>e({...n,...t})}function Pc(...e){return n=>e.reduceRight((t,r)=>r(t),n)}function Hc(e){return e.render(e.data())}function $c(e,n){return t=>{let r=document.createElement("div");r.setAttribute("data-sibu-boundary",e);try{let o=n(t);r.appendChild(o)}catch(o){let i=document.createElement("div");i.setAttribute("data-sibu-boundary-error",e),i.style.cssText="color: red; border: 1px solid red; padding: 8px; margin: 4px;",i.textContent=`[${e}] ${o instanceof Error?o.message:String(o)}`,r.appendChild(i)}return r}}function Dc(e){return{renderSlot(n,t){let r=Object.hasOwn(e,n)?e[n]:void 0;if(r){let o=r();if(Array.isArray(o)){let i=document.createElement("div");i.style.display="contents";for(let s of o)i.appendChild(s);return i}return o}return t?t():null},hasSlot(n){return Object.hasOwn(e,n)}}}function Oc(e){let{defaults:n,setup:t}=e;return r=>{let o=n?{...n,...r}:r;return t(o)}}function Ic(e){let{defaults:n,setup:t}=e;return r=>{let o=n?{...n,...r}:r;return t(o)}}function Bc(e,n){return t=>e(n(t))}var Vc={string:((e,n)=>typeof e=="string"||`${n} must be a string, got ${typeof e}`),number:((e,n)=>typeof e=="number"||`${n} must be a number, got ${typeof e}`),boolean:((e,n)=>typeof e=="boolean"||`${n} must be a boolean, got ${typeof e}`),function:((e,n)=>typeof e=="function"||`${n} must be a function, got ${typeof e}`),object:((e,n)=>typeof e=="object"&&e!==null||`${n} must be an object`),array:((e,n)=>Array.isArray(e)||`${n} must be an array`),required:((e,n)=>e!=null||`${n} is required`),oneOf:(...e)=>(n,t)=>e.includes(n)||`${t} must be one of: ${e.join(", ")}`,instanceOf:e=>(n,t)=>n instanceof e||`${t} must be an instance of ${e.name}`,arrayOf:e=>(n,t)=>{if(!Array.isArray(n))return`${t} must be an array`;for(let r=0;r<n.length;r++){let o=e(n[r],`${t}[${r}]`);if(o!==!0)return o}return!0},shape:e=>(n,t)=>{if(typeof n!="object"||n===null)return`${t} must be an object`;for(let[r,o]of Object.entries(e)){let i=o(n[r],`${t}.${r}`);if(i!==!0)return i}return!0},optional:e=>(n,t)=>n==null?!0:e(n,t),range:(e,n)=>(t,r)=>typeof t!="number"?`${r} must be a number`:t>=e&&t<=n||`${r} must be between ${e} and ${n}`,pattern:e=>(n,t)=>typeof n!="string"?`${t} must be a string`:e.test(n)||`${t} must match pattern ${e}`};function Ar(e,n){let t={...e};{let r=[];for(let[o,i]of Object.entries(n)){let s=typeof i=="function"?{type:i}:i;if(t[o]==null&&s.default!==void 0&&(t[o]=typeof s.default=="function"?s.default():s.default),s.required&&t[o]==null){r.push(`Prop '${o}' is required`);continue}if(t[o]!=null){if(s.type){let a=s.type(t[o],o);a!==!0&&r.push(a)}if(s.validator){let a=s.validator(t[o],o);a!==!0&&r.push(a)}}}return r.length>0&&O(`Prop validation errors:
|
|
397
|
+
`,yr=!1;function Ua(){!yr&&typeof document<"u"&&(document.head.appendChild(Le({nodes:Ka})),yr=!0)}function Ja(e={}){Ua();let{text:n,variant:t="spinner",size:r="md"}=e,o=r!=="md"?` sibu-loading-${r}`:"";return t==="dots"?M({class:`sibu-loading${o}`,role:"status","aria-live":"polite","aria-label":n?void 0:"Loading"},[M({class:"sibu-loading-dots"},[F({class:"sibu-loading-dot"}),F({class:"sibu-loading-dot"}),F({class:"sibu-loading-dot"})]),n?F({class:"sibu-loading-text"},n):null]):M({class:`sibu-loading${o}`,role:"status","aria-live":"polite","aria-label":n?void 0:"Loading"},[M({class:"sibu-loading-spinner"}),n?F({class:"sibu-loading-text"},n):null])}var Jt=Symbol.for("sibujs.actions.v1"),vr=globalThis[Jt]??(globalThis[Jt]=new Map);function qe(e,n){vr.set(e,n)}function Sr(e){return vr.get(e)}function Ga(e,n,t){let r=typeof n=="string"?Sr(n):n;if(!r)throw new Error(`[SibuJS] No action registered under the name "${n}". Register it with registerAction() before applying it by name.`);let o=r(e,t);typeof o=="function"&&C(e,o)}var xr=(e,n)=>{let t=r=>{e.contains(r.target)||n()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},Tr=(e,n)=>{let t=n.duration??500,r=null,o=()=>{r=setTimeout(()=>{n.callback(),r=null},t)},i=()=>{r!==null&&(clearTimeout(r),r=null)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",i),e.addEventListener("pointerleave",i),()=>{i(),e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",i),e.removeEventListener("pointerleave",i)}},wr=(e,n)=>{let t=o=>R(o,{phase:"async",name:"copyOnClick",node:e}),r=()=>{try{let o=typeof n=="function"?n():e.textContent??"";Promise.resolve(navigator.clipboard.writeText(o)).catch(t)}catch(o){t(o)}};return e.addEventListener("click",r),()=>e.removeEventListener("click",r)},Er=e=>{let n=()=>{e.style.overflow="hidden",e.style.height="auto",e.style.height=`${e.scrollHeight}px`};return n(),e.addEventListener("input",n),()=>e.removeEventListener("input",n)},kr=e=>{let n='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',t=r=>{if(r.key!=="Tab")return;let o=Array.from(e.querySelectorAll(n));if(o.length===0)return;let i=o[0],s=o[o.length-1];r.shiftKey&&document.activeElement===i?(r.preventDefault(),s.focus()):!r.shiftKey&&document.activeElement===s&&(r.preventDefault(),i.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)};qe("clickOutside",xr);qe("longPress",Tr);qe("copyOnClick",wr);qe("autoResize",Er);qe("trapFocus",kr);function pt(e){if(e===null||typeof e!="object"&&typeof e!="function")return null;let n;try{n=e.then}catch(t){return Promise.reject(t)}return typeof n!="function"?null:new Promise((t,r)=>{queueMicrotask(()=>{try{Reflect.apply(n,e,[t,r])}catch(o){r(o)}})})}var Oe=null;function Ya(e,n){try{let t=e(),r=pt(t);return r&&r.then(void 0,o=>{n?n(o,"async"):Oe?Oe(o,"async"):console.error("Unhandled async error in Sibu.catchError:",o)}),t}catch(t){return n?n(t,"sync"):Oe?Oe(t,"sync"):console.error("Unhandled error in Sibu.catchError:",t),null}}async function Xa(e,n){try{return await e()}catch(t){return n?n(t,"async"):Oe?Oe(t,"async"):console.error("Unhandled async error in Sibu.catchErrorAsync:",t),null}}function Za(e){Oe=e}function Qa(e){let[n,t]=A(e),r=i=>{!!0||!le()||O(`context.${i}() called during SSR. SibuJS context() is application-global \u2014 it is NOT isolated per request, so a concurrent request can observe this value. Do not use context() for request-specific SSR data; pass it explicitly or use request-scoped storage instead.`)};return{provide(i){r("provide");let s=n();return t(i),()=>t(s)},use(){return n},get(){return n()},set(i){r("set"),t(i)},withContext(i,s){r("withContext");let a=n();t(i);try{let c=s();return c!==null&&typeof c?.then=="function"&&O("context.withContext() received an async callback. Scoping is synchronous only \u2014 the previous value is restored as soon as the callback returns its promise, so anything after an `await` runs outside the scope."),c}finally{t(a)}}}}var Gt=Symbol.for("sibujs.createId.v1"),Yt=globalThis[Gt]??(globalThis[Gt]={n:0});function _r(e="sibu"){let n=rr();return n?(n.idCounter=(n.idCounter??0)+1,`${e}-${n.idCounter}`):(Yt.n++,`${e}-${Yt.n}`)}function Cr(){Yt.n=0}function ec(e,n){let t=typeof n=="function"?n():n;return C(t,G(()=>{t.style.display=e()?"":"none"},t)),t}function Ar(e,n,t,r,o){let i=typeof t=="function"?t():t;if(i==null||typeof i=="boolean")return{node:null,owned:!1};let s=i instanceof Node?i:document.createTextNode(String(i)),a=s===t,c=r.has(s),u=!a&&!c;return r.add(s),c&&oe(()=>`${o}: ${a?"a branch was given as an element rather than a function":"a branch factory returned a node it had already returned"}, so the SAME node is being re-attached \u2014 any state it accumulated while detached (input value, scroll position, classes set imperatively) comes back with it. Its reactive bindings are left intact rather than disposed, because the node is not this directive's to tear down. Return a FRESH node per call (\`() => div(\u2026)\`) for rebuild semantics, or keep this form deliberately when the reuse is what you want.`),e.insertBefore(s,n.nextSibling),{node:s,owned:u}}function tc(e,n,t){let r=document.createComment("when"),o=null,i,s=!1,a=!1,c=new WeakSet,u=!1,f=()=>{if(a)return;let b=e(),m=r.parentNode;if(!m||s&&Object.is(b,i))return;i=b;let l=o?Xe([o]):null;o?.parentNode&&(u&&j(o),o.parentNode.removeChild(o),o=null);let d=b?n:t!==void 0?t:null,g=ce(()=>Ar(m,r,d,c,"when"));o=g.node,u=g.owned,je(l,o?[o]:[],"when"),s=!0},h=G(f,r);return C(r,()=>{a=!0,h()}),s||queueMicrotask(()=>{!a&&!s&&r.parentNode&&f()}),r}function nc(e,n,t){let r=document.createComment("match"),o=null,i,s=!1,a=!1,c=new WeakSet,u=!1,f=()=>{if(a)return;let b=String(e()),m=r.parentNode;if(!m||s&&b===i)return;i=b;let l=o?Xe([o]):null;o?.parentNode&&(u&&j(o),o.parentNode.removeChild(o),o=null);let d=Object.hasOwn(n,b)?n[b]:t,g=ce(()=>Ar(m,r,d??null,c,"match"));o=g.node,u=g.owned,je(l,o?[o]:[],"match"),s=!0},h=G(f,r);return C(r,()=>{a=!0,h()}),s||queueMicrotask(()=>{!a&&!s&&r.parentNode&&f()}),r}function et(e,n){let t=globalThis;return t[e]??(t[e]=n())}var mt=et(Symbol.for("sibujs.components.registry.v1"),()=>new Map),Nr=et(Symbol.for("sibujs.components.registryVersion.v1"),()=>A(0));function Rr(){let[e,n]=Nr;n(ce(e)+1)}function rc(e,n){mt.set(e,n),Rr()}function oc(e){mt.delete(e)&&Rr()}function ic(e){let n=mt.get(e);return n?n():M(`[Component "${e}" not found]`)}function sc(e){let n=M({class:"sibu-dynamic"}),r={};function o(){let s=e(),a;typeof s=="function"?a=s:(Nr[0](),a=mt.get(s));let c=a??`missing:${s}`;if(c===r)return;let u=ce(()=>a?a():M(`[Component "${s}" not found]`));r=c,Q(n,u)}let i=ne(o);return C(n,i),n}function Lr(e){return typeof e=="function"?Lr(e()):e instanceof Node?e:document.createTextNode(String(e))}function ac(e,n){if(n===0)return[];let t=[],r=new Array(n);for(let a=0;a<n;a++){let c=e[a],u=0,f=t.length;for(;u<f;){let h=u+f>>1;e[t[h]]<c?u=h+1:f=h}t[u]=a,r[a]=u>0?t[u-1]:-1}let o=t.length,i=new Array(o),s=t[o-1];for(let a=o-1;a>=0;a--)i[a]=s,s=r[s];return i}function cc(e,n,t){V(typeof e=="function","each: first argument must be a function that returns an array."),V(typeof n=="function","each: second argument must be a render function."),V(t&&typeof t.key=="function","each: options.key must be a function that returns a unique key per item.");let r=document.createComment("each:anchor"),o=document.createComment("each:end"),i=[],s=[],a=i,c=0,u=new Map,f=new Map,h=[],b=[],m=[],l=0,d=[],g=[],y=new Uint8Array(0),S=new Map,v=[],x=[],E=new Map,D=!1,B=!1,W=!1,ue=t.key,nt=()=>{if(W)return;let k=e(),_=k.length,$=r.parentNode;if(!$)return;B||($.insertBefore(o,r.nextSibling),B=!0),g.length<_&&(g=new Array(_));for(let w=0;w<_;w++)g[w]=ue(k[w]);let H=g;d.length<_&&(d=new Array(_)),f.clear(),E.clear();for(let w=0;w<_;w++)E.has(H[w])&&O(`each: duplicate key "${String(H[w])}" at index ${w} (first seen at ${E.get(H[w])}). Keys must be unique \u2014 duplicates cause rows to be dropped or mis-ordered.`),E.set(H[w],w);l=0;for(let w=0;w<_;w++){let J=H[w],nn=u.get(J),Ue;if(nn!==void 0)Ue=nn,h[l]=Ue,b[l]=k[w],m[l]=w,l++;else{let[rn,Yr]=A(k[w]),[on,Xr]=A(w),vt;try{Ce();try{vt=Lr(n(rn,on))}finally{Ae()}}catch(Zr){let Qr=H[w];vt=document.createComment(`each:error:${w}`),queueMicrotask(()=>{R(Zr,{phase:"render",name:`each row (key="${String(Qr)}")`,node:r.parentNode?r:void 0})})}Ue={node:vt,item:rn,setItem:Yr,index:on,setIndex:Xr}}f.set(J,Ue),d[w]=Ue.node}for(let[w,J]of u)f.has(w)||(j(J.node),J.node.parentNode&&$.removeChild(J.node));if(_===0){c=0;let w=u;u=f,f=w,D=!0,l=0;return}S.clear();for(let w=0;w<c;w++)S.set(a[w],w);v.length<_&&(v=new Array(_),x=new Array(_));let K=0;for(let w=0;w<_;w++){let J=S.get(H[w]);J!==void 0&&(v[K]=w,x[K]=J,K++)}let Ke=ac(x,K);y.length<_?y=new Uint8Array(_):y.fill(0,0,_);for(let w=0;w<Ke.length;w++)y[v[Ke[w]]]=1;let Y=o;for(let w=_-1;w>=0;w--){let J=d[w];y[w]||J.nextSibling!==Y&&$.insertBefore(J,Y),Y=J}let q=a===i?s:i;q.length<_&&(q.length=_);for(let w=0;w<_;w++)q[w]=H[w];a=q,c=_;let ee=u;u=f,f=ee,D=!0,N()};function N(){if(l===0)return;let k=l;l=0,z(()=>{for(let _=0;_<k;_++){let $=h[_];$.setItem(b[_]),$.setIndex(m[_]),h[_]=void 0,b[_]=void 0}})}let T=ne(nt);return C(r,()=>{if(!W){W=!0,T();for(let k of u.values())j(k.node),k.node.parentNode?.removeChild(k.node);o.parentNode&&o.parentNode.removeChild(o),B=!1,u.clear(),f.clear(),E.clear(),S.clear(),c=0,h.length=0,b.length=0,m.length=0,l=0}}),D||queueMicrotask(()=>{!D&&!W&&r.parentNode&&nt()}),r}function lc(e){let n=document.createDocumentFragment();for(let t of e)if(!(t==null||typeof t=="boolean"))if(Array.isArray(t))for(let r of t)r==null||typeof r=="boolean"||Mr(n,r);else Mr(n,t);return n}function Mr(e,n){if(n instanceof Node){e.appendChild(n);return}if(typeof n=="function"){let t=document.createComment("");e.appendChild(t),C(t,he(t,n));return}e.appendChild(document.createTextNode(String(n)))}var uc=new Set(["script","style"]),dc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pr=new Set(["svg","circle","ellipse","g","line","path","polygon","polyline","rect","text","tspan","defs","clipPath","mask","pattern","linearGradient","radialGradient","stop","use","symbol","marker"]),Dr=new WeakMap;function fc(e){let n=e.length-1,t=e[0];for(let m=0;m<n;m++)t+=`\0${m}\0${e[m+1]}`;let r=0,o=t.length;function i(){for(;r<o&&(t[r]===" "||t[r]===" "||t[r]===`
|
|
398
|
+
`||t[r]==="\r");)r++}function s(){if(t.charCodeAt(r)!==0)return-1;let m=r;r++;let l=0;for(;r<o&&t.charCodeAt(r)!==0;)l=l*10+(t.charCodeAt(r)-48),r++;return r<o&&r++,l<0||l>=n?(r=m,-1):l}function a(){let m=r;for(;r<o;){let l=t.charCodeAt(r);if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57||l===45)r++;else break}return t.slice(m,r)}function c(){if(i(),t[r]!=="=")return{kind:"bool"};r++,i();let m=s();if(m>=0)return{kind:"expr",idx:m};let l=t[r];if(l==='"'||l==="'"){r++;let d=[],g=[],y="";for(;r<o&&t[r]!==l;){let S=s();S>=0?(d.push(y),y="",g.push(S)):y+=t[r++]}return r<o&&r++,d.push(y),g.length===0?{kind:"static",value:d[0]}:{kind:"mixed",statics:d,exprs:g}}{let d=[],g=[],y="";for(;r<o;){let S=t.charCodeAt(r);if(S===32||S===9||S===10||S===13||S===62)break;let v=s();v>=0?(d.push(y),y="",g.push(v)):y+=t[r++]}return d.push(y),g.length===0?{kind:"static",value:d[0]}:{kind:"mixed",statics:d,exprs:g}}}function u(){let m=[];for(;r<o&&(i(),!(t[r]===">"||t[r]==="/"));){let l=r;for(;r<o;){let y=t.charCodeAt(r);if(y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===45||y===58||y===95||y===46)r++;else break}let d=t.slice(l,r);if(!d)break;let g=c();d.startsWith("on:")?g.kind==="expr"&&m.push({t:3,name:d.slice(3),idx:g.idx}):g.kind==="bool"?m.push({t:4,name:d}):g.kind==="static"?m.push({t:0,name:d,value:g.value}):g.kind==="expr"?m.push({t:1,name:d,idx:g.idx}):g.kind==="mixed"&&m.push({t:2,name:d,statics:g.statics,exprs:g.exprs})}return m}function f(m){return m.replace(/\s+/g," ")}function h(m){let l="";for(;r<o&&t[r]!=="<";){let g=s();if(g>=0){let y=f(l);y&&m.push({t:1,value:y}),l="",m.push({t:2,idx:g})}else l+=t[r++]}let d=f(l);d&&m.push({t:1,value:d})}function b(){let m=[];for(;r<o&&!(t[r]==="<"&&r+1<o&&t[r+1]==="/");)if(t[r]==="<"){let l=t[r+1];if(l==="!"){if(t.startsWith("<!--",r)){let v=t.indexOf("-->",r+4);r=v===-1?o:v+3}else if(t.startsWith("<![CDATA[",r)){let v=t.indexOf("]]>",r+9);r=v===-1?o:v+3}else{let v=t.indexOf(">",r);r=v===-1?o:v+1}continue}if(l==="?"){let v=t.indexOf(">",r);r=v===-1?o:v+1;continue}if(!(l>="a"&&l<="z")&&!(l>="A"&&l<="Z")){m.push({t:1,value:"<"}),r++;continue}r++;let d=a(),g=u();i();let y=dc.has(d),S=t[r]==="/";if(S&&r++,r<o&&r++,y||S)m.push({t:0,el:{tag:d,svg:Pr.has(d),attrs:g,children:[]}});else{let v=b();if(uc.has(d.toLowerCase())){for(let x=0;x<v.length;x++)if(v[x].t===2)throw new Error(`html: dynamic \${...} expressions are not allowed inside <${d}> (raw-text context). Build the content separately and append it as a Node.`)}t[r]==="<"&&r+1<o&&t[r+1]==="/"&&(r+=2,a(),i(),r<o&&t[r]===">"&&r++),m.push({t:0,el:{tag:d,svg:Pr.has(d),attrs:g,children:v}})}}else h(m);return m}return b()}function Xt(e,n){let t=e.svg?document.createElementNS(I,e.tag):document.createElement(e.tag);for(let r=0;r<e.attrs.length;r++){let o=e.attrs[r];switch(o.t){case 0:t.setAttribute(o.name,o.value);break;case 1:{let i=o.name,s=n[o.idx];typeof s=="function"?C(t,Ye(t,i,s)):ie(t,i,s,{syncValueProperty:!1,label:"html"});break}case 2:{let i=o.statics[0];for(let s=0;s<o.exprs.length;s++){let a=n[o.exprs[s]];i+=(a==null?"":String(a))+o.statics[s+1]}ie(t,o.name,i,{syncValueProperty:!1,label:"html"});break}case 3:{let i=n[o.idx];typeof i=="function"?t.addEventListener(o.name,i):O(`html: on:${o.name} handler is not a function (got ${typeof i}). Event listener was not attached.`);break}case 4:t.setAttribute(o.name,"");break}}for(let r=0;r<e.children.length;r++){let o=e.children[r];switch(o.t){case 0:t.appendChild(Xt(o.el,n));break;case 1:t.appendChild(document.createTextNode(o.value));break;case 2:{let i=n[o.idx];if(typeof i=="function"){let s=document.createComment("");t.appendChild(s),C(t,he(s,i))}else if(i instanceof Node)t.appendChild(i);else if(Array.isArray(i))for(let s=0;s<i.length;s++){let a=i[s];a instanceof Node?t.appendChild(a):a!=null&&typeof a!="boolean"&&t.appendChild(document.createTextNode(String(a)))}else i!=null&&typeof i!="boolean"&&t.appendChild(document.createTextNode(String(i)));break}}}return t}function $r(e,...n){let t=Dr.get(e);if(t||(t=fc(e),Dr.set(e,t)),t.length===1&&t[0].t===0)return Xt(t[0].el,n);let r=document.createElement("div");for(let o=0;o<t.length;o++){let i=t[o];switch(i.t){case 0:r.appendChild(Xt(i.el,n));break;case 1:r.appendChild(document.createTextNode(i.value));break;case 2:{let s=n[i.idx];if(s instanceof Node)r.appendChild(s);else if(typeof s=="function"){let a=document.createComment("bind:htm");r.appendChild(a),C(r,he(a,s))}else if(Array.isArray(s))for(let a=0;a<s.length;a++){let c=s[a];c instanceof Node?r.appendChild(c):c!=null&&typeof c!="boolean"&&r.appendChild(document.createTextNode(String(c)))}else s!=null&&typeof s!="boolean"&&r.appendChild(document.createTextNode(String(s)));break}}}return r.childNodes.length===1&&r.firstChild instanceof Element?r.firstChild:r}function pc(e,n,t){let r=document.createComment("keep-alive"),o=new Map,i=[],s=t?.max??10;s===0&&de()&&O("KeepAlive: unbounded cache (max: 0). Cached subtrees will never be evicted \u2014 set `max` to bound memory.");let a,c=null,u=!1,f=!1,h=()=>{if(f)return;let m=e(),l=r.parentNode;if(!l||u&&m===a)return;c?.parentNode&&l.removeChild(c),a=m;let d=o.get(m);if(d){let g=i.indexOf(m);g!==-1&&(i.splice(g,1),i.push(m))}else{let g=n[m];if(!g){c=null,u=!0;return}if(d=g(),d instanceof DocumentFragment){let y=document.createElement("div");y.style.display="contents",y.appendChild(d),d=y}if(o.set(m,d),i.push(m),s>0&&i.length>s){let y=i.shift(),S=o.get(y);S&&(j(S),S.parentNode&&S.parentNode.removeChild(S),o.delete(y))}}l.insertBefore(d,r.nextSibling),c=d,u=!0},b=ne(h);return u||queueMicrotask(()=>{!u&&r.parentNode&&h()}),C(r,()=>{f=!0,b();for(let m of o.values())j(m),m.parentNode&&m.parentNode.removeChild(m);o.clear(),i.length=0,c=null}),r}function mc(e,n){if(!n)throw new Error("[SibuJS mount] container element not found. Make sure the DOM element exists before calling mount().");V(typeof e=="function"||e instanceof Node,"mount: first argument must be a component function or a DOM Node.");let t=()=>typeof performance<"u"?performance.now():0,r=t(),o=null,i=f=>{if(f instanceof DocumentFragment){let h=document.createComment(""),b=document.createComment("");f.insertBefore(h,f.firstChild),f.appendChild(b),o={start:h,end:b}}n.appendChild(f)},s;typeof e=="function"?s=pn(()=>{let f=e();return i(f),f}):(s=e,i(s));let a=t()-r,c=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;c&&re(c,"app:init",{rootElement:s,container:n,duration:a});let u=o;return{node:s,unmount(){if(c&&re(c,"app:unmount",{rootElement:s}),u){gc(u.start,u.end);return}j(s),s.parentNode?.removeChild(s)}}}function gc(e,n){let t=e.parentNode;if(!t&&!n.parentNode)return;let r=me;for(let a=e.nextSibling;a&&a!==n;a=a.nextSibling)r++;let o=e,i=null,s=!0;for(;;){e.parentNode!==t||n.parentNode!==t?s=!1:(e.previousSibling!==o||n.nextSibling!==i)&&(o=e.previousSibling,i=n.nextSibling,s=!!(e.compareDocumentPosition(n)&4));let a=e.nextSibling;if(!s||a===n)break;if(r--<=0){Se("mount",me,1);return}j(a),a.parentNode===t&&t.removeChild(a)}s||R(new Error("[SibuJS mount] fragment markers lost"),{phase:"cleanup",name:"mount"}),e.parentNode?.removeChild(e),n.parentNode?.removeChild(n)}function bc(e,n){let t=document.createComment("portal"),r=n||document.body,o=null,i=!1;return queueMicrotask(()=>{if(!i)try{o=e(),r.appendChild(o)}catch(s){queueMicrotask(()=>{R(s,{phase:"render",name:"Portal",node:t.parentNode?t:void 0})})}}),C(t,()=>{i=!0,o&&(j(o),o.remove(),o=null)}),t}function hc(e,n="default"){if(e==null||!Object.hasOwn(e,n))return;let t=e[n];return typeof t=="function"?t:void 0}function Or(e,n,t){return t.length===0?e.splice(n):e.splice(n,...t)}function yc(e=[]){let[n,t]=A([...e]);return[n,{push(...o){t(i=>[...i,...o])},pop(){let o;return t(i=>{let s=[...i];return o=s.pop(),s}),o},shift(){let o;return t(i=>{let s=[...i];return o=s.shift(),s}),o},unshift(...o){t(i=>[...o,...i])},splice(o,...i){let s=[];return t(a=>{let c=[...a];return s=Or(c,o,i),s.length===0&&i.length<=1?a:c}),s},remove(o){t(i=>i.filter((s,a)=>a!==o))},removeWhere(o){t(i=>{let s=i.findIndex(o);return s===-1?i:i.filter((a,c)=>c!==s)})},set(o){t([...o])},update(o,i){t(s=>s.map((a,c)=>c===o?i:a))},updateWhere(o,i){t(s=>s.map(a=>o(a)?i(a):a))},sort(o){t(i=>[...i].sort(o))},reverse(){t(o=>[...o].reverse())},filter(o){t(i=>i.filter(o))},map(o){t(i=>i.map(o))},clear(){t([])}}]}function vc(e=[]){let n=[...e],t=null,r={__v:0};function o(){t=null,r.__v++,$e(r)||Ve(r)}function i(){if(Ne(r),t===null){let a=n.slice();t=Object.freeze(a)}return t}return[i,{push(...a){a.length!==0&&(n.push(...a),o())},pop(){if(n.length===0)return;let a=n.pop();return o(),a},shift(){if(n.length===0)return;let a=n.shift();return o(),a},unshift(...a){a.length!==0&&(n.unshift(...a),o())},splice(a,...c){let u=Or(n,a,c);return(u.length>0||c.length>1)&&o(),u},remove(a){a<0||a>=n.length||(n.splice(a,1),o())},removeWhere(a){let c=n.findIndex(a);c!==-1&&(n.splice(c,1),o())},set(a){n=[...a],o()},update(a,c){a<0||a>=n.length||Object.is(n[a],c)||(n[a]=c,o())},updateWhere(a,c){let u=!1;for(let f=0;f<n.length;f++)if(a(n[f])){let h=c(n[f]);Object.is(n[f],h)||(n[f]=h,u=!0)}u&&o()},sort(a){n.length<=1||(n.sort(a),o())},reverse(){n.length<=1||(n.reverse(),o())},filter(a){let c=n.filter(a);c.length!==n.length&&(n=c,o())},map(a){let c=!1;for(let u=0;u<n.length;u++){let f=a(n[u],u);Object.is(n[u],f)||(n[u]=f,c=!0)}c&&o()},clear(){n.length!==0&&(n=[],o())}}]}function Sc(e,n){let[t,r]=A(n),[o,i]=A(!1),[s,a]=A(null),[c,u]=A(0),f=0,h=!1,b=null,m=()=>{if(b===null)return;let d=b;b=null;try{d.abort()}catch{}},l=Z(()=>{if(c(),h)return;m();let d=++f,g=typeof AbortController<"u"?new AbortController:null;b=g,z(()=>{i(!0),a(null)});let y=()=>h||d!==f,S;try{S=e({signal:g?g.signal:void 0})}catch(v){if(y())return;z(()=>{a(v),i(!1)});return}S.then(v=>{y()||(b=null,z(()=>{r(v),i(!1)}))},v=>{y()||(b=null,z(()=>{a(v),i(!1)}))})});return{value:t,loading:o,error:s,refresh:()=>{h||u(d=>d+1)},dispose:()=>{h||(h=!0,l(),m())}}}function We(e,n,t){if(Object.is(e,n))return!0;if(e==null||n==null||typeof e!=typeof n||typeof e!="object")return!1;let r=e,o=n;if(r.constructor!==o.constructor)return!1;if(e instanceof Date)return e.getTime()===n.getTime();if(e instanceof RegExp){let a=n;return e.source===a.source&&e.flags===a.flags}t||(t=new Map);let i=t.get(r);if(i?.has(o))return!0;if(i||(i=new Set,t.set(r,i)),i.add(o),e instanceof Map){let a=n;if(e.size!==a.size)return!1;for(let[c,u]of e)if(!a.has(c)||!We(u,a.get(c),t))return!1;return!0}if(e instanceof Set){let a=n;if(e.size!==a.size)return!1;for(let c of e)if(!a.has(c))return!1;return!0}if(e instanceof ArrayBuffer){let a=new Uint8Array(e),c=new Uint8Array(n);if(a.length!==c.length)return!1;for(let u=0;u<a.length;u++)if(a[u]!==c[u])return!1;return!0}if(e instanceof DataView){if(!(n instanceof DataView)||e.byteLength!==n.byteLength)return!1;for(let a=0;a<e.byteLength;a++)if(e.getUint8(a)!==n.getUint8(a))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){let a=e,c=n;if(a.length!==c.length)return!1;for(let u=0;u<a.length;u++)if(a[u]!==c[u])return!1;return!0}if(Array.isArray(e))return!Array.isArray(n)||e.length!==n.length?!1:e.every((a,c)=>We(a,n[c],t));if(e instanceof Number||e instanceof String||e instanceof Boolean)return Object.is(e.valueOf(),n.valueOf());if(typeof URL<"u"&&e instanceof URL)return e.href===n.href;if(e instanceof Error){let a=n;return e.name===a.name&&e.message===a.message&&We(e.cause,a.cause,t)&&Hr(r,o,t)}let s=Object.getPrototypeOf(r);return s!==Object.prototype&&s!==null?!1:Hr(r,o,t)}function Hr(e,n,t){let r=Object.keys(e),o=Object.keys(n);return r.length!==o.length?!1:r.every(i=>Object.hasOwn(n,i)&&We(e[i],n[i],t))}function xc(e){return A(e,{equals:(n,t)=>We(n,t)})}function He(e,n){V(typeof e=="function","derived: argument must be a getter function.");let t=n?.name,r=n?.equals,o={};o._d=!1,o._init=!1,o._f=!1,o._g=e,o.__v=0;let i=!1,s=!1,a,c=()=>{o._d||s||(o._d=!0)};c._c=1,c._sig=o;let u=()=>{let l=e();o._v=r&&o._init&&r(o._v,l)?o._v:l,o._d=!1,o._init=!0};try{ne(()=>{o._v=e(),o._d=!1,o._init=!0},c)}catch(l){throw s=!0,Re(c),l}let f=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__,h=()=>{if(!o._d||s||a!==void 0)return;let l=o._v;i=!0;try{we(u,c),Object.is(l,o._v)||o.__v++}catch(d){a={error:d},o.__v++,s?o._d=!0:o._f=!0}finally{i=!1,s&&Re(c)}f&&!s&&!Object.is(l,o._v)&&re(f,"computed:update",{signal:o,oldValue:l,newValue:o._v})};o._validate=h;let b=()=>{let{error:l}=a;throw a=void 0,s&&(o._d=!1),l};function m(){if(i)throw new Error(`[SibuJS] Circular dependency detected in derived${t?` "${t}"`:""}. A derived signal cannot read itself (directly or through a chain).`);return jn()||s?(o._d&&(h(),a!==void 0&&b()),o._v):(o._d&&(h(),a!==void 0&&(Ne(o),b())),Ne(o),o._v)}return t&&(m.__name=t,o.__name=t),m.__signal=o,m.dispose=()=>{if(s)return;s=!0,o._d=a!==void 0,Re(c);let l=globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;if(l)try{l.emit("computed:destroy",{signal:o,getter:m})}catch{}},f&&re(f,"computed:create",{signal:o,name:t,getter:m}),m}function Tc(e){let[n,t]=A(e);return{get current(){return n()},set current(r){t(r)}}}function Ir(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function wc(e){V(e!==null&&typeof e=="object"&&!Array.isArray(e),"store: argument must be a plain object. For arrays, use array() instead.");let n=Object.create(null);Object.keys(e).forEach(c=>{let[u,f]=A(e[c]);Ir(n,c,[u,f])});let t=new Proxy({},{get(c,u){if(typeof u=="string"&&Object.hasOwn(n,u)){let f=n[u][0];return f()}return Reflect.get(c,u)},set(){throw new Error("[SibuJS store] Direct mutation is not allowed. Use actions.setState() to update store properties.")}}),r=()=>{let c={};return Object.keys(n).forEach(u=>{Ir(c,u,n[u][0]())}),c};return[t,{setState:c=>{let u=r(),f=typeof c=="function"?c(u):c;z(()=>{Object.entries(f).forEach(([h,b])=>{Object.hasOwn(n,h)&&n[h][1](b)})})},reset:()=>{z(()=>{Object.keys(e).forEach(c=>{let u=n[c][1];u(e[c])})})},subscribe:c=>{let u=!0;return Z(()=>{let f=r();if(u){u=!1;return}Ce();try{c(f)}finally{Ae()}})},subscribeKey:(c,u)=>{let f,h=!0;return Z(()=>{let b=n[c][0]();if(h){f=b,h=!1;return}if(!Object.is(b,f)){let m=f;f=b,Ce();try{u(b,m)}finally{Ae()}}})},getSnapshot:r}]}function Ec(e,n){if(V(typeof e=="function","watch: first argument must be a getter function."),V(typeof n=="function","watch: second argument must be a callback function."),le())return()=>{};let t,r=!0;return ne(()=>{let s=e();if(r){t=s,r=!1;return}if(!Object.is(s,t)){let a=t;t=s,Ce();try{n(s,a)}finally{Ae()}}})}function kc(e,n,t){return[He(e,t),i=>{z(()=>n(i))}]}function _c(e){let n=e();return de()&&queueMicrotask(()=>{try{e()}catch(t){console.warn("[SibuJS strict] second run threw:",t)}}),n}function Cc(e){if(!de())return Z(e);let n=Z(e),t=null;return queueMicrotask(()=>{try{t=Z(e)}catch(r){console.warn("[SibuJS strictEffect] second run threw:",r)}}),()=>{n(),t&&t()}}function Br(e,n){return le()?()=>{}:G(e,n)}var Zt="data-sibu-enhanced",Qt=new WeakMap;function Vr(e,n){let t=0;for(;e.length>0;){let r=e.splice(0);for(let o=0;o<r.length;o++){if(t>=me){let i=r.length-o+e.length;e.length=0,Se(n,t,i);return}t++;try{r[o]()}catch(i){typeof console<"u"&&console.error(`[SibuJS ${n}] teardown error:`,i)}}}}var jr=["text","attr","class","show","on","cleanup"];function Fr(e,n){if(n==null)return e;if(typeof n!="string")return n;let t=n.startsWith("@")?`[data-ref="${n.slice(1)}"]`:n;try{return e.querySelector(t)}catch{return null}}function tt(e,n){return Br(n,e)}function Ac(e){if(e instanceof HTMLInputElement){if(e.type==="checkbox")return e.checked;if(e.type==="number"||e.type==="range")return e.value===""?null:Number(e.value)}return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions,n=>n.value):e.value}function Nc(e,n){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked=!!n;return}if(e instanceof HTMLSelectElement&&e.multiple){let r=Array.isArray(n)?n.map(String):[];for(let o of Array.from(e.options))o.selected=r.includes(o.value);return}let t=n==null?"":String(n);e.value!==t&&(e.value=t)}function Rc(e,n,t,r){let o=`ctx.each[${r}]`;if(de())for(let i of Object.keys(t))V(jr.includes(i),`${o}: unknown binding "${i}". Expected one of: ${jr.join(", ")}.`);if(t.text!==void 0&&(V(typeof t.text=="function",`${o}: "text" must be a function returning the value.`),e.text(n,t.text)),t.attr!==void 0)for(let i of Object.keys(t.attr)){let s=t.attr[i];V(typeof s=="function",`${o}: attr["${i}"] must be a function returning the value.`),e.attr(n,i,s)}if(t.class!==void 0)for(let i of Object.keys(t.class)){let s=t.class[i];V(typeof s=="function",`${o}: class["${i}"] must be a function returning a boolean.`),e.classed(n,i,s)}if(t.show!==void 0&&(V(typeof t.show=="function",`${o}: "show" must be a function returning a boolean.`),e.show(n,t.show)),t.on!==void 0)for(let i of Object.keys(t.on)){let s=t.on[i];V(typeof s=="function",`${o}: on["${String(i)}"] must be a function.`),e.on(n,i,s)}t.cleanup!==void 0&&(V(typeof t.cleanup=="function",`${o}: "cleanup" must be a function.`),e.cleanup(t.cleanup))}function gt(e,n){let t=typeof e=="string"?typeof document<"u"?document.querySelector(e):null:e;if(!t)return typeof console<"u"&&console.warn(`[SibuJS enhance] no element matched ${JSON.stringify(e)} \u2014 nothing enhanced.`),()=>{};if(t.getAttribute(Zt)==="true")return de()&&typeof console<"u"&&console.warn("[SibuJS enhance] element is already enhanced; ignoring re-enhance.",t),()=>{};let r=[],o=Symbol("sibujs.enhance"),i=!1,s=!1,a=b=>s?(oe(()=>`enhance: ctx.${b}() was called after this enhancement was rolled back or disposed, so it was ignored. The setup is still running past the point where its transaction ended \u2014 usually an async setup continuing after an await, or a callback it queued before it threw. Registrations made now would belong to nothing: the root carries no enhancement marker and the disposer has already run, so nothing could ever release them.`),!0):!1,c=(b,m,l)=>{if(a(b))return;let d=Fr(t,m);if(!d){typeof console<"u"&&console.warn(`[SibuJS enhance] target ${JSON.stringify(m)} not found under`,t);return}l(d)},u={root:t,ref:b=>Fr(t,b),refs:b=>{let m=b.startsWith("@")?`[data-ref="${b.slice(1)}"]`:b;try{return Array.from(t.querySelectorAll(m))}catch{return[]}},on:(b,m,l,d)=>{c("on",b,g=>{let y=S=>l(S,g);g.addEventListener(m,y,d),r.push(()=>g.removeEventListener(m,y,d))})},text:(b,m)=>{c("text",b,l=>{r.push(tt(l,()=>{let d=m(),g=d==null?"":String(d);l.textContent!==g&&(l.textContent=g)}))})},attr:(b,m,l)=>{c("attr",b,d=>{r.push(tt(d,()=>{let g=l(),y=g==null?null:String(g);ie(d,m,y,{syncValueProperty:!1,label:"enhance attr()"})}))})},classed:(b,m,l)=>{c("classed",b,d=>{r.push(tt(d,()=>{d.classList.toggle(m,!!l())}))})},show:(b,m)=>{c("show",b,l=>{let d=l.hidden;r.push(tt(l,()=>{l.hidden=!m()})),r.push(()=>{l.hidden=d})})},model:(b,m,l)=>{c("model",b,d=>{let g=d,[y,S]=m,v=l?.event??(g instanceof HTMLSelectElement||g instanceof HTMLInputElement&&(g.type==="checkbox"||g.type==="radio")?"change":"input");r.push(tt(d,()=>{Nc(g,y())}));let x=()=>S(Ac(g));g.addEventListener(v,x),r.push(()=>g.removeEventListener(v,x))})},each:(b,m)=>{if(a("each"))return;V(typeof m=="function","ctx.each: second argument must be a function.");let l=typeof b=="string"?u.refs(b):Array.from(b);for(let d=0;d<l.length;d++){let g=l[d],y=m(g,d);y!=null&&Rc(u,g,y,d)}},cleanup:b=>{a("cleanup")||r.push(b)}},f;try{f=n(u);let b=f;if(b&&typeof b.then=="function")throw b.then(void 0,m=>{oe(()=>`enhance: the promise returned by the setup also rejected: ${String(m)}`)}),new Error("[SibuJS enhance] the setup returned a promise, so its work did not complete inside the enhancement transaction. If it is a lazy import, register it as lazyIsland(() => import(\u2026)): an unwrapped loader is called as a setup, so its module is fetched but the setup it resolves to is discarded. If it is an async setup, make it synchronous \u2014 this enhancement has been rolled back, and ctx registrations made after this point are ignored.")}catch(b){throw Vr(r,"enhance"),s=!0,b}typeof f=="function"&&r.push(f);let h=()=>{i||(i=!0,Qt.get(t)===o&&(Qt.delete(t),t.removeAttribute(Zt)),Je(t,h),Vr(r,"enhance"),s=!0)};return C(t,h),Qt.set(t,o),t.setAttribute(Zt,"true"),h}function Lc(e,n){if(typeof document>"u")return()=>{};let t=[];try{for(let r of Array.from(document.querySelectorAll(e)))t.push(gt(r,n))}catch(r){for(let o=t.length-1;o>=0;o--)try{t[o]()}catch(i){typeof console<"u"&&console.error("[SibuJS enhanceAll] rollback error:",i)}throw t.length=0,r}return()=>{for(let r of t.splice(0))r()}}var Mc=/^[A-Za-z0-9_-]+$/,zr=Symbol.for("sibujs.islands.lazy"),bt=et(Symbol.for("sibujs.islands.registry.v1"),()=>new Map);function Pc(e){return e[zr]=!0,e}function Dc(e,n){if(!Mc.test(e))throw new Error(`[SibuJS islands] name must match [A-Za-z0-9_-]+ (got: ${JSON.stringify(e.slice(0,32))})`);bt.set(e,n)}function $c(e){bt.delete(e)}async function Oc(e){if(typeof e=="function"&&e[zr]){let n=await e(),t=n.default??n;return typeof t=="function"?t:null}return e}function Hc(e=typeof document<"u"?document:null,n={}){if(!e||typeof e.querySelectorAll!="function")return()=>{};let t=[],r=[],o=!1;for(let i of Array.from(e.querySelectorAll("[data-sibu-island]"))){if(i.getAttribute("data-sibu-enhanced")==="true")continue;let s=i.getAttribute("data-sibu-island")??"";if(!bt.has(s)){typeof console<"u"&&console.warn(`[SibuJS islands] no island registered for "${s}" \u2014 skipping. Call registerIsland("${s}", ...).`);continue}let a=!1,c=()=>{if(a||o)return;a=!0;let f=bt.get(s);f&&Oc(f).then(h=>{if(!o){if(!h){typeof console<"u"&&console.warn(`[SibuJS islands] "${s}" loader produced no setup.`);return}try{let b=gt(i,h);if(o){b();return}r.push(b),i.setAttribute("data-sibu-hydrated","true")}catch(b){typeof console<"u"&&console.error(`[SibuJS islands] "${s}" failed to mount:`,b)}}}).catch(h=>{typeof console<"u"&&console.error(`[SibuJS islands] "${s}" failed to load:`,h)})},u=i.getAttribute("data-sibu-load")||"load";t.push(Ic(u,i,c,n))}return()=>{o=!0;for(let i of t.splice(0))i();for(let i of r.splice(0))i()}}function Ic(e,n,t,r){switch(e){case"idle":{if(typeof requestIdleCallback<"u"){let i=requestIdleCallback(t);return()=>cancelIdleCallback(i)}let o=setTimeout(t,1);return()=>clearTimeout(o)}case"visible":{if(typeof IntersectionObserver>"u")return queueMicrotask(t),()=>{};let o=new IntersectionObserver(i=>{for(let s of i)s.isIntersecting&&(o.disconnect(),t())},{rootMargin:r.rootMargin,threshold:r.threshold});return o.observe(n),()=>o.disconnect()}case"interaction":{let o=["pointerdown","focusin","keydown","touchstart"],i=()=>{s(),t()},s=()=>{for(let a of o)n.removeEventListener(a,i)};for(let a of o)n.addEventListener(a,i,{passive:!0});return s}case"media":{let o=n.getAttribute("data-sibu-media")||"(min-width: 0px)";if(typeof matchMedia>"u")return queueMicrotask(t),()=>{};let i=matchMedia(o);if(i.matches)return queueMicrotask(t),()=>{};let s=()=>{i.matches&&(i.removeEventListener("change",s),t())};return i.addEventListener("change",s),()=>i.removeEventListener("change",s)}default:return queueMicrotask(t),()=>{}}}function qr(e){return e}var Af=1024*1024;function Bc(e){let[n,t]=A(e()),r=!1,o=!1,i=n(),s=()=>{r=!1,!o&&t(i)},a=()=>{r||(r=!0,queueMicrotask(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(s):s()}))},c=ne(()=>{i=e(),a()}),u=(()=>n());return u.dispose=()=>{o||(o=!0,c())},u}var Wr=16;function Vc(e){let n=globalThis;if(typeof n.requestIdleCallback=="function"){n.requestIdleCallback(e,{timeout:Wr*4});return}if(typeof requestAnimationFrame=="function"){requestAnimationFrame(()=>e());return}setTimeout(e,Wr)}function jc(){let[e,n]=A(!1),t=0;function r(o){t++,n(!0);let i=!1,s=()=>{i||(i=!0,t--,t===0&&n(!1))},a=c=>{s(),R(c,{phase:"async",name:"transition"})};Vc(()=>{try{let c=pt(o());c?c.then(s,a):s()}catch(c){a(c)}})}return{pending:e,start:r}}function Fc(){return new Promise(e=>{queueMicrotask(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):e()})})}var yt={};sn(yt,{RenderProp:()=>el,assertType:()=>cl,compose:()=>Qc,createGuard:()=>ll,createSlots:()=>nl,defineComponent:()=>rl,defineSlottedComponent:()=>ol,defineStrictComponent:()=>al,globalStore:()=>Yc,machine:()=>qc,optimistic:()=>Kc,optimisticList:()=>Uc,persisted:()=>Wc,timeline:()=>Jc,validateProps:()=>Gr,validators:()=>sl,withBoundary:()=>tl,withDefaults:()=>Zc,withProps:()=>il,withWrapper:()=>Xc});var zc=new Set(["__proto__","constructor","prototype"]);function tn(e){return zc.has(e)}function ht(e){let n={};for(let t of Object.keys(e))tn(t)||(n[t]=e[t]);return n}function qc(e){let[n,t]=A(e.initial),[r,o]=A(e.context||{}),i=e.initial,s=r(),a=[],c=!1;function u(){c=!0;try{for(;a.length>0;)f(a.shift())}catch(d){throw a.length=0,d}finally{c=!1}}function f(d){let g=e.states[i];if(!g?.on)return;let y=g.on[d];if(!y)return;let S,v,x;typeof y=="string"?S=y:(S=y.target,v=y.guard,x=y.action);let E=s;if(v&&!v(E))return;g.exit&&g.exit(E);let D=E;if(x){let W=x(E);D={...E,...ht(W)}}i=S,s=D,z(()=>{x&&o(D),t(S)});let B=e.states[S];B?.entry&&B.entry(s)}function h(d){a.push(d),!c&&u()}let b=e.states[e.initial];if(b?.entry){c=!0;try{b.entry(s)}catch(d){throw a.length=0,d}finally{c=!1}a.length>0&&u()}function m(d){return n()===d}function l(d){let g=n(),y=e.states[g];if(!y?.on)return!1;let S=y.on[d];return S?typeof S=="string"?!0:S.guard?S.guard(r()):!0:!1}return{state:n,context:r,send:h,matches:m,can:l}}function Wc(e,n,t={}){let r=(()=>{try{return t.session?typeof sessionStorage<"u"?sessionStorage:null:typeof localStorage<"u"?localStorage:null}catch{return null}})(),o=t.serialize||JSON.stringify,i=(y,S)=>tn(y)?void 0:S,s=t.deserialize||(y=>JSON.parse(y,i)),a=t.encrypt,c=t.decrypt,u=t.session?!1:t.syncTabs??!0,f=n;try{let y=r?r.getItem(e):null;if(y!==null){c&&(y=c(y));let S=s(y);f=t.validate&&!t.validate(S)?n:S}}catch{}let[h,b]=A(f),m=!1,l=Z(()=>{let y=h();if(!m)try{let S=o(y);a&&(S=a(S)),r?.setItem(e,S)}catch{}}),d=null;return u&&r&&typeof window<"u"&&(d=y=>{if(!(y.storageArea!==r||y.key!==e)){if(y.newValue===null){m=!0;try{b(n)}finally{m=!1}return}try{let S=y.newValue;c&&(S=c(S));let v=s(S);if(t.validate&&!t.validate(v))return;m=!0;try{b(v)}finally{m=!1}}catch{}}},window.addEventListener("storage",d)),Object.defineProperty(b,"dispose",{value:()=>{l(),d&&typeof window<"u"&&(window.removeEventListener("storage",d),d=null)},enumerable:!1,writable:!1,configurable:!1}),[h,b]}function Kc(e){let[n,t]=A(e),[r,o]=A(!1),i=0,s=0;async function a(c,u){let f=++s,h=n();t(c),i++,o(!0);try{let b=await u();s===f&&t(b)}catch{s===f&&t(h)}finally{i--,i<=0&&(i=0,o(!1))}}return{value:n,pending:r,update:a}}function Uc(e){let n=0,t=0,r=0,o=new Map,i=[];for(let N of e){let T={id:n++,key:t++,base:N,claims:[],visible:!0,refs:0};o.set(T.id,T),i.push(T.id)}function s(N){let T=N.claims;return T.length>0?T[T.length-1].value:N.base}function a(N,T){let L=N.claims;for(let k=L.length-1;k>=0;k--)if(L[k].opId<T)return L[k].value;return N.base}function c(N,T,L){let k={opId:T,value:L,settled:!1},_=N.claims,$=_.length;for(;$>0&&_[$-1].opId>T;)$--;return _.splice($,0,k),k}function u(N,T){let L=N.claims.indexOf(T);L!==-1&&N.claims.splice(L,1)}function f(N){let T=N.claims,L=0;for(;L<T.length&&T[L].settled;)N.base=T[L].value,L++;L>0&&T.splice(0,L)}let[h,b]=A(i.map(N=>s(o.get(N)))),[m,l]=A(!1),d=0,g=new Set;function y(){let N=new Array(i.length);for(let T=0;T<i.length;T++)N[T]=s(o.get(i[T]));return N}function S(N){z(()=>{let T=!1;try{T=N()}finally{l(d>0),T&&b(y())}})}function v(N){let T=o.get(N);return!T||!T.visible?!1:(T.visible=!1,i=i.filter(L=>L!==N),!0)}function x(N){let T=[];for(let H of N){let K=o.get(H);!K||K.visible||g.has(H)||T.push(H)}if(T.length===0)return!1;let L=new Array(i.length+T.length),k=0,_=0,$=0;for(;k<i.length&&_<T.length;){let H=o.get(i[k]).key,K=o.get(T[_]).key;L[$++]=H<=K?i[k++]:T[_++]}for(;k<i.length;)L[$++]=i[k++];for(;_<T.length;)L[$++]=T[_++];for(let H of T)o.get(H).visible=!0;return i=L,!0}function E(N){for(let T of N){let L=o.get(T);L&&L.refs++}}function D(N){for(let T of N){let L=o.get(T);L&&(L.refs--,L.refs<=0&&!L.visible&&(o.delete(T),g.delete(T)))}}function B(N){if(D(N),d--,d<=0&&(d=0,g.clear(),o.size!==i.length))for(let[T,L]of o)L.visible||o.delete(T)}async function W(N,T){let L=++r,k={id:n++,key:t++,base:N,claims:[],visible:!1,refs:1},_=c(k,L,N);S(()=>(o.set(k.id,k),k.visible=!0,i=[...i,k.id],d++,!0));let $,H=!1;try{$=await T()}catch{H=!0}S(()=>{try{if(H)return g.add(k.id),u(k,_),v(k.id);let K=s(k);return _.value=$,_.settled=!0,f(k),k.visible&&!Object.is(K,s(k))}finally{B([k.id])}})}async function ue(N,T){let L=++r,k=[];for(let $ of i)N(a(o.get($),L))&&k.push($);S(()=>{if(E(k),d++,k.length===0)return!1;let $=new Set(k);for(let H of k){let K=o.get(H);K&&(K.visible=!1)}return i=i.filter(H=>!$.has(H)),!0});let _=!1;try{await T()}catch{_=!0}S(()=>{try{if(!_){for(let $ of k)g.add($);return!1}return x(k)}finally{B(k)}})}async function nt(N,T,L){let k=++r,_=[];for(let Y of i){let q=o.get(Y),ee=a(q,k);N(ee)&&_.push({row:q,nextValue:{...ee,...T}})}let $=_.map(Y=>Y.row.id),H=[];S(()=>{E($),d++;let Y=!1;for(let q of _){let ee=s(q.row);H.push(c(q.row,k,q.nextValue)),q.row.visible&&!Object.is(ee,s(q.row))&&(Y=!0)}return Y});let K,Ke=!1;try{K=await L()}catch{Ke=!0}S(()=>{try{let Y=!1;for(let q=0;q<H.length;q++){let ee=_[q].row,w=H[q],J=s(ee);Ke?u(ee,w):(w.value=K,w.settled=!0),f(ee),ee.visible&&!Object.is(J,s(ee))&&(Y=!0)}return Y}finally{B($)}})}return{items:h,pending:m,add:W,remove:ue,update:nt}}function Jc(e,n=100){if(!Number.isSafeInteger(n)||n<1)throw new RangeError(`[timeline] maxHistory must be a positive safe integer, got ${n}`);let[t,r]=A([e]),[o,i]=A(0),s=He(()=>t()[o()]),a=He(()=>o()>0),c=He(()=>o()<t().length-1);function u(d){let g=s(),y=typeof d=="function"?d(g):d;if(Object.is(y,g))return;let S=t(),v=o(),x=S.slice(0,v+1);x.push(y),z(()=>{x.length>n?(x.shift(),r(x),i(x.length-1)):(r(x),i(v+1))})}function f(){a()&&i(o()-1)}function h(){c()&&i(o()+1)}function b(){z(()=>{r([e]),i(0)})}function m(d){let g=t();d>=0&&d<g.length&&i(d)}function l(){s.dispose(),a.dispose(),c.dispose()}return{value:s,set:u,undo:f,redo:h,canUndo:a,canRedo:c,history:t,index:o,reset:b,jumpTo:m,dispose:l}}var Ur=Promise.prototype.then;function Kr(e,n,t){let r=!1,o=i=>{r||(r=!0,(i?n:t)())};try{Reflect.apply(Ur,e,[void 0,()=>o(!0)])}catch{queueMicrotask(()=>o(!0));return}queueMicrotask(()=>o(!1))}function Jr(e){if(e===null||typeof e!="object"&&typeof e!="function")return null;let n;try{n=e.then}catch(l){return{promise:Promise.reject(l),failedEarly:!0,probe:d=>queueMicrotask(d)}}if(typeof n!="function")return null;let t,r,o=new Promise((l,d)=>{t=l,r=d}),i="invoking",s,a=[],c=l=>{if(i=l,l!=="invoking")for(let d of a.splice(0))d()},u=l=>{t(l),c("fulfilled")},f=l=>{r(l),c("rejected")},h=l=>{if(l===o){f(new TypeError("adopt: a thenable resolved to its own adoption"));return}if(l===null||typeof l!="object"&&typeof l!="function"){u(l);return}let d;try{d=l.then}catch(g){f(g);return}if(typeof d!="function"){u(l);return}b(l,d)},b=(l,d)=>{d===Ur?(s=l,c("native")):c("invoking"),queueMicrotask(()=>{let g=!1,y=v=>{g||(g=!0,h(v))},S=v=>{g||(g=!0,f(v))};try{Reflect.apply(d,l,[y,S])}catch(v){S(v)}!g&&i==="invoking"&&c("pending")})};return b(e,n),{promise:o,failedEarly:!1,probe:(l,d)=>{let g=()=>{i==="native"?Kr(s,l,d):(i==="rejected"?l:d)()};i==="native"?Kr(s,l,d):i==="invoking"?a.push(g):queueMicrotask(i==="rejected"?l:d)}}}function Gc(e){if(typeof structuredClone=="function")return structuredClone(e);let n=new WeakSet,t=r=>{if(r===null||typeof r!="object")return r;if(n.has(r))throw new Error("deepClone: circular reference");if(n.add(r),r instanceof Date)return new Date(r.getTime());if(r instanceof Map){let i=new Map;for(let[s,a]of r)i.set(t(s),t(a));return i}if(r instanceof Set){let i=new Set;for(let s of r)i.add(t(s));return i}if(Array.isArray(r))return r.map(t);let o={};for(let i of Object.keys(r))i!=="__proto__"&&(o[i]=t(r[i]));return o};return t(e)}function Yc(e){let n=Gc(e.state),[t,r]=A({...n}),o=new Map,i=e.middleware||[];function s(l){if(o.size!==0){for(let d of Array.from(o.values()))if(d.active)try{d.callback(l)}catch(g){R(g,{phase:"event",name:"globalStore(subscribe)"})}}}let a=[],c=!1;function u(l,d=!0){if(a.push(l),c)return;c=!0;let g,y=!1;try{let S=!0,v=0;for(;v<a.length;){let x=a[v];a[v++]=void 0;try{x()}catch(E){S&&d?(y=!0,g=E):R(E,{phase:"event",name:"globalStore(dispatch)"})}S=!1}}finally{a.length=0,c=!1}if(y)throw g}function f(l,d){let g=e.actions[l];if(!g)throw new Error(`Unknown action: ${String(l)}`);let y=()=>{let S=t(),v=g(S,d),x=ht(v);r({...S,...x}),s(t())};u(()=>{if(i.length===0){y();return}let S=v=>{if(v>=i.length){y();return}let x=!1,E=!1,D=!0,B=()=>{if(E&&!x){O(`globalStore: middleware ${v} next() called after it failed for "${String(l)}"; ignored.`),x=!0;return}if(x){O(`globalStore: middleware ${v} next() called more than once for "${String(l)}"; ignored.`);return}if(x=!0,D){S(v+1);return}let ue=()=>u(()=>S(v+1),!1);if(!W){ue();return}W.probe(()=>{E=!0,O(`globalStore: middleware ${v} next() called after it failed for "${String(l)}"; ignored.`)},ue)},W=null;try{W=Jr(i[v](t(),String(l),d,B))}catch(ue){throw E=!0,ue}finally{D=!1}W&&(W.failedEarly&&(E=!0),W.promise.then(void 0,ue=>{E=!0,R(ue,{phase:"async",name:"globalStore(middleware)"})}))};S(0)})}function h(l){return()=>l(t())}function b(l){let d=o.get(l);d||(d={callback:l,active:!0},o.set(l,d));let g=d;return()=>{o.get(l)===g&&(g.active=!1,o.delete(l))}}function m(){u(()=>{r({...n}),s(t())})}return{getState:t,select:h,dispatch:f,subscribe:b,reset:m}}function Xc(e,n){return t=>n(e,t)}function Zc(e,n){return t=>e({...n,...t})}function Qc(...e){return n=>e.reduceRight((t,r)=>r(t),n)}function el(e){return e.render(e.data())}function tl(e,n){return t=>{let r=document.createElement("div");r.setAttribute("data-sibu-boundary",e);try{let o=n(t);r.appendChild(o)}catch(o){let i=document.createElement("div");i.setAttribute("data-sibu-boundary-error",e),i.style.cssText="color: red; border: 1px solid red; padding: 8px; margin: 4px;",i.textContent=`[${e}] ${o instanceof Error?o.message:String(o)}`,r.appendChild(i)}return r}}function nl(e){return{renderSlot(n,t){let r=Object.hasOwn(e,n)?e[n]:void 0;if(r){let o=r();if(Array.isArray(o)){let i=document.createElement("div");i.style.display="contents";for(let s of o)i.appendChild(s);return i}return o}return t?t():null},hasSlot(n){return Object.hasOwn(e,n)}}}function rl(e){let{defaults:n,setup:t}=e;return r=>{let o=n?{...n,...r}:r;return t(o)}}function ol(e){let{defaults:n,setup:t}=e;return r=>{let o=n?{...n,...r}:r;return t(o)}}function il(e,n){return t=>e(n(t))}var sl={string:((e,n)=>typeof e=="string"||`${n} must be a string, got ${typeof e}`),number:((e,n)=>typeof e=="number"||`${n} must be a number, got ${typeof e}`),boolean:((e,n)=>typeof e=="boolean"||`${n} must be a boolean, got ${typeof e}`),function:((e,n)=>typeof e=="function"||`${n} must be a function, got ${typeof e}`),object:((e,n)=>typeof e=="object"&&e!==null||`${n} must be an object`),array:((e,n)=>Array.isArray(e)||`${n} must be an array`),required:((e,n)=>e!=null||`${n} is required`),oneOf:(...e)=>(n,t)=>e.includes(n)||`${t} must be one of: ${e.join(", ")}`,instanceOf:e=>(n,t)=>n instanceof e||`${t} must be an instance of ${e.name}`,arrayOf:e=>(n,t)=>{if(!Array.isArray(n))return`${t} must be an array`;for(let r=0;r<n.length;r++){let o=e(n[r],`${t}[${r}]`);if(o!==!0)return o}return!0},shape:e=>(n,t)=>{if(typeof n!="object"||n===null)return`${t} must be an object`;for(let[r,o]of Object.entries(e)){let i=o(n[r],`${t}.${r}`);if(i!==!0)return i}return!0},optional:e=>(n,t)=>n==null?!0:e(n,t),range:(e,n)=>(t,r)=>typeof t!="number"?`${r} must be a number`:t>=e&&t<=n||`${r} must be between ${e} and ${n}`,pattern:e=>(n,t)=>typeof n!="string"?`${t} must be a string`:e.test(n)||`${t} must match pattern ${e}`};function Gr(e,n){let t={...e};{let r=[];for(let[o,i]of Object.entries(n)){let s=typeof i=="function"?{type:i}:i;if(t[o]===void 0&&s.default!==void 0&&(t[o]=typeof s.default=="function"?s.default():s.default),s.required&&t[o]==null){r.push(`Prop '${o}' is required`);continue}if(t[o]!=null){if(s.type){let a=s.type(t[o],o);a!==!0&&r.push(a)}if(s.validator){let a=s.validator(t[o],o);a!==!0&&r.push(a)}}}return r.length>0&&O(`Prop validation errors:
|
|
399
399
|
${r.map(o=>` - ${o}`).join(`
|
|
400
|
-
`)}`),t}for(let[r,o]of Object.entries(n)){if(typeof o=="function")continue;let i=o.default;t[r]
|
|
400
|
+
`)}`),t}for(let[r,o]of Object.entries(n)){if(typeof o=="function")continue;let i=o.default;t[r]===void 0&&i!==void 0&&(t[r]=typeof i=="function"?i():i)}return t}function al(e){return n=>{let t=Gr(n,e.props);return e.setup(t)}}function cl(e,n,t){{let r=n(e,t||"value");if(r!==!0)throw new TypeError(`[SibuJS Contract] ${r}`)}}function ll(e){return n=>e(n,"value")===!0}typeof globalThis<"u"&&(globalThis.Sibu={...yt,...en,patterns:yt});})();
|