@fieldia/viewer 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/fieldia.js +40 -34
- package/bundle/fieldia.js.map +4 -4
- package/package.json +3 -3
- package/src/lib/viewer.d.mts +3 -1
- package/src/lib/viewer.d.ts +3 -1
- package/src/lib/viewer.js +7 -2
- package/src/lib/viewer.js.map +1 -1
- package/src/lib/viewer.mjs +8 -3
- package/src/lib/viewer.mjs.map +1 -1
package/bundle/fieldia.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/*! Fieldia 0.
|
|
2
|
-
"use strict";var Fieldia=(()=>{var rr=Object.defineProperty;var Qu=Object.getOwnPropertyDescriptor;var el=Object.getOwnPropertyNames;var tl=Object.prototype.hasOwnProperty;var rl=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var jo=(e,t)=>{for(var r in t)rr(e,r,{get:t[r],enumerable:!0})},nl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of el(t))!tl.call(e,o)&&o!==r&&rr(e,o,{get:()=>t[o],enumerable:!(n=Qu(t,o))||n.enumerable});return e};var ol=e=>nl(rr({},"__esModule",{value:!0}),e);var ot=(e,t,r)=>rl(e,typeof t!="symbol"?t+"":t,r);var Ep={};jo(Ep,{DEFAULT_LABELS:()=>kp,FIELDIA_CSS:()=>Xu,FIELD_NAME:()=>Ye,FIELD_TYPES:()=>uu,FORMAT_VERSION:()=>ko,FieldSchema:()=>wo,FieldsSchema:()=>Fr,FilterConditionSchema:()=>xo,LayoutNodeSchema:()=>lt,LineFieldSchema:()=>_o,MESSAGES:()=>Qe,ModifierSchema:()=>Wt,OptionSchema:()=>Lr,PageSchema:()=>zt,RootLayoutSchema:()=>Cr,VERSION:()=>Sp,VIEWER_LABELS:()=>Do,WIDGET_LABELS:()=>we,binaryWidget:()=>Ro,builtInWidgets:()=>Gu,checkValue:()=>qt,compileModifier:()=>Xe,createForm:()=>Ur,createMemoryDataSource:()=>Vu,createWidget:()=>Xt,emptyValue:()=>Eo,evaluateModifier:()=>Fu,expressionContext:()=>Kt,fill:()=>jr,formatBytes:()=>Gt,hostScheduler:()=>Yt,htmlWidget:()=>Fo,imageWidget:()=>Io,initialValues:()=>$t,installStyles:()=>Mo,isEmpty:()=>Dr,isModifierValid:()=>Cu,jsonWidget:()=>Jr,linesWidget:()=>Ao,linkCheckboxesWidget:()=>Zo,many2oneWidget:()=>No,mountViewer:()=>$p,pageJsonSchema:()=>Lu,referenceWidget:()=>To,sanitizeHtml:()=>Lo,summary:()=>qu,tagsWidget:()=>Br,validatePage:()=>Mr,wait:()=>Vr});var A={};jo(A,{BIGINT_FORMAT_RANGES:()=>sr,CONSTANT_CATCH:()=>Yo,Class:()=>Gr,NUMBER_FORMAT_RANGES:()=>Pt,aborted:()=>xe,allowsEval:()=>rn,assert:()=>ll,assertEqual:()=>il,assertIs:()=>cl,assertNever:()=>ul,assertNotEqual:()=>sl,assignProp:()=>ge,attachSchema:()=>cr,base64ToUint8Array:()=>qo,base64urlToUint8Array:()=>Ol,cached:()=>gt,captureStackTrace:()=>or,cleanEnum:()=>Pl,cleanRegex:()=>Et,clone:()=>$e,cloneDef:()=>pl,codePointLength:()=>Ot,constantCatch:()=>Xo,createTransparentProxy:()=>xl,defineLazy:()=>Qr,defineLazyInternal:()=>M,derived:()=>Al,esc:()=>en,escapeRegex:()=>Me,explicitlyAborted:()=>sn,extend:()=>wl,finalizeIssue:()=>Ee,floatSafeRemainder:()=>Xr,getElementAtPath:()=>ml,getEnumValues:()=>mt,getLengthableOrigin:()=>Nt,getParsedType:()=>yl,getSizableOrigin:()=>Ko,hexToUint8Array:()=>Zl,hide:()=>ur,installLazyProp:()=>Fl,isObject:()=>st,isPlainObject:()=>He,issue:()=>yt,joinValues:()=>nr,jsonStringifyReplacer:()=>ht,members:()=>cn,merge:()=>zl,mergeDefs:()=>Ce,normalizeParams:()=>O,nullish:()=>Yr,numKeys:()=>bl,objectClone:()=>dl,omit:()=>_l,optionalKeys:()=>on,own:()=>We,parsedType:()=>an,partial:()=>$l,pick:()=>vl,prefixIssues:()=>Se,primitiveTypes:()=>Wo,promiseAllObject:()=>hl,propertyKeyTypes:()=>nn,randomString:()=>gl,rawShape:()=>bt,required:()=>Sl,safeExtend:()=>kl,shallowClone:()=>Jo,slugify:()=>tn,stringifyPrimitive:()=>ir,toZod:()=>al,uint8ArrayToBase64:()=>Go,uint8ArrayToBase64url:()=>Nl,uint8ArrayToHex:()=>Tl,unwrapMessage:()=>pt});function il(e){return e}function sl(e){return e}function al(){return e=>e}function cl(e){}function ul(e){throw new Error("Unexpected value in exhaustive check")}function ll(e){}function mt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function nr(e,t="|"){return e.map(r=>ir(r)).join(t)}function ht(e,t){return typeof t=="bigint"?t.toString():t}var qr=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function gt(e){return new qr(e)}function Yr(e){return e==null}function Et(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Xr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Vo=Symbol("evaluating");function Qr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Vo)return n===void 0&&(n=Vo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dl(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function bt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Fe(e){return bt(e._zod.def)??e._zod.def.shape}function Uo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ge(this,t,n),n},enumerable:!0,configurable:!0})}function Bo(e,t,r){t in e?ge(e,t,r):e[t]=r}function it(e,t,r,n){let o=Fe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Uo(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Bo(e,i,n?n(s.value,i):s.value))}}function fl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Uo(e,r,()=>t[r]):Bo(e,r,n.value))}}function Ce(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function pl(e){return Ce(e._zod.def)}function ml(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hl(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function gl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function en(e){return JSON.stringify(e)}function tn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var or="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function st(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var rn=gt(()=>{if(me.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function He(e){if(st(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(st(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jo(e){return He(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function bl(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var yl=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},nn=new Set(["string","number","symbol"]),Wo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $e(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function O(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xl(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ir(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function on(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Pt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function vl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return it(i,e,ar(e,t)),$e(e,Ce(r,{shape:i,checks:[]}))}function ar(e,t){let r=Fe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function _l(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ar(e,t)),s={};return it(s,e,Reflect.ownKeys(Fe(e)).filter(a=>!i.has(a))),$e(e,Ce(r,{shape:s,checks:[]}))}function wl(e,t){if(!He(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Fe(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $e(e,Ce(e._zod.def,{shape:Ho(e,t)}))}function Ho(e,t){let r={};return it(r,e,Reflect.ownKeys(Fe(e))),fl(r,t),r}function kl(e,t){if(!He(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $e(e,Ce(e._zod.def,{shape:Ho(e,t)}))}function zl(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};it(r,e,Reflect.ownKeys(Fe(e))),it(r,t,Reflect.ownKeys(Fe(t)));let n=Ce(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return $e(e,n)}function $l(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(ar(t,r)):void 0,c={};return it(c,t,Reflect.ownKeys(Fe(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),$e(t,Ce(t._zod.def,{shape:c,checks:[]}))}function Sl(e,t,r){let n=r?new Set(ar(t,r)):void 0,o={};return it(o,t,Reflect.ownKeys(Fe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),$e(t,Ce(t._zod.def,{shape:o}))}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function sn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Se(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function pt(e){return typeof e=="string"?e:e?.message}function cr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Ee(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:pt(e.inst?._zod.def?.error?.(e))??pt(i?.(e))??pt(t?.error?.(e))??pt(r.customError?.(e))??pt(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Ko(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var El=/[\uD800-\uDBFF]/;function Ot(e){let t=e.length;if(!El.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Nt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function an(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function yt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Pl(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function qo(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Go(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ol(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return qo(t+r)}function Nl(e){return Go(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Tl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gr=class{constructor(...t){}};function cn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Rl(e,r,n.value)}}function We(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ur(e,t,r){return We(e,t,r,!1)}function Al(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return We(this,r,n(this))},set(o){We(this,r,o)}})}return t}function Rl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:We(this,t,r.bind(this))},set(n){We(this,t,n)}})}function Il(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Kr,Je=!1,Ll={configurable:!0,get(){Je=!0}};function M(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Kr!==e._zod){Kr=void 0;return}Kr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ll);let o=Je;Je=!1;try{let i=r(this);return Je?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Je=Je||o,i}catch(i){throw delete this[t],Je=Je||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Fl(e,t,r,n){let o=Il(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Yo="~constantCatch";function Xo(e){let t=()=>e;return t[Yo]=!0,t}var Qo;var un={value:void 0,enumerable:!1},ei="captureStackTrace"in Error?Error:null;function Cl(e){let t=ei;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ei=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function i(m){this.def=m,this.constr=p,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(m,f){if(m._zod){if(m._zod.traits.has(e))return}else{un.value=new i(f);try{Object.defineProperty(m,"_zod",un)}finally{un.value=void 0}}if(m._zod.traits.add(e),t(m,f),a){let x=Object.getPrototypeOf(m),d=m._zod.constr.prototype,v=x;for(;v&&v!==d;)v=Object.getPrototypeOf(v);let P=v??x;a.has(P)||(a.add(P),cn(P,s))}let h=p.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in m||(m[x]=h[x].bind(m)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(m){let f=n?.Parent?Cl(l):this;c(f,m);let h=f._zod.deferred;if(h){for(let d of h)d();f._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(f),f}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:m=>n?.Parent&&m instanceof n.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var Pe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},xt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qo=globalThis).__zod_globalConfig??(Qo.__zod_globalConfig={});var me=globalThis.__zod_globalConfig;function ve(e){return e&&Object.assign(me,e),me}function Ml(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ht,2)),e.message}function Dl(e){this._zod.message=e}var jl={get:Ml,set:Dl,enumerable:!0,configurable:!0},dn={value:void 0,enumerable:!1},ti=new WeakSet([Object.prototype,Error.prototype]),ri=(e,t)=>{e.name="$ZodError",dn.value=t,Object.defineProperty(e,"issues",dn),dn.value=void 0,Object.defineProperty(e,"message",jl);let r=Object.getPrototypeOf(e);ti.has(r)||(ti.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ni=b("$ZodError",ri),Tp=b("$ZodError",ri,void 0,{Parent:Error});function Vl(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function oi(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Vl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ii(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],p=u===a.length-1;if(l==="_errors"){p&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];p&&m._errors.push(t(s)),c=m,u++}}}};return n(e),r}function lr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var dr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Pe;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw or(c,i?.callee??t),c}return a.value};return t};var fr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>Ee(u,s,ve())));throw or(c,i?.callee??t),c}return a.value};return t};var pr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Pe;return i.issues.length?si(e,i.issues,o):{success:!0,data:i.value}};function si(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Ee(o,r,ve()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var mr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?si(e,i.issues,o):{success:!0,data:i.value}};var Ul=Symbol.for("zod.compile.invalid"),Bl=Symbol.for("zod.compile.fallback"),fn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ul)return!0;if(n.definite===!0&&r===void 0)return!1}return Jl(e,t,r)});function Jl(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Bl]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Pe;return i.issues.length===0}var pn=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},ai=e=>{let t=dr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,lr(r,s))};return r};var ci=e=>{let t=dr(e),r=(n,o,i,s)=>t(n,o,i,lr(r,s));return r};var ui=e=>{let t=fr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,lr(r,s))};return r};var li=e=>{let t=fr(e),r=async(n,o,i,s)=>await t(n,o,i,lr(r,s));return r};var di=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return pr(e)(t,r,o)};var fi=e=>(t,r,n)=>pr(e)(t,r,n);var pi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mr(e)(t,r,o)};var mi=e=>async(t,r,n)=>mr(e)(t,r,n);var hi=/^[cC][0-9a-z]{6,}$/,gi=/^[0-9a-z]+$/,bi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yi=/^[0-9a-vA-V]{20}$/,xi=/^[A-Za-z0-9]{27}$/,vi=/^[a-zA-Z0-9_-]{21}$/;function _i(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var wi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var ki=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var zi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Wl="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $i(){return new RegExp(Wl,"u")}var Si=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ei=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Pi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Oi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ni=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ti=/^https?$/,Ai=/^\+[1-9]\d{6,14}$/;var Ri="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Hl(e){return new RegExp(`^${e}$`)}var Ii=Hl(Ri);function mn(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Li(e){return new RegExp(`^${mn(e)}$`)}function Fi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${mn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${mn({precision:e.precision})}`:r;return new RegExp(`^${Ri}T(?:${n})$`)}var Ci=/^[\s\S]{0,}$/;var gn=/^-?\d+$/,Zt=/^-?\d+(?:\.\d+)?$/,Mi=/^(?:true|false)$/i,Di=/^null$/i;var ji=/^[^A-Z]*$/,Vi=/^[^a-z]*$/;var fe=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var bn=e=>{let t=e.value;return!Yr(t)&&t.length!==void 0},hr={number:"number",bigint:"bigint",object:"date"},yn=b("$ZodCheckLessThan",(e,t)=>{fe.init(e,t);let r=hr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:hr[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xn=b("$ZodCheckGreaterThan",(e,t)=>{fe.init(e,t);let r=hr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:hr[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=b("$ZodCheckMultipleOf",(e,t)=>{fe.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Xr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Bi=b("$ZodCheckNumberFormat",(e,t)=>{fe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Pt[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Ji=b("$ZodCheckMaxLength",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ot(o):i)<=t.maximum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wi=b("$ZodCheckMinLength",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ot(o):i)>=t.minimum)return;let a=Nt(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hi=b("$ZodCheckLengthEquals",(e,t)=>{var r;fe.init(e,t),(r=e._zod.def).when??(r.when=bn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ot(o):i;if(s===t.length)return;let a=Nt(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),At=b("$ZodCheckStringFormat",(e,t)=>{var r,n;fe.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ki=b("$ZodCheckRegex",(e,t)=>{At.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qi=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ji),At.init(e,t)}),Gi=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vi),At.init(e,t)}),Yi=b("$ZodCheckIncludes",(e,t)=>{fe.init(e,t);let r=Me(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Xi=b("$ZodCheckStartsWith",(e,t)=>{fe.init(e,t);let r=new RegExp(`^${Me(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qi=b("$ZodCheckEndsWith",(e,t)=>{fe.init(e,t);let r=new RegExp(`.*${Me(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var es=b("$ZodCheckOverwrite",(e,t)=>{fe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var gr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
1
|
+
/*! Fieldia 0.3.0 · MIT · https://fieldia.dev */
|
|
2
|
+
"use strict";var Fieldia=(()=>{var ir=Object.defineProperty;var ul=Object.getOwnPropertyDescriptor;var ll=Object.getOwnPropertyNames;var dl=Object.prototype.hasOwnProperty;var fl=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ko=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},pl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ll(t))!dl.call(e,o)&&o!==r&&ir(e,o,{get:()=>t[o],enumerable:!(n=ul(t,o))||n.enumerable});return e};var ml=e=>pl(ir({},"__esModule",{value:!0}),e);var at=(e,t,r)=>fl(e,typeof t!="symbol"?t+"":t,r);var Fp={};Ko(Fp,{DEFAULT_LABELS:()=>Ap,FIELDIA_CSS:()=>al,FIELD_NAME:()=>Ce,FIELD_TYPES:()=>hu,FORMAT_VERSION:()=>Eo,FieldSchema:()=>So,FieldsSchema:()=>Dr,FilterConditionSchema:()=>wo,LayoutNodeSchema:()=>ft,LineFieldSchema:()=>zo,LineKindsSchema:()=>$o,MESSAGES:()=>st,ModifierSchema:()=>Gt,OptionSchema:()=>Mr,PageSchema:()=>Pt,RootLayoutSchema:()=>jr,VERSION:()=>Ip,VIEWER_LABELS:()=>Wo,WIDGET_LABELS:()=>Ne,binaryWidget:()=>Mo,browserPreferences:()=>Jo,builtInWidgets:()=>il,checkValue:()=>Qt,compileModifier:()=>ot,createForm:()=>Kr,createMemoryDataSource:()=>Hu,createWidget:()=>rr,displayValue:()=>Fo,emptyValue:()=>No,evaluateModifier:()=>Uu,expressionContext:()=>Xt,fill:()=>Jr,formatBytes:()=>er,hostScheduler:()=>tr,htmlWidget:()=>Vo,imageWidget:()=>Do,initialValues:()=>Ot,installStyles:()=>Bo,isEmpty:()=>Br,isModifierValid:()=>Bu,jsonWidget:()=>qr,kindTextField:()=>Yu,lineForm:()=>Xu,lineKind:()=>it,linesWidget:()=>Co,linkCheckboxesWidget:()=>Lo,many2oneWidget:()=>Ao,memoryPreferences:()=>Tp,mountViewer:()=>Rp,pageJsonSchema:()=>Vu,referenceWidget:()=>Ro,sanitizeHtml:()=>jo,summary:()=>ol,tagsWidget:()=>Hr,validatePage:()=>Ur,wait:()=>Wr});var A={};Ko(A,{BIGINT_FORMAT_RANGES:()=>ur,CONSTANT_CATCH:()=>ni,Class:()=>Qr,NUMBER_FORMAT_RANGES:()=>Tt,aborted:()=>Ee,allowsEval:()=>sn,assert:()=>vl,assertEqual:()=>hl,assertIs:()=>yl,assertNever:()=>xl,assertNotEqual:()=>gl,assignProp:()=>ke,attachSchema:()=>dr,base64ToUint8Array:()=>ti,base64urlToUint8Array:()=>Ml,cached:()=>_t,captureStackTrace:()=>ar,cleanEnum:()=>Cl,cleanRegex:()=>Zt,clone:()=>Ae,cloneDef:()=>kl,codePointLength:()=>At,constantCatch:()=>oi,createTransparentProxy:()=>Ol,defineLazy:()=>rn,defineLazyInternal:()=>j,derived:()=>Ul,esc:()=>nn,escapeRegex:()=>We,explicitlyAborted:()=>un,extend:()=>Tl,finalizeIssue:()=>Re,floatSafeRemainder:()=>tn,getElementAtPath:()=>zl,getEnumValues:()=>xt,getLengthableOrigin:()=>Lt,getParsedType:()=>Pl,getSizableOrigin:()=>ei,hexToUint8Array:()=>jl,hide:()=>fr,installLazyProp:()=>Kl,isObject:()=>ut,isPlainObject:()=>et,issue:()=>kt,joinValues:()=>sr,jsonStringifyReplacer:()=>vt,members:()=>dn,merge:()=>Ll,mergeDefs:()=>Je,normalizeParams:()=>Z,nullish:()=>en,numKeys:()=>El,objectClone:()=>_l,omit:()=>Zl,optionalKeys:()=>cn,own:()=>Qe,parsedType:()=>ln,partial:()=>Rl,pick:()=>Nl,prefixIssues:()=>Le,primitiveTypes:()=>Xo,promiseAllObject:()=>$l,propertyKeyTypes:()=>an,randomString:()=>Sl,rawShape:()=>wt,required:()=>Il,safeExtend:()=>Al,shallowClone:()=>Yo,slugify:()=>on,stringifyPrimitive:()=>cr,toZod:()=>bl,uint8ArrayToBase64:()=>ri,uint8ArrayToBase64url:()=>Dl,uint8ArrayToHex:()=>Vl,unwrapMessage:()=>yt});function hl(e){return e}function gl(e){return e}function bl(){return e=>e}function yl(e){}function xl(e){throw new Error("Unexpected value in exhaustive check")}function vl(e){}function xt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function sr(e,t="|"){return e.map(r=>cr(r)).join(t)}function vt(e,t){return typeof t=="bigint"?t.toString():t}var Xr=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function _t(e){return new Xr(e)}function en(e){return e==null}function Zt(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function tn(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Ho=Symbol("evaluating");function rn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ho)return n===void 0&&(n=Ho,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _l(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ke(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function wt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Be(e){return wt(e._zod.def)??e._zod.def.shape}function qo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ke(this,t,n),n},enumerable:!0,configurable:!0})}function Go(e,t,r){t in e?ke(e,t,r):e[t]=r}function ct(e,t,r,n){let o=Be(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?qo(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Go(e,i,n?n(s.value,i):s.value))}}function wl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?qo(e,r,()=>t[r]):Go(e,r,n.value))}}function Je(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function kl(e){return Je(e._zod.def)}function zl(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function $l(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Sl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function nn(e){return JSON.stringify(e)}function on(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ar="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sn=_t(()=>{if(_e.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function et(e){if(ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ut(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Yo(e){return et(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function El(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Pl=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},an=new Set(["string","number","symbol"]),Xo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function We(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ol(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function cr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Tt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ur={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Nl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return ct(i,e,lr(e,t)),Ae(e,Je(r,{shape:i,checks:[]}))}function lr(e,t){let r=Be(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Zl(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(lr(e,t)),s={};return ct(s,e,Reflect.ownKeys(Be(e)).filter(c=>!i.has(c))),Ae(e,Je(r,{shape:s,checks:[]}))}function Tl(e,t){if(!et(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Be(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ae(e,Je(e._zod.def,{shape:Qo(e,t)}))}function Qo(e,t){let r={};return ct(r,e,Reflect.ownKeys(Be(e))),wl(r,t),r}function Al(e,t){if(!et(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ae(e,Je(e._zod.def,{shape:Qo(e,t)}))}function Ll(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ct(r,e,Reflect.ownKeys(Be(e))),ct(r,t,Reflect.ownKeys(Be(t)));let n=Je(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ae(e,n)}function Rl(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(lr(t,r)):void 0,a={};return ct(a,t,Reflect.ownKeys(Be(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),Ae(t,Je(t._zod.def,{shape:a,checks:[]}))}function Il(e,t,r){let n=r?new Set(lr(t,r)):void 0,o={};return ct(o,t,Reflect.ownKeys(Be(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Ae(t,Je(t._zod.def,{shape:o}))}function Ee(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function un(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function yt(e){return typeof e=="string"?e:e?.message}function dr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Re(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:yt(e.inst?._zod.def?.error?.(e))??yt(i?.(e))??yt(t?.error?.(e))??yt(r.customError?.(e))??yt(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function ei(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Fl=/[\uD800-\uDBFF]/;function At(e){let t=e.length;if(!Fl.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Lt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ln(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function kt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Cl(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ti(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function ri(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ml(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return ti(t+r)}function Dl(e){return ri(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Vl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Qr=class{constructor(...t){}};function dn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Bl(e,r,n.value)}}function Qe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function fr(e,t,r){return Qe(e,t,r,!1)}function Ul(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Qe(this,r,n(this))},set(o){Qe(this,r,o)}})}return t}function Bl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Qe(this,t,r.bind(this))},set(n){Qe(this,t,n)}})}function Jl(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Yr,Xe=!1,Wl={configurable:!0,get(){Xe=!0}};function j(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Yr!==e._zod){Yr=void 0;return}Yr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Wl);let o=Xe;Xe=!1;try{let i=r(this);return Xe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Xe=Xe||o,i}catch(i){throw delete this[t],Xe=Xe||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Kl(e,t,r,n){let o=Jl(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var ni="~constantCatch";function oi(e){let t=()=>e;return t[ni]=!0,t}var ii;var fn={value:void 0,enumerable:!1},si="captureStackTrace"in Error?Error:null;function Hl(e){let t=si;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return si=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function i(p){this.def=p,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(p,d){if(p._zod){if(p._zod.traits.has(e))return}else{fn.value=new i(d);try{Object.defineProperty(p,"_zod",fn)}finally{fn.value=void 0}}if(p._zod.traits.add(e),t(p,d),c){let v=Object.getPrototypeOf(p),y=p._zod.constr.prototype,h=v;for(;h&&h!==y;)h=Object.getPrototypeOf(h);let O=h??v;c.has(O)||(c.add(O),dn(O,s))}let m=f.prototype;for(let v in m)Object.prototype.hasOwnProperty.call(m,v)&&(v in p||(p[v]=m[v].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(p){let d=n?.Parent?Hl(l):this;a(d,p);let m=d._zod.deferred;if(m){for(let y of m)y();d._zod.deferred=void 0}let v=globalThis.__zod_globalConfig?.postProcessor;return v&&v(d),d}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var Ie=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},zt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ii=globalThis).__zod_globalConfig??(ii.__zod_globalConfig={});var _e=globalThis.__zod_globalConfig;function Pe(e){return e&&Object.assign(_e,e),_e}function ql(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,vt,2)),e.message}function Gl(e){this._zod.message=e}var Yl={get:ql,set:Gl,enumerable:!0,configurable:!0},mn={value:void 0,enumerable:!1},ai=new WeakSet([Object.prototype,Error.prototype]),ci=(e,t)=>{e.name="$ZodError",mn.value=t,Object.defineProperty(e,"issues",mn),mn.value=void 0,Object.defineProperty(e,"message",Yl);let r=Object.getPrototypeOf(e);ai.has(r)||(ai.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ui=b("$ZodError",ci),Vp=b("$ZodError",ci,void 0,{Parent:Error});function Xl(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function li(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Xl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function di(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;for(;u<c.length;){let l=c[u],f=u===c.length-1;if(l==="_errors"){f&&a._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(a,l)||Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=a[l];f&&p._errors.push(t(s)),a=p,u++}}}};return n(e),r}function pr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var mr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Ie;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Re(u,s,Pe())));throw ar(a,i?.callee??t),a}return c.value};return t};var hr=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Re(u,s,Pe())));throw ar(a,i?.callee??t),a}return c.value};return t};var gr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ie;return i.issues.length?fi(e,i.issues,o):{success:!0,data:i.value}};function fi(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Re(o,r,Pe()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var br=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?fi(e,i.issues,o):{success:!0,data:i.value}};var Ql=Symbol.for("zod.compile.invalid"),ed=Symbol.for("zod.compile.fallback"),hn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ql)return!0;if(n.definite===!0&&r===void 0)return!1}return td(e,t,r)});function td(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ed]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Ie;return i.issues.length===0}var gn=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},pi=e=>{let t=mr(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,pr(r,s))};return r};var mi=e=>{let t=mr(e),r=(n,o,i,s)=>t(n,o,i,pr(r,s));return r};var hi=e=>{let t=hr(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,pr(r,s))};return r};var gi=e=>{let t=hr(e),r=async(n,o,i,s)=>await t(n,o,i,pr(r,s));return r};var bi=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return gr(e)(t,r,o)};var yi=e=>(t,r,n)=>gr(e)(t,r,n);var xi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return br(e)(t,r,o)};var vi=e=>async(t,r,n)=>br(e)(t,r,n);var _i=/^[cC][0-9a-z]{6,}$/,wi=/^[0-9a-z]+$/,ki=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,zi=/^[0-9a-vA-V]{20}$/,$i=/^[A-Za-z0-9]{27}$/,Si=/^[a-zA-Z0-9_-]{21}$/;function Ei(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Pi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Oi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Ni=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var rd="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Zi(){return new RegExp(rd,"u")}var Ti=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ai=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Li=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ri=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ii=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ci=/^https?$/,Mi=/^\+[1-9]\d{6,14}$/;var Di="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function nd(e){return new RegExp(`^${e}$`)}var ji=nd(Di);function bn(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vi(e){return new RegExp(`^${bn(e)}$`)}function Ui(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${bn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${bn({precision:e.precision})}`:r;return new RegExp(`^${Di}T(?:${n})$`)}var Bi=/^[\s\S]{0,}$/;var xn=/^-?\d+$/,Rt=/^-?\d+(?:\.\d+)?$/,Ji=/^(?:true|false)$/i,Wi=/^null$/i;var Ki=/^[^A-Z]*$/,Hi=/^[^a-z]*$/;var be=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var vn=e=>{let t=e.value;return!en(t)&&t.length!==void 0},yr={number:"number",bigint:"bigint",object:"date"},_n=b("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let r=yr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:yr[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wn=b("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let r=yr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:yr[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qi=b("$ZodCheckMultipleOf",(e,t)=>{be.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):tn(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Gi=b("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Tt[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Yi=b("$ZodCheckMaxLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?At(o):i)<=t.maximum)return;let c=Lt(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xi=b("$ZodCheckMinLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?At(o):i)>=t.minimum)return;let c=Lt(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qi=b("$ZodCheckLengthEquals",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=vn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?At(o):i;if(s===t.length)return;let c=Lt(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ft=b("$ZodCheckStringFormat",(e,t)=>{var r,n;be.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),es=b("$ZodCheckRegex",(e,t)=>{Ft.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ts=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ki),Ft.init(e,t)}),rs=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Hi),Ft.init(e,t)}),ns=b("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let r=We(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),os=b("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`^${We(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),is=b("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`.*${We(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var ss=b("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var xr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
3
3
|
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${r.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}};var rs={major:4,minor:6,patch:5};var W=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rs;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=xe(a),p;for(let m of c){if(m._zod.def.when){if(sn(a)||!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=m._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new Pe;if(p||h instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(cr(a.issues,f,e),l||(l=xe(a,f)))});else{if(a.issues.length===f)continue;cr(a.issues,f,e),l||(l=xe(a,f))}}return p?p.then(()=>a):a},s=(a,c,u)=>{if(xe(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new Pe;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(p=>s(p,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Pe;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return ur(this,"~standard",_n(this))},set"~standard"(e){We(this,"~standard",e)}}),gs=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ee(r,t,ve()))}:{value:e.value};async function Kl(e,t){let r={async:!0};return gs(await e._zod.run({value:t,issues:[]},r),r)}function _n(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return gs(n,r)}catch{}return Kl(e,t)},vendor:"zod",version:1}}var vr=b("$ZodString",(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??Ci,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),X=b("$ZodStringFormat",(e,t)=>{At.init(e,t),vr.init(e,t)}),bs=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ki),X.init(e,t)}),ys=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=hn(n))}else t.pattern??(t.pattern=hn());X.init(e,t)}),xs=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zi),X.init(e,t)}),vs=1,yr=2;function _s(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ql(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?_s(e)||yr:Gl(e,t)}function Gl(e,t){if(!t.normalize&&t.protocol?.source===Ti.source&&!/^https?:\/\//i.test(e))return vs;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??yr}return new URL(e)}catch{return yr}}var Yl=/[\t\n\r]/g;function ns(e){return e.replace(Yl,"")}function Xl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ql(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ws=b("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ql(n,t);if(o===vs){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===yr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=ns(n);return}t.hostname&&!Xl(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Ql(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:ns(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ks=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$i()),X.init(e,t)}),zs=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?vi:_i(t.length)),X.init(e,t)}),$s=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hi),X.init(e,t)}),Ss=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gi),X.init(e,t)}),Es=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=bi),X.init(e,t)}),Ps=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yi),X.init(e,t)}),Os=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xi),X.init(e,t)}),Ns=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Fi(t)),X.init(e,t)}),Zs=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ii),X.init(e,t)}),Ts=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Li(t)),X.init(e,t)}),As=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wi),X.init(e,t)}),Rs=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Si),X.init(e,t)}),ed=/^[0-9a-fA-F:.]+$/;function Is(e){return ed.test(e)?_s(`http://[${e}]`):!1}var Ls=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ei),X.init(e,t),e._zod.check=r=>{Is(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Fs=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Pi),X.init(e,t)});function td(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Is(r)}var Cs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oi),X.init(e,t),e._zod.check=r=>{td(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Ms(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var wn=/^[0-9a-zA-Z+/]*={0,2}$/,Ds=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wn),X.init(e,t),e._zod.check=r=>{Ms(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),_r=/^[A-Za-z0-9_-]*$/;function rd(e){if(!_r.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ms(r)}var js=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_r),X.init(e,t),e._zod.check=r=>{rd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Vs=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ai),X.init(e,t)});function nd(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Us=b("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=r=>{nd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var kn=b("$ZodNumber",(e,t)=>{W.init(e,t),e._zod.pattern=Zt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Bs=b("$ZodNumberFormat",(e,t)=>{Bi.init(e,t),kn.init(e,t)}),Js=b("$ZodBoolean",(e,t)=>{W.init(e,t),e._zod.pattern=Mi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Ws=b("$ZodNull",(e,t)=>{W.init(e,t),e._zod.pattern=Di,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Hs=b("$ZodUnknown",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),Ks=b("$ZodNever",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function os(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}var qs=b("$ZodArray",(e,t)=>{W.init(e,t);let r=me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(p=>os(p,n,c)));else if(os(l,n,c),a&&l.issues.length!==0&&xe(l))break}return s.length?Promise.all(s).then(()=>n):n}});function xr(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...Se(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var od=[];function Gs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:od,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=on(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ys(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,p=u.optin,m=u.optout,f=0;for(let h in t){if(s&&r.issues.length!==f){if(xe(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let x=u.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(d=>xr(d,r,h,t,p,m))):xr(x,r,h,t,p,m)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var id=b("$ZodObject",(e,t)=>{W.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=gt(()=>Gs(t));M(e,"propValues",u=>{let l=u.def.shape,p={};for(let m in l){let f=l[m]._zod;if(f.values){Object.prototype.hasOwnProperty.call(p,m)||ge(p,m,new Set);for(let h of f.values)p[m].add(h);f.optin!==void 0&&p[m].add(void 0)}}return p});let i=st,s=t.catchall,a,c=me.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],f=a.shape,h=l?.abortEarly,x=u.issues.length;for(let d of a.allKeys){if(h&&u.issues.length!==x){if(xe(u,x))break;x=u.issues.length}if(d==="__proto__")continue;let v=f[d],P=v._zod.optin,j=v._zod.optout,S=v._zod.run({value:p[d],issues:[]},l);S instanceof Promise?m.push(S.then(w=>xr(w,u,d,p,P,j))):xr(S,u,d,p,P,j)}return s?Ys(m,p,u,l,o.value,e,h===!0):m.length?Promise.all(m).then(()=>u):u}}),Xs=b("$ZodObjectJIT",(e,t)=>{id.init(e,t);let r=e._zod.parse,n=gt(()=>Gs(t)),o=me.memoizer,i=f=>{let h=n.value,x=h.symbolKeys,d=new gr(["payload","ctx"],{shape:f,inst:e,memo:o,syms:x}),v=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,P=(w,$)=>`
|
|
7
|
-
let ${
|
|
8
|
-
for (let i = 0; i < ${
|
|
9
|
-
const iss = ${
|
|
10
|
-
iss.path = iss.path ? [${
|
|
6
|
+
};`)(...Object.values(this.closed))}};var cs={major:4,minor:6,patch:5};var Y=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cs;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=Ee(c),f;for(let p of a){if(p._zod.def.when){if(un(c)||!p._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,m=p._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new Ie;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,c.issues.length!==d&&(dr(c.issues,d,e),l||(l=Ee(c,d)))});else{if(c.issues.length===d)continue;dr(c.issues,d,e),l||(l=Ee(c,d))}}return f?f.then(()=>c):c},s=(c,a,u)=>{if(Ee(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new Ie;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,c,a)):s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new Ie;return u.then(l=>i(l,o,a))}return i(u,o,a)}}},{get"~standard"(){return fr(this,"~standard",zn(this))},set"~standard"(e){Qe(this,"~standard",e)}}),ws=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Re(r,t,Pe()))}:{value:e.value};async function od(e,t){let r={async:!0};return ws(await e._zod.run({value:t,issues:[]},r),r)}function zn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return ws(n,r)}catch{}return od(e,t)},vendor:"zod",version:1}}var kr=b("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=t.pattern??Bi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),oe=b("$ZodStringFormat",(e,t)=>{Ft.init(e,t),kr.init(e,t)}),ks=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Oi),oe.init(e,t)}),zs=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yn(n))}else t.pattern??(t.pattern=yn());oe.init(e,t)}),$s=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ni),oe.init(e,t)}),Ss=1,_r=2;function Es(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function id(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Es(e)||_r:sd(e,t)}function sd(e,t){if(!t.normalize&&t.protocol?.source===Ci.source&&!/^https?:\/\//i.test(e))return Ss;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??_r}return new URL(e)}catch{return _r}}var ad=/[\t\n\r]/g;function us(e){return e.replace(ad,"")}function cd(e,t){return t.lastIndex=0,t.test(e.hostname)}function ud(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Ps=b("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=id(n,t);if(o===Ss){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===_r){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=us(n);return}t.hostname&&!cd(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!ud(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:us(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Os=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Zi()),oe.init(e,t)}),Ns=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Si:Ei(t.length)),oe.init(e,t)}),Zs=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_i),oe.init(e,t)}),Ts=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wi),oe.init(e,t)}),As=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ki),oe.init(e,t)}),Ls=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=zi),oe.init(e,t)}),Rs=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$i),oe.init(e,t)}),Is=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ui(t)),oe.init(e,t)}),Fs=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ji),oe.init(e,t)}),Cs=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vi(t)),oe.init(e,t)}),Ms=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pi),oe.init(e,t)}),Ds=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ti),oe.init(e,t)}),ld=/^[0-9a-fA-F:.]+$/;function js(e){return ld.test(e)?Es(`http://[${e}]`):!1}var Vs=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ai),oe.init(e,t),e._zod.check=r=>{js(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Us=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Li),oe.init(e,t)});function dd(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:js(r)}var Bs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ri),oe.init(e,t),e._zod.check=r=>{dd(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Js(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var $n=/^[0-9a-zA-Z+/]*={0,2}$/,Ws=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$n),oe.init(e,t),e._zod.check=r=>{Js(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),zr=/^[A-Za-z0-9_-]*$/;function fd(e){if(!zr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Js(r)}var Ks=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zr),oe.init(e,t),e._zod.check=r=>{fd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Hs=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Mi),oe.init(e,t)});function pd(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var qs=b("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{pd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Sn=b("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=Rt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Gs=b("$ZodNumberFormat",(e,t)=>{Gi.init(e,t),Sn.init(e,t)}),Ys=b("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=Ji,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Xs=b("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=Wi,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Qs=b("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),ea=b("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ls(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}var ta=b("$ZodArray",(e,t)=>{Y.init(e,t);let r=_e.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>ls(f,n,a)));else if(ls(l,n,a),c&&l.issues.length!==0&&Ee(l))break}return s.length?Promise.all(s).then(()=>n):n}});function wr(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Le(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var md=[];function ra(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:md,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=cn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function na(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,p=u.optout,d=0;for(let m in t){if(s&&r.issues.length!==d){if(Ee(r,d))break;d=r.issues.length}if(a.has(m))continue;if(m==="__proto__"){l==="never"&&c.push(m);continue}if(l==="never"){c.push(m);continue}let v=u.run({value:t[m],issues:[]},n);v instanceof Promise?e.push(v.then(y=>wr(y,r,m,t,f,p))):wr(v,r,m,t,f,p)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var hd=b("$ZodObject",(e,t)=>{Y.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=_t(()=>ra(t));j(e,"propValues",u=>{let l=u.def.shape,f={};for(let p in l){let d=l[p]._zod;if(d.values){Object.prototype.hasOwnProperty.call(f,p)||ke(f,p,new Set);for(let m of d.values)f[p].add(m);d.optin!==void 0&&f[p].add(void 0)}}return f});let i=ut,s=t.catchall,c,a=_e.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let p=[],d=c.shape,m=l?.abortEarly,v=u.issues.length;for(let y of c.allKeys){if(m&&u.issues.length!==v){if(Ee(u,v))break;v=u.issues.length}if(y==="__proto__")continue;let h=d[y],O=h._zod.optin,K=h._zod.optout,S=h._zod.run({value:f[y],issues:[]},l);S instanceof Promise?p.push(S.then(z=>wr(z,u,y,f,O,K))):wr(S,u,y,f,O,K)}return s?na(p,f,u,l,o.value,e,m===!0):p.length?Promise.all(p).then(()=>u):u}}),oa=b("$ZodObjectJIT",(e,t)=>{hd.init(e,t);let r=e._zod.parse,n=_t(()=>ra(t)),o=_e.memoizer,i=d=>{let m=n.value,v=m.symbolKeys,y=new xr(["payload","ctx"],{shape:d,inst:e,memo:o,syms:v}),h=z=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,O=(z,E)=>`
|
|
7
|
+
let ${z}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${z}.issues.length; i++) {
|
|
9
|
+
const iss = ${z}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${E}, ...iss.path] : [${E}];
|
|
11
11
|
payload.issues.push(iss);
|
|
12
|
-
if (iss.continue !== true) ${
|
|
12
|
+
if (iss.continue !== true) ${z}_ab = true;
|
|
13
13
|
}
|
|
14
|
-
if (${
|
|
14
|
+
if (${z}_ab && ctx && ctx.abortEarly) {
|
|
15
15
|
payload.value = newResult;
|
|
16
16
|
return payload;
|
|
17
|
-
}`;
|
|
18
|
-
const ${
|
|
19
|
-
if (!${
|
|
20
|
-
if (${
|
|
17
|
+
}`;y.write("const input = payload.value;");let K=Object.create(null),S=0;for(let z of m.allKeys)K[z]=`key_${S++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of m.allKeys){if(z==="__proto__")continue;let E=K[z],q=typeof z=="symbol"?`syms[${v.indexOf(z)}]`:nn(z),de=`${q} in input`,Te=d[z],B=Te?._zod?.optin,V=B!==void 0,ne=Te?._zod?.optout==="optional";if(y.write(`const ${E} = ${h(q)};`),V&&ne){let ie=B==="optional"?`${E}_present`:`${E}.value !== undefined || ${E}_present`;y.write(`
|
|
18
|
+
const ${E}_present = ${de};
|
|
19
|
+
if (!${E}.issues.length || ${E}_present) {
|
|
20
|
+
if (${E}.issues.length) {${O(E,q)}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (${
|
|
24
|
-
newResult[${
|
|
23
|
+
if (${ie}) {
|
|
24
|
+
newResult[${q}] = ${E}.value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}else
|
|
29
|
-
if (${
|
|
28
|
+
`)}else V?(y.write(`
|
|
29
|
+
if (${E}.issues.length) {${O(E,q)}
|
|
30
30
|
}
|
|
31
|
-
`),
|
|
32
|
-
if (${
|
|
33
|
-
newResult[${
|
|
31
|
+
`),B==="defaulted"?y.write(`newResult[${q}] = ${E}.value;`):y.write(`
|
|
32
|
+
if (${E}.value !== undefined || ${de}) {
|
|
33
|
+
newResult[${q}] = ${E}.value;
|
|
34
34
|
}
|
|
35
|
-
`)):
|
|
36
|
-
const ${
|
|
37
|
-
if (${
|
|
35
|
+
`)):y.write(`
|
|
36
|
+
const ${E}_present = ${de};
|
|
37
|
+
if (${E}.issues.length) {${O(E,q)}
|
|
38
38
|
}
|
|
39
|
-
if (!${
|
|
39
|
+
if (!${E}_present && !${E}.issues.length) {
|
|
40
40
|
payload.issues.push({
|
|
41
41
|
code: "invalid_type",
|
|
42
42
|
expected: "nonoptional",
|
|
43
43
|
input: undefined,
|
|
44
|
-
path: [${
|
|
44
|
+
path: [${q}]
|
|
45
45
|
});
|
|
46
46
|
if (ctx && ctx.abortEarly) {
|
|
47
47
|
payload.value = newResult;
|
|
@@ -49,13 +49,13 @@ ${r.join(`
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (${
|
|
53
|
-
newResult[${
|
|
52
|
+
if (${E}_present) {
|
|
53
|
+
newResult[${q}] = ${E}.value;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
`)}return d.write("payload.value = newResult;"),d.write("return payload;"),d.compile()},s,a=st,c=!me.jitless,l=c&&rn.value,p=t.catchall,m;e._zod.parse=(f,h)=>{m??(m=n.value);let x=f.value;return a(x)?c&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),f=s(f,h),p?Ys([],x,f,h,m,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),f)}});function is(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!xe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Ee(s,n,ve())))}),t)}var zn=b("$ZodUnion",(e,t)=>{W.init(e,t),M(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),M(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),M(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),M(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Et(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>is(a,n,e,o)):is(s,n,e,o)}});function sd(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Qs=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,zn.init(e,t);let r=e._zod.parse;M(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ge(i,u,new Set);for(let p of l)i[u].add(p)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=bt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=gt(()=>sd(t));e._zod.parse=(o,i)=>{let s=o.value;if(!st(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),ea=b("$ZodIntersection",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>ss(r,c,u)):ss(r,i,s)}});function vn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(He(e)&&He(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=vn(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=vn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ss(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);i.has(m)||i.set(m,u),p=[m]}else return!1;for(let m of p)n.has(m)||n.set(m,{}),n.get(m)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=vn(t.value,r.value);if(!c.valid){if(xe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ta=b("$ZodTuple",(e,t)=>{W.init(e,t);let r=t.items,n=me.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=as(r,"optin"),u=as(r,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),p=t.rest?i?.abortEarly:void 0,m=!1;for(let f=0;f<r.length;f++){let h=r[f]._zod.run({value:s[f],issues:[]},i);h instanceof Promise?a.push(h.then(x=>{l[f]=x})):(l[f]=h,p&&!m&&h.issues.length&&(m=xe(h)))}if(t.rest&&!m){let f=r.length-1,h=s.slice(r.length),x=o.issues.length;for(let d of h){if(p&&o.issues.length!==x){if(xe(o,x))break;x=o.issues.length}f++;let v=t.rest._zod.run({value:d,issues:[]},i);v instanceof Promise?a.push(v.then(P=>cs(P,o,f))):cs(v,o,f)}}return a.length?Promise.all(a).then(()=>us(l,o,r,s,u)):us(l,o,r,s,u)}});function as(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function cs(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}function us(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...Se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ra=b("$ZodRecord",(e,t)=>{W.init(e,t);let r=me.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!He(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(h=>Ee(h,o,ve())),input:l,path:[l],inst:e});continue}let m=p.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);f instanceof Promise?s.push(f.then(h=>{h.issues.length&&n.issues.push(...Se(l,h.issues)),n.value[m]=h.value})):(f.issues.length&&n.issues.push(...Se(l,f.issues)),n.value[m]=f.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Zt.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Ee(h,o,ve())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);f instanceof Promise?s.push(f.then(h=>{h.issues.length&&n.issues.push(...Se(u,h.issues)),n.value[m]=h.value})):(f.issues.length&&n.issues.push(...Se(u,f.issues)),n.value[m]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var na=b("$ZodEnum",(e,t)=>{W.init(e,t);let r=mt(t.entries),n=new Set(r);e._zod.values=n,M(e,"pattern",o=>{let i=mt(o.def.entries).filter(s=>nn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Me(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),oa=b("$ZodLiteral",(e,t)=>{W.init(e,t);let r=new Set(t.values);e._zod.values=r,M(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Me(i):i?Me(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var ia=b("$ZodTransform",(e,t)=>{W.init(e,t),e._zod.optin="optional",me.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Pe;return r.value=o,r}});function ls(e,t){return e.value=t.issues.length?void 0:t.value,e}var $n=b("$ZodOptional",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",M(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),M(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ls(r,i)):ls(r,o)}return t.innerType._zod.run(r,n)}}),sa=b("$ZodExactOptional",(e,t)=>{$n.init(e,t),M(e,"values",r=>r.def.innerType._zod.values),M(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),aa=b("$ZodNullable",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin),M(e,"optout",r=>r.def.innerType._zod.optout),M(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)}|null)$`):void 0}),M(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ca=b("$ZodDefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ds(i,t)):ds(o,t)}});function ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ua=b("$ZodPrefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),la=b("$ZodNonOptional",(e,t)=>{W.init(e,t),M(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fs(i,e)):fs(o,e)}});function fs(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ps(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ee(o,n,ve()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var da=b("$ZodCatch",(e,t)=>{W.init(e,t),M(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),M(e,"optout",r=>r.def.innerType._zod.optout),M(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ps(r,i,t,n)):ps(r,o,t,n)}});var fa=b("$ZodPipe",(e,t)=>{W.init(e,t),M(e,"values",r=>r.def.in._zod.values),M(e,"optin",r=>r.def.in._zod.optin),M(e,"optout",r=>r.def.out._zod.optout),M(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>br(s,t.in,n)):br(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>br(i,t.out,n)):br(o,t.out,n)}});function br(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var pa=b("$ZodReadonly",(e,t)=>{W.init(e,t),M(e,"propValues",r=>r.def.innerType._zod.propValues),M(e,"values",r=>r.def.innerType._zod.values),M(e,"optin",r=>r.def.innerType?._zod?.optin),M(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(ms):ms(o)}});function ms(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ma=b("$ZodLazy",(e,t)=>{W.init(e,t),Qr(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),M(e,"pattern",r=>r.innerType?._zod?.pattern),M(e,"propValues",r=>r.innerType?._zod?.propValues),M(e,"optin",r=>r.innerType?._zod?.optin??void 0),M(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ha=b("$ZodCustom",(e,t)=>{fe.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>hs(i,r,n,e));hs(o,r,n,e)}});function hs(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(yt(o))}}var En=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Pn="~memo",ga=[];function ba(e){return e!==null&&typeof e=="object"}function Sn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ya=new WeakMap,Rt=0,zr=1,It=2;function $r(e,t,r){let n=ya.get(e);if(n!==void 0)return n?It:Rt;if(t.has(e))return It;t.add(e);let o=Rt,i=l=>{if(o!==It&&l?._zod){let p=$r(l,t,r);p>o&&(o=p)}},s=(l,p)=>{let m=Rt;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(p&&!h.enumerable)continue;let x=h.get?zr:h.value?._zod?$r(h.value,t,r):Rt;x>m&&(m=x)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=bt(c);a(l?s(l,!0):zr),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?$r(l,t,!1):zr);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let m=p.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let f of m)i(f)}}}return t.delete(e),ad(e,o)}function ad(e,t){return t!==zr&&ya.set(e,t===It),t}function cd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var wr,kr=[],ud={alloc(e,t,r){let n=wr;if(!n)return r;wr=void 0;let o={value:r,issues:null};return n.set(t.value,o),kr.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ld(i,o.value))throw new En;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=$r(e,new Set,!1);if(v===Rt)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);v===It||n?r=!0:n=!0}let l=c.value;if(!ba(l))return s(c,u);let p=u[Pn];p||(p={buckets:new WeakMap,backEdges:void 0},u[Pn]=p);let m;o===u?m=i:(m=cd(p,e),o=u,i=m);let f=m.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Sn(f.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value)),c;wr=m;let h=kr.length,x=s(c,u);wr=void 0;let d=kr.length>h?kr.pop():void 0;return x instanceof Promise?x.then(v=>(d&&(d.issues=v.issues.length?Sn(v.issues):ga),v)):(d&&(d.issues=x.issues.length?Sn(x.issues):ga),x)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function xa(){return ud}function ld(e,t){let r=e[Pn]?.backEdges;return r!==void 0&&ba(t)&&r.has(t)}var dd=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=an(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${ir(i.values[0])}`:`Invalid option: expected one of ${nr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${nr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function va(){return{localeError:dd()}}var _a;var On=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function fd(){return new On}(_a=globalThis).__zod_globalRegistry??(_a.__zod_globalRegistry=fd());var at=globalThis.__zod_globalRegistry;function wa(e){return e.checks&&(e.checks=[...e.checks]),e}function ka(e,t){return new e(wa({type:"string",...O(t)}))}function za(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function $a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Sa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Na(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Za(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ta(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Aa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Ia(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Ca(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function ja(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Wa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Ha(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ka(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function qa(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function Ga(e,t){return new e(wa({type:"number",checks:[],...O(t)}))}function Ya(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Xa(e,t){return new e({type:"boolean",...O(t)})}function Qa(e,t){return new e({type:"null",...O(t)})}function ec(e){return new e({type:"unknown"})}function tc(e,t){return new e({type:"never",...O(t)})}function Sr(e,t){return new yn({check:"less_than",...O(t),value:e,inclusive:!1})}function Lt(e,t){return new yn({check:"less_than",...O(t),value:e,inclusive:!0})}function Er(e,t){return new xn({check:"greater_than",...O(t),value:e,inclusive:!1})}function Ft(e,t){return new xn({check:"greater_than",...O(t),value:e,inclusive:!0})}function Pr(e,t){return new Ui({check:"multiple_of",...O(t),value:e})}function Or(e,t){return new Ji({check:"max_length",...O(t),maximum:e})}function vt(e,t){return new Wi({check:"min_length",...O(t),minimum:e})}function Nr(e,t){return new Hi({check:"length_equals",...O(t),length:e})}function Nn(e,t){return new Ki({check:"string_format",format:"regex",...O(t),pattern:e})}function Zn(e){return new qi({check:"string_format",format:"lowercase",...O(e)})}function Tn(e){return new Gi({check:"string_format",format:"uppercase",...O(e)})}function An(e,t){return new Yi({check:"string_format",format:"includes",...O(t),includes:e})}function Rn(e,t){return new Xi({check:"string_format",format:"starts_with",...O(t),prefix:e})}function In(e,t){return new Qi({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Ke(e){return new es({check:"overwrite",tx:e})}function Ln(e){return Ke(t=>t.normalize(e))}function Fn(){return Ke(e=>e.trim())}function Cn(){return Ke(e=>e.toLowerCase())}function Mn(){return Ke(e=>e.toUpperCase())}function Dn(){return Ke(e=>tn(e))}function rc(e,t,r){return new e({type:"array",element:t,...O(r)})}function nc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function oc(e,t){let r=pd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(yt(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(yt(i))}},e(n.value,n)),t);return r}function pd(e,t){let r=new fe({check:"custom",...O(t)});return r._zod.check=e,r}function Ct(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ge(e,n,r[n]);return e}function Dt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??at,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ce(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function q(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),q(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ct(s.schema,c),t.io==="input"&&he(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function ic(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function jt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,m=e.external.uri??(h=>h);if(p)return{ref:m(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${ic(f)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+ic(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
56
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=ut,a=!_e.jitless,l=a&&sn.value,f=t.catchall,p;e._zod.parse=(d,m)=>{p??(p=n.value);let v=d.value;return c(v)?a&&l&&m?.async===!1&&m.jitless!==!0?(s||(s=i(t.shape)),d=s(d,m),f?na([],v,d,m,p,e,m?.abortEarly===!0):d):r(d,m):(d.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),d)}});function ds(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Ee(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Re(s,n,Pe())))}),t)}var En=b("$ZodUnion",(e,t)=>{Y.init(e,t),j(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),j(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),j(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),j(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Zt(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(c=>ds(c,n,e,o)):ds(s,n,e,o)}});function gd(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var ia=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,En.init(e,t);let r=e._zod.parse;j(e,"propValues",o=>{let i={},s=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,u)||ke(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=wt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=_t(()=>gd(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ut(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],a=n.value.get(c);return a&&(c!==void 0||i.direction!=="backward")?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),sa=b("$ZodIntersection",(e,t)=>{Y.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([a,u])=>fs(r,a,u)):fs(r,i,s)}});function kn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(et(e)&&et(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=kn(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=kn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function fs(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);i.has(p)||i.set(p,u),f=[p]}else return!1;for(let p of f)n.has(p)||n.set(p,{}),n.get(p)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of c)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let a=kn(t.value,r.value);if(!a.valid){if(Ee(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var aa=b("$ZodTuple",(e,t)=>{Y.init(e,t);let r=t.items,n=_e.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=ps(r,"optin"),u=ps(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),f=t.rest?i?.abortEarly:void 0,p=!1;for(let d=0;d<r.length;d++){let m=r[d]._zod.run({value:s[d],issues:[]},i);m instanceof Promise?c.push(m.then(v=>{l[d]=v})):(l[d]=m,f&&!p&&m.issues.length&&(p=Ee(m)))}if(t.rest&&!p){let d=r.length-1,m=s.slice(r.length),v=o.issues.length;for(let y of m){if(f&&o.issues.length!==v){if(Ee(o,v))break;v=o.issues.length}d++;let h=t.rest._zod.run({value:y,issues:[]},i);h instanceof Promise?c.push(h.then(O=>ms(O,o,d))):ms(h,o,d)}}return c.length?Promise.all(c).then(()=>hs(l,o,r,s,u)):hs(l,o,r,s,u)}});function ps(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function ms(e,t,r){e.issues.length&&t.issues.push(...Le(r,e.issues)),t.value[r]=e.value}function hs(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...Le(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ca=b("$ZodRecord",(e,t)=>{Y.init(e,t);let r=_e.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!et(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(m=>Re(m,o,Pe())),input:l,path:[l],inst:e});continue}let p=f.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Le(l,m.issues)),n.value[p]=m.value})):(d.issues.length&&n.issues.push(...Le(l,d.issues)),n.value[p]=d.value)}let u;for(let l in i)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Rt.test(u)&&l.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(l=m)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:c?(a=a??[],a.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Re(m,o,Pe())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(m=>{m.issues.length&&n.issues.push(...Le(u,m.issues)),n.value[p]=m.value})):(d.issues.length&&n.issues.push(...Le(u,d.issues)),n.value[p]=d.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var ua=b("$ZodEnum",(e,t)=>{Y.init(e,t);let r=xt(t.entries),n=new Set(r);e._zod.values=n,j(e,"pattern",o=>{let i=xt(o.def.entries).filter(s=>an.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>We(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),la=b("$ZodLiteral",(e,t)=>{Y.init(e,t);let r=new Set(t.values);e._zod.values=r,j(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?We(i):i?We(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var da=b("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.optin="optional",_e.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new zt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new Ie;return r.value=o,r}});function gs(e,t){return e.value=t.issues.length?void 0:t.value,e}var Pn=b("$ZodOptional",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",j(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),j(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>gs(r,i)):gs(r,o)}return t.innerType._zod.run(r,n)}}),fa=b("$ZodExactOptional",(e,t)=>{Pn.init(e,t),j(e,"values",r=>r.def.innerType._zod.values),j(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),pa=b("$ZodNullable",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin),j(e,"optout",r=>r.def.innerType._zod.optout),j(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Zt(n.source)}|null)$`):void 0}),j(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ma=b("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="defaulted",j(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bs(i,t)):bs(o,t)}});function bs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ha=b("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="defaulted",j(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ga=b("$ZodNonOptional",(e,t)=>{Y.init(e,t),j(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ys(i,e)):ys(o,e)}});function ys(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function xs(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Re(o,n,Pe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ba=b("$ZodCatch",(e,t)=>{Y.init(e,t),j(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),j(e,"optout",r=>r.def.innerType._zod.optout),j(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>xs(r,i,t,n)):xs(r,o,t,n)}});var ya=b("$ZodPipe",(e,t)=>{Y.init(e,t),j(e,"values",r=>r.def.in._zod.values),j(e,"optin",r=>r.def.in._zod.optin),j(e,"optout",r=>r.def.out._zod.optout),j(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>vr(s,t.in,n)):vr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>vr(i,t.out,n)):vr(o,t.out,n)}});function vr(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var xa=b("$ZodReadonly",(e,t)=>{Y.init(e,t),j(e,"propValues",r=>r.def.innerType._zod.propValues),j(e,"values",r=>r.def.innerType._zod.values),j(e,"optin",r=>r.def.innerType?._zod?.optin),j(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(vs):vs(o)}});function vs(e){return e.memo||(e.value=Object.freeze(e.value)),e}var va=b("$ZodLazy",(e,t)=>{Y.init(e,t),rn(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),j(e,"pattern",r=>r.innerType?._zod?.pattern),j(e,"propValues",r=>r.innerType?._zod?.propValues),j(e,"optin",r=>r.innerType?._zod?.optin??void 0),j(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),_a=b("$ZodCustom",(e,t)=>{be.init(e,t),Y.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>_s(i,r,n,e));_s(o,r,n,e)}});function _s(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(kt(o))}}var Nn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Zn="~memo",wa=[];function ka(e){return e!==null&&typeof e=="object"}function On(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var za=new WeakMap,Ct=0,Er=1,Mt=2;function Pr(e,t,r){let n=za.get(e);if(n!==void 0)return n?Mt:Ct;if(t.has(e))return Mt;t.add(e);let o=Ct,i=l=>{if(o!==Mt&&l?._zod){let f=Pr(l,t,r);f>o&&(o=f)}},s=(l,f)=>{let p=Ct;for(let d of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,d);if(f&&!m.enumerable)continue;let v=m.get?Er:m.value?._zod?Pr(m.value,t,r):Ct;v>p&&(p=v)}return p},c=l=>{l>o&&(o=l)},a=e._zod.def,u=a.type;switch(u){case"object":{let l=wt(a);c(l?s(l,!0):Er),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?Pr(l,t,!1):Er);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let f=Object.getOwnPropertyDescriptor(a,l);if(!f||f.get)continue;let p=f.value;if(!(!p||typeof p!="object")){if(p._zod)i(p);else if(Array.isArray(p))for(let d of p)i(d)}}}return t.delete(e),bd(e,o)}function bd(e,t){return t!==Er&&za.set(e,t===Mt),t}function yd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var $r,Sr=[],xd={alloc(e,t,r){let n=$r;if(!n)return r;$r=void 0;let o={value:r,issues:null};return n.set(t.value,o),Sr.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&vd(i,o.value))throw new Nn;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let h=Pr(e,new Set,!1);if(h===Ct)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,u);h===Mt||n?r=!0:n=!0}let l=a.value;if(!ka(l))return s(a,u);let f=u[Zn];f||(f={buckets:new WeakMap,backEdges:void 0},u[Zn]=f);let p;o===u?p=i:(p=yd(f,e),o=u,i=p);let d=p.get(l);if(d)return a.value=d.value,d.issues?d.issues.length&&a.issues.push(...On(d.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value)),a;$r=p;let m=Sr.length,v=s(a,u);$r=void 0;let y=Sr.length>m?Sr.pop():void 0;return v instanceof Promise?v.then(h=>(y&&(y.issues=h.issues.length?On(h.issues):wa),h)):(y&&(y.issues=v.issues.length?On(v.issues):wa),v)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function $a(){return xd}function vd(e,t){let r=e[Zn]?.backEdges;return r!==void 0&&ka(t)&&r.has(t)}var _d=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=ln(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${cr(i.values[0])}`:`Invalid option: expected one of ${sr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${sr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Sa(){return{localeError:_d()}}var Ea;var Tn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function wd(){return new Tn}(Ea=globalThis).__zod_globalRegistry??(Ea.__zod_globalRegistry=wd());var lt=globalThis.__zod_globalRegistry;function Pa(e){return e.checks&&(e.checks=[...e.checks]),e}function Oa(e,t){return new e(Pa({type:"string",...Z(t)}))}function Na(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(t)})}function Za(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(t)})}function La(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(t)})}function Ia(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(t)})}function Fa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(t)})}function Ca(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(t)})}function Ma(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(t)})}function Da(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(t)})}function ja(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(t)})}function Va(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(t)})}function Ua(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(t)})}function Ba(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(t)})}function Ja(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(t)})}function Wa(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(t)})}function Ka(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(t)})}function Ha(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(t)})}function qa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(t)})}function Ga(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(t)})}function Ya(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(t)})}function Xa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(t)})}function Qa(e,t){return new e({type:"string",format:"date",check:"string_format",...Z(t)})}function ec(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(t)})}function tc(e,t){return new e({type:"string",format:"duration",check:"string_format",...Z(t)})}function rc(e,t){return new e(Pa({type:"number",checks:[],...Z(t)}))}function nc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(t)})}function oc(e,t){return new e({type:"boolean",...Z(t)})}function ic(e,t){return new e({type:"null",...Z(t)})}function sc(e){return new e({type:"unknown"})}function ac(e,t){return new e({type:"never",...Z(t)})}function Or(e,t){return new _n({check:"less_than",...Z(t),value:e,inclusive:!1})}function Dt(e,t){return new _n({check:"less_than",...Z(t),value:e,inclusive:!0})}function Nr(e,t){return new wn({check:"greater_than",...Z(t),value:e,inclusive:!1})}function jt(e,t){return new wn({check:"greater_than",...Z(t),value:e,inclusive:!0})}function Zr(e,t){return new qi({check:"multiple_of",...Z(t),value:e})}function Tr(e,t){return new Yi({check:"max_length",...Z(t),maximum:e})}function $t(e,t){return new Xi({check:"min_length",...Z(t),minimum:e})}function Ar(e,t){return new Qi({check:"length_equals",...Z(t),length:e})}function An(e,t){return new es({check:"string_format",format:"regex",...Z(t),pattern:e})}function Ln(e){return new ts({check:"string_format",format:"lowercase",...Z(e)})}function Rn(e){return new rs({check:"string_format",format:"uppercase",...Z(e)})}function In(e,t){return new ns({check:"string_format",format:"includes",...Z(t),includes:e})}function Fn(e,t){return new os({check:"string_format",format:"starts_with",...Z(t),prefix:e})}function Cn(e,t){return new is({check:"string_format",format:"ends_with",...Z(t),suffix:e})}function tt(e){return new ss({check:"overwrite",tx:e})}function Mn(e){return tt(t=>t.normalize(e))}function Dn(){return tt(e=>e.trim())}function jn(){return tt(e=>e.toLowerCase())}function Vn(){return tt(e=>e.toUpperCase())}function Un(){return tt(e=>on(e))}function cc(e,t,r){return new e({type:"array",element:t,...Z(r)})}function uc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Z(r)})}function lc(e,t){let r=kd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(kt(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(kt(i))}},e(n.value,n)),t);return r}function kd(e,t){let r=new be({check:"custom",...Z(t)});return r._zod.check=e,r}function Vt(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ke(e,n,r[n]);return e}function Bt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??lt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function me(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function ee(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let p=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,p,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),ee(f,t,l),t.seen.get(f).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Vt(s.schema,a),t.io==="input"&&we(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function dc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Jt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,p=e.external.uri??(m=>m);if(f)return{ref:p(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${p("__shared")}#/${c}/${dc(d)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+dc(l)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let f in l)delete l[f];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
57
|
|
|
58
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function cc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;cc(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var uc=new Set(["type","properties","required","additionalProperties"]),sc=["oneOf","anyOf"];function ac(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function jn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!uc.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??ac(u);l!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:jn(a)??{allOf:a};ge(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=ac(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function md(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of uc)if(o in e)return;let r=t.filter(o=>sc.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=jn(t);else{let o=r[0],i=sc.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>jn([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,Ct(e,n))}function Vt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){n(p);let f=e.seen.get(p),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Ct(u,h),Ct(u,l),a._zod.parent===p)for(let d in u)d==="$ref"||d==="allOf"||d in l||delete u[d];if(h.$ref&&f.def)for(let d in u)d==="$ref"||d==="allOf"||d in f.def&&JSON.stringify(u[d])===JSON.stringify(f.def[d])&&delete u[d]}let m=a._zod.parent;if(m&&m!==p){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())cc(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);p?p.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])md(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Ct(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ge(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Mt(t,"input",e.processors),output:Mt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return he(n.element,r);if(n.type==="set")return he(n.valueType,r);if(n.type==="lazy")return he(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return he(n.innerType,r);if(n.type==="intersection")return he(n.left,r)||he(n.right,r);if(n.type==="record"||n.type==="map")return he(n.keyType,r)||he(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:he(n.in,r)||he(n.out,r);if(n.type==="object"){for(let o in n.shape)if(he(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(he(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(he(o,r))return!0;return!!(n.rest&&he(n.rest,r))}return!1}var lc=(e,t={})=>r=>{let n=Dt({...r,processors:t});return q(e,n),jt(n,e),Vt(n,e)},Mt=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Dt({...o??{},target:i,io:t,processors:r});return q(e,s),jt(s,e),Vt(s,e)};var _t=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},wt=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},dc=(e,t)=>{_t(e,"minimum",t),wt(e,"maximum",t)},gc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},bc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},yc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},xc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},fc=(e,t)=>_t(e,"minimum",t.minimum),pc=(e,t)=>wt(e,"maximum",t.maximum),mc=e=>(t,r)=>{xc(t,r.format);let[n,o]=e[r.format];_t(t,"minimum",n),wt(t,"maximum",o)},hd={greater_than:(e,t)=>_t(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>wt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>gc(e,t.value),number_format:mc(Pt),bigint_format:mc(sr),min_length:fc,max_length:pc,length_equals:(e,t)=>dc(e,t.length),min_size:fc,max_size:pc,size_equals:(e,t)=>dc(e,t.size),string_format:(e,t)=>{xc(e,t.format),t.pattern&&bc(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>yc(e,t.mime)};function be(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)hd[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&_t(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&_t(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&wt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&wt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&gc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&yc(t,o.mime);for(let i of o.patterns??[])bc(t,i);return t}var gd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bd=new Map([[wn,Ni],[_r,Zi]]),vc=e=>bd.get(e)??e,Bn=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=be(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=gd[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let p=[...c].map(vc);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Jn=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=be(e);o.type=l?"integer":"number";let p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let h=new Set;for(let v of a)Number.isFinite(v)&&v!==0?h.add(Math.abs(v)):ce(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[x,...d]=h;x!==void 0&&(o.multipleOf=x),d.length&&(o.allOf=[...o.allOf??[],...d.map(v=>({multipleOf:v}))])}},Wn=(e,t,r,n)=>{r.type="boolean"},_c=(e,t,r,n)=>{ce(e,t,r,n,"BigInt cannot be represented in JSON Schema")},wc=(e,t,r,n)=>{ce(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Hn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},kc=(e,t,r,n)=>{ce(e,t,r,n,"Undefined cannot be represented in JSON Schema")},zc=(e,t,r,n)=>{ce(e,t,r,n,"Void cannot be represented in JSON Schema")},Kn=(e,t,r,n)=>{r.not={}},$c=(e,t,r,n)=>{},qn=(e,t,r,n)=>{},Sc=(e,t,r,n)=>{ce(e,t,r,n,"Date cannot be represented in JSON Schema")},Gn=(e,t,r,n)=>{let o=e._zod.def,i=mt(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},Yn=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(ce(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ce(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Ec=(e,t,r,n)=>{ce(e,t,r,n,"NaN cannot be represented in JSON Schema")},Pc=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Oc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=be(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Nc=(e,t,r,n)=>{r.type="boolean"},Xn=(e,t,r,n)=>{ce(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Zc=(e,t,r,n)=>{ce(e,t,r,n,"Function types cannot be represented in JSON Schema")},Qn=(e,t,r,n)=>{ce(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Tc=(e,t,r,n)=>{ce(e,t,r,n,"Map cannot be represented in JSON Schema")},Ac=(e,t,r,n)=>{ce(e,t,r,n,"Set cannot be represented in JSON Schema")},eo=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=be(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=q(i.element,t,{...n,path:[...n.path,"items"]})};function Ut(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ut(t.out):t.type==="catch"?Ut(t.innerType):e._zod.optin}var to=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ce(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ge(o.properties,u,q(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Ut(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=q(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ro=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>q(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},no=(e,t,r,n)=>{let o=e._zod.def,i=q(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=q(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},oo=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((x,d)=>q(x,t,{...n,path:[...n.path,s,d]})),u=i.rest?q(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let x=i.items[l-1];if(!(t.io==="input"?Ut(x)!==void 0:x._zod.optout==="optional"))break;l--}let p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),m&&(o.maxItems=p)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),m&&(o.maxItems=p));let{minimum:f,maximum:h}=be(e);typeof f=="number"&&(o.minItems=f),typeof h=="number"&&(o.maxItems=h)};function Vn(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let x=Vn(e,h,r);return x===h?t:x}for(let h of["anyOf","oneOf"]){let x=t[h];if(!Array.isArray(x))continue;let d=x.map(v=>Vn(e,v,r));d.some((v,P)=>v!==x[P])&&(t={...t,[h]:d})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(h=>typeof h=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:m,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",i||(f.pattern=(n.includes("number")?Zt:gn).source)),f}var Un=new WeakMap;function yd(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Un.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Vn(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var io=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=be(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=q(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)ge(o.patternProperties,vc(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=q(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Un.get(t);l||(l=[],Un.set(t,l),t.deferred.push(()=>yd(t))),l.push(e)}o.additionalProperties=q(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&Ut(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l.map(String))}},so=(e,t,r,n)=>{let o=e._zod.def,i=q(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},ao=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},co=Symbol();function Rc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(ce(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),co):JSON.parse(s)}var uo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Rc(o.defaultValue,e,t,r,n);s!==co&&(r.default=s)},lo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Rc(o.defaultValue,e,t,r,n);s!==co&&(r._prefault=s)},fo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ce(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},po=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;q(s,t,n);let a=t.seen.get(e);a.ref=s},mo=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Ic=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Zr=(e,t,r,n)=>{let o=e._zod.def;q(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},ho=(e,t,r,n)=>{let o=e._zod.innerType;q(o,t,n);let i=t.seen.get(e);i.ref=o},hc={string:Bn,number:Jn,boolean:Wn,bigint:_c,symbol:wc,null:Hn,undefined:kc,void:zc,never:Kn,any:$c,unknown:qn,date:Sc,enum:Gn,literal:Yn,nan:Ec,template_literal:Pc,file:Oc,success:Nc,custom:Xn,function:Zc,transform:Qn,map:Tc,set:Ac,array:eo,object:to,union:ro,intersection:no,tuple:oo,record:io,nullable:so,nonoptional:ao,default:uo,prefault:lo,catch:fo,pipe:po,readonly:mo,promise:Ic,optional:Zr,lazy:ho};function go(e,t){if("_idmap"in e){let n=e,o=Dt({...t,processors:hc}),i={};for(let c of n._idmap.entries()){let[u,l]=c;q(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;jt(o,l),ge(s,u,Vt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Dt({...t,processors:hc});return q(e,r),jt(r,e),Vt(r,e)}var Lc=new WeakSet([Object.prototype,Error.prototype]);function Ar(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Ed=(e,t)=>{ni.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Lc.has(r)||(Lc.add(r),Ar(r,"format",n=>o=>ii(n,o)),Ar(r,"flatten",n=>o=>oi(n,o)),Ar(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ht,2)}),Ar(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ht,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var _e=b("ZodError",Ed,void 0,{Parent:Error});var Fc=dr(_e),Cc=fr(_e),Mc=pr(_e),Dc=mr(_e),jc=ai(_e),Vc=ci(_e),Uc=ui(_e),Bc=li(_e),Jc=di(_e),Wc=fi(_e),Hc=pi(_e),Kc=mi(_e);function Od(){me.localeError||ve(va())}function Bt(){me.memoizer||ve({memoizer:xa()})}var Y=b("ZodType",(e,t)=>(Od(),W.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $e(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Of(e,t))},superRefine(e,t){return this.check(Nf(e,t))},overwrite(e){return this.check(Ke(e))},optional(){return Yc(this)},exactOptional(){return mf(this)},nullable(){return Xc(this)},nullish(){return Yc(Xc(this))},nonoptional(e){return vf(this,e)},array(){return ie(this)},or(e){return qe([this,e])},and(e){return uf(this,e)},transform(e){return Qc(this,pf(e))},default(e){return bf(this,e)},prefault(e){return xf(this,e)},catch(e){return wf(this,e)},pipe(e){return Qc(this,e)},readonly(){return $f(this)},describe(e){let t=this.clone();return at.add(t,{description:e}),t},meta(...e){if(e.length===0)return at.get(this);let t=this.clone();return at.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return A.hide(this,"~standard",{..._n(this),jsonSchema:{input:Mt(this,"input"),output:Mt(this,"output")}})},set"~standard"(e){A.own(this,"~standard",e)},parse:function e(t,r){return Fc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Cc(this,t,r,{callee:e})},safeParse(e,t){return Mc(this,e,t)},async safeParseAsync(e,t){return Dc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){A.own(this,"spa",e)},validate(e,t){return fn(this,e,t)},validateAsync(e,t){return pn(this,e,t)},encode:function e(t,r){return jc(this,t,r,{callee:e})},decode:function e(t,r){return Vc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Uc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Bc(this,t,r,{callee:e})},safeEncode(e,t){return Jc(this,e,t)},safeDecode(e,t){return Wc(this,e,t)},async safeEncodeAsync(e,t){return Hc(this,e,t)},async safeDecodeAsync(e,t){return Kc(this,e,t)},toJSONSchema(e){return lc(this,{})(e)},get description(){return at.get(this)?.description},get _def(){return this._zod.def}}),eu=b("_ZodString",(e,t)=>{vr.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bn(e,r,n,o)},A.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(Nn(...e))},includes(...e){return this.check(An(...e))},startsWith(...e){return this.check(Rn(...e))},endsWith(...e){return this.check(In(...e))},min(...e){return this.check(vt(...e))},max(...e){return this.check(Or(...e))},length(...e){return this.check(Nr(...e))},nonempty(...e){return this.check(vt(1,...e))},lowercase(e){return this.check(Zn(e))},uppercase(e){return this.check(Tn(e))},trim(){return this.check(Fn())},normalize(...e){return this.check(Ln(...e))},toLowerCase(){return this.check(Cn())},toUpperCase(){return this.check(Mn())},slugify(){return this.check(Dn())}})),Nd=b("ZodString",(e,t)=>{vr.init(e,t),eu.init(e,t)},{email(e){return this.check(za(Id,e))},url(e){return this.check(Na(Fd,e))},jwt(e){return this.check(Ja(Xd,e))},emoji(e){return this.check(Za(Cd,e))},guid(e){return this.check($a(Ld,e))},uuid(e){return this.check(Sa(Rr,e))},uuidv4(e){return this.check(Ea(Rr,e))},uuidv6(e){return this.check(Pa(Rr,e))},uuidv7(e){return this.check(Oa(Rr,e))},nanoid(e){return this.check(Ta(Md,e))},cuid(e){return this.check(Aa(Dd,e))},cuid2(e){return this.check(Ra(jd,e))},ulid(e){return this.check(Ia(Vd,e))},base64(e){return this.check(Va(qd,e))},base64url(e){return this.check(Ua(Gd,e))},xid(e){return this.check(La(Ud,e))},ksuid(e){return this.check(Fa(Bd,e))},ipv4(e){return this.check(Ca(Jd,e))},ipv6(e){return this.check(Ma(Wd,e))},cidrv4(e){return this.check(Da(Hd,e))},cidrv6(e){return this.check(ja(Kd,e))},e164(e){return this.check(Ba(Yd,e))},datetime(e){return this.check(Wa(Zd,e))},date(e){return this.check(Ha(Td,e))},time(e){return this.check(Ka(Ad,e))},duration(e){return this.check(qa(Rd,e))}});function Z(e){return ka(Nd,e)}var ee=b("ZodStringFormat",(e,t)=>{X.init(e,t),eu.init(e,t)}),Zd=b("ZodISODateTime",(e,t)=>{Ns.init(e,t),ee.init(e,t)}),Td=b("ZodISODate",(e,t)=>{Zs.init(e,t),ee.init(e,t)}),Ad=b("ZodISOTime",(e,t)=>{Ts.init(e,t),ee.init(e,t)}),Rd=b("ZodISODuration",(e,t)=>{As.init(e,t),ee.init(e,t)}),Id=b("ZodEmail",(e,t)=>{xs.init(e,t),ee.init(e,t)});var Ld=b("ZodGUID",(e,t)=>{bs.init(e,t),ee.init(e,t)});var Rr=b("ZodUUID",(e,t)=>{ys.init(e,t),ee.init(e,t)});var Fd=b("ZodURL",(e,t)=>{ws.init(e,t),ee.init(e,t)});var Cd=b("ZodEmoji",(e,t)=>{ks.init(e,t),ee.init(e,t)});var Md=b("ZodNanoID",(e,t)=>{zs.init(e,t),ee.init(e,t)});var Dd=b("ZodCUID",(e,t)=>{$s.init(e,t),ee.init(e,t)});var jd=b("ZodCUID2",(e,t)=>{Ss.init(e,t),ee.init(e,t)});var Vd=b("ZodULID",(e,t)=>{Es.init(e,t),ee.init(e,t)});var Ud=b("ZodXID",(e,t)=>{Ps.init(e,t),ee.init(e,t)});var Bd=b("ZodKSUID",(e,t)=>{Os.init(e,t),ee.init(e,t)});var Jd=b("ZodIPv4",(e,t)=>{Rs.init(e,t),ee.init(e,t)});var Wd=b("ZodIPv6",(e,t)=>{Ls.init(e,t),ee.init(e,t)});var Hd=b("ZodCIDRv4",(e,t)=>{Fs.init(e,t),ee.init(e,t)});var Kd=b("ZodCIDRv6",(e,t)=>{Cs.init(e,t),ee.init(e,t)});var qd=b("ZodBase64",(e,t)=>{Ds.init(e,t),ee.init(e,t)});var Gd=b("ZodBase64URL",(e,t)=>{js.init(e,t),ee.init(e,t)});var Yd=b("ZodE164",(e,t)=>{Vs.init(e,t),ee.init(e,t)});var Xd=b("ZodJWT",(e,t)=>{Us.init(e,t),ee.init(e,t)});var tu=b("ZodNumber",(e,t)=>{kn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jn(e,r,n,o),e.isFinite=!0},A.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=be(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=be(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=be(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>be(e).format??null},{gt(e,t){return this.check(Er(e,t))},gte(e,t){return this.check(Ft(e,t))},min(e,t){return this.check(Ft(e,t))},lt(e,t){return this.check(Sr(e,t))},lte(e,t){return this.check(Lt(e,t))},max(e,t){return this.check(Lt(e,t))},int(e){return this.check(Ae(e))},safe(e){return this.check(Ae(e))},positive(e){return this.check(Er(0,e))},nonnegative(e){return this.check(Ft(0,e))},negative(e){return this.check(Sr(0,e))},nonpositive(e){return this.check(Lt(0,e))},multipleOf(e,t){return this.check(Pr(e,t))},step(e,t){return this.check(Pr(e,t))},finite(){return this}}));function Oe(e){return Ga(tu,e)}var Qd=b("ZodNumberFormat",(e,t)=>{Bs.init(e,t),tu.init(e,t)});function Ae(e){return Ya(Qd,e)}var ef=b("ZodBoolean",(e,t)=>{Js.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wn(e,r,n,o)});function Re(e){return Xa(ef,e)}var tf=b("ZodNull",(e,t)=>{Ws.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o)});function rf(e){return Qa(tf,e)}var nf=b("ZodUnknown",(e,t)=>{Hs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qn(e,r,n,o)});function qc(){return ec(nf)}var of=b("ZodNever",(e,t)=>{Ks.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)});function ru(e){return tc(of,e)}var sf=b("ZodArray",(e,t)=>{Bt(),qs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n,o),e.element=t.element},{min(e,t){return this.check(vt(e,t))},nonempty(e){return this.check(vt(1,e))},max(e,t){return this.check(Or(e,t))},length(e,t){return this.check(Nr(e,t))},unwrap(){return this.element}});function ie(e,t){return rc(sf,e,t)}var nu=b("ZodObject",(e,t)=>{Bt(),Xs.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o),A.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ct(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:qc()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:qc()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:ru()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return A.extend(this,e)},safeExtend(e){return A.safeExtend(this,e)},merge(e){return A.merge(this,e)},pick(e){return A.pick(this,e)},omit(e){return A.omit(this,e)},partial(...e){return A.partial(yo,this,e[0])},exactPartial(...e){return A.partial(su,this,e[0],"exactPartial")},required(...e){return A.required(au,this,e[0])}});function re(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new nu(r)}function ne(e,t){return new nu({type:"object",shape:e,catchall:ru(),...A.normalizeParams(t)})}var ou=b("ZodUnion",(e,t)=>{zn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o),e.options=t.options});function qe(e,t){return new ou({type:"union",options:e,...A.normalizeParams(t)})}var af=b("ZodDiscriminatedUnion",(e,t)=>{ou.init(e,t),Qs.init(e,t)});function Ge(e,t,r){return new af({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var cf=b("ZodIntersection",(e,t)=>{ea.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o)});function uf(e,t){return new cf({type:"intersection",left:e,right:t})}var lf=b("ZodTuple",(e,t)=>{Bt(),ta.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new yo({type:"optional",innerType:t}))})}});function iu(e,t,r){let n=t instanceof W,o=n?r:t,i=n?t:null;return new lf({type:"tuple",items:e,rest:i,...A.normalizeParams(o)})}var Gc=b("ZodRecord",(e,t)=>{Bt(),ra.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function kt(e,t,r){return!t||!t._zod?new Gc({type:"record",keyType:Z(),valueType:e,...A.normalizeParams(t)}):new Gc({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var bo=b("ZodEnum",(e,t)=>{na.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Gn(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new bo({...t,checks:[],...A.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new bo({...t,checks:[],...A.normalizeParams(o),entries:i})}});function ct(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...A.normalizeParams(t)})}var df=b("ZodLiteral",(e,t)=>{oa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function F(e,t){return new df({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var ff=b("ZodTransform",(e,t)=>{Bt(),ia.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qn(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(A.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(A.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function pf(e){return new ff({type:"transform",transform:e})}var yo=b("ZodOptional",(e,t)=>{$n.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new yo({type:"optional",innerType:e})}var su=b("ZodExactOptional",(e,t)=>{sa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mf(e){return new su({type:"optional",innerType:e})}var hf=b("ZodNullable",(e,t)=>{aa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xc(e){return new hf({type:"nullable",innerType:e})}var gf=b("ZodDefault",(e,t)=>{ca.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bf(e,t){return new gf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var yf=b("ZodPrefault",(e,t)=>{ua.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new yf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var au=b("ZodNonOptional",(e,t)=>{la.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new au({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var _f=b("ZodCatch",(e,t)=>{da.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wf(e,t){return new _f({type:"catch",innerType:e,catchValue:typeof t=="function"?t:A.constantCatch(t)})}var kf=b("ZodPipe",(e,t)=>{fa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.in=t.in,e.out=t.out});function Qc(e,t){return new kf({type:"pipe",in:e,out:t})}var zf=b("ZodReadonly",(e,t)=>{pa.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $f(e){return new zf({type:"readonly",innerType:e})}var Sf=b("ZodLazy",(e,t)=>{ma.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ef(e){return new Sf({type:"lazy",getter:e})}var Pf=b("ZodCustom",(e,t)=>{ha.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o)});function Of(e,t={}){return nc(Pf,e,t)}function Nf(e,t){return oc(e,t)}function cu(e){let t=Ef(()=>qe([Z(e),Oe(),Re(),rf(),ie(t),kt(Z(),t)]));return t}var Jt=cu().meta({id:"JsonValue"});var Ye=/^[A-Za-z_][A-Za-z0-9_]*$/,uu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Lr=re({value:qe([Z(),Oe()]),label:Z()}).strict().meta({id:"Option"}),xo=re({field:Z().min(1),op:ct(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Jt.optional(),valueFrom:Z().regex(Ye).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ue={label:Z(),help:Z().optional(),required:Re().optional(),readonly:Re().optional(),default:Jt.optional()},lu=Ae().positive().optional(),du=iu([Ae().positive(),Ae().nonnegative()]).optional(),vo=Z().min(1),fu=ie(xo).optional(),pu=re({type:F("char"),...ue,size:lu,pattern:Z().optional()}).strict(),mu=re({type:F("text"),...ue,size:lu}).strict(),hu=re({type:F("html"),...ue}).strict(),gu=re({type:F("integer"),...ue,min:Oe().optional(),max:Oe().optional()}).strict(),bu=re({type:F("float"),...ue,min:Oe().optional(),max:Oe().optional(),digits:du}).strict(),yu=re({type:F("monetary"),...ue,currencyField:Z().regex(Ye).optional(),currency:Z().regex(/^[A-Z]{3}$/).optional(),min:Oe().optional(),max:Oe().optional(),digits:du}).strict(),xu=re({type:F("boolean"),...ue}).strict(),vu=re({type:F("date"),...ue}).strict(),_u=re({type:F("datetime"),...ue}).strict(),wu=re({type:F("selection"),...ue,options:ie(Lr).min(1),multiple:Re().optional()}).strict(),ku=re({type:F("binary"),...ue,accept:ie(Z()).optional(),maxSize:Ae().positive().optional()}).strict(),zu=re({type:F("image"),...ue,maxSize:Ae().positive().optional()}).strict(),$u=re({type:F("many2one"),...ue,relation:vo,filter:fu}).strict(),Su=re({type:F("many2many"),...ue,relation:vo,filter:fu}).strict(),Eu=re({type:F("reference"),...ue,models:ie(Lr).min(1)}).strict(),Pu=re({type:F("properties"),...ue}).strict(),Ou=re({type:F("json"),...ue}).strict(),_o=Ge("type",[pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou]).meta({id:"LineField"}),Zf=re({type:F("one2many"),...ue,relation:vo,fields:kt(Z().regex(Ye),_o)}).strict(),wo=Ge("type",[pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Zf,Eu,Pu,Ou]).meta({id:"Field"}),Fr=kt(Z().regex(Ye),wo);var Wt=qe([Re(),Z().min(1)]).meta({id:"Modifier"}),ye=Z().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),ut=Z().regex(Ye),Nu=ct(["info","success","warning","danger","muted"]),Ne=Wt.optional(),Tf=ne({type:F("field"),id:ye,field:ut,label:Z().optional(),widget:Z().min(1).optional(),placeholder:Z().optional(),help:Z().optional(),colspan:Ae().min(1).max(4).optional(),columns:ie(ut).min(1).optional(),invisible:Ne,readonly:Wt.optional(),required:Wt.optional()}),Zu=ne({type:F("button"),id:ye,label:Z(),action:Z().min(1),params:kt(Z(),Jt).optional(),style:ct(["primary","secondary","danger","link"]).optional(),confirm:Z().optional(),icon:Z().optional(),invisible:Ne}),Af=ne({type:F("text"),id:ye,text:Z(),style:ct(["heading","paragraph","note"]).optional(),invisible:Ne}),Tu=ne({type:F("slot"),id:ye,name:Z().min(1),invisible:Ne}),Rf=ne({type:F("section"),id:ye,title:Z().optional(),description:Z().optional(),columns:qe([F(1),F(2),F(3),F(4)]).optional(),collapsible:Re().optional(),collapsed:Re().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"SectionNode"}),If=ne({type:F("tab"),id:ye,label:Z(),icon:Z().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"TabNode"}),Au=ne({type:F("tabs"),id:ye,invisible:Ne,children:ie(If).min(1)}).meta({id:"TabsNode"}),lt=Ge("type",[Tf,Zu,Af,Tu,Rf,Au]).meta({id:"LayoutNode"}),Lf=ne({type:F("step"),id:ye,label:Z(),description:Z().optional(),invisible:Ne,get children(){return ie(lt)}}).meta({id:"StepNode"}),Ff=ne({type:F("wizard"),id:ye,children:ie(Lf).min(1)}).meta({id:"WizardNode"}),Cf=ne({type:F("sections"),id:ye,get children(){return ie(lt)}}).meta({id:"SectionsNode"}),Mf=ne({id:ye,label:Z(),action:Z().min(1),field:ut.optional(),icon:Z().optional(),invisible:Ne}),Df=ne({id:ye,label:Z(),tone:Nu.optional(),invisible:Ne}),jf=ne({id:ye,message:Z(),tone:Nu.optional(),invisible:Ne}),Vf=ne({type:F("sheet"),id:ye,title:ne({field:ut,subtitleField:ut.optional(),avatarField:ut.optional(),placeholder:Z().optional()}).optional(),statusbar:ne({field:ut,visibleStates:ie(qe([Z(),Oe()])).optional(),clickable:Re().optional()}).optional(),buttons:ie(Zu).optional(),statButtons:ie(Mf).optional(),ribbon:Df.optional(),alerts:ie(jf).optional(),get children(){return ie(lt)},sidePanel:Tu.optional()}).meta({id:"SheetNode"}),Cr=Ge("type",[Vf,Cf,Au,Ff]).meta({id:"RootLayout"});var ko="0.1",Uf=Ge("kind",[ne({kind:F("record"),model:Z().min(1)}),ne({kind:F("responses")})]),zt=ne({fieldia:F(ko),id:Z().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:Z().optional(),description:Z().optional(),data:Uf,fields:Fr,layout:Cr}).meta({title:"Fieldia page",description:"A form, survey or record screen as data. This schema checks shape; validatePage() also checks that every reference resolves."});function dt(e,t){switch(e.type){case"BinaryOp":return Bf(e,t);case"UnaryOp":return Jf(e,t);case"Literal":return e.value;case"Identifier":return Wf(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Bf(e,t){let r=Ru(dt(e.left,t)),n=Ru(dt(e.right,t)),o=e.operator.toLowerCase(),i=r!==null&&n!==null;switch(o){case"==":return r===n;case"!=":case"<>":return r!==n;case"<":return i&&r<n;case">":return i&&r>n;case"<=":return i&&r<=n;case">=":return i&&r>=n;case"in":return Array.isArray(n)&&n.includes(r);case"not in":return Array.isArray(n)&&!n.includes(r);case"and":return De(r)&&De(n);case"or":return De(r)||De(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function Jf(e,t){let r=dt(e.operand,t);if(e.operator.toLowerCase()==="not")return!De(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Ru(e){return e===void 0?null:e}function De(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Wf(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var zo=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Ht(e){let t=[];if(!e)return t;let r=/(\(|\)|==|!=|<=|>=|<>|<|>|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|-?\d+\.?\d*|\w+(?:\.\w+)*)/iy,n=/\s*/y,o=0;for(;;){if(n.lastIndex=o,n.exec(e),o=n.lastIndex,o>=e.length)return t;r.lastIndex=o;let i=r.exec(e);if(!i)throw new Error(`Unexpected "${e[o]}" at character ${o+1} of: ${e}`);t.push({type:Hf(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function Hf(e){let t=e.toLowerCase().trim();return zo.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^-?\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var ft=class{constructor(t){ot(this,"tokens");ot(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let r=this.previous().value,n=this.parseAnd();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let r=this.previous().value,n=this.parseNot();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,r=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:r}}return this.parseComparison()}parseComparison(){let t=this.parseValue(),r=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...r)){let n=this.previous().value,o=this.parseValue();return{type:"BinaryOp",operator:n.toLowerCase(),left:t,right:o}}return t}parseValue(){if(this.match("PAREN","(")){let t=this.parseOr();return this.consume("PAREN",")","Expected closing parenthesis"),t}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:zo.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:Kf(t.value)}}if(this.check("IDENTIFIER"))return{type:"Identifier",name:this.advance().value};throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...r){if(this.check(t)){if(r.length===0)return this.advance(),!0;let n=this.peek();if(n&&r.includes(n.value))return this.advance(),!0}return!1}matchLogical(...t){let r=this.peek();if(r&&r.type==="LOGICAL"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}matchOperator(...t){let r=this.peek();if(r&&r.type==="OPERATOR"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,r,n){if(this.check(t)){let o=this.peek();if(o&&o.value===r)return this.advance()}throw new Error(n)}};function Kf(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let r=[],n="",o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];(a==="'"||a==='"')&&(s===0||t[s-1]!=="\\")&&(o?a===i&&(o=!1,i=""):(o=!0,i=a)),a===","&&!o?(r.push(Iu(n.trim())),n=""):n+=a}return n.trim()&&r.push(Iu(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Iu(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function Xe(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new ft(Ht(e)).parse();return{source:e,fields:qf(t),evaluate(r){try{return De(dt(t,r))}catch{return!1}}}}function qf(e){let t=[],r=n=>{switch(n.type){case"Identifier":{let o=n.name.split(".")[0];t.includes(o)||t.push(o);return}case"BinaryOp":r(n.left),r(n.right);return;case"UnaryOp":r(n.operand);return;default:return}};return r(e),t}function Mr(e){let t=zt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:Gf(o.path),message:Yf(o)}))};let r=t.data,n=new So(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function Gf(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Yf(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var $o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),So=class{constructor(t){ot(this,"page",t);ot(this,"issues",[]);ot(this,"ids",new Map)}run(){return this.checkFields(this.page.fields,"fields"),this.walkRoot(this.page.layout,"layout"),this.issues}report(t,r){this.issues.push({path:t,message:r})}claim(t,r){let n=this.ids.get(t);n!==void 0?this.report(r,`duplicate id "${t}", also used at ${n}`):this.ids.set(t,r)}need(t,r,n=this.page.fields){if($o(n,t))return n[t];this.report(r,`no field "${t}"`)}checkModifiers(t,r,n=["invisible"]){for(let o of n){let i=t[o];if(typeof i!="string")continue;let s;try{s=Xe(i).fields}catch(a){this.report(`${r}.${o}`,`cannot read "${i}": ${a.message}`);continue}for(let a of s)$o(this.page.fields,a)||this.report(`${r}.${o}`,`"${i}" reads "${a}", which is not a field of this page`)}}checkFields(t,r){for(let[n,o]of Object.entries(t)){let i=`${r}.${n}`;if(o.type==="monetary"&&o.currencyField!==void 0){let s=this.need(o.currencyField,`${i}.currencyField`,t);s&&!["many2one","selection","char"].includes(s.type)&&this.report(`${i}.currencyField`,`"${o.currencyField}" is a ${s.type}; a currency field must be a many2one, selection or char`)}(o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,a)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${a}].valueFrom`,t)}),o.type==="one2many"&&this.checkFields(o.fields,`${i}.fields`)}}walkRoot(t,r){if(t.type==="tabs")return this.walkNode(t,r);if(this.claim(t.id,r),t.type==="sheet")return this.walkSheet(t,r);if(t.type==="sections")return this.walkChildren(t.children,r);t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkChildren(t,r){t.forEach((n,o)=>this.walkNode(n,`${r}.children[${o}]`))}walkNode(t,r){switch(this.claim(t.id,r),this.checkModifiers(t,r,t.type==="field"?["invisible","readonly","required"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,r);case"section":return t.collapsible&&!t.title&&this.report(r,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(r,"collapsed needs collapsible: true"),this.walkChildren(t.children,r);case"tabs":return this.walkTabs(t,r);default:return}}walkTabs(t,r){t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkSheet(t,r){if(t.title&&(this.need(t.title.field,`${r}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${r}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${r}.title.avatarField`)),t.statusbar){let{field:n,visibleStates:o}=t.statusbar,i=this.need(n,`${r}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${r}.statusbar.field`,`"${n}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&o){let s=new Set(i.options.map(a=>a.value));o.forEach((a,c)=>{s.has(a)||this.report(`${r}.statusbar.visibleStates[${c}]`,`"${a}" is not an option of "${n}"`)})}}t.buttons?.forEach((n,o)=>{this.claim(n.id,`${r}.buttons[${o}]`),this.checkModifiers(n,`${r}.buttons[${o}]`)}),t.statButtons?.forEach((n,o)=>{this.claim(n.id,`${r}.statButtons[${o}]`),this.checkModifiers(n,`${r}.statButtons[${o}]`),n.field!==void 0&&this.need(n.field,`${r}.statButtons[${o}].field`)}),t.ribbon&&(this.claim(t.ribbon.id,`${r}.ribbon`),this.checkModifiers(t.ribbon,`${r}.ribbon`)),t.alerts?.forEach((n,o)=>{this.claim(n.id,`${r}.alerts[${o}]`),this.checkModifiers(n,`${r}.alerts[${o}]`)}),this.walkChildren(t.children,r),t.sidePanel&&(this.claim(t.sidePanel.id,`${r}.sidePanel`),this.checkModifiers(t.sidePanel,`${r}.sidePanel`))}checkFieldNode(t,r){let n=this.need(t.field,`${r}.field`);!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{$o(n.fields,o)||this.report(`${r}.columns[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}):n.type!=="many2many"&&this.report(`${r}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${n.type}`))}};function Lu(){return go(zt,{target:"draft-2020-12"})}function Fu(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let r=Ht(e);if(r.length===0)return!1;let o=new ft(r).parse(),i=dt(o,t);return De(i)}catch{return!1}}function Cu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Ht(e);return t.length===0||new ft(t).parse(),!0}catch{return!1}}function Eo(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function $t(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?G(n.default):Eo(n);return t}function Dr(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Kt(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?Xf(i,o):o}return r}function Xf(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(r=>r.id);case"one2many":return t.map(r=>r.key);case"reference":{let r=t;return`${r.model},${r.id}`}case"binary":case"image":return t.name;default:return t}}function G(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var Qe={en:{required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",or:"or"},ar:{required:"{label} \u0645\u0637\u0644\u0648\u0628",maxLength:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627",pattern:"\u0635\u064A\u063A\u0629 {label} \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629",text:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0635\u064B\u0627",number:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627",integer:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",min:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 {label} \u0639\u0646 {min}",max:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F {label} \u0639\u0646 {max}",decimals:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {digits} \u0645\u0646\u0627\u0632\u0644 \u0639\u0634\u0631\u064A\u0629",boolean:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627",dateFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DD)",dateInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D (\u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u0644\u0634\u0647\u0631 \u0648\u0627\u0644\u064A\u0648\u0645)",datetimeFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u064A\u0646",choice:"\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0642\u064A\u0645\u0629 \u0648\u0627\u062D\u062F\u0629 \u0645\u0646: {options}",choices:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A",record:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0633\u062C\u0644\u064B\u0627",records:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0633\u062C\u0644\u0627\u062A",reference:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0634\u064A\u0631 {label} \u0625\u0644\u0649 {models}",file:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641\u064B\u0627",fileSize:"\u062D\u062C\u0645 {label} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}",fileType:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641 {types}",or:"\u0623\u0648"},de:{required:"{label} ist erforderlich",maxLength:"Maximal {max} Zeichen erlaubt",pattern:"{label} hat nicht das erwartete Format",text:"{label} muss Text sein",number:"{label} muss eine Zahl sein",integer:"{label} muss eine ganze Zahl sein",min:"{label} muss mindestens {min} sein",max:"{label} darf h\xF6chstens {max} sein",decimals:"Maximal {digits} Nachkommastellen erlaubt",boolean:"{label} muss ja oder nein sein",dateFormat:"Ung\xFCltiges Datumsformat (erwartet JJJJ-MM-TT)",dateInvalid:"Ung\xFCltiges Datum (Monat und Tag pr\xFCfen)",datetimeFormat:"Ung\xFCltiges Datums- und Zeitformat (erwartet JJJJ-MM-TTTHH:MM:SS)",datetimeInvalid:"Ung\xFCltiges Datum oder ung\xFCltige Uhrzeit",choice:"Muss eines davon sein: {options}",choices:"{label} muss eine Liste von Optionen sein",record:"{label} muss ein Datensatz sein",records:"{label} muss eine Liste von Datens\xE4tzen sein",reference:"{label} muss auf {models} verweisen",file:"{label} muss eine Datei sein",fileSize:"{label} ist gr\xF6\xDFer als {size}",fileType:"{label} muss eine {types}-Datei sein",or:"oder"},fr:{required:"{label} est obligatoire",maxLength:"{max} caract\xE8res au maximum",pattern:"{label} n'a pas le format attendu",text:"{label} doit \xEAtre du texte",number:"{label} doit \xEAtre un nombre",integer:"{label} doit \xEAtre un nombre entier",min:"{label} doit \xEAtre au moins {min}",max:"{label} doit \xEAtre au plus {max}",decimals:"{digits} d\xE9cimales au maximum",boolean:"{label} doit \xEAtre oui ou non",dateFormat:"Format de date invalide (attendu AAAA-MM-JJ)",dateInvalid:"Date invalide (v\xE9rifiez le mois et le jour)",datetimeFormat:"Format de date et heure invalide (attendu AAAA-MM-JJTHH:MM:SS)",datetimeInvalid:"Date ou heure invalide",choice:"Doit \xEAtre parmi : {options}",choices:"{label} doit \xEAtre une liste de choix",record:"{label} doit \xEAtre un enregistrement",records:"{label} doit \xEAtre une liste d'enregistrements",reference:"{label} doit pointer vers {models}",file:"{label} doit \xEAtre un fichier",fileSize:"{label} d\xE9passe {size}",fileType:"{label} doit \xEAtre un fichier {types}",or:"ou"}};function jr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function qt(e,t,r,n=Qe.en){let o=e.label||"This field",i=(s,a={})=>jr(n[s],{label:o,...a});if(Dr(e,t))return r?i("required"):void 0;switch(e.type){case"char":case"text":case"html":return typeof t!="string"?i("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?i("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?i("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?i("number"):e.type==="integer"&&!Number.isInteger(t)?i("integer"):e.min!==void 0&&t<e.min?i("min",{min:e.min}):e.max!==void 0&&t>e.max?i("max",{max:e.max}):e.type!=="integer"&&e.digits&&Qf(t)>e.digits[1]?i("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:i("boolean");case"date":return ep(t,i);case"datetime":return rp(t,i);case"selection":{let s=new Set(e.options.map(c=>c.value)),a=i("choice",{options:e.options.map(c=>c.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(c=>s.has(c))?void 0:a:i("choices"):s.has(t)?void 0:a}case"many2one":return Po(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Po)?void 0:i("records");case"reference":{let s=t;if(!Po(t)||typeof s.model!="string")return i("record");if(!e.models.some(a=>a.value===s.model)){let a=Du(e.models.map(c=>c.label),n.or);return i("reference",{models:a,aModels:ju(a)})}return}case"binary":case"image":return np(e,t,i,n);default:return}}function Qf(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let r=t.indexOf(".");return r===-1?0:t.length-r-1}function Po(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function ep(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[r,n,o]=e.split("-").map(Number);return Mu(r,n,o)?void 0:t("dateInvalid")}var tp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function rp(e,t){let r=typeof e=="string"?tp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,a,c]=r.slice(1).map(u=>Number(u??0));return Mu(n,o,i)&&s<24&&a<60&&c<60?void 0:t("datetimeInvalid")}function Mu(e,t,r){if(t<1||t>12||r<1)return!1;let n=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return r<=n[t-1]}function np(e,t,r,n){let o=t;if(!op(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:Gt(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>ip(i,o.type))){let i=Du(e.accept.map(sp),n.or);return r("fileType",{types:i,aTypes:ju(i)})}}function op(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function ip(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function sp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Du(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function ju(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function Gt(e){let t=["bytes","KB","MB","GB"],r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${Number(r.toFixed(1))} ${t[n]}`}var Yt={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Vr(e,t=Yt){return new Promise(r=>{t.setTimeout(r,e)})}function Vu(e={}){let t=G(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?Vr(e.delayMs,e.scheduler):Promise.resolve(),s=f=>t[f]??(t[f]={}),a=(f,h)=>{let x=s(f)[String(h)]?.[e.labelField?.[f]??"name"];return typeof x=="string"?x:String(h)},c=f=>Math.max(0,...Object.keys(s(f)).map(Number).filter(Number.isFinite))+1,u=f=>Number.isFinite(Number(f))?Number(f):f;function l(f,h){let x=[...f];for(let d of h)d.op==="create"?x.push({key:d.key,id:++o,values:G(d.values)}):d.op==="update"?x=x.map(v=>v.id===d.id?{...v,values:{...v.values,...G(d.values)}}:v):x=x.filter(v=>v.id!==d.id);return x}function p(f,h,x){let d=[...f],v=P=>({id:P,label:a(x,P)});for(let P of h)P.op==="link"&&!d.some(j=>j.id===P.id)?d.push(v(P.id)):P.op==="unlink"?d=d.filter(j=>j.id!==P.id):P.op==="set"?d=P.ids.map(v):P.op==="clear"&&(d=[]);return d}function m(f,h){let x=f[h];return x&&"relation"in x?x.relation:h}return{records:t,responses:r,calls:n,async load(f){n.push({method:"load",request:f}),await i();let h=s(f.model)[String(f.id)];if(!h)throw new Error(`No ${f.model} record with id ${f.id}`);return G(h)},async save(f){n.push({method:"save",request:f}),await i();let h=f.id??c(f.model),x={...s(f.model)[String(h)]??{},...G(f.changes.values)};for(let[d,v]of Object.entries(f.changes.lines))x[d]=l(x[d]??[],v);for(let[d,v]of Object.entries(f.changes.links))x[d]=p(x[d]??[],v,m(f.fields,d));return s(f.model)[String(h)]=x,{id:h,values:G(x)}},async onchange(f){n.push({method:"onchange",request:f}),await i();let h=e.onchange?.[f.model]?.[f.changed],x=e.warnings?.[f.model]?.[f.changed],d=h?{values:h(G(f.values))}:{},v=x?.(G(f.values));return v?{...d,warning:v}:d},async search(f){n.push({method:"search",request:f}),await i();let h=f.query.trim().toLowerCase();return Object.entries(s(f.model)).filter(([,x])=>(f.filter??[]).every(d=>ap(x,d))).map(([x])=>({id:u(x),label:a(f.model,u(x))})).filter(x=>x.label.toLowerCase().includes(h)).slice(0,f.limit??8)},async submit(f){return n.push({method:"submit",request:f}),await i(),r.push(G(f)),{id:r.length}}}}function ap(e,t){let r=e[t.field],n=r!==null&&typeof r=="object"&&"id"in r?r.id:r,o=t.value;switch(t.op){case"=":return n===o;case"!=":return n!==o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;case"in":return Array.isArray(o)&&o.includes(n);case"not in":return Array.isArray(o)&&!o.includes(n);case"like":return String(n??"").includes(String(o));case"ilike":return String(n??"").toLowerCase().includes(String(o).toLowerCase())}}function Ur(e){let{page:t}=e,r=e.scheduler??Yt,n=e.messages??Qe.en,o=lp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(y=>y.id):[],s=()=>`fieldia:draft:${t.id}:${c.recordId??"new"}`,a={...$t(t.fields),...G(e.values??{})},c={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:G(a),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},u=0,l=0,p=null,m=null,f=new Set,h=new Set,x=null;function d(y){c={...c,...y};for(let _ of[...h])_(c)}function v(y){f.add(y);let _=()=>f.delete(y);return y.then(_,_),y}function P(){return x?.values!==c.values&&(x={values:c.values,context:Kt(c.values,t.fields)}),x.context}function j(y){let _=t.fields[y];if(!_)throw new Error(`The page has no field "${y}"`);return _}function S(y){return Object.keys(t.fields).filter(_=>JSON.stringify(y[_]??null)!==JSON.stringify(a[_]??null))}function w(y){let _=o.get(y);if(!_)throw new Error(`The page has no element "${y}"`);let k=P(),L=_.invisible.evaluate(k);for(let V=_.parent;!L&&V;V=o.get(V)?.parent??null)L=o.get(V)?.invisible.evaluate(k)??!1;let J=_.field?t.fields[_.field]:void 0;return{invisible:L,readonly:_.readonly.evaluate(k)||J?.readonly===!0,required:_.required.evaluate(k)||J?.required===!0}}function $(y){let _=k=>{if(!y)return!0;for(let L=k.id;L;L=o.get(L)?.parent??null)if(L===y)return!0;return!1};return[...o.values()].filter(k=>k.kind==="field"&&_(k)&&!w(k.id).invisible)}function H(y){let _={};for(let k of $(y)){let L=k.field;if(_[L])continue;let J=t.fields[L],V=qt(J,c.values[L],w(k.id).required,n);if(V&&(_[L]=V),J.type==="one2many")for(let ae of c.values[L]??[])for(let[ze,Ue]of Object.entries(J.fields)){let Le=qt(Ue,ae.values[ze],Ue.required===!0,n);Le&&(_[`${L}.${ae.key}.${ze}`]=Le)}}return _}function te(y,_={}){let k=Object.keys(c.errors).length?Q(y):c.errors;d({values:y,dirty:S(y),errors:k,..._})}function Q(y){let _=c;c={...c,values:y};let k=H(c.step??void 0);c=_;let L={};for(let J of Object.keys(c.errors))k[J]&&(L[J]=k[J]);return L}function oe(){let y=e.drafts;y&&(p!==null&&r.clearTimeout(p),p=r.setTimeout(()=>{p=null,y.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:c.values}))},y.delayMs??400))}function B(){p!==null&&r.clearTimeout(p),p=null,e.drafts?.store.removeItem(s())}function se(){let y=e.drafts;if(!y)return;let _=y.store.getItem(s());if(!_)return;let k;try{k=JSON.parse(_)}catch{y.store.removeItem(s());return}y.restore==="auto"?te({...c.values,...k.values},{draft:null}):d({draft:{savedAt:k.savedAt}})}function de(){let y=e.autosave;!y||t.data.kind!=="record"||(m!==null&&r.clearTimeout(m),m=r.setTimeout(()=>{m=null,c.dirty.length&&Object.keys(H()).length===0&&v(Te())},y.delayMs))}function et(y){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let k=++l,L={model:t.data.model,id:c.recordId,changed:y,values:G(c.values)};v(_.onchange(L).then(J=>{if(k!==l)return;let V={...c.values,...J.values??{}};te(V,{warning:J.warning??null,warningField:J.warning?y:null})},()=>{}))}function Ze(y){oe(),de(),et(y)}function Ve(){let y={values:{},lines:{},links:{}};for(let _ of c.dirty){let k=t.fields[_],L=c.values[_],J=a[_];k.type==="one2many"?y.lines[_]=cp(J??[],L??[]):k.type==="many2many"?y.links[_]=up(J??[],L??[]):y.values[_]=G(L)}return y}function Ie(){let y={};for(let _ of $()){let k=_.field;y[k]=G(c.values[k])}return y}async function Te(){let y=H();if(Object.keys(y).length)return d({errors:y}),!1;let _=e.dataSource;d({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!_?.submit)throw new Error("This page has no data source to send its answers to");return await _.submit({pageId:t.id,values:Ie()}),B(),d({status:"saved"}),!0}if(!_?.save)throw new Error("This page has no data source to save to");let k=await _.save({model:t.data.model,id:c.recordId,fields:t.fields,changes:Ve(),values:G(c.values)});B();let L=k.values?{...c.values,...k.values}:c.values;return a=G(L),d({status:"saved",recordId:k.id,values:L,dirty:[]}),!0}catch(k){return d({status:"error",error:k.message}),!1}}async function tt(y,_,k,L,J,V){if(y.type!=="many2one"&&y.type!=="many2many"&&y.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(y.type==="reference"&&!V)throw new Error(`Searching "${_}" needs a model`);let ae=e.dataSource;if(!ae?.search)return[];let ze=y.type==="reference"?void 0:y.filter?.map(({field:Le,op:Hr,value:g,valueFrom:z})=>({field:Le,op:Hr,value:z!==void 0?k[z]??null:g??null})),Ue=y.type==="reference"?V:y.relation;return v(ae.search({model:Ue,query:L,...ze?{filter:ze}:{},limit:J}))}function rt(y){let _=j(y);if(_.type!=="one2many")throw new Error(`"${y}" is a ${_.type}, not a one2many`);return _}function nt(){return c.step?i.indexOf(c.step):-1}async function tr(){let y=e.dataSource;if(!(c.recordId==null||t.data.kind!=="record")){if(!y?.load){d({status:"error",error:"This page has no data source to load from"});return}d({status:"loading",error:null});try{let _=await y.load({model:t.data.model,id:c.recordId,fields:t.fields});a={...$t(t.fields),..._},d({status:"ready",values:G(a),dirty:[],errors:{}}),se()}catch(_){d({status:"error",error:_.message})}}}let St={page:t,getState:()=>c,subscribe(y){return h.add(y),()=>h.delete(y)},load:()=>v(tr()),setValue(y,_){j(y),te({...c.values,[y]:G(_)}),Ze(y)},node:w,fieldReadonly:y=>j(y).readonly===!0,validate(){let y=H();return d({errors:y}),Object.keys(y).length===0},save:()=>v(Te()),reset(){B(),d({values:G(a),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:Ve,addLine(y,_={}){let k=rt(y),L=`new-${++u}`,J={key:L,values:{...$t(k.fields),...G(_)}},V=[...c.values[y]??[],J];return te({...c.values,[y]:V}),Ze(y),L},updateLine(y,_,k,L){if(!rt(y).fields[k])throw new Error(`The lines of "${y}" have no field "${k}"`);let V=(c.values[y]??[]).map(ae=>ae.key===_?{...ae,values:{...ae.values,[k]:G(L)}}:ae);te({...c.values,[y]:V}),Ze(y)},removeLine(y,_){rt(y);let k=(c.values[y]??[]).filter(L=>L.key!==_);te({...c.values,[y]:k}),Ze(y)},async search(y,_,k=8,L={}){return tt(j(y),y,P(),_,k,L.model)},async searchLine(y,_,k,L,J=8){let V=rt(y),ae=V.fields[k];if(!ae)throw new Error(`The lines of "${y}" have no field "${k}"`);let ze=(c.values[y]??[]).find(Ue=>Ue.key===_);if(!ze)throw new Error(`"${y}" has no line "${_}"`);return tt(ae,k,Kt(ze.values,V.fields),L,J)},steps:()=>i.filter(y=>!w(y).invisible),next(){if(!c.step)return!1;let y=H(c.step);if(Object.keys(y).length)return d({errors:y}),!1;let _=St.steps(),k=i.slice(nt()+1).find(L=>_.includes(L));return k?(d({step:k,errors:{}}),!0):!1},back(){if(!c.step)return!1;let y=St.steps(),_=i.slice(0,nt()).reverse().find(k=>y.includes(k));return _?(d({step:_,errors:{}}),!0):!1},async runAction(y){let _=o.get(y);if(!_||_.kind!=="button"&&_.kind!=="stat")throw new Error(`The page has no button "${y}"`);if(w(y).invisible)return;let k=_.source;await v(Promise.resolve(e.onAction?.({id:y,action:k.action,..."params"in k&&k.params?{params:k.params}:{},recordId:c.recordId,values:G(c.values)})))},restoreDraft(){let y=e.drafts?.store.getItem(s());if(!y)return;let _=JSON.parse(y);te({...c.values,..._.values},{draft:null})},discardDraft(){B(),d({draft:null})},async settled(){for(;f.size;)await Promise.allSettled([...f])},dispose(){p!==null&&r.clearTimeout(p),m!==null&&r.clearTimeout(m),h.clear()}};return c.recordId==null&&se(),St}function cp(e,t){let r=[],n=new Map(e.filter(i=>i.id!==void 0).map(i=>[i.key,i]));for(let i of t){let s=n.get(i.key);if(i.id===void 0||!s){r.push({op:"create",key:i.key,values:G(i.values)});continue}let a={};for(let[c,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[c])&&(a[c]=G(u));Object.keys(a).length&&r.push({op:"update",id:i.id,values:a})}let o=new Set(t.map(i=>i.key));for(let i of e)i.id!==void 0&&!o.has(i.key)&&r.push({op:"delete",id:i.id});return r}function up(e,t){let r=new Set(e.map(o=>o.id)),n=new Set(t.map(o=>o.id));return[...t.filter(o=>!r.has(o.id)).map(o=>({op:"link",id:o.id})),...e.filter(o=>!n.has(o.id)).map(o=>({op:"unlink",id:o.id}))]}function lp(e){let t=new Map,r=(o,i,s,a)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:a.field,invisible:Xe(a.invisible),readonly:Xe(a.readonly),required:Xe(a.required),source:o})},n=(o,i)=>{for(let s of o)if(s.type==="field")r(s,i,"field",{invisible:s.invisible,readonly:s.readonly,required:s.required,field:s.field});else if(s.type==="button")r(s,i,"button",{invisible:s.invisible});else if(s.type==="tabs"){r(s,i,"other",{invisible:s.invisible});for(let a of s.children)r(a,s.id,"other",{invisible:a.invisible}),n(a.children,a.id)}else r(s,i,"other",{invisible:s.invisible}),s.type==="section"&&n(s.children,s.id)};if(e.type==="tabs")return n([e],""),t.get(e.id).parent=null,t;if(r(e,null,"other",{}),e.type==="wizard")for(let o of e.children)r(o,e.id,"step",{invisible:o.invisible}),n(o.children,o.id);else if(e.type==="sections")n(e.children,e.id);else{let o=(i,s)=>{s&&r({id:i},e.id,"field",{field:s})};o("#title",e.title?.field),o("#subtitle",e.title?.subtitleField),o("#avatar",e.title?.avatarField),o("#statusbar",e.statusbar?.field);for(let i of e.buttons??[])r(i,e.id,"button",{invisible:i.invisible});for(let i of e.statButtons??[])r(i,e.id,"stat",{invisible:i.invisible});e.ribbon&&r(e.ribbon,e.id,"other",{invisible:e.ribbon.invisible});for(let i of e.alerts??[])r(i,e.id,"other",{invisible:i.invisible});n(e.children,e.id),e.sidePanel&&r(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible})}return t}var we={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",deleteLine:"Delete line",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",deleteLine:"Supprimer la ligne",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var dp=180;function Uu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function Oo(e){let{document:t,id:r,labels:n}=e,o=`${r}-list`,i=t.createElement("input");Object.assign(i,{id:r,className:"fd-input fd-combo-input",autocomplete:"off"}),i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",o),i.placeholder=n.search;let s=t.createElement("ul");s.id=o,s.className="fd-listbox",s.setAttribute("role","listbox"),s.hidden=!0;let a=t.createElement("div");a.className="fd-combo",a.append(i,s);let c="",u=!1,l=[],p=-1,m=0,f,h=!1;function x(){if(s.replaceChildren(),l.forEach((S,w)=>{let $=t.createElement("li");$.id=`${o}-${w}`,$.setAttribute("role","option"),$.setAttribute("aria-selected",String(w===p)),$.className=w===p?"fd-option fd-active":"fd-option",$.textContent=S.label,$.addEventListener("mousedown",H=>H.preventDefault()),$.addEventListener("click",()=>P(w)),s.append($)}),!l.length){let S=t.createElement("li");S.className="fd-empty",S.textContent=n.noResults,s.append(S)}p>=0?i.setAttribute("aria-activedescendant",`${o}-${p}`):i.removeAttribute("aria-activedescendant")}function d(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function v(){s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),p=-1}function P(S){let w=l[S];w&&(v(),u=!1,e.pick(w))}function j(S){clearTimeout(f);let w=++m;f=setTimeout(async()=>{let $=await e.search(S).catch(()=>[]);if(w!==m||t.activeElement!==i)return;let H=e.exclude?.()??new Set;l=$.filter(te=>!H.has(te.id)),p=-1,x(),d()},dp)}return i.addEventListener("input",()=>{u=!0,h||j(i.value)}),i.addEventListener("focus",()=>{h||j("")}),i.addEventListener("keydown",S=>{if(!h)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return j(i.value);if(!l.length)return;p=(p+(S.key==="ArrowDown"?1:-1)+l.length)%l.length,x(),s.children[p]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&p>=0&&(S.preventDefault(),P(p));return;case"Escape":s.hidden||S.preventDefault(),v(),u=!1,i.value=c;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{m++,clearTimeout(f),v();let S=u&&i.value.trim()===""&&c!=="";u=!1,S?e.onCommitEmpty?.():i.value=c}),{element:a,input:i,setText(S){c=S,u||(i.value=S)},setReadonly(S){h=S,i.readOnly=S,S&&v()},close:v}}var No=({form:e,name:t,field:r,id:n,document:o,labels:i=we.en})=>{let s=Oo({document:o,id:n,labels:i,search:c=>e.search(t,c),pick:c=>e.setValue(t,c),onCommitEmpty:()=>e.setValue(t,null)}),a=o.createElement("button");return a.type="button",a.className="fd-combo-clear",a.textContent="\xD7",a.setAttribute("aria-label",Uu(i.clear,{label:r.label})),a.addEventListener("click",()=>{e.setValue(t,null),s.input.focus()}),s.element.append(a),{element:s.element,focus:()=>s.input.focus(),update(c){let u=c.value;s.setText(u?.label??""),s.setReadonly(c.readonly),a.hidden=!u||c.readonly,s.input.setAttribute("aria-invalid",String(c.invalid)),s.input.setAttribute("aria-required",String(c.required)),c.describedBy&&s.input.setAttribute("aria-describedby",c.describedBy)}}},Br=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=()=>e.getState().values[t]??[],s=n.createElement("div");s.className="fd-tags",s.setAttribute("role","group");let a=n.createElement("ul");a.className="fd-chips";let c=Oo({document:n,id:r,labels:o,search:p=>e.search(t,p),pick:p=>{e.setValue(t,[...i(),p]),c.input.value=""},exclude:()=>new Set(i().map(p=>p.id)),onEmptyBackspace:()=>{let p=i();p.length&&e.setValue(t,p.slice(0,-1))}});s.append(a,c.element);let u=!1,l="";return{element:s,focus:()=>c.input.focus(),update(p){let m=p.value??[],f=JSON.stringify([p.readonly,m]);u=p.readonly,c.setReadonly(u),c.element.hidden=u,c.input.setAttribute("aria-invalid",String(p.invalid)),p.describedBy&&c.input.setAttribute("aria-describedby",p.describedBy),f!==l&&(l=f,a.replaceChildren(...m.map(h=>{let x=n.createElement("li");x.className="fd-chip";let d=n.createElement("span");if(d.className="fd-chip-label",d.textContent=h.label,x.append(d),!u){let v=n.createElement("button");v.type="button",v.className="fd-chip-remove",v.textContent="\xD7",v.setAttribute("aria-label",Uu(o.remove,{name:h.label})),v.addEventListener("click",()=>e.setValue(t,i().filter(P=>P.id!==h.id))),x.append(v)}return x})),c.setText(""))}}},Zo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-choices fd-choices-checkbox",o.setAttribute("role","group");let i=[],s={readonly:!1,value:[]},a=()=>{let c=new Set(s.value.map(u=>u.id));for(let{record:u,box:l}of i)l.checked=c.has(u.id),l.disabled=s.readonly};return e.search(t,"",50).then(c=>{i=c.map((u,l)=>{let p=n.createElement("input");p.type="checkbox",p.id=`${r}-${l}`,p.addEventListener("change",()=>{let h=e.getState().values[t]??[];e.setValue(t,p.checked?[...h,u]:h.filter(x=>x.id!==u.id))});let m=n.createElement("label");m.className="fd-choice",m.htmlFor=p.id;let f=n.createElement("span");return f.textContent=u.label,m.append(p,f),o.append(m),{record:u,box:p}}),a()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(c){s={readonly:c.readonly,value:c.value??[]},a()}}},To=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=we.en}=e,a=n.type==="reference"?n.models:[],c=i.createElement("div");c.className="fd-reference";let u=i.createElement("select");u.className="fd-input fd-select",u.setAttribute("aria-label",n.label),u.append(i.createElement("option"));for(let m of a){let f=i.createElement("option");f.value=String(m.value),f.textContent=m.label,u.append(f)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let p=Oo({document:i,id:o,labels:s,search:m=>l?t.search(r,m,8,{model:l}):Promise.resolve([]),pick:m=>t.setValue(r,{model:l,id:m.id,label:m.label}),onCommitEmpty:()=>t.setValue(r,null)});return c.append(u,p.element),{element:c,focus:()=>l?p.input.focus():u.focus(),update(m){let f=m.value;f&&(l=f.model),u.value=l,u.disabled=m.readonly,p.setText(f?.label??""),p.setReadonly(m.readonly||!l)}}};function fp(e,t,r){let n=()=>(e.getState().values[t]??[]).find(o=>o.key===r)?.values??{};return{...e,getState:()=>({...e.getState(),values:n()}),setValue:(o,i)=>e.updateLine(t,r,o,i),search:(o,i,s)=>e.searchLine(t,r,o,i,s)}}var Ao=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=we.en})=>{let a=r,c=(n.columns??Object.keys(a.fields)).filter(w=>a.fields[w]),u=i.createElement("div");u.className="fd-lines",u.id=o,u.setAttribute("role","group");let l=i.createElement("div");l.className="fd-lines-scroll";let p=i.createElement("table");p.className="fd-lines-table";let m=i.createElement("thead"),f=i.createElement("tr");for(let w of c){let $=i.createElement("th");$.scope="col",$.textContent=a.fields[w].label,f.append($)}let h=i.createElement("th");h.className="fd-lines-tools",f.append(h),m.append(f);let x=i.createElement("tbody");p.append(m,x),l.append(p);let d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link fd-lines-add",d.textContent=`+ ${s.addLine}`,u.append(l,d);let v=new Map,P=null,j=!1;d.addEventListener("click",()=>{P=e.addLine(t);let w=v.get(P);w&&(w.cells[0]?.widget.focus(),P=null)});function S(w){let $=i.createElement("tr");$.dataset.line=w.key;let H=fp(e,t,w.key),te=c.map(B=>{let se=a.fields[B],de=`${o}-${w.key}-${B}`,et={type:"field",id:`${n.id}.${w.key}.${B}`,field:B},Ze=Xt({form:H,name:B,field:se,node:et,id:de,document:i,labels:s}),Ve=i.createElement("td"),Ie=i.createElement("label");Ie.className="fd-sr-only",Ie.htmlFor=de,Ie.textContent=se.label;let Te=i.createElement("div");return Te.className="fd-cell-error",Te.hidden=!0,Ve.append(Ie,Ze.element,Te),$.append(Ve),{name:B,def:se,widget:Ze,error:Te}}),Q=i.createElement("td");Q.className="fd-lines-tools";let oe=i.createElement("button");return oe.type="button",oe.className="fd-line-delete",oe.textContent="\xD7",oe.setAttribute("aria-label",s.deleteLine),oe.addEventListener("click",()=>e.removeLine(t,w.key)),Q.append(oe),$.append(Q),{element:$,cells:te,remove:oe}}return{element:u,focus:()=>(x.querySelector("input, select, textarea")??d).focus(),update(w){j=w.readonly,d.hidden=j;let $=w.value??[],H=e.getState().errors,te=new Set($.map(Q=>Q.key));for(let[Q,oe]of v)te.has(Q)||(oe.element.remove(),v.delete(Q));$.forEach((Q,oe)=>{let B=v.get(Q.key);B||(B=S(Q),v.set(Q.key,B)),x.children[oe]!==B.element&&x.insertBefore(B.element,x.children[oe]??null),B.remove.hidden=j,j?B.remove.remove():B.remove.isConnected||B.element.lastElementChild?.append(B.remove);for(let se of B.cells){let de=H[`${t}.${Q.key}.${se.name}`];se.error.hidden=!de,se.error.textContent=de??"",se.widget.update({value:Q.values[se.name],values:Q.values,readonly:j||se.def.readonly===!0,required:se.def.required===!0,invalid:!!de})}}),P&&v.has(P)&&(v.get(P)?.cells[0]?.widget.focus(),P=null)}}};function pp(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{let o=String(n.result??"");t({name:e.name,type:e.type,size:e.size,data:o.slice(o.indexOf(",")+1)})},n.onerror=()=>r(n.error),n.readAsDataURL(e)})}function Bu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=we.en})=>{let a=i.createElement("div");a.className=`fd-file fd-file-${e}`;let c=i.createElement("input");c.type="file",c.id=o,c.className="fd-sr-only";let u=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;u&&(c.accept=u.join(","));let l=i.createElement("img");l.className="fd-image-preview",l.alt=n.label,l.hidden=!0;let p=i.createElement("label");p.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",p.htmlFor=o;let m=i.createElement("span");m.className="fd-button",m.textContent=e==="image"?s.uploadImage:s.upload;let f=i.createElement("span");f.className="fd-help",f.textContent=s.dropHere,p.append(m,f);let h=i.createElement("div");h.className="fd-file-chosen";let x=i.createElement("span");x.className="fd-file-name";let d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=s.replace,d.addEventListener("click",()=>c.click());let v=i.createElement("button");v.type="button",v.className="fd-button fd-button-link",v.textContent=s.removeFile,v.addEventListener("click",()=>t.setValue(r,null)),h.append(x,d,v),a.append(c,...e==="image"?[l]:[],p,h);let P=!1,j=async S=>{!S||P||t.setValue(r,await pp(S))};return c.addEventListener("change",()=>{j(c.files?.[0]),c.value=""}),a.addEventListener("dragover",S=>{P||(S.preventDefault(),a.classList.add("fd-dragging"))}),a.addEventListener("dragleave",()=>a.classList.remove("fd-dragging")),a.addEventListener("drop",S=>{S.preventDefault(),a.classList.remove("fd-dragging"),j(S.dataTransfer?.files?.[0])}),{element:a,focus:()=>(p.hidden?d:c).focus(),update(S){P=S.readonly;let w=S.value;if(p.hidden=!!w||P,h.hidden=!w,d.hidden=v.hidden=P,c.disabled=P,c.setAttribute("aria-invalid",String(S.invalid)),S.describedBy&&c.setAttribute("aria-describedby",S.describedBy),x.textContent=w?`${w.name} \xB7 ${Gt(w.size)}`:"",e==="image"){let $=w?w.data?`data:${w.type};base64,${w.data}`:w.url??"":"";l.hidden=!$,l.getAttribute("src")!==$&&($?l.src=$:l.removeAttribute("src"))}}}}}var Ro=Bu("binary"),Io=Bu("image");var mp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),hp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function Lo(e,t=globalThis.document){let r=t.createElement("template");r.innerHTML=e;let n=i=>{for(let s of[...i.childNodes]){if(s.nodeType===Node.TEXT_NODE)continue;if(s.nodeType!==Node.ELEMENT_NODE){s.remove();continue}let a=s;if(hp.has(a.tagName)){a.remove();continue}if(n(a),!mp.has(a.tagName)){a.replaceWith(...a.childNodes);continue}let c=a.tagName==="A"?a.getAttribute("href"):null;for(let u of[...a.attributes])a.removeAttribute(u.name);c&&/^(https?:|mailto:)/i.test(c.trim())&&a.setAttribute("href",c.trim())}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}var Fo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-input fd-richtext",o.setAttribute("role","textbox"),o.setAttribute("aria-multiline","true"),o.setAttribute("contenteditable","true");let i="";return o.addEventListener("input",()=>{let s=Lo(o.innerHTML,n);i=s,e.setValue(t,s.trim()===""?null:s)}),o.addEventListener("blur",()=>{o.innerHTML!==i&&(o.innerHTML=i)}),{element:o,focus:()=>o.focus(),update(s){let a=Lo(typeof s.value=="string"?s.value:"",n);(a!==i||n.activeElement!==o)&&(o.innerHTML!==a&&(o.innerHTML=a),i=a),o.setAttribute("contenteditable",String(!s.readonly)),o.setAttribute("aria-readonly",String(s.readonly)),o.setAttribute("aria-invalid",String(s.invalid)),s.describedBy&&o.setAttribute("aria-describedby",s.describedBy)}}},Jr=({form:e,name:t,id:r,document:n,labels:o=we.en})=>{let i=n.createElement("div");i.className="fd-json";let s=n.createElement("textarea");s.id=r,s.className="fd-input fd-textarea fd-code",s.spellcheck=!1;let a=n.createElement("div");return a.className="fd-cell-error",a.hidden=!0,i.append(s,a),s.addEventListener("input",()=>{if(s.value.trim()===""){a.hidden=!0,e.setValue(t,null);return}try{let c=JSON.parse(s.value);a.hidden=!0,e.setValue(t,c)}catch{a.hidden=!1,a.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(c){if(n.activeElement!==s){let u=c.value===null||c.value===void 0?"":JSON.stringify(c.value,null,2);s.value!==u&&(s.value=u)}s.readOnly=c.readonly,s.setAttribute("aria-invalid",String(c.invalid||!a.hidden))}}};function Xt(e,t={}){let{field:r,node:n}=e,o=[n.widget?`${r.type}.${n.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type].filter(i=>i!==null);for(let i of o){let s=t[i]??Gu[i];if(s)return s(e)}return wp(e)}function le(e,t,r={},...n){let o=e.createElement(t);for(let[i,s]of Object.entries(r))s!==void 0&&o.setAttribute(i,s);return o.append(...n),o}function je(e,t){e.setAttribute("aria-invalid",String(t.invalid)),e.setAttribute("aria-required",String(t.required)),t.describedBy?e.setAttribute("aria-describedby",t.describedBy):e.removeAttribute("aria-describedby")}var er=e=>e==null?"":String(e);function Qt(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let a=le(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(a.maxLength=n.size),o.placeholder&&(a.placeholder=o.placeholder),a.addEventListener("input",()=>t.setValue(r,a.value===""?null:a.value)),{element:a,focus:()=>a.focus(),update(c){let u=er(c.value);a.value!==u&&(a.value=u),a.readOnly=c.readonly,je(a,c)}}}}var gp=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=le(i,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});return r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),n.placeholder&&(s.placeholder=n.placeholder),s.addEventListener("input",()=>e.setValue(t,s.value===""?null:s.value)),{element:s,focus:()=>s.focus(),update(a){let c=er(a.value);s.value!==c&&(s.value=c),s.readOnly=a.readonly,je(s,a)}}},bp=/^-?(\d+\.?\d*|\.\d+)$/,yp=/^-?\.?$/,Co=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,a=n.type==="integer",c=le(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=a?"numeric":"decimal",o.placeholder&&(c.placeholder=o.placeholder);let u=m=>{let f=m.trim();if(f==="")return null;if(bp.test(f))return Number(f);if(!yp.test(f))return f};c.addEventListener("input",()=>{let m=u(c.value);m!==void 0&&t.setValue(r,m)}),c.addEventListener("blur",()=>{c.value=er(t.getState().values[r])});let l=n.type==="monetary"?le(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?le(s,"span",{class:"fd-number"},l,c):c,focus:()=>c.focus(),update(m){let f=s.activeElement===c,h=u(c.value),x=h===void 0||h===m.value;if(!(f&&x)){let d=er(m.value);c.value!==d&&(c.value=d)}if(c.readOnly=m.readonly,je(c,m),l&&n.type==="monetary"){let d=n.currencyField?m.values[n.currencyField]:null;l.textContent=d&&typeof d=="object"&&"label"in d?d.label:typeof d=="string"?d:n.currency??""}}}};function Ju(e){return({form:t,name:r,id:n,document:o})=>{let i=le(o,"input",{id:n,type:"checkbox",class:e?"fd-switch":"fd-checkbox",role:e});return i.addEventListener("change",()=>t.setValue(r,i.checked)),{element:i,focus:()=>i.focus(),update(s){i.checked=s.value===!0,i.disabled=s.readonly,je(i,s)}}}}function Ku(e){return e.type==="selection"?e.options:[]}var xp=({form:e,name:t,field:r,id:n,document:o})=>{let i=Ku(r),s=le(o,"select",{id:n,class:"fd-input fd-select"},le(o,"option",{value:""}));return i.forEach((a,c)=>s.append(le(o,"option",{value:String(c)},a.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(a){let c=i.findIndex(u=>u.value===a.value);s.value=c===-1?"":String(c),s.disabled=a.readonly,je(s,a)}}};function Wu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Ku(n),a=le(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),c=s.map((u,l)=>{let p=le(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return a.append(le(i,"label",{class:"fd-choice",for:`${o}-${l}`},p,le(i,"span",{},u.label))),p});return a.addEventListener("change",()=>{if(e==="radio"){let u=c.findIndex(l=>l.checked);t.setValue(r,u===-1?null:s[u].value)}else t.setValue(r,s.filter((u,l)=>c[l].checked).map(u=>u.value))}),{element:a,focus:()=>(c.find(u=>u.checked)??c[0])?.focus(),update(u){let l=Array.isArray(u.value)?u.value:[u.value];c.forEach((p,m)=>{p.checked=l.includes(s[m].value),p.disabled=u.readonly}),je(a,u)}}}}function Hu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s="min"in n&&n.min!==void 0?n.min:e==="rating"?1:0,a="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,c=le(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=a;l++){let p=le(i,"button",{type:"button",role:"radio","aria-label":`${l} of ${a}`,"data-value":String(l)},e==="rating"?"\u2605":String(l));e==="scale"&&p.removeAttribute("aria-label"),p.addEventListener("click",()=>t.setValue(r,l)),u.push(p),c.append(p)}return c.addEventListener("keydown",l=>{let p=t.getState().values[r],m=typeof p=="number"?p:s-1,f=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!f)return;l.preventDefault();let h=Math.min(a,Math.max(s,m+f));t.setValue(r,h),u[h-s]?.focus()}),{element:c,focus:()=>(u.find(l=>l.getAttribute("aria-checked")==="true")??u[0])?.focus(),update(l){let p=typeof l.value=="number"?l.value:null;u.forEach((m,f)=>{let h=s+f;m.setAttribute("aria-checked",String(h===p)),m.classList.toggle("fd-on",e==="rating"?p!==null&&h<=p:h===p),m.tabIndex=h===p||p===null&&f===0?0:-1,m.disabled=l.readonly}),je(c,l)}}}}var vp=({form:e,name:t,id:r,document:n})=>{let o=le(n,"input",{id:r,type:"date",class:"fd-input fd-date"});return o.addEventListener("input",()=>e.setValue(t,o.value||null)),{element:o,focus:()=>o.focus(),update(i){let s=er(i.value);o.value!==s&&(o.value=s),o.readOnly=i.readonly,je(o,i)}}},Wr=e=>String(e).padStart(2,"0"),_p=({form:e,name:t,id:r,document:n})=>{let o=le(n,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),i=s=>{if(typeof s!="string"||!s)return"";let a=new Date(s);return Number.isNaN(a.getTime())?"":`${a.getFullYear()}-${Wr(a.getMonth()+1)}-${Wr(a.getDate())}T${Wr(a.getHours())}:${Wr(a.getMinutes())}`};return o.addEventListener("input",()=>{if(!o.value)return e.setValue(t,null);let s=new Date(o.value);Number.isNaN(s.getTime())||e.setValue(t,s.toISOString())}),{element:o,focus:()=>o.focus(),update(s){let a=i(s.value);o.value!==a&&(o.value=a),o.readOnly=s.readonly,je(o,s)}}};function wp({field:e,id:t,document:r}){let n=le(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=qu(o.value,e)}}}function qu(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(r=>r.label).join(", ");case"one2many":{let r=e.length;return`${r} ${r===1?"line":"lines"}`}case"binary":case"image":return e.name;case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var Gu={char:Qt("text"),"char.email":Qt("email"),"char.phone":Qt("tel"),"char.url":Qt("url"),"char.password":Qt("password"),text:gp,integer:Co,float:Co,monetary:Co,"integer.rating":Hu("rating"),"integer.scale":Hu("scale"),boolean:Ju(),"boolean.toggle":Ju("switch"),selection:xp,"selection.radio":Wu("radio"),"selection.checkboxes":Wu("checkbox"),date:vp,datetime:_p,many2one:No,many2many:Br,"many2many.tags":Br,"many2many.checkboxes":Zo,reference:To,one2many:Ao,binary:Ro,image:Io,html:Fo,json:Jr,properties:Jr};var Xu=`
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function mc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;mc(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var hc=new Set(["type","properties","required","additionalProperties"]),fc=["oneOf","anyOf"];function pc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Bn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!hc.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??pc(u);l!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:Bn(c)??{allOf:c};ke(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=pc(s);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function zd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of hc)if(o in e)return;let r=t.filter(o=>fc.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Bn(t);else{let o=r[0],i=fc.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter(a=>a!==o),c=o[i].map(a=>Bn([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Vt(e,n))}function Wt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},f=a.ref;if(a.ref=null,f){n(f);let d=e.seen.get(f),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Vt(u,m),Vt(u,l),c._zod.parent===f)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&d.def)for(let y in u)y==="$ref"||y==="allOf"||y in d.def&&JSON.stringify(u[y])===JSON.stringify(d.def[y])&&delete u[y]}let p=c._zod.parent;if(p&&p!==f){n(p);let d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let m in u)m==="$ref"||m==="allOf"||m in d.def&&JSON.stringify(u[m])===JSON.stringify(d.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())mc(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);f?f.push(u):c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])zd(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Vt(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,ke(s,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ut(t,"input",e.processors),output:Ut(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function we(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return we(n.element,r);if(n.type==="set")return we(n.valueType,r);if(n.type==="lazy")return we(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return we(n.innerType,r);if(n.type==="intersection")return we(n.left,r)||we(n.right,r);if(n.type==="record"||n.type==="map")return we(n.keyType,r)||we(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:we(n.in,r)||we(n.out,r);if(n.type==="object"){for(let o in n.shape)if(we(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(we(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(we(o,r))return!0;return!!(n.rest&&we(n.rest,r))}return!1}var gc=(e,t={})=>r=>{let n=Bt({...r,processors:t});return ee(e,n),Jt(n,e),Wt(n,e)},Ut=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Bt({...o??{},target:i,io:t,processors:r});return ee(e,s),Jt(s,e),Wt(s,e)};var St=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Et=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},bc=(e,t)=>{St(e,"minimum",t),Et(e,"maximum",t)},wc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},kc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},$c=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},yc=(e,t)=>St(e,"minimum",t.minimum),xc=(e,t)=>Et(e,"maximum",t.maximum),vc=e=>(t,r)=>{$c(t,r.format);let[n,o]=e[r.format];St(t,"minimum",n),Et(t,"maximum",o)},$d={greater_than:(e,t)=>St(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Et(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wc(e,t.value),number_format:vc(Tt),bigint_format:vc(ur),min_length:yc,max_length:xc,length_equals:(e,t)=>bc(e,t.length),min_size:yc,max_size:xc,size_equals:(e,t)=>bc(e,t.size),string_format:(e,t)=>{$c(e,t.format),t.pattern&&kc(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zc(e,t.mime)};function ze(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)$d[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&St(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&St(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Et(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Et(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&wc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zc(t,o.mime);for(let i of o.patterns??[])kc(t,i);return t}var Sd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ed=new Map([[$n,Ii],[zr,Fi]]),Sc=e=>Ed.get(e)??e,Kn=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=ze(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Sd[c]??c,o.format===""&&delete o.format,(c==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),a&&a.size>0){let f=[...a].map(Sc);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Hn=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=ze(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),p=typeof a=="number"&&a<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),p?d?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof s=="number"&&(o.maximum=s),c){let m=new Set;for(let h of c)Number.isFinite(h)&&h!==0?m.add(Math.abs(h)):me(e,t,o,n,`A multipleOf divisor of ${h} cannot be represented in JSON Schema`);let[v,...y]=m;v!==void 0&&(o.multipleOf=v),y.length&&(o.allOf=[...o.allOf??[],...y.map(h=>({multipleOf:h}))])}},qn=(e,t,r,n)=>{r.type="boolean"},Ec=(e,t,r,n)=>{me(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Pc=(e,t,r,n)=>{me(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Gn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Oc=(e,t,r,n)=>{me(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Nc=(e,t,r,n)=>{me(e,t,r,n,"Void cannot be represented in JSON Schema")},Yn=(e,t,r,n)=>{r.not={}},Zc=(e,t,r,n)=>{},Xn=(e,t,r,n)=>{},Tc=(e,t,r,n)=>{me(e,t,r,n,"Date cannot be represented in JSON Schema")},Qn=(e,t,r,n)=>{let o=e._zod.def,i=xt(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},eo=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(me(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(me(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},Ac=(e,t,r,n)=>{me(e,t,r,n,"NaN cannot be represented in JSON Schema")},Lc=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Rc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=ze(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},Ic=(e,t,r,n)=>{r.type="boolean"},to=(e,t,r,n)=>{me(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Fc=(e,t,r,n)=>{me(e,t,r,n,"Function types cannot be represented in JSON Schema")},ro=(e,t,r,n)=>{me(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Cc=(e,t,r,n)=>{me(e,t,r,n,"Map cannot be represented in JSON Schema")},Mc=(e,t,r,n)=>{me(e,t,r,n,"Set cannot be represented in JSON Schema")},no=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=ze(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=ee(i.element,t,{...n,path:[...n.path,"items"]})};function Kt(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Kt(t.out):t.type==="catch"?Kt(t.innerType):e._zod.optin}var oo=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&me(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ke(o.properties,u,ee(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?Kt(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=ee(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},io=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>ee(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=s:r.anyOf=s},so=(e,t,r,n)=>{let o=e._zod.def,i=ee(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=ee(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},ao=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((v,y)=>ee(v,t,{...n,path:[...n.path,s,y]})),u=i.rest?ee(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let v=i.items[l-1];if(!(t.io==="input"?Kt(v)!==void 0:v._zod.optout==="optional"))break;l--}let f=i.items.length,p=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,p?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),p&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:a},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),p&&(o.maxItems=f)):(o.items=a,p?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),p&&(o.maxItems=f));let{minimum:d,maximum:m}=ze(e);typeof d=="number"&&(o.minItems=d),typeof m=="number"&&(o.maxItems=m)};function Jn(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let v=Jn(e,m,r);return v===m?t:v}for(let m of["anyOf","oneOf"]){let v=t[m];if(!Array.isArray(v))continue;let y=v.map(h=>Jn(e,h,r));y.some((h,O)=>h!==v[O])&&(t={...t,[m]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(m=>m==="number"||m==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(m=>typeof m=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:f,id:p,...d}=t;return d.enum?d.enum=d.enum.map(m=>typeof m=="number"?String(m):m):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(n.includes("number")?Rt:xn).source)),d}var Wn=new WeakMap;function Pd(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Wn.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Jn(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var co=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=ze(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=ee(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)ke(o.patternProperties,Sc(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ee(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Wn.get(t);l||(l=[],Wn.set(t,l),t.deferred.push(()=>Pd(t))),l.push(e)}o.additionalProperties=ee(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&Kt(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},uo=(e,t,r,n)=>{let o=e._zod.def,i=ee(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},lo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},fo=Symbol();function Dc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(me(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),fo):JSON.parse(s)}var po=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Dc(o.defaultValue,e,t,r,n);s!==fo&&(r.default=s)},mo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Dc(o.defaultValue,e,t,r,n);s!==fo&&(r._prefault=s)},ho=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{me(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},go=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;ee(s,t,n);let c=t.seen.get(e);c.ref=s},bo=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},jc=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Lr=(e,t,r,n)=>{let o=e._zod.def;ee(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},yo=(e,t,r,n)=>{let o=e._zod.innerType;ee(o,t,n);let i=t.seen.get(e);i.ref=o},_c={string:Kn,number:Hn,boolean:qn,bigint:Ec,symbol:Pc,null:Gn,undefined:Oc,void:Nc,never:Yn,any:Zc,unknown:Xn,date:Tc,enum:Qn,literal:eo,nan:Ac,template_literal:Lc,file:Rc,success:Ic,custom:to,function:Fc,transform:ro,map:Cc,set:Mc,array:no,object:oo,union:io,intersection:so,tuple:ao,record:co,nullable:uo,nonoptional:lo,default:po,prefault:mo,catch:ho,pipe:go,readonly:bo,promise:jc,optional:Lr,lazy:yo};function xo(e,t){if("_idmap"in e){let n=e,o=Bt({...t,processors:_c}),i={};for(let a of n._idmap.entries()){let[u,l]=a;ee(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[u,l]=a;Jt(o,l),ke(s,u,Wt(o,l))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:i}}return{schemas:s}}let r=Bt({...t,processors:_c});return ee(e,r),Jt(r,e),Wt(r,e)}var Vc=new WeakSet([Object.prototype,Error.prototype]);function Ir(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Fd=(e,t)=>{ui.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Vc.has(r)||(Vc.add(r),Ir(r,"format",n=>o=>di(n,o)),Ir(r,"flatten",n=>o=>li(n,o)),Ir(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,vt,2)}),Ir(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,vt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Oe=b("ZodError",Fd,void 0,{Parent:Error});var Uc=mr(Oe),Bc=hr(Oe),Jc=gr(Oe),Wc=br(Oe),Kc=pi(Oe),Hc=mi(Oe),qc=hi(Oe),Gc=gi(Oe),Yc=bi(Oe),Xc=yi(Oe),Qc=xi(Oe),eu=vi(Oe);function Md(){_e.localeError||Pe(Sa())}function Ht(){_e.memoizer||Pe({memoizer:$a()})}var re=b("ZodType",(e,t)=>(Md(),Y.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ae(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Mf(e,t))},superRefine(e,t){return this.check(Df(e,t))},overwrite(e){return this.check(tt(e))},optional(){return nu(this)},exactOptional(){return zf(this)},nullable(){return ou(this)},nullish(){return nu(ou(this))},nonoptional(e){return Nf(this,e)},array(){return ue(this)},or(e){return rt([this,e])},and(e){return xf(this,e)},transform(e){return iu(this,kf(e))},default(e){return Ef(this,e)},prefault(e){return Of(this,e)},catch(e){return Tf(this,e)},pipe(e){return iu(this,e)},readonly(){return Rf(this)},describe(e){let t=this.clone();return lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return lt.get(this);let t=this.clone();return lt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return A.hide(this,"~standard",{...zn(this),jsonSchema:{input:Ut(this,"input"),output:Ut(this,"output")}})},set"~standard"(e){A.own(this,"~standard",e)},parse:function e(t,r){return Uc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Bc(this,t,r,{callee:e})},safeParse(e,t){return Jc(this,e,t)},async safeParseAsync(e,t){return Wc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){A.own(this,"spa",e)},validate(e,t){return hn(this,e,t)},validateAsync(e,t){return gn(this,e,t)},encode:function e(t,r){return Kc(this,t,r,{callee:e})},decode:function e(t,r){return Hc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await qc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Gc(this,t,r,{callee:e})},safeEncode(e,t){return Yc(this,e,t)},safeDecode(e,t){return Xc(this,e,t)},async safeEncodeAsync(e,t){return Qc(this,e,t)},async safeDecodeAsync(e,t){return eu(this,e,t)},toJSONSchema(e){return gc(this,{})(e)},get description(){return lt.get(this)?.description},get _def(){return this._zod.def}}),su=b("_ZodString",(e,t)=>{kr.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)},A.derived({format:e=>ze(e).format??null,minLength:e=>ze(e).minimum??null,maxLength:e=>ze(e).maximum??null},{regex(...e){return this.check(An(...e))},includes(...e){return this.check(In(...e))},startsWith(...e){return this.check(Fn(...e))},endsWith(...e){return this.check(Cn(...e))},min(...e){return this.check($t(...e))},max(...e){return this.check(Tr(...e))},length(...e){return this.check(Ar(...e))},nonempty(...e){return this.check($t(1,...e))},lowercase(e){return this.check(Ln(e))},uppercase(e){return this.check(Rn(e))},trim(){return this.check(Dn())},normalize(...e){return this.check(Mn(...e))},toLowerCase(){return this.check(jn())},toUpperCase(){return this.check(Vn())},slugify(){return this.check(Un())}})),Dd=b("ZodString",(e,t)=>{kr.init(e,t),su.init(e,t)},{email(e){return this.check(Na(Jd,e))},url(e){return this.check(Ia(Kd,e))},jwt(e){return this.check(Ya(uf,e))},emoji(e){return this.check(Fa(Hd,e))},guid(e){return this.check(Za(Wd,e))},uuid(e){return this.check(Ta(Fr,e))},uuidv4(e){return this.check(Aa(Fr,e))},uuidv6(e){return this.check(La(Fr,e))},uuidv7(e){return this.check(Ra(Fr,e))},nanoid(e){return this.check(Ca(qd,e))},cuid(e){return this.check(Ma(Gd,e))},cuid2(e){return this.check(Da(Yd,e))},ulid(e){return this.check(ja(Xd,e))},base64(e){return this.check(Ha(sf,e))},base64url(e){return this.check(qa(af,e))},xid(e){return this.check(Va(Qd,e))},ksuid(e){return this.check(Ua(ef,e))},ipv4(e){return this.check(Ba(tf,e))},ipv6(e){return this.check(Ja(rf,e))},cidrv4(e){return this.check(Wa(nf,e))},cidrv6(e){return this.check(Ka(of,e))},e164(e){return this.check(Ga(cf,e))},datetime(e){return this.check(Xa(jd,e))},date(e){return this.check(Qa(Vd,e))},time(e){return this.check(ec(Ud,e))},duration(e){return this.check(tc(Bd,e))}});function P(e){return Oa(Dd,e)}var se=b("ZodStringFormat",(e,t)=>{oe.init(e,t),su.init(e,t)}),jd=b("ZodISODateTime",(e,t)=>{Is.init(e,t),se.init(e,t)}),Vd=b("ZodISODate",(e,t)=>{Fs.init(e,t),se.init(e,t)}),Ud=b("ZodISOTime",(e,t)=>{Cs.init(e,t),se.init(e,t)}),Bd=b("ZodISODuration",(e,t)=>{Ms.init(e,t),se.init(e,t)}),Jd=b("ZodEmail",(e,t)=>{$s.init(e,t),se.init(e,t)});var Wd=b("ZodGUID",(e,t)=>{ks.init(e,t),se.init(e,t)});var Fr=b("ZodUUID",(e,t)=>{zs.init(e,t),se.init(e,t)});var Kd=b("ZodURL",(e,t)=>{Ps.init(e,t),se.init(e,t)});var Hd=b("ZodEmoji",(e,t)=>{Os.init(e,t),se.init(e,t)});var qd=b("ZodNanoID",(e,t)=>{Ns.init(e,t),se.init(e,t)});var Gd=b("ZodCUID",(e,t)=>{Zs.init(e,t),se.init(e,t)});var Yd=b("ZodCUID2",(e,t)=>{Ts.init(e,t),se.init(e,t)});var Xd=b("ZodULID",(e,t)=>{As.init(e,t),se.init(e,t)});var Qd=b("ZodXID",(e,t)=>{Ls.init(e,t),se.init(e,t)});var ef=b("ZodKSUID",(e,t)=>{Rs.init(e,t),se.init(e,t)});var tf=b("ZodIPv4",(e,t)=>{Ds.init(e,t),se.init(e,t)});var rf=b("ZodIPv6",(e,t)=>{Vs.init(e,t),se.init(e,t)});var nf=b("ZodCIDRv4",(e,t)=>{Us.init(e,t),se.init(e,t)});var of=b("ZodCIDRv6",(e,t)=>{Bs.init(e,t),se.init(e,t)});var sf=b("ZodBase64",(e,t)=>{Ws.init(e,t),se.init(e,t)});var af=b("ZodBase64URL",(e,t)=>{Ks.init(e,t),se.init(e,t)});var cf=b("ZodE164",(e,t)=>{Hs.init(e,t),se.init(e,t)});var uf=b("ZodJWT",(e,t)=>{qs.init(e,t),se.init(e,t)});var au=b("ZodNumber",(e,t)=>{Sn.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o),e.isFinite=!0},A.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=ze(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=ze(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=ze(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>ze(e).format??null},{gt(e,t){return this.check(Nr(e,t))},gte(e,t){return this.check(jt(e,t))},min(e,t){return this.check(jt(e,t))},lt(e,t){return this.check(Or(e,t))},lte(e,t){return this.check(Dt(e,t))},max(e,t){return this.check(Dt(e,t))},int(e){return this.check(je(e))},safe(e){return this.check(je(e))},positive(e){return this.check(Nr(0,e))},nonnegative(e){return this.check(jt(0,e))},negative(e){return this.check(Or(0,e))},nonpositive(e){return this.check(Dt(0,e))},multipleOf(e,t){return this.check(Zr(e,t))},step(e,t){return this.check(Zr(e,t))},finite(){return this}}));function Fe(e){return rc(au,e)}var lf=b("ZodNumberFormat",(e,t)=>{Gs.init(e,t),au.init(e,t)});function je(e){return nc(lf,e)}var df=b("ZodBoolean",(e,t)=>{Ys.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qn(e,r,n,o)});function Ve(e){return oc(df,e)}var ff=b("ZodNull",(e,t)=>{Xs.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gn(e,r,n,o)});function pf(e){return ic(ff,e)}var mf=b("ZodUnknown",(e,t)=>{Qs.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o)});function tu(){return sc(mf)}var hf=b("ZodNever",(e,t)=>{ea.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o)});function cu(e){return ac(hf,e)}var gf=b("ZodArray",(e,t)=>{Ht(),ta.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(e,r,n,o),e.element=t.element},{min(e,t){return this.check($t(e,t))},nonempty(e){return this.check($t(1,e))},max(e,t){return this.check(Tr(e,t))},length(e,t){return this.check(Ar(e,t))},unwrap(){return this.element}});function ue(e,t){return cc(gf,e,t)}var uu=b("ZodObject",(e,t)=>{Ht(),oa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o),A.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ke(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A.mergeDefs(this._zod.def,{catchall:tu()}))},loose(){return this.clone(A.mergeDefs(this._zod.def,{catchall:tu()}))},strict(){return this.clone(A.mergeDefs(this._zod.def,{catchall:cu()}))},strip(){return this.clone(A.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return A.extend(this,e)},safeExtend(e){return A.safeExtend(this,e)},merge(e){return A.merge(this,e)},pick(e){return A.pick(this,e)},omit(e){return A.omit(this,e)},partial(...e){return A.partial(_o,this,e[0])},exactPartial(...e){return A.partial(fu,this,e[0],"exactPartial")},required(...e){return A.required(pu,this,e[0])}});function ae(e,t){let r={type:"object",shape:e??{},...A.normalizeParams(t)};return new uu(r)}function le(e,t){return new uu({type:"object",shape:e,catchall:cu(),...A.normalizeParams(t)})}var lu=b("ZodUnion",(e,t)=>{En.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.options=t.options});function rt(e,t){return new lu({type:"union",options:e,...A.normalizeParams(t)})}var bf=b("ZodDiscriminatedUnion",(e,t)=>{lu.init(e,t),ia.init(e,t)});function nt(e,t,r){return new bf({type:"union",options:t,discriminator:e,...A.normalizeParams(r)})}var yf=b("ZodIntersection",(e,t)=>{sa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o)});function xf(e,t){return new yf({type:"intersection",left:e,right:t})}var vf=b("ZodTuple",(e,t)=>{Ht(),aa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new _o({type:"optional",innerType:t}))})}});function du(e,t,r){let n=t instanceof Y,o=n?r:t,i=n?t:null;return new vf({type:"tuple",items:e,rest:i,...A.normalizeParams(o)})}var ru=b("ZodRecord",(e,t)=>{Ht(),ca.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function dt(e,t,r){return!t||!t._zod?new ru({type:"record",keyType:P(),valueType:e,...A.normalizeParams(t)}):new ru({type:"record",keyType:e,valueType:t,...A.normalizeParams(r)})}var vo=b("ZodEnum",(e,t)=>{ua.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Qn(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new vo({...t,checks:[],...A.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new vo({...t,checks:[],...A.normalizeParams(o),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new vo({type:"enum",entries:r,...A.normalizeParams(t)})}var _f=b("ZodLiteral",(e,t)=>{la.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function C(e,t){return new _f({type:"literal",values:Array.isArray(e)?e:[e],...A.normalizeParams(t)})}var wf=b("ZodTransform",(e,t)=>{Ht(),da.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new zt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(A.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(A.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function kf(e){return new wf({type:"transform",transform:e})}var _o=b("ZodOptional",(e,t)=>{Pn.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nu(e){return new _o({type:"optional",innerType:e})}var fu=b("ZodExactOptional",(e,t)=>{fa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new fu({type:"optional",innerType:e})}var $f=b("ZodNullable",(e,t)=>{pa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new $f({type:"nullable",innerType:e})}var Sf=b("ZodDefault",(e,t)=>{ma.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ef(e,t){return new Sf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var Pf=b("ZodPrefault",(e,t)=>{ha.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Of(e,t){return new Pf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():A.shallowClone(t)}})}var pu=b("ZodNonOptional",(e,t)=>{ga.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new pu({type:"nonoptional",innerType:e,...A.normalizeParams(t)})}var Zf=b("ZodCatch",(e,t)=>{ba.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tf(e,t){return new Zf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:A.constantCatch(t)})}var Af=b("ZodPipe",(e,t)=>{ya.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>go(e,r,n,o),e.in=t.in,e.out=t.out});function iu(e,t){return new Af({type:"pipe",in:e,out:t})}var Lf=b("ZodReadonly",(e,t)=>{xa.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rf(e){return new Lf({type:"readonly",innerType:e})}var If=b("ZodLazy",(e,t)=>{va.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ff(e){return new If({type:"lazy",getter:e})}var Cf=b("ZodCustom",(e,t)=>{_a.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o)});function Mf(e,t={}){return uc(Cf,e,t)}function Df(e,t){return lc(e,t)}function mu(e){let t=Ff(()=>rt([P(e),Fe(),Ve(),pf(),ue(t),dt(P(),t)]));return t}var qt=mu().meta({id:"JsonValue"});var Ce=/^[A-Za-z_][A-Za-z0-9_]*$/,hu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Mr=ae({value:rt([P(),Fe()]),label:P()}).strict().meta({id:"Option"}),wo=ae({field:P().min(1),op:Ke(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:qt.optional(),valueFrom:P().regex(Ce).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),he={label:P(),help:P().optional(),required:Ve().optional(),readonly:Ve().optional(),default:qt.optional()},gu=je().positive().optional(),bu=du([je().positive(),je().nonnegative()]).optional(),ko=P().min(1),yu=ue(wo).optional(),xu=ae({type:C("char"),...he,size:gu,pattern:P().optional()}).strict(),vu=ae({type:C("text"),...he,size:gu}).strict(),_u=ae({type:C("html"),...he}).strict(),wu=ae({type:C("integer"),...he,min:Fe().optional(),max:Fe().optional()}).strict(),ku=ae({type:C("float"),...he,min:Fe().optional(),max:Fe().optional(),digits:bu}).strict(),zu=ae({type:C("monetary"),...he,currencyField:P().regex(Ce).optional(),currency:P().regex(/^[A-Z]{3}$/).optional(),min:Fe().optional(),max:Fe().optional(),digits:bu}).strict(),$u=ae({type:C("boolean"),...he}).strict(),Su=ae({type:C("date"),...he}).strict(),Eu=ae({type:C("datetime"),...he}).strict(),Pu=ae({type:C("selection"),...he,options:ue(Mr).min(1),multiple:Ve().optional()}).strict(),Ou=ae({type:C("binary"),...he,accept:ue(P()).optional(),maxSize:je().positive().optional()}).strict(),Nu=ae({type:C("image"),...he,maxSize:je().positive().optional()}).strict(),Zu=ae({type:C("many2one"),...he,relation:ko,filter:yu}).strict(),Tu=ae({type:C("many2many"),...he,relation:ko,filter:yu}).strict(),Au=ae({type:C("reference"),...he,models:ue(Mr).min(1)}).strict(),Lu=ae({type:C("properties"),...he}).strict(),Ru=ae({type:C("json"),...he}).strict(),zo=nt("type",[xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou,Nu,Zu,Tu,Au,Lu,Ru]).meta({id:"LineField"}),$o=ae({field:P().regex(Ce),text:P().regex(Ce),section:P().min(1).optional(),note:P().min(1).optional()}).strict().meta({id:"LineKinds"}),jf=ae({type:C("one2many"),...he,relation:ko,fields:dt(P().regex(Ce),zo),lineKinds:$o.optional(),sequenceField:P().regex(Ce).optional()}).strict(),So=nt("type",[xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu,Ou,Nu,Zu,Tu,jf,Au,Lu,Ru]).meta({id:"Field"}),Dr=dt(P().regex(Ce),So);var Gt=rt([Ve(),P().min(1)]).meta({id:"Modifier"}),$e=P().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),He=P().regex(Ce),Iu=Ke(["info","success","warning","danger","muted"]),Me=Gt.optional(),Vf=le({type:C("field"),id:$e,field:He,label:P().optional(),widget:P().min(1).optional(),placeholder:P().optional(),help:P().optional(),colspan:je().min(1).max(4).optional(),columns:ue(He).min(1).optional(),totals:ue(He).min(1).optional(),optionalColumns:dt(He,Ke(["show","hide"])).optional(),editMode:Ke(["cell","row"]).optional(),invisible:Me,readonly:Gt.optional(),required:Gt.optional()}),Fu=le({type:C("button"),id:$e,label:P(),action:P().min(1),params:dt(P(),qt).optional(),style:Ke(["primary","secondary","danger","link"]).optional(),confirm:P().optional(),icon:P().optional(),invisible:Me}),Uf=le({type:C("text"),id:$e,text:P(),style:Ke(["heading","paragraph","note"]).optional(),invisible:Me}),Cu=le({type:C("slot"),id:$e,name:P().min(1),invisible:Me}),Bf=le({type:C("section"),id:$e,title:P().optional(),description:P().optional(),columns:rt([C(1),C(2),C(3),C(4)]).optional(),collapsible:Ve().optional(),collapsed:Ve().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"SectionNode"}),Jf=le({type:C("tab"),id:$e,label:P(),icon:P().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"TabNode"}),Mu=le({type:C("tabs"),id:$e,invisible:Me,children:ue(Jf).min(1)}).meta({id:"TabsNode"}),ft=nt("type",[Vf,Fu,Uf,Cu,Bf,Mu]).meta({id:"LayoutNode"}),Wf=le({type:C("step"),id:$e,label:P(),description:P().optional(),invisible:Me,get children(){return ue(ft)}}).meta({id:"StepNode"}),Kf=le({type:C("wizard"),id:$e,children:ue(Wf).min(1)}).meta({id:"WizardNode"}),Hf=le({type:C("sections"),id:$e,get children(){return ue(ft)}}).meta({id:"SectionsNode"}),qf=le({id:$e,label:P(),action:P().min(1),field:He.optional(),icon:P().optional(),invisible:Me}),Gf=le({id:$e,label:P(),tone:Iu.optional(),invisible:Me}),Yf=le({id:$e,message:P(),tone:Iu.optional(),invisible:Me}),Xf=le({type:C("sheet"),id:$e,title:le({field:He,subtitleField:He.optional(),avatarField:He.optional(),placeholder:P().optional()}).optional(),statusbar:le({field:He,visibleStates:ue(rt([P(),Fe()])).optional(),clickable:Ve().optional()}).optional(),buttons:ue(Fu).optional(),statButtons:ue(qf).optional(),ribbon:Gf.optional(),alerts:ue(Yf).optional(),get children(){return ue(ft)},sidePanel:Cu.optional()}).meta({id:"SheetNode"}),jr=nt("type",[Xf,Hf,Mu,Kf]).meta({id:"RootLayout"});var Eo="0.1",Qf=nt("kind",[le({kind:C("record"),model:P().min(1)}),le({kind:C("responses")})]),Pt=le({fieldia:C(Eo),id:P().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:P().optional(),description:P().optional(),data:Qf,fields:Dr,layout:jr}).meta({title:"Fieldia page",description:"A form, survey or record screen as data. This schema checks shape; validatePage() also checks that every reference resolves."});function pt(e,t){switch(e.type){case"BinaryOp":return ep(e,t);case"UnaryOp":return tp(e,t);case"Literal":return e.value;case"Identifier":return rp(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function ep(e,t){let r=Du(pt(e.left,t)),n=Du(pt(e.right,t)),o=e.operator.toLowerCase(),i=r!==null&&n!==null;switch(o){case"==":return r===n;case"!=":case"<>":return r!==n;case"<":return i&&r<n;case">":return i&&r>n;case"<=":return i&&r<=n;case">=":return i&&r>=n;case"in":return Array.isArray(n)&&n.includes(r);case"not in":return Array.isArray(n)&&!n.includes(r);case"and":return qe(r)&&qe(n);case"or":return qe(r)||qe(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function tp(e,t){let r=pt(e.operand,t);if(e.operator.toLowerCase()==="not")return!qe(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Du(e){return e===void 0?null:e}function qe(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function rp(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var Po=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Yt(e){let t=[];if(!e)return t;let r=/(\(|\)|==|!=|<=|>=|<>|<|>|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|-?\d+\.?\d*|\w+(?:\.\w+)*)/iy,n=/\s*/y,o=0;for(;;){if(n.lastIndex=o,n.exec(e),o=n.lastIndex,o>=e.length)return t;r.lastIndex=o;let i=r.exec(e);if(!i)throw new Error(`Unexpected "${e[o]}" at character ${o+1} of: ${e}`);t.push({type:np(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function np(e){let t=e.toLowerCase().trim();return Po.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^-?\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var mt=class{constructor(t){at(this,"tokens");at(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let r=this.previous().value,n=this.parseAnd();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let r=this.previous().value,n=this.parseNot();t={type:"BinaryOp",operator:r.toLowerCase(),left:t,right:n}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,r=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:r}}return this.parseComparison()}parseComparison(){let t=this.parseValue(),r=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...r)){let n=this.previous().value,o=this.parseValue();return{type:"BinaryOp",operator:n.toLowerCase(),left:t,right:o}}return t}parseValue(){if(this.match("PAREN","(")){let t=this.parseOr();return this.consume("PAREN",")","Expected closing parenthesis"),t}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:Po.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:op(t.value)}}if(this.check("IDENTIFIER"))return{type:"Identifier",name:this.advance().value};throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...r){if(this.check(t)){if(r.length===0)return this.advance(),!0;let n=this.peek();if(n&&r.includes(n.value))return this.advance(),!0}return!1}matchLogical(...t){let r=this.peek();if(r&&r.type==="LOGICAL"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}matchOperator(...t){let r=this.peek();if(r&&r.type==="OPERATOR"){let n=r.value.toLowerCase();if(t.map(o=>o.toLowerCase()).includes(n))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,r,n){if(this.check(t)){let o=this.peek();if(o&&o.value===r)return this.advance()}throw new Error(n)}};function op(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let r=[],n="",o=!1,i="";for(let s=0;s<t.length;s++){let c=t[s];(c==="'"||c==='"')&&(s===0||t[s-1]!=="\\")&&(o?c===i&&(o=!1,i=""):(o=!0,i=c)),c===","&&!o?(r.push(ju(n.trim())),n=""):n+=c}return n.trim()&&r.push(ju(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function ju(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function ot(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new mt(Yt(e)).parse();return{source:e,fields:ip(t),evaluate(r){try{return qe(pt(t,r))}catch{return!1}}}}function ip(e){let t=[],r=n=>{switch(n.type){case"Identifier":{let o=n.name.split(".")[0];t.includes(o)||t.push(o);return}case"BinaryOp":r(n.left),r(n.right);return;case"UnaryOp":r(n.operand);return;default:return}};return r(e),t}function Ur(e){let t=Pt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:sp(o.path),message:ap(o)}))};let r=t.data,n=new Oo(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function sp(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function ap(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var Vr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Oo=class{constructor(t){at(this,"page",t);at(this,"issues",[]);at(this,"ids",new Map)}run(){return this.checkFields(this.page.fields,"fields"),this.walkRoot(this.page.layout,"layout"),this.issues}report(t,r){this.issues.push({path:t,message:r})}claim(t,r){let n=this.ids.get(t);n!==void 0?this.report(r,`duplicate id "${t}", also used at ${n}`):this.ids.set(t,r)}need(t,r,n=this.page.fields){if(Vr(n,t))return n[t];this.report(r,`no field "${t}"`)}checkModifiers(t,r,n=["invisible"]){for(let o of n){let i=t[o];if(typeof i!="string")continue;let s;try{s=ot(i).fields}catch(c){this.report(`${r}.${o}`,`cannot read "${i}": ${c.message}`);continue}for(let c of s)Vr(this.page.fields,c)||this.report(`${r}.${o}`,`"${i}" reads "${c}", which is not a field of this page`)}}checkFields(t,r){for(let[n,o]of Object.entries(t)){let i=`${r}.${n}`;if(o.type==="monetary"&&o.currencyField!==void 0){let s=this.need(o.currencyField,`${i}.currencyField`,t);s&&!["many2one","selection","char"].includes(s.type)&&this.report(`${i}.currencyField`,`"${o.currencyField}" is a ${s.type}; a currency field must be a many2one, selection or char`)}if((o.type==="many2one"||o.type==="many2many")&&o.filter&&o.filter.forEach((s,c)=>{s.valueFrom!==void 0&&this.need(s.valueFrom,`${i}.filter[${c}].valueFrom`,t)}),o.type==="one2many"&&(this.checkFields(o.fields,`${i}.fields`),o.lineKinds&&this.checkLineKinds(n,o.lineKinds,o.fields,`${i}.lineKinds`),o.sequenceField!==void 0)){let s=o.fields[o.sequenceField];s?s.type!=="integer"&&this.report(`${i}.sequenceField`,`"${o.sequenceField}" is a ${s.type}; the field that keeps the order of lines must be an integer`):this.report(`${i}.sequenceField`,`"${o.sequenceField}" is not a field of the lines of "${n}"`)}}}checkLineKinds(t,r,n,o){let i=n[r.field];if(!i)this.report(`${o}.field`,`"${r.field}" is not a field of the lines of "${t}"`);else if(i.type!=="selection"&&i.type!=="char")this.report(`${o}.field`,`"${r.field}" is a ${i.type}; the field that says what a line is must be a selection or char`);else if(i.type==="selection")for(let c of["section","note"]){let a=r[c]??c;i.options.some(u=>u.value===a)||this.report(`${o}.${c}`,`"${r.field}" has no option "${a}"`)}let s=n[r.text];s?s.type!=="char"&&s.type!=="text"&&this.report(`${o}.text`,`"${r.text}" is a ${s.type}; a section's or note's text must be a char or text field`):this.report(`${o}.text`,`"${r.text}" is not a field of the lines of "${t}"`)}walkRoot(t,r){if(t.type==="tabs")return this.walkNode(t,r);if(this.claim(t.id,r),t.type==="sheet")return this.walkSheet(t,r);if(t.type==="sections")return this.walkChildren(t.children,r);t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkChildren(t,r){t.forEach((n,o)=>this.walkNode(n,`${r}.children[${o}]`))}walkNode(t,r){switch(this.claim(t.id,r),this.checkModifiers(t,r,t.type==="field"?["invisible","readonly","required"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,r);case"section":return t.collapsible&&!t.title&&this.report(r,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(r,"collapsed needs collapsible: true"),this.walkChildren(t.children,r);case"tabs":return this.walkTabs(t,r);default:return}}walkTabs(t,r){t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkSheet(t,r){if(t.title&&(this.need(t.title.field,`${r}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${r}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${r}.title.avatarField`)),t.statusbar){let{field:n,visibleStates:o}=t.statusbar,i=this.need(n,`${r}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${r}.statusbar.field`,`"${n}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&o){let s=new Set(i.options.map(c=>c.value));o.forEach((c,a)=>{s.has(c)||this.report(`${r}.statusbar.visibleStates[${a}]`,`"${c}" is not an option of "${n}"`)})}}t.buttons?.forEach((n,o)=>{this.claim(n.id,`${r}.buttons[${o}]`),this.checkModifiers(n,`${r}.buttons[${o}]`)}),t.statButtons?.forEach((n,o)=>{this.claim(n.id,`${r}.statButtons[${o}]`),this.checkModifiers(n,`${r}.statButtons[${o}]`),n.field!==void 0&&this.need(n.field,`${r}.statButtons[${o}].field`)}),t.ribbon&&(this.claim(t.ribbon.id,`${r}.ribbon`),this.checkModifiers(t.ribbon,`${r}.ribbon`)),t.alerts?.forEach((n,o)=>{this.claim(n.id,`${r}.alerts[${o}]`),this.checkModifiers(n,`${r}.alerts[${o}]`)}),this.walkChildren(t.children,r),t.sidePanel&&(this.claim(t.sidePanel.id,`${r}.sidePanel`),this.checkModifiers(t.sidePanel,`${r}.sidePanel`))}checkFieldNode(t,r){let n=this.need(t.field,`${r}.field`);if(n&&t.totals&&(n.type!=="one2many"?this.report(`${r}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${n.type}`):t.totals.forEach((o,i)=>{let s=Vr(n.fields,o)?n.fields[o]:void 0;s?["integer","float","monetary"].includes(s.type)||this.report(`${r}.totals[${i}]`,`"${o}" is a ${s.type}; only integer, float and monetary columns add up`):this.report(`${r}.totals[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)})),n&&t.editMode&&n.type!=="one2many"&&this.report(`${r}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${n.type}`),n&&t.optionalColumns)if(n.type!=="one2many")this.report(`${r}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${n.type}`);else{let o=t.columns??Object.keys(n.fields).filter(i=>i!==n.lineKinds?.field&&i!==n.sequenceField);for(let i of Object.keys(t.optionalColumns))o.includes(i)||this.report(`${r}.optionalColumns.${i}`,`"${i}" is not a column of "${t.field}"`)}!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{Vr(n.fields,o)||this.report(`${r}.columns[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}):n.type!=="many2many"&&this.report(`${r}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${n.type}`))}};function Vu(){return xo(Pt,{target:"draft-2020-12"})}function Uu(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let r=Yt(e);if(r.length===0)return!1;let o=new mt(r).parse(),i=pt(o,t);return qe(i)}catch{return!1}}function Bu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Yt(e);return t.length===0||new mt(t).parse(),!0}catch{return!1}}function No(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function Ot(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?te(n.default):No(n);return t}function Br(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Xt(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?cp(i,o):o}return r}function cp(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(r=>r.id);case"one2many":return t.map(r=>r.key);case"reference":{let r=t;return`${r.model},${r.id}`}case"binary":case"image":return t.name;default:return t}}function it(e,t){let r=e.lineKinds;if(!r)return null;let n=t[r.field];return n===(r.section??"section")?"section":n===(r.note??"note")?"note":null}function te(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var st={en:{required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",or:"or"},ar:{required:"{label} \u0645\u0637\u0644\u0648\u0628",maxLength:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627",pattern:"\u0635\u064A\u063A\u0629 {label} \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629",text:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0635\u064B\u0627",number:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627",integer:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",min:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 {label} \u0639\u0646 {min}",max:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F {label} \u0639\u0646 {max}",decimals:"\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {digits} \u0645\u0646\u0627\u0632\u0644 \u0639\u0634\u0631\u064A\u0629",boolean:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0646\u0639\u0645 \u0623\u0648 \u0644\u0627",dateFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DD)",dateInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u063A\u064A\u0631 \u0635\u062D\u064A\u062D (\u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u0644\u0634\u0647\u0631 \u0648\u0627\u0644\u064A\u0648\u0645)",datetimeFormat:"\u0635\u064A\u063A\u0629 \u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u0629 (\u0627\u0644\u0645\u062A\u0648\u0642\u0639 YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"\u0627\u0644\u062A\u0627\u0631\u064A\u062E \u0648\u0627\u0644\u0648\u0642\u062A \u063A\u064A\u0631 \u0635\u062D\u064A\u062D\u064A\u0646",choice:"\u064A\u062C\u0628 \u0623\u0646 \u062A\u0643\u0648\u0646 \u0627\u0644\u0642\u064A\u0645\u0629 \u0648\u0627\u062D\u062F\u0629 \u0645\u0646: {options}",choices:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0627\u062E\u062A\u064A\u0627\u0631\u0627\u062A",record:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0633\u062C\u0644\u064B\u0627",records:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0642\u0627\u0626\u0645\u0629 \u0633\u062C\u0644\u0627\u062A",reference:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0634\u064A\u0631 {label} \u0625\u0644\u0649 {models}",file:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641\u064B\u0627",fileSize:"\u062D\u062C\u0645 {label} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}",fileType:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 {label} \u0645\u0644\u0641 {types}",or:"\u0623\u0648"},de:{required:"{label} ist erforderlich",maxLength:"Maximal {max} Zeichen erlaubt",pattern:"{label} hat nicht das erwartete Format",text:"{label} muss Text sein",number:"{label} muss eine Zahl sein",integer:"{label} muss eine ganze Zahl sein",min:"{label} muss mindestens {min} sein",max:"{label} darf h\xF6chstens {max} sein",decimals:"Maximal {digits} Nachkommastellen erlaubt",boolean:"{label} muss ja oder nein sein",dateFormat:"Ung\xFCltiges Datumsformat (erwartet JJJJ-MM-TT)",dateInvalid:"Ung\xFCltiges Datum (Monat und Tag pr\xFCfen)",datetimeFormat:"Ung\xFCltiges Datums- und Zeitformat (erwartet JJJJ-MM-TTTHH:MM:SS)",datetimeInvalid:"Ung\xFCltiges Datum oder ung\xFCltige Uhrzeit",choice:"Muss eines davon sein: {options}",choices:"{label} muss eine Liste von Optionen sein",record:"{label} muss ein Datensatz sein",records:"{label} muss eine Liste von Datens\xE4tzen sein",reference:"{label} muss auf {models} verweisen",file:"{label} muss eine Datei sein",fileSize:"{label} ist gr\xF6\xDFer als {size}",fileType:"{label} muss eine {types}-Datei sein",or:"oder"},fr:{required:"{label} est obligatoire",maxLength:"{max} caract\xE8res au maximum",pattern:"{label} n'a pas le format attendu",text:"{label} doit \xEAtre du texte",number:"{label} doit \xEAtre un nombre",integer:"{label} doit \xEAtre un nombre entier",min:"{label} doit \xEAtre au moins {min}",max:"{label} doit \xEAtre au plus {max}",decimals:"{digits} d\xE9cimales au maximum",boolean:"{label} doit \xEAtre oui ou non",dateFormat:"Format de date invalide (attendu AAAA-MM-JJ)",dateInvalid:"Date invalide (v\xE9rifiez le mois et le jour)",datetimeFormat:"Format de date et heure invalide (attendu AAAA-MM-JJTHH:MM:SS)",datetimeInvalid:"Date ou heure invalide",choice:"Doit \xEAtre parmi : {options}",choices:"{label} doit \xEAtre une liste de choix",record:"{label} doit \xEAtre un enregistrement",records:"{label} doit \xEAtre une liste d'enregistrements",reference:"{label} doit pointer vers {models}",file:"{label} doit \xEAtre un fichier",fileSize:"{label} d\xE9passe {size}",fileType:"{label} doit \xEAtre un fichier {types}",or:"ou"}};function Jr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function Qt(e,t,r,n=st.en){let o=e.label||"This field",i=(s,c={})=>Jr(n[s],{label:o,...c});if(Br(e,t))return r?i("required"):void 0;switch(e.type){case"char":case"text":case"html":return typeof t!="string"?i("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?i("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?i("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?i("number"):e.type==="integer"&&!Number.isInteger(t)?i("integer"):e.min!==void 0&&t<e.min?i("min",{min:e.min}):e.max!==void 0&&t>e.max?i("max",{max:e.max}):e.type!=="integer"&&e.digits&&up(t)>e.digits[1]?i("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:i("boolean");case"date":return lp(t,i);case"datetime":return fp(t,i);case"selection":{let s=new Set(e.options.map(a=>a.value)),c=i("choice",{options:e.options.map(a=>a.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(a=>s.has(a))?void 0:c:i("choices"):s.has(t)?void 0:c}case"many2one":return Zo(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Zo)?void 0:i("records");case"reference":{let s=t;if(!Zo(t)||typeof s.model!="string")return i("record");if(!e.models.some(c=>c.value===s.model)){let c=Wu(e.models.map(a=>a.label),n.or);return i("reference",{models:c,aModels:Ku(c)})}return}case"binary":case"image":return pp(e,t,i,n);default:return}}function up(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let r=t.indexOf(".");return r===-1?0:t.length-r-1}function Zo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function lp(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[r,n,o]=e.split("-").map(Number);return Ju(r,n,o)?void 0:t("dateInvalid")}var dp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function fp(e,t){let r=typeof e=="string"?dp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,c,a]=r.slice(1).map(u=>Number(u??0));return Ju(n,o,i)&&s<24&&c<60&&a<60?void 0:t("datetimeInvalid")}function Ju(e,t,r){if(t<1||t>12||r<1)return!1;let n=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return r<=n[t-1]}function pp(e,t,r,n){let o=t;if(!mp(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:er(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>hp(i,o.type))){let i=Wu(e.accept.map(gp),n.or);return r("fileType",{types:i,aTypes:Ku(i)})}}function mp(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function hp(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function gp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Wu(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function Ku(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function er(e){let t=["bytes","KB","MB","GB"],r=e,n=0;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${Number(r.toFixed(1))} ${t[n]}`}var tr={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Wr(e,t=tr){return new Promise(r=>{t.setTimeout(r,e)})}function Hu(e={}){let t=te(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?Wr(e.delayMs,e.scheduler):Promise.resolve(),s=d=>t[d]??(t[d]={}),c=(d,m)=>{let v=s(d)[String(m)]?.[e.labelField?.[d]??"name"];return typeof v=="string"?v:String(m)},a=d=>Math.max(0,...Object.keys(s(d)).map(Number).filter(Number.isFinite))+1,u=d=>Number.isFinite(Number(d))?Number(d):d;function l(d,m){let v=[...d];for(let y of m)y.op==="create"?v.push({key:y.key,id:++o,values:te(y.values)}):y.op==="update"?v=v.map(h=>h.id===y.id?{...h,values:{...h.values,...te(y.values)}}:h):v=v.filter(h=>h.id!==y.id);return v}function f(d,m,v){let y=[...d],h=O=>({id:O,label:c(v,O)});for(let O of m)O.op==="link"&&!y.some(K=>K.id===O.id)?y.push(h(O.id)):O.op==="unlink"?y=y.filter(K=>K.id!==O.id):O.op==="set"?y=O.ids.map(h):O.op==="clear"&&(y=[]);return y}function p(d,m){let v=d[m];return v&&"relation"in v?v.relation:m}return{records:t,responses:r,calls:n,async load(d){n.push({method:"load",request:d}),await i();let m=s(d.model)[String(d.id)];if(!m)throw new Error(`No ${d.model} record with id ${d.id}`);return te(m)},async save(d){n.push({method:"save",request:d}),await i();let m=d.id??a(d.model),v={...s(d.model)[String(m)]??{},...te(d.changes.values)};for(let[y,h]of Object.entries(d.changes.lines))v[y]=l(v[y]??[],h);for(let[y,h]of Object.entries(d.changes.links))v[y]=f(v[y]??[],h,p(d.fields,y));return s(d.model)[String(m)]=v,{id:m,values:te(v)}},async onchange(d){n.push({method:"onchange",request:d}),await i();let m=e.onchange?.[d.model]?.[d.changed],v=e.warnings?.[d.model]?.[d.changed],y=m?{values:m(te(d.values))}:{},h=v?.(te(d.values));return h?{...y,warning:h}:y},async search(d){n.push({method:"search",request:d}),await i();let m=d.query.trim().toLowerCase();return Object.entries(s(d.model)).filter(([,v])=>(d.filter??[]).every(y=>bp(v,y))).map(([v])=>({id:u(v),label:c(d.model,u(v))})).filter(v=>v.label.toLowerCase().includes(m)).slice(0,d.limit??8)},async submit(d){return n.push({method:"submit",request:d}),await i(),r.push(te(d)),{id:r.length}}}}function bp(e,t){let r=e[t.field],n=r!==null&&typeof r=="object"&&"id"in r?r.id:r,o=t.value;switch(t.op){case"=":return n===o;case"!=":return n!==o;case"<":return n<o;case">":return n>o;case"<=":return n<=o;case">=":return n>=o;case"in":return Array.isArray(o)&&o.includes(n);case"not in":return Array.isArray(o)&&!o.includes(n);case"like":return String(n??"").includes(String(o));case"ilike":return String(n??"").toLowerCase().includes(String(o).toLowerCase())}}function Kr(e){let{page:t}=e,r=e.scheduler??tr,n=e.messages??st.en,o=vp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(x=>x.id):[],s=()=>`fieldia:draft:${t.id}:${a.recordId??"new"}`,c={...Ot(t.fields),...te(e.values??{})},a={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:te(c),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},u=0,l=0,f=null,p=null,d=new Set,m=new Set,v=null;function y(x){a={...a,...x};for(let _ of[...m])_(a)}function h(x){d.add(x);let _=()=>d.delete(x);return x.then(_,_),x}function O(){return v?.values!==a.values&&(v={values:a.values,context:Xt(a.values,t.fields)}),v.context}function K(x){let _=t.fields[x];if(!_)throw new Error(`The page has no field "${x}"`);return _}function S(x){return Object.keys(t.fields).filter(_=>JSON.stringify(x[_]??null)!==JSON.stringify(c[_]??null))}function z(x){let _=o.get(x);if(!_)throw new Error(`The page has no element "${x}"`);let w=O(),F=_.invisible.evaluate(w);for(let J=_.parent;!F&&J;J=o.get(J)?.parent??null)F=o.get(J)?.invisible.evaluate(w)??!1;let U=_.field?t.fields[_.field]:void 0;return{invisible:F,readonly:_.readonly.evaluate(w)||U?.readonly===!0,required:_.required.evaluate(w)||U?.required===!0}}function E(x){let _=w=>{if(!x)return!0;for(let F=w.id;F;F=o.get(F)?.parent??null)if(F===x)return!0;return!1};return[...o.values()].filter(w=>w.kind==="field"&&_(w)&&!z(w.id).invisible)}function q(x){let _={};for(let w of E(x)){let F=w.field;if(_[F])continue;let U=t.fields[F],J=Qt(U,a.values[F],z(w.id).required,n);if(J&&(_[F]=J),U.type==="one2many")for(let W of a.values[F]??[]){let ce=it(U,W.values);for(let[pe,Ue]of Object.entries(U.fields)){if(ce&&pe!==U.lineKinds?.text)continue;let Se=Qt(Ue,W.values[pe],Ue.required===!0,n);Se&&(_[`${F}.${W.key}.${pe}`]=Se)}}}return _}function de(x,_={}){let w=Object.keys(a.errors).length?Te(x):a.errors;y({values:x,dirty:S(x),errors:w,..._})}function Te(x){let _=a;a={...a,values:x};let w=q(a.step??void 0);a=_;let F={};for(let U of Object.keys(a.errors))w[U]&&(F[U]=w[U]);return F}function B(){let x=e.drafts;x&&(f!==null&&r.clearTimeout(f),f=r.setTimeout(()=>{f=null,x.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:a.values}))},x.delayMs??400))}function V(){f!==null&&r.clearTimeout(f),f=null,e.drafts?.store.removeItem(s())}function ne(){let x=e.drafts;if(!x)return;let _=x.store.getItem(s());if(!_)return;let w;try{w=JSON.parse(_)}catch{x.store.removeItem(s());return}x.restore==="auto"?de({...a.values,...w.values},{draft:null}):y({draft:{savedAt:w.savedAt}})}function ie(){let x=e.autosave;!x||t.data.kind!=="record"||(p!==null&&r.clearTimeout(p),p=r.setTimeout(()=>{p=null,a.dirty.length&&Object.keys(q()).length===0&&h(xe())},x.delayMs))}function D(x){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let w=++l,F={model:t.data.model,id:a.recordId,changed:x,values:te(a.values)};h(_.onchange(F).then(U=>{if(w!==l)return;let J={...a.values,...U.values??{}};de(J,{warning:U.warning??null,warningField:U.warning?x:null})},()=>{}))}function X(x){B(),ie(),D(x)}function G(){let x={values:{},lines:{},links:{}};for(let _ of a.dirty){let w=t.fields[_],F=a.values[_],U=c[_];w.type==="one2many"?x.lines[_]=yp(U??[],F??[]):w.type==="many2many"?x.links[_]=xp(U??[],F??[]):x.values[_]=te(F)}return x}function fe(){let x={};for(let _ of E()){let w=_.field;x[w]=te(a.values[w])}return x}async function xe(){let x=q();if(Object.keys(x).length)return y({errors:x}),!1;let _=e.dataSource;y({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!_?.submit)throw new Error("This page has no data source to send its answers to");return await _.submit({pageId:t.id,values:fe()}),V(),y({status:"saved"}),!0}if(!_?.save)throw new Error("This page has no data source to save to");let w=await _.save({model:t.data.model,id:a.recordId,fields:t.fields,changes:G(),values:te(a.values)});V();let F=w.values?{...a.values,...w.values}:a.values;return c=te(F),y({status:"saved",recordId:w.id,values:F,dirty:[]}),!0}catch(w){return y({status:"error",error:w.message}),!1}}async function De(x,_,w,F,U,J){if(x.type!=="many2one"&&x.type!=="many2many"&&x.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(x.type==="reference"&&!J)throw new Error(`Searching "${_}" needs a model`);let W=e.dataSource;if(!W?.search)return[];let ce=x.type==="reference"?void 0:x.filter?.map(({field:Ue,op:Se,value:bt,valueFrom:g})=>({field:Ue,op:Se,value:g!==void 0?w[g]??null:bt??null})),pe=x.type==="reference"?J:x.relation;return h(W.search({model:pe,query:F,...ce?{filter:ce}:{},limit:U}))}function ve(x){let _=K(x);if(_.type!=="one2many")throw new Error(`"${x}" is a ${_.type}, not a one2many`);return _}function Nt(){return a.step?i.indexOf(a.step):-1}async function ht(){let x=e.dataSource;if(!(a.recordId==null||t.data.kind!=="record")){if(!x?.load){y({status:"error",error:"This page has no data source to load from"});return}y({status:"loading",error:null});try{let _=await x.load({model:t.data.model,id:a.recordId,fields:t.fields});c={...Ot(t.fields),..._},y({status:"ready",values:te(c),dirty:[],errors:{}}),ne()}catch(_){y({status:"error",error:_.message})}}}let gt={page:t,getState:()=>a,subscribe(x){return m.add(x),()=>m.delete(x)},load:()=>h(ht()),setValue(x,_){K(x),de({...a.values,[x]:te(_)}),X(x)},node:z,fieldReadonly:x=>K(x).readonly===!0,validate(){let x=q();return y({errors:x}),Object.keys(x).length===0},save:()=>h(xe()),reset(){V(),y({values:te(c),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:G,addLine(x,_={}){let w=ve(x),F=`new-${++u}`,U=a.values[x]??[],J={key:F,values:{...Ot(w.fields),...te(_)}};if(w.sequenceField&&J.values[w.sequenceField]==null){let ce=U.map(pe=>pe.values[w.sequenceField]).filter(pe=>typeof pe=="number");J.values[w.sequenceField]=ce.length?Math.max(...ce)+1:1}let W=[...U,J];return de({...a.values,[x]:W}),X(x),F},updateLine(x,_,w,F){if(!ve(x).fields[w])throw new Error(`The lines of "${x}" have no field "${w}"`);let J=(a.values[x]??[]).map(W=>W.key===_?{...W,values:{...W.values,[w]:te(F)}}:W);de({...a.values,[x]:J}),X(x)},moveLine(x,_,w){let U=ve(x).sequenceField;if(!U)throw new Error(`The lines of "${x}" keep no order: give the field a sequenceField`);let J=[...a.values[x]??[]],W=J.findIndex(k=>k.key===_);if(W<0)throw new Error(`"${x}" has no line "${_}"`);let ce=Math.max(0,Math.min(w,J.length-1));if(ce===W)return;let pe=J.map(k=>k.values[U]),Ue=pe.every((k,I)=>typeof k=="number"&&(I===0||k>pe[I-1]));J.splice(ce,0,...J.splice(W,1));let Se=Math.min(W,ce),bt=Math.max(W,ce),g=Ue?pe.slice(Se,bt+1):[],$=J.map((k,I)=>{let M=Ue?I>=Se&&I<=bt?g[I-Se]:k.values[U]:I+1;return M===k.values[U]?k:{...k,values:{...k.values,[U]:M}}});de({...a.values,[x]:$}),X(x)},removeLine(x,_){ve(x);let w=(a.values[x]??[]).filter(F=>F.key!==_);de({...a.values,[x]:w}),X(x)},async search(x,_,w=8,F={}){return De(K(x),x,O(),_,w,F.model)},async searchLine(x,_,w,F,U=8){let J=ve(x),W=J.fields[w];if(!W)throw new Error(`The lines of "${x}" have no field "${w}"`);let ce=(a.values[x]??[]).find(pe=>pe.key===_);if(!ce)throw new Error(`"${x}" has no line "${_}"`);return De(W,w,Xt(ce.values,J.fields),F,U)},steps:()=>i.filter(x=>!z(x).invisible),next(){if(!a.step)return!1;let x=q(a.step);if(Object.keys(x).length)return y({errors:x}),!1;let _=gt.steps(),w=i.slice(Nt()+1).find(F=>_.includes(F));return w?(y({step:w,errors:{}}),!0):!1},back(){if(!a.step)return!1;let x=gt.steps(),_=i.slice(0,Nt()).reverse().find(w=>x.includes(w));return _?(y({step:_,errors:{}}),!0):!1},async runAction(x){let _=o.get(x);if(!_||_.kind!=="button"&&_.kind!=="stat")throw new Error(`The page has no button "${x}"`);if(z(x).invisible)return;let w=_.source;await h(Promise.resolve(e.onAction?.({id:x,action:w.action,..."params"in w&&w.params?{params:w.params}:{},recordId:a.recordId,values:te(a.values)})))},restoreDraft(){let x=e.drafts?.store.getItem(s());if(!x)return;let _=JSON.parse(x);de({...a.values,..._.values},{draft:null})},discardDraft(){V(),y({draft:null})},async settled(){for(;d.size;)await Promise.allSettled([...d])},dispose(){f!==null&&r.clearTimeout(f),p!==null&&r.clearTimeout(p),m.clear()}};return a.recordId==null&&ne(),gt}function yp(e,t){let r=[],n=new Map(e.filter(i=>i.id!==void 0).map(i=>[i.key,i]));for(let i of t){let s=n.get(i.key);if(i.id===void 0||!s){r.push({op:"create",key:i.key,values:te(i.values)});continue}let c={};for(let[a,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[a])&&(c[a]=te(u));Object.keys(c).length&&r.push({op:"update",id:i.id,values:c})}let o=new Set(t.map(i=>i.key));for(let i of e)i.id!==void 0&&!o.has(i.key)&&r.push({op:"delete",id:i.id});return r}function xp(e,t){let r=new Set(e.map(o=>o.id)),n=new Set(t.map(o=>o.id));return[...t.filter(o=>!r.has(o.id)).map(o=>({op:"link",id:o.id})),...e.filter(o=>!n.has(o.id)).map(o=>({op:"unlink",id:o.id}))]}function vp(e){let t=new Map,r=(o,i,s,c)=>{t.set(o.id,{id:o.id,parent:i,kind:s,field:c.field,invisible:ot(c.invisible),readonly:ot(c.readonly),required:ot(c.required),source:o})},n=(o,i)=>{for(let s of o)if(s.type==="field")r(s,i,"field",{invisible:s.invisible,readonly:s.readonly,required:s.required,field:s.field});else if(s.type==="button")r(s,i,"button",{invisible:s.invisible});else if(s.type==="tabs"){r(s,i,"other",{invisible:s.invisible});for(let c of s.children)r(c,s.id,"other",{invisible:c.invisible}),n(c.children,c.id)}else r(s,i,"other",{invisible:s.invisible}),s.type==="section"&&n(s.children,s.id)};if(e.type==="tabs")return n([e],""),t.get(e.id).parent=null,t;if(r(e,null,"other",{}),e.type==="wizard")for(let o of e.children)r(o,e.id,"step",{invisible:o.invisible}),n(o.children,o.id);else if(e.type==="sections")n(e.children,e.id);else{let o=(i,s)=>{s&&r({id:i},e.id,"field",{field:s})};o("#title",e.title?.field),o("#subtitle",e.title?.subtitleField),o("#avatar",e.title?.avatarField),o("#statusbar",e.statusbar?.field);for(let i of e.buttons??[])r(i,e.id,"button",{invisible:i.invisible});for(let i of e.statButtons??[])r(i,e.id,"stat",{invisible:i.invisible});e.ribbon&&r(e.ribbon,e.id,"other",{invisible:e.ribbon.invisible});for(let i of e.alerts??[])r(i,e.id,"other",{invisible:i.invisible});n(e.children,e.id),e.sidePanel&&r(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible})}return t}var Ne={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",addSection:"\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",addNote:"\u0625\u0636\u0627\u0641\u0629 \u0645\u0644\u0627\u062D\u0638\u0629",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",total:"\u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A",lineProblem:"\u0627\u0644\u0633\u0637\u0631 {n}: {message}",moreProblems:"\u0648{n} \u0623\u062E\u0631\u0649",chooseColumns:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",addSection:"Abschnitt hinzuf\xFCgen",addNote:"Notiz hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",total:"Summe",lineProblem:"Zeile {n}: {message}",moreProblems:"und {n} weitere",chooseColumns:"Spalten ausw\xE4hlen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",addSection:"Ajouter une section",addNote:"Ajouter une note",deleteLine:"Supprimer la ligne",total:"Total",lineProblem:"Ligne {n} : {message}",moreProblems:"et {n} de plus",chooseColumns:"Choisir les colonnes",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var _p=180;function qu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function To(e){let{document:t,id:r,labels:n}=e,o=`${r}-list`,i=t.createElement("input");Object.assign(i,{id:r,className:"fd-input fd-combo-input",autocomplete:"off"}),i.setAttribute("role","combobox"),i.setAttribute("aria-autocomplete","list"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",o),i.placeholder=n.search;let s=t.createElement("ul");s.id=o,s.className="fd-listbox",s.setAttribute("role","listbox"),s.hidden=!0;let c=t.createElement("div");c.className="fd-combo",c.append(i,s);let a="",u=!1,l=[],f=-1,p=0,d,m=!1;function v(){if(s.replaceChildren(),l.forEach((S,z)=>{let E=t.createElement("li");E.id=`${o}-${z}`,E.setAttribute("role","option"),E.setAttribute("aria-selected",String(z===f)),E.className=z===f?"fd-option fd-active":"fd-option",E.textContent=S.label,E.addEventListener("mousedown",q=>q.preventDefault()),E.addEventListener("click",()=>O(z)),s.append(E)}),!l.length){let S=t.createElement("li");S.className="fd-empty",S.textContent=n.noResults,s.append(S)}f>=0?i.setAttribute("aria-activedescendant",`${o}-${f}`):i.removeAttribute("aria-activedescendant")}function y(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function h(){clearTimeout(d),p++,s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),f=-1}function O(S){let z=l[S];z&&(h(),u=!1,e.pick(z))}function K(S){clearTimeout(d);let z=++p;d=setTimeout(async()=>{let E=await e.search(S).catch(()=>[]);if(z!==p||t.activeElement!==i)return;let q=e.exclude?.()??new Set;l=E.filter(de=>!q.has(de.id)),f=-1,v(),y()},_p)}return i.addEventListener("input",()=>{u=!0,m||K(i.value)}),i.addEventListener("focus",()=>{m||K("")}),i.addEventListener("keydown",S=>{if(!m)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return K(i.value);if(!l.length)return;f=(f+(S.key==="ArrowDown"?1:-1)+l.length)%l.length,v(),s.children[f]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&f>=0&&(S.preventDefault(),O(f));return;case"Escape":s.hidden||S.preventDefault(),h(),u=!1,i.value=a;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{p++,clearTimeout(d),h();let S=u&&i.value.trim()===""&&a!=="";u=!1,S?e.onCommitEmpty?.():i.value=a}),{element:c,input:i,setText(S){a=S,u||(i.value=S)},setReadonly(S){m=S,i.readOnly=S,S&&h()},close:h}}var Ao=({form:e,name:t,field:r,id:n,document:o,labels:i=Ne.en})=>{let s=To({document:o,id:n,labels:i,search:a=>e.search(t,a),pick:a=>e.setValue(t,a),onCommitEmpty:()=>e.setValue(t,null)}),c=o.createElement("button");return c.type="button",c.className="fd-combo-clear",c.textContent="\xD7",c.setAttribute("aria-label",qu(i.clear,{label:r.label})),c.addEventListener("click",()=>{e.setValue(t,null),s.input.focus()}),s.element.append(c),{element:s.element,focus:()=>s.input.focus(),update(a){let u=a.value;s.setText(u?.label??""),s.setReadonly(a.readonly),c.hidden=!u||a.readonly,s.input.setAttribute("aria-invalid",String(a.invalid)),s.input.setAttribute("aria-required",String(a.required)),a.describedBy&&s.input.setAttribute("aria-describedby",a.describedBy)}}},Hr=({form:e,name:t,id:r,document:n,labels:o=Ne.en})=>{let i=()=>e.getState().values[t]??[],s=n.createElement("div");s.className="fd-tags",s.setAttribute("role","group");let c=n.createElement("ul");c.className="fd-chips";let a=To({document:n,id:r,labels:o,search:f=>e.search(t,f),pick:f=>{e.setValue(t,[...i(),f]),a.input.value=""},exclude:()=>new Set(i().map(f=>f.id)),onEmptyBackspace:()=>{let f=i();f.length&&e.setValue(t,f.slice(0,-1))}});s.append(c,a.element);let u=!1,l="";return{element:s,focus:()=>a.input.focus(),update(f){let p=f.value??[],d=JSON.stringify([f.readonly,p]);u=f.readonly,a.setReadonly(u),a.element.hidden=u,a.input.setAttribute("aria-invalid",String(f.invalid)),f.describedBy&&a.input.setAttribute("aria-describedby",f.describedBy),d!==l&&(l=d,c.replaceChildren(...p.map(m=>{let v=n.createElement("li");v.className="fd-chip";let y=n.createElement("span");if(y.className="fd-chip-label",y.textContent=m.label,v.append(y),!u){let h=n.createElement("button");h.type="button",h.className="fd-chip-remove",h.textContent="\xD7",h.setAttribute("aria-label",qu(o.remove,{name:m.label})),h.addEventListener("click",()=>e.setValue(t,i().filter(O=>O.id!==m.id))),v.append(h)}return v})),a.setText(""))}}},Lo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-choices fd-choices-checkbox",o.setAttribute("role","group");let i=[],s={readonly:!1,value:[]},c=()=>{let a=new Set(s.value.map(u=>u.id));for(let{record:u,box:l}of i)l.checked=a.has(u.id),l.disabled=s.readonly};return e.search(t,"",50).then(a=>{i=a.map((u,l)=>{let f=n.createElement("input");f.type="checkbox",f.id=`${r}-${l}`,f.addEventListener("change",()=>{let m=e.getState().values[t]??[];e.setValue(t,f.checked?[...m,u]:m.filter(v=>v.id!==u.id))});let p=n.createElement("label");p.className="fd-choice",p.htmlFor=f.id;let d=n.createElement("span");return d.textContent=u.label,p.append(f,d),o.append(p),{record:u,box:f}}),c()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(a){s={readonly:a.readonly,value:a.value??[]},c()}}},Ro=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=Ne.en}=e,c=n.type==="reference"?n.models:[],a=i.createElement("div");a.className="fd-reference";let u=i.createElement("select");u.className="fd-input fd-select",u.setAttribute("aria-label",n.label),u.append(i.createElement("option"));for(let p of c){let d=i.createElement("option");d.value=String(p.value),d.textContent=p.label,u.append(d)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let f=To({document:i,id:o,labels:s,search:p=>l?t.search(r,p,8,{model:l}):Promise.resolve([]),pick:p=>t.setValue(r,{model:l,id:p.id,label:p.label}),onCommitEmpty:()=>t.setValue(r,null)});return a.append(u,f.element),{element:a,focus:()=>l?f.input.focus():u.focus(),update(p){let d=p.value;d&&(l=d.model),u.value=l,u.disabled=p.readonly,f.setText(d?.label??""),f.setReadonly(p.readonly||!l)}}};var Io=(e,t)=>new Intl.NumberFormat("en-US",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e);function Gu(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,r,n,o,i,s]=t;return new Date(Number(r),Number(n)-1,Number(o),Number(i??0),Number(s??0))}function Fo(e,t,r={}){if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(n=>n.label).join(", ");case"selection":{let n=o=>e.options.find(i=>i.value===o)?.label??String(o);return Array.isArray(t)?t.map(n).join(", "):n(t)}case"integer":return Io(Number(t),0);case"float":return Io(Number(t),e.digits?.[1]??2);case"monetary":{let n=e.currency??(e.currencyField?r[e.currencyField]?.label:void 0),o=Io(Number(t),e.digits?.[1]??2);return n?`${n} ${o}`:o}case"date":{let n=Gu(String(t));return n?new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"short",year:"numeric"}).format(n):String(t)}case"datetime":{let n=Gu(String(t));return n?new Intl.DateTimeFormat("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(n):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return t.name??"";case"boolean":return t?"\u2713":"";default:return String(t)}}function Yu(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function Xu(e,t,r){let n=()=>(e.getState().values[t]??[]).find(o=>o.key===r)?.values??{};return{...e,getState:()=>({...e.getState(),values:n()}),setValue:(o,i)=>e.updateLine(t,r,o,i),search:(o,i,s)=>e.searchLine(t,r,o,i,s)}}var Co=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=Ne.en})=>{let c=r,a=c.lineKinds,u=(n.columns??Object.keys(c.fields)).filter(B=>c.fields[B]&&B!==a?.field&&B!==c.sequenceField&&n.optionalColumns?.[B]!=="hide"),l=i.createElement("div");l.className="fd-lines",l.id=o,l.setAttribute("role","group");let f=i.createElement("div");f.className="fd-lines-scroll";let p=i.createElement("table");p.className="fd-lines-table";let d=i.createElement("thead"),m=i.createElement("tr");for(let B of u){let V=i.createElement("th");V.scope="col",V.textContent=c.fields[B].label,m.append(V)}let v=i.createElement("th");v.className="fd-lines-tools",m.append(v),d.append(m);let y=i.createElement("tbody");p.append(d,y);let h=(n.totals??[]).filter(B=>u.includes(B)),O=new Map;if(h.length){let B=i.createElement("tfoot"),V=i.createElement("tr");V.className="fd-lines-totals",u.forEach((ne,ie)=>{let D=i.createElement("td");h.includes(ne)?O.set(ne,D):ie===0&&(D.textContent=s.total),V.append(D)}),V.append(i.createElement("td")),B.append(V),p.append(B)}f.append(p);let K=i.createElement("div");K.className="fd-lines-adds";let S=(B,V,ne)=>{let ie=i.createElement("button");ie.type="button",ie.className="fd-button fd-button-link fd-lines-add",ie.dataset.add=ne,ie.textContent=`+ ${B}`,ie.addEventListener("click",()=>{E=e.addLine(t,V);let D=z.get(E);D&&(D.cells[0]?.widget.focus(),E=null)}),K.append(ie)};S(s.addLine,{},"line"),a&&(S(s.addSection,{[a.field]:a.section??"section"},"section"),S(s.addNote,{[a.field]:a.note??"note"},"note")),l.append(f,K);let z=new Map,E=null,q=!1;function de(B,V,ne,ie,D=1){let X=`${o}-${V.key}-${ne}`,G={type:"field",id:`${n.id}.${V.key}.${ne}`,field:ne},fe=rr({form:Xu(e,t,V.key),name:ne,field:ie,node:G,id:X,document:i,labels:s}),xe=i.createElement("td");xe.colSpan=D;let De=i.createElement("label");De.className="fd-sr-only",De.htmlFor=X,De.textContent=ie.label;let ve=i.createElement("div");return ve.className="fd-cell-error",ve.hidden=!0,xe.append(De,fe.element,ve),B.append(xe),{name:ne,def:ie,widget:fe,error:ve}}function Te(B){let V=i.createElement("tr");V.dataset.line=B.key;let ne=it(c,B.values);ne&&(V.className=`fd-line-${ne}`);let ie=ne&&a?[de(V,B,a.text,Yu(c.fields[a.text],ne),u.length)]:u.map(G=>de(V,B,G,c.fields[G])),D=i.createElement("td");D.className="fd-lines-tools";let X=i.createElement("button");return X.type="button",X.className="fd-line-delete",X.textContent="\xD7",X.setAttribute("aria-label",s.deleteLine),X.addEventListener("click",()=>e.removeLine(t,B.key)),D.append(X),V.append(D),{element:V,kind:ne,cells:ie,remove:X}}return{element:l,focus:()=>(y.querySelector("input, select, textarea")??K.querySelector("button"))?.focus(),update(B){q=B.readonly,K.hidden=q;let V=B.value??[],ne=e.getState().errors,ie=new Set(V.map(D=>D.key));for(let[D,X]of z)ie.has(D)||(X.element.remove(),z.delete(D));V.forEach((D,X)=>{let G=z.get(D.key);G&&G.kind!==it(c,D.values)&&(G.element.remove(),G=void 0),G||(G=Te(D),z.set(D.key,G)),y.children[X]!==G.element&&y.insertBefore(G.element,y.children[X]??null),G.remove.hidden=q,q?G.remove.remove():G.remove.isConnected||G.element.lastElementChild?.append(G.remove);for(let fe of G.cells){let xe=ne[`${t}.${D.key}.${fe.name}`];fe.error.hidden=!xe,fe.error.textContent=xe??"",fe.widget.update({value:D.values[fe.name],values:D.values,readonly:q||fe.def.readonly===!0,required:fe.def.required===!0,invalid:!!xe})}});for(let[D,X]of O){let G=V.filter(fe=>!it(c,fe.values)).reduce((fe,xe)=>fe+Number(xe.values[D]??0),0);X.textContent=Fo(c.fields[D],G,V[0]?.values??{})}E&&z.has(E)&&(z.get(E)?.cells[0]?.widget.focus(),E=null)}}};function wp(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{let o=String(n.result??"");t({name:e.name,type:e.type,size:e.size,data:o.slice(o.indexOf(",")+1)})},n.onerror=()=>r(n.error),n.readAsDataURL(e)})}function Qu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=Ne.en})=>{let c=i.createElement("div");c.className=`fd-file fd-file-${e}`;let a=i.createElement("input");a.type="file",a.id=o,a.className="fd-sr-only";let u=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;u&&(a.accept=u.join(","));let l=i.createElement("img");l.className="fd-image-preview",l.alt=n.label,l.hidden=!0;let f=i.createElement("label");f.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",f.htmlFor=o;let p=i.createElement("span");p.className="fd-button",p.textContent=e==="image"?s.uploadImage:s.upload;let d=i.createElement("span");d.className="fd-help",d.textContent=s.dropHere,f.append(p,d);let m=i.createElement("div");m.className="fd-file-chosen";let v=i.createElement("span");v.className="fd-file-name";let y=i.createElement("button");y.type="button",y.className="fd-button fd-button-link",y.textContent=s.replace,y.addEventListener("click",()=>a.click());let h=i.createElement("button");h.type="button",h.className="fd-button fd-button-link",h.textContent=s.removeFile,h.addEventListener("click",()=>t.setValue(r,null)),m.append(v,y,h),c.append(a,...e==="image"?[l]:[],f,m);let O=!1,K=async S=>{!S||O||t.setValue(r,await wp(S))};return a.addEventListener("change",()=>{K(a.files?.[0]),a.value=""}),c.addEventListener("dragover",S=>{O||(S.preventDefault(),c.classList.add("fd-dragging"))}),c.addEventListener("dragleave",()=>c.classList.remove("fd-dragging")),c.addEventListener("drop",S=>{S.preventDefault(),c.classList.remove("fd-dragging"),K(S.dataTransfer?.files?.[0])}),{element:c,focus:()=>(f.hidden?y:a).focus(),update(S){O=S.readonly;let z=S.value;if(f.hidden=!!z||O,m.hidden=!z,y.hidden=h.hidden=O,a.disabled=O,a.setAttribute("aria-invalid",String(S.invalid)),S.describedBy&&a.setAttribute("aria-describedby",S.describedBy),v.textContent=z?`${z.name} \xB7 ${er(z.size)}`:"",e==="image"){let E=z?z.data?`data:${z.type};base64,${z.data}`:z.url??"":"";l.hidden=!E,l.getAttribute("src")!==E&&(E?l.src=E:l.removeAttribute("src"))}}}}}var Mo=Qu("binary"),Do=Qu("image");var kp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),zp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function jo(e,t=globalThis.document){let r=t.createElement("template");r.innerHTML=e;let n=i=>{for(let s of[...i.childNodes]){if(s.nodeType===Node.TEXT_NODE)continue;if(s.nodeType!==Node.ELEMENT_NODE){s.remove();continue}let c=s;if(zp.has(c.tagName)){c.remove();continue}if(n(c),!kp.has(c.tagName)){c.replaceWith(...c.childNodes);continue}let a=c.tagName==="A"?c.getAttribute("href"):null;for(let u of[...c.attributes])c.removeAttribute(u.name);a&&/^(https?:|mailto:)/i.test(a.trim())&&c.setAttribute("href",a.trim())}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}var Vo=({form:e,name:t,id:r,document:n})=>{let o=n.createElement("div");o.id=r,o.className="fd-input fd-richtext",o.setAttribute("role","textbox"),o.setAttribute("aria-multiline","true"),o.setAttribute("contenteditable","true");let i="";return o.addEventListener("input",()=>{let s=jo(o.innerHTML,n);i=s,e.setValue(t,s.trim()===""?null:s)}),o.addEventListener("blur",()=>{o.innerHTML!==i&&(o.innerHTML=i)}),{element:o,focus:()=>o.focus(),update(s){let c=jo(typeof s.value=="string"?s.value:"",n);(c!==i||n.activeElement!==o)&&(o.innerHTML!==c&&(o.innerHTML=c),i=c),o.setAttribute("contenteditable",String(!s.readonly)),o.setAttribute("aria-readonly",String(s.readonly)),o.setAttribute("aria-invalid",String(s.invalid)),s.describedBy&&o.setAttribute("aria-describedby",s.describedBy)}}},qr=({form:e,name:t,id:r,document:n,labels:o=Ne.en})=>{let i=n.createElement("div");i.className="fd-json";let s=n.createElement("textarea");s.id=r,s.className="fd-input fd-textarea fd-code",s.spellcheck=!1;let c=n.createElement("div");return c.className="fd-cell-error",c.hidden=!0,i.append(s,c),s.addEventListener("input",()=>{if(s.value.trim()===""){c.hidden=!0,e.setValue(t,null);return}try{let a=JSON.parse(s.value);c.hidden=!0,e.setValue(t,a)}catch{c.hidden=!1,c.textContent=o.invalidJson}}),{element:i,focus:()=>s.focus(),update(a){if(n.activeElement!==s){let u=a.value===null||a.value===void 0?"":JSON.stringify(a.value,null,2);s.value!==u&&(s.value=u)}s.readOnly=a.readonly,s.setAttribute("aria-invalid",String(a.invalid||!c.hidden))}}};function rr(e,t={}){let{field:r,node:n}=e,o=[n.widget?`${r.type}.${n.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type].filter(i=>i!==null);for(let i of o){let s=t[i]??il[i];if(s)return s(e)}return Zp(e)}function ge(e,t,r={},...n){let o=e.createElement(t);for(let[i,s]of Object.entries(r))s!==void 0&&o.setAttribute(i,s);return o.append(...n),o}function Ge(e,t){e.setAttribute("aria-invalid",String(t.invalid)),e.setAttribute("aria-required",String(t.required)),t.describedBy?e.setAttribute("aria-describedby",t.describedBy):e.removeAttribute("aria-describedby")}var or=e=>e==null?"":String(e);function nr(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let c=ge(s,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return n.type==="char"&&n.size!==void 0&&(c.maxLength=n.size),o.placeholder&&(c.placeholder=o.placeholder),c.addEventListener("input",()=>t.setValue(r,c.value===""?null:c.value)),{element:c,focus:()=>c.focus(),update(a){let u=or(a.value);c.value!==u&&(c.value=u),c.readOnly=a.readonly,Ge(c,a)}}}}var $p=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=ge(i,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});return r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),n.placeholder&&(s.placeholder=n.placeholder),s.addEventListener("input",()=>e.setValue(t,s.value===""?null:s.value)),{element:s,focus:()=>s.focus(),update(c){let a=or(c.value);s.value!==a&&(s.value=a),s.readOnly=c.readonly,Ge(s,c)}}},Sp=/^-?(\d+\.?\d*|\.\d+)$/,Ep=/^-?\.?$/,Uo=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,c=n.type==="integer",a=ge(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});a.inputMode=c?"numeric":"decimal",o.placeholder&&(a.placeholder=o.placeholder);let u=p=>{let d=p.trim();if(d==="")return null;if(Sp.test(d))return Number(d);if(!Ep.test(d))return d};a.addEventListener("input",()=>{let p=u(a.value);p!==void 0&&t.setValue(r,p)}),a.addEventListener("blur",()=>{a.value=or(t.getState().values[r])});let l=n.type==="monetary"?ge(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?ge(s,"span",{class:"fd-number"},l,a):a,focus:()=>a.focus(),update(p){let d=s.activeElement===a,m=u(a.value),v=m===void 0||m===p.value;if(!(d&&v)){let y=or(p.value);a.value!==y&&(a.value=y)}if(a.readOnly=p.readonly,Ge(a,p),l&&n.type==="monetary"){let y=n.currencyField?p.values[n.currencyField]:null;l.textContent=y&&typeof y=="object"&&"label"in y?y.label:typeof y=="string"?y:n.currency??""}}}};function el(e){return({form:t,name:r,id:n,document:o})=>{let i=ge(o,"input",{id:n,type:"checkbox",class:e?"fd-switch":"fd-checkbox",role:e});return i.addEventListener("change",()=>t.setValue(r,i.checked)),{element:i,focus:()=>i.focus(),update(s){i.checked=s.value===!0,i.disabled=s.readonly,Ge(i,s)}}}}function nl(e){return e.type==="selection"?e.options:[]}var Pp=({form:e,name:t,field:r,id:n,document:o})=>{let i=nl(r),s=ge(o,"select",{id:n,class:"fd-input fd-select"},ge(o,"option",{value:""}));return i.forEach((c,a)=>s.append(ge(o,"option",{value:String(a)},c.label))),s.addEventListener("change",()=>e.setValue(t,s.value===""?null:i[Number(s.value)].value)),{element:s,focus:()=>s.focus(),update(c){let a=i.findIndex(u=>u.value===c.value);s.value=a===-1?"":String(a),s.disabled=c.readonly,Ge(s,c)}}};function tl(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=nl(n),c=ge(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),a=s.map((u,l)=>{let f=ge(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return c.append(ge(i,"label",{class:"fd-choice",for:`${o}-${l}`},f,ge(i,"span",{},u.label))),f});return c.addEventListener("change",()=>{if(e==="radio"){let u=a.findIndex(l=>l.checked);t.setValue(r,u===-1?null:s[u].value)}else t.setValue(r,s.filter((u,l)=>a[l].checked).map(u=>u.value))}),{element:c,focus:()=>(a.find(u=>u.checked)??a[0])?.focus(),update(u){let l=Array.isArray(u.value)?u.value:[u.value];a.forEach((f,p)=>{f.checked=l.includes(s[p].value),f.disabled=u.readonly}),Ge(c,u)}}}}function rl(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s="min"in n&&n.min!==void 0?n.min:e==="rating"?1:0,c="max"in n&&n.max!==void 0?n.max:e==="rating"?5:10,a=ge(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=c;l++){let f=ge(i,"button",{type:"button",role:"radio","aria-label":`${l} of ${c}`,"data-value":String(l)},e==="rating"?"\u2605":String(l));e==="scale"&&f.removeAttribute("aria-label"),f.addEventListener("click",()=>t.setValue(r,l)),u.push(f),a.append(f)}return a.addEventListener("keydown",l=>{let f=t.getState().values[r],p=typeof f=="number"?f:s-1,d=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!d)return;l.preventDefault();let m=Math.min(c,Math.max(s,p+d));t.setValue(r,m),u[m-s]?.focus()}),{element:a,focus:()=>(u.find(l=>l.getAttribute("aria-checked")==="true")??u[0])?.focus(),update(l){let f=typeof l.value=="number"?l.value:null;u.forEach((p,d)=>{let m=s+d;p.setAttribute("aria-checked",String(m===f)),p.classList.toggle("fd-on",e==="rating"?f!==null&&m<=f:m===f),p.tabIndex=m===f||f===null&&d===0?0:-1,p.disabled=l.readonly}),Ge(a,l)}}}}var Op=({form:e,name:t,id:r,document:n})=>{let o=ge(n,"input",{id:r,type:"date",class:"fd-input fd-date"});return o.addEventListener("input",()=>e.setValue(t,o.value||null)),{element:o,focus:()=>o.focus(),update(i){let s=or(i.value);o.value!==s&&(o.value=s),o.readOnly=i.readonly,Ge(o,i)}}},Gr=e=>String(e).padStart(2,"0"),Np=({form:e,name:t,id:r,document:n})=>{let o=ge(n,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),i=s=>{if(typeof s!="string"||!s)return"";let c=new Date(s);return Number.isNaN(c.getTime())?"":`${c.getFullYear()}-${Gr(c.getMonth()+1)}-${Gr(c.getDate())}T${Gr(c.getHours())}:${Gr(c.getMinutes())}`};return o.addEventListener("input",()=>{if(!o.value)return e.setValue(t,null);let s=new Date(o.value);Number.isNaN(s.getTime())||e.setValue(t,s.toISOString())}),{element:o,focus:()=>o.focus(),update(s){let c=i(s.value);o.value!==c&&(o.value=c),o.readOnly=s.readonly,Ge(o,s)}}};function Zp({field:e,id:t,document:r}){let n=ge(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=ol(o.value,e)}}}function ol(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(r=>r.label).join(", ");case"one2many":{let r=e.length;return`${r} ${r===1?"line":"lines"}`}case"binary":case"image":return e.name;case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var il={char:nr("text"),"char.email":nr("email"),"char.phone":nr("tel"),"char.url":nr("url"),"char.password":nr("password"),text:$p,integer:Uo,float:Uo,monetary:Uo,"integer.rating":rl("rating"),"integer.scale":rl("scale"),boolean:el(),"boolean.toggle":el("switch"),selection:Pp,"selection.radio":tl("radio"),"selection.checkboxes":tl("checkbox"),date:Op,datetime:Np,many2one:Ao,many2many:Hr,"many2many.tags":Hr,"many2many.checkboxes":Lo,reference:Ro,one2many:Co,binary:Mo,image:Do,html:Vo,json:qr,properties:qr};var al=`
|
|
59
59
|
.fd-form {
|
|
60
60
|
--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
|
|
61
61
|
--fd-text: #212529;
|
|
@@ -263,7 +263,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
263
263
|
.fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }
|
|
264
264
|
.fd-line-delete { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px; }
|
|
265
265
|
.fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }
|
|
266
|
-
.fd-lines-
|
|
266
|
+
.fd-lines-totals td { padding: 8px; font-weight: 600; border-block-start: 1px solid var(--fd-border); font-variant-numeric: tabular-nums; }
|
|
267
|
+
.fd-lines-adds { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-self: start; }
|
|
268
|
+
/* A section heads the lines below it; a note reads as a remark between them. */
|
|
269
|
+
.fd-line-section td { background: var(--fd-page); }
|
|
270
|
+
.fd-line-section .fd-input { font-weight: 600; }
|
|
271
|
+
.fd-line-note .fd-input { font-style: italic; }
|
|
267
272
|
.fd-cell-error { color: var(--fd-error); font-size: 12px; }
|
|
268
273
|
.fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
269
274
|
|
|
@@ -357,9 +362,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
357
362
|
.fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
|
|
358
363
|
@container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }
|
|
359
364
|
.fd-card {
|
|
360
|
-
position: relative;
|
|
365
|
+
position: relative; background: var(--fd-surface); border: 1px solid var(--fd-border);
|
|
361
366
|
border-radius: var(--fd-radius); padding: 24px 28px 28px; display: grid; gap: 18px; min-width: 0;
|
|
362
367
|
}
|
|
368
|
+
.fd-ribbon-frame { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
|
|
363
369
|
.fd-ribbon {
|
|
364
370
|
position: absolute; inset-block-start: 18px; inset-inline-end: -42px; transform: rotate(45deg); width: 160px;
|
|
365
371
|
text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: #fff; background: var(--fd-muted);
|
|
@@ -378,7 +384,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
378
384
|
.fd-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0; margin: -24px -28px 0; border-block-end: 1px solid var(--fd-border); }
|
|
379
385
|
.fd-stats:empty { display: none; }
|
|
380
386
|
/* A visible ribbon owns the corner: stat buttons keep clear of it. */
|
|
381
|
-
.fd-card:has(> .fd-ribbon:not([hidden])) .fd-stats { padding-inline-end: 104px; }
|
|
387
|
+
.fd-card:has(> .fd-ribbon-frame > .fd-ribbon:not([hidden])) .fd-stats { padding-inline-end: 104px; }
|
|
382
388
|
.fd-stat {
|
|
383
389
|
font: inherit; background: none; border: none; border-inline-start: 1px solid var(--fd-border); cursor: pointer;
|
|
384
390
|
padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;
|
|
@@ -439,7 +445,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
439
445
|
}
|
|
440
446
|
.fd-dialog p { margin: 0; }
|
|
441
447
|
@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
|
|
442
|
-
`,
|
|
448
|
+
`,sl="fieldia-styles";function Bo(e){if(e.getElementById(sl))return;let t=e.createElement("style");t.id=sl,t.textContent=al,(e.head??e.documentElement).append(t)}function Jo(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(r){try{let n=t()?.getItem(`fieldia:${r}`);return n==null?null:JSON.parse(n)}catch{return null}},set(r,n){try{t()?.setItem(`fieldia:${r}`,JSON.stringify(n))}catch{}}}}function Tp(){let e=new Map;return{get:t=>e.has(t)?cl(e.get(t)):null,set:(t,r)=>{e.set(t,cl(r))}}}var cl=e=>JSON.parse(JSON.stringify(e));var Wo={en:{save:"Save",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",stepOf:"Step {n} of {total}",submitted:"Thank you. Your answers were sent.",submitAnother:"Submit another response",draftFound:"You have unsaved answers from {time}.",restore:"Restore",discardDraft:"Discard",ok:"OK",cancel:"Cancel",loading:"Loading\u2026"},ar:{save:"\u062D\u0641\u0638",discard:"\u062A\u062C\u0627\u0647\u0644",saving:"\u062C\u0627\u0631\u064D \u0627\u0644\u062D\u0641\u0638\u2026",saved:"\u062A\u0645 \u0627\u0644\u062D\u0641\u0638",submit:"\u0625\u0631\u0633\u0627\u0644",next:"\u0627\u0644\u062A\u0627\u0644\u064A",back:"\u0631\u062C\u0648\u0639",stepOf:"\u0627\u0644\u062E\u0637\u0648\u0629 {n} \u0645\u0646 {total}",submitted:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643. \u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0627\u062A\u0643.",submitAnother:"\u0625\u0631\u0633\u0627\u0644 \u0625\u062C\u0627\u0628\u0629 \u0623\u062E\u0631\u0649",draftFound:"\u0644\u062F\u064A\u0643 \u0625\u062C\u0627\u0628\u0627\u062A \u063A\u064A\u0631 \u0645\u062D\u0641\u0648\u0638\u0629 \u0645\u0646 {time}.",restore:"\u0627\u0633\u062A\u0639\u0627\u062F\u0629",discardDraft:"\u062A\u062C\u0627\u0647\u0644",ok:"\u0645\u0648\u0627\u0641\u0642",cancel:"\u0625\u0644\u063A\u0627\u0621",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"},de:{save:"Speichern",discard:"Verwerfen",saving:"Wird gespeichert\u2026",saved:"Gespeichert",submit:"Absenden",next:"Weiter",back:"Zur\xFCck",stepOf:"Schritt {n} von {total}",submitted:"Vielen Dank. Ihre Antworten wurden gesendet.",submitAnother:"Weitere Antwort senden",draftFound:"Sie haben ungespeicherte Antworten vom {time}.",restore:"Wiederherstellen",discardDraft:"Verwerfen",ok:"OK",cancel:"Abbrechen",loading:"Wird geladen\u2026"},fr:{save:"Enregistrer",discard:"Annuler les modifications",saving:"Enregistrement\u2026",saved:"Enregistr\xE9",submit:"Envoyer",next:"Suivant",back:"Retour",stepOf:"\xC9tape {n} sur {total}",submitted:"Merci. Vos r\xE9ponses ont \xE9t\xE9 envoy\xE9es.",submitAnother:"Envoyer une autre r\xE9ponse",draftFound:"Vous avez des r\xE9ponses non enregistr\xE9es du {time}.",restore:"Restaurer",discardDraft:"Ignorer",ok:"OK",cancel:"Annuler",loading:"Chargement\u2026"}},Ap=Wo.en,Lp=0;function Rp(e,t){let r=e.ownerDocument,n=Ur(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
|
|
443
449
|
${n.issues.map(g=>` ${g.path}: ${g.message}`).join(`
|
|
444
|
-
`)}`);let o=n.page,i=t.locale??"en",s=!t.form,a=t.form??Ur({...t,page:o,messages:t.messages??Qe[i]}),c={...Do[i],...t.labels},u=we[i],l=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++zp}`,m=[],f=[],h=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,x=(g,z)=>g.replace(/\{(\w+)\}/g,(T,C)=>String(z[C]??""));Mo(r);function d(g,z={},...T){let C=r.createElement(g);for(let[D,R]of Object.entries(z))R!==void 0&&C.setAttribute(D,R);return C.append(...T),C}let v=d("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:l,lang:t.locale}),P=t.confirm??Ue;function j(g){let z=o.fields[g.field],T=h(g.id),C=d("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":z.type});g.colspan&&C.style.setProperty("--fd-span",String(g.colspan));let D=d("label",{class:"fd-label",id:`${T}-label`,for:T},g.label??z.label),R=Xt({form:a,name:g.field,field:z,node:g,id:T,document:r,labels:u},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(R.element.tagName)||(R.element.getAttribute("role")&&R.element.setAttribute("aria-labelledby",D.id),D.addEventListener("click",()=>R.focus()));let N=g.help??z.help,K=N?d("div",{class:"fd-help",id:`${T}-help`},N):null,E=d("div",{class:"fd-error",id:`${T}-error`,role:"alert",hidden:""}),I=d("div",{class:"fd-warning",role:"status",hidden:""});return C.append(D,R.element,...K?[K]:[],E,I),R.destroy&&f.push(()=>R.destroy?.()),m.push(U=>{let pe=a.node(g.id);C.hidden=pe.invisible,C.classList.toggle("fd-required",pe.required);let ke=U.errors[g.field];E.hidden=!ke,E.textContent=ke??"";let Be=U.warning&&U.warningField===g.field?U.warning:"";I.hidden=!Be,I.textContent=Be,R.update({value:U.values[g.field],values:U.values,readonly:pe.readonly,required:pe.required,invalid:!!ke,describedBy:[K?.id,ke?E.id:void 0].filter(Boolean).join(" ")||void 0})}),C}function S(g,z){m.push(()=>{g.hidden=a.node(z).invisible})}function w(g){let z=d("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return z.addEventListener("click",async()=>{g.confirm&&!await P(g.confirm)||await a.runAction(g.id)}),S(z,g.id),z}function $(g){let z=g.style??"paragraph",T=d(z==="heading"?"h3":"p",{class:`fd-text-${z}`,"data-node":g.id},g.text);return S(T,g.id),T}function H(g){let z=d("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),T=t.slots?.[g.name]?.(z,{form:a,name:g.name});return T&&f.push(T),S(z,g.id),z}function te(g,z=1){let T=d("div",{class:"fd-grid"});return T.style.setProperty("--fd-columns",String(z)),T.append(...g.map(se)),T}let Q=new Map;function oe(g){let z=d("fieldset",{class:"fd-section","data-node":g.id}),T=g.description?d("p",{class:"fd-section-description"},g.description):null,C=te(g.children,g.columns??1);if(g.title&&g.collapsible){C.id=h(`${g.id}-content`);let D=d("button",{type:"button",class:"fd-section-toggle","aria-controls":C.id},d("span",{class:"fd-section-chevron","aria-hidden":"true"}),g.title),R=g.collapsed!==!0,N=K=>{R=K,D.setAttribute("aria-expanded",String(R)),C.hidden=!R,T&&(T.hidden=!R),z.classList.toggle("fd-section-folded",!R)};D.addEventListener("click",()=>N(!R)),Q.set(z,()=>N(!0)),N(R),z.append(d("legend",{class:"fd-section-title"},D))}else g.title&&z.append(d("legend",{class:"fd-section-title"},g.title));return T&&z.append(T),z.append(C),S(z,g.id),z}function B(g){let z=d("div",{class:"fd-tabs","data-node":g.id}),T=d("div",{class:"fd-tablist",role:"tablist"}),C=null,D=g.children[0].id,R=g.children.map(N=>{let K=h(`${N.id}-tab`),E=h(`${N.id}-panel`),I=d("button",{type:"button",class:"fd-tab",role:"tab",id:K,"aria-controls":E,"data-node":N.id},N.label),U=d("div",{class:"fd-tabpanel",role:"tabpanel",id:E,"aria-labelledby":K},te(N.children));return I.addEventListener("click",()=>{C=D=N.id,Le(a.getState())}),T.append(I),{tab:N,button:I,panel:U}});return T.addEventListener("keydown",N=>{let K=R.filter(ke=>!ke.button.hidden),E=K.findIndex(ke=>ke.tab.id===D),I={ArrowRight:1,ArrowLeft:-1,Home:-E,End:K.length-1-E}[N.key];if(I===void 0||E===-1)return;N.preventDefault();let U=v.getAttribute("dir")==="rtl"&&(N.key==="ArrowRight"||N.key==="ArrowLeft"),pe=K[(E+(U?-I:I)+K.length)%K.length];C=D=pe.tab.id,Le(a.getState()),pe.button.focus()}),z.append(T,...R.map(N=>N.panel)),m.push(()=>{z.hidden=a.node(g.id).invisible;let N=R.filter(E=>!a.node(E.tab.id).invisible);C!==null&&N.some(E=>E.tab.id===C)?D=C:N.length&&(D=N[0].tab.id);for(let E of R){let I=E.tab.id===D;E.button.hidden=!N.includes(E),E.button.setAttribute("aria-selected",String(I)),E.button.tabIndex=I?0:-1,E.panel.hidden=!I}}),z}function se(g){switch(g.type){case"field":return j(g);case"button":return w(g);case"text":return $(g);case"slot":return H(g);case"section":return oe(g);case"tabs":return B(g)}}let de=d("div",{class:"fd-status",role:"status","aria-live":"polite"});m.push(g=>{let z=g.status==="saving"?c.saving:g.status==="saved"?c.saved:g.status==="loading"?c.loading:g.status==="error"?g.error??"":"";de.textContent=z,de.classList.toggle("fd-status-error",g.status==="error"),de.classList.toggle("fd-status-saved",g.status==="saved")});let et=d("div",{class:"fd-draft",hidden:""}),Ze=d("span"),Ve=d("button",{type:"button",class:"fd-button fd-button-primary"},c.restore),Ie=d("button",{type:"button",class:"fd-button fd-button-link"},c.discardDraft);Ve.addEventListener("click",()=>a.restoreDraft()),Ie.addEventListener("click",()=>a.discardDraft()),et.append(Ze,Ve,Ie),m.push(g=>{et.hidden=!g.draft,g.draft&&(Ze.textContent=x(c.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function Te(){let g=v.querySelector('[aria-invalid="true"]');if(!g)return;for(let T=g.closest(".fd-section-folded");T;T=T.parentElement?.closest(".fd-section-folded")??null)Q.get(T)?.();(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let tt=d("div",{class:"fd-done",hidden:""},d("p",{class:"fd-done-title"},c.submitted)),rt=d("button",{type:"button",class:"fd-button"},c.submitAnother);tt.append(rt);let nt=d("div",{class:"fd-content"});async function tr(){if(!await a.save()){Te();return}o.data.kind==="responses"&&(nt.hidden=!0,tt.hidden=!1)}rt.addEventListener("click",()=>{a.reset(),nt.hidden=!1,tt.hidden=!0});function St(){if(!o.title&&!o.description)return null;let g=d("header",{class:"fd-page-head"});return o.title&&g.append(d("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(d("p",{class:"fd-page-description"},o.description)),g}function y(g){let z=d("div",{class:"fd-sections","data-node":g.id},...g.children.map(se)),T=d("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?c.submit:c.save),C=d("div",{class:"fd-actions fd-actions-end"},de,T);if(o.data.kind==="record"){let D=d("button",{type:"button",class:"fd-button"},c.discard);D.addEventListener("click",()=>a.reset()),C.insertBefore(D,T),m.push(R=>{let N=R.dirty.length>0&&R.status!=="saving";T.hidden=!N,D.hidden=!N})}return d("div",{},z,C)}function _(g){let z=d("div",{class:"fd-wizard","data-node":g.id}),T=d("div",{class:"fd-progress-text"}),C=d("span");z.append(d("div",{class:"fd-progress"},T,d("div",{class:"fd-progress-bar"},C)));let D=g.children.map(I=>{let U=d("section",{class:"fd-step","data-node":I.id,"aria-labelledby":h(`${I.id}-title`)});return U.append(d("h2",{class:"fd-step-title",id:h(`${I.id}-title`)},I.label)),I.description&&U.append(d("p",{class:"fd-section-description"},I.description)),U.append(te(I.children)),z.append(U),{step:I,panel:U}}),R=d("button",{type:"button",class:"fd-button"},c.back),N=d("button",{type:"submit",class:"fd-button fd-button-primary"});z.append(d("div",{class:"fd-wizard-nav"},R,d("span",{class:"fd-spacer"}),de,N)),R.addEventListener("click",()=>{a.back()&&E()});let K=()=>{let I=a.steps();return I.indexOf(a.getState().step??"")===I.length-1};J=async()=>{if(K())return tr();a.next()?E():Te()};function E(){D.find(U=>U.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return m.push(I=>{let U=a.steps(),pe=Math.max(0,U.indexOf(I.step??""));T.textContent=x(c.stepOf,{n:pe+1,total:U.length}),C.style.width=`${(pe+1)/Math.max(1,U.length)*100}%`;for(let{step:ke,panel:Be}of D)Be.hidden=ke.id!==I.step;R.hidden=pe===0,N.textContent=pe===U.length-1?c.submit:c.next}),z}function k(g){let z=d("div",{class:"fd-sheet-page","data-node":g.id}),T=d("div",{class:"fd-actions"}),C=d("button",{type:"submit",class:"fd-button fd-button-primary"},c.save),D=d("button",{type:"button",class:"fd-button"},c.discard);D.addEventListener("click",()=>a.reset()),T.append(C,D,...(g.buttons??[]).map(w),de),m.push(E=>{let I=E.dirty.length>0&&E.status!=="saving";C.hidden=!I,D.hidden=!I});let R=d("div",{class:"fd-header"},T);g.statusbar&&R.append(L(g.statusbar));let N=d("div",{class:"fd-card"});if(g.ribbon){let E=d("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);S(E,g.ribbon.id),N.append(E)}if(g.statButtons?.length){let E=d("div",{class:"fd-stats"});for(let I of g.statButtons){let U=d("span",{class:"fd-stat-value"}),pe=d("button",{type:"button",class:"fd-stat","data-node":I.id},U,d("span",{class:"fd-stat-label"},I.label));pe.addEventListener("click",()=>{a.runAction(I.id)}),m.push(ke=>{pe.hidden=a.node(I.id).invisible;let Be=I.field?ke.values[I.field]:null;U.textContent=Be==null?"":String(Be)}),E.append(pe)}N.append(E)}for(let E of g.alerts??[]){let I=d("div",{class:`fd-alert fd-tone-${E.tone??"info"}`,role:"status","data-node":E.id},E.message);S(I,E.id),N.append(I)}if(g.title){let E=d("div",{class:"fd-title"});E.append(j({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&E.append(j({type:"field",id:"#subtitle",field:g.title.subtitleField}));let I=d("div",{class:"fd-title-row"},E);if(g.title.avatarField){let U=j({type:"field",id:"#avatar",field:g.title.avatarField});U.classList.add("fd-avatar"),I.append(U)}N.append(I)}N.append(te(g.children));let K=d("div",{class:"fd-sheet-layout"},N);return g.sidePanel&&(K.classList.add("fd-has-side"),K.append(d("aside",{class:"fd-side"},H(g.sidePanel)))),z.append(R,K),z}function L(g){let z=o.fields[g.field],T=d("ol",{class:"fd-statusbar","aria-label":z.label});if(z.type==="selection"){let D=z.options.filter(R=>!g.visibleStates||g.visibleStates.includes(R.value)).map(R=>{let N=g.clickable?d("button",{type:"button"},d("span",{},R.label)):d("span",{},d("span",{},R.label));return N instanceof HTMLButtonElement&&N.addEventListener("click",()=>a.setValue(g.field,R.value)),T.append(d("li",{},N)),{option:R,inner:N}});m.push(R=>{let N=a.node("#statusbar").readonly;for(let{option:K,inner:E}of D)K.value===R.values[g.field]?E.setAttribute("aria-current","step"):E.removeAttribute("aria-current"),E instanceof HTMLButtonElement&&(E.disabled=N)})}else{let C=d("span",{"aria-current":"step"});T.append(d("li",{},C)),m.push(D=>{let R=D.values[g.field];C.textContent=R?.label??""})}return T}let J=null,V=o.layout,ae;V.type==="sheet"?ae=k(V):V.type==="wizard"?ae=_(V):V.type==="tabs"?ae=y({id:`${V.id}-page`,children:[V]}):ae=y(V);let ze=V.type==="sheet"?null:St();nt.append(...ze?[ze]:[],et,ae),v.append(nt,tt),v.addEventListener("submit",g=>{g.preventDefault(),J?J():tr()});function Ue(g){return new Promise(z=>{let T=d("p",{id:`${p}-confirm`},g),C=d("button",{type:"button",class:"fd-button"},c.cancel),D=d("button",{type:"button",class:"fd-button fd-button-primary"},c.ok),R=d("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":T.id},T,d("div",{class:"fd-actions fd-actions-end"},C,D)),N=d("div",{class:"fd-dialog-backdrop"},R),K=E=>{N.remove(),z(E)};C.addEventListener("click",()=>K(!1)),D.addEventListener("click",()=>K(!0)),N.addEventListener("keydown",E=>{E.key==="Escape"&&K(!1)}),v.append(N),D.focus()})}function Le(g){for(let z of m)z(g)}e.append(v);let Hr=a.subscribe(Le);return Le(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:v,setSkin(g){v.setAttribute("data-fd-skin",g)},destroy(){Hr();for(let g of f)g();v.remove(),s&&a.dispose()}}}var Sp="0.2.0";return ol(Ep);})();
|
|
450
|
+
`)}`);let o=n.page,i=t.locale??"en",s=t.preferences??Jo(),c=!t.form,a=t.form??Kr({...t,page:o,messages:t.messages??st[i]}),u={...Wo[i],...t.labels},l=Ne[i],f=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++Lp}`,d=[],m=[],v=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,y=(g,$)=>g.replace(/\{(\w+)\}/g,(k,I)=>String($[I]??""));Bo(r);function h(g,$={},...k){let I=r.createElement(g);for(let[M,L]of Object.entries($))L!==void 0&&I.setAttribute(M,L);return I.append(...k),I}let O=h("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:f,lang:t.locale}),K=t.confirm??Ue;function S(g){let $=o.fields[g.field],k=v(g.id),I=h("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":$.type});g.colspan&&I.style.setProperty("--fd-span",String(g.colspan));let M=h("label",{class:"fd-label",id:`${k}-label`,for:k},g.label??$.label),L=rr({form:a,name:g.field,field:$,node:g,id:k,document:r,labels:l,preferences:s},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(L.element.tagName)||(L.element.getAttribute("role")&&L.element.setAttribute("aria-labelledby",M.id),M.addEventListener("click",()=>L.focus()));let T=g.help??$.help,Q=T?h("div",{class:"fd-help",id:`${k}-help`},T):null,N=h("div",{class:"fd-error",id:`${k}-error`,role:"alert",hidden:""}),R=h("div",{class:"fd-warning",role:"status",hidden:""});return I.append(M,L.element,...Q?[Q]:[],N,R),L.destroy&&m.push(()=>L.destroy?.()),d.push(H=>{let ye=a.node(g.id);I.hidden=ye.invisible,I.classList.toggle("fd-required",ye.required);let Ze=H.errors[g.field];N.hidden=!Ze,N.textContent=Ze??"";let Ye=H.warning&&H.warningField===g.field?H.warning:"";R.hidden=!Ye,R.textContent=Ye,L.update({value:H.values[g.field],values:H.values,readonly:ye.readonly,required:ye.required,invalid:!!Ze,describedBy:[Q?.id,Ze?N.id:void 0].filter(Boolean).join(" ")||void 0})}),I}function z(g,$){d.push(()=>{g.hidden=a.node($).invisible})}function E(g){let $=h("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return $.addEventListener("click",async()=>{g.confirm&&!await K(g.confirm)||await a.runAction(g.id)}),z($,g.id),$}function q(g){let $=g.style??"paragraph",k=h($==="heading"?"h3":"p",{class:`fd-text-${$}`,"data-node":g.id},g.text);return z(k,g.id),k}function de(g){let $=h("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),k=t.slots?.[g.name]?.($,{form:a,name:g.name});return k&&m.push(k),z($,g.id),$}function Te(g,$=1){let k=h("div",{class:"fd-grid"});return k.style.setProperty("--fd-columns",String($)),k.append(...g.map(ie)),k}let B=new Map;function V(g){let $=h("fieldset",{class:"fd-section","data-node":g.id}),k=g.description?h("p",{class:"fd-section-description"},g.description):null,I=Te(g.children,g.columns??1);if(g.title&&g.collapsible){I.id=v(`${g.id}-content`);let M=h("button",{type:"button",class:"fd-section-toggle","aria-controls":I.id},h("span",{class:"fd-section-chevron","aria-hidden":"true"}),g.title),L=g.collapsed!==!0,T=Q=>{L=Q,M.setAttribute("aria-expanded",String(L)),I.hidden=!L,k&&(k.hidden=!L),$.classList.toggle("fd-section-folded",!L)};M.addEventListener("click",()=>T(!L)),B.set($,()=>T(!0)),T(L),$.append(h("legend",{class:"fd-section-title"},M))}else g.title&&$.append(h("legend",{class:"fd-section-title"},g.title));return k&&$.append(k),$.append(I),z($,g.id),$}function ne(g){let $=h("div",{class:"fd-tabs","data-node":g.id}),k=h("div",{class:"fd-tablist",role:"tablist"}),I=null,M=g.children[0].id,L=g.children.map(T=>{let Q=v(`${T.id}-tab`),N=v(`${T.id}-panel`),R=h("button",{type:"button",class:"fd-tab",role:"tab",id:Q,"aria-controls":N,"data-node":T.id},T.label),H=h("div",{class:"fd-tabpanel",role:"tabpanel",id:N,"aria-labelledby":Q},Te(T.children));return R.addEventListener("click",()=>{I=M=T.id,Se(a.getState())}),k.append(R),{tab:T,button:R,panel:H}});return k.addEventListener("keydown",T=>{let Q=L.filter(Ze=>!Ze.button.hidden),N=Q.findIndex(Ze=>Ze.tab.id===M),R={ArrowRight:1,ArrowLeft:-1,Home:-N,End:Q.length-1-N}[T.key];if(R===void 0||N===-1)return;T.preventDefault();let H=O.getAttribute("dir")==="rtl"&&(T.key==="ArrowRight"||T.key==="ArrowLeft"),ye=Q[(N+(H?-R:R)+Q.length)%Q.length];I=M=ye.tab.id,Se(a.getState()),ye.button.focus()}),$.append(k,...L.map(T=>T.panel)),d.push(()=>{$.hidden=a.node(g.id).invisible;let T=L.filter(N=>!a.node(N.tab.id).invisible);I!==null&&T.some(N=>N.tab.id===I)?M=I:T.length&&(M=T[0].tab.id);for(let N of L){let R=N.tab.id===M;N.button.hidden=!T.includes(N),N.button.setAttribute("aria-selected",String(R)),N.button.tabIndex=R?0:-1,N.panel.hidden=!R}}),$}function ie(g){switch(g.type){case"field":return S(g);case"button":return E(g);case"text":return q(g);case"slot":return de(g);case"section":return V(g);case"tabs":return ne(g)}}let D=h("div",{class:"fd-status",role:"status","aria-live":"polite"});d.push(g=>{let $=g.status==="saving"?u.saving:g.status==="saved"?u.saved:g.status==="loading"?u.loading:g.status==="error"?g.error??"":"";D.textContent=$,D.classList.toggle("fd-status-error",g.status==="error"),D.classList.toggle("fd-status-saved",g.status==="saved")});let X=h("div",{class:"fd-draft",hidden:""}),G=h("span"),fe=h("button",{type:"button",class:"fd-button fd-button-primary"},u.restore),xe=h("button",{type:"button",class:"fd-button fd-button-link"},u.discardDraft);fe.addEventListener("click",()=>a.restoreDraft()),xe.addEventListener("click",()=>a.discardDraft()),X.append(G,fe,xe),d.push(g=>{X.hidden=!g.draft,g.draft&&(G.textContent=y(u.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function De(){let g=O.querySelector('[aria-invalid="true"]');if(!g)return;for(let k=g.closest(".fd-section-folded");k;k=k.parentElement?.closest(".fd-section-folded")??null)B.get(k)?.();if(!g.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let ve=h("div",{class:"fd-done",hidden:""},h("p",{class:"fd-done-title"},u.submitted)),Nt=h("button",{type:"button",class:"fd-button"},u.submitAnother);ve.append(Nt);let ht=h("div",{class:"fd-content"});async function gt(){if(!await a.save()){De();return}o.data.kind==="responses"&&(ht.hidden=!0,ve.hidden=!1)}Nt.addEventListener("click",()=>{a.reset(),ht.hidden=!1,ve.hidden=!0});function x(){if(!o.title&&!o.description)return null;let g=h("header",{class:"fd-page-head"});return o.title&&g.append(h("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(h("p",{class:"fd-page-description"},o.description)),g}function _(g){let $=h("div",{class:"fd-sections","data-node":g.id},...g.children.map(ie)),k=h("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?u.submit:u.save),I=h("div",{class:"fd-actions fd-actions-end"},D,k);if(o.data.kind==="record"){let M=h("button",{type:"button",class:"fd-button"},u.discard);M.addEventListener("click",()=>a.reset()),I.insertBefore(M,k),d.push(L=>{let T=L.dirty.length>0&&L.status!=="saving";k.hidden=!T,M.hidden=!T})}return h("div",{},$,I)}function w(g){let $=h("div",{class:"fd-wizard","data-node":g.id}),k=h("div",{class:"fd-progress-text"}),I=h("span");$.append(h("div",{class:"fd-progress"},k,h("div",{class:"fd-progress-bar"},I)));let M=g.children.map(R=>{let H=h("section",{class:"fd-step","data-node":R.id,"aria-labelledby":v(`${R.id}-title`)});return H.append(h("h2",{class:"fd-step-title",id:v(`${R.id}-title`)},R.label)),R.description&&H.append(h("p",{class:"fd-section-description"},R.description)),H.append(Te(R.children)),$.append(H),{step:R,panel:H}}),L=h("button",{type:"button",class:"fd-button"},u.back),T=h("button",{type:"submit",class:"fd-button fd-button-primary"});$.append(h("div",{class:"fd-wizard-nav"},L,h("span",{class:"fd-spacer"}),D,T)),L.addEventListener("click",()=>{a.back()&&N()});let Q=()=>{let R=a.steps();return R.indexOf(a.getState().step??"")===R.length-1};J=async()=>{if(Q())return gt();a.next()?N():De()};function N(){M.find(H=>H.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return d.push(R=>{let H=a.steps(),ye=Math.max(0,H.indexOf(R.step??""));k.textContent=y(u.stepOf,{n:ye+1,total:H.length}),I.style.width=`${(ye+1)/Math.max(1,H.length)*100}%`;for(let{step:Ze,panel:Ye}of M)Ye.hidden=Ze.id!==R.step;L.hidden=ye===0,T.textContent=ye===H.length-1?u.submit:u.next}),$}function F(g){let $=h("div",{class:"fd-sheet-page","data-node":g.id}),k=h("div",{class:"fd-actions"}),I=h("button",{type:"submit",class:"fd-button fd-button-primary"},u.save),M=h("button",{type:"button",class:"fd-button"},u.discard);M.addEventListener("click",()=>a.reset()),k.append(I,M,...(g.buttons??[]).map(E),D),d.push(N=>{let R=N.dirty.length>0&&N.status!=="saving";I.hidden=!R,M.hidden=!R});let L=h("div",{class:"fd-header"},k);g.statusbar&&L.append(U(g.statusbar));let T=h("div",{class:"fd-card"});if(g.ribbon){let N=h("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);z(N,g.ribbon.id),T.append(h("div",{class:"fd-ribbon-frame"},N))}if(g.statButtons?.length){let N=h("div",{class:"fd-stats"});for(let R of g.statButtons){let H=h("span",{class:"fd-stat-value"}),ye=h("button",{type:"button",class:"fd-stat","data-node":R.id},H,h("span",{class:"fd-stat-label"},R.label));ye.addEventListener("click",()=>{a.runAction(R.id)}),d.push(Ze=>{ye.hidden=a.node(R.id).invisible;let Ye=R.field?Ze.values[R.field]:null;H.textContent=Ye==null?"":String(Ye)}),N.append(ye)}T.append(N)}for(let N of g.alerts??[]){let R=h("div",{class:`fd-alert fd-tone-${N.tone??"info"}`,role:"status","data-node":N.id},N.message);z(R,N.id),T.append(R)}if(g.title){let N=h("div",{class:"fd-title"});N.append(S({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&N.append(S({type:"field",id:"#subtitle",field:g.title.subtitleField}));let R=h("div",{class:"fd-title-row"},N);if(g.title.avatarField){let H=S({type:"field",id:"#avatar",field:g.title.avatarField});H.classList.add("fd-avatar"),R.append(H)}T.append(R)}T.append(Te(g.children));let Q=h("div",{class:"fd-sheet-layout"},T);return g.sidePanel&&(Q.classList.add("fd-has-side"),Q.append(h("aside",{class:"fd-side"},de(g.sidePanel)))),$.append(L,Q),$}function U(g){let $=o.fields[g.field],k=h("ol",{class:"fd-statusbar","aria-label":$.label});if($.type==="selection"){let M=$.options.filter(L=>!g.visibleStates||g.visibleStates.includes(L.value)).map(L=>{let T=g.clickable?h("button",{type:"button"},h("span",{},L.label)):h("span",{},h("span",{},L.label));return T instanceof HTMLButtonElement&&T.addEventListener("click",()=>a.setValue(g.field,L.value)),k.append(h("li",{},T)),{option:L,inner:T}});d.push(L=>{let T=a.node("#statusbar").readonly;for(let{option:Q,inner:N}of M)Q.value===L.values[g.field]?N.setAttribute("aria-current","step"):N.removeAttribute("aria-current"),N instanceof HTMLButtonElement&&(N.disabled=T)})}else{let I=h("span",{"aria-current":"step"});k.append(h("li",{},I)),d.push(M=>{let L=M.values[g.field];I.textContent=L?.label??""})}return k}let J=null,W=o.layout,ce;W.type==="sheet"?ce=F(W):W.type==="wizard"?ce=w(W):W.type==="tabs"?ce=_({id:`${W.id}-page`,children:[W]}):ce=_(W);let pe=W.type==="sheet"?null:x();ht.append(...pe?[pe]:[],X,ce),O.append(ht,ve),O.addEventListener("submit",g=>{g.preventDefault(),J?J():gt()});function Ue(g){return new Promise($=>{let k=h("p",{id:`${p}-confirm`},g),I=h("button",{type:"button",class:"fd-button"},u.cancel),M=h("button",{type:"button",class:"fd-button fd-button-primary"},u.ok),L=h("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":k.id},k,h("div",{class:"fd-actions fd-actions-end"},I,M)),T=h("div",{class:"fd-dialog-backdrop"},L),Q=N=>{T.remove(),$(N)};I.addEventListener("click",()=>Q(!1)),M.addEventListener("click",()=>Q(!0)),T.addEventListener("keydown",N=>{N.key==="Escape"&&Q(!1)}),O.append(T),M.focus()})}function Se(g){for(let $ of d)$(g)}e.append(O);let bt=a.subscribe(Se);return Se(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:O,setSkin(g){O.setAttribute("data-fd-skin",g)},destroy(){bt();for(let g of m)g();O.remove(),c&&a.dispose()}}}var Ip="0.3.0";return ml(Fp);})();
|
|
445
451
|
//# sourceMappingURL=fieldia.js.map
|