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