solarite 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- // Solarite v0.7.0 | MIT | vorticode.github.io/solarite
2
- var t;!function e(){t={connected:new WeakSet,t:null,div:document.createElement("div"),i:document,l:{},o:{},h:new WeakMap,u:new WeakMap,p:new WeakSet,m:new WeakMap,reset:e}}();var e=t;function i(t,e,i=l){let s=i!==l,n=e.length;if(!t&&!s&&n)return;let r=0;for(let l of e){if(void 0===t[l]){if(!s)return;n-1>r&&(t[l]=(e[r+1]+"").match(/^\d+$/)?[]:{})}s&&r===n-1&&(t[l]=i),t=t[l],r++}return t}function s(t){return Array.isArray(t)&&t.length>=2&&("object"==typeof t[0]||void 0===t[0])&&!t.slice(1).find((t=>"string"!=typeof t&&"number"!=typeof t))}let l={},n={v(t,e){let i=t.length;if(i!==e.length)return!1;for(let s=0;i>s;s++)if(t[s]!==e[s])return!1;return!0},S(t,e=null){let i={};for(let s of t.attributes)s.name!==e&&(i[n.k(s.name)]=s.value);return i},$(t,e){let s=e.getAttribute("data-id")||e.getAttribute("id");if(s){if(!s.includes(".")){let i=t[s],l=s in t&&!Object.hasOwn(t,s);if(!i?.nodeType&&(null!=i||l))throw Error(`${t.constructor.name}.${s} can't be a reference to <${e.tagName.toLowerCase()} id="${s}"> because it would clobber an existing `+(l?"built-in ":"")+"property. Rename the id or the property.")}i(t,s.split(/\./g),e)}},A(t,i){let s,l,n=i.tagName.toLowerCase();if(t.hasAttribute("global")||t.hasAttribute("data-global")){s=n,l="";let r=e.i||i.ownerDocument||document;r.head.querySelector(`style[data-style="${s}"]`)?t.remove():(r.head.append(t),t.setAttribute("data-style",s))}else{let t=i.getAttribute("data-style");t||(i.constructor.T||(i.constructor.T=1),t=i.constructor.T++,i.setAttribute("data-style",t)),l=`[data-style="${t}"]`}for(let e of t.childNodes)if(3===e.nodeType){let t=e.textContent,i=t.replace(/:host(?=[^a-z0-9_])/gi,`${n}${l}`);t!==i&&(e.textContent=i)}},N:t=>(t=(t=(t=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2")).replace(/([A-Z])([A-Z][a-z])/g,"$1-$2")).replace(/([a-zA-Z])([0-9])/g,"$1-$2")).toLowerCase(),k:t=>t.replace(/-([a-z])/g,(t=>t[1].toUpperCase())),C(t,e){customElements[o](t)||((e=e||n.N(t.name)).includes("-")||(e+="-element"),customElements[r](e,t))},O:t=>"checkbox"===t.type?t.checked:"radio"===t.type?t.value:"file"===t.type?[...t.files]:"number"===t.type||"range"===t.type?t.valueAsNumber:"date"===t.type||"time"===t.type||"datetime-local"===t.type?t.valueAsDate:"select-multiple"===t.type?[...t.selectedOptions].map((t=>t.value)):t.hasAttribute("contenteditable")?t.innerHTML:t.value,L:t=>t.startsWith("on")&&t in e.div,j(t,i){let s=t.tagName+"."+i,l=e.o[s];if(void 0===l){let n=Object.getPrototypeOf(t);for(;n;){const t=n.constructor.name;if(t.startsWith("HTML")&&t.endsWith("Element"))break;n=Object.getPrototypeOf(n)}e.o[s]=l=!!n&&!!Object.getOwnPropertyDescriptor(n,i)?.set}return l},P:t=>void 0===t||!1===t||null===t,R(t){let e={},i=(t+"").split(/([\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|\S+))/g).map((t=>t.trim())).filter((t=>t.length));for(let t of i){let[i,s]=t.split(/\s*=\s*/);s=(s||"").replace(/^(['"])(.*)\1$/,"$2"),e[i]=s}return e},M:t=>"function"==typeof t?n.M(t()):t instanceof Date?t.toISOString().replace(/T/," "):Array.isArray(t)||"object"==typeof t?"":t,D(t){e.i.createDocumentFragment().append(...t)},H(t){const e=t=>t.nodeType!==Node.ELEMENT_NODE&&(t.nodeType!==Node.TEXT_NODE||""===t.textContent.trim()),i=[...t];for(;i.length>0&&e(i[0]);)i.shift();for(;i.length>0&&e(i[i.length-1]);)i.pop();return i}},r="define",o="getName";class f{F;G;I=!1;W;J;constructor(t,e){this.F=t,this.G=e}apply(t){}V(t){}_(){return 1}B(t,e){let i=t,s=this.K,l=s.length-e;for(let t=l-1;t>0;t--)i=i.childNodes[s[t]];return l?i.childNodes[s[0]]:t}Z(t,e){let i=new this.constructor(t,e,this.attrName,this.U);return i.q=this.q,i.I=this.I,i.Y=this.Y,i}clone(t,e=0){let i,s,l=t,n=this.K,r=n.length-e;for(let t=r-1;t>0;t--)l=l.childNodes[n[t]];let o=l.childNodes;i=r?o[n[0]]:t,this.F&&(s=o[this.X]);let f=new this.constructor(s,i,this.attrName,this.U);return f.q=this.q,f.I=this.I,f.Y=this.Y,f}static get(t){let e=[];for(;;){let i=t.parentNode;if(!i)break;e.push([].indexOf.call(t.parentNode.childNodes,t)),t=i}return e}static resolve(t,e){for(let i=e.length-1;i>=0;i--)t=t.childNodes[e[i]];return t}}class h{constructor(){this.tt={context:h.Text,quote:null,buffer:"",et:null},this.state={...this.tt}}reset(){return this.state={...this.tt},this.state.context}parse(t,e=null){if(null===t)return this.reset();for(let i=0;t.length>i;i++){const s=t[i];switch(this.state.context){case h.Text:"<"===s&&t[i+1].match(/[/a-z!]/i)&&(e?.(t,i,this.state.context,h.it),this.state.context=h.it,this.state.buffer="");break;case h.it:if(">"===s)e?.(t,i+1,this.state.context,h.Text),this.state.context=h.Text,this.state.quote=null,this.state.buffer="";else{if(" "===s&&!this.state.buffer)continue;" "===s||"/"===s||"?"===s?this.state.buffer="":'"'===s||"'"===s||"="===s?(e?.(t,i,this.state.context,h.st),this.state.context=h.st,this.state.quote="="===s?null:s,this.state.buffer=""):this.state.buffer+=s}break;case h.st:this.state.quote||this.state.buffer.length||'"'!==s&&"'"!==s?s===this.state.quote||!this.state.quote&&this.state.buffer.length?(e?.(t,i,this.state.context,h.it),this.state.context=h.it,this.state.quote=null,this.state.buffer=""):this.state.quote||">"!==s?" "!==s&&(this.state.buffer+=s):(e?.(t,i+1,this.state.context,h.Text),this.state.context=h.Text,this.state.quote=null,this.state.buffer=""):this.state.quote=s}}return e?.(t,t.length,this.state.context,null),this.state.context}}h.st="Attribute",h.Text="Text",h.it="Tag";class u extends f{attrName;U;lt;Y;constructor(t,e,i=null,s=null){super(null,e),this.attrName=i,this.U=s}apply(t){if(this.U){let e=this.G,i=this.nt(t),s=this.Y;(s?e[this.attrName]:e.getAttribute(this.attrName))!==i&&(s?e[this.attrName]=i:"value"===this.attrName&&e.hasAttribute("contenteditable")&&(e.innerHTML=i),e.setAttribute(this.attrName,i))}else this.V(t[0])}V(t){if(this.U)return this.apply([t]);let e=this.G;if(s(t)){if(this.q&&e.tagName.endsWith("-SOLARITE-PLACEHOLDER"))return;let[s,l]=[t[0],t.slice(1)];if(!s)throw Error(`Solarite cannot bind to <${e.tagName.toLowerCase()} ${this.attrName}=\${[${t.map((t=>t?`'${t}'`:t+"")).join(", ")}]}>.`);let r=i(s,l);if("value"===this.attrName&&"select-multiple"===e.type&&Array.isArray(r)){let t=r.map((t=>t+""));for(let i of e.options)i.selected=t.includes(i.value)}else if("radio"===e.type)e.checked=e.value===r+"";else{const t=n.P(r)?"":r;"value"===this.attrName&&e.hasAttribute("contenteditable")?t!==e.innerHTML&&(e.innerHTML=t):t!==e[this.attrName]&&(e[this.attrName]=t)}let o=()=>{let t="value"===this.attrName||"radio"===e.type?n.O(e):e[this.attrName];i(s,l,t)};this.rt(e,this.W.getRootNode(),this.attrName,"input",o,null,!0)}else{let i=this.Y;if("function"==typeof t){if(this.q)return;t=t()}else t=n.M(t);void 0===t||!1===t||null===t?(i&&(e[this.attrName]=!1),e.removeAttribute(this.attrName)):!0===t?(i&&(e[this.attrName]=!0),e.setAttribute(this.attrName,"")):(i?e[this.attrName]:e.getAttribute(this.attrName)??"")!==t&&(i?e[this.attrName]=t:"value"===this.attrName&&e.hasAttribute("contenteditable")&&(e.innerHTML=t),e.setAttribute(this.attrName,t))}}_(){return this.U?this.U.length-1:1}nt(t){if(!this.U)return t[0];let e=[],i=this.U;for(let s=0;i.length>s;s++)if(e.push(i[s]),i.length-1>s){let i=n.M(t[s]);n.P(i)||e.push(i)}return e.join("")}rt(t,e,i,s,l,n,r=!1){if("function"!=typeof l)throw Error(`Solarite cannot bind to <${t.tagName.toLowerCase()} ${this.attrName}=\${${l}}> because it's not a function.`);let o,f=this.W.ot.options,h=n||[l],u=t[a];if(void 0!==u){if(u instanceof g){if(u.key!==i){let l=t[a]={};return l[u.key]=u,o=l[i]=new g(e,t,i,h),void d(o,t,s,r,f,e)}o=u}else if(o=u[i],!o)return o=u[i]=new g(e,t,i,h),void d(o,t,s,r,f,e);o.root=e,o.ft=h}else d(t[a]=new g(e,t,i,h),t,s,r,f,e)}}const a=Symbol("solariteEvents");function c(t,e){let i=t[a];if(void 0!==i)return i instanceof g?i.key===e?i:void 0:i[e]}function d(t,e,i,s,l,n){let r=!1;if(!1===s){let t=l?.eventDelegation??!0;!1!==t&&p.has(i)&&(r=!0===t||t.includes(i))}if(r){t.ht=!0;let e=n[y];void 0===e&&(e=n[y]=new Set),e.has(i)||(e.add(i),n.addEventListener(i,b))}else e.addEventListener(i,t,s)}const p=new Set(["beforeinput","click","contextmenu","dblclick","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),y=Symbol("solariteDelegatedTypes"),m=Symbol("solariteDelegated");function b(t){if(t[m])return;t[m]=!0;let e=t.type,i=t.target;for(Object.defineProperty(t,"currentTarget",{configurable:!0,get:()=>i});i;){let s=i[a];if(void 0!==s){let i=s instanceof g?s:s[e];if(void 0!==i&&!0===i.ht&&i.key===e&&(i.handleEvent(t),t.cancelBubble))break}i=i.parentNode}delete t.currentTarget}class g{constructor(t,e,i,s){this.root=t,this.node=e,this.key=i,this.ft=s}handleEvent(t){let e=this.ft;switch(e.length){case 1:return e[0].call(this.root,t,this.node);case 2:return e[0].call(this.root,e[1],t,this.node);case 3:return e[0].call(this.root,e[1],e[2],t,this.node)}return e[0].call(this.root,...e.slice(1),t,this.node)}}class v extends u{ut;constructor(t,e,i=null,s=null){super(null,e,i,s),this.ut=i?i.slice(2):null}apply(t){this.U?.length>1?super.apply(t):this.V(t[0])}V(t){if(this.U?.length>1)return super.apply([t]);if(this.q&&this.G.tagName.endsWith("-SOLARITE-PLACEHOLDER"))return;let e,i=this.W.ot.root,s=this.G,l=this.ut;if(Array.isArray(t)&&"function"==typeof t[0])e=t[0];else{if("function"!=typeof t)throw Error(`Invalid event binding: <${s.tagName.toLowerCase()} ${this.attrName}=\${${JSON.stringify(t)}}>`);e=t,t=null}this.rt(s,i,l,l,e,t)}}const w=Symbol("Fragment");class E{constructor(t,e){this.name=t,this.value=e}}const S=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),k=new Map;function $(t){if(null===t||"object"!=typeof t)return t;let e="";for(let i in t){let s=t[i];null!=s&&!1!==s&&(e+=(e?";":"")+n.N(i)+":"+s)}return e}function x(t){return(""+t).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function A(t,e,i=[],s){if(e=e||{},t===w){let t=[""];for(let e=0;i.length>e;e++)t.push("");return new Q(t,i)}if("function"==typeof t){if(t.prototype instanceof HTMLElement){n.C(t);let l=customElements.ct?customElements.ct(t):n.N(t.name);return l&&!l.includes("-")&&(l+="-element"),T(l,e,i,s)}let l={};for(let t in e)"key"!==t&&(l[t]="style"===t?$(e[t]):e[t]);!("children"in l)&&i.length&&(l.children=1===i.length?i[0]:i);let r=t(l);return void 0===s&&(s=e.key),void 0!==s&&r instanceof Q&&(r.key=s),r}return T(t,e,i,s)}function T(t,e,i,s){let l=S.has(t.toLowerCase()),n=[],r=[],o="";for(let t in e){if("children"===t)continue;if("key"===t){void 0===s&&(s=e[t]);continue}let i=e[t];"id"!==t&&"data-id"!==t||"string"!=typeof i?("style"===t&&(i=$(i)),n.push(t),r.push(i)):o+=` ${t}="${x(i)}"`}let f=l?0:i.length,h=t+o+"\0"+n.join("\0")+"\0#"+f,u=k.get(h);u||(u=((t,e,i,s,l)=>{let n=[],r="<"+t+e;for(let t of i)n.push(r+" "+t+"="),r="";if(r+=">",l)return n.push(r),n;if(0===s)n.push(r+"</"+t+">");else{n.push(r);for(let t=1;s>t;t++)n.push("");n.push("</"+t+">")}return n})(t,o,n,f,l),k.set(h,u));let a=l?r:r.concat(i),c=new Q(u,a);return void 0!==s&&(c.key=s),c}class N extends f{dt;lt;constructor(t,e){super(null,null),this.G=e,this.dt=new Set}apply(t){this.V(t[0])}V(t){let e=this.G;if(t instanceof E)return this.yt(t);Array.isArray(t)&&(t=t.flat().join(" "));let i=this.dt;if(this.dt=new Set,t)if("function"==typeof t&&(t=t()),"object"==typeof t)for(let i in t){let s=t[i];void 0!==s&&!1!==s&&null!==s&&(e.setAttribute(i,s),this.dt.add(i))}else{let i=n.R(t);for(let t in i)e.setAttribute(t,i[t]),this.dt.add(t)}for(let t of i)this.dt.has(t)||e.removeAttribute(t)}yt(t){let e=t.name;if("key"===e)return;let i=t.value,s=this.bt;if(void 0===s||this.gt!==e){let t=this.G;n.L(e)?s=new v(null,t,e,null):(s=new u(null,t,e,null),s.Y=n.j(t,e)),s.q=this.q,this.bt=s,this.gt=e}s.G=this.G,s.W=this.W,"style"===e&&(i=$(i)),s.V(i)}_(){return 1}nt(t){return t[0]}}class C{data={};add(t,e){let i=this.data,s=i[t];s?s.push(e):i[t]=[e]}vt(t,e,i){let s=this.data,l=s[t];l?i>l.length-(l.head||0)&&l.push(e):s[t]=[e]}wt(t){let e=this.data,i=e[t];if(!i)return;let s=i.head||0,l=i[s];return s++,i.length>s?i.head=s:delete e[t],l}}class O extends f{Et=null;St=null;kt=null;$t=null;xt=null;At=null;constructor(t,e){super(t,e)}apply(t){this.V(t[0])}V(t){let i=typeof t;if(("string"===i||"number"===i)&&!this.Tt){"string"!==i&&(t+="");let s=this.St;if(null!==s)return void(this.kt!==t&&(s.nodeValue=t,this.kt=t));let l=this.Et;if(null===l||0===l.length){let i;if(this.I){let e=this.G.firstChild;if(null!==e&&3===e.nodeType&&e===this.G.lastChild)return e.nodeValue!==t&&(e.nodeValue=t),this.St=e,void(this.kt=t);this.G.textContent=t,i=this.G.firstChild}else i=e.i.createTextNode(t),this.G.parentNode.insertBefore(i,this.G);return this.St=i,this.kt=t,void(this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot()))}if(1===l.length){let e=l[0],i=e.Lt;if(!0===i.jt)return void(i.html[0]!==t&&(e.Pt.nodeValue=t,i.html[0]=t,e.Rt=t))}}if(null!==this.St){let t=new Z(P(this.kt),this,this.St);(this.Et??=[]).push(t),this.St=null}let s=[],l=this.Mt(t,s,!1);if(l||this.Tt)this.Tt=l,this.Dt(s);else{let t=0!==s.length?s[0]:null;(null!==t?"string"==typeof t||void 0===t.key&&0>I.get(t.html,t.Ft).Ht:null===this.Et||0===this.Et.length||void 0===this.Et[0].key)?this.Gt(s):this.It(s)}}Gt(t){let i=this.Et||L,s=i.length,l=t.length,r=Array(l),o=0,f=s,h=l;for(;f>o&&h>o;){let e=i[o],s=t[o];if(!R(e,s))break;e.zt&&e.Wt(s.exprs,!1),r[o]=e,o++}for(;f>o&&h>o;){let e=i[f-1],s=t[h-1];if(!R(e,s))break;e.zt&&e.Wt(s.exprs,!1),r[--h]=e,f--}for(;f>o&&h>o;){let e=i[o],s=t[o];if(R(e,s))e.zt&&e.Wt(s.exprs,!1);else{if(!M(e,s))break;this.Jt(e,s)}r[o]=e,o++}let u=f-o,a=h-o;if(u||a){if(u){for(let t=o;f>t;t++){let e=i[t];e.Pt!==e.Vt&&e._t()}let t=0===l&&0===o&&this.Bt(),e=this.At??=new C;for(let s=o;f>s;s++){let l=i[s];l.Pt!==l.Vt?n.D(l._t()):t||l.Pt.remove(),l.Lt.jt||e.vt(l.Rt,l,j)}}if(a){let i=this.I,s=l>h?r[h].Pt:i?null:this.G,n=i?this.G:this.G.parentNode,f=n,u=s,c=null;a>1&&(c=e.i.createDocumentFragment(),f=c,u=null);for(let e=o;h>e;e++){let i=this.Kt(t[e]);r[e]=i;let s=i.Pt,l=i.Vt;if(s===l)f.insertBefore(s,u);else for(;;){let t=s.nextSibling;if(f.insertBefore(s,u),s===l)break;s=t}}c&&n.insertBefore(c,s)}this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot())}this.Et=r,this.$t&&(this.$t=null),this.xt&&(this.xt=null)}It(t){let i=this.Et||L,s=i.length,l=t.length,r=Array(l),o=null,f=-1;const h=t=>void 0!==t.key?t.key:(t.html!==o&&(o=t.html,f=I.get(t.html,t.Ft).Ht),0>f?void 0:t.exprs[f]);let u=0,a=s,c=l;for(;a>u&&c>u;){let e=i[u],s=t[u];if(e.Lt===s)e.zt&&e.Wt(s.exprs,!1);else{if("string"==typeof s||e.key!==h(s)||!M(e,s))break;R(e,s)?e.zt&&e.Wt(s.exprs,!1):this.Jt(e,s)}r[u]=e,u++}for(;a>u&&c>u;){let e=i[a-1],s=t[c-1];if(e.Lt===s)e.zt&&e.Wt(s.exprs,!1);else{if("string"==typeof s||e.key!==h(s)||!M(e,s))break;R(e,s)?e.zt&&e.Wt(s.exprs,!1):this.Jt(e,s)}r[--c]=e,a--}let d=a-u,p=c-u;if(d||p){let s=this.I,o=s?this.G:this.G.parentNode,f=0,y=!1,m=null,b=null;if(d)if(p){let e=new Map;for(let i=u;c>i;i++){let s=t[i];"string"!=typeof s&&e.set(h(s),i)}m=Array(p).fill(-1);let s=-1;for(let l=u;a>l;l++){let n,o=i[l],h=void 0===o.key?void 0:e.get(o.key);void 0!==h&&-1===m[h-u]&&M(o,n=t[h])?(m[h-u]=l,f++,s>h?y=!0:s=h,R(o,n)?o.zt&&o.Wt(n.exprs,!1):this.Jt(o,n),r[h]=o):(b??=[]).push(o)}}else b=i.slice(u,a);if(b){for(let t of b)t.Pt!==t.Vt&&t._t();if(0!==u||c!==l||0!==f||!this.Bt())for(let t of b)t.Pt!==t.Vt?n.D(t._t()):t.Pt.remove()}if(p){let i=l>c?r[c].Pt:s?null:this.G;if(0===f){let s=o,l=i,n=null;p>1&&(n=e.i.createDocumentFragment(),s=n,l=null);for(let e=u;c>e;e++){let i=this.Zt(t[e]);r[e]=i;let n=i.Pt,o=i.Vt;if(n===o)s.insertBefore(n,l);else for(;;){let t=n.nextSibling;if(s.insertBefore(n,l),n===o)break;n=t}}n&&o.insertBefore(n,i)}else{let e=y?(t=>{let e=[],i=Array(t.length);for(let s=0;t.length>s;s++){let l=t[s];if(-1===l)continue;let n=0,r=e.length;for(;r>n;){let i=n+r>>1;l>t[e[i]]?n=i+1:r=i}n>0&&(i[s]=e[n-1]),n===e.length?e.push(s):e[n]=s}let s=e.length;if(s){let t=e[s-1];for(;s-- >0;)e[s]=t,t=i[t]}return e})(m):null,s=null!==e?e.length-1:-1;for(let l=c-1;l>=u;l--){let n=r[l];void 0===n?(n=this.Zt(t[l]),r[l]=n,D(o,n,i)):null!==e&&(0>s||e[s]!==l-u?D(o,n,i):s--),i=n.Pt}}}this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot())}this.Et=r,this.$t&&(this.$t=null),this.xt&&(this.xt=null)}Zt(t){if("string"==typeof t)return new Z(P(t),this);let e=new Z(t,this);return(t.exprs.length||e.Ut&&e.Ut.length)&&e.Wt(t.exprs),e}Jt(t,e){if("string"==typeof e)t.Pt.nodeValue=e,t.Lt.html[0]=e,t.Rt=e;else{if(t.qt){if(null!==t.Ut||!t.Yt(e)){let i=t.Lt.exprs,s=e.exprs,l=t.Ut??t.Xt();for(let t=l.length-1;t>=0;t--)et(i[t],s[t])||l[t].V(s[t])}t.styles&&t.Qt(),t.J=null,t.Nt=!1}else t.Wt(e.exprs);t.Lt=e,void 0!==e.key&&(t.key=e.key)}}Kt(t){let e;if("string"==typeof t)return t=P(t),new Z(t,this);let i=this.At;return i&&(e=i.wt(t.te()),e)?(this.Jt(e,t),e):(e=new Z(t,this),(t.exprs.length||e.Ut&&e.Ut.length)&&e.Wt(t.exprs),e)}Mt(t,e,i){if(t instanceof Q)e.push(t);else if(Array.isArray(t))for(let s of t)s instanceof Q?e.push(s):i=this.Mt(s,e,i);else if("function"==typeof t)i=this.Mt(t(),e,i);else if(t instanceof NodeList){for(let i of t)e.push(i);i=i||t.length>0}else if(t?.nodeType){if(11===t.nodeType)for(let i of[...t.childNodes])e.push(i);else e.push(t);i=!0}else void 0===t||!1===t||null===t?t="":"string"!=typeof t&&(t+=""),e.push(t);return i}Dt(t){let e=this;e.ee();let i=[],s=e.Et||L;e.Et=[];for(let s of t)if("string"==typeof s&&(s=P(s)),s instanceof Q){let t=e.ie(s);i.push(...t._t()),e.Et.push(t)}else i.push(s);let l=e._t();if(!n.v(l,i)){e.J=i,this.W.Ct&&this.W.Ct.Ot(),l.length&&!i.length&&e.Bt()||(e.I?H(e.G,l,i,null):H(e.G.parentNode,l,i,e.G));for(let t of s)t.Pt.parentNode||n.D(t._t())}}Ot(){let t=this,e=this.I?this.G:this.G.parentNode;for(;t&&(t.I?t.G:t.G.parentNode)===e;)t.J=null,t=t.W?.Ct}Bt(){if(this.I)return this.G.textContent="",!0;let t=this.F.parentNode;return this.F===t.firstChild&&this.G===t.lastChild&&(t.innerHTML="",t.append(this.F,this.G),!0)}ie(t){let e=t.te(),i=this.xt?.wt(e)||this.At?.wt(e);return i?(tt(i.Lt,t)?i.zt&&i.Wt(t.exprs,!1):i.Wt(t.exprs),i.Lt=t):(i=new Z(t,this),i.Wt(t.exprs)),(this.$t??=[]).push(i),i}ee(){let t=this.xt?.data;if(t){let e=(this.At??=new C).data;for(let i in t){let s=t[i],l=s.head||0,n=e[i];if(n)for(let t=l,e=j+(n.head||0);s.length>t&&e>n.length;t++)n.push(s[t]);else n=e[i]=l?s.slice(l):s,n.length>j&&(n.length=j)}}this.xt=new C;let e=this.xt,i=this.$t?.length?this.$t:this.Et;if(i)for(let t of i)e.add(t.Rt,t);this.$t=null}_t(){let t;if(t=this.J,t)return t;t=[];let e,i=null;for(this.I?e=this.G.firstChild:(e=this.F.nextSibling,i=this.G);e&&e!==i;)t.push(e),e=e.nextSibling;return this.J=t,t}}const L=[],j=1e4;function P(t){let e=new Q([t],[]);return e.jt=!0,e}function R(t,e){let i=t.Lt;return i===e||("string"==typeof e?!0===i.jt&&i.html[0]===e:tt(i,e))}function M(t,e){let i=t.Lt;return"string"==typeof e?!0===i.jt:i.html===e.html&&i.Ft===e.Ft}function D(t,e,i){let s=e.Pt,l=e.Vt;if(s===l)t.insertBefore(s,i);else for(;;){let e=s.nextSibling;if(t.insertBefore(s,i),s===l)break;s=e}}function H(t,e,i,s){if(e.length){let s=new Set(i);for(let i of e)s.has(i)||i.parentNode!==t||t.removeChild(i)}let l=s;for(let e=i.length;e--;){let s=i[e];s.nextSibling===l&&s.parentNode===t||t.insertBefore(s,l),l=s}}class F extends f{apply(t){this.W.key=t[0]}V(t){this.W.key=t}}class G extends f{se;le;constructor(t,e){super(null,e)}apply(t){let l=(t=>{const e=new Set;return JSON.stringify(t,((t,i)=>{if("function"==typeof i)return X(i);if("object"==typeof i&&null!==i){if(i instanceof Node)return X(i);if(e.has(i))return X(i);if(e.add(i),i instanceof Q)return{html:X(i.html),exprs:i.exprs}}return i}))})(t),r=l!==this.le;this.le=l;let o=this.G,f=n.S(o,"_is");for(let e,l=0;e=this.se[l];l++)if(!(e instanceof F))if(e instanceof u){let r=n.k(e.attrName),o=e.nt(t[l]);!e.U&&s(o)&&(o=i(o[0],o.slice(1))),f[r]=o}else{let i=e.nt(t[l]);if("object"==typeof i)for(let t in i)f[n.k(t)]=i[t];else if("string"==typeof i){let t=n.R(i);for(let e in t)f[n.k(e)]=t[e]}}let h=o.getAttribute("_is");if(o.tagName.endsWith("-SOLARITE-PLACEHOLDER")||h){let s=(h||o.tagName.slice(0,-21)).toLowerCase(),l=customElements.get(s);if(!l)throw Error(`Must call customElements.define('${s}', Class) before using it.`);e.t=[...o.childNodes];let n=new l(f);h&&n.setAttribute("is",h);for(let t of o.attributes)"_is"!==t.name&&n.setAttribute(t.name,t.value);for(let t in f){let e=f[t],i=typeof e;"boolean"===i?!1!==e&&null!=e&&n.setAttribute(t,""):"string"!==i&&"number"!==i&&"bigint"!==i||n.setAttribute(t,e)}let r=n.getAttribute("data-id")||n.getAttribute("id");r&&i(this.W.getRootNode(),r.split(/\./g),n);let u=this.W;this.G=n;for(let t of u.Ut)t.G===o&&(t.G=n),t.F===o&&(t.F=n);u.Pt===o&&(u.Pt=n),u.Vt===o&&(u.Vt=n),"function"!=typeof n.render||e.p.has(n)||n.render(f,!0);for(let e,i=0;e=this.se[i];i++)e.W=this.W,e.G=n,e.apply(t[i]);o.replaceWith(n)}else"function"==typeof o.render&&o.render(f,r);e.t=null}clone(t,e=0){let i=this.B(t,e),s=new G(null,i);return s.se=this.se.map((i=>i.clone(t,e))),s}_(){return 0}}class I{fragment;Ut=[];ids=[];styles=[];scripts=[];zt=!1;qt=!1;ne=!1;Ht=-1;re=!1;oe=!1;constructor(t=null,i=!1){if(!t)return;if(1===t.length&&!t[0].match(/[<&]/))return void(this.fragment=e.i.createTextNode(t[0]));let s,l=I.fe(t),r=e.i.createElement("template");if(l)if(i){r.innerHTML="<svg>"+l+"</svg>";let t=r.content.firstChild,i=e.i.createDocumentFragment();for(;t.firstChild;)i.append(t.firstChild);this.fragment=i}else r.innerHTML=l,this.fragment=r.content;else r.content.append(e.i.createTextNode("")),this.fragment=r.content;J(this.fragment);let o=[],h=0;const a=e.i.createTreeWalker(this.fragment,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);for(;s=a.nextNode();)if(o.map((t=>t.remove())),o=[],1===s.nodeType){const t=s.hasAttribute("is"),e=t||s.tagName.includes("-"),l=[];for(let t of[...s.attributes]){if("key"===t.name){let i=t.value.split(/[\ue000-\uf8ff]/g);if(2!==i.length||""!==i[0]||""!==i[1])throw Error("The key attribute is reserved and must be a single expression: key=${...}");if(s.parentNode!==this.fragment)throw Error("The key attribute must be on a top-level element of its template.");if(this.Ht>=0)throw Error("A template can have only one key attribute.");this.Ht=t.value.charCodeAt(0)-K;let n=new F(null,s);this.Ut.push(n),e&&l.push(n),h++,s.removeAttribute("key");continue}let r=t.name.match(/^[\ue000-\uf8ff]$/);if(r){let t=new N(null,s);this.Ut.push(t),e&&(t.q=!0,l.push(t)),h++,s.removeAttribute(r[0])}else{let r=t.value.split(/[\ue000-\uf8ff]/g);if(r.length>1){let o=2!==r.length||r[0].length||r[1].length?r:null,f=n.L(t.name),a=f?new v(null,s,t.name,o):new u(null,s,t.name,o);if(a.Y=n.j(s,t.name),this.Ut.push(a),e&&(a.q=!0,l.push(a)),h+=r.length-1,i||f&&!o)s.removeAttribute(t.name);else try{s.setAttribute(t.name,r.join(""))}catch(e){throw Error(`Error setting attribute "${t.name}" on node <${s.tagName}>: ${e.message}`)}}}}if(e){let e=new G(null,s);e.se=l,this.Ut.splice(this.Ut.length-l.length,0,e),t&&(s.setAttribute("_is",s.getAttribute("is")),s.removeAttribute("is"))}}else if(8===s.nodeType&&"!✨!"===s.nodeValue){if(s?.parentNode?.closest&&s?.parentNode?.closest("[contenteditable]"))throw Error('Contenteditable can\'t have expressions inside them. Use <div contenteditable value="${...}"> instead.');let t=s.parentNode;if(1!==t.nodeType||s.previousSibling||s.nextSibling||t.tagName.includes("-")||"SLOT"===t.tagName||t.hasAttribute("is")){let t,i=s.previousSibling;i||(i=e.i.createComment("Path:"+this.Ut.length),s.parentNode.insertBefore(i,s)),!s.nextSibling||8===s.nextSibling.nodeType&&"!✨!"===s.nextSibling.textContent?(t=s,t.textContent="PathEnd:"+this.Ut.length):(t=s.nextSibling,o.push(s));let l=new O(i,t);this.Ut.push(l),h++}else{let e=new O(null,t);e.I=!0,this.Ut.push(e),h++,o.push(s)}}else{if(3===s.nodeType&&"TEXTAREA"===s.parentNode?.tagName&&s.textContent.includes("\x3c!--!✨!--\x3e"))throw Error('Textarea can\'t have expressions inside them. Use <textarea value="${...}"> instead.');if(8===s.nodeType){let t=s.textContent.split(/[\ue000-\uf8ff]/g);for(let e=0;t.length-1>e;e++){let t=new f(s.previousSibling,s);this.Ut.push(t),h++}}else if(3===s.nodeType&&["SCRIPT","STYLE"].includes(s.parentNode?.nodeName)){let t=s.textContent.split(z);if(t.length>1){let i=[];for(let l=0;t.length>l;l++){let n=e.i.createTextNode(t[l]);s.parentNode.insertBefore(n,s),l>0&&i.push(n)}for(let t,e=0;t=i[e];e++){let e=new O(t.previousSibling,t);this.Ut.push(e),h++}o.push(s)}}}if(o.map((t=>t.remove())),h!==t.length-1)throw Error("Could not parse expressions in template. Check for duplicate attributes or malformed html: "+t.join("${...}"));for(let t of this.Ut)t.F&&(t.X=[].indexOf.call(t.F.parentNode.childNodes,t.F)),t.K=f.get(t.G);this.he(),this.ue(),this.qt=!0;for(let t of this.Ut){if(t instanceof G){this.zt=!0,this.qt=!1;break}1!==t._()&&(this.qt=!1)}if(this.re&&this.qt){let t=[],e=!0;for(let i=0;this.Ut.length>i;i++){let s=this.Ut[i];if(s instanceof O){if(!s.I){e=!1;break}t.push(i)}else if(!(s instanceof u||s instanceof F)){e=!1;break}}e&&(this.oe=!0,this.ae=t,this.ce=this.Ut.map((t=>t.Z(null,t.G))))}}static fe(t){let e=[],i=new h;for(let s=0;t.length>s;s++){let l=0,n=i.parse(t[s],((t,i,s)=>{if(l!==i){let n=t.slice(l,i);s===h.it&&(n=n.replace(/^<\/?[a-z][a-z0-9]*-[a-z0-9-]+/i,(t=>t+"-SOLARITE-PLACEHOLDER"))),e.push(n)}l=i}));t.length-1>s&&e.push(n===h.Text?z:String.fromCharCode(K+s))}return e.join("")}he(){this.scripts=[].map.call(this.fragment.querySelectorAll("script"),(t=>f.get(t))),this.styles=[].map.call(this.fragment.querySelectorAll("style"),(t=>f.get(t)));let t=this.fragment.querySelectorAll("[id],[data-id]");for(let i of t){let t=i.getAttribute("data-id")||i.getAttribute("id");if(e.div.hasOwnProperty(t))throw Error(`<${i.tagName.toLowerCase()} id="${t}"> can't override existing HTMLElement id property.`)}this.ids=[].map.call(t,(t=>f.get(t))),this.ne=this.ids.length>0||this.styles.length>0||this.scripts.length>0}ue(){let t=!1;for(let e of this.Ut)if(e instanceof G){t=!0;break}if(t||!this.Ut.length)return;let e=[],i=new Map,s=this.fragment,l=1,n=t=>{if(t===s)return 0;let r=i.get(t);return void 0===r&&(e.push(n(t.parentNode),[].indexOf.call(t.parentNode.childNodes,t)),r=l++,i.set(t,r)),r};for(let t of this.Ut)t.de=t.G===s?0:n(t.G),t.pe=t.F?n(t.F):-1;this.ye=e,this.me=Array(l),this.ne||1!==s.childNodes.length||1!==s.firstChild.nodeType||2>e.length||0!==e[0]||0!==e[1]||(this.re=!0)}static get(t,i=!1){if(t===V&&i===_)return B;let s=e.m.get(t);s||(s={},e.m.set(t,s));let l=i?"svg":"html",n=s[l];return n||(n=s[l]=new I(t,i)),V=t,_=i,B=n,n}}const z="\x3c!--!✨!--\x3e",W=["TABLE","THEAD","TBODY","TFOOT","TR"];function J(t){let e=1===t.nodeType&&W.includes(t.tagName),i=t.firstChild;for(;i;){let t=i.nextSibling;1===i.nodeType?J(i):e&&3===i.nodeType&&!i.nodeValue.trim()&&i.remove(),i=t}}let V=null,_=!1,B=null;const K=57344;class Z{ot;Ct;Pt;Vt;Ut=null;Rt;key;zt=!1;qt=!1;Nt=!0;J;styles;Lt;constructor(t,i=null,s=null,l=null){if(this.ot=i?.W?.ot||this,this.Ct=i,this.Lt=t,void 0!==t.key&&(this.key=t.key),t.jt)this.Rt=t.te(),this.Pt=this.Vt=s||e.i.createTextNode(t.html[0]);else{const e=I.get(t.html,t.Ft);if(this.Rt=e.Rt??=t.te(),this.zt=e.zt,this.qt=e.qt,e.re&&null!==i){const t=e.fragment.firstChild.cloneNode(!0);this.Pt=this.Vt=t,!0!==e.oe&&this.be(t,e,0,!0)}else{const t=e.fragment.cloneNode(!0);11===t.nodeType?(this.Pt=t.firstChild,this.Vt=t.lastChild):this.Pt=this.Vt=t,this.instantiate(e,t,s,l)}}}instantiate(t,e,i,s){t.Ut.length?this.be(e,t):this.Ut=[],t.ne&&this.ge(e,t)}Wt(t,e=!0){let i=this.Ut;if(this.qt){if(e){if(null===i)return void this.ve(t);for(let e=i.length-1;e>=0;e--)i[e].V(t[e]);this.styles&&this.Qt(),this.J=null}return void(this.Nt=!1)}if(!i)return void(this.Nt=!1);let s=t.length,l=Array(i.length);for(let n,r=i.length-1;n=i[r];r--){if(0===r&&n instanceof G&&n.G===this.getRootNode())continue;let i=n._();if(l[r]=t.slice(s-i,s),s-=i,n instanceof G){let t=l.slice(r+1,r+1+n.se.length);n.apply(t)}else e&&n.apply(l[r])}e&&(this.Qt(),this.J=null),this.Nt=!1}ve(t){let e=this.Lt,i=I.get(e.html,e.Ft),s=i.ae;for(let e=0;s.length>e;e++){let l=typeof t[s[e]];if("string"!==l&&"number"!==l){let e=this.Xt(i);for(let i=e.length-1;i>=0;i--)e[i].V(t[i]);return this.J=null,void(this.Nt=!1)}}let l=this.we(i),n=i.Ut,r=i.ce;for(let e=n.length-1;e>=0;e--){let i=r[e],s=l[n[e].de];if(i.I){let i=t[e];"number"==typeof i&&(i+=""),s.textContent=i}else i.G=s,i.W=this,i.V(t[e])}this.J=null,this.Nt=!1}Yt(t){let e=I.get(t.html,t.Ft),i=t.exprs,s=e.ae;for(let t=0;s.length>t;t++){let e=typeof i[s[t]];if("string"!==e&&"number"!==e)return!1}let l=this.Lt.exprs,n=e.Ut,r=e.ce,o=null;for(let t=n.length-1;t>=0;t--)if(!et(l[t],i[t])){null===o&&(o=this.we(e));let s=r[t],l=o[n[t].de];if(s.I){let e=i[t],n=l.firstChild;"number"==typeof e&&(e+=""),null!==n&&3===n.nodeType&&n===l.lastChild?n.nodeValue=e:(s.G=l,s.W=this,s.V(i[t]),s.St=null,s.kt=null,s.J=null);continue}s.G=l,s.W=this,s.V(i[t])}return!0}we(t){let e=t.me;e[1]=this.Pt;let i=t.ye;for(let t=2,s=2;i.length>t;t+=2,s++){let l=e[i[t]].firstChild;for(let e=i[t+1];e>0;e--)l=l.nextSibling;e[s]=l}return e}Xt(t=null){t??=I.get(this.Lt.html,this.Lt.Ft);let e=this.we(t),i=t.Ut,s=i.length,l=this.Ut=Array(s);for(let t=0;s>t;t++){let s=i[t],n=s.Z(0>s.pe?null:e[s.pe],e[s.de]);n.W=this,l[t]=n}for(let e of t.ae){let t=l[e],i=t.G.firstChild;null!==i&&3===i.nodeType&&i===t.G.lastChild&&(t.St=i,t.kt=i.nodeValue)}return l}_t(){let t=this.J;if(t)return t;t=[];let e=this.Pt,i=this.Vt?.nextSibling;for(;e&&e!==i;)t.push(e),e=e.nextSibling;return this.J=t,t}getRootNode(){return this.ot.root}Ee(){return this.ot}be(t,e,i=0,s=!1){let l=e.Ut,n=l.length,r=this.Ut=Array(n),o=e.ye;if(o&&0===i){let i=e.me,f=0,h=1;for(s?(i[1]=t,f=2,h=2):i[0]=t;o.length>f;f+=2,h++){let t=i[o[f]].firstChild;for(let e=o[f+1];e>0;e--)t=t.nextSibling;i[h]=t}for(let t=0;n>t;t++){let e=l[t],s=e.Z(0>e.pe?null:i[e.pe],i[e.de]);s.W=this,r[t]=s}}else for(let e=0;n>e;e++){let s=l[e].clone(t,i);s.W=this,r[e]=s}}Qt(){if(this.styles)for(let[t,e]of this.styles)e!==t.textContent&&n.A(t,this.Ee().root)}ge(t,e,i=0){let s=this.ot.root;if(s){let l=this.ot.options;if(!1!==l?.ids)for(let l of e.ids){i&&(l=l.slice(0,-i));let e=f.resolve(t,l);n.$(s,e)}if(!1!==l?.styles){e.styles.length&&(this.styles=new Map);for(let l of e.styles){i&&(l=l.slice(0,-i));let e=f.resolve(t,l);1===s.nodeType&&(n.A(e,s),this.styles.set(e,e.textContent))}}if(!1!==l?.scripts)for(let s of e.scripts){i&&(s=s.slice(0,-i));let e=f.resolve(t,s);(0,eval)(e.textContent)}}}}class U extends Z{instantiate(t,i,s,l){let n=0;if(this.options=l,i instanceof Text){if(!s)throw Error("Cannot create a standalone text node");this.root=s,i.nodeValue.length&&this.root.append(i)}else{if(s){let t;if(this.root=s,(e.t||s.childNodes.length)&&(t=e.i.createDocumentFragment(),t.append(...e.t||s.childNodes)),o=this.root.tagName,1===(r=i).children.length&&o.includes("-")&&r.children[0].tagName.replace("-SOLARITE-PLACEHOLDER","")===o){this.root.append(...i.children[0].childNodes);for(let t of i.children[0].attributes)this.root.hasAttribute(t.name)||this.root.setAttribute(t.name,t.value);n=1}else 1===i.childNodes.length&&3===i.childNodes[0].nodeType&&""===i.childNodes[0].textContent||this.root.append(...i.childNodes);if(t){for(let e of s.querySelectorAll("slot[name]")){let i=e.getAttribute("name");if(i){let s=t.querySelectorAll(`[slot='${i}']`);e.append(...s)}}let e=s.querySelector("slot:not([name])");e?e.append(t):s.append(t)}}else{let t=(t=>{let e=[];for(let i of t.childNodes)if(1===i.nodeType||3===i.nodeType&&i.textContent.trim().length){if(e.length)return null;e.push(i)}return e[0]})(i);this.root=t||i,t&&(n=1)}this.be(this.root,t,n),this.ge(this.root,t,n)}var r,o;this.Pt=this.Vt=this.root,e.h.set(this.root,this)}}let q=1,Y=new WeakMap;function X(t){let e=Y.get(t);return void 0===e&&(e="~@"+q++,Y.set(t,e)),e}class Q{exprs=void 0;html=void 0;Rt;jt;key;Ft=!1;constructor(t=[""],e=[]){this.html=t,this.exprs=e}render(t=null,i={}){let s=t&&e.h.get(t);return s||(s=new U(this,null,t,i),t||(t=s.getRootNode()),e.h.set(t,s)),1!==this.html?.length||this.html[0]?s.Wt(this.exprs):t.innerHTML="",t}te(){return void 0===this.Rt&&(this.Rt=this.exprs.length?X(this.html):this.html[0]),this.Rt}}function tt(t,e){if(t.html===e.html&&t.Ft===e.Ft){let i=t.exprs,s=e.exprs;for(let t=0;i.length>t;t++)if(!et(i[t],s[t]))return!1;return!0}return t.jt===e.jt&&!t.exprs.length&&!e.exprs.length&&1===t.html.length&&1===e.html.length&&t.Ft===e.Ft&&t.html[0]===e.html[0]}function et(t,e){if(t===e)return!0;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;t.length>i;i++)if(!et(t[i],e[i]))return!1;return!0}return t instanceof Q&&e instanceof Q&&tt(t,e)}function it(t){if("string"==typeof t){let i=e.i.createElement("template");i.innerHTML=t;let s=n.H(i.content.childNodes);return 1===s.length?s[0]:i.content}if(t instanceof Q)return t.render();if(t&&"object"==typeof t){let i=t;if("Object"!==i.constructor.name)throw Error(`Solarate Web Component class ${i.constructor?.name} must extend HTMLElement.`);if(!e.u.has(i)){e.u.set(i,null),i[st]();let t=e.u.get(i);e.u.delete(i);for(let e in i)t[e]="function"==typeof i[e]?i[e].bind(t):i[e];return t}}throw Error("toEl() does not support argument of type: "+(t?typeof t:t))}let st="render";function lt(t,...e){let i=new Q(t,e);return i.Ft=!0,i}const nt=Symbol("solariteRender"),rt=Symbol();function ot(t=rt,...i){if(Array.isArray(t))return new Q(t,i);if("string"==typeof t||t instanceof String){let e=t;if(!i.length||"object"!=typeof i[0]&&null!==i[0]){let t=e;return/^\s+</.test(t)&&(t=t.trim()),new Q([t],[])}return A(e+"",i[0]||{},i.slice(1))}if("function"==typeof t||t===w)return A(t,i[0]||{},i.slice(1));if(t instanceof HTMLElement||t instanceof DocumentFragment){if(!(i[0]instanceof Q)){let s=t,l=i[0];if(void 0===l){let t=s[nt];if(t)return t}let n=(t,...i)=>(s.shadowRoot&&(s.innerHTML=""),e.p.add(s),new Q(t,i).render(s,l));return void 0===l&&(s[nt]=n),n}i[0].render(t,i[1])}else{if(t===rt)return(t,...e)=>it(ot(t,...e));if("object"!=typeof t||!e.u.has(t)){if(n.P(t))return new Q;throw Error("h() does not support argument of type: "+(t?typeof t:t))}{let s=t;if("Object"!==s.constructor.name)throw Error(`Solarate Web Component class ${s.constructor?.name} must extend HTMLElement.`);if(!(i[0]instanceof Q))return((...t)=>{let i=ot(...t).render();e.u.set(s,i)}).bind(s);{let t=i[0].render();e.u.set(s,t)}}}}const ft=new WeakMap;function ht(t,e={},i=[]){for(let s of t.attributes){let l=n.k(s.name);if(!(l in t)||i.includes(l))continue;let r=s.value,o=e[l];t[l]=r.startsWith("${")&&r.endsWith("}")?JSON.parse(r.slice(2,-1)):o===Date?new Date(r):o===Boolean?!["false","0"].includes(r):o===Number?+r:o===String?r+"":o?o(r):r}}ot.immutableMap=ot.map=(t,e)=>{let i=Array(t.length);for(let s=0;t.length>s;s++){let l=t[s];if(null!==l&&"object"==typeof l){let t=ft.get(l);void 0===t&&(t=e(l),ft.set(l,t)),i[s]=t}else i[s]=e(l)}return i};let ut=new Proxy(HTMLElement,{construct:(t,e,i)=>(n.C(i),Reflect.construct(t,e,i))});class at extends ut{constructor(t=null){if(super(),t){if("object"!=typeof t)throw Error("First argument to custom element constructor must be an object.");if(t&&!Object.keys(t).length){let e=at.getAttribs(this);for(let i in e)t[i]=e[i]}}}render(){throw Error("render() is not defined for "+this.constructor.name)}renderFirstTime(){if(!e.p.has(this)){let t=at.getAttribs(this);this.render(t)}}connectedCallback(){this.renderFirstTime()}static define(t=null){n.C(this,t)}static getAttribs(t){let e=n.S(t);for(let t in e){let i=e[t];i.startsWith("${")&&i.endsWith("}")&&(e[t]=JSON.parse(i.slice(2,-1)))}return e}}export default ot;export{w as Fragment,e as Globals,at as Solarite,n as SolariteUtil,Q as Template,ht as assignAttributes,i as delve,c as getEventBinding,ot as h,lt as svg,it as toEl};
1
+ // Solarite v0.7.1 | MIT | eric-frost.github.io/solarite
2
+ var t;!function e(){t={connected:new WeakSet,t:null,div:document.createElement("div"),i:document,l:{},o:{},h:new WeakMap,u:new WeakMap,p:new WeakSet,m:new WeakMap,reset:e}}();var e=t;function i(t,e,i=l){let s=i!==l,n=e.length;if(!t&&!s&&n)return;let r=0;for(let l of e){if(void 0===t[l]){if(!s)return;n-1>r&&(t[l]=(e[r+1]+"").match(/^\d+$/)?[]:{})}s&&r===n-1&&(t[l]=i),t=t[l],r++}return t}function s(t){return Array.isArray(t)&&t.length>=2&&("object"==typeof t[0]||void 0===t[0])&&!t.slice(1).find((t=>"string"!=typeof t&&"number"!=typeof t))}let l={},n={v(t,e){let i=t.length;if(i!==e.length)return!1;for(let s=0;i>s;s++)if(t[s]!==e[s])return!1;return!0},S(t,e=null){let i={};for(let s of t.attributes)s.name!==e&&(i[n.k(s.name)]=s.value);return i},$(t,e){let s=e.getAttribute("data-id")||e.getAttribute("id");if(s){if(!s.includes(".")){let i=t[s],l=s in t&&!Object.hasOwn(t,s);if(!i?.nodeType&&(null!=i||l))throw Error(`${t.constructor.name}.${s} can't be a reference to <${e.tagName.toLowerCase()} id="${s}"> because it would clobber an existing `+(l?"built-in ":"")+"property. Rename the id or the property.")}i(t,s.split(/\./g),e)}},A(t,i){let s,l,n=i.tagName.toLowerCase();if(t.hasAttribute("global")||t.hasAttribute("data-global")){s=n,l="";let r=e.i||i.ownerDocument||document;r.head.querySelector(`style[data-style="${s}"]`)?t.remove():(r.head.append(t),t.setAttribute("data-style",s))}else{let t=i.getAttribute("data-style");t||(i.constructor.T||(i.constructor.T=1),t=i.constructor.T++,i.setAttribute("data-style",t)),l=`[data-style="${t}"]`}for(let e of t.childNodes)if(3===e.nodeType){let t=e.textContent,i=t.replace(/:host(?=[^a-z0-9_])/gi,`${n}${l}`);t!==i&&(e.textContent=i)}},N:t=>(t=(t=(t=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2")).replace(/([A-Z])([A-Z][a-z])/g,"$1-$2")).replace(/([a-zA-Z])([0-9])/g,"$1-$2")).toLowerCase(),k:t=>t.replace(/-([a-z])/g,(t=>t[1].toUpperCase())),C(t,e){customElements[o](t)||((e=e||n.N(t.name)).includes("-")||(e+="-element"),customElements[r](e,t))},O:t=>"checkbox"===t.type?t.checked:"radio"===t.type?t.value:"file"===t.type?[...t.files]:"number"===t.type||"range"===t.type?t.valueAsNumber:"date"===t.type||"time"===t.type||"datetime-local"===t.type?t.valueAsDate:"select-multiple"===t.type?[...t.selectedOptions].map((t=>t.value)):t.hasAttribute("contenteditable")?t.innerHTML:t.value,L:t=>t.startsWith("on")&&t in e.div,j(t,i){let s=t.tagName+"."+i,l=e.o[s];if(void 0===l){let n=Object.getPrototypeOf(t);for(;n;){const t=n.constructor.name;if(t.startsWith("HTML")&&t.endsWith("Element"))break;n=Object.getPrototypeOf(n)}e.o[s]=l=!!n&&!!Object.getOwnPropertyDescriptor(n,i)?.set}return l},P:t=>void 0===t||!1===t||null===t,R(t){let e={},i=(t+"").split(/([\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|\S+))/g).map((t=>t.trim())).filter((t=>t.length));for(let t of i){let[i,s]=t.split(/\s*=\s*/);s=(s||"").replace(/^(['"])(.*)\1$/,"$2"),e[i]=s}return e},M:t=>"function"==typeof t?n.M(t()):t instanceof Date?t.toISOString().replace(/T/," "):Array.isArray(t)||"object"==typeof t?"":t,D(t){e.i.createDocumentFragment().append(...t)},H(t){const e=t=>t.nodeType!==Node.ELEMENT_NODE&&(t.nodeType!==Node.TEXT_NODE||""===t.textContent.trim()),i=[...t];for(;i.length>0&&e(i[0]);)i.shift();for(;i.length>0&&e(i[i.length-1]);)i.pop();return i}},r="define",o="getName";class f{F;G;I=!1;W;J;constructor(t,e){this.F=t,this.G=e}apply(t){}V(t){}_(){return 1}B(t,e){let i=t,s=this.K,l=s.length-e;for(let t=l-1;t>0;t--)i=i.childNodes[s[t]];return l?i.childNodes[s[0]]:t}Z(t,e){let i=new this.constructor(t,e,this.attrName,this.U);return i.q=this.q,i.I=this.I,i.Y=this.Y,i}clone(t,e=0){let i,s,l=t,n=this.K,r=n.length-e;for(let t=r-1;t>0;t--)l=l.childNodes[n[t]];let o=l.childNodes;i=r?o[n[0]]:t,this.F&&(s=o[this.X]);let f=new this.constructor(s,i,this.attrName,this.U);return f.q=this.q,f.I=this.I,f.Y=this.Y,f}static get(t){let e=[];for(;;){let i=t.parentNode;if(!i)break;e.push([].indexOf.call(t.parentNode.childNodes,t)),t=i}return e}static resolve(t,e){for(let i=e.length-1;i>=0;i--)t=t.childNodes[e[i]];return t}}class h{constructor(){this.tt={context:h.Text,quote:null,buffer:"",et:null},this.state={...this.tt}}reset(){return this.state={...this.tt},this.state.context}parse(t,e=null){if(null===t)return this.reset();for(let i=0;t.length>i;i++){const s=t[i];switch(this.state.context){case h.Text:"<"===s&&t[i+1].match(/[/a-z!]/i)&&(e?.(t,i,this.state.context,h.it),this.state.context=h.it,this.state.buffer="");break;case h.it:if(">"===s)e?.(t,i+1,this.state.context,h.Text),this.state.context=h.Text,this.state.quote=null,this.state.buffer="";else{if(" "===s&&!this.state.buffer)continue;" "===s||"/"===s||"?"===s?this.state.buffer="":'"'===s||"'"===s||"="===s?(e?.(t,i,this.state.context,h.st),this.state.context=h.st,this.state.quote="="===s?null:s,this.state.buffer=""):this.state.buffer+=s}break;case h.st:this.state.quote||this.state.buffer.length||'"'!==s&&"'"!==s?s===this.state.quote||!this.state.quote&&this.state.buffer.length?(e?.(t,i,this.state.context,h.it),this.state.context=h.it,this.state.quote=null,this.state.buffer=""):this.state.quote||">"!==s?" "!==s&&(this.state.buffer+=s):(e?.(t,i+1,this.state.context,h.Text),this.state.context=h.Text,this.state.quote=null,this.state.buffer=""):this.state.quote=s}}return e?.(t,t.length,this.state.context,null),this.state.context}}h.st="Attribute",h.Text="Text",h.it="Tag";class u extends f{attrName;U;lt;Y;constructor(t,e,i=null,s=null){super(null,e),this.attrName=i,this.U=s}apply(t){if(this.U){let e=this.G,i=this.nt(t),s=this.Y;(s?e[this.attrName]:e.getAttribute(this.attrName))!==i&&(s?e[this.attrName]=i:"value"===this.attrName&&e.hasAttribute("contenteditable")&&(e.innerHTML=i),e.setAttribute(this.attrName,i))}else this.V(t[0])}V(t){if(this.U)return this.apply([t]);let e=this.G;if(s(t)){if(this.q&&e.tagName.endsWith("-SOLARITE-PLACEHOLDER"))return;let[s,l]=[t[0],t.slice(1)];if(!s)throw Error(`Solarite cannot bind to <${e.tagName.toLowerCase()} ${this.attrName}=\${[${t.map((t=>t?`'${t}'`:t+"")).join(", ")}]}>.`);let r=i(s,l);if("value"===this.attrName&&"select-multiple"===e.type&&Array.isArray(r)){let t=r.map((t=>t+""));for(let i of e.options)i.selected=t.includes(i.value)}else if("radio"===e.type)e.checked=e.value===r+"";else{const t=n.P(r)?"":r;"value"===this.attrName&&e.hasAttribute("contenteditable")?t!==e.innerHTML&&(e.innerHTML=t):t!==e[this.attrName]&&(e[this.attrName]=t)}let o=()=>{let t="value"===this.attrName||"radio"===e.type?n.O(e):e[this.attrName];i(s,l,t)};this.rt(e,this.W.getRootNode(),this.attrName,"input",o,null,!0)}else{let i=this.Y;if("function"==typeof t){if(this.q)return;t=t()}else t=n.M(t);void 0===t||!1===t||null===t?(i&&(e[this.attrName]=!1),e.removeAttribute(this.attrName)):!0===t?(i&&(e[this.attrName]=!0),e.setAttribute(this.attrName,"")):(i?e[this.attrName]:e.getAttribute(this.attrName)??"")!==t&&(i?e[this.attrName]=t:"value"===this.attrName&&e.hasAttribute("contenteditable")&&(e.innerHTML=t),e.setAttribute(this.attrName,t))}}_(){return this.U?this.U.length-1:1}nt(t){if(!this.U)return t[0];let e=[],i=this.U;for(let s=0;i.length>s;s++)if(e.push(i[s]),i.length-1>s){let i=n.M(t[s]);n.P(i)||e.push(i)}return e.join("")}rt(t,e,i,s,l,n,r=!1){if("function"!=typeof l)throw Error(`Solarite cannot bind to <${t.tagName.toLowerCase()} ${this.attrName}=\${${l}}> because it's not a function.`);let o,f=this.W.ot.options,h=n||[l],u=t[a];if(void 0!==u){if(u instanceof g){if(u.key!==i){let l=t[a]={};return l[u.key]=u,o=l[i]=new g(e,t,i,h),void d(o,t,s,r,f,e)}o=u}else if(o=u[i],!o)return o=u[i]=new g(e,t,i,h),void d(o,t,s,r,f,e);o.root=e,o.ft=h}else d(t[a]=new g(e,t,i,h),t,s,r,f,e)}}const a=Symbol("solariteEvents");function c(t,e){let i=t[a];if(void 0!==i)return i instanceof g?i.key===e?i:void 0:i[e]}function d(t,e,i,s,l,n){let r=!1;if(!1===s){let t=l?.eventDelegation??!0;!1!==t&&p.has(i)&&(r=!0===t||t.includes(i))}if(r){t.ht=!0;let e=n[y];void 0===e&&(e=n[y]=new Set),e.has(i)||(e.add(i),n.addEventListener(i,b))}else e.addEventListener(i,t,s)}const p=new Set(["beforeinput","click","contextmenu","dblclick","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),y=Symbol("solariteDelegatedTypes"),m=Symbol("solariteDelegated");function b(t){if(t[m])return;t[m]=!0;let e=t.type,i=t.target;for(Object.defineProperty(t,"currentTarget",{configurable:!0,get:()=>i});i;){let s=i[a];if(void 0!==s){let i=s instanceof g?s:s[e];if(void 0!==i&&!0===i.ht&&i.key===e&&(i.handleEvent(t),t.cancelBubble))break}i=i.parentNode}delete t.currentTarget}class g{constructor(t,e,i,s){this.root=t,this.node=e,this.key=i,this.ft=s}handleEvent(t){let e=this.ft;switch(e.length){case 1:return e[0].call(this.root,t,this.node);case 2:return e[0].call(this.root,e[1],t,this.node);case 3:return e[0].call(this.root,e[1],e[2],t,this.node)}return e[0].call(this.root,...e.slice(1),t,this.node)}}class v extends u{ut;constructor(t,e,i=null,s=null){super(null,e,i,s),this.ut=i?i.slice(2):null}apply(t){this.U?.length>1?super.apply(t):this.V(t[0])}V(t){if(this.U?.length>1)return super.apply([t]);if(this.q&&this.G.tagName.endsWith("-SOLARITE-PLACEHOLDER"))return;let e,i=this.W.ot.root,s=this.G,l=this.ut;if(Array.isArray(t)&&"function"==typeof t[0])e=t[0];else{if("function"!=typeof t)throw Error(`Invalid event binding: <${s.tagName.toLowerCase()} ${this.attrName}=\${${JSON.stringify(t)}}>`);e=t,t=null}this.rt(s,i,l,l,e,t)}}const w=Symbol("Fragment");class E{constructor(t,e){this.name=t,this.value=e}}const S=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),k=new Map;function $(t){if(null===t||"object"!=typeof t)return t;let e="";for(let i in t){let s=t[i];null!=s&&!1!==s&&(e+=(e?";":"")+n.N(i)+":"+s)}return e}function x(t){return(""+t).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function A(t,e,i=[],s){if(e=e||{},t===w){let t=[""];for(let e=0;i.length>e;e++)t.push("");return new Q(t,i)}if("function"==typeof t){if(t.prototype instanceof HTMLElement){n.C(t);let l=customElements.ct?customElements.ct(t):n.N(t.name);return l&&!l.includes("-")&&(l+="-element"),T(l,e,i,s)}let l={};for(let t in e)"key"!==t&&(l[t]="style"===t?$(e[t]):e[t]);!("children"in l)&&i.length&&(l.children=1===i.length?i[0]:i);let r=t(l);return void 0===s&&(s=e.key),void 0!==s&&r instanceof Q&&(r.key=s),r}return T(t,e,i,s)}function T(t,e,i,s){let l=S.has(t.toLowerCase()),n=[],r=[],o="";for(let t in e){if("children"===t)continue;if("key"===t){void 0===s&&(s=e[t]);continue}let i=e[t];"id"!==t&&"data-id"!==t||"string"!=typeof i?("style"===t&&(i=$(i)),n.push(t),r.push(i)):o+=` ${t}="${x(i)}"`}let f=l?0:i.length,h=t+o+"\0"+n.join("\0")+"\0#"+f,u=k.get(h);u||(u=((t,e,i,s,l)=>{let n=[],r="<"+t+e;for(let t of i)n.push(r+" "+t+"="),r="";if(r+=">",l)return n.push(r),n;if(0===s)n.push(r+"</"+t+">");else{n.push(r);for(let t=1;s>t;t++)n.push("");n.push("</"+t+">")}return n})(t,o,n,f,l),k.set(h,u));let a=l?r:r.concat(i),c=new Q(u,a);return void 0!==s&&(c.key=s),c}class N extends f{dt;lt;constructor(t,e){super(null,null),this.G=e,this.dt=new Set}apply(t){this.V(t[0])}V(t){let e=this.G;if(t instanceof E)return this.yt(t);Array.isArray(t)&&(t=t.flat().join(" "));let i=this.dt;if(this.dt=new Set,t)if("function"==typeof t&&(t=t()),"object"==typeof t)for(let i in t){let s=t[i];void 0!==s&&!1!==s&&null!==s&&(e.setAttribute(i,s),this.dt.add(i))}else{let i=n.R(t);for(let t in i)e.setAttribute(t,i[t]),this.dt.add(t)}for(let t of i)this.dt.has(t)||e.removeAttribute(t)}yt(t){let e=t.name;if("key"===e)return;let i=t.value,s=this.bt;if(void 0===s||this.gt!==e){let t=this.G;n.L(e)?s=new v(null,t,e,null):(s=new u(null,t,e,null),s.Y=n.j(t,e)),s.q=this.q,this.bt=s,this.gt=e}s.G=this.G,s.W=this.W,"style"===e&&(i=$(i)),s.V(i)}_(){return 1}nt(t){return t[0]}}class C{data={};add(t,e){let i=this.data,s=i[t];s?s.push(e):i[t]=[e]}vt(t,e,i){let s=this.data,l=s[t];l?i>l.length-(l.head||0)&&l.push(e):s[t]=[e]}wt(t){let e=this.data,i=e[t];if(!i)return;let s=i.head||0,l=i[s];return s++,i.length>s?i.head=s:delete e[t],l}}class O extends f{Et=null;St=null;kt=null;$t=null;xt=null;At=null;constructor(t,e){super(t,e)}apply(t){this.V(t[0])}V(t){let i=typeof t;if(("string"===i||"number"===i)&&!this.Tt){"string"!==i&&(t+="");let s=this.St;if(null!==s)return void(this.kt!==t&&(s.nodeValue=t,this.kt=t));let l=this.Et;if(null===l||0===l.length){let i;if(this.I){let e=this.G.firstChild;if(null!==e&&3===e.nodeType&&e===this.G.lastChild)return e.nodeValue!==t&&(e.nodeValue=t),this.St=e,void(this.kt=t);this.G.textContent=t,i=this.G.firstChild}else i=e.i.createTextNode(t),this.G.parentNode.insertBefore(i,this.G);return this.St=i,this.kt=t,void(this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot()))}if(1===l.length){let e=l[0],i=e.Lt;if(!0===i.jt)return void(i.html[0]!==t&&(e.Pt.nodeValue=t,i.html[0]=t,e.Rt=t))}}if(null!==this.St){let t=new Z(P(this.kt),this,this.St);(this.Et??=[]).push(t),this.St=null}let s=[],l=this.Mt(t,s,!1);if(l||this.Tt)this.Tt=l,this.Dt(s);else{let t=0!==s.length?s[0]:null;(null!==t?"string"==typeof t||void 0===t.key&&0>I.get(t.html,t.Ft).Ht:null===this.Et||0===this.Et.length||void 0===this.Et[0].key)?this.Gt(s):this.It(s)}}Gt(t){let i=this.Et||L,s=i.length,l=t.length,r=Array(l),o=0,f=s,h=l;for(;f>o&&h>o;){let e=i[o],s=t[o];if(!R(e,s))break;e.zt&&e.Wt(s.exprs,!1),r[o]=e,o++}for(;f>o&&h>o;){let e=i[f-1],s=t[h-1];if(!R(e,s))break;e.zt&&e.Wt(s.exprs,!1),r[--h]=e,f--}for(;f>o&&h>o;){let e=i[o],s=t[o];if(R(e,s))e.zt&&e.Wt(s.exprs,!1);else{if(!M(e,s))break;this.Jt(e,s)}r[o]=e,o++}let u=f-o,a=h-o;if(u||a){if(u){for(let t=o;f>t;t++){let e=i[t];e.Pt!==e.Vt&&e._t()}let t=0===l&&0===o&&this.Bt(),e=this.At??=new C;for(let s=o;f>s;s++){let l=i[s];l.Pt!==l.Vt?n.D(l._t()):t||l.Pt.remove(),l.Lt.jt||e.vt(l.Rt,l,j)}}if(a){let i=this.I,s=l>h?r[h].Pt:i?null:this.G,n=i?this.G:this.G.parentNode,f=n,u=s,c=null;a>1&&(c=e.i.createDocumentFragment(),f=c,u=null);for(let e=o;h>e;e++){let i=this.Kt(t[e]);r[e]=i;let s=i.Pt,l=i.Vt;if(s===l)f.insertBefore(s,u);else for(;;){let t=s.nextSibling;if(f.insertBefore(s,u),s===l)break;s=t}}c&&n.insertBefore(c,s)}this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot())}this.Et=r,this.$t&&(this.$t=null),this.xt&&(this.xt=null)}It(t){let i=this.Et||L,s=i.length,l=t.length,r=Array(l),o=null,f=-1;const h=t=>void 0!==t.key?t.key:(t.html!==o&&(o=t.html,f=I.get(t.html,t.Ft).Ht),0>f?void 0:t.exprs[f]);let u=0,a=s,c=l;for(;a>u&&c>u;){let e=i[u],s=t[u];if(e.Lt===s)e.zt&&e.Wt(s.exprs,!1);else{if("string"==typeof s||e.key!==h(s)||!M(e,s))break;R(e,s)?e.zt&&e.Wt(s.exprs,!1):this.Jt(e,s)}r[u]=e,u++}for(;a>u&&c>u;){let e=i[a-1],s=t[c-1];if(e.Lt===s)e.zt&&e.Wt(s.exprs,!1);else{if("string"==typeof s||e.key!==h(s)||!M(e,s))break;R(e,s)?e.zt&&e.Wt(s.exprs,!1):this.Jt(e,s)}r[--c]=e,a--}let d=a-u,p=c-u;if(d||p){let s=this.I,o=s?this.G:this.G.parentNode,f=0,y=!1,m=null,b=null;if(d)if(p){let e=new Map;for(let i=u;c>i;i++){let s=t[i];"string"!=typeof s&&e.set(h(s),i)}m=Array(p).fill(-1);let s=-1;for(let l=u;a>l;l++){let n,o=i[l],h=void 0===o.key?void 0:e.get(o.key);void 0!==h&&-1===m[h-u]&&M(o,n=t[h])?(m[h-u]=l,f++,s>h?y=!0:s=h,R(o,n)?o.zt&&o.Wt(n.exprs,!1):this.Jt(o,n),r[h]=o):(b??=[]).push(o)}}else b=i.slice(u,a);if(b){for(let t of b)t.Pt!==t.Vt&&t._t();if(0!==u||c!==l||0!==f||!this.Bt())for(let t of b)t.Pt!==t.Vt?n.D(t._t()):t.Pt.remove()}if(p){let i=l>c?r[c].Pt:s?null:this.G;if(0===f){let s=o,l=i,n=null;p>1&&(n=e.i.createDocumentFragment(),s=n,l=null);for(let e=u;c>e;e++){let i=this.Zt(t[e]);r[e]=i;let n=i.Pt,o=i.Vt;if(n===o)s.insertBefore(n,l);else for(;;){let t=n.nextSibling;if(s.insertBefore(n,l),n===o)break;n=t}}n&&o.insertBefore(n,i)}else{let e=y?(t=>{let e=[],i=Array(t.length);for(let s=0;t.length>s;s++){let l=t[s];if(-1===l)continue;let n=0,r=e.length;for(;r>n;){let i=n+r>>1;l>t[e[i]]?n=i+1:r=i}n>0&&(i[s]=e[n-1]),n===e.length?e.push(s):e[n]=s}let s=e.length;if(s){let t=e[s-1];for(;s-- >0;)e[s]=t,t=i[t]}return e})(m):null,s=null!==e?e.length-1:-1;for(let l=c-1;l>=u;l--){let n=r[l];void 0===n?(n=this.Zt(t[l]),r[l]=n,D(o,n,i)):null!==e&&(0>s||e[s]!==l-u?D(o,n,i):s--),i=n.Pt}}}this.W.Nt||(this.J=null,this.W.Ct&&this.W.Ct.Ot())}this.Et=r,this.$t&&(this.$t=null),this.xt&&(this.xt=null)}Zt(t){if("string"==typeof t)return new Z(P(t),this);let e=new Z(t,this);return(t.exprs.length||e.Ut&&e.Ut.length)&&e.Wt(t.exprs),e}Jt(t,e){if("string"==typeof e)t.Pt.nodeValue=e,t.Lt.html[0]=e,t.Rt=e;else{if(t.qt){if(null!==t.Ut||!t.Yt(e)){let i=t.Lt.exprs,s=e.exprs,l=t.Ut??t.Xt();for(let t=l.length-1;t>=0;t--)et(i[t],s[t])||l[t].V(s[t])}t.styles&&t.Qt(),t.J=null,t.Nt=!1}else t.Wt(e.exprs);t.Lt=e,void 0!==e.key&&(t.key=e.key)}}Kt(t){let e;if("string"==typeof t)return t=P(t),new Z(t,this);let i=this.At;return i&&(e=i.wt(t.te()),e)?(this.Jt(e,t),e):(e=new Z(t,this),(t.exprs.length||e.Ut&&e.Ut.length)&&e.Wt(t.exprs),e)}Mt(t,e,i){if(t instanceof Q)e.push(t);else if(Array.isArray(t))for(let s of t)s instanceof Q?e.push(s):i=this.Mt(s,e,i);else if("function"==typeof t)i=this.Mt(t(),e,i);else if(t instanceof NodeList){for(let i of t)e.push(i);i=i||t.length>0}else if(t?.nodeType){if(11===t.nodeType)for(let i of[...t.childNodes])e.push(i);else e.push(t);i=!0}else void 0===t||!1===t||null===t?t="":"string"!=typeof t&&(t+=""),e.push(t);return i}Dt(t){let e=this;e.ee();let i=[],s=e.Et||L;e.Et=[];for(let s of t)if("string"==typeof s&&(s=P(s)),s instanceof Q){let t=e.ie(s);i.push(...t._t()),e.Et.push(t)}else i.push(s);let l=e._t();if(!n.v(l,i)){e.J=i,this.W.Ct&&this.W.Ct.Ot(),l.length&&!i.length&&e.Bt()||(e.I?H(e.G,l,i,null):H(e.G.parentNode,l,i,e.G));for(let t of s)t.Pt.parentNode||n.D(t._t())}}Ot(){let t=this,e=this.I?this.G:this.G.parentNode;for(;t&&(t.I?t.G:t.G.parentNode)===e;)t.J=null,t=t.W?.Ct}Bt(){if(this.I)return this.G.textContent="",!0;let t=this.F.parentNode;return this.F===t.firstChild&&this.G===t.lastChild&&(t.innerHTML="",t.append(this.F,this.G),!0)}ie(t){let e=t.te(),i=this.xt?.wt(e)||this.At?.wt(e);return i?(tt(i.Lt,t)?i.zt&&i.Wt(t.exprs,!1):i.Wt(t.exprs),i.Lt=t):(i=new Z(t,this),i.Wt(t.exprs)),(this.$t??=[]).push(i),i}ee(){let t=this.xt?.data;if(t){let e=(this.At??=new C).data;for(let i in t){let s=t[i],l=s.head||0,n=e[i];if(n)for(let t=l,e=j+(n.head||0);s.length>t&&e>n.length;t++)n.push(s[t]);else n=e[i]=l?s.slice(l):s,n.length>j&&(n.length=j)}}this.xt=new C;let e=this.xt,i=this.$t?.length?this.$t:this.Et;if(i)for(let t of i)e.add(t.Rt,t);this.$t=null}_t(){let t;if(t=this.J,t)return t;t=[];let e,i=null;for(this.I?e=this.G.firstChild:(e=this.F.nextSibling,i=this.G);e&&e!==i;)t.push(e),e=e.nextSibling;return this.J=t,t}}const L=[],j=1e4;function P(t){let e=new Q([t],[]);return e.jt=!0,e}function R(t,e){let i=t.Lt;return i===e||("string"==typeof e?!0===i.jt&&i.html[0]===e:tt(i,e))}function M(t,e){let i=t.Lt;return"string"==typeof e?!0===i.jt:i.html===e.html&&i.Ft===e.Ft}function D(t,e,i){let s=e.Pt,l=e.Vt;if(s===l)t.insertBefore(s,i);else for(;;){let e=s.nextSibling;if(t.insertBefore(s,i),s===l)break;s=e}}function H(t,e,i,s){if(e.length){let s=new Set(i);for(let i of e)s.has(i)||i.parentNode!==t||t.removeChild(i)}let l=s;for(let e=i.length;e--;){let s=i[e];s.nextSibling===l&&s.parentNode===t||t.insertBefore(s,l),l=s}}class F extends f{apply(t){this.W.key=t[0]}V(t){this.W.key=t}}class G extends f{se;le;constructor(t,e){super(null,e)}apply(t){let l=(t=>{const e=new Set;return JSON.stringify(t,((t,i)=>{if("function"==typeof i)return X(i);if("object"==typeof i&&null!==i){if(i instanceof Node)return X(i);if(e.has(i))return X(i);if(e.add(i),i instanceof Q)return{html:X(i.html),exprs:i.exprs}}return i}))})(t),r=l!==this.le;this.le=l;let o=this.G,f=n.S(o,"_is");for(let e,l=0;e=this.se[l];l++)if(!(e instanceof F))if(e instanceof u){let r=n.k(e.attrName),o=e.nt(t[l]);!e.U&&s(o)&&(o=i(o[0],o.slice(1))),f[r]=o}else{let i=e.nt(t[l]);if("object"==typeof i)for(let t in i)f[n.k(t)]=i[t];else if("string"==typeof i){let t=n.R(i);for(let e in t)f[n.k(e)]=t[e]}}let h=o.getAttribute("_is");if(o.tagName.endsWith("-SOLARITE-PLACEHOLDER")||h){let s=(h||o.tagName.slice(0,-21)).toLowerCase(),l=customElements.get(s);if(!l)throw Error(`Must call customElements.define('${s}', Class) before using it.`);e.t=[...o.childNodes];let n=new l(f);h&&n.setAttribute("is",h);for(let t of o.attributes)"_is"!==t.name&&n.setAttribute(t.name,t.value);for(let t in f){let e=f[t],i=typeof e;"boolean"===i?!1!==e&&null!=e&&n.setAttribute(t,""):"string"!==i&&"number"!==i&&"bigint"!==i||n.setAttribute(t,e)}let r=n.getAttribute("data-id")||n.getAttribute("id");r&&i(this.W.getRootNode(),r.split(/\./g),n);let u=this.W;this.G=n;for(let t of u.Ut)t.G===o&&(t.G=n),t.F===o&&(t.F=n);u.Pt===o&&(u.Pt=n),u.Vt===o&&(u.Vt=n),"function"!=typeof n.render||e.p.has(n)||n.render(f,!0);for(let e,i=0;e=this.se[i];i++)e.W=this.W,e.G=n,e.apply(t[i]);o.replaceWith(n)}else"function"==typeof o.render&&o.render(f,r);e.t=null}clone(t,e=0){let i=this.B(t,e),s=new G(null,i);return s.se=this.se.map((i=>i.clone(t,e))),s}_(){return 0}}class I{fragment;Ut=[];ids=[];styles=[];scripts=[];zt=!1;qt=!1;ne=!1;Ht=-1;re=!1;oe=!1;constructor(t=null,i=!1){if(!t)return;if(1===t.length&&!t[0].match(/[<&]/))return void(this.fragment=e.i.createTextNode(t[0]));let s,l=I.fe(t),r=e.i.createElement("template");if(l)if(i){r.innerHTML="<svg>"+l+"</svg>";let t=r.content.firstChild,i=e.i.createDocumentFragment();for(;t.firstChild;)i.append(t.firstChild);this.fragment=i}else r.innerHTML=l,this.fragment=r.content;else r.content.append(e.i.createTextNode("")),this.fragment=r.content;J(this.fragment);let o=[],h=0;const a=e.i.createTreeWalker(this.fragment,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);for(;s=a.nextNode();)if(o.map((t=>t.remove())),o=[],1===s.nodeType){const t=s.hasAttribute("is"),e=t||s.tagName.includes("-"),l=[];for(let t of[...s.attributes]){if("key"===t.name){let i=t.value.split(/[\ue000-\uf8ff]/g);if(2!==i.length||""!==i[0]||""!==i[1])throw Error("The key attribute is reserved and must be a single expression: key=${...}");if(s.parentNode!==this.fragment)throw Error("The key attribute must be on a top-level element of its template.");if(this.Ht>=0)throw Error("A template can have only one key attribute.");this.Ht=t.value.charCodeAt(0)-K;let n=new F(null,s);this.Ut.push(n),e&&l.push(n),h++,s.removeAttribute("key");continue}let r=t.name.match(/^[\ue000-\uf8ff]$/);if(r){let t=new N(null,s);this.Ut.push(t),e&&(t.q=!0,l.push(t)),h++,s.removeAttribute(r[0])}else{let r=t.value.split(/[\ue000-\uf8ff]/g);if(r.length>1){let o=2!==r.length||r[0].length||r[1].length?r:null,f=n.L(t.name),a=f?new v(null,s,t.name,o):new u(null,s,t.name,o);if(a.Y=n.j(s,t.name),this.Ut.push(a),e&&(a.q=!0,l.push(a)),h+=r.length-1,i||f&&!o)s.removeAttribute(t.name);else try{s.setAttribute(t.name,r.join(""))}catch(e){throw Error(`Error setting attribute "${t.name}" on node <${s.tagName}>: ${e.message}`)}}}}if(e){let e=new G(null,s);e.se=l,this.Ut.splice(this.Ut.length-l.length,0,e),t&&(s.setAttribute("_is",s.getAttribute("is")),s.removeAttribute("is"))}}else if(8===s.nodeType&&"!✨!"===s.nodeValue){if(s?.parentNode?.closest&&s?.parentNode?.closest("[contenteditable]"))throw Error('Contenteditable can\'t have expressions inside them. Use <div contenteditable value="${...}"> instead.');let t=s.parentNode;if(1!==t.nodeType||s.previousSibling||s.nextSibling||t.tagName.includes("-")||"SLOT"===t.tagName||t.hasAttribute("is")){let t,i=s.previousSibling;i||(i=e.i.createComment("Path:"+this.Ut.length),s.parentNode.insertBefore(i,s)),!s.nextSibling||8===s.nextSibling.nodeType&&"!✨!"===s.nextSibling.textContent?(t=s,t.textContent="PathEnd:"+this.Ut.length):(t=s.nextSibling,o.push(s));let l=new O(i,t);this.Ut.push(l),h++}else{let e=new O(null,t);e.I=!0,this.Ut.push(e),h++,o.push(s)}}else{if(3===s.nodeType&&"TEXTAREA"===s.parentNode?.tagName&&s.textContent.includes("\x3c!--!✨!--\x3e"))throw Error('Textarea can\'t have expressions inside them. Use <textarea value="${...}"> instead.');if(8===s.nodeType){let t=s.textContent.split(/[\ue000-\uf8ff]/g);for(let e=0;t.length-1>e;e++){let t=new f(s.previousSibling,s);this.Ut.push(t),h++}}else if(3===s.nodeType&&["SCRIPT","STYLE"].includes(s.parentNode?.nodeName)){let t=s.textContent.split(z);if(t.length>1){let i=[];for(let l=0;t.length>l;l++){let n=e.i.createTextNode(t[l]);s.parentNode.insertBefore(n,s),l>0&&i.push(n)}for(let t,e=0;t=i[e];e++){let e=new O(t.previousSibling,t);this.Ut.push(e),h++}o.push(s)}}}if(o.map((t=>t.remove())),h!==t.length-1)throw Error("Could not parse expressions in template. Check for duplicate attributes or malformed html: "+t.join("${...}"));for(let t of this.Ut)t.F&&(t.X=[].indexOf.call(t.F.parentNode.childNodes,t.F)),t.K=f.get(t.G);this.he(),this.ue(),this.qt=!0;for(let t of this.Ut){if(t instanceof G){this.zt=!0,this.qt=!1;break}1!==t._()&&(this.qt=!1)}if(this.re&&this.qt){let t=[],e=!0;for(let i=0;this.Ut.length>i;i++){let s=this.Ut[i];if(s instanceof O){if(!s.I){e=!1;break}t.push(i)}else if(!(s instanceof u||s instanceof F)){e=!1;break}}e&&(this.oe=!0,this.ae=t,this.ce=this.Ut.map((t=>t.Z(null,t.G))))}}static fe(t){let e=[],i=new h;for(let s=0;t.length>s;s++){let l=0,n=i.parse(t[s],((t,i,s)=>{if(l!==i){let n=t.slice(l,i);s===h.it&&(n=n.replace(/^<\/?[a-z][a-z0-9]*-[a-z0-9-]+/i,(t=>t+"-SOLARITE-PLACEHOLDER"))),e.push(n)}l=i}));t.length-1>s&&e.push(n===h.Text?z:String.fromCharCode(K+s))}return e.join("")}he(){this.scripts=[].map.call(this.fragment.querySelectorAll("script"),(t=>f.get(t))),this.styles=[].map.call(this.fragment.querySelectorAll("style"),(t=>f.get(t)));let t=this.fragment.querySelectorAll("[id],[data-id]");for(let i of t){let t=i.getAttribute("data-id")||i.getAttribute("id");if(e.div.hasOwnProperty(t))throw Error(`<${i.tagName.toLowerCase()} id="${t}"> can't override existing HTMLElement id property.`)}this.ids=[].map.call(t,(t=>f.get(t))),this.ne=this.ids.length>0||this.styles.length>0||this.scripts.length>0}ue(){let t=!1;for(let e of this.Ut)if(e instanceof G){t=!0;break}if(t||!this.Ut.length)return;let e=[],i=new Map,s=this.fragment,l=1,n=t=>{if(t===s)return 0;let r=i.get(t);return void 0===r&&(e.push(n(t.parentNode),[].indexOf.call(t.parentNode.childNodes,t)),r=l++,i.set(t,r)),r};for(let t of this.Ut)t.de=t.G===s?0:n(t.G),t.pe=t.F?n(t.F):-1;this.ye=e,this.me=Array(l),this.ne||1!==s.childNodes.length||1!==s.firstChild.nodeType||2>e.length||0!==e[0]||0!==e[1]||(this.re=!0)}static get(t,i=!1){if(t===V&&i===_)return B;let s=e.m.get(t);s||(s={},e.m.set(t,s));let l=i?"svg":"html",n=s[l];return n||(n=s[l]=new I(t,i)),V=t,_=i,B=n,n}}const z="\x3c!--!✨!--\x3e",W=["TABLE","THEAD","TBODY","TFOOT","TR"];function J(t){let e=1===t.nodeType&&W.includes(t.tagName),i=t.firstChild;for(;i;){let t=i.nextSibling;1===i.nodeType?J(i):e&&3===i.nodeType&&!i.nodeValue.trim()&&i.remove(),i=t}}let V=null,_=!1,B=null;const K=57344;class Z{ot;Ct;Pt;Vt;Ut=null;Rt;key;zt=!1;qt=!1;Nt=!0;J;styles;Lt;constructor(t,i=null,s=null,l=null){if(this.ot=i?.W?.ot||this,this.Ct=i,this.Lt=t,void 0!==t.key&&(this.key=t.key),t.jt)this.Rt=t.te(),this.Pt=this.Vt=s||e.i.createTextNode(t.html[0]);else{const e=I.get(t.html,t.Ft);if(this.Rt=e.Rt??=t.te(),this.zt=e.zt,this.qt=e.qt,e.re&&null!==i){const t=e.fragment.firstChild.cloneNode(!0);this.Pt=this.Vt=t,!0!==e.oe&&this.be(t,e,0,!0)}else{const t=e.fragment.cloneNode(!0);11===t.nodeType?(this.Pt=t.firstChild,this.Vt=t.lastChild):this.Pt=this.Vt=t,this.instantiate(e,t,s,l)}}}instantiate(t,e,i,s){t.Ut.length?this.be(e,t):this.Ut=[],t.ne&&this.ge(e,t)}Wt(t,e=!0){let i=this.Ut;if(this.qt){if(e){if(null===i)return void this.ve(t);for(let e=i.length-1;e>=0;e--)i[e].V(t[e]);this.styles&&this.Qt(),this.J=null}return void(this.Nt=!1)}if(!i)return void(this.Nt=!1);let s=t.length,l=Array(i.length);for(let n,r=i.length-1;n=i[r];r--){if(0===r&&n instanceof G&&n.G===this.getRootNode())continue;let i=n._();if(l[r]=t.slice(s-i,s),s-=i,n instanceof G){let t=l.slice(r+1,r+1+n.se.length);n.apply(t)}else e&&n.apply(l[r])}e&&(this.Qt(),this.J=null),this.Nt=!1}ve(t){let e=this.Lt,i=I.get(e.html,e.Ft),s=i.ae;for(let e=0;s.length>e;e++){let l=typeof t[s[e]];if("string"!==l&&"number"!==l){let e=this.Xt(i);for(let i=e.length-1;i>=0;i--)e[i].V(t[i]);return this.J=null,void(this.Nt=!1)}}let l=this.we(i),n=i.Ut,r=i.ce;for(let e=n.length-1;e>=0;e--){let i=r[e],s=l[n[e].de];if(i.I){let i=t[e];"number"==typeof i&&(i+=""),s.textContent=i}else i.G=s,i.W=this,i.V(t[e])}this.J=null,this.Nt=!1}Yt(t){let e=I.get(t.html,t.Ft),i=t.exprs,s=e.ae;for(let t=0;s.length>t;t++){let e=typeof i[s[t]];if("string"!==e&&"number"!==e)return!1}let l=this.Lt.exprs,n=e.Ut,r=e.ce,o=null;for(let t=n.length-1;t>=0;t--)if(!et(l[t],i[t])){null===o&&(o=this.we(e));let s=r[t],l=o[n[t].de];if(s.I){let e=i[t],n=l.firstChild;"number"==typeof e&&(e+=""),null!==n&&3===n.nodeType&&n===l.lastChild?n.nodeValue=e:(s.G=l,s.W=this,s.V(i[t]),s.St=null,s.kt=null,s.J=null);continue}s.G=l,s.W=this,s.V(i[t])}return!0}we(t){let e=t.me;e[1]=this.Pt;let i=t.ye;for(let t=2,s=2;i.length>t;t+=2,s++){let l=e[i[t]].firstChild;for(let e=i[t+1];e>0;e--)l=l.nextSibling;e[s]=l}return e}Xt(t=null){t??=I.get(this.Lt.html,this.Lt.Ft);let e=this.we(t),i=t.Ut,s=i.length,l=this.Ut=Array(s);for(let t=0;s>t;t++){let s=i[t],n=s.Z(0>s.pe?null:e[s.pe],e[s.de]);n.W=this,l[t]=n}for(let e of t.ae){let t=l[e],i=t.G.firstChild;null!==i&&3===i.nodeType&&i===t.G.lastChild&&(t.St=i,t.kt=i.nodeValue)}return l}_t(){let t=this.J;if(t)return t;t=[];let e=this.Pt,i=this.Vt?.nextSibling;for(;e&&e!==i;)t.push(e),e=e.nextSibling;return this.J=t,t}getRootNode(){return this.ot.root}Ee(){return this.ot}be(t,e,i=0,s=!1){let l=e.Ut,n=l.length,r=this.Ut=Array(n),o=e.ye;if(o&&0===i){let i=e.me,f=0,h=1;for(s?(i[1]=t,f=2,h=2):i[0]=t;o.length>f;f+=2,h++){let t=i[o[f]].firstChild;for(let e=o[f+1];e>0;e--)t=t.nextSibling;i[h]=t}for(let t=0;n>t;t++){let e=l[t],s=e.Z(0>e.pe?null:i[e.pe],i[e.de]);s.W=this,r[t]=s}}else for(let e=0;n>e;e++){let s=l[e].clone(t,i);s.W=this,r[e]=s}}Qt(){if(this.styles)for(let[t,e]of this.styles)e!==t.textContent&&n.A(t,this.Ee().root)}ge(t,e,i=0){let s=this.ot.root;if(s){let l=this.ot.options;if(!1!==l?.ids)for(let l of e.ids){i&&(l=l.slice(0,-i));let e=f.resolve(t,l);n.$(s,e)}if(!1!==l?.styles){e.styles.length&&(this.styles=new Map);for(let l of e.styles){i&&(l=l.slice(0,-i));let e=f.resolve(t,l);1===s.nodeType&&(n.A(e,s),this.styles.set(e,e.textContent))}}if(!1!==l?.scripts)for(let s of e.scripts){i&&(s=s.slice(0,-i));let e=f.resolve(t,s);(0,eval)(e.textContent)}}}}class U extends Z{instantiate(t,i,s,l){let n=0;if(this.options=l,i instanceof Text){if(!s)throw Error("Cannot create a standalone text node");this.root=s,i.nodeValue.length&&this.root.append(i)}else{if(s){let t;if(this.root=s,(e.t||s.childNodes.length)&&(t=e.i.createDocumentFragment(),t.append(...e.t||s.childNodes)),o=this.root.tagName,1===(r=i).children.length&&o.includes("-")&&r.children[0].tagName.replace("-SOLARITE-PLACEHOLDER","")===o){this.root.append(...i.children[0].childNodes);for(let t of i.children[0].attributes)this.root.hasAttribute(t.name)||this.root.setAttribute(t.name,t.value);n=1}else 1===i.childNodes.length&&3===i.childNodes[0].nodeType&&""===i.childNodes[0].textContent||this.root.append(...i.childNodes);if(t){for(let e of s.querySelectorAll("slot[name]")){let i=e.getAttribute("name");if(i){let s=t.querySelectorAll(`[slot='${i}']`);e.append(...s)}}let e=s.querySelector("slot:not([name])");e?e.append(t):s.append(t)}}else{let t=(t=>{let e=[];for(let i of t.childNodes)if(1===i.nodeType||3===i.nodeType&&i.textContent.trim().length){if(e.length)return null;e.push(i)}return e[0]})(i);this.root=t||i,t&&(n=1)}this.be(this.root,t,n),this.ge(this.root,t,n)}var r,o;this.Pt=this.Vt=this.root,e.h.set(this.root,this)}}let q=1,Y=new WeakMap;function X(t){let e=Y.get(t);return void 0===e&&(e="~@"+q++,Y.set(t,e)),e}class Q{exprs=void 0;html=void 0;Rt;jt;key;Ft=!1;constructor(t=[""],e=[]){this.html=t,this.exprs=e}render(t=null,i={}){let s=t&&e.h.get(t);return s||(s=new U(this,null,t,i),t||(t=s.getRootNode()),e.h.set(t,s)),1!==this.html?.length||this.html[0]?s.Wt(this.exprs):t.innerHTML="",t}te(){return void 0===this.Rt&&(this.Rt=this.exprs.length?X(this.html):this.html[0]),this.Rt}}function tt(t,e){if(t.html===e.html&&t.Ft===e.Ft){let i=t.exprs,s=e.exprs;for(let t=0;i.length>t;t++)if(!et(i[t],s[t]))return!1;return!0}return t.jt===e.jt&&!t.exprs.length&&!e.exprs.length&&1===t.html.length&&1===e.html.length&&t.Ft===e.Ft&&t.html[0]===e.html[0]}function et(t,e){if(t===e)return!0;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;t.length>i;i++)if(!et(t[i],e[i]))return!1;return!0}return t instanceof Q&&e instanceof Q&&tt(t,e)}function it(t){if("string"==typeof t){let i=e.i.createElement("template");i.innerHTML=t;let s=n.H(i.content.childNodes);return 1===s.length?s[0]:i.content}if(t instanceof Q)return t.render();if(t&&"object"==typeof t){let i=t;if("Object"!==i.constructor.name)throw Error(`Solarate Web Component class ${i.constructor?.name} must extend HTMLElement.`);if(!e.u.has(i)){e.u.set(i,null),i[st]();let t=e.u.get(i);e.u.delete(i);for(let e in i)t[e]="function"==typeof i[e]?i[e].bind(t):i[e];return t}}throw Error("toEl() does not support argument of type: "+(t?typeof t:t))}let st="render";function lt(t,...e){let i=new Q(t,e);return i.Ft=!0,i}const nt=Symbol("solariteRender"),rt=Symbol();function ot(t=rt,...i){if(Array.isArray(t))return new Q(t,i);if("string"==typeof t||t instanceof String){let e=t;if(!i.length||"object"!=typeof i[0]&&null!==i[0]){let t=e;return/^\s+</.test(t)&&(t=t.trim()),new Q([t],[])}return A(e+"",i[0]||{},i.slice(1))}if("function"==typeof t||t===w)return A(t,i[0]||{},i.slice(1));if(t instanceof HTMLElement||t instanceof DocumentFragment){if(!(i[0]instanceof Q)){let s=t,l=i[0];if(void 0===l){let t=s[nt];if(t)return t}let n=(t,...i)=>(s.shadowRoot&&(s.innerHTML=""),e.p.add(s),new Q(t,i).render(s,l));return void 0===l&&(s[nt]=n),n}i[0].render(t,i[1])}else{if(t===rt)return(t,...e)=>it(ot(t,...e));if("object"!=typeof t||!e.u.has(t)){if(n.P(t))return new Q;throw Error("h() does not support argument of type: "+(t?typeof t:t))}{let s=t;if("Object"!==s.constructor.name)throw Error(`Solarate Web Component class ${s.constructor?.name} must extend HTMLElement.`);if(!(i[0]instanceof Q))return((...t)=>{let i=ot(...t).render();e.u.set(s,i)}).bind(s);{let t=i[0].render();e.u.set(s,t)}}}}const ft=new WeakMap;function ht(t,e={},i=[]){for(let s of t.attributes){let l=n.k(s.name);if(!(l in t)||i.includes(l))continue;let r=s.value,o=e[l];r.startsWith("${")&&r.endsWith("}")?t[l]=JSON.parse(r.slice(2,-1)):o===Date?t[l]=new Date(r):o===Boolean?t[l]=!["false","0"].includes(r):o===Number?t[l]=+r:o===String?t[l]=r+"":o?t[l]=o(r):""===r&&("function"==typeof t[l]||"object"==typeof t[l]&&null!==t[l])||(t[l]=r)}}ot.immutableMap=ot.map=(t,e)=>{let i=Array(t.length);for(let s=0;t.length>s;s++){let l=t[s];if(null!==l&&"object"==typeof l){let t=ft.get(l);void 0===t&&(t=e(l),ft.set(l,t)),i[s]=t}else i[s]=e(l)}return i};let ut=new Proxy(HTMLElement,{construct:(t,e,i)=>(n.C(i),Reflect.construct(t,e,i))});class at extends ut{constructor(t=null){if(super(),t){if("object"!=typeof t)throw Error("First argument to custom element constructor must be an object.");if(t&&!Object.keys(t).length){let e=at.getAttribs(this);for(let i in e)t[i]=e[i]}}}render(){throw Error("render() is not defined for "+this.constructor.name)}renderFirstTime(){if(!e.p.has(this)){let t=at.getAttribs(this);this.render(t)}}connectedCallback(){this.renderFirstTime()}static define(t=null){n.C(this,t)}static getAttribs(t){let e=n.S(t);for(let t in e){let i=e[t];i.startsWith("${")&&i.endsWith("}")&&(e[t]=JSON.parse(i.slice(2,-1)))}return e}}export default ot;export{w as Fragment,e as Globals,at as Solarite,n as SolariteUtil,Q as Template,ht as assignAttributes,i as delve,c as getEventBinding,ot as h,lt as svg,it as toEl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solarite",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Solarite is a small (12KB min+gzip), fast, compilation-free JavaScript library that makes native web components fast to update, patching only the DOM that actually changed when you call render().",
5
5
  "type": "module",
6
6
  "main": "dist/Solarite.js",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
39
- "url": "git+https://github.com/Vorticode/solarite.git"
39
+ "url": "git+https://github.com/eric-frost/solarite.git"
40
40
  },
41
41
  "keywords": [
42
42
  "JavaScript",
@@ -51,7 +51,7 @@
51
51
  "author": "Eric Frost",
52
52
  "license": "MIT",
53
53
  "bugs": {
54
- "url": "https://github.com/Vorticode/solarite/issues"
54
+ "url": "https://github.com/eric-frost/solarite/issues"
55
55
  },
56
- "homepage": "https://vorticode.github.io/solarite/"
56
+ "homepage": "https://eric-frost.github.io/solarite/"
57
57
  }