tosijs 1.2.0 → 1.3.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/color.d.ts +17 -0
- package/dist/css.d.ts +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +7 -7
- package/dist/main.js +12 -9
- package/dist/main.js.map +7 -7
- package/dist/module.js +12 -9
- package/dist/module.js.map +7 -7
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/color.d.ts
CHANGED
|
@@ -43,5 +43,22 @@ export declare class Color {
|
|
|
43
43
|
static blendHue(a: number, b: number, t: number): number;
|
|
44
44
|
mix(otherColor: Color, t: number): Color;
|
|
45
45
|
colorMix(otherColor: Color, t: number): Color;
|
|
46
|
+
private static computedColorStylesheet;
|
|
47
|
+
private static computedColors;
|
|
48
|
+
private static recomputeQueued;
|
|
49
|
+
/**
|
|
50
|
+
* Register a computed color variable. Called by vars proxy when a computed
|
|
51
|
+
* color like `vars.primaryColor50b` is accessed.
|
|
52
|
+
*/
|
|
53
|
+
static registerComputedColor(outputVar: string, sourceVar: string, scale: number, method: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Queue a recomputation of all computed color variables.
|
|
56
|
+
* Called when observant stylesheets change.
|
|
57
|
+
*/
|
|
58
|
+
static queueRecompute(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Recompute all registered computed color variables and update the stylesheet.
|
|
61
|
+
*/
|
|
62
|
+
private static recomputeColors;
|
|
46
63
|
}
|
|
47
64
|
export {};
|
package/dist/css.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XinStyleSheet, XinStyleRule } from './css-types';
|
|
2
|
+
export declare function onStylesheetChange(callback: () => void): () => void;
|
|
2
3
|
export declare function StyleSheet(id: string, styleSpec: XinStyleSheet): void;
|
|
3
4
|
export declare const processProp: (prop: string, value: string | number) => {
|
|
4
5
|
prop: string;
|
|
@@ -19,4 +20,15 @@ type VarsType = {
|
|
|
19
20
|
};
|
|
20
21
|
export declare const vars: VarsType;
|
|
21
22
|
type CssVarBuilder = (val: string | number) => string;
|
|
23
|
+
export type ColorScheme = 'light' | 'dark';
|
|
24
|
+
export type ContrastPreference = 'no-preference' | 'more' | 'less' | 'custom';
|
|
25
|
+
export interface ThemePreferences {
|
|
26
|
+
colorScheme: ColorScheme;
|
|
27
|
+
contrast: ContrastPreference;
|
|
28
|
+
reducedMotion: boolean;
|
|
29
|
+
reducedTransparency: boolean;
|
|
30
|
+
forcedColors: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function getThemePreferences(): ThemePreferences;
|
|
33
|
+
export declare function onThemePreferencesChange(callback: (prefs: ThemePreferences) => void): () => void;
|
|
22
34
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { bind, on, touchElement } from './bind';
|
|
2
2
|
export { bindings } from './bindings';
|
|
3
|
-
export { css, invertLuminance, initVars, vars, varDefault, StyleSheet, } from './css';
|
|
3
|
+
export { css, invertLuminance, initVars, vars, varDefault, StyleSheet, onStylesheetChange, getThemePreferences, onThemePreferencesChange, } from './css';
|
|
4
|
+
export type { ColorScheme, ContrastPreference, ThemePreferences } from './css';
|
|
4
5
|
export type { XinStyleSheet, XinStyleMap, XinStyleRule } from './css-types';
|
|
5
6
|
export { Color } from './color';
|
|
6
7
|
export { Component } from './component';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
(()=>{var{defineProperty:Jo,getOwnPropertyNames:rn,getOwnPropertyDescriptor:sn}=Object,tn=Object.prototype.hasOwnProperty;var le=new WeakMap,cn=(o)=>{var e=le.get(o),n;if(e)return e;if(e=Jo({},"__esModule",{value:!0}),o&&typeof o==="object"||typeof o==="function")rn(o).map((r)=>!tn.call(e,r)&&Jo(e,r,{get:()=>o[r],enumerable:!(n=sn(o,r))||n.enumerable}));return le.set(o,e),e};var fn=(o,e)=>{for(var n in e)Jo(o,n,{get:e[n],enumerable:!0,configurable:!0,set:(r)=>e[n]=()=>r})};var qn={};fn(qn,{xinValue:()=>Ee,xinProxy:()=>Fo,xinPath:()=>Ce,xin:()=>w,warnDeprecated:()=>F,version:()=>Do,vars:()=>Mo,varDefault:()=>to,validateAgainstConstraints:()=>zo,updates:()=>Vo,unobserve:()=>J,touchElement:()=>$o,touch:()=>q,tosiValue:()=>p,tosiSetValue:()=>we,tosiPath:()=>x,tosi:()=>mo,throttle:()=>ro,svgElements:()=>Lo,settings:()=>Q,on:()=>B,observe:()=>Ho,mathML:()=>ko,makeComponent:()=>uo,invertLuminance:()=>Qe,initVars:()=>je,hotReload:()=>Ne,getListItem:()=>ao,getListInstance:()=>Xo,getListBinding:()=>so,getCssVar:()=>bo,elements:()=>u,deprecated:()=>Co,deleteListItem:()=>Ie,debounce:()=>xo,css:()=>K,boxedProxy:()=>lo,boxed:()=>V,blueprintLoader:()=>en,blueprint:()=>on,bindings:()=>io,bind:()=>S,StyleSheet:()=>Je,MoreMath:()=>Ye,Component:()=>a,Color:()=>d,BlueprintLoader:()=>Yo,Blueprint:()=>yo});function $(o){if(o==null||typeof o!=="object")return o;if(o instanceof Set)return new Set(o);else if(Array.isArray(o))return o.map($);let e={};for(let n in o){let r=o[n];if(o!=null&&typeof o==="object")e[n]=$(r);else e[n]=r}return e}var jo="-xin-data",j=`.${jo}`,Qo="-xin-event",qo=`.${Qo}`,T=Symbol.for("xin-path"),D=Symbol.for("xin-value"),Go="xinObserve",Zo="xinBind",Oo="xinOn",P=Symbol("list-binding"),wo=Symbol("list-instance"),Wo=new Map;function ue(o,e){let n=Wo.get(o);if(n===void 0)n=new Set,Wo.set(o,n);n.add(e)}function ye(o){return Wo.get(o)}var de=new Set;function F(o,e){if(!de.has(o))console.warn(e),de.add(o)}function Co(o,e){let n=!1;return(...r)=>{if(!n)console.warn(e),n=!0;return o(...r)}}var x=(o)=>{return o&&o[T]||void 0};function p(o){if(typeof o==="object"&&o!==null){let e=o[D];return e!==void 0?e:o}return o}function we(o,e){if(x(o)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");o[D]=e}var Ce=Co(x,"xinPath is deprecated. Use tosiPath instead."),Ee=Co(p,"xinValue is deprecated. Use tosiValue instead."),U=new WeakMap,z=new WeakMap;var A=(o)=>{let e=o.cloneNode();if(e instanceof Element){let n=z.get(o),r=U.get(o);if(n!=null)z.set(e,$(n));if(r!=null)U.set(e,$(r))}for(let n of Array.from(o instanceof HTMLTemplateElement?o.content.childNodes:o.childNodes))if(n instanceof Element||n instanceof DocumentFragment)e.appendChild(A(n));else e.appendChild(n.cloneNode());return e};var Q={debug:!1,perf:!1};var mn=(o)=>{try{return JSON.stringify(o)}catch(e){return"{has circular references}"}},Uo=(...o)=>Error(o.map(mn).join(" "));var ln=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),dn=0,un=()=>(parseInt("10000",36)+ ++dn).toString(36).slice(-5),yn=()=>ln()+un(),Ro=Symbol("delete"),xe=Symbol("new-object"),Ao=Symbol("automatic-index");function be(o){if(o==="")return[];if(Array.isArray(o))return o;else{let e=[];while(o.length>0){let n=o.search(/\[[^\]]+\]/);if(n===-1){e.push(o.split("."));break}else{let r=o.slice(0,n);if(o=o.slice(n),r!=="")e.push(r.split("."));if(n=o.indexOf("]")+1,e.push(o.slice(1,n-1)),o.slice(n,n+1)===".")n+=1;o=o.slice(n)}}return e}}var Y=new WeakMap;function Me(o,e){if(Y.get(o)===void 0)Y.set(o,{});if(Y.get(o)[e]===void 0)Y.get(o)[e]={};let n=Y.get(o)[e];if(e==="_auto_")o.forEach((r,i)=>{if(r[Ao]===void 0)r[Ao]=yn();n[r[Ao]+""]=i});else o.forEach((r,i)=>{n[g(r,e)+""]=i});return n}function wn(o,e){if(Y.get(o)===void 0||Y.get(o)[e]===void 0)return Me(o,e);else return Y.get(o)[e]}function Cn(o,e,n){n=n+"";let r=wn(o,e)[n];if(r===void 0||g(o[r],e)+""!==n)r=Me(o,e)[n];return r}function En(o,e,n){if(o[e]===void 0&&n!==void 0)o[e]=n;return o[e]}function Te(o,e,n,r){let i=e!==""?Cn(o,e,n):n;if(r===Ro)return o.splice(i,1),Y.delete(o),Symbol("deleted");else if(r===xe){if(e===""&&o[i]===void 0)o[i]={}}else if(r!==void 0)if(i!==void 0)o[i]=r;else if(e!==""&&g(r,e)+""===n+"")o.push(r),i=o.length-1;else throw Error(`byIdPath insert failed at [${e}=${n}]`);return o[i]}function he(o){if(!Array.isArray(o))throw Uo("setByPath failed: expected array, found",o)}function pe(o){if(o==null||!(o instanceof Object))throw Uo("setByPath failed: expected Object, found",o)}function g(o,e){let n=be(e),r=o,i,s,t,c;for(i=0,s=n.length;r!==void 0&&i<s;i++){let f=n[i];if(Array.isArray(f))for(t=0,c=f.length;r!==void 0&&t<c;t++){let m=f[t];r=r[m]}else if(r.length===0){if(r=r[Number(f.slice(1))],f[0]!=="=")return}else if(f.includes("=")){let[m,...l]=f.split("=");r=Te(r,m,l.join("="))}else t=parseInt(f,10),r=r[t]}return r}function Le(o,e,n){let r=o;if(e==="")throw Error("setByPath cannot be used to set the root object");let i=be(e);while(r!=null&&i.length>0){let s=i.shift();if(typeof s==="string"){let t=s.indexOf("=");if(t>-1){if(t===0)pe(r);else he(r);let c=s.slice(0,t),f=s.slice(t+1);if(r=Te(r,c,f,i.length>0?xe:n),i.length===0)return!0}else{he(r);let c=parseInt(s,10);if(i.length>0)r=r[c];else{if(n!==Ro){if(r[c]===n)return!1;r[c]=n}else r.splice(c,1);return!0}}}else if(Array.isArray(s)&&s.length>0){pe(r);while(s.length>0){let t=s.shift();if(s.length>0||i.length>0)r=En(r,t,s.length>0?{}:[]);else{if(n!==Ro){if(r[t]===n)return!1;r[t]=n}else{if(!Object.prototype.hasOwnProperty.call(r,t))return!1;delete r[t]}return!0}}}else throw Error(`setByPath failed, bad path ${e}`)}throw Error(`setByPath(${o}, ${e}, ${n}) failed`)}var ke=Symbol("observer should be removed"),Eo=[],ho=[],Ko=!1,Bo,Io;function Se(o,e,n,r){let i=ye(o);if(i===void 0)return[];let s=[];for(let t of i){let c=g(n,t);if(c!==void 0)s.push(`${o}[${t}=${c}]${r}`)}return s}class He{description;test;callback;constructor(o,e){let n=typeof e==="string"?`"${e}"`:`function ${e.name}`,r;if(typeof o==="string")this.test=(i)=>typeof i==="string"&&i!==""&&(o.startsWith(i)||i.startsWith(o)),r=`test = "${o}"`;else if(o instanceof RegExp)this.test=o.test.bind(o),r=`test = "${o.toString()}"`;else if(o instanceof Function)this.test=o,r=`test = function ${o.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${r}, ${n}`,typeof e==="function")this.callback=e;else throw Error("expect callback to be a path or function");Eo.push(this)}}var Vo=async()=>{if(Bo===void 0)return;await Bo},hn=()=>{if(Q.perf)console.time("xin async update");let o=Array.from(ho);for(let e of o)Eo.filter((n)=>{let r;try{r=n.test(e)}catch(i){throw Error(`Listener ${n.description} threw "${i}" at "${e}"`)}if(r===ke)return J(n),!1;return r}).forEach((n)=>{let r;try{r=n.callback(e)}catch(i){console.error(`Listener ${n.description} threw "${i}" handling "${e}"`)}if(r===ke)J(n)});if(ho.splice(0),Ko=!1,typeof Io==="function")Io();if(Q.perf)console.timeEnd("xin async update")},q=(o)=>{let e=typeof o==="string"?o:x(o);if(e===void 0)throw console.error("touch was called on an invalid target",o),Error("touch was called on an invalid target");if(Ko===!1)Bo=new Promise((n)=>{Io=n}),Ko=setTimeout(hn);if(ho.find((n)=>e.startsWith(n))==null)ho.push(e)},G=(o,e)=>{return new He(o,e)},J=(o)=>{let e=Eo.indexOf(o);if(e>-1)Eo.splice(e,1);else throw Error("unobserve failed, listener not found")};var N={},_o=null,Xe=(o)=>{_o=o},po=()=>{if(_o===null)throw Error("xin proxy not initialized");return _o},vo=null,Po=null,ae=(o,e)=>{vo=o,Po=e},oo=()=>{if(vo===null)throw Error("bind not initialized");return vo},eo=()=>{if(Po===null)throw Error("on not initialized");return Po};var No=(o,e)=>{let n=new Event(e);o.dispatchEvent(n)},ze=(o)=>{if(o instanceof HTMLInputElement)return o.type;else if(o instanceof HTMLSelectElement&&o.hasAttribute("multiple"))return"multi-select";else return"other"},De=(o,e)=>{switch(ze(o)){case"radio":o.checked=o.value===e;break;case"checkbox":o.checked=!!e;break;case"date":o.valueAsDate=new Date(e);break;case"multi-select":for(let n of Array.from(o.querySelectorAll("option")))n.selected=e[n.value];break;default:o.value=e}},Fe=(o)=>{switch(ze(o)){case"radio":{let e=o.parentElement?.querySelector(`[name="${o.name}"]:checked`);return e!=null?e.value:null}case"checkbox":return o.checked;case"date":return o.valueAsDate?.toISOString();case"multi-select":return Array.from(o.querySelectorAll("option")).reduce((e,n)=>{return e[n.value]=n.selected,e},{});default:return o.value}},{ResizeObserver:$e}=globalThis,no=$e!=null?new $e((o)=>{for(let e of o){let n=e.target;No(n,"resize")}}):{observe(){},unobserve(){}},oe=(o,e,n=!0)=>{if(o!=null&&e!=null)if(typeof e==="string")o.textContent=e;else if(Array.isArray(e))e.forEach((r)=>{o.append(r instanceof Node&&n?A(r):r)});else if(e instanceof Node)o.append(n?A(e):e);else throw Error("expect text content or document node")};var xo=(o,e=250)=>{let n;return(...r)=>{if(n!==void 0)clearTimeout(n);n=setTimeout(()=>{o(...r)},e)}},ro=(o,e=250)=>{let n,r=Date.now()-e,i=!1;return(...s)=>{if(clearTimeout(n),n=setTimeout(()=>{o(...s),r=Date.now()},e),!i&&Date.now()-r>=e){i=!0;try{o(...s),r=Date.now()}finally{i=!1}}}};var io={value:{toDOM:De,fromDOM(o){return Fe(o)}},text:{toDOM(o,e){o.textContent=e}},enabled:{toDOM(o,e){o.disabled=!e}},disabled:{toDOM(o,e){o.disabled=Boolean(e)}},list:{toDOM(o,e,n){so(o,e,n).update(e)}}};function b(o){return o.replace(/[A-Z]/g,(e)=>{return`-${e.toLocaleLowerCase()}`})}function ee(o){return o.replace(/-([a-z])/g,(e,n)=>{return n.toLocaleUpperCase()})}var pn=180/Math.PI,xn=Math.PI/180;function k(o,e,n){return n<o?NaN:e<o?o:e>n?n:e}function W(o,e,n,r=!0){if(r)n=k(0,n,1);return n*(e-o)+o}var Ye={RADIANS_TO_DEGREES:pn,DEGREES_TO_RADIANS:xn,clamp:k,lerp:W};function bo(o,e=document.body){let n=getComputedStyle(e);if(o.endsWith(")")&&o.startsWith("var("))o=o.slice(4,-1);return n.getPropertyValue(o).trim()}var bn=(o,e,n)=>{return(0.299*o+0.587*e+0.114*n)/255},R=(o)=>("00"+Math.round(Number(o)).toString(16)).slice(-2);class ge{h;s;l;constructor(o,e,n){o/=255,e/=255,n/=255;let r=Math.max(o,e,n),i=r-Math.min(o,e,n),s=i!==0?r===o?(e-n)/i:r===e?2+(n-o)/i:4+(o-e)/i:0;this.h=60*s<0?60*s+360:60*s,this.s=i!==0?r<=0.5?i/(2*r-i):i/(2-(2*r-i)):0,this.l=(2*r-i)/2}}var v=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;class d{r;g;b;a;static fromVar(o,e=document.body){return d.fromCss(bo(o,e))}static fromCss(o){let e=o;if(v instanceof HTMLSpanElement)v.style.color="black",v.style.color=o,document.body.appendChild(v),e=getComputedStyle(v).color,v.remove();let[n,r,i,s]=e.match(/[\d.]+/g)||["0","0","0","0"],t=e.startsWith("color(srgb")?255:1;return new d(Number(n)*t,Number(r)*t,Number(i)*t,s==null?1:Number(s))}static fromHsl(o,e,n,r=1){let i,s,t;if(e===0)i=s=t=n;else{let f=(E,M,C)=>{if(C<0)C+=1;if(C>1)C-=1;if(C<0.16666666666666666)return E+(M-E)*6*C;if(C<0.5)return M;if(C<0.6666666666666666)return E+(M-E)*(0.6666666666666666-C)*6;return E},m=n<0.5?n*(1+e):n+e-n*e,l=2*n-m,y=(o%360+360)%360/360;i=f(l,m,y+0.3333333333333333),s=f(l,m,y),t=f(l,m,y-0.3333333333333333)}let c=new d(i*255,s*255,t*255,r);return c.hslCached={h:(o%360+360)%360,s:e,l:n},c}static black=new d(0,0,0);static white=new d(255,255,255);constructor(o,e,n,r=1){this.r=k(0,o,255),this.g=k(0,e,255),this.b=k(0,n,255),this.a=k(0,r,1)}get inverse(){return new d(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:o,s:e,l:n}=this._hsl;return d.fromHsl(o,e,1-n,this.a)}get opaque(){return this.a===1?this:new d(this.r,this.g,this.b,1)}contrasting(o=1){return this.opaque.blend(this.brightness>0.5?d.black:d.white,o)}get rgb(){let{r:o,g:e,b:n}=this;return`rgb(${o.toFixed(0)},${e.toFixed(0)},${n.toFixed(0)})`}get rgba(){let{r:o,g:e,b:n,a:r}=this;return`rgba(${o.toFixed(0)},${e.toFixed(0)},${n.toFixed(0)},${r.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 ge(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:o,s:e,l:n}=this._hsl;return`hsl(${o.toFixed(0)}deg ${(e*100).toFixed(0)}% ${(n*100).toFixed(0)}%)`}get hsla(){let{h:o,s:e,l:n}=this._hsl;return`hsl(${o.toFixed(0)}deg ${(e*100).toFixed(0)}% ${(n*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let o=this.brightness*255;return new d(o,o,o)}get brightness(){return bn(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+R(this.r)+R(this.g)+R(this.b):"#"+R(this.r)+R(this.g)+R(this.b)+R(Math.floor(255*this.a))}brighten(o){let{h:e,s:n,l:r}=this._hsl,i=k(0,r+o*(1-r),1);return d.fromHsl(e,n,i,this.a)}darken(o){let{h:e,s:n,l:r}=this._hsl,i=k(0,r*(1-o),1);return d.fromHsl(e,n,i,this.a)}saturate(o){let{h:e,s:n,l:r}=this._hsl,i=k(0,n+o*(1-n),1);return d.fromHsl(e,i,r,this.a)}desaturate(o){let{h:e,s:n,l:r}=this._hsl,i=k(0,n*(1-o),1);return d.fromHsl(e,i,r,this.a)}rotate(o){let{h:e,s:n,l:r}=this._hsl,i=(e+360+o)%360;return d.fromHsl(i,n,r,this.a)}opacity(o){let{h:e,s:n,l:r}=this._hsl;return d.fromHsl(e,n,r,o)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(o,e){return new d(W(this.r,o.r,e),W(this.g,o.g,e),W(this.b,o.b,e),W(this.a,o.a,e))}static blendHue(o,e,n){let r=(e-o+720)%360;if(r<180)return o+n*r;else return o-(360-r)*n}mix(o,e){let n=this._hsl,r=o._hsl;return d.fromHsl(n.s===0?r.h:r.s===0?n.h:d.blendHue(n.h,r.h,e),W(n.s,r.s,e),W(n.l,r.l,e),W(this.a,o.a,e))}colorMix(o,e){return d.fromCss(`color-mix(in hsl, ${this.html}, ${o.html} ${(e*100).toFixed(0)}%)`)}}function Je(o,e){let n=u.style(K(e));n.id=o,document.head.append(n)}var Mn=["animation-iteration-count","flex","flex-base","flex-grow","flex-shrink","opacity","order","tab-size","widows","z-index","zoom"],ne=(o,e)=>{if(typeof e==="number"&&!Mn.includes(o))e=`${e}px`;if(o.startsWith("_"))if(o.startsWith("__"))o="--"+o.substring(2),e=`var(${o}-default, ${e})`;else o="--"+o.substring(1);return{prop:o,value:String(e)}},Tn=(o,e,n)=>{if(n===void 0)return"";if(n instanceof d)n=n.html;let r=ne(e,n);return`${o} ${r.prop}: ${r.value};`},We=(o,e,n="")=>{let r=b(o);if(typeof e==="object"&&!(e instanceof d)){let i=Object.keys(e).map((s)=>We(s,e[s],`${n} `)).join(`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`);return`${
|
|
6
|
-
${
|
|
1
|
+
(()=>{var{defineProperty:Kn,getOwnPropertyNames:yf,getOwnPropertyDescriptor:Lf}=Object,xf=Object.prototype.hasOwnProperty;var xo=new WeakMap,Tf=(n)=>{var o=xo.get(n),f;if(o)return o;if(o=Kn({},"__esModule",{value:!0}),n&&typeof n==="object"||typeof n==="function")yf(n).map((i)=>!xf.call(o,i)&&Kn(o,i,{get:()=>n[i],enumerable:!(f=Lf(n,i))||f.enumerable}));return xo.set(n,o),o};var sf=(n,o)=>{for(var f in o)Kn(n,f,{get:o[f],enumerable:!0,configurable:!0,set:(i)=>o[f]=()=>i})};var pf={};sf(pf,{xinValue:()=>Fo,xinProxy:()=>An,xinPath:()=>Xo,xin:()=>X,warnDeprecated:()=>q,version:()=>qn,vars:()=>Zn,varDefault:()=>wn,validateAgainstConstraints:()=>Un,updates:()=>tn,unobserve:()=>u,touchElement:()=>On,touch:()=>B,tosiValue:()=>H,tosiSetValue:()=>Co,tosiPath:()=>F,tosi:()=>Ln,throttle:()=>mn,svgElements:()=>Gn,settings:()=>S,onThemePreferencesChange:()=>Po,onStylesheetChange:()=>Bo,on:()=>p,observe:()=>l,mathML:()=>Qn,makeComponent:()=>Tn,invertLuminance:()=>bo,initVars:()=>eo,hotReload:()=>Ef,getThemePreferences:()=>co,getListItem:()=>zn,getListInstance:()=>Wn,getListBinding:()=>rn,getCssVar:()=>$n,elements:()=>x,deprecated:()=>Cn,deleteListItem:()=>nf,debounce:()=>Yn,css:()=>V,boxedProxy:()=>xn,boxed:()=>g,blueprintLoader:()=>wf,blueprint:()=>rf,bindings:()=>En,bind:()=>Q,StyleSheet:()=>Io,MoreMath:()=>Ko,Component:()=>W,Color:()=>y,BlueprintLoader:()=>jn,Blueprint:()=>sn});function z(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(z);let o={};for(let f in n){let i=n[f];if(n!=null&&typeof n==="object")o[f]=z(i);else o[f]=i}return o}var Sn="-xin-data",R=`.${Sn}`,Bn="-xin-event",In=`.${Bn}`,J=Symbol.for("xin-path"),U=Symbol.for("xin-value"),Vn="xinObserve",en="xinBind",bn="xinOn",a=Symbol("list-binding"),Hn=Symbol("list-instance"),Rn=new Map;function so(n,o){let f=Rn.get(n);if(f===void 0)f=new Set,Rn.set(n,f);f.add(o)}function Ho(n){return Rn.get(n)}var To=new Set;function q(n,o){if(!To.has(n))console.warn(o),To.add(n)}function Cn(n,o){let f=!1;return(...i)=>{if(!f)console.warn(o),f=!0;return n(...i)}}var F=(n)=>{return n&&n[J]||void 0};function H(n){if(typeof n==="object"&&n!==null){let o=n[U];return o!==void 0?o:n}return n}function Co(n,o){if(F(n)===void 0)throw Error("tosiSetValue requires a xin or boxed proxy");n[U]=o}var Xo=Cn(F,"xinPath is deprecated. Use tosiPath instead."),Fo=Cn(H,"xinValue is deprecated. Use tosiValue instead."),P=new WeakMap,O=new WeakMap;var _=(n)=>{let o=n.cloneNode();if(o instanceof Element){let f=O.get(n),i=P.get(n);if(f!=null)O.set(o,z(f));if(i!=null)P.set(o,z(i))}for(let f of Array.from(n instanceof HTMLTemplateElement?n.content.childNodes:n.childNodes))if(f instanceof Element||f instanceof DocumentFragment)o.appendChild(_(f));else o.appendChild(f.cloneNode());return o};var S={debug:!1,perf:!1};var Hf=(n)=>{try{return JSON.stringify(n)}catch(o){return"{has circular references}"}},Pn=(...n)=>Error(n.map(Hf).join(" "));var Cf=()=>new Date(parseInt("1000000000",36)+Date.now()).valueOf().toString(36).slice(1),Xf=0,Ff=()=>(parseInt("10000",36)+ ++Xf).toString(36).slice(-5),Df=()=>Cf()+Ff(),hn=Symbol("delete"),$o=Symbol("new-object"),_n=Symbol("automatic-index");function Jo(n){if(n==="")return[];if(Array.isArray(n))return n;else{let o=[];while(n.length>0){let f=n.search(/\[[^\]]+\]/);if(f===-1){o.push(n.split("."));break}else{let i=n.slice(0,f);if(n=n.slice(f),i!=="")o.push(i.split("."));if(f=n.indexOf("]")+1,o.push(n.slice(1,f-1)),n.slice(f,f+1)===".")f+=1;n=n.slice(f)}}return o}}var A=new WeakMap;function Zo(n,o){if(A.get(n)===void 0)A.set(n,{});if(A.get(n)[o]===void 0)A.get(n)[o]={};let f=A.get(n)[o];if(o==="_auto_")n.forEach((i,c)=>{if(i[_n]===void 0)i[_n]=Df();f[i[_n]+""]=c});else n.forEach((i,c)=>{f[j(i,o)+""]=c});return f}function Yf(n,o){if(A.get(n)===void 0||A.get(n)[o]===void 0)return Zo(n,o);else return A.get(n)[o]}function $f(n,o,f){f=f+"";let i=Yf(n,o)[f];if(i===void 0||j(n[i],o)+""!==f)i=Zo(n,o)[f];return i}function Jf(n,o,f){if(n[o]===void 0&&f!==void 0)n[o]=f;return n[o]}function Go(n,o,f,i){let c=o!==""?$f(n,o,f):f;if(i===hn)return n.splice(c,1),A.delete(n),Symbol("deleted");else if(i===$o){if(o===""&&n[c]===void 0)n[c]={}}else if(i!==void 0)if(c!==void 0)n[c]=i;else if(o!==""&&j(i,o)+""===f+"")n.push(i),c=n.length-1;else throw Error(`byIdPath insert failed at [${o}=${f}]`);return n[c]}function Do(n){if(!Array.isArray(n))throw Pn("setByPath failed: expected array, found",n)}function Yo(n){if(n==null||!(n instanceof Object))throw Pn("setByPath failed: expected Object, found",n)}function j(n,o){let f=Jo(o),i=n,c,m,r,w;for(c=0,m=f.length;i!==void 0&&c<m;c++){let E=f[c];if(Array.isArray(E))for(r=0,w=E.length;i!==void 0&&r<w;r++){let M=E[r];i=i[M]}else if(i.length===0){if(i=i[Number(E.slice(1))],E[0]!=="=")return}else if(E.includes("=")){let[M,...L]=E.split("=");i=Go(i,M,L.join("="))}else r=parseInt(E,10),i=i[r]}return i}function Qo(n,o,f){let i=n;if(o==="")throw Error("setByPath cannot be used to set the root object");let c=Jo(o);while(i!=null&&c.length>0){let m=c.shift();if(typeof m==="string"){let r=m.indexOf("=");if(r>-1){if(r===0)Yo(i);else Do(i);let w=m.slice(0,r),E=m.slice(r+1);if(i=Go(i,w,E,c.length>0?$o:f),c.length===0)return!0}else{Do(i);let w=parseInt(m,10);if(c.length>0)i=i[w];else{if(f!==hn){if(i[w]===f)return!1;i[w]=f}else i.splice(w,1);return!0}}}else if(Array.isArray(m)&&m.length>0){Yo(i);while(m.length>0){let r=m.shift();if(m.length>0||c.length>0)i=Jf(i,r,m.length>0?{}:[]);else{if(f!==hn){if(i[r]===f)return!1;i[r]=f}else{if(!Object.prototype.hasOwnProperty.call(i,r))return!1;delete i[r]}return!0}}}else throw Error(`setByPath failed, bad path ${o}`)}throw Error(`setByPath(${n}, ${o}, ${f}) failed`)}var ko=Symbol("observer should be removed"),Xn=[],Fn=[],pn=!1,Nn,gn;function Wo(n,o,f,i){let c=Ho(n);if(c===void 0)return[];let m=[];for(let r of c){let w=j(f,r);if(w!==void 0)m.push(`${n}[${r}=${w}]${i}`)}return m}class zo{description;test;callback;constructor(n,o){let f=typeof o==="string"?`"${o}"`:`function ${o.name}`,i;if(typeof n==="string")this.test=(c)=>typeof c==="string"&&c!==""&&(n.startsWith(c)||c.startsWith(n)),i=`test = "${n}"`;else if(n instanceof RegExp)this.test=n.test.bind(n),i=`test = "${n.toString()}"`;else if(n instanceof Function)this.test=n,i=`test = function ${n.name}`;else throw Error("expect listener test to be a string, RegExp, or test function");if(this.description=`${i}, ${f}`,typeof o==="function")this.callback=o;else throw Error("expect callback to be a path or function");Xn.push(this)}}var tn=async()=>{if(Nn===void 0)return;await Nn},Zf=()=>{if(S.perf)console.time("xin async update");let n=Array.from(Fn);Fn.length=0,pn=!1;for(let o of n)Xn.filter((f)=>{let i;try{i=f.test(o)}catch(c){throw Error(`Listener ${f.description} threw "${c}" at "${o}"`)}if(i===ko)return u(f),!1;return i}).forEach((f)=>{let i;try{i=f.callback(o)}catch(c){console.error(`Listener ${f.description} threw "${c}" handling "${o}"`)}if(i===ko)u(f)});if(typeof gn==="function")gn();if(S.perf)console.timeEnd("xin async update")},B=(n)=>{let o=typeof n==="string"?n:F(n);if(o===void 0)throw console.error("touch was called on an invalid target",n),Error("touch was called on an invalid target");if(pn===!1)Nn=new Promise((f)=>{gn=f}),pn=setTimeout(Zf);if(Fn.find((f)=>o.startsWith(f))==null)Fn.push(o)},I=(n,o)=>{return new zo(n,o)},u=(n)=>{let o=Xn.indexOf(n);if(o>-1)Xn.splice(o,1);else throw Error("unobserve failed, listener not found")};var nn={},ln=null,Oo=(n)=>{ln=n},Dn=()=>{if(ln===null)throw Error("xin proxy not initialized");return ln},vn=null,an=null,Uo=(n,o)=>{vn=n,an=o},on=()=>{if(vn===null)throw Error("bind not initialized");return vn},fn=()=>{if(an===null)throw Error("on not initialized");return an};var no=(n,o)=>{let f=new Event(o);n.dispatchEvent(f)},Ao=(n)=>{if(n instanceof HTMLInputElement)return n.type;else if(n instanceof HTMLSelectElement&&n.hasAttribute("multiple"))return"multi-select";else return"other"},jo=(n,o)=>{switch(Ao(n)){case"radio":n.checked=n.value===o;break;case"checkbox":n.checked=!!o;break;case"date":n.valueAsDate=new Date(o);break;case"multi-select":for(let f of Array.from(n.querySelectorAll("option")))f.selected=o[f.value];break;default:n.value=o}},uo=(n)=>{switch(Ao(n)){case"radio":{let o=n.parentElement?.querySelector(`[name="${n.name}"]:checked`);return o!=null?o.value:null}case"checkbox":return n.checked;case"date":return n.valueAsDate?.toISOString();case"multi-select":return Array.from(n.querySelectorAll("option")).reduce((o,f)=>{return o[f.value]=f.selected,o},{});default:return n.value}},{ResizeObserver:qo}=globalThis,cn=qo!=null?new qo((n)=>{for(let o of n){let f=o.target;no(f,"resize")}}):{observe(){},unobserve(){}},oo=(n,o,f=!0)=>{if(n!=null&&o!=null)if(typeof o==="string")n.textContent=o;else if(Array.isArray(o))o.forEach((i)=>{n.append(i instanceof Node&&f?_(i):i)});else if(o instanceof Node)n.append(f?_(o):o);else throw Error("expect text content or document node")};var Yn=(n,o=250)=>{let f;return(...i)=>{if(f!==void 0)clearTimeout(f);f=setTimeout(()=>{n(...i)},o)}},mn=(n,o=250)=>{let f,i=Date.now()-o,c=!1;return(...m)=>{if(clearTimeout(f),f=setTimeout(()=>{n(...m),i=Date.now()},o),!c&&Date.now()-i>=o){c=!0;try{n(...m),i=Date.now()}finally{c=!1}}}};var En={value:{toDOM:jo,fromDOM(n){return uo(n)}},text:{toDOM(n,o){n.textContent=o}},enabled:{toDOM(n,o){n.disabled=!o}},disabled:{toDOM(n,o){n.disabled=Boolean(o)}},list:{toDOM(n,o,f){rn(n,o,f).update(o)}}};function $(n){return n.replace(/[A-Z]/g,(o)=>{return`-${o.toLocaleLowerCase()}`})}function fo(n){return n.replace(/-([a-z])/g,(o,f)=>{return f.toLocaleUpperCase()})}var df=180/Math.PI,Gf=Math.PI/180;function G(n,o,f){return f<n?NaN:o<n?n:o>f?f:o}function K(n,o,f,i=!0){if(i)f=G(0,f,1);return f*(o-n)+n}var Ko={RADIANS_TO_DEGREES:df,DEGREES_TO_RADIANS:Gf,clamp:G,lerp:K};function $n(n,o=document.body){let f=getComputedStyle(o);if(n.endsWith(")")&&n.startsWith("var("))n=n.slice(4,-1);return f.getPropertyValue(n).trim()}var Qf=(n,o,f)=>{return(0.299*n+0.587*o+0.114*f)/255},h=(n)=>("00"+Math.round(Number(n)).toString(16)).slice(-2);class Ro{h;s;l;constructor(n,o,f){n/=255,o/=255,f/=255;let i=Math.max(n,o,f),c=i-Math.min(n,o,f),m=c!==0?i===n?(o-f)/c:i===o?2+(f-n)/c:4+(n-o)/c:0;this.h=60*m<0?60*m+360:60*m,this.s=c!==0?i<=0.5?c/(2*i-c):c/(2-(2*i-c)):0,this.l=(2*i-c)/2}}var t=globalThis.document!==void 0?globalThis.document.createElement("span"):void 0;class y{r;g;b;a;static fromVar(n,o=document.body){return y.fromCss($n(n,o))}static fromCss(n){let o=n.match(/^#([0-9a-fA-F]+)$/);if(o){let E=o[1];if(E.length===3)return new y(parseInt(E[0]+E[0],16),parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16));if(E.length===4)return new y(parseInt(E[0]+E[0],16),parseInt(E[1]+E[1],16),parseInt(E[2]+E[2],16),parseInt(E[3]+E[3],16)/255);if(E.length===6)return new y(parseInt(E.slice(0,2),16),parseInt(E.slice(2,4),16),parseInt(E.slice(4,6),16));if(E.length===8)return new y(parseInt(E.slice(0,2),16),parseInt(E.slice(2,4),16),parseInt(E.slice(4,6),16),parseInt(E.slice(6,8),16)/255)}let f=n;if(t instanceof HTMLSpanElement)t.style.color="black",t.style.color=n,document.body.appendChild(t),f=getComputedStyle(t).color,t.remove();let[i,c,m,r]=f.match(/[\d.]+/g)||["0","0","0","0"],w=f.startsWith("color(srgb")?255:1;return new y(Number(i)*w,Number(c)*w,Number(m)*w,r==null?1:Number(r))}static fromHsl(n,o,f,i=1){let c,m,r;if(o===0)c=m=r=f;else{let E=(D,Y,s)=>{if(s<0)s+=1;if(s>1)s-=1;if(s<0.16666666666666666)return D+(Y-D)*6*s;if(s<0.5)return Y;if(s<0.6666666666666666)return D+(Y-D)*(0.6666666666666666-s)*6;return D},M=f<0.5?f*(1+o):f+o-f*o,L=2*f-M,T=(n%360+360)%360/360;c=E(L,M,T+0.3333333333333333),m=E(L,M,T),r=E(L,M,T-0.3333333333333333)}let w=new y(c*255,m*255,r*255,i);return w.hslCached={h:(n%360+360)%360,s:o,l:f},w}static black=new y(0,0,0);static white=new y(255,255,255);constructor(n,o,f,i=1){this.r=G(0,n,255),this.g=G(0,o,255),this.b=G(0,f,255),this.a=G(0,i,1)}get inverse(){return new y(255-this.r,255-this.g,255-this.b,this.a)}get inverseLuminance(){let{h:n,s:o,l:f}=this._hsl;return y.fromHsl(n,o,1-f,this.a)}get opaque(){return this.a===1?this:new y(this.r,this.g,this.b,1)}contrasting(n=1){return this.opaque.blend(this.brightness>0.5?y.black:y.white,n)}get rgb(){let{r:n,g:o,b:f}=this;return`rgb(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)})`}get rgba(){let{r:n,g:o,b:f,a:i}=this;return`rgba(${n.toFixed(0)},${o.toFixed(0)},${f.toFixed(0)},${i.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 Ro(this.r,this.g,this.b);return this.hslCached}get hsl(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}%)`}get hsla(){let{h:n,s:o,l:f}=this._hsl;return`hsl(${n.toFixed(0)}deg ${(o*100).toFixed(0)}% ${(f*100).toFixed(0)}% / ${(this.a*100).toFixed(0)}%)`}get mono(){let n=this.brightness*255;return new y(n,n,n)}get brightness(){return Qf(this.r,this.g,this.b)}get html(){return this.toString()}toString(){return this.a===1?"#"+h(this.r)+h(this.g)+h(this.b):"#"+h(this.r)+h(this.g)+h(this.b)+h(Math.floor(255*this.a))}brighten(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i+n*(1-i),1);return y.fromHsl(o,f,c,this.a)}darken(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,i*(1-n),1);return y.fromHsl(o,f,c,this.a)}saturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f+n*(1-f),1);return y.fromHsl(o,c,i,this.a)}desaturate(n){let{h:o,s:f,l:i}=this._hsl,c=G(0,f*(1-n),1);return y.fromHsl(o,c,i,this.a)}rotate(n){let{h:o,s:f,l:i}=this._hsl,c=(o+360+n)%360;return y.fromHsl(c,f,i,this.a)}opacity(n){let{h:o,s:f,l:i}=this._hsl;return y.fromHsl(o,f,i,n)}swatch(){return console.log(`%c %c ${this.html}, ${this.rgba}`,`background-color: ${this.html}`,"background-color: transparent"),this}blend(n,o){return new y(K(this.r,n.r,o),K(this.g,n.g,o),K(this.b,n.b,o),K(this.a,n.a,o))}static blendHue(n,o,f){let i=(o-n+720)%360;if(i<180)return n+f*i;else return n-(360-i)*f}mix(n,o){let f=this._hsl,i=n._hsl;return y.fromHsl(f.s===0?i.h:i.s===0?f.h:y.blendHue(f.h,i.h,o),K(f.s,i.s,o),K(f.l,i.l,o),K(this.a,n.a,o))}colorMix(n,o){return y.fromCss(`color-mix(in hsl, ${this.html}, ${n.html} ${(o*100).toFixed(0)}%)`)}static computedColorStylesheet=null;static computedColors=new Map;static recomputeQueued=!1;static registerComputedColor(n,o,f,i){if(!y.computedColors.has(n))y.computedColors.set(n,{varName:o,scale:f,method:i}),y.queueRecompute()}static queueRecompute(){if(y.recomputeQueued)return;y.recomputeQueued=!0,queueMicrotask(()=>{y.recomputeQueued=!1,y.recomputeColors()})}static recomputeColors(){if(y.computedColors.size===0)return;let n=[];for(let[f,{varName:i,scale:c,method:m}]of y.computedColors)try{let r=y.fromVar(i),w;switch(m){case"b":w=c>0?r.brighten(c):r.darken(-c);break;case"s":w=c>0?r.saturate(c):r.desaturate(-c);break;case"h":w=r.rotate(c*100);break;case"o":w=r.opacity(c);break;default:continue}n.push(` ${f}: ${w.rgba};`)}catch(r){}if(n.length===0)return;let o=`:root {
|
|
2
|
+
${n.join(`
|
|
3
|
+
`)}
|
|
4
|
+
}`;if(y.computedColorStylesheet===null)y.computedColorStylesheet=document.createElement("style"),y.computedColorStylesheet.id="tosijs-computed-colors",document.head.append(y.computedColorStylesheet);y.computedColorStylesheet.textContent=o}}var Jn=new Set,So=!1;function kf(){if(!So)So=!0,Jn.add(()=>y.queueRecompute())}function Bo(n){return Jn.add(n),()=>Jn.delete(n)}function Wf(){kf();for(let n of Jn)n()}function Io(n,o){let f=H(o),i=x.style(V(f));i.id=n,document.head.append(i);let c=F(o);if(c!==void 0)l(c,()=>{i.textContent=V(H(o)),Wf()})}var zf=/^(animation-iteration-count|column-count|flex(-grow|-shrink)?|font-weight|line-height|opacity|order|orphans|scale|tab-size|widows|z-index|zoom)$/,io=(n,o)=>{if(typeof o==="number"&&!zf.test(n))o=`${o}px`;if(n.startsWith("_"))if(n.startsWith("__"))n="--"+n.substring(2),o=`var(${n}-default, ${o})`;else n="--"+n.substring(1);return{prop:n,value:String(o)}},Of=(n,o,f)=>{if(f===void 0)return"";if(f instanceof y)f=f.html;let i=io(o,f);return`${n} ${i.prop}: ${i.value};`},Vo=(n,o,f="")=>{let i=$(n);if(typeof o==="object"&&!(o instanceof y)){let c=Object.keys(o).map((m)=>Vo(m,o[m],`${f} `)).join(`
|
|
5
|
+
`);return`${f} ${n} {
|
|
6
|
+
${c}
|
|
7
|
+
${f} }`}else return Of(f,i,o)},V=(n,o="")=>{return Object.keys(n).map((i)=>{let c=n[i];if(typeof c==="string"){if(i==="@import")return`@import url('${c}');`;throw Error("top-level string value only allowed for `@import`")}let m=Object.keys(c).map((r)=>Vo(r,c[r])).join(`
|
|
8
|
+
`);return`${o}${i} {
|
|
9
|
+
${m}
|
|
7
10
|
}`}).join(`
|
|
8
11
|
|
|
9
|
-
`)},je=(o)=>{F("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let e={};for(let n of Object.keys(o)){let r=o[n],i=b(n);e[`--${i}`]=typeof r==="number"&&r!==0?String(r)+"px":r}return e},Qe=(o)=>{let e={};for(let n of Object.keys(o)){let r=o[n];if(r instanceof d)e[n]=r.inverseLuminance;else if(typeof r==="string"&&r.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))e[n]=d.fromCss(r).inverseLuminance}return e},to=new Proxy({},{get(o,e){if(o[e]===void 0){let n="--"+b(e);o[e]=(r)=>`var(${n}, ${r})`}return o[e]}}),Mo=new Proxy({},{get(o,e){if(e==="default")return to;if(o[e]==null){e=b(e);let[,n,,r,i,s]=e.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",e],t=`--${n}`;if(i!=null){let c=r==null?Number(i)/100:-Number(i)/100;switch(s){case"b":{let f=d.fromVar(t);o[e]=c>0?f.brighten(c).rgba:f.darken(-c).rgba}break;case"s":{let f=d.fromVar(t);o[e]=c>0?f.saturate(c).rgba:f.desaturate(-c).rgba}break;case"h":{let f=d.fromVar(t);o[e]=f.rotate(c*100).rgba}break;case"o":{let f=d.fromVar(t);o[e]=f.opacity(c).rgba}break;case"":o[e]=`calc(var(${t}) * ${c})`;break;default:throw console.error(s),Error(`Unrecognized method ${s} for css variable ${t}`)}}else o[e]=`var(${t})`}return o[e]}});var qe="http://www.w3.org/1998/Math/MathML",Ge="http://www.w3.org/2000/svg";var To={},Ze=(o,e,n)=>{let r=ne(b(e),n);if(r.prop.startsWith("--"))o.style.setProperty(r.prop,r.value);else o.style[e]=r.value},Ln=(o)=>{return{toDOM(e,n){Ze(e,o,n)}}},Oe=(o,e,n)=>{if(e==="style")if(typeof n==="object")for(let r of Object.keys(n))if(x(n[r]))S(o,n[r],Ln(r));else Ze(o,r,n[r]);else o.setAttribute("style",n);else{let r=b(e),i=o.constructor.observedAttributes;if(i?.includes(e)||i?.includes(r))if(typeof n==="boolean")n?o.setAttribute(r,""):o.removeAttribute(r);else o.setAttribute(r,n);else if(o[e]!==void 0){let{MathMLElement:t}=globalThis;if(o instanceof SVGElement||t!==void 0&&o instanceof t)o.setAttribute(e,n);else o[e]=n}else if(r==="class")n.split(" ").forEach((t)=>{o.classList.add(t)});else if(o[r]!==void 0)o[r]=n;else if(typeof n==="boolean")n?o.setAttribute(r,""):o.removeAttribute(r);else o.setAttribute(r,n)}},kn=(o)=>{return{toDOM(e,n){Oe(e,o,n)}}},Sn=(o,e,n)=>{if(e==="apply")n(o);else if(e.match(/^on[A-Z]/)!=null){let r=e.substring(2).toLowerCase();B(o,r,n)}else if(e==="bind")if((typeof n.binding==="string"?io[n.binding]:n.binding)!==void 0&&n.value!==void 0)S(o,n.value,n.binding instanceof Function?{toDOM:n.binding}:n.binding);else throw Error("bad binding");else if(e.match(/^bind[A-Z]/)!=null){let r=e.substring(4,5).toLowerCase()+e.substring(5),i=io[r];if(i!==void 0)S(o,n,i);else throw Error(`${e} is not allowed, bindings.${r} is not defined`)}else if(x(n))S(o,n,kn(e));else Oe(o,e,n)},re=(o,...e)=>{if(To[o]===void 0){let[i,s]=o.split("|");if(s===void 0)To[o]=globalThis.document.createElement(i);else To[o]=globalThis.document.createElementNS(s,i)}let n=To[o].cloneNode(),r={};for(let i of e)if(i instanceof Element||i instanceof DocumentFragment||typeof i==="string"||typeof i==="number")if(n instanceof HTMLTemplateElement)n.content.append(i);else n.append(i);else if(x(i))n.append(u.span({bindText:i}));else Object.assign(r,i);for(let i of Object.keys(r)){let s=r[i];Sn(n,i,s)}return n},ie=(...o)=>{let e=globalThis.document.createDocumentFragment();for(let n of o)e.append(n);return e},u=new Proxy({fragment:ie},{get(o,e){if(e=e.replace(/[A-Z]/g,(n)=>`-${n.toLocaleLowerCase()}`),o[e]===void 0)o[e]=(...n)=>re(e,...n);return o[e]},set(){throw Error("You may not add new properties to elements")}}),Lo=new Proxy({fragment:ie},{get(o,e){if(o[e]===void 0)o[e]=(...n)=>re(`${e}|${Ge}`,...n);return o[e]},set(){throw Error("You may not add new properties to elements")}}),ko=new Proxy({fragment:ie},{get(o,e){if(o[e]===void 0)o[e]=(...n)=>re(`${e}|${qe}`,...n);return o[e]},set(){throw Error("You may not add new properties to elements")}});var Hn=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],Xn=!0,an=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,$n=(o)=>an.test(o),Z=(o="",e="")=>{if(o==="")return e;else if(e.match(/^\d+$/)!==null||e.includes("="))return`${o}[${e}]`;else return`${o}.${e}`},Re={};function se(o,e){if(o!==null&&(typeof o==="object"||typeof o==="function"))return o;return new Proxy(Re,O(e,!0))}var So=()=>new Proxy({},O("^",!0)),Ue=!1;function I(){if(!Ue)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),Ue=!0}var Ae=(o)=>{return o===Re},O=(o,e)=>({get(n,r){if(Ae(n)){let c=()=>g(N,o);switch(r){case"path":return o;case"value":return c();case"valueOf":case"toJSON":return()=>c();case Symbol.toPrimitive:return(f)=>{let m=c();if(f==="number")return Number(m);if(f==="string")return String(m);return m};case"toString":return()=>String(c());case"observe":return(f)=>{let m=G(o,f);return()=>J(m)};case"on":return(f,m)=>eo()(f,m,c());case"bind":return(f,m,l)=>{oo()(f,o,m,l)};case"binding":return(f)=>({bind:{value:o,binding:f}});case"listBinding":return(f=({span:l})=>l({bindText:"^"}),m={})=>[{bindList:{value:o,...m}},u.template(f(u,So()))];case D:case"xinValue":case"tosiValue":return I(),c();case T:case"xinPath":case"tosiPath":return I(),o;case Go:case"tosiObserve":return I(),(f)=>{let m=G(o,f);return()=>J(m)};case Oo:case"tosiOn":return I(),(f,m)=>eo()(f,m,c());case Zo:case"tosiBind":return I(),(f,m,l)=>{oo()(f,o,m,l)};case"tosiBinding":return I(),(f)=>({bind:{value:o,binding:f}});case"tosiListBinding":return I(),(f=({span:l})=>l({bindText:"^"}),m={})=>[{bindList:{value:o,...m}},u.template(f(u,So()))]}if(typeof r==="string"&&/^\d+$/.test(r)){let f=c();if(typeof f==="string")return f[parseInt(r,10)]}if(r==="length"){let f=c();if(typeof f==="string")return f.length}return}if(e&&!(r in n))switch(r){case"path":return o;case"value":return n.valueOf?n.valueOf():n;case"valueOf":case"toJSON":return()=>n.valueOf?n.valueOf():n;case"observe":return(c)=>{let f=G(o,c);return()=>J(f)};case"on":return(c,f)=>eo()(c,f,p(n));case"bind":return(c,f,m)=>{oo()(c,o,f,m)};case"binding":return(c)=>({bind:{value:o,binding:c}});case"listBinding":return(c=({span:m})=>m({bindText:"^"}),f={})=>[{bindList:{value:o,...f}},u.template(c(u,So()))]}switch(r){case T:case"xinPath":case"tosiPath":return o;case D:case"xinValue":case"tosiValue":return n.valueOf?n.valueOf():n;case Go:case"xinObserve":case"tosiObserve":return(c)=>{let f=G(o,c);return()=>J(f)};case Oo:case"xinOn":case"tosiOn":return(c,f)=>eo()(c,f,p(n));case Zo:case"xinBind":case"tosiBind":return(c,f,m)=>{oo()(c,o,f,m)};case"tosiBinding":return(c)=>({bind:{value:o,binding:c}});case"tosiListBinding":return(c=({span:m})=>m({bindText:"^"}),f={})=>[{bindList:{value:o,...f}},u.template(c(u,So()))]}if(typeof r==="symbol")return n[r];let i=Object.getOwnPropertyDescriptor(n,r);if(i&&!i.configurable&&!i.writable&&"value"in i)return i.value;let s=r,t=s.match(/^([^.[]+)\.(.+)$/)??s.match(/^([^\]]+)(\[.+)/)??s.match(/^(\[[^\]]+\])\.(.+)$/)??s.match(/^(\[[^\]]+\])\[(.+)$/);if(t!==null){let[,c,f]=t,m=Z(o,c),l=g(n,c);return l!==null&&typeof l==="object"?new Proxy(l,O(m,e))[f]:l}if(s.startsWith("[")&&s.endsWith("]"))s=s.substring(1,s.length-1);if(!Array.isArray(n)&&n[s]!==void 0||Array.isArray(n)&&s.includes("=")){let c;if(s.includes("=")){let[f,m]=s.split("=");c=n.find((l)=>`${g(l,f)}`===m)}else c=n[s];if(c instanceof Object){let f=Z(o,s);return new Proxy(c instanceof Function?c.bind(n):c,O(f,e))}else return e?se(c,Z(o,s)):c}else if(Array.isArray(n)){let c=n[s];return typeof c==="function"?(...f)=>{let m=f.map((y)=>p(y)),l=c.apply(n,m);if(Hn.includes(s))q(o);if(l!=null&&typeof l==="object"){if(s==="find"||s==="findLast"||s==="at"){let y=n.indexOf(l);if(y!==-1)return new Proxy(l,O(Z(o,String(y)),e))}}return l}:typeof c==="object"?new Proxy(c,O(Z(o,s),e)):e?se(c,Z(o,s)):c}else return e?se(n[s],Z(o,s)):n[s]},set(n,r,i){i=p(i);let s=r===D||r==="xinValue"||r==="tosiValue"||r==="value"&&(Ae(n)||e),t=s?o:Z(o,r);if(Xn&&!$n(t))throw Error(`setting invalid path ${t}`);if(p(w[t])!==i&&Le(N,t,i)){q(t);let f=o.match(/^(.+)\[(\d+)\]$/);if(f!==null){let[,m,l]=f,y=parseInt(l,10),E=s?"":`.${r}`,M=Se(m,y,n,E);for(let C of M)q(C)}}return!0}}),Ho=(o,e)=>{let n=typeof e==="function"?e:w[e];if(typeof n!=="function")throw Error(`observe expects a function or path to a function, ${e} is neither`);return G(o,n)},w=new Proxy(N,O("",!1));Xe(w);var V=new Proxy(N,O("",!0));var zn=16,Dn=100;function Ke(o,e){let n=Array.from(o.querySelectorAll(j));if(o.matches(j))n.unshift(o);for(let r of n){let i=z.get(r);for(let s of i){if(s.path.startsWith("^"))s.path=`${e}${s.path.substring(1)}`;if(s.binding.toDOM!=null)s.binding.toDOM(r,w[s.path])}}}class Be{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(o,e,n={}){if(this.boundElement=o,this.itemToElement=new WeakMap,n.idPath!=null){let r=x(e);if(r!=null)ue(r,n.idPath)}if(o.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(o.children[0]instanceof HTMLTemplateElement){let r=o.children[0];if(r.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=A(r.content.children[0])}else this.template=o.children[0],this.template.remove();if(this.options=n,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),n.virtual!=null)if(no.observe(this.boundElement),this._update=ro(()=>{this.update(this.array,!0)},zn),this.boundElement.addEventListener("resize",this._update),n.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}visibleSlice(){let{virtual:o,hiddenProp:e,visibleProp:n}=this.options,r=this.array;if(e!==void 0)r=r.filter((f)=>f[e]!==!0);if(n!==void 0)r=r.filter((f)=>f[n]===!0);if(this.options.filter&&this.needle!==void 0)r=this.options.filter(r,this.needle);let i=0,s=r.length-1,t=0,c=0;if(o!=null&&this.boundElement instanceof HTMLElement){let f=this.boundElement.offsetWidth,m=o.scrollContainer==="window",l,y;if(m){l=window.innerHeight;let _=this.boundElement.getBoundingClientRect();y=Math.max(0,-_.top)}else l=this.boundElement.offsetHeight,y=this.boundElement.scrollTop;if(o.visibleColumns==null)o.visibleColumns=o.width!=null?Math.max(1,Math.floor(f/o.width)):1;let E=Math.ceil(l/o.height)+(o.rowChunkSize||1),M=Math.ceil(r.length/o.visibleColumns),C=o.visibleColumns*E,H=Math.floor(y/o.height);if(H>M-E+1)H=Math.max(0,M-E+1);if(o.rowChunkSize)H-=H%o.rowChunkSize;i=H*o.visibleColumns,s=i+C-1,t=H*o.height,c=Math.max((M-E)*o.height-t,0)}return{items:r,firstItem:i,lastItem:s,topBuffer:t,bottomBuffer:c}}needle;filter=ro((o)=>{if(this.needle!==o)this.needle=o,this.update(this.array)},Dn);update(o,e){if(o==null)o=[];this.array=o;let{hiddenProp:n,visibleProp:r}=this.options,i=x(o),s=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",s.items.length===0);let t=this._previousSlice,{firstItem:c,lastItem:f,topBuffer:m,bottomBuffer:l}=s;if(n===void 0&&r===void 0&&e===!0&&t!=null&&c===t.firstItem&&f===t.lastItem)return;this._previousSlice=s;let y=0,E=0,M=0;for(let h of Array.from(this.boundElement.children)){if(h===this.listTop||h===this.listBottom)continue;let X=h[wo];if(X==null)h.remove();else{let L=s.items.indexOf(X);if(L<c||L>f)h.remove(),this.itemToElement.delete(X),y++}}this.listTop.style.height=String(m)+"px",this.listBottom.style.height=String(l)+"px";let C=[],{idPath:H}=this.options;for(let h=c;h<=f;h++){let X=s.items[h];if(X===void 0)continue;let L=this.itemToElement.get(p(X));if(L==null){if(M++,L=A(this.template),typeof X==="object")this.itemToElement.set(p(X),L),L[wo]=p(X);if(this.boundElement.insertBefore(L,this.listBottom),H!=null){let go=X[H],nn=`${i}[${H}=${go}]`;Ke(L,nn)}else{let go=`${i}[${h}]`;Ke(L,go)}}C.push(L)}let _=null;for(let h of C){if(h.previousElementSibling!==_)if(E++,_?.nextElementSibling!=null)this.boundElement.insertBefore(h,_.nextElementSibling);else this.boundElement.insertBefore(h,this.listBottom);_=h}if(Q.perf)console.log(i,"updated",{removed:y,created:M,moved:E})}}var so=(o,e,n)=>{let r=o[P];if(e&&r===void 0)r=new Be(o,e,n),o[P]=r;return r},Xo=(o)=>{let e;while(!(e=o[wo])&&o&&o.parentElement)o=o.parentElement;return e?{element:o,item:e}:void 0},ao=(o)=>{let e=Xo(o);return e?e.item:void 0},Ie=(o)=>{let e=Xo(o);if(!e)return console.error("deleteListItem failed, element is not part of a list instance",o),!1;let n=so(e.element.parentElement);if(!n.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",o.parentElement,n),!1;let r=n.array.indexOf(e.item);if(r>-1)return n.array.splice(r,1),!0;return!1};var{document:co,MutationObserver:Ve}=globalThis,$o=(o,e)=>{let n=z.get(o);if(n==null)return;for(let r of n){let{binding:i,options:s}=r,{path:t}=r,{toDOM:c}=i;if(c!=null){if(t.startsWith("^")){let f=ao(o);if(f!=null&&f[T]!=null)t=r.path=`${f[T]}${t.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${t}`,o,"is not part of a list"),Error(`Cannot resolve relative binding ${t}`)}if(e==null||t.startsWith(e))c(o,po()[t],s)}}};if(Ve!=null)new Ve((e)=>{e.forEach((n)=>{Array.from(n.addedNodes).forEach((r)=>{if(r instanceof Element)Array.from(r.querySelectorAll(j)).forEach((i)=>$o(i))})})}).observe(co.body,{subtree:!0,childList:!0});G(()=>!0,(o)=>{let e=Array.from(co.querySelectorAll(j));for(let n of e)$o(n,o)});var _e=(o)=>{let e=o.target?.closest(j);while(e!=null){let n=z.get(e);for(let r of n){let{binding:i,path:s}=r,{fromDOM:t}=i;if(t!=null){let c;try{c=t(e,r.options)}catch(f){throw console.error("Cannot get value from",e,"via",r),Error("Cannot obtain value fromDOM")}if(c!=null){let f=po(),m=f[s];if(m==null)f[s]=c;else{let l=m[T]!=null?m[D]:m,y=c[T]!=null?c[D]:c;if(l!==y)f[s]=y}}}}e=e.parentElement.closest(j)}};if(globalThis.document!=null)co.body.addEventListener("change",_e,!0),co.body.addEventListener("input",_e,!0);function S(o,e,n,r){if(o instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let i;if(typeof e==="object"&&e[T]===void 0&&r===void 0){let{value:c}=e;i=typeof c==="string"?c:c[T],r=e,delete r.value}else i=typeof e==="string"?e:e[T];if(i==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:s}=n;o.classList?.add(jo);let t=z.get(o);if(t==null)t=[],z.set(o,t);if(t.push({path:i,binding:n,options:r}),s!=null&&!i.startsWith("^"))q(i);if(r?.filter&&r?.needle)S(o,r.needle,{toDOM(c,f){console.log({needle:f}),c[P]?.filter(f)}});return o}var ve=new Set,Fn=(o)=>{let e=o?.target?.closest(qo),n=!1,r=new Proxy(o,{get(s,t){if(t==="stopPropagation")return()=>{o.stopPropagation(),n=!0};else{let c=s[t];return typeof c==="function"?c.bind(s):c}}}),i=new Set;while(!n&&e!=null){let t=U.get(e)[o.type]||i;for(let c of t){if(typeof c==="function")c(r);else{let f=po()[c];if(typeof f==="function")f(r);else throw Error(`no event handler found at path ${c}`)}if(n)continue}e=e.parentElement!=null?e.parentElement.closest(qo):null}};function B(o,e,n){let r=U.get(o);if(o.classList.add(Qo),r==null)r={},U.set(o,r);if(!r[e])r[e]=new Set;if(r[e].add(n),!ve.has(e))ve.add(e),co.body.addEventListener(e,Fn,!0);return()=>{r[e].delete(n)}}ae(S,B);function zo(o,e){if(!o.internals)return;let n={},r="";if(o.hasAttribute("required")&&e==="")n.valueMissing=!0,r="Please fill out this field.";let i=o.getAttribute("minlength");if(i&&e.length<parseInt(i,10))n.tooShort=!0,r=`Please use at least ${i} characters.`;let s=o.getAttribute("maxlength");if(s&&e.length>parseInt(s,10))n.tooLong=!0,r=`Please use no more than ${s} characters.`;let t=o.getAttribute("pattern");if(t&&e!=="")try{if(!new RegExp(`^(?:${t})$`).test(e))n.patternMismatch=!0,r="Please match the requested format."}catch{}if(Object.keys(n).length>0)o.internals.setValidity(n,r,o);else o.internals.setValidity({})}var Yn=0;function te(){return`custom-elt${(Yn++).toString(36)}`}var Pe=0,ce=null;function gn(){if(ce===null)ce=new MutationObserver((o)=>{let e=new Set;for(let n of o)if(n.type==="attributes"&&n.target instanceof a){let r=n.target,i=ee(n.attributeName);if(r._legacyTrackedAttrs?.has(i))e.add(r)}for(let n of e)n.queueRender(!1)});return ce}var fo={};function Jn(o,e){let n=fo[o],r=K(e).replace(/:host\b/g,o);fo[o]=n?n+`
|
|
10
|
-
`+
|
|
12
|
+
`)},eo=(n)=>{q("initVars","initVars is deprecated. Just use _ and __ prefixes instead.");let o={};for(let f of Object.keys(n)){let i=n[f],c=$(f);o[`--${c}`]=typeof i==="number"&&i!==0?String(i)+"px":i}return o},bo=(n)=>{let o={};for(let f of Object.keys(n)){let i=n[f];if(i instanceof y)o[f]=i.inverseLuminance;else if(typeof i==="string"&&i.match(/^(#[0-9a-fA-F]{3}|rgba?\(|hsla?\()/))o[f]=y.fromCss(i).inverseLuminance}return o},wn=new Proxy({},{get(n,o){if(n[o]===void 0){let f="--"+$(o);n[o]=(i)=>`var(${f}, ${i})`}return n[o]}}),Zn=new Proxy({},{get(n,o){if(o==="default")return wn;if(n[o]==null){o=$(o);let[,f,,i,c,m]=o.match(/^([-\w]*?)((_)?(\d+)(\w?))?$/)||["",o],r=`--${f}`;if(c!=null){let w=i==null?Number(c)/100:-Number(c)/100;switch(m){case"b":case"s":case"h":case"o":{let E=`--${o}`;y.registerComputedColor(E,r,w,m),n[o]=`var(${E})`}break;case"":n[o]=`calc(var(${r}) * ${w})`;break;default:throw console.error(m),Error(`Unrecognized method ${m} for css variable ${r}`)}}else n[o]=`var(${r})`}return n[o]}});function co(){let n=(o)=>typeof matchMedia<"u"&&matchMedia(o).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 Po(n){if(typeof matchMedia>"u")return()=>{};let o=["(prefers-color-scheme: dark)","(prefers-contrast: more)","(prefers-contrast: less)","(prefers-contrast: custom)","(prefers-reduced-motion: reduce)","(prefers-reduced-transparency: reduce)","(forced-colors: active)"],f=()=>n(co()),i=o.map((c)=>matchMedia(c));for(let c of i)c.addEventListener("change",f);return()=>{for(let c of i)c.removeEventListener("change",f)}}var _o="http://www.w3.org/1998/Math/MathML",ho="http://www.w3.org/2000/svg";var dn={},po=(n,o,f)=>{let i=io($(o),f);if(i.prop.startsWith("--"))n.style.setProperty(i.prop,i.value);else n.style[o]=i.value},Uf=(n)=>{return{toDOM(o,f){po(o,n,f)}}},No=(n,o,f)=>{if(o==="style")if(typeof f==="object")for(let i of Object.keys(f))if(F(f[i]))Q(n,f[i],Uf(i));else po(n,i,f[i]);else n.setAttribute("style",f);else{let i=$(o),c=n.constructor.observedAttributes;if(c?.includes(o)||c?.includes(i))if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f);else if(n[o]!==void 0){let{MathMLElement:r}=globalThis;if(n instanceof SVGElement||r!==void 0&&n instanceof r)n.setAttribute(o,f);else n[o]=f}else if(i==="class")f.split(" ").forEach((r)=>{n.classList.add(r)});else if(n[i]!==void 0)n[i]=f;else if(typeof f==="boolean")f?n.setAttribute(i,""):n.removeAttribute(i);else n.setAttribute(i,f)}},qf=(n)=>{return{toDOM(o,f){No(o,n,f)}}},Af=(n,o,f)=>{if(o==="apply")f(n);else if(o.match(/^on[A-Z]/)!=null){let i=o.substring(2).toLowerCase();p(n,i,f)}else if(o==="bind")if((typeof f.binding==="string"?En[f.binding]:f.binding)!==void 0&&f.value!==void 0)Q(n,f.value,f.binding instanceof Function?{toDOM:f.binding}:f.binding);else throw Error("bad binding");else if(o.match(/^bind[A-Z]/)!=null){let i=o.substring(4,5).toLowerCase()+o.substring(5),c=En[i];if(c!==void 0)Q(n,f,c);else throw Error(`${o} is not allowed, bindings.${i} is not defined`)}else if(F(f))Q(n,f,qf(o));else No(n,o,f)},mo=(n,...o)=>{if(dn[n]===void 0){let[c,m]=n.split("|");if(m===void 0)dn[n]=globalThis.document.createElement(c);else dn[n]=globalThis.document.createElementNS(m,c)}let f=dn[n].cloneNode(),i={};for(let c of o)if(c instanceof Element||c instanceof DocumentFragment||typeof c==="string"||typeof c==="number")if(f instanceof HTMLTemplateElement)f.content.append(c);else f.append(c);else if(F(c))f.append(x.span({bindText:c}));else Object.assign(i,c);for(let c of Object.keys(i)){let m=i[c];Af(f,c,m)}return f},Eo=(...n)=>{let o=globalThis.document.createDocumentFragment();for(let f of n)o.append(f);return o},x=new Proxy({fragment:Eo},{get(n,o){if(o=o.replace(/[A-Z]/g,(f)=>`-${f.toLocaleLowerCase()}`),n[o]===void 0)n[o]=(...f)=>mo(o,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Gn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${ho}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}}),Qn=new Proxy({fragment:Eo},{get(n,o){if(n[o]===void 0)n[o]=(...f)=>mo(`${o}|${_o}`,...f);return n[o]},set(){throw Error("You may not add new properties to elements")}});var jf=["sort","splice","copyWithin","fill","pop","push","reverse","shift","unshift"],uf=!0,Kf=/^\.?([^.[\](),])+(\.[^.[\](),]+|\[\d+\]|\[[^=[\](),]*=[^[\]()]+\])*$/,Rf=(n)=>Kf.test(n),e=(n="",o="")=>{if(n==="")return o;else if(o.match(/^\d+$/)!==null||o.includes("="))return`${n}[${o}]`;else return`${n}.${o}`},lo={};function ro(n,o){if(n!==null&&(typeof n==="object"||typeof n==="function"))return n;return new Proxy(lo,b(o,!0))}var kn=()=>new Proxy({},b("^",!0)),go=!1;function N(){if(!go)console.warn("xinValue, tosiValue, xinPath, tosiPath, etc. are deprecated. Use value, path, observe, bind, on, binding, listBinding instead."),go=!0}var to=(n)=>{return n===lo},b=(n,o)=>({get(f,i){if(to(f)){let w=()=>j(nn,n);switch(i){case"path":return n;case"value":return w();case"valueOf":case"toJSON":return()=>w();case Symbol.toPrimitive:return(E)=>{let M=w();if(E==="number")return Number(M);if(E==="string")return String(M);return M};case"toString":return()=>String(w());case"observe":return(E)=>{let M=I(n,E);return()=>u(M)};case"on":return(E,M)=>fn()(E,M,w());case"bind":return(E,M,L)=>{on()(E,n,M,L)};case"binding":return(E)=>({bind:{value:n,binding:E}});case"listBinding":return(E=({span:L})=>L({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},x.template(E(x,kn()))];case U:case"xinValue":case"tosiValue":return N(),w();case J:case"xinPath":case"tosiPath":return N(),n;case Vn:case"tosiObserve":return N(),(E)=>{let M=I(n,E);return()=>u(M)};case bn:case"tosiOn":return N(),(E,M)=>fn()(E,M,w());case en:case"tosiBind":return N(),(E,M,L)=>{on()(E,n,M,L)};case"tosiBinding":return N(),(E)=>({bind:{value:n,binding:E}});case"tosiListBinding":return N(),(E=({span:L})=>L({bindText:"^"}),M={})=>[{bindList:{value:n,...M}},x.template(E(x,kn()))]}if(typeof i==="string"&&/^\d+$/.test(i)){let E=w();if(typeof E==="string")return E[parseInt(i,10)]}if(i==="length"){let E=w();if(typeof E==="string")return E.length}return}if(o&&!(i in f))switch(i){case"path":return n;case"value":return f.valueOf?f.valueOf():f;case"valueOf":case"toJSON":return()=>f.valueOf?f.valueOf():f;case"observe":return(w)=>{let E=I(n,w);return()=>u(E)};case"on":return(w,E)=>fn()(w,E,H(f));case"bind":return(w,E,M)=>{on()(w,n,E,M)};case"binding":return(w)=>({bind:{value:n,binding:w}});case"listBinding":return(w=({span:M})=>M({bindText:"^"}),E={})=>[{bindList:{value:n,...E}},x.template(w(x,kn()))]}switch(i){case J:case"xinPath":case"tosiPath":return n;case U:case"xinValue":case"tosiValue":return f.valueOf?f.valueOf():f;case Vn:case"xinObserve":case"tosiObserve":return(w)=>{let E=I(n,w);return()=>u(E)};case bn:case"xinOn":case"tosiOn":return(w,E)=>fn()(w,E,H(f));case en:case"xinBind":case"tosiBind":return(w,E,M)=>{on()(w,n,E,M)};case"tosiBinding":return(w)=>({bind:{value:n,binding:w}});case"tosiListBinding":return(w=({span:M})=>M({bindText:"^"}),E={})=>[{bindList:{value:n,...E}},x.template(w(x,kn()))]}if(typeof i==="symbol")return f[i];let c=Object.getOwnPropertyDescriptor(f,i);if(c&&!c.configurable&&!c.writable&&"value"in c)return c.value;let m=i,r=m.match(/^([^.[]+)\.(.+)$/)??m.match(/^([^\]]+)(\[.+)/)??m.match(/^(\[[^\]]+\])\.(.+)$/)??m.match(/^(\[[^\]]+\])\[(.+)$/);if(r!==null){let[,w,E]=r,M=e(n,w),L=j(f,w);return L!==null&&typeof L==="object"?new Proxy(L,b(M,o))[E]:L}if(m.startsWith("[")&&m.endsWith("]"))m=m.substring(1,m.length-1);if(!Array.isArray(f)&&f[m]!==void 0||Array.isArray(f)&&m.includes("=")){let w;if(m.includes("=")){let[E,M]=m.split("=");w=f.find((L)=>`${j(L,E)}`===M)}else w=f[m];if(w instanceof Object){let E=e(n,m);return new Proxy(w instanceof Function?w.bind(f):w,b(E,o))}else return o?ro(w,e(n,m)):w}else if(Array.isArray(f)){let w=f[m];return typeof w==="function"?(...E)=>{let M=E.map((T)=>H(T)),L=w.apply(f,M);if(jf.includes(m))B(n);if(L!=null&&typeof L==="object"){if(m==="find"||m==="findLast"||m==="at"){let T=f.indexOf(L);if(T!==-1)return new Proxy(L,b(e(n,String(T)),o))}}return L}:typeof w==="object"?new Proxy(w,b(e(n,m),o)):o?ro(w,e(n,m)):w}else return o?ro(f[m],e(n,m)):f[m]},set(f,i,c){c=H(c);let m=i===U||i==="xinValue"||i==="tosiValue"||i==="value"&&(to(f)||o),r=m?n:e(n,i);if(uf&&!Rf(r))throw Error(`setting invalid path ${r}`);if(H(X[r])!==c&&Qo(nn,r,c)){B(r);let E=n.match(/^(.+)\[(\d+)\]$/);if(E!==null){let[,M,L]=E,T=parseInt(L,10),D=m?"":`.${i}`,Y=Wo(M,T,f,D);for(let s of Y)B(s)}}return!0}}),l=(n,o)=>{let f=typeof o==="function"?o:X[o];if(typeof f!=="function")throw Error(`observe expects a function or path to a function, ${o} is neither`);return I(n,f)},X=new Proxy(nn,b("",!1));Oo(X);var g=new Proxy(nn,b("",!0));var Sf=16,Bf=100;function vo(n,o){let f=Array.from(n.querySelectorAll(R));if(n.matches(R))f.unshift(n);for(let i of f){let c=O.get(i);for(let m of c){if(m.path.startsWith("^"))m.path=`${o}${m.path.substring(1)}`;if(m.binding.toDOM!=null)m.binding.toDOM(i,X[m.path])}}}class ao{boundElement;listTop;listBottom;template;options;itemToElement;array=[];_update;_previousSlice;static filterBoundObservers=new WeakMap;constructor(n,o,f={}){if(this.boundElement=n,this.itemToElement=new WeakMap,f.idPath!=null){let i=F(o);if(i!=null)so(i,f.idPath)}if(n.children.length!==1)throw Error("ListBinding expects an element with exactly one child element");if(n.children[0]instanceof HTMLTemplateElement){let i=n.children[0];if(i.content.children.length!==1)throw Error("ListBinding expects a template with exactly one child element");this.template=_(i.content.children[0])}else this.template=n.children[0],this.template.remove();if(this.options=f,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),f.virtual!=null)if(cn.observe(this.boundElement),this._update=mn(()=>{this.update(this.array,!0)},Sf),this.boundElement.addEventListener("resize",this._update),f.virtual.scrollContainer==="window")window.addEventListener("scroll",this._update),window.addEventListener("resize",this._update);else this.boundElement.addEventListener("scroll",this._update)}visibleSlice(){let{virtual:n,hiddenProp:o,visibleProp:f}=this.options,i=this.array;if(o!==void 0)i=i.filter((E)=>E[o]!==!0);if(f!==void 0)i=i.filter((E)=>E[f]===!0);if(this.options.filter&&this.needle!==void 0)i=this.options.filter(i,this.needle);let c=0,m=i.length-1,r=0,w=0;if(n!=null&&this.boundElement instanceof HTMLElement){let E=this.boundElement.offsetWidth,M=n.scrollContainer==="window",L,T;if(M){L=window.innerHeight;let C=this.boundElement.getBoundingClientRect();T=Math.max(0,-C.top)}else L=this.boundElement.offsetHeight,T=this.boundElement.scrollTop;let D=n.width!=null?Math.max(1,Math.floor(E/n.width)):n.visibleColumns??1,Y=Math.ceil(L/n.height)+(n.rowChunkSize||1),s=Math.ceil(i.length/D),v=D*Y,Z=Math.floor(T/n.height);if(Z>s-Y+1)Z=Math.max(0,s-Y+1);if(n.rowChunkSize)Z-=Z%n.rowChunkSize;c=Z*D,m=c+v-1,r=Z*n.height,w=Math.max((s-Y)*n.height-r,0)}return{items:i,firstItem:c,lastItem:m,topBuffer:r,bottomBuffer:w}}needle;filter=mn((n)=>{if(this.needle!==n)this.needle=n,this.update(this.array)},Bf);update(n,o){if(n==null)n=[];this.array=n;let{hiddenProp:f,visibleProp:i}=this.options,c=F(n),m=this.visibleSlice();this.boundElement.classList.toggle("-xin-empty-list",m.items.length===0);let r=this._previousSlice,{firstItem:w,lastItem:E,topBuffer:M,bottomBuffer:L}=m;if(f===void 0&&i===void 0&&o===!0&&r!=null&&w===r.firstItem&&E===r.lastItem&&M===r.topBuffer&&L===r.bottomBuffer)return;this._previousSlice=m;let T=0,D=0,Y=0;for(let C of Array.from(this.boundElement.children)){if(C===this.listTop||C===this.listBottom)continue;let k=C[Hn];if(k==null)C.remove();else{let d=m.items.indexOf(k);if(d<w||d>E)C.remove(),this.itemToElement.delete(k),T++}}this.listTop.style.height=String(M)+"px",this.listBottom.style.height=String(L)+"px";let s=[],{idPath:v}=this.options;for(let C=w;C<=E;C++){let k=m.items[C];if(k===void 0)continue;let d=this.itemToElement.get(H(k));if(d==null){if(Y++,d=_(this.template),typeof k==="object")this.itemToElement.set(H(k),d),d[Hn]=H(k);if(this.boundElement.insertBefore(d,this.listBottom),v!=null){let un=k[v],Mf=`${c}[${v}=${un}]`;vo(d,Mf)}else{let un=`${c}[${C}]`;vo(d,un)}}s.push(d)}let Z=null;for(let C of s){if(C.previousElementSibling!==Z)if(D++,Z?.nextElementSibling!=null)this.boundElement.insertBefore(C,Z.nextElementSibling);else this.boundElement.insertBefore(C,this.listBottom);Z=C}if(S.perf)console.log(c,"updated",{removed:T,created:Y,moved:D})}}var rn=(n,o,f)=>{let i=n[a];if(o&&i===void 0)i=new ao(n,o,f),n[a]=i;return i},Wn=(n)=>{let o;while(!(o=n[Hn])&&n&&n.parentElement)n=n.parentElement;return o?{element:n,item:o}:void 0},zn=(n)=>{let o=Wn(n);return o?o.item:void 0},nf=(n)=>{let o=Wn(n);if(!o)return console.error("deleteListItem failed, element is not part of a list instance",n),!1;let f=rn(o.element.parentElement);if(!f.options.idPath)return console.error("deleteListItem failed, list binding has no idPath",n.parentElement,f),!1;let i=f.array.indexOf(o.item);if(i>-1)return f.array.splice(i,1),!0;return!1};var{document:Mn,MutationObserver:of}=globalThis,On=(n,o)=>{let f=O.get(n);if(f==null)return;for(let i of f){let{binding:c,options:m}=i,{path:r}=i,{toDOM:w}=c;if(w!=null){if(r.startsWith("^")){let E=zn(n);if(E!=null&&E[J]!=null)r=i.path=`${E[J]}${r.substring(1)}`;else throw console.error(`Cannot resolve relative binding ${r}`,n,"is not part of a list"),Error(`Cannot resolve relative binding ${r}`)}if(o==null||r.startsWith(o))w(n,Dn()[r],m)}}};if(of!=null)new of((o)=>{o.forEach((f)=>{Array.from(f.addedNodes).forEach((i)=>{if(i instanceof Element)Array.from(i.querySelectorAll(R)).forEach((c)=>On(c))})})}).observe(Mn.body,{subtree:!0,childList:!0});I(()=>!0,(n)=>{let o=Array.from(Mn.querySelectorAll(R));for(let f of o)On(f,n)});var ff=(n)=>{let o=n.target?.closest(R);while(o!=null){let f=O.get(o);for(let i of f){let{binding:c,path:m}=i,{fromDOM:r}=c;if(r!=null){let w;try{w=r(o,i.options)}catch(E){throw console.error("Cannot get value from",o,"via",i),Error("Cannot obtain value fromDOM")}if(w!=null){let E=Dn(),M=E[m];if(M==null)E[m]=w;else{let L=M[J]!=null?M[U]:M,T=w[J]!=null?w[U]:w;if(L!==T)E[m]=T}}}}o=o.parentElement.closest(R)}};if(globalThis.document!=null)Mn.body.addEventListener("change",ff,!0),Mn.body.addEventListener("input",ff,!0);function Q(n,o,f,i){if(n instanceof DocumentFragment)throw Error("bind cannot bind to a DocumentFragment");let c;if(typeof o==="object"&&o[J]===void 0&&i===void 0){let{value:w}=o;c=typeof w==="string"?w:w[J],i=o,delete i.value}else c=typeof o==="string"?o:o[J];if(c==null)throw Error("bind requires a path or object with xin Proxy");let{toDOM:m}=f;n.classList?.add(Sn);let r=O.get(n);if(r==null)r=[],O.set(n,r);if(r.push({path:c,binding:f,options:i}),m!=null&&!c.startsWith("^"))B(c);if(i?.filter&&i?.needle)Q(n,i.needle,{toDOM(w,E){console.log({needle:E}),w[a]?.filter(E)}});return n}var cf=new Set,If=(n)=>{let o=n?.target?.closest(In),f=!1,i=new Proxy(n,{get(m,r){if(r==="stopPropagation")return()=>{n.stopPropagation(),f=!0};else{let w=m[r];return typeof w==="function"?w.bind(m):w}}}),c=new Set;while(!f&&o!=null){let r=P.get(o)[n.type]||c;for(let w of r){if(typeof w==="function")w(i);else{let E=Dn()[w];if(typeof E==="function")E(i);else throw Error(`no event handler found at path ${w}`)}if(f)continue}o=o.parentElement!=null?o.parentElement.closest(In):null}};function p(n,o,f){let i=P.get(n);if(n.classList.add(Bn),i==null)i={},P.set(n,i);if(!i[o])i[o]=new Set;if(i[o].add(f),!cf.has(o))cf.add(o),Mn.body.addEventListener(o,If,!0);return()=>{i[o].delete(f)}}Uo(Q,p);function Un(n,o){if(!n.internals)return;let f={},i="";if(n.hasAttribute("required")&&o==="")f.valueMissing=!0,i="Please fill out this field.";let c=n.getAttribute("minlength");if(c&&o.length<parseInt(c,10))f.tooShort=!0,i=`Please use at least ${c} characters.`;let m=n.getAttribute("maxlength");if(m&&o.length>parseInt(m,10))f.tooLong=!0,i=`Please use no more than ${m} characters.`;let r=n.getAttribute("pattern");if(r&&o!=="")try{if(!new RegExp(`^(?:${r})$`).test(o))f.patternMismatch=!0,i="Please match the requested format."}catch{}if(Object.keys(f).length>0)n.internals.setValidity(f,i,n);else n.internals.setValidity({})}var Vf=0;function wo(){return`custom-elt${(Vf++).toString(36)}`}var mf=0,Mo=null;function ef(){if(Mo===null)Mo=new MutationObserver((n)=>{let o=new Set;for(let f of n)if(f.type==="attributes"&&f.target instanceof W){let i=f.target,c=fo(f.attributeName);if(i._legacyTrackedAttrs?.has(c))o.add(i)}for(let f of o)f.queueRender(!1)});return Mo}var yn={};function bf(n,o){let f=yn[n],i=V(o).replace(/:host\b/g,n);yn[n]=f?f+`
|
|
13
|
+
`+i:i}function Pf(n){if(yn[n])document.head.append(x.style({id:n+"-component"},yn[n]));delete yn[n]}class W extends HTMLElement{static elements=x;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,o,f){this.internals?.setValidity(n,o,f)}setFormValue(n,o){this.internals?.setFormValue(n,o)}static get observedAttributes(){let n=this.initAttributes;if(n)return["hidden",...Object.keys(n).map($)];return["hidden"]}instanceId;styleNode;static styleSpec;static styleNode;content=x.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"),x.style(V(n))}static elementCreator(n={}){let o=this;if(o._elementCreator==null){let{tag:f,styleSpec:i}=n,c=n!=null?f:null;if(c==null)if(typeof o.name==="string"&&o.name!==""){if(c=$(o.name),c.startsWith("-"))c=c.slice(1)}else c=wo();if(customElements.get(c)!=null)console.warn(`${c} is already defined`);if(c.match(/\w+(-\w+)+/)==null)console.warn(`${c} is not a legal tag for a custom-element`),c=wo();while(customElements.get(c)!==void 0)c=wo();if(o._tagName=c,i!==void 0)bf(c,i);window.customElements.define(c,this,n),o._elementCreator=x[c]}return o._elementCreator}initAttributes(...n){if(q("initAttributes","initAttributes() is deprecated. Use static initAttributes = { ... } instead."),!this._legacyTrackedAttrs)this._legacyTrackedAttrs=new Set;for(let c of n)this._legacyTrackedAttrs.add(c);ef().observe(this,{attributes:!0});let f={},i={};n.forEach((c)=>{f[c]=z(this[c]);let m=$(c);Object.defineProperty(this,c,{enumerable:!1,get(){if(typeof f[c]==="boolean")return this.hasAttribute(m);else if(this.hasAttribute(m))return typeof f[c]==="number"?parseFloat(this.getAttribute(m)):this.getAttribute(m);else if(i[c]!==void 0)return i[c];else return f[c]},set(r){if(typeof f[c]==="boolean"){if(r!==this[c]){if(r)this.setAttribute(m,"");else this.removeAttribute(m);this.queueRender()}}else if(typeof f[c]==="number"){if(r!==parseFloat(this[c]))this.setAttribute(m,r),this.queueRender()}else if(typeof r==="object"||`${r}`!==`${this[c]}`){if(r===null||r===void 0||typeof r==="object")this.removeAttribute(m);else this.setAttribute(m,r);this.queueRender(),i[c]=r}}})})}initValue(){let n=Object.getOwnPropertyDescriptor(this,"value");if(n===void 0||n.get!==void 0||n.set!==void 0)return;let o=this.hasAttribute("value")?this.getAttribute("value"):z(this.value);delete this.value,Object.defineProperty(this,"value",{enumerable:!1,get(){return o},set(f){if(o!==f)o=f,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(o,f){if(o[f]===void 0){let i=n.querySelector(`[part="${f}"]`);if(i==null)i=n.querySelector(f);if(i==null)throw Error(`elementRef "${f}" does not exist!`);i.removeAttribute("data-ref"),o[f]=i}return o[f]}});return this._parts}attributeChangedCallback(n,o,f){let i=fo(n);if(!this._legacyTrackedAttrs?.has(i))this.queueRender(!1)}constructor(){super();if(mf+=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()}-${mf}`,this._value=z(this.defaultValue)}_setupAttributeAccessors(n){if(!this._attrValues)this._attrValues=new Map;for(let o of Object.keys(n)){let f=$(o),i=n[o];if(o==="value"){console.warn(`${this.tagName}: 'value' cannot be an attribute. Use the Component value property instead.`);continue}if(typeof i==="object"&&i!==null){console.warn(`${this.tagName}: initAttributes.${o} is an object. Use a regular property instead.`);continue}let c=this,m=!1;while(c){let r=Object.getOwnPropertyDescriptor(c,o);if(r){if(!r.configurable||r.get||r.set){m=!0;break}break}c=Object.getPrototypeOf(c)}if(m)continue;Object.defineProperty(this,o,{enumerable:!1,get:()=>{if(typeof i==="boolean")return this.hasAttribute(f);else if(this.hasAttribute(f))return typeof i==="number"?parseFloat(this.getAttribute(f)):this.getAttribute(f);else if(this._attrValues.has(o))return this._attrValues.get(o);else return i},set:(r)=>{if(typeof i==="boolean"){if(r!==this[o]){if(r)this.setAttribute(f,"");else this.removeAttribute(f);this.queueRender()}}else if(typeof i==="number"){if(r!==parseFloat(this[o]))this.setAttribute(f,r),this.queueRender()}else if(typeof r==="object"||`${r}`!==`${this[o]}`){if(r===null||r===void 0||typeof r==="object")this.removeAttribute(f);else this.setAttribute(f,r);this.queueRender(),this._attrValues.set(o,r)}}})}}connectedCallback(){if(Pf(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(cn.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(){cn.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(no(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",o=typeof this.content==="function"?this.content(x):this.content,{styleSpec:f}=this.constructor,{styleNode:i}=this.constructor;if(f)i=this.constructor.styleNode=x.style(V(f)),delete this.constructor.styleNode;if(this.styleNode)console.warn(this,"styleNode is deprecrated, use static styleNode or statc styleSpec instead"),i=this.styleNode;if(i){let c=this.attachShadow({mode:"open"});c.appendChild(i.cloneNode(!0)),oo(c,o,n)}else if(o!==null){let c=Array.from(this.childNodes);oo(this,o,n),this.isSlotted=this.querySelector("slot,xin-slot")!==void 0;let m=Array.from(this.querySelectorAll("slot"));if(m.length>0)m.forEach(yo.replaceSlot);if(c.length>0){let r={"":this};Array.from(this.querySelectorAll("xin-slot")).forEach((w)=>{r[w.name]=w}),c.forEach((w)=>{let E=r[""],M=w instanceof Element?r[w.slot]:E;(M!==void 0?M:E).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);Un(this,n)}}class yo extends W{static initAttributes={name:""};content=null;static replaceSlot(n){let o=document.createElement("xin-slot");if(n.name!=="")o.setAttribute("name",n.name);n.replaceWith(o)}}var Lc=yo.elementCreator({tag:"xin-slot"});var Ef=(n=()=>!0)=>{let o=localStorage.getItem("xin-state");if(o!=null){let i=JSON.parse(o);for(let c of Object.keys(i).filter(n))if(X[c]!==void 0)Object.assign(X[c],i[c]);else X[c]=i[c]}let f=Yn(()=>{let i={},c=H(X);for(let m of Object.keys(c).filter(n))i[m]=c[m];localStorage.setItem("xin-state",JSON.stringify(i)),console.log("xin state saved to localStorage")},500);l(n,f)};var qn="1.3.3";function Ln(n){return Object.assign(g,n),g}function xn(n){return q("boxedProxy","boxedProxy is deprecated, please use tosi() instead"),Ln(n)}function An(n,o=!1){if(o)return q("xinProxy-boxed","xinProxy(..., true) is deprecated; use tosi(...) instead"),xn(n);return Object.keys(n).forEach((f)=>{X[f]=n[f]}),X}var _f={};async function Tn(n,o){let{type:f,styleSpec:i}=await o(n,{Color:y,Component:W,elements:x,svgElements:Gn,mathML:Qn,varDefault:wn,vars:Zn,xin:X,boxed:g,xinProxy:An,boxedProxy:xn,tosi:Ln,makeComponent:Tn,bind:Q,on:p,version:qn}),c={type:f,creator:f.elementCreator({tag:n,styleSpec:i})};return _f[n]=c,c}var Lo={},hf=(n)=>import(n);class sn extends W{static initAttributes={tag:"anon-elt",src:"",property:"default"};loaded;blueprintLoaded=(n)=>{};async packaged(){let{tag:n,src:o,property:f}=this,i=`${n}.${f}:${o}`;if(!this.loaded){if(Lo[i]===void 0)Lo[i]=hf(o).then((c)=>{let m=c[f];return Tn(n,m)});else console.log(`using cached ${n} with signature ${i}`);this.loaded=await Lo[i],this.blueprintLoaded(this.loaded)}return this.loaded}}var rf=sn.elementCreator({tag:"xin-blueprint",styleSpec:{":host":{display:"none"}}});class jn extends W{allLoaded=()=>{};constructor(){super()}async load(){let o=Array.from(this.querySelectorAll(sn.tagName)).filter((f)=>f.src).map((f)=>f.packaged());await Promise.all(o),this.allLoaded()}connectedCallback(){super.connectedCallback(),this.load()}}var wf=jn.elementCreator({tag:"xin-loader",styleSpec:{":host":{display:"none"}}});})();
|
|
11
14
|
|
|
12
|
-
//# debugId=
|
|
15
|
+
//# debugId=935DCBB07055FCA864756E2164756E21
|
|
13
16
|
//# sourceMappingURL=index.js.map
|