@tempots/beatui 0.61.14 → 0.63.0

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yt=require("../_commonjsHelpers-DwGv2jUC.cjs"),D=require("../notice-D3As5ZhJ.cjs"),J=require("../utils-Bzo19jHw.cjs"),E=require("@tempots/dom"),ke=require("../translations-hMQlZmD4.cjs"),Os=require("../colors-B9fcMxa_.cjs");var Be={exports:{}},lr={},be={},Ee={},dr={},fr={},mr={},Jr;function Bt(){return Jr||(Jr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(o){if(super(),!e.IDENTIFIER.test(o))throw new Error("CodeGen: name must be a valid identifier");this.str=o}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(o){super(),this._items=typeof o=="string"?[o]:o}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const o=this._items[0];return o===""||o==='""'}get str(){var o;return(o=this._str)!==null&&o!==void 0?o:this._str=this._items.reduce((d,v)=>`${d}${v}`,"")}get names(){var o;return(o=this._names)!==null&&o!==void 0?o:this._names=this._items.reduce((d,v)=>(v instanceof r&&(d[v.str]=(d[v.str]||0)+1),d),{})}}e._Code=n,e.nil=new n("");function s(m,...o){const d=[m[0]];let v=0;for(;v<o.length;)c(d,o[v]),d.push(m[++v]);return new n(d)}e._=s;const a=new n("+");function i(m,...o){const d=[b(m[0])];let v=0;for(;v<o.length;)d.push(a),c(d,o[v]),d.push(a,b(m[++v]));return f(d),new n(d)}e.str=i;function c(m,o){o instanceof n?m.push(...o._items):o instanceof r?m.push(o):m.push(y(o))}e.addCodeArg=c;function f(m){let o=1;for(;o<m.length-1;){if(m[o]===a){const d=p(m[o-1],m[o+1]);if(d!==void 0){m.splice(o-1,3,d);continue}m[o++]="+"}o++}}function p(m,o){if(o==='""')return m;if(m==='""')return o;if(typeof m=="string")return o instanceof r||m[m.length-1]!=='"'?void 0:typeof o!="string"?`${m.slice(0,-1)}${o}"`:o[0]==='"'?m.slice(0,-1)+o.slice(1):void 0;if(typeof o=="string"&&o[0]==='"'&&!(m instanceof r))return`"${m}${o.slice(1)}`}function l(m,o){return o.emptyStr()?m:m.emptyStr()?o:i`${m}${o}`}e.strConcat=l;function y(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:b(Array.isArray(m)?m.join(","):m)}function $(m){return new n(b(m))}e.stringify=$;function b(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=b;function S(m){return typeof m=="string"&&e.IDENTIFIER.test(m)?new n(`.${m}`):s`[${m}]`}e.getProperty=S;function g(m){if(typeof m=="string"&&e.IDENTIFIER.test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}e.getEsmExportName=g;function u(m){return new n(m.toString())}e.regexpCode=u}(mr)),mr}var pr={},Wr;function Br(){return Wr||(Wr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Bt();class r extends Error{constructor(p){super(`CodeGen: "code" for ${p} not defined`),this.value=p.value}}var n;(function(f){f[f.Started=0]="Started",f[f.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:p,parent:l}={}){this._names={},this._prefixes=p,this._parent=l}toName(p){return p instanceof t.Name?p:this.name(p)}name(p){return new t.Name(this._newName(p))}_newName(p){const l=this._names[p]||this._nameGroup(p);return`${p}${l.index++}`}_nameGroup(p){var l,y;if(!((y=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||y===void 0)&&y.has(p)||this._prefixes&&!this._prefixes.has(p))throw new Error(`CodeGen: prefix "${p}" is not allowed in this scope`);return this._names[p]={prefix:p,index:0}}}e.Scope=s;class a extends t.Name{constructor(p,l){super(l),this.prefix=p}setValue(p,{property:l,itemIndex:y}){this.value=p,this.scopePath=(0,t._)`.${new t.Name(l)}[${y}]`}}e.ValueScopeName=a;const i=(0,t._)`\n`;class c extends s{constructor(p){super(p),this._values={},this._scope=p.scope,this.opts={...p,_n:p.lines?i:t.nil}}get(){return this._scope}name(p){return new a(p,this._newName(p))}value(p,l){var y;if(l.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const $=this.toName(p),{prefix:b}=$,S=(y=l.key)!==null&&y!==void 0?y:l.ref;let g=this._values[b];if(g){const o=g.get(S);if(o)return o}else g=this._values[b]=new Map;g.set(S,$);const u=this._scope[b]||(this._scope[b]=[]),m=u.length;return u[m]=l.ref,$.setValue(l,{property:b,itemIndex:m}),$}getValue(p,l){const y=this._values[p];if(y)return y.get(l)}scopeRefs(p,l=this._values){return this._reduceValues(l,y=>{if(y.scopePath===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return(0,t._)`${p}${y.scopePath}`})}scopeCode(p=this._values,l,y){return this._reduceValues(p,$=>{if($.value===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return $.value.code},l,y)}_reduceValues(p,l,y={},$){let b=t.nil;for(const S in p){const g=p[S];if(!g)continue;const u=y[S]=y[S]||new Map;g.forEach(m=>{if(u.has(m))return;u.set(m,n.Started);let o=l(m);if(o){const d=this.opts.es5?e.varKinds.var:e.varKinds.const;b=(0,t._)`${b}${d} ${m} = ${o};${this.opts._n}`}else if(o=$?.(m))b=(0,t._)`${b}${o}${this.opts._n}`;else throw new r(m);u.set(m,n.Completed)})}return b}}e.ValueScope=c}(pr)),pr}var Hr;function x(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Bt(),r=Br();var n=Bt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Br();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(h,j){return this}}class i extends a{constructor(h,j,N){super(),this.varKind=h,this.name=j,this.rhs=N}render({es5:h,_n:j}){const N=h?r.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${K};`+j}optimizeNames(h,j){if(h[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,h,j)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(h,j,N){super(),this.lhs=h,this.rhs=j,this.sideEffects=N}render({_n:h}){return`${this.lhs} = ${this.rhs};`+h}optimizeNames(h,j){if(!(this.lhs instanceof t.Name&&!h[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.rhs,h,j),this}get names(){const h=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(h,this.rhs)}}class f extends c{constructor(h,j,N,K){super(h,N,K),this.op=j}render({_n:h}){return`${this.lhs} ${this.op}= ${this.rhs};`+h}}class p extends a{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`${this.label}:`+h}}class l extends a{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`break${this.label?` ${this.label}`:""};`+h}}class y extends a{constructor(h){super(),this.error=h}render({_n:h}){return`throw ${this.error};`+h}get names(){return this.error.names}}class $ extends a{constructor(h){super(),this.code=h}render({_n:h}){return`${this.code};`+h}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(h,j){return this.code=B(this.code,h,j),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class b extends a{constructor(h=[]){super(),this.nodes=h}render(h){return this.nodes.reduce((j,N)=>j+N.render(h),"")}optimizeNodes(){const{nodes:h}=this;let j=h.length;for(;j--;){const N=h[j].optimizeNodes();Array.isArray(N)?h.splice(j,1,...N):N?h[j]=N:h.splice(j,1)}return h.length>0?this:void 0}optimizeNames(h,j){const{nodes:N}=this;let K=N.length;for(;K--;){const W=N[K];W.optimizeNames(h,j)||(ee(h,W.names),N.splice(K,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((h,j)=>z(h,j.names),{})}}class S extends b{render(h){return"{"+h._n+super.render(h)+"}"+h._n}}class g extends b{}class u extends S{}u.kind="else";class m extends S{constructor(h,j){super(j),this.condition=h}render(h){let j=`if(${this.condition})`+super.render(h);return this.else&&(j+="else "+this.else.render(h)),j}optimizeNodes(){super.optimizeNodes();const h=this.condition;if(h===!0)return this.nodes;let j=this.else;if(j){const N=j.optimizeNodes();j=this.else=Array.isArray(N)?new u(N):N}if(j)return h===!1?j instanceof m?j:j.nodes:this.nodes.length?this:new m(se(h),j instanceof m?[j]:j.nodes);if(!(h===!1||!this.nodes.length))return this}optimizeNames(h,j){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(h,j),!!(super.optimizeNames(h,j)||this.else))return this.condition=B(this.condition,h,j),this}get names(){const h=super.names;return U(h,this.condition),this.else&&z(h,this.else.names),h}}m.kind="if";class o extends S{}o.kind="for";class d extends o{constructor(h){super(),this.iteration=h}render(h){return`for(${this.iteration})`+super.render(h)}optimizeNames(h,j){if(super.optimizeNames(h,j))return this.iteration=B(this.iteration,h,j),this}get names(){return z(super.names,this.iteration.names)}}class v extends o{constructor(h,j,N,K){super(),this.varKind=h,this.name=j,this.from=N,this.to=K}render(h){const j=h.es5?r.varKinds.var:this.varKind,{name:N,from:K,to:W}=this;return`for(${j} ${N}=${K}; ${N}<${W}; ${N}++)`+super.render(h)}get names(){const h=U(super.names,this.from);return U(h,this.to)}}class _ extends o{constructor(h,j,N,K){super(),this.loop=h,this.varKind=j,this.name=N,this.iterable=K}render(h){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(h)}optimizeNames(h,j){if(super.optimizeNames(h,j))return this.iterable=B(this.iterable,h,j),this}get names(){return z(super.names,this.iterable.names)}}class w extends S{constructor(h,j,N){super(),this.name=h,this.args=j,this.async=N}render(h){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(h)}}w.kind="func";class P extends b{render(h){return"return "+super.render(h)}}P.kind="return";class I extends S{render(h){let j="try"+super.render(h);return this.catch&&(j+=this.catch.render(h)),this.finally&&(j+=this.finally.render(h)),j}optimizeNodes(){var h,j;return super.optimizeNodes(),(h=this.catch)===null||h===void 0||h.optimizeNodes(),(j=this.finally)===null||j===void 0||j.optimizeNodes(),this}optimizeNames(h,j){var N,K;return super.optimizeNames(h,j),(N=this.catch)===null||N===void 0||N.optimizeNames(h,j),(K=this.finally)===null||K===void 0||K.optimizeNames(h,j),this}get names(){const h=super.names;return this.catch&&z(h,this.catch.names),this.finally&&z(h,this.finally.names),h}}class M extends S{constructor(h){super(),this.error=h}render(h){return`catch(${this.error})`+super.render(h)}}M.kind="catch";class F extends S{render(h){return"finally"+super.render(h)}}F.kind="finally";class C{constructor(h,j={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...j,_n:j.lines?`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Yt=require("../_commonjsHelpers-DwGv2jUC.cjs"),D=require("../notice-CDDmL_KD.cjs"),J=require("../utils-_FbKFtEZ.cjs"),E=require("@tempots/dom"),ke=require("../translations-hMQlZmD4.cjs"),Os=require("../colors-B9fcMxa_.cjs");var Be={exports:{}},lr={},be={},Ee={},dr={},fr={},mr={},Jr;function Bt(){return Jr||(Jr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(o){if(super(),!e.IDENTIFIER.test(o))throw new Error("CodeGen: name must be a valid identifier");this.str=o}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(o){super(),this._items=typeof o=="string"?[o]:o}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const o=this._items[0];return o===""||o==='""'}get str(){var o;return(o=this._str)!==null&&o!==void 0?o:this._str=this._items.reduce((d,v)=>`${d}${v}`,"")}get names(){var o;return(o=this._names)!==null&&o!==void 0?o:this._names=this._items.reduce((d,v)=>(v instanceof r&&(d[v.str]=(d[v.str]||0)+1),d),{})}}e._Code=n,e.nil=new n("");function s(m,...o){const d=[m[0]];let v=0;for(;v<o.length;)c(d,o[v]),d.push(m[++v]);return new n(d)}e._=s;const a=new n("+");function i(m,...o){const d=[b(m[0])];let v=0;for(;v<o.length;)d.push(a),c(d,o[v]),d.push(a,b(m[++v]));return f(d),new n(d)}e.str=i;function c(m,o){o instanceof n?m.push(...o._items):o instanceof r?m.push(o):m.push(y(o))}e.addCodeArg=c;function f(m){let o=1;for(;o<m.length-1;){if(m[o]===a){const d=p(m[o-1],m[o+1]);if(d!==void 0){m.splice(o-1,3,d);continue}m[o++]="+"}o++}}function p(m,o){if(o==='""')return m;if(m==='""')return o;if(typeof m=="string")return o instanceof r||m[m.length-1]!=='"'?void 0:typeof o!="string"?`${m.slice(0,-1)}${o}"`:o[0]==='"'?m.slice(0,-1)+o.slice(1):void 0;if(typeof o=="string"&&o[0]==='"'&&!(m instanceof r))return`"${m}${o.slice(1)}`}function l(m,o){return o.emptyStr()?m:m.emptyStr()?o:i`${m}${o}`}e.strConcat=l;function y(m){return typeof m=="number"||typeof m=="boolean"||m===null?m:b(Array.isArray(m)?m.join(","):m)}function $(m){return new n(b(m))}e.stringify=$;function b(m){return JSON.stringify(m).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=b;function S(m){return typeof m=="string"&&e.IDENTIFIER.test(m)?new n(`.${m}`):s`[${m}]`}e.getProperty=S;function g(m){if(typeof m=="string"&&e.IDENTIFIER.test(m))return new n(`${m}`);throw new Error(`CodeGen: invalid export name: ${m}, use explicit $id name mapping`)}e.getEsmExportName=g;function u(m){return new n(m.toString())}e.regexpCode=u}(mr)),mr}var pr={},Wr;function Br(){return Wr||(Wr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Bt();class r extends Error{constructor(p){super(`CodeGen: "code" for ${p} not defined`),this.value=p.value}}var n;(function(f){f[f.Started=0]="Started",f[f.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:p,parent:l}={}){this._names={},this._prefixes=p,this._parent=l}toName(p){return p instanceof t.Name?p:this.name(p)}name(p){return new t.Name(this._newName(p))}_newName(p){const l=this._names[p]||this._nameGroup(p);return`${p}${l.index++}`}_nameGroup(p){var l,y;if(!((y=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||y===void 0)&&y.has(p)||this._prefixes&&!this._prefixes.has(p))throw new Error(`CodeGen: prefix "${p}" is not allowed in this scope`);return this._names[p]={prefix:p,index:0}}}e.Scope=s;class a extends t.Name{constructor(p,l){super(l),this.prefix=p}setValue(p,{property:l,itemIndex:y}){this.value=p,this.scopePath=(0,t._)`.${new t.Name(l)}[${y}]`}}e.ValueScopeName=a;const i=(0,t._)`\n`;class c extends s{constructor(p){super(p),this._values={},this._scope=p.scope,this.opts={...p,_n:p.lines?i:t.nil}}get(){return this._scope}name(p){return new a(p,this._newName(p))}value(p,l){var y;if(l.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const $=this.toName(p),{prefix:b}=$,S=(y=l.key)!==null&&y!==void 0?y:l.ref;let g=this._values[b];if(g){const o=g.get(S);if(o)return o}else g=this._values[b]=new Map;g.set(S,$);const u=this._scope[b]||(this._scope[b]=[]),m=u.length;return u[m]=l.ref,$.setValue(l,{property:b,itemIndex:m}),$}getValue(p,l){const y=this._values[p];if(y)return y.get(l)}scopeRefs(p,l=this._values){return this._reduceValues(l,y=>{if(y.scopePath===void 0)throw new Error(`CodeGen: name "${y}" has no value`);return(0,t._)`${p}${y.scopePath}`})}scopeCode(p=this._values,l,y){return this._reduceValues(p,$=>{if($.value===void 0)throw new Error(`CodeGen: name "${$}" has no value`);return $.value.code},l,y)}_reduceValues(p,l,y={},$){let b=t.nil;for(const S in p){const g=p[S];if(!g)continue;const u=y[S]=y[S]||new Map;g.forEach(m=>{if(u.has(m))return;u.set(m,n.Started);let o=l(m);if(o){const d=this.opts.es5?e.varKinds.var:e.varKinds.const;b=(0,t._)`${b}${d} ${m} = ${o};${this.opts._n}`}else if(o=$?.(m))b=(0,t._)`${b}${o}${this.opts._n}`;else throw new r(m);u.set(m,n.Completed)})}return b}}e.ValueScope=c}(pr)),pr}var Hr;function x(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Bt(),r=Br();var n=Bt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var s=Br();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(h,j){return this}}class i extends a{constructor(h,j,N){super(),this.varKind=h,this.name=j,this.rhs=N}render({es5:h,_n:j}){const N=h?r.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${K};`+j}optimizeNames(h,j){if(h[this.name.str])return this.rhs&&(this.rhs=B(this.rhs,h,j)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(h,j,N){super(),this.lhs=h,this.rhs=j,this.sideEffects=N}render({_n:h}){return`${this.lhs} = ${this.rhs};`+h}optimizeNames(h,j){if(!(this.lhs instanceof t.Name&&!h[this.lhs.str]&&!this.sideEffects))return this.rhs=B(this.rhs,h,j),this}get names(){const h=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(h,this.rhs)}}class f extends c{constructor(h,j,N,K){super(h,N,K),this.op=j}render({_n:h}){return`${this.lhs} ${this.op}= ${this.rhs};`+h}}class p extends a{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`${this.label}:`+h}}class l extends a{constructor(h){super(),this.label=h,this.names={}}render({_n:h}){return`break${this.label?` ${this.label}`:""};`+h}}class y extends a{constructor(h){super(),this.error=h}render({_n:h}){return`throw ${this.error};`+h}get names(){return this.error.names}}class $ extends a{constructor(h){super(),this.code=h}render({_n:h}){return`${this.code};`+h}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(h,j){return this.code=B(this.code,h,j),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class b extends a{constructor(h=[]){super(),this.nodes=h}render(h){return this.nodes.reduce((j,N)=>j+N.render(h),"")}optimizeNodes(){const{nodes:h}=this;let j=h.length;for(;j--;){const N=h[j].optimizeNodes();Array.isArray(N)?h.splice(j,1,...N):N?h[j]=N:h.splice(j,1)}return h.length>0?this:void 0}optimizeNames(h,j){const{nodes:N}=this;let K=N.length;for(;K--;){const W=N[K];W.optimizeNames(h,j)||(ee(h,W.names),N.splice(K,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce((h,j)=>z(h,j.names),{})}}class S extends b{render(h){return"{"+h._n+super.render(h)+"}"+h._n}}class g extends b{}class u extends S{}u.kind="else";class m extends S{constructor(h,j){super(j),this.condition=h}render(h){let j=`if(${this.condition})`+super.render(h);return this.else&&(j+="else "+this.else.render(h)),j}optimizeNodes(){super.optimizeNodes();const h=this.condition;if(h===!0)return this.nodes;let j=this.else;if(j){const N=j.optimizeNodes();j=this.else=Array.isArray(N)?new u(N):N}if(j)return h===!1?j instanceof m?j:j.nodes:this.nodes.length?this:new m(se(h),j instanceof m?[j]:j.nodes);if(!(h===!1||!this.nodes.length))return this}optimizeNames(h,j){var N;if(this.else=(N=this.else)===null||N===void 0?void 0:N.optimizeNames(h,j),!!(super.optimizeNames(h,j)||this.else))return this.condition=B(this.condition,h,j),this}get names(){const h=super.names;return U(h,this.condition),this.else&&z(h,this.else.names),h}}m.kind="if";class o extends S{}o.kind="for";class d extends o{constructor(h){super(),this.iteration=h}render(h){return`for(${this.iteration})`+super.render(h)}optimizeNames(h,j){if(super.optimizeNames(h,j))return this.iteration=B(this.iteration,h,j),this}get names(){return z(super.names,this.iteration.names)}}class v extends o{constructor(h,j,N,K){super(),this.varKind=h,this.name=j,this.from=N,this.to=K}render(h){const j=h.es5?r.varKinds.var:this.varKind,{name:N,from:K,to:W}=this;return`for(${j} ${N}=${K}; ${N}<${W}; ${N}++)`+super.render(h)}get names(){const h=U(super.names,this.from);return U(h,this.to)}}class _ extends o{constructor(h,j,N,K){super(),this.loop=h,this.varKind=j,this.name=N,this.iterable=K}render(h){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(h)}optimizeNames(h,j){if(super.optimizeNames(h,j))return this.iterable=B(this.iterable,h,j),this}get names(){return z(super.names,this.iterable.names)}}class w extends S{constructor(h,j,N){super(),this.name=h,this.args=j,this.async=N}render(h){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(h)}}w.kind="func";class P extends b{render(h){return"return "+super.render(h)}}P.kind="return";class I extends S{render(h){let j="try"+super.render(h);return this.catch&&(j+=this.catch.render(h)),this.finally&&(j+=this.finally.render(h)),j}optimizeNodes(){var h,j;return super.optimizeNodes(),(h=this.catch)===null||h===void 0||h.optimizeNodes(),(j=this.finally)===null||j===void 0||j.optimizeNodes(),this}optimizeNames(h,j){var N,K;return super.optimizeNames(h,j),(N=this.catch)===null||N===void 0||N.optimizeNames(h,j),(K=this.finally)===null||K===void 0||K.optimizeNames(h,j),this}get names(){const h=super.names;return this.catch&&z(h,this.catch.names),this.finally&&z(h,this.finally.names),h}}class M extends S{constructor(h){super(),this.error=h}render(h){return`catch(${this.error})`+super.render(h)}}M.kind="catch";class F extends S{render(h){return"finally"+super.render(h)}}F.kind="finally";class C{constructor(h,j={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...j,_n:j.lines?`
2
2
  `:""},this._extScope=h,this._scope=new r.Scope({parent:h}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(h){return this._scope.name(h)}scopeName(h){return this._extScope.name(h)}scopeValue(h,j){const N=this._extScope.value(h,j);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue(h,j){return this._extScope.getValue(h,j)}scopeRefs(h){return this._extScope.scopeRefs(h,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(h,j,N,K){const W=this._scope.toName(j);return N!==void 0&&K&&(this._constants[W.str]=N),this._leafNode(new i(h,W,N)),W}const(h,j,N){return this._def(r.varKinds.const,h,j,N)}let(h,j,N){return this._def(r.varKinds.let,h,j,N)}var(h,j,N){return this._def(r.varKinds.var,h,j,N)}assign(h,j,N){return this._leafNode(new c(h,j,N))}add(h,j){return this._leafNode(new f(h,e.operators.ADD,j))}code(h){return typeof h=="function"?h():h!==t.nil&&this._leafNode(new $(h)),this}object(...h){const j=["{"];for(const[N,K]of h)j.length>1&&j.push(","),j.push(N),(N!==K||this.opts.es5)&&(j.push(":"),(0,t.addCodeArg)(j,K));return j.push("}"),new t._Code(j)}if(h,j,N){if(this._blockNode(new m(h)),j&&N)this.code(j).else().code(N).endIf();else if(j)this.code(j).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(h){return this._elseNode(new m(h))}else(){return this._elseNode(new u)}endIf(){return this._endBlockNode(m,u)}_for(h,j){return this._blockNode(h),j&&this.code(j).endFor(),this}for(h,j){return this._for(new d(h),j)}forRange(h,j,N,K,W=this.opts.es5?r.varKinds.var:r.varKinds.let){const Y=this._scope.toName(h);return this._for(new v(W,Y,j,N),()=>K(Y))}forOf(h,j,N,K=r.varKinds.const){const W=this._scope.toName(h);if(this.opts.es5){const Y=j instanceof t.Name?j:this.var("_arr",j);return this.forRange("_i",0,(0,t._)`${Y}.length`,X=>{this.var(W,(0,t._)`${Y}[${X}]`),N(W)})}return this._for(new _("of",K,W,j),()=>N(W))}forIn(h,j,N,K=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(h,(0,t._)`Object.keys(${j})`,N);const W=this._scope.toName(h);return this._for(new _("in",K,W,j),()=>N(W))}endFor(){return this._endBlockNode(o)}label(h){return this._leafNode(new p(h))}break(h){return this._leafNode(new l(h))}return(h){const j=new P;if(this._blockNode(j),this.code(h),j.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(P)}try(h,j,N){if(!j&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new I;if(this._blockNode(K),this.code(h),j){const W=this.name("e");this._currNode=K.catch=new M(W),j(W)}return N&&(this._currNode=K.finally=new F,this.code(N)),this._endBlockNode(M,F)}throw(h){return this._leafNode(new y(h))}block(h,j){return this._blockStarts.push(this._nodes.length),h&&this.code(h).endBlock(j),this}endBlock(h){const j=this._blockStarts.pop();if(j===void 0)throw new Error("CodeGen: not in self-balancing block");const N=this._nodes.length-j;if(N<0||h!==void 0&&N!==h)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${h} expected`);return this._nodes.length=j,this}func(h,j=t.nil,N,K){return this._blockNode(new w(h,j,N)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(w)}optimize(h=1){for(;h-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(h){return this._currNode.nodes.push(h),this}_blockNode(h){this._currNode.nodes.push(h),this._nodes.push(h)}_endBlockNode(h,j){const N=this._currNode;if(N instanceof h||j&&N instanceof j)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${j?`${h.kind}/${j.kind}`:h.kind}"`)}_elseNode(h){const j=this._currNode;if(!(j instanceof m))throw new Error('CodeGen: "else" without "if"');return this._currNode=j.else=h,this}get _root(){return this._nodes[0]}get _currNode(){const h=this._nodes;return h[h.length-1]}set _currNode(h){const j=this._nodes;j[j.length-1]=h}}e.CodeGen=C;function z(A,h){for(const j in h)A[j]=(A[j]||0)+(h[j]||0);return A}function U(A,h){return h instanceof t._CodeOrName?z(A,h.names):A}function B(A,h,j){if(A instanceof t.Name)return N(A);if(!K(A))return A;return new t._Code(A._items.reduce((W,Y)=>(Y instanceof t.Name&&(Y=N(Y)),Y instanceof t._Code?W.push(...Y._items):W.push(Y),W),[]));function N(W){const Y=j[W.str];return Y===void 0||h[W.str]!==1?W:(delete h[W.str],Y)}function K(W){return W instanceof t._Code&&W._items.some(Y=>Y instanceof t.Name&&h[Y.str]===1&&j[Y.str]!==void 0)}}function ee(A,h){for(const j in h)A[j]=(A[j]||0)-(h[j]||0)}function se(A){return typeof A=="boolean"||typeof A=="number"||A===null?!A:(0,t._)`!${T(A)}`}e.not=se;const ae=R(e.operators.AND);function te(...A){return A.reduce(ae)}e.and=te;const pe=R(e.operators.OR);function V(...A){return A.reduce(pe)}e.or=V;function R(A){return(h,j)=>h===t.nil?j:j===t.nil?h:(0,t._)`${T(h)} ${A} ${T(j)}`}function T(A){return A instanceof t.Name?A:(0,t._)`(${A})`}}(fr)),fr}var G={},xr;function Q(){if(xr)return G;xr=1,Object.defineProperty(G,"__esModule",{value:!0}),G.checkStrictMode=G.getErrorPath=G.Type=G.useFunc=G.setEvaluated=G.evaluatedPropsToName=G.mergeEvaluated=G.eachItem=G.unescapeJsonPointer=G.escapeJsonPointer=G.escapeFragment=G.unescapeFragment=G.schemaRefOrVal=G.schemaHasRulesButRef=G.schemaHasRules=G.checkUnknownRules=G.alwaysValidSchema=G.toHash=void 0;const e=x(),t=Bt();function r(_){const w={};for(const P of _)w[P]=!0;return w}G.toHash=r;function n(_,w){return typeof w=="boolean"?w:Object.keys(w).length===0?!0:(s(_,w),!a(w,_.self.RULES.all))}G.alwaysValidSchema=n;function s(_,w=_.schema){const{opts:P,self:I}=_;if(!P.strictSchema||typeof w=="boolean")return;const M=I.RULES.keywords;for(const F in w)M[F]||v(_,`unknown keyword: "${F}"`)}G.checkUnknownRules=s;function a(_,w){if(typeof _=="boolean")return!_;for(const P in _)if(w[P])return!0;return!1}G.schemaHasRules=a;function i(_,w){if(typeof _=="boolean")return!_;for(const P in _)if(P!=="$ref"&&w.all[P])return!0;return!1}G.schemaHasRulesButRef=i;function c({topSchemaRef:_,schemaPath:w},P,I,M){if(!M){if(typeof P=="number"||typeof P=="boolean")return P;if(typeof P=="string")return(0,e._)`${P}`}return(0,e._)`${_}${w}${(0,e.getProperty)(I)}`}G.schemaRefOrVal=c;function f(_){return y(decodeURIComponent(_))}G.unescapeFragment=f;function p(_){return encodeURIComponent(l(_))}G.escapeFragment=p;function l(_){return typeof _=="number"?`${_}`:_.replace(/~/g,"~0").replace(/\//g,"~1")}G.escapeJsonPointer=l;function y(_){return _.replace(/~1/g,"/").replace(/~0/g,"~")}G.unescapeJsonPointer=y;function $(_,w){if(Array.isArray(_))for(const P of _)w(P);else w(_)}G.eachItem=$;function b({mergeNames:_,mergeToName:w,mergeValues:P,resultToName:I}){return(M,F,C,z)=>{const U=C===void 0?F:C instanceof e.Name?(F instanceof e.Name?_(M,F,C):w(M,F,C),C):F instanceof e.Name?(w(M,C,F),F):P(F,C);return z===e.Name&&!(U instanceof e.Name)?I(M,U):U}}G.mergeEvaluated={props:b({mergeNames:(_,w,P)=>_.if((0,e._)`${P} !== true && ${w} !== undefined`,()=>{_.if((0,e._)`${w} === true`,()=>_.assign(P,!0),()=>_.assign(P,(0,e._)`${P} || {}`).code((0,e._)`Object.assign(${P}, ${w})`))}),mergeToName:(_,w,P)=>_.if((0,e._)`${P} !== true`,()=>{w===!0?_.assign(P,!0):(_.assign(P,(0,e._)`${P} || {}`),g(_,P,w))}),mergeValues:(_,w)=>_===!0?!0:{..._,...w},resultToName:S}),items:b({mergeNames:(_,w,P)=>_.if((0,e._)`${P} !== true && ${w} !== undefined`,()=>_.assign(P,(0,e._)`${w} === true ? true : ${P} > ${w} ? ${P} : ${w}`)),mergeToName:(_,w,P)=>_.if((0,e._)`${P} !== true`,()=>_.assign(P,w===!0?!0:(0,e._)`${P} > ${w} ? ${P} : ${w}`)),mergeValues:(_,w)=>_===!0?!0:Math.max(_,w),resultToName:(_,w)=>_.var("items",w)})};function S(_,w){if(w===!0)return _.var("props",!0);const P=_.var("props",(0,e._)`{}`);return w!==void 0&&g(_,P,w),P}G.evaluatedPropsToName=S;function g(_,w,P){Object.keys(P).forEach(I=>_.assign((0,e._)`${w}${(0,e.getProperty)(I)}`,!0))}G.setEvaluated=g;const u={};function m(_,w){return _.scopeValue("func",{ref:w,code:u[w.code]||(u[w.code]=new t._Code(w.code))})}G.useFunc=m;var o;(function(_){_[_.Num=0]="Num",_[_.Str=1]="Str"})(o||(G.Type=o={}));function d(_,w,P){if(_ instanceof e.Name){const I=w===o.Num;return P?I?(0,e._)`"[" + ${_} + "]"`:(0,e._)`"['" + ${_} + "']"`:I?(0,e._)`"/" + ${_}`:(0,e._)`"/" + ${_}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return P?(0,e.getProperty)(_).toString():"/"+l(_)}G.getErrorPath=d;function v(_,w,P=_.opts.strictSchema){if(P){if(w=`strict mode: ${w}`,P===!0)throw new Error(w);_.self.logger.warn(w)}}return G.checkStrictMode=v,G}var He={},Gr;function ve(){if(Gr)return He;Gr=1,Object.defineProperty(He,"__esModule",{value:!0});const e=x(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return He.default=t,He}var Zr;function Qt(){return Zr||(Zr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=x(),r=Q(),n=ve();e.keywordError={message:({keyword:u})=>(0,t.str)`must pass "${u}" keyword validation`},e.keyword$DataError={message:({keyword:u,schemaType:m})=>m?(0,t.str)`"${u}" keyword must be ${m} ($data)`:(0,t.str)`"${u}" keyword is invalid ($data)`};function s(u,m=e.keywordError,o,d){const{it:v}=u,{gen:_,compositeRule:w,allErrors:P}=v,I=y(u,m,o);d??(w||P)?f(_,I):p(v,(0,t._)`[${I}]`)}e.reportError=s;function a(u,m=e.keywordError,o){const{it:d}=u,{gen:v,compositeRule:_,allErrors:w}=d,P=y(u,m,o);f(v,P),_||w||p(d,n.default.vErrors)}e.reportExtraError=a;function i(u,m){u.assign(n.default.errors,m),u.if((0,t._)`${n.default.vErrors} !== null`,()=>u.if(m,()=>u.assign((0,t._)`${n.default.vErrors}.length`,m),()=>u.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:u,keyword:m,schemaValue:o,data:d,errsCount:v,it:_}){if(v===void 0)throw new Error("ajv implementation error");const w=u.name("err");u.forRange("i",v,n.default.errors,P=>{u.const(w,(0,t._)`${n.default.vErrors}[${P}]`),u.if((0,t._)`${w}.instancePath === undefined`,()=>u.assign((0,t._)`${w}.instancePath`,(0,t.strConcat)(n.default.instancePath,_.errorPath))),u.assign((0,t._)`${w}.schemaPath`,(0,t.str)`${_.errSchemaPath}/${m}`),_.opts.verbose&&(u.assign((0,t._)`${w}.schema`,o),u.assign((0,t._)`${w}.data`,d))})}e.extendErrors=c;function f(u,m){const o=u.const("err",m);u.if((0,t._)`${n.default.vErrors} === null`,()=>u.assign(n.default.vErrors,(0,t._)`[${o}]`),(0,t._)`${n.default.vErrors}.push(${o})`),u.code((0,t._)`${n.default.errors}++`)}function p(u,m){const{gen:o,validateName:d,schemaEnv:v}=u;v.$async?o.throw((0,t._)`new ${u.ValidationError}(${m})`):(o.assign((0,t._)`${d}.errors`,m),o.return(!1))}const l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function y(u,m,o){const{createErrors:d}=u.it;return d===!1?(0,t._)`{}`:$(u,m,o)}function $(u,m,o={}){const{gen:d,it:v}=u,_=[b(v,o),S(u,o)];return g(u,m,_),d.object(..._)}function b({errorPath:u},{instancePath:m}){const o=m?(0,t.str)`${u}${(0,r.getErrorPath)(m,r.Type.Str)}`:u;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,o)]}function S({keyword:u,it:{errSchemaPath:m}},{schemaPath:o,parentSchema:d}){let v=d?m:(0,t.str)`${m}/${u}`;return o&&(v=(0,t.str)`${v}${(0,r.getErrorPath)(o,r.Type.Str)}`),[l.schemaPath,v]}function g(u,{params:m,message:o},d){const{keyword:v,data:_,schemaValue:w,it:P}=u,{opts:I,propertyName:M,topSchemaRef:F,schemaPath:C}=P;d.push([l.keyword,v],[l.params,typeof m=="function"?m(u):m||(0,t._)`{}`]),I.messages&&d.push([l.message,typeof o=="function"?o(u):o]),I.verbose&&d.push([l.schema,w],[l.parentSchema,(0,t._)`${F}${C}`],[n.default.data,_]),M&&d.push([l.propertyName,M])}}(dr)),dr}var Xr;function Rs(){if(Xr)return Ee;Xr=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.boolOrEmptySchema=Ee.topBoolOrEmptySchema=void 0;const e=Qt(),t=x(),r=ve(),n={message:"boolean schema is false"};function s(c){const{gen:f,schema:p,validateName:l}=c;p===!1?i(c,!1):typeof p=="object"&&p.$async===!0?f.return(r.default.data):(f.assign((0,t._)`${l}.errors`,null),f.return(!0))}Ee.topBoolOrEmptySchema=s;function a(c,f){const{gen:p,schema:l}=c;l===!1?(p.var(f,!1),i(c)):p.var(f,!0)}Ee.boolOrEmptySchema=a;function i(c,f){const{gen:p,data:l}=c,y={gen:p,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,e.reportError)(y,n,void 0,f)}return Ee}var ce={},Oe={},Yr;function Da(){if(Yr)return Oe;Yr=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.getRules=Oe.isJSONType=void 0;const e=["string","number","integer","boolean","null","object","array"],t=new Set(e);function r(s){return typeof s=="string"&&t.has(s)}Oe.isJSONType=r;function n(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return Oe.getRules=n,Oe}var _e={},Qr;function za(){if(Qr)return _e;Qr=1,Object.defineProperty(_e,"__esModule",{value:!0}),_e.shouldUseRule=_e.shouldUseGroup=_e.schemaHasRulesForType=void 0;function e({schema:n,self:s},a){const i=s.RULES.types[a];return i&&i!==!0&&t(n,i)}_e.schemaHasRulesForType=e;function t(n,s){return s.rules.some(a=>r(n,a))}_e.shouldUseGroup=t;function r(n,s){var a;return n[s.keyword]!==void 0||((a=s.definition.implements)===null||a===void 0?void 0:a.some(i=>n[i]!==void 0))}return _e.shouldUseRule=r,_e}var en;function Ht(){if(en)return ce;en=1,Object.defineProperty(ce,"__esModule",{value:!0}),ce.reportTypeError=ce.checkDataTypes=ce.checkDataType=ce.coerceAndCheckDataType=ce.getJSONTypes=ce.getSchemaTypes=ce.DataType=void 0;const e=Da(),t=za(),r=Qt(),n=x(),s=Q();var a;(function(o){o[o.Correct=0]="Correct",o[o.Wrong=1]="Wrong"})(a||(ce.DataType=a={}));function i(o){const d=c(o.type);if(d.includes("null")){if(o.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!d.length&&o.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');o.nullable===!0&&d.push("null")}return d}ce.getSchemaTypes=i;function c(o){const d=Array.isArray(o)?o:o?[o]:[];if(d.every(e.isJSONType))return d;throw new Error("type must be JSONType or JSONType[]: "+d.join(","))}ce.getJSONTypes=c;function f(o,d){const{gen:v,data:_,opts:w}=o,P=l(d,w.coerceTypes),I=d.length>0&&!(P.length===0&&d.length===1&&(0,t.schemaHasRulesForType)(o,d[0]));if(I){const M=S(d,_,w.strictNumbers,a.Wrong);v.if(M,()=>{P.length?y(o,d,P):u(o)})}return I}ce.coerceAndCheckDataType=f;const p=new Set(["string","number","integer","boolean","null"]);function l(o,d){return d?o.filter(v=>p.has(v)||d==="array"&&v==="array"):[]}function y(o,d,v){const{gen:_,data:w,opts:P}=o,I=_.let("dataType",(0,n._)`typeof ${w}`),M=_.let("coerced",(0,n._)`undefined`);P.coerceTypes==="array"&&_.if((0,n._)`${I} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>_.assign(w,(0,n._)`${w}[0]`).assign(I,(0,n._)`typeof ${w}`).if(S(d,w,P.strictNumbers),()=>_.assign(M,w))),_.if((0,n._)`${M} !== undefined`);for(const C of v)(p.has(C)||C==="array"&&P.coerceTypes==="array")&&F(C);_.else(),u(o),_.endIf(),_.if((0,n._)`${M} !== undefined`,()=>{_.assign(w,M),$(o,M)});function F(C){switch(C){case"string":_.elseIf((0,n._)`${I} == "number" || ${I} == "boolean"`).assign(M,(0,n._)`"" + ${w}`).elseIf((0,n._)`${w} === null`).assign(M,(0,n._)`""`);return;case"number":_.elseIf((0,n._)`${I} == "boolean" || ${w} === null
3
3
  || (${I} == "string" && ${w} && ${w} == +${w})`).assign(M,(0,n._)`+${w}`);return;case"integer":_.elseIf((0,n._)`${I} === "boolean" || ${w} === null
4
4
  || (${I} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(M,(0,n._)`+${w}`);return;case"boolean":_.elseIf((0,n._)`${w} === "false" || ${w} === 0 || ${w} === null`).assign(M,!1).elseIf((0,n._)`${w} === "true" || ${w} === 1`).assign(M,!0);return;case"null":_.elseIf((0,n._)`${w} === "" || ${w} === 0 || ${w} === false`),_.assign(M,null);return;case"array":_.elseIf((0,n._)`${I} === "string" || ${I} === "number"
@@ -1,6 +1,6 @@
1
1
  import { g as cr } from "../_commonjsHelpers-C6fGbg64.js";
2
- import { a as Pe, S as fe, I as et, c as Q, M as gr, P as Hs, E as Ws, b as an, N as Qa, L as Ue, x as Gs, C as es, i as xs, A as Zs, l as Xs } from "../notice-BH_pePhd.js";
3
- import { ah as Fr, ai as Ys, S as Qs, N as ei, a as ts, j as ti, t as le, x as Ve, w as vr, H as ri, C as ni, W as ai, O as si, Q as ii, v as oi, s as ci, r as ui, u as li, g as He, T as di, D as fi, z as Tr, y as mi, M as rt, K as pi, J as hi, I as yi, R as gi, A as vi, q as $i, G as bi, m as rs, V as _i, L as wi, f as Si } from "../utils-sMnCjVjS.js";
2
+ import { a as Pe, S as fe, I as et, c as Q, M as gr, P as Hs, E as Ws, b as an, N as Qa, L as Ue, x as Gs, C as es, i as xs, A as Zs, l as Xs } from "../notice-DUpqtjgC.js";
3
+ import { ah as Fr, ai as Ys, S as Qs, N as ei, a as ts, j as ti, t as le, x as Ve, w as vr, H as ri, C as ni, W as ai, O as si, Q as ii, v as oi, s as ci, r as ui, u as li, g as He, T as di, D as fi, z as Tr, y as mi, M as rt, K as pi, J as hi, I as yi, R as gi, A as vi, q as $i, G as bi, m as rs, V as _i, L as wi, f as Si } from "../utils-Lx2CyUUf.js";
4
4
  import { attr as F, Value as ne, Fragment as Re, WithElement as ns, Empty as as, html as H, When as Xe, computedOf as ie, prop as ke, Use as Ur, style as ss, Ensure as is, aria as Pi, on as Ye, MapSignal as ur, Async as ji, OnDispose as Ei } from "@tempots/dom";
5
5
  import { T as Oi, a as Kr, I as os, B as Ri } from "../translations-BUTBIDsS.js";
6
6
  import { f as ki } from "../colors-pQZlNrwM.js";
@@ -1 +1 @@
1
- "use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./notice-D3As5ZhJ.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
1
+ "use strict";const r=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),q=require("./notice-CDDmL_KD.cjs"),O=require("./translations-hMQlZmD4.cjs"),_=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function P(o){return Array.from(o.querySelectorAll(_)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(o={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:n,returnFocus:a,clickOutsideDeactivates:i=!1,onClickOutside:d}=o;return r.WithElement(p=>{let f=t,h=null,c=[];typeof document<"u"&&(h=document.activeElement);const v=()=>{c=P(p)},b=u=>{if(f){if(s&&u.key==="Escape"){u.preventDefault(),e?.();return}if(u.key==="Tab"){if(v(),c.length===0){u.preventDefault();return}const l=c.indexOf(document.activeElement);u.shiftKey?l<=0&&(u.preventDefault(),c[c.length-1]?.focus()):l>=c.length-1&&(u.preventDefault(),c[0]?.focus())}}},g=u=>{if(!f||!i)return;const l=u.target;p.contains(l)||d?.()},y=()=>{if(!f)return;v();let u=null;typeof n=="function"?u=n():n?u=n:c.length>0&&(u=c[0]),u&&setTimeout(()=>{u?.focus()},50),document.addEventListener("keydown",b,!0),i&&document.addEventListener("click",g,!0)},A=()=>{f=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",g,!0);let u=null;typeof a=="function"?u=a():a?u=a:h&&(u=h),u&&document.body.contains(u)&&setTimeout(()=>{u?.focus()},0)};return setTimeout(()=>y(),0),r.OnDispose(()=>{A()})})}function U(o={}){return{activate:()=>V({...o,active:!0}),deactivate:()=>V({...o,active:!1})}}function B({initialStatus:o="closed",openedAfter:t,closedAfter:s}){const e=r.prop(o),n=()=>{e.set("start-opening")},a=()=>{e.set("start-closing")},i=e.map(l=>l!=="closed"&&l!=="start-closing"&&l!=="closing"),d=l=>{l?n():a()},p=()=>{d(!i.value)},f=[],h=l=>{f.push(e.on(x=>{x==="closed"&&l()}))};let c=()=>{};e.on(l=>{switch(c(),l){case"start-opening":c=w.g(()=>e.set("opening"));break;case"opening":c=t(()=>e.set("opened"));break;case"start-closing":c=w.g(()=>e.set("closing"));break;case"closing":c=s(()=>e.set("closed"));break;case"closed":c=()=>{};break}}),e.onDispose(()=>{f.forEach(l=>l()),c()});const v=e.map(l=>l==="closed"),b=e.map(l=>l==="start-opening"),g=e.map(l=>l==="opening"),y=e.map(l=>l==="opened"),A=e.map(l=>l==="closing"),u=e.map(l=>l==="start-closing");return{status:e,open:n,close:a,toggle:p,setOpen:d,display:i,isClosed:v,isStartOpening:b,isOpening:g,isOpened:y,isClosing:A,isStartClosing:u,dispose:()=>e.dispose(),listenOnClosed:h}}function z({initialStatus:o="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return B({initialStatus:o,openedAfter:n=>w.T(n,s),closedAfter:n=>w.T(n,e)})}function M(o,t){let s=!1,e=null;function n(){s||(s=!0,o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i),e&&(clearTimeout(e),e=null),t())}function a(f){f.target===o&&n()}function i(f){f.target===o&&n()}const d=()=>{if(typeof o.getAnimations>"u"){e=setTimeout(n,16);return}o.addEventListener("transitionend",a),o.addEventListener("animationend",i),o.getAnimations().length===0&&(e=setTimeout(n,1e3))},p=w.g(d);return()=>{s=!0,p(),e&&(clearTimeout(e),e=null),o.removeEventListener("transitionend",a),o.removeEventListener("animationend",i)}}function F({initialStatus:o="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...B({initialStatus:o,openedAfter:e=>s==null?(e(),()=>{}):M(s,e),closedAfter:e=>s==null?(e(),()=>{}):M(s,e)})}}function R(o){if(o==null)return"";const t=[];return o.fade&&t.push("fade"),o.slide&&t.push(`slide-${o.slide}`),o.scale!=null&&t.push("scale"),t.length>0?t.join(" "):"none"}function H(o){if(o==null)return"";const t=[];return o.scale!=null&&typeof o.scale=="number"&&t.push(`--scale-factor: ${o.scale}`),o.transformOrigin!=null&&t.push(`--transform-origin: ${o.transformOrigin}`),o.duration!=null&&t.push(`--animation-duration: ${o.duration}ms`),o.easing!=null&&t.push(`--animation-easing: ${o.easing}`),t.join("; ")}function D({animation:o,status:t}){const s=r.computedOf(o,t)((n,a)=>{if(n==null)return`bc-animated-toggle bc-animated-toggle--${a}`;const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,`bc-animated-toggle bc-animated-toggle--${R(d)} bc-animated-toggle--${a}`}),e=r.computedOf(o,t)((n,a)=>{if(n==null)return"";const i=a==="start-opening"||a==="opening"||a==="opened";let d;return"enter"in n||"exit"in n?d=i?n.enter:n.exit:d=n,H(d)});return r.Fragment(r.attr.class(s),r.attr.style(e))}function K({initialStatus:o="closed",animation:t},s){return r.WithElement(e=>{const{setElement:n,dispose:a,...i}=F({initialStatus:o,element:e});return n(e),r.Fragment(D({status:i.status,animation:t}),r.OnDispose(a),s(i))})}function j(o){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=o.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(n=>({message:n.message,path:n.path}))}},types:void 0},safeParse:s=>{const e=o.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(n=>({message:n.message,path:n.path?.map(a=>typeof a=="object"&&"key"in a?a.key.toString():a.toString())||[]}))}}}}}class k{optional(){return new N(this)}default(t){return new G(this,t)}schema(){return j(this)}}class T extends k{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&t.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&s.push({message:"Invalid format"});for(const e of this.customValidations){const n=e(t);n&&s.push({message:n})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new T;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length<t?s:null),e}max(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>n.length>t?s:null),e}regex(t,s){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(n=>t.test(n)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,n=>s.test(n)?null:t],e}refine(t){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class C extends k{mustBeTrue=!1;trueMessage;validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,s){const e=new C;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const n=e.validate.bind(e);return e.validate=a=>{const i=n(a);return i.success?t(i.data)?i:{success:!1,errors:[{message:s}]}:i},e}literal(t,s){const e=new C;return e.mustBeTrue=!0,e.trueMessage=s,e}}class N extends k{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class G extends k{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class $ extends k{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},n=[];for(const[a,i]of Object.entries(this.shape)){const d=i.validate(s[a]);if(d.success)e[a]=d.data;else for(const p of d.errors)n.push({message:p.message,path:[a,...p.path||[]]})}return n.length>0?{success:!1,errors:n}:{success:!0,data:e}}refine(t,s){const e=new $(this.shape),n=e.validate.bind(e);return e.validate=a=>{const i=n(a);if(!i.success)return i;const d=t(i.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:i.data}},e}}const J=()=>new T,Q=()=>new C,X=o=>new $(o);function I(o){return r.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(a=>a());return o(({effect:a="opaque",mode:i="capturing",onClickOutside:d,onEscape:p,content:f,container:h="body"})=>{h==="body"&&(t=t.makePortal("body"));const c=F();c.listenOnClosed(e);let v=()=>{},b=()=>{};const g=E=>{E.key==="Escape"&&(p?.(),c.close())},y=()=>{d?.(),c.close()},A=E=>{v(),b(),E==="capturing"?(document.addEventListener("keydown",g),v=()=>document.removeEventListener("keydown",g),t.element.addEventListener("mousedown",y),b=()=>t.element.removeEventListener("mousedown",y)):(v=()=>{},b=()=>{})},u=r.Value.on(i,A);s.push(u),s.push(()=>{c.dispose(),v(),b()});const l=()=>{const E=new Set;for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))m.hasAttribute("inert")?E.add(m):m.setAttribute("inert","");return s.push(()=>{for(const m of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(m)||m.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),r.html.div(r.WithElement(m=>c.setElement(m)),r.dataAttr.status(c.status.map(String)),r.dataAttr.overlay("true"),r.attr.class(r.computedOf(a??"opaque",i)((m,L)=>`bc-overlay bc-overlay--effect-${m} bc-overlay--mode-${L}`)),f)},x=r.render(l(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(x),w.g(()=>c.open())},e)})}function W(o,t){const{size:s="md",dismissable:e=!0,showCloseButton:n=!0,onClose:a,overlayEffect:i="opaque",container:d="body",position:p="center"}=o;return I((f,h)=>{let c=()=>{};return t(g=>{c=h;const y=r.prop("capturing");r.Value.on(e,m=>{y.set(m?"capturing":"non-capturing")});const A=r.computedOf(g.header!=null,n)((m,L)=>m||L),u=q.sessionId("modal"),l=`${u}-header`,x=`${u}-body`,E=r.html.div(r.attr.class(r.computedOf(s,p)((m,L)=>`bc-modal bc-modal--size-${m} bc-modal--container-${d} bc-modal--position-${L}`)),r.attr.role("dialog"),r.aria.modal(!0),...g.header?[r.aria.labelledby(l)]:[],r.aria.describedby(x),r.attr.tabindex(-1),r.attr.id(u),r.dataAttr.focusTrap("true"),r.on.mousedown(m=>m.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const m=document.getElementById(u);if(!m)return null;const L=m.querySelector('[aria-label="Close modal"]');if(L)return L;const S=m.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||m}}),r.html.div(r.attr.class("bc-modal__content"),r.When(A,()=>r.html.div(r.attr.class("bc-modal__header"),r.html.div(r.attr.class("bc-modal__title"),...g.header?[r.attr.id(l)]:[],g.header),r.When(n,()=>r.Use(O.BeatUII18n,m=>q.CloseButton({size:"sm",label:m.$.closeModal,onClick:()=>{c(),h()}}))))),r.html.div(r.attr.class("bc-modal__body"),r.attr.id(x),g.body),g.footer&&r.html.div(r.attr.class("bc-modal__footer"),g.footer)));f({mode:y,effect:i??"opaque",container:d,content:E,onClickOutside:()=>{a?.(),h()},onEscape:()=>{a?.(),h()}})},()=>{c(),h()})})}function Y(o,t){const{confirmText:s,cancelText:e,onConfirm:n,onCancel:a,...i}=o;return r.Use(O.BeatUII18n,d=>W({showCloseButton:!1,...i},(p,f)=>{const h=()=>{n?.(),f()},c=()=>{a?.(),f()};return t(b=>{p({body:b,footer:r.Fragment(r.attr.class("bc-modal__actions"),O.Button({variant:"outline",onClick:c},r.coalesce(e,d.$.cancel)),O.Button({color:"primary",variant:"filled",onClick:h},r.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggle=K;exports.AnimatedToggleClass=D;exports.BooleanValidator=C;exports.ConfirmModal=Y;exports.FocusTrap=V;exports.Modal=W;exports.ObjectValidator=$;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=j;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=B;exports.useFocusTrap=U;exports.useTimedToggle=z;
@@ -1,6 +1,6 @@
1
1
  import { WithElement as S, OnDispose as z, prop as R, computedOf as w, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as B, aria as V, on as X, When as q, Use as H, coalesce as I } from "@tempots/dom";
2
2
  import { g as $, T as _ } from "./timer-DzWb416P.js";
3
- import { s as Y, C as Z } from "./notice-BH_pePhd.js";
3
+ import { s as Y, C as Z } from "./notice-DUpqtjgC.js";
4
4
  import { a as K, B as P } from "./translations-BUTBIDsS.js";
5
5
  const ee = [
6
6
  "a[href]",
@@ -1,2 +1,2 @@
1
- "use strict";const s=require("@tempots/dom"),w=require("./translations-hMQlZmD4.cjs"),x=new Map;function T(e){const t=x.get(e)??0;return x.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,S={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>S.isValid(e)?t():n(e.error),toResult:(e,t)=>S.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(S.isValid(e)&&t(),e),whenInvalid:(e,t)=>(S.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>S.valid,t=>S.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function j({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(w.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return w.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,w.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),q=(...e)=>s.html.span(s.attr.class(F("default")),...e),U=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??T("checkbox"),m=`${h}-label`,k=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},g=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),k())};return w.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,w.Icon({icon:s.computedOf(t,l,c)((u,d,b)=>u?d??"akar-icons/check-box-fill":b??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),U(a)):s.Empty)},s.on.click(k))},W=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function N(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:k},...g)=>{const u=p??l!=null,d=h??!1,b=m??"vertical",I=T("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(b)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(b,y=>ne(y))),s.attr.class(s.Value.map(e,y=>y?"bc-input-wrapper--full-width":"")),s.When(s.computedOf(b,k??void 0)((y,E)=>N(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(b,k??void 0)((y,E)=>N(y,E)),y=>y))),n!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((y,E)=>re(y??!1,E??!1))),n),n!=null&&t?W:s.Empty),s.When(s.computedOf(A,i)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?q(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),l!=null?s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)):null,...g)};function ae(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ie=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??w.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(w.BeatUII18n,p=>w.InputContainer({...e,before:c,input:s.input.email(w.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},le=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,k={name:"password",disabled:c,...m},g=s.prop(!0),u=s.computedOf(g,p)((d,b)=>d?b??"current-password":"off");return s.Use(w.BeatUII18n,d=>{const b=s.computedOf(d.$.passwordPlaceholderText,g,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>g.update(C=>!C)),s.When(g,()=>w.Icon({icon:"line-md:watch"}),()=>w.Icon({icon:"line-md:watch-off"})));return w.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(w.CommonInputAttributes({...k,autocomplete:u,placeholder:b}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},z=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:z(n,r)})}function oe(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??T("control");return P({...r,labelFor:n??i,content:$(l=>e({...l,id:i}),r)},...a)}function H(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??T("control");return P({...r,labelFor:n??i,content:H(e,{...r,id:i})},...a)}function ue(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function R(e){return typeof e=="number"?`[${e}]`:`.${e}`}function K(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(R)].join("")}function D(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return S.valid;return S.invalid(r)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,r,a,i,o=O){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="continuous"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return K(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new J(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=O)=>new V([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(D(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=O)=>new V([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(D(a)),this.parent,i)}class G extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class J extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((k,g)=>{const u=h.length+g;k.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function Q(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function X(e){const t=e.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=Q(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
- `);return{...n,message:r!=""?r:void 0}}function Y({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(S.valid),c=s.prop(!1),p=s.prop(a??"touchedOrSubmit"),h=d=>{l.set(d)};let m;const k=async d=>{if(n!=null){const b=await n(d);h(b)}},g=async d=>{o.set(d),t?.(d);const b=p.value;if(n!=null){if(b==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{k(d)},I)):await k(d)}},u=new V([],g,o,l,{disabled:c,validationMode:p},r??O);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function L(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function he(e,{triggerOn:t="change"}={}){return s.Fragment(L(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(L(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?S.invalid(X(e.issues)):S.valid}async function pe({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):S.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?S.invalid({message:i}):S.invalid({dependencies:Z(n,i)})}}function Z(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Z(r,t)}}}function me({initialValue:e={},schema:t,onSubmit:n=async()=>S.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=Y({initialValue:e,validationMode:r??"touchedOrSubmit",validateDebounceMs:a,validate:(r??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),(r??"touchedOrSubmit")==="onSubmit"){const k=c.signal.value,g=t?.["~standard"].validate;if(g==null){l.set(!1);return}const u=B(await g(k));if(o(u),u.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function fe(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function be(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ge(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ye({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),k=s.Value.map(t,u=>u??"subtle"),g=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(w.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,k,h,l)((d,b,I,C)=>ge(d,b,I,C))),s.attr.role(s.Value.map(g,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),w.Icon({icon:s.computedOf(a,m)((d,b)=>d===void 0?fe(b):String(d)),size:"md",color:s.Value.map(m,be)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>j({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=J;exports.BaseControl=$;exports.BaseMappedControl=H;exports.CheckboxInput=se;exports.CloseButton=j;exports.Control=oe;exports.Controller=V;exports.DangerLabel=te;exports.EmailInput=ie;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=q;exports.MappedControl=ce;exports.MutedLabel=U;exports.Notice=ye;exports.O=O;exports.ObjectController=G;exports.PasswordInput=le;exports.RequiredSymbol=W;exports.Stack=ae;exports.a=S;exports.connectCommonAttributes=L;exports.connectNumberInput=de;exports.connectStringInput=he;exports.convertStandardSchemaIssues=X;exports.convertStandardSchemaPathToPath=Q;exports.makeMapValidation=D;exports.makeOnBlurHandler=z;exports.makeOnChangeHandler=M;exports.parsePath=ue;exports.pathToString=K;exports.sessionId=T;exports.standardSchemaResultToValidation=B;exports.taskToValidation=pe;exports.useController=Y;exports.useForm=me;exports.wrapSegment=R;
1
+ "use strict";const s=require("@tempots/dom"),w=require("./translations-hMQlZmD4.cjs"),L=new Map;function D(e){const t=L.get(e)??0;return L.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:r,notAsked:a=r})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?a():r(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,S={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>S.isValid(e)?t():n(e.error),toResult:(e,t)=>S.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(S.isValid(e)&&t(),e),whenInvalid:(e,t)=>(S.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>S.valid,t=>S.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,r)=>f.match(e,a=>f.match(t,i=>f.success(n(a,i)),i=>f.failure(i)),a=>f.match(t,i=>f.failure(a),i=>f.failure(r(a,i)))),equals:(e,t,n={valueEquals:(r,a)=>r===a,errorEquals:(r,a)=>r===a})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function j({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:r="full",color:a="base",onClick:i,label:o},...l){return s.Use(w.BeatUII18n,c=>{const p=s.coalesce(o,c.$.closeModal);return w.Button({variant:"text",size:e,roundedness:r,disabled:n,color:a,onClick:i},s.attr.title(p),s.aria.label(p),...l,w.Icon({icon:t,size:e??"sm"}))})}function F(e){return`bc-label bc-label--${e}`}const ee=(...e)=>s.html.span(s.attr.class(F("emphasis")),...e),q=(...e)=>s.html.span(s.attr.class(F("default")),...e),U=(...e)=>s.html.span(s.attr.class(F("muted")),...e),te=(...e)=>s.html.span(s.attr.class(F("danger")),...e),se=e=>{const{value:t,onBlur:n,onChange:r,placeholder:a,disabled:i,id:o,checkedIcon:l,uncheckedIcon:c,iconSize:p="lg"}=e,h=o??D("checkbox"),m=`${h}-label`,k=()=>{if(s.Value.get(i??!1))return;const u=s.Value.get(t);r?.(!u)},g=u=>{s.Value.get(i??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),k())};return w.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(h),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,u=>u?-1:0)),s.aria.checked(t),s.aria.disabled(i),a!=null?s.aria.labelledby(m):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,w.Icon({icon:s.computedOf(t,l,c)((u,d,b)=>u?d??"akar-icons/check-box-fill":b??"akar-icons/box"),accessibility:"decorative",size:p})),a!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(m),s.attr.for(h),U(a)):s.Empty)},s.on.click(k))},W=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function ne(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function re(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function N(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const P=({fullWidth:e=!1,required:t,label:n,labelChildren:r,context:a,description:i,content:o,error:l,labelFor:c,hasError:p,disabled:h,layout:m,labelWidth:k},...g)=>{const u=p??l!=null,d=h??!1,b=m??"vertical",I=D("input-wrapper"),C=i?`${I}-description`:void 0,_=l!=null?`${I}-error`:void 0,A=s.computedOf(b)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(b,y=>ne(y))),s.attr.class(s.Value.map(e,y=>y?"bc-input-wrapper--full-width":"")),s.When(s.computedOf(b,k??void 0)((y,E)=>N(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(b,k??void 0)((y,E)=>N(y,E)),y=>y))),n!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),c!=null?s.attr.for(c):s.Empty,s.html.span(s.attr.class(s.computedOf(u,d)((y,E)=>re(y??!1,E??!1))),n),n!=null&&t?W:s.Empty),s.When(s.computedOf(A,i)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),i))),a!=null?q(a):s.Empty,r):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,_].filter(Boolean).length>0?s.dataAttr.describedby([C,_].filter(Boolean).join(" ")):s.Empty,t?s.dataAttr.required("true"):s.Empty,s.When(u,()=>s.dataAttr.invalid("true")),o),s.When(s.computedOf(A,i)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),i)),s.When(u,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(_),s.aria.live("polite"),s.attr.role("alert"),l)),...g)};function ae(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ie=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:r,onBlur:a,onChange:i,onInput:o,placeholder:l}=t,c=r??w.InputIcon({icon:"line-md:email",size:e.size,color:"neutral"});return s.Use(w.BeatUII18n,p=>w.InputContainer({...e,before:c,input:s.input.email(w.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(l,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),a!=null?s.on.blur(s.emitValue(a)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,o!=null?s.on.input(s.emitValue(o)):s.Empty)}))},le=e=>{const{value:t,onBlur:n,onChange:r,onInput:a,before:i,after:o,hasError:l,disabled:c,autocomplete:p,placeholder:h,...m}=e,k={name:"password",disabled:c,...m},g=s.prop(!0),u=s.computedOf(g,p)((d,b)=>d?b??"current-password":"off");return s.Use(w.BeatUII18n,d=>{const b=s.computedOf(d.$.passwordPlaceholderText,g,h)((C,_,A)=>_?"•••••••••••••••":A??C),I=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>g.update(C=>!C)),s.When(g,()=>w.Icon({icon:"line-md:watch"}),()=>w.Icon({icon:"line-md:watch-off"})));return w.InputContainer({before:i,disabled:c,hasError:l,input:s.html.input(w.CommonInputAttributes({...k,autocomplete:u,placeholder:b}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,r!=null?s.on.change(s.emitValue(r)):s.Empty,a!=null?s.on.input(s.emitValue(a)):s.Empty),after:o!=null?s.Fragment(I,o):I})})},z=(e,t)=>()=>{e.markTouched(),t?.()},M=(e,t)=>n=>{e.change(n),t?.(n)};function $(e,t){const{controller:n,onBlur:r,onChange:a,id:i,triggerOn:o,...l}=t;return e({id:i??n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,name:n.name,...l,onInput:o==="input"?M(n,a):void 0,onChange:o!=="input"?M(n,a):void 0,onBlur:z(n,r)})}function oe(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control"),o=n??i;return P({...r,hasError:r.controller.errorVisible,error:s.TextNode(r.controller.error.map(l=>l??"")),labelFor:o,content:$(l=>e({...l,id:i}),r)},...a)}function H(e,t){const{toInput:n,fromInput:r,controller:a,...i}=t,o=a.transform(n,r);return $(e,{...i,controller:o})}function ce(e,{id:t,labelFor:n,...r},...a){const i=t??r.controller.name??D("control");return P({...r,labelFor:n??i,content:H(e,{...r,id:i})},...a)}function ue(e){return e.split(".").map(n=>{const r=n.match(/^\[(\d+)\]$/);return r?Number(r[1]):n})}function R(e){return typeof e=="number"?`[${e}]`:`.${e}`}function K(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(R)].join("")}function T(e){return function(n){if(n.type==="valid")return n;let r=n.error;for(const a of e)if(r=r?.dependencies?.[a],r==null)return S.valid;return S.invalid(r)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,r,a,i,o=O){this.path=t,this.change=n,this.signal=r,this.status=a,this.#s=o,this.#t.set(r.value),this.error=a.map(l=>l?.type==="invalid"?l.error?.message:void 0),this.hasError=this.error.map(l=>l!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((l,c,p)=>p==="continuous"?!!l:!!l&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((l,c)=>!!l&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((l,c)=>!this.#s(l,c)),this.dependencyErrors=a.map(l=>l?.type==="invalid"?l.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((l,c)=>l||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((l,c)=>l||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return K(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new J(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,r=[],a=O)=>new V([...this.path,...r],i=>this.change(n(i)),this.signal.map(t,a),this.status.map(T(r)),this.parent,a);asyncTransform=(t,n,r,a=[],i=O)=>new V([...this.path,...a],o=>{n(o).then(l=>this.change(l))},this.signal.mapAsync(t,r,void 0,i),this.status.map(T(a)),this.parent,i)}class G extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){super(t,n,r.map(c=>c??{},o),a,i,o),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const l=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),l()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async o=>{this.change({...this.signal.value,[t]:o})},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,r);const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class J extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,r,a,i,o){const l=r.map(h=>h??[],o);super(t,n,l,a,i,o);const c=l.on(h=>{const m=this.#e.length-h.length;m>0&&(this.#e.splice(h.length,m).forEach((k,g)=>{const u=h.length+g;k.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#r.get(u)?.(),this.#r.delete(u),this.#a.delete(u)}),this.#o(),this.#i())});this.length=l.map(h=>h.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),l.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#r.values())h();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async o=>{const l=this.signal.value.slice();l[t]=o,this.change(l)},r=new V([...this.path,t],n,this.signal.map(o=>o[t]),this.status.map(T([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=r;const a=r.touched.on(o=>{this.#s.set(t,o),this.#o()});this.#t.set(t,a);const i=r.dirty.on(o=>{this.#a.set(t,o),this.#i()});return this.#r.set(t,i),r};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const r=this.signal.value.slice();r.splice(t,n),this.change(r)};move=(t,n,r=1)=>{if(r<1||t===n)return;const a=this.signal.value.slice(),i=a.splice(t,r);a.splice(n,0,...i),this.change(a)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function Q(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function X(e){const t=e.filter(a=>a.path==null||a.path.length===0).map(a=>a.message),n=e.filter(a=>a.path!=null&&a.path.length>0).reduce((a,i)=>{const o=Q(i.path),l=o.pop();let c=a;for(const p of o)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[l]={message:i.message},a},{}),r=t.join(`
2
+ `);return{...n,message:r!=""?r:void 0}}function Y({initialValue:e,onChange:t,validate:n,equals:r,validationMode:a,validateDebounceMs:i}){const o=s.Value.deriveProp(e),l=s.prop(S.valid),c=s.prop(!1),p=s.prop(a??"touchedOrSubmit"),h=d=>{l.set(d)};let m;const k=async d=>{if(n!=null){const b=await n(d);h(b)}},g=async d=>{o.set(d),t?.(d);const b=p.value;if(n!=null){if(b==="onSubmit")return;const I=i??0;I>0?(m&&clearTimeout(m),m=setTimeout(()=>{k(d)},I)):await k(d)}},u=new V([],g,o,l,{disabled:c,validationMode:p},r??O);return u.onDispose(()=>{c.dispose(),o.dispose(),l.dispose(),p.dispose(),m&&clearTimeout(m)}),{controller:u,setStatus:h}}function x(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function he(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function de(e,{triggerOn:t="change"}={}){return s.Fragment(x(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function B(e){return e.issues!=null?S.invalid(X(e.issues)):S.valid}async function pe({task:e,errorMessage:t,errorPath:n=["root"],validation:r}){try{const a=await e();return r!=null?r(a):S.valid}catch(a){const i=t??(a instanceof Error?a.message:"Operation failed");return n.length===1&&n[0]==="root"?S.invalid({message:i}):S.invalid({dependencies:Z(n,i)})}}function Z(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...r]=e;return{[n]:{dependencies:Z(r,t)}}}function me({initialValue:e={},schema:t,onSubmit:n=async()=>S.valid,validationMode:r,validateDebounceMs:a}){const{controller:i,setStatus:o}=Y({initialValue:e,validationMode:r??"touchedOrSubmit",validateDebounceMs:a,validate:(r??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async h=>B(await t["~standard"].validate(h))}),l=s.prop(!1),c=i.object();return c.onDispose(l.dispose),{controller:c,setStatus:o,submit:async h=>{if(l.set(!0),h?.preventDefault(),c.markAllTouched(),(r??"touchedOrSubmit")==="onSubmit"){const k=c.signal.value,g=t?.["~standard"].validate;if(g==null){l.set(!1);return}const u=B(await g(k));if(o(u),u.type==="invalid"){l.set(!1);return}}const m=await n(c.signal.value);l.set(!1),m.type==="invalid"&&o(m)},submitting:l}}function fe(e){switch(e){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function be(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function ge(e,t,n,r){const a=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&a.push("bc-notice--dismissible"),r&&r.length>0&&a.push(r),a.join(" ")}function ye({variant:e="info",tone:t="subtle",role:n,title:r,icon:a,closable:i=!1,onDismiss:o,class:l},...c){const p=s.prop(!0);return s.When(p,()=>{const h=s.Value.map(i,u=>!!u||o!=null),m=s.Value.map(e,u=>u??"info"),k=s.Value.map(t,u=>u??"subtle"),g=s.computedOf(n,m)((u,d)=>u??(d==="danger"?"alert":"status"));return s.Use(w.BeatUII18n,u=>s.html.div(s.attr.class(s.computedOf(m,k,h,l)((d,b,I,C)=>ge(d,b,I,C))),s.attr.role(s.Value.map(g,d=>d)),s.Unless(s.Value.map(a,d=>d===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),w.Icon({icon:s.computedOf(a,m)((d,b)=>d===void 0?fe(b):String(d)),size:"md",color:s.Value.map(m,be)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(r,d=>s.html.div(s.attr.class("bc-notice__title"),d)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(h,()=>j({size:"xs",label:u.$.closeModal,onClick:()=>{p.set(!1),o?.()}}))))})}exports.ArrayController=J;exports.BaseControl=$;exports.BaseMappedControl=H;exports.CheckboxInput=se;exports.CloseButton=j;exports.Control=oe;exports.Controller=V;exports.DangerLabel=te;exports.EmailInput=ie;exports.EmphasisLabel=ee;exports.InputWrapper=P;exports.Label=q;exports.MappedControl=ce;exports.MutedLabel=U;exports.Notice=ye;exports.O=O;exports.ObjectController=G;exports.PasswordInput=le;exports.RequiredSymbol=W;exports.Stack=ae;exports.a=S;exports.connectCommonAttributes=x;exports.connectNumberInput=de;exports.connectStringInput=he;exports.convertStandardSchemaIssues=X;exports.convertStandardSchemaPathToPath=Q;exports.makeMapValidation=T;exports.makeOnBlurHandler=z;exports.makeOnChangeHandler=M;exports.parsePath=ue;exports.pathToString=K;exports.sessionId=D;exports.standardSchemaResultToValidation=B;exports.taskToValidation=pe;exports.useController=Y;exports.useForm=me;exports.wrapSegment=R;