nuclo 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nuclo.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Nuclo={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function n(e){return e instanceof Node?!0:typeof e!=`object`||!e?!1:typeof e.nodeType==`number`}function r(e){return typeof e==`object`&&!!e}function i(e){return r(e)&&`tagName`in e}function a(e){return typeof e==`boolean`}function o(e){return typeof e==`function`}function s(e){return o(e)&&e.length===0}function c(e,t){typeof console<`u`&&console.error(`nuclo: ${e}`,t)}let l=typeof window<`u`&&typeof document<`u`,u=new WeakMap;function d(e,t){let n=u.get(e);n?Array.isArray(n)?n.includes(t)||n.push(t):n!==t&&u.set(e,[n,t]):u.set(e,t)}function f(e,t){e.removeEventListener(t.type,t.wrapped,t.capture)}function p(e,t){let n=u.get(e);if(!n)return;if(t===void 0){if(Array.isArray(n))for(let t=0;t<n.length;t++)f(e,n[t]);else f(e,n);u.delete(e);return}if(!Array.isArray(n)){n.type===t&&(f(e,n),u.delete(e));return}let r=0;for(let i=0;i<n.length;i++){let a=n[i];a.type===t?f(e,a):n[r++]=a}r===0?u.delete(e):r===1?u.set(e,n[0]):n.length=r}function m(e){}function h(e,t,n){return{type:e,wrapped:function(n){let r=this;try{t.call(r,n)}catch(t){c(`Error in '${e}' listener`,t)}},capture:n}}function ee(e,t,n){if(!l)return m;let r=h(e,t,n===!0||typeof n==`object`&&!!n&&n.capture===!0);return function(t){if(!t||typeof t.addEventListener!=`function`)return;let i=t;i.addEventListener(e,r.wrapped,n),d(i,r)}}let g=new Set,_=new WeakMap,v=new Set,y=new WeakMap;function te(e,t){let n=_.get(e);if(n){n.info.resolver=t.resolver,n.info.lastValue=t.lastValue,n.info.sanitize=t.sanitize;return}let r=new WeakRef(e);g.add(r),_.set(e,{ref:r,info:t})}function b(e,t){let n=new WeakRef(e);v.add(n),y.set(e,{ref:n,info:t})}function x(e){g.delete(e)}function S(e){v.delete(e)}function ne(e){let t=_.get(e);t&&(g.delete(t.ref),_.delete(e))}function C(e){let t=y.get(e);t&&(v.delete(t.ref),y.delete(e))}let w=new WeakMap,T=new Set,E=new WeakMap,re=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{T.delete(e)}):null;function ie(e,t){w.set(e,t);let n=new WeakRef(e);T.add(n),E.set(e,n),re?.register(e,n)}function ae(e){w.delete(e);let t=E.get(e);t&&(T.delete(t),E.delete(e))}function oe(){let e=[],t=[];for(let n of T){let r=n.deref();r===void 0?t.push(n):e.push(r)}for(let e of t)T.delete(e);return e}function se(e){return w.get(e)??null}let ce=`http://www.w3.org/2000/svg`;function le(e){return globalThis.document?document.createElement(e):null}function ue(e,t){return globalThis.document?document.createElementNS(e,t):null}function D(e){return globalThis.document?document.createTextNode(e):null}function de(){return globalThis.document?document.createDocumentFragment():null}function fe(e,t){try{return e.appendChild(t),!0}catch(e){return c(`Failed to append child node`,e),!1}}function pe(e){if(e.nodeType===Node.ELEMENT_NODE){let t=e;p(t),C(t),ae(t)}else e.nodeType===Node.TEXT_NODE?ne(e):e.nodeType===Node.COMMENT_NODE&&ae(e);if(e.childNodes&&e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)pe(e.childNodes[t])}function me(e){if(!e?.parentNode)return!1;try{return pe(e),e.parentNode.removeChild(e),!0}catch(e){return c(`Failed to remove child node`,e),!1}}function he(e,t,n){try{return e.insertBefore(t,n),!0}catch(e){return c(`Failed to insert node before reference`,e),!1}}function O(e){return globalThis.document?globalThis.document.createComment(e):null}function ge(e,t=`hidden`){return globalThis.document?globalThis.document.createComment(`conditional-${e}-${t}`):null}function _e(e,t){let n=O(`${e}-end`);if(!n)throw Error(`Failed to create comment: document not available`);let r=O(`${e}-start-${t}`);if(!r)throw Error(`Failed to create comment: document not available`);return{start:r,end:n}}function ve(e,t){let n=e.nextSibling;for(;n&&n!==t;){let e=n.nextSibling;me(n),n=e}}function ye(e,t){let n=t.parentNode;if(n)for(let r=0;r<e.length;r++)he(n,e[r],t)}function be(e,...t){if(!e)return e;for(let n=0;n<t.length;n++){let r=t[n];if(r!=null){let t;if(typeof r==`string`){let e=D(r);if(e)t=e;else continue}else t=r;fe(e,t)}}return e}function k(e){return e?.isConnected===!0}function xe(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return c(`Error replacing conditional node`,e),!1}}function Se(e){return e}function Ce(e,t,n){let r=Se(e),i=r.appendChild.bind(r),a=r.insertBefore.bind(r);r.appendChild=function(e){return a(e,t)};try{return n()}finally{r.appendChild=i}}function we(e,t,n){try{if(n==null||n===``)return e.style[t]=``,!0;let r=String(n);return e.style[t]=r,!0}catch{return!1}}let Te={},Ee=!1;function De(e){let t=e.target;if(!t||typeof Node>`u`||!(t instanceof Node))return;let n=t;for(;n;){if(n instanceof Element){let e=y.get(n);e&&(k(n)?Me(e.info):(S(e.ref),y.delete(n)))}n=n.parentNode}}function Oe(){Ee||typeof document>`u`||typeof document.addEventListener!=`function`||(document.addEventListener(`update`,De,!0),Ee=!0)}function ke(e){let t=y.get(e);if(t)return t.info;let n={attributeResolvers:[]};return b(e,n),n}function Ae(e){return typeof e!=`object`||!e}function je(e){let t;try{t=e.resolver()}catch(t){c(`Failed to resolve reactive attribute: ${e.key}`,t);return}let n=Ae(t);if(!(n&&Object.is(t,e.lastValue)))try{e.applyValue(t),e.lastValue=n?t:Te}catch(t){c(`Failed to apply reactive attribute: ${e.key}`,t)}}function Me(e){let t=e.attributeResolvers;for(let e=0;e<t.length;e++)je(t[e])}function Ne(e,t,n,r){if(!(e instanceof Element)||!t||typeof n!=`function`){c(`Invalid parameters for registerAttributeResolver`);return}let i={key:t,resolver:n,applyValue:r,lastValue:Te};if(!l){je(i);return}Oe();let a=ke(e).attributeResolvers,o=!1;for(let e=0;e<a.length;e++)if(a[e].key===t){a[e]=i,o=!0;break}o||a.push(i),je(i)}function Pe(e){let t=[];for(let n of v){let r=n.deref();if(r===void 0){t.push(n);continue}let i=y.get(r);if(!i){t.push(n);continue}if(!k(r)){y.delete(r),t.push(n);continue}e&&!e.contains(r)||Me(i.info)}for(let e of t)S(e)}function Fe(e,t){if(!(!e?.style||!t))for(let n in t)we(e,n,t[n])||c(`Failed to set style property '${n}'`)}function Ie(e,t){e&&(o(t)?Ne(e,`style`,t,function(t){Fe(e,t)}):Fe(e,t))}let Le=new WeakMap;function Re(e){if(e.length<=2||e.charCodeAt(0)!==111||e.charCodeAt(1)!==110)return null;let t=e.charCodeAt(2);return t<65||t>90?null:e===`onDoubleClick`?`ondblclick`:e.toLowerCase()}function ze(e,t,n){if(t in e){e[t]=n;return}let r=t.slice(2),i=Le.get(e);if(i){for(let t=0;t<i.length;t+=2){if(i[t]!==r)continue;let a=i[t+1];if(a===n)return;e.removeEventListener(r,a),e.addEventListener(r,n),i[t+1]=n;return}e.addEventListener(r,n),i.push(r,n);return}e.addEventListener(r,n),Le.set(e,[r,n])}let A=new WeakMap,Be=new WeakSet;function j(e,t){let n=t.length,r=0;for(let i=0;i<=n;i++)(i===n||t.charCodeAt(i)===32)&&(i>r&&e.add(t.substring(r,i)),r=i+1)}function Ve(e){let t=``;for(let n of e)t&&(t+=` `),t+=n;return t}function He(e){if(e.className&&!A.has(e)){let t=new Set;j(t,e.className),A.set(e,t)}Be.add(e)}function Ue(e){return Be.has(e)}function We(e,t){if(!t)return;let n=A.get(e);n||(n=new Set,A.set(e,n)),j(n,t)}function Ge(e,t){let n=A.get(e);if(!n||n.size===0){let n=t||``;e.className!==n&&(e.className=n);return}if(!t){e.className=Ve(n);return}let r=Ve(n),i=t.length,a=0;for(let e=0;e<=i;e++)if(e===i||t.charCodeAt(e)===32){if(e>a){let i=t.substring(a,e);n.has(i)||(r+=` `+i)}a=e+1}e.className=r}function Ke(e,t){if(!t)return;let n=e.className;if(n&&n!==t){let r=new Set;j(r,n),j(r,t),e.className=Ve(r)}else e.className=t}function qe(e,t,n){if(typeof e!=`function`){c(`Invalid resolver provided to createReactiveTextNode`);let e=D(``);if(!e)throw Error(`Failed to create text node: document not available`);return e}let r;if(arguments.length>1)r=t;else try{r=e()}catch(e){c(`Failed to evaluate reactive text resolver`,e),r=``}let i=r===void 0?``:String(r),a=D(i);if(!a)throw Error(`Failed to create text node: document not available`);return l&&te(a,{resolver:e,lastValue:i,sanitize:n}),a}function Je(e){let t=[];for(let n of g){let r=n.deref();if(r===void 0){t.push(n);continue}let i=_.get(r);if(!i){t.push(n);continue}let a=i.info;if(!k(r)){_.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;let o;try{o=a.resolver()}catch(e){c(`Failed to update reactive text node`,e),o=void 0}let s=a.sanitize?o==null||typeof o==`object`||typeof o==`function`?``:String(o):o===void 0?``:String(o);s!==a.lastValue&&(r.textContent=s,a.lastValue=s)}for(let e of t)x(e)}function Ye(e,t,n,r){if(n!=null){if(r&&t===`className`&&e instanceof HTMLElement){Ke(e,String(n));return}if(e instanceof Element&&e.namespaceURI===`http://www.w3.org/2000/svg`)e.setAttribute(t,String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(t,String(n))}else e instanceof Element&&e.setAttribute(t,String(n))}}function Xe(e,t,n,r=!1){if(n==null)return;let i=t;if(i===`style`){Ie(e,n);return}if(o(n)){if(i===`onClick`){e.onclick=n;return}if(i.charCodeAt(0)===111&&i.charCodeAt(1)===110){let t=Re(i);if(t){ze(e,t,n);return}if(i in e){e[i]=n;return}}if(n.length===0){let t=n;i===`className`&&e instanceof HTMLElement?(He(e),Ne(e,i,t,function(t){Ge(e,String(t||``))})):Ne(e,i,t,function(t){Ye(e,i,t,!1)});return}}if(i===`className`&&e instanceof HTMLElement&&Ue(e)){let t=String(n||``);t&&(We(e,t),Ke(e,t));return}Ye(e,i,n,r)}function Ze(e,t,n=!0){if(t)for(let r in t){let i=r,a=t[r];Xe(e,i,a,n&&i===`className`)}}let M=!1,Qe=new WeakMap;function N(){return M}function $e(){return!1}function et(){M=!0,Qe=new WeakMap}function tt(){M=!1}function nt(e){let t=M;M=!1;try{return e()}finally{M=t}}function P(e){let t=Qe.get(e);return t===void 0?e.firstChild:t}function F(e,t){Qe.set(e,t)}function rt(e){return e.nodeType===3&&!/\S/.test(e.textContent||``)}function it(e){let t=P(e),n=!1;for(;t&&rt(t);)t=t.nextSibling,n=!0;n&&F(e,t)}function I(e){let t=P(e);return t&&F(e,t.nextSibling),t}function at(e,t){if(!M)return null;it(e);let n=P(e);return n&&n.nodeType===1&&n.tagName.toLowerCase()===t?I(e):null}function ot(e,t){if(!t)return;let n=P(e);for(;n;){let r=n===t?null:n.nextSibling;e.removeChild(n),n=r}F(e,null)}let L=new WeakMap;function st(e){return r(e)&&!n(e)&&`className`in e&&typeof e.className==`string`&&Object.keys(e).length===1}function ct(e){it(e);let t=P(e);return!!t&&t.nodeType===8&&t.textContent?.trimStart().startsWith(`text-`)===!0}function lt(e,t){let n=P(e);if(n&&n.nodeType===3)return I(e),n.textContent!==t&&(n.textContent=t),n;let r=D(t);return r?(e.insertBefore(r,n),F(e,n),r):null}function R(e,i,a){if(i==null)return null;if(o(i)){if(s(i))try{let n=L.get(i);if(n||(n={value:i(),error:!1},L.set(i,n)),n.error)return dt(a,()=>``);let r=n.value;if(st(r))return Ze(e,{className:()=>{let e=i();return st(e)?e.className:``}}),null;if(t(r)){let t=i,n=r??``;if(N()&&ct(e)){let r=e;I(r);let i=String(n),a=lt(r,i);return a&&te(a,{resolver:t,lastValue:i,sanitize:!0}),null}return dt(a,t,n,!0)}return null}catch(e){return L.set(i,{value:void 0,error:!0}),c(`Error evaluating reactive text function:`,e),dt(a,()=>``)}let o=i(e,a);return o==null?null:t(o)?ft(a,o):n(o)?o:(r(o)&&Ze(e,o),null)}let l=i;if(t(l)){if(N()&&ct(e)){let t=e;return I(t),lt(t,String(l)),null}return ft(a,l)}return n(l)?l:(Ze(e,l),null)}function ut(e,t){if(l&&!N()&&!$e())return t;let n=de();if(!n)throw Error(`Failed to create document fragment: document not available`);let r=O(` text-${e} `);return r&&n.appendChild(r),t&&n.appendChild(t),n}function dt(e,t,n,r){return ut(e,qe(t,n,r))}function ft(e,t){return ut(e,D(String(t)))}let pt=Symbol(`nuclo.factory.tag`),mt=Symbol(`nuclo.factory.mods`),z=0,ht=[],gt=0;function _t(){return gt>=ht.length&&ht.push(()=>null),ht[gt++]}function vt(e,t,n){e[pt]=t,e[mt]=n}function B(e){return typeof e==`function`?e[mt]:void 0}function yt(e){return typeof e==`function`?e[pt]:void 0}function bt(){return z>0}function xt(e,t,n){let r=z===0;z++,r&&(gt=0);try{return e(t,n)}finally{z--}}function St(e,t,n=0){if(!t||t.length===0)return;let r=n,i=e;for(let n=0;n<t.length;n+=1){let a=t[n];if(a==null)continue;let o=R(e,a,r);o&&(o.parentNode!==i&&i.appendChild(o),r+=1)}}function Ct(e,t){let n=le(e);if(!n)throw Error(`Failed to create element: ${e}`);return St(n,t,0),n}function wt(e,t){let n=ue(ce,e);if(!n)throw Error(`Failed to create SVG element: ${e}`);return St(n,t,0),n}function Tt(e,t){if(bt()){let n=_t();return vt(n,e,t),n}let n=function(n,r=0){let i=n,a=i?at(i,e):null,o=a??le(e);if(!o)throw Error(`Failed to create element: ${e}`);let s=o,c=a?s.lastChild:null;return St(o,t,r),a&&ot(s,c),o};return vt(n,e,t),n}function Et(e,t){if(bt()){let n=_t();return vt(n,e,t),n}return function(n,r=0){let i=n,a=i?at(i,e):null,o=a??ue(`http://www.w3.org/2000/svg`,e);if(!o)throw Error(`Failed to create SVG element: ${e}`);let s=o,c=a?s.lastChild:null;return St(o,t,r),a&&ot(s,c),o}}function Dt(e){return(...t)=>Tt(e,t)}function Ot(e){return(...t)=>Et(e,t)}let kt=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.link.main.map.mark.menu.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.script.search.section.select.slot.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`),At=`a.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),jt=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`];function Mt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let r=n();return Object.defineProperty(e,t,{value:r,configurable:!0,enumerable:!0,writable:!0}),r},set(n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}})}function Nt(e,t){t in e&&typeof e[t]!=`function`||(Mt(e,t,()=>Dt(t)),t===`var`&&Mt(e,`var_`,()=>Dt(t)))}function Pt(e,t){let n=`${t}Svg`;n in e||Mt(e,n,()=>Ot(t))}function Ft(e=globalThis){let t=`__nuclo_tags_registered`;if(!e[t]){for(let t=0;t<At.length;t++)Pt(e,At[t]);for(let t=0;t<kt.length;t++)Nt(e,kt[t]);e[t]=!0}}function It(e,t,n){if(o(e)){let r=e(t,n);return r&&i(r)?r:null}return e&&i(e)?e:null}function Lt(e,t){let r=[],i=0;for(let e=0;e<t.length;e++){let a=t[e];if(a==null){r.push({kind:4});continue}let o=typeof a;if(o===`function`){let e=B(a);if(e!==void 0){let t=yt(a);if(!t)return null;let n=Lt(t,e);if(!n)return null;r.push({kind:3,child:n});continue}if(a.length===0){let e;try{e=a(),L.set(a,{value:e,error:!1})}catch{return null}if(e==null||typeof e!=`object`&&typeof e!=`function`){r.push({kind:2});continue}return null}return null}if(o===`object`){if(n(a))return null;let e=a,t=Object.keys(e),o=[];for(let n=0;n<t.length;n++){let r=t[n],a=e[r];if(a==null){o.push({key:r,kind:3,prop:!1});continue}if(r===`style`)return null;let s=typeof a;if(s===`function`){let e=Re(r);if(e){o.push({key:r,kind:1,prop:!1,value:e});continue}if(r===`className`&&a.length===0){if(i++)return null;o.push({key:r,kind:2,prop:!1});continue}return null}if(s===`object`||r===`className`&&i++)return null;o.push({key:r,kind:0,prop:!1,value:a})}r.push({kind:0,keys:o});continue}r.push({kind:1})}return{tag:e,slots:r}}function Rt(e,t){let n=e.slots,r=t.firstChild;for(let e=0;e<n.length;e++){let i=n[e];switch(i.kind){case 0:{let e=i.keys;for(let n=0;n<e.length;n++){let r=e[n];r.kind===0?r.prop=r.key in t:r.kind===2&&(t.className=``)}break}case 1:case 2:r&&=r.nextSibling;break;case 3:if(!r)return;Rt(i.child,r),r=r.nextSibling;break}}}function zt(e,t,n,r){let i=e.slots;if(t.length!==i.length)return!1;let a=n.firstChild;for(let e=0;e<i.length;e++){let o=i[e],s=t[e];switch(o.kind){case 0:{if(typeof s!=`object`||!s)return!1;let e=s,t=o.keys,i=0;for(let t in e)i++;if(i!==t.length)return!1;for(let i=0;i<t.length;i++){let a=t[i],o=e[a.key];switch(a.kind){case 0:if(o==null||typeof o==`object`||typeof o==`function`)return!1;if(o===a.value)break;if(a.prop){let e=n;e[a.key]!==o&&(e[a.key]=o)}else{let e=String(o);n.getAttribute(a.key)!==e&&n.setAttribute(a.key,e)}break;case 1:{if(typeof o!=`function`)return!1;let e=a.value;e===`onclick`?n.onclick=o:ze(n,e,o);break}case 2:{if(typeof o!=`function`||o.length!==0)return!1;let e=o,t;try{t=e()}catch{return!1}let i=t?String(t):``;i&&(n.className=i),r.push({kind:1,node:n,fn:e,last:i});break}case 3:if(o!=null)return!1;break}}break}case 1:if(s==null||typeof s==`object`||typeof s==`function`||!a)return!1;a.nodeValue=String(s),a=a.nextSibling;break;case 2:{if(typeof s!=`function`||s.length!==0||B(s)!==void 0||!a)return!1;let e;try{e=s()}catch{return!1}if(e!=null&&(typeof e==`object`||typeof e==`function`))return!1;let t=e==null?``:String(e),n=a;n.nodeValue=t,r.push({kind:0,node:n,fn:s,last:t}),a=n.nextSibling;break}case 3:{let e=B(s);if(e===void 0||yt(s)!==o.child.tag||!a||!zt(o.child,e,a,r))return!1;a=a.nextSibling;break}case 4:if(s!=null)return!1;break}}return!0}function Bt(e,t,n,r){let i=e.slots;if(t.length!==i.length)return!1;let a=n.firstChild;for(let e=0;e<i.length;e++){let o=i[e],s=t[e];switch(o.kind){case 0:{if(typeof s!=`object`||!s)return!1;let e=s,t=o.keys,i=0;for(let a in e){if(i>=t.length)return!1;let o=t[i];if(o.key!==a)return!1;i++;let s=e[a];if(o.kind===2){if(typeof s!=`function`||s.length!==0)return!1;C(n),r.push({kind:1,node:n,fn:s,last:n.className})}}if(i!==t.length)return!1;break}case 1:if(!a)return!1;a=a.nextSibling;break;case 2:{if(typeof s!=`function`||s.length!==0||!a||a.nodeType!==3)return!1;let e=a;ne(e),r.push({kind:0,node:e,fn:s,last:e.nodeValue??``}),a=e.nextSibling;break}case 3:{let e=B(s);if(e===void 0||yt(s)!==o.child.tag||!a||!Bt(o.child,e,a,r))return!1;a=a.nextSibling;break}case 4:if(s!=null)return!1;break}}return!0}function Vt(e){for(let t=0;t<e.length;t++){let n=e[t],r;try{r=n.fn()}catch{continue}if(n.kind===0){let e=r==null||typeof r==`object`||typeof r==`function`?``:String(r);e!==n.last&&(n.node.nodeValue=e,n.last=e)}else{let e=r?String(r):``;e!==n.last&&(n.node.className=e,n.last=e)}}}function Ht(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}let Ut=new Set,Wt=new WeakMap,Gt=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{Ut.delete(e)}):null,Kt=0;function qt(e,t){let n=new WeakRef(e);Ut.add(n),Wt.set(e,t),Gt?.register(e,n)}function Jt(e){return Array.isArray(e)?e:Array.from(e)}function Yt(e){if(typeof e!=`object`||!e)return!1;let t=e.element;return!!t&&typeof Node<`u`&&t instanceof Node}function Xt(e,t,n){let r=e.renderItem(t,n);return Yt(r)?(e.lastRenderRefresh=typeof r.update==`function`?r.update:null,r.element):It(r,e.host,n)}function Zt(e,t,n){e.lastRenderLeaves=null,e.lastRenderRefresh=null;let r=e.template,i=l&&!N()&&!$e(),a=r&&i?xt(e.renderItem,t,n):e.renderItem(t,n);if(Yt(a))return e.lastRenderRefresh=typeof a.update==`function`?a.update:null,a.element;if(r!==null&&i){let i=B(a);if(i!==void 0){if(r===void 0){let t=yt(a),r=t?Lt(t,i):null,o=It(a,e.host,n);if(r&&o){let t=o.cloneNode(!0);Rt(r,t);let n=[];if(Bt(r,i,o,n))n.length>0&&(e.lastRenderLeaves=n);else return e.template=null,e.lastRenderLeaves=null,o;e.template={tmpl:r,skeleton:t}}else e.template=null;return o}let o=r.skeleton.cloneNode(!0),s=[];return zt(r.tmpl,i,o,s)?(s.length>0&&(e.lastRenderLeaves=s),o):(e.template=null,Xt(e,t,n))}else if(r===void 0)e.template=null;else return e.template=null,Xt(e,t,n)}return It(a,e.host,n)}function V(e){me(e.element)}function Qt(e,t,n,r){if(n.parentNode!==t||r.parentNode!==t)return!1;if(l&&t.firstChild===n&&t.lastChild===r)return t.textContent=``,t.appendChild(n),t.appendChild(r),!0;for(let n=0;n<e.length;n++){let r=e[n].element;r&&r.parentNode===t&&t.removeChild(r)}return!0}function $t(e){let t=e.length;if(t===0)return[];let n=Array(t),r=[];for(let i=0;i<t;i++){let t=e[i],a=0,o=r.length;for(;a<o;){let n=a+o>>1;e[r[n]]<t?a=n+1:o=n}n[i]=a>0?r[a-1]:-1,a===r.length?r.push(i):r[a]=i}let i=r.length,a=r[i-1],o=Array(i);for(;i>0;)o[--i]=a,a=n[a];return o}function en(e,t,n,r,i,a,o){let s=de(),c=0;for(let l=r;l<i;l++){let r=n[l],i=Zt(e,r,l);if(!i)continue;let u=e.lastRenderLeaves;o.push({item:r,element:i,dyn:u,refresh:e.lastRenderRefresh,dynCreatedAt:u?e.currentFlushEpoch:void 0});let d=i;s?(s.appendChild(d),c++):t.insertBefore(d,a)}s&&c>0&&t.insertBefore(s,a)}function tn(e){let{startMarker:t,endMarker:n}=e,r=t.parentNode??e.host,i=Jt(e.itemsProvider());if(Ht(e.lastSyncedItems,i))return;let a=e.records,o=a.length,s=i.length;if(s===0){if(o>0&&!Qt(a,r,t,n))for(let e=0;e<o;e++)V(a[e]);e.records=[],e.lastSyncedItems=[],e.allRecordsCreatedAt=void 0;return}let c=0,l=Math.min(o,s);for(;c<l&&a[c].item===i[c];)c++;let u=0,d=l-c;for(;u<d&&a[o-1-u].item===i[s-1-u];)u++;let f=c,p=o-u,m=c,h=s-u;if(f===p){let t=p<o?a[p].element:n;if(p===o)en(e,r,i,m,h,t,a),e.allRecordsCreatedAt=o===0?e.currentFlushEpoch:void 0;else{let n=[];en(e,r,i,m,h,t,n),e.records=a.slice(0,f).concat(n,a.slice(f)),e.allRecordsCreatedAt=void 0}e.lastSyncedItems=i.slice();return}if(m===h){for(let e=f;e<p;e++)V(a[e]);a.splice(f,p-f),e.allRecordsCreatedAt=void 0,e.lastSyncedItems=i.slice();return}let ee=p-f,g=h-m,_=Array(g).fill(-1),v=new Uint8Array(ee),y=0,te=Math.min(p,h);for(let e=c;e<te;e++)a[e].item===i[e]&&(_[e-m]=e,v[e-f]=1,y++);let b=new Map;for(let e=f;e<p;e++){if(v[e-f])continue;let t=a[e].item,n=b.get(t);n===void 0?b.set(t,e):typeof n==`number`?b.set(t,[n,e]):n.push(e)}for(let e=0;e<g;e++){if(_[e]!==-1)continue;let t=b.get(i[m+e]);if(t===void 0)continue;let n;typeof t==`number`?(n=t,b.delete(i[m+e])):(n=t.shift(),t.length===0&&b.delete(i[m+e])),_[e]=n,v[n-f]=1,y++}if(y===0&&f===0&&p===o){if(!Qt(a,r,t,n))for(let e=0;e<o;e++)V(a[e]);let c=[];en(e,r,i,0,s,n,c),e.records=c,e.allRecordsCreatedAt=e.currentFlushEpoch,e.lastSyncedItems=i.slice();return}for(let e=f;e<p;e++)v[e-f]||V(a[e]);let x=null;if(y>0){let e=[],t=[];for(let n=0;n<g;n++)_[n]!==-1&&(e.push(_[n]),t.push(n));x=new Uint8Array(g);let n=$t(e);for(let e=0;e<n.length;e++)x[t[n[e]]]=1}let S=Array(g),ne=0,C=p<o?a[p].element:n,w=null;for(let t=g-1;t>=0;t--){let n=_[t];if(n===-1){let n=i[m+t],a=Zt(e,n,m+t);if(!a){S[t]=null,ne++;continue}let o=e.lastRenderLeaves;S[t]={item:n,element:a,dyn:o,refresh:e.lastRenderRefresh,dynCreatedAt:o?e.currentFlushEpoch:void 0};let s=a;w||=de(),w?w.insertBefore(s,w.firstChild):(r.insertBefore(s,C),C=s);continue}let o=a[n];S[t]=o;let s=o.element;if(w&&w.firstChild){let e=w.firstChild;r.insertBefore(w,C),C=e,w=null}(!x||!x[t])&&r.insertBefore(s,C),C=s}w&&w.firstChild&&r.insertBefore(w,C);let T=Array(f+(g-ne)+(o-p)),E=0;for(let e=0;e<f;e++)T[E++]=a[e];for(let e=0;e<g;e++){let t=S[e];t&&(T[E++]=t)}for(let e=p;e<o;e++)T[E++]=a[e];e.records=T,e.allRecordsCreatedAt=void 0,e.lastSyncedItems=i.slice()}function nn(e,t,n,r){return N()?an(e,t,n,r):rn(e,t,n,r)}function rn(e,t,n,r){let{start:i,end:a}=_e(`list`,r),o={itemsProvider:e,renderItem:t,startMarker:i,endMarker:a,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(i),s.appendChild(a),tn(o),l&&qt(i,o),o}function an(e,t,n,r){let i=n;it(i);let a=P(i);if(!a||a.nodeType!==8||!a.textContent?.startsWith(`list-start-`))return rn(e,t,n,r);let o=I(i),s=0,c=P(i);for(;c;){if(c.nodeType===8){let e=c.textContent||``;if(e.startsWith(`list-start-`))s++;else if(e===`list-end`){if(s===0)break;s--}}c=c.nextSibling}let u=c;if(!u){let e=O(`list-end`);e&&(i.insertBefore(e,o.nextSibling),u=e)}if(!u)return rn(e,t,n,r);let d=Jt(e()),f=[];for(let e=0;e<d.length;e++){let r=t(d[e],e),i=Yt(r)?r:null,a=i?i.element:It(r,n,e);a&&f.push({item:d[e],element:a,refresh:i&&typeof i.update==`function`?i.update:void 0})}let p=P(i);for(;p&&p!==u;){let e=p.nextSibling;me(p),p=e}let m=u;for(let e=f.length-1;e>=0;e--){let t=f[e].element;(t.parentNode!==i||t.nextSibling!==m)&&i.insertBefore(t,m),m=t}F(i,u.nextSibling);let h={itemsProvider:e,renderItem:t,startMarker:o,endMarker:u,records:f,host:n,lastSyncedItems:d.slice()};return l&&qt(o,h),h}function on(e){for(let t=0;t<e.records.length;t++){let n=e.records[t];n.element=null,n.item=null,n.dyn=null,n.refresh=null,delete n.dynCreatedAt}e.records=[],e.lastSyncedItems=[],e.allRecordsCreatedAt=void 0}function sn(e){let t=[];Kt++;for(let n of Ut){let r=n.deref();if(!r){t.push(n);continue}let i=Wt.get(r);if(!i){t.push(n);continue}if(!k(r)||!k(i.endMarker)){on(i),Wt.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;i.currentFlushEpoch=Kt;try{tn(i)}finally{i.currentFlushEpoch=void 0}if(i.allRecordsCreatedAt===Kt)continue;let a=i.records;for(let e=0;e<a.length;e++){if(a[e].dynCreatedAt===Kt)continue;let t=a[e].refresh;t&&t();let n=a[e].dyn;n&&Vt(n)}}for(let e of t)Ut.delete(e)}function cn(e,t){return function(n,r){return nn(e,t,n,r).startMarker}}function ln(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function un(e,t){return typeof e==`function`?ln(e,t):!!e}let H=new Set,U=new WeakMap,dn=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{H.delete(e)}):null;function fn(e,t){for(let t=0;t<e.length;t++)if(un(e[t].condition))return t;return t.length>0?-1:null}function pn(e){let{groups:t,elseContent:n,host:r,index:i,endMarker:a}=e,o=fn(t,n);o!==e.activeIndex&&(ve(e.startMarker,e.endMarker),e.activeIndex=o,o!==null&&ye(_n(o>=0?t[o].content:n,r,i,a),a))}function mn(e){let t=new WeakRef(e.startMarker);H.add(t),U.set(e.startMarker,e),dn?.register(e.startMarker,t)}function hn(e){let t=[];for(let n of H){let r=n.deref();if(r===void 0){t.push(n);continue}let i=U.get(r);if(!i){t.push(n);continue}if(!k(r)||!k(i.endMarker)){U.delete(r),t.push(n);continue}if(!(e&&!e.contains(r)))try{i.update()}catch(e){c(`when() branch threw during update; unregistering this conditional`,e),U.delete(r),t.push(n)}}for(let e of t)H.delete(e)}function gn(e,t,n,r){return o(e)?s(e)?(L.delete(e),R(t,e,n)):Ce(t,r,()=>{let r=R(t,e,n);return r&&!r.parentNode?r:null}):R(t,e,n)}function _n(e,t,n,r){let i=[];for(let a of e){let e=gn(a,t,n,r);e&&i.push(e)}return i}function vn(e,t){return`when-start-${e}-b${t===null?`n`:t}`}function yn(e){let t=/-b(n|-?\d+)$/.exec(e||``);if(t)return t[1]===`n`?null:parseInt(t[1],10)}var bn=class e{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}cloneWith(t,n){let r=Object.create(e.prototype);return r.groups=[...this.groups],t&&r.groups.push(t),r.elseContent=n??[...this.elseContent],r}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){return globalThis.document?N()?this.hydrateRender(e,t):this.freshRender(e,t):null}freshRender(e,t){let{start:n,end:r}=_e(`when`,t),i=this.createRuntimeFromMarkers(e,t,n,r),a=Se(e);return a.appendChild(n),a.appendChild(r),pn(i),n.textContent=vn(t,i.activeIndex),n}hydrateRender(e,t){let n=e;it(n);let r=P(n);if(!r||r.nodeType!==8||!r.textContent?.startsWith(`when-start-`))return this.freshRender(e,t);let i=I(n),a=0,o=P(n);for(;o;){if(o.nodeType===8){let e=o.textContent||``;if(e.startsWith(`when-start-`))a++;else if(e===`when-end`){if(a===0)break;a--}}o=o.nextSibling}let s=o,c=!1;if(!s){let e=O(`when-end`);if(!e)return i;n.insertBefore(e,i.nextSibling),s=e,c=!0}let l=fn(this.groups,this.elseContent),u=yn(i.textContent);if(!c&&(u===void 0||u===l)){if(l!==null){let n=l>=0?this.groups[l].content:this.elseContent;for(let r of n)R(e,r,t)}}else if(ve(i,s),l!==null){let n=l>=0?this.groups[l].content:this.elseContent,r=s;nt(()=>{ye(_n(n,e,t,r),r)})}return F(n,s.nextSibling),this.createRuntimeFromMarkers(e,t,i,s,l),i}createRuntimeFromMarkers(e,t,n,r,i=null){let a={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:i,update:function(){pn(a)}};return l&&mn(a),a}};function xn(e){return Object.assign(function(t,n){return e.render(t,n)},{when:function(t,...n){return xn(e.cloneWith({condition:t,content:n}))},else:function(...t){return xn(e.cloneWith(void 0,t))}})}function Sn(e,...t){return xn(new bn(e,...t))}function Cn(e){try{return e.isSvg?wt(e.tagName,e.modifiers):Ct(e.tagName,e.modifiers)}catch(t){if(c(`Error applying modifiers in conditional element "${e.tagName}"`,t),e.isSvg){let n=ue(ce,e.tagName);if(!n)throw Error(`Failed to create SVG element: ${e.tagName}`,{cause:t});return n}let n=le(e.tagName);if(!n)throw Error(`Failed to create element: ${e.tagName}`,{cause:t});return n}}function wn(e){let t=se(e);if(!t)return;let n=ln(t.condition,e=>{c(`Error evaluating conditional condition`,e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){let n=Cn(t);ie(n,t),xe(e,n)}else if(!n&&r){let n=ge(t.tagName);n&&(ie(n,t),xe(e,n))}}function Tn(e){if(l)try{let t=oe();for(let n of t){if(!n.isConnected){ae(n);continue}e&&!e.contains(n)||wn(n)}}catch(e){c(`Error during conditional elements update`,e)}}let W=new Map;function En(e){let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function Dn(e,t){let n=W.get(e);n||(n=new Set,W.set(e,n)),n.add(new WeakRef(t))}function On(e){let t=En(e);if(t.length===0)return[];let n=new Set;for(let e of t){let t=W.get(e);if(!t)continue;let r=[];for(let e of t){let t=e.deref();if(t===void 0){r.push(e);continue}if(!k(t)){r.push(e);continue}n.add(t)}for(let e of r)t.delete(e);t.size===0&&W.delete(e)}return Array.from(n)}function kn(...e){let t=En(e);return function(e){if(l&&e instanceof Element)for(let n of t)Dn(n,e)}}let An=[sn,hn,Tn,Pe,Je,Mn];function jn(...e){let t;if(e.length>0){let n=On(e);if(n.length===1){let e=n[0];t={roots:n,contains:t=>e.contains(t)}}else t={roots:n,contains:e=>{for(let t of n)if(t.contains(e))return!0;return!1}}}for(let e of An)e(t)}function Mn(e){if(typeof document>`u`)return;let t=e?e.roots:[document.body??document];for(let e of t)try{e.dispatchEvent(new Event(`update`,{bubbles:!0}))}catch(e){c(`Error dispatching global update event`,e)}}function Nn(e,t,n=0){let r=t||document.body,i=e(r,n);return r.appendChild(i),i}function Pn(e,t){let n=t||document.body,r=n;et();try{let t=e(n,0),i=t;if(i&&i.nodeType===1&&i.parentNode!==r){let e=P(r);if(e){let t=e.nextSibling;r.insertBefore(i,e),me(e),F(r,t)}else r.appendChild(i),F(r,null)}return t}finally{tt()}}let Fn=null;function In(e){Fn=e}let Ln=new Map,G=new Map,Rn=new Set,zn=[],K=new Map,Bn=0,q=null,J=null,Vn=null,Y=0,X=new Map,Z=null,Hn=!1;function Un(e){for(let t of e)K.has(t)||K.set(t,[])}function Wn(e,t){try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=e.cssRules[n];return X.set(t,r),X.set(Q(r),r),r}catch{return null}}function Q(e){let t=e.cssText,n=t.indexOf(`{`);return(n===-1?t:t.slice(0,n)).trim()}function Gn(e){return e instanceof CSSStyleRule?e.selectorText:Q(e)}function Kn(e,t){return(e===void 0?`-`:`+`+e.length+`:`+e)+t.length+`:`+t}function qn(e,t){if(!Z)return;let n=Kn(t,Gn(e)),r=Z.get(n);r||(r=new Set,Z.set(n,r)),r.add(e.cssText)}function Jn(e,t){if(!Z)return!1;let n=Kn(t,Gn(e)),r=Z.get(n);return r?.delete(e.cssText)?(r.size===0&&Z.delete(n),Z.size===0&&(Z=null),!0):!1}function Yn(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof CSSStyleRule){qn(n,void 0);continue}let r=Q(n);if(`cssRules`in n&&!r.startsWith(`@keyframes`)){let e=n;Hn=!0,X.set(r,e);for(let t=0;t<e.cssRules.length;t++)qn(e.cssRules[t],r)}else qn(n,void 0)}}function Xn(e,t){try{e.insertRule(t,Y);let n=e.cssRules[Y];if(Jn(n,void 0)){e.deleteRule(Y);return}Y++}catch{}}function Zn(e,t){try{let n=e.cssRules.length;e.insertRule(t,n);let r=e.cssRules[n];Jn(r,Q(e))&&e.deleteRule(n)}catch{}}function Qn(e,t){let n=X.get(t);if(n)return n;if(!Hn)return Wn(e,t);try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=Q(e.cssRules[n]);e.deleteRule(n);let i=X.get(r);if(i)return X.set(t,i),i}catch{return null}return Wn(e,t)}function $n(){if(typeof document>`u`||typeof document.getElementById!=`function`)return null;if(J&&Vn===document&&J.ownerNode&&J.ownerNode.isConnected)return J;let e=document.getElementById(`nuclo-styles`),t;if(e?.tagName===`STYLE`?t=e:(t=document.createElement(`style`),t.id=`nuclo-styles`,e?e.replaceWith(t):document.head.appendChild(t)),J=t.sheet,Vn=document,X.clear(),Y=0,Z=null,Hn=!1,!J)return null;if(J.cssRules.length>0){let e=0;for(;e<J.cssRules.length;){let t=J.cssRules[e];if(!(t instanceof CSSStyleRule)&&`cssRules`in t&&!Q(t).startsWith(`@keyframes`))break;e++}Y=e,Z=new Map,Yn(J.cssRules)}for(let e of zn)Xn(J,e);for(let[e,t]of K){let n=Qn(J,e);if(n)for(let e of t)Zn(n,e)}return J}function er(e,t){let n=$n();if(t===void 0)zn.push(e);else{let n=K.get(t);n||(n=[],K.set(t,n)),n.push(e)}if(q=null,n)if(t===void 0)Xn(n,e);else{let r=Qn(n,t);r&&Zn(r,e)}Fn?.(t===void 0?e:t+`{`+e+`}`)}function tr(e){let t=2166136261,n=2128831035;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n^i,2246822507)}return(t>>>0).toString(36)+((n>>>9)%1296).toString(36)}function nr(e,t){return(e===void 0?`-`:`+`+e.length+`:`+e)+t.length+`:`+t}function rr(e,t){return e+t.length+`:`+t}function ir(e,t){let n=``,r=0;for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a===92&&i+1<e.length){n+=e[i]+e[++i];continue}if(r!==0){n+=e[i],a===r&&(r=0);continue}a===34||a===39?(r=a,n+=e[i]):n+=a===38?t:e[i]}return n}function ar(e,t){let n=`.`+e;return n+ir(t,n)}function or(e){if(e.length===0||e===`-`)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n===45||n===95||t>0&&n>=48&&n<=57))return!1}if(e.charCodeAt(0)===45&&e.length>1){let t=e.charCodeAt(1);if(t>=48&&t<=57)return!1}return!0}function sr(e,t,n,r,i=!1){let a=``,o=nr(e,t);for(let[e,t]of n)a+=(a?`;`:``)+e+`:`+t,o=rr(rr(o,e),t);r!==void 0&&!or(r)&&(console.warn(`[nuclo] css() name ${JSON.stringify(r)} is not a valid CSS class name (letters, digits, - and _ only, not starting with a digit); falling back to a generated name.`),r=void 0);let s=r===void 0?`a`+o:`n`+rr(``,r)+o,c=Ln.get(s);return c===void 0?(r===void 0?c=`n`+tr(s):(c=i?r:r+`-`+tr(s),G.has(c)&&console.warn(`[nuclo] css() name ${JSON.stringify(c)} is already used by a different style. Both rules are emitted under the same class, so they will override each other — rename one.`)),Ln.set(s,c),G.set(c,{query:e,suffix:t,decls:n,name:r}),er(ar(c,t)+`{`+a+`}`,e),c):($n(),c)}function cr(e,t,n,r,i=!1){return sr(e,t,n,r,i)}function lr(e,t){let n=G.get(e),r=G.get(t);if(!n||!r)return t;let i=[...n.decls,...r.decls],a=new Map;for(let e=0;e<i.length;e++)a.set(i[e][0],e);let o=i.filter((e,t)=>a.get(e[0])===t);return sr(n.query,n.suffix,o,n.name??r.name)}function ur(e){let t=G.get(e);return t===void 0?void 0:nr(t.query,t.suffix)}function dr(){return Bn}function fr(e,t){if(Rn.has(e)){$n();return}Rn.add(e),er(t,void 0)}function pr(){if(q!==null)return q;let e=zn.join(``);for(let[t,n]of K)n.length>0&&(e+=t+`{`+n.join(``)+`}`);return q=e,e}function mr(){Ln.clear(),G.clear(),Rn.clear(),zn.length=0,K.clear(),X.clear(),q=null,Y=0,J=null,Vn=null,Z=null,Hn=!1,Bn++,typeof document<`u`&&document.getElementById(`nuclo-styles`)?.remove()}let hr={hover:`:hover`,focus:`:focus`,focusVisible:`:focus-visible`,focusWithin:`:focus-within`,active:`:active`,visited:`:visited`,disabled:`:disabled`,enabled:`:enabled`,checked:`:checked`,required:`:required`,invalid:`:invalid`,valid:`:valid`,readOnly:`:read-only`,first:`:first-child`,last:`:last-child`,only:`:only-child`,odd:`:nth-child(odd)`,even:`:nth-child(even)`,empty:`:empty`,placeholderShown:`:placeholder-shown`,placeholder:`::placeholder`,before:`::before`,after:`::after`,selection:`::selection`,marker:`::marker`,firstLine:`::first-line`,firstLetter:`::first-letter`},gr={bg:[`background`],p:[`padding`],px:[`padding-left`,`padding-right`],py:[`padding-top`,`padding-bottom`],pt:[`padding-top`],pr:[`padding-right`],pb:[`padding-bottom`],pl:[`padding-left`],m:[`margin`],mx:[`margin-left`,`margin-right`],my:[`margin-top`,`margin-bottom`],mt:[`margin-top`],mr:[`margin-right`],mb:[`margin-bottom`],ml:[`margin-left`],w:[`width`],h:[`height`],minW:[`min-width`],maxW:[`max-width`],minH:[`min-height`],maxH:[`max-height`],size:[`width`,`height`],text:[`font-size`],font:[`font-family`],weight:[`font-weight`],leading:[`line-height`],tracking:[`letter-spacing`],align:[`text-align`],items:[`align-items`],justify:[`justify-content`],z:[`z-index`],rounded:[`border-radius`],shadow:[`box-shadow`],select:[`user-select`]},_r={row:{display:`flex`,"flex-direction":`row`},col:{display:`flex`,"flex-direction":`column`},center:{"align-items":`center`,"justify-content":`center`},truncate:{overflow:`hidden`,"text-overflow":`ellipsis`,"white-space":`nowrap`}},vr={background:`colors`,"background-color":`colors`,color:`colors`,"border-color":`colors`,"border-top-color":`colors`,"border-right-color":`colors`,"border-bottom-color":`colors`,"border-left-color":`colors`,"outline-color":`colors`,"caret-color":`colors`,"text-decoration-color":`colors`,"font-family":`fonts`,"box-shadow":`shadows`,"border-radius":`radii`},yr=new Set([`z-index`,`opacity`,`font-weight`,`line-height`,`flex`,`flex-grow`,`flex-shrink`,`order`,`aspect-ratio`,`zoom`,`scale`,`column-count`,`orphans`,`widows`,`tab-size`,`animation-iteration-count`,`grid-column`,`grid-row`]),br=new Map;function xr(e){let t=br.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),br.set(e,t)),t}function Sr(e){return e.charCodeAt(0)===64?e:`@media `+e}function Cr(e,t){return e!==void 0&&e.startsWith(`@media`)&&t.startsWith(`@media`)?e+` and`+t.slice(6):t}function wr(e,t){for(let n in t){let r=t[n],i=e[n];typeof r==`object`&&r&&!Array.isArray(r)&&typeof i==`object`&&i&&!Array.isArray(i)?e[n]=wr({...i},r):e[n]=r}return e}function Tr(e){let t={className:e};return Object.defineProperty(t,"toString",{value:()=>e,enumerable:!1}),t}function Er(e,t){let n=ur(t);if(n===void 0){e.set(t,t);return}let r=e.get(n);r===void 0||r===t?e.set(n,t):e.set(n,lr(r,t))}function Dr(e,t){let n=0;for(let r=0;r<=e.length;r++){let i=r===e.length?32:e.charCodeAt(r);(i===32||i===9||i===10||i===12||i===13)&&(r>n&&Er(t,e.slice(n,r)),n=r+1)}}function Or(e,t){for(let n of e)n&&(typeof n==`string`?Dr(n,t):Array.isArray(n)?Or(n,t):Dr(n.className,t))}function kr(...e){let t=new Map;Or(e,t);let n=``;for(let e of t.values())n+=(n?` `:``)+e;return Tr(n)}function Ar(e={}){let t=e.screens??{};Un(Object.values(t).map(Sr));let n=new WeakMap;function r(t,n){if(typeof n==`number`)return n===0||yr.has(t)?String(n):n+`px`;let r=vr[t];if(r!==void 0){let t=e[r]?.[n];if(t!==void 0)return t}return n}function i(e,t,n){let r=(t===void 0?`-`:`+`+t.length+`:`+t)+n.length+`:`+n,i=e.get(r);return i||(i={query:t,suffix:n,decls:[]},e.set(r,i)),i}function a(e,n,o,s){for(let c in e){let l=e[c];if(l==null||l===!1)continue;if(typeof l==`object`){if(c===`raw`){let e=l,t=i(s,n,o).decls;for(let n in e)t.push([n,r(n,e[n])]);continue}let e=hr[c];if(e!==void 0){a(l,n,o+e,s);continue}let u=t[c];if(u!==void 0){a(l,Cr(n,Sr(u)),o,s);continue}let d=c.charCodeAt(0);if(d===38){a(l,n,ir(c,`&`+o).slice(1),s);continue}if(d===64){a(l,Cr(n,c),o,s);continue}continue}if(l===!0){let e=_r[c];if(e){let t=i(s,n,o).decls;for(let n in e)t.push([n,e[n]])}continue}let u=gr[c];if(u!==void 0){let e=i(s,n,o).decls;for(let t of u)e.push([t,r(t,l)])}else{let e=xr(c);i(s,n,o).decls.push([e,r(e,l)])}}}function o(e,t){let r=typeof e==`string`,i=r?t:e,o=r?e:void 0;if(i==null)return Tr(``);let s=dr(),c=n.get(i);if(c!==void 0&&c.epoch===s&&c.name===o)return c.result;let l=new Map;a(i,void 0,``,l);let u=[];for(let e of l.values()){if(e.decls.length===0)continue;let t=e.query===void 0&&e.suffix===``;u.push(cr(e.query,e.suffix,e.decls,o,t))}let d=Tr(u.join(` `));return n.set(i,{epoch:s,name:o,result:d}),d}function s(e){let t=``,n=(e,n)=>{t+=(t?`;`:``)+e+`:`+n};for(let t in e){let i=e[t];if(i==null||i===!1)continue;if(t===`raw`&&typeof i==`object`){let e=i;for(let t in e)n(t,r(t,e[t]));continue}if(typeof i==`object`)continue;if(i===!0){let e=_r[t];if(e)for(let t in e)n(t,e[t]);continue}let a=gr[t];if(a!==void 0)for(let e of a)n(e,r(e,i));else{let e=xr(t);n(e,r(e,i))}}return t}function c(e){let t=``;for(let n in e)t+=n+`{`+s(e[n])+`}`;let n=`nk`+tr(t);return fr(n,`@keyframes `+n+`{`+t+`}`),n}function l(e,t){let n=e+`{`+s(t)+`}`;fr(`g|`+n,n)}function u(e){let t=e=>e===!0?`true`:e===!1?`false`:String(e),n=e.variants??{},r=Object.keys(n),i=e.defaultVariants??{},a=e.base??null,s=(e.compoundVariants??[]).map(e=>{let{css:n,...r}=e,i={};for(let e in r)i[e]=t(r[e]);return{conditions:i,style:n}}),c=new Map;return function(e){let l={};for(let n of r){let r=(e?e[n]:void 0)??i[n];r!=null&&(l[n]=t(r))}let u=``;for(let e of r){let t=l[e];u+=e.length+`:`+e,u+=t===void 0?`-`:`+`+t.length+`:`+t}let d=c.get(u);if(d)return d;let f={};a&&(f=wr(f,a));for(let e of r){let t=l[e];if(t!==void 0){let r=n[e][t];r&&(f=wr(f,r))}}for(let e of s){let t=!0;for(let n in e.conditions)if(l[n]!==e.conditions[n]){t=!1;break}t&&(f=wr(f,e.style))}let p=o(f);return c.set(u,p),p}}return{css:o,cx:kr,variants:u,keyframes:c,globalStyle:l,theme:e}}let jr;function $(){return jr??=Ar({})}let Mr=(e,t)=>typeof e==`string`?$().css(e,t):$().css(e),Nr=e=>$().variants(e),Pr=e=>$().keyframes(e),Fr=(e,t)=>$().globalStyle(e,t);function Ir(){Ft();let e=globalThis;e.list=cn,e.update=jn,e.when=Sn,e.on=ee,e.scope=kn,e.render=Nn,e.hydrate=Pn,e.createCss=Ar,e.css=Mr,e.cx=kr,e.variants=Nr,e.keyframes=Pr,e.globalStyle=Fr}Ir(),e.HTML_TAGS=kt,e.SELF_CLOSING_TAGS=jt,e.SVG_TAGS=At,e.appendChildren=be,e.applyAttributes=Ze,e.applyNodeModifier=R,e.createComment=O,e.createConditionalComment=ge,e.createCss=Ar,e.createHtmlElementWithModifiers=Ct,e.createHtmlTagBuilder=Dt,e.createSvgElementWithModifiers=wt,e.createSvgTagBuilder=Ot,e.css=Mr,e.cx=kr,e.getCssText=pr,e.globalStyle=Fr,e.hydrate=Pn,e.initializeRuntime=Ir,e.isBoolean=a,e.isBrowser=l,e.isFunction=o,e.isNode=n,e.isObject=r,e.isPrimitive=t,e.isTagLike=i,e.isZeroArityFunction=s,e.keyframes=Pr,e.list=cn,e.on=ee,e.registerGlobalTagBuilders=Ft,e.render=Nn,e.replaceNodeSafely=xe,e.resetStyles=mr,e.scope=kn,e.setSSRCollector=In,e.update=jn,e.variants=Nr,e.when=Sn});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Nuclo={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return e===null||typeof e!=`object`&&typeof e!=`function`}function n(e){return e instanceof Node?!0:typeof e!=`object`||!e?!1:typeof e.nodeType==`number`}function r(e){return typeof e==`object`&&!!e}function i(e){return r(e)&&`tagName`in e}function a(e){return typeof e==`boolean`}function o(e){return typeof e==`function`}function s(e){return o(e)&&e.length===0}function c(e,t){typeof console<`u`&&console.error(`nuclo: ${e}`,t)}let l=typeof window<`u`&&typeof document<`u`,u=new WeakMap;function d(e,t){let n=u.get(e);n?Array.isArray(n)?n.includes(t)||n.push(t):n!==t&&u.set(e,[n,t]):u.set(e,t)}function f(e,t){e.removeEventListener(t.type,t.wrapped,t.capture)}function p(e,t){let n=u.get(e);if(!n)return;if(t===void 0){if(Array.isArray(n))for(let t=0;t<n.length;t++)f(e,n[t]);else f(e,n);u.delete(e);return}if(!Array.isArray(n)){n.type===t&&(f(e,n),u.delete(e));return}let r=0;for(let i=0;i<n.length;i++){let a=n[i];a.type===t?f(e,a):n[r++]=a}r===0?u.delete(e):r===1?u.set(e,n[0]):n.length=r}function m(e){}function h(e,t,n){return{type:e,wrapped:function(n){let r=this;try{t.call(r,n)}catch(t){c(`Error in '${e}' listener`,t)}},capture:n}}function ee(e,t,n){if(!l)return m;let r=h(e,t,n===!0||typeof n==`object`&&!!n&&n.capture===!0);return function(t){if(!t||typeof t.addEventListener!=`function`)return;let i=t;i.addEventListener(e,r.wrapped,n),d(i,r)}}let g=new Set,_=new WeakMap,v=new Set,y=new WeakMap;function te(e,t){let n=_.get(e);if(n){n.info.resolver=t.resolver,n.info.lastValue=t.lastValue,n.info.sanitize=t.sanitize;return}let r=new WeakRef(e);g.add(r),_.set(e,{ref:r,info:t})}function b(e,t){let n=new WeakRef(e);v.add(n),y.set(e,{ref:n,info:t})}function x(e){g.delete(e)}function S(e){v.delete(e)}function C(e){let t=_.get(e);t&&(g.delete(t.ref),_.delete(e))}function w(e){let t=y.get(e);t&&(v.delete(t.ref),y.delete(e))}let T=new WeakMap,E=new Set,D=new WeakMap,ne=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{E.delete(e)}):null;function re(e,t){T.set(e,t);let n=new WeakRef(e);E.add(n),D.set(e,n),ne?.register(e,n)}function ie(e){T.delete(e);let t=D.get(e);t&&(E.delete(t),D.delete(e))}function ae(){let e=[],t=[];for(let n of E){let r=n.deref();r===void 0?t.push(n):e.push(r)}for(let e of t)E.delete(e);return e}function oe(e){return T.get(e)??null}let se=`http://www.w3.org/2000/svg`;function ce(e){return globalThis.document?document.createElement(e):null}function le(e,t){return globalThis.document?document.createElementNS(e,t):null}function O(e){return globalThis.document?document.createTextNode(e):null}function ue(){return globalThis.document?document.createDocumentFragment():null}function de(e,t){try{return e.appendChild(t),!0}catch(e){return c(`Failed to append child node`,e),!1}}function fe(e){if(e.nodeType===Node.ELEMENT_NODE){let t=e;p(t),w(t),ie(t)}else e.nodeType===Node.TEXT_NODE?C(e):e.nodeType===Node.COMMENT_NODE&&ie(e);if(e.childNodes&&e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)fe(e.childNodes[t])}function k(e){if(!e?.parentNode)return!1;try{return fe(e),e.parentNode.removeChild(e),!0}catch(e){return c(`Failed to remove child node`,e),!1}}function pe(e,t,n){try{return e.insertBefore(t,n),!0}catch(e){return c(`Failed to insert node before reference`,e),!1}}function A(e){return globalThis.document?globalThis.document.createComment(e):null}function me(e,t=`hidden`){return globalThis.document?globalThis.document.createComment(`conditional-${e}-${t}`):null}function he(e,t){let n=A(`${e}-end`);if(!n)throw Error(`Failed to create comment: document not available`);let r=A(`${e}-start-${t}`);if(!r)throw Error(`Failed to create comment: document not available`);return{start:r,end:n}}function ge(e,t){let n=e.nextSibling;for(;n&&n!==t;){let e=n.nextSibling;k(n),n=e}}function _e(e,t){let n=t.parentNode;if(n)for(let r=0;r<e.length;r++)pe(n,e[r],t)}function ve(e,...t){if(!e)return e;for(let n=0;n<t.length;n++){let r=t[n];if(r!=null){let t;if(typeof r==`string`){let e=O(r);if(e)t=e;else continue}else t=r;de(e,t)}}return e}function j(e){return e?.isConnected===!0}function ye(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return c(`Error replacing conditional node`,e),!1}}function be(e){return e}function xe(e,t,n){let r=be(e),i=r.appendChild.bind(r),a=r.insertBefore.bind(r);r.appendChild=function(e){return a(e,t)};try{return n()}finally{r.appendChild=i}}function Se(e,t,n){try{if(n==null||n===``)return e.style[t]=``,!0;let r=String(n);return e.style[t]=r,!0}catch{return!1}}let Ce={},we=!1;function Te(e){let t=e.target;if(!t||typeof Node>`u`||!(t instanceof Node))return;let n=t;for(;n;){if(n instanceof Element){let e=y.get(n);e&&(j(n)?Ae(e.info):(S(e.ref),y.delete(n)))}n=n.parentNode}}function Ee(){we||typeof document>`u`||typeof document.addEventListener!=`function`||(document.addEventListener(`update`,Te,!0),we=!0)}function De(e){let t=y.get(e);if(t)return t.info;let n={attributeResolvers:[]};return b(e,n),n}function Oe(e){return typeof e!=`object`||!e}function ke(e){let t;try{t=e.resolver()}catch(t){c(`Failed to resolve reactive attribute: ${e.key}`,t);return}let n=Oe(t);if(!(n&&Object.is(t,e.lastValue)))try{e.applyValue(t),e.lastValue=n?t:Ce}catch(t){c(`Failed to apply reactive attribute: ${e.key}`,t)}}function Ae(e){let t=e.attributeResolvers;for(let e=0;e<t.length;e++)ke(t[e])}function je(e,t,n,r){if(!(e instanceof Element)||!t||typeof n!=`function`){c(`Invalid parameters for registerAttributeResolver`);return}let i={key:t,resolver:n,applyValue:r,lastValue:Ce};if(!l){ke(i);return}Ee();let a=De(e).attributeResolvers,o=!1;for(let e=0;e<a.length;e++)if(a[e].key===t){a[e]=i,o=!0;break}o||a.push(i),ke(i)}function Me(e){let t=[];for(let n of v){let r=n.deref();if(r===void 0){t.push(n);continue}let i=y.get(r);if(!i){t.push(n);continue}if(!j(r)){y.delete(r),t.push(n);continue}e&&!e.contains(r)||Ae(i.info)}for(let e of t)S(e)}function Ne(e,t){if(!(!e?.style||!t))for(let n in t)Se(e,n,t[n])||c(`Failed to set style property '${n}'`)}function Pe(e,t){e&&(o(t)?je(e,`style`,t,function(t){Ne(e,t)}):Ne(e,t))}let Fe=new WeakMap;function Ie(e){if(e.length<=2||e.charCodeAt(0)!==111||e.charCodeAt(1)!==110)return null;let t=e.charCodeAt(2);return t<65||t>90?null:e===`onDoubleClick`?`ondblclick`:e.toLowerCase()}function Le(e,t,n){if(t in e){e[t]=n;return}let r=t.slice(2),i=Fe.get(e);if(i){for(let t=0;t<i.length;t+=2){if(i[t]!==r)continue;let a=i[t+1];if(a===n)return;e.removeEventListener(r,a),e.addEventListener(r,n),i[t+1]=n;return}e.addEventListener(r,n),i.push(r,n);return}e.addEventListener(r,n),Fe.set(e,[r,n])}let M=new WeakMap,Re=new WeakSet;function ze(e,t){let n=t.length,r=0;for(let i=0;i<=n;i++)(i===n||t.charCodeAt(i)===32)&&(i>r&&e.add(t.substring(r,i)),r=i+1)}function Be(e){let t=``;for(let n of e)t&&(t+=` `),t+=n;return t}function Ve(e){if(e.className&&!M.has(e)){let t=new Set;ze(t,e.className),M.set(e,t)}Re.add(e)}function He(e){return Re.has(e)}function Ue(e,t){if(!t)return;let n=M.get(e);n||(n=new Set,M.set(e,n)),ze(n,t)}function We(e,t){let n=M.get(e);if(!n||n.size===0){let n=t||``;e.className!==n&&(e.className=n);return}if(!t){e.className=Be(n);return}let r=Be(n),i=t.length,a=0;for(let e=0;e<=i;e++)if(e===i||t.charCodeAt(e)===32){if(e>a){let i=t.substring(a,e);n.has(i)||(r+=` `+i)}a=e+1}e.className=r}function Ge(e,t){if(!t)return;let n=e.className;if(n&&n!==t){let r=new Set;ze(r,n),ze(r,t),e.className=Be(r)}else e.className=t}function Ke(e,t,n){if(typeof e!=`function`){c(`Invalid resolver provided to createReactiveTextNode`);let e=O(``);if(!e)throw Error(`Failed to create text node: document not available`);return e}let r;if(arguments.length>1)r=t;else try{r=e()}catch(e){c(`Failed to evaluate reactive text resolver`,e),r=``}let i=r===void 0?``:String(r),a=O(i);if(!a)throw Error(`Failed to create text node: document not available`);return l&&te(a,{resolver:e,lastValue:i,sanitize:n}),a}function qe(e){let t=[];for(let n of g){let r=n.deref();if(r===void 0){t.push(n);continue}let i=_.get(r);if(!i){t.push(n);continue}let a=i.info;if(!j(r)){_.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;let o;try{o=a.resolver()}catch(e){c(`Failed to update reactive text node`,e),o=void 0}let s=a.sanitize?o==null||typeof o==`object`||typeof o==`function`?``:String(o):o===void 0?``:String(o);s!==a.lastValue&&(r.textContent=s,a.lastValue=s)}for(let e of t)x(e)}function Je(e,t,n,r){if(n!=null){if(r&&t===`className`&&e instanceof HTMLElement){Ge(e,String(n));return}if(e instanceof Element&&e.namespaceURI===`http://www.w3.org/2000/svg`)e.setAttribute(t,String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(t,String(n))}else e instanceof Element&&e.setAttribute(t,String(n))}}function Ye(e,t,n,r=!1){if(n==null)return;let i=t;if(i===`style`){Pe(e,n);return}if(o(n)){if(i===`onClick`){e.onclick=n;return}if(i.charCodeAt(0)===111&&i.charCodeAt(1)===110){let t=Ie(i);if(t){Le(e,t,n);return}if(i in e){e[i]=n;return}}if(n.length===0){let t=n;i===`className`&&e instanceof HTMLElement?(Ve(e),je(e,i,t,function(t){We(e,String(t||``))})):je(e,i,t,function(t){Je(e,i,t,!1)});return}}if(i===`className`&&e instanceof HTMLElement&&He(e)){let t=String(n||``);t&&(Ue(e,t),Ge(e,t));return}Je(e,i,n,r)}function Xe(e,t,n=!0){if(t)for(let r in t){let i=r,a=t[r];Ye(e,i,a,n&&i===`className`)}}let N=!1,Ze=new WeakMap;function P(){return N}function Qe(){return!1}function $e(){N=!0,Ze=new WeakMap}function et(){N=!1}function tt(e){let t=N;N=!1;try{return e()}finally{N=t}}function F(e){let t=Ze.get(e);return t===void 0?e.firstChild:t}function I(e,t){Ze.set(e,t)}function nt(e){return e.nodeType===3&&!/\S/.test(e.textContent||``)}function L(e){let t=F(e),n=!1;for(;t&&nt(t);)t=t.nextSibling,n=!0;n&&I(e,t)}function R(e){let t=F(e);return t&&I(e,t.nextSibling),t}function rt(e,t){if(!N)return null;L(e);let n=F(e);return n&&n.nodeType===1&&n.tagName.toLowerCase()===t?R(e):null}function it(e,t){if(!t)return;let n=F(e);for(;n;){let r=n===t?null:n.nextSibling;e.removeChild(n),n=r}I(e,null)}let z=new WeakMap;function at(e){return r(e)&&!n(e)&&`className`in e&&typeof e.className==`string`&&Object.keys(e).length===1}function ot(e){L(e);let t=F(e);return!!t&&t.nodeType===8&&t.textContent?.trimStart().startsWith(`text-`)===!0}function st(e,t){let n=F(e);if(n&&n.nodeType===3)return R(e),n.textContent!==t&&(n.textContent=t),n;let r=O(t);return r?(e.insertBefore(r,n),I(e,n),r):null}function B(e,i,a){if(i==null)return null;if(o(i)){if(s(i))try{let n=z.get(i);if(n||(n={value:i(),error:!1},z.set(i,n)),n.error)return lt(a,()=>``);let r=n.value;if(at(r))return Xe(e,{className:()=>{let e=i();return at(e)?e.className:``}}),null;if(t(r)){let t=i,n=r??``;if(P()&&ot(e)){let r=e;R(r);let i=String(n),a=st(r,i);return a&&te(a,{resolver:t,lastValue:i,sanitize:!0}),null}return lt(a,t,n,!0)}return null}catch(e){return z.set(i,{value:void 0,error:!0}),c(`Error evaluating reactive text function:`,e),lt(a,()=>``)}let o=i(e,a);return o==null?null:t(o)?ut(a,o):n(o)?o:(r(o)&&Xe(e,o),null)}let l=i;if(t(l)){if(P()&&ot(e)){let t=e;return R(t),st(t,String(l)),null}return ut(a,l)}return n(l)?l:(Xe(e,l),null)}function ct(e,t){if(l&&!P()&&!Qe())return t;let n=ue();if(!n)throw Error(`Failed to create document fragment: document not available`);let r=A(` text-${e} `);return r&&n.appendChild(r),t&&n.appendChild(t),n}function lt(e,t,n,r){return ct(e,Ke(t,n,r))}function ut(e,t){return ct(e,O(String(t)))}let dt=Symbol(`nuclo.factory.tag`),ft=Symbol(`nuclo.factory.mods`),V=0,pt=[],mt=0;function ht(){return mt>=pt.length&&pt.push(()=>null),pt[mt++]}function gt(e,t,n){e[dt]=t,e[ft]=n}function H(e){return typeof e==`function`?e[ft]:void 0}function U(e){return typeof e==`function`?e[dt]:void 0}function _t(){return V>0}function vt(e,t,n){let r=V===0;V++,r&&(mt=0);try{return e(t,n)}finally{V--}}function W(e,t,n=0){if(!t||t.length===0)return;let r=n,i=e;for(let n=0;n<t.length;n+=1){let a=t[n];if(a==null)continue;let o=B(e,a,r);o&&(o.parentNode!==i&&i.appendChild(o),r+=1)}}function yt(e,t){let n=ce(e);if(!n)throw Error(`Failed to create element: ${e}`);return W(n,t,0),n}function bt(e,t){let n=le(se,e);if(!n)throw Error(`Failed to create SVG element: ${e}`);return W(n,t,0),n}function xt(e,t){if(_t()){let n=ht();return gt(n,e,t),n}let n=function(n,r=0){let i=n,a=i?rt(i,e):null,o=a??ce(e);if(!o)throw Error(`Failed to create element: ${e}`);let s=o,c=a?s.lastChild:null;return W(o,t,r),a&&it(s,c),o};return gt(n,e,t),n}function St(e,t){if(_t()){let n=ht();return gt(n,e,t),n}return function(n,r=0){let i=n,a=i?rt(i,e):null,o=a??le(`http://www.w3.org/2000/svg`,e);if(!o)throw Error(`Failed to create SVG element: ${e}`);let s=o,c=a?s.lastChild:null;return W(o,t,r),a&&it(s,c),o}}function Ct(e){return(...t)=>xt(e,t)}function wt(e){return(...t)=>St(e,t)}let Tt=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.link.main.map.mark.menu.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.script.search.section.select.slot.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`),Et=`a.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),Dt=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`];function Ot(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let r=n();return Object.defineProperty(e,t,{value:r,configurable:!0,enumerable:!0,writable:!0}),r},set(n){Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}})}function kt(e,t){t in e&&typeof e[t]!=`function`||(Ot(e,t,()=>Ct(t)),t===`var`&&Ot(e,`var_`,()=>Ct(t)))}function At(e,t){let n=`${t}Svg`;n in e||Ot(e,n,()=>wt(t))}function jt(e=globalThis){let t=`__nuclo_tags_registered`;if(!e[t]){for(let t=0;t<Et.length;t++)At(e,Et[t]);for(let t=0;t<Tt.length;t++)kt(e,Tt[t]);e[t]=!0}}function G(e,t,n){if(o(e)){let r=e(t,n);return r&&i(r)?r:null}return e&&i(e)?e:null}function Mt(e,t){let r=[],i=0;for(let e=0;e<t.length;e++){let a=t[e];if(a==null){r.push({kind:4});continue}let o=typeof a;if(o===`function`){let e=H(a);if(e!==void 0){let t=U(a);if(!t)return null;let n=Mt(t,e);if(!n)return null;r.push({kind:3,child:n});continue}if(a.length===0){let e;try{e=a(),z.set(a,{value:e,error:!1})}catch{return null}if(e==null||typeof e!=`object`&&typeof e!=`function`){r.push({kind:2});continue}return null}return null}if(o===`object`){if(n(a))return null;let e=a,t=Object.keys(e),o=[];for(let n=0;n<t.length;n++){let r=t[n],a=e[r];if(a==null){o.push({key:r,kind:3,prop:!1});continue}if(r===`style`)return null;let s=typeof a;if(s===`function`){let e=Ie(r);if(e){o.push({key:r,kind:1,prop:!1,value:e});continue}if(r===`className`&&a.length===0){if(i++)return null;o.push({key:r,kind:2,prop:!1});continue}return null}if(s===`object`||r===`className`&&i++)return null;o.push({key:r,kind:0,prop:!1,value:a})}r.push({kind:0,keys:o});continue}r.push({kind:1})}return{tag:e,slots:r}}function Nt(e,t){let n=e.slots,r=t.firstChild;for(let e=0;e<n.length;e++){let i=n[e];switch(i.kind){case 0:{let e=i.keys;for(let n=0;n<e.length;n++){let r=e[n];r.kind===0?r.prop=r.key in t:r.kind===2&&(t.className=``)}break}case 1:case 2:r&&=r.nextSibling;break;case 3:if(!r)return;Nt(i.child,r),r=r.nextSibling;break}}}function Pt(e,t,n,r){let i=e.slots;if(t.length!==i.length)return!1;let a=n.firstChild;for(let e=0;e<i.length;e++){let o=i[e],s=t[e];switch(o.kind){case 0:{if(typeof s!=`object`||!s)return!1;let e=s,t=o.keys,i=0;for(let t in e)i++;if(i!==t.length)return!1;for(let i=0;i<t.length;i++){let a=t[i],o=e[a.key];switch(a.kind){case 0:if(o==null||typeof o==`object`||typeof o==`function`)return!1;if(o===a.value)break;if(a.prop){let e=n;e[a.key]!==o&&(e[a.key]=o)}else{let e=String(o);n.getAttribute(a.key)!==e&&n.setAttribute(a.key,e)}break;case 1:{if(typeof o!=`function`)return!1;let e=a.value;e===`onclick`?n.onclick=o:Le(n,e,o);break}case 2:{if(typeof o!=`function`||o.length!==0)return!1;let e=o,t;try{t=e()}catch{return!1}let i=t?String(t):``;i&&(n.className=i),r.push({kind:1,node:n,fn:e,last:i});break}case 3:if(o!=null)return!1;break}}break}case 1:if(s==null||typeof s==`object`||typeof s==`function`||!a)return!1;a.nodeValue=String(s),a=a.nextSibling;break;case 2:{if(typeof s!=`function`||s.length!==0||H(s)!==void 0||!a)return!1;let e;try{e=s()}catch{return!1}if(e!=null&&(typeof e==`object`||typeof e==`function`))return!1;let t=e==null?``:String(e),n=a;n.nodeValue=t,r.push({kind:0,node:n,fn:s,last:t}),a=n.nextSibling;break}case 3:{let e=H(s);if(e===void 0||U(s)!==o.child.tag||!a||!Pt(o.child,e,a,r))return!1;a=a.nextSibling;break}case 4:if(s!=null)return!1;break}}return!0}function Ft(e,t,n,r){let i=e.slots;if(t.length!==i.length)return!1;let a=n.firstChild;for(let e=0;e<i.length;e++){let o=i[e],s=t[e];switch(o.kind){case 0:{if(typeof s!=`object`||!s)return!1;let e=s,t=o.keys,i=0;for(let a in e){if(i>=t.length)return!1;let o=t[i];if(o.key!==a)return!1;i++;let s=e[a];if(o.kind===2){if(typeof s!=`function`||s.length!==0)return!1;w(n),r.push({kind:1,node:n,fn:s,last:n.className})}}if(i!==t.length)return!1;break}case 1:if(!a)return!1;a=a.nextSibling;break;case 2:{if(typeof s!=`function`||s.length!==0||!a||a.nodeType!==3)return!1;let e=a;C(e),r.push({kind:0,node:e,fn:s,last:e.nodeValue??``}),a=e.nextSibling;break}case 3:{let e=H(s);if(e===void 0||U(s)!==o.child.tag||!a||!Ft(o.child,e,a,r))return!1;a=a.nextSibling;break}case 4:if(s!=null)return!1;break}}return!0}function It(e){for(let t=0;t<e.length;t++){let n=e[t],r;try{r=n.fn()}catch{continue}if(n.kind===0){let e=r==null||typeof r==`object`||typeof r==`function`?``:String(r);e!==n.last&&(n.node.nodeValue=e,n.last=e)}else{let e=r?String(r):``;e!==n.last&&(n.node.className=e,n.last=e)}}}function Lt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}let K=new Set,Rt=new WeakMap,zt=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{K.delete(e)}):null,q=0;function Bt(e,t){let n=new WeakRef(e);K.add(n),Rt.set(e,t),zt?.register(e,n)}function Vt(e){return Array.isArray(e)?e:Array.from(e)}function Ht(e){if(typeof e!=`object`||!e)return!1;let t=e.element;return!!t&&typeof Node<`u`&&t instanceof Node}function Ut(e,t,n){let r=e.renderItem(t,n);return Ht(r)?(e.lastRenderRefresh=typeof r.update==`function`?r.update:null,r.element):G(r,e.host,n)}function Wt(e,t,n){e.lastRenderLeaves=null,e.lastRenderRefresh=null;let r=e.template,i=l&&!P()&&!Qe(),a=r&&i?vt(e.renderItem,t,n):e.renderItem(t,n);if(Ht(a))return e.lastRenderRefresh=typeof a.update==`function`?a.update:null,a.element;if(r!==null&&i){let i=H(a);if(i!==void 0){if(r===void 0){let t=U(a),r=t?Mt(t,i):null,o=G(a,e.host,n);if(r&&o){let t=o.cloneNode(!0);Nt(r,t);let n=[];if(Ft(r,i,o,n))n.length>0&&(e.lastRenderLeaves=n);else return e.template=null,e.lastRenderLeaves=null,o;e.template={tmpl:r,skeleton:t}}else e.template=null;return o}let o=r.skeleton.cloneNode(!0),s=[];return Pt(r.tmpl,i,o,s)?(s.length>0&&(e.lastRenderLeaves=s),o):(e.template=null,Ut(e,t,n))}else if(r===void 0)e.template=null;else return e.template=null,Ut(e,t,n)}return G(a,e.host,n)}function J(e){k(e.element)}function Gt(e,t,n,r){if(n.parentNode!==t||r.parentNode!==t)return!1;if(l&&t.firstChild===n&&t.lastChild===r)return t.textContent=``,t.appendChild(n),t.appendChild(r),!0;for(let n=0;n<e.length;n++){let r=e[n].element;r&&r.parentNode===t&&t.removeChild(r)}return!0}function Kt(e){let t=e.length;if(t===0)return[];let n=Array(t),r=[];for(let i=0;i<t;i++){let t=e[i],a=0,o=r.length;for(;a<o;){let n=a+o>>1;e[r[n]]<t?a=n+1:o=n}n[i]=a>0?r[a-1]:-1,a===r.length?r.push(i):r[a]=i}let i=r.length,a=r[i-1],o=Array(i);for(;i>0;)o[--i]=a,a=n[a];return o}function qt(e,t,n,r,i,a,o){let s=ue(),c=0;for(let l=r;l<i;l++){let r=n[l],i=Wt(e,r,l);if(!i)continue;let u=e.lastRenderLeaves;o.push({item:r,element:i,dyn:u,refresh:e.lastRenderRefresh,dynCreatedAt:u?e.currentFlushEpoch:void 0});let d=i;s?(s.appendChild(d),c++):t.insertBefore(d,a)}s&&c>0&&t.insertBefore(s,a)}function Jt(e){let{startMarker:t,endMarker:n}=e,r=t.parentNode??e.host,i=Vt(e.itemsProvider());if(Lt(e.lastSyncedItems,i))return;let a=e.records,o=a.length,s=i.length;if(s===0){if(o>0&&!Gt(a,r,t,n))for(let e=0;e<o;e++)J(a[e]);e.records=[],e.lastSyncedItems=[],e.allRecordsCreatedAt=void 0;return}let c=0,l=Math.min(o,s);for(;c<l&&a[c].item===i[c];)c++;let u=0,d=l-c;for(;u<d&&a[o-1-u].item===i[s-1-u];)u++;let f=c,p=o-u,m=c,h=s-u;if(f===p){let t=p<o?a[p].element:n;if(p===o)qt(e,r,i,m,h,t,a),e.allRecordsCreatedAt=o===0?e.currentFlushEpoch:void 0;else{let n=[];qt(e,r,i,m,h,t,n),e.records=a.slice(0,f).concat(n,a.slice(f)),e.allRecordsCreatedAt=void 0}e.lastSyncedItems=i.slice();return}if(m===h){for(let e=f;e<p;e++)J(a[e]);a.splice(f,p-f),e.allRecordsCreatedAt=void 0,e.lastSyncedItems=i.slice();return}let ee=p-f,g=h-m,_=Array(g).fill(-1),v=new Uint8Array(ee),y=0,te=Math.min(p,h);for(let e=c;e<te;e++)a[e].item===i[e]&&(_[e-m]=e,v[e-f]=1,y++);let b=new Map;for(let e=f;e<p;e++){if(v[e-f])continue;let t=a[e].item,n=b.get(t);n===void 0?b.set(t,e):typeof n==`number`?b.set(t,[n,e]):n.push(e)}for(let e=0;e<g;e++){if(_[e]!==-1)continue;let t=b.get(i[m+e]);if(t===void 0)continue;let n;typeof t==`number`?(n=t,b.delete(i[m+e])):(n=t.shift(),t.length===0&&b.delete(i[m+e])),_[e]=n,v[n-f]=1,y++}if(y===0&&f===0&&p===o){if(!Gt(a,r,t,n))for(let e=0;e<o;e++)J(a[e]);let c=[];qt(e,r,i,0,s,n,c),e.records=c,e.allRecordsCreatedAt=e.currentFlushEpoch,e.lastSyncedItems=i.slice();return}for(let e=f;e<p;e++)v[e-f]||J(a[e]);let x=null;if(y>0){let e=[],t=[];for(let n=0;n<g;n++)_[n]!==-1&&(e.push(_[n]),t.push(n));x=new Uint8Array(g);let n=Kt(e);for(let e=0;e<n.length;e++)x[t[n[e]]]=1}let S=Array(g),C=0,w=p<o?a[p].element:n,T=null;for(let t=g-1;t>=0;t--){let n=_[t];if(n===-1){let n=i[m+t],a=Wt(e,n,m+t);if(!a){S[t]=null,C++;continue}let o=e.lastRenderLeaves;S[t]={item:n,element:a,dyn:o,refresh:e.lastRenderRefresh,dynCreatedAt:o?e.currentFlushEpoch:void 0};let s=a;T||=ue(),T?T.insertBefore(s,T.firstChild):(r.insertBefore(s,w),w=s);continue}let o=a[n];S[t]=o;let s=o.element;if(T&&T.firstChild){let e=T.firstChild;r.insertBefore(T,w),w=e,T=null}(!x||!x[t])&&r.insertBefore(s,w),w=s}T&&T.firstChild&&r.insertBefore(T,w);let E=Array(f+(g-C)+(o-p)),D=0;for(let e=0;e<f;e++)E[D++]=a[e];for(let e=0;e<g;e++){let t=S[e];t&&(E[D++]=t)}for(let e=p;e<o;e++)E[D++]=a[e];e.records=E,e.allRecordsCreatedAt=void 0,e.lastSyncedItems=i.slice()}function Yt(e,t,n,r){return P()?Zt(e,t,n,r):Xt(e,t,n,r)}function Xt(e,t,n,r){let{start:i,end:a}=he(`list`,r),o={itemsProvider:e,renderItem:t,startMarker:i,endMarker:a,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(i),s.appendChild(a),Jt(o),l&&Bt(i,o),o}function Zt(e,t,n,r){let i=n;L(i);let a=F(i);if(!a||a.nodeType!==8||!a.textContent?.startsWith(`list-start-`))return Xt(e,t,n,r);let o=R(i),s=0,c=F(i);for(;c;){if(c.nodeType===8){let e=c.textContent||``;if(e.startsWith(`list-start-`))s++;else if(e===`list-end`){if(s===0)break;s--}}c=c.nextSibling}let u=c;if(!u){let e=A(`list-end`);e&&(i.insertBefore(e,o.nextSibling),u=e)}if(!u)return Xt(e,t,n,r);let d=Vt(e()),f=[];for(let e=0;e<d.length;e++){let r=t(d[e],e),i=Ht(r)?r:null,a=i?i.element:G(r,n,e);a&&f.push({item:d[e],element:a,refresh:i&&typeof i.update==`function`?i.update:void 0})}let p=F(i);for(;p&&p!==u;){let e=p.nextSibling;k(p),p=e}let m=u;for(let e=f.length-1;e>=0;e--){let t=f[e].element;(t.parentNode!==i||t.nextSibling!==m)&&i.insertBefore(t,m),m=t}I(i,u.nextSibling);let h={itemsProvider:e,renderItem:t,startMarker:o,endMarker:u,records:f,host:n,lastSyncedItems:d.slice()};return l&&Bt(o,h),h}function Qt(e){for(let t=0;t<e.records.length;t++){let n=e.records[t];n.element=null,n.item=null,n.dyn=null,n.refresh=null,delete n.dynCreatedAt}e.records=[],e.lastSyncedItems=[],e.allRecordsCreatedAt=void 0}function $t(e){let t=[];q++;for(let n of K){let r=n.deref();if(!r){t.push(n);continue}let i=Rt.get(r);if(!i){t.push(n);continue}if(!j(r)||!j(i.endMarker)){Qt(i),Rt.delete(r),t.push(n);continue}if(e&&!e.contains(r))continue;i.currentFlushEpoch=q;try{Jt(i)}finally{i.currentFlushEpoch=void 0}if(i.allRecordsCreatedAt===q)continue;let a=i.records;for(let e=0;e<a.length;e++){if(a[e].dynCreatedAt===q)continue;let t=a[e].refresh;t&&t();let n=a[e].dyn;n&&It(n)}}for(let e of t)K.delete(e)}function en(e,t){return function(n,r){return Yt(e,t,n,r).startMarker}}function tn(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function nn(e,t){return typeof e==`function`?tn(e,t):!!e}let Y=new Set,rn=new WeakMap,an=typeof FinalizationRegistry<`u`?new FinalizationRegistry(e=>{Y.delete(e)}):null;function on(e,t){for(let t=0;t<e.length;t++)if(nn(e[t].condition))return t;return t.length>0?-1:null}function sn(e){let{groups:t,elseContent:n,host:r,index:i,endMarker:a}=e,o=on(t,n);o!==e.activeIndex&&(ge(e.startMarker,e.endMarker),e.activeIndex=o,o!==null&&_e(dn(o>=0?t[o].content:n,r,i,a),a))}function cn(e){let t=new WeakRef(e.startMarker);Y.add(t),rn.set(e.startMarker,e),an?.register(e.startMarker,t)}function ln(e){let t=[];for(let n of Y){let r=n.deref();if(r===void 0){t.push(n);continue}let i=rn.get(r);if(!i){t.push(n);continue}if(!j(r)||!j(i.endMarker)){rn.delete(r),t.push(n);continue}if(!(e&&!e.contains(r)))try{i.update()}catch(e){c(`when() branch threw during update; unregistering this conditional`,e),rn.delete(r),t.push(n)}}for(let e of t)Y.delete(e)}function un(e,t,n,r){return o(e)?s(e)?(z.delete(e),B(t,e,n)):xe(t,r,()=>{let r=B(t,e,n);return r&&!r.parentNode?r:null}):B(t,e,n)}function dn(e,t,n,r){let i=[];for(let a of e){let e=un(a,t,n,r);e&&i.push(e)}return i}function fn(e,t){return`when-start-${e}-b${t===null?`n`:t}`}function pn(e){let t=/-b(n|-?\d+)$/.exec(e||``);if(t)return t[1]===`n`?null:parseInt(t[1],10)}var mn=class e{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}cloneWith(t,n){let r=Object.create(e.prototype);return r.groups=[...this.groups],t&&r.groups.push(t),r.elseContent=n??[...this.elseContent],r}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){return globalThis.document?P()?this.hydrateRender(e,t):this.freshRender(e,t):null}freshRender(e,t){let{start:n,end:r}=he(`when`,t),i=this.createRuntimeFromMarkers(e,t,n,r),a=be(e);return a.appendChild(n),a.appendChild(r),sn(i),n.textContent=fn(t,i.activeIndex),n}hydrateRender(e,t){let n=e;L(n);let r=F(n);if(!r||r.nodeType!==8||!r.textContent?.startsWith(`when-start-`))return this.freshRender(e,t);let i=R(n),a=0,o=F(n);for(;o;){if(o.nodeType===8){let e=o.textContent||``;if(e.startsWith(`when-start-`))a++;else if(e===`when-end`){if(a===0)break;a--}}o=o.nextSibling}let s=o,c=!1;if(!s){let e=A(`when-end`);if(!e)return i;n.insertBefore(e,i.nextSibling),s=e,c=!0}let l=on(this.groups,this.elseContent),u=pn(i.textContent);if(!c&&(u===void 0||u===l)){if(l!==null){let n=l>=0?this.groups[l].content:this.elseContent;for(let r of n)B(e,r,t)}}else if(ge(i,s),l!==null){let n=l>=0?this.groups[l].content:this.elseContent,r=s;tt(()=>{_e(dn(n,e,t,r),r)})}return I(n,s.nextSibling),this.createRuntimeFromMarkers(e,t,i,s,l),i}createRuntimeFromMarkers(e,t,n,r,i=null){let a={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:i,update:function(){sn(a)}};return l&&cn(a),a}};function hn(e){return Object.assign(function(t,n){return e.render(t,n)},{when:function(t,...n){return hn(e.cloneWith({condition:t,content:n}))},else:function(...t){return hn(e.cloneWith(void 0,t))}})}function gn(e,...t){return hn(new mn(e,...t))}function _n(e){try{return e.isSvg?bt(e.tagName,e.modifiers):yt(e.tagName,e.modifiers)}catch(t){if(c(`Error applying modifiers in conditional element "${e.tagName}"`,t),e.isSvg){let n=le(se,e.tagName);if(!n)throw Error(`Failed to create SVG element: ${e.tagName}`,{cause:t});return n}let n=ce(e.tagName);if(!n)throw Error(`Failed to create element: ${e.tagName}`,{cause:t});return n}}function vn(e){let t=oe(e);if(!t)return;let n=tn(t.condition,e=>{c(`Error evaluating conditional condition`,e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){let n=_n(t);re(n,t),ye(e,n)}else if(!n&&r){let n=me(t.tagName);n&&(re(n,t),ye(e,n))}}function yn(e){if(l)try{let t=ae();for(let n of t){if(!n.isConnected){ie(n);continue}e&&!e.contains(n)||vn(n)}}catch(e){c(`Error during conditional elements update`,e)}}let X=new Map;function bn(e){let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)continue;let e=r.trim();e&&(n.has(e)||(n.add(e),t.push(e)))}return t}function xn(e,t){let n=X.get(e);n||(n=new Set,X.set(e,n)),n.add(new WeakRef(t))}function Sn(e){let t=bn(e);if(t.length===0)return[];let n=new Set;for(let e of t){let t=X.get(e);if(!t)continue;let r=[];for(let e of t){let t=e.deref();if(t===void 0){r.push(e);continue}if(!j(t)){r.push(e);continue}n.add(t)}for(let e of r)t.delete(e);t.size===0&&X.delete(e)}return Array.from(n)}function Cn(...e){let t=bn(e);return function(e){if(l&&e instanceof Element)for(let n of t)xn(n,e)}}let wn=[$t,ln,yn,Me,qe,En];function Tn(...e){let t;if(e.length>0){let n=Sn(e);if(n.length===1){let e=n[0];t={roots:n,contains:t=>e.contains(t)}}else t={roots:n,contains:e=>{for(let t of n)if(t.contains(e))return!0;return!1}}}for(let e of wn)e(t)}function En(e){if(typeof document>`u`)return;let t=e?e.roots:[document.body??document];for(let e of t)try{e.dispatchEvent(new Event(`update`,{bubbles:!0}))}catch(e){c(`Error dispatching global update event`,e)}}function Dn(e,t,n=0){let r=t||document.body,i=e(r,n);return r.appendChild(i),i}function On(e,t){let n=t||document.body,r=n;$e();try{let t=e(n,0),i=t;if(i&&i.nodeType===1&&i.parentNode!==r){let e=F(r);if(e){let t=e.nextSibling;r.insertBefore(i,e),k(e),I(r,t)}else r.appendChild(i),I(r,null)}return t}finally{et()}}function kn(){return{ssrCollector:null,atomCache:new Map,atomMeta:new Map,rawKeys:new Set,baseRules:[],queryRules:new Map,styleEpoch:0,cssTextCache:null,sheet:null,sheetDocument:null,baseRuleCount:0,groupRules:new Map,externalRules:null,hasExternalGroups:!1}}let An=Symbol.for(`nuclo.style.engine.v1`),jn=globalThis,Z=jn[An]??(jn[An]=kn());function Mn(e){Z.ssrCollector=e}function Nn(e){for(let t of e)Z.queryRules.has(t)||Z.queryRules.set(t,[])}function Pn(e,t){try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=e.cssRules[n];return Z.groupRules.set(t,r),Z.groupRules.set(Q(r),r),r}catch{return null}}function Q(e){let t=e.cssText,n=t.indexOf(`{`);return(n===-1?t:t.slice(0,n)).trim()}function Fn(e){return e instanceof CSSStyleRule?e.selectorText:Q(e)}function In(e,t){return(e===void 0?`-`:`+`+e.length+`:`+e)+t.length+`:`+t}function Ln(e,t){if(!Z.externalRules)return;let n=In(t,Fn(e)),r=Z.externalRules.get(n);r||(r=new Set,Z.externalRules.set(n,r)),r.add(e.cssText)}function Rn(e,t){if(!Z.externalRules)return!1;let n=In(t,Fn(e)),r=Z.externalRules.get(n);return r?.delete(e.cssText)?(r.size===0&&Z.externalRules.delete(n),Z.externalRules.size===0&&(Z.externalRules=null),!0):!1}function zn(e){for(let t=0;t<e.length;t++){let n=e[t];if(n instanceof CSSStyleRule){Ln(n,void 0);continue}let r=Q(n);if(`cssRules`in n&&!r.startsWith(`@keyframes`)){let e=n;Z.hasExternalGroups=!0,Z.groupRules.set(r,e);for(let t=0;t<e.cssRules.length;t++)Ln(e.cssRules[t],r)}else Ln(n,void 0)}}function Bn(e,t){try{e.insertRule(t,Z.baseRuleCount);let n=e.cssRules[Z.baseRuleCount];if(Rn(n,void 0)){e.deleteRule(Z.baseRuleCount);return}Z.baseRuleCount++}catch{}}function Vn(e,t){try{let n=e.cssRules.length;e.insertRule(t,n);let r=e.cssRules[n];Rn(r,Q(e))&&e.deleteRule(n)}catch{}}function Hn(e,t){let n=Z.groupRules.get(t);if(n)return n;if(!Z.hasExternalGroups)return Pn(e,t);try{let n=e.cssRules.length;e.insertRule(t+`{}`,n);let r=Q(e.cssRules[n]);e.deleteRule(n);let i=Z.groupRules.get(r);if(i)return Z.groupRules.set(t,i),i}catch{return null}return Pn(e,t)}function Un(){if(typeof document>`u`||typeof document.getElementById!=`function`)return null;if(Z.sheet&&Z.sheetDocument===document&&Z.sheet.ownerNode&&Z.sheet.ownerNode.isConnected)return Z.sheet;let e=document.getElementById(`nuclo-styles`),t;if(e?.tagName===`STYLE`?t=e:(t=document.createElement(`style`),t.id=`nuclo-styles`,e?e.replaceWith(t):document.head.appendChild(t)),Z.sheet=t.sheet,Z.sheetDocument=document,Z.groupRules.clear(),Z.baseRuleCount=0,Z.externalRules=null,Z.hasExternalGroups=!1,!Z.sheet)return null;if(Z.sheet.cssRules.length>0){let e=0;for(;e<Z.sheet.cssRules.length;){let t=Z.sheet.cssRules[e];if(!(t instanceof CSSStyleRule)&&`cssRules`in t&&!Q(t).startsWith(`@keyframes`))break;e++}Z.baseRuleCount=e,Z.externalRules=new Map,zn(Z.sheet.cssRules)}for(let e of Z.baseRules)Bn(Z.sheet,e);for(let[e,t]of Z.queryRules){let n=Hn(Z.sheet,e);if(n)for(let e of t)Vn(n,e)}return Z.sheet}function Wn(e,t){let n=Un();if(t===void 0)Z.baseRules.push(e);else{let n=Z.queryRules.get(t);n||(n=[],Z.queryRules.set(t,n)),n.push(e)}if(Z.cssTextCache=null,n)if(t===void 0)Bn(n,e);else{let r=Hn(n,t);r&&Vn(r,e)}Z.ssrCollector?.(t===void 0?e:t+`{`+e+`}`)}function Gn(e){let t=2166136261,n=2128831035;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n^i,2246822507)}return(t>>>0).toString(36)+((n>>>9)%1296).toString(36)}function Kn(e,t){return(e===void 0?`-`:`+`+e.length+`:`+e)+t.length+`:`+t}function qn(e,t){return e+t.length+`:`+t}function Jn(e,t){let n=``,r=0;for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a===92&&i+1<e.length){n+=e[i]+e[++i];continue}if(r!==0){n+=e[i],a===r&&(r=0);continue}a===34||a===39?(r=a,n+=e[i]):n+=a===38?t:e[i]}return n}function Yn(e,t){let n=`.`+e;return n+Jn(t,n)}function Xn(e){if(e.length===0||e===`-`)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n===45||n===95||t>0&&n>=48&&n<=57))return!1}if(e.charCodeAt(0)===45&&e.length>1){let t=e.charCodeAt(1);if(t>=48&&t<=57)return!1}return!0}function Zn(e,t,n,r,i=!1){let a=``,o=Kn(e,t);for(let[e,t]of n)a+=(a?`;`:``)+e+`:`+t,o=qn(qn(o,e),t);r!==void 0&&!Xn(r)&&(console.warn(`[nuclo] css() name ${JSON.stringify(r)} is not a valid CSS class name (letters, digits, - and _ only, not starting with a digit); falling back to a generated name.`),r=void 0);let s=r===void 0?`a`+o:`n`+qn(``,r)+o,c=Z.atomCache.get(s);return c===void 0?(r===void 0?c=`n`+Gn(s):(c=i?r:r+`-`+Gn(s),Z.atomMeta.has(c)&&console.warn(`[nuclo] css() name ${JSON.stringify(c)} is already used by a different style. Both rules are emitted under the same class, so they will override each other — rename one.`)),Z.atomCache.set(s,c),Z.atomMeta.set(c,{query:e,suffix:t,decls:n,name:r}),Wn(Yn(c,t)+`{`+a+`}`,e),c):(Un(),c)}function Qn(e,t,n,r,i=!1){return Zn(e,t,n,r,i)}function $n(e,t){let n=Z.atomMeta.get(e),r=Z.atomMeta.get(t);if(!n||!r)return t;let i=[...n.decls,...r.decls],a=new Map;for(let e=0;e<i.length;e++)a.set(i[e][0],e);let o=i.filter((e,t)=>a.get(e[0])===t);return Zn(n.query,n.suffix,o,n.name??r.name)}function er(e){let t=Z.atomMeta.get(e);return t===void 0?void 0:Kn(t.query,t.suffix)}function tr(){return Z.styleEpoch}function nr(e,t){if(Z.rawKeys.has(e)){Un();return}Z.rawKeys.add(e),Wn(t,void 0)}function rr(){if(Z.cssTextCache!==null)return Z.cssTextCache;let e=Z.baseRules.join(``);for(let[t,n]of Z.queryRules)n.length>0&&(e+=t+`{`+n.join(``)+`}`);return Z.cssTextCache=e,e}function ir(){Z.atomCache.clear(),Z.atomMeta.clear(),Z.rawKeys.clear(),Z.baseRules.length=0,Z.queryRules.clear(),Z.groupRules.clear(),Z.cssTextCache=null,Z.baseRuleCount=0,Z.sheet=null,Z.sheetDocument=null,Z.externalRules=null,Z.hasExternalGroups=!1,Z.styleEpoch++,typeof document<`u`&&document.getElementById(`nuclo-styles`)?.remove()}let ar={hover:`:hover`,focus:`:focus`,focusVisible:`:focus-visible`,focusWithin:`:focus-within`,active:`:active`,visited:`:visited`,disabled:`:disabled`,enabled:`:enabled`,checked:`:checked`,required:`:required`,invalid:`:invalid`,valid:`:valid`,readOnly:`:read-only`,first:`:first-child`,last:`:last-child`,only:`:only-child`,odd:`:nth-child(odd)`,even:`:nth-child(even)`,empty:`:empty`,placeholderShown:`:placeholder-shown`,placeholder:`::placeholder`,before:`::before`,after:`::after`,selection:`::selection`,marker:`::marker`,firstLine:`::first-line`,firstLetter:`::first-letter`},or={bg:[`background`],p:[`padding`],px:[`padding-left`,`padding-right`],py:[`padding-top`,`padding-bottom`],pt:[`padding-top`],pr:[`padding-right`],pb:[`padding-bottom`],pl:[`padding-left`],m:[`margin`],mx:[`margin-left`,`margin-right`],my:[`margin-top`,`margin-bottom`],mt:[`margin-top`],mr:[`margin-right`],mb:[`margin-bottom`],ml:[`margin-left`],w:[`width`],h:[`height`],minW:[`min-width`],maxW:[`max-width`],minH:[`min-height`],maxH:[`max-height`],size:[`width`,`height`],text:[`font-size`],font:[`font-family`],weight:[`font-weight`],leading:[`line-height`],tracking:[`letter-spacing`],align:[`text-align`],items:[`align-items`],justify:[`justify-content`],z:[`z-index`],rounded:[`border-radius`],shadow:[`box-shadow`],select:[`user-select`]},sr={row:{display:`flex`,"flex-direction":`row`},col:{display:`flex`,"flex-direction":`column`},center:{"align-items":`center`,"justify-content":`center`},truncate:{overflow:`hidden`,"text-overflow":`ellipsis`,"white-space":`nowrap`}},cr={background:`colors`,"background-color":`colors`,color:`colors`,"border-color":`colors`,"border-top-color":`colors`,"border-right-color":`colors`,"border-bottom-color":`colors`,"border-left-color":`colors`,"outline-color":`colors`,"caret-color":`colors`,"text-decoration-color":`colors`,"font-family":`fonts`,"box-shadow":`shadows`,"border-radius":`radii`},lr=new Set([`z-index`,`opacity`,`font-weight`,`line-height`,`flex`,`flex-grow`,`flex-shrink`,`order`,`aspect-ratio`,`zoom`,`scale`,`column-count`,`orphans`,`widows`,`tab-size`,`animation-iteration-count`,`grid-column`,`grid-row`]),ur=new Map;function dr(e){let t=ur.get(e);return t===void 0&&(t=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),ur.set(e,t)),t}function fr(e){return e.charCodeAt(0)===64?e:`@media `+e}function pr(e,t){return e!==void 0&&e.startsWith(`@media`)&&t.startsWith(`@media`)?e+` and`+t.slice(6):t}function mr(e,t){for(let n in t){let r=t[n],i=e[n];typeof r==`object`&&r&&!Array.isArray(r)&&typeof i==`object`&&i&&!Array.isArray(i)?e[n]=mr({...i},r):e[n]=r}return e}function hr(e){let t={className:e};return Object.defineProperty(t,"toString",{value:()=>e,enumerable:!1}),t}function gr(e,t){let n=er(t);if(n===void 0){e.set(t,t);return}let r=e.get(n);r===void 0||r===t?e.set(n,t):e.set(n,$n(r,t))}function _r(e,t){let n=0;for(let r=0;r<=e.length;r++){let i=r===e.length?32:e.charCodeAt(r);(i===32||i===9||i===10||i===12||i===13)&&(r>n&&gr(t,e.slice(n,r)),n=r+1)}}function vr(e,t){for(let n of e)n&&(typeof n==`string`?_r(n,t):Array.isArray(n)?vr(n,t):_r(n.className,t))}function yr(...e){let t=new Map;vr(e,t);let n=``;for(let e of t.values())n+=(n?` `:``)+e;return hr(n)}function br(e={}){let t=e.screens??{};Nn(Object.values(t).map(fr));let n=new WeakMap;function r(t,n){if(typeof n==`number`)return n===0||lr.has(t)?String(n):n+`px`;let r=cr[t];if(r!==void 0){let t=e[r]?.[n];if(t!==void 0)return t}return n}function i(e,t,n){let r=(t===void 0?`-`:`+`+t.length+`:`+t)+n.length+`:`+n,i=e.get(r);return i||(i={query:t,suffix:n,decls:[]},e.set(r,i)),i}function a(e,n,o,s){for(let c in e){let l=e[c];if(l==null||l===!1)continue;if(typeof l==`object`){if(c===`raw`){let e=l,t=i(s,n,o).decls;for(let n in e)t.push([n,r(n,e[n])]);continue}let e=ar[c];if(e!==void 0){a(l,n,o+e,s);continue}let u=t[c];if(u!==void 0){a(l,pr(n,fr(u)),o,s);continue}let d=c.charCodeAt(0);if(d===38){a(l,n,Jn(c,`&`+o).slice(1),s);continue}if(d===64){a(l,pr(n,c),o,s);continue}continue}if(l===!0){let e=sr[c];if(e){let t=i(s,n,o).decls;for(let n in e)t.push([n,e[n]])}continue}let u=or[c];if(u!==void 0){let e=i(s,n,o).decls;for(let t of u)e.push([t,r(t,l)])}else{let e=dr(c);i(s,n,o).decls.push([e,r(e,l)])}}}function o(e,t){let r=typeof e==`string`,i=r?t:e,o=r?e:void 0;if(i==null)return hr(``);let s=tr(),c=n.get(i);if(c!==void 0&&c.epoch===s&&c.name===o)return c.result;let l=new Map;a(i,void 0,``,l);let u=[];for(let e of l.values()){if(e.decls.length===0)continue;let t=e.query===void 0&&e.suffix===``;u.push(Qn(e.query,e.suffix,e.decls,o,t))}let d=hr(u.join(` `));return n.set(i,{epoch:s,name:o,result:d}),d}function s(e){let t=``,n=(e,n)=>{t+=(t?`;`:``)+e+`:`+n};for(let t in e){let i=e[t];if(i==null||i===!1)continue;if(t===`raw`&&typeof i==`object`){let e=i;for(let t in e)n(t,r(t,e[t]));continue}if(typeof i==`object`)continue;if(i===!0){let e=sr[t];if(e)for(let t in e)n(t,e[t]);continue}let a=or[t];if(a!==void 0)for(let e of a)n(e,r(e,i));else{let e=dr(t);n(e,r(e,i))}}return t}function c(e){let t=``;for(let n in e)t+=n+`{`+s(e[n])+`}`;let n=`nk`+Gn(t);return nr(n,`@keyframes `+n+`{`+t+`}`),n}function l(e,t){let n=e+`{`+s(t)+`}`;nr(`g|`+n,n)}function u(e){let t=e=>e===!0?`true`:e===!1?`false`:String(e),n=e.variants??{},r=Object.keys(n),i=e.defaultVariants??{},a=e.base??null,s=(e.compoundVariants??[]).map(e=>{let{css:n,...r}=e,i={};for(let e in r)i[e]=t(r[e]);return{conditions:i,style:n}}),c=new Map;return function(e){let l={};for(let n of r){let r=(e?e[n]:void 0)??i[n];r!=null&&(l[n]=t(r))}let u=``;for(let e of r){let t=l[e];u+=e.length+`:`+e,u+=t===void 0?`-`:`+`+t.length+`:`+t}let d=c.get(u);if(d)return d;let f={};a&&(f=mr(f,a));for(let e of r){let t=l[e];if(t!==void 0){let r=n[e][t];r&&(f=mr(f,r))}}for(let e of s){let t=!0;for(let n in e.conditions)if(l[n]!==e.conditions[n]){t=!1;break}t&&(f=mr(f,e.style))}let p=o(f);return c.set(u,p),p}}return{css:o,cx:yr,variants:u,keyframes:c,globalStyle:l,theme:e}}let xr;function $(){return xr??=br({})}let Sr=(e,t)=>typeof e==`string`?$().css(e,t):$().css(e),Cr=e=>$().variants(e),wr=e=>$().keyframes(e),Tr=(e,t)=>$().globalStyle(e,t);function Er(){jt();let e=globalThis;e.list=en,e.update=Tn,e.when=gn,e.on=ee,e.scope=Cn,e.render=Dn,e.hydrate=On,e.createCss=br,e.css=Sr,e.cx=yr,e.variants=Cr,e.keyframes=wr,e.globalStyle=Tr}Er(),e.HTML_TAGS=Tt,e.SELF_CLOSING_TAGS=Dt,e.SVG_TAGS=Et,e.appendChildren=ve,e.applyAttributes=Xe,e.applyNodeModifier=B,e.createComment=A,e.createConditionalComment=me,e.createCss=br,e.createHtmlElementWithModifiers=yt,e.createHtmlTagBuilder=Ct,e.createSvgElementWithModifiers=bt,e.createSvgTagBuilder=wt,e.css=Sr,e.cx=yr,e.getCssText=rr,e.globalStyle=Tr,e.hydrate=On,e.initializeRuntime=Er,e.isBoolean=a,e.isBrowser=l,e.isFunction=o,e.isNode=n,e.isObject=r,e.isPrimitive=t,e.isTagLike=i,e.isZeroArityFunction=s,e.keyframes=wr,e.list=en,e.on=ee,e.registerGlobalTagBuilders=jt,e.render=Dn,e.replaceNodeSafely=ye,e.resetStyles=ir,e.scope=Cn,e.setSSRCollector=Mn,e.update=Tn,e.variants=Cr,e.when=gn});
2
2
  //# sourceMappingURL=nuclo.umd.js.map