@golemui/core 1.0.0-rc.2 → 1.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("rxjs");require("@standard-schema/spec");function ht(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function pt(e){return e.issues===void 0}var Yt=class{constructor(e){this.value=e}map(e){return F(e(this.value))}isOk(){return!0}},Zt=class{constructor(e){this.error=e}map(e){return w(this.error)}isOk(){return!1}};function F(e){return new Yt(e)}function w(e){return new Zt(e)}var T=class Fe{constructor(t){this.decodeFn=t,this["~standard"]={version:1,vendor:"ts.data.json",validate:r=>{let n=this.decode(r);return n.isOk()?{value:n.value}:{issues:[{message:n.error}]}}},this.decodeToPromise=this.decodePromise,this.chain=this.flatMap}parse(t){let r=this.decode(t);if(r.isOk())return r.value;throw r.error}decode(t){return this.decodeFn(t)}decodePromise(t){return new Promise((r,n)=>{let i=this.decode(t);return i.isOk()?r(i.value):n(i.error)})}map(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?F(t(n.value)):w(n.error)})}flatMap(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?t(n.value).decode(r):w(n.error)})}},xt=(e,t,r)=>`<${e}> decoder failed at index "${t}" with error: ${r}`,q=(e,t)=>`${JSON.stringify(e)} is not a valid ${t}`;function Ne(e,t){return new T(r=>{if(r instanceof Array){let n=[];for(let i=0;i<r.length;i++){let o=e.decode(r[i]);if(o.isOk())n.push(o.value);else return w(xt(t,i,o.error))}return F(n)}else return w(q(r,"array"))})}function er(){return new T(e=>typeof e=="boolean"?F(e):w(q(e,"boolean")))}function gt(e){return new T(t=>e().decode(t))}var tr=(e,t)=>`${JSON.stringify(e)} is not exactly ${JSON.stringify(t)}`;function J(e){return new T(t=>t===e?F(e):w(tr(t,e)))}function $e(){return new T(e=>typeof e=="number"?F(e):w(q(e,"number")))}var rr=(e,t,r)=>`<${e}> decoder failed at key "${t}" with error: ${r}`;function re(e,t){return new T(r=>{if(r!==null&&typeof r=="object"){let n={};for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let o,s=e[i];if(s instanceof T?o=s.decode(r[i]):o=s.decoder.decode(r[s.fromKey]),o.isOk())n[i]=o.value;else return w(rr(t,i,o.error))}return F(n)}else return w(q(r,t))})}var nr=(e,t)=>`<${e}> decoder failed because ${JSON.stringify(t)} can't be decoded with any of the provided oneOf decoders`;function K(e,t){return new T(r=>{for(let n=0;n<e.length;n++){let i=e[n].decode(r);if(i.isOk())return i}return w(nr(t,r))})}function y(e){return new T(t=>t===void 0?F(void 0):e.decode(t))}var ir=(e,t,r)=>`<${e}> record decoder failed at key "${t}" with error: ${r}`;function or(e,t){return new T(r=>{if(r!==null&&typeof r=="object"){let n={};for(let i in r)if(Object.prototype.hasOwnProperty.call(r,i)){let o=e.decode(r[i]);if(o.isOk())n[i]=o.value;else return w(ir(t,i,o.error))}return F(n)}else return w(q(r,t))})}function C(){return new T(e=>typeof e=="string"?F(e):w(q(e,"string")))}function G(){return new T(e=>F(e))}function ne(e,t){return new T(r=>{if(typeof r!="object"||r===null)return w(`<${t}> failed. Expected object literal, got "${typeof r}"`);const n={};for(const[i,o]of Object.entries(e)){const s=o.decoder.decode(r[i]);if(!s.isOk())return w(`<${t}> failed at "${i}" with ${s.error}`);if(n[i]=s.value,o.suffixed){for(const[u,c]of Object.entries(r))if(u.startsWith(i+".")){const a=o.decoder.decode(c);if(!a.isOk())return w(`<${t}> failed at "${u}" with ${a.error}`);n[u]=a.value}}}return F(n)})}const Ve=()=>crypto.randomUUID().slice(0,8),sr=e=>typeof e!="function"&&e.kind==="display",x=e=>typeof e!="function"&&e.kind==="action",O=e=>typeof e!="function"&&e.kind==="input",We=e=>typeof e!="function"&&e.kind==="layout",ie=e=>typeof e=="function",dr=re({in:Ne(C(),"In[]")},"In"),Le=re({when:C()},"When"),Ae=K([dr,Le],"In | When"),ur=re({from:Ne(C(),"From[]")},"From"),Se=K([ur,Le],"Exclude"),ke=K([er(),Le],"Bool | When"),cr=new T(e=>{const t=typeof e;return t==="function"?F(e):w(`Expected a function, got '${t}'`)}),V=e=>K([e,cr],""),Re=ne({load:{suffixed:!0,decoder:V(y(C()))},click:{suffixed:!0,decoder:V(y(C()))},change:{suffixed:!0,decoder:V(y(C()))},filter:{suffixed:!0,decoder:V(y(C()))},blur:{suffixed:!0,decoder:V(y(C()))}},"On"),lr=re({key:C(),default:y(C()),params:y(G())},"TranslationConfig"),mt=K([C(),lr],"Localizable"),Me=y(C()).map(e=>e||Ve()),ar=ne({kind:{decoder:J("display")},uid:{decoder:Me},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},props:{decoder:y(G())}},"DisplayWidget"),fr=ne({kind:{decoder:J("action")},uid:{decoder:Me},type:{decoder:C()},actionType:{decoder:y(K([J("button"),J("submit")],"button | submit "))},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},label:{suffixed:!0,decoder:V(y(mt))},disabled:{suffixed:!0,decoder:y(ke)},on:{decoder:y(Re)},props:{decoder:y(G())}},"ActionWidget"),hr=new T(e=>{const t=typeof e;if(t==="function"){const r=e,n=r(void 0);return r.uid=n.uid||Ve(),r.type=n.type,r.path=n.path,F(r)}else return w(`Expected a function, got '${t}'`)}),pr=ne({kind:{decoder:J("input")},uid:{decoder:y(C())},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},disabled:{suffixed:!0,decoder:y(ke)},readonly:{suffixed:!0,decoder:y(ke)},on:{decoder:y(Re)},props:{decoder:y(G())},label:{suffixed:!0,decoder:V(y(mt))},path:{decoder:C()},defaultValue:{decoder:y(G())},validator:{suffixed:!0,decoder:V(y(G()))}},"InputWidget").map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;r.template=Be.parse(r.template)}return t}),gr=gt(()=>K([hr,pr,Be,ar,fr],"FormWidget")),Be=ne({kind:{decoder:J("layout")},uid:{decoder:Me},type:{decoder:C()},size:{suffixed:!0,decoder:y($e())},include:{decoder:y(Ae)},exclude:{decoder:y(Se)},props:{decoder:y(G())},on:{decoder:y(Re)},children:{decoder:Ne(gr,"FormWidget[]")}},"LayoutWidget"),B=class B{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!B.sharedCache.has(r)){const n=r().catch(i=>(B.sharedCache.delete(r),Promise.reject(i)));B.sharedCache.set(r,n)}return B.sharedCache.get(r)}};B.sharedCache=new Map;let Pe=B;function mr(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const yt=re({states:y(or(C(),"states")),form:gt(()=>Be)},"FormDef"),$t=e=>({formName:"",formDef:yt.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,lang:e}),yr=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function $r(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const At=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(i=>i(e))}}},Ar=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function P(e,...t){return t.reduce((r,n)=>n(r),e)}function Sr(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");const n=t.payload.widget,i=e.touched&&O(n)?{...e.touchedControls,[n.path]:!0}:e.touchedControls;return{...e,touchedControls:i,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:n,current:{}}}}}const Q={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},oe=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},He=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let i=e;for(let s=0;s<n.length-1;s++){const u=n[s],c=n[s+1];(i[u]==null||typeof i[u]!="object")&&(i[u]=Er(c)?[]:{}),i=i[u]}const o=n[n.length-1];return i[o]=r,e},vr=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let s=0;s<r.length-1;s++){const u=n[s];if(u==null||typeof u!="object")return e;const c=r[s],a=Array.isArray(u)?u[parseInt(c,10)]:u[c];if(a==null||typeof a!="object")return e;n.push(a)}const i=n[n.length-1],o=r[r.length-1];Array.isArray(i)?i.splice(parseInt(o,10),1):delete i[o];for(let s=n.length-1;s>=1;s--){const u=n[s];if(Array.isArray(u)||!Cr(u))break;const c=n[s-1],a=r[s-1];if(Array.isArray(c))break;delete c[a]}return e};function Er(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Cr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const ve=(e,t)=>(delete e[t],e);function ae(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>ae(r));const t={};for(const r of Object.keys(e))t[r]=ae(e[r]);return t}function Ge(e){return e.flatMap(t=>[t,...We(t)?Ge(t.children):[]])}function Ke(e){return Object.entries(e.validations).reduce((r,[n,i])=>(i!==null&&(r.$formIsInvalid=!0,He(r.$errors,n,[...i])),r),{$formIsInvalid:!1,$errors:{}})}function we(e){const t=ae(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const i=e.flatForm[r];i&&O(i)&&vr(t,i.path)}return t}const Xe=32;let je,p,g,$=e=>(p=0,g=e,$.newline=!1,e=v(),g[p]?X():e||""),X=(e="Unexpected token",t=p,r=g.slice(0,t).split(`
2
- `),n=r.pop(),i=g.slice(Math.max(0,t-40),t),o="̭",s=(g[t]||" ")+o,u=g.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
- ${g[t-41]!==`
4
- `,""+i}${s}${u}`)},St=(e,t=p)=>(Array.isArray(e)&&(e.loc=t),e),b=(e,t=p,r)=>{for(;r=e(g.charCodeAt(p));)p+=r;return g.slice(t,p)},I=(e=1)=>g[p+=e],_e=e=>p=e,v=(e=0,t)=>{let r,n,i,o,s;for(t&&$.asi&&($.newline=!1);(r=$.space())&&(s=$.newline,1)&&r!==t&&(i=(n&&r===91&&je&&$.asi?.(n,e,v)||null)??((o=k[r])&&o(n,e))??(n&&s&&$.asi?.(n,e,v))??(!n&&b($.id)));)n=i;return t&&(r==t?(p++,t===125&&$.asi&&($.newline=!0)):X("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},R=(e,t=p)=>{for(je=!1;(e=g.charCodeAt(p))<=Xe;)$.asi&&e===10&&($.newline=je=!0),p++;return e},wr=(e=p)=>{for(;g.charCodeAt(e)<=Xe;)e++;return g.charCodeAt(e)};$.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Ir=(e,t=e.length)=>g.substr(p,t)===e&&!$.id(g.charCodeAt(p+t)),k=[],st={},W=(e,t=Xe,r,n=e.charCodeAt(0),i=e.length,o=k[n],s=e.toUpperCase()!==e,u,c)=>(t=st[e]=!o&&st[e]||t,k[n]=(a,S,m,h=p)=>(u=m,(m?e==m:(i<2||e.charCodeAt(1)===g.charCodeAt(p+1)&&(i<3||g.substr(p,i)==e))&&(!s||!$.id(g.charCodeAt(p+i)))&&(u=m=e))&&S<t&&(p+=i,(c=r(a))?St(c,h):(p=h,u=0,!s&&!o&&!a&&X()),c)||o?.(a,S,u))),A=(e,t,r=!1)=>W(e,t,n=>n&&(i=>i&&[e,n,i])(v(t-(r?.5:0)))),M=(e,t,r)=>W(e,t,n=>!n&&(n=v(t-.5))&&[e,n]),se=(e,t)=>W(e,200,r=>!r&&[,t]),vt=(e,t,r)=>W(e,t,(n,i)=>(i=v(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),i?.[0]===e?n.push(...i.slice(1)):n.push(i||null),n)),ze=(e,t)=>W(e[0],t,r=>!r&&[e,v(0,e.charCodeAt(1))||null]),Et=(e,t)=>W(e[0],t,r=>r&&[e,r,v(0,e.charCodeAt(1))||null]),de=(e,t,r,n=e.charCodeAt(0),i=e.length,o=k[n],s)=>k[n]=(u,c,a,S=p)=>!u&&(a?e==a:(i<2||g.substr(p,i)==e)&&(a=e))&&c<t&&!$.id(g.charCodeAt(p+i))&&(!$.prop||$.prop(p+i))&&(_e(p+i),(s=r())?St(s,S):_e(S),s)||o?.(u,c,a);Object.defineProperty($,"space",{configurable:!0,enumerable:!0,get:()=>R,set:e=>R=e});const Ue={},l=(e,t,r=Ue[e])=>Ue[e]=(...n)=>t(...n)||r?.(...n),d=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):Ue[e[0]]?.(...e.slice(1))??X(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],fe=46,ee=48,he=57,Or=69,Dr=101,Tr=43,Fr=45,le=95,Ct=110,Wr=97,kr=102,Pr=65,jr=70,wt=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),Je=e=>{let t=wt(b(r=>r===fe&&g.charCodeAt(p+1)!==fe||r>=ee&&r<=he||r===le||((r===Or||r===Dr)&&((r=g.charCodeAt(p+1))>=ee&&r<=he||r===Tr||r===Fr)?2:0)));return g.charCodeAt(p)===Ct?(I(),[,BigInt(t)]):(e=+t)!=e?X():[,e]},_r={2:e=>e===48||e===49||e===le,8:e=>e>=48&&e<=55||e===le,16:e=>e>=ee&&e<=he||e>=Wr&&e<=kr||e>=Pr&&e<=jr||e===le};$.number=null;k[fe]=e=>!e&&g.charCodeAt(p+1)!==fe&&Je();for(let e=ee;e<=he;e++)k[e]=t=>t?void 0:Je();k[ee]=e=>{if(e)return;const t=$.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&g[p+1]?.toLowerCase()===r[1]){I(2);const i=wt(b(_r[n]));return g.charCodeAt(p)===Ct?(I(),[,BigInt("0"+r[1]+i)]):[,parseInt(i,n)]}}return Je()};const Ur=92,dt=34,ut=39,Nr={n:`
5
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},It=e=>(t,r,n="")=>{if(!(t||!$.string?.[String.fromCharCode(e)]))return I(),b(i=>i-e&&(i===Ur?(n+=Nr[g[p+1]]||g[p+1],2):(n+=g[p],1))),g[p]===String.fromCharCode(e)?I():X("Bad string"),[,n]};k[dt]=It(dt);k[ut]=It(ut);$.string={'"':!0};const Vr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>A(e,Vr,!0));const Ot=(e,t,r,n)=>typeof e=="string"?i=>t(i,e,i):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n,i)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i),i)):e[0]==="()"&&e.length===2?Ot(e[1],t):(()=>{throw Error("Invalid assignment target")})(),ct={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in ct)l(e,(t,r)=>(r=d(r),Ot(t,(n,i,o)=>ct[e](n,i,r(o)))));const Lr=30,Rr=40,Mr=140;M("!",Mr);A("||",Lr);A("&&",Rr);l("!",e=>(e=d(e),t=>!e(t)));l("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));l("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Br=50,Hr=60,Gr=70,Dt=100,Kr=140;A("|",Br);A("&",Gr);A("^",Hr);A(">>",Dt);A("<<",Dt);M("~",Kr);l("~",e=>(e=d(e),t=>~e(t)));l("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));l("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));l("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));l(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));l("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const Ee=90;A("<",Ee);A(">",Ee);A("<=",Ee);A(">=",Ee);l(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));l("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));l(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));l("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Tt=80;A("==",Tt);A("!=",Tt);l("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));l("!=",(e,t)=>(e=d(e),t=d(t),r=>e(r)!=t(r)));const Ft=110,Qe=120,Wt=140;A("+",Ft);A("-",Ft);A("*",Qe);A("/",Qe);A("%",Qe);M("+",Wt);M("-",Wt);l("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));l("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));l("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));l("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));l("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const pe=150;W("++",pe,e=>e?["++",e,null]:["++",v(pe-1)]);W("--",pe,e=>e?["--",e,null]:["--",v(pe-1)]);const qe=(e,t,r,n)=>typeof e=="string"?i=>t(i,e):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i))):e[0]==="()"&&e.length===2?qe(e[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(e,t)=>qe(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));l("--",(e,t)=>qe(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Xr=5,zr=10;vt(",",zr);vt(";",Xr,!0);const kt=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});l(",",kt);l(";",kt);const Jr=170;ze("()",Jr);const L=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",be=170;Et("[]",be);A(".",be);Et("()",be);const ge=e=>{throw Error(e)};l("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=d(r[1]),n=>r(n)):(r=d(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&ge("Missing index"),e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)[n]}));l(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],L(t)?()=>{}:r=>e(r)[t]));l("()",(e,t)=>{if(t===void 0)return e==null?ge("Empty ()"):d(e);const r=i=>i?.[0]===","&&i.slice(1).some(o=>o==null||r(o));r(t)&&ge("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),i=>t.map(o=>o(i))):(t=d(t),i=>[t(i)]):()=>[];return Ye(e,(i,o,s)=>i[o](...n(s)))});const z=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&z(e[1])||e[0]==="{}"),Ye=(e,t,r,n)=>e==null?ge("Empty ()"):e[0]==="()"&&e.length==2?Ye(e[1],t):typeof e=="string"?i=>t(i,e,i):e[0]==="."?(r=d(e[1]),n=e[2],i=>t(r(i),n,i)):e[0]==="?."?(r=d(e[1]),n=e[2],i=>{const o=r(i);return o==null?void 0:t(o,n,i)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),i=>t(r(i),n(i),i)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),i=>{const o=r(i);return o==null?void 0:t(o,n(i),i)}):(e=d(e),i=>t([e(i)],0,i)),Y=Ye,Qr=32,qr=$.space;$.comment??={"//":`
6
- `,"/*":"*/"};let Ie;$.space=()=>{Ie||(Ie=Object.entries($.comment).map(([i,o])=>[i,o,i.charCodeAt(0)]));for(var e;e=qr();){for(var t=0,r;r=Ie[t++];)if(e===r[2]&&g.substr(p,r[0].length)===r[0]){var n=p+r[0].length;if(r[1]===`
7
- `)for(;g.charCodeAt(n)>=Qr;)n++;else{for(;g[n]&&g.substr(n,r[1].length)!==r[1];)n++;g[n]&&(n+=r[1].length)}_e(n),e=0;break}if(e)return e}return e};const Pt=80;A("===",Pt);A("!==",Pt);l("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));l("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const br=30;A("??",br);l("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const Yr=130,Zr=20;A("**",Yr,!0);A("**=",Zr,!0);l("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const xr=e=>{throw Error(e)};l("**=",(e,t)=>(z(e)||xr("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]**=t(i))));const jt=90;A("in",jt);A("of",jt);l("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const en=20,tn=100,rn=e=>{throw Error(e)};A(">>>",tn);A(">>>=",en,!0);l(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));l(">>>=",(e,t)=>(z(e)||rn("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]>>>=t(i))));const Ze=5,nn=10,on=20,sn=e=>e[0]?.[0]===","?e[0].slice(1):e,me=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...i]=e,o=sn(i);if(n==="{}"){const s=[];for(const u of o){if(Array.isArray(u)&&u[0]==="..."){const h={};for(const D in t)s.includes(D)||(h[D]=t[D]);r[u[1]]=h;break}let c,a,S;typeof u=="string"?c=a=u:u[0]==="="?(typeof u[1]=="string"?c=a=u[1]:[,c,a]=u[1],S=u[2]):[,c,a]=u,s.push(c);let m=t[c];m===void 0&&S&&(m=d(S)(r)),me(a,m,r)}}else if(n==="[]"){let s=0;for(const u of o){if(u===null){s++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(s);break}let c=u,a;Array.isArray(u)&&u[0]==="="&&([,c,a]=u);let S=t[s++];S===void 0&&a&&(S=d(a)(r)),me(c,S,r)}}},_t=e=>{let t=v(nn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};de("let",Ze+1,()=>_t("let"));de("const",Ze+1,()=>_t("const"));de("var",Ze,()=>(R(),["var",v(on)]));const Ut=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,i=d(n);return typeof r=="string"?o=>{o[r]=i(o)}:o=>me(r,i(o),o)}return d(t)}),t=>{for(const r of e)r(t)});l("let",Ut);l("const",Ut);l("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const xe=20,Ce=e=>{throw Error(e)};A("||=",xe,!0);A("&&=",xe,!0);A("??=",xe,!0);l("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=d(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>me(r,t(n),n)}return z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]=t(i))});l("||=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]||=t(i))));l("&&=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]&&=t(i))));l("??=",(e,t)=>(z(e)||Ce("Invalid assignment target"),t=d(t),Y(e,(r,n,i)=>r[n]??=t(i))));se("true",!0);se("false",!1);se("null",null);de("undefined",200,()=>[]);se("NaN",NaN);se("Infinity",1/0);const Oe=20;W("?",Oe,(e,t,r)=>e&&(t=v(Oe-1))&&b(n=>n===58)&&(r=v(Oe-1),["?",e,t,r]));l("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const dn=[],un=20;A("=>",un,!0);l("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,i=null;const o=r[r.length-1];Array.isArray(o)&&o[0]==="..."&&(n=r.length-1,i=o[1],r.length--);const s=t?.[0]==="{}";return t=d(s?["{",t[1]]:t),u=>(...c)=>{const a={};r.forEach((m,h)=>a[m]=c[h]),i&&(a[i]=c.slice(n));const S=new Proxy(a,{get:(m,h)=>h in m?m[h]:u?.[h],set:(m,h,D)=>((h in m?m:u)[h]=D,!0),has:(m,h)=>h in m||(u?h in u:!1)});try{const m=t(S);return s?void 0:m}catch(m){if(m===dn)return m[0];throw m}}});const cn=140;M("...",cn);l("...",e=>(e=d(e),t=>Object.entries(e(t))));const lt=170;W("?.",lt,(e,t)=>{if(!e)return;const r=R();return r===40?(I(),["?.()",e,v(0,41)||null]):r===91?(I(),["?.[]",e,v(0,93)]):(t=v(lt),t?["?.",e,t]:void 0)});l("?.",(e,t)=>(e=d(e),L(t)?()=>{}:r=>e(r)?.[t]));l("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)?.[n]}));l("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),i=>t.map(o=>o(i))):(t=d(t),i=>[t(i)]):()=>[];if(e[0]==="?."){const i=d(e[1]),o=e[2];return L(o)?()=>{}:s=>i(s)?.[o]?.(...r(s))}if(e[0]==="?.[]"){const i=d(e[1]),o=d(e[2]);return s=>{const u=i(s),c=o(s);return L(c)?void 0:u?.[c]?.(...r(s))}}if(e[0]==="."){const i=d(e[1]),o=e[2];return L(o)?()=>{}:s=>i(s)?.[o]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const i=d(e[1]),o=d(e[2]);return s=>{const u=i(s),c=o(s);return L(c)?void 0:u?.[c]?.(...r(s))}}const n=d(e);return i=>n(i)?.(...r(i))});const te=140;M("typeof",te);M("void",te);M("delete",te);de("new",te,()=>Ir(".target")?(I(7),["new.target"]):["new",v(te)]);l("typeof",e=>(e=d(e),t=>typeof e(t)));l("void",e=>(e=d(e),t=>(e(t),void 0)));l("delete",e=>{if(e[0]==="."){const t=d(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=d(e[1]),r=d(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});l("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(i=>o=>i.map(s=>s(o)))(r.slice(1).map(d)):(i=>o=>[i(o)])(d(r)):()=>[];return i=>new(t(i))(...n(i))});const et=Symbol("accessor"),tt=20,ln=40,Nt=41,Vt=123,Lt=125,Rt=e=>t=>{if(t)return;R();const r=b($.id);if(!r||(R(),g.charCodeAt(p)!==ln))return!1;I();const n=v(0,Nt);return R(),g.charCodeAt(p)!==Vt?!1:(I(),[e,r,n,v(0,Lt)])};W("get",tt-1,Rt("get"));W("set",tt-1,Rt("set"));W("(",tt-1,e=>{if(!e||typeof e!="string")return;const t=v(0,Nt)||null;if(R(),g.charCodeAt(p)===Vt)return I(),[":",e,["=>",["()",t],v(0,Lt)||null]]});l("get",(e,t)=>(t=t?d(t):()=>{},r=>[[et,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));l("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[et,e,{set:function(i){const o=Object.create(n||{});o.this=this,o[t]=i,r(o)}}]]));const an=20,Mt=200;$.prop=e=>wr(e)!==58;const fn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);ze("[]",Mt);ze("{}",Mt);A(":",an-1,!0);l("{}",(e,t)=>{if(t!==void 0)return;if(!fn(e))return d(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>d(typeof n=="string"?[":",n,n]:n));return n=>{const i={},o={};for(const s of r.flatMap(u=>u(n)))if(s[0]===et){const[,u,c]=s;o[u]={...o[u],...c,configurable:!0,enumerable:!0}}else i[s[0]]=s[1];for(const s in o)Object.defineProperty(i,s,o[s]);return i}});l("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));l(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const hn=170,ye=96,pn=36,gn=123,mn=92,yn={n:`
8
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},at=()=>{const e=[];for(let t="",r;(r=g.charCodeAt(p))!==ye;)r?r===mn?(I(),t+=yn[g[p]]||g[p],I()):r===pn&&g.charCodeAt(p+1)===gn?(t&&e.push([,t]),t="",I(2),e.push(v(0,125))):(t+=g[p],I(),r=g.charCodeAt(p),r===ye&&t&&e.push([,t])):X("Unterminated template");return I(),e},$n=k[ye];k[ye]=(e,t)=>e&&t<hn?$.asi&&$.newline?void 0:(I(),["``",e,...at()]):e?$n?.(e,t):(I(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(at()));l("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));l("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const o of t)Array.isArray(o)&&o[0]===void 0?r.push(o[1]):n.push(d(o));const i=Object.assign([...r],{raw:r});return o=>e(o)(i,...n.map(s=>s(o)))});$.string["'"]=!0;$.number={"0x":16,"0b":2,"0o":8};const An={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function _(e,t,r,n,i){const o=$(rt(e));return d(o)({$form:t,$meta:r,$errors:n,$formIsInvalid:i,$log:An.log})===!0}function rt(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const U=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Ke(e);t=Sn(t);let i=[],o={status:"ok"};try{i=Object.keys(t).map(s=>{const u=t[s];let c;try{c=_(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?s:void 0}).filter(s=>s!==void 0)}catch(s){const u=s,c=Q.calculateCurrentStateError;o={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:i,formHealth:o}};function Sn(e){const t={};function r(n){const i=n.split(":"),o=[];for(let s=0;s<i.length;s++)o.push(i.slice(0,s+1).join(":"));return o}for(const[n,i]of Object.entries(e)){const o=r(n),s=[];for(const u of o)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const nt=Symbol("filterMap.skip");function Bt(e,t){const r=[];for(let n=0;n<e.length;n++){const i=t(e[n],n,e);i!==nt&&r.push(i)}return r}function vn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function En(e,t,r,n){let i=n;for(let o=0;o<e.length;o++)t(e[o],o,e)&&(i=r(i,e[o],o,e));return i}function Cn(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function Ht(e,t){const r=Gt(e.uid,t);return O(e)?{...e,uid:r,path:wn(e.path,t)}:{...e,uid:r}}function Gt(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,i)=>`${n}[${i}]`,"");return`${e}${r}`}function wn(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),i=n.length-1;if(i!==t.length)throw new Error(`Path contains ${i} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((o,s,u)=>u===0?s:`${o}.${t[u-1]}${s}`)}function ue(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,i)=>{const o=t[r++];return o===void 0?n:`.${o}${i}.`})}const ce=(e,t)=>r=>e(r)?t(r):r,H=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,N=e=>{const{$formIsInvalid:t,$errors:r}=Ke(e);return{...e,widgetFlags:{...In(e,r,t),...On(e,r,t)}}};function In(e,t,r){return Bt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return nt;if(ie(n)){const i=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return i.uid=n.uid,i}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(O(n)||x(n))&&H(n.disabled)||O(n)&&H(n.readonly))).reduce((n,i)=>(n[i.uid]=n[i.uid]||{},i.include&&"in"in i.include?n[i.uid].hidden=!i.include.in.some(o=>e.currentStates.includes(o)):i.include&&"when"in i.include&&(n[i.uid].hidden=!_(i.include.when,e.data,e.meta,t,r)),i.exclude&&"from"in i.exclude?n[i.uid].hidden=i.exclude.from.some(o=>e.currentStates.includes(o)):i.exclude&&"when"in i.exclude&&(n[i.uid].hidden=_(i.exclude.when,e.data,e.meta,t,r)),(O(i)||x(i))&&H(i.disabled)&&(n[i.uid].disabled=_(i.disabled.when,e.data,e.meta,t,r)),O(i)&&H(i.readonly)&&(n[i.uid].readonly=_(i.readonly.when,e.data,e.meta,t,r)),n),{})}function On(e,t,r){return En(Object.values(e.flatForm),n=>!ie(n)&&n.type==="repeater",(n,i)=>({...n,...Kt(e,i,[],t,r)}),{})}function Kt(e,t,r,n,i){const o=t.props.template,s=oe(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,a)=>{const S=[...r,a];Ge([o]).forEach(m=>{let h;if(ie(m)?(h=m({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),h.uid=m.uid):h=m,h.type==="repeater"){const Z=Ht(h,S);Object.assign(u,Kt(e,Z,S,n,i));return}const D=Gt(h.uid,S);u[D]=u[D]||{},h.include&&"in"in h.include?u[D].hidden=!h.include.in.some(Z=>e.currentStates.includes(Z)):h.include&&"when"in h.include&&(u[D].hidden=!_(ue(h.include.when,S),e.data,e.meta,n,i)),h.exclude&&"from"in h.exclude?u[D].hidden=h.exclude.from.some(Z=>e.currentStates.includes(Z)):h.exclude&&"when"in h.exclude&&(u[D].hidden=_(ue(h.exclude.when,S),e.data,e.meta,n,i)),(O(h)||x(h))&&H(h.disabled)&&(u[D].disabled=_(ue(h.disabled.when,S),e.data,e.meta,n,i)),O(h)&&H(h.readonly)&&(u[D].readonly=_(ue(h.readonly.when,S),e.data,e.meta,n,i))})}),u}const j=e=>t=>{try{return{...t,calculatedWidgets:Dn(t,e)}}catch(r){const n=r;return{...t,formHealth:{status:"errored",message:`[${n.code}] ${n.message}`,code:n.code}}}};function Dn(e,t){const{$formIsInvalid:r,$errors:n}=Ke(e),i=zn(e,t,r,n),o={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(ie(c)){o[s]=Tn(s,c,e,t);continue}o[s]=Fn(u,c,e,i)}return o}function Tn(e,t,r,n){const i=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return i.uid=e,{source:t,current:i}}function Fn(e,t,r,n){const i=new Xn(t,e.current);return i.write("uid",t.uid),i.write("type",t.type),i.write("kind",t.kind),sr(t)?Wn(i,n):x(t)?kn(i,n):O(t)?Pn(i,n):We(t)&&jn(i,n),_n(t,i,n,r),(x(t)||O(t))&&Un(t,i,n),We(t)&&Nn(t,i,r),i.changed?{source:e.source,current:i.current}:e}function Wn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function kn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Pn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function jn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function _n(e,t,r,n){const i=n.widgetPropOverrides[e.uid]??{},o={...e.props??{},...i};for(const s of Jt(Object.keys(o)))Vn(t,r,s)}function Un(e,t,r){const n=e.on??{};for(const i of Jt(Object.keys(n)))Ln(t,r,i)}function Nn(e,t,r){const n=qn(e.uid),i=Qn(e.children,n,r.widgetFlags);t.current.children=i;const o=t.previous.children??[];o.length===i.length&&i.every((u,c)=>o[c]&&o[c].uid===i[c].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!Jn(n,r))return;const i=ot(n,r,t.sortedStates);let o;switch(r){case"disabled":case"readonly":o=Bn(i,t,e.source.uid,r);break;case"defaultValue":o=i;break;default:o=zt(i,t)}e.write(r,o)}function Vn(e,t,r){const n=e.source.props,i=ot(n,r,t.sortedStates);let o=zt(i,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(o=s),e.write(`props.${r}`,o)}function Ln(e,t,r){const n=e.source.on,i=ot(n,r,t.sortedStates);e.write(`on.${r}`,Hn(i,t))}function it(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Rn(e,t){return t.localization.translate(e.key,Kn(e.params,t),e.default)}const Mn=/\{\{([^}]+)\}\}/g;function Xt(e,t){return e.includes("{{")?e.replace(Mn,(r,n)=>{const i=rt(n.trim());try{const o=d($(i))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});return o==null?"":String(o)}catch(o){const s=o instanceof Error?o.message:String(o);throw new Qt(`Failed to evaluate '{{${n.trim()}}}': ${s}`)}}):e}function zt(e,t){return typeof e=="function"?it(e,t):yr(e)?Rn(e,t):typeof e=="string"?Xt(e,t):e}function Bn(e,t,r,n){return typeof e=="function"?it(e,t):H(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Xt(e,t):e}function Hn(e,t){return typeof e=="function"?it(e,t):e}function ot(e,t,r){if(e){for(const n of r){const i=e[`${t}.${n}`];if(i!==void 0)return i}return e[t]}}function Gn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e==="$formIsInvalid"}function Kn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const i=String(e[n]);if(Gn(i))try{const o=d($(rt(i)))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});r[n]=o??i}catch(o){const s=o instanceof Error?o.message:String(o);throw new Qt(`Failed to evaluate i18n param '${i}': ${s}`)}else r[n]=i;return r},{})}class Xn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){He(this.current,t,r),oe(this.previous,t)!==r&&(this._changed=!0)}}function zn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((i,o)=>o.length-i.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function Jn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function Jt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function Qn(e,t,r){const n=t.map(i=>`[${i}]`).join("");return e.filter(i=>{const o=i.uid+n,s=r[o];return!s||s.hidden!==!0})}const qn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10));class Qt extends Error{constructor(){super(...arguments),this.code=Q.resolveStringInterpolationError,this.name="StringInterpolationError"}}const bn=({lang:e},t)=>{const r={...$t(e),formName:t.payload.formName};let n=t.payload.formDef,i={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(u){const c=u,a=Q.initializeParseError;i={status:"errored",message:`[${a}] ${c.message}`,code:a}}if(i.status==="errored")return{...r,formHealth:i}}if(Array.isArray(n.form)){const u=n,c=u.form;u.form={uid:"",type:"flex",kind:"layout",children:c}}const o=yt.decode(n);if(o.isOk()){i={status:"ok"};let u={};try{u=Ge([o.value.form]).reduce((c,a)=>{const S=a.uid;if(c[S])throw{existingWidget:c[S],newWidget:a};return c[S]=a,c},{})}catch(c){const a=Q.initializeUidCollisionError;i={status:"errored",message:`[${a}] ${Yn(c.existingWidget,c.newWidget)}`,code:a},u={}}return{...r,formDef:o.value,flatForm:u,formHealth:i}}const s=Q.initializeUnknownError;return{...r,formHealth:{status:"errored",message:`[${s}] ${o.error}`,code:s}}};function Yn(e,t){const r=n=>O(n)?` at "${n.path}"`:"";return`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`}function Zn(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const xn=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:o})=>O(o)&&o.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=r.source.uid,i=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...i,[t.prop]:t.value}}}};function ei(e,t){return P(e,ti(t),ri(t),ni(t),ii(t))}const ti=e=>t=>({...t,widgetFlags:{...ve(t.widgetFlags,e.payload.uid)}}),ri=e=>t=>({...t,calculatedWidgets:{...ve(t.calculatedWidgets,e.payload.uid)}}),ni=e=>t=>({...t,widgetPropOverrides:{...ve(t.widgetPropOverrides,e.payload.uid)}}),ii=e=>t=>({...t,touchedControls:P(t.touchedControls,r=>{const n=t.flatForm[e.payload.uid];return n&&O(n)?ve(r,n.path):r})}),oi=(e,t)=>({...e,data:{...t.payload.data}}),si=(e,t)=>({...e,formHealth:t.payload.formHealth}),di=(e,t)=>({...e,lang:t.payload.lang}),ui=(e,t)=>({...e,meta:{...t.payload.meta}}),ci=(e,t)=>{const r=oe(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...He(e.data,t.payload.path,t.payload.data)}}:e},De=(e,t)=>r=>{const n=Bt(Object.values(r.calculatedWidgets),({current:o})=>O(o)?o:nt),i=r.validations;return{...r,validations:n.reduce((o,s)=>{if(o[s.path]=null,s.validator){const u=e(s.validator,t),c=oe(r.data,s.path),a=ht(u,c);o[s.path]=pt(a)?null:a.issues.map(S=>S.message)}return Array.isArray(o[s.path])&&Array.isArray(i[s.path])&&Cn(o[s.path],i[s.path],(u,c)=>u===c)&&(o[s.path]=i[s.path]),o},{})}},li=({validators:e,validateOn:t,localization:r})=>(n,i)=>{switch(i.type){case"INITIALIZE":return bn(n,i);case"SET_DATA":return P(oi(n,i),U,N,j(r));case"SET_META":return P(ui(n,i),U,N,j(r));case"SET_LANGUAGE":return P(di(n,i),j(r));case"ADD_WIDGET":return P(Sr(n,i),ce(Te,U),ce(Te,N),ce(Te,j(r)));case"REMOVE_WIDGET":return P(ei(n,i),U,N,j(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return P(ci(n,i),U,N,j(r));case"OVERRIDE_WIDGET_PROP":return P(xn(n,i),U,N,j(r),ce(o=>{let s=!1,u="";"path"in i.payload?(s=!0,u=i.payload.path):O(o.calculatedWidgets[i.payload.uid].current)&&(s=!0,u=o.calculatedWidgets[i.payload.uid].current.path);const c=s&&o.touchedControls[u];return o.touched&&c},De(e,r)));case"SET_FORM_HEALTH":return si(n,i);case"VALIDATE_ALL":return P({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((o,s)=>{const u=n.calculatedWidgets[s].source;return O(u)&&(o[u.path]=!0),o},{})},De(e,r),U,N,j(r),ft);case"ATTEMPT_VALIDATION":{const o=i.payload.reason,s=i.payload.path;return t==="eager"||o===t||t.includes(o)?P({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},De(e,r),U,N,j(r),c=>{const a=i.payload.uid,S=c.calculatedWidgets[a],m=S.source;if(ie(m)){const h=m({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[a]:{source:S.source,current:h}}}}return c},ft):n}case"INJECT_VALIDATION_ISSUES":return Zn(n,i);default:return Ar(i)}},Te=e=>e.formHealth.status==="ok";function ft(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(i=>e.injectedValidations[i]!==null&&Array.isArray(e.injectedValidations[i]));return n!==void 0?{...e,isFormValid:!1}:(n=r.find(i=>e.validations[i]!==null&&Array.isArray(e.validations[i])),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function ai(e=[],t,r,n){const i=new f.BehaviorSubject($t(n.lang)),o=i.asObservable().pipe(f.distinctUntilChanged()),s=li({validators:t,validateOn:r,localization:n});function u(m){const h=i.getValue(),D=s(h,m);i.next(D)}let c=u;const a={getState:()=>i.getValue(),dispatch:m=>c(m)};return c=e.map(m=>m(a)).reduceRight((m,h)=>h(m),u),{state$:o,dispatch:c,getState:()=>i.getValue()}}class fi{constructor(){this.widgetRegistry=new Pe,this.store={},this.events$=new f.Subject,this.submit$=new f.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,i,o,s=At(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=o,this.store=ai(r,n,i,s)}emitEvent(t,r,n){const o=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(o.length>0)o.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,r),u&&this.events$.next({name:u,data:we(this.store.getState()),detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const s=r.on?.[t];this.attemptValidation(t,r),s&&this.events$.next({name:s,data:we(this.store.getState()),detail:n,callback:u=>{this.store.dispatch(u)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:we(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function hi(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),i=>o=>{i(o),n&&n.send(o,t.getState())}}}const pi=f.pipe(f.map(e=>e.data),f.distinctUntilChanged()),gi=e=>f.pipe(pi,f.map(t=>oe(t,e)),f.distinctUntilChanged()),mi=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.validations),f.distinctUntilChanged()),yi=e=>f.pipe(mi,f.map(t=>t[e]),f.distinctUntilChanged()),$i=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.injectedValidations),f.distinctUntilChanged()),Ai=e=>f.pipe($i,f.map(t=>t[e]),f.distinctUntilChanged(),f.startWith(null)),Si=f.pipe(f.map(e=>e.lang),f.distinctUntilChanged()),qt=f.pipe(f.map(e=>e.calculatedWidgets),f.distinctUntilChanged()),vi=e=>t=>f.combineLatest([t.pipe(Si),t.pipe(qt)]).pipe(f.map(([r,n])=>({lang:r,widget:n[e]})),f.filter(r=>r.widget!==void 0),f.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),f.map(r=>r.widget.current)),Ei=e=>f.pipe(qt,f.map(t=>t[e]),f.filter(t=>t!==void 0),f.map(t=>t.current.children),f.distinctUntilChanged());f.pipe(f.map(e=>e.widgetFlags),f.distinctUntilChanged());const Ci=f.pipe(f.map(e=>e.touchedControls),f.distinctUntilChanged()),wi=e=>f.pipe(Ci,f.map(t=>t[e]),f.distinctUntilChanged()),Ii=f.pipe(f.map(e=>e.formHealth),f.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),Oi=e=>e.pipe(Ii);let bt=!1;function Di(){bt=!0}function Ti(){return bt}function Fi(e,t,r){if(!Ti())return;const n=Object.keys(t??{}).filter(i=>i in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.FormContext=fi;exports.assertNoPropCollisions=Fi;exports.calculatedLayoutChildrenByUid$=Ei;exports.calculatedWidgetsByUid$=vi;exports.cloneObject=ae;exports.dataByPath$=gi;exports.defineForm=mr;exports.devToolsMiddleware=hi;exports.enableDevMode=Di;exports.errorCodes=Q;exports.filterTap=vn;exports.formHealth=Oi;exports.getDirectionFromLanguage=$r;exports.identityTranslator=At;exports.injectedValidationByPath$=Ai;exports.isStandardValidateSuccess=pt;exports.makeRepeaterItemConfig=Ht;exports.shortUUID=Ve;exports.standardValidate=ht;exports.touchedControlsByPath$=wi;exports.validationByPath$=yi;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("rxjs");require("@standard-schema/spec");function gt(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function mt(e){return e.issues===void 0}var tr=class{value;constructor(e){this.value=e}map(e){return k(e(this.value))}isOk(){return!0}},rr=class yt{issues;constructor(t){this.issues=t}map(t){return new yt(this.issues)}isOk(){return!1}};function k(e){return new tr(e)}function C(e){return new rr(e)}function At(e){return e.reduce((t,r)=>typeof r=="number"?`${t}[${r}]`:t.length===0?String(r):`${t}.${r}`,"")}function dt(e){return e.map(t=>t.path.length===0?t.message:`${At(t.path)}: ${t.message}`).join("; ")}var D=class ke{decodeFn;constructor(t){this.decodeFn=t}parse(t){let r=this.decode(t);if(r.isOk())return r.value;{let n=r;throw Error(dt(n.issues),{cause:n.issues})}}decode(t){return this.decodeFn(t)}"~standard"={version:1,vendor:"ts.data.json",validate:t=>{let r=this.decode(t);return r.isOk()?{value:r.value}:{issues:r.issues.map(n=>({message:n.message,path:n.path.length>0?n.path.map(s=>({key:s})):void 0}))}}};decodePromise(t){return new Promise((r,n)=>{let s=this.decode(t);if(s.isOk())return r(s.value);{let i=s;return n(Error(dt(i.issues),{cause:i.issues}))}})}map(t){return new ke(r=>{let n=this.decodeFn(r);return n.isOk()?k(t(n.value)):C(n.issues)})}flatMap(t){return new ke(r=>{let n=this.decodeFn(r);return n.isOk()?t(n.value).decode(r):C(n.issues)})}},K=(e,t)=>[{message:`${JSON.stringify(e)} is not a valid ${t}`,path:[]}],_e=(e,t)=>e.map(r=>({...r,path:[t,...r.path]}));function Ve(e){return new D(t=>{if(t instanceof Array){let r=[],n=[];for(let s=0;s<t.length;s++){let i=e.decode(t[s]);i.isOk()?r.push(i.value):n.push(..._e(i.issues,s))}return n.length>0?C(n):k(r)}else return C(K(t,"array"))})}function nr(){return new D(e=>typeof e=="boolean"?k(e):C(K(e,"boolean")))}function sr(e,t){return new D(r=>{if(typeof r!="object"||!r)return C(K(r,"object"));let n=r[e];return Object.prototype.hasOwnProperty.call(t,n)?t[n].decode(r):C([{message:`"${e}" must be one of ${Object.keys(t).map(s=>JSON.stringify(s)).join(", ")}, but got ${JSON.stringify(n)}`,path:[e]}])})}function $t(e){return new D(t=>e().decode(t))}function b(e){return new D(t=>t===e?k(e):C([{message:`${JSON.stringify(t)} is not exactly ${JSON.stringify(e)}`,path:[]}]))}function Ae(){return new D(e=>typeof e=="number"?k(e):C(K(e,"number")))}function re(e){return new D(t=>{if(typeof t=="object"&&t){let r={},n=[];for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let i,o=e[s];i=o instanceof D?o.decode(t[s]):o.decoder.decode(t[o.fromKey]),i.isOk()?r[s]=i.value:n.push(..._e(i.issues,s))}return n.length>0?C(n):k(r)}else return C(K(t,"object"))})}function Q(e){return new D(t=>{let r=[];for(let n=0;n<e.length;n++){let s=e[n].decode(t);if(s.isOk())return s;r.push(s.issues)}return C([{message:`no alternative matched (tried ${e.length})`,path:[]},...ir(r)])})}function ir(e){let t=new Map;for(let r of e)for(let n of r){let s=JSON.stringify(n.path),i=t.get(s);i?i.messages.includes(n.message)||i.messages.push(n.message):t.set(s,{path:n.path,messages:[n.message]})}return Array.from(t.values()).map(({path:r,messages:n})=>({message:n.join(" or "),path:r}))}function A(e){return new D(t=>t===void 0?k(void 0):e.decode(t))}function or(e){return new D(t=>{if(typeof t=="object"&&t){let r={},n=[];for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)){let i=e.decode(t[s]);i.isOk()?r[s]=i.value:n.push(..._e(i.issues,s))}return n.length>0?C(n):k(r)}else return C(K(t,"object"))})}function w(){return new D(e=>typeof e=="string"?k(e):C(K(e,"string")))}function G(){return new D(e=>k(e))}function ne(e){return new D(t=>{if(typeof t!="object"||t===null)return C([{message:`Expected object literal, got "${typeof t}"`,path:[]}]);const r={};for(const[n,s]of Object.entries(e)){const i=s.decoder.decode(t[n]);if(!i.isOk())return C(i.issues.map(o=>({message:o.message,path:[n,...o.path]})));if(r[n]=i.value,s.suffixed){for(const[o,u]of Object.entries(t))if(o.startsWith(n+".")){const c=s.decoder.decode(u);if(!c.isOk())return C(c.issues.map(a=>({message:a.message,path:[o,...a.path]})));r[o]=c.value}}}return k(r)})}const Le=()=>crypto.randomUUID().slice(0,8),dr=e=>typeof e!="function"&&e.kind==="display",x=e=>typeof e!="function"&&e.kind==="action",O=e=>typeof e!="function"&&e.kind==="input",Fe=e=>typeof e!="function"&&e.kind==="layout",se=e=>typeof e=="function",ur=re({in:Ve(w())}),Re=re({when:w()}),$e=Q([ur,Re]),cr=re({from:Ve(w())}),Se=Q([cr,Re]),je=Q([nr(),Re]),lr=new D(e=>{const t=typeof e;return t==="function"?k(e):C([{message:`Expected a function, got '${t}'`,path:[]}])}),V=e=>Q([e,lr]),Me=ne({load:{suffixed:!0,decoder:V(A(w()))},click:{suffixed:!0,decoder:V(A(w()))},change:{suffixed:!0,decoder:V(A(w()))},filter:{suffixed:!0,decoder:V(A(w()))},blur:{suffixed:!0,decoder:V(A(w()))}}),ar=re({key:w(),default:A(w()),params:A(G())}),St=Q([w(),ar]),Be=A(w()).map(e=>e||Le()),fr=ne({kind:{decoder:b("display")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A(Ae())},include:{decoder:A($e)},exclude:{decoder:A(Se)},props:{decoder:A(G())}}),pr=ne({kind:{decoder:b("action")},uid:{decoder:Be},type:{decoder:w()},actionType:{decoder:A(Q([b("button"),b("submit")]))},size:{suffixed:!0,decoder:A(Ae())},include:{decoder:A($e)},exclude:{decoder:A(Se)},label:{suffixed:!0,decoder:V(A(St))},disabled:{suffixed:!0,decoder:A(je)},on:{decoder:A(Me)},props:{decoder:A(G())}}),hr=new D(e=>{const t=typeof e;if(t==="function"){const r=e,n=r(void 0);return r.uid=n.uid||Le(),r.type=n.type,r.path=n.path,k(r)}else return C([{message:`Expected a function, got '${t}'`,path:[]}])}),gr=ne({kind:{decoder:b("input")},uid:{decoder:A(w())},type:{decoder:w()},size:{suffixed:!0,decoder:A(Ae())},include:{decoder:A($e)},exclude:{decoder:A(Se)},disabled:{suffixed:!0,decoder:A(je)},readonly:{suffixed:!0,decoder:A(je)},on:{decoder:A(Me)},props:{decoder:A(G())},label:{suffixed:!0,decoder:V(A(St))},path:{decoder:w()},defaultValue:{decoder:A(G())},validator:{suffixed:!0,decoder:V(A(G()))}}).map(e=>{const t={...e};if(e.uid||(t.uid=`${e.path}-${e.type}`),e.type==="repeater"){const r=e.props;r.template=He.parse(r.template)}return t}),mr=$t(()=>{const e=sr("kind",{input:gr,layout:He,display:fr,action:pr});return new D(t=>typeof t=="function"?hr.decode(t):e.decode(t))}),He=ne({kind:{decoder:b("layout")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A(Ae())},include:{decoder:A($e)},exclude:{decoder:A(Se)},props:{decoder:A(G())},on:{decoder:A(Me)},children:{decoder:Ve(mr)}}),B=class B{constructor(){this.widgetLoaders={},this._ready=!1}get ready(){return this._ready}setWidgetLoaders(t){this.widgetLoaders=t,this._ready=!0}async loadWidget(t){const r=this.widgetLoaders[t];if(!B.sharedCache.has(r)){const n=r().catch(s=>(B.sharedCache.delete(r),Promise.reject(s)));B.sharedCache.set(r,n)}return B.sharedCache.get(r)}};B.sharedCache=new Map;let We=B;function yr(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const vt=re({states:A(or(w())),form:$t(()=>He)}),Et=e=>({formName:"",formDef:vt.parse({form:{kind:"layout",type:"flex",children:[]}}),flatForm:{},currentStates:[],calculatedWidgets:{},validations:{},touchedControls:{},injectedValidations:{},isFormValid:!0,widgetFlags:{},widgetPropOverrides:{},data:{},meta:{},formHealth:{status:"ok"},touched:!1,lang:e}),Ar=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function $r(e){const t=new Intl.Locale(e).maximize().script;return["Arab","Hebr","Thaa","Syrc","Tfng","Adlm","Rohg"].includes(t||"")?"rtl":"ltr"}const Ct=(e=navigator.language||"en-US")=>{const t=new Set;return{get lang(){return e},translate(n){return n},subscribe(n){return t.add(n),()=>{t.delete(n)}},setLang(n){e=n,t.forEach(s=>s(e))}}},Sr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function W(e,...t){return t.reduce((r,n)=>n(r),e)}function vr(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");const n=t.payload.widget,s=e.touched&&O(n)?{...e.touchedControls,[n.path]:!0}:e.touchedControls;return{...e,touchedControls:s,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:n,current:{}}}}}const z={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,widgetCouldNotBeLoaded:30,resolveStringInterpolationError:40},ie=(e,t)=>{if(e===void 0)throw new Error("obj is undefined");return t.split(".").reduce((r,n)=>r===void 0||n===""?r:Array.isArray(r)?r[parseInt(n,10)]:r[n],e)},Ge=(e,t,r)=>{if(e===null)throw new Error("object is null");if(e===void 0)throw new Error("object is undefined");if(t==="")throw new Error("path cannot be empty");const n=t.split(".");let s=e;for(let o=0;o<n.length-1;o++){const u=n[o],c=n[o+1];(s[u]==null||typeof s[u]!="object")&&(s[u]=Cr(c)?[]:{}),s=s[u]}const i=n[n.length-1];return s[i]=r,e},Er=(e,t)=>{if(t==="")return e;const r=t.split("."),n=[e];for(let o=0;o<r.length-1;o++){const u=n[o];if(u==null||typeof u!="object")return e;const c=r[o],a=Array.isArray(u)?u[parseInt(c,10)]:u[c];if(a==null||typeof a!="object")return e;n.push(a)}const s=n[n.length-1],i=r[r.length-1];Array.isArray(s)?s.splice(parseInt(i,10),1):delete s[i];for(let o=n.length-1;o>=1;o--){const u=n[o];if(Array.isArray(u)||!wr(u))break;const c=n[o-1],a=r[o-1];if(Array.isArray(c))break;delete c[a]}return e};function Cr(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function wr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const ve=(e,t)=>(delete e[t],e);function ae(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>ae(r));const t={};for(const r of Object.keys(e))t[r]=ae(e[r]);return t}function Ke(e){return e.flatMap(t=>[t,...Fe(t)?Ke(t.children):[]])}function Xe(e){return Object.entries(e.validations).reduce((r,[n,s])=>(s!==null&&(r.$formIsInvalid=!0,Ge(r.$errors,n,[...s])),r),{$formIsInvalid:!1,$errors:{}})}function we(e){const t=ae(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const s=e.flatForm[r];s&&O(s)&&Er(t,s.path)}return t}const Je=32;let Pe,h,m,$=e=>(h=0,m=e,$.newline=!1,e=v(),m[h]?X():e||""),X=(e="Unexpected token",t=h,r=m.slice(0,t).split(`
2
+ `),n=r.pop(),s=m.slice(Math.max(0,t-40),t),i="̭",o=(m[t]||" ")+i,u=m.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
+ ${m[t-41]!==`
4
+ `,""+s}${o}${u}`)},wt=(e,t=h)=>(Array.isArray(e)&&(e.loc=t),e),q=(e,t=h,r)=>{for(;r=e(m.charCodeAt(h));)h+=r;return m.slice(t,h)},I=(e=1)=>m[h+=e],Ne=e=>h=e,v=(e=0,t)=>{let r,n,s,i,o;for(t&&$.asi&&($.newline=!1);(r=$.space())&&(o=$.newline,1)&&r!==t&&(s=(n&&r===91&&Pe&&$.asi?.(n,e,v)||null)??((i=j[r])&&i(n,e))??(n&&o&&$.asi?.(n,e,v))??(!n&&q($.id)));)n=s;return t&&(r==t?(h++,t===125&&$.asi&&($.newline=!0)):X("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},R=(e,t=h)=>{for(Pe=!1;(e=m.charCodeAt(h))<=Je;)$.asi&&e===10&&($.newline=Pe=!0),h++;return e},Ir=(e=h)=>{for(;m.charCodeAt(e)<=Je;)e++;return m.charCodeAt(e)};$.id=e=>e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e==36||e==95||e>=192&&e!=215&&e!=247;let Or=(e,t=e.length)=>m.substr(h,t)===e&&!$.id(m.charCodeAt(h+t)),j=[],ut={},F=(e,t=Je,r,n=e.charCodeAt(0),s=e.length,i=j[n],o=e.toUpperCase()!==e,u,c)=>(t=ut[e]=!i&&ut[e]||t,j[n]=(a,y,g,p=h)=>(u=g,(g?e==g:(s<2||e.charCodeAt(1)===m.charCodeAt(h+1)&&(s<3||m.substr(h,s)==e))&&(!o||!$.id(m.charCodeAt(h+s)))&&(u=g=e))&&y<t&&(h+=s,(c=r(a))?wt(c,p):(h=p,u=0,!o&&!i&&!a&&X()),c)||i?.(a,y,u))),S=(e,t,r=!1)=>F(e,t,n=>n&&(s=>s&&[e,n,s])(v(t-(r?.5:0)))),M=(e,t,r)=>F(e,t,n=>!n&&(n=v(t-.5))&&[e,n]),oe=(e,t)=>F(e,200,r=>!r&&[,t]),It=(e,t,r)=>F(e,t,(n,s)=>(s=v(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),s?.[0]===e?n.push(...s.slice(1)):n.push(s||null),n)),be=(e,t)=>F(e[0],t,r=>!r&&[e,v(0,e.charCodeAt(1))||null]),Ot=(e,t)=>F(e[0],t,r=>r&&[e,r,v(0,e.charCodeAt(1))||null]),de=(e,t,r,n=e.charCodeAt(0),s=e.length,i=j[n],o)=>j[n]=(u,c,a,y=h)=>!u&&(a?e==a:(s<2||m.substr(h,s)==e)&&(a=e))&&c<t&&!$.id(m.charCodeAt(h+s))&&(!$.prop||$.prop(h+s))&&(Ne(h+s),(o=r())?wt(o,y):Ne(y),o)||i?.(u,c,a);Object.defineProperty($,"space",{configurable:!0,enumerable:!0,get:()=>R,set:e=>R=e});const Ue={},l=(e,t,r=Ue[e])=>Ue[e]=(...n)=>t(...n)||r?.(...n),d=e=>Array.isArray(e)?e[0]==null?(t=>()=>t)(e[1]):Ue[e[0]]?.(...e.slice(1))??X(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],fe=46,ee=48,pe=57,Dr=69,Tr=101,kr=43,Fr=45,le=95,Dt=110,jr=97,Wr=102,Pr=65,Nr=70,Tt=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),ze=e=>{let t=Tt(q(r=>r===fe&&m.charCodeAt(h+1)!==fe||r>=ee&&r<=pe||r===le||((r===Dr||r===Tr)&&((r=m.charCodeAt(h+1))>=ee&&r<=pe||r===kr||r===Fr)?2:0)));return m.charCodeAt(h)===Dt?(I(),[,BigInt(t)]):(e=+t)!=e?X():[,e]},Ur={2:e=>e===48||e===49||e===le,8:e=>e>=48&&e<=55||e===le,16:e=>e>=ee&&e<=pe||e>=jr&&e<=Wr||e>=Pr&&e<=Nr||e===le};$.number=null;j[fe]=e=>!e&&m.charCodeAt(h+1)!==fe&&ze();for(let e=ee;e<=pe;e++)j[e]=t=>t?void 0:ze();j[ee]=e=>{if(e)return;const t=$.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&m[h+1]?.toLowerCase()===r[1]){I(2);const s=Tt(q(Ur[n]));return m.charCodeAt(h)===Dt?(I(),[,BigInt("0"+r[1]+s)]):[,parseInt(s,n)]}}return ze()};const _r=92,ct=34,lt=39,Vr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},kt=e=>(t,r,n="")=>{if(!(t||!$.string?.[String.fromCharCode(e)]))return I(),q(s=>s-e&&(s===_r?(n+=Vr[m[h+1]]||m[h+1],2):(n+=m[h],1))),m[h]===String.fromCharCode(e)?I():X("Bad string"),[,n]};j[ct]=kt(ct);j[lt]=kt(lt);$.string={'"':!0};const Lr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>S(e,Lr,!0));const Ft=(e,t,r,n)=>typeof e=="string"?s=>t(s,e,s):e[0]==="."?(r=d(e[1]),n=e[2],s=>t(r(s),n,s)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),s=>t(r(s),n(s),s)):e[0]==="()"&&e.length===2?Ft(e[1],t):(()=>{throw Error("Invalid assignment target")})(),at={"=":(e,t,r)=>e[t]=r,"+=":(e,t,r)=>e[t]+=r,"-=":(e,t,r)=>e[t]-=r,"*=":(e,t,r)=>e[t]*=r,"/=":(e,t,r)=>e[t]/=r,"%=":(e,t,r)=>e[t]%=r,"|=":(e,t,r)=>e[t]|=r,"&=":(e,t,r)=>e[t]&=r,"^=":(e,t,r)=>e[t]^=r,">>=":(e,t,r)=>e[t]>>=r,"<<=":(e,t,r)=>e[t]<<=r};for(const e in at)l(e,(t,r)=>(r=d(r),Ft(t,(n,s,i)=>at[e](n,s,r(i)))));const Rr=30,Mr=40,Br=140;M("!",Br);S("||",Rr);S("&&",Mr);l("!",e=>(e=d(e),t=>!e(t)));l("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));l("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Hr=50,Gr=60,Kr=70,jt=100,Xr=140;S("|",Hr);S("&",Kr);S("^",Gr);S(">>",jt);S("<<",jt);M("~",Xr);l("~",e=>(e=d(e),t=>~e(t)));l("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));l("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));l("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));l(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));l("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const Ee=90;S("<",Ee);S(">",Ee);S("<=",Ee);S(">=",Ee);l(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));l("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));l(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));l("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Wt=80;S("==",Wt);S("!=",Wt);l("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));l("!=",(e,t)=>(e=d(e),t=d(t),r=>e(r)!=t(r)));const Pt=110,Qe=120,Nt=140;S("+",Pt);S("-",Pt);S("*",Qe);S("/",Qe);S("%",Qe);M("+",Nt);M("-",Nt);l("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));l("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));l("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));l("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));l("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const he=150;F("++",he,e=>e?["++",e,null]:["++",v(he-1)]);F("--",he,e=>e?["--",e,null]:["--",v(he-1)]);const qe=(e,t,r,n)=>typeof e=="string"?s=>t(s,e):e[0]==="."?(r=d(e[1]),n=e[2],s=>t(r(s),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),s=>t(r(s),n(s))):e[0]==="()"&&e.length===2?qe(e[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(e,t)=>qe(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));l("--",(e,t)=>qe(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Jr=5,br=10;It(",",br);It(";",Jr,!0);const Ut=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});l(",",Ut);l(";",Ut);const zr=170;be("()",zr);const L=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",Ze=170;Ot("[]",Ze);S(".",Ze);Ot("()",Ze);const ge=e=>{throw Error(e)};l("[]",(e,t)=>t===void 0?(e=e?e[0]===","?e.slice(1):[e]:[],e=e.map(r=>r==null?(()=>{}):r[0]==="..."?(r=d(r[1]),n=>r(n)):(r=d(r),n=>[r(n)])),r=>e.flatMap(n=>n(r))):(t==null&&ge("Missing index"),e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)[n]}));l(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],L(t)?()=>{}:r=>e(r)[t]));l("()",(e,t)=>{if(t===void 0)return e==null?ge("Empty ()"):d(e);const r=s=>s?.[0]===","&&s.slice(1).some(i=>i==null||r(i));r(t)&&ge("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),s=>t.map(i=>i(s))):(t=d(t),s=>[t(s)]):()=>[];return Ye(e,(s,i,o)=>s[i](...n(o)))});const J=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&J(e[1])||e[0]==="{}"),Ye=(e,t,r,n)=>e==null?ge("Empty ()"):e[0]==="()"&&e.length==2?Ye(e[1],t):typeof e=="string"?s=>t(s,e,s):e[0]==="."?(r=d(e[1]),n=e[2],s=>t(r(s),n,s)):e[0]==="?."?(r=d(e[1]),n=e[2],s=>{const i=r(s);return i==null?void 0:t(i,n,s)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),s=>t(r(s),n(s),s)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),s=>{const i=r(s);return i==null?void 0:t(i,n(s),s)}):(e=d(e),s=>t([e(s)],0,s)),Z=Ye,Qr=32,qr=$.space;$.comment??={"//":`
6
+ `,"/*":"*/"};let Ie;$.space=()=>{Ie||(Ie=Object.entries($.comment).map(([s,i])=>[s,i,s.charCodeAt(0)]));for(var e;e=qr();){for(var t=0,r;r=Ie[t++];)if(e===r[2]&&m.substr(h,r[0].length)===r[0]){var n=h+r[0].length;if(r[1]===`
7
+ `)for(;m.charCodeAt(n)>=Qr;)n++;else{for(;m[n]&&m.substr(n,r[1].length)!==r[1];)n++;m[n]&&(n+=r[1].length)}Ne(n),e=0;break}if(e)return e}return e};const _t=80;S("===",_t);S("!==",_t);l("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));l("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const Zr=30;S("??",Zr);l("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const Yr=130,xr=20;S("**",Yr,!0);S("**=",xr,!0);l("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const en=e=>{throw Error(e)};l("**=",(e,t)=>(J(e)||en("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]**=t(s))));const Vt=90;S("in",Vt);S("of",Vt);l("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const tn=20,rn=100,nn=e=>{throw Error(e)};S(">>>",rn);S(">>>=",tn,!0);l(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));l(">>>=",(e,t)=>(J(e)||nn("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]>>>=t(s))));const xe=5,sn=10,on=20,dn=e=>e[0]?.[0]===","?e[0].slice(1):e,me=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...s]=e,i=dn(s);if(n==="{}"){const o=[];for(const u of i){if(Array.isArray(u)&&u[0]==="..."){const p={};for(const T in t)o.includes(T)||(p[T]=t[T]);r[u[1]]=p;break}let c,a,y;typeof u=="string"?c=a=u:u[0]==="="?(typeof u[1]=="string"?c=a=u[1]:[,c,a]=u[1],y=u[2]):[,c,a]=u,o.push(c);let g=t[c];g===void 0&&y&&(g=d(y)(r)),me(a,g,r)}}else if(n==="[]"){let o=0;for(const u of i){if(u===null){o++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(o);break}let c=u,a;Array.isArray(u)&&u[0]==="="&&([,c,a]=u);let y=t[o++];y===void 0&&a&&(y=d(a)(r)),me(c,y,r)}}},Lt=e=>{let t=v(sn-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[e,t[1]],t[2]]:t?.[0]===","?[e,...t.slice(1)]:[e,t]};de("let",xe+1,()=>Lt("let"));de("const",xe+1,()=>Lt("const"));de("var",xe,()=>(R(),["var",v(on)]));const Rt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,s=d(n);return typeof r=="string"?i=>{i[r]=s(i)}:i=>me(r,s(i),i)}return d(t)}),t=>{for(const r of e)r(t)});l("let",Rt);l("const",Rt);l("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const et=20,Ce=e=>{throw Error(e)};S("||=",et,!0);S("&&=",et,!0);S("??=",et,!0);l("=",(e,t)=>{if(Array.isArray(e)&&(e[0]==="let"||e[0]==="const"||e[0]==="var")){const r=e[1];return t=d(t),typeof r=="string"?n=>{n[r]=t(n)}:n=>me(r,t(n),n)}return J(e)||Ce("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]=t(s))});l("||=",(e,t)=>(J(e)||Ce("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]||=t(s))));l("&&=",(e,t)=>(J(e)||Ce("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]&&=t(s))));l("??=",(e,t)=>(J(e)||Ce("Invalid assignment target"),t=d(t),Z(e,(r,n,s)=>r[n]??=t(s))));oe("true",!0);oe("false",!1);oe("null",null);de("undefined",200,()=>[]);oe("NaN",NaN);oe("Infinity",1/0);const Oe=20;F("?",Oe,(e,t,r)=>e&&(t=v(Oe-1))&&q(n=>n===58)&&(r=v(Oe-1),["?",e,t,r]));l("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const un=[],cn=20;S("=>",cn,!0);l("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,s=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,s=i[1],r.length--);const o=t?.[0]==="{}";return t=d(o?["{",t[1]]:t),u=>(...c)=>{const a={};r.forEach((g,p)=>a[g]=c[p]),s&&(a[s]=c.slice(n));const y=new Proxy(a,{get:(g,p)=>p in g?g[p]:u?.[p],set:(g,p,T)=>((p in g?g:u)[p]=T,!0),has:(g,p)=>p in g||(u?p in u:!1)});try{const g=t(y);return o?void 0:g}catch(g){if(g===un)return g[0];throw g}}});const ln=140;M("...",ln);l("...",e=>(e=d(e),t=>Object.entries(e(t))));const ft=170;F("?.",ft,(e,t)=>{if(!e)return;const r=R();return r===40?(I(),["?.()",e,v(0,41)||null]):r===91?(I(),["?.[]",e,v(0,93)]):(t=v(ft),t?["?.",e,t]:void 0)});l("?.",(e,t)=>(e=d(e),L(t)?()=>{}:r=>e(r)?.[t]));l("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)?.[n]}));l("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),s=>t.map(i=>i(s))):(t=d(t),s=>[t(s)]):()=>[];if(e[0]==="?."){const s=d(e[1]),i=e[2];return L(i)?()=>{}:o=>s(o)?.[i]?.(...r(o))}if(e[0]==="?.[]"){const s=d(e[1]),i=d(e[2]);return o=>{const u=s(o),c=i(o);return L(c)?void 0:u?.[c]?.(...r(o))}}if(e[0]==="."){const s=d(e[1]),i=e[2];return L(i)?()=>{}:o=>s(o)?.[i]?.(...r(o))}if(e[0]==="[]"&&e.length===3){const s=d(e[1]),i=d(e[2]);return o=>{const u=s(o),c=i(o);return L(c)?void 0:u?.[c]?.(...r(o))}}const n=d(e);return s=>n(s)?.(...r(s))});const te=140;M("typeof",te);M("void",te);M("delete",te);de("new",te,()=>Or(".target")?(I(7),["new.target"]):["new",v(te)]);l("typeof",e=>(e=d(e),t=>typeof e(t)));l("void",e=>(e=d(e),t=>(e(t),void 0)));l("delete",e=>{if(e[0]==="."){const t=d(e[1]),r=e[2];return n=>delete t(n)[r]}if(e[0]==="[]"){const t=d(e[1]),r=d(e[2]);return n=>delete t(n)[r(n)]}return()=>!0});l("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(s=>i=>s.map(o=>o(i)))(r.slice(1).map(d)):(s=>i=>[s(i)])(d(r)):()=>[];return s=>new(t(s))(...n(s))});const tt=Symbol("accessor"),rt=20,an=40,Mt=41,Bt=123,Ht=125,Gt=e=>t=>{if(t)return;R();const r=q($.id);if(!r||(R(),m.charCodeAt(h)!==an))return!1;I();const n=v(0,Mt);return R(),m.charCodeAt(h)!==Bt?!1:(I(),[e,r,n,v(0,Ht)])};F("get",rt-1,Gt("get"));F("set",rt-1,Gt("set"));F("(",rt-1,e=>{if(!e||typeof e!="string")return;const t=v(0,Mt)||null;if(R(),m.charCodeAt(h)===Bt)return I(),[":",e,["=>",["()",t],v(0,Ht)||null]]});l("get",(e,t)=>(t=t?d(t):()=>{},r=>[[tt,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));l("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[tt,e,{set:function(s){const i=Object.create(n||{});i.this=this,i[t]=s,r(i)}}]]));const fn=20,Kt=200;$.prop=e=>Ir(e)!==58;const pn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);be("[]",Kt);be("{}",Kt);S(":",fn-1,!0);l("{}",(e,t)=>{if(t!==void 0)return;if(!pn(e))return d(["{",e]);e=e?e[0]!==","?[e]:e.slice(1):[];const r=e.map(n=>d(typeof n=="string"?[":",n,n]:n));return n=>{const s={},i={};for(const o of r.flatMap(u=>u(n)))if(o[0]===tt){const[,u,c]=o;i[u]={...i[u],...c,configurable:!0,enumerable:!0}}else s[o[0]]=o[1];for(const o in i)Object.defineProperty(s,o,i[o]);return s}});l("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));l(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const hn=170,ye=96,gn=36,mn=123,yn=92,An={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},pt=()=>{const e=[];for(let t="",r;(r=m.charCodeAt(h))!==ye;)r?r===yn?(I(),t+=An[m[h]]||m[h],I()):r===gn&&m.charCodeAt(h+1)===mn?(t&&e.push([,t]),t="",I(2),e.push(v(0,125))):(t+=m[h],I(),r=m.charCodeAt(h),r===ye&&t&&e.push([,t])):X("Unterminated template");return I(),e},$n=j[ye];j[ye]=(e,t)=>e&&t<hn?$.asi&&$.newline?void 0:(I(),["``",e,...pt()]):e?$n?.(e,t):(I(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(pt()));l("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));l("``",(e,...t)=>{e=d(e);const r=[],n=[];for(const i of t)Array.isArray(i)&&i[0]===void 0?r.push(i[1]):n.push(d(i));const s=Object.assign([...r],{raw:r});return i=>e(i)(s,...n.map(o=>o(i)))});$.string["'"]=!0;$.number={"0x":16,"0b":2,"0o":8};const Sn={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function N(e,t,r,n,s){const i=$(nt(e));return d(i)({$form:t,$meta:r,$errors:n,$formIsInvalid:s,$log:Sn.log})===!0}function nt(e){return e.replace(/\?\.(\d+)/g,"?.[$1]").replace(/\.(\d+)/g,"[$1]")}const U=e=>{let t=e.formDef.states;if(!t||Object.keys(t).length===0||e.formHealth.status==="errored")return e;const{$formIsInvalid:r,$errors:n}=Xe(e);t=vn(t);let s=[],i={status:"ok"};try{s=Object.keys(t).map(o=>{const u=t[o];let c;try{c=N(u,e.data,e.meta,n,r)}catch{c=!1}return c===!0?o:void 0}).filter(o=>o!==void 0)}catch(o){const u=o,c=z.calculateCurrentStateError;i={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:s,formHealth:i}};function vn(e){const t={};function r(n){const s=n.split(":"),i=[];for(let o=0;o<s.length;o++)i.push(s.slice(0,o+1).join(":"));return i}for(const[n,s]of Object.entries(e)){const i=r(n),o=[];for(const u of i)e[u]&&o.push(`(${e[u]})`);t[n]=o.join(" && ")}return t}const st=Symbol("filterMap.skip");function Xt(e,t){const r=[];for(let n=0;n<e.length;n++){const s=t(e[n],n,e);s!==st&&r.push(s)}return r}function En(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function Cn(e,t,r,n){let s=n;for(let i=0;i<e.length;i++)t(e[i],i,e)&&(s=r(s,e[i],i,e));return s}function wn(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n],n,e,t))return!1;return!0}function Jt(e,t){const r=bt(e.uid,t);return O(e)?{...e,uid:r,path:In(e.path,t)}:{...e,uid:r}}function bt(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,s)=>`${n}[${s}]`,"");return`${e}${r}`}function In(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r="items",n=e.split(`.${r}`),s=n.length-1;if(s!==t.length)throw new Error(`Path contains ${s} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((i,o,u)=>u===0?o:`${i}.${t[u-1]}${o}`)}function ue(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,s)=>{const i=t[r++];return i===void 0?n:`.${i}${s}.`})}const ce=(e,t)=>r=>e(r)?t(r):r,H=e=>e!==void 0&&typeof e=="object"&&e!==null&&"when"in e,_=e=>{const{$formIsInvalid:t,$errors:r}=Xe(e);return{...e,widgetFlags:{...On(e,r,t),...Dn(e,r,t)}}};function On(e,t,r){return Xt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return st;if(se(n)){const s=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return s.uid=n.uid,s}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(O(n)||x(n))&&H(n.disabled)||O(n)&&H(n.readonly))).reduce((n,s)=>(n[s.uid]=n[s.uid]||{},s.include&&"in"in s.include?n[s.uid].hidden=!s.include.in.some(i=>e.currentStates.includes(i)):s.include&&"when"in s.include&&(n[s.uid].hidden=!N(s.include.when,e.data,e.meta,t,r)),s.exclude&&"from"in s.exclude?n[s.uid].hidden=s.exclude.from.some(i=>e.currentStates.includes(i)):s.exclude&&"when"in s.exclude&&(n[s.uid].hidden=N(s.exclude.when,e.data,e.meta,t,r)),(O(s)||x(s))&&H(s.disabled)&&(n[s.uid].disabled=N(s.disabled.when,e.data,e.meta,t,r)),O(s)&&H(s.readonly)&&(n[s.uid].readonly=N(s.readonly.when,e.data,e.meta,t,r)),n),{})}function Dn(e,t,r){return Cn(Object.values(e.flatForm),n=>!se(n)&&n.type==="repeater",(n,s)=>({...n,...zt(e,s,[],t,r)}),{})}function zt(e,t,r,n,s){const i=t.props.template,o=ie(e.data,t.path);if(!Array.isArray(o))return{};const u={};return o.forEach((c,a)=>{const y=[...r,a];Ke([i]).forEach(g=>{let p;if(se(g)?(p=g({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),p.uid=g.uid):p=g,p.type==="repeater"){const Y=Jt(p,y);Object.assign(u,zt(e,Y,y,n,s));return}const T=bt(p.uid,y);u[T]=u[T]||{},p.include&&"in"in p.include?u[T].hidden=!p.include.in.some(Y=>e.currentStates.includes(Y)):p.include&&"when"in p.include&&(u[T].hidden=!N(ue(p.include.when,y),e.data,e.meta,n,s)),p.exclude&&"from"in p.exclude?u[T].hidden=p.exclude.from.some(Y=>e.currentStates.includes(Y)):p.exclude&&"when"in p.exclude&&(u[T].hidden=N(ue(p.exclude.when,y),e.data,e.meta,n,s)),(O(p)||x(p))&&H(p.disabled)&&(u[T].disabled=N(ue(p.disabled.when,y),e.data,e.meta,n,s)),O(p)&&H(p.readonly)&&(u[T].readonly=N(ue(p.readonly.when,y),e.data,e.meta,n,s))})}),u}const P=e=>t=>{try{return{...t,calculatedWidgets:Tn(t,e)}}catch(r){const n=r;return{...t,formHealth:{status:"errored",message:`[${n.code}] ${n.message}`,code:n.code}}}};function Tn(e,t){const{$formIsInvalid:r,$errors:n}=Xe(e),s=bn(e,t,r,n),i={};for(const o of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[o]?.hidden)continue;const u=e.calculatedWidgets[o],c=u.source;if(se(c)){i[o]=kn(o,c,e,t);continue}i[o]=Fn(u,c,e,s)}return i}function kn(e,t,r,n){const s=t({$form:r.data,errors:t.path?r.validations[t.path]:void 0,touched:t.path?r.touchedControls[t.path]:void 0,translate:n.translate});return s.uid=e,{source:t,current:s}}function Fn(e,t,r,n){const s=new Jn(t,e.current);return s.write("uid",t.uid),s.write("type",t.type),s.write("kind",t.kind),dr(t)?jn(s,n):x(t)?Wn(s,n):O(t)?Pn(s,n):Fe(t)&&Nn(s,n),Un(t,s,n,r),(x(t)||O(t))&&_n(t,s,n),Fe(t)&&Vn(t,s,r),s.changed?{source:e.source,current:s.current}:e}function jn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function Wn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"actionType")}function Pn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude"),E(e,t,"label"),E(e,t,"disabled"),E(e,t,"readonly"),E(e,t,"validator"),E(e,t,"path"),E(e,t,"defaultValue")}function Nn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function Un(e,t,r,n){const s=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...s};for(const o of Zt(Object.keys(i)))Ln(t,r,o)}function _n(e,t,r){const n=e.on??{};for(const s of Zt(Object.keys(n)))Rn(t,r,s)}function Vn(e,t,r){const n=qn(e.uid),s=Qn(e.children,n,r.widgetFlags);t.current.children=s;const i=t.previous.children??[];i.length===s.length&&s.every((u,c)=>i[c]&&i[c].uid===s[c].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!zn(n,r))return;const s=ot(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Hn(s,t,e.source.uid,r);break;case"defaultValue":i=s;break;default:i=qt(s,t)}e.write(r,i)}function Ln(e,t,r){const n=e.source.props,s=ot(n,r,t.sortedStates);let i=qt(s,t);const o=t.widgetPropOverrides[e.source.uid]?.[r];o!==void 0&&(i=o),e.write(`props.${r}`,i)}function Rn(e,t,r){const n=e.source.on,s=ot(n,r,t.sortedStates);e.write(`on.${r}`,Gn(s,t))}function it(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Mn(e,t){return t.localization.translate(e.key,Xn(e.params,t),e.default)}const Bn=/\{\{([^}]+)\}\}/g;function Qt(e,t){return e.includes("{{")?e.replace(Bn,(r,n)=>{const s=nt(n.trim());try{const i=d($(s))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});return i==null?"":String(i)}catch(i){const o=i instanceof Error?i.message:String(i);throw new Yt(`Failed to evaluate '{{${n.trim()}}}': ${o}`)}}):e}function qt(e,t){return typeof e=="function"?it(e,t):Ar(e)?Mn(e,t):typeof e=="string"?Qt(e,t):e}function Hn(e,t,r,n){return typeof e=="function"?it(e,t):H(e)?t.widgetFlags[r]?.[n]:typeof e=="string"?Qt(e,t):e}function Gn(e,t){return typeof e=="function"?it(e,t):e}function ot(e,t,r){if(e){for(const n of r){const s=e[`${t}.${n}`];if(s!==void 0)return s}return e[t]}}function Kn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e==="$formIsInvalid"}function Xn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const s=String(e[n]);if(Kn(s))try{const i=d($(nt(s)))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});r[n]=i??s}catch(i){const o=i instanceof Error?i.message:String(i);throw new Yt(`Failed to evaluate i18n param '${s}': ${o}`)}else r[n]=s;return r},{})}class Jn{constructor(t,r){this._changed=!1,this.source=t,this.previous=r,this.current={}}get changed(){return this._changed}markChanged(){this._changed=!0}write(t,r){Ge(this.current,t,r),ie(this.previous,t)!==r&&(this._changed=!0)}}function bn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((s,i)=>i.length-s.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function zn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function Zt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function Qn(e,t,r){const n=t.map(s=>`[${s}]`).join("");return e.filter(s=>{const i=s.uid+n,o=r[i];return!o||o.hidden!==!0})}const qn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10));class Yt extends Error{constructor(){super(...arguments),this.code=z.resolveStringInterpolationError,this.name="StringInterpolationError"}}const Zn=({lang:e},t)=>{const r={...Et(e),formName:t.payload.formName};let n=t.payload.formDef,s={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(c){const a=c,y=z.initializeParseError;s={status:"errored",message:`[${y}] ${a.message}`,code:y}}if(s.status==="errored")return{...r,formHealth:s}}if(Array.isArray(n.form)){const c=n,a=c.form;c.form={uid:"",type:"flex",kind:"layout",children:a}}const i=vt.decode(n);if(i.isOk()){s={status:"ok"};let c={};try{c=Ke([i.value.form]).reduce((a,y)=>{const g=y.uid;if(a[g])throw{existingWidget:a[g],newWidget:y};return a[g]=y,a},{})}catch(a){const y=z.initializeUidCollisionError;s={status:"errored",message:`[${y}] ${Yn(a.existingWidget,a.newWidget)}`,code:y},c={}}return{...r,formDef:i.value,flatForm:c,formHealth:s}}const o=z.initializeUnknownError,u=i.issues.map(c=>`${c.path.length>0?At(c.path):"root"}: ${c.message}`).join("; ");return{...r,formHealth:{status:"errored",message:`[${o}] ${u}`,code:o}}};function Yn(e,t){const r=n=>O(n)?` at "${n.path}"`:"";return`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`}function xn(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const es=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:i})=>O(i)&&i.path===t.path),!r)return console.warn(`Input with path "${t.path}" not found`),e}else if(r=e.calculatedWidgets[t.uid],!r)return console.warn(`Widget with uid "${t.uid}" not found`),e;const n=r.source.uid,s=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...s,[t.prop]:t.value}}}};function ts(e,t){return W(e,rs(t),ns(t),ss(t),is(t))}const rs=e=>t=>({...t,widgetFlags:{...ve(t.widgetFlags,e.payload.uid)}}),ns=e=>t=>({...t,calculatedWidgets:{...ve(t.calculatedWidgets,e.payload.uid)}}),ss=e=>t=>({...t,widgetPropOverrides:{...ve(t.widgetPropOverrides,e.payload.uid)}}),is=e=>t=>({...t,touchedControls:W(t.touchedControls,r=>{const n=t.flatForm[e.payload.uid];return n&&O(n)?ve(r,n.path):r})}),os=(e,t)=>({...e,data:{...t.payload.data}}),ds=(e,t)=>({...e,formHealth:t.payload.formHealth}),us=(e,t)=>({...e,lang:t.payload.lang}),cs=(e,t)=>({...e,meta:{...t.payload.meta}}),ls=(e,t)=>{const r=ie(e.data,t.payload.path);return t.type==="SET_WIDGET_DATA"||t.type==="SET_WIDGET_INITIAL_DATA"&&r===void 0?{...e,data:{...Ge(e.data,t.payload.path,t.payload.data)}}:e},De=(e,t)=>r=>{const n=Xt(Object.values(r.calculatedWidgets),({current:i})=>O(i)?i:st),s=r.validations;return{...r,validations:n.reduce((i,o)=>{if(i[o.path]=null,o.validator){const u=e(o.validator,t),c=ie(r.data,o.path),a=gt(u,c);i[o.path]=mt(a)?null:a.issues.map(y=>y.message)}return Array.isArray(i[o.path])&&Array.isArray(s[o.path])&&wn(i[o.path],s[o.path],(u,c)=>u===c)&&(i[o.path]=s[o.path]),i},{})}},as=({validators:e,validateOn:t,localization:r})=>(n,s)=>{switch(s.type){case"INITIALIZE":return Zn(n,s);case"SET_DATA":return W(os(n,s),U,_,P(r));case"SET_META":return W(cs(n,s),U,_,P(r));case"SET_LANGUAGE":return W(us(n,s),P(r));case"ADD_WIDGET":return W(vr(n,s),ce(Te,U),ce(Te,_),ce(Te,P(r)));case"REMOVE_WIDGET":return W(ts(n,s),U,_,P(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return W(ls(n,s),U,_,P(r));case"OVERRIDE_WIDGET_PROP":return W(es(n,s),U,_,P(r),ce(i=>{let o=!1,u="";"path"in s.payload?(o=!0,u=s.payload.path):O(i.calculatedWidgets[s.payload.uid].current)&&(o=!0,u=i.calculatedWidgets[s.payload.uid].current.path);const c=o&&i.touchedControls[u];return i.touched&&c},De(e,r)));case"SET_FORM_HEALTH":return ds(n,s);case"VALIDATE_ALL":return W({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((i,o)=>{const u=n.calculatedWidgets[o].source;return O(u)&&(i[u.path]=!0),i},{})},De(e,r),U,_,P(r),ht);case"ATTEMPT_VALIDATION":{const i=s.payload.reason,o=s.payload.path;return t==="eager"||i===t||t.includes(i)?W({...n,touched:!0,touchedControls:{...n.touchedControls,[o]:!0}},De(e,r),U,_,P(r),c=>{const a=s.payload.uid,y=c.calculatedWidgets[a],g=y.source;if(se(g)){const p=g({$form:c.data,errors:c.validations[o],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[a]:{source:y.source,current:p}}}}return c},ht):n}case"INJECT_VALIDATION_ISSUES":return xn(n,s);default:return Sr(s)}},Te=e=>e.formHealth.status==="ok";function ht(e){const t=Object.keys(e.injectedValidations),r=Object.keys(e.validations);if(t.length===0&&r.length===0)return{...e,isFormValid:!0};let n=t.find(s=>e.injectedValidations[s]!==null&&Array.isArray(e.injectedValidations[s]));return n!==void 0?{...e,isFormValid:!1}:(n=r.find(s=>e.validations[s]!==null&&Array.isArray(e.validations[s])),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function fs(e=[],t,r,n){const s=new f.BehaviorSubject(Et(n.lang)),i=s.asObservable().pipe(f.distinctUntilChanged()),o=as({validators:t,validateOn:r,localization:n});function u(g){const p=s.getValue(),T=o(p,g);s.next(T)}let c=u;const a={getState:()=>s.getValue(),dispatch:g=>c(g)};return c=e.map(g=>g(a)).reduceRight((g,p)=>p(g),u),{state$:i,dispatch:c,getState:()=>s.getValue()}}class ps{constructor(){this.widgetRegistry=new We,this.store={},this.events$=new f.Subject,this.submit$=new f.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,s,i,o=Ct(),u){this.localization=o,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=fs(r,n,s,o)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(o=>r.on?.[`${t}.${o}`]!==void 0);if(i.length>0)i.forEach(o=>{const u=r.on?.[`${t}.${o}`];this.attemptValidation(t,r),u&&this.events$.next({name:u,data:we(this.store.getState()),detail:n??void 0,callback:c=>{this.store.dispatch(c)}})});else{const o=r.on?.[t];this.attemptValidation(t,r),o&&this.events$.next({name:o,data:we(this.store.getState()),detail:n,callback:u=>{this.store.dispatch(u)}})}}emitSubmitEvent(){this.store.dispatch({type:"VALIDATE_ALL"}),this.store.getState().isFormValid&&this.submit$.next({data:we(this.store.getState()),callback:t=>{this.store.dispatch(t)}})}attemptValidation(t,r){r.kind!=="layout"&&(t==="change"?this.store.dispatch({type:"ATTEMPT_VALIDATION",payload:{reason:"change",path:r.path,uid:r.uid}}):t==="click"&&r.kind==="action"&&r.actionType==="submit"&&this.store.dispatch({type:"VALIDATE_ALL"}))}}function hs(e="GolemUI Form Store"){return t=>{const n=(typeof window<"u"?window.__REDUX_DEVTOOLS_EXTENSION__:void 0)?.connect({name:e});return n?.init(t.getState()),s=>i=>{s(i),n&&n.send(i,t.getState())}}}const gs=f.pipe(f.map(e=>e.data),f.distinctUntilChanged()),ms=e=>f.pipe(gs,f.map(t=>ie(t,e)),f.distinctUntilChanged()),ys=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.validations),f.distinctUntilChanged()),As=e=>f.pipe(ys,f.map(t=>t[e]),f.distinctUntilChanged()),$s=f.pipe(f.filter(e=>e.touched===!0),f.map(e=>e.injectedValidations),f.distinctUntilChanged()),Ss=e=>f.pipe($s,f.map(t=>t[e]),f.distinctUntilChanged(),f.startWith(null)),vs=f.pipe(f.map(e=>e.lang),f.distinctUntilChanged()),xt=f.pipe(f.map(e=>e.calculatedWidgets),f.distinctUntilChanged()),Es=e=>t=>f.combineLatest([t.pipe(vs),t.pipe(xt)]).pipe(f.map(([r,n])=>({lang:r,widget:n[e]})),f.filter(r=>r.widget!==void 0),f.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),f.map(r=>r.widget.current)),Cs=e=>f.pipe(xt,f.map(t=>t[e]),f.filter(t=>t!==void 0),f.map(t=>t.current.children),f.distinctUntilChanged());f.pipe(f.map(e=>e.widgetFlags),f.distinctUntilChanged());const ws=f.pipe(f.map(e=>e.touchedControls),f.distinctUntilChanged()),Is=e=>f.pipe(ws,f.map(t=>t[e]),f.distinctUntilChanged()),Os=f.pipe(f.map(e=>e.formHealth),f.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),Ds=e=>e.pipe(Os);let er=!1;function Ts(){er=!0}function ks(){return er}function Fs(e,t,r){if(!ks())return;const n=Object.keys(t??{}).filter(s=>s in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.FormContext=ps;exports.assertNoPropCollisions=Fs;exports.calculatedLayoutChildrenByUid$=Cs;exports.calculatedWidgetsByUid$=Es;exports.cloneObject=ae;exports.dataByPath$=ms;exports.defineForm=yr;exports.devToolsMiddleware=hs;exports.enableDevMode=Ts;exports.errorCodes=z;exports.filterTap=En;exports.formHealth=Ds;exports.getDirectionFromLanguage=$r;exports.identityTranslator=Ct;exports.injectedValidationByPath$=Ss;exports.isStandardValidateSuccess=mt;exports.makeRepeaterItemConfig=Jt;exports.shortUUID=Le;exports.standardValidate=gt;exports.touchedControlsByPath$=Is;exports.validationByPath$=As;
@@ -26,20 +26,16 @@ export type KeySpec<A> = Record<string, {
26
26
  * @typeParam T - The resulting object shape after successful decoding.
27
27
  *
28
28
  * @param specs - A map of base keys to their decoding specification.
29
- * @param decoderName - Human-readable name used in error messages.
30
29
  *
31
30
  * @returns A `jd.Decoder` that validates and decodes objects according to the
32
31
  * provided key specifications.
33
32
  *
34
33
  * @example
35
34
  * ```ts
36
- * const decoder = objectWithSuffix<Record<string, string>>(
37
- * {
38
- * label: { suffixed: true, decoder: jd.string() },
39
- * title: { suffixed: false, decoder: jd.string() },
40
- * },
41
- * 'MyObj',
42
- * );
35
+ * const decoder = objectWithSuffix<Record<string, string>>({
36
+ * label: { suffixed: true, decoder: jd.string() },
37
+ * title: { suffixed: false, decoder: jd.string() },
38
+ * });
43
39
  *
44
40
  * decoder.decode({
45
41
  * label: 'Submit',
@@ -48,4 +44,4 @@ export type KeySpec<A> = Record<string, {
48
44
  * });
49
45
  * ```
50
46
  */
51
- export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>, decoderName: string): Decoder<T>;
47
+ export declare function objectWithSuffix<T extends Record<string, any>>(specs: KeySpec<any>): Decoder<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/core",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.3",
4
4
  "type": "module",
5
5
  "main": "./index.umd.cjs",
6
6
  "module": "./index.js",
@@ -28,7 +28,7 @@
28
28
  "*.md"
29
29
  ],
30
30
  "dependencies": {
31
- "ts.data.json": "^3.3.0"
31
+ "ts.data.json": "^4.1.0"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "subscript": "^10.1.8",