UNPKG

sprae

Version:

DOM microhydration

23 lines (22 loc) 27.9 kB
(function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("sprae", [], f);} else if ("object" == typeof exports) {exports["sprae"] = f();} else {g["sprae"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports }; var Tt=Object.defineProperty;var lr=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var ar=Object.prototype.hasOwnProperty;var _=(t,e)=>()=>(t&&(e=t(t=0)),e);var mt=(t,e)=>{for(var r in e)Tt(t,r,{get:e[r],enumerable:!0})},fr=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cr(e))!ar.call(t,i)&&i!==r&&Tt(t,i,{get:()=>e[i],enumerable:!(o=lr(e,i))||o.enumerable});return t};var jt=t=>fr(Tt({},"__esModule",{value:!0}),t);var re={};mt(re,{_add:()=>yt,_change:()=>I,_dispose:()=>v,_off:()=>$,_on:()=>ft,_set:()=>st,_signals:()=>H,_state:()=>b,_touch:()=>wt,attr:()=>U,batch:()=>F,clsx:()=>_t,compile:()=>$t,computed:()=>B,dashcase:()=>Mt,debounce:()=>xt,decorate:()=>W,default:()=>w,dir:()=>Wt,directive:()=>tt,effect:()=>J,frag:()=>R,isCE:()=>Z,mo:()=>V,modifier:()=>q,mutate:()=>et,parse:()=>A,prefix:()=>gt,signal:()=>j,start:()=>vt,store:()=>rt,throttle:()=>X,untracked:()=>M,use:()=>ut});var v,b,ft,$,yt,gt,Z,j,J,B,F,M,tt,q,bt,Dt,ur,Lt,Yt,Pt,Wt,$t,A,te,ut,W,V,et,vt,R,Mt,dr,U,_t,ee,X,xt,w,O=_(()=>{dt();dt();v=Symbol.dispose||(Symbol.dispose=Symbol("dispose")),b=Symbol("state"),ft=Symbol("on"),$=Symbol("off"),yt=Symbol("init"),gt=":",Z=t=>t.localName?.includes("-"),F=t=>t(),M=F,tt={},q={},bt=null,Dt=null,ur=t=>{if(!t?.tagName)return"";let e=t.tagName.toLowerCase();return t.id?e+="#"+t.id:t.className&&(e+="."+t.className.split(" ")[0]),`<${e}>`},Lt=(t,e,r=Dt)=>{let o=`\u2234 ${t}`;if(r&&(o+=` in ${ur(r)}`),e){let i=e.length>100?e.slice(0,80)+`\u2026 (${e.length} chars)`:e;o+=bt?` ${bt}="${i}"`:` ="${i}"`}console.error(o)},Yt=Symbol("dirs"),Pt=(t=document.body,e,r)=>{if(t[b])return Object.assign(t[b],e);e=lt(e||{});let o=t,i=[],n=[];o[ft]=()=>{if(n)return n;n=Array(i.length);for(let c=0;c<i.length;c++)n[c]=i[c]();return n},o[$]=()=>{if(!n)return;let c=n;n=null;for(let f=0;f<c.length;f++)c[f]?.()},o[v]||(o[v]=()=>{o[$]?.(),V?._root===o&&(V.disconnect(),V=null),o[$]=o[ft]=o[v]=o[yt]=o[b]=null});let s=(c,f,u,d,h=c[b])=>(bt=f,Dt=c,i.push(l=Wt(c,u,d,e)),n.push(l()),c[b]!==h),l,a=o[yt]=(c,f)=>{let u=f?.[Yt];if(u!==void 0){for(let[d,h,N]of u)if(c.removeAttribute(d),s(c,d,h,N))return}else{let d=c.attributes,h=f&&(f[Yt]=[]);if(d)for(let N=0;N<d.length;){let{name:T,value:D}=d[N];if(T.startsWith(gt)){c.removeAttribute(T),f?.removeAttribute(T);let P=T.slice(gt.length);if(h?.push([T,P,D]),s(c,T,P,D))return}else N++}}if(!(c!==t&&Z(c)))if(c.firstChild!==void 0){let d=c.firstChild,h=f?.firstChild,N;for(;d;)N=d.nextSibling,d.nodeType==1&&a(d,h),h&&(h=h.nextSibling),d=N}else for(let d of c.childNodes)d.nodeType==1&&a(d)};return a(o,r),bt=Dt=null,o[b]===void 0&&!Z(t)&&(o[b]=e),e};Pt.version="13.4.0";A=t=>{let e=te[t=t.trim()];if(e)return e;try{e=$t(t||"undefined")}catch(r){Lt(r,t)}return te[t]=function(r,o,i){try{let n=e?.call(this,r);return o?n?.then?(n.then(s=>i=o(s)).catch(s=>Lt(s,t,this)),()=>typeof i=="function"&&i()):o(n):n}catch(n){Lt(n,t,this)}}},te={},ut=t=>(t.compile&&($t=t.compile),t.prefix&&(gt=t.prefix),t.signal&&(j=t.signal),t.effect&&(J=t.effect),t.computed&&(B=t.computed),t.batch&&(F=t.batch),t.untracked&&(M=t.untracked),t.dir&&(Wt=t.dir)),W=(t,e)=>{for(;e.length;){let[r,...o]=e.pop().split("-"),i=q[r],n;if(i&&(n=i(t,...o))!==t){for(let s in t)n[s]??(n[s]=t[s]);t=n}}return t},V=null,et=t=>{V?.disconnect(),t(),V?.observe(V._root,{childList:!0,subtree:!0})},vt=(t=document.body,e)=>{let r=lt(e);return Pt(t,r),V=new MutationObserver(o=>{for(let i of o){for(let n of i.addedNodes)n.nodeType===1&&n[b]===void 0&&t.contains(n)&&t[yt](n);for(let n of i.removedNodes)n.nodeType===1&&!t.contains(n)&&n[v]?.()}}),V._root=t,V.observe(t,{childList:!0,subtree:!0}),r},R=t=>{if(!t.nodeType)return t;let e=t.ownerDocument,r=t.content.cloneNode(!0),o=[...t.attributes],i=e.createTextNode(""),n=(r.append(i),[...r.childNodes]);return{ownerDocument:e,childNodes:n,content:r,remove:()=>r.append(...n),replaceWith(s){s!==i&&(i.before(s),r.append(...n))},attributes:o,removeAttribute(s){o.splice(o.findIndex(l=>l.name===s),1)}}},Mt=t=>t.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,(e,r)=>(r?"-":"")+e.toLowerCase()),dr=t=>t.replace(/-([a-z])/g,(e,r)=>r.toUpperCase()),U=(t,e,r)=>r==null||r===!1?t.removeAttribute(e):Z(t)?t[dr(e)]=r:t.setAttribute(e,r===!0?"":r),_t=t=>t?typeof t=="string"?t:(Array.isArray(t)?t.map(_t):Object.entries(t).reduce((e,[r,o])=>(o&&e.push(r),e),[])).join(" "):"",ee=t=>typeof t=="function"?t:t?e=>setTimeout(e,t):queueMicrotask,X=(t,e)=>{let r=0,o=0,i,n=ee(e),s=l=>{i=l,r++||(t(i),n(()=>{let a=r>1;if(r=0,a){if(++o>50){o=0,console.error("\u2234 Reactive loop detected");return}s(i)}else o=0}))};return s},xt=(t,e,r)=>{let o=ee(e);return r?(i=>n=>!i&&(t(n),i=1,o(()=>i=0)))():((i=0)=>(n,s=++i)=>o(()=>s==i&&t(n)))()},w=Pt});var H,I,wt,st,qt,Rt,rt,oe,Ot,St,ie,lt,dt=_(()=>{O();H=Symbol("signals"),I=Symbol("change"),wt=Symbol("touch"),st=Symbol("set"),qt=Symbol("parent"),Rt=!0,rt=(t,e)=>{if(!t||t[Symbol.toStringTag]||t[H])return t;if(t.constructor!==Object)return Array.isArray(t)?oe(t):t;let r=Object.keys(t).length,o={},i=new Proxy(Object.assign(o,{[I]:j(r),[H]:o}),{get:(s,l)=>l in o?o.hasOwnProperty(l)&&typeof o[l]=="function"&&!o[l].prototype?o[l].bind(i):o[l]?o[l].valueOf():o[l]:e?e[l]:typeof globalThis[l]=="function"&&!globalThis[l].prototype?globalThis[l].bind(globalThis):globalThis[l],set:(s,l,a)=>l in o?(ie(o,l,a),1):(Rt=!1,e&&l in e?e[l]=a:(Ot(o,l,a),o[I].value=++r),Rt=!0,1),deleteProperty:(s,l)=>(l in o&&(l[0]!="_"&&o[l]?.[Symbol.dispose]?.(),delete o[l],o[I].value=--r),1),ownKeys:()=>(o[I].value,Reflect.ownKeys(o).filter(s=>s!==qt)),has:(s,l)=>l in o?!0:e?l in e:Rt});Object.defineProperty(o,qt,{value:e,configurable:!0});let n=Object.getOwnPropertyDescriptors(t);for(let s in t)n[s]?.get?(o[s]=B(n[s].get.bind(i)))[st]=n[s].set?.bind(i):Ot(o,s,t[s]);return i},oe=(t,e=globalThis)=>{let r=t.map(f=>j(St(f))),o=!1,i=f=>function(){o=!0;let u;return F(()=>u=f.apply(this,arguments)),u},n=j(t.length),s=j(0),l=()=>{s.value++},a=r.splice,c=new Proxy(Object.assign(r,{[I]:n,[wt]:s,[H]:r,push:i(r.push),pop:i(r.pop),shift:i(r.shift),unshift:i(r.unshift),splice:i(function(){let f=a.apply(this,arguments);return l(),f})}),{get(f,u){return u==="length"?o?(o=!1,r.length):n.value:typeof u=="symbol"||isNaN(u)?r[u]?.valueOf()??e[u]:(r[u]??(r[u]=j(void 0))).valueOf()},set(f,u,d){if(u==="length"){for(let h=d;h<r.length;h++)r[h]?.[Symbol.dispose]?.();n.value=r.length=d}else if(u>=r.length)Ot(r,u,d,St),c.length=+u+1;else if(r[u]){let h=r[u],N=h.peek?.()??h.valueOf();ie(r,u,d,St),(h.peek?.()??h.valueOf())!==N&&l()}else Ot(r,u,d,St);return 1},deleteProperty:(f,u)=>(r[u]?.[Symbol.dispose]?.(),delete r[u],1)});return Object.defineProperty(r,qt,{value:e,configurable:!0}),c},Ot=(t,e,r,o=rt)=>t[e]=e[0]=="_"||r?.peek||typeof r=="function"?r:j(o(r)),St=t=>{if(!t||typeof t!="object"||t.constructor!==Object||t[I])return t;let e={},r;return new Proxy(t,{get:(o,i)=>i===H?o:i===I?r??(r=j(0)):(typeof i=="symbol"||(e[i]??(e[i]=j(0))).value,o[i]),set:(o,i,n)=>{if(o[i]!==n){let s=!(i in o);o[i]=n,e[i]&&e[i].value++,s&&r&&r.value++}return 1},has:()=>!0})},ie=(t,e,r,o=rt)=>{if(e[0]==="_"||typeof t[e]=="function")return t[e]=r;let i=t[e],n=i.peek?.()??i;if(r!==n){if(i[st])return i[st](r);Array.isArray(r)&&Array.isArray(n)?I in n?M(()=>F(()=>{for(let s=0;s<r.length;s++)n[s]=r[s];n.length=r.length})):i.value=I in r?r:oe(r):i.value=o(r)}},lt=rt});var Kt={};mt(Kt,{batch:()=>mr,computed:()=>hr,effect:()=>ne,signal:()=>pr,untracked:()=>yr});var k,Ht,ct,Nt,pr,ne,It,hr,mr,yr,se=_(()=>{Ht=0,Nt=class{constructor(e){this.v=e,this.o=null}get value(){return k&&k.deps.add((this.o??(this.o=new Set)).add(k)),this.v}set value(e){if(e!==this.v&&(this.v=e,this.o))for(let r of this.o)ct?ct.add(r):r()}peek(){return this.v}valueOf(){return this.value}toString(){return this.value}toJSON(){return this.value}},pr=t=>new Nt(t),ne=(t,e,r,o)=>(r=i=>{if(!t)return;let n=e;if(e=null,n?.call?.(),i=k,k=r,Ht++>50){Ht--,k=i,e=t=r.fn=null;for(let s of o)s.delete(r);o.clear(),console.error("\u2234 Reactive loop detected");return}try{e=t()}finally{k=i,Ht--}},r.fn=t,o=r.deps=new Set,r(),i=>{e?.call?.(),e=t=r.fn=null;for(i of o)i.delete(r);o.clear()}),It=class extends Nt{constructor(e){super(),this.fn=e,this.e=null}get value(){return this.e||(this.e=ne(()=>super.value=this.fn())),super.value}},hr=t=>new It(t),mr=(t,e=!ct,r)=>{ct??(ct=new Set);try{t()}finally{if(e){[ct,r]=[null,ct];for(let o of r)o()}}},yr=(t,e)=>{e=k,k=null;try{return t()}finally{k=e}}});var le,ce,ae=_(()=>{O();le=(t,e)=>{var n,s;let r,o;t._holder?w(o=t,e):(t[n=b]??(t[n]=null),o=t.content?R(t):t,o[s=b]??(o[s]=null),et(()=>t.replaceWith(r=t.ownerDocument.createTextNode(""))),o._holder=r._holder=r,r._clauses=[o._clause=[o,!1]],r._match=null,r.update=X(()=>{let l=r._clauses.find(([,a])=>a);l!=r._match&&et(()=>{r._match?.[0].remove(),r._match?.[0][$]?.(),(r._match=l)&&(r.before(r._match[0].content||r._match[0]),r._match[0][b]?r._match[0][ft]?.():(delete r._match[0][b],w(r._match[0],e)))})}));let i=l=>{o._clause[1]=l,o._holder.update()};return i[$]=()=>{o._holder._match?.[0][$]?.(),o._holder._match=null},i},ce=t=>{var o;let e,r=t;for(e=t.content?R(t):t,e[o=b]??(e[o]=null);r&&!(e._holder=r._holder);)r=r.previousSibling;return t.remove(),t[b]=null,e._holder._clauses.push(e._clause=[e,!0]),e._holder.update}});var fe,ue=_(()=>{O();fe=t=>(t.content&&t.replaceWith(t=R(t).childNodes[0]),e=>{e=typeof e=="function"?e(t.textContent):e,e=e==null?"":""+e;let r=t.textContent;if(r===e)return;let o=t.firstChild;if(o&&e.startsWith(r)){o.appendData(e.slice(r.length));return}let i=t.ownerDocument,n=i.activeElement,s=n&&(n===t||t.contains(n))?i.getSelection?.():null,l=s?.rangeCount&&t.contains(s.anchorNode)?s.getRangeAt(0).startOffset:-1;if(t.textContent=e,l>=0&&t.firstChild){let a=Math.min(l,t.firstChild.textContent.length),c=new Range;c.setStart(t.firstChild,a),c.collapse(!0),s.removeAllRanges(),s.addRange(c)}})});var de,pe=_(()=>{O();de=(t,e,r,o)=>{let i=null,n,s=null,l=()=>!t.classList.length&&t.removeAttribute("class");return a=>{if(a=typeof a=="function"?a(t.className):a,a?.constructor===Object){if(s=null,i)for(let c of i)a[c]||(t.classList.remove(c),i.delete(c));i?.size||(i=null);for(let c in a)a[c]&&!i?.has(c)&&(t.classList.add(c),(i||(i=new Set)).add(c));i||l();return}if(a=_t(a),a!==s){if(s=a,n=null,a)for(let c of a.split(" "))c&&(n||(n=new Set)).add(c);if(i)for(let c of i)n?.has(c)||t.classList.remove(c);if(n)for(let c of n)i?.has(c)||t.classList.add(c);n||l(),i=n}}}});var he,me=_(()=>{O();he=(t,e,r,o)=>{let i;return n=>{if(i===void 0&&(i=t.getAttribute("style")??""),n=typeof n=="function"?n(t.style):n,typeof n=="string")U(t,"style",i?i+"; "+n:n);else{i&&U(t,"style",i);for(let s in n)s[0]=="-"?t.style.setProperty(s,n[s]):s[0]>="A"&&(t.style[s]=n[s])}}}});var ye,ge=_(()=>{ye=()=>t=>typeof t=="function"&&t()});var be,ve=_(()=>{O();be=(t,e)=>(t.type?.startsWith("select")&&w(t,e),t.type==="text"||t.type===""||t.tagName==="TEXTAREA"?(r,o,i)=>(o=t.selectionStart,i=t.selectionEnd,t.setAttribute("value",t.value=r??""),o&&t.setSelectionRange(o,i)):t.type==="checkbox"?r=>(t.checked=r,U(t,"checked",r)):t.type==="radio"?r=>(t.checked=t.value===r,U(t,"checked",t.checked||null)):t.type==="select-one"?r=>{for(let o of t.options)o.value==r?o.setAttribute("selected",""):o.removeAttribute("selected");t.value=r}:t.type==="select-multiple"?r=>{for(let o of t.options)r.some(i=>i==o.value)?o.setAttribute("selected",""):o.removeAttribute("selected")}:r=>t.value=r)});var gr,_e,xe=_(()=>{O();gr=(t,e=A(`${t}=__`))=>(r,o)=>{r.__=o,e(r),delete r.__},_e=(t,e,r)=>{let o=A(r).call(t,e);typeof o=="function"?o(t):gr(r)(e,t)}});var we,Se=_(()=>{O();dt();we=(t,e)=>{let r=t[b]=rt({},e),o=!1,i,n=t.content&&R(t);return n&&t.replaceWith(i=t.ownerDocument.createTextNode("")),s=>{if(s=typeof s=="function"?s(r):s,s!==r)for(let l in s){let a=Object.getOwnPropertyDescriptor(s,l);if(a?.get){(r[H][l]=B(a.get.bind(r)))[st]=a.set?.bind(r);continue}let c=typeof s[l]=="function"?s[l].bind(r):s[l];l in r[H]?r[l]=c:r[H][l]=l[0]=="_"||c?.peek?c:j(rt(c))}return!o&&(o=!0,!i&&delete t[b],M(()=>(i?.before(n.content||t),w(n||t,r))))}}});var br,Oe,Ne=_(()=>{O();br={get:(t,e)=>e===t.v?t.c?t.c[t.i]:t.r:e===t.k?t.o?t.o[t.i]:t.i:e===H?t:t.l?.[e]!==void 0?t.l[e]:t.p?.[e],set:(t,e,r)=>(e===t.v?t.c?t.c[t.i]=r:t.r=r:e===t.k||(t.l?.[e]!==void 0?t.l[e]=r:e in(t.p?.[H]||{})?t.p[e]=r:(t.l||(t.l={}))[e]=r),1),has:()=>!0},Oe=(t,e,r)=>{let[,o,i]=r.match(/^(.*?)\b(?:in|of)\b(.*)$/s)||[],[n,s="$"]=o.trim().replace(/\(|\)/g,"").split(/\s*,\s*/),l=t.ownerDocument,a=t._eachHolder||(t._eachHolder=l.createTextNode("")),c=new Map,f=[],u,d,h,N=!1,T=m=>{c.delete(m.scope.r),m.el.remove(),m.el[Symbol.dispose]?.()},D=(m,E,C)=>{let it={p:e,v:n,k:s,r:m,c:E,i:C,o:d,l:null},p=t.content?R(t):t.cloneNode(!0);return{el:p,scope:it,proxy:new Proxy(it,br),node:p.content||p,_di:C}},P=m=>{if(!m.length)return;let E=m.length>1?l.createDocumentFragment():null;for(let C of m)E?E.appendChild(C.node):a.before(C.node);E&&a.before(E);for(let C of m)w(C.el,C.proxy,t.content?void 0:t)},at=X(()=>M(()=>et(()=>{let m=u,E=m.length,C=f.length,it=E!==C;N=!1;for(let p=0;p<E;p++)if(m[p]!=null){N=typeof m[p]=="object";break}if(N&&C){let p=[],z=[],Y=new Set,Gt=!1,Qt=!1;for(let S=0;S<E;S++){let g=m[S];if(g!=null&&typeof g=="object"){if(Y.has(g))return;Y.add(g)}let x=c.get(g);x?(!it&&x.scope.i!==S&&(Gt=!0),z.length&&(Qt=!0),x.scope.i=S,x.scope.r=g,x.scope.o=d):(x=D(g,null,S),c.set(g,x),z.push(x)),p.push(x)}for(let[S,g]of c)Y.has(S)||T(g);if(P(z),Qt){let S=a;for(let g=p.length-1;g>=0;g--){let x=p[g].node;x.nextSibling!==S&&S.before(x),S=x,p[g]._di=g}}else if(Gt){let S=[];for(let g=0;g<p.length;g++){let x=p[g];x._di!==g&&S.push(x),x._di=g}if(S.length===2){let g=S[0].node,x=S[1].node,nt=l.createTextNode("");g.replaceWith(nt),x.replaceWith(g),nt.replaceWith(x)}else{let g=a;for(let x=p.length-1;x>=0;x--){let nt=p[x].node;nt.nextSibling!==g&&g.before(nt),g=nt}}}else for(let S=0;S<p.length;S++)p[S]._di=S;f=p}else{if(C&&h!==m){for(let p of f)T(p);f.length=0,C=0,c.clear()}if(h=m,E<C){for(let p=E;p<C;p++)T(f[p]);f.length=E}for(let p=0;p<Math.min(C,E);p++)f[p].scope.c=m,d&&(f[p].scope.o=d);if(E>C){let p=[];for(let z=C;z<E;z++){let Y=N?D(m[z],null,z):D(null,m,z);f.push(Y),N&&c.set(m[z],Y),p.push(Y)}P(p)}}})));t.parentNode&&et(()=>t.replaceWith(a)),t[b]=null;let Et=m=>{d=null,typeof m=="number"?u=Array.from({length:m},(C,it)=>it+1):m?.constructor===Object?(d=Object.keys(m),u=Object.values(m)):u=m||[];let E=J(()=>{u[I]?.value,u[wt],at()});return()=>E()};return Et.eval=A(i),Et[$]=()=>{for(let m of f)T(m);f.length=0,c.clear()},Et}});var Ae,Ce=_(()=>{O();Ae=(t,e,r,o)=>i=>U(t,o,typeof i=="function"&&!Z(t)?i(t.getAttribute(o)):i)});var Ee,Te=_(()=>{O();Ee=t=>e=>{let r=Z(t);for(let o in e)U(t,r?o:Mt(o),e[o])}});var je,Le=_(()=>{O();je=(t,e,r,o)=>{let[i,...n]=o.slice(2).split("."),s=A(r).bind(t),l=W(Object.assign(a=>s(e,c=>typeof c=="function"?c(a):c),{target:t}),n);return l.target.addEventListener(i,l,l),{[Symbol.dispose](){l.target.removeEventListener(i,l),l[Symbol.dispose]?.()}}}});var De,Pe=_(()=>{O();De=(t,e,r,o)=>{let i,n,s=A(r).bind(t),l=o.split("..").map((a,c,{length:f})=>a.split(":").reduce((u,d)=>{let[h,...N]=d.slice(2).split("."),T=(P,at)=>i=typeof P=="function"?P(at):P,D=W(Object.assign(P=>(c?T(i,P):s(e,at=>T(at,P)),n(),n=l[(c+1)%f]()),{target:t}),N);return P=>(P=u?.(),D.target.addEventListener(h,D,D),()=>(P?.(),D.target.removeEventListener(h,D)))},null));return n=l[0](),{[Symbol.dispose](){n?.()}}}});var We,$e,Me=_(()=>{O();We=t=>!!t?.content,$e=(t,e)=>{if(t.content){let r,o=t.innerHTML,i=t.ownerDocument,n=t._holder;return n||t.replaceWith(n=i.createTextNode("")),s=>{if(typeof s=="function"&&(s=s(o)),t._holder&&(t.remove(),t.content.replaceChildren()),r?.[v]?.(),r?.remove(),s!=null&&s!=="")return r=We(s)?(o=s.innerHTML,R(s)):R((r=i.createElement("template"),r.innerHTML=o=s,r)),M(()=>w(r,e)),n.before(r.content),t._holder&&t.childNodes.splice(0,1/0,...r.childNodes),r[v];t._holder&&(t.childNodes.length=0,o="")}}return r=>{var o;return r=typeof r=="function"?r(t.innerHTML):r,We(r)?t.replaceChildren(r.content.cloneNode(!0)):t.innerHTML=r??"",t[o=b]&&(t[o]=null),M(()=>w(t,e)),t[v]}}});var Re,qe=_(()=>{Re=(t,e,r)=>{let o=t.ownerDocument,i=o.createComment(":portal"),n=null;return t.before(i),s=>{let l=t.getRootNode(),a=typeof s=="string"?l.querySelector?.(s)||o.querySelector(s):s?.nodeType===1?s:s?o.body:null;if(a!==n)return a?a.appendChild(t):i.after(t),n=a,()=>{n&&(i.after(t),n=null)}}}});var He,Ie=_(()=>{He=t=>e=>t.hidden=!!e});var Ut,Ke=_(()=>{O();Ut=(t,e,r,o)=>{let[,...i]=o.split("."),n=A(r).bind(t),s;return W(Object.assign(()=>{let a=n(e,c=>typeof c=="function"?c(t):c);typeof a=="function"&&(s=a)},{target:t}),i)(),{[v](){s?.(),s=null}}}});var zt,Ue=_(()=>{O();zt=(t,e,r,o)=>{let[,...i]=o.split("."),n=A(r).bind(t),s=t.type==="checkbox"?()=>t.checked:t.type==="select-multiple"?()=>[...t.selectedOptions].map(a=>a.value):/^(date|time|month|week)/.test(t.type)?()=>t.value:()=>t.selectedIndex<0?null:isNaN(t.valueAsNumber)?t.value:t.valueAsNumber,l=W(Object.assign(()=>{n(e,a=>typeof a=="function"?a(s()):a)},{target:t}),i);return t.addEventListener("input",l),t.addEventListener("change",l),{[v](){t.removeEventListener("input",l),t.removeEventListener("change",l)}}}});var ze,Ve,Ze=_(()=>{O();ze=(t,e,r,o)=>{let[,...i]=o.split("."),n=A(r).bind(t),s=i.includes("once"),l=W(Object.assign(c=>{n(e,f=>typeof f=="function"?f(c):f)},{target:t}),i),a=new IntersectionObserver(c=>{for(let f of c)f.isIntersecting&&(l(f),s&&a.disconnect())});return a.observe(t),{[v](){a.disconnect()}}};ze.observer=!0;Ve=ze});var ke,Je,Be=_(()=>{O();ke=(t,e,r,o)=>{let[,...i]=o.split("."),n=A(r).bind(t),s=W(Object.assign(a=>{n(e,c=>typeof c=="function"?c(a):c)},{target:t}),i),l=new ResizeObserver(a=>{for(let c of a){let f=c.contentRect;s({width:f.width,height:f.height,entry:c})}});return l.observe(t),{[v](){l.disconnect()}}};ke.observer=!0;Je=ke});var Xe={};mt(Xe,{batch:()=>F,computed:()=>B,debounce:()=>xt,default:()=>Or,dispose:()=>Sr,effect:()=>J,signal:()=>j,sprae:()=>w,start:()=>vt,store:()=>lt,throttle:()=>X,untracked:()=>M,use:()=>ut});var vr,Vt,_r,xr,Zt,kt,Fe,wr,Sr,Or,Ge=_(()=>{dt();O();se();O();ae();ue();pe();me();ge();ve();xe();Se();Ne();Ce();Te();Le();Pe();Me();qe();Ie();Ke();Ue();Ze();Be();Ut.observer=zt.observer=!0;Object.assign(tt,{_:Ae,"":Ee,class:de,text:fe,html:$e,style:he,fx:ye,value:be,ref:_e,scope:we,if:le,else:ce,each:Oe,portal:Re,hidden:He,mount:Ut,change:zt,intersect:Ve,resize:Je});vr=(t,e,r,o,i)=>{let n=tt[e]||tt._,s=r.length>0;return()=>{let l=t,a,c,f,u=0;if(s&&(c=j(0),f=W(Object.assign(()=>c.value++,{target:t}),r.slice()),l=f.target??t),a=n(l,i,o,e),!a?.call)return a?.[v];let d=a.eval??A(o),h,N=()=>(typeof h=="function"&&h(),h=null);Z(l)||(i=l[b]??i);let T=s?J(()=>(c.value==u?f():(u=c.value,h=d.call(l,i,a)),N)):J(()=>(h=d.call(l,i,a),N));if(!(b in l))return T;let D=0;return()=>{D||(D=1,T(),a[$]?a[$]():l[v]?.())}}},Vt={},_r=t=>Vt[t]??(Vt[t]=t.includes("..")?0:t.split(":").map(e=>{let[r,...o]=e.split(".");return{str:e,dirName:r,mods:o,on:e.startsWith("on")}})),xr=t=>t?typeof t=="number"?t:(([,e,r]=t.match(/^(\d+)(ms|s|m)?$/)||[])=>(e=+e,r==="s"?e*1e3:r==="m"?e*6e4:e))():0,Zt=t=>t==="idle"?requestIdleCallback:t==="raf"?requestAnimationFrame:!t||t==="tick"?queueMicrotask:e=>setTimeout(e,xr(t));Object.assign(q,{debounce:(t,e,r)=>xt(t,Zt(e==="immediate"?r:e),e==="immediate"||r==="immediate"),throttle:(t,e)=>X(t,Zt(e)),delay:(t,e)=>((r=Zt(e))=>o=>r(()=>t(o)))(),once:(t,e,r)=>(r=o=>!e&&(e=1,t(o)),r.once=!0,r),window:t=>(t.target=t.target.ownerDocument.defaultView,t),document:t=>(t.target=t.target.ownerDocument,t),root:t=>(t.target=t.target.ownerDocument.documentElement,t),body:t=>(t.target=t.target.ownerDocument.body,t),parent:t=>(t.target=t.target.parentNode,t),self:t=>e=>e.target===t.target&&t(e),away:(t,e)=>{let r=t.target.ownerDocument,o=n=>e=n.target,i=r.currentEvent||r.defaultView?.event;return r.addEventListener("pointerdown",o,!0),Object.assign(n=>n!==i&&!t.target.contains(n.type==="click"?e??n.target:n.target)&&n.target.isConnected&&t(n),{target:r,[v]:()=>r.removeEventListener("pointerdown",o,!0)})},prevent:t=>e=>(e?.preventDefault(),t(e)),stop:(t,e)=>r=>(e?.[0]==="i"?r?.stopImmediatePropagation():r?.stopPropagation(),t(r)),passive:t=>(t.passive=!0,t),capture:t=>(t.capture=!0,t)});q.outside=q.away;q.tick=t=>q.delay(t);q.raf=t=>q.delay(t,"raf");kt={ctrl:t=>t.ctrlKey||t.key==="Control"||t.key==="Ctrl",shift:t=>t.shiftKey||t.key==="Shift",alt:t=>t.altKey||t.key==="Alt",meta:t=>t.metaKey||t.key==="Meta",cmd:t=>t.metaKey||t.key==="Command",arrow:t=>t.key?.startsWith("Arrow"),enter:t=>t.key==="Enter",esc:t=>t.key?.startsWith("Esc"),tab:t=>t.key==="Tab",space:t=>t.key==="\xA0"||t.key==="Space"||t.key===" ",delete:t=>t.key==="Delete"||t.key==="Backspace",digit:t=>/^\d$/.test(t.key),letter:t=>/^\p{L}$/gu.test(t.key),char:t=>/^\S$/.test(t.key)},Fe=(t,e)=>kt[t]?.(e)||e.key?.toLowerCase()===t||e.keyCode==t;for(let t in kt)q[t]=(e,r,o)=>i=>kt[t](i)&&(!r||Fe(r,i))&&(!o||Fe(o,i))&&e(i);wr=t=>{let e=0,r="",o=0;for(let i of t){if(r){o?o=0:i==="\\"?o=1:i===r&&(r="");continue}if(i===";"&&!e)return!0;i==="{"?e++:i==="}"?e--:(i==='"'||i==="'"||i==="`")&&(r=i)}return!1};ut({compile:t=>(/^(if|let|const)\b/.test(t)||wr(t)||(t=`return ${t}`),/\bawait\s/.test(t)&&(t=`return (async()=>{${t}})()`),w.constructor(`with(arguments[0]){${t}}`)),dir:(t,e,r,o)=>{let i=_r(e);return i?i.reduce((n,s)=>{let l=tt[s.dirName],a=s.on?()=>je(t,o,r,s.str)[v]:l?.observer?()=>l(t,o,r,s.str)[v]:vr(t,s.dirName,s.mods,r,o);return n?(c,f)=>(c=n(),f=a(),()=>{c(),f()}):a},null):()=>De(t,o,r,e)[v]},...Kt});w.use=ut;w.store=lt;w.directive=tt;w.modifier=q;Sr=w.dispose=t=>t[v]?.();w.start=vt;Or=w});var ir={};mt(ir,{Computed:()=>Q,Effect:()=>ot,Signal:()=>L,batch:()=>Ar,computed:()=>Er,effect:()=>or,signal:()=>Cr,untracked:()=>Bt});function Ct(){if(G>1)G--;else{for(var t,e=!1;pt!==void 0;){var r=pt;for(pt=void 0,Jt++;r!==void 0;){var o=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Ye(r))try{r.c()}catch(i){e||(t=i,e=!0)}r=o}}if(Jt=0,G--,e)throw t}}function Ar(t){if(G>0)return t();G++;try{return t()}finally{Ct()}}function Bt(t){var e=y;y=void 0;try{return t()}finally{y=e}}function Qe(t){if(y!==void 0){var e=t.n;if(e===void 0||e.t!==y)return e={i:0,S:t,p:y.s,n:void 0,t:y,e:void 0,x:void 0,r:e},y.s!==void 0&&(y.s.n=e),y.s=e,t.n=e,32&y.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=y.s,e.n=void 0,y.s.n=e,y.s=e),e}}function L(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Cr(t,e){return new L(t,e)}function Ye(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function tr(t){for(var e=t.s;e!==void 0;e=e.n){var r=e.S.n;if(r!==void 0&&(e.r=r),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function er(t){for(var e=t.s,r=void 0;e!==void 0;){var o=e.p;e.i===-1?(e.S.U(e),o!==void 0&&(o.n=e.n),e.n!==void 0&&(e.n.p=o)):r=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=o}t.s=r}function Q(t,e){L.call(this,void 0),this.x=t,this.s=void 0,this.g=At-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Er(t,e){return new Q(t,e)}function rr(t){var e=t.u;if(t.u=void 0,typeof e=="function"){G++;var r=y;y=void 0;try{e()}catch(o){throw t.f&=-2,t.f|=8,Ft(t),o}finally{y=r,Ct()}}}function Ft(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,rr(t)}function Tr(t){if(y!==this)throw new Error("Out-of-order effect");er(this),y=t,this.f&=-2,8&this.f&&Ft(this),Ct()}function ot(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}function or(t,e){var r=new ot(t,e);try{r.c()}catch(i){throw r.d(),i}var o=r.d.bind(r);return o[Symbol.dispose]=o,o}var Nr,y,pt,G,Jt,At,nr=_(()=>{Nr=Symbol.for("preact-signals");y=void 0;pt=void 0,G=0,Jt=0,At=0;L.prototype.brand=Nr;L.prototype.h=function(){return!0};L.prototype.S=function(t){var e=this,r=this.t;r!==t&&t.e===void 0&&(t.x=r,this.t=t,r!==void 0?r.e=t:Bt(function(){var o;(o=e.W)==null||o.call(e)}))};L.prototype.U=function(t){var e=this;if(this.t!==void 0){var r=t.e,o=t.x;r!==void 0&&(r.x=o,t.e=void 0),o!==void 0&&(o.e=r,t.x=void 0),t===this.t&&(this.t=o,o===void 0&&Bt(function(){var i;(i=e.Z)==null||i.call(e)}))}};L.prototype.subscribe=function(t){var e=this;return or(function(){var r=e.value,o=y;y=void 0;try{t(r)}finally{y=o}},{name:"sub"})};L.prototype.valueOf=function(){return this.value};L.prototype.toString=function(){return this.value+""};L.prototype.toJSON=function(){return this.value};L.prototype.peek=function(){var t=y;y=void 0;try{return this.value}finally{y=t}};Object.defineProperty(L.prototype,"value",{get:function(){var t=Qe(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Jt>100)throw new Error("Cycle detected");this.v=t,this.i++,At++,G++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Ct()}}}});Q.prototype=new L;Q.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===At))return!0;if(this.g=At,this.f|=1,this.i>0&&!Ye(this))return this.f&=-2,!0;var t=y;try{tr(this),y=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return y=t,er(this),this.f&=-2,!0};Q.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}L.prototype.S.call(this,t)};Q.prototype.U=function(t){if(this.t!==void 0&&(L.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};Q.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(Q.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Qe(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});ot.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.u=e)}finally{t()}};ot.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rr(this),tr(this),G++;var t=y;return y=this,Tr.bind(this,t)};ot.prototype.N=function(){2&this.f||(this.f|=2,this.o=pt,pt=this)};ot.prototype.d=function(){this.f|=8,1&this.f||Ft(this)};ot.prototype.dispose=function(){this.d()}});var Xt=(Ge(),jt(Xe)).default,jr=(nr(),jt(ir)),Lr=(O(),jt(re)).use;Lr(jr);module.exports=Xt;var K=document.currentScript,sr=K.getAttribute("prefix")??K.dataset.prefix??K.dataset.spraePrefix,ht=K.getAttribute("start")??K.dataset.start??K.dataset.spraeStart;K.removeAttribute("prefix");K.removeAttribute("start");delete K.dataset.prefix;delete K.dataset.start;delete K.dataset.spraePrefix;delete K.dataset.spraeStart;sr&&Xt.use({prefix:sr});ht!=null&&ht!=="false"&&(ht&&ht!=="true"?document.querySelectorAll(ht):[document.body||document.documentElement]).forEach(t=>Xt.start(t)); ;if (typeof module.exports == "object" && typeof exports == "object") { var __cp = (to, from, except, desc) => { if ((from && typeof from === "object") || typeof from === "function") { for (let key of Object.getOwnPropertyNames(from)) { if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except) Object.defineProperty(to, key, { get: () => from[key], enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable, }); } } return to; }; module.exports = __cp(module.exports, exports); } return module.exports; }))