tosijs 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -9
- package/dist/index.js.map +9 -8
- package/dist/main.js +9 -9
- package/dist/main.js.map +9 -8
- package/dist/module.js +9 -9
- package/dist/module.js.map +9 -8
- package/dist/share.d.ts +13 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[tosijs.net](https://tosijs.net) | [tosijs-ui](https://ui.tosijs.net) | [github](https://github.com/tonioloewald/tosijs) | [npm](https://www.npmjs.com/package/tosijs) | [cdn](https://www.jsdelivr.com/package/npm/tosijs) | [react-tosijs](https://react.tosijs.net) | [discord](https://discord.gg/ramJ9rgky5)
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/tosijs)
|
|
12
|
-
[](https://bundlejs.com/?q=tosijs&badge=)
|
|
13
13
|
[](https://www.jsdelivr.com/package/npm/tosijs)
|
|
14
14
|
|
|
15
15
|
<div style="text-align: center; margin: 20px">
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { elements, svgElements, mathML } from './elements';
|
|
|
10
10
|
export type { ElementsProxy } from './elements-types';
|
|
11
11
|
export { getCssVar } from './get-css-var';
|
|
12
12
|
export { hotReload } from './hot-reload';
|
|
13
|
+
export { share } from './share';
|
|
13
14
|
export { xinPath, xinValue, tosiPath, tosiValue, tosiSetValue, deprecated, warnDeprecated, } from './metadata';
|
|
14
15
|
export { getListInstance, getListItem, getListBinding, deleteListItem, scrollListItemIntoView, } from './list-binding';
|
|
15
16
|
export { makeComponent } from './make-component';
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(()=>{var{defineProperty:Sn,getOwnPropertyNames:To,getOwnPropertyDescriptor:Do}=Object,Yo=Object.prototype.hasOwnProperty;var Jf=new WeakMap,$o=(n)=>{var f=Jf.get(n),o;if(f)return f;if(f=Sn({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function")To(n).map((E)=>!Yo.call(f,E)&&Sn(f,E,{get:()=>n[E],enumerable:!(o=Do(n,E))||o.enumerable}));return Jf.set(n,f),f};var Jo=(n,f)=>{for(var o in f)Sn(n,o,{get:f[o],enumerable:!0,configurable:!0,set:(E)=>f[o]=()=>E})};var fE={};Jo(fE,{xinValue:()=>Wf,xinProxy:()=>dn,xinPath:()=>zf,xin:()=>Q,warnDeprecated:()=>d,version:()=>Bn,vars:()=>qn,varDefault:()=>Cn,validateAgainstConstraints:()=>Kn,updates:()=>ff,unobserve:()=>S,touchElement:()=>sn,touch:()=>I,tosiValue:()=>F,tosiSetValue:()=>Gf,tosiPath:()=>z,tosi:()=>Dn,throttle:()=>wn,svgElements:()=>Un,settings:()=>P,scrollListItemIntoView:()=>Lo,onThemePreferencesChange:()=>vf,onStylesheetChange:()=>bf,on:()=>a,observe:()=>cn,mathML:()=>jn,makeComponent:()=>$n,invertLuminance:()=>gf,initVars:()=>pf,hotReload:()=>Ho,getThemePreferences:()=>mf,getListItem:()=>On,getListInstance:()=>An,getListBinding:()=>En,getCssVar:()=>Wn,elements:()=>T,deprecated:()=>Zn,deleteListItem:()=>mo,debounce:()=>zn,css:()=>b,boxedProxy:()=>Yn,boxed:()=>k,blueprintLoader:()=>Xo,blueprint:()=>io,bindings:()=>xn,bind:()=>A,StyleSheet:()=>Nf,MoreMath:()=>uf,Component:()=>O,Color:()=>x,BlueprintLoader:()=>Rn,Blueprint:()=>Jn});function s(n){if(n==null||typeof n!=="object")return n;if(n instanceof Set)return new Set(n);else if(Array.isArray(n))return n.map(s);let f={};for(let o in n){let E=n[o];if(n!=null&&typeof n==="object")f[o]=s(E);else f[o]=E}return f}var Vn="-xin-data",u=`.${Vn}`,un="-xin-event",Pn=`.${un}`,r=Symbol.for("xin-path"),B=Symbol.for("xin-value"),_n="xinObserve",bn="xinBind",Nn="xinOn",fn=Symbol("list-binding"),v=Symbol("list-instance"),In=new Map;function Zf(n,f){let o=In.get(n);if(o===void 0)o=new Set,In.set(n,o);o.add(f)}function Qf(n){return In.get(n)}var Ff=new Set;function d(n,f){if(!Ff.has(n))console.warn(f),Ff.add(n)}function Zn(n,f){let o=!1;return(...E)=>{if(!o)console.warn(f),o=!0;return n(...E)}}var z=(n)=>{return n&&n[r]||void 0};function F(n){if(typeof n==="object"&&n!==null){let f=n[B];return f!==void 0?f:n}return n}function Gf(n,f){if(z(n)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");n[B]=f}var zf=Zn(z,"xinPath is deprecated. Use tosiPath instead."),Wf=Zn(F,"xinValue is deprecated. Use tosiValue instead."),g=new WeakMap,K=new WeakMap;var e=(n)=>{let f=n.cloneNode();if(f instanceof Element){let o=K.get(n),E=g.get(n);if(o!=null)K.set(f,s(o));if(E!=null)g.set(f,s(E))}for(let o of Array.from(n instanceof HTMLTemplateElement?n.content.childNodes:n.childNodes))if(o instanceof Element||o instanceof DocumentFragment)f.appendChild(e(o));else f.appendChild(o.cloneNode());return f};var P={debug:!1,perf:!1};var Fo=(n)=>{try{return JSON.stringify(n)}catch(f){return"{has circular references}"}},hn=(...n)=>Error(n.map(Fo).join(" "));var Zo=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),Qo=0,Go=()=>(parseInt("10000",36)+ ++Qo).toString(36).slice(-5),zo=()=>Zo()+Go(),gn=Symbol("delete"),rf=Symbol("new-object"),pn=Symbol("automatic-index");function Uf(n){if(n==="")return[];if(Array.isArray(n))return n;else{let f=[];while(n.length>0){let o=n.search(/\[[^\]]+\]/);if(o===-1){f.push(n.split("."));break}else{let E=n.slice(0,o);if(n=n.slice(o),E!=="")f.push(E.split("."));if(o=n.indexOf("]")+1,f.push(n.slice(1,o-1)),n.slice(o,o+1)===".")o+=1;n=n.slice(o)}}return f}}var R=new WeakMap;function jf(n,f){if(R.get(n)===void 0)R.set(n,{});if(R.get(n)[f]===void 0)R.get(n)[f]={};let o=R.get(n)[f];if(f==="_auto_")n.forEach((E,M)=>{if(E[pn]===void 0)E[pn]=zo();o[E[pn]+""]=M});else n.forEach((E,M)=>{o[U(E,f)+""]=M});return o}function Wo(n,f){if(R.get(n)===void 0||R.get(n)[f]===void 0)return jf(n,f);else return R.get(n)[f]}function ko(n,f,o){o=o+"";let E=Wo(n,f)[o];if(E===void 0||U(n[E],f)+""!==o)E=jf(n,f)[o];return E}function qo(n,f,o){if(n[f]===void 0&&o!==void 0)n[f]=o;return n[f]}function Af(n,f,o,E){let M=f!==""?ko(n,f,o):o;if(E===gn)return n.splice(M,1),R.delete(n),Symbol("deleted");else if(E===rf){if(f===""&&n[M]===void 0)n[M]={}}else if(E!==void 0)if(M!==void 0)n[M]=E;else if(f!==""&&U(E,f)+""===o+"")n.push(E),M=n.length-1;else throw Error(`byIdPath insert failed at [${f}=${o}]`);return n[M]}function kf(n){if(!Array.isArray(n))throw hn("setByPath failed: expected array, found",n)}function qf(n){if(n==null||!(n instanceof Object))throw hn("setByPath failed: expected Object, found",n)}function U(n,f){let o=Uf(f),E=n,M,c,L,y;for(M=0,c=o.length;E!==void 0&&M<c;M++){let m=o[M];if(Array.isArray(m))for(L=0,y=m.length;E!==void 0&&L<y;L++){let w=m[L];E=E[w]}else if(E.length===0){if(E=E[Number(m.slice(1))],m[0]!=="=")return}else if(m.includes("=")){let[w,...C]=m.split("=");E=Af(E,w,C.join("="))}else L=parseInt(m,10),E=E[L]}return E}function Of(n,f,o){let E=n;if(f==="")throw Error("setByPath cannot be used to set the root object");let M=Uf(f);while(E!=null&&M.length>0){let c=M.shift();if(typeof c==="string"){let L=c.indexOf("=");if(L>-1){if(L===0)qf(E);else kf(E);let y=c.slice(0,L),m=c.slice(L+1);if(E=Af(E,y,m,M.length>0?rf:o),M.length===0)return!0}else{kf(E);let y=parseInt(c,10);if(M.length>0)E=E[y];else{if(o!==gn){if(E[y]===o)return!1;E[y]=o}else E.splice(y,1);return!0}}}else if(Array.isArray(c)&&c.length>0){qf(E);while(c.length>0){let L=c.shift();if(c.length>0||M.length>0)E=qo(E,L,c.length>0?{}:[]);else{if(o!==gn){if(E[L]===o)return!1;E[L]=o}else{if(!Object.prototype.hasOwnProperty.call(E,L))return!1;delete E[L]}return!0}}}else throw Error(`setByPath failed, bad path ${f}`)}throw Error(`setByPath(${n}, ${f}, ${o}) failed`)}var l={},vn=null,sf=(n)=>{vn=n},Qn=()=>{if(vn===null)throw Error("xin proxy not initialized");return vn},en=null,ln=null,Kf=(n,f)=>{en=n,ln=f},mn=()=>{if(en===null)throw Error("bind not initialized");return en},Ln=()=>{if(ln===null)throw Error("on not initialized");return ln};var Bf=Symbol("observer should be removed"),Gn=[],on=[],tn=!1,an,nf;function ro(n,f,o,E){let M=Qf(n);if(M===void 0)return[];let c=[];for(let L of M){let y=U(o,L);if(y!==void 0)c.push(`${n}[${L}=${y}]${E}`)}return c}class df{description;test;callback;constructor(n,f){let o=typeof f==="string"?`"${f}"`:`function ${f.name}`,E;if(typeof n==="string")this.test=(M)=>typeof M==="string"&&M!==""&&(n.startsWith(M)||M.startsWith(n)),E=`test = "${n}"`;else if(n instanceof RegExp)this.test=n.test.bind(n),E=`test = "${n.toString()}"`;else if(n instanceof Function)this.test=n,E=`test = function ${n.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${E}, ${o}`,typeof f==="function")this.callback=f;else throw Error("expect callback to be a path or function");Gn.push(this)}}var ff=async()=>{if(an===void 0)return;await an},Uo=()=>{if(P.perf)console.time("xin async update");let n=Array.from(on);on.length=0,tn=!1;for(let f of n)Gn.filter((o)=>{let E;try{E=o.test(f)}catch(M){throw Error(`Listener ${o.description} threw "${M}" at "${f}"`)}if(E===Bf)return S(o),!1;return E}).forEach((o)=>{let E;try{E=o.callback(f)}catch(M){console.error(`Listener ${o.description} threw "${M}" handling "${f}"`)}if(E===Bf)S(o)});if(typeof nf==="function")nf();if(P.perf)console.timeEnd("xin async update")},I=(n)=>{let f=typeof n==="string"?n:z(n);if(f===void 0)throw console.error("touch was called on an invalid target",n),Error("touch was called on an invalid target");if(tn===!1)an=new Promise((E)=>{nf=E}),tn=setTimeout(Uo);if(on.find((E)=>f.startsWith(E))==null)on.push(f);let o=f.match(/^(.+)\[(\d+)\](.*)$/);if(o!==null){let[,E,M,c]=o,L=parseInt(M,10),y=U(l,`${E}[${L}]`);if(y!=null){let m=ro(E,L,y,c);for(let w of m)if(on.find((C)=>w.startsWith(C))==null)on.push(w)}}},_=(n,f)=>{return new df(n,f)},S=(n)=>{let f=Gn.indexOf(n);if(f>-1)Gn.splice(f,1);else throw Error("unobserve failed, listener not found")};var of=(n,f)=>{let o=new Event(f);n.dispatchEvent(o)},Sf=(n)=>{if(n instanceof HTMLInputElement)return n.type;else if(n instanceof HTMLSelectElement&&n.hasAttribute("multiple"))return"multi-select";else return"other"},If=(n,f)=>{switch(Sf(n)){case"radio":n.checked=n.value===f;break;case"checkbox":n.checked=!!f;break;case"date":n.valueAsDate=new Date(f);break;case"multi-select":for(let o of Array.from(n.querySelectorAll("option")))o.selected=f[o.value];break;default:n.value=f}},Vf=(n)=>{switch(Sf(n)){case"radio":{let f=n.parentElement?.querySelector(`[name="${n.name}"]:checked`);return f!=null?f.value:null}case"checkbox":return n.checked;case"date":return n.valueAsDate?.toISOString();case"multi-select":return Array.from(n.querySelectorAll("option")).reduce((f,o)=>{return f[o.value]=o.selected,f},{});default:return n.value}},{ResizeObserver:Rf}=globalThis,yn=Rf!=null?new Rf((n)=>{for(let f of n){let o=f.target;of(o,"resize")}}):{observe(){},unobserve(){}},Ef=(n,f,o=!0)=>{if(n!=null&&f!=null)if(typeof f==="string")n.textContent=f;else if(Array.isArray(f))f.forEach((E)=>{n.append(E instanceof Node&&o?e(E):E)});else if(f instanceof Node)n.append(o?e(f):f);else throw Error("expect text content or document node")};var zn=(n,f=250)=>{let o;return(...E)=>{if(o!==void 0)clearTimeout(o);o=setTimeout(()=>{n(...E)},f)}},wn=(n,f=250)=>{let o,E=Date.now()-f,M=!1;return(...c)=>{if(clearTimeout(o),o=setTimeout(()=>{n(...c),E=Date.now()},f),!M&&Date.now()-E>=f){M=!0;try{n(...c),E=Date.now()}finally{M=!1}}}};var xn={value:{toDOM:If,fromDOM(n){return Vf(n)}},text:{toDOM(n,f){n.textContent=f}},enabled:{toDOM(n,f){n.disabled=!f}},disabled:{toDOM(n,f){n.disabled=Boolean(f)}},list:{toDOM(n,f,o){En(n,f,o).update(f)}}};function W(n){return n.replace(/[A-Z]/g,(f)=>{return`-${f.toLocaleLowerCase()}`})}function Mf(n){return n.replace(/-([a-z])/g,(f,o)=>{return o.toLocaleUpperCase()})}var jo=180/Math.PI,Ao=Math.PI/180;function j(n,f,o){return o<n?NaN:f<n?n:f>o?o:f}function V(n,f,o,E=!0){if(E)o=j(0,o,1);return o*(f-n)+n}var uf={RADIANS_TO_DEGREES:jo,DEGREES_TO_RADIANS:Ao,clamp:j,lerp:V};function Wn(n,f=document.body){let o=getComputedStyle(f);if(n.endsWith(")")&&n.startsWith("var("))n=n.slice(4,-1);return o.getPropertyValue(n).trim()}var Oo=(n,f,o)=>{return(0.299*n+0.587*f+0.114*o)/255},t=(n)=>("00"+Math.round(Number(n)).toString(16)).slice(-2);class Pf{h;s;l;constructor(n,f,o){n/=255,f/=255,o/=255;let E=Math.max(n,f,o),M=E-Math.min(n,f,o),c=M!==0?E===n?(f-o)/M:E===f?2+(o-n)/M:4+(n-f)/M:0;this.h=60*c<0?60*c+360:60*c,this.s=M!==0?E<=0.5?M/(2*E-M):M/(2-(2*E-M)):0,this.l=(2*E-M)/2}}var Mn=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;class x{r;g;b;a;static fromVar(n,f=document.body){return x.fromCss(Wn(n,f))}static fromCss(n){let f=n.match(/^#([0-9a-fA-F]+)$/);if(f){let m=f[1];if(m.length===3)return new x(parseInt(m[0]+m[0],16),parseInt(m[1]+m[1],16),parseInt(m[2]+m[2],16));if(m.length===4)return new x(parseInt(m[0]+m[0],16),parseInt(m[1]+m[1],16),parseInt(m[2]+m[2],16),parseInt(m[3]+m[3],16)/255);if(m.length===6)return new x(parseInt(m.slice(0,2),16),parseInt(m.slice(2,4),16),parseInt(m.slice(4,6),16));if(m.length===8)return new x(parseInt(m.slice(0,2),16),parseInt(m.slice(2,4),16),parseInt(m.slice(4,6),16),parseInt(m.slice(6,8),16)/255)}let o=n;if(Mn instanceof HTMLSpanElement)Mn.style.color="black",Mn.style.color=n,document.body.appendChild(Mn),o=getComputedStyle(Mn).color,Mn.remove();let[E,M,c,L]=o.match(/[\d.]+/g)||["0","0","0","0"],y=o.startsWith("color(srgb")?255:1;return new x(Number(E)*y,Number(M)*y,Number(c)*y,L==null?1:Number(L))}static fromHsl(n,f,o,E=1){let M,c,L;if(f===0)M=c=L=o;else{let m=(Y,G,H)=>{if(H<0)H+=1;if(H>1)H-=1;if(H<0.16666666666666666)return Y+(G-Y)*6*H;if(H<0.5)return G;if(H<0.6666666666666666)return Y+(G-Y)*(0.6666666666666666-H)*6;return Y},w=o<0.5?o*(1+f):o+f-o*f,C=2*o-w,i=(n%360+360)%360/360;M=m(C,w,i+0.3333333333333333),c=m(C,w,i),L=m(C,w,i-0.3333333333333333)}let y=new x(M*255,c*255,L*255,E);return y.hslCached={h:(n%360+360)%360,s:f,l:o},y}static black=new x(0,0,0);static white=new x(255,255,255);constructor(n,f,o,E=1){this.r=j(0,n,255),this.g=j(0,f,255),this.b=j(0,o,255),this.a=j(0,E,1)}get inverse(){return new x(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:n,s:f,l:o}=this._hsl;return x.fromHsl(n,f,1-o,this.a)}get opaque(){return this.a===1?this:new x(this.r,this.g,this.b,1)}contrasting(n=1){return this.opaque.blend(this.brightness>0.5?x.black:x.white,n)}get rgb(){let{r:n,g:f,b:o}=this;return`rgb(${n.toFixed(0)},${f.toFixed(0)},${o.toFixed(0)})`}get rgba(){let{r:n,g:f,b:o,a:E}=this;return`rgba(${n.toFixed(0)},${f.toFixed(0)},${o.toFixed(0)},${E.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 Pf(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:n,s:f,l:o}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(f*100).toFixed(0)}% ${(o*100).toFixed(0)}%)`}get hsla(){let{h:n,s:f,l:o}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(f*100).toFixed(0)}% ${(o*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let n=this.brightness*255;return new x(n,n,n)}get brightness(){return Oo(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+t(this.r)+t(this.g)+t(this.b):"#"+t(this.r)+t(this.g)+t(this.b)+t(Math.floor(255*this.a))}brighten(n){let{h:f,s:o,l:E}=this._hsl,M=j(0,E+n*(1-E),1);return x.fromHsl(f,o,M,this.a)}darken(n){let{h:f,s:o,l:E}=this._hsl,M=j(0,E*(1-n),1);return x.fromHsl(f,o,M,this.a)}saturate(n){let{h:f,s:o,l:E}=this._hsl,M=j(0,o+n*(1-o),1);return x.fromHsl(f,M,E,this.a)}desaturate(n){let{h:f,s:o,l:E}=this._hsl,M=j(0,o*(1-n),1);return x.fromHsl(f,M,E,this.a)}rotate(n){let{h:f,s:o,l:E}=this._hsl,M=(f+360+n)%360;return x.fromHsl(M,o,E,this.a)}opacity(n){let{h:f,s:o,l:E}=this._hsl;return x.fromHsl(f,o,E,n)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(n,f){return new x(V(this.r,n.r,f),V(this.g,n.g,f),V(this.b,n.b,f),V(this.a,n.a,f))}static blendHue(n,f,o){let E=(f-n+720)%360;if(E<180)return n+o*E;else return n-(360-E)*o}mix(n,f){let o=this._hsl,E=n._hsl;return x.fromHsl(o.s===0?E.h:E.s===0?o.h:x.blendHue(o.h,E.h,f),V(o.s,E.s,f),V(o.l,E.l,f),V(this.a,n.a,f))}colorMix(n,f){return x.fromCss(`color-mix(in hsl, ${this.html}, ${n.html} ${(f*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(n,f,o,E){if(!x.computedColors.has(n))x.computedColors.set(n,{varName:f,scale:o,method:E}),x.queueRecompute()}static queueRecompute(){if(x.recomputeQueued)return;x.recomputeQueued=!0,queueMicrotask(()=>{x.recomputeQueued=!1,x.recomputeColors()})}static recomputeColors(){if(x.computedColors.size===0)return;let n=[];for(let[o,{varName:E,scale:M,method:c}]of x.computedColors)try{let L=x.fromVar(E),y;switch(c){case"b":y=M>0?L.brighten(M):L.darken(-M);break;case"s":y=M>0?L.saturate(M):L.desaturate(-M);break;case"h":y=L.rotate(M*100);break;case"o":y=L.opacity(M);break;default:continue}n.push(` ${o}: ${y.rgba};`)}catch(L){}if(n.length===0)return;let f=`:root {
|
|
1
|
+
(()=>{var{defineProperty:dn,getOwnPropertyNames:kE,getOwnPropertyDescriptor:UE}=Object,qE=Object.prototype.hasOwnProperty;function jE(n){return this[n]}var OE=(n)=>{var f=(Uf??=new WeakMap).get(n),E;if(f)return f;if(f=dn({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function"){for(var o of kE(n))if(!qE.call(f,o))dn(f,o,{get:jE.bind(n,o),enumerable:!(E=UE(n,o))||E.enumerable})}return Uf.set(n,f),f},Uf;var AE=(n)=>n;function KE(n,f){this[n]=AE.bind(null,f)}var BE=(n,f)=>{for(var E in f)dn(n,E,{get:f[E],enumerable:!0,configurable:!0,set:KE.bind(f,E)})};var Wo={};BE(Wo,{xinValue:()=>Bf,xinProxy:()=>_n,xinPath:()=>Kf,xin:()=>G,warnDeprecated:()=>r,version:()=>un,vars:()=>An,varDefault:()=>Yn,validateAgainstConstraints:()=>sn,updates:()=>xn,unobserve:()=>_,touchElement:()=>Sn,touch:()=>A,tosiValue:()=>F,tosiSetValue:()=>Af,tosiPath:()=>Q,tosi:()=>Zn,throttle:()=>Xn,svgElements:()=>Bn,share:()=>GE,settings:()=>P,scrollListItemIntoView:()=>TE,onThemePreferencesChange:()=>EE,onStylesheetChange:()=>ef,on:()=>nn,observe:()=>cn,mathML:()=>Vn,makeComponent:()=>Gn,invertLuminance:()=>fE,initVars:()=>nE,hotReload:()=>JE,getThemePreferences:()=>Cf,getListItem:()=>Rn,getListInstance:()=>In,getListBinding:()=>Ln,getCssVar:()=>jn,elements:()=>i,deprecated:()=>kn,deleteListItem:()=>XE,debounce:()=>mn,css:()=>p,boxedProxy:()=>Qn,boxed:()=>q,blueprintLoader:()=>WE,blueprint:()=>zE,bindings:()=>Tn,bind:()=>B,StyleSheet:()=>tf,MoreMath:()=>hf,Component:()=>I,Color:()=>C,BlueprintLoader:()=>bn,Blueprint:()=>zn});function R(n){if(n==null||typeof n!=="object")return n;if(n instanceof Set)return new Set(n);else if(Array.isArray(n))return n.map(R);let f={};for(let E in n){let o=n[E];if(n!=null&&typeof n==="object")f[E]=R(o);else f[E]=o}return f}var Nn="-xin-data",d=`.${Nn}`,pn="-xin-event",gn=`.${pn}`,O=Symbol.for("xin-path"),s=Symbol.for("xin-value"),hn="xinObserve",vn="xinBind",ln="xinOn",on=Symbol("list-binding"),e=Symbol("list-instance"),Pn=new Map;function jf(n,f){let E=Pn.get(n);if(E===void 0)E=new Set,Pn.set(n,E);E.add(f)}function Of(n){return Pn.get(n)}var qf=new Set;function r(n,f){if(!qf.has(n))console.warn(f),qf.add(n)}function kn(n,f){let E=!1;return(...o)=>{if(!E)console.warn(f),E=!0;return n(...o)}}var Q=(n)=>{return n&&n[O]||void 0};function F(n){if(typeof n==="object"&&n!==null){let f=n[s];return f!==void 0?f:n}return n}function Af(n,f){if(Q(n)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");n[s]=f}var Kf=kn(Q,"xinPath is deprecated. Use tosiPath instead."),Bf=kn(F,"xinValue is deprecated. Use tosiValue instead."),l=new WeakMap,S=new WeakMap;var t=(n)=>{let f=n.cloneNode();if(f instanceof Element){let E=S.get(n),o=l.get(n);if(E!=null)S.set(f,R(E));if(o!=null)l.set(f,R(o))}for(let E of Array.from(n instanceof HTMLTemplateElement?n.content.childNodes:n.childNodes))if(E instanceof Element||E instanceof DocumentFragment)f.appendChild(t(E));else f.appendChild(E.cloneNode());return f};var P={debug:!1,perf:!1};var VE=(n)=>{try{return JSON.stringify(n)}catch(f){return"{has circular references}"}},en=(...n)=>Error(n.map(VE).join(" "));var IE=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),RE=0,SE=()=>(parseInt("10000",36)+ ++RE).toString(36).slice(-5),sE=()=>IE()+SE(),an=Symbol("delete"),Rf=Symbol("new-object"),tn=Symbol("automatic-index");function Sf(n){if(n==="")return[];if(Array.isArray(n))return n;else{let f=[];while(n.length>0){let E=n.search(/\[[^\]]+\]/);if(E===-1){f.push(n.split("."));break}else{let o=n.slice(0,E);if(n=n.slice(E),o!=="")f.push(o.split("."));if(E=n.indexOf("]")+1,f.push(n.slice(1,E-1)),n.slice(E,E+1)===".")E+=1;n=n.slice(E)}}return f}}var u=new WeakMap;function sf(n,f){if(u.get(n)===void 0)u.set(n,{});if(u.get(n)[f]===void 0)u.get(n)[f]={};let E=u.get(n)[f];if(f==="_auto_")n.forEach((o,M)=>{if(o[tn]===void 0)o[tn]=sE();E[o[tn]+""]=M});else n.forEach((o,M)=>{E[W(o,f)+""]=M});return E}function rE(n,f){if(u.get(n)===void 0||u.get(n)[f]===void 0)return sf(n,f);else return u.get(n)[f]}function uE(n,f,E){E=E+"";let o=rE(n,f)[E];if(o===void 0||W(n[o],f)+""!==E)o=sf(n,f)[E];return o}function _E(n,f,E){if(n[f]===void 0&&E!==void 0)n[f]=E;return n[f]}function rf(n,f,E,o){let M=f!==""?uE(n,f,E):E;if(o===an)return n.splice(M,1),u.delete(n),Symbol("deleted");else if(o===Rf){if(f===""&&n[M]===void 0)n[M]={}}else if(o!==void 0)if(M!==void 0)n[M]=o;else if(f!==""&&W(o,f)+""===E+"")n.push(o),M=n.length-1;else throw Error(`byIdPath insert failed at [${f}=${E}]`);return n[M]}function Vf(n){if(!Array.isArray(n))throw en("setByPath failed: expected array, found",n)}function If(n){if(n==null||!(n instanceof Object))throw en("setByPath failed: expected Object, found",n)}function W(n,f){let E=Sf(f),o=n,M,m,c,w;for(M=0,m=E.length;o!==void 0&&M<m;M++){let L=E[M];if(Array.isArray(L))for(c=0,w=L.length;o!==void 0&&c<w;c++){let y=L[c];o=o[y]}else if(o.length===0){if(o=o[Number(L.slice(1))],L[0]!=="=")return}else if(L.includes("=")){let[y,...x]=L.split("=");o=rf(o,y,x.join("="))}else c=parseInt(L,10),o=o[c]}return o}function wn(n,f,E){let o=n;if(f==="")throw Error("setByPath cannot be used to set the root object");let M=Sf(f);while(o!=null&&M.length>0){let m=M.shift();if(typeof m==="string"){let c=m.indexOf("=");if(c>-1){if(c===0)If(o);else Vf(o);let w=m.slice(0,c),L=m.slice(c+1);if(o=rf(o,w,L,M.length>0?Rf:E),M.length===0)return!0}else{Vf(o);let w=parseInt(m,10);if(M.length>0)o=o[w];else{if(E!==an){if(o[w]===E)return!1;o[w]=E}else o.splice(w,1);return!0}}}else if(Array.isArray(m)&&m.length>0){If(o);while(m.length>0){let c=m.shift();if(m.length>0||M.length>0)o=_E(o,c,m.length>0?{}:[]);else{if(E!==an){if(o[c]===E)return!1;o[c]=E}else{if(!Object.prototype.hasOwnProperty.call(o,c))return!1;delete o[c]}return!0}}}else throw Error(`setByPath failed, bad path ${f}`)}throw Error(`setByPath(${n}, ${f}, ${E}) failed`)}var k={},nf=null,uf=(n)=>{nf=n},Un=()=>{if(nf===null)throw Error("xin proxy not initialized");return nf},ff=null,Ef=null,_f=(n,f)=>{ff=n,Ef=f},yn=()=>{if(ff===null)throw Error("bind not initialized");return ff},Cn=()=>{if(Ef===null)throw Error("on not initialized");return Ef};var bf=Symbol("observer should be removed"),qn=[],Mn=[],of=!1,Mf,mf;function bE(n,f,E,o){let M=Of(n);if(M===void 0)return[];let m=[];for(let c of M){let w=W(E,c);if(w!==void 0)m.push(`${n}[${c}=${w}]${o}`)}return m}class df{description;test;callback;constructor(n,f){let E=typeof f==="string"?`"${f}"`:`function ${f.name}`,o;if(typeof n==="string")this.test=(M)=>typeof M==="string"&&M!==""&&(n.startsWith(M)||M.startsWith(n)),o=`test = "${n}"`;else if(n instanceof RegExp)this.test=n.test.bind(n),o=`test = "${n.toString()}"`;else if(n instanceof Function)this.test=n,o=`test = function ${n.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${o}, ${E}`,typeof f==="function")this.callback=f;else throw Error("expect callback to be a path or function");qn.push(this)}}var xn=async()=>{if(Mf===void 0)return;await Mf},dE=()=>{if(P.perf)console.time("xin async update");let n=Array.from(Mn);Mn.length=0,of=!1;for(let f of n)qn.filter((E)=>{let o;try{o=E.test(f)}catch(M){throw Error(`Listener ${E.description} threw "${M}" at "${f}"`)}if(o===bf)return _(E),!1;return o}).forEach((E)=>{let o;try{o=E.callback(f)}catch(M){console.error(`Listener ${E.description} threw "${M}" handling "${f}"`)}if(o===bf)_(E)});if(typeof mf==="function")mf();if(P.perf)console.timeEnd("xin async update")},A=(n)=>{let f=typeof n==="string"?n:Q(n);if(f===void 0)throw console.error("touch was called on an invalid target",n),Error("touch was called on an invalid target");if(of===!1)Mf=new Promise((o)=>{mf=o}),of=setTimeout(dE);if(Mn.find((o)=>f.startsWith(o))==null)Mn.push(f);let E=f.match(/^(.+)\[(\d+)\](.*)$/);if(E!==null){let[,o,M,m]=E,c=parseInt(M,10),w=W(k,`${o}[${c}]`);if(w!=null){let L=bE(o,c,w,m);for(let y of L)if(Mn.find((x)=>y.startsWith(x))==null)Mn.push(y)}}},V=(n,f)=>{return new df(n,f)},_=(n)=>{let f=qn.indexOf(n);if(f>-1)qn.splice(f,1);else throw Error("unobserve failed, listener not found")};var Lf=(n,f)=>{let E=new Event(f);n.dispatchEvent(E)},Nf=(n)=>{if(n instanceof HTMLInputElement)return n.type;else if(n instanceof HTMLSelectElement&&n.hasAttribute("multiple"))return"multi-select";else return"other"},pf=(n,f)=>{switch(Nf(n)){case"radio":n.checked=n.value===f;break;case"checkbox":n.checked=!!f;break;case"date":n.valueAsDate=new Date(f);break;case"multi-select":for(let E of Array.from(n.querySelectorAll("option")))E.selected=f[E.value];break;default:n.value=f}},gf=(n)=>{switch(Nf(n)){case"radio":{let f=n.parentElement?.querySelector(`[name="${n.name}"]:checked`);return f!=null?f.value:null}case"checkbox":return n.checked;case"date":return n.valueAsDate?.toISOString();case"multi-select":return Array.from(n.querySelectorAll("option")).reduce((f,E)=>{return f[E.value]=E.selected,f},{});default:return n.value}},{ResizeObserver:Pf}=globalThis,Hn=Pf!=null?new Pf((n)=>{for(let f of n){let E=f.target;Lf(E,"resize")}}):{observe(){},unobserve(){}},cf=(n,f,E=!0)=>{if(n!=null&&f!=null)if(typeof f==="string")n.textContent=f;else if(Array.isArray(f))f.forEach((o)=>{n.append(o instanceof Node&&E?t(o):o)});else if(f instanceof Node)n.append(E?t(f):f);else throw Error("expect text content or document node")};var mn=(n,f=250)=>{let E;return(...o)=>{if(E!==void 0)clearTimeout(E);E=setTimeout(()=>{n(...o)},f)}},Xn=(n,f=250)=>{let E,o=Date.now()-f,M=!1;return(...m)=>{if(clearTimeout(E),E=setTimeout(()=>{n(...m),o=Date.now()},f),!M&&Date.now()-o>=f){M=!0;try{n(...m),o=Date.now()}finally{M=!1}}}};var Tn={value:{toDOM:pf,fromDOM(n){return gf(n)}},text:{toDOM(n,f){n.textContent=f}},enabled:{toDOM(n,f){n.disabled=!f}},disabled:{toDOM(n,f){n.disabled=Boolean(f)}},list:{toDOM(n,f,E){Ln(n,f,E).update(f)}}};function U(n){return n.replace(/[A-Z]/g,(f)=>{return`-${f.toLocaleLowerCase()}`})}function wf(n){return n.replace(/-([a-z])/g,(f,E)=>{return E.toLocaleUpperCase()})}var PE=180/Math.PI,NE=Math.PI/180;function K(n,f,E){return E<n?NaN:f<n?n:f>E?E:f}function b(n,f,E,o=!0){if(o)E=K(0,E,1);return E*(f-n)+n}var hf={RADIANS_TO_DEGREES:PE,DEGREES_TO_RADIANS:NE,clamp:K,lerp:b};function jn(n,f=document.body){let E=getComputedStyle(f);if(n.endsWith(")")&&n.startsWith("var("))n=n.slice(4,-1);return E.getPropertyValue(n).trim()}var pE=(n,f,E)=>{return(0.299*n+0.587*f+0.114*E)/255},a=(n)=>("00"+Math.round(Number(n)).toString(16)).slice(-2);class vf{h;s;l;constructor(n,f,E){n/=255,f/=255,E/=255;let o=Math.max(n,f,E),M=o-Math.min(n,f,E),m=M!==0?o===n?(f-E)/M:o===f?2+(E-n)/M:4+(n-f)/M:0;this.h=60*m<0?60*m+360:60*m,this.s=M!==0?o<=0.5?M/(2*o-M):M/(2-(2*o-M)):0,this.l=(2*o-M)/2}}var N=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;if(N)N.style.display="none";class C{r;g;b;a;static fromVar(n,f=document.body){return C.fromCss(jn(n,f))}static fromCss(n){let f=n.match(/^#([0-9a-fA-F]+)$/);if(f){let L=f[1];if(L.length===3)return new C(parseInt(L[0]+L[0],16),parseInt(L[1]+L[1],16),parseInt(L[2]+L[2],16));if(L.length===4)return new C(parseInt(L[0]+L[0],16),parseInt(L[1]+L[1],16),parseInt(L[2]+L[2],16),parseInt(L[3]+L[3],16)/255);if(L.length===6)return new C(parseInt(L.slice(0,2),16),parseInt(L.slice(2,4),16),parseInt(L.slice(4,6),16));if(L.length===8)return new C(parseInt(L.slice(0,2),16),parseInt(L.slice(2,4),16),parseInt(L.slice(4,6),16),parseInt(L.slice(6,8),16)/255)}let E=n;if(N instanceof HTMLSpanElement)N.style.color="black",N.style.color=n,document.body.appendChild(N),E=getComputedStyle(N).color,N.remove();let[o,M,m,c]=E.match(/[\d.]+/g)||["0","0","0","0"],w=E.startsWith("color(srgb")?255:1;return new C(Number(o)*w,Number(M)*w,Number(m)*w,c==null?1:Number(c))}static fromHsl(n,f,E,o=1){let M,m,c;if(f===0)M=m=c=E;else{let L=($,z,H)=>{if(H<0)H+=1;if(H>1)H-=1;if(H<0.16666666666666666)return $+(z-$)*6*H;if(H<0.5)return z;if(H<0.6666666666666666)return $+(z-$)*(0.6666666666666666-H)*6;return $},y=E<0.5?E*(1+f):E+f-E*f,x=2*E-y,X=(n%360+360)%360/360;M=L(x,y,X+0.3333333333333333),m=L(x,y,X),c=L(x,y,X-0.3333333333333333)}let w=new C(M*255,m*255,c*255,o);return w.hslCached={h:(n%360+360)%360,s:f,l:E},w}static black=new C(0,0,0);static white=new C(255,255,255);constructor(n,f,E,o=1){this.r=K(0,n,255),this.g=K(0,f,255),this.b=K(0,E,255),this.a=K(0,o,1)}get inverse(){return new C(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:n,s:f,l:E}=this._hsl;return C.fromHsl(n,f,1-E,this.a)}get opaque(){return this.a===1?this:new C(this.r,this.g,this.b,1)}contrasting(n=1){return this.opaque.blend(this.brightness>0.5?C.black:C.white,n)}get rgb(){let{r:n,g:f,b:E}=this;return`rgb(${n.toFixed(0)},${f.toFixed(0)},${E.toFixed(0)})`}get rgba(){let{r:n,g:f,b:E,a:o}=this;return`rgba(${n.toFixed(0)},${f.toFixed(0)},${E.toFixed(0)},${o.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 vf(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:n,s:f,l:E}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(f*100).toFixed(0)}% ${(E*100).toFixed(0)}%)`}get hsla(){let{h:n,s:f,l:E}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(f*100).toFixed(0)}% ${(E*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let n=this.brightness*255;return new C(n,n,n)}get brightness(){return pE(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+a(this.r)+a(this.g)+a(this.b):"#"+a(this.r)+a(this.g)+a(this.b)+a(Math.floor(255*this.a))}brighten(n){let{h:f,s:E,l:o}=this._hsl,M=K(0,o+n*(1-o),1);return C.fromHsl(f,E,M,this.a)}darken(n){let{h:f,s:E,l:o}=this._hsl,M=K(0,o*(1-n),1);return C.fromHsl(f,E,M,this.a)}saturate(n){let{h:f,s:E,l:o}=this._hsl,M=K(0,E+n*(1-E),1);return C.fromHsl(f,M,o,this.a)}desaturate(n){let{h:f,s:E,l:o}=this._hsl,M=K(0,E*(1-n),1);return C.fromHsl(f,M,o,this.a)}rotate(n){let{h:f,s:E,l:o}=this._hsl,M=(f+360+n)%360;return C.fromHsl(M,E,o,this.a)}opacity(n){let{h:f,s:E,l:o}=this._hsl;return C.fromHsl(f,E,o,n)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(n,f){return new C(b(this.r,n.r,f),b(this.g,n.g,f),b(this.b,n.b,f),b(this.a,n.a,f))}static blendHue(n,f,E){let o=(f-n+720)%360;if(o<180)return n+E*o;else return n-(360-o)*E}mix(n,f){let E=this._hsl,o=n._hsl;return C.fromHsl(E.s===0?o.h:o.s===0?E.h:C.blendHue(E.h,o.h,f),b(E.s,o.s,f),b(E.l,o.l,f),b(this.a,n.a,f))}colorMix(n,f){return C.fromCss(`color-mix(in hsl, ${this.html}, ${n.html} ${(f*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(n,f,E,o){if(!C.computedColors.has(n))C.computedColors.set(n,{varName:f,scale:E,method:o}),C.queueRecompute()}static queueRecompute(){if(C.recomputeQueued)return;C.recomputeQueued=!0,queueMicrotask(()=>{C.recomputeQueued=!1,C.recomputeColors()})}static recomputeColors(){if(C.computedColors.size===0)return;let n=[];for(let[E,{varName:o,scale:M,method:m}]of C.computedColors)try{let c=C.fromVar(o),w;switch(m){case"b":w=M>0?c.brighten(M):c.darken(-M);break;case"s":w=M>0?c.saturate(M):c.desaturate(-M);break;case"h":w=c.rotate(M*100);break;case"o":w=c.opacity(M);break;default:continue}n.push(` ${E}: ${w.rgba};`)}catch(c){}if(n.length===0)return;let f=`:root {
|
|
2
2
|
${n.join(`
|
|
3
3
|
`)}
|
|
4
|
-
}`;if(
|
|
5
|
-
`);return`${
|
|
4
|
+
}`;if(C.computedColorStylesheet===null)C.computedColorStylesheet=document.createElement("style"),C.computedColorStylesheet.id="tosijs-computed-colors",document.head.append(C.computedColorStylesheet);C.computedColorStylesheet.textContent=f}}var On=new Set,lf=!1;function gE(){if(!lf)lf=!0,On.add(()=>C.queueRecompute())}function ef(n){return On.add(n),()=>On.delete(n)}function hE(){gE();for(let n of On)n()}function tf(n,f){let E=F(f),o=i.style(p(E));o.id=n,document.head.append(o);let M=Q(f);if(M!==void 0)cn(M,()=>{o.textContent=p(F(f)),hE()})}var vE=/^(animation-iteration-count|column-count|flex(-grow|-shrink)?|font-weight|line-height|opacity|order|orphans|scale|tab-size|widows|z-index|zoom)$/,yf=(n,f)=>{if(typeof f==="number"&&!vE.test(n))f=`${f}px`;if(n.startsWith("_"))if(n.startsWith("__"))n="--"+n.substring(2),f=`var(${n}-default, ${f})`;else n="--"+n.substring(1);return{prop:n,value:String(f)}},lE=(n,f,E)=>{if(E===void 0)return"";if(E instanceof C)E=E.html;let o=yf(f,E);return`${n} ${o.prop}: ${o.value};`},af=(n,f,E="")=>{let o=U(n);if(typeof f==="object"&&!(f instanceof C)){let M=Object.keys(f).map((m)=>af(m,f[m],`${E} `)).join(`
|
|
5
|
+
`);return`${E} ${n} {
|
|
6
6
|
${M}
|
|
7
|
-
${
|
|
8
|
-
`);return`${f}${
|
|
9
|
-
${
|
|
7
|
+
${E} }`}else return lE(E,o,f)},p=(n,f="")=>{return Object.keys(n).map((o)=>{let M=n[o];if(typeof M==="string"){if(o==="@import")return`@import url('${M}');`;throw Error("top-level string value only allowed for `@import`")}let m=Object.keys(M).map((c)=>af(c,M[c])).join(`
|
|
8
|
+
`);return`${f}${o} {
|
|
9
|
+
${m}
|
|
10
10
|
}`}).join(`
|
|
11
11
|
|
|
12
|
-
`)},pf=(n)=>{d("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let f={};for(let o of Object.keys(n)){let E=n[o],M=W(o);f[`--${M}`]=typeof E==="number"&&E!==0?String(E)+"px":E}return f},gf=(n)=>{let f={};for(let o of Object.keys(n)){let E=n[o];if(E instanceof x)f[o]=E.inverseLuminance;else if(typeof E==="string"&&E.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))f[o]=x.fromCss(E).inverseLuminance}return f},Cn=new Proxy({},{get(n,f){if(n[f]===void 0){let o="--"+W(f);n[f]=(E)=>`var(${o}, ${E})`}return n[f]}}),qn=new Proxy({},{get(n,f){if(f==="default")return Cn;if(n[f]==null){f=W(f);let[,o,,E,M,c]=f.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",f],L=`--${o}`;if(M!=null){let y=E==null?Number(M)/100:-Number(M)/100;switch(c){case"b":case"s":case"h":case"o":{let m=`--${f}`;x.registerComputedColor(m,L,y,c),n[f]=`var(${m})`}break;case"":n[f]=`calc(var(${L}) * ${y})`;break;default:throw console.error(c),Error(`Unrecognized method ${c} for css variable ${L}`)}}else n[f]=`var(${L})`}return n[f]}});function mf(){let n=(f)=>typeof matchMedia<"u"&&matchMedia(f).matches;return{colorScheme:n("(prefers-color-scheme: dark)")?"dark":"light",contrast:n("(prefers-contrast: more)")?"more":n("(prefers-contrast: less)")?"less":n("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:n("(prefers-reduced-motion: reduce)"),reducedTransparency:n("(prefers-reduced-transparency: reduce)"),forcedColors:n("(forced-colors: active)")}}function vf(n){if(typeof matchMedia>"u")return()=>{};let f=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],o=()=>n(mf()),E=f.map((M)=>matchMedia(M));for(let M of E)M.addEventListener("change",o);return()=>{for(let M of E)M.removeEventListener("change",o)}}var ef="http://www.w3.org/1998/Math/MathML",lf="http://www.w3.org/2000/svg";var rn={},tf=(n,f,o)=>{let E=cf(W(f),o);if(E.prop.startsWith("--"))n.style.setProperty(E.prop,E.value);else n.style[f]=E.value},So=(n)=>{return{toDOM(f,o){tf(f,n,o)}}},af=(n,f,o)=>{if(f==="style")if(typeof o==="object")for(let E of Object.keys(o))if(z(o[E]))A(n,o[E],So(E));else tf(n,E,o[E]);else n.setAttribute("style",o);else{let E=W(f),M=n.constructor.observedAttributes;if(M?.includes(f)||M?.includes(E))if(typeof o==="boolean")o?n.setAttribute(E,""):n.removeAttribute(E);else n.setAttribute(E,o);else if(n[f]!==void 0){let{MathMLElement:L}=globalThis;if(n instanceof SVGElement||L!==void 0&&n instanceof L)n.setAttribute(f,o);else n[f]=o}else if(E==="class")o.split(" ").forEach((L)=>{n.classList.add(L)});else if(n[E]!==void 0)n[E]=o;else if(typeof o==="boolean")o?n.setAttribute(E,""):n.removeAttribute(E);else n.setAttribute(E,o)}},Lf={},Io=(n)=>{if(!Lf[n])Lf[n]={toDOM(f,o){af(f,n,o)}};return Lf[n]},Vo=(n,f,o)=>{if(f==="apply")o(n);else if(f.match(/^on[A-Z]/)!=null){let E=f.substring(2).toLowerCase();a(n,E,o)}else if(f==="bind")if((typeof o.binding==="string"?xn[o.binding]:o.binding)!==void 0&&o.value!==void 0)A(n,o.value,o.binding instanceof Function?{toDOM:o.binding}:o.binding);else throw Error("bad binding");else if(f.match(/^bind[A-Z]/)!=null){let E=f.substring(4,5).toLowerCase()+f.substring(5),M=xn[E];if(M!==void 0)A(n,o,M);else throw Error(`${f} is not allowed, bindings.${E} is not defined`)}else if(z(o))A(n,o,Io(f));else af(n,f,o)},yf=(n,...f)=>{if(rn[n]===void 0){let[M,c]=n.split("|");if(c===void 0)rn[n]=globalThis.document.createElement(M);else rn[n]=globalThis.document.createElementNS(c,M)}let o=rn[n].cloneNode(),E={};for(let M of f)if(M instanceof Element||M instanceof DocumentFragment||typeof M==="string"||typeof M==="number")if(o instanceof HTMLTemplateElement)o.content.append(M);else o.append(M);else if(z(M))o.append(T.span({bindText:M}));else Object.assign(E,M);for(let M of Object.keys(E)){let c=E[M];Vo(o,M,c)}return o},wf=(...n)=>{let f=globalThis.document.createDocumentFragment();for(let o of n)f.append(o);return f},T=new Proxy({fragment:wf},{get(n,f){if(f=f.replace(/[A-Z]/g,(o)=>`-${o.toLocaleLowerCase()}`),n[f]===void 0)n[f]=(...o)=>yf(f,...o);return n[f]},set(){throw Error("You may not add new properties to elements")}}),Un=new Proxy({fragment:wf},{get(n,f){if(n[f]===void 0)n[f]=(...o)=>yf(`${f}|${lf}`,...o);return n[f]},set(){throw Error("You may not add new properties to elements")}}),jn=new Proxy({fragment:wf},{get(n,f){if(n[f]===void 0)n[f]=(...o)=>yf(`${f}|${ef}`,...o);return n[f]},set(){throw Error("You may not add new properties to elements")}});var uo=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],Po=!0,_o=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,bo=(n)=>_o.test(n),N=(n="",f="")=>{if(n==="")return f;else if(f.match(/^\d+$/)!==null||f.includes("="))return`${n}[${f}]`;else return`${n}.${f}`},Eo={};function xf(n,f){if(n!==null&&(typeof n==="object"||typeof n==="function"))return n;return new Proxy(Eo,h(f,!0))}var Hn=()=>new Proxy({},h("^",!0)),Cf=(n)=>{let o=n(Hn())?.path;if(!o?.startsWith("^."))throw Error("selector must return a property of the item");return o.substring(2)},Hf=(n,f,o)=>{for(let E=0;E<n.length;E++)if(`${U(n[E],f)}`===`${o}`)return E;return-1},no=(n,f)=>({listFind(o,E){if(o instanceof Element){let L=o;while(L&&!L[v]&&L.parentElement)L=L.parentElement;let y=L?.[v];if(y==null)return;let m=f.indexOf(y);return m!==-1?k[n][m]:void 0}let M=Cf(o),c=Hf(f,M,E);return c!==-1?k[n][c]:void 0},listUpdate(o,E){let M=Cf(o),c=U(E,M),L=Hf(f,M,c);if(L!==-1){let y=k[n][L];for(let m of Object.keys(E))y[m]=E[m];return y}return k[n].push(E),k[n][f.length-1]},listRemove(o,E){let M=Cf(o),c=Hf(f,M,E);if(c===-1)return!1;return k[n].splice(c,1),!0}}),fo=!1;function nn(){if(!fo)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),fo=!0}var oo=(n)=>{return n===Eo},h=(n,f)=>({get(o,E){if(oo(o)){let y=()=>U(l,n);switch(E){case"path":return n;case"value":return y();case"valueOf":case"toJSON":return()=>y();case Symbol.toPrimitive:return(m)=>{let w=y();if(m==="number")return Number(w);if(m==="string")return String(w);return w};case"toString":return()=>String(y());case"touch":return()=>I(n);case"observe":return(m)=>{let w=_(n,m);return()=>S(w)};case"on":return(m,w)=>Ln()(m,w,y());case"bind":return(m,w,C)=>{mn()(m,n,w,C)};case"binding":return(m)=>({bind:{value:n,binding:m}});case"listBinding":return(m=({span:C})=>C({bindText:"^"}),w={})=>[{bindList:{value:n,...w}},T.template(m(T,Hn()))];case"listFind":case"listUpdate":case"listRemove":return no(n,o)[E];case B:case"xinValue":case"tosiValue":return nn(),y();case r:case"xinPath":case"tosiPath":return nn(),n;case _n:case"tosiObserve":return nn(),(m)=>{let w=_(n,m);return()=>S(w)};case Nn:case"tosiOn":return nn(),(m,w)=>Ln()(m,w,y());case bn:case"tosiBind":return nn(),(m,w,C)=>{mn()(m,n,w,C)};case"tosiBinding":return nn(),(m)=>({bind:{value:n,binding:m}});case"tosiListBinding":return nn(),(m=({span:C})=>C({bindText:"^"}),w={})=>[{bindList:{value:n,...w}},T.template(m(T,Hn()))]}if(typeof E==="string"&&/^\d+$/.test(E)){let m=y();if(typeof m==="string")return m[parseInt(E,10)]}if(E==="length"){let m=y();if(typeof m==="string")return m.length}return}if(f&&!(E in o))switch(E){case"path":return n;case"value":return o.valueOf?o.valueOf():o;case"valueOf":case"toJSON":return()=>o.valueOf?o.valueOf():o;case"touch":return()=>I(n);case"observe":return(y)=>{let m=_(n,y);return()=>S(m)};case"on":return(y,m)=>Ln()(y,m,F(o));case"bind":return(y,m,w)=>{mn()(y,n,m,w)};case"binding":return(y)=>({bind:{value:n,binding:y}});case"listBinding":return(y=({span:w})=>w({bindText:"^"}),m={})=>[{bindList:{value:n,...m}},T.template(y(T,Hn()))];case"listFind":case"listUpdate":case"listRemove":return no(n,o)[E]}switch(E){case r:case"xinPath":case"tosiPath":return n;case B:case"xinValue":case"tosiValue":return o.valueOf?o.valueOf():o;case _n:case"xinObserve":case"tosiObserve":return(y)=>{let m=_(n,y);return()=>S(m)};case Nn:case"xinOn":case"tosiOn":return(y,m)=>Ln()(y,m,F(o));case bn:case"xinBind":case"tosiBind":return(y,m,w)=>{mn()(y,n,m,w)};case"tosiBinding":return(y)=>({bind:{value:n,binding:y}});case"tosiListBinding":return(y=({span:w})=>w({bindText:"^"}),m={})=>[{bindList:{value:n,...m}},T.template(y(T,Hn()))]}if(typeof E==="symbol")return o[E];let M=Object.getOwnPropertyDescriptor(o,E);if(M&&!M.configurable&&!M.writable&&"value"in M)return M.value;let c=E,L=c.match(/^([^.[]+)\.(.+)$/)??c.match(/^([^\]]+)(\[.+)/)??c.match(/^(\[[^\]]+\])\.(.+)$/)??c.match(/^(\[[^\]]+\])\[(.+)$/);if(L!==null){let[,y,m]=L,w=N(n,y),C=U(o,y);return C!==null&&typeof C==="object"?new Proxy(C,h(w,f))[m]:C}if(c.startsWith("[")&&c.endsWith("]"))c=c.substring(1,c.length-1);if(!Array.isArray(o)&&o[c]!==void 0||Array.isArray(o)&&c.includes("=")){let y;if(c.includes("=")){let[m,w]=c.split("=");y=o.find((C)=>`${U(C,m)}`===w)}else y=o[c];if(y instanceof Object){let m=N(n,c);return new Proxy(y instanceof Function?y.bind(o):y,h(m,f))}else return f?xf(y,N(n,c)):y}else if(Array.isArray(o)){let y=o[c];return typeof y==="function"?(...m)=>{let w=m.map((i)=>F(i)),C=y.apply(o,w);if(uo.includes(c))I(n);if(C!=null&&typeof C==="object"){if(c==="find"||c==="findLast"||c==="at"){let i=o.indexOf(C);if(i!==-1)return new Proxy(C,h(N(n,String(i)),f))}}return C}:typeof y==="object"?new Proxy(y,h(N(n,c),f)):f?xf(y,N(n,c)):y}else return f?xf(o[c],N(n,c)):o[c]},set(o,E,M){M=F(M);let L=E===B||E==="xinValue"||E==="tosiValue"||E==="value"&&(oo(o)||f)?n:N(n,E);if(Po&&!bo(L))throw Error(`setting invalid path ${L}`);if(F(Q[L])!==M&&Of(l,L,M))I(L);return!0}}),cn=(n,f)=>{let o=typeof f==="function"?f:Q[f];if(typeof o!=="function")throw Error(`observe expects a function or path to a function, ${f} is neither`);return _(n,o)},Q=new Proxy(l,h("",!1));sf(Q);var k=new Proxy(l,h("",!0));var No=16,ho=100;function Mo(n,f){let o=Array.from(n.querySelectorAll(u));if(n.matches(u))o.unshift(n);for(let E of o){let M=K.get(E);for(let c of M){if(c.path.startsWith("^"))c.path=`${f}${c.path.substring(1)}`;if(c.binding.toDOM!=null)c.binding.toDOM(E,Q[c.path])}}}class co{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_filteredCache;_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(n,f,o={}){if(this.boundElement=n,this.itemToElement=new WeakMap,o.idPath!=null){let E=z(f);if(E!=null)Zf(E,o.idPath)}if(n.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(n.children[0]instanceof HTMLTemplateElement){let E=n.children[0];if(E.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=e(E.content.children[0])}else this.template=n.children[0],this.template.remove();if(this.options=o,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),this.boundElement[fn]=this,o.virtual!=null)if(yn.observe(this.boundElement),this._update=wn(()=>{this.update(this.array,!0)},No),this.boundElement.addEventListener("resize",this._update),o.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:n,visibleProp:f}=this.options,o=this.array;if(n!==void 0)o=o.filter((E)=>E[n]!==!0);if(f!==void 0)o=o.filter((E)=>E[f]===!0);if(this.options.filter&&this.needle!==void 0)o=this.options.filter(o,this.needle);return this._filteredCache=o,o}visibleSlice(){let{virtual:n}=this.options,f=this.filteredArray(),o=0,E=f.length-1,M=0,c=0;if(n!=null&&this.boundElement instanceof HTMLElement){let L=this.boundElement.offsetWidth,y=n.scrollContainer==="window",m,w;if(y){m=window.innerHeight;let Y=this.boundElement.getBoundingClientRect();w=Math.max(0,-Y.top)}else m=this.boundElement.offsetHeight,w=this.boundElement.scrollTop;let C=n.width!=null?Math.max(1,Math.floor(L/n.width)):n.visibleColumns??1,i=Math.ceil(f.length/C);if(n.minHeight!=null){let Y=n.minHeight,G=Math.ceil(m/Y)+(n.rowChunkSize||1),H=C*G,$=i*Y,D=Math.max(0,$-m),q=D>0?Math.min(1,Math.max(0,w/D)):0,X=Math.max(0,i-G+1),J=q*X,Z=Math.floor(J);if(n.rowChunkSize)Z-=Z%n.rowChunkSize;return o=Z*C,E=o+H-1,M=w,c=Math.max(0,$-w-m),{items:f,firstItem:o,lastItem:E,topBuffer:M,bottomBuffer:c,interpolation:{t:q,position:J,scrollTop:w,viewportHeight:m,totalScrollHeight:$,rowHeight:n.height}}}else{let Y=Math.ceil(m/n.height)+(n.rowChunkSize||1),G=C*Y,H=Math.floor(w/n.height);if(H>i-Y+1)H=Math.max(0,i-Y+1);if(n.rowChunkSize)H-=H%n.rowChunkSize;o=H*C,E=o+G-1,M=H*n.height,c=Math.max((i-Y)*n.height-M,0)}}return{items:f,firstItem:o,lastItem:E,topBuffer:M,bottomBuffer:c}}needle;filter=wn((n)=>{if(this.needle!==n)this.needle=n,this.update(this.array)},ho);update(n,f){if(n==null)n=[];if(this.array=n,!f)this._filteredCache=void 0;let{hiddenProp:o,visibleProp:E}=this.options,M=z(n),c=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",c.items.length===0);let L=this._previousSlice,{firstItem:y,lastItem:m,topBuffer:w,bottomBuffer:C}=c,i=o===void 0&&E===void 0&&f===!0&&L!=null&&y===L.firstItem&&m===L.lastItem;if(i&&c.interpolation==null&&w===L.topBuffer&&C===L.bottomBuffer)return;if(i&&c.interpolation!=null){this._updateInterpolatedBuffers(c);return}this._previousSlice=c;let Y=0,G=0,H=0;for(let X of Array.from(this.boundElement.children)){if(X===this.listTop||X===this.listBottom)continue;let J=X[v];if(J==null)X.remove();else{let Z=c.items.indexOf(J);if(Z<y||Z>m)X.remove(),this.itemToElement.delete(J),Y++}}this.listTop.style.height=String(w)+"px",this.listBottom.style.height=String(C)+"px";let $=[],{idPath:D}=this.options;for(let X=y;X<=m;X++){let J=c.items[X];if(J===void 0)continue;let Z=this.itemToElement.get(F(J));if(Z==null){if(H++,Z=e(this.template),typeof J==="object")this.itemToElement.set(F(J),Z),Z[v]=F(J);if(this.boundElement.insertBefore(Z,this.listBottom),D!=null){let p=J[D],Fn=`${M}[${D}=${p}]`;Mo(Z,Fn)}else{let p=`${M}[${X}]`;Mo(Z,p)}}$.push(Z)}let q=null;for(let X of $){if(X.previousElementSibling!==q)if(G++,q?.nextElementSibling!=null)this.boundElement.insertBefore(X,q.nextElementSibling);else this.boundElement.insertBefore(X,this.listBottom);q=X}if(c.interpolation!=null)this._updateInterpolatedBuffers(c);if(P.perf)console.log(M,"updated",{removed:Y,created:H,moved:G})}_updateInterpolatedBuffers(n){let{t:f,position:o,scrollTop:E,viewportHeight:M,totalScrollHeight:c,rowHeight:L}=n.interpolation,y=0;for(let i of Array.from(this.boundElement.children)){if(i===this.listTop||i===this.listBottom)continue;y+=i.offsetHeight||L}let m=E,w=E+M-y,C=Math.max(0,f*w+(1-f)*m-o%1*L);this.listTop.style.height=String(C)+"px",this.listBottom.style.height=String(Math.max(0,c-C-y))+"px"}}var En=(n,f,o)=>{let E=n[fn];if(f&&E===void 0)E=new co(n,f,o),n[fn]=E;return E},An=(n)=>{let f;while(!(f=n[v])&&n&&n.parentElement)n=n.parentElement;return f?{element:n,item:f}:void 0},On=(n)=>{let f=An(n);return f?f.item:void 0},mo=(n)=>{let f=An(n);if(!f)return console.error("deleteListItem failed, element is not part of a list instance",n),!1;let o=En(f.element.parentElement);if(!o.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",n.parentElement,o),!1;let E=o.array.indexOf(f.item);if(E>-1)return o.array.splice(E,1),!0;return!1},po={start:"start",middle:"center",end:"end",nearest:"nearest"},Lo=(n,f,o={})=>{let E=En(n);if(E==null)return console.error("scrollListItemIntoView failed, element has no list binding",n),!1;let{position:M="middle"}=o,c=E.filteredArray(),L=F(f)??f,y=c.indexOf(L);if(y===-1)return console.error("scrollListItemIntoView failed, item not found in list",f),!1;let{virtual:m}=E.options;if(m!=null&&n instanceof HTMLElement){let w=m.width!=null?Math.max(1,Math.floor(n.offsetWidth/m.width)):m.visibleColumns??1,C=Math.floor(y/w),i=m.minHeight??m.height,Y=Math.ceil(c.length/w),G=m.scrollContainer==="window",H=G?window.innerHeight:n.offsetHeight,$;if(m.minHeight!=null){let D=Math.ceil(H/i)+(m.rowChunkSize||1),q=Y*i,X=Math.max(0,q-H),J=Math.max(1,Y-D+1),Z=C/J;switch(M){case"start":$=Z*X;break;case"end":$=Math.max(0,(C-D+1)/J*X);break;case"nearest":{let p=G?Math.max(0,-n.getBoundingClientRect().top):n.scrollTop,Fn=X>0?p/X:0,$f=Math.floor(Fn*J);if(C<$f)$=Z*X;else if(C>=$f+D)$=Math.max(0,(C-D+1)/J*X);else return!0;break}default:{let p=C-Math.floor(D/2);$=Math.max(0,p)/J*X}}}else{let D=C*m.height;switch(M){case"start":$=D;break;case"end":$=D-H+m.height;break;case"nearest":{let q=G?Math.max(0,-n.getBoundingClientRect().top):n.scrollTop;if(D<q)$=D;else if(D+m.height>q+H)$=D-H+m.height;else return!0;break}default:$=D-(H-m.height)/2}}if($=Math.max(0,$),G){let D=n.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:D+$,behavior:"smooth"})}else n.scrollTo({top:$,behavior:"smooth"})}else{let w=E.itemToElement.get(L);if(w==null)return console.error("scrollListItemIntoView failed, no DOM element found for item",f),!1;w.scrollIntoView({block:po[M]??"center",behavior:"smooth"})}return!0};var{document:Xn,MutationObserver:yo}=globalThis,sn=(n,f)=>{let o=K.get(n);if(o==null)return;for(let E of o){let{binding:M,options:c}=E,{path:L}=E,{toDOM:y}=M;if(y!=null){if(L.startsWith("^")){let m=On(n);if(m!=null&&m[r]!=null)L=E.path=`${m[r]}${L.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${L}`,n,"is not part of a list"),Error(`Cannot resolve relative binding ${L}`)}if(f==null||L.startsWith(f))y(n,Qn()[L],c)}}};if(yo!=null)new yo((f)=>{f.forEach((o)=>{Array.from(o.addedNodes).forEach((E)=>{if(E instanceof Element)Array.from(E.querySelectorAll(u)).forEach((M)=>sn(M))})})}).observe(Xn.body,{subtree:!0,childList:!0});_(()=>!0,(n)=>{let f=Array.from(Xn.querySelectorAll(u));for(let o of f)sn(o,n)});var wo=(n)=>{let f=n.target?.closest(u);while(f!=null){let o=K.get(f);for(let E of o){let{binding:M,path:c}=E,{fromDOM:L}=M;if(L!=null){let y;try{y=L(f,E.options)}catch(m){throw console.error("Cannot get value from",f,"via",E),Error("Cannot obtain value fromDOM")}if(y!=null){let m=Qn(),w=m[c];if(w==null)m[c]=y;else{let C=w[r]!=null?w[B]:w,i=y[r]!=null?y[B]:y;if(C!==i)m[c]=i}}}}f=f.parentElement.closest(u)}};if(globalThis.document!=null)Xn.body.addEventListener("change",wo,!0),Xn.body.addEventListener("input",wo,!0);function A(n,f,o,E){if(n instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let M;if(typeof f==="object"&&f[r]===void 0&&E===void 0){let{value:y}=f;M=typeof y==="string"?y:y[r],E=f,delete E.value}else M=typeof f==="string"?f:f[r];if(M==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:c}=o;n.classList?.add(Vn);let L=K.get(n);if(L==null)L=[],K.set(n,L);if(L.push({path:M,binding:o,options:E}),c!=null&&!M.startsWith("^"))I(M);if(E?.filter&&E?.needle)A(n,E.needle,{toDOM(y,m){console.log({needle:m}),y[fn]?.filter(m)}});return n}var xo=new Set,go=(n)=>{let f=n?.target?.closest(Pn),o=!1,E=new Proxy(n,{get(c,L){if(L==="stopPropagation")return()=>{n.stopPropagation(),o=!0};else{let y=c[L];return typeof y==="function"?y.bind(c):y}}}),M=new Set;while(!o&&f!=null){let L=g.get(f)[n.type]||M;for(let y of L){if(typeof y==="function")y(E);else{let m=Qn()[y];if(typeof m==="function")m(E);else throw Error(`no event handler found at path ${y}`)}if(o)continue}f=f.parentElement!=null?f.parentElement.closest(Pn):null}};function a(n,f,o){let E=g.get(n);if(n.classList.add(un),E==null)E={},g.set(n,E);if(!E[f])E[f]=new Set;if(E[f].add(o),!xo.has(f))xo.add(f),Xn.body.addEventListener(f,go,!0);return()=>{E[f].delete(o)}}Kf(A,a);function Kn(n,f){if(!n.internals)return;let o={},E="";if(n.hasAttribute("required")&&f==="")o.valueMissing=!0,E="Please fill out this field.";let M=n.getAttribute("minlength");if(M&&f.length<parseInt(M,10))o.tooShort=!0,E=`Please use at least ${M} characters.`;let c=n.getAttribute("maxlength");if(c&&f.length>parseInt(c,10))o.tooLong=!0,E=`Please use no more than ${c} characters.`;let L=n.getAttribute("pattern");if(L&&f!=="")try{if(!new RegExp(`^(?:${L})$`).test(f))o.patternMismatch=!0,E="Please match the requested format."}catch{}if(Object.keys(o).length>0)n.internals.setValidity(o,E,n);else n.internals.setValidity({})}var vo=0;function Xf(){return`custom-elt${(vo++).toString(36)}`}var Co=0,Tf=null;function eo(){if(Tf===null)Tf=new MutationObserver((n)=>{let f=new Set;for(let o of n)if(o.type==="attributes"&&o.target instanceof O){let E=o.target,M=Mf(o.attributeName);if(E._legacyTrackedAttrs?.has(M))f.add(E)}for(let o of f)o.queueRender(!1)});return Tf}var Tn={};function lo(n,f){let o=Tn[n],E=b(f).replace(/:host\(([^)]+)\)/g,`${n}$1`).replace(/:host\b/g,n);Tn[n]=o?o+`
|
|
13
|
-
`+E:E}function to(n){if(Tn[n])document.head.append(T.style({id:n+"-component"},Tn[n]));delete Tn[n]}class O extends HTMLElement{static elements=T;static _elementCreator;static initAttributes;static formAssociated;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(n){if(this.internals)if(n)this.internals.setValidity({customError:!0},n);else this.internals.setValidity({})}setValidity(n,f,o){this.internals?.setValidity(n,f,o)}setFormValue(n,f){this.internals?.setFormValue(n,f)}static get observedAttributes(){let n=this.initAttributes;if(n)return["hidden",...Object.keys(n).map(W)];return["hidden"]}instanceId;styleNode;static styleSpec;static styleNode;content=T.slot();isSlotted;static _tagName=null;static get tagName(){return this._tagName}_legacyTrackedAttrs;_attrValues;_valueChanged=!1;static StyleNode(n){return console.warn("StyleNode is deprecated, just assign static styleSpec: XinStyleSheet to the class directly"),T.style(b(n))}static elementCreator(n={}){let f=this;if(f._elementCreator==null){let{tag:o,styleSpec:E}=n,M=n!=null?o:null;if(M==null)if(typeof f.name==="string"&&f.name!==""){if(M=W(f.name),M.startsWith("-"))M=M.slice(1)}else M=Xf();if(customElements.get(M)!=null)console.warn(`${M} is already defined`);if(M.match(/\w+(-\w+)+/)==null)console.warn(`${M} is not a legal tag for a custom-element`),M=Xf();while(customElements.get(M)!==void 0)M=Xf();if(f._tagName=M,E!==void 0)lo(M,E);window.customElements.define(M,this,n),f._elementCreator=T[M]}return f._elementCreator}initAttributes(...n){if(d("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let M of n)this._legacyTrackedAttrs.add(M);eo().observe(this,{attributes:!0});let o={},E={};n.forEach((M)=>{o[M]=s(this[M]);let c=W(M);Object.defineProperty(this,M,{enumerable:!1,get(){if(typeof o[M]==="boolean")return this.hasAttribute(c);else if(this.hasAttribute(c))return typeof o[M]==="number"?parseFloat(this.getAttribute(c)):this.getAttribute(c);else if(E[M]!==void 0)return E[M];else return o[M]},set(L){if(typeof o[M]==="boolean"){if(L!==this[M]){if(L)this.setAttribute(c,"");else this.removeAttribute(c);this.queueRender()}}else if(typeof o[M]==="number"){if(L!==parseFloat(this[M]))this.setAttribute(c,L),this.queueRender()}else if(typeof L==="object"||`${L}`!==`${this[M]}`){if(L===null||L===void 0||typeof L==="object")this.removeAttribute(c);else this.setAttribute(c,L);this.queueRender(),E[M]=L}}})})}initValue(){let n=Object.getOwnPropertyDescriptor(this,"value");if(n===void 0||n.get!==void 0||n.set!==void 0)return;let f=this.hasAttribute("value")?this.getAttribute("value"):s(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return f},set(o){if(f!==o)f=o,this._valueChanged=!0,this.queueRender(!0)}})}_parts;get parts(){let n=this.shadowRoot!=null?this.shadowRoot:this;if(this._parts==null)this._parts=new Proxy({},{get(f,o){if(f[o]===void 0){let E=n.querySelector(`[part="${o}"]`);if(E==null)E=n.querySelector(o);if(E==null)throw Error(`elementRef "${o}" does not exist!`);E.removeAttribute("data-ref"),f[o]=E}return f[o]}});return this._parts}attributeChangedCallback(n,f,o){let E=Mf(n);if(!this._legacyTrackedAttrs?.has(E))this.queueRender(!1)}constructor(){super();if(Co+=1,this.constructor.formAssociated&&typeof this.attachInternals==="function"&&!this.internals)this.internals=this.attachInternals();let n=this.constructor.initAttributes;if(n)this._setupAttributeAccessors(n);this.instanceId=`${this.tagName.toLocaleLowerCase()}-${Co}`,this._value=s(this.defaultValue)}_setupAttributeAccessors(n){if(!this._attrValues)this._attrValues=new Map;for(let f of Object.keys(n)){let o=W(f),E=n[f];if(f==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof E==="object"&&E!==null){console.warn(`${this.tagName}: initAttributes.${f} is an object. Use a regular property instead.`);continue}let M=this,c=!1;while(M){let L=Object.getOwnPropertyDescriptor(M,f);if(L){if(!L.configurable||L.get||L.set){c=!0;break}break}M=Object.getPrototypeOf(M)}if(c)continue;Object.defineProperty(this,f,{enumerable:!1,get:()=>{if(typeof E==="boolean")return this.hasAttribute(o);else if(this.hasAttribute(o))return typeof E==="number"?parseFloat(this.getAttribute(o)):this.getAttribute(o);else if(this._attrValues.has(f))return this._attrValues.get(f);else return E},set:(L)=>{if(typeof E==="boolean"){if(L!==this[f]){if(L)this.setAttribute(o,"");else this.removeAttribute(o);this.queueRender()}}else if(typeof E==="number"){if(L!==parseFloat(this[f]))this.setAttribute(o,L),this.queueRender()}else if(typeof L==="object"||`${L}`!==`${this[f]}`){if(L===null||L===void 0||typeof L==="object")this.removeAttribute(o);else this.setAttribute(o,L);this.queueRender(),this._attrValues.set(f,L)}}})}}connectedCallback(){if(to(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(yn.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(){yn.unobserve(this)}formResetCallback(){if(this.value!==void 0)this.value=this.defaultValue??""}formDisabledCallback(n){if(n)this.setAttribute("disabled","");else this.removeAttribute("disabled")}formStateRestoreCallback(n){if(this.value!==void 0&&typeof n==="string")this.value=n}_changeQueued=!1;_renderQueued=!1;queueRender(n=!1){if(!this._hydrated)return;if(!this._changeQueued)this._changeQueued=n;if(!this._renderQueued)this._renderQueued=!0,requestAnimationFrame(()=>{if(this._changeQueued){if(of(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 n=typeof this.content!=="function",f=typeof this.content==="function"?this.content(T):this.content,{styleSpec:o}=this.constructor,{styleNode:E}=this.constructor;if(o)E=this.constructor.styleNode=T.style(b(o)),delete this.constructor.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecrated, use static styleNode or statc styleSpec instead"),E=this.styleNode;if(E){let M=this.attachShadow({mode:"open"});M.appendChild(E.cloneNode(!0)),Ef(M,f,n)}else if(f!==null){let M=Array.from(this.childNodes);Ef(this,f,n),this.isSlotted=this.querySelector("slot,xin-slot")!==void 0;let c=Array.from(this.querySelectorAll("slot"));if(c.length>0)c.forEach(Df.replaceSlot);if(M.length>0){let L={"":this};Array.from(this.querySelectorAll("xin-slot")).forEach((y)=>{L[y.name]=y}),M.forEach((y)=>{let m=L[""],w=y instanceof Element?L[y.slot]:m;(w!==void 0?w:m).append(y)})}}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 n=typeof this.value==="string"?this.value:String(this.value);Kn(this,n)}}class Df extends O{static initAttributes={name:""};content=null;static replaceSlot(n){let f=document.createElement("xin-slot");if(n.name!=="")f.setAttribute("name",n.name);n.replaceWith(f)}}var FM=Df.elementCreator({tag:"xin-slot"});var Ho=(n=()=>!0)=>{let f=localStorage.getItem("xin-state");if(f!=null){let E=JSON.parse(f);for(let M of Object.keys(E).filter(n))if(Q[M]!==void 0)Object.assign(Q[M],E[M]);else Q[M]=E[M]}let o=zn(()=>{let E={},M=F(Q);for(let c of Object.keys(M).filter(n))E[c]=M[c];localStorage.setItem("xin-state",JSON.stringify(E)),console.log("xin state saved to localStorage")},500);cn(n,o)};var Bn="1.4.0";function Dn(n){return Object.assign(k,n),k}function Yn(n){return d("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),Dn(n)}function dn(n,f=!1){if(f)return d("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),Yn(n);return Object.keys(n).forEach((o)=>{Q[o]=n[o]}),Q}var ao={};async function $n(n,f){let{type:o,styleSpec:E}=await f(n,{Color:x,Component:O,elements:T,svgElements:Un,mathML:jn,varDefault:Cn,vars:qn,xin:Q,boxed:k,xinProxy:dn,boxedProxy:Yn,tosi:Dn,makeComponent:$n,bind:A,on:a,version:Bn}),M={type:o,creator:o.elementCreator({tag:n,styleSpec:E})};return ao[n]=M,M}var Yf={},nE=(n)=>import(n);class Jn extends O{static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(n)=>{};async packaged(){let{tag:n,src:f,property:o}=this,E=`${n}.${o}:${f}`;if(!this.loaded){if(Yf[E]===void 0)Yf[E]=nE(f).then((M)=>{let c=M[o];return $n(n,c)});else console.log(`using cached ${n} with signature ${E}`);this.loaded=await Yf[E],this.blueprintLoaded(this.loaded)}return this.loaded}}var io=Jn.elementCreator({tag:"xin-blueprint",styleSpec:{":host":{display:"none"}}});class Rn extends O{allLoaded=()=>{};constructor(){super()}async load(){let f=Array.from(this.querySelectorAll(Jn.tagName)).filter((o)=>o.src).map((o)=>o.packaged());await Promise.all(f),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var Xo=Rn.elementCreator({tag:"xin-loader",styleSpec:{":host":{display:"none"}}});})();
|
|
12
|
+
`)},nE=(n)=>{r("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let f={};for(let E of Object.keys(n)){let o=n[E],M=U(E);f[`--${M}`]=typeof o==="number"&&o!==0?String(o)+"px":o}return f},fE=(n)=>{let f={};for(let E of Object.keys(n)){let o=n[E];if(o instanceof C)f[E]=o.inverseLuminance;else if(typeof o==="string"&&o.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))f[E]=C.fromCss(o).inverseLuminance}return f},Yn=new Proxy({},{get(n,f){if(n[f]===void 0){let E="--"+U(f);n[f]=(o)=>`var(${E}, ${o})`}return n[f]}}),An=new Proxy({},{get(n,f){if(f==="default")return Yn;if(n[f]==null){f=U(f);let[,E,,o,M,m]=f.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",f],c=`--${E}`;if(M!=null){let w=o==null?Number(M)/100:-Number(M)/100;switch(m){case"b":case"s":case"h":case"o":{let L=`--${f}`;C.registerComputedColor(L,c,w,m),n[f]=`var(${L})`}break;case"":n[f]=`calc(var(${c}) * ${w})`;break;default:throw console.error(m),Error(`Unrecognized method ${m} for css variable ${c}`)}}else n[f]=`var(${c})`}return n[f]}});function Cf(){let n=(f)=>typeof matchMedia<"u"&&matchMedia(f).matches;return{colorScheme:n("(prefers-color-scheme: dark)")?"dark":"light",contrast:n("(prefers-contrast: more)")?"more":n("(prefers-contrast: less)")?"less":n("(prefers-contrast: custom)")?"custom":"no-preference",reducedMotion:n("(prefers-reduced-motion: reduce)"),reducedTransparency:n("(prefers-reduced-transparency: reduce)"),forcedColors:n("(forced-colors: active)")}}function EE(n){if(typeof matchMedia>"u")return()=>{};let f=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],E=()=>n(Cf()),o=f.map((M)=>matchMedia(M));for(let M of o)M.addEventListener("change",E);return()=>{for(let M of o)M.removeEventListener("change",E)}}var oE="http://www.w3.org/1998/Math/MathML",ME="http://www.w3.org/2000/svg";var Kn={},mE=(n,f,E)=>{let o=yf(U(f),E);if(o.prop.startsWith("--"))n.style.setProperty(o.prop,o.value);else n.style[f]=o.value},eE=(n)=>{return{toDOM(f,E){mE(f,n,E)}}},LE=(n,f,E)=>{if(f==="style")if(typeof E==="object")for(let o of Object.keys(E))if(Q(E[o]))B(n,E[o],eE(o));else mE(n,o,E[o]);else n.setAttribute("style",E);else{let o=U(f),M=n.constructor.observedAttributes;if(M?.includes(f)||M?.includes(o))if(typeof E==="boolean")E?n.setAttribute(o,""):n.removeAttribute(o);else n.setAttribute(o,E);else if(n[f]!==void 0){let{MathMLElement:c}=globalThis;if(n instanceof SVGElement||c!==void 0&&n instanceof c)n.setAttribute(f,E);else n[f]=E}else if(o==="class")E.split(" ").forEach((c)=>{n.classList.add(c)});else if(n[o]!==void 0)n[o]=E;else if(typeof E==="boolean")E?n.setAttribute(o,""):n.removeAttribute(o);else n.setAttribute(o,E)}},xf={},tE=(n)=>{if(!xf[n])xf[n]={toDOM(f,E){LE(f,n,E)}};return xf[n]},aE=(n,f,E)=>{if(f==="apply")E(n);else if(f.match(/^on[A-Z]/)!=null){let o=f.substring(2).toLowerCase();nn(n,o,E)}else if(f==="bind")if((typeof E.binding==="string"?Tn[E.binding]:E.binding)!==void 0&&E.value!==void 0)B(n,E.value,E.binding instanceof Function?{toDOM:E.binding}:E.binding);else throw Error("bad binding");else if(f.match(/^bind[A-Z]/)!=null){let o=f.substring(4,5).toLowerCase()+f.substring(5),M=Tn[o];if(M!==void 0)B(n,E,M);else throw Error(`${f} is not allowed, bindings.${o} is not defined`)}else if(Q(E))B(n,E,tE(f));else LE(n,f,E)},Hf=(n,...f)=>{if(Kn[n]===void 0){let[M,m]=n.split("|");if(m===void 0)Kn[n]=globalThis.document.createElement(M);else Kn[n]=globalThis.document.createElementNS(m,M)}let E=Kn[n].cloneNode(),o={};for(let M of f)if(M instanceof Element||M instanceof DocumentFragment||typeof M==="string"||typeof M==="number")if(E instanceof HTMLTemplateElement)E.content.append(M);else E.append(M);else if(Q(M))E.append(i.span({bindText:M}));else Object.assign(o,M);for(let M of Object.keys(o)){let m=o[M];aE(E,M,m)}return E},Xf=(...n)=>{let f=globalThis.document.createDocumentFragment();for(let E of n)f.append(E);return f},i=new Proxy({fragment:Xf},{get(n,f){if(f=f.replace(/[A-Z]/g,(E)=>`-${E.toLocaleLowerCase()}`),n[f]===void 0)n[f]=(...E)=>Hf(f,...E);return n[f]},set(){throw Error("You may not add new properties to elements")}}),Bn=new Proxy({fragment:Xf},{get(n,f){if(n[f]===void 0)n[f]=(...E)=>Hf(`${f}|${ME}`,...E);return n[f]},set(){throw Error("You may not add new properties to elements")}}),Vn=new Proxy({fragment:Xf},{get(n,f){if(n[f]===void 0)n[f]=(...E)=>Hf(`${f}|${oE}`,...E);return n[f]},set(){throw Error("You may not add new properties to elements")}});var no=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],fo=!0,Eo=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,oo=(n)=>Eo.test(n),g=(n="",f="")=>{if(n==="")return f;else if(f.match(/^\d+$/)!==null||f.includes("="))return`${n}[${f}]`;else return`${n}.${f}`},CE={};function Tf(n,f){if(n!==null&&(typeof n==="object"||typeof n==="function"))return n;return new Proxy(CE,h(f,!0))}var $n=()=>new Proxy({},h("^",!0)),Yf=(n)=>{let E=n($n())?.path;if(!E?.startsWith("^."))throw Error("selector must return a property of the item");return E.substring(2)},$f=(n,f,E)=>{for(let o=0;o<n.length;o++)if(`${W(n[o],f)}`===`${E}`)return o;return-1},cE=(n,f)=>({listFind(E,o){if(E instanceof Element){let c=E;while(c&&!c[e]&&c.parentElement)c=c.parentElement;let w=c?.[e];if(w==null)return;let L=f.indexOf(w);return L!==-1?q[n][L]:void 0}let M=Yf(E),m=$f(f,M,o);return m!==-1?q[n][m]:void 0},listUpdate(E,o){let M=Yf(E),m=W(o,M),c=$f(f,M,m);if(c!==-1){let w=q[n][c];for(let L of Object.keys(o))w[L]=o[L];return w}return q[n].push(o),q[n][f.length-1]},listRemove(E,o){let M=Yf(E),m=$f(f,M,o);if(m===-1)return!1;return q[n].splice(m,1),!0}}),wE=!1;function fn(){if(!wE)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),wE=!0}var yE=(n)=>{return n===CE},h=(n,f)=>({get(E,o){if(yE(E)){let w=()=>W(k,n);switch(o){case"path":return n;case"value":return w();case"valueOf":case"toJSON":return()=>w();case Symbol.toPrimitive:return(L)=>{let y=w();if(L==="number")return Number(y);if(L==="string")return String(y);return y};case"toString":return()=>String(w());case"touch":return()=>A(n);case"observe":return(L)=>{let y=V(n,L);return()=>_(y)};case"on":return(L,y)=>Cn()(L,y,w());case"bind":return(L,y,x)=>{yn()(L,n,y,x)};case"binding":return(L)=>({bind:{value:n,binding:L}});case"listBinding":return(L=({span:x})=>x({bindText:"^"}),y={})=>[{bindList:{value:n,...y}},i.template(L(i,$n()))];case"listFind":case"listUpdate":case"listRemove":return cE(n,E)[o];case s:case"xinValue":case"tosiValue":return fn(),w();case O:case"xinPath":case"tosiPath":return fn(),n;case hn:case"tosiObserve":return fn(),(L)=>{let y=V(n,L);return()=>_(y)};case ln:case"tosiOn":return fn(),(L,y)=>Cn()(L,y,w());case vn:case"tosiBind":return fn(),(L,y,x)=>{yn()(L,n,y,x)};case"tosiBinding":return fn(),(L)=>({bind:{value:n,binding:L}});case"tosiListBinding":return fn(),(L=({span:x})=>x({bindText:"^"}),y={})=>[{bindList:{value:n,...y}},i.template(L(i,$n()))]}if(typeof o==="string"&&/^\d+$/.test(o)){let L=w();if(typeof L==="string")return L[parseInt(o,10)]}if(o==="length"){let L=w();if(typeof L==="string")return L.length}return}if(f&&!(o in E))switch(o){case"path":return n;case"value":return E.valueOf?E.valueOf():E;case"valueOf":case"toJSON":return()=>E.valueOf?E.valueOf():E;case"touch":return()=>A(n);case"observe":return(w)=>{let L=V(n,w);return()=>_(L)};case"on":return(w,L)=>Cn()(w,L,F(E));case"bind":return(w,L,y)=>{yn()(w,n,L,y)};case"binding":return(w)=>({bind:{value:n,binding:w}});case"listBinding":return(w=({span:y})=>y({bindText:"^"}),L={})=>[{bindList:{value:n,...L}},i.template(w(i,$n()))];case"listFind":case"listUpdate":case"listRemove":return cE(n,E)[o]}switch(o){case O:case"xinPath":case"tosiPath":return n;case s:case"xinValue":case"tosiValue":return E.valueOf?E.valueOf():E;case hn:case"xinObserve":case"tosiObserve":return(w)=>{let L=V(n,w);return()=>_(L)};case ln:case"xinOn":case"tosiOn":return(w,L)=>Cn()(w,L,F(E));case vn:case"xinBind":case"tosiBind":return(w,L,y)=>{yn()(w,n,L,y)};case"tosiBinding":return(w)=>({bind:{value:n,binding:w}});case"tosiListBinding":return(w=({span:y})=>y({bindText:"^"}),L={})=>[{bindList:{value:n,...L}},i.template(w(i,$n()))]}if(typeof o==="symbol")return E[o];let M=Object.getOwnPropertyDescriptor(E,o);if(M&&!M.configurable&&!M.writable&&"value"in M)return M.value;let m=o,c=m.match(/^([^.[]+)\.(.+)$/)??m.match(/^([^\]]+)(\[.+)/)??m.match(/^(\[[^\]]+\])\.(.+)$/)??m.match(/^(\[[^\]]+\])\[(.+)$/);if(c!==null){let[,w,L]=c,y=g(n,w),x=W(E,w);return x!==null&&typeof x==="object"?new Proxy(x,h(y,f))[L]:x}if(m.startsWith("[")&&m.endsWith("]"))m=m.substring(1,m.length-1);if(!Array.isArray(E)&&E[m]!==void 0||Array.isArray(E)&&m.includes("=")){let w;if(m.includes("=")){let[L,y]=m.split("=");w=E.find((x)=>`${W(x,L)}`===y)}else w=E[m];if(w instanceof Object){let L=g(n,m);return new Proxy(w instanceof Function?w.bind(E):w,h(L,f))}else return f?Tf(w,g(n,m)):w}else if(Array.isArray(E)){let w=E[m];return typeof w==="function"?(...L)=>{let y=L.map((X)=>F(X)),x=w.apply(E,y);if(no.includes(m))A(n);if(x!=null&&typeof x==="object"){if(m==="find"||m==="findLast"||m==="at"){let X=E.indexOf(x);if(X!==-1)return new Proxy(x,h(g(n,String(X)),f))}}return x}:typeof w==="object"?new Proxy(w,h(g(n,m),f)):f?Tf(w,g(n,m)):w}else return f?Tf(E[m],g(n,m)):E[m]},set(E,o,M){M=F(M);let c=o===s||o==="xinValue"||o==="tosiValue"||o==="value"&&(yE(E)||f)?n:g(n,o);if(fo&&!oo(c))throw Error(`setting invalid path ${c}`);if(F(G[c])!==M&&wn(k,c,M))A(c);return!0}}),cn=(n,f)=>{let E=typeof f==="function"?f:G[f];if(typeof E!=="function")throw Error(`observe expects a function or path to a function, ${f} is neither`);return V(n,E)},G=new Proxy(k,h("",!1));uf(G);var q=new Proxy(k,h("",!0));var Mo=16,mo=100;function xE(n,f){let E=Array.from(n.querySelectorAll(d));if(n.matches(d))E.unshift(n);for(let o of E){let M=S.get(o);for(let m of M){if(m.path.startsWith("^"))m.path=`${f}${m.path.substring(1)}`;if(m.binding.toDOM!=null)m.binding.toDOM(o,G[m.path])}}}class HE{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_filteredCache;_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(n,f,E={}){if(this.boundElement=n,this.itemToElement=new WeakMap,E.idPath!=null){let o=Q(f);if(o!=null)jf(o,E.idPath)}if(n.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(n.children[0]instanceof HTMLTemplateElement){let o=n.children[0];if(o.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=t(o.content.children[0])}else this.template=n.children[0],this.template.remove();if(this.options=E,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),this.boundElement[on]=this,E.virtual!=null)if(Hn.observe(this.boundElement),this._update=Xn(()=>{this.update(this.array,!0)},Mo),this.boundElement.addEventListener("resize",this._update),E.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:n,visibleProp:f}=this.options,E=this.array;if(n!==void 0)E=E.filter((o)=>o[n]!==!0);if(f!==void 0)E=E.filter((o)=>o[f]===!0);if(this.options.filter&&this.needle!==void 0)E=this.options.filter(E,this.needle);return this._filteredCache=E,E}visibleSlice(){let{virtual:n}=this.options,f=this.filteredArray(),E=0,o=f.length-1,M=0,m=0;if(n!=null&&this.boundElement instanceof HTMLElement){let c=this.boundElement.offsetWidth,w=n.scrollContainer==="window",L,y;if(w){L=window.innerHeight;let $=this.boundElement.getBoundingClientRect();y=Math.max(0,-$.top)}else L=this.boundElement.offsetHeight,y=this.boundElement.scrollTop;let x=n.width!=null?Math.max(1,Math.floor(c/n.width)):n.visibleColumns??1,X=Math.ceil(f.length/x);if(n.minHeight!=null){let $=n.minHeight,z=Math.ceil(L/$)+(n.rowChunkSize||1),H=x*z,D=X*$,Y=Math.max(0,D-L),j=Y>0?Math.min(1,Math.max(0,y/Y)):0,T=Math.max(0,X-z+1),J=j*T,Z=Math.floor(J);if(n.rowChunkSize)Z-=Z%n.rowChunkSize;return E=Z*x,o=E+H-1,M=y,m=Math.max(0,D-y-L),{items:f,firstItem:E,lastItem:o,topBuffer:M,bottomBuffer:m,interpolation:{t:j,position:J,scrollTop:y,viewportHeight:L,totalScrollHeight:D,rowHeight:n.height}}}else{let $=Math.ceil(L/n.height)+(n.rowChunkSize||1),z=x*$,H=Math.floor(y/n.height);if(H>X-$+1)H=Math.max(0,X-$+1);if(n.rowChunkSize)H-=H%n.rowChunkSize;E=H*x,o=E+z-1,M=H*n.height,m=Math.max((X-$)*n.height-M,0)}}return{items:f,firstItem:E,lastItem:o,topBuffer:M,bottomBuffer:m}}needle;filter=Xn((n)=>{if(this.needle!==n)this.needle=n,this.update(this.array)},mo);update(n,f){if(n==null)n=[];if(this.array=n,!f)this._filteredCache=void 0;let{hiddenProp:E,visibleProp:o}=this.options,M=Q(n),m=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",m.items.length===0);let c=this._previousSlice,{firstItem:w,lastItem:L,topBuffer:y,bottomBuffer:x}=m,X=E===void 0&&o===void 0&&f===!0&&c!=null&&w===c.firstItem&&L===c.lastItem;if(X&&m.interpolation==null&&y===c.topBuffer&&x===c.bottomBuffer)return;if(X&&m.interpolation!=null){this._updateInterpolatedBuffers(m);return}this._previousSlice=m;let $=0,z=0,H=0;for(let T of Array.from(this.boundElement.children)){if(T===this.listTop||T===this.listBottom)continue;let J=T[e];if(J==null)T.remove();else{let Z=m.items.indexOf(J);if(Z<w||Z>L)T.remove(),this.itemToElement.delete(J),$++}}this.listTop.style.height=String(y)+"px",this.listBottom.style.height=String(x)+"px";let D=[],{idPath:Y}=this.options;for(let T=w;T<=L;T++){let J=m.items[T];if(J===void 0)continue;let Z=this.itemToElement.get(F(J));if(Z==null){if(H++,Z=t(this.template),typeof J==="object")this.itemToElement.set(F(J),Z),Z[e]=F(J);if(this.boundElement.insertBefore(Z,this.listBottom),Y!=null){let v=J[Y],Wn=`${M}[${Y}=${v}]`;xE(Z,Wn)}else{let v=`${M}[${T}]`;xE(Z,v)}}D.push(Z)}let j=null;for(let T of D){if(T.previousElementSibling!==j)if(z++,j?.nextElementSibling!=null)this.boundElement.insertBefore(T,j.nextElementSibling);else this.boundElement.insertBefore(T,this.listBottom);j=T}if(m.interpolation!=null)this._updateInterpolatedBuffers(m);if(P.perf)console.log(M,"updated",{removed:$,created:H,moved:z})}_updateInterpolatedBuffers(n){let{t:f,position:E,scrollTop:o,viewportHeight:M,totalScrollHeight:m,rowHeight:c}=n.interpolation,w=0;for(let X of Array.from(this.boundElement.children)){if(X===this.listTop||X===this.listBottom)continue;w+=X.offsetHeight||c}let L=o,y=o+M-w,x=Math.max(0,f*y+(1-f)*L-E%1*c);this.listTop.style.height=String(x)+"px",this.listBottom.style.height=String(Math.max(0,m-x-w))+"px"}}var Ln=(n,f,E)=>{let o=n[on];if(f&&o===void 0)o=new HE(n,f,E),n[on]=o;return o},In=(n)=>{let f;while(!(f=n[e])&&n&&n.parentElement)n=n.parentElement;return f?{element:n,item:f}:void 0},Rn=(n)=>{let f=In(n);return f?f.item:void 0},XE=(n)=>{let f=In(n);if(!f)return console.error("deleteListItem failed, element is not part of a list instance",n),!1;let E=Ln(f.element.parentElement);if(!E.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",n.parentElement,E),!1;let o=E.array.indexOf(f.item);if(o>-1)return E.array.splice(o,1),!0;return!1},Lo={start:"start",middle:"center",end:"end",nearest:"nearest"},TE=(n,f,E={})=>{let o=Ln(n);if(o==null)return console.error("scrollListItemIntoView failed, element has no list binding",n),!1;let{position:M="middle"}=E,m=o.filteredArray(),c=F(f)??f,w=m.indexOf(c);if(w===-1)return console.error("scrollListItemIntoView failed, item not found in list",f),!1;let{virtual:L}=o.options;if(L!=null&&n instanceof HTMLElement){let y=L.width!=null?Math.max(1,Math.floor(n.offsetWidth/L.width)):L.visibleColumns??1,x=Math.floor(w/y),X=L.minHeight??L.height,$=Math.ceil(m.length/y),z=L.scrollContainer==="window",H=z?window.innerHeight:n.offsetHeight,D;if(L.minHeight!=null){let Y=Math.ceil(H/X)+(L.rowChunkSize||1),j=$*X,T=Math.max(0,j-H),J=Math.max(1,$-Y+1),Z=x/J;switch(M){case"start":D=Z*T;break;case"end":D=Math.max(0,(x-Y+1)/J*T);break;case"nearest":{let v=z?Math.max(0,-n.getBoundingClientRect().top):n.scrollTop,Wn=T>0?v/T:0,kf=Math.floor(Wn*J);if(x<kf)D=Z*T;else if(x>=kf+Y)D=Math.max(0,(x-Y+1)/J*T);else return!0;break}default:{let v=x-Math.floor(Y/2);D=Math.max(0,v)/J*T}}}else{let Y=x*L.height;switch(M){case"start":D=Y;break;case"end":D=Y-H+L.height;break;case"nearest":{let j=z?Math.max(0,-n.getBoundingClientRect().top):n.scrollTop;if(Y<j)D=Y;else if(Y+L.height>j+H)D=Y-H+L.height;else return!0;break}default:D=Y-(H-L.height)/2}}if(D=Math.max(0,D),z){let Y=n.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:Y+D,behavior:"smooth"})}else n.scrollTo({top:D,behavior:"smooth"})}else{let y=o.itemToElement.get(c);if(y==null)return console.error("scrollListItemIntoView failed, no DOM element found for item",f),!1;y.scrollIntoView({block:Lo[M]??"center",behavior:"smooth"})}return!0};var{document:Dn,MutationObserver:iE}=globalThis,Sn=(n,f)=>{let E=S.get(n);if(E==null)return;for(let o of E){let{binding:M,options:m}=o,{path:c}=o,{toDOM:w}=M;if(w!=null){if(c.startsWith("^")){let L=Rn(n);if(L!=null&&L[O]!=null)c=o.path=`${L[O]}${c.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${c}`,n,"is not part of a list"),Error(`Cannot resolve relative binding ${c}`)}if(f==null||c.startsWith(f))w(n,Un()[c],m)}}};if(iE!=null)new iE((f)=>{f.forEach((E)=>{Array.from(E.addedNodes).forEach((o)=>{if(o instanceof Element)Array.from(o.querySelectorAll(d)).forEach((M)=>Sn(M))})})}).observe(Dn.body,{subtree:!0,childList:!0});V(()=>!0,(n)=>{let f=Array.from(Dn.querySelectorAll(d));for(let E of f)Sn(E,n)});var YE=(n)=>{let f=n.target?.closest(d);while(f!=null){let E=S.get(f);for(let o of E){let{binding:M,path:m}=o,{fromDOM:c}=M;if(c!=null){let w;try{w=c(f,o.options)}catch(L){throw console.error("Cannot get value from",f,"via",o),Error("Cannot obtain value fromDOM")}if(w!=null){let L=Un(),y=L[m];if(y==null)L[m]=w;else{let x=y[O]!=null?y[s]:y,X=w[O]!=null?w[s]:w;if(x!==X)L[m]=X}}}}f=f.parentElement.closest(d)}};if(globalThis.document!=null)Dn.body.addEventListener("change",YE,!0),Dn.body.addEventListener("input",YE,!0);function B(n,f,E,o){if(n instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let M;if(typeof f==="object"&&f[O]===void 0&&o===void 0){let{value:w}=f;M=typeof w==="string"?w:w[O],o=f,delete o.value}else M=typeof f==="string"?f:f[O];if(M==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:m}=E;n.classList?.add(Nn);let c=S.get(n);if(c==null)c=[],S.set(n,c);if(c.push({path:M,binding:E,options:o}),m!=null&&!M.startsWith("^"))A(M);if(o?.filter&&o?.needle)B(n,o.needle,{toDOM(w,L){console.log({needle:L}),w[on]?.filter(L)}});return n}var $E=new Set,co=(n)=>{let f=n?.target?.closest(gn),E=!1,o=new Proxy(n,{get(m,c){if(c==="stopPropagation")return()=>{n.stopPropagation(),E=!0};else{let w=m[c];return typeof w==="function"?w.bind(m):w}}}),M=new Set;while(!E&&f!=null){let c=l.get(f)[n.type]||M;for(let w of c){if(typeof w==="function")w(o);else{let L=Un()[w];if(typeof L==="function")L(o);else throw Error(`no event handler found at path ${w}`)}if(E)continue}f=f.parentElement!=null?f.parentElement.closest(gn):null}};function nn(n,f,E){let o=l.get(n);if(n.classList.add(pn),o==null)o={},l.set(n,o);if(!o[f])o[f]=new Set;if(o[f].add(E),!$E.has(f))$E.add(f),Dn.body.addEventListener(f,co,!0);return()=>{o[f].delete(E)}}_f(B,nn);function sn(n,f){if(!n.internals)return;let E={},o="";if(n.hasAttribute("required")&&f==="")E.valueMissing=!0,o="Please fill out this field.";let M=n.getAttribute("minlength");if(M&&f.length<parseInt(M,10))E.tooShort=!0,o=`Please use at least ${M} characters.`;let m=n.getAttribute("maxlength");if(m&&f.length>parseInt(m,10))E.tooLong=!0,o=`Please use no more than ${m} characters.`;let c=n.getAttribute("pattern");if(c&&f!=="")try{if(!new RegExp(`^(?:${c})$`).test(f))E.patternMismatch=!0,o="Please match the requested format."}catch{}if(Object.keys(E).length>0)n.internals.setValidity(E,o,n);else n.internals.setValidity({})}var wo=0;function Df(){return`custom-elt${(wo++).toString(36)}`}var DE=0,Jf=null;function yo(){if(Jf===null)Jf=new MutationObserver((n)=>{let f=new Set;for(let E of n)if(E.type==="attributes"&&E.target instanceof I){let o=E.target,M=wf(E.attributeName);if(o._legacyTrackedAttrs?.has(M))f.add(o)}for(let E of f)E.queueRender(!1)});return Jf}var Jn={};function Co(n,f){let E=Jn[n],o=p(f).replace(/:host\(([^)]+)\)/g,`${n}$1`).replace(/:host\b/g,n);Jn[n]=E?E+`
|
|
13
|
+
`+o:o}function xo(n){if(Jn[n])document.head.append(i.style({id:n+"-component"},Jn[n]));delete Jn[n]}class I extends HTMLElement{static elements=i;static _elementCreator;static initAttributes;static formAssociated;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(n){if(this.internals)if(n)this.internals.setValidity({customError:!0},n);else this.internals.setValidity({})}setValidity(n,f,E){this.internals?.setValidity(n,f,E)}setFormValue(n,f){this.internals?.setFormValue(n,f)}static get observedAttributes(){let n=this.initAttributes;if(n)return["hidden",...Object.keys(n).map(U)];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(n){return console.warn("StyleNode is deprecated, just assign static styleSpec: XinStyleSheet to the class directly"),i.style(p(n))}static elementCreator(n={}){let f=this;if(f._elementCreator==null){let{tag:E,styleSpec:o}=n,M=n!=null?E:null;if(M==null)if(typeof f.name==="string"&&f.name!==""){if(M=U(f.name),M.startsWith("-"))M=M.slice(1)}else M=Df();if(customElements.get(M)!=null)console.warn(`${M} is already defined`);if(M.match(/\w+(-\w+)+/)==null)console.warn(`${M} is not a legal tag for a custom-element`),M=Df();while(customElements.get(M)!==void 0)M=Df();if(f._tagName=M,o!==void 0)Co(M,o);window.customElements.define(M,this,n),f._elementCreator=i[M]}return f._elementCreator}initAttributes(...n){if(r("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let M of n)this._legacyTrackedAttrs.add(M);yo().observe(this,{attributes:!0});let E={},o={};n.forEach((M)=>{E[M]=R(this[M]);let m=U(M);Object.defineProperty(this,M,{enumerable:!1,get(){if(typeof E[M]==="boolean")return this.hasAttribute(m);else if(this.hasAttribute(m))return typeof E[M]==="number"?parseFloat(this.getAttribute(m)):this.getAttribute(m);else if(o[M]!==void 0)return o[M];else return E[M]},set(c){if(typeof E[M]==="boolean"){if(c!==this[M]){if(c)this.setAttribute(m,"");else this.removeAttribute(m);this.queueRender()}}else if(typeof E[M]==="number"){if(c!==parseFloat(this[M]))this.setAttribute(m,c),this.queueRender()}else if(typeof c==="object"||`${c}`!==`${this[M]}`){if(c===null||c===void 0||typeof c==="object")this.removeAttribute(m);else this.setAttribute(m,c);this.queueRender(),o[M]=c}}})})}initValue(){let n=Object.getOwnPropertyDescriptor(this,"value");if(n===void 0||n.get!==void 0||n.set!==void 0)return;let f=this.hasAttribute("value")?this.getAttribute("value"):R(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return f},set(E){if(f!==E)f=E,this._valueChanged=!0,this.queueRender(!0)}})}_parts;get parts(){let n=this.shadowRoot!=null?this.shadowRoot:this;if(this._parts==null)this._parts=new Proxy({},{get(f,E){if(f[E]===void 0){let o=n.querySelector(`[part="${E}"]`);if(o==null)o=n.querySelector(E);if(o==null)throw Error(`elementRef "${E}" does not exist!`);o.removeAttribute("data-ref"),f[E]=o}return f[E]}});return this._parts}attributeChangedCallback(n,f,E){let o=wf(n);if(!this._legacyTrackedAttrs?.has(o))this.queueRender(!1)}constructor(){super();if(DE+=1,this.constructor.formAssociated&&typeof this.attachInternals==="function"&&!this.internals)this.internals=this.attachInternals();let n=this.constructor.initAttributes;if(n)this._setupAttributeAccessors(n);this.instanceId=`${this.tagName.toLocaleLowerCase()}-${DE}`,this._value=R(this.defaultValue)}_setupAttributeAccessors(n){if(!this._attrValues)this._attrValues=new Map;for(let f of Object.keys(n)){let E=U(f),o=n[f];if(f==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof o==="object"&&o!==null){console.warn(`${this.tagName}: initAttributes.${f} is an object. Use a regular property instead.`);continue}let M=this,m=!1;while(M){let c=Object.getOwnPropertyDescriptor(M,f);if(c){if(!c.configurable||c.get||c.set){m=!0;break}break}M=Object.getPrototypeOf(M)}if(m)continue;Object.defineProperty(this,f,{enumerable:!1,get:()=>{if(typeof o==="boolean")return this.hasAttribute(E);else if(this.hasAttribute(E))return typeof o==="number"?parseFloat(this.getAttribute(E)):this.getAttribute(E);else if(this._attrValues.has(f))return this._attrValues.get(f);else return o},set:(c)=>{if(typeof o==="boolean"){if(c!==this[f]){if(c)this.setAttribute(E,"");else this.removeAttribute(E);this.queueRender()}}else if(typeof o==="number"){if(c!==parseFloat(this[f]))this.setAttribute(E,c),this.queueRender()}else if(typeof c==="object"||`${c}`!==`${this[f]}`){if(c===null||c===void 0||typeof c==="object")this.removeAttribute(E);else this.setAttribute(E,c);this.queueRender(),this._attrValues.set(f,c)}}})}}connectedCallback(){if(xo(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(Hn.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(){Hn.unobserve(this)}formResetCallback(){if(this.value!==void 0)this.value=this.defaultValue??""}formDisabledCallback(n){if(n)this.setAttribute("disabled","");else this.removeAttribute("disabled")}formStateRestoreCallback(n){if(this.value!==void 0&&typeof n==="string")this.value=n}_changeQueued=!1;_renderQueued=!1;queueRender(n=!1){if(!this._hydrated)return;if(!this._changeQueued)this._changeQueued=n;if(!this._renderQueued)this._renderQueued=!0,requestAnimationFrame(()=>{if(this._changeQueued){if(Lf(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 n=typeof this.content!=="function",f=typeof this.content==="function"?this.content(i):this.content,{styleSpec:E}=this.constructor,{styleNode:o}=this.constructor;if(E)o=this.constructor.styleNode=i.style(p(E)),delete this.constructor.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecrated, use static styleNode or statc styleSpec instead"),o=this.styleNode;if(o){let M=this.attachShadow({mode:"open"});M.appendChild(o.cloneNode(!0)),cf(M,f,n)}else if(f!==null){let M=Array.from(this.childNodes);cf(this,f,n),this.isSlotted=this.querySelector("slot,xin-slot")!==void 0;let m=Array.from(this.querySelectorAll("slot"));if(m.length>0)m.forEach(Ff.replaceSlot);if(M.length>0){let c={"":this};Array.from(this.querySelectorAll("xin-slot")).forEach((w)=>{c[w.name]=w}),M.forEach((w)=>{let L=c[""],y=w instanceof Element?c[w.slot]:L;(y!==void 0?y:L).append(w)})}}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 n=typeof this.value==="string"?this.value:String(this.value);sn(this,n)}}class Ff extends I{static initAttributes={name:""};content=null;static replaceSlot(n){let f=document.createElement("xin-slot");if(n.name!=="")f.setAttribute("name",n.name);n.replaceWith(f)}}var NM=Ff.elementCreator({tag:"xin-slot"});var JE=(n=()=>!0)=>{let f=localStorage.getItem("xin-state");if(f!=null){let o=JSON.parse(f);for(let M of Object.keys(o).filter(n))if(G[M]!==void 0)Object.assign(G[M],o[M]);else G[M]=o[M]}let E=mn(()=>{let o={},M=F(G);for(let m of Object.keys(M).filter(n))o[m]=M[m];localStorage.setItem("xin-state",JSON.stringify(o)),console.log("xin state saved to localStorage")},500);cn(n,E)};var Ho="tosijs-share",Xo="tosijs-share",Fn="shared",To=1,Qf=new Set,Gf=new Set,Zf=new Map,En=null,zf="",rn=null,io=null;function FE(){if(rn!=null)return Promise.resolve(rn);return new Promise((n,f)=>{let E=indexedDB.open(Xo,To);E.onupgradeneeded=()=>{E.result.createObjectStore(Fn)},E.onsuccess=()=>{rn=E.result,n(rn)},E.onerror=()=>f(E.error)})}var Yo={async get(n){let f=await FE();return new Promise((E,o)=>{let m=f.transaction(Fn,"readonly").objectStore(Fn).get(n);m.onsuccess=()=>E(m.result),m.onerror=()=>o(m.error)})},async set(n,f){let E=await FE();return new Promise((o,M)=>{let m=E.transaction(Fn,"readwrite");m.objectStore(Fn).put(f,n),m.oncomplete=()=>o(),m.onerror=()=>M(m.error)})}};function ZE(){return io??Yo}function $o(n){return n!=null&&n.type==="tosijs-share"&&typeof n.path==="string"}function QE(n){for(let f of Qf)if(n===f||n.startsWith(f+"."))return f;return}function Do(n){for(let f of Gf)if(n===f||n.startsWith(f+"."))return!0;return!1}function Jo(n,f){Gf.add(n),wn(k,n,f),A(n),xn().then(()=>{Gf.delete(n)})}function Fo(){if(En!=null)return En;return zf=crypto.randomUUID(),En=new BroadcastChannel(Ho),En.onmessage=(n)=>{let f=n.data;if(!$o(f))return;if(f.origin===zf)return;if(QE(f.path)===void 0)return;Jo(f.path,f.value)},En}function Zo(n,f){if(En==null)return;let E={type:"tosijs-share",path:n,value:f,origin:zf};En.postMessage(E)}function Qo(n){if(!Zf.has(n))Zf.set(n,mn(()=>{let f=W(k,n);ZE().set(n,f)},500));Zf.get(n)()}async function GE(...n){if(typeof BroadcastChannel>"u")return{restored:[]};Fo();let f=[],E=ZE();for(let o of n){let M=typeof o==="string"?o:Q(o);if(M===void 0)throw Error("share() requires boxed proxies or string paths. Got a non-proxy value.");if(Qf.has(M))continue;Qf.add(M);let m=await E.get(M);if(m!==void 0)wn(k,M,m),A(M),f.push(o);else{let c=W(k,M);await E.set(M,c)}V((c)=>c===M||c.startsWith(M+"."),(c)=>{if(Do(c))return;let w=QE(c);if(w===void 0)return;let L=W(k,c);Zo(c,L),Qo(w)})}return{restored:f}}var un="1.4.1";function Zn(n){return Object.assign(q,n),q}function Qn(n){return r("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),Zn(n)}function _n(n,f=!1){if(f)return r("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),Qn(n);return Object.keys(n).forEach((E)=>{G[E]=n[E]}),G}var Go={};async function Gn(n,f){let{type:E,styleSpec:o}=await f(n,{Color:C,Component:I,elements:i,svgElements:Bn,mathML:Vn,varDefault:Yn,vars:An,xin:G,boxed:q,xinProxy:_n,boxedProxy:Qn,tosi:Zn,makeComponent:Gn,bind:B,on:nn,version:un}),M={type:E,creator:E.elementCreator({tag:n,styleSpec:o})};return Go[n]=M,M}var Wf={},zo=(n)=>import(n);class zn extends I{static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(n)=>{};async packaged(){let{tag:n,src:f,property:E}=this,o=`${n}.${E}:${f}`;if(!this.loaded){if(Wf[o]===void 0)Wf[o]=zo(f).then((M)=>{let m=M[E];return Gn(n,m)});else console.log(`using cached ${n} with signature ${o}`);this.loaded=await Wf[o],this.blueprintLoaded(this.loaded)}return this.loaded}}var zE=zn.elementCreator({tag:"xin-blueprint",styleSpec:{":host":{display:"none"}}});class bn extends I{allLoaded=()=>{};constructor(){super()}async load(){let f=Array.from(this.querySelectorAll(zn.tagName)).filter((E)=>E.src).map((E)=>E.packaged());await Promise.all(f),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var WE=bn.elementCreator({tag:"xin-loader",styleSpec:{":host":{display:"none"}}});})();
|
|
14
14
|
|
|
15
|
-
//# debugId=
|
|
15
|
+
//# debugId=B72BC9223D28AC8A64756E2164756E21
|
|
16
16
|
//# sourceMappingURL=index.js.map
|