nuclo 0.1.49 → 0.1.51

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){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Nuclo={})}(this,function(e){"use strict";function t(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function n(e){return e instanceof Node}function r(e){return"object"==typeof e&&null!==e}function o(e){return r(e)&&"tagName"in e}function i(e){return"function"==typeof e}function s(e){return i(e)&&0===e.length}function c(e,t){"undefined"!=typeof console&&console.error(`nuclo: ${e}`,t)}function a(e,t){try{return e()}catch(e){return c("Operation failed",e),t}}const l="undefined"!=typeof window&&"undefined"!=typeof document;function u(e){if(!e?.parentNode)return!1;try{return e.parentNode.removeChild(e),!0}catch(e){return c("Failed to remove child node",e),!1}}function d(e){if(!l)return null;try{return document.createComment(e)}catch(e){return c("Failed to create comment node",e),null}}function f(e){return d(e)}function h(e,t="hidden"){try{return document.createComment(`conditional-${e}-${t}`)}catch(e){return c("Failed to create conditional comment",e),null}}function p(e){if(!l)throw new Error("Cannot create comment in non-browser environment");const t=d(`${e}-${Math.random().toString(36).slice(2)}`);if(!t)throw new Error("Failed to create comment");return t}function m(e){const t=d(`${e}-end`);if(!t)throw new Error("Failed to create end comment");return{start:p(`${e}-start`),end:t}}function g(e,t){const n=t.parentNode;n&&e.forEach(e=>function(e,t,n){if(!e||!t)return!1;try{return e.insertBefore(t,n),!0}catch(e){return c("Failed to insert node before reference",e),!1}}(n,e,t))}function y(e){return!!e&&("boolean"==typeof e.isConnected?e.isConnected:!(!l||"undefined"==typeof document)&&document.contains(e))}function b(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}}const C=new Map,w=new Map;function x(e,t){t.attributeResolvers.forEach(({resolver:e,applyValue:t},n)=>{try{t(a(e))}catch(e){c(`Failed to update reactive attribute: ${n}`,e)}})}function v(e,t,n,r){if(!(e instanceof Element&&t&&"function"==typeof n))return void c("Invalid parameters for registerAttributeResolver");const o=function(e){let t=w.get(e);return t||(t={attributeResolvers:new Map},w.set(e,t)),t}(e);o.attributeResolvers.set(t,{resolver:n,applyValue:r});try{r(a(n))}catch(e){c("Failed to apply initial attribute value",e)}if(!o.updateListener){const t=()=>x(0,o);e.addEventListener("update",t),o.updateListener=t}}function S(e,t,n){try{if(null==n||""===n)return e.style[t]="",!0;const r=String(n);return e.style[t]=r,!0}catch{return!1}}function E(e,t){if(e?.style&&t)for(const[n,r]of Object.entries(t)){S(e,n,r)||c(`Failed to set style property '${n}'`)}}function N(e,t,n,r=!1){if(null==n)return;if("style"===t)return s=n,void((o=e)&&(i(s)?v(o,"style",()=>{try{return s()}catch(e){return c("Error in style resolver function",e),null}},e=>{E(o,e)}):E(o,s)));var o,s;const a=(n,r=!1)=>{if(null==n)return;if("className"===t&&e instanceof HTMLElement&&r){const t=String(n),r=e.className;if(r&&r!==t){const n=new Set(r.split(" ").filter(e=>e));t.split(" ").filter(e=>e).forEach(e=>n.add(e)),e.className=Array.from(n).join(" ")}else t&&(e.className=t);return}if(e instanceof Element&&"http://www.w3.org/2000/svg"===e.namespaceURI)e.setAttribute(String(t),String(n));else if(t in e)try{e[t]=n}catch{e instanceof Element&&e.setAttribute(String(t),String(n))}else e instanceof Element&&e.setAttribute(String(t),String(n))};if(i(n)&&0===n.length){const r=n;v(e,String(t),r,e=>a(e,!1))}else a(n,r)}function M(e,t,n=!0){if(t)for(const r of Object.keys(t)){N(e,r,t[r],n&&"className"===r)}}const $=new WeakMap;function k(e){const{value:t,error:n}=function(e){const t=$.get(e);if(t)return t;try{const t={value:e(),error:!1};return $.set(e,t),t}catch{const t={value:void 0,error:!0};return $.set(e,t),t}}(e);return!n&&"boolean"==typeof t}function T(e,t,o){if(!i(e)||0!==e.length)return!1;if(!k(e))return!1;const s=t.filter((e,t)=>t!==o);if(0===s.length)return!1;return s.some(e=>!(!r(e)&&!n(e))||!!(i(e)&&e.length>0))}function R(e,o,a){if(null==o)return null;if(i(o)){if(s(o))try{let e=$.get(o);if(!e){e={value:o(),error:!1},$.set(o,e)}if(e.error)return j(a,()=>"");const n=e.value;return t(n)&&null!=n?j(a,o,n):null}catch(e){return $.set(o,{value:void 0,error:!0}),c("Error evaluating reactive text function:",e),j(a,()=>"")}const i=o(e,a);return null==i?null:t(i)?F(a,i):n(i)?i:(r(i)&&M(e,i),null)}const l=o;return null==l?null:t(l)?F(a,l):n(l)?l:(r(l)&&M(e,l),null)}function j(e,t,n){const r=document.createDocumentFragment(),o=f(` text-${e} `);o&&r.appendChild(o);const i=function(e,t){if("function"!=typeof e)return c("Invalid resolver provided to createReactiveTextNode"),document.createTextNode("");const n=arguments.length>1?t:a(e,""),r=void 0===n?"":String(n),o=document.createTextNode(r);return C.set(o,{resolver:e,lastValue:r}),o}(t,n);return r.appendChild(i),r}function F(e,t){const n=document.createDocumentFragment(),r=f(` text-${e} `);r&&n.appendChild(r);const o=document.createTextNode(String(t));return n.appendChild(o),n}const I=new Set;function L(e,t){e._conditionalInfo=t,I.add(e)}function A(e,t,n=0){if(!t||0===t.length)return{element:e,nextIndex:n,appended:0};let r=n,o=0;const i=e;for(let n=0;n<t.length;n+=1){const s=t[n];if(null==s)continue;const c=R(e,s,r);c&&(c.parentNode!==i&&i.appendChild(c),r+=1,o+=1)}return{element:e,nextIndex:r,appended:o}}function D(e,t){const n=document.createElement(e);return A(n,t,0),n}function O(e){const t=function(e){for(let t=0;t<e.length;t+=1)if(T(e[t],e,t))return t;return-1}(e);return-1===t?{condition:null,otherModifiers:e}:{condition:e[t],otherModifiers:e.filter((e,n)=>n!==t)}}function B(e){return function(e){return P.includes(e)}(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function _(e,...t){return(n,r)=>{const{condition:o,otherModifiers:i}=O(t);if(o)return function(e,t,n){const r=t();if(!l)return r?D(e,n):h(e,"ssr");const o={condition:t,tagName:e,modifiers:n};if(r){const t=D(e,n);return L(t,o),t}const i=h(e);if(!i)throw new Error(`Failed to create conditional comment for ${e}`);return L(i,o),i}(e,o,i);const s=B(e);return A(s,i,r),s}}function G(e){return(...t)=>_(e,...t)}const z=["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"],P=["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"];function V(e=globalThis){const t="__nuclo_tags_registered";e[t]||(P.forEach(t=>function(e,t){let n=t;["a","script","style","title","text"].includes(t)?n=`${t}_svg`:["stop"].includes(t)&&(n=`${t}_`),n in e||(e[n]=G(t))}(e,t)),z.forEach(t=>function(e,t){t in e&&"function"!=typeof e[t]||(e[t]=G(t))}(e,t)),e[t]=!0)}const q=new Set;function W(e,t,n){return function(e,t,n){if(i(e)){const r=e(t,n);return r&&o(r)?r:null}return e&&o(e)?e:null}(e.renderItem(t,n),e.host,n)}function H(e){u(e.element)}function Z(e){const{host:t,startMarker:n,endMarker:r}=e,o=n.parentNode??t,i=e.itemsProvider();if(function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if((n in e?e[n]:void 0)!==(n in t?t[n]:void 0))return!1;return!0}(e.lastSyncedItems,i))return;const s=new Map,c=new Map;e.records.forEach(e=>{const t=c.get(e.item);t?t.push(e):c.set(e.item,[e])}),i.forEach((t,n)=>{if(n<e.lastSyncedItems.length&&e.lastSyncedItems[n]===t){const r=e.records[n];if(r&&r.item===t){s.set(n,r);const e=c.get(t);if(e){const n=e.indexOf(r);n>=0&&(e.splice(n,1),0===e.length&&c.delete(t))}}}});const a=[],l=new Set(e.records);let u=r;for(let t=i.length-1;t>=0;t--){const n=i[t];let r=s.get(t);if(!r){const e=c.get(n);e&&e.length>0&&(r=e.shift(),0===e.length&&c.delete(n))}if(r)l.delete(r);else{const o=W(e,n,t);if(!o)continue;r={item:n,element:o}}a.unshift(r);const d=r.element;d.nextSibling!==u&&o.insertBefore(d,u),u=d}l.forEach(H),e.records=a,e.lastSyncedItems=[...i]}function U(e,t){return(n,r)=>{const o=function(e,t,n){const{start:r,end:o}=m("list"),i={itemsProvider:e,renderItem:t,startMarker:r,endMarker:o,records:[],host:n,lastSyncedItems:[]},s=n;return s.appendChild(r),s.appendChild(o),q.add(i),Z(i),i}(e,t,n);return o.startMarker}}function J(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function K(e,t){return"function"==typeof e?J(e,t):Boolean(e)}const Q=new Set;function X(e,t,n,r){return i(e)?s(e)?($.delete(e),R(t,e,n)):function(e,t,n){const r=e,o=r.appendChild.bind(r),i=r.insertBefore.bind(r);r.appendChild=function(e){return i(e,t)};try{return n()}finally{r.appendChild=o}}(t,r,()=>{const r=R(t,e,n);return r&&!r.parentNode?r:null}):R(t,e,n)}function Y(e){const{groups:t,elseContent:n,host:r,index:o,endMarker:i}=e,s=function(e,t){for(let t=0;t<e.length;t++)if(K(e[t].condition))return t;return t.length>0?-1:null}(t,n);if(s===e.activeIndex)return;if(function(e,t){let n=e.nextSibling;for(;n&&n!==t;){const e=n.nextSibling;u(n),n=e}}(e.startMarker,e.endMarker),e.activeIndex=s,null===s)return;const c=function(e,t,n,r){const o=[];for(const i of e){const e=X(i,t,n,r);e&&o.push(e)}return o}(s>=0?t[s].content:n,r,o,i);g(c,i)}class ee{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){if(!l){return f("when-ssr")||null}const{start:n,end:r}=m("when"),o={startMarker:n,endMarker:r,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>Y(o)};Q.add(o);const i=e;return i.appendChild(n),i.appendChild(r),Y(o),n}}function te(e){return Object.assign((t,n)=>e.render(t,n),{when:(t,...n)=>(e.when(t,...n),te(e)),else:(...t)=>(e.else(...t),te(e))})}function ne(e,...t){return te(new ee(e,...t))}function re(e){const t=function(e){return e._conditionalInfo??null}(e);if(!t)return;const n=J(t.condition,e=>{c("Error evaluating conditional condition",e)}),r=e.nodeType===Node.ELEMENT_NODE;if(n&&!r){const n=function(e){try{return D(e.tagName,e.modifiers)}catch(t){return c(`Error applying modifiers in conditional element "${e.tagName}"`,t),document.createElement(e.tagName)}}(t);L(n,t),b(e,n)}else if(!n&&r){const n=h(t.tagName);n&&(L(n,t),b(e,n))}}const oe=[function(){q.forEach(e=>{e.startMarker.isConnected&&e.endMarker.isConnected?Z(e):q.delete(e)})},function(){Q.forEach(e=>{try{e.update()}catch(t){Q.delete(e)}})},function(){if(l)try{I.forEach(e=>{e.isConnected?re(e):function(e){I.delete(e)}(e)})}catch(e){c("Error during conditional elements update",e)}},function(){w.forEach((e,t)=>{if(!y(t))return e.updateListener&&t.removeEventListener("update",e.updateListener),void w.delete(t);x(0,e)})},function(){C.forEach((e,t)=>{if(y(t))try{const n=a(e.resolver),r=void 0===n?"":String(n);r!==e.lastValue&&(t.textContent=r,e.lastValue=r)}catch(e){c("Failed to update reactive text node",e)}else C.delete(t)})},function(){if("undefined"==typeof document)return;const e=document.body?[document.body,document]:[document];for(const t of e)try{t.dispatchEvent(new Event("update",{bubbles:!0}))}catch(e){c("Error dispatching global update event",e)}}];function ie(){for(const e of oe)e()}function se(e,t,n){return r=>{if(!r||"function"!=typeof r.addEventListener)return;const o=r;o.addEventListener(e,n=>{try{t.call(o,n)}catch(t){c(`Error in '${e}' listener`,t)}},n)}}function ce(e,t,n=0){const r=e(t||document.body,n);return(t||document.body).appendChild(r),r}const ae=new Map;function le(e,t,n){let r=document.querySelector("#nuclo-styles");r||(r=document.createElement("style"),r.id="nuclo-styles",document.head.appendChild(r));Array.from(r.sheet?.cssRules||[]).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)||r.sheet?.insertRule(`.${e} { ${t}: ${n}; }`,r.sheet.cssRules.length)}function ue(e,t,n,r){let o=document.querySelector("#nuclo-styles");o||(o=document.createElement("style"),o.id="nuclo-styles",document.head.appendChild(o));const i=Array.from(o.sheet?.cssRules||[]);let s=null;for(const e of i)if(e instanceof CSSMediaRule&&e.media.mediaText===r){s=e;break}if(!s){const e=o.sheet?.cssRules.length||0;o.sheet?.insertRule(`@media ${r} {}`,e),s=o.sheet?.cssRules[e]}Array.from(s.cssRules).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)||s.insertRule(`.${e} { ${t}: ${n}; }`,s.cssRules.length)}class de{classNames=[];classDefinitions=[];getClassNames(){return[...this.classNames]}getClassDefinitions(){return[...this.classDefinitions]}toString(){return this.classNames.join(" ")}addClass(e,t){const n=function(e,t){const n=`${e}:${t}`;if(ae.has(n))return ae.get(n);let r;const o={"background-color":"bg",color:"text","font-size":"text",display:"display",flex:"flex","justify-content":"justify","align-items":"items","font-weight":"font",padding:"p",margin:"m",width:"w",height:"h",border:"border","border-radius":"rounded","text-align":"text",gap:"gap","flex-direction":"flex",position:"position",opacity:"opacity",cursor:"cursor","box-shadow":"shadow",transition:"transition","text-decoration":"underline","letter-spacing":"tracking","min-width":"min-w","max-width":"max-w","min-height":"min-h","accent-color":"accent","line-height":"leading","font-family":"font",outline:"outline"}[e]||e.replace(/-/g,"-"),i=function(e){return(e=(e=(e=e.replace(/^#/,"")).replace(/[^a-zA-Z0-9]/g,"-")).replace(/^-+|-+$/g,"").replace(/-+/g,"-")).toLowerCase()}(t);return r="display"===e&&"flex"===t?"flex":"display"===e&&"grid"===t?"grid":"display"===e&&"block"===t?"display-block":"display"===e&&"none"===t?"display-none":"justify-content"===e&&"center"===t&&"justify"===o?"justify-center":"align-items"===e&&"center"===t&&"items"===o?"items-center":"font-weight"===e&&"bold"===t?"font-bold":"text-align"===e&&"center"===t?"text-center":"flex-direction"===e&&"column"===t?"flex-col":"flex-direction"===e&&"row"===t?"flex-row":"cursor"===e&&"pointer"===t?"cursor-pointer":"text-decoration"===e&&"line-through"===t?"line-through":`${o}-${i}`,ae.set(n,r),r}(e,t);return fe.set(n,{property:e,value:t}),this.classDefinitions.push({className:n,property:e,value:t}),le(n,e,t),this.classNames.includes(n)||this.classNames.push(n),this}add(e,t){return this.addClass(e,t)}bg(e){return this.addClass("background-color",e)}color(e){return this.addClass("color",e)}fontSize(e){return this.addClass("font-size",e)}display(e){return this.addClass("display",e)}flex(e){return void 0!==e?this.addClass("flex",e):this.addClass("display","flex")}center(){return this.addClass("justify-content","center"),this.addClass("align-items","center")}bold(){return this.addClass("font-weight","bold")}padding(e){return this.addClass("padding",e)}margin(e){return this.addClass("margin",e)}width(e){return this.addClass("width",e)}height(e){return this.addClass("height",e)}border(e){return this.addClass("border",e)}borderRadius(e){return this.addClass("border-radius",e)}textAlign(e){return this.addClass("text-align",e)}gap(e){return this.addClass("gap",e)}flexDirection(e){return this.addClass("flex-direction",e)}grid(){return this.addClass("display","grid")}position(e){return this.addClass("position",e)}opacity(e){return this.addClass("opacity",e)}cursor(e){return this.addClass("cursor",e)}boxShadow(e){return this.addClass("box-shadow",e)}transition(e){return this.addClass("transition",e)}textDecoration(e){return this.addClass("text-decoration",e)}letterSpacing(e){return this.addClass("letter-spacing",e)}fontWeight(e){return this.addClass("font-weight",e)}alignItems(e){return this.addClass("align-items",e)}justifyContent(e){return this.addClass("justify-content",e)}minWidth(e){return this.addClass("min-width",e)}maxWidth(e){return this.addClass("max-width",e)}minHeight(e){return this.addClass("min-height",e)}accentColor(e){return this.addClass("accent-color",e)}lineHeight(e){return this.addClass("line-height",e)}fontFamily(e){return this.addClass("font-family",e)}outline(e){return this.addClass("outline",e)}}const fe=new Map;function he(e){return function(t,n){let r,o;if(void 0!==n?(r=t,o=n):t instanceof de?(r=t,o=void 0):(r=void 0,o=t),!(r||o&&0!==Object.keys(o).length))return"";const i=[];if(r){const e=r.getClassDefinitions();for(const{className:t,property:n,value:r}of e)le(t,n,r),i.push(t)}if(o&&Object.keys(o).length>0){const t=Object.entries(e);for(const[e,n]of t){const t=o[e];if(t){const r=t.getClassDefinitions();for(const{className:t,property:o,value:s}of r){const r=`${e}-${t}`;ue(r,o,s,n),i.push(r)}}}}return{className:i.join(" ")}}}function pe(e,t){let n=document.querySelector("#nuclo-styles");n||(n=document.createElement("style"),n.id="nuclo-styles",document.head.appendChild(n));const r=Object.entries(t).map(([e,t])=>`${e}: ${t}`).join("; ");n.sheet?.insertRule(`.${e} { ${r} }`,n.sheet.cssRules.length)}function me(e){return(new de).bg(e)}function ge(e){return(new de).color(e)}function ye(e){return(new de).fontSize(e)}function be(e){return(new de).flex(e)}function Ce(){return(new de).center()}function we(){return(new de).bold()}function xe(e){return(new de).padding(e)}function ve(e){return(new de).margin(e)}function Se(e){return(new de).width(e)}function Ee(e){return(new de).height(e)}function Ne(e){return(new de).border(e)}function Me(e){return(new de).borderRadius(e)}function $e(e){return(new de).textAlign(e)}function ke(e){return(new de).gap(e)}function Te(e){return(new de).flexDirection(e)}function Re(){return(new de).grid()}function je(e){return(new de).position(e)}function Fe(e){return(new de).opacity(e)}function Ie(e){return(new de).cursor(e)}function Le(){if(V(),"undefined"!=typeof globalThis){const e=globalThis;e.list=U,e.update=ie,e.when=ne,e.on=se,e.render=ce,e.createCSSClass=pe,e.createBreakpoints=he,e.bg=me,e.color=ge,e.fontSize=ye,e.flex=be,e.center=Ce,e.bold=we,e.padding=xe,e.margin=ve,e.width=Se,e.height=Ee,e.border=Ne,e.borderRadius=Me,e.textAlign=$e,e.gap=ke,e.flexDirection=Te,e.grid=Re,e.position=je,e.opacity=Fe,e.cursor=Ie}}"undefined"!=typeof globalThis&&Le(),e.HTML_TAGS=z,e.SELF_CLOSING_TAGS=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"],e.SVG_TAGS=P,e.appendChildren=function(e,...t){return e?(t.forEach(t=>{if(null!=t){let n;if("string"==typeof t){const e=function(e){if(!l)return null;try{return document.createTextNode(String(e))}catch(e){return c("Failed to create text node",e),null}}(t);if(!e)return;n=e}else n=t;!function(e,t){if(!e||!t)return!1;try{return e.appendChild(t),!0}catch(e){return c("Failed to append child node",e),!1}}(e,n)}}),e):e},e.applyAttributes=M,e.applyNodeModifier=R,e.bg=me,e.bold=we,e.border=Ne,e.borderRadius=Me,e.center=Ce,e.color=ge,e.createBreakpoints=he,e.createCSSClass=pe,e.createComment=f,e.createConditionalComment=h,e.createElementFactory=_,e.createElementWithModifiers=D,e.createTagBuilder=G,e.cursor=Ie,e.flex=be,e.flexDirection=Te,e.fontSize=ye,e.gap=ke,e.grid=Re,e.height=Ee,e.initializeRuntime=Le,e.isBoolean=function(e){return"boolean"==typeof e},e.isBrowser=l,e.isFunction=i,e.isNode=n,e.isObject=r,e.isPrimitive=t,e.isTagLike=o,e.isZeroArityFunction=s,e.list=U,e.margin=ve,e.on=se,e.opacity=Fe,e.padding=xe,e.position=je,e.registerGlobalTagBuilders=V,e.render=ce,e.replaceNodeSafely=b,e.textAlign=$e,e.update=ie,e.when=ne,e.width=Se});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Nuclo={})}(this,function(e){"use strict";function t(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function r(e){return e instanceof Node}function n(e){return"object"==typeof e&&null!==e}function o(e){return n(e)&&"tagName"in e}function i(e){return"function"==typeof e}function a(e){return i(e)&&0===e.length}function s(e,t){"undefined"!=typeof console&&console.error(`nuclo: ${e}`,t)}function l(e,t){try{return e()}catch(e){return s("Operation failed",e),t}}const c="undefined"!=typeof window&&"undefined"!=typeof document;function d(e){if(!e?.parentNode)return!1;try{return e.parentNode.removeChild(e),!0}catch(e){return s("Failed to remove child node",e),!1}}function u(e){if(!c)return null;try{return document.createComment(e)}catch(e){return s("Failed to create comment node",e),null}}function m(e){return u(e)}function p(e,t="hidden"){try{return document.createComment(`conditional-${e}-${t}`)}catch(e){return s("Failed to create conditional comment",e),null}}function f(e){if(!c)throw new Error("Cannot create comment in non-browser environment");const t=u(`${e}-${Math.random().toString(36).slice(2)}`);if(!t)throw new Error("Failed to create comment");return t}function y(e){const t=u(`${e}-end`);if(!t)throw new Error("Failed to create end comment");return{start:f(`${e}-start`),end:t}}function g(e,t){const r=t.parentNode;r&&e.forEach(e=>function(e,t,r){if(!e||!t)return!1;try{return e.insertBefore(t,r),!0}catch(e){return s("Failed to insert node before reference",e),!1}}(r,e,t))}function h(e){return!!e&&("boolean"==typeof e.isConnected?e.isConnected:!(!c||"undefined"==typeof document)&&document.contains(e))}function b(e,t){if(!e?.parentNode)return!1;try{return e.parentNode.replaceChild(t,e),!0}catch(e){return s("Error replacing conditional node",e),!1}}const P=new Map,S=new Map;function w(e,t){t.attributeResolvers.forEach(({resolver:e,applyValue:t},r)=>{try{t(l(e))}catch(e){s(`Failed to update reactive attribute: ${r}`,e)}})}function x(e,t,r,n){if(!(e instanceof Element&&t&&"function"==typeof r))return void s("Invalid parameters for registerAttributeResolver");const o=function(e){let t=S.get(e);return t||(t={attributeResolvers:new Map},S.set(e,t)),t}(e);o.attributeResolvers.set(t,{resolver:r,applyValue:n});try{n(l(r))}catch(e){s("Failed to apply initial attribute value",e)}if(!o.updateListener){const t=()=>w(0,o);e.addEventListener("update",t),o.updateListener=t}}function C(e,t,r){try{if(null==r||""===r)return e.style[t]="",!0;const n=String(r);return e.style[t]=n,!0}catch{return!1}}function v(e,t){if(e?.style&&t)for(const[r,n]of Object.entries(t)){C(e,r,n)||s(`Failed to set style property '${r}'`)}}function k(e,t,r,n=!1){if(null==r)return;if("style"===t)return a=r,void((o=e)&&(i(a)?x(o,"style",()=>{try{return a()}catch(e){return s("Error in style resolver function",e),null}},e=>{v(o,e)}):v(o,a)));var o,a;const l=(r,n=!1)=>{if(null==r)return;if("className"===t&&e instanceof HTMLElement&&n){const t=String(r),n=e.className;if(n&&n!==t){const r=new Set(n.split(" ").filter(e=>e));t.split(" ").filter(e=>e).forEach(e=>r.add(e)),e.className=Array.from(r).join(" ")}else t&&(e.className=t);return}if(e instanceof Element&&"http://www.w3.org/2000/svg"===e.namespaceURI)e.setAttribute(String(t),String(r));else if(t in e)try{e[t]=r}catch{e instanceof Element&&e.setAttribute(String(t),String(r))}else e instanceof Element&&e.setAttribute(String(t),String(r))};if(i(r)&&0===r.length){const n=r;x(e,String(t),n,e=>l(e,!1))}else l(r,n)}function R(e,t,r=!0){if(t)for(const n of Object.keys(t)){k(e,n,t[n],r&&"className"===n)}}const T=new WeakMap;function B(e){const{value:t,error:r}=function(e){const t=T.get(e);if(t)return t;try{const t={value:e(),error:!1};return T.set(e,t),t}catch{const t={value:void 0,error:!0};return T.set(e,t),t}}(e);return!r&&"boolean"==typeof t}function A(e,t,o){if(!i(e)||0!==e.length)return!1;if(!B(e))return!1;const a=t.filter((e,t)=>t!==o);if(0===a.length)return!1;return a.some(e=>!(!n(e)&&!r(e))||!!(i(e)&&e.length>0))}function E(e,o,l){if(null==o)return null;if(i(o)){if(a(o))try{let e=T.get(o);if(!e){e={value:o(),error:!1},T.set(o,e)}if(e.error)return L(l,()=>"");const r=e.value;return t(r)&&null!=r?L(l,o,r):null}catch(e){return T.set(o,{value:void 0,error:!0}),s("Error evaluating reactive text function:",e),L(l,()=>"")}const i=o(e,l);return null==i?null:t(i)?I(l,i):r(i)?i:(n(i)&&R(e,i),null)}const c=o;return null==c?null:t(c)?I(l,c):r(c)?c:(n(c)&&R(e,c),null)}function L(e,t,r){const n=document.createDocumentFragment(),o=m(` text-${e} `);o&&n.appendChild(o);const i=function(e,t){if("function"!=typeof e)return s("Invalid resolver provided to createReactiveTextNode"),document.createTextNode("");const r=arguments.length>1?t:l(e,""),n=void 0===r?"":String(r),o=document.createTextNode(n);return P.set(o,{resolver:e,lastValue:n}),o}(t,r);return n.appendChild(i),n}function I(e,t){const r=document.createDocumentFragment(),n=m(` text-${e} `);n&&r.appendChild(n);const o=document.createTextNode(String(t));return r.appendChild(o),r}const W=new Set;function F(e,t){e._conditionalInfo=t,W.add(e)}function D(e,t,r=0){if(!t||0===t.length)return{element:e,nextIndex:r,appended:0};let n=r,o=0;const i=e;for(let r=0;r<t.length;r+=1){const a=t[r];if(null==a)continue;const s=E(e,a,n);s&&(s.parentNode!==i&&i.appendChild(s),n+=1,o+=1)}return{element:e,nextIndex:n,appended:o}}function N(e,t){const r=document.createElement(e);return D(r,t,0),r}function j(e){const t=function(e){for(let t=0;t<e.length;t+=1)if(A(e[t],e,t))return t;return-1}(e);return-1===t?{condition:null,otherModifiers:e}:{condition:e[t],otherModifiers:e.filter((e,r)=>r!==t)}}function M(e){return function(e){return G.includes(e)}(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function O(e,...t){return(r,n)=>{const{condition:o,otherModifiers:i}=j(t);if(o)return function(e,t,r){const n=t();if(!c)return n?N(e,r):p(e,"ssr");const o={condition:t,tagName:e,modifiers:r};if(n){const t=N(e,r);return F(t,o),t}const i=p(e);if(!i)throw new Error(`Failed to create conditional comment for ${e}`);return F(i,o),i}(e,o,i);const a=M(e);return D(a,i,n),a}}function $(e){return(...t)=>O(e,...t)}const z=["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"],G=["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"];function V(e=globalThis){const t="__nuclo_tags_registered";e[t]||(G.forEach(t=>function(e,t){let r=t;["a","script","style","title","text"].includes(t)?r=`${t}_svg`:["stop"].includes(t)&&(r=`${t}_`),r in e||(e[r]=$(t))}(e,t)),z.forEach(t=>function(e,t){t in e&&"function"!=typeof e[t]||(e[t]=$(t))}(e,t)),e[t]=!0)}const _=new Set;function H(e,t,r){return function(e,t,r){if(i(e)){const n=e(t,r);return n&&o(n)?n:null}return e&&o(e)?e:null}(e.renderItem(t,r),e.host,r)}function q(e){d(e.element)}function U(e){const{host:t,startMarker:r,endMarker:n}=e,o=r.parentNode??t,i=e.itemsProvider();if(function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if((r in e?e[r]:void 0)!==(r in t?t[r]:void 0))return!1;return!0}(e.lastSyncedItems,i))return;const a=new Map,s=new Map;e.records.forEach(e=>{const t=s.get(e.item);t?t.push(e):s.set(e.item,[e])}),i.forEach((t,r)=>{if(r<e.lastSyncedItems.length&&e.lastSyncedItems[r]===t){const n=e.records[r];if(n&&n.item===t){a.set(r,n);const e=s.get(t);if(e){const r=e.indexOf(n);r>=0&&(e.splice(r,1),0===e.length&&s.delete(t))}}}});const l=[],c=new Set(e.records);let d=n;for(let t=i.length-1;t>=0;t--){const r=i[t];let n=a.get(t);if(!n){const e=s.get(r);e&&e.length>0&&(n=e.shift(),0===e.length&&s.delete(r))}if(n)c.delete(n);else{const o=H(e,r,t);if(!o)continue;n={item:r,element:o}}l.unshift(n);const u=n.element;u.nextSibling!==d&&o.insertBefore(u,d),d=u}c.forEach(q),e.records=l,e.lastSyncedItems=[...i]}function J(e,t){return(r,n)=>{const o=function(e,t,r){const{start:n,end:o}=y("list"),i={itemsProvider:e,renderItem:t,startMarker:n,endMarker:o,records:[],host:r,lastSyncedItems:[]},a=r;return a.appendChild(n),a.appendChild(o),_.add(i),U(i),i}(e,t,r);return o.startMarker}}function X(e,t){try{return e()}catch(e){if(t)return t(e),!1;throw e}}function Y(e,t){return"function"==typeof e?X(e,t):Boolean(e)}const Q=new Set;function Z(e,t,r,n){return i(e)?a(e)?(T.delete(e),E(t,e,r)):function(e,t,r){const n=e,o=n.appendChild.bind(n),i=n.insertBefore.bind(n);n.appendChild=function(e){return i(e,t)};try{return r()}finally{n.appendChild=o}}(t,n,()=>{const n=E(t,e,r);return n&&!n.parentNode?n:null}):E(t,e,r)}function K(e){const{groups:t,elseContent:r,host:n,index:o,endMarker:i}=e,a=function(e,t){for(let t=0;t<e.length;t++)if(Y(e[t].condition))return t;return t.length>0?-1:null}(t,r);if(a===e.activeIndex)return;if(function(e,t){let r=e.nextSibling;for(;r&&r!==t;){const e=r.nextSibling;d(r),r=e}}(e.startMarker,e.endMarker),e.activeIndex=a,null===a)return;const s=function(e,t,r,n){const o=[];for(const i of e){const e=Z(i,t,r,n);e&&o.push(e)}return o}(a>=0?t[a].content:r,n,o,i);g(s,i)}class ee{groups=[];elseContent=[];constructor(e,...t){this.groups.push({condition:e,content:t})}when(e,...t){return this.groups.push({condition:e,content:t}),this}else(...e){return this.elseContent=e,this}render(e,t){if(!c){return m("when-ssr")||null}const{start:r,end:n}=y("when"),o={startMarker:r,endMarker:n,host:e,index:t,groups:[...this.groups],elseContent:[...this.elseContent],activeIndex:null,update:()=>K(o)};Q.add(o);const i=e;return i.appendChild(r),i.appendChild(n),K(o),r}}function te(e){return Object.assign((t,r)=>e.render(t,r),{when:(t,...r)=>(e.when(t,...r),te(e)),else:(...t)=>(e.else(...t),te(e))})}function re(e,...t){return te(new ee(e,...t))}function ne(e){const t=function(e){return e._conditionalInfo??null}(e);if(!t)return;const r=X(t.condition,e=>{s("Error evaluating conditional condition",e)}),n=e.nodeType===Node.ELEMENT_NODE;if(r&&!n){const r=function(e){try{return N(e.tagName,e.modifiers)}catch(t){return s(`Error applying modifiers in conditional element "${e.tagName}"`,t),document.createElement(e.tagName)}}(t);F(r,t),b(e,r)}else if(!r&&n){const r=p(t.tagName);r&&(F(r,t),b(e,r))}}const oe=[function(){_.forEach(e=>{e.startMarker.isConnected&&e.endMarker.isConnected?U(e):_.delete(e)})},function(){Q.forEach(e=>{try{e.update()}catch(t){Q.delete(e)}})},function(){if(c)try{W.forEach(e=>{e.isConnected?ne(e):function(e){W.delete(e)}(e)})}catch(e){s("Error during conditional elements update",e)}},function(){S.forEach((e,t)=>{if(!h(t))return e.updateListener&&t.removeEventListener("update",e.updateListener),void S.delete(t);w(0,e)})},function(){P.forEach((e,t)=>{if(h(t))try{const r=l(e.resolver),n=void 0===r?"":String(r);n!==e.lastValue&&(t.textContent=n,e.lastValue=n)}catch(e){s("Failed to update reactive text node",e)}else P.delete(t)})},function(){if("undefined"==typeof document)return;const e=document.body?[document.body,document]:[document];for(const t of e)try{t.dispatchEvent(new Event("update",{bubbles:!0}))}catch(e){s("Error dispatching global update event",e)}}];function ie(){for(const e of oe)e()}function ae(e,t,r){return n=>{if(!n||"function"!=typeof n.addEventListener)return;const o=n;o.addEventListener(e,r=>{try{t.call(o,r)}catch(t){s(`Error in '${e}' listener`,t)}},r)}}function se(e,t,r=0){const n=e(t||document.body,r);return(t||document.body).appendChild(n),n}const le=[{name:"display",cssProperty:"display"},{name:"grid",cssProperty:"display",defaultValue:"grid",isShorthand:!0},{name:"bg",cssProperty:"background-color"},{name:"color",cssProperty:"color"},{name:"accentColor",cssProperty:"accent-color"},{name:"fontSize",cssProperty:"font-size"},{name:"fontWeight",cssProperty:"font-weight"},{name:"fontFamily",cssProperty:"font-family"},{name:"lineHeight",cssProperty:"line-height"},{name:"letterSpacing",cssProperty:"letter-spacing"},{name:"textAlign",cssProperty:"text-align"},{name:"textDecoration",cssProperty:"text-decoration"},{name:"fontStyle",cssProperty:"font-style"},{name:"fontVariant",cssProperty:"font-variant"},{name:"fontStretch",cssProperty:"font-stretch"},{name:"textTransform",cssProperty:"text-transform"},{name:"textIndent",cssProperty:"text-indent"},{name:"textOverflow",cssProperty:"text-overflow"},{name:"textShadow",cssProperty:"text-shadow"},{name:"whiteSpace",cssProperty:"white-space"},{name:"wordSpacing",cssProperty:"word-spacing"},{name:"wordWrap",cssProperty:"word-wrap"},{name:"overflowWrap",cssProperty:"overflow-wrap"},{name:"textAlignLast",cssProperty:"text-align-last"},{name:"textJustify",cssProperty:"text-justify"},{name:"textDecorationLine",cssProperty:"text-decoration-line"},{name:"textDecorationColor",cssProperty:"text-decoration-color"},{name:"textDecorationStyle",cssProperty:"text-decoration-style"},{name:"textDecorationThickness",cssProperty:"text-decoration-thickness"},{name:"textUnderlineOffset",cssProperty:"text-underline-offset"},{name:"verticalAlign",cssProperty:"vertical-align"},{name:"position",cssProperty:"position"},{name:"padding",cssProperty:"padding"},{name:"paddingTop",cssProperty:"padding-top"},{name:"paddingRight",cssProperty:"padding-right"},{name:"paddingBottom",cssProperty:"padding-bottom"},{name:"paddingLeft",cssProperty:"padding-left"},{name:"margin",cssProperty:"margin"},{name:"marginTop",cssProperty:"margin-top"},{name:"marginRight",cssProperty:"margin-right"},{name:"marginBottom",cssProperty:"margin-bottom"},{name:"marginLeft",cssProperty:"margin-left"},{name:"width",cssProperty:"width"},{name:"height",cssProperty:"height"},{name:"minWidth",cssProperty:"min-width"},{name:"maxWidth",cssProperty:"max-width"},{name:"minHeight",cssProperty:"min-height"},{name:"maxHeight",cssProperty:"max-height"},{name:"boxSizing",cssProperty:"box-sizing"},{name:"top",cssProperty:"top"},{name:"right",cssProperty:"right"},{name:"bottom",cssProperty:"bottom"},{name:"left",cssProperty:"left"},{name:"zIndex",cssProperty:"z-index"},{name:"flexDirection",cssProperty:"flex-direction"},{name:"alignItems",cssProperty:"align-items"},{name:"justifyContent",cssProperty:"justify-content"},{name:"gap",cssProperty:"gap"},{name:"flexWrap",cssProperty:"flex-wrap"},{name:"flexGrow",cssProperty:"flex-grow"},{name:"flexShrink",cssProperty:"flex-shrink"},{name:"flexBasis",cssProperty:"flex-basis"},{name:"alignSelf",cssProperty:"align-self"},{name:"alignContent",cssProperty:"align-content"},{name:"justifySelf",cssProperty:"justify-self"},{name:"justifyItems",cssProperty:"justify-items"},{name:"gridTemplateColumns",cssProperty:"grid-template-columns"},{name:"gridTemplateRows",cssProperty:"grid-template-rows"},{name:"gridTemplateAreas",cssProperty:"grid-template-areas"},{name:"gridColumn",cssProperty:"grid-column"},{name:"gridRow",cssProperty:"grid-row"},{name:"gridColumnStart",cssProperty:"grid-column-start"},{name:"gridColumnEnd",cssProperty:"grid-column-end"},{name:"gridRowStart",cssProperty:"grid-row-start"},{name:"gridRowEnd",cssProperty:"grid-row-end"},{name:"gridArea",cssProperty:"grid-area"},{name:"gridAutoColumns",cssProperty:"grid-auto-columns"},{name:"gridAutoRows",cssProperty:"grid-auto-rows"},{name:"gridAutoFlow",cssProperty:"grid-auto-flow"},{name:"border",cssProperty:"border"},{name:"borderTop",cssProperty:"border-top"},{name:"borderRight",cssProperty:"border-right"},{name:"borderBottom",cssProperty:"border-bottom"},{name:"borderLeft",cssProperty:"border-left"},{name:"borderWidth",cssProperty:"border-width"},{name:"borderStyle",cssProperty:"border-style"},{name:"borderColor",cssProperty:"border-color"},{name:"borderTopWidth",cssProperty:"border-top-width"},{name:"borderRightWidth",cssProperty:"border-right-width"},{name:"borderBottomWidth",cssProperty:"border-bottom-width"},{name:"borderLeftWidth",cssProperty:"border-left-width"},{name:"borderTopStyle",cssProperty:"border-top-style"},{name:"borderRightStyle",cssProperty:"border-right-style"},{name:"borderBottomStyle",cssProperty:"border-bottom-style"},{name:"borderLeftStyle",cssProperty:"border-left-style"},{name:"borderTopColor",cssProperty:"border-top-color"},{name:"borderRightColor",cssProperty:"border-right-color"},{name:"borderBottomColor",cssProperty:"border-bottom-color"},{name:"borderLeftColor",cssProperty:"border-left-color"},{name:"borderRadius",cssProperty:"border-radius"},{name:"borderTopLeftRadius",cssProperty:"border-top-left-radius"},{name:"borderTopRightRadius",cssProperty:"border-top-right-radius"},{name:"borderBottomLeftRadius",cssProperty:"border-bottom-left-radius"},{name:"borderBottomRightRadius",cssProperty:"border-bottom-right-radius"},{name:"outline",cssProperty:"outline"},{name:"outlineWidth",cssProperty:"outline-width"},{name:"outlineStyle",cssProperty:"outline-style"},{name:"outlineColor",cssProperty:"outline-color"},{name:"outlineOffset",cssProperty:"outline-offset"},{name:"backgroundColor",cssProperty:"background-color"},{name:"backgroundImage",cssProperty:"background-image"},{name:"backgroundRepeat",cssProperty:"background-repeat"},{name:"backgroundPosition",cssProperty:"background-position"},{name:"backgroundSize",cssProperty:"background-size"},{name:"backgroundAttachment",cssProperty:"background-attachment"},{name:"backgroundClip",cssProperty:"background-clip"},{name:"backgroundOrigin",cssProperty:"background-origin"},{name:"boxShadow",cssProperty:"box-shadow"},{name:"opacity",cssProperty:"opacity"},{name:"transition",cssProperty:"transition"},{name:"transitionProperty",cssProperty:"transition-property"},{name:"transitionDuration",cssProperty:"transition-duration"},{name:"transitionTimingFunction",cssProperty:"transition-timing-function"},{name:"transitionDelay",cssProperty:"transition-delay"},{name:"transform",cssProperty:"transform"},{name:"transformOrigin",cssProperty:"transform-origin"},{name:"transformStyle",cssProperty:"transform-style"},{name:"perspective",cssProperty:"perspective"},{name:"perspectiveOrigin",cssProperty:"perspective-origin"},{name:"backfaceVisibility",cssProperty:"backface-visibility"},{name:"animation",cssProperty:"animation"},{name:"animationName",cssProperty:"animation-name"},{name:"animationDuration",cssProperty:"animation-duration"},{name:"animationTimingFunction",cssProperty:"animation-timing-function"},{name:"animationDelay",cssProperty:"animation-delay"},{name:"animationIterationCount",cssProperty:"animation-iteration-count"},{name:"animationDirection",cssProperty:"animation-direction"},{name:"animationFillMode",cssProperty:"animation-fill-mode"},{name:"animationPlayState",cssProperty:"animation-play-state"},{name:"filter",cssProperty:"filter"},{name:"backdropFilter",cssProperty:"backdrop-filter"},{name:"overflow",cssProperty:"overflow"},{name:"overflowX",cssProperty:"overflow-x"},{name:"overflowY",cssProperty:"overflow-y"},{name:"visibility",cssProperty:"visibility"},{name:"objectFit",cssProperty:"object-fit"},{name:"objectPosition",cssProperty:"object-position"},{name:"listStyle",cssProperty:"list-style"},{name:"listStyleType",cssProperty:"list-style-type"},{name:"listStylePosition",cssProperty:"list-style-position"},{name:"listStyleImage",cssProperty:"list-style-image"},{name:"borderCollapse",cssProperty:"border-collapse"},{name:"borderSpacing",cssProperty:"border-spacing"},{name:"captionSide",cssProperty:"caption-side"},{name:"emptyCells",cssProperty:"empty-cells"},{name:"tableLayout",cssProperty:"table-layout"},{name:"content",cssProperty:"content"},{name:"quotes",cssProperty:"quotes"},{name:"counterReset",cssProperty:"counter-reset"},{name:"counterIncrement",cssProperty:"counter-increment"},{name:"appearance",cssProperty:"appearance"},{name:"userSelect",cssProperty:"user-select"},{name:"pointerEvents",cssProperty:"pointer-events"},{name:"resize",cssProperty:"resize"},{name:"scrollBehavior",cssProperty:"scroll-behavior"},{name:"clip",cssProperty:"clip"},{name:"clipPath",cssProperty:"clip-path"},{name:"isolation",cssProperty:"isolation"},{name:"mixBlendMode",cssProperty:"mix-blend-mode"},{name:"willChange",cssProperty:"will-change"},{name:"contain",cssProperty:"contain"},{name:"pageBreakBefore",cssProperty:"page-break-before"},{name:"pageBreakAfter",cssProperty:"page-break-after"},{name:"pageBreakInside",cssProperty:"page-break-inside"},{name:"breakBefore",cssProperty:"break-before"},{name:"breakAfter",cssProperty:"break-after"},{name:"breakInside",cssProperty:"break-inside"},{name:"orphans",cssProperty:"orphans"},{name:"widows",cssProperty:"widows"},{name:"columnCount",cssProperty:"column-count"},{name:"columnFill",cssProperty:"column-fill"},{name:"columnGap",cssProperty:"column-gap"},{name:"columnRule",cssProperty:"column-rule"},{name:"columnRuleColor",cssProperty:"column-rule-color"},{name:"columnRuleStyle",cssProperty:"column-rule-style"},{name:"columnRuleWidth",cssProperty:"column-rule-width"},{name:"columnSpan",cssProperty:"column-span"},{name:"columnWidth",cssProperty:"column-width"},{name:"columns",cssProperty:"columns"},{name:"cursor",cssProperty:"cursor"}],ce=["bold","center","flex"],de=new Map;function ue(e){let t=0;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return Math.abs(t).toString(16).padStart(8,"0").substring(0,8)}function me(e){return Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}:${t}`).join("|")}function pe(e,t="",r){const n=me(e),o=t?`${t}:${n}`:n;if(de.has(o)){const t=de.get(o);return function(e,t){const r=document.querySelector("#nuclo-styles");if(!r||!r.sheet)return!1;if(t){const n=Array.from(r.sheet.cssRules||[]).find(e=>e instanceof CSSMediaRule&&e.media.mediaText===t);return!!n&&Array.from(n.cssRules).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)}return Array.from(r.sheet.cssRules||[]).some(t=>t instanceof CSSStyleRule&&t.selectorText===`.${e}`)}(t,r)||fe(t,e,r),t}const i=ue(n),a=t?`n${t}-${i}`:`n${i}`;return de.set(o,a),fe(a,e,r),a}function fe(e,t,r){let n=document.querySelector("#nuclo-styles");n||(n=document.createElement("style"),n.id="nuclo-styles",document.head.appendChild(n));const o=Object.entries(t).map(([e,t])=>`${e}: ${t}`).join("; ");if(r){const i=Array.from(n.sheet?.cssRules||[]);let a=null;for(const e of i)if(e instanceof CSSMediaRule&&e.media.mediaText===r){a=e;break}if(!a){let e=i.length;for(let t=i.length-1;t>=0;t--){if(i[t]instanceof CSSMediaRule){e=t+1;break}if(i[t]instanceof CSSStyleRule){e=t+1;break}}n.sheet?.insertRule(`@media ${r} {}`,e),a=n.sheet?.cssRules[e]}let s=null;for(const t of Array.from(a.cssRules))if(t instanceof CSSStyleRule&&t.selectorText===`.${e}`){s=t;break}if(s){for(;s.style.length>0;)s.style.removeProperty(s.style[0]);Object.entries(t).forEach(([e,t])=>{s.style.setProperty(e,t)})}else a.insertRule(`.${e} { ${o} }`,a.cssRules.length)}else{let r=null,i=0;const a=Array.from(n.sheet?.cssRules||[]);for(let t=0;t<a.length;t++){const n=a[t];if(n instanceof CSSStyleRule&&n.selectorText===`.${e}`){r=n,i=t;break}n instanceof CSSMediaRule||(i=t+1)}if(r){for(;r.style.length>0;)r.style.removeProperty(r.style[0]);Object.entries(t).forEach(([e,t])=>{r.style.setProperty(e,t)})}else n.sheet?.insertRule(`.${e} { ${o} }`,i)}}class ye{styles={};getStyles(){return{...this.styles}}getClassName(e="",t){return pe(this.styles,e,t)}getClassNames(){return[this.getClassName()]}getClassDefinitions(){return Object.entries(this.styles).map(([e,t])=>({className:this.getClassName(),property:e,value:t}))}toString(){return this.getClassName()}add(e,t){return this.styles[e]=t,this}bold(){return this.styles["font-weight"]="bold",this}center(){return this.styles["justify-content"]="center",this.styles["align-items"]="center",this}flex(e){return void 0!==e?this.styles.flex=e:this.styles.display="flex",this}}function ge(e){const t=Array.isArray(e)?e:Object.entries(e);return function(e,r){let n,o;if(void 0!==r?(n=e,o=r):e instanceof ye?(n=e,o=void 0):(n=void 0,o=e),!(n||o&&0!==Object.keys(o).length))return"";if(o&&Object.keys(o).length>0){const e=[];for(const[r,n]of t){const t=o[r];t&&e.push({breakpointName:r,mediaQuery:n,styles:t.getStyles()})}const r=[];if(n){const e=n.getStyles();r.push(`default:${me(e)}`)}r.push(...e.map(({breakpointName:e,styles:t})=>`${e}:${me(t)}`));const i=`n${ue(r.sort().join("||"))}`;let a={};n&&(a={...n.getStyles()},fe(i,a));for(const{breakpointName:t,mediaQuery:r,styles:n}of e)a={...a,...n},fe(i,a,r);return{className:i}}if(n){return{className:n.getClassName()}}return""}}function he(e,t){fe(e,t)}function be(e){return e.isShorthand?()=>(new ye).add(e.cssProperty,e.defaultValue||""):t=>(new ye).add(e.cssProperty,t||"")}!function(){const e=ye.prototype;for(const t of le)t.name in e||(t.isShorthand?e[t.name]=function(){return this.add(t.cssProperty,t.defaultValue||""),this}:e[t.name]=function(e){return this.add(t.cssProperty,e),this})}();const Pe={};for(const e of le)Pe[e.name]=be(e);for(const e of ce)"bold"===e||"center"===e?Pe[e]=()=>(new ye)[e]():"flex"===e&&(Pe[e]=e=>(new ye).flex(e));const{display:Se,flex:we,grid:xe,bg:Ce,color:ve,accentColor:ke,fontSize:Re,fontWeight:Te,fontFamily:Be,lineHeight:Ae,letterSpacing:Ee,textAlign:Le,textDecoration:Ie,bold:We,fontStyle:Fe,fontVariant:De,fontStretch:Ne,textTransform:je,textIndent:Me,textOverflow:Oe,textShadow:$e,whiteSpace:ze,wordSpacing:Ge,wordWrap:Ve,overflowWrap:_e,textAlignLast:He,textJustify:qe,textDecorationLine:Ue,textDecorationColor:Je,textDecorationStyle:Xe,textDecorationThickness:Ye,textUnderlineOffset:Qe,verticalAlign:Ze,position:Ke,padding:et,paddingTop:tt,paddingRight:rt,paddingBottom:nt,paddingLeft:ot,margin:it,marginTop:at,marginRight:st,marginBottom:lt,marginLeft:ct,width:dt,height:ut,minWidth:mt,maxWidth:pt,minHeight:ft,maxHeight:yt,boxSizing:gt,top:ht,right:bt,bottom:Pt,left:St,zIndex:wt,flexDirection:xt,alignItems:Ct,justifyContent:vt,center:kt,gap:Rt,flexWrap:Tt,flexGrow:Bt,flexShrink:At,flexBasis:Et,alignSelf:Lt,alignContent:It,justifySelf:Wt,justifyItems:Ft,gridTemplateColumns:Dt,gridTemplateRows:Nt,gridTemplateAreas:jt,gridColumn:Mt,gridRow:Ot,gridColumnStart:$t,gridColumnEnd:zt,gridRowStart:Gt,gridRowEnd:Vt,gridArea:_t,gridAutoColumns:Ht,gridAutoRows:qt,gridAutoFlow:Ut,border:Jt,borderTop:Xt,borderRight:Yt,borderBottom:Qt,borderLeft:Zt,borderWidth:Kt,borderStyle:er,borderColor:tr,borderTopWidth:rr,borderRightWidth:nr,borderBottomWidth:or,borderLeftWidth:ir,borderTopStyle:ar,borderRightStyle:sr,borderBottomStyle:lr,borderLeftStyle:cr,borderTopColor:dr,borderRightColor:ur,borderBottomColor:mr,borderLeftColor:pr,borderRadius:fr,borderTopLeftRadius:yr,borderTopRightRadius:gr,borderBottomLeftRadius:hr,borderBottomRightRadius:br,outline:Pr,outlineWidth:Sr,outlineStyle:wr,outlineColor:xr,outlineOffset:Cr,backgroundColor:vr,backgroundImage:kr,backgroundRepeat:Rr,backgroundPosition:Tr,backgroundSize:Br,backgroundAttachment:Ar,backgroundClip:Er,backgroundOrigin:Lr,boxShadow:Ir,opacity:Wr,transition:Fr,transitionProperty:Dr,transitionDuration:Nr,transitionTimingFunction:jr,transitionDelay:Mr,transform:Or,transformOrigin:$r,transformStyle:zr,perspective:Gr,perspectiveOrigin:Vr,backfaceVisibility:_r,animation:Hr,animationName:qr,animationDuration:Ur,animationTimingFunction:Jr,animationDelay:Xr,animationIterationCount:Yr,animationDirection:Qr,animationFillMode:Zr,animationPlayState:Kr,filter:en,backdropFilter:tn,overflow:rn,overflowX:nn,overflowY:on,visibility:an,objectFit:sn,objectPosition:ln,listStyle:cn,listStyleType:dn,listStylePosition:un,listStyleImage:mn,borderCollapse:pn,borderSpacing:fn,captionSide:yn,emptyCells:gn,tableLayout:hn,content:bn,quotes:Pn,counterReset:Sn,counterIncrement:wn,appearance:xn,userSelect:Cn,pointerEvents:vn,resize:kn,scrollBehavior:Rn,clip:Tn,clipPath:Bn,isolation:An,mixBlendMode:En,willChange:Ln,contain:In,pageBreakBefore:Wn,pageBreakAfter:Fn,pageBreakInside:Dn,breakBefore:Nn,breakAfter:jn,breakInside:Mn,orphans:On,widows:$n,columnCount:zn,columnFill:Gn,columnGap:Vn,columnRule:_n,columnRuleColor:Hn,columnRuleStyle:qn,columnRuleWidth:Un,columnSpan:Jn,columnWidth:Xn,columns:Yn,cursor:Qn}=Pe;var Zn=Object.freeze({__proto__:null,StyleBuilder:ye,accentColor:ke,alignContent:It,alignItems:Ct,alignSelf:Lt,animation:Hr,animationDelay:Xr,animationDirection:Qr,animationDuration:Ur,animationFillMode:Zr,animationIterationCount:Yr,animationName:qr,animationPlayState:Kr,animationTimingFunction:Jr,appearance:xn,backdropFilter:tn,backfaceVisibility:_r,backgroundAttachment:Ar,backgroundClip:Er,backgroundColor:vr,backgroundImage:kr,backgroundOrigin:Lr,backgroundPosition:Tr,backgroundRepeat:Rr,backgroundSize:Br,bg:Ce,bold:We,border:Jt,borderBottom:Qt,borderBottomColor:mr,borderBottomLeftRadius:hr,borderBottomRightRadius:br,borderBottomStyle:lr,borderBottomWidth:or,borderCollapse:pn,borderColor:tr,borderLeft:Zt,borderLeftColor:pr,borderLeftStyle:cr,borderLeftWidth:ir,borderRadius:fr,borderRight:Yt,borderRightColor:ur,borderRightStyle:sr,borderRightWidth:nr,borderSpacing:fn,borderStyle:er,borderTop:Xt,borderTopColor:dr,borderTopLeftRadius:yr,borderTopRightRadius:gr,borderTopStyle:ar,borderTopWidth:rr,borderWidth:Kt,bottom:Pt,boxShadow:Ir,boxSizing:gt,breakAfter:jn,breakBefore:Nn,breakInside:Mn,captionSide:yn,center:kt,clip:Tn,clipPath:Bn,color:ve,columnCount:zn,columnFill:Gn,columnGap:Vn,columnRule:_n,columnRuleColor:Hn,columnRuleStyle:qn,columnRuleWidth:Un,columnSpan:Jn,columnWidth:Xn,columns:Yn,contain:In,content:bn,counterIncrement:wn,counterReset:Sn,createBreakpoints:ge,createCSSClass:he,cursor:Qn,display:Se,emptyCells:gn,filter:en,flex:we,flexBasis:Et,flexDirection:xt,flexGrow:Bt,flexShrink:At,flexWrap:Tt,fontFamily:Be,fontSize:Re,fontStretch:Ne,fontStyle:Fe,fontVariant:De,fontWeight:Te,gap:Rt,grid:xe,gridArea:_t,gridAutoColumns:Ht,gridAutoFlow:Ut,gridAutoRows:qt,gridColumn:Mt,gridColumnEnd:zt,gridColumnStart:$t,gridRow:Ot,gridRowEnd:Vt,gridRowStart:Gt,gridTemplateAreas:jt,gridTemplateColumns:Dt,gridTemplateRows:Nt,height:ut,isolation:An,justifyContent:vt,justifyItems:Ft,justifySelf:Wt,left:St,letterSpacing:Ee,lineHeight:Ae,listStyle:cn,listStyleImage:mn,listStylePosition:un,listStyleType:dn,margin:it,marginBottom:lt,marginLeft:ct,marginRight:st,marginTop:at,maxHeight:yt,maxWidth:pt,minHeight:ft,minWidth:mt,mixBlendMode:En,objectFit:sn,objectPosition:ln,opacity:Wr,orphans:On,outline:Pr,outlineColor:xr,outlineOffset:Cr,outlineStyle:wr,outlineWidth:Sr,overflow:rn,overflowWrap:_e,overflowX:nn,overflowY:on,padding:et,paddingBottom:nt,paddingLeft:ot,paddingRight:rt,paddingTop:tt,pageBreakAfter:Fn,pageBreakBefore:Wn,pageBreakInside:Dn,perspective:Gr,perspectiveOrigin:Vr,pointerEvents:vn,position:Ke,quotes:Pn,resize:kn,right:bt,scrollBehavior:Rn,tableLayout:hn,textAlign:Le,textAlignLast:He,textDecoration:Ie,textDecorationColor:Je,textDecorationLine:Ue,textDecorationStyle:Xe,textDecorationThickness:Ye,textIndent:Me,textJustify:qe,textOverflow:Oe,textShadow:$e,textTransform:je,textUnderlineOffset:Qe,top:ht,transform:Or,transformOrigin:$r,transformStyle:zr,transition:Fr,transitionDelay:Mr,transitionDuration:Nr,transitionProperty:Dr,transitionTimingFunction:jr,userSelect:Cn,verticalAlign:Ze,visibility:an,whiteSpace:ze,widows:$n,width:dt,willChange:Ln,wordSpacing:Ge,wordWrap:Ve,zIndex:wt});function Kn(){if(V(),"undefined"!=typeof globalThis){const e=globalThis;e.list=J,e.update=ie,e.when=re,e.on=ae,e.render=se;for(const[t,r]of Object.entries(Zn))try{e[t]=r}catch(e){}}}"undefined"!=typeof globalThis&&Kn(),e.HTML_TAGS=z,e.SELF_CLOSING_TAGS=["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"],e.SVG_TAGS=G,e.StyleBuilder=ye,e.accentColor=ke,e.alignContent=It,e.alignItems=Ct,e.alignSelf=Lt,e.animation=Hr,e.animationDelay=Xr,e.animationDirection=Qr,e.animationDuration=Ur,e.animationFillMode=Zr,e.animationIterationCount=Yr,e.animationName=qr,e.animationPlayState=Kr,e.animationTimingFunction=Jr,e.appearance=xn,e.appendChildren=function(e,...t){return e?(t.forEach(t=>{if(null!=t){let r;if("string"==typeof t){const e=function(e){if(!c)return null;try{return document.createTextNode(String(e))}catch(e){return s("Failed to create text node",e),null}}(t);if(!e)return;r=e}else r=t;!function(e,t){if(!e||!t)return!1;try{return e.appendChild(t),!0}catch(e){return s("Failed to append child node",e),!1}}(e,r)}}),e):e},e.applyAttributes=R,e.applyNodeModifier=E,e.backdropFilter=tn,e.backfaceVisibility=_r,e.backgroundAttachment=Ar,e.backgroundClip=Er,e.backgroundColor=vr,e.backgroundImage=kr,e.backgroundOrigin=Lr,e.backgroundPosition=Tr,e.backgroundRepeat=Rr,e.backgroundSize=Br,e.bg=Ce,e.bold=We,e.border=Jt,e.borderBottom=Qt,e.borderBottomColor=mr,e.borderBottomLeftRadius=hr,e.borderBottomRightRadius=br,e.borderBottomStyle=lr,e.borderBottomWidth=or,e.borderCollapse=pn,e.borderColor=tr,e.borderLeft=Zt,e.borderLeftColor=pr,e.borderLeftStyle=cr,e.borderLeftWidth=ir,e.borderRadius=fr,e.borderRight=Yt,e.borderRightColor=ur,e.borderRightStyle=sr,e.borderRightWidth=nr,e.borderSpacing=fn,e.borderStyle=er,e.borderTop=Xt,e.borderTopColor=dr,e.borderTopLeftRadius=yr,e.borderTopRightRadius=gr,e.borderTopStyle=ar,e.borderTopWidth=rr,e.borderWidth=Kt,e.bottom=Pt,e.boxShadow=Ir,e.boxSizing=gt,e.breakAfter=jn,e.breakBefore=Nn,e.breakInside=Mn,e.captionSide=yn,e.center=kt,e.clip=Tn,e.clipPath=Bn,e.color=ve,e.columnCount=zn,e.columnFill=Gn,e.columnGap=Vn,e.columnRule=_n,e.columnRuleColor=Hn,e.columnRuleStyle=qn,e.columnRuleWidth=Un,e.columnSpan=Jn,e.columnWidth=Xn,e.columns=Yn,e.contain=In,e.content=bn,e.counterIncrement=wn,e.counterReset=Sn,e.createBreakpoints=ge,e.createCSSClass=he,e.createComment=m,e.createConditionalComment=p,e.createElementFactory=O,e.createElementWithModifiers=N,e.createTagBuilder=$,e.cursor=Qn,e.display=Se,e.emptyCells=gn,e.filter=en,e.flex=we,e.flexBasis=Et,e.flexDirection=xt,e.flexGrow=Bt,e.flexShrink=At,e.flexWrap=Tt,e.fontFamily=Be,e.fontSize=Re,e.fontStretch=Ne,e.fontStyle=Fe,e.fontVariant=De,e.fontWeight=Te,e.gap=Rt,e.grid=xe,e.gridArea=_t,e.gridAutoColumns=Ht,e.gridAutoFlow=Ut,e.gridAutoRows=qt,e.gridColumn=Mt,e.gridColumnEnd=zt,e.gridColumnStart=$t,e.gridRow=Ot,e.gridRowEnd=Vt,e.gridRowStart=Gt,e.gridTemplateAreas=jt,e.gridTemplateColumns=Dt,e.gridTemplateRows=Nt,e.height=ut,e.initializeRuntime=Kn,e.isBoolean=function(e){return"boolean"==typeof e},e.isBrowser=c,e.isFunction=i,e.isNode=r,e.isObject=n,e.isPrimitive=t,e.isTagLike=o,e.isZeroArityFunction=a,e.isolation=An,e.justifyContent=vt,e.justifyItems=Ft,e.justifySelf=Wt,e.left=St,e.letterSpacing=Ee,e.lineHeight=Ae,e.list=J,e.listStyle=cn,e.listStyleImage=mn,e.listStylePosition=un,e.listStyleType=dn,e.margin=it,e.marginBottom=lt,e.marginLeft=ct,e.marginRight=st,e.marginTop=at,e.maxHeight=yt,e.maxWidth=pt,e.minHeight=ft,e.minWidth=mt,e.mixBlendMode=En,e.objectFit=sn,e.objectPosition=ln,e.on=ae,e.opacity=Wr,e.orphans=On,e.outline=Pr,e.outlineColor=xr,e.outlineOffset=Cr,e.outlineStyle=wr,e.outlineWidth=Sr,e.overflow=rn,e.overflowWrap=_e,e.overflowX=nn,e.overflowY=on,e.padding=et,e.paddingBottom=nt,e.paddingLeft=ot,e.paddingRight=rt,e.paddingTop=tt,e.pageBreakAfter=Fn,e.pageBreakBefore=Wn,e.pageBreakInside=Dn,e.perspective=Gr,e.perspectiveOrigin=Vr,e.pointerEvents=vn,e.position=Ke,e.quotes=Pn,e.registerGlobalTagBuilders=V,e.render=se,e.replaceNodeSafely=b,e.resize=kn,e.right=bt,e.scrollBehavior=Rn,e.tableLayout=hn,e.textAlign=Le,e.textAlignLast=He,e.textDecoration=Ie,e.textDecorationColor=Je,e.textDecorationLine=Ue,e.textDecorationStyle=Xe,e.textDecorationThickness=Ye,e.textIndent=Me,e.textJustify=qe,e.textOverflow=Oe,e.textShadow=$e,e.textTransform=je,e.textUnderlineOffset=Qe,e.top=ht,e.transform=Or,e.transformOrigin=$r,e.transformStyle=zr,e.transition=Fr,e.transitionDelay=Mr,e.transitionDuration=Nr,e.transitionProperty=Dr,e.transitionTimingFunction=jr,e.update=ie,e.userSelect=Cn,e.verticalAlign=Ze,e.visibility=an,e.when=re,e.whiteSpace=ze,e.widows=$n,e.width=dt,e.willChange=Ln,e.wordSpacing=Ge,e.wordWrap=Ve,e.zIndex=wt});
2
2
  //# sourceMappingURL=nuclo.umd.js.map