tosijs 1.5.7 → 1.5.8
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/index.js +6 -6
- package/dist/index.js.map +7 -7
- package/dist/list-binding.d.ts +1 -0
- package/dist/main.js +6 -6
- package/dist/main.js.map +7 -7
- package/dist/module.debug.js +8 -8
- package/dist/module.debug.js.map +7 -7
- package/dist/module.js +6 -6
- package/dist/module.js.map +7 -7
- package/dist/module.safe.js +8 -8
- package/dist/module.safe.js.map +7 -7
- package/dist/version.d.ts +1 -1
- package/dist/xin-types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(()=>{var{defineProperty:sE,getOwnPropertyNames:hf,getOwnPropertyDescriptor:sf}=Object,pf=Object.prototype.hasOwnProperty;function rf(E){return this[E]}var of=(E)=>{var M=(TM??=new WeakMap).get(E),f;if(M)return M;if(M=sE({},"__esModule",{value:!0}),E&&typeof E==="object"||typeof E==="function"){for(var L of hf(E))if(!pf.call(M,L))sE(M,L,{get:rf.bind(E,L),enumerable:!(f=sf(E,L))||f.enumerable})}return TM.set(E,M),M},TM;var lf=(E)=>E;function tf(E,M){this[E]=lf.bind(null,M)}var af=(E,M)=>{for(var f in M)sE(E,f,{get:M[f],enumerable:!0,configurable:!0,set:tf.bind(M,f)})};var oL={};af(oL,{xinValue:()=>mM,xinSlot:()=>Bf,xinProxy:()=>nE,xinPath:()=>PM,xin:()=>V,warnDeprecated:()=>I,version:()=>dE,vars:()=>_E,varDefault:()=>UE,validateAgainstConstraints:()=>vE,updates:()=>EE,unobserve:()=>i,touchElement:()=>cE,touch:()=>k,tosiValue:()=>K,tosiUnique:()=>bf,tosiSlot:()=>If,tosiSetValue:()=>yM,tosiPath:()=>O,tosiLoader:()=>vf,tosiBlueprint:()=>cf,tosiAccessor:()=>NM,tosi:()=>wE,throttle:()=>ME,sync:()=>mf,svgElements:()=>NE,share:()=>yf,settings:()=>n,scrollListItemIntoView:()=>Cf,onThemePreferencesChange:()=>Zf,onStylesheetChange:()=>ff,on:()=>LE,observe:()=>GE,mathML:()=>yE,makeComponent:()=>CE,invertLuminance:()=>$f,initVars:()=>Jf,hotReload:()=>_f,getThemePreferences:()=>GM,getListItem:()=>bE,getListInstance:()=>mE,getListBinding:()=>YE,getCssVar:()=>kE,elements:()=>T,deprecated:()=>TE,deleteListItem:()=>Af,debounce:()=>QE,css:()=>p,boxedProxy:()=>AE,boxed:()=>B,blueprintLoader:()=>nf,blueprint:()=>gf,bindings:()=>WE,bindParts:()=>zf,bind:()=>m,TOSI_ACCESSOR:()=>FE,TAKE_DESCRIPTOR:()=>JE,StyleSheet:()=>Lf,MoreMath:()=>eM,Component:()=>N,Color:()=>G,BlueprintLoader:()=>iE,Blueprint:()=>jE});function b(E){if(E==null||typeof E!=="object")return E;if(E instanceof Set)return new Set(E);else if(Array.isArray(E))return E.map(b);let M={};for(let f in E){let L=E[f];if(E!=null&&typeof E==="object")M[f]=b(L);else M[f]=L}return M}var RE="-xin-data",g=`.${RE}`,rE="-xin-event",oE=`.${rE}`,x=Symbol.for("xin-path"),d=Symbol.for("xin-value"),kM="xinObserve",BM="xinBind",_M="xinOn",FE=Symbol.for("tosi-accessor"),JE=Symbol.for("tosi-take"),$E=Symbol("list-binding"),a=Symbol("list-instance"),pE=new Map;function SM(E,M){let f=pE.get(E);if(f===void 0)f=new Set,pE.set(E,f);f.add(M)}function xM(E){return pE.get(E)}var IM=new Set;function I(E,M){if(!IM.has(E))console.warn(M),IM.add(E)}function TE(E,M){let f=!1;return(...L)=>{if(!f)console.warn(M),f=!0;return E(...L)}}var O=(E)=>{return E&&E[x]||void 0};function K(E){if(typeof E==="object"&&E!==null){let M=E[d];return M!==void 0?M:E}return E}function NM(E){return E!=null?E[FE]:void 0}function yM(E,M){if(O(E)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");E[d]=M}var PM=TE(O,"xinPath is deprecated. Use tosiPath instead."),mM=TE(K,"xinValue is deprecated. Use tosiValue instead."),t=new WeakMap,y=new WeakMap;var e=(E)=>{let M=E.cloneNode();if(M instanceof Element){let f=y.get(E),L=t.get(E);if(f!=null)y.set(M,b(f));if(L!=null)t.set(M,b(L))}for(let f of Array.from(E instanceof HTMLTemplateElement?E.content.childNodes:E.childNodes))if(f instanceof Element||f instanceof DocumentFragment)M.appendChild(e(f));else M.appendChild(f.cloneNode());return M};var n={debug:!1,perf:!1};var ef=(E)=>{try{return JSON.stringify(E)}catch(M){return"{has circular references}"}},lE=(...E)=>Error(E.map(ef).join(" "));var EL=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),ML=0,fL=()=>(parseInt("10000",36)+ ++ML).toString(36).slice(-5),eE=()=>EL()+fL(),aE=Symbol("delete"),vM=Symbol("new-object"),tE=Symbol("automatic-index");function uM(E){if(E==="")return[];if(Array.isArray(E))return E;else{let M=[];while(E.length>0){let f=E.search(/\[[^\]]+\]/);if(f===-1){M.push(E.split("."));break}else{let L=E.slice(0,f);if(E=E.slice(f),L!=="")M.push(L.split("."));if(f=E.indexOf("]")+1,M.push(E.slice(1,f-1)),E.slice(f,f+1)===".")f+=1;E=E.slice(f)}}return M}}var c=new WeakMap;function gM(E,M){if(c.get(E)===void 0)c.set(E,{});if(c.get(E)[M]===void 0)c.get(E)[M]={};let f=c.get(E)[M];if(M==="_auto_")E.forEach((L,H)=>{if(L[tE]===void 0)L[tE]=eE();f[L[tE]+""]=H});else E.forEach((L,H)=>{f[w(L,M)+""]=H});return f}function LL(E,M){if(c.get(E)===void 0||c.get(E)[M]===void 0)return gM(E,M);else return c.get(E)[M]}function HL(E,M,f){f=f+"";let L=LL(E,M)[f];if(L===void 0||w(E[L],M)+""!==f)L=gM(E,M)[f];return L}function JL(E,M,f){if(E[M]===void 0&&f!==void 0)E[M]=f;return E[M]}function dM(E,M,f,L){let H=M!==""?HL(E,M,f):f;if(L===aE)return E.splice(H,1),c.delete(E),Symbol("deleted");else if(L===vM){if(M===""&&E[H]===void 0)E[H]={}}else if(L!==void 0)if(H!==void 0)E[H]=L;else if(M!==""&&w(L,M)+""===f+"")E.push(L),H=E.length-1;else throw Error(`byIdPath insert failed at [${M}=${f}]`);return E[H]}function bM(E){if(!Array.isArray(E))throw lE("setByPath failed: expected array, found",E)}function cM(E){if(E==null||!(E instanceof Object))throw lE("setByPath failed: expected Object, found",E)}function w(E,M){let f=uM(M),L=E,H,$,J,Q;for(H=0,$=f.length;L!==void 0&&H<$;H++){let Z=f[H];if(Array.isArray(Z))for(J=0,Q=Z.length;L!==void 0&&J<Q;J++){let Y=Z[J];L=L[Y]}else if(L.length===0){if(L=L[Number(Z.slice(1))],Z[0]!=="=")return}else if(Z.includes("=")){let[Y,...X]=Z.split("=");L=dM(L,Y,X.join("="))}else J=parseInt(Z,10),L=L[J]}return L}function h(E,M,f){let L=E;if(M==="")throw Error("setByPath cannot be used to set the root object");let H=uM(M);while(L!=null&&H.length>0){let $=H.shift();if(typeof $==="string"){let J=$.indexOf("=");if(J>-1){if(J===0)cM(L);else bM(L);let Q=$.slice(0,J),Z=$.slice(J+1);if(L=dM(L,Q,Z,H.length>0?vM:f),H.length===0)return!0}else{bM(L);let Q=parseInt($,10);if(H.length>0)L=L[Q];else{if(f!==aE){if(L[Q]===f)return!1;L[Q]=f}else L.splice(Q,1);return!0}}}else if(Array.isArray($)&&$.length>0){cM(L);while($.length>0){let J=$.shift();if($.length>0||H.length>0)L=JL(L,J,$.length>0?{}:[]);else{if(f!==aE){if(L[J]===f)return!1;L[J]=f}else{if(!Object.prototype.hasOwnProperty.call(L,J))return!1;delete L[J]}return!0}}}else throw Error(`setByPath failed, bad path ${M}`)}throw Error(`setByPath(${E}, ${M}, ${f}) failed`)}var j={},EM=null,nM=(E)=>{EM=E},XE=()=>{if(EM===null)throw Error("xin proxy not initialized");return EM},MM=null,fM=null,hM=(E,M)=>{MM=E,fM=M},iM=()=>{if(MM===null)throw Error("bind not initialized");return MM},sM=()=>{if(fM===null)throw Error("on not initialized");return fM};var pM=Symbol("observer should be removed"),IE=[],ZE=[],LM=!1,HM,JM;function $L(E,M,f,L){let H=xM(E);if(H===void 0)return[];let $=[];for(let J of H){let Q=w(f,J);if(Q!==void 0)$.push(`${E}[${J}=${Q}]${L}`)}return $}class rM{description;test;callback;constructor(E,M){let f=typeof M==="string"?`"${M}"`:`function ${M.name}`,L;if(typeof E==="string")this.test=(H)=>typeof H==="string"&&H!==""&&(E.startsWith(H)||H.startsWith(E)),L=`test = "${E}"`;else if(E instanceof RegExp)this.test=E.test.bind(E),L=`test = "${E.toString()}"`;else if(E instanceof Function)this.test=E,L=`test = function ${E.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${L}, ${f}`,typeof M==="function")this.callback=M;else throw Error("expect callback to be a path or function");IE.push(this)}}var EE=async()=>{if(HM===void 0)return;await HM},ZL=()=>{if(n.perf)console.time("xin async update");let E=Array.from(ZE);ZE.length=0,LM=!1;for(let M of E)IE.filter((f)=>{let L;try{L=f.test(M)}catch(H){throw Error(`Listener ${f.description} threw "${H}" at "${M}"`)}if(L===pM)return i(f),!1;return L}).forEach((f)=>{let L;try{L=f.callback(M)}catch(H){console.error(`Listener ${f.description} threw "${H}" handling "${M}"`)}if(L===pM)i(f)});if(typeof JM==="function")JM();if(n.perf)console.timeEnd("xin async update")},k=(E)=>{let M=typeof E==="string"?E:O(E);if(M===void 0)throw console.error("touch was called on an invalid target",E),Error("touch was called on an invalid target");if(LM===!1)HM=new Promise((L)=>{JM=L}),LM=setTimeout(ZL);if(ZE.find((L)=>M.startsWith(L))==null)ZE.push(M);let f=M.match(/^(.+)\[(\d+)\](.*)$/);if(f!==null){let[,L,H,$]=f,J=parseInt(H,10),Q=w(j,`${L}[${J}]`);if(Q!=null){let Z=$L(L,J,Q,$);for(let Y of Z)if(ZE.find((X)=>Y.startsWith(X))==null)ZE.push(Y)}}},v=(E,M)=>{return new rM(E,M)},i=(E)=>{let M=IE.indexOf(E);if(M>-1)IE.splice(M,1);else throw Error("unobserve failed, listener not found")};var $M=(E,M)=>{let f=new Event(M);E.dispatchEvent(f)},lM=(E)=>{if(E instanceof HTMLInputElement)return E.type;else if(E instanceof HTMLSelectElement&&E.hasAttribute("multiple"))return"multi-select";else return"other"},tM=(E,M)=>{switch(lM(E)){case"radio":E.checked=E.value===M;break;case"checkbox":E.checked=!!M;break;case"date":E.valueAsDate=new Date(M);break;case"multi-select":for(let f of Array.from(E.querySelectorAll("option")))f.selected=M[f.value];break;default:E.value=M}},aM=(E)=>{switch(lM(E)){case"radio":{let M=E.parentElement?.querySelector(`[name="${E.name}"]:checked`);return M!=null?M.value:null}case"checkbox":return E.checked;case"date":return E.valueAsDate?.toISOString();case"multi-select":return Array.from(E.querySelectorAll("option")).reduce((M,f)=>{return M[f.value]=f.selected,M},{});default:return E.value}},{ResizeObserver:oM}=globalThis,zE=oM!=null?new oM((E)=>{for(let M of E){let f=M.target;$M(f,"resize")}}):{observe(){},unobserve(){}},ZM=(E,M,f=!0)=>{if(E!=null&&M!=null)if(typeof M==="string")E.textContent=M;else if(Array.isArray(M))M.forEach((L)=>{E.append(L instanceof Node&&f?e(L):L)});else if(M instanceof Node)E.append(f?e(M):M);else throw Error("expect text content or document node")};var QE=(E,M=250)=>{let f;return(...L)=>{if(f!==void 0)clearTimeout(f);f=setTimeout(()=>{E(...L)},M)}},ME=(E,M=250)=>{let f,L=Date.now()-M,H=!1;return(...$)=>{if(clearTimeout(f),f=setTimeout(()=>{E(...$),L=Date.now()},M),!H&&Date.now()-L>=M){H=!0;try{E(...$),L=Date.now()}finally{H=!1}}}};var WE={value:{toDOM:tM,fromDOM(E){return aM(E)}},text:{toDOM(E,M){E.textContent=M}},enabled:{toDOM(E,M){E.disabled=!M}},disabled:{toDOM(E,M){E.disabled=Boolean(M)}},list:{toDOM(E,M,f){YE(E,M,f).update(M)}}};function S(E){return E.replace(/[A-Z]/g,(M)=>{return`-${M.toLocaleLowerCase()}`})}function QM(E){return E.replace(/-([a-z])/g,(M,f)=>{return f.toLocaleUpperCase()})}var QL=180/Math.PI,YL=Math.PI/180;function P(E,M,f){return f<E?NaN:M<E?E:M>f?f:M}function u(E,M,f,L=!0){if(L)f=P(0,f,1);return f*(M-E)+E}var eM={RADIANS_TO_DEGREES:QL,DEGREES_TO_RADIANS:YL,clamp:P,lerp:u};function kE(E,M=document.body){let f=getComputedStyle(M);if(E.endsWith(")")&&E.startsWith("var("))E=E.slice(4,-1);return f.getPropertyValue(E).trim()}var GL=(E,M,f)=>{return(0.299*E+0.587*M+0.114*f)/255},fE=(E)=>("00"+Math.round(Number(E)).toString(16)).slice(-2);class Ef{h;s;l;constructor(E,M,f){E/=255,M/=255,f/=255;let L=Math.max(E,M,f),H=L-Math.min(E,M,f),$=H!==0?L===E?(M-f)/H:L===M?2+(f-E)/H:4+(E-M)/H:0;this.h=60*$<0?60*$+360:60*$,this.s=H!==0?L<=0.5?H/(2*L-H):H/(2-(2*L-H)):0,this.l=(2*L-H)/2}}var s=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;if(s)s.style.display="none";class G{r;g;b;a;static fromVar(E,M=document.body){return G.fromCss(kE(E,M))}static fromCss(E){let M=E.match(/^#([0-9a-fA-F]+)$/);if(M){let Z=M[1];if(Z.length===3)return new G(parseInt(Z[0]+Z[0],16),parseInt(Z[1]+Z[1],16),parseInt(Z[2]+Z[2],16));if(Z.length===4)return new G(parseInt(Z[0]+Z[0],16),parseInt(Z[1]+Z[1],16),parseInt(Z[2]+Z[2],16),parseInt(Z[3]+Z[3],16)/255);if(Z.length===6)return new G(parseInt(Z.slice(0,2),16),parseInt(Z.slice(2,4),16),parseInt(Z.slice(4,6),16));if(Z.length===8)return new G(parseInt(Z.slice(0,2),16),parseInt(Z.slice(2,4),16),parseInt(Z.slice(4,6),16),parseInt(Z.slice(6,8),16)/255)}let f=E;if(s instanceof HTMLSpanElement)s.style.color="black",s.style.color=E,document.body.appendChild(s),f=getComputedStyle(s).color,s.remove();let[L,H,$,J]=f.match(/[\d.]+/g)||["0","0","0","0"],Q=f.startsWith("color(srgb")?255:1;return new G(Number(L)*Q,Number(H)*Q,Number($)*Q,J==null?1:Number(J))}static fromHsl(E,M,f,L=1){let H,$,J;if(M===0)H=$=J=f;else{let Z=(z,R,W)=>{if(W<0)W+=1;if(W>1)W-=1;if(W<0.16666666666666666)return z+(R-z)*6*W;if(W<0.5)return R;if(W<0.6666666666666666)return z+(R-z)*(0.6666666666666666-W)*6;return z},Y=f<0.5?f*(1+M):f+M-f*M,X=2*f-Y,F=(E%360+360)%360/360;H=Z(X,Y,F+0.3333333333333333),$=Z(X,Y,F),J=Z(X,Y,F-0.3333333333333333)}let Q=new G(H*255,$*255,J*255,L);return Q.hslCached={h:(E%360+360)%360,s:M,l:f},Q}static black=new G(0,0,0);static white=new G(255,255,255);constructor(E,M,f,L=1){this.r=P(0,E,255),this.g=P(0,M,255),this.b=P(0,f,255),this.a=P(0,L,1)}get inverse(){return new G(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:E,s:M,l:f}=this._hsl;return G.fromHsl(E,M,1-f,this.a)}get opaque(){return this.a===1?this:new G(this.r,this.g,this.b,1)}contrasting(E=1){return this.opaque.blend(this.brightness>0.5?G.black:G.white,E)}get rgb(){let{r:E,g:M,b:f}=this;return`rgb(${E.toFixed(0)},${M.toFixed(0)},${f.toFixed(0)})`}get rgba(){let{r:E,g:M,b:f,a:L}=this;return`rgba(${E.toFixed(0)},${M.toFixed(0)},${f.toFixed(0)},${L.toFixed(2)})`}get RGBA(){return[this.r/255,this.g/255,this.b/255,this.a]}get ARGB(){return[this.a,this.r/255,this.g/255,this.b/255]}hslCached;get _hsl(){if(this.hslCached==null)this.hslCached=new Ef(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:E,s:M,l:f}=this._hsl;return`hsl(${E.toFixed(0)}deg ${(M*100).toFixed(0)}% ${(f*100).toFixed(0)}%)`}get hsla(){let{h:E,s:M,l:f}=this._hsl;return`hsl(${E.toFixed(0)}deg ${(M*100).toFixed(0)}% ${(f*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let E=this.brightness*255;return new G(E,E,E)}get brightness(){return GL(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+fE(this.r)+fE(this.g)+fE(this.b):"#"+fE(this.r)+fE(this.g)+fE(this.b)+fE(Math.floor(255*this.a))}brighten(E){let{h:M,s:f,l:L}=this._hsl,H=P(0,L+E*(1-L),1);return G.fromHsl(M,f,H,this.a)}darken(E){let{h:M,s:f,l:L}=this._hsl,H=P(0,L*(1-E),1);return G.fromHsl(M,f,H,this.a)}saturate(E){let{h:M,s:f,l:L}=this._hsl,H=P(0,f+E*(1-f),1);return G.fromHsl(M,H,L,this.a)}desaturate(E){let{h:M,s:f,l:L}=this._hsl,H=P(0,f*(1-E),1);return G.fromHsl(M,H,L,this.a)}rotate(E){let{h:M,s:f,l:L}=this._hsl,H=(M+360+E)%360;return G.fromHsl(H,f,L,this.a)}opacity(E){let{h:M,s:f,l:L}=this._hsl;return G.fromHsl(M,f,L,E)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(E,M){return new G(u(this.r,E.r,M),u(this.g,E.g,M),u(this.b,E.b,M),u(this.a,E.a,M))}static blendHue(E,M,f){let L=(M-E+720)%360;if(L<180)return E+f*L;else return E-(360-L)*f}mix(E,M){let f=this._hsl,L=E._hsl;return G.fromHsl(f.s===0?L.h:L.s===0?f.h:G.blendHue(f.h,L.h,M),u(f.s,L.s,M),u(f.l,L.l,M),u(this.a,E.a,M))}colorMix(E,M){return G.fromCss(`color-mix(in hsl, ${this.html}, ${E.html} ${(M*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(E,M,f,L){if(!G.computedColors.has(E))G.computedColors.set(E,{varName:M,scale:f,method:L}),G.queueRecompute()}static queueRecompute(){if(G.recomputeQueued)return;G.recomputeQueued=!0,queueMicrotask(()=>{G.recomputeQueued=!1,G.recomputeColors()})}static recomputeColors(){if(G.computedColors.size===0)return;let E=[];for(let[f,{varName:L,scale:H,method:$}]of G.computedColors)try{let J=G.fromVar(L),Q;switch($){case"b":Q=H>0?J.brighten(H):J.darken(-H);break;case"s":Q=H>0?J.saturate(H):J.desaturate(-H);break;case"h":Q=J.rotate(H*100);break;case"o":Q=J.opacity(H);break;default:continue}E.push(` ${f}: ${Q.rgba};`)}catch(J){}if(E.length===0)return;let M=`:root {
|
|
1
|
+
(()=>{var{defineProperty:pE,getOwnPropertyNames:sf,getOwnPropertyDescriptor:pf}=Object,rf=Object.prototype.hasOwnProperty;function of(E){return this[E]}var lf=(E)=>{var M=(TM??=new WeakMap).get(E),f;if(M)return M;if(M=pE({},"__esModule",{value:!0}),E&&typeof E==="object"||typeof E==="function"){for(var L of sf(E))if(!rf.call(M,L))pE(M,L,{get:of.bind(E,L),enumerable:!(f=pf(E,L))||f.enumerable})}return TM.set(E,M),M},TM;var tf=(E)=>E;function af(E,M){this[E]=tf.bind(null,M)}var ef=(E,M)=>{for(var f in M)pE(E,f,{get:M[f],enumerable:!0,configurable:!0,set:af.bind(M,f)})};var oL={};ef(oL,{xinValue:()=>mM,xinSlot:()=>_f,xinProxy:()=>hE,xinPath:()=>PM,xin:()=>R,warnDeprecated:()=>j,version:()=>nE,vars:()=>SE,varDefault:()=>KE,validateAgainstConstraints:()=>uE,updates:()=>LE,unobserve:()=>o,touchElement:()=>vE,touch:()=>k,tosiValue:()=>q,tosiUnique:()=>cf,tosiSlot:()=>kf,tosiSetValue:()=>yM,tosiPath:()=>A,tosiLoader:()=>uf,tosiBlueprint:()=>vf,tosiAccessor:()=>NM,tosi:()=>CE,throttle:()=>HE,sync:()=>bf,svgElements:()=>yE,share:()=>Pf,settings:()=>p,scrollListItemIntoView:()=>jf,onThemePreferencesChange:()=>Zf,onStylesheetChange:()=>ff,on:()=>$E,observe:()=>XE,mathML:()=>PE,makeComponent:()=>VE,invertLuminance:()=>$f,initVars:()=>Jf,hotReload:()=>Sf,getThemePreferences:()=>FM,getListItem:()=>cE,getListInstance:()=>bE,getListBinding:()=>FE,getCssVar:()=>BE,elements:()=>I,deprecated:()=>IE,deleteListItem:()=>Cf,debounce:()=>GE,css:()=>t,boxedProxy:()=>jE,boxed:()=>B,blueprintLoader:()=>hf,blueprint:()=>df,bindings:()=>DE,bindParts:()=>Wf,bind:()=>P,TOSI_ACCESSOR:()=>zE,TAKE_DESCRIPTOR:()=>i,StyleSheet:()=>Lf,MoreMath:()=>eM,Component:()=>m,Color:()=>G,BlueprintLoader:()=>sE,Blueprint:()=>RE});function v(E){if(E==null||typeof E!=="object")return E;if(E instanceof Set)return new Set(E);else if(Array.isArray(E))return E.map(v);let M={};for(let f in E){let L=E[f];if(E!=null&&typeof E==="object")M[f]=v(L);else M[f]=L}return M}var TE="-xin-data",n=`.${TE}`,oE="-xin-event",lE=`.${oE}`,y=Symbol.for("xin-path"),h=Symbol.for("xin-value"),kM="xinObserve",BM="xinBind",_M="xinOn",zE=Symbol.for("tosi-accessor"),i=Symbol.for("tosi-take"),QE=Symbol("list-binding"),s=Symbol("list-instance"),rE=new Map;function SM(E,M){let f=rE.get(E);if(f===void 0)f=new Set,rE.set(E,f);f.add(M)}function xM(E){return rE.get(E)}var IM=new Set;function j(E,M){if(!IM.has(E))console.warn(M),IM.add(E)}function IE(E,M){let f=!1;return(...L)=>{if(!f)console.warn(M),f=!0;return E(...L)}}var A=(E)=>{return E&&E[y]||void 0};function q(E){if(typeof E==="object"&&E!==null){let M=E[h];return M!==void 0?M:E}return E}function NM(E){return E!=null?E[zE]:void 0}function yM(E,M){if(A(E)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");E[h]=M}var PM=IE(A,"xinPath is deprecated. Use tosiPath instead."),mM=IE(q,"xinValue is deprecated. Use tosiValue instead."),ME=new WeakMap,b=new WeakMap;var fE=(E)=>{let M=E.cloneNode();if(M instanceof Element){let f=b.get(E),L=ME.get(E);if(f!=null)b.set(M,v(f));if(L!=null)ME.set(M,v(L))}for(let f of Array.from(E instanceof HTMLTemplateElement?E.content.childNodes:E.childNodes))if(f instanceof Element||f instanceof DocumentFragment)M.appendChild(fE(f));else M.appendChild(f.cloneNode());return M};var p={debug:!1,perf:!1};var EL=(E)=>{try{return JSON.stringify(E)}catch(M){return"{has circular references}"}},tE=(...E)=>Error(E.map(EL).join(" "));var ML=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),fL=0,LL=()=>(parseInt("10000",36)+ ++fL).toString(36).slice(-5),EM=()=>ML()+LL(),eE=Symbol("delete"),vM=Symbol("new-object"),aE=Symbol("automatic-index");function uM(E){if(E==="")return[];if(Array.isArray(E))return E;else{let M=[];while(E.length>0){let f=E.search(/\[[^\]]+\]/);if(f===-1){M.push(E.split("."));break}else{let L=E.slice(0,f);if(E=E.slice(f),L!=="")M.push(L.split("."));if(f=E.indexOf("]")+1,M.push(E.slice(1,f-1)),E.slice(f,f+1)===".")f+=1;E=E.slice(f)}}return M}}var u=new WeakMap;function gM(E,M){if(u.get(E)===void 0)u.set(E,{});if(u.get(E)[M]===void 0)u.get(E)[M]={};let f=u.get(E)[M];if(M==="_auto_")E.forEach((L,H)=>{if(L[aE]===void 0)L[aE]=EM();f[L[aE]+""]=H});else E.forEach((L,H)=>{f[C(L,M)+""]=H});return f}function HL(E,M){if(u.get(E)===void 0||u.get(E)[M]===void 0)return gM(E,M);else return u.get(E)[M]}function JL(E,M,f){f=f+"";let L=HL(E,M)[f];if(L===void 0||C(E[L],M)+""!==f)L=gM(E,M)[f];return L}function $L(E,M,f){if(E[M]===void 0&&f!==void 0)E[M]=f;return E[M]}function dM(E,M,f,L){let H=M!==""?JL(E,M,f):f;if(L===eE)return E.splice(H,1),u.delete(E),Symbol("deleted");else if(L===vM){if(M===""&&E[H]===void 0)E[H]={}}else if(L!==void 0)if(H!==void 0)E[H]=L;else if(M!==""&&C(L,M)+""===f+"")E.push(L),H=E.length-1;else throw Error(`byIdPath insert failed at [${M}=${f}]`);return E[H]}function bM(E){if(!Array.isArray(E))throw tE("setByPath failed: expected array, found",E)}function cM(E){if(E==null||!(E instanceof Object))throw tE("setByPath failed: expected Object, found",E)}function C(E,M){let f=uM(M),L=E,H,$,J,Q;for(H=0,$=f.length;L!==void 0&&H<$;H++){let Z=f[H];if(Array.isArray(Z))for(J=0,Q=Z.length;L!==void 0&&J<Q;J++){let Y=Z[J];L=L[Y]}else if(L.length===0){if(L=L[Number(Z.slice(1))],Z[0]!=="=")return}else if(Z.includes("=")){let[Y,...X]=Z.split("=");L=dM(L,Y,X.join("="))}else J=parseInt(Z,10),L=L[J]}return L}function r(E,M,f){let L=E;if(M==="")throw Error("setByPath cannot be used to set the root object");let H=uM(M);while(L!=null&&H.length>0){let $=H.shift();if(typeof $==="string"){let J=$.indexOf("=");if(J>-1){if(J===0)cM(L);else bM(L);let Q=$.slice(0,J),Z=$.slice(J+1);if(L=dM(L,Q,Z,H.length>0?vM:f),H.length===0)return!0}else{bM(L);let Q=parseInt($,10);if(H.length>0)L=L[Q];else{if(f!==eE){if(L[Q]===f)return!1;L[Q]=f}else L.splice(Q,1);return!0}}}else if(Array.isArray($)&&$.length>0){cM(L);while($.length>0){let J=$.shift();if($.length>0||H.length>0)L=$L(L,J,$.length>0?{}:[]);else{if(f!==eE){if(L[J]===f)return!1;L[J]=f}else{if(!Object.prototype.hasOwnProperty.call(L,J))return!1;delete L[J]}return!0}}}else throw Error(`setByPath failed, bad path ${M}`)}throw Error(`setByPath(${E}, ${M}, ${f}) failed`)}var V={},MM=null,nM=(E)=>{MM=E},WE=()=>{if(MM===null)throw Error("xin proxy not initialized");return MM},fM=null,LM=null,hM=(E,M)=>{fM=E,LM=M},iM=()=>{if(fM===null)throw Error("bind not initialized");return fM},sM=()=>{if(LM===null)throw Error("on not initialized");return LM};var pM=Symbol("observer should be removed"),kE=[],YE=[],HM=!1,JM,$M;function ZL(E,M,f,L){let H=xM(E);if(H===void 0)return[];let $=[];for(let J of H){let Q=C(f,J);if(Q!==void 0)$.push(`${E}[${J}=${Q}]${L}`)}return $}class rM{description;test;callback;constructor(E,M){let f=typeof M==="string"?`"${M}"`:`function ${M.name}`,L;if(typeof E==="string")this.test=(H)=>typeof H==="string"&&H!==""&&(E.startsWith(H)||H.startsWith(E)),L=`test = "${E}"`;else if(E instanceof RegExp)this.test=E.test.bind(E),L=`test = "${E.toString()}"`;else if(E instanceof Function)this.test=E,L=`test = function ${E.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${L}, ${f}`,typeof M==="function")this.callback=M;else throw Error("expect callback to be a path or function");kE.push(this)}}var LE=async()=>{if(JM===void 0)return;await JM},QL=()=>{if(p.perf)console.time("xin async update");let E=Array.from(YE);YE.length=0,HM=!1;for(let M of E)kE.filter((f)=>{let L;try{L=f.test(M)}catch(H){throw Error(`Listener ${f.description} threw "${H}" at "${M}"`)}if(L===pM)return o(f),!1;return L}).forEach((f)=>{let L;try{L=f.callback(M)}catch(H){console.error(`Listener ${f.description} threw "${H}" handling "${M}"`)}if(L===pM)o(f)});if(typeof $M==="function")$M();if(p.perf)console.timeEnd("xin async update")},k=(E)=>{let M=typeof E==="string"?E:A(E);if(M===void 0)throw console.error("touch was called on an invalid target",E),Error("touch was called on an invalid target");if(HM===!1)JM=new Promise((L)=>{$M=L}),HM=setTimeout(QL);if(YE.find((L)=>M.startsWith(L))==null)YE.push(M);let f=M.match(/^(.+)\[(\d+)\](.*)$/);if(f!==null){let[,L,H,$]=f,J=parseInt(H,10),Q=C(V,`${L}[${J}]`);if(Q!=null){let Z=ZL(L,J,Q,$);for(let Y of Z)if(YE.find((X)=>Y.startsWith(X))==null)YE.push(Y)}}},g=(E,M)=>{return new rM(E,M)},o=(E)=>{let M=kE.indexOf(E);if(M>-1)kE.splice(M,1);else throw Error("unobserve failed, listener not found")};var ZM=(E,M)=>{let f=new Event(M);E.dispatchEvent(f)},lM=(E)=>{if(E instanceof HTMLInputElement)return E.type;else if(E instanceof HTMLSelectElement&&E.hasAttribute("multiple"))return"multi-select";else return"other"},tM=(E,M)=>{switch(lM(E)){case"radio":E.checked=E.value===M;break;case"checkbox":E.checked=!!M;break;case"date":E.valueAsDate=new Date(M);break;case"multi-select":for(let f of Array.from(E.querySelectorAll("option")))f.selected=M[f.value];break;default:E.value=M}},aM=(E)=>{switch(lM(E)){case"radio":{let M=E.parentElement?.querySelector(`[name="${E.name}"]:checked`);return M!=null?M.value:null}case"checkbox":return E.checked;case"date":return E.valueAsDate?.toISOString();case"multi-select":return Array.from(E.querySelectorAll("option")).reduce((M,f)=>{return M[f.value]=f.selected,M},{});default:return E.value}},{ResizeObserver:oM}=globalThis,UE=oM!=null?new oM((E)=>{for(let M of E){let f=M.target;ZM(f,"resize")}}):{observe(){},unobserve(){}},QM=(E,M,f=!0)=>{if(E!=null&&M!=null)if(typeof M==="string")E.textContent=M;else if(Array.isArray(M))M.forEach((L)=>{E.append(L instanceof Node&&f?fE(L):L)});else if(M instanceof Node)E.append(f?fE(M):M);else throw Error("expect text content or document node")};var GE=(E,M=250)=>{let f;return(...L)=>{if(f!==void 0)clearTimeout(f);f=setTimeout(()=>{E(...L)},M)}},HE=(E,M=250)=>{let f,L=Date.now()-M,H=!1;return(...$)=>{if(clearTimeout(f),f=setTimeout(()=>{E(...$),L=Date.now()},M),!H&&Date.now()-L>=M){H=!0;try{E(...$),L=Date.now()}finally{H=!1}}}};var DE={value:{toDOM:tM,fromDOM(E){return aM(E)}},text:{toDOM(E,M){E.textContent=M}},enabled:{toDOM(E,M){E.disabled=!M}},disabled:{toDOM(E,M){E.disabled=Boolean(M)}},list:{toDOM(E,M,f){FE(E,M,f).update(M)}}};function S(E){return E.replace(/[A-Z]/g,(M)=>{return`-${M.toLocaleLowerCase()}`})}function YM(E){return E.replace(/-([a-z])/g,(M,f)=>{return f.toLocaleUpperCase()})}var YL=180/Math.PI,GL=Math.PI/180;function c(E,M,f){return f<E?NaN:M<E?E:M>f?f:M}function d(E,M,f,L=!0){if(L)f=c(0,f,1);return f*(M-E)+E}var eM={RADIANS_TO_DEGREES:YL,DEGREES_TO_RADIANS:GL,clamp:c,lerp:d};function BE(E,M=document.body){let f=getComputedStyle(M);if(E.endsWith(")")&&E.startsWith("var("))E=E.slice(4,-1);return f.getPropertyValue(E).trim()}var FL=(E,M,f)=>{return(0.299*E+0.587*M+0.114*f)/255},JE=(E)=>("00"+Math.round(Number(E)).toString(16)).slice(-2);class Ef{h;s;l;constructor(E,M,f){E/=255,M/=255,f/=255;let L=Math.max(E,M,f),H=L-Math.min(E,M,f),$=H!==0?L===E?(M-f)/H:L===M?2+(f-E)/H:4+(E-M)/H:0;this.h=60*$<0?60*$+360:60*$,this.s=H!==0?L<=0.5?H/(2*L-H):H/(2-(2*L-H)):0,this.l=(2*L-H)/2}}var l=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;if(l)l.style.display="none";class G{r;g;b;a;static fromVar(E,M=document.body){return G.fromCss(BE(E,M))}static fromCss(E){let M=E.match(/^#([0-9a-fA-F]+)$/);if(M){let Z=M[1];if(Z.length===3)return new G(parseInt(Z[0]+Z[0],16),parseInt(Z[1]+Z[1],16),parseInt(Z[2]+Z[2],16));if(Z.length===4)return new G(parseInt(Z[0]+Z[0],16),parseInt(Z[1]+Z[1],16),parseInt(Z[2]+Z[2],16),parseInt(Z[3]+Z[3],16)/255);if(Z.length===6)return new G(parseInt(Z.slice(0,2),16),parseInt(Z.slice(2,4),16),parseInt(Z.slice(4,6),16));if(Z.length===8)return new G(parseInt(Z.slice(0,2),16),parseInt(Z.slice(2,4),16),parseInt(Z.slice(4,6),16),parseInt(Z.slice(6,8),16)/255)}let f=E;if(l instanceof HTMLSpanElement)l.style.color="black",l.style.color=E,document.body.appendChild(l),f=getComputedStyle(l).color,l.remove();let[L,H,$,J]=f.match(/[\d.]+/g)||["0","0","0","0"],Q=f.startsWith("color(srgb")?255:1;return new G(Number(L)*Q,Number(H)*Q,Number($)*Q,J==null?1:Number(J))}static fromHsl(E,M,f,L=1){let H,$,J;if(M===0)H=$=J=f;else{let Z=(z,T,W)=>{if(W<0)W+=1;if(W>1)W-=1;if(W<0.16666666666666666)return z+(T-z)*6*W;if(W<0.5)return T;if(W<0.6666666666666666)return z+(T-z)*(0.6666666666666666-W)*6;return z},Y=f<0.5?f*(1+M):f+M-f*M,X=2*f-Y,F=(E%360+360)%360/360;H=Z(X,Y,F+0.3333333333333333),$=Z(X,Y,F),J=Z(X,Y,F-0.3333333333333333)}let Q=new G(H*255,$*255,J*255,L);return Q.hslCached={h:(E%360+360)%360,s:M,l:f},Q}static black=new G(0,0,0);static white=new G(255,255,255);constructor(E,M,f,L=1){this.r=c(0,E,255),this.g=c(0,M,255),this.b=c(0,f,255),this.a=c(0,L,1)}get inverse(){return new G(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:E,s:M,l:f}=this._hsl;return G.fromHsl(E,M,1-f,this.a)}get opaque(){return this.a===1?this:new G(this.r,this.g,this.b,1)}contrasting(E=1){return this.opaque.blend(this.brightness>0.5?G.black:G.white,E)}get rgb(){let{r:E,g:M,b:f}=this;return`rgb(${E.toFixed(0)},${M.toFixed(0)},${f.toFixed(0)})`}get rgba(){let{r:E,g:M,b:f,a:L}=this;return`rgba(${E.toFixed(0)},${M.toFixed(0)},${f.toFixed(0)},${L.toFixed(2)})`}get RGBA(){return[this.r/255,this.g/255,this.b/255,this.a]}get ARGB(){return[this.a,this.r/255,this.g/255,this.b/255]}hslCached;get _hsl(){if(this.hslCached==null)this.hslCached=new Ef(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:E,s:M,l:f}=this._hsl;return`hsl(${E.toFixed(0)}deg ${(M*100).toFixed(0)}% ${(f*100).toFixed(0)}%)`}get hsla(){let{h:E,s:M,l:f}=this._hsl;return`hsl(${E.toFixed(0)}deg ${(M*100).toFixed(0)}% ${(f*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let E=this.brightness*255;return new G(E,E,E)}get brightness(){return FL(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+JE(this.r)+JE(this.g)+JE(this.b):"#"+JE(this.r)+JE(this.g)+JE(this.b)+JE(Math.floor(255*this.a))}brighten(E){let{h:M,s:f,l:L}=this._hsl,H=c(0,L+E*(1-L),1);return G.fromHsl(M,f,H,this.a)}darken(E){let{h:M,s:f,l:L}=this._hsl,H=c(0,L*(1-E),1);return G.fromHsl(M,f,H,this.a)}saturate(E){let{h:M,s:f,l:L}=this._hsl,H=c(0,f+E*(1-f),1);return G.fromHsl(M,H,L,this.a)}desaturate(E){let{h:M,s:f,l:L}=this._hsl,H=c(0,f*(1-E),1);return G.fromHsl(M,H,L,this.a)}rotate(E){let{h:M,s:f,l:L}=this._hsl,H=(M+360+E)%360;return G.fromHsl(H,f,L,this.a)}opacity(E){let{h:M,s:f,l:L}=this._hsl;return G.fromHsl(M,f,L,E)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(E,M){return new G(d(this.r,E.r,M),d(this.g,E.g,M),d(this.b,E.b,M),d(this.a,E.a,M))}static blendHue(E,M,f){let L=(M-E+720)%360;if(L<180)return E+f*L;else return E-(360-L)*f}mix(E,M){let f=this._hsl,L=E._hsl;return G.fromHsl(f.s===0?L.h:L.s===0?f.h:G.blendHue(f.h,L.h,M),d(f.s,L.s,M),d(f.l,L.l,M),d(this.a,E.a,M))}colorMix(E,M){return G.fromCss(`color-mix(in hsl, ${this.html}, ${E.html} ${(M*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(E,M,f,L){if(!G.computedColors.has(E))G.computedColors.set(E,{varName:M,scale:f,method:L}),G.queueRecompute()}static queueRecompute(){if(G.recomputeQueued)return;G.recomputeQueued=!0,queueMicrotask(()=>{G.recomputeQueued=!1,G.recomputeColors()})}static recomputeColors(){if(G.computedColors.size===0)return;let E=[];for(let[f,{varName:L,scale:H,method:$}]of G.computedColors)try{let J=G.fromVar(L),Q;switch($){case"b":Q=H>0?J.brighten(H):J.darken(-H);break;case"s":Q=H>0?J.saturate(H):J.desaturate(-H);break;case"h":Q=J.rotate(H*100);break;case"o":Q=J.opacity(H);break;default:continue}E.push(` ${f}: ${Q.rgba};`)}catch(J){}if(E.length===0)return;let M=`:root {
|
|
2
2
|
${E.join(`
|
|
3
3
|
`)}
|
|
4
|
-
}`;if(G.computedColorStylesheet===null)G.computedColorStylesheet=document.createElement("style"),G.computedColorStylesheet.id="tosijs-computed-colors",document.head.append(G.computedColorStylesheet);G.computedColorStylesheet.textContent=M}}var
|
|
4
|
+
}`;if(G.computedColorStylesheet===null)G.computedColorStylesheet=document.createElement("style"),G.computedColorStylesheet.id="tosijs-computed-colors",document.head.append(G.computedColorStylesheet);G.computedColorStylesheet.textContent=M}}var _E=new Set,Mf=!1;function XL(){if(!Mf)Mf=!0,_E.add(()=>G.queueRecompute())}function ff(E){return _E.add(E),()=>_E.delete(E)}function zL(){XL();for(let E of _E)E()}function Lf(E,M){let f=q(M),L=I.style(t(f));L.id=E,document.head.append(L);let H=A(M);if(H!==void 0)XE(H,()=>{L.textContent=t(q(M)),zL()})}var WL=/^(animation-iteration-count|column-count|flex(-grow|-shrink)?|font-weight|line-height|opacity|order|orphans|scale|tab-size|widows|z-index|zoom)$/,GM=(E,M)=>{if(typeof M==="number"&&!WL.test(E))M=`${M}px`;if(E.startsWith("_"))if(E.startsWith("__"))E="--"+E.substring(2),M=`var(${E}-default, ${M})`;else E="--"+E.substring(1);return{prop:E,value:String(M)}},UL=(E,M,f)=>{if(f===void 0)return"";if(f instanceof G)f=f.html;let L=GM(M,f);return`${E} ${L.prop}: ${L.value};`},Hf=(E,M,f="")=>{let L=S(E);if(typeof M==="object"&&!(M instanceof G)){let H=Object.keys(M).map(($)=>Hf($,M[$],`${f} `)).join(`
|
|
5
5
|
`);return`${f} ${E} {
|
|
6
6
|
${H}
|
|
7
|
-
${f} }`}else return
|
|
7
|
+
${f} }`}else return UL(f,L,M)},t=(E,M="")=>{return Object.keys(E).map((L)=>{let H=E[L];if(typeof H==="string"){if(L==="@import")return`@import url('${H}');`;throw Error("top-level string value only allowed for `@import`")}let $=Object.keys(H).map((J)=>Hf(J,H[J])).join(`
|
|
8
8
|
`);return`${M}${L} {
|
|
9
9
|
${$}
|
|
10
10
|
}`}).join(`
|
|
11
11
|
|
|
12
|
-
`)},Jf=(E)=>{I("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let M={};for(let f of Object.keys(E)){let L=E[f],H=S(f);M[`--${H}`]=typeof L==="number"&&L!==0?String(L)+"px":L}return M},$f=(E)=>{let M={};for(let f of Object.keys(E)){let L=E[f];if(L instanceof G)M[f]=L.inverseLuminance;else if(typeof L==="string"&&L.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))M[f]=G.fromCss(L).inverseLuminance}return M},UE=new Proxy({},{get(E,M){if(E[M]===void 0){let f="--"+S(M);E[M]=(L)=>`var(${f}, ${L})`}return E[M]}}),_E=new Proxy({},{get(E,M){if(M==="default")return UE;if(E[M]==null){M=S(M);let[,f,,L,H,$]=M.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",M],J=`--${f}`;if(H!=null){let Q=L==null?Number(H)/100:-Number(H)/100;switch($){case"b":case"s":case"h":case"o":{let Z=`--${M}`;G.registerComputedColor(Z,J,Q,$),E[M]=`var(${Z})`}break;case"":E[M]=`calc(var(${J}) * ${Q})`;break;default:throw console.error($),Error(`Unrecognized method ${$} for css variable ${J}`)}}else E[M]=`var(${J})`}return E[M]}});function GM(){let E=(M)=>typeof matchMedia<"u"&&matchMedia(M).matches;return{colorScheme:E("(prefers-color-scheme: dark)")?"dark":"light",contrast:E("(prefers-contrast: more)")?"more":E("(prefers-contrast: less)")?"less":E("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:E("(prefers-reduced-motion: reduce)"),reducedTransparency:E("(prefers-reduced-transparency: reduce)"),forcedColors:E("(forced-colors: active)")}}function Zf(E){if(typeof matchMedia>"u")return()=>{};let M=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],f=()=>E(GM()),L=M.map((H)=>matchMedia(H));for(let H of L)H.addEventListener("change",f);return()=>{for(let H of L)H.removeEventListener("change",f)}}var Qf="http://www.w3.org/1998/Math/MathML",Yf="http://www.w3.org/2000/svg";var SE={},Ff=(E,M,f)=>{let L=YM(S(M),f);if(L.prop.startsWith("--"))E.style.setProperty(L.prop,L.value);else E.style[M]=L.value},UL=(E)=>{return{toDOM(M,f){Ff(M,E,f)}}},Xf=(E,M,f)=>{if(M==="style")if(typeof f==="object")for(let L of Object.keys(f))if(O(f[L]))m(E,f[L],UL(L));else Ff(E,L,f[L]);else E.setAttribute("style",f);else{let L=S(M),H=E.constructor.observedAttributes;if(H?.includes(M)||H?.includes(L))if(typeof f==="boolean")f?E.setAttribute(L,""):E.removeAttribute(L);else E.setAttribute(L,f);else if(E[M]!==void 0){let{MathMLElement:J}=globalThis;if(E instanceof SVGElement||J!==void 0&&E instanceof J)E.setAttribute(M,f);else E[M]=f}else if(L==="class")f.split(" ").forEach((J)=>{E.classList.add(J)});else if(E[L]!==void 0)E[L]=f;else if(typeof f==="boolean")f?E.setAttribute(L,""):E.removeAttribute(L);else E.setAttribute(L,f)}},FM={},DL=(E)=>{if(!FM[E])FM[E]={toDOM(M,f){Xf(M,E,f)}};return FM[E]},xE=(E,M,f)=>{if(M==="apply")f(E);else if(M.match(/^on[A-Z]/)!=null){let L=M.substring(2).toLowerCase();LE(E,L,f)}else if(M==="bind")if((typeof f.binding==="string"?WE[f.binding]:f.binding)!==void 0&&f.value!==void 0)m(E,f.value,f.binding instanceof Function?{toDOM:f.binding}:f.binding);else throw Error("bad binding");else if(M.match(/^bind[A-Z]/)!=null){let L=M.substring(4,5).toLowerCase()+M.substring(5),H=WE[L];if(H!==void 0)m(E,f,H);else throw Error(`${M} is not allowed, bindings.${L} is not defined`)}else if(O(f))m(E,f,DL(M));else Xf(E,M,f)},XM=(E,...M)=>{if(SE[E]===void 0){let[H,$]=E.split("|");if($===void 0)SE[E]=globalThis.document.createElement(H);else SE[E]=globalThis.document.createElementNS($,H)}let f=SE[E].cloneNode(),L={};for(let H of M)if(H instanceof Element||H instanceof DocumentFragment||typeof H==="string"||typeof H==="number")if(f instanceof HTMLTemplateElement)f.content.append(H);else f.append(H);else if(O(H))f.append(T.span({bindText:H}));else Object.assign(L,H);for(let H of Object.keys(L)){let $=L[H];xE(f,H,$)}return f},zM=(...E)=>{let M=globalThis.document.createDocumentFragment();for(let f of E)M.append(f);return M},T=new Proxy({fragment:zM},{get(E,M){if(M=M.replace(/[A-Z]/g,(f)=>`-${f.toLocaleLowerCase()}`),E[M]===void 0)E[M]=(...f)=>XM(M,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),NE=new Proxy({fragment:zM},{get(E,M){if(E[M]===void 0)E[M]=(...f)=>XM(`${M}|${Yf}`,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),yE=new Proxy({fragment:zM},{get(E,M){if(E[M]===void 0)E[M]=(...f)=>XM(`${M}|${Qf}`,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),Gf=new WeakSet;function zf(E,M,f="part"){let L=`[data-${f}]`;for(let H of Array.from(E.querySelectorAll(L))){if(Gf.has(H))continue;let $=H.getAttribute(`data-${f}`);if($==null)continue;let J=M[$];if(J==null)continue;Gf.add(H);for(let Q of Object.keys(J))xE(H,Q,J[Q])}}var KL=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],qL=!0,OL=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,wL=(E)=>OL.test(E),r=(E="",M="")=>{if(E==="")return M;else if(M.match(/^\d+$/)!==null||M.includes("="))return`${E}[${M}]`;else return`${E}.${M}`},PE={};function WM(E,M){if(E!==null&&(typeof E==="object"||typeof E==="function"))return E;return new Proxy(PE,o(M,!0))}var qf=()=>new Proxy({},o("^",!0)),UM=(E)=>{let f=E(qf())?.path;if(!f?.startsWith("^."))throw Error("selector must return a property of the item");return f.substring(2)},DM=(E,M,f)=>{for(let L=0;L<E.length;L++)if(`${w(E[L],M)}`===`${f}`)return L;return-1},AL=(E,M)=>({listFind(f,L){if(f instanceof Element){let J=f;while(J&&!J[a]&&J.parentElement)J=J.parentElement;let Q=J?.[a];if(Q==null)return;let Z=M.indexOf(Q);return Z!==-1?B[E][Z]:void 0}let H=UM(f),$=DM(M,H,L);return $!==-1?B[E][$]:void 0},listUpdate(f,L){let H=UM(f),$=w(L,H),J=DM(M,H,$);if(J!==-1){let Q=B[E][J];for(let Z of Object.keys(L))Q[Z]=L[Z];return Q}return B[E].push(L),B[E][M.length-1]},listRemove(f,L){let H=UM(f),$=DM(M,H,L);if($===-1)return!1;return B[E].splice($,1),!0}}),Wf=!1;function CL(){if(!Wf)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use .tosi.value, .tosi.path, .tosi.observe(), etc. instead."),Wf=!0}var Uf=(E)=>{return E===PE},jL=(E,M)=>({get(f,L){switch(L){case"value":return M===PE?w(j,E):M.valueOf?M.valueOf():M;case"path":return E;case"touch":return()=>k(E);case"observe":return(H)=>{let $=v(E,H);return()=>i($)};case"bind":return(H,$,J)=>{iM()(H,E,$,J)};case"on":{let H=M===PE?w(j,E):M.valueOf?M.valueOf():M;return($,J)=>sM()($,J,H)}case"binding":return(H)=>({bind:{value:E,binding:H}});case"listBinding":return(H=({span:J})=>J({bindText:"^"}),$={})=>[{bindList:{value:E,...$}},T.template(H(T,qf()))];case"listFind":case"listUpdate":case"listRemove":return AL(E,Array.isArray(M)?M:[])[L];case"take":return(...H)=>{let $=H[H.length-1],Q=H.slice(0,-1).map((Z)=>typeof Z==="string"?Z:Z[x]);return{[JE]:!0,paths:[E,...Q],transform:$}}}return},set(f,L,H){if(L==="value"){if(H=K(H),K(V[E])!==H&&h(j,E,H))k(E);return!0}return!1}}),DE=(E,M)=>new Proxy(M,jL(E,M)),Df=new Set(["path","value","touch","observe","bind","on","binding","listBinding","listFind","listUpdate","listRemove","take"]),Kf=new Map([[x,"path"],["xinPath","path"],["tosiPath","path"],[d,"value"],["xinValue","value"],["tosiValue","value"],[kM,"observe"],["xinObserve","observe"],["tosiObserve","observe"],[_M,"on"],["xinOn","on"],["tosiOn","on"],[BM,"bind"],["xinBind","bind"],["tosiBind","bind"],["tosiBinding","binding"],["tosiListBinding","listBinding"]]),o=(E,M)=>({get(f,L){if((L==="tosi"||L===FE)&&M)return DE(E,f);if(Uf(f)){let Z=()=>w(j,E);switch(L){case"valueOf":case"toJSON":return()=>Z();case Symbol.toPrimitive:return(F)=>{let z=Z();if(F==="number")return Number(z);if(F==="string")return String(z);return z};case"toString":return()=>String(Z())}if(Df.has(L))return DE(E,f)[L];let Y=Kf.get(L);if(Y!==void 0)return CL(),DE(E,f)[Y];let X=Z();if(X!=null){let F=Object(X);if(L in F){let z=F[L];return typeof z==="function"?z.bind(F):z}}return}if(M&&(L==="valueOf"||L==="toJSON"))return()=>f.valueOf?f.valueOf():f;if(M&&!(L in f)&&Df.has(L))return DE(E,f)[L];let H=Kf.get(L);if(H!==void 0)return DE(E,f)[H];if(typeof L==="symbol")return f[L];let $=Object.getOwnPropertyDescriptor(f,L);if($&&!$.configurable&&!$.writable&&"value"in $)return $.value;let J=L,Q=J.match(/^([^.[]+)\.(.+)$/)??J.match(/^([^\]]+)(\[.+)/)??J.match(/^(\[[^\]]+\])\.(.+)$/)??J.match(/^(\[[^\]]+\])\[(.+)$/);if(Q!==null){let[,Z,Y]=Q,X=r(E,Z),F=K(w(f,Z));return F!==null&&typeof F==="object"?new Proxy(F,o(X,M))[Y]:F}if(J.startsWith("[")&&J.endsWith("]"))J=J.substring(1,J.length-1);if(!Array.isArray(f)&&f[J]!==void 0||Array.isArray(f)&&J.includes("=")){let Z;if(J.includes("=")){let[Y,X]=J.split("=");Z=f.find((F)=>`${w(F,Y)}`===X)}else Z=f[J];if(Z instanceof Object){Z=K(Z);let Y=r(E,J);return new Proxy(Z instanceof Function?Z.bind(f):Z,o(Y,M))}else return M?WM(Z,r(E,J)):Z}else if(Array.isArray(f)){let Z=f[J];return typeof Z==="function"?(...Y)=>{let X=Y.map((z)=>K(z)),F=Z.apply(f,X);if(KL.includes(J))k(E);if(F!=null&&typeof F==="object"){if(J==="find"||J==="findLast"||J==="at"){let z=f.indexOf(F);if(z!==-1)return new Proxy(F,o(r(E,String(z)),M))}}return F}:typeof Z==="object"?new Proxy(K(Z),o(r(E,J),M)):M?WM(Z,r(E,J)):Z}else{let Z=f[J];if(Z!==null&&typeof Z==="object")Z=K(Z);return M?WM(Z,r(E,J)):Z}},set(f,L,H){if(H=K(H),H!==null&&typeof H==="object")if(Array.isArray(H))for(let Z=0;Z<H.length;Z++)H[Z]=K(H[Z]);else for(let Z of Object.keys(H))H[Z]=K(H[Z]);let J=L===d||L==="xinValue"||L==="tosiValue"||L==="value"&&(Uf(f)||M)?E:r(E,L);if(qL&&!wL(J))throw Error(`setting invalid path ${J}`);if(K(V[J])!==H&&h(j,J,H))k(J);return!0}}),GE=(E,M)=>{let f=typeof M==="function"?M:V[M];if(typeof f!=="function")throw Error(`observe expects a function or path to a function, ${M} is neither`);return v(E,f)},V=new Proxy(j,o("",!1));nM(V);var B=new Proxy(j,o("",!0));var VL=16,RL=100;function Of(E,M){let f=Array.from(E.querySelectorAll(g));if(E.matches(g))f.unshift(E);for(let L of f){let H=y.get(L);for(let $ of H){if($.path.startsWith("^"))$.path=`${M}${$.path.substring(1)}`;if($.binding.toDOM!=null)$.binding.toDOM(L,V[$.path])}}}class wf{boundElement;listTop;listBottom;isNamespaced;template;options;itemToElement;array=[];_filteredCache;_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(E,M,f={}){if(this.boundElement=E,this.itemToElement=new WeakMap,f.idPath!=null){let H=O(M);if(H!=null)SM(H,f.idPath)}if(E.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(E.children[0]instanceof HTMLTemplateElement){let H=E.children[0];if(H.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=e(H.content.children[0])}else this.template=E.children[0],this.template.remove();this.options=f;let L=E.namespaceURI;if(this.isNamespaced=L==="http://www.w3.org/2000/svg"||L==="http://www.w3.org/1998/Math/MathML",this.isNamespaced)this.listTop=null,this.listBottom=null;else this.listTop=document.createElement("div"),this.listBottom=document.createElement("div"),this.listTop.classList.add("virtual-list-padding"),this.listBottom.classList.add("virtual-list-padding"),this.boundElement.append(this.listTop),this.boundElement.append(this.listBottom);if(this.boundElement[$E]=this,this.isNamespaced&&f.virtual!=null)console.warn("ListBinding: virtual scrolling is not supported in SVG/MathML containers, ignoring virtual option");if(!this.isNamespaced&&f.virtual!=null)if(zE.observe(this.boundElement),this._update=ME(()=>{this.update(this.array,!0)},VL),this.boundElement.addEventListener("resize",this._update),f.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}filteredArray(){if(this._filteredCache!=null)return this._filteredCache;let{hiddenProp:E,visibleProp:M}=this.options,f=this.array;if(E!==void 0)f=f.filter((L)=>L[E]!==!0);if(M!==void 0)f=f.filter((L)=>L[M]===!0);if(this.options.filter&&this.needle!==void 0)f=this.options.filter(f,this.needle);return this._filteredCache=f,f}visibleSlice(){let{virtual:E}=this.options,M=this.filteredArray(),f=0,L=M.length-1,H=0,$=0;if(E!=null&&this.boundElement instanceof HTMLElement){let J=this.boundElement.offsetWidth,Q=E.scrollContainer==="window",Z,Y;if(Q){Z=window.innerHeight;let z=this.boundElement.getBoundingClientRect();Y=Math.max(0,-z.top)}else Z=this.boundElement.offsetHeight,Y=this.boundElement.scrollTop;let X=E.width!=null?Math.max(1,Math.floor(J/E.width)):E.visibleColumns??1,F=Math.ceil(M.length/X);if(E.minHeight!=null){let z=E.minHeight,R=Math.ceil(Z/z)+(E.rowChunkSize||1),W=X*R,q=F*z,U=Math.max(0,q-Z),_=U>0?Math.min(1,Math.max(0,Y/U)):0,D=Math.max(0,F-R+1),A=_*D,C=Math.floor(A);if(E.rowChunkSize)C-=C%E.rowChunkSize;return f=C*X,L=f+W-1,H=Y,$=Math.max(0,q-Y-Z),{items:M,firstItem:f,lastItem:L,topBuffer:H,bottomBuffer:$,interpolation:{t:_,position:A,scrollTop:Y,viewportHeight:Z,totalScrollHeight:q,rowHeight:E.height}}}else{let z=Math.ceil(Z/E.height)+(E.rowChunkSize||1),R=X*z,W=Math.floor(Y/E.height);if(W>F-z+1)W=Math.max(0,F-z+1);if(E.rowChunkSize)W-=W%E.rowChunkSize;f=W*X,L=f+R-1,H=W*E.height,$=Math.max((F-z)*E.height-H,0)}}return{items:M,firstItem:f,lastItem:L,topBuffer:H,bottomBuffer:$}}needle;filter=ME((E)=>{if(this.needle!==E)this.needle=E,this.update(this.array)},RL);update(E,M){if(E==null)E=[];if(this.array=E,!M)this._filteredCache=void 0;let{hiddenProp:f,visibleProp:L}=this.options,H=O(E),$=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",$.items.length===0);let J=this._previousSlice,{firstItem:Q,lastItem:Z,topBuffer:Y,bottomBuffer:X}=$,F=f===void 0&&L===void 0&&M===!0&&J!=null&&Q===J.firstItem&&Z===J.lastItem;if(F&&$.interpolation==null&&Y===J.topBuffer&&X===J.bottomBuffer)return;if(F&&$.interpolation!=null){this._updateInterpolatedBuffers($);return}this._previousSlice=$;let z=0,R=0,W=0;for(let D of Array.from(this.boundElement.children)){if(D===this.listTop||D===this.listBottom)continue;let A=D[a];if(A==null)D.remove();else{let C=$.items.indexOf(A);if(C<Q||C>Z)D.remove(),this.itemToElement.delete(A),z++}}if(this.listTop!=null&&this.listBottom!=null)this.listTop.style.height=String(Y)+"px",this.listBottom.style.height=String(X)+"px";let q=[],{idPath:U}=this.options;for(let D=Q;D<=Z;D++){let A=$.items[D];if(A===void 0)continue;let C=this.itemToElement.get(K(A));if(C==null){if(W++,C=e(this.template),typeof A==="object")this.itemToElement.set(K(A),C),C[a]=K(A);if(this.listBottom!=null)this.boundElement.insertBefore(C,this.listBottom);else this.boundElement.append(C);if(U!=null){let l=A[U],VE=`${H}[${U}=${l}]`;Of(C,VE)}else{let l=`${H}[${D}]`;Of(C,l)}}q.push(C)}let _=null;for(let D of q){if(D.previousElementSibling!==_)if(R++,_?.nextElementSibling!=null)this.boundElement.insertBefore(D,_.nextElementSibling);else if(this.listBottom!=null)this.boundElement.insertBefore(D,this.listBottom);else this.boundElement.append(D);_=D}if($.interpolation!=null)this._updateInterpolatedBuffers($);if(n.perf)console.log(H,"updated",{removed:z,created:W,moved:R})}_updateInterpolatedBuffers(E){let{t:M,position:f,scrollTop:L,viewportHeight:H,totalScrollHeight:$,rowHeight:J}=E.interpolation,Q=0;for(let F of Array.from(this.boundElement.children)){if(F===this.listTop||F===this.listBottom)continue;Q+=F.offsetHeight||J}let Z=L,Y=L+H-Q,X=Math.max(0,M*Y+(1-M)*Z-f%1*J);if(this.listTop!=null&&this.listBottom!=null)this.listTop.style.height=String(X)+"px",this.listBottom.style.height=String(Math.max(0,$-X-Q))+"px"}}var YE=(E,M,f)=>{let L=E[$E];if(M&&L===void 0)L=new wf(E,M,f),E[$E]=L;return L},mE=(E)=>{let M;while(!(M=E[a])&&E&&E.parentElement)E=E.parentElement;return M?{element:E,item:M}:void 0},bE=(E)=>{let M=mE(E);return M?M.item:void 0},Af=(E)=>{let M=mE(E);if(!M)return console.error("deleteListItem failed, element is not part of a list instance",E),!1;let f=YE(M.element.parentElement);if(!f.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",E.parentElement,f),!1;let L=f.array.indexOf(M.item);if(L>-1)return f.array.splice(L,1),!0;return!1},TL={start:"start",middle:"center",end:"end",nearest:"nearest"},Cf=(E,M,f={})=>{let L=YE(E);if(L==null)return console.error("scrollListItemIntoView failed, element has no list binding",E),!1;let{position:H="middle"}=f,$=L.filteredArray(),J=K(M)??M,Q=$.indexOf(J);if(Q===-1)return console.error("scrollListItemIntoView failed, item not found in list",M),!1;let{virtual:Z}=L.options;if(Z!=null&&E instanceof HTMLElement){let Y=Z.width!=null?Math.max(1,Math.floor(E.offsetWidth/Z.width)):Z.visibleColumns??1,X=Math.floor(Q/Y),F=Z.minHeight??Z.height,z=Math.ceil($.length/Y),R=Z.scrollContainer==="window",W=R?window.innerHeight:E.offsetHeight,q;if(Z.minHeight!=null){let U=Math.ceil(W/F)+(Z.rowChunkSize||1),_=z*F,D=Math.max(0,_-W),A=Math.max(1,z-U+1),C=X/A;switch(H){case"start":q=C*D;break;case"end":q=Math.max(0,(X-U+1)/A*D);break;case"nearest":{let l=R?Math.max(0,-E.getBoundingClientRect().top):E.scrollTop,VE=D>0?l/D:0,RM=Math.floor(VE*A);if(X<RM)q=C*D;else if(X>=RM+U)q=Math.max(0,(X-U+1)/A*D);else return!0;break}default:{let l=X-Math.floor(U/2);q=Math.max(0,l)/A*D}}}else{let U=X*Z.height;switch(H){case"start":q=U;break;case"end":q=U-W+Z.height;break;case"nearest":{let _=R?Math.max(0,-E.getBoundingClientRect().top):E.scrollTop;if(U<_)q=U;else if(U+Z.height>_+W)q=U-W+Z.height;else return!0;break}default:q=U-(W-Z.height)/2}}if(q=Math.max(0,q),R){let U=E.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:U+q,behavior:"smooth"})}else E.scrollTo({top:q,behavior:"smooth"})}else{let Y=L.itemToElement.get(J);if(Y==null)return console.error("scrollListItemIntoView failed, no DOM element found for item",M),!1;Y.scrollIntoView({block:TL[H]??"center",behavior:"smooth"})}return!0};var{document:KE,MutationObserver:jf}=globalThis,cE=(E,M)=>{let f=y.get(E);if(f==null)return;for(let L of f){let{binding:H,options:$}=L,{path:J}=L,{toDOM:Q}=H;if(Q!=null){if(J.startsWith("^")){let Z=bE(E);if(Z!=null&&Z[x]!=null)J=L.path=`${Z[x]}${J.substring(1)}`;else{if(E instanceof HTMLElement)console.warn(`Unresolved relative binding "${J}" —`,E,"is not part of a list. If this is a list template, wrap it in a <template>.");continue}}if(M==null||J.startsWith(M))Q(E,XE()[J],$)}}};if(jf!=null)new jf((M)=>{M.forEach((f)=>{Array.from(f.addedNodes).forEach((L)=>{if(L instanceof Element)Array.from(L.querySelectorAll(g)).forEach((H)=>cE(H))})})}).observe(KE.body,{subtree:!0,childList:!0});v(()=>!0,(E)=>{let M=Array.from(KE.querySelectorAll(g));for(let f of M)cE(f,E)});var Vf=(E)=>{let M=E.target?.closest(g);while(M!=null){let f=y.get(M);for(let L of f){let{binding:H,path:$}=L,{fromDOM:J}=H;if(J!=null){let Q;try{Q=J(M,L.options)}catch(Z){throw console.error("Cannot get value from",M,"via",L),Error("Cannot obtain value fromDOM")}if(Q!=null){let Z=XE(),Y=Z[$];if(Y==null)Z[$]=Q;else{let X=Y[x]!=null?Y[d]:Y,F=Q[x]!=null?Q[d]:Q;if(X!==F)Z[$]=F}}}}M=M.parentElement.closest(g)}};if(globalThis.document!=null)KE.body.addEventListener("change",Vf,!0),KE.body.addEventListener("input",Vf,!0);function IL(E,M,f,L){let{paths:H,transform:$}=M,{toDOM:J}=f;if(J==null)return E;let Q=null,Z={toDOM(X,F,z){let R=XE(),W=H.map((U)=>R[U]);if(Q!==null&&W.every((U,_)=>U===Q[_]))return;Q=W;let q=$(...W);J(X,q,z)},fromDOM:f.fromDOM};E.classList?.add(RE);let Y=y.get(E);if(Y==null)Y=[],y.set(E,Y);for(let X of H)Y.push({path:X,binding:Z,options:L});if(!H[0].startsWith("^"))k(H[0]);return E}function m(E,M,f,L){if(E instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");if(M!=null&&typeof M==="object"&&M[JE])return IL(E,M,f,L);let H;if(typeof M==="object"&&M[x]===void 0&&L===void 0){let{value:Q}=M;H=typeof Q==="string"?Q:Q[x],L=M,delete L.value}else H=typeof M==="string"?M:M[x];if(H==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:$}=f;E.classList?.add(RE);let J=y.get(E);if(J==null)J=[],y.set(E,J);if(J.push({path:H,binding:f,options:L}),$!=null&&!H.startsWith("^"))k(H);if(L?.filter&&L?.needle)m(E,L.needle,{toDOM(Q,Z){console.log({needle:Z}),Q[$E]?.filter(Z)}});return E}var Rf=new Set,kL=(E)=>{let M=E?.target?.closest(oE),f=!1,L=new Proxy(E,{get($,J){if(J==="stopPropagation")return()=>{E.stopPropagation(),f=!0};else{let Q=$[J];return typeof Q==="function"?Q.bind($):Q}}}),H=new Set;while(!f&&M!=null){let J=t.get(M)[E.type]||H;for(let Q of J){if(typeof Q==="function")Q(L);else{let Z=XE()[Q];if(typeof Z==="function")Z(L);else throw Error(`no event handler found at path ${Q}`)}if(f)continue}M=M.parentElement!=null?M.parentElement.closest(oE):null}};function LE(E,M,f){let L=t.get(E);if(E.classList.add(rE),L==null)L={},t.set(E,L);if(!L[M])L[M]=new Set;if(L[M].add(f),!Rf.has(M))Rf.add(M),KE.body.addEventListener(M,kL,!0);return()=>{L[M].delete(f)}}hM(m,LE);function vE(E,M){if(!E.internals)return;let f={},L="";if(E.hasAttribute("required")&&M==="")f.valueMissing=!0,L="Please fill out this field.";let H=E.getAttribute("minlength");if(H&&M.length<parseInt(H,10))f.tooShort=!0,L=`Please use at least ${H} characters.`;let $=E.getAttribute("maxlength");if($&&M.length>parseInt($,10))f.tooLong=!0,L=`Please use no more than ${$} characters.`;let J=E.getAttribute("pattern");if(J&&M!=="")try{if(!new RegExp(`^(?:${J})$`).test(M))f.patternMismatch=!0,L="Please match the requested format."}catch{}if(Object.keys(f).length>0)E.internals.setValidity(f,L,E);else E.internals.setValidity({})}var BL=0;function KM(){return`custom-elt${(BL++).toString(36)}`}var Tf=0,qM=null;function _L(){if(qM===null)qM=new MutationObserver((E)=>{let M=new Set;for(let f of E)if(f.type==="attributes"&&f.target instanceof N){let L=f.target,H=QM(f.attributeName);if(L._legacyTrackedAttrs?.has(H))M.add(L)}for(let f of M)f.queueRender(!1)});return qM}var qE={};function SL(E,M){let f=qE[E],L=p(M).replace(/:host\(([^)]+)\)/g,`${E}$1`).replace(/:host\b/g,E);qE[E]=f?f+`
|
|
13
|
-
`+L:L}function xL(E){if(qE[E])document.head.append(T.style({id:E+"-component"},qE[E]));delete qE[E]}class N extends HTMLElement{static elements=T;static _elementCreator;static initAttributes;static formAssociated;static preferredTagName;static shadowStyleSpec;static lightStyleSpec;static extends;internals;get validity(){return this.internals?.validity}get validationMessage(){return this.internals?.validationMessage??""}get willValidate(){return this.internals?.willValidate??!1}checkValidity(){return this.internals?.checkValidity()??!0}reportValidity(){return this.internals?.reportValidity()??!0}setCustomValidity(E){if(this.internals)if(E)this.internals.setValidity({customError:!0},E);else this.internals.setValidity({})}setValidity(E,M,f){this.internals?.setValidity(E,M,f)}setFormValue(E,M){this.internals?.setFormValue(E,M)}static get observedAttributes(){let E=this.initAttributes;if(E)return["hidden",...Object.keys(E).map(S)];return["hidden"]}instanceId;styleNode;static styleSpec;static styleNode;content=T.slot();isSlotted;static _tagName=null;static get tagName(){return this._tagName}_legacyTrackedAttrs;_attrValues;_valueChanged=!1;static StyleNode(E){return console.warn("StyleNode is deprecated, use static shadowStyleSpec instead"),T.style(p(E))}static elementCreator(E={}){let M=this;if(!Object.prototype.hasOwnProperty.call(M,"_elementCreator")){if(E.tag!==void 0)I("elementCreator-tag","Passing tag to elementCreator() is deprecated. Use static preferredTagName instead.");if(E.styleSpec!==void 0)I("elementCreator-styleSpec","Passing styleSpec to elementCreator() is deprecated. Use static lightStyleSpec instead.");if(E.extends!==void 0)I("elementCreator-extends","Passing extends to elementCreator() is deprecated. Use static extends instead.");let f=E.tag??M.preferredTagName;if(f==null)if(typeof M.name==="string"&&M.name!==""){if(f=S(M.name),f.startsWith("-"))f=f.slice(1)}else f=KM();if(customElements.get(f)!=null)console.warn(`${f} is already defined`);if(f.match(/\w+(-\w+)+/)==null)console.warn(`${f} is not a legal tag for a custom-element`),f=KM();while(customElements.get(f)!==void 0)f=KM();M._tagName=f;let L=E.styleSpec??M.lightStyleSpec;if(L!==void 0)SL(f,L);let H=E.extends??M.extends,$=H?{extends:H}:void 0;window.customElements.define(f,this,$),M._elementCreator=T[f]}return M._elementCreator}initAttributes(...E){if(I("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let H of E)this._legacyTrackedAttrs.add(H);_L().observe(this,{attributes:!0});let f={},L={};E.forEach((H)=>{f[H]=b(this[H]);let $=S(H);Object.defineProperty(this,H,{enumerable:!1,get(){if(typeof f[H]==="boolean")return this.hasAttribute($);else if(this.hasAttribute($))return typeof f[H]==="number"?parseFloat(this.getAttribute($)):this.getAttribute($);else if(L[H]!==void 0)return L[H];else return f[H]},set(J){if(typeof f[H]==="boolean"){if(J!==this[H]){if(J)this.setAttribute($,"");else this.removeAttribute($);this.queueRender()}}else if(typeof f[H]==="number"){if(J!==parseFloat(this[H]))this.setAttribute($,J),this.queueRender()}else if(typeof J==="object"||`${J}`!==`${this[H]}`){if(J===null||J===void 0||typeof J==="object")this.removeAttribute($);else this.setAttribute($,J);this.queueRender(),L[H]=J}}})})}initValue(){let E=Object.getOwnPropertyDescriptor(this,"value");if(E===void 0||E.get!==void 0||E.set!==void 0)return;let M=this.hasAttribute("value")?this.getAttribute("value"):b(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return M},set(f){if(M!==f)M=f,this._valueChanged=!0,this.queueRender(!0)}})}_parts;get parts(){let E=this.shadowRoot!=null?this.shadowRoot:this;if(this._parts==null)this._parts=new Proxy({},{get(M,f){if(M[f]===void 0){let L=E.querySelector(`[part="${f}"]`);if(L==null)L=E.querySelector(f);if(L==null)throw Error(`elementRef "${f}" does not exist!`);L.removeAttribute("data-ref"),M[f]=L}return M[f]}});return this._parts}attributeChangedCallback(E,M,f){let L=QM(E);if(!this._legacyTrackedAttrs?.has(L))this.queueRender(!1)}constructor(){super();if(Tf+=1,this.constructor.formAssociated&&typeof this.attachInternals==="function"&&!this.internals)this.internals=this.attachInternals();let E=this.constructor.initAttributes;if(E)this._setupAttributeAccessors(E);this.instanceId=`${this.tagName.toLocaleLowerCase()}-${Tf}`,this._value=b(this.defaultValue)}_setupAttributeAccessors(E){if(!this._attrValues)this._attrValues=new Map;for(let M of Object.keys(E)){let f=S(M),L=E[M];if(M==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof L==="object"&&L!==null){console.warn(`${this.tagName}: initAttributes.${M} is an object. Use a regular property instead.`);continue}let H=this,$=!1;while(H){let J=Object.getOwnPropertyDescriptor(H,M);if(J){if(!J.configurable||J.get||J.set){$=!0;break}break}H=Object.getPrototypeOf(H)}if($)continue;Object.defineProperty(this,M,{enumerable:!1,get:()=>{if(typeof L==="boolean")return this.hasAttribute(f);else if(this.hasAttribute(f))return typeof L==="number"?parseFloat(this.getAttribute(f)):this.getAttribute(f);else if(this._attrValues.has(M))return this._attrValues.get(M);else return L},set:(J)=>{if(typeof L==="boolean"){if(J!==this[M]){if(J)this.setAttribute(f,"");else this.removeAttribute(f);this.queueRender()}}else if(typeof L==="number"){if(J!==parseFloat(this[M]))this.setAttribute(f,J),this.queueRender()}else if(typeof J==="object"||`${J}`!==`${this[M]}`){if(J===null||J===void 0||typeof J==="object")this.removeAttribute(f);else this.setAttribute(f,J);this.queueRender(),this._attrValues.set(M,J)}}})}}connectedCallback(){if(xL(this.constructor.tagName),this.hydrate(),this.role!=null)this.setAttribute("role",this.role);if(this.constructor.formAssociated&&!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(this.onResize!==void 0){if(zE.observe(this),this._onResize==null)this._onResize=this.onResize.bind(this);this.addEventListener("resize",this._onResize)}if(this.value!=null&&this.getAttribute("value")!=null)this._value=this.getAttribute("value");if(this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this.queueRender()}disconnectedCallback(){zE.unobserve(this)}formResetCallback(){if(this.value!==void 0)this.value=this.defaultValue??""}formDisabledCallback(E){if(E)this.setAttribute("disabled","");else this.removeAttribute("disabled")}formStateRestoreCallback(E){if(this.value!==void 0&&typeof E==="string")this.value=E}_changeQueued=!1;_renderQueued=!1;queueRender(E=!1){if(!this._hydrated)return;if(!this._changeQueued)this._changeQueued=E;if(!this._renderQueued)this._renderQueued=!0,requestAnimationFrame(()=>{if(this._changeQueued){if($M(this,"change"),this.internals&&this.value!==void 0)this.internals.setFormValue(this.value)}this._changeQueued=!1,this._renderQueued=!1,this.render()})}_hydrated=!1;hydrate(){if(!this._hydrated){this.initValue();let E=typeof this.content!=="function",M=typeof this.content==="function"?this.content(T):this.content;if(Array.isArray(M)){let $={};M=M.filter((J)=>{if(J instanceof Node||typeof J==="string"||typeof J==="number"||O(J))return!0;return Object.assign($,J),!1});for(let J of Object.keys($))xE(this,J,$[J])}let f=this.constructor,L=f.shadowStyleSpec??f.styleSpec;if(f.styleSpec&&!f.shadowStyleSpec)I("static-styleSpec","static styleSpec is deprecated. Use static shadowStyleSpec instead.");let{styleNode:H}=f;if(L)H=f.styleNode=T.style(p(L)),delete f.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecated, use static shadowStyleSpec instead"),H=this.styleNode;if(H){let $=this.attachShadow({mode:"open"});$.appendChild(H.cloneNode(!0)),ZM($,M,E)}else if(M!==null){let $=Array.from(this.childNodes);ZM(this,M,E),this.isSlotted=this.querySelector("slot,tosi-slot,xin-slot")!==void 0;let J=Array.from(this.querySelectorAll("slot"));if(J.length>0)J.forEach(uE.replaceSlot);if($.length>0){let Q={"":this};Array.from(this.querySelectorAll("tosi-slot,xin-slot")).forEach((Z)=>{Q[Z.name]=Z}),$.forEach((Z)=>{let Y=Q[""],X=Z instanceof Element?Q[Z.slot]:Y;(X!==void 0?X:Y).append(Z)})}}this._hydrated=!0}}render(){if(this._valueChanged&&this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this._valueChanged=!1}validateValue(){if(!this.internals||this.value===void 0)return;let E=typeof this.value==="string"?this.value:String(this.value);vE(this,E)}}class uE extends N{static preferredTagName="tosi-slot";static initAttributes={name:""};content=null;static replaceSlot(E){let M=document.createElement("tosi-slot");if(E.name!=="")M.setAttribute("name",E.name);E.replaceWith(M)}}var If=uE.elementCreator();class kf extends N{static preferredTagName="xin-slot";static initAttributes={name:""};content=null;constructor(){super();I("xin-slot","<xin-slot> is deprecated. Use <tosi-slot> instead.")}static replaceSlot=uE.replaceSlot}var Bf=kf.elementCreator();var _f=(E=()=>!0)=>{let M=localStorage.getItem("xin-state");if(M!=null){let L=JSON.parse(M);for(let H of Object.keys(L).filter(E))if(V[H]!==void 0)Object.assign(V[H],L[H]);else V[H]=L[H]}let f=QE(()=>{let L={},H=K(V);for(let $ of Object.keys(H).filter(E))L[$]=H[$];localStorage.setItem("xin-state",JSON.stringify(L)),console.log("xin state saved to localStorage")},500);GE(E,f)};var NL="tosijs-share",yL="tosijs-share",OE="shared",PL=1,wM=new Set,AM=new Set,OM=new Map,HE=null,CM="",gE=null,mL=null;function Sf(){if(gE!=null)return Promise.resolve(gE);return new Promise((E,M)=>{let f=indexedDB.open(yL,PL);f.onupgradeneeded=()=>{f.result.createObjectStore(OE)},f.onsuccess=()=>{gE=f.result,E(gE)},f.onerror=()=>M(f.error)})}var bL={async get(E){let M=await Sf();return new Promise((f,L)=>{let $=M.transaction(OE,"readonly").objectStore(OE).get(E);$.onsuccess=()=>f($.result),$.onerror=()=>L($.error)})},async set(E,M){let f=await Sf();return new Promise((L,H)=>{let $=f.transaction(OE,"readwrite");$.objectStore(OE).put(M,E),$.oncomplete=()=>L(),$.onerror=()=>H($.error)})}};function xf(){return mL??bL}function cL(E){return E!=null&&E.type==="tosijs-share"&&typeof E.path==="string"}function Nf(E){for(let M of wM)if(E===M||E.startsWith(M+"."))return M;return}function vL(E){for(let M of AM)if(E===M||E.startsWith(M+"."))return!0;return!1}function uL(E,M){AM.add(E),h(j,E,M),k(E),EE().then(()=>{AM.delete(E)})}function gL(){if(HE!=null)return HE;return CM=crypto.randomUUID(),HE=new BroadcastChannel(NL),HE.onmessage=(E)=>{let M=E.data;if(!cL(M))return;if(M.origin===CM)return;if(Nf(M.path)===void 0)return;uL(M.path,M.value)},HE}function dL(E,M){if(HE==null)return;let f={type:"tosijs-share",path:E,value:M,origin:CM};HE.postMessage(f)}function nL(E){if(!OM.has(E))OM.set(E,QE(()=>{let M=w(j,E);xf().set(E,M)},500));OM.get(E)()}async function yf(...E){if(typeof BroadcastChannel>"u")return{restored:[]};gL();let M=[],f=xf();for(let L of E){let H=typeof L==="string"?L:O(L);if(H===void 0)throw Error("share() requires boxed proxies or string paths. Got a non-proxy value.");if(wM.has(H))continue;wM.add(H);let $=await f.get(H);if($!==void 0)h(j,H,$),k(H),M.push(L);else{let J=w(j,H);await f.set(H,J)}v((J)=>J===H||J.startsWith(H+"."),(J)=>{if(vL(J))return;let Q=Nf(J);if(Q===void 0)return;let Z=w(j,J);dL(J,Z),nL(Q)})}return{restored:M}}var jM=new Set;function Pf(E,M){for(let f of E)if(M===f||M.startsWith(f+"."))return f;return}function hL(E){for(let M of jM)if(E===M||E.startsWith(M+"."))return!0;return!1}function iL(E,M){jM.add(E),h(j,E,M),k(E),EE().then(()=>{jM.delete(E)})}async function mf(E,M,...f){let L=new Set,H=[],$=[],J=M.throttleInterval??100;await E.connect();let Q=ME(()=>{if(H.length===0)return;let Z=H.splice(0);E.send(Z)},J);E.onReceive((Z)=>{for(let Y of Z){if(Pf(L,Y.path)===void 0)continue;iL(Y.path,Y.value)}});for(let Z of f){let Y=typeof Z==="string"?Z:O(Z);if(Y===void 0)throw Error("sync() requires boxed proxies or string paths. Got a non-proxy value.");L.add(Y);let X=v((F)=>F===Y||F.startsWith(Y+"."),(F)=>{if(hL(F))return;if(Pf(L,F)===void 0)return;let z=w(j,F);H.push({path:F,value:z}),Q()});$.push(X)}return{disconnect(){for(let Z of $)i(Z);$.length=0,L.clear(),H.length=0,E.disconnect()}}}var dE="1.5.7";function wE(E){return Object.assign(B,E),B}function AE(E){return I("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),wE(E)}var sL=new FinalizationRegistry((E)=>{E()});function bf(E,M){let f=eE();B[f]=E;let L=B[f],H=()=>{delete V[f]};if(M)sL.register(M,H);return[L,H]}function nE(E,M=!1){if(M)return I("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),AE(E);return Object.keys(E).forEach((f)=>{V[f]=E[f]}),V}var pL={};async function CE(E,M){let f=await M(E,{Color:G,Component:N,elements:T,svgElements:NE,mathML:yE,varDefault:UE,vars:_E,xin:V,boxed:B,xinProxy:nE,boxedProxy:AE,tosi:wE,makeComponent:CE,bind:m,on:LE,version:dE}),{type:L}=f;L.preferredTagName=E;let H=f.lightStyleSpec??f.styleSpec;if(H)L.lightStyleSpec=H;let $={type:L,creator:L.elementCreator()};return pL[E]=$,$}var hE={":host":{display:"none"}},VM={},rL=(E)=>import(E);class jE extends N{static preferredTagName="tosi-blueprint";static lightStyleSpec=hE;static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(E)=>{};async packaged(){let{tag:E,src:M,property:f}=this,L=`${E}.${f}:${M}`;if(!this.loaded){if(VM[L]===void 0)VM[L]=rL(M).then((H)=>{let $=H[f];return CE(E,$)});else console.log(`using cached ${E} with signature ${L}`);this.loaded=await VM[L],this.blueprintLoaded(this.loaded)}return this.loaded}}var cf=jE.elementCreator();class iE extends N{static preferredTagName="tosi-loader";static lightStyleSpec=hE;allLoaded=()=>{};async load(){let M=Array.from(this.querySelectorAll("tosi-blueprint, xin-blueprint")).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(M),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var vf=iE.elementCreator();class uf extends jE{static preferredTagName="xin-blueprint";static lightStyleSpec=hE;constructor(){super();I("xin-blueprint","<xin-blueprint> is deprecated. Use <tosi-blueprint> instead.")}}var gf=uf.elementCreator();class df extends N{static preferredTagName="xin-loader";static lightStyleSpec=hE;allLoaded=()=>{};constructor(){super();I("xin-loader","<xin-loader> is deprecated. Use <tosi-loader> instead.")}async load(){let M=Array.from(this.querySelectorAll("xin-blueprint")).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(M),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var nf=df.elementCreator();})();
|
|
12
|
+
`)},Jf=(E)=>{j("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let M={};for(let f of Object.keys(E)){let L=E[f],H=S(f);M[`--${H}`]=typeof L==="number"&&L!==0?String(L)+"px":L}return M},$f=(E)=>{let M={};for(let f of Object.keys(E)){let L=E[f];if(L instanceof G)M[f]=L.inverseLuminance;else if(typeof L==="string"&&L.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))M[f]=G.fromCss(L).inverseLuminance}return M},KE=new Proxy({},{get(E,M){if(E[M]===void 0){let f="--"+S(M);E[M]=(L)=>`var(${f}, ${L})`}return E[M]}}),SE=new Proxy({},{get(E,M){if(M==="default")return KE;if(E[M]==null){M=S(M);let[,f,,L,H,$]=M.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",M],J=`--${f}`;if(H!=null){let Q=L==null?Number(H)/100:-Number(H)/100;switch($){case"b":case"s":case"h":case"o":{let Z=`--${M}`;G.registerComputedColor(Z,J,Q,$),E[M]=`var(${Z})`}break;case"":E[M]=`calc(var(${J}) * ${Q})`;break;default:throw console.error($),Error(`Unrecognized method ${$} for css variable ${J}`)}}else E[M]=`var(${J})`}return E[M]}});function FM(){let E=(M)=>typeof matchMedia<"u"&&matchMedia(M).matches;return{colorScheme:E("(prefers-color-scheme: dark)")?"dark":"light",contrast:E("(prefers-contrast: more)")?"more":E("(prefers-contrast: less)")?"less":E("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:E("(prefers-reduced-motion: reduce)"),reducedTransparency:E("(prefers-reduced-transparency: reduce)"),forcedColors:E("(forced-colors: active)")}}function Zf(E){if(typeof matchMedia>"u")return()=>{};let M=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],f=()=>E(FM()),L=M.map((H)=>matchMedia(H));for(let H of L)H.addEventListener("change",f);return()=>{for(let H of L)H.removeEventListener("change",f)}}var Qf="http://www.w3.org/1998/Math/MathML",Yf="http://www.w3.org/2000/svg";var xE={},Xf=(E,M,f)=>{let L=GM(S(M),f);if(L.prop.startsWith("--"))E.style.setProperty(L.prop,L.value);else E.style[M]=L.value},DL=(E)=>{return{toDOM(M,f){Xf(M,E,f)}}},zf=(E,M,f)=>{if(M==="style")if(typeof f==="object")for(let L of Object.keys(f))if(A(f[L]))P(E,f[L],DL(L));else Xf(E,L,f[L]);else E.setAttribute("style",f);else{let L=S(M),H=E.constructor.observedAttributes;if(H?.includes(M)||H?.includes(L))if(typeof f==="boolean")f?E.setAttribute(L,""):E.removeAttribute(L);else E.setAttribute(L,f);else if(E[M]!==void 0){let{MathMLElement:J}=globalThis;if(E instanceof SVGElement||J!==void 0&&E instanceof J)E.setAttribute(M,f);else E[M]=f}else if(L==="class")f.split(" ").forEach((J)=>{E.classList.add(J)});else if(E[L]!==void 0)E[L]=f;else if(typeof f==="boolean")f?E.setAttribute(L,""):E.removeAttribute(L);else E.setAttribute(L,f)}},XM={},Gf=(E)=>{if(!XM[E])XM[E]={toDOM(M,f){zf(M,E,f)}};return XM[E]},NE=(E,M,f)=>{if(M==="apply")f(E);else if(M.match(/^on[A-Z]/)!=null){let L=M.substring(2).toLowerCase();$E(E,L,f)}else if(M==="bind")if((typeof f.binding==="string"?DE[f.binding]:f.binding)!==void 0&&f.value!==void 0)P(E,f.value,f.binding instanceof Function?{toDOM:f.binding}:f.binding);else throw Error("bad binding");else if(M.match(/^bind[A-Z]/)!=null){let L=M.substring(4,5).toLowerCase()+M.substring(5);if(L!=="value"){let $=L==="text"?"textContent":L==="enabled"?"disabled (with .tosi.take(v => !v))":L==="disabled"?"disabled":L==="list"?".tosi.listBinding()":null;if($)j(`bind${L}`,`bind${M.substring(4)} is deprecated. Use { ${$}: ... } instead.`)}let H=DE[L];if(H!==void 0)P(E,f,H);else throw Error(`${M} is not allowed, bindings.${L} is not defined`)}else if(f!=null&&typeof f==="object"&&f[i])P(E,f,Gf(M));else if(A(f))P(E,f,Gf(M));else zf(E,M,f)},zM=(E,...M)=>{if(xE[E]===void 0){let[H,$]=E.split("|");if($===void 0)xE[E]=globalThis.document.createElement(H);else xE[E]=globalThis.document.createElementNS($,H)}let f=xE[E].cloneNode(),L={};for(let H of M)if(H instanceof Element||H instanceof DocumentFragment||typeof H==="string"||typeof H==="number")if(f instanceof HTMLTemplateElement)f.content.append(H);else f.append(H);else if(A(H))f.append(I.span({bindText:H}));else Object.assign(L,H);for(let H of Object.keys(L)){let $=L[H];NE(f,H,$)}return f},WM=(...E)=>{let M=globalThis.document.createDocumentFragment();for(let f of E)M.append(f);return M},I=new Proxy({fragment:WM},{get(E,M){if(M=M.replace(/[A-Z]/g,(f)=>`-${f.toLocaleLowerCase()}`),E[M]===void 0)E[M]=(...f)=>zM(M,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),yE=new Proxy({fragment:WM},{get(E,M){if(E[M]===void 0)E[M]=(...f)=>zM(`${M}|${Yf}`,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),PE=new Proxy({fragment:WM},{get(E,M){if(E[M]===void 0)E[M]=(...f)=>zM(`${M}|${Qf}`,...f);return E[M]},set(){throw Error("You may not add new properties to elements")}}),Ff=new WeakSet;function Wf(E,M,f="part"){let L=`[data-${f}]`;for(let H of Array.from(E.querySelectorAll(L))){if(Ff.has(H))continue;let $=H.getAttribute(`data-${f}`);if($==null)continue;let J=M[$];if(J==null)continue;Ff.add(H);for(let Q of Object.keys(J))NE(H,Q,J[Q])}}var KL=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],qL=!0,OL=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,wL=(E)=>OL.test(E),a=(E="",M="")=>{if(E==="")return M;else if(M.match(/^\d+$/)!==null||M.includes("="))return`${E}[${M}]`;else return`${E}.${M}`},mE={};function UM(E,M){if(E!==null&&(typeof E==="object"||typeof E==="function"))return E;return new Proxy(mE,e(M,!0))}var Of=()=>new Proxy({},e("^",!0)),DM=(E)=>{let f=E(Of())?.path;if(!f?.startsWith("^."))throw Error("selector must return a property of the item");return f.substring(2)},KM=(E,M,f)=>{for(let L=0;L<E.length;L++)if(`${C(E[L],M)}`===`${f}`)return L;return-1},AL=(E,M)=>({listFind(f,L){if(f instanceof Element){let J=f;while(J&&!J[s]&&J.parentElement)J=J.parentElement;let Q=J?.[s];if(Q==null)return;let Z=M.indexOf(Q);return Z!==-1?B[E][Z]:void 0}let H=DM(f),$=KM(M,H,L);return $!==-1?B[E][$]:void 0},listUpdate(f,L){let H=DM(f),$=C(L,H),J=KM(M,H,$);if(J!==-1){let Q=B[E][J];for(let Z of Object.keys(L))Q[Z]=L[Z];return Q}return B[E].push(L),B[E][M.length-1]},listRemove(f,L){let H=DM(f),$=KM(M,H,L);if($===-1)return!1;return B[E].splice($,1),!0}}),Uf=!1;function CL(){if(!Uf)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use .tosi.value, .tosi.path, .tosi.observe(), etc. instead."),Uf=!0}var Df=(E)=>{return E===mE},jL=(E,M)=>({get(f,L){switch(L){case"value":return M===mE?C(V,E):M.valueOf?M.valueOf():M;case"path":return E;case"touch":return()=>k(E);case"observe":return(H)=>{let $=g(E,H);return()=>o($)};case"bind":return(H,$,J)=>{iM()(H,E,$,J)};case"on":{let H=M===mE?C(V,E):M.valueOf?M.valueOf():M;return($,J)=>sM()($,J,H)}case"binding":return(H)=>({bind:{value:E,binding:H}});case"listBinding":return(H=({span:J})=>J({bindText:"^"}),$={})=>[{bindList:{value:E,...$}},I.template(H(I,Of()))];case"listFind":case"listUpdate":case"listRemove":return AL(E,Array.isArray(M)?M:[])[L];case"take":return(...H)=>{let $=H[H.length-1],Q=H.slice(0,-1).map((Z)=>typeof Z==="string"?Z:Z[y]);return{[i]:!0,paths:[E,...Q],transform:$}}}return},set(f,L,H){if(L==="value"){if(H=q(H),q(R[E])!==H&&r(V,E,H))k(E);return!0}return!1}}),qE=(E,M)=>new Proxy(M,jL(E,M)),Kf=new Set(["path","value","touch","observe","bind","on","binding","listBinding","listFind","listUpdate","listRemove","take"]),qf=new Map([[y,"path"],["xinPath","path"],["tosiPath","path"],[h,"value"],["xinValue","value"],["tosiValue","value"],[kM,"observe"],["xinObserve","observe"],["tosiObserve","observe"],[_M,"on"],["xinOn","on"],["tosiOn","on"],[BM,"bind"],["xinBind","bind"],["tosiBind","bind"],["tosiBinding","binding"],["tosiListBinding","listBinding"]]),e=(E,M)=>({get(f,L){if((L==="tosi"||L===zE)&&M)return qE(E,f);if(Df(f)){let Z=()=>C(V,E);switch(L){case"valueOf":case"toJSON":return()=>Z();case Symbol.toPrimitive:return(F)=>{let z=Z();if(F==="number")return Number(z);if(F==="string")return String(z);return z};case"toString":return()=>String(Z())}if(Kf.has(L))return qE(E,f)[L];let Y=qf.get(L);if(Y!==void 0)return CL(),qE(E,f)[Y];let X=Z();if(X!=null){let F=Object(X);if(L in F){let z=F[L];return typeof z==="function"?z.bind(F):z}}return}if(M&&(L==="valueOf"||L==="toJSON"))return()=>f.valueOf?f.valueOf():f;if(M&&!(L in f)&&Kf.has(L))return qE(E,f)[L];let H=qf.get(L);if(H!==void 0)return qE(E,f)[H];if(typeof L==="symbol")return f[L];let $=Object.getOwnPropertyDescriptor(f,L);if($&&!$.configurable&&!$.writable&&"value"in $)return $.value;let J=L,Q=J.match(/^([^.[]+)\.(.+)$/)??J.match(/^([^\]]+)(\[.+)/)??J.match(/^(\[[^\]]+\])\.(.+)$/)??J.match(/^(\[[^\]]+\])\[(.+)$/);if(Q!==null){let[,Z,Y]=Q,X=a(E,Z),F=q(C(f,Z));return F!==null&&typeof F==="object"?new Proxy(F,e(X,M))[Y]:F}if(J.startsWith("[")&&J.endsWith("]"))J=J.substring(1,J.length-1);if(!Array.isArray(f)&&f[J]!==void 0||Array.isArray(f)&&J.includes("=")){let Z;if(J.includes("=")){let[Y,X]=J.split("=");Z=f.find((F)=>`${C(F,Y)}`===X)}else Z=f[J];if(Z instanceof Object){Z=q(Z);let Y=a(E,J);return new Proxy(Z instanceof Function?Z.bind(f):Z,e(Y,M))}else return M?UM(Z,a(E,J)):Z}else if(Array.isArray(f)){let Z=f[J];return typeof Z==="function"?(...Y)=>{let X=Y.map((z)=>q(z)),F=Z.apply(f,X);if(KL.includes(J))k(E);if(F!=null&&typeof F==="object"){if(J==="find"||J==="findLast"||J==="at"){let z=f.indexOf(F);if(z!==-1)return new Proxy(F,e(a(E,String(z)),M))}}return F}:typeof Z==="object"?new Proxy(q(Z),e(a(E,J),M)):M?UM(Z,a(E,J)):Z}else{let Z=f[J];if(Z!==null&&typeof Z==="object")Z=q(Z);return M?UM(Z,a(E,J)):Z}},set(f,L,H){if(H=q(H),H!==null&&typeof H==="object")if(Array.isArray(H))for(let Z=0;Z<H.length;Z++)H[Z]=q(H[Z]);else for(let Z of Object.keys(H))H[Z]=q(H[Z]);let J=L===h||L==="xinValue"||L==="tosiValue"||L==="value"&&(Df(f)||M)?E:a(E,L);if(qL&&!wL(J))throw Error(`setting invalid path ${J}`);if(q(R[J])!==H&&r(V,J,H))k(J);return!0}}),XE=(E,M)=>{let f=typeof M==="function"?M:R[M];if(typeof f!=="function")throw Error(`observe expects a function or path to a function, ${M} is neither`);return g(E,f)},R=new Proxy(V,e("",!1));nM(R);var B=new Proxy(V,e("",!0));var VL=16,RL=100;function wf(E,M){let f=Array.from(E.querySelectorAll(n));if(E.matches(n))f.unshift(E);for(let L of f){let H=b.get(L);for(let $ of H){if($.path.startsWith("^"))$.path=`${M}${$.path.substring(1)}`;if($.binding.toDOM!=null)$.binding.toDOM(L,R[$.path])}}}class Af{boundElement;listTop;listBottom;isNamespaced;template;options;itemToElement;idToElement=new Map;array=[];_filteredCache;_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(E,M,f={}){if(this.boundElement=E,this.itemToElement=new WeakMap,f.idPath!=null){let H=A(M);if(H!=null)SM(H,f.idPath)}if(E.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(E.children[0]instanceof HTMLTemplateElement){let H=E.children[0];if(H.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=fE(H.content.children[0])}else this.template=E.children[0],this.template.remove();this.options=f;let L=E.namespaceURI;if(this.isNamespaced=L==="http://www.w3.org/2000/svg"||L==="http://www.w3.org/1998/Math/MathML",this.isNamespaced)this.listTop=null,this.listBottom=null;else this.listTop=document.createElement("div"),this.listBottom=document.createElement("div"),this.listTop.classList.add("virtual-list-padding"),this.listBottom.classList.add("virtual-list-padding"),this.boundElement.append(this.listTop),this.boundElement.append(this.listBottom);if(this.boundElement[QE]=this,this.isNamespaced&&f.virtual!=null)console.warn("ListBinding: virtual scrolling is not supported in SVG/MathML containers, ignoring virtual option");if(!this.isNamespaced&&f.virtual!=null)if(UE.observe(this.boundElement),this._update=HE(()=>{this.update(this.array,!0)},VL),this.boundElement.addEventListener("resize",this._update),f.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}filteredArray(){if(this._filteredCache!=null)return this._filteredCache;let{hiddenProp:E,visibleProp:M}=this.options,f=this.array;if(E!==void 0)f=f.filter((L)=>L[E]!==!0);if(M!==void 0)f=f.filter((L)=>L[M]===!0);if(this.options.filter&&this.needle!==void 0)f=this.options.filter(f,this.needle);return this._filteredCache=f,f}visibleSlice(){let{virtual:E}=this.options,M=this.filteredArray(),f=0,L=M.length-1,H=0,$=0;if(E!=null&&this.boundElement instanceof HTMLElement){let J=this.boundElement.offsetWidth,Q=E.scrollContainer==="window",Z,Y;if(Q){Z=window.innerHeight;let z=this.boundElement.getBoundingClientRect();Y=Math.max(0,-z.top)}else Z=this.boundElement.offsetHeight,Y=this.boundElement.scrollTop;let X=E.width!=null?Math.max(1,Math.floor(J/E.width)):E.visibleColumns??1,F=Math.ceil(M.length/X);if(E.minHeight!=null){let z=E.minHeight,T=Math.ceil(Z/z)+(E.rowChunkSize||1),W=X*T,U=F*z,K=Math.max(0,U-Z),x=K>0?Math.min(1,Math.max(0,Y/K)):0,_=Math.max(0,F-T+1),D=x*_,O=Math.floor(D);if(E.rowChunkSize)O-=O%E.rowChunkSize;return f=O*X,L=f+W-1,H=Y,$=Math.max(0,U-Y-Z),{items:M,firstItem:f,lastItem:L,topBuffer:H,bottomBuffer:$,interpolation:{t:x,position:D,scrollTop:Y,viewportHeight:Z,totalScrollHeight:U,rowHeight:E.height}}}else{let z=Math.ceil(Z/E.height)+(E.rowChunkSize||1),T=X*z,W=Math.floor(Y/E.height);if(W>F-z+1)W=Math.max(0,F-z+1);if(E.rowChunkSize)W-=W%E.rowChunkSize;f=W*X,L=f+T-1,H=W*E.height,$=Math.max((F-z)*E.height-H,0)}}return{items:M,firstItem:f,lastItem:L,topBuffer:H,bottomBuffer:$}}needle;filter=HE((E)=>{if(this.needle!==E)this.needle=E,this.update(this.array)},RL);update(E,M){if(E==null)E=[];if(this.array=E,!M)this._filteredCache=void 0;let{hiddenProp:f,visibleProp:L}=this.options,H=A(E),$=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",$.items.length===0);let J=this._previousSlice,{firstItem:Q,lastItem:Z,topBuffer:Y,bottomBuffer:X}=$,F=f===void 0&&L===void 0&&M===!0&&J!=null&&Q===J.firstItem&&Z===J.lastItem;if(F&&$.interpolation==null&&Y===J.topBuffer&&X===J.bottomBuffer)return;if(F&&$.interpolation!=null){this._updateInterpolatedBuffers($);return}this._previousSlice=$;let z=0,T=0,W=0,{idPath:U}=this.options,K;if(U!=null){K=new Set;for(let D=Q;D<=Z;D++){let O=$.items[D];if(O!==void 0)K.add(String(O[U]))}}for(let D of Array.from(this.boundElement.children)){if(D===this.listTop||D===this.listBottom)continue;let O=D[s];if(O==null)D.remove();else{let w;if(U!=null)w=!K.has(String(O[U]));else{let N=$.items.indexOf(O);w=N<Q||N>Z}if(w){if(D.remove(),this.itemToElement.delete(O),U!=null)this.idToElement.delete(String(O[U]));z++}}}if(this.listTop!=null&&this.listBottom!=null)this.listTop.style.height=String(Y)+"px",this.listBottom.style.height=String(X)+"px";let x=[];for(let D=Q;D<=Z;D++){let O=$.items[D];if(O===void 0)continue;let w=this.itemToElement.get(q(O));if(w==null&&U!=null){let N=String(O[U]);if(w=this.idToElement.get(N),w!=null){let EE=q(O);this.itemToElement.set(EE,w),w[s]=EE}}if(w==null){if(W++,w=fE(this.template),typeof O==="object")this.itemToElement.set(q(O),w),w[s]=q(O);if(this.listBottom!=null)this.boundElement.insertBefore(w,this.listBottom);else this.boundElement.append(w);if(U!=null){let N=O[U],EE=`${H}[${U}=${N}]`;wf(w,EE),this.idToElement.set(String(N),w)}else{let N=`${H}[${D}]`;wf(w,N)}}x.push(w)}let _=null;for(let D of x){if(D.previousElementSibling!==_)if(T++,_?.nextElementSibling!=null)this.boundElement.insertBefore(D,_.nextElementSibling);else if(this.listBottom!=null)this.boundElement.insertBefore(D,this.listBottom);else this.boundElement.append(D);_=D}if($.interpolation!=null)this._updateInterpolatedBuffers($);if(p.perf)console.log(H,"updated",{removed:z,created:W,moved:T})}_updateInterpolatedBuffers(E){let{t:M,position:f,scrollTop:L,viewportHeight:H,totalScrollHeight:$,rowHeight:J}=E.interpolation,Q=0;for(let F of Array.from(this.boundElement.children)){if(F===this.listTop||F===this.listBottom)continue;Q+=F.offsetHeight||J}let Z=L,Y=L+H-Q,X=Math.max(0,M*Y+(1-M)*Z-f%1*J);if(this.listTop!=null&&this.listBottom!=null)this.listTop.style.height=String(X)+"px",this.listBottom.style.height=String(Math.max(0,$-X-Q))+"px"}}var FE=(E,M,f)=>{let L=E[QE];if(M&&L===void 0)L=new Af(E,M,f),E[QE]=L;return L},bE=(E)=>{let M;while(!(M=E[s])&&E&&E.parentElement)E=E.parentElement;return M?{element:E,item:M}:void 0},cE=(E)=>{let M=bE(E);return M?M.item:void 0},Cf=(E)=>{let M=bE(E);if(!M)return console.error("deleteListItem failed, element is not part of a list instance",E),!1;let f=FE(M.element.parentElement);if(!f.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",E.parentElement,f),!1;let L=f.array.indexOf(M.item);if(L>-1)return f.array.splice(L,1),!0;return!1},TL={start:"start",middle:"center",end:"end",nearest:"nearest"},jf=(E,M,f={})=>{let L=FE(E);if(L==null)return console.error("scrollListItemIntoView failed, element has no list binding",E),!1;let{position:H="middle"}=f,$=L.filteredArray(),J=q(M)??M,Q=$.indexOf(J);if(Q===-1)return console.error("scrollListItemIntoView failed, item not found in list",M),!1;let{virtual:Z}=L.options;if(Z!=null&&E instanceof HTMLElement){let Y=Z.width!=null?Math.max(1,Math.floor(E.offsetWidth/Z.width)):Z.visibleColumns??1,X=Math.floor(Q/Y),F=Z.minHeight??Z.height,z=Math.ceil($.length/Y),T=Z.scrollContainer==="window",W=T?window.innerHeight:E.offsetHeight,U;if(Z.minHeight!=null){let K=Math.ceil(W/F)+(Z.rowChunkSize||1),x=z*F,_=Math.max(0,x-W),D=Math.max(1,z-K+1),O=X/D;switch(H){case"start":U=O*_;break;case"end":U=Math.max(0,(X-K+1)/D*_);break;case"nearest":{let w=T?Math.max(0,-E.getBoundingClientRect().top):E.scrollTop,N=_>0?w/_:0,EE=Math.floor(N*D);if(X<EE)U=O*_;else if(X>=EE+K)U=Math.max(0,(X-K+1)/D*_);else return!0;break}default:{let w=X-Math.floor(K/2);U=Math.max(0,w)/D*_}}}else{let K=X*Z.height;switch(H){case"start":U=K;break;case"end":U=K-W+Z.height;break;case"nearest":{let x=T?Math.max(0,-E.getBoundingClientRect().top):E.scrollTop;if(K<x)U=K;else if(K+Z.height>x+W)U=K-W+Z.height;else return!0;break}default:U=K-(W-Z.height)/2}}if(U=Math.max(0,U),T){let K=E.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:K+U,behavior:"smooth"})}else E.scrollTo({top:U,behavior:"smooth"})}else{let Y=L.itemToElement.get(J);if(Y==null)return console.error("scrollListItemIntoView failed, no DOM element found for item",M),!1;Y.scrollIntoView({block:TL[H]??"center",behavior:"smooth"})}return!0};var{document:OE,MutationObserver:Vf}=globalThis,vE=(E,M)=>{let f=b.get(E);if(f==null)return;for(let L of f){let{binding:H,options:$}=L,{path:J}=L,{toDOM:Q}=H;if(Q!=null){if(J.startsWith("^")){let Z=cE(E);if(Z!=null&&Z[y]!=null)J=L.path=`${Z[y]}${J.substring(1)}`;else{if(E instanceof HTMLElement)console.warn(`Unresolved relative binding "${J}" —`,E,"is not part of a list. If this is a list template, wrap it in a <template>.");continue}}if(M==null||J.startsWith(M))Q(E,WE()[J],$)}}};if(Vf!=null)new Vf((M)=>{M.forEach((f)=>{Array.from(f.addedNodes).forEach((L)=>{if(L instanceof Element)Array.from(L.querySelectorAll(n)).forEach((H)=>vE(H))})})}).observe(OE.body,{subtree:!0,childList:!0});g(()=>!0,(E)=>{let M=Array.from(OE.querySelectorAll(n));for(let f of M)vE(f,E)});var Rf=(E)=>{let M=E.target?.closest(n);while(M!=null){let f=b.get(M);for(let L of f){let{binding:H,path:$}=L,{fromDOM:J}=H;if(J!=null){let Q;try{Q=J(M,L.options)}catch(Z){throw console.error("Cannot get value from",M,"via",L),Error("Cannot obtain value fromDOM")}if(Q!=null){let Z=WE(),Y=Z[$];if(Y==null)Z[$]=Q;else{let X=Y[y]!=null?Y[h]:Y,F=Q[y]!=null?Q[h]:Q;if(X!==F)Z[$]=F}}}}M=M.parentElement.closest(n)}};if(globalThis.document!=null)OE.body.addEventListener("change",Rf,!0),OE.body.addEventListener("input",Rf,!0);function IL(E,M,f,L){let{paths:H,transform:$}=M,{toDOM:J}=f;if(J==null)return E;let Q=null,Z={toDOM(X,F,z){let T=WE(),W=H.map((K)=>T[K]);if(Q!==null&&W.every((K,x)=>K===Q[x]))return;Q=W;let U=$(...W);J(X,U,z)},fromDOM:f.fromDOM};E.classList?.add(TE);let Y=b.get(E);if(Y==null)Y=[],b.set(E,Y);for(let X of H)Y.push({path:X,binding:Z,options:L});if(!H[0].startsWith("^"))k(H[0]);return E}function P(E,M,f,L){if(E instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");if(M!=null&&typeof M==="object"&&M[i])return IL(E,M,f,L);let H;if(typeof M==="object"&&M[y]===void 0&&L===void 0){let{value:Q}=M;H=typeof Q==="string"?Q:Q[y],L=M,delete L.value}else H=typeof M==="string"?M:M[y];if(H==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:$}=f;E.classList?.add(TE);let J=b.get(E);if(J==null)J=[],b.set(E,J);if(J.push({path:H,binding:f,options:L}),$!=null&&!H.startsWith("^"))k(H);if(L?.filter&&L?.needle)P(E,L.needle,{toDOM(Q,Z){console.log({needle:Z}),Q[QE]?.filter(Z)}});return E}var Tf=new Set,kL=(E)=>{let M=E?.target?.closest(lE),f=!1,L=new Proxy(E,{get($,J){if(J==="stopPropagation")return()=>{E.stopPropagation(),f=!0};else{let Q=$[J];return typeof Q==="function"?Q.bind($):Q}}}),H=new Set;while(!f&&M!=null){let J=ME.get(M)[E.type]||H;for(let Q of J){if(typeof Q==="function")Q(L);else{let Z=WE()[Q];if(typeof Z==="function")Z(L);else throw Error(`no event handler found at path ${Q}`)}if(f)continue}M=M.parentElement!=null?M.parentElement.closest(lE):null}};function $E(E,M,f){let L=ME.get(E);if(E.classList.add(oE),L==null)L={},ME.set(E,L);if(!L[M])L[M]=new Set;if(L[M].add(f),!Tf.has(M))Tf.add(M),OE.body.addEventListener(M,kL,!0);return()=>{L[M].delete(f)}}hM(P,$E);function uE(E,M){if(!E.internals)return;let f={},L="";if(E.hasAttribute("required")&&M==="")f.valueMissing=!0,L="Please fill out this field.";let H=E.getAttribute("minlength");if(H&&M.length<parseInt(H,10))f.tooShort=!0,L=`Please use at least ${H} characters.`;let $=E.getAttribute("maxlength");if($&&M.length>parseInt($,10))f.tooLong=!0,L=`Please use no more than ${$} characters.`;let J=E.getAttribute("pattern");if(J&&M!=="")try{if(!new RegExp(`^(?:${J})$`).test(M))f.patternMismatch=!0,L="Please match the requested format."}catch{}if(Object.keys(f).length>0)E.internals.setValidity(f,L,E);else E.internals.setValidity({})}var BL=0;function qM(){return`custom-elt${(BL++).toString(36)}`}var If=0,OM=null;function _L(){if(OM===null)OM=new MutationObserver((E)=>{let M=new Set;for(let f of E)if(f.type==="attributes"&&f.target instanceof m){let L=f.target,H=YM(f.attributeName);if(L._legacyTrackedAttrs?.has(H))M.add(L)}for(let f of M)f.queueRender(!1)});return OM}var wE={};function SL(E,M){let f=wE[E],L=t(M).replace(/:host\(([^)]+)\)/g,`${E}$1`).replace(/:host\b/g,E);wE[E]=f?f+`
|
|
13
|
+
`+L:L}function xL(E){if(wE[E])document.head.append(I.style({id:E+"-component"},wE[E]));delete wE[E]}class m extends HTMLElement{static elements=I;static _elementCreator;static initAttributes;static formAssociated;static preferredTagName;static shadowStyleSpec;static lightStyleSpec;static extends;internals;get validity(){return this.internals?.validity}get validationMessage(){return this.internals?.validationMessage??""}get willValidate(){return this.internals?.willValidate??!1}checkValidity(){return this.internals?.checkValidity()??!0}reportValidity(){return this.internals?.reportValidity()??!0}setCustomValidity(E){if(this.internals)if(E)this.internals.setValidity({customError:!0},E);else this.internals.setValidity({})}setValidity(E,M,f){this.internals?.setValidity(E,M,f)}setFormValue(E,M){this.internals?.setFormValue(E,M)}static get observedAttributes(){let E=this.initAttributes;if(E)return["hidden",...Object.keys(E).map(S)];return["hidden"]}instanceId;styleNode;static styleSpec;static styleNode;content=I.slot();isSlotted;static _tagName=null;static get tagName(){return this._tagName}_legacyTrackedAttrs;_attrValues;_valueChanged=!1;static StyleNode(E){return console.warn("StyleNode is deprecated, use static shadowStyleSpec instead"),I.style(t(E))}static elementCreator(E={}){let M=this;if(!Object.prototype.hasOwnProperty.call(M,"_elementCreator")){if(E.tag!==void 0)j("elementCreator-tag","Passing tag to elementCreator() is deprecated. Use static preferredTagName instead.");if(E.styleSpec!==void 0)j("elementCreator-styleSpec","Passing styleSpec to elementCreator() is deprecated. Use static lightStyleSpec instead.");if(E.extends!==void 0)j("elementCreator-extends","Passing extends to elementCreator() is deprecated. Use static extends instead.");let f=E.tag??M.preferredTagName;if(f==null)if(typeof M.name==="string"&&M.name!==""){if(f=S(M.name),f.startsWith("-"))f=f.slice(1)}else f=qM();if(customElements.get(f)!=null)console.warn(`${f} is already defined`);if(f.match(/\w+(-\w+)+/)==null)console.warn(`${f} is not a legal tag for a custom-element`),f=qM();while(customElements.get(f)!==void 0)f=qM();M._tagName=f;let L=E.styleSpec??M.lightStyleSpec;if(L!==void 0)SL(f,L);let H=E.extends??M.extends,$=H?{extends:H}:void 0;window.customElements.define(f,this,$),M._elementCreator=I[f]}return M._elementCreator}initAttributes(...E){if(j("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let H of E)this._legacyTrackedAttrs.add(H);_L().observe(this,{attributes:!0});let f={},L={};E.forEach((H)=>{f[H]=v(this[H]);let $=S(H);Object.defineProperty(this,H,{enumerable:!1,get(){if(typeof f[H]==="boolean")return this.hasAttribute($);else if(this.hasAttribute($))return typeof f[H]==="number"?parseFloat(this.getAttribute($)):this.getAttribute($);else if(L[H]!==void 0)return L[H];else return f[H]},set(J){if(typeof f[H]==="boolean"){if(J!==this[H]){if(J)this.setAttribute($,"");else this.removeAttribute($);this.queueRender()}}else if(typeof f[H]==="number"){if(J!==parseFloat(this[H]))this.setAttribute($,J),this.queueRender()}else if(typeof J==="object"||`${J}`!==`${this[H]}`){if(J===null||J===void 0||typeof J==="object")this.removeAttribute($);else this.setAttribute($,J);this.queueRender(),L[H]=J}}})})}initValue(){let E=Object.getOwnPropertyDescriptor(this,"value");if(E===void 0||E.get!==void 0||E.set!==void 0)return;let M=this.hasAttribute("value")?this.getAttribute("value"):v(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return M},set(f){if(M!==f)M=f,this._valueChanged=!0,this.queueRender(!0)}})}_parts;get parts(){let E=this.shadowRoot!=null?this.shadowRoot:this;if(this._parts==null)this._parts=new Proxy({},{get(M,f){if(M[f]===void 0){let L=E.querySelector(`[part="${f}"]`);if(L==null)L=E.querySelector(f);if(L==null)throw Error(`elementRef "${f}" does not exist!`);L.removeAttribute("data-ref"),M[f]=L}return M[f]}});return this._parts}attributeChangedCallback(E,M,f){let L=YM(E);if(!this._legacyTrackedAttrs?.has(L))this.queueRender(!1)}constructor(){super();if(If+=1,this.constructor.formAssociated&&typeof this.attachInternals==="function"&&!this.internals)this.internals=this.attachInternals();let E=this.constructor.initAttributes;if(E)this._setupAttributeAccessors(E);this.instanceId=`${this.tagName.toLocaleLowerCase()}-${If}`,this._value=v(this.defaultValue)}_setupAttributeAccessors(E){if(!this._attrValues)this._attrValues=new Map;for(let M of Object.keys(E)){let f=S(M),L=E[M];if(M==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof L==="object"&&L!==null){console.warn(`${this.tagName}: initAttributes.${M} is an object. Use a regular property instead.`);continue}let H=this,$=!1;while(H){let J=Object.getOwnPropertyDescriptor(H,M);if(J){if(!J.configurable||J.get||J.set){$=!0;break}break}H=Object.getPrototypeOf(H)}if($)continue;Object.defineProperty(this,M,{enumerable:!1,get:()=>{if(typeof L==="boolean")return this.hasAttribute(f);else if(this.hasAttribute(f))return typeof L==="number"?parseFloat(this.getAttribute(f)):this.getAttribute(f);else if(this._attrValues.has(M))return this._attrValues.get(M);else return L},set:(J)=>{if(typeof L==="boolean"){if(J!==this[M]){if(J)this.setAttribute(f,"");else this.removeAttribute(f);this.queueRender()}}else if(typeof L==="number"){if(J!==parseFloat(this[M]))this.setAttribute(f,J),this.queueRender()}else if(typeof J==="object"||`${J}`!==`${this[M]}`){if(J===null||J===void 0||typeof J==="object")this.removeAttribute(f);else this.setAttribute(f,J);this.queueRender(),this._attrValues.set(M,J)}}})}}connectedCallback(){if(xL(this.constructor.tagName),this.hydrate(),this.role!=null)this.setAttribute("role",this.role);if(this.constructor.formAssociated&&!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(this.onResize!==void 0){if(UE.observe(this),this._onResize==null)this._onResize=this.onResize.bind(this);this.addEventListener("resize",this._onResize)}if(this.value!=null&&this.getAttribute("value")!=null)this._value=this.getAttribute("value");if(this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this.queueRender()}disconnectedCallback(){UE.unobserve(this)}formResetCallback(){if(this.value!==void 0)this.value=this.defaultValue??""}formDisabledCallback(E){if(E)this.setAttribute("disabled","");else this.removeAttribute("disabled")}formStateRestoreCallback(E){if(this.value!==void 0&&typeof E==="string")this.value=E}_changeQueued=!1;_renderQueued=!1;queueRender(E=!1){if(!this._hydrated)return;if(!this._changeQueued)this._changeQueued=E;if(!this._renderQueued)this._renderQueued=!0,requestAnimationFrame(()=>{if(this._changeQueued){if(ZM(this,"change"),this.internals&&this.value!==void 0)this.internals.setFormValue(this.value)}this._changeQueued=!1,this._renderQueued=!1,this.render()})}_hydrated=!1;hydrate(){if(!this._hydrated){this.initValue();let E=typeof this.content!=="function",M=typeof this.content==="function"?this.content(I):this.content;if(Array.isArray(M)){let $={};M=M.filter((J)=>{if(J instanceof Node||typeof J==="string"||typeof J==="number"||A(J))return!0;return Object.assign($,J),!1});for(let J of Object.keys($))NE(this,J,$[J])}let f=this.constructor,L=f.shadowStyleSpec??f.styleSpec;if(f.styleSpec&&!f.shadowStyleSpec)j("static-styleSpec","static styleSpec is deprecated. Use static shadowStyleSpec instead.");let{styleNode:H}=f;if(L)H=f.styleNode=I.style(t(L)),delete f.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecated, use static shadowStyleSpec instead"),H=this.styleNode;if(H){let $=this.attachShadow({mode:"open"});$.appendChild(H.cloneNode(!0)),QM($,M,E)}else if(M!==null){let $=Array.from(this.childNodes);QM(this,M,E),this.isSlotted=this.querySelector("slot,tosi-slot,xin-slot")!==void 0;let J=Array.from(this.querySelectorAll("slot"));if(J.length>0)J.forEach(gE.replaceSlot);if($.length>0){let Q={"":this};Array.from(this.querySelectorAll("tosi-slot,xin-slot")).forEach((Z)=>{Q[Z.name]=Z}),$.forEach((Z)=>{let Y=Q[""],X=Z instanceof Element?Q[Z.slot]:Y;(X!==void 0?X:Y).append(Z)})}}this._hydrated=!0}}render(){if(this._valueChanged&&this.internals&&this.value!==void 0)this.internals.setFormValue(this.value),this.validateValue();this._valueChanged=!1}validateValue(){if(!this.internals||this.value===void 0)return;let E=typeof this.value==="string"?this.value:String(this.value);uE(this,E)}}class gE extends m{static preferredTagName="tosi-slot";static initAttributes={name:""};content=null;static replaceSlot(E){let M=document.createElement("tosi-slot");if(E.name!=="")M.setAttribute("name",E.name);E.replaceWith(M)}}var kf=gE.elementCreator();class Bf extends m{static preferredTagName="xin-slot";static initAttributes={name:""};content=null;constructor(){super();j("xin-slot","<xin-slot> is deprecated. Use <tosi-slot> instead.")}static replaceSlot=gE.replaceSlot}var _f=Bf.elementCreator();var Sf=(E=()=>!0)=>{let M=localStorage.getItem("xin-state");if(M!=null){let L=JSON.parse(M);for(let H of Object.keys(L).filter(E))if(R[H]!==void 0)Object.assign(R[H],L[H]);else R[H]=L[H]}let f=GE(()=>{let L={},H=q(R);for(let $ of Object.keys(H).filter(E))L[$]=H[$];localStorage.setItem("xin-state",JSON.stringify(L)),console.log("xin state saved to localStorage")},500);XE(E,f)};var NL="tosijs-share",yL="tosijs-share",AE="shared",PL=1,AM=new Set,CM=new Set,wM=new Map,ZE=null,jM="",dE=null,mL=null;function xf(){if(dE!=null)return Promise.resolve(dE);return new Promise((E,M)=>{let f=indexedDB.open(yL,PL);f.onupgradeneeded=()=>{f.result.createObjectStore(AE)},f.onsuccess=()=>{dE=f.result,E(dE)},f.onerror=()=>M(f.error)})}var bL={async get(E){let M=await xf();return new Promise((f,L)=>{let $=M.transaction(AE,"readonly").objectStore(AE).get(E);$.onsuccess=()=>f($.result),$.onerror=()=>L($.error)})},async set(E,M){let f=await xf();return new Promise((L,H)=>{let $=f.transaction(AE,"readwrite");$.objectStore(AE).put(M,E),$.oncomplete=()=>L(),$.onerror=()=>H($.error)})}};function Nf(){return mL??bL}function cL(E){return E!=null&&E.type==="tosijs-share"&&typeof E.path==="string"}function yf(E){for(let M of AM)if(E===M||E.startsWith(M+"."))return M;return}function vL(E){for(let M of CM)if(E===M||E.startsWith(M+"."))return!0;return!1}function uL(E,M){CM.add(E),r(V,E,M),k(E),LE().then(()=>{CM.delete(E)})}function gL(){if(ZE!=null)return ZE;return jM=crypto.randomUUID(),ZE=new BroadcastChannel(NL),ZE.onmessage=(E)=>{let M=E.data;if(!cL(M))return;if(M.origin===jM)return;if(yf(M.path)===void 0)return;uL(M.path,M.value)},ZE}function dL(E,M){if(ZE==null)return;let f={type:"tosijs-share",path:E,value:M,origin:jM};ZE.postMessage(f)}function nL(E){if(!wM.has(E))wM.set(E,GE(()=>{let M=C(V,E);Nf().set(E,M)},500));wM.get(E)()}async function Pf(...E){if(typeof BroadcastChannel>"u")return{restored:[]};gL();let M=[],f=Nf();for(let L of E){let H=typeof L==="string"?L:A(L);if(H===void 0)throw Error("share() requires boxed proxies or string paths. Got a non-proxy value.");if(AM.has(H))continue;AM.add(H);let $=await f.get(H);if($!==void 0)r(V,H,$),k(H),M.push(L);else{let J=C(V,H);await f.set(H,J)}g((J)=>J===H||J.startsWith(H+"."),(J)=>{if(vL(J))return;let Q=yf(J);if(Q===void 0)return;let Z=C(V,J);dL(J,Z),nL(Q)})}return{restored:M}}var VM=new Set;function mf(E,M){for(let f of E)if(M===f||M.startsWith(f+"."))return f;return}function hL(E){for(let M of VM)if(E===M||E.startsWith(M+"."))return!0;return!1}function iL(E,M){VM.add(E),r(V,E,M),k(E),LE().then(()=>{VM.delete(E)})}async function bf(E,M,...f){let L=new Set,H=[],$=[],J=M.throttleInterval??100;await E.connect();let Q=HE(()=>{if(H.length===0)return;let Z=H.splice(0);E.send(Z)},J);E.onReceive((Z)=>{for(let Y of Z){if(mf(L,Y.path)===void 0)continue;iL(Y.path,Y.value)}});for(let Z of f){let Y=typeof Z==="string"?Z:A(Z);if(Y===void 0)throw Error("sync() requires boxed proxies or string paths. Got a non-proxy value.");L.add(Y);let X=g((F)=>F===Y||F.startsWith(Y+"."),(F)=>{if(hL(F))return;if(mf(L,F)===void 0)return;let z=C(V,F);H.push({path:F,value:z}),Q()});$.push(X)}return{disconnect(){for(let Z of $)o(Z);$.length=0,L.clear(),H.length=0,E.disconnect()}}}var nE="1.5.8";function CE(E){return Object.assign(B,E),B}function jE(E){return j("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),CE(E)}var sL=new FinalizationRegistry((E)=>{E()});function cf(E,M){let f=EM();B[f]=E;let L=B[f],H=()=>{delete R[f]};if(M)sL.register(M,H);return[L,H]}function hE(E,M=!1){if(M)return j("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),jE(E);return Object.keys(E).forEach((f)=>{R[f]=E[f]}),R}var pL={};async function VE(E,M){let f=await M(E,{Color:G,Component:m,elements:I,svgElements:yE,mathML:PE,varDefault:KE,vars:SE,xin:R,boxed:B,xinProxy:hE,boxedProxy:jE,tosi:CE,makeComponent:VE,bind:P,on:$E,version:nE}),{type:L}=f;L.preferredTagName=E;let H=f.lightStyleSpec??f.styleSpec;if(H)L.lightStyleSpec=H;let $={type:L,creator:L.elementCreator()};return pL[E]=$,$}var iE={":host":{display:"none"}},RM={},rL=(E)=>import(E);class RE extends m{static preferredTagName="tosi-blueprint";static lightStyleSpec=iE;static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(E)=>{};async packaged(){let{tag:E,src:M,property:f}=this,L=`${E}.${f}:${M}`;if(!this.loaded){if(RM[L]===void 0)RM[L]=rL(M).then((H)=>{let $=H[f];return VE(E,$)});else console.log(`using cached ${E} with signature ${L}`);this.loaded=await RM[L],this.blueprintLoaded(this.loaded)}return this.loaded}}var vf=RE.elementCreator();class sE extends m{static preferredTagName="tosi-loader";static lightStyleSpec=iE;allLoaded=()=>{};async load(){let M=Array.from(this.querySelectorAll("tosi-blueprint, xin-blueprint")).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(M),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var uf=sE.elementCreator();class gf extends RE{static preferredTagName="xin-blueprint";static lightStyleSpec=iE;constructor(){super();j("xin-blueprint","<xin-blueprint> is deprecated. Use <tosi-blueprint> instead.")}}var df=gf.elementCreator();class nf extends m{static preferredTagName="xin-loader";static lightStyleSpec=iE;allLoaded=()=>{};constructor(){super();j("xin-loader","<xin-loader> is deprecated. Use <tosi-loader> instead.")}async load(){let M=Array.from(this.querySelectorAll("xin-blueprint")).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(M),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var hf=nf.elementCreator();})();
|
|
14
14
|
|
|
15
|
-
//# debugId=
|
|
15
|
+
//# debugId=5C9396F9176769BF64756E2164756E21
|
|
16
16
|
//# sourceMappingURL=index.js.map
|