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

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 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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("rxjs");require("@standard-schema/spec");function mt(e,t){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous");return r}function gt(e){return e.issues===void 0}var rr=class{value;constructor(e){this.value=e}map(e){return k(e(this.value))}isOk(){return!0}},nr=class yt{issues;constructor(t){this.issues=t}map(t){return new yt(this.issues)}isOk(){return!1}};function k(e){return new rr(e)}function C(e){return new nr(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 Fe{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(o=>({key:o})):void 0}))}}};decodePromise(t){return new Promise((r,n)=>{let o=this.decode(t);if(o.isOk())return r(o.value);{let i=o;return n(Error(dt(i.issues),{cause:i.issues}))}})}map(t){return new Fe(r=>{let n=this.decodeFn(r);return n.isOk()?k(t(n.value)):C(n.issues)})}flatMap(t){return new Fe(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 o=0;o<t.length;o++){let i=e.decode(t[o]);i.isOk()?r.push(i.value):n.push(..._e(i.issues,o))}return n.length>0?C(n):k(r)}else return C(K(t,"array"))})}function or(){return new D(e=>typeof e=="boolean"?k(e):C(K(e,"boolean")))}function ir(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(o=>JSON.stringify(o)).join(", ")}, but got ${JSON.stringify(n)}`,path:[e]}])})}function $t(e){return new D(t=>e().decode(t))}function J(e){return new D(t=>t===e?k(e):C([{message:`${JSON.stringify(t)} is not exactly ${JSON.stringify(e)}`,path:[]}]))}function $e(){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 o in e)if(Object.prototype.hasOwnProperty.call(e,o)){let i,s=e[o];i=s instanceof D?s.decode(t[o]):s.decoder.decode(t[s.fromKey]),i.isOk()?r[o]=i.value:n.push(..._e(i.issues,o))}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 o=e[n].decode(t);if(o.isOk())return o;r.push(o.issues)}return C([{message:`no alternative matched (tried ${e.length})`,path:[]},...sr(r)])})}function sr(e){let t=new Map;for(let r of e)for(let n of r){let o=JSON.stringify(n.path),i=t.get(o);i?i.messages.includes(n.message)||i.messages.push(n.message):t.set(o,{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 dr(e){return new D(t=>{if(typeof t=="object"&&t){let r={},n=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=e.decode(t[o]);i.isOk()?r[o]=i.value:n.push(..._e(i.issues,o))}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,o]of Object.entries(e)){const i=o.decoder.decode(t[n]);if(!i.isOk())return C(i.issues.map(s=>({message:s.message,path:[n,...s.path]})));if(r[n]=i.value,o.suffixed){for(const[s,u]of Object.entries(t))if(s.startsWith(n+".")){const c=o.decoder.decode(u);if(!c.isOk())return C(c.issues.map(l=>({message:l.message,path:[s,...l.path]})));r[s]=c.value}}}return k(r)})}const Le=()=>crypto.randomUUID().slice(0,8),ur=e=>typeof e!="function"&&e.kind==="display",Y=e=>typeof e!="function"&&e.kind==="action",I=e=>typeof e!="function"&&e.kind==="input",ae=e=>typeof e!="function"&&e.kind==="layout",oe=e=>typeof e=="function",cr=re({in:Ve(w())}),Re=re({when:w()}),Se=Q([cr,Re]),lr=re({from:Ve(w())}),ve=Q([lr,Re]),je=Q([or(),Re]),ar=new D(e=>{const t=typeof e;return t==="function"?k(e):C([{message:`Expected a function, got '${t}'`,path:[]}])}),V=e=>Q([e,ar]),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()))}}),fr=re({key:w(),default:A(w()),params:A(G())}),St=Q([w(),fr]),Be=A(w()).map(e=>e||Le()),pr=ne({kind:{decoder:J("display")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},props:{decoder:A(G())}}),hr=ne({kind:{decoder:J("action")},uid:{decoder:Be},type:{decoder:w()},actionType:{decoder:A(Q([J("button"),J("submit")]))},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},label:{suffixed:!0,decoder:V(A(St))},disabled:{suffixed:!0,decoder:A(je)},on:{decoder:A(Me)},props:{decoder:A(G())}}),mr=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:J("input")},uid:{decoder:A(w())},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},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}),yr=$t(()=>{const e=ir("kind",{input:gr,layout:He,display:pr,action:hr});return new D(t=>typeof t=="function"?mr.decode(t):e.decode(t))}),He=ne({kind:{decoder:J("layout")},uid:{decoder:Be},type:{decoder:w()},size:{suffixed:!0,decoder:A($e())},include:{decoder:A(Se)},exclude:{decoder:A(ve)},props:{decoder:A(G())},on:{decoder:A(Me)},children:{decoder:Ve(yr)}}),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(o=>(B.sharedCache.delete(r),Promise.reject(o)));B.sharedCache.set(r,n)}return B.sharedCache.get(r)}};B.sharedCache=new Map;let We=B;function Ar(e){return{...e,form:{uid:"",type:"flex",kind:"layout",children:e.form}}}const vt=re({states:A(dr(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}),$r=e=>!(typeof e!="object"||e===null||typeof e.key!="string");function Sr(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(o=>o(e))}}},vr=e=>{throw new Error(`Unhandled case: ${JSON.stringify(e)}`)};function W(e,...t){return t.reduce((r,n)=>n(r),e)}function Er(e,t){const r=t.payload.widget.uid;if(!r)throw new Error("addWidget: widget must have a uid");const n=t.payload.widget,o=e.touched&&I(n)?{...e.touchedControls,[n.path]:!0}:e.touchedControls;return{...e,touchedControls:o,calculatedWidgets:{...e.calculatedWidgets,[r]:{source:n,current:{}}}}}const b={calculateCurrentStateError:10,initializeParseError:20,initializeUidCollisionError:21,initializeUnknownError:22,initializeMalformedFormShapeError:23,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 o=e;for(let s=0;s<n.length-1;s++){const u=n[s],c=n[s+1];(o[u]==null||typeof o[u]!="object")&&(o[u]=wr(c)?[]:{}),o=o[u]}const i=n[n.length-1];return o[i]=r,e},Cr=(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],l=Array.isArray(u)?u[parseInt(c,10)]:u[c];if(l==null||typeof l!="object")return e;n.push(l)}const o=n[n.length-1],i=r[r.length-1];Array.isArray(o)?o.splice(parseInt(i,10),1):delete o[i];for(let s=n.length-1;s>=1;s--){const u=n[s];if(Array.isArray(u)||!Or(u))break;const c=n[s-1],l=r[s-1];if(Array.isArray(c))break;delete c[l]}return e};function wr(e){const t=Number(e);return Number.isInteger(t)&&t>=0&&t.toString()===e}function Or(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0}const Ee=(e,t)=>(delete e[t],e);function fe(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(r=>fe(r));const t={};for(const r of Object.keys(e))t[r]=fe(e[r]);return t}function be(e){return e.flatMap(t=>[t,...ae(t)?be(t.children):[]])}function Ke(e){return Object.entries(e.validations).reduce((r,[n,o])=>(o!==null&&(r.$formIsInvalid=!0,Ge(r.$errors,n,[...o])),r),{$formIsInvalid:!1,$errors:{}})}function Oe(e){const t=fe(e.data);for(const[r,n]of Object.entries(e.widgetFlags))if(n.hidden===!0){const o=e.flatForm[r];o&&I(o)&&Cr(t,o.path)}return t}const ze=32;let Pe,h,y,$=e=>(h=0,y=e,$.newline=!1,e=v(),y[h]?z():e||""),z=(e="Unexpected token",t=h,r=y.slice(0,t).split(`
2
+ `),n=r.pop(),o=y.slice(Math.max(0,t-40),t),i="̭",s=(y[t]||" ")+i,u=y.slice(t+1,t+20))=>{throw SyntaxError(`${e} at ${r.length+1}:${n.length+1}
3
+ ${y[t-41]!==`
4
+ `,""+o}${s}${u}`)},wt=(e,t=h)=>(Array.isArray(e)&&(e.loc=t),e),q=(e,t=h,r)=>{for(;r=e(y.charCodeAt(h));)h+=r;return y.slice(t,h)},O=(e=1)=>y[h+=e],Ne=e=>h=e,v=(e=0,t)=>{let r,n,o,i,s;for(t&&$.asi&&($.newline=!1);(r=$.space())&&(s=$.newline,1)&&r!==t&&(o=(n&&r===91&&Pe&&$.asi?.(n,e,v)||null)??((i=j[r])&&i(n,e))??(n&&s&&$.asi?.(n,e,v))??(!n&&q($.id)));)n=o;return t&&(r==t?(h++,t===125&&$.asi&&($.newline=!0)):z("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},R=(e,t=h)=>{for(Pe=!1;(e=y.charCodeAt(h))<=ze;)$.asi&&e===10&&($.newline=Pe=!0),h++;return e},Ir=(e=h)=>{for(;y.charCodeAt(e)<=ze;)e++;return y.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 Dr=(e,t=e.length)=>y.substr(h,t)===e&&!$.id(y.charCodeAt(h+t)),j=[],ut={},F=(e,t=ze,r,n=e.charCodeAt(0),o=e.length,i=j[n],s=e.toUpperCase()!==e,u,c)=>(t=ut[e]=!i&&ut[e]||t,j[n]=(l,g,m,f=h)=>(u=m,(m?e==m:(o<2||e.charCodeAt(1)===y.charCodeAt(h+1)&&(o<3||y.substr(h,o)==e))&&(!s||!$.id(y.charCodeAt(h+o)))&&(u=m=e))&&g<t&&(h+=o,(c=r(l))?wt(c,f):(h=f,u=0,!s&&!i&&!l&&z()),c)||i?.(l,g,u))),S=(e,t,r=!1)=>F(e,t,n=>n&&(o=>o&&[e,n,o])(v(t-(r?.5:0)))),M=(e,t,r)=>F(e,t,n=>!n&&(n=v(t-.5))&&[e,n]),se=(e,t)=>F(e,200,r=>!r&&[,t]),Ot=(e,t,r)=>F(e,t,(n,o)=>(o=v(t-(r?.5:0)),n?.[0]!==e&&(n=[e,n||null]),o?.[0]===e?n.push(...o.slice(1)):n.push(o||null),n)),Xe=(e,t)=>F(e[0],t,r=>!r&&[e,v(0,e.charCodeAt(1))||null]),It=(e,t)=>F(e[0],t,r=>r&&[e,r,v(0,e.charCodeAt(1))||null]),de=(e,t,r,n=e.charCodeAt(0),o=e.length,i=j[n],s)=>j[n]=(u,c,l,g=h)=>!u&&(l?e==l:(o<2||y.substr(h,o)==e)&&(l=e))&&c<t&&!$.id(y.charCodeAt(h+o))&&(!$.prop||$.prop(h+o))&&(Ne(h+o),(s=r())?wt(s,g):Ne(g),s)||i?.(u,c,l);Object.defineProperty($,"space",{configurable:!0,enumerable:!0,get:()=>R,set:e=>R=e});const Ue={},a=(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))??z(`Unknown operator: ${e[0]}`,e?.loc):e===void 0?()=>{}:t=>t?.[e],pe=46,ee=48,he=57,Tr=69,kr=101,Fr=43,jr=45,le=95,Dt=110,Wr=97,Pr=102,Nr=65,Ur=70,Tt=e=>e.indexOf("_")<0?e:e.replaceAll("_",""),Je=e=>{let t=Tt(q(r=>r===pe&&y.charCodeAt(h+1)!==pe||r>=ee&&r<=he||r===le||((r===Tr||r===kr)&&((r=y.charCodeAt(h+1))>=ee&&r<=he||r===Fr||r===jr)?2:0)));return y.charCodeAt(h)===Dt?(O(),[,BigInt(t)]):(e=+t)!=e?z():[,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<=Pr||e>=Nr&&e<=Ur||e===le};$.number=null;j[pe]=e=>!e&&y.charCodeAt(h+1)!==pe&&Je();for(let e=ee;e<=he;e++)j[e]=t=>t?void 0:Je();j[ee]=e=>{if(e)return;const t=$.number;if(t){for(const[r,n]of Object.entries(t))if(r[0]==="0"&&y[h+1]?.toLowerCase()===r[1]){O(2);const o=Tt(q(_r[n]));return y.charCodeAt(h)===Dt?(O(),[,BigInt("0"+r[1]+o)]):[,parseInt(o,n)]}}return Je()};const Vr=92,ct=34,lt=39,Lr={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},kt=e=>(t,r,n="")=>{if(!(t||!$.string?.[String.fromCharCode(e)]))return O(),q(o=>o-e&&(o===Vr?(n+=Lr[y[h+1]]||y[h+1],2):(n+=y[h],1))),y[h]===String.fromCharCode(e)?O():z("Bad string"),[,n]};j[ct]=kt(ct);j[lt]=kt(lt);$.string={'"':!0};const Rr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(e=>S(e,Rr,!0));const Ft=(e,t,r,n)=>typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):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)a(e,(t,r)=>(r=d(r),Ft(t,(n,o,i)=>at[e](n,o,r(i)))));const Mr=30,Br=40,Hr=140;M("!",Hr);S("||",Mr);S("&&",Br);a("!",e=>(e=d(e),t=>!e(t)));a("||",(e,t)=>(e=d(e),t=d(t),r=>e(r)||t(r)));a("&&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&&t(r)));const Gr=50,br=60,Kr=70,jt=100,zr=140;S("|",Gr);S("&",Kr);S("^",br);S(">>",jt);S("<<",jt);M("~",zr);a("~",e=>(e=d(e),t=>~e(t)));a("|",(e,t)=>(e=d(e),t=d(t),r=>e(r)|t(r)));a("&",(e,t)=>(e=d(e),t=d(t),r=>e(r)&t(r)));a("^",(e,t)=>(e=d(e),t=d(t),r=>e(r)^t(r)));a(">>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>t(r)));a("<<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<<t(r)));const Ce=90;S("<",Ce);S(">",Ce);S("<=",Ce);S(">=",Ce);a(">",(e,t)=>(e=d(e),t=d(t),r=>e(r)>t(r)));a("<",(e,t)=>(e=d(e),t=d(t),r=>e(r)<t(r)));a(">=",(e,t)=>(e=d(e),t=d(t),r=>e(r)>=t(r)));a("<=",(e,t)=>(e=d(e),t=d(t),r=>e(r)<=t(r)));const Wt=80;S("==",Wt);S("!=",Wt);a("==",(e,t)=>(e=d(e),t=d(t),r=>e(r)==t(r)));a("!=",(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);a("+",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)+t(r)):(e=d(e),r=>+e(r)));a("-",(e,t)=>t!==void 0?(e=d(e),t=d(t),r=>e(r)-t(r)):(e=d(e),r=>-e(r)));a("*",(e,t)=>(e=d(e),t=d(t),r=>e(r)*t(r)));a("/",(e,t)=>(e=d(e),t=d(t),r=>e(r)/t(r)));a("%",(e,t)=>(e=d(e),t=d(t),r=>e(r)%t(r)));const me=150;F("++",me,e=>e?["++",e,null]:["++",v(me-1)]);F("--",me,e=>e?["--",e,null]:["--",v(me-1)]);const qe=(e,t,r,n)=>typeof e=="string"?o=>t(o,e):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n)):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o))):e[0]==="()"&&e.length===2?qe(e[1],t):(()=>{throw Error("Invalid increment target")})();a("++",(e,t)=>qe(e,t===null?(r,n)=>r[n]++:(r,n)=>++r[n]));a("--",(e,t)=>qe(e,t===null?(r,n)=>r[n]--:(r,n)=>--r[n]));const Xr=5,Jr=10;Ot(",",Jr);Ot(";",Xr,!0);const Ut=(...e)=>(e=e.map(d),t=>{let r;for(const n of e)r=n(t);return r});a(",",Ut);a(";",Ut);const Qr=170;Xe("()",Qr);const L=e=>e?.[0]==="_"&&e[1]==="_"||e==="constructor"||e==="prototype",xe=170;It("[]",xe);S(".",xe);It("()",xe);const ge=e=>{throw Error(e)};a("[]",(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]}));a(".",(e,t)=>(e=d(e),t=t[0]?t:t[1],L(t)?()=>{}:r=>e(r)[t]));a("()",(e,t)=>{if(t===void 0)return e==null?ge("Empty ()"):d(e);const r=o=>o?.[0]===","&&o.slice(1).some(i=>i==null||r(i));r(t)&&ge("Empty argument");const n=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];return Ze(e,(o,i,s)=>o[i](...n(s)))});const X=e=>typeof e=="string"||Array.isArray(e)&&(e[0]==="."||e[0]==="?."||e[0]==="[]"&&e.length===3||e[0]==="?.[]"||e[0]==="()"&&e.length===2&&X(e[1])||e[0]==="{}"),Ze=(e,t,r,n)=>e==null?ge("Empty ()"):e[0]==="()"&&e.length==2?Ze(e[1],t):typeof e=="string"?o=>t(o,e,o):e[0]==="."?(r=d(e[1]),n=e[2],o=>t(r(o),n,o)):e[0]==="?."?(r=d(e[1]),n=e[2],o=>{const i=r(o);return i==null?void 0:t(i,n,o)}):e[0]==="[]"&&e.length===3?(r=d(e[1]),n=d(e[2]),o=>t(r(o),n(o),o)):e[0]==="?.[]"?(r=d(e[1]),n=d(e[2]),o=>{const i=r(o);return i==null?void 0:t(i,n(o),o)}):(e=d(e),o=>t([e(o)],0,o)),x=Ze,qr=32,xr=$.space;$.comment??={"//":`
6
+ `,"/*":"*/"};let Ie;$.space=()=>{Ie||(Ie=Object.entries($.comment).map(([o,i])=>[o,i,o.charCodeAt(0)]));for(var e;e=xr();){for(var t=0,r;r=Ie[t++];)if(e===r[2]&&y.substr(h,r[0].length)===r[0]){var n=h+r[0].length;if(r[1]===`
7
+ `)for(;y.charCodeAt(n)>=qr;)n++;else{for(;y[n]&&y.substr(n,r[1].length)!==r[1];)n++;y[n]&&(n+=r[1].length)}Ne(n),e=0;break}if(e)return e}return e};const _t=80;S("===",_t);S("!==",_t);a("===",(e,t)=>(e=d(e),t=d(t),r=>e(r)===t(r)));a("!==",(e,t)=>(e=d(e),t=d(t),r=>e(r)!==t(r)));const Zr=30;S("??",Zr);a("??",(e,t)=>(e=d(e),t=d(t),r=>e(r)??t(r)));const Yr=130,en=20;S("**",Yr,!0);S("**=",en,!0);a("**",(e,t)=>(e=d(e),t=d(t),r=>e(r)**t(r)));const tn=e=>{throw Error(e)};a("**=",(e,t)=>(X(e)||tn("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]**=t(o))));const Vt=90;S("in",Vt);S("of",Vt);a("in",(e,t)=>(e=d(e),t=d(t),r=>e(r)in t(r)));const rn=20,nn=100,on=e=>{throw Error(e)};S(">>>",nn);S(">>>=",rn,!0);a(">>>",(e,t)=>(e=d(e),t=d(t),r=>e(r)>>>t(r)));a(">>>=",(e,t)=>(X(e)||on("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]>>>=t(o))));const Ye=5,sn=10,dn=20,un=e=>e[0]?.[0]===","?e[0].slice(1):e,ye=(e,t,r)=>{if(typeof e=="string"){r[e]=t;return}const[n,...o]=e,i=un(o);if(n==="{}"){const s=[];for(const u of i){if(Array.isArray(u)&&u[0]==="..."){const f={};for(const T in t)s.includes(T)||(f[T]=t[T]);r[u[1]]=f;break}let c,l,g;typeof u=="string"?c=l=u:u[0]==="="?(typeof u[1]=="string"?c=l=u[1]:[,c,l]=u[1],g=u[2]):[,c,l]=u,s.push(c);let m=t[c];m===void 0&&g&&(m=d(g)(r)),ye(l,m,r)}}else if(n==="[]"){let s=0;for(const u of i){if(u===null){s++;continue}if(Array.isArray(u)&&u[0]==="..."){r[u[1]]=t.slice(s);break}let c=u,l;Array.isArray(u)&&u[0]==="="&&([,c,l]=u);let g=t[s++];g===void 0&&l&&(g=d(l)(r)),ye(c,g,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",Ye+1,()=>Lt("let"));de("const",Ye+1,()=>Lt("const"));de("var",Ye,()=>(R(),["var",v(dn)]));const Rt=(...e)=>(e=e.map(t=>{if(typeof t=="string")return r=>{r[t]=void 0};if(t[0]==="="){const[,r,n]=t,o=d(n);return typeof r=="string"?i=>{i[r]=o(i)}:i=>ye(r,o(i),i)}return d(t)}),t=>{for(const r of e)r(t)});a("let",Rt);a("const",Rt);a("var",e=>typeof e=="string"?t=>{t[e]=void 0}:()=>{});const et=20,we=e=>{throw Error(e)};S("||=",et,!0);S("&&=",et,!0);S("??=",et,!0);a("=",(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=>ye(r,t(n),n)}return X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]=t(o))});a("||=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]||=t(o))));a("&&=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]&&=t(o))));a("??=",(e,t)=>(X(e)||we("Invalid assignment target"),t=d(t),x(e,(r,n,o)=>r[n]??=t(o))));se("true",!0);se("false",!1);se("null",null);de("undefined",200,()=>[]);se("NaN",NaN);se("Infinity",1/0);const De=20;F("?",De,(e,t,r)=>e&&(t=v(De-1))&&q(n=>n===58)&&(r=v(De-1),["?",e,t,r]));a("?",(e,t,r)=>(e=d(e),t=d(t),r=d(r),n=>e(n)?t(n):r(n)));const cn=[],ln=20;S("=>",ln,!0);a("=>",(e,t)=>{e=e?.[0]==="()"?e[1]:e;const r=e?e[0]===","?e.slice(1):[e]:[];let n=-1,o=null;const i=r[r.length-1];Array.isArray(i)&&i[0]==="..."&&(n=r.length-1,o=i[1],r.length--);const s=t?.[0]==="{}";return t=d(s?["{",t[1]]:t),u=>(...c)=>{const l={};r.forEach((m,f)=>l[m]=c[f]),o&&(l[o]=c.slice(n));const g=new Proxy(l,{get:(m,f)=>f in m?m[f]:u?.[f],set:(m,f,T)=>((f in m?m:u)[f]=T,!0),has:(m,f)=>f in m||(u?f in u:!1)});try{const m=t(g);return s?void 0:m}catch(m){if(m===cn)return m[0];throw m}}});const an=140;M("...",an);a("...",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?(O(),["?.()",e,v(0,41)||null]):r===91?(O(),["?.[]",e,v(0,93)]):(t=v(ft),t?["?.",e,t]:void 0)});a("?.",(e,t)=>(e=d(e),L(t)?()=>{}:r=>e(r)?.[t]));a("?.[]",(e,t)=>(e=d(e),t=d(t),r=>{const n=t(r);return L(n)?void 0:e(r)?.[n]}));a("?.()",(e,t)=>{const r=t?t[0]===","?(t=t.slice(1).map(d),o=>t.map(i=>i(o))):(t=d(t),o=>[t(o)]):()=>[];if(e[0]==="?."){const o=d(e[1]),i=e[2];return L(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="?.[]"){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return L(c)?void 0:u?.[c]?.(...r(s))}}if(e[0]==="."){const o=d(e[1]),i=e[2];return L(i)?()=>{}:s=>o(s)?.[i]?.(...r(s))}if(e[0]==="[]"&&e.length===3){const o=d(e[1]),i=d(e[2]);return s=>{const u=o(s),c=i(s);return L(c)?void 0:u?.[c]?.(...r(s))}}const n=d(e);return o=>n(o)?.(...r(o))});const te=140;M("typeof",te);M("void",te);M("delete",te);de("new",te,()=>Dr(".target")?(O(7),["new.target"]):["new",v(te)]);a("typeof",e=>(e=d(e),t=>typeof e(t)));a("void",e=>(e=d(e),t=>(e(t),void 0)));a("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});a("new",e=>{const t=d(e?.[0]==="()"?e[1]:e),r=e?.[0]==="()"?e[2]:null,n=r?r[0]===","?(o=>i=>o.map(s=>s(i)))(r.slice(1).map(d)):(o=>i=>[o(i)])(d(r)):()=>[];return o=>new(t(o))(...n(o))});const tt=Symbol("accessor"),rt=20,fn=40,Mt=41,Bt=123,Ht=125,Gt=e=>t=>{if(t)return;R();const r=q($.id);if(!r||(R(),y.charCodeAt(h)!==fn))return!1;O();const n=v(0,Mt);return R(),y.charCodeAt(h)!==Bt?!1:(O(),[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(),y.charCodeAt(h)===Bt)return O(),[":",e,["=>",["()",t],v(0,Ht)||null]]});a("get",(e,t)=>(t=t?d(t):()=>{},r=>[[tt,e,{get:function(){const n=Object.create(r||{});return n.this=this,t(n)}}]]));a("set",(e,t,r)=>(r=r?d(r):()=>{},n=>[[tt,e,{set:function(o){const i=Object.create(n||{});i.this=this,i[t]=o,r(i)}}]]));const pn=20,bt=200;$.prop=e=>Ir(e)!==58;const hn=e=>e==null||typeof e=="string"||[":",",","...","get","set"].includes(e[0]);Xe("[]",bt);Xe("{}",bt);S(":",pn-1,!0);a("{}",(e,t)=>{if(t!==void 0)return;if(!hn(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 o={},i={};for(const s of r.flatMap(u=>u(n)))if(s[0]===tt){const[,u,c]=s;i[u]={...i[u],...c,configurable:!0,enumerable:!0}}else o[s[0]]=s[1];for(const s in i)Object.defineProperty(o,s,i[s]);return o}});a("{",e=>(e=e?d(e):()=>{},t=>e(Object.create(t))));a(":",(e,t)=>(t=d(t),Array.isArray(e)?(e=d(e),r=>[[e(r),t(r)]]):r=>[[e,t(r)]]));const mn=170,Ae=96,gn=36,yn=123,An=92,$n={n:`
8
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},pt=()=>{const e=[];for(let t="",r;(r=y.charCodeAt(h))!==Ae;)r?r===An?(O(),t+=$n[y[h]]||y[h],O()):r===gn&&y.charCodeAt(h+1)===yn?(t&&e.push([,t]),t="",O(2),e.push(v(0,125))):(t+=y[h],O(),r=y.charCodeAt(h),r===Ae&&t&&e.push([,t])):z("Unterminated template");return O(),e},Sn=j[Ae];j[Ae]=(e,t)=>e&&t<mn?$.asi&&$.newline?void 0:(O(),["``",e,...pt()]):e?Sn?.(e,t):(O(),(r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r])(pt()));a("`",(...e)=>(e=e.map(d),t=>e.map(r=>r(t)).join("")));a("``",(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 o=Object.assign([...r],{raw:r});return i=>e(i)(o,...n.map(s=>s(i)))});$.string["'"]=!0;$.number={"0x":16,"0b":2,"0o":8};const vn={log:(e,t)=>(t?console.log(t,e):console.log(e),e)};function N(e,t,r,n,o){const i=$(nt(e));return d(i)({$form:t,$meta:r,$errors:n,$formIsInvalid:o,$log:vn.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}=Ke(e);t=En(t);let o=[],i={status:"ok"};try{o=Object.keys(t).map(s=>{const u=t[s];let c;try{c=N(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=b.calculateCurrentStateError;i={status:"errored",message:`[${c}] ${u.message}`,code:c}}return{...e,currentStates:o,formHealth:i}};function En(e){const t={};function r(n){const o=n.split(":"),i=[];for(let s=0;s<o.length;s++)i.push(o.slice(0,s+1).join(":"));return i}for(const[n,o]of Object.entries(e)){const i=r(n),s=[];for(const u of i)e[u]&&s.push(`(${e[u]})`);t[n]=s.join(" && ")}return t}const ot=Symbol("filterMap.skip");function Kt(e,t){const r=[];for(let n=0;n<e.length;n++){const o=t(e[n],n,e);o!==ot&&r.push(o)}return r}function Cn(e,t,r){for(let n=0;n<e.length;n++)t(e[n],n,e)&&r(e[n],n,e)}function wn(e,t,r,n){let o=n;for(let i=0;i<e.length;i++)t(e[i],i,e)&&(o=r(o,e[i],i,e));return o}function On(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 zt(e,t){const r=Xt(e.uid,t);return I(e)?{...e,uid:r,path:In(e.path,t)}:{...e,uid:r}}function Xt(e,t){if(t.length===0)throw new Error("Repeater indexes cannot be an empty array");const r=t.reduce((n,o)=>`${n}[${o}]`,"");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}`),o=n.length-1;if(o!==t.length)throw new Error(`Path contains ${o} '${r}' occurrences, but ${t.length} indexes were provided.`);return n.reduce((i,s,u)=>u===0?s:`${i}.${t[u-1]}${s}`)}function ue(e,t){let r=0;return e.replace(/\.items(\??)\./g,(n,o)=>{const i=t[r++];return i===void 0?n:`.${i}${o}.`})}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}=Ke(e);return{...e,widgetFlags:{...Dn(e,r,t),...Tn(e,r,t)}}};function Dn(e,t,r){return Kt(Object.values(e.flatForm),n=>{if(n.uid?.includes("["))return ot;if(oe(n)){const o=n({$form:e.data,errors:void 0,touched:void 0,translate:void 0});return o.uid=n.uid,o}return n}).filter(n=>!!(n.include&&("in"in n.include||"when"in n.include)||n.exclude&&("from"in n.exclude||"when"in n.exclude)||(I(n)||Y(n))&&H(n.disabled)||I(n)&&H(n.readonly))).reduce((n,o)=>(n[o.uid]=n[o.uid]||{},o.include&&"in"in o.include?n[o.uid].hidden=!o.include.in.some(i=>e.currentStates.includes(i)):o.include&&"when"in o.include&&(n[o.uid].hidden=!N(o.include.when,e.data,e.meta,t,r)),o.exclude&&"from"in o.exclude?n[o.uid].hidden=o.exclude.from.some(i=>e.currentStates.includes(i)):o.exclude&&"when"in o.exclude&&(n[o.uid].hidden=N(o.exclude.when,e.data,e.meta,t,r)),(I(o)||Y(o))&&H(o.disabled)&&(n[o.uid].disabled=N(o.disabled.when,e.data,e.meta,t,r)),I(o)&&H(o.readonly)&&(n[o.uid].readonly=N(o.readonly.when,e.data,e.meta,t,r)),n),{})}function Tn(e,t,r){return wn(Object.values(e.flatForm),n=>!oe(n)&&n.type==="repeater",(n,o)=>({...n,...Jt(e,o,[],t,r)}),{})}function Jt(e,t,r,n,o){const i=t.props.template,s=ie(e.data,t.path);if(!Array.isArray(s))return{};const u={};return s.forEach((c,l)=>{const g=[...r,l];be([i]).forEach(m=>{let f;if(oe(m)?(f=m({$form:e.data,errors:void 0,touched:void 0,translate:void 0}),f.uid=m.uid):f=m,f.type==="repeater"){const Z=zt(f,g);Object.assign(u,Jt(e,Z,g,n,o));return}const T=Xt(f.uid,g);u[T]=u[T]||{},f.include&&"in"in f.include?u[T].hidden=!f.include.in.some(Z=>e.currentStates.includes(Z)):f.include&&"when"in f.include&&(u[T].hidden=!N(ue(f.include.when,g),e.data,e.meta,n,o)),f.exclude&&"from"in f.exclude?u[T].hidden=f.exclude.from.some(Z=>e.currentStates.includes(Z)):f.exclude&&"when"in f.exclude&&(u[T].hidden=N(ue(f.exclude.when,g),e.data,e.meta,n,o)),(I(f)||Y(f))&&H(f.disabled)&&(u[T].disabled=N(ue(f.disabled.when,g),e.data,e.meta,n,o)),I(f)&&H(f.readonly)&&(u[T].readonly=N(ue(f.readonly.when,g),e.data,e.meta,n,o))})}),u}const P=e=>t=>{try{return{...t,calculatedWidgets:kn(t,e)}}catch(r){const n=r;return{...t,formHealth:{status:"errored",message:`[${n.code}] ${n.message}`,code:n.code}}}};function kn(e,t){const{$formIsInvalid:r,$errors:n}=Ke(e),o=Jn(e,t,r,n),i={};for(const s of Object.keys(e.calculatedWidgets)){if(e.widgetFlags[s]?.hidden)continue;const u=e.calculatedWidgets[s],c=u.source;if(oe(c)){i[s]=Fn(s,c,e,t);continue}i[s]=jn(u,c,e,o)}return i}function Fn(e,t,r,n){const o=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 o.uid=e,{source:t,current:o}}function jn(e,t,r,n){const o=new Xn(t,e.current);return o.write("uid",t.uid),o.write("type",t.type),o.write("kind",t.kind),ur(t)?Wn(o,n):Y(t)?Pn(o,n):I(t)?Nn(o,n):ae(t)&&Un(o,n),_n(t,o,n,r),(Y(t)||I(t))&&Vn(t,o,n),ae(t)&&Ln(t,o,r),o.changed?{source:e.source,current:o.current}:e}function Wn(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}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,"actionType")}function Nn(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 Un(e,t){E(e,t,"size"),E(e,t,"include"),E(e,t,"exclude")}function _n(e,t,r,n){const o=n.widgetPropOverrides[e.uid]??{},i={...e.props??{},...o};for(const s of xt(Object.keys(i)))Rn(t,r,s)}function Vn(e,t,r){const n=e.on??{};for(const o of xt(Object.keys(n)))Mn(t,r,o)}function Ln(e,t,r){const n=xn(e.uid),o=qn(e.children,n,r.widgetFlags);t.current.children=o;const i=t.previous.children??[];i.length===o.length&&o.every((u,c)=>i[c]&&i[c].uid===o[c].uid)||t.markChanged()}function E(e,t,r){const n=e.source;if(!Qn(n,r))return;const o=st(n,r,t.sortedStates);let i;switch(r){case"disabled":case"readonly":i=Gn(o,t,e.source.uid,r);break;case"defaultValue":i=o;break;default:i=qt(o,t)}e.write(r,i)}function Rn(e,t,r){const n=e.source.props,o=st(n,r,t.sortedStates);let i=qt(o,t);const s=t.widgetPropOverrides[e.source.uid]?.[r];s!==void 0&&(i=s),e.write(`props.${r}`,i)}function Mn(e,t,r){const n=e.source.on,o=st(n,r,t.sortedStates);e.write(`on.${r}`,bn(o,t))}function it(e,t){return e({$form:t.$form,translate:t.localization.translate})}function Bn(e,t){return t.localization.translate(e.key,zn(e.params,t),e.default)}const Hn=/\{\{([^}]+)\}\}/g;function Qt(e,t){return e.includes("{{")?e.replace(Hn,(r,n)=>{const o=nt(n.trim());try{const i=d($(o))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});return i==null?"":String(i)}catch(i){const s=i instanceof Error?i.message:String(i);throw new Zt(`Failed to evaluate '{{${n.trim()}}}': ${s}`)}}):e}function qt(e,t){return typeof e=="function"?it(e,t):$r(e)?Bn(e,t):typeof e=="string"?Qt(e,t):e}function Gn(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 bn(e,t){return typeof e=="function"?it(e,t):e}function st(e,t,r){if(e){for(const n of r){const o=e[`${t}.${n}`];if(o!==void 0)return o}return e[t]}}function Kn(e){return e.startsWith("$form")||e.startsWith("$meta")||e.startsWith("$errors")||e==="$formIsInvalid"}function zn(e,t){return e&&Object.keys(e).reduce((r,n)=>{const o=String(e[n]);if(Kn(o))try{const i=d($(nt(o)))({$form:t.$form,$meta:t.$meta,$errors:t.$errors,$formIsInvalid:t.$formIsInvalid});r[n]=i??o}catch(i){const s=i instanceof Error?i.message:String(i);throw new Zt(`Failed to evaluate i18n param '${o}': ${s}`)}else r[n]=o;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){Ge(this.current,t,r),ie(this.previous,t)!==r&&(this._changed=!0)}}function Jn(e,t,r,n){return{sortedStates:[...e.currentStates].sort((o,i)=>i.length-o.length),widgetPropOverrides:e.widgetPropOverrides,widgetFlags:e.widgetFlags,$form:e.data,$meta:e.meta,$formIsInvalid:r,$errors:n,localization:t}}function Qn(e,t){if(t in e)return!0;const r=`${t}.`;return Object.keys(e).some(n=>n.startsWith(r))}function xt(e){return Array.from(new Set(e.map(t=>t.split(".")[0])))}function qn(e,t,r){const n=t.map(o=>`[${o}]`).join("");return e.filter(o=>{const i=o.uid+n,s=r[i];return!s||s.hidden!==!0})}const xn=e=>[...e.matchAll(/\[(\d+)\]/g)].map(t=>parseInt(t[1],10));class Zt extends Error{constructor(){super(...arguments),this.code=b.resolveStringInterpolationError,this.name="StringInterpolationError"}}const Zn=({lang:e},t)=>{const r={...Et(e),formName:t.payload.formName};let n=t.payload.formDef,o={status:"ok"};if(typeof n=="string"){try{n=JSON.parse(n)}catch(l){const g=l,m=b.initializeParseError;o={status:"errored",message:`[${m}] ${g.message}`,code:m}}if(o.status==="errored")return{...r,formHealth:o}}if(Array.isArray(n.form)){const l=n,g=l.form;l.form={uid:"",type:"flex",kind:"layout",children:g}}const i=vt.decode(n);if(i.isOk()){o={status:"ok"};let l={};try{l=be([i.value.form]).reduce((g,m)=>{const f=m.uid;if(g[f])throw{existingWidget:g[f],newWidget:m};return g[f]=m,g},{})}catch(g){o=to(g.existingWidget,g.newWidget),l={}}return ro(l,i.value.states),{...r,formDef:i.value,flatForm:l,formHealth:o}}const s=eo(n);if(s)return{...r,formHealth:s};const u=b.initializeUnknownError,c=i.issues.map(l=>`${l.path.length>0?At(l.path):"root"}: ${l.message}`).join("; ");return{...r,formHealth:{status:"errored",message:`[${u}] ${c}`,code:u}}};function Yt(e,t){return{status:"errored",code:e,message:`[${e}] ${t}`}}function Yn(){return"Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`."}function eo(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.form;return t&&typeof t=="object"&&!Array.isArray(t)&&!ae(t)?Yt(b.initializeMalformedFormShapeError,Yn()):null}function to(e,t){const r=o=>I(o)?` at "${o.path}"`:"",n=`Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;return Yt(b.initializeUidCollisionError,n)}function ro(e,t){const r=new Set(Object.keys(t??{})),n=new Map;for(const i of Object.values(e)){const s=[],u=i.include;u&&Array.isArray(u.in)&&s.push(...u.in);const c=i.exclude;c&&Array.isArray(c.from)&&s.push(...c.from);for(const l of s){if(r.has(l))continue;const g=n.get(l)??[];g.push(i.uid||"(unknown)"),n.set(l,g)}}if(n.size===0)return;const o=r.size?[...r].join(", "):"(none declared)";for(const[i,s]of n)console.error(`[GolemUI] include/exclude references undefined state "${i}" (on ${s.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${i}" in formConfig.states, or correct the name.`)}function no(e,t){return{...e,injectedValidations:{...e.injectedValidations,[t.payload.path]:t.payload.issues}}}const oo=(e,{payload:t})=>{let r;if("path"in t){if(r=Object.values(e.calculatedWidgets).find(({source:i})=>I(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,o=e.widgetPropOverrides[n]||{};return{...e,widgetPropOverrides:{...e.widgetPropOverrides,[n]:{...o,[t.prop]:t.value}}}};function io(e,t){return W(e,so(t),uo(t),co(t),lo(t))}const so=e=>t=>({...t,widgetFlags:{...Ee(t.widgetFlags,e.payload.uid)}}),uo=e=>t=>({...t,calculatedWidgets:{...Ee(t.calculatedWidgets,e.payload.uid)}}),co=e=>t=>({...t,widgetPropOverrides:{...Ee(t.widgetPropOverrides,e.payload.uid)}}),lo=e=>t=>({...t,touchedControls:W(t.touchedControls,r=>{const n=t.flatForm[e.payload.uid];return n&&I(n)?Ee(r,n.path):r})}),ao=(e,t)=>({...e,data:{...t.payload.data}}),fo=(e,t)=>({...e,formHealth:t.payload.formHealth}),po=(e,t)=>({...e,lang:t.payload.lang}),ho=(e,t)=>({...e,meta:{...t.payload.meta}}),mo=(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},Te=(e,t)=>r=>{const n=Kt(Object.values(r.calculatedWidgets),({current:i})=>I(i)?i:ot),o=r.validations;return{...r,validations:n.reduce((i,s)=>{if(i[s.path]=null,s.validator){const u=e(s.validator,t),c=ie(r.data,s.path),l=mt(u,c);i[s.path]=gt(l)?null:l.issues.map(g=>g.message)}return Array.isArray(i[s.path])&&Array.isArray(o[s.path])&&On(i[s.path],o[s.path],(u,c)=>u===c)&&(i[s.path]=o[s.path]),i},{})}},go=({validators:e,validateOn:t,localization:r})=>(n,o)=>{switch(o.type){case"INITIALIZE":return Zn(n,o);case"SET_DATA":return W(ao(n,o),U,_,P(r));case"SET_META":return W(ho(n,o),U,_,P(r));case"SET_LANGUAGE":return W(po(n,o),P(r));case"ADD_WIDGET":return W(Er(n,o),ce(ke,U),ce(ke,_),ce(ke,P(r)));case"REMOVE_WIDGET":return W(io(n,o),U,_,P(r));case"SET_WIDGET_INITIAL_DATA":case"SET_WIDGET_DATA":return W(mo(n,o),U,_,P(r));case"OVERRIDE_WIDGET_PROP":return W(oo(n,o),U,_,P(r),ce(i=>{let s=!1,u="";"path"in o.payload?(s=!0,u=o.payload.path):I(i.calculatedWidgets[o.payload.uid].current)&&(s=!0,u=i.calculatedWidgets[o.payload.uid].current.path);const c=s&&i.touchedControls[u];return i.touched&&c},Te(e,r)));case"SET_FORM_HEALTH":return fo(n,o);case"VALIDATE_ALL":return W({...n,touched:!0,touchedControls:Object.keys(n.calculatedWidgets).reduce((i,s)=>{const u=n.calculatedWidgets[s].source;return I(u)&&(i[u.path]=!0),i},{})},Te(e,r),U,_,P(r),ht);case"ATTEMPT_VALIDATION":{const i=o.payload.reason,s=o.payload.path;return t==="eager"||i===t||t.includes(i)?W({...n,touched:!0,touchedControls:{...n.touchedControls,[s]:!0}},Te(e,r),U,_,P(r),c=>{const l=o.payload.uid,g=c.calculatedWidgets[l],m=g.source;if(oe(m)){const f=m({$form:c.data,errors:c.validations[s],touched:!0,translate:r.translate});return{...c,calculatedWidgets:{...c.calculatedWidgets,[l]:{source:g.source,current:f}}}}return c},ht):n}case"INJECT_VALIDATION_ISSUES":return no(n,o);default:return vr(o)}},ke=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(o=>e.injectedValidations[o]!==null&&Array.isArray(e.injectedValidations[o]));return n!==void 0?{...e,isFormValid:!1}:(n=r.find(o=>e.validations[o]!==null&&Array.isArray(e.validations[o])),n!==void 0?{...e,isFormValid:!1}:{...e,isFormValid:!0})}function yo(e=[],t,r,n){const o=new p.BehaviorSubject(Et(n.lang)),i=o.asObservable().pipe(p.distinctUntilChanged()),s=go({validators:t,validateOn:r,localization:n});function u(m){const f=o.getValue(),T=s(f,m);o.next(T)}let c=u;const l={getState:()=>o.getValue(),dispatch:m=>c(m)};return c=e.map(m=>m(l)).reduceRight((m,f)=>f(m),u),{state$:i,dispatch:c,getState:()=>o.getValue()}}class Ao{constructor(){this.widgetRegistry=new We,this.store={},this.events$=new p.Subject,this.submit$=new p.Subject,this.uuid=crypto.randomUUID(),this.itemRenderers={},this.dependencies={}}initialize(t,r=[],n,o,i,s=Ct(),u){this.localization=s,this.dependencies=u,this.widgetRegistry.setWidgetLoaders(t),this.itemRenderers=i,this.store=yo(r,n,o,s)}emitEvent(t,r,n){const i=this.store.getState().currentStates.filter(s=>r.on?.[`${t}.${s}`]!==void 0);if(i.length>0)i.forEach(s=>{const u=r.on?.[`${t}.${s}`];this.attemptValidation(t,r),u&&this.events$.next({name:u,data:Oe(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:Oe(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:Oe(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 $o(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()),o=>i=>{o(i),n&&n.send(i,t.getState())}}}const So=p.pipe(p.map(e=>e.data),p.distinctUntilChanged()),vo=e=>p.pipe(So,p.map(t=>ie(t,e)),p.distinctUntilChanged()),Eo=p.pipe(p.filter(e=>e.touched===!0),p.map(e=>e.validations),p.distinctUntilChanged()),Co=e=>p.pipe(Eo,p.map(t=>t[e]),p.distinctUntilChanged()),wo=p.pipe(p.filter(e=>e.touched===!0),p.map(e=>e.injectedValidations),p.distinctUntilChanged()),Oo=e=>p.pipe(wo,p.map(t=>t[e]),p.distinctUntilChanged(),p.startWith(null)),Io=p.pipe(p.map(e=>e.lang),p.distinctUntilChanged()),er=p.pipe(p.map(e=>e.calculatedWidgets),p.distinctUntilChanged()),Do=e=>t=>p.combineLatest([t.pipe(Io),t.pipe(er)]).pipe(p.map(([r,n])=>({lang:r,widget:n[e]})),p.filter(r=>r.widget!==void 0),p.distinctUntilChanged((r,n)=>r.lang===n.lang&&r.widget===n.widget),p.map(r=>r.widget.current)),To=e=>p.pipe(er,p.map(t=>t[e]),p.filter(t=>t!==void 0),p.map(t=>t.current.children),p.distinctUntilChanged());p.pipe(p.map(e=>e.widgetFlags),p.distinctUntilChanged());const ko=p.pipe(p.map(e=>e.touchedControls),p.distinctUntilChanged()),Fo=e=>p.pipe(ko,p.map(t=>t[e]),p.distinctUntilChanged()),jo=p.pipe(p.map(e=>e.formHealth),p.distinctUntilChanged((e,t)=>e.status!==t.status?!1:e.status==="errored"&&t.status==="errored"?e.message===t.message&&e.code===t.code:!0)),Wo=e=>e.pipe(jo);let tr=!1;function Po(){tr=!0}function No(){return tr}function Uo(e,t,r){if(!No())return;const n=Object.keys(t??{}).filter(o=>o in r);if(n.length>0)throw new Error(`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`)}exports.FormContext=Ao;exports.assertNoPropCollisions=Uo;exports.calculatedLayoutChildrenByUid$=To;exports.calculatedWidgetsByUid$=Do;exports.cloneObject=fe;exports.dataByPath$=vo;exports.defineForm=Ar;exports.devToolsMiddleware=$o;exports.enableDevMode=Po;exports.errorCodes=b;exports.filterTap=Cn;exports.formHealth=Wo;exports.getDirectionFromLanguage=Sr;exports.identityTranslator=Ct;exports.injectedValidationByPath$=Oo;exports.isStandardValidateSuccess=gt;exports.makeRepeaterItemConfig=zt;exports.shortUUID=Le;exports.standardValidate=mt;exports.touchedControlsByPath$=Fo;exports.validationByPath$=Co;
package/lib/errors.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const errorCodes: {
6
6
  initializeParseError: number;
7
7
  initializeUidCollisionError: number;
8
8
  initializeUnknownError: number;
9
+ initializeMalformedFormShapeError: number;
9
10
  widgetCouldNotBeLoaded: number;
10
11
  resolveStringInterpolationError: number;
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@golemui/core",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.4",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "main": "./index.umd.cjs",
6
7
  "module": "./index.js",