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