@fieldia/viewer 0.1.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 CHANGED
@@ -1,47 +1,47 @@
1
- /*! Fieldia 0.1.0 · MIT · https://fieldia.dev */
2
- "use strict";var Fieldia=(()=>{var tr=Object.defineProperty;var Xu=Object.getOwnPropertyDescriptor;var Qu=Object.getOwnPropertyNames;var el=Object.prototype.hasOwnProperty;var tl=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Do=(e,t)=>{for(var r in t)tr(e,r,{get:t[r],enumerable:!0})},rl=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Qu(t))!el.call(e,o)&&o!==r&&tr(e,o,{get:()=>t[o],enumerable:!(n=Xu(t,o))||n.enumerable});return e};var nl=e=>rl(tr({},"__esModule",{value:!0}),e);var Qe=(e,t,r)=>tl(e,typeof t!="symbol"?t+"":t,r);var Sp={};Do(Sp,{DEFAULT_LABELS:()=>wp,FIELDIA_CSS:()=>Yu,FIELD_NAME:()=>qe,FIELD_TYPES:()=>cu,FORMAT_VERSION:()=>wo,FieldSchema:()=>_o,FieldsSchema:()=>Lr,FilterConditionSchema:()=>yo,LayoutNodeSchema:()=>it,LineFieldSchema:()=>vo,MESSAGES:()=>Ye,ModifierSchema:()=>Wt,OptionSchema:()=>Ir,PageSchema:()=>wt,RootLayoutSchema:()=>Fr,VERSION:()=>$p,VIEWER_LABELS:()=>Mo,WIDGET_LABELS:()=>we,binaryWidget:()=>To,builtInWidgets:()=>qu,checkValue:()=>qt,compileModifier:()=>Ge,createForm:()=>Vr,createMemoryDataSource:()=>ju,createWidget:()=>Xt,emptyValue:()=>So,evaluateModifier:()=>Lu,expressionContext:()=>Kt,fill:()=>Dr,formatBytes:()=>Gt,hostScheduler:()=>Yt,htmlWidget:()=>Lo,imageWidget:()=>Ro,initialValues:()=>kt,installStyles:()=>Co,isEmpty:()=>Mr,isModifierValid:()=>Fu,jsonWidget:()=>Br,linesWidget:()=>Ao,linkCheckboxesWidget:()=>No,many2oneWidget:()=>Oo,mountViewer:()=>zp,pageJsonSchema:()=>Iu,referenceWidget:()=>Zo,sanitizeHtml:()=>Io,summary:()=>Ku,tagsWidget:()=>Ur,validatePage:()=>Cr,wait:()=>jr});var Z={};Do(Z,{BIGINT_FORMAT_RANGES:()=>ir,CONSTANT_CATCH:()=>Go,Class:()=>qr,NUMBER_FORMAT_RANGES:()=>Pt,aborted:()=>xe,allowsEval:()=>tn,assert:()=>ul,assertEqual:()=>ol,assertIs:()=>al,assertNever:()=>cl,assertNotEqual:()=>il,assignProp:()=>ge,attachSchema:()=>ar,base64ToUint8Array:()=>Ko,base64urlToUint8Array:()=>Pl,cached:()=>mt,captureStackTrace:()=>nr,cleanEnum:()=>El,cleanRegex:()=>Et,clone:()=>$e,cloneDef:()=>fl,codePointLength:()=>Ot,constantCatch:()=>Yo,createTransparentProxy:()=>yl,defineLazy:()=>Xr,defineLazyInternal:()=>F,derived:()=>Al,esc:()=>Qr,escapeRegex:()=>Ce,explicitlyAborted:()=>on,extend:()=>_l,finalizeIssue:()=>Ee,floatSafeRemainder:()=>Yr,getElementAtPath:()=>pl,getEnumValues:()=>ft,getLengthableOrigin:()=>Nt,getParsedType:()=>bl,getSizableOrigin:()=>Ho,hexToUint8Array:()=>Nl,hide:()=>cr,installLazyProp:()=>Ll,isObject:()=>tt,isPlainObject:()=>Je,issue:()=>gt,joinValues:()=>rr,jsonStringifyReplacer:()=>pt,members:()=>an,merge:()=>kl,mergeDefs:()=>Fe,normalizeParams:()=>O,nullish:()=>Gr,numKeys:()=>gl,objectClone:()=>ll,omit:()=>vl,optionalKeys:()=>nn,own:()=>Be,parsedType:()=>sn,partial:()=>zl,pick:()=>xl,prefixIssues:()=>Se,primitiveTypes:()=>Jo,promiseAllObject:()=>ml,propertyKeyTypes:()=>rn,randomString:()=>hl,rawShape:()=>ht,required:()=>$l,safeExtend:()=>wl,shallowClone:()=>Bo,slugify:()=>en,stringifyPrimitive:()=>or,toZod:()=>sl,uint8ArrayToBase64:()=>qo,uint8ArrayToBase64url:()=>Ol,uint8ArrayToHex:()=>Zl,unwrapMessage:()=>dt});function ol(e){return e}function il(e){return e}function sl(){return e=>e}function al(e){}function cl(e){throw new Error("Unexpected value in exhaustive check")}function ul(e){}function ft(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 rr(e,t="|"){return e.map(r=>or(r)).join(t)}function pt(e,t){return typeof t=="bigint"?t.toString():t}var Kr=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 mt(e){return new Kr(e)}function Gr(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 Yr(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 jo=Symbol("evaluating");function Xr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jo)return n===void 0&&(n=jo,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ll(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 ht(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Le(e){return ht(e._zod.def)??e._zod.def.shape}function Vo(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ge(this,t,n),n},enumerable:!0,configurable:!0})}function Uo(e,t,r){t in e?ge(e,t,r):e[t]=r}function et(e,t,r,n){let o=Le(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Vo(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Uo(e,i,n?n(s.value,i):s.value))}}function dl(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Vo(e,r,()=>t[r]):Uo(e,r,n.value))}}function Fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fl(e){return Fe(e._zod.def)}function pl(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function ml(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 hl(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Qr(e){return JSON.stringify(e)}function en(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var tn=mt(()=>{if(pe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Je(e){if(tt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(tt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Bo(e){return Je(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function gl(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var bl=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}`)}},rn=new Set(["string","number","symbol"]),Jo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ce(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 yl(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 or(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function nn(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]},ir={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xl(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 et(i,e,sr(e,t)),$e(e,Fe(r,{shape:i,checks:[]}))}function sr(e,t){let r=Le(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 vl(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(sr(e,t)),s={};return et(s,e,Reflect.ownKeys(Le(e)).filter(a=>!i.has(a))),$e(e,Fe(r,{shape:s,checks:[]}))}function _l(e,t){if(!Je(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=Le(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,Fe(e._zod.def,{shape:Wo(e,t)}))}function Wo(e,t){let r={};return et(r,e,Reflect.ownKeys(Le(e))),dl(r,t),r}function wl(e,t){if(!Je(t))throw new Error("Invalid input to safeExtend: expected a plain object");return $e(e,Fe(e._zod.def,{shape:Wo(e,t)}))}function kl(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={};et(r,e,Reflect.ownKeys(Le(e))),et(r,t,Reflect.ownKeys(Le(t)));let n=Fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return $e(e,n)}function zl(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(sr(t,r)):void 0,c={};return et(c,t,Reflect.ownKeys(Le(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),$e(t,Fe(t._zod.def,{shape:c,checks:[]}))}function $l(e,t,r){let n=r?new Set(sr(t,r)):void 0,o={};return et(o,t,Reflect.ownKeys(Le(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),$e(t,Fe(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 on(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 dt(e){return typeof e=="string"?e:e?.message}function ar(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:dt(e.inst?._zod.def?.error?.(e))??dt(i?.(e))??dt(t?.error?.(e))??dt(r.customError?.(e))??dt(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 Ho(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Sl=/[\uD800-\uDBFF]/;function Ot(e){let t=e.length;if(!Sl.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 sn(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 gt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function El(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ko(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 qo(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Pl(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Ko(t+r)}function Ol(e){return qo(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Nl(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 Zl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var qr=class{constructor(...t){}};function an(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Tl(e,r,n.value)}}function Be(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function cr(e,t,r){return Be(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 Be(this,r,n(this))},set(o){Be(this,r,o)}})}return t}function Tl(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Be(this,t,r.bind(this))},set(n){Be(this,t,n)}})}function Rl(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Hr,Ue=!1,Il={configurable:!0,get(){Ue=!0}};function F(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Hr!==e._zod){Hr=void 0;return}Hr=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Il);let o=Ue;Ue=!1;try{let i=r(this);return Ue?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ue=Ue||o,i}catch(i){throw delete this[t],Ue=Ue||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Ll(e,t,r,n){let o=Rl(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 Go="~constantCatch";function Yo(e){let t=()=>e;return t[Go]=!0,t}var Xo;var cn={value:void 0,enumerable:!1},Qo="captureStackTrace"in Error?Error:null;function Fl(e){let t=Qo;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Qo=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,d){if(m._zod){if(m._zod.traits.has(e))return}else{cn.value=new i(d);try{Object.defineProperty(m,"_zod",cn)}finally{cn.value=void 0}}if(m._zod.traits.add(e),t(m,d),a){let x=Object.getPrototypeOf(m),f=m._zod.constr.prototype,v=x;for(;v&&v!==f;)v=Object.getPrototypeOf(v);let P=v??x;a.has(P)||(a.add(P),an(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 d=n?.Parent?Fl(l):this;c(d,m);let h=d._zod.deferred;if(h){for(let f of h)f();d._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(d),d}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.")}},bt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Xo=globalThis).__zod_globalConfig??(Xo.__zod_globalConfig={});var pe=globalThis.__zod_globalConfig;function ve(e){return e&&Object.assign(pe,e),pe}function Cl(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,pt,2)),e.message}function Ml(e){this._zod.message=e}var Dl={get:Cl,set:Ml,enumerable:!0,configurable:!0},ln={value:void 0,enumerable:!1},ei=new WeakSet([Object.prototype,Error.prototype]),ti=(e,t)=>{e.name="$ZodError",ln.value=t,Object.defineProperty(e,"issues",ln),ln.value=void 0,Object.defineProperty(e,"message",Dl);let r=Object.getPrototypeOf(e);ei.has(r)||(ei.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})}}))},ri=b("$ZodError",ti),Zp=b("$ZodError",ti,void 0,{Parent:Error});function jl(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 ni(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?jl(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function oi(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 ur(e,t){return{callee:t?.callee??e,Err:t?.Err}}var lr=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 nr(c,i?.callee??t),c}return a.value};return t};var dr=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 nr(c,i?.callee??t),c}return a.value};return t};var fr=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?ii(e,i.issues,o):{success:!0,data:i.value}};function ii(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 pr=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?ii(e,i.issues,o):{success:!0,data:i.value}};var Vl=Symbol.for("zod.compile.invalid"),Ul=Symbol.for("zod.compile.fallback"),dn=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Vl)return!0;if(n.definite===!0&&r===void 0)return!1}return Bl(e,t,r)});function Bl(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Ul]=!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 fn=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},si=e=>{let t=lr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,ur(r,s))};return r};var ai=e=>{let t=lr(e),r=(n,o,i,s)=>t(n,o,i,ur(r,s));return r};var ci=e=>{let t=dr(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,ur(r,s))};return r};var ui=e=>{let t=dr(e),r=async(n,o,i,s)=>await t(n,o,i,ur(r,s));return r};var li=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return fr(e)(t,r,o)};var di=e=>(t,r,n)=>fr(e)(t,r,n);var fi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return pr(e)(t,r,o)};var pi=e=>async(t,r,n)=>pr(e)(t,r,n);var mi=/^[cC][0-9a-z]{6,}$/,hi=/^[0-9a-z]+$/,gi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bi=/^[0-9a-vA-V]{20}$/,yi=/^[A-Za-z0-9]{27}$/,xi=/^[a-zA-Z0-9_-]{21}$/;function vi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _i=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wi=/^([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})$/,mn=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 ki=/^(?:[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 Jl="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zi(){return new RegExp(Jl,"u")}var $i=/^(?:(?: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])$/,Si=/^(([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 Ei=/^((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])$/,Pi=/^(([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])$/,Oi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ni=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Zi=/^https?$/,Ai=/^\+[1-9]\d{6,14}$/;var Ti="(?:(?:\\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 Wl(e){return new RegExp(`^${e}$`)}var Ri=Wl(Ti);function pn(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 Ii(e){return new RegExp(`^${pn(e)}$`)}function Li(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${pn({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${pn({precision:e.precision})}`:r;return new RegExp(`^${Ti}T(?:${n})$`)}var Fi=/^[\s\S]{0,}$/;var hn=/^-?\d+$/,Zt=/^-?\d+(?:\.\d+)?$/,Ci=/^(?:true|false)$/i,Mi=/^null$/i;var Di=/^[^A-Z]*$/,ji=/^[^a-z]*$/;var le=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var gn=e=>{let t=e.value;return!Gr(t)&&t.length!==void 0},mr={number:"number",bigint:"bigint",object:"date"},bn=b("$ZodCheckLessThan",(e,t)=>{le.init(e,t);let r=mr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:mr[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})}}),yn=b("$ZodCheckGreaterThan",(e,t)=>{le.init(e,t);let r=mr[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:mr[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})}}),Vi=b("$ZodCheckMultipleOf",(e,t)=>{le.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):Yr(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})}}),Ui=b("$ZodCheckNumberFormat",(e,t)=>{le.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 Bi=b("$ZodCheckMaxLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),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})}}),Ji=b("$ZodCheckMinLength",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),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})}}),Wi=b("$ZodCheckLengthEquals",(e,t)=>{var r;le.init(e,t),(r=e._zod.def).when??(r.when=gn),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})}}),Tt=b("$ZodCheckStringFormat",(e,t)=>{var r,n;le.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=()=>{})}),Hi=b("$ZodCheckRegex",(e,t)=>{Tt.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})}}),Ki=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Di),Tt.init(e,t)}),qi=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ji),Tt.init(e,t)}),Gi=b("$ZodCheckIncludes",(e,t)=>{le.init(e,t);let r=Ce(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})}}),Yi=b("$ZodCheckStartsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`^${Ce(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})}}),Xi=b("$ZodCheckEndsWith",(e,t)=>{le.init(e,t);let r=new RegExp(`.*${Ce(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 Qi=b("$ZodCheckOverwrite",(e,t)=>{le.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var hr=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 ts={major:4,minor:6,patch:5};var U=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ts;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(on(a)||!m._zod.def.when(a))continue}else if(l)continue;let d=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!==d&&(ar(a.issues,d,e),l||(l=xe(a,d)))});else{if(a.issues.length===d)continue;ar(a.issues,d,e),l||(l=xe(a,d))}}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 cr(this,"~standard",vn(this))},set"~standard"(e){Be(this,"~standard",e)}}),hs=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ee(r,t,ve()))}:{value:e.value};async function Hl(e,t){let r={async:!0};return hs(await e._zod.run({value:t,issues:[]},r),r)}function vn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return hs(n,r)}catch{}return Hl(e,t)},vendor:"zod",version:1}}var xr=b("$ZodString",(e,t)=>{U.init(e,t),e._zod.pattern=t.pattern??Fi,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)=>{Tt.init(e,t),xr.init(e,t)}),gs=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wi),X.init(e,t)}),bs=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=mn(n))}else t.pattern??(t.pattern=mn());X.init(e,t)}),ys=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ki),X.init(e,t)}),xs=1,br=2;function vs(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Kl(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?vs(e)||br:ql(e,t)}function ql(e,t){if(!t.normalize&&t.protocol?.source===Zi.source&&!/^https?:\/\//i.test(e))return xs;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??br}return new URL(e)}catch{return br}}var Gl=/[\t\n\r]/g;function rs(e){return e.replace(Gl,"")}function Yl(e,t){return t.lastIndex=0,t.test(e.hostname)}function Xl(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var _s=b("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Kl(n,t);if(o===xs){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===br){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=rs(n);return}t.hostname&&!Yl(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&&!Xl(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:rs(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ws=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zi()),X.init(e,t)}),ks=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?xi:vi(t.length)),X.init(e,t)}),zs=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mi),X.init(e,t)}),$s=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hi),X.init(e,t)}),Ss=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gi),X.init(e,t)}),Es=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bi),X.init(e,t)}),Ps=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yi),X.init(e,t)}),Os=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Li(t)),X.init(e,t)}),Ns=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ri),X.init(e,t)}),Zs=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ii(t)),X.init(e,t)}),As=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_i),X.init(e,t)}),Ts=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$i),X.init(e,t)}),Ql=/^[0-9a-fA-F:.]+$/;function Rs(e){return Ql.test(e)?vs(`http://[${e}]`):!1}var Is=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Si),X.init(e,t),e._zod.check=r=>{Rs(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Ls=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ei),X.init(e,t)});function ed(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:Rs(r)}var Fs=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pi),X.init(e,t),e._zod.check=r=>{ed(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Cs(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}$/,Ms=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_n),X.init(e,t),e._zod.check=r=>{Cs(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),vr=/^[A-Za-z0-9_-]*$/;function td(e){if(!vr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Cs(r)}var Ds=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vr),X.init(e,t),e._zod.check=r=>{td(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),js=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ai),X.init(e,t)});function rd(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 Vs=b("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=r=>{rd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wn=b("$ZodNumber",(e,t)=>{U.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}}),Us=b("$ZodNumberFormat",(e,t)=>{Ui.init(e,t),wn.init(e,t)}),Bs=b("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=Ci,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 Js=b("$ZodNull",(e,t)=>{U.init(e,t),e._zod.pattern=Mi,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 Ws=b("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=r=>r}),Hs=b("$ZodNever",(e,t)=>{U.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ns(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}var Ks=b("$ZodArray",(e,t)=>{U.init(e,t);let r=pe.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=>ns(p,n,c)));else if(ns(l,n,c),a&&l.issues.length!==0&&xe(l))break}return s.length?Promise.all(s).then(()=>n):n}});function yr(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 nd=[];function qs(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:nd,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=nn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Gs(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,d=0;for(let h in t){if(s&&r.issues.length!==d){if(xe(r,d))break;d=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(f=>yr(f,r,h,t,p,m))):yr(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 od=b("$ZodObject",(e,t)=>{U.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=mt(()=>qs(t));F(e,"propValues",u=>{let l=u.def.shape,p={};for(let m in l){let d=l[m]._zod;if(d.values){Object.prototype.hasOwnProperty.call(p,m)||ge(p,m,new Set);for(let h of d.values)p[m].add(h);d.optin!==void 0&&p[m].add(void 0)}}return p});let i=tt,s=t.catchall,a,c=pe.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=[],d=a.shape,h=l?.abortEarly,x=u.issues.length;for(let f of a.allKeys){if(h&&u.issues.length!==x){if(xe(u,x))break;x=u.issues.length}if(f==="__proto__")continue;let v=d[f],P=v._zod.optin,D=v._zod.optout,S=v._zod.run({value:p[f],issues:[]},l);S instanceof Promise?m.push(S.then(w=>yr(w,u,f,p,P,D))):yr(S,u,f,p,P,D)}return s?Gs(m,p,u,l,o.value,e,h===!0):m.length?Promise.all(m).then(()=>u):u}}),Ys=b("$ZodObjectJIT",(e,t)=>{od.init(e,t);let r=e._zod.parse,n=mt(()=>qs(t)),o=pe.memoizer,i=d=>{let h=n.value,x=h.symbolKeys,f=new hr(["payload","ctx"],{shape:d,inst:e,memo:o,syms:x}),v=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,P=(w,z)=>`
7
- let ${w}_ab = false;
8
- for (let i = 0; i < ${w}.issues.length; i++) {
9
- const iss = ${w}.issues[i];
10
- iss.path = iss.path ? [${z}, ...iss.path] : [${z}];
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) ${w}_ab = true;
12
+ if (iss.continue !== true) ${z}_ab = true;
13
13
  }
14
- if (${w}_ab && ctx && ctx.abortEarly) {
14
+ if (${z}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;f.write("const input = payload.value;");let D=Object.create(null),S=0;for(let w of h.allKeys)D[w]=`key_${S++}`;f.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of h.allKeys){if(w==="__proto__")continue;let z=D[w],B=typeof w=="symbol"?`syms[${x.indexOf(w)}]`:Qr(w),te=`${B} in input`,re=d[w],ie=re?._zod?.optin,V=ie!==void 0,Q=re?._zod?.optout==="optional";if(f.write(`const ${z} = ${v(B)};`),V&&Q){let he=ie==="optional"?`${z}_present`:`${z}.value !== undefined || ${z}_present`;f.write(`
18
- const ${z}_present = ${te};
19
- if (!${z}.issues.length || ${z}_present) {
20
- if (${z}.issues.length) {${P(z,B)}
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 (${he}) {
24
- newResult[${B}] = ${z}.value;
23
+ if (${ie}) {
24
+ newResult[${q}] = ${E}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else V?(f.write(`
29
- if (${z}.issues.length) {${P(z,B)}
28
+ `)}else V?(y.write(`
29
+ if (${E}.issues.length) {${O(E,q)}
30
30
  }
31
- `),ie==="defaulted"?f.write(`newResult[${B}] = ${z}.value;`):f.write(`
32
- if (${z}.value !== undefined || ${te}) {
33
- newResult[${B}] = ${z}.value;
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
- `)):f.write(`
36
- const ${z}_present = ${te};
37
- if (${z}.issues.length) {${P(z,B)}
35
+ `)):y.write(`
36
+ const ${E}_present = ${de};
37
+ if (${E}.issues.length) {${O(E,q)}
38
38
  }
39
- if (!${z}_present && !${z}.issues.length) {
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: [${B}]
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 (${z}_present) {
53
- newResult[${B}] = ${z}.value;
52
+ if (${E}_present) {
53
+ newResult[${q}] = ${E}.value;
54
54
  }
55
55
 
56
- `)}return f.write("payload.value = newResult;"),f.write("return payload;"),f.compile()},s,a=tt,c=!pe.jitless,l=c&&tn.value,p=t.catchall,m;e._zod.parse=(d,h)=>{m??(m=n.value);let x=d.value;return a(x)?c&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),d=s(d,h),p?Gs([],x,d,h,m,e,h?.abortEarly===!0):d):r(d,h):(d.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),d)}});function os(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 kn=b("$ZodUnion",(e,t)=>{U.init(e,t),F(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),F(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),F(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)))}),F(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=>os(a,n,e,o)):os(s,n,e,o)}});function id(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 Xs=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kn.init(e,t);let r=e._zod.parse;F(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=ht(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=mt(()=>id(t));e._zod.parse=(o,i)=>{let s=o.value;if(!tt(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)}}),Qs=b("$ZodIntersection",(e,t)=>{U.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])=>is(r,c,u)):is(r,i,s)}});function xn(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(Je(e)&&Je(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=xn(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=xn(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 is(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=xn(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 ea=b("$ZodTuple",(e,t)=>{U.init(e,t);let r=t.items,n=pe.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=ss(r,"optin"),u=ss(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 d=0;d<r.length;d++){let h=r[d]._zod.run({value:s[d],issues:[]},i);h instanceof Promise?a.push(h.then(x=>{l[d]=x})):(l[d]=h,p&&!m&&h.issues.length&&(m=xe(h)))}if(t.rest&&!m){let d=r.length-1,h=s.slice(r.length),x=o.issues.length;for(let f of h){if(p&&o.issues.length!==x){if(xe(o,x))break;x=o.issues.length}d++;let v=t.rest._zod.run({value:f,issues:[]},i);v instanceof Promise?a.push(v.then(P=>as(P,o,d))):as(v,o,d)}}return a.length?Promise.all(a).then(()=>cs(l,o,r,s,u)):cs(l,o,r,s,u)}});function ss(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 as(e,t,r){e.issues.length&&t.issues.push(...Se(r,e.issues)),t.value[r]=e.value}function cs(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 ta=b("$ZodRecord",(e,t)=>{U.init(e,t);let r=pe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Je(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 d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Se(l,h.issues)),n.value[m]=h.value})):(d.issues.length&&n.issues.push(...Se(l,d.issues)),n.value[m]=d.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 d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Se(u,h.issues)),n.value[m]=h.value})):(d.issues.length&&n.issues.push(...Se(u,d.issues)),n.value[m]=d.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 ra=b("$ZodEnum",(e,t)=>{U.init(e,t);let r=ft(t.entries),n=new Set(r);e._zod.values=n,F(e,"pattern",o=>{let i=ft(o.def.entries).filter(s=>rn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Ce(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}}),na=b("$ZodLiteral",(e,t)=>{U.init(e,t);let r=new Set(t.values);e._zod.values=r,F(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Ce(i):i?Ce(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 oa=b("$ZodTransform",(e,t)=>{U.init(e,t),e._zod.optin="optional",pe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new bt(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 us(e,t){return e.value=t.issues.length?void 0:t.value,e}var zn=b("$ZodOptional",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",F(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),F(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=>us(r,i)):us(r,o)}return t.innerType._zod.run(r,n)}}),ia=b("$ZodExactOptional",(e,t)=>{zn.init(e,t),F(e,"values",r=>r.def.innerType._zod.values),F(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),sa=b("$ZodNullable",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin),F(e,"optout",r=>r.def.innerType._zod.optout),F(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Et(n.source)}|null)$`):void 0}),F(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)}),aa=b("$ZodDefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",F(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=>ls(i,t)):ls(o,t)}});function ls(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ca=b("$ZodPrefault",(e,t)=>{U.init(e,t),e._zod.optin="defaulted",F(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))}),ua=b("$ZodNonOptional",(e,t)=>{U.init(e,t),F(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=>ds(i,e)):ds(o,e)}});function ds(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 fs(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 la=b("$ZodCatch",(e,t)=>{U.init(e,t),F(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),F(e,"optout",r=>r.def.innerType._zod.optout),F(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=>fs(r,i,t,n)):fs(r,o,t,n)}});var da=b("$ZodPipe",(e,t)=>{U.init(e,t),F(e,"values",r=>r.def.in._zod.values),F(e,"optin",r=>r.def.in._zod.optin),F(e,"optout",r=>r.def.out._zod.optout),F(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=>gr(s,t.in,n)):gr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>gr(i,t.out,n)):gr(o,t.out,n)}});function gr(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 fa=b("$ZodReadonly",(e,t)=>{U.init(e,t),F(e,"propValues",r=>r.def.innerType._zod.propValues),F(e,"values",r=>r.def.innerType._zod.values),F(e,"optin",r=>r.def.innerType?._zod?.optin),F(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(ps):ps(o)}});function ps(e){return e.memo||(e.value=Object.freeze(e.value)),e}var pa=b("$ZodLazy",(e,t)=>{U.init(e,t),Xr(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),F(e,"pattern",r=>r.innerType?._zod?.pattern),F(e,"propValues",r=>r.innerType?._zod?.propValues),F(e,"optin",r=>r.innerType?._zod?.optin??void 0),F(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ma=b("$ZodCustom",(e,t)=>{le.init(e,t),U.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=>ms(i,r,n,e));ms(o,r,n,e)}});function ms(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(gt(o))}}var Sn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},En="~memo",ha=[];function ga(e){return e!==null&&typeof e=="object"}function $n(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ba=new WeakMap,Rt=0,kr=1,It=2;function zr(e,t,r){let n=ba.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=zr(l,t,r);p>o&&(o=p)}},s=(l,p)=>{let m=Rt;for(let d of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,d);if(p&&!h.enumerable)continue;let x=h.get?kr:h.value?._zod?zr(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=ht(c);a(l?s(l,!0):kr),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?zr(l,t,!1):kr);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 d of m)i(d)}}}return t.delete(e),sd(e,o)}function sd(e,t){return t!==kr&&ba.set(e,t===It),t}function ad(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var _r,wr=[],cd={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),wr.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"&&ud(i,o.value))throw new Sn;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=zr(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(!ga(l))return s(c,u);let p=u[En];p||(p={buckets:new WeakMap,backEdges:void 0},u[En]=p);let m;o===u?m=i:(m=ad(p,e),o=u,i=m);let d=m.get(l);if(d)return c.value=d.value,d.issues?d.issues.length&&c.issues.push(...$n(d.issues)):(c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(d.value)),c;_r=m;let h=wr.length,x=s(c,u);_r=void 0;let f=wr.length>h?wr.pop():void 0;return x instanceof Promise?x.then(v=>(f&&(f.issues=v.issues.length?$n(v.issues):ha),v)):(f&&(f.issues=x.issues.length?$n(x.issues):ha),x)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function ya(){return cd}function ud(e,t){let r=e[En]?.backEdges;return r!==void 0&&ga(t)&&r.has(t)}var ld=()=>{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=sn(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 ${or(i.values[0])}`:`Invalid option: expected one of ${rr(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":""}: ${rr(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 xa(){return{localeError:ld()}}var va;var Pn=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 dd(){return new Pn}(va=globalThis).__zod_globalRegistry??(va.__zod_globalRegistry=dd());var rt=globalThis.__zod_globalRegistry;function _a(e){return e.checks&&(e.checks=[...e.checks]),e}function wa(e,t){return new e(_a({type:"string",...O(t)}))}function ka(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function za(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function $a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Sa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Ea(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Oa(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Na(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Za(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 Ta(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Ia(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Ca(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function ja(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Wa(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ha(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Ka(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function qa(e,t){return new e(_a({type:"number",checks:[],...O(t)}))}function Ga(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Ya(e,t){return new e({type:"boolean",...O(t)})}function Xa(e,t){return new e({type:"null",...O(t)})}function Qa(e){return new e({type:"unknown"})}function ec(e,t){return new e({type:"never",...O(t)})}function $r(e,t){return new bn({check:"less_than",...O(t),value:e,inclusive:!1})}function Lt(e,t){return new bn({check:"less_than",...O(t),value:e,inclusive:!0})}function Sr(e,t){return new yn({check:"greater_than",...O(t),value:e,inclusive:!1})}function Ft(e,t){return new yn({check:"greater_than",...O(t),value:e,inclusive:!0})}function Er(e,t){return new Vi({check:"multiple_of",...O(t),value:e})}function Pr(e,t){return new Bi({check:"max_length",...O(t),maximum:e})}function yt(e,t){return new Ji({check:"min_length",...O(t),minimum:e})}function Or(e,t){return new Wi({check:"length_equals",...O(t),length:e})}function On(e,t){return new Hi({check:"string_format",format:"regex",...O(t),pattern:e})}function Nn(e){return new Ki({check:"string_format",format:"lowercase",...O(e)})}function Zn(e){return new qi({check:"string_format",format:"uppercase",...O(e)})}function An(e,t){return new Gi({check:"string_format",format:"includes",...O(t),includes:e})}function Tn(e,t){return new Yi({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Rn(e,t){return new Xi({check:"string_format",format:"ends_with",...O(t),suffix:e})}function We(e){return new Qi({check:"overwrite",tx:e})}function In(e){return We(t=>t.normalize(e))}function Ln(){return We(e=>e.trim())}function Fn(){return We(e=>e.toLowerCase())}function Cn(){return We(e=>e.toUpperCase())}function Mn(){return We(e=>en(e))}function tc(e,t,r){return new e({type:"array",element:t,...O(r)})}function rc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function nc(e,t){let r=fd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(gt(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(gt(i))}},e(n.value,n)),t);return r}function fd(e,t){let r=new le({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??rt,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 ae(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 H(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,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),H(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ct(s.schema,c),t.io==="input"&&me(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 oc(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 d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${a}/${oc(d)}`}}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+oc(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 ac(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;ac(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 cc=new Set(["type","properties","required","additionalProperties"]),ic=["oneOf","anyOf"];function sc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Dn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!cc.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]??sc(u);l!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Dn(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=sc(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 pd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of cc)if(o in e)return;let r=t.filter(o=>ic.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dn(t);else{let o=r[0],i=ic.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=>Dn([...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 d=e.seen.get(p),h=d.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 f in u)f==="$ref"||f==="allOf"||f in l||delete u[f];if(h.$ref&&d.def)for(let f in u)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(u[f])===JSON.stringify(d.def[f])&&delete u[f]}let m=a._zod.parent;if(m&&m!==p){n(m);let d=e.seen.get(m);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let h in u)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.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())ac(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)??[])pd(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 me(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 me(n.element,r);if(n.type==="set")return me(n.valueType,r);if(n.type==="lazy")return me(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 me(n.innerType,r);if(n.type==="intersection")return me(n.left,r)||me(n.right,r);if(n.type==="record"||n.type==="map")return me(n.keyType,r)||me(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:me(n.in,r)||me(n.out,r);if(n.type==="object"){for(let o in n.shape)if(me(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(me(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(me(o,r))return!0;return!!(n.rest&&me(n.rest,r))}return!1}var uc=(e,t={})=>r=>{let n=Dt({...r,processors:t});return H(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 H(e,s),jt(s,e),Vt(s,e)};var xt=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},vt=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},lc=(e,t)=>{xt(e,"minimum",t),vt(e,"maximum",t)},hc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},gc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},bc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},yc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},dc=(e,t)=>xt(e,"minimum",t.minimum),fc=(e,t)=>vt(e,"maximum",t.maximum),pc=e=>(t,r)=>{yc(t,r.format);let[n,o]=e[r.format];xt(t,"minimum",n),vt(t,"maximum",o)},md={greater_than:(e,t)=>xt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>vt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>hc(e,t.value),number_format:pc(Pt),bigint_format:pc(ir),min_length:dc,max_length:fc,length_equals:(e,t)=>lc(e,t.length),min_size:dc,max_size:fc,size_equals:(e,t)=>lc(e,t.size),string_format:(e,t)=>{yc(e,t.format),t.pattern&&gc(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)=>bc(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)md[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&xt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&xt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&vt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&vt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&hc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&bc(t,o.mime);for(let i of o.patterns??[])gc(t,i);return t}var hd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gd=new Map([[_n,Oi],[vr,Ni]]),xc=e=>gd.get(e)??e,Un=(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=hd[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(xc);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}))])}},Bn=(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),d=t.target==="draft-04"||t.target==="openapi-3.0";if(p?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?d?(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)):ae(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[x,...f]=h;x!==void 0&&(o.multipleOf=x),f.length&&(o.allOf=[...o.allOf??[],...f.map(v=>({multipleOf:v}))])}},Jn=(e,t,r,n)=>{r.type="boolean"},vc=(e,t,r,n)=>{ae(e,t,r,n,"BigInt cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{ae(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Wn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},wc=(e,t,r,n)=>{ae(e,t,r,n,"Undefined cannot be represented in JSON Schema")},kc=(e,t,r,n)=>{ae(e,t,r,n,"Void cannot be represented in JSON Schema")},Hn=(e,t,r,n)=>{r.not={}},zc=(e,t,r,n)=>{},Kn=(e,t,r,n)=>{},$c=(e,t,r,n)=>{ae(e,t,r,n,"Date cannot be represented in JSON Schema")},qn=(e,t,r,n)=>{let o=e._zod.def,i=ft(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},Gn=(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(ae(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(ae(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},Sc=(e,t,r,n)=>{ae(e,t,r,n,"NaN cannot be represented in JSON Schema")},Ec=(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},Pc=(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})))},Oc=(e,t,r,n)=>{r.type="boolean"},Yn=(e,t,r,n)=>{ae(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Nc=(e,t,r,n)=>{ae(e,t,r,n,"Function types cannot be represented in JSON Schema")},Xn=(e,t,r,n)=>{ae(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Zc=(e,t,r,n)=>{ae(e,t,r,n,"Map cannot be represented in JSON Schema")},Ac=(e,t,r,n)=>{ae(e,t,r,n,"Set cannot be represented in JSON Schema")},Qn=(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=H(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 eo=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ae(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,H(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=H(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},to=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>H(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},ro=(e,t,r,n)=>{let o=e._zod.def,i=H(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=H(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)},no=(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,f)=>H(x,t,{...n,path:[...n.path,s,f]})),u=i.rest?H(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:d,maximum:h}=be(e);typeof d=="number"&&(o.minItems=d),typeof h=="number"&&(o.maxItems=h)};function jn(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=jn(e,h,r);return x===h?t:x}for(let h of["anyOf","oneOf"]){let x=t[h];if(!Array.isArray(x))continue;let f=x.map(v=>jn(e,v,r));f.some((v,P)=>v!==x[P])&&(t={...t,[h]:f})}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,...d}=t;return d.enum?d.enum=d.enum.map(h=>typeof h=="number"?String(h):h):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(n.includes("number")?Zt:hn).source)),d}var Vn=new WeakMap;function bd(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 Vn.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 oo=(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=H(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)ge(o.patternProperties,xc(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=H(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Vn.get(t);l||(l=[],Vn.set(t,l),t.deferred.push(()=>bd(t))),l.push(e)}o.additionalProperties=H(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))}},io=(e,t,r,n)=>{let o=e._zod.def,i=H(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"}]},so=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},ao=Symbol();function Tc(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(ae(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ao):JSON.parse(s)}var co=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Tc(o.defaultValue,e,t,r,n);s!==ao&&(r.default=s)},uo=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Tc(o.defaultValue,e,t,r,n);s!==ao&&(r._prefault=s)},lo=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ae(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},fo=(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;H(s,t,n);let a=t.seen.get(e);a.ref=s},po=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Rc=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Nr=(e,t,r,n)=>{let o=e._zod.def;H(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},mo=(e,t,r,n)=>{let o=e._zod.innerType;H(o,t,n);let i=t.seen.get(e);i.ref=o},mc={string:Un,number:Bn,boolean:Jn,bigint:vc,symbol:_c,null:Wn,undefined:wc,void:kc,never:Hn,any:zc,unknown:Kn,date:$c,enum:qn,literal:Gn,nan:Sc,template_literal:Ec,file:Pc,success:Oc,custom:Yn,function:Nc,transform:Xn,map:Zc,set:Ac,array:Qn,object:eo,union:to,intersection:ro,tuple:no,record:oo,nullable:io,nonoptional:so,default:co,prefault:uo,catch:lo,pipe:fo,readonly:po,promise:Rc,optional:Nr,lazy:mo};function ho(e,t){if("_idmap"in e){let n=e,o=Dt({...t,processors:mc}),i={};for(let c of n._idmap.entries()){let[u,l]=c;H(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:mc});return H(e,r),jt(r,e),Vt(r,e)}var Ic=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 Sd=(e,t)=>{ri.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Ic.has(r)||(Ic.add(r),Ar(r,"format",n=>o=>oi(n,o)),Ar(r,"flatten",n=>o=>ni(n,o)),Ar(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,pt,2)}),Ar(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,pt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var _e=b("ZodError",Sd,void 0,{Parent:Error});var Lc=lr(_e),Fc=dr(_e),Cc=fr(_e),Mc=pr(_e),Dc=si(_e),jc=ai(_e),Vc=ci(_e),Uc=ui(_e),Bc=li(_e),Jc=di(_e),Wc=fi(_e),Hc=pi(_e);function Pd(){pe.localeError||ve(xa())}function Bt(){pe.memoizer||ve({memoizer:ya()})}var K=b("ZodType",(e,t)=>(Pd(),U.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Z.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(Pf(e,t))},superRefine(e,t){return this.check(Of(e,t))},overwrite(e){return this.check(We(e))},optional(){return Gc(this)},exactOptional(){return pf(this)},nullable(){return Yc(this)},nullish(){return Gc(Yc(this))},nonoptional(e){return xf(this,e)},array(){return se(this)},or(e){return He([this,e])},and(e){return cf(this,e)},transform(e){return Xc(this,ff(e))},default(e){return gf(this,e)},prefault(e){return yf(this,e)},catch(e){return _f(this,e)},pipe(e){return Xc(this,e)},readonly(){return zf(this)},describe(e){let t=this.clone();return rt.add(t,{description:e}),t},meta(...e){if(e.length===0)return rt.get(this);let t=this.clone();return rt.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 Z.hide(this,"~standard",{...vn(this),jsonSchema:{input:Mt(this,"input"),output:Mt(this,"output")}})},set"~standard"(e){Z.own(this,"~standard",e)},parse:function e(t,r){return Lc(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Fc(this,t,r,{callee:e})},safeParse(e,t){return Cc(this,e,t)},async safeParseAsync(e,t){return Mc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Z.own(this,"spa",e)},validate(e,t){return dn(this,e,t)},validateAsync(e,t){return fn(this,e,t)},encode:function e(t,r){return Dc(this,t,r,{callee:e})},decode:function e(t,r){return jc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Vc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Uc(this,t,r,{callee:e})},safeEncode(e,t){return Bc(this,e,t)},safeDecode(e,t){return Jc(this,e,t)},async safeEncodeAsync(e,t){return Wc(this,e,t)},async safeDecodeAsync(e,t){return Hc(this,e,t)},toJSONSchema(e){return uc(this,{})(e)},get description(){return rt.get(this)?.description},get _def(){return this._zod.def}}),Qc=b("_ZodString",(e,t)=>{xr.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Un(e,r,n,o)},Z.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(On(...e))},includes(...e){return this.check(An(...e))},startsWith(...e){return this.check(Tn(...e))},endsWith(...e){return this.check(Rn(...e))},min(...e){return this.check(yt(...e))},max(...e){return this.check(Pr(...e))},length(...e){return this.check(Or(...e))},nonempty(...e){return this.check(yt(1,...e))},lowercase(e){return this.check(Nn(e))},uppercase(e){return this.check(Zn(e))},trim(){return this.check(Ln())},normalize(...e){return this.check(In(...e))},toLowerCase(){return this.check(Fn())},toUpperCase(){return this.check(Cn())},slugify(){return this.check(Mn())}})),Od=b("ZodString",(e,t)=>{xr.init(e,t),Qc.init(e,t)},{email(e){return this.check(ka(Rd,e))},url(e){return this.check(Oa(Ld,e))},jwt(e){return this.check(Ba(Yd,e))},emoji(e){return this.check(Na(Fd,e))},guid(e){return this.check(za(Id,e))},uuid(e){return this.check($a(Tr,e))},uuidv4(e){return this.check(Sa(Tr,e))},uuidv6(e){return this.check(Ea(Tr,e))},uuidv7(e){return this.check(Pa(Tr,e))},nanoid(e){return this.check(Za(Cd,e))},cuid(e){return this.check(Aa(Md,e))},cuid2(e){return this.check(Ta(Dd,e))},ulid(e){return this.check(Ra(jd,e))},base64(e){return this.check(ja(Kd,e))},base64url(e){return this.check(Va(qd,e))},xid(e){return this.check(Ia(Vd,e))},ksuid(e){return this.check(La(Ud,e))},ipv4(e){return this.check(Fa(Bd,e))},ipv6(e){return this.check(Ca(Jd,e))},cidrv4(e){return this.check(Ma(Wd,e))},cidrv6(e){return this.check(Da(Hd,e))},e164(e){return this.check(Ua(Gd,e))},datetime(e){return this.check(Ja(Nd,e))},date(e){return this.check(Wa(Zd,e))},time(e){return this.check(Ha(Ad,e))},duration(e){return this.check(Ka(Td,e))}});function N(e){return wa(Od,e)}var ee=b("ZodStringFormat",(e,t)=>{X.init(e,t),Qc.init(e,t)}),Nd=b("ZodISODateTime",(e,t)=>{Os.init(e,t),ee.init(e,t)}),Zd=b("ZodISODate",(e,t)=>{Ns.init(e,t),ee.init(e,t)}),Ad=b("ZodISOTime",(e,t)=>{Zs.init(e,t),ee.init(e,t)}),Td=b("ZodISODuration",(e,t)=>{As.init(e,t),ee.init(e,t)}),Rd=b("ZodEmail",(e,t)=>{ys.init(e,t),ee.init(e,t)});var Id=b("ZodGUID",(e,t)=>{gs.init(e,t),ee.init(e,t)});var Tr=b("ZodUUID",(e,t)=>{bs.init(e,t),ee.init(e,t)});var Ld=b("ZodURL",(e,t)=>{_s.init(e,t),ee.init(e,t)});var Fd=b("ZodEmoji",(e,t)=>{ws.init(e,t),ee.init(e,t)});var Cd=b("ZodNanoID",(e,t)=>{ks.init(e,t),ee.init(e,t)});var Md=b("ZodCUID",(e,t)=>{zs.init(e,t),ee.init(e,t)});var Dd=b("ZodCUID2",(e,t)=>{$s.init(e,t),ee.init(e,t)});var jd=b("ZodULID",(e,t)=>{Ss.init(e,t),ee.init(e,t)});var Vd=b("ZodXID",(e,t)=>{Es.init(e,t),ee.init(e,t)});var Ud=b("ZodKSUID",(e,t)=>{Ps.init(e,t),ee.init(e,t)});var Bd=b("ZodIPv4",(e,t)=>{Ts.init(e,t),ee.init(e,t)});var Jd=b("ZodIPv6",(e,t)=>{Is.init(e,t),ee.init(e,t)});var Wd=b("ZodCIDRv4",(e,t)=>{Ls.init(e,t),ee.init(e,t)});var Hd=b("ZodCIDRv6",(e,t)=>{Fs.init(e,t),ee.init(e,t)});var Kd=b("ZodBase64",(e,t)=>{Ms.init(e,t),ee.init(e,t)});var qd=b("ZodBase64URL",(e,t)=>{Ds.init(e,t),ee.init(e,t)});var Gd=b("ZodE164",(e,t)=>{js.init(e,t),ee.init(e,t)});var Yd=b("ZodJWT",(e,t)=>{Vs.init(e,t),ee.init(e,t)});var eu=b("ZodNumber",(e,t)=>{wn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bn(e,r,n,o),e.isFinite=!0},Z.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(Sr(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($r(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(Te(e))},safe(e){return this.check(Te(e))},positive(e){return this.check(Sr(0,e))},nonnegative(e){return this.check(Ft(0,e))},negative(e){return this.check($r(0,e))},nonpositive(e){return this.check(Lt(0,e))},multipleOf(e,t){return this.check(Er(e,t))},step(e,t){return this.check(Er(e,t))},finite(){return this}}));function Oe(e){return qa(eu,e)}var Xd=b("ZodNumberFormat",(e,t)=>{Us.init(e,t),eu.init(e,t)});function Te(e){return Ga(Xd,e)}var Qd=b("ZodBoolean",(e,t)=>{Bs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jn(e,r,n,o)});function Me(e){return Ya(Qd,e)}var ef=b("ZodNull",(e,t)=>{Js.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wn(e,r,n,o)});function tf(e){return Xa(ef,e)}var rf=b("ZodUnknown",(e,t)=>{Ws.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kn(e,r,n,o)});function Kc(){return Qa(rf)}var nf=b("ZodNever",(e,t)=>{Hs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hn(e,r,n,o)});function tu(e){return ec(nf,e)}var of=b("ZodArray",(e,t)=>{Bt(),Ks.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qn(e,r,n,o),e.element=t.element},{min(e,t){return this.check(yt(e,t))},nonempty(e){return this.check(yt(1,e))},max(e,t){return this.check(Pr(e,t))},length(e,t){return this.check(Or(e,t))},unwrap(){return this.element}});function se(e,t){return tc(of,e,t)}var ru=b("ZodObject",(e,t)=>{Bt(),Ys.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eo(e,r,n,o),Z.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return nt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Z.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:Kc()}))},loose(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:Kc()}))},strict(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:tu()}))},strip(){return this.clone(Z.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return Z.extend(this,e)},safeExtend(e){return Z.safeExtend(this,e)},merge(e){return Z.merge(this,e)},pick(e){return Z.pick(this,e)},omit(e){return Z.omit(this,e)},partial(...e){return Z.partial(bo,this,e[0])},exactPartial(...e){return Z.partial(iu,this,e[0],"exactPartial")},required(...e){return Z.required(su,this,e[0])}});function ne(e,t){let r={type:"object",shape:e??{},...Z.normalizeParams(t)};return new ru(r)}function oe(e,t){return new ru({type:"object",shape:e,catchall:tu(),...Z.normalizeParams(t)})}var nu=b("ZodUnion",(e,t)=>{kn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>to(e,r,n,o),e.options=t.options});function He(e,t){return new nu({type:"union",options:e,...Z.normalizeParams(t)})}var sf=b("ZodDiscriminatedUnion",(e,t)=>{nu.init(e,t),Xs.init(e,t)});function Ke(e,t,r){return new sf({type:"union",options:t,discriminator:e,...Z.normalizeParams(r)})}var af=b("ZodIntersection",(e,t)=>{Qs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ro(e,r,n,o)});function cf(e,t){return new af({type:"intersection",left:e,right:t})}var uf=b("ZodTuple",(e,t)=>{Bt(),ea.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>no(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 bo({type:"optional",innerType:t}))})}});function ou(e,t,r){let n=t instanceof U,o=n?r:t,i=n?t:null;return new uf({type:"tuple",items:e,rest:i,...Z.normalizeParams(o)})}var qc=b("ZodRecord",(e,t)=>{Bt(),ta.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oo(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function _t(e,t,r){return!t||!t._zod?new qc({type:"record",keyType:N(),valueType:e,...Z.normalizeParams(t)}):new qc({type:"record",keyType:e,valueType:t,...Z.normalizeParams(r)})}var go=b("ZodEnum",(e,t)=>{ra.init(e,t),K.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 go({...t,checks:[],...Z.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 go({...t,checks:[],...Z.normalizeParams(o),entries:i})}});function nt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new go({type:"enum",entries:r,...Z.normalizeParams(t)})}var lf=b("ZodLiteral",(e,t)=>{na.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gn(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 L(e,t){return new lf({type:"literal",values:Array.isArray(e)?e:[e],...Z.normalizeParams(t)})}var df=b("ZodTransform",(e,t)=>{Bt(),oa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xn(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new bt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Z.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(Z.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 ff(e){return new df({type:"transform",transform:e})}var bo=b("ZodOptional",(e,t)=>{zn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new bo({type:"optional",innerType:e})}var iu=b("ZodExactOptional",(e,t)=>{ia.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new iu({type:"optional",innerType:e})}var mf=b("ZodNullable",(e,t)=>{sa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>io(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new mf({type:"nullable",innerType:e})}var hf=b("ZodDefault",(e,t)=>{aa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gf(e,t){return new hf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}var bf=b("ZodPrefault",(e,t)=>{ca.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new bf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Z.shallowClone(t)}})}var su=b("ZodNonOptional",(e,t)=>{ua.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new su({type:"nonoptional",innerType:e,...Z.normalizeParams(t)})}var vf=b("ZodCatch",(e,t)=>{la.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _f(e,t){return new vf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:Z.constantCatch(t)})}var wf=b("ZodPipe",(e,t)=>{da.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o),e.in=t.in,e.out=t.out});function Xc(e,t){return new wf({type:"pipe",in:e,out:t})}var kf=b("ZodReadonly",(e,t)=>{fa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>po(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new kf({type:"readonly",innerType:e})}var $f=b("ZodLazy",(e,t)=>{pa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Sf(e){return new $f({type:"lazy",getter:e})}var Ef=b("ZodCustom",(e,t)=>{ma.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yn(e,r,n,o)});function Pf(e,t={}){return rc(Ef,e,t)}function Of(e,t){return nc(e,t)}function au(e){let t=Sf(()=>He([N(e),Oe(),Me(),tf(),se(t),_t(N(),t)]));return t}var Jt=au().meta({id:"JsonValue"});var qe=/^[A-Za-z_][A-Za-z0-9_]*$/,cu=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],Ir=ne({value:He([N(),Oe()]),label:N()}).strict().meta({id:"Option"}),yo=ne({field:N().min(1),op:nt(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Jt.optional(),valueFrom:N().regex(qe).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ce={label:N(),help:N().optional(),required:Me().optional(),readonly:Me().optional(),default:Jt.optional()},uu=Te().positive().optional(),lu=ou([Te().positive(),Te().nonnegative()]).optional(),xo=N().min(1),du=se(yo).optional(),fu=ne({type:L("char"),...ce,size:uu,pattern:N().optional()}).strict(),pu=ne({type:L("text"),...ce,size:uu}).strict(),mu=ne({type:L("html"),...ce}).strict(),hu=ne({type:L("integer"),...ce,min:Oe().optional(),max:Oe().optional()}).strict(),gu=ne({type:L("float"),...ce,min:Oe().optional(),max:Oe().optional(),digits:lu}).strict(),bu=ne({type:L("monetary"),...ce,currencyField:N().regex(qe).optional(),currency:N().regex(/^[A-Z]{3}$/).optional(),min:Oe().optional(),max:Oe().optional(),digits:lu}).strict(),yu=ne({type:L("boolean"),...ce}).strict(),xu=ne({type:L("date"),...ce}).strict(),vu=ne({type:L("datetime"),...ce}).strict(),_u=ne({type:L("selection"),...ce,options:se(Ir).min(1),multiple:Me().optional()}).strict(),wu=ne({type:L("binary"),...ce,accept:se(N()).optional(),maxSize:Te().positive().optional()}).strict(),ku=ne({type:L("image"),...ce,maxSize:Te().positive().optional()}).strict(),zu=ne({type:L("many2one"),...ce,relation:xo,filter:du}).strict(),$u=ne({type:L("many2many"),...ce,relation:xo,filter:du}).strict(),Su=ne({type:L("reference"),...ce,models:se(Ir).min(1)}).strict(),Eu=ne({type:L("properties"),...ce}).strict(),Pu=ne({type:L("json"),...ce}).strict(),vo=Ke("type",[fu,pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Su,Eu,Pu]).meta({id:"LineField"}),Nf=ne({type:L("one2many"),...ce,relation:xo,fields:_t(N().regex(qe),vo)}).strict(),_o=Ke("type",[fu,pu,mu,hu,gu,bu,yu,xu,vu,_u,wu,ku,zu,$u,Nf,Su,Eu,Pu]).meta({id:"Field"}),Lr=_t(N().regex(qe),_o);var Wt=He([Me(),N().min(1)]).meta({id:"Modifier"}),ye=N().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),ot=N().regex(qe),Ou=nt(["info","success","warning","danger","muted"]),Ne=Wt.optional(),Zf=oe({type:L("field"),id:ye,field:ot,label:N().optional(),widget:N().min(1).optional(),placeholder:N().optional(),help:N().optional(),colspan:Te().min(1).max(4).optional(),columns:se(ot).min(1).optional(),invisible:Ne,readonly:Wt.optional(),required:Wt.optional()}),Nu=oe({type:L("button"),id:ye,label:N(),action:N().min(1),params:_t(N(),Jt).optional(),style:nt(["primary","secondary","danger","link"]).optional(),confirm:N().optional(),icon:N().optional(),invisible:Ne}),Af=oe({type:L("text"),id:ye,text:N(),style:nt(["heading","paragraph","note"]).optional(),invisible:Ne}),Zu=oe({type:L("slot"),id:ye,name:N().min(1),invisible:Ne}),Tf=oe({type:L("section"),id:ye,title:N().optional(),description:N().optional(),columns:He([L(1),L(2),L(3),L(4)]).optional(),collapsible:Me().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"SectionNode"}),Rf=oe({type:L("tab"),id:ye,label:N(),icon:N().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"TabNode"}),Au=oe({type:L("tabs"),id:ye,invisible:Ne,children:se(Rf).min(1)}).meta({id:"TabsNode"}),it=Ke("type",[Zf,Nu,Af,Zu,Tf,Au]).meta({id:"LayoutNode"}),If=oe({type:L("step"),id:ye,label:N(),description:N().optional(),invisible:Ne,get children(){return se(it)}}).meta({id:"StepNode"}),Lf=oe({type:L("wizard"),id:ye,children:se(If).min(1)}).meta({id:"WizardNode"}),Ff=oe({type:L("sections"),id:ye,get children(){return se(it)}}).meta({id:"SectionsNode"}),Cf=oe({id:ye,label:N(),action:N().min(1),field:ot.optional(),icon:N().optional(),invisible:Ne}),Mf=oe({id:ye,label:N(),tone:Ou.optional(),invisible:Ne}),Df=oe({id:ye,message:N(),tone:Ou.optional(),invisible:Ne}),jf=oe({type:L("sheet"),id:ye,title:oe({field:ot,subtitleField:ot.optional(),avatarField:ot.optional(),placeholder:N().optional()}).optional(),statusbar:oe({field:ot,visibleStates:se(He([N(),Oe()])).optional(),clickable:Me().optional()}).optional(),buttons:se(Nu).optional(),statButtons:se(Cf).optional(),ribbon:Mf.optional(),alerts:se(Df).optional(),get children(){return se(it)},sidePanel:Zu.optional()}).meta({id:"SheetNode"}),Fr=Ke("type",[jf,Ff,Au,Lf]).meta({id:"RootLayout"});var wo="0.1",Vf=Ke("kind",[oe({kind:L("record"),model:N().min(1)}),oe({kind:L("responses")})]),wt=oe({fieldia:L(wo),id:N().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:N().optional(),description:N().optional(),data:Vf,fields:Lr,layout:Fr}).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 st(e,t){switch(e.type){case"BinaryOp":return Uf(e,t);case"UnaryOp":return Bf(e,t);case"Literal":return e.value;case"Identifier":return Jf(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Uf(e,t){let r=Tu(st(e.left,t)),n=Tu(st(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 Bf(e,t){let r=st(e.operand,t);if(e.operator.toLowerCase()==="not")return!De(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function Tu(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 Jf(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var ko=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:Wf(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function Wf(e){let t=e.toLowerCase().trim();return ko.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 at=class{constructor(t){Qe(this,"tokens");Qe(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:ko.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:Hf(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 Hf(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(Ru(n.trim())),n=""):n+=a}return n.trim()&&r.push(Ru(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Ru(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 Ge(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new at(Ht(e)).parse();return{source:e,fields:Kf(t),evaluate(r){try{return De(st(t,r))}catch{return!1}}}}function Kf(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 Cr(e){let t=wt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:qf(o.path),message:Gf(o)}))};let r=t.data,n=new $o(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function qf(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Gf(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var zo=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),$o=class{constructor(t){Qe(this,"page",t);Qe(this,"issues",[]);Qe(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(zo(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=Ge(i).fields}catch(a){this.report(`${r}.${o}`,`cannot read "${i}": ${a.message}`);continue}for(let a of s)zo(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 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)=>{zo(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 Iu(){return ho(wt,{target:"draft-2020-12"})}function Lu(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 at(r).parse(),i=st(o,t);return De(i)}catch{return!1}}function Fu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Ht(e);return t.length===0||new at(t).parse(),!0}catch{return!1}}function So(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function kt(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?q(n.default):So(n);return t}function Mr(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?Yf(i,o):o}return r}function Yf(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 q(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var Ye={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 Dr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function qt(e,t,r,n=Ye.en){let o=e.label||"This field",i=(s,a={})=>Dr(n[s],{label:o,...a});if(Mr(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&&Xf(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 Qf(t,i);case"datetime":return tp(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 Eo(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Eo)?void 0:i("records");case"reference":{let s=t;if(!Eo(t)||typeof s.model!="string")return i("record");if(!e.models.some(a=>a.value===s.model)){let a=Mu(e.models.map(c=>c.label),n.or);return i("reference",{models:a,aModels:Du(a)})}return}case"binary":case"image":return rp(e,t,i,n);default:return}}function Xf(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 Eo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function Qf(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 Cu(r,n,o)?void 0:t("dateInvalid")}var ep=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function tp(e,t){let r=typeof e=="string"?ep.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,a,c]=r.slice(1).map(u=>Number(u??0));return Cu(n,o,i)&&s<24&&a<60&&c<60?void 0:t("datetimeInvalid")}function Cu(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 rp(e,t,r,n){let o=t;if(!np(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=>op(i,o.type))){let i=Mu(e.accept.map(ip),n.or);return r("fileType",{types:i,aTypes:Du(i)})}}function np(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function op(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function ip(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function Mu(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function Du(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 jr(e,t=Yt){return new Promise(r=>{t.setTimeout(r,e)})}function ju(e={}){let t=q(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?jr(e.delayMs,e.scheduler):Promise.resolve(),s=d=>t[d]??(t[d]={}),a=(d,h)=>{let x=s(d)[String(h)]?.[e.labelField?.[d]??"name"];return typeof x=="string"?x:String(h)},c=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,h){let x=[...d];for(let f of h)f.op==="create"?x.push({key:f.key,id:++o,values:q(f.values)}):f.op==="update"?x=x.map(v=>v.id===f.id?{...v,values:{...v.values,...q(f.values)}}:v):x=x.filter(v=>v.id!==f.id);return x}function p(d,h,x){let f=[...d],v=P=>({id:P,label:a(x,P)});for(let P of h)P.op==="link"&&!f.some(D=>D.id===P.id)?f.push(v(P.id)):P.op==="unlink"?f=f.filter(D=>D.id!==P.id):P.op==="set"?f=P.ids.map(v):P.op==="clear"&&(f=[]);return f}function m(d,h){let x=d[h];return x&&"relation"in x?x.relation:h}return{records:t,responses:r,calls:n,async load(d){n.push({method:"load",request:d}),await i();let h=s(d.model)[String(d.id)];if(!h)throw new Error(`No ${d.model} record with id ${d.id}`);return q(h)},async save(d){n.push({method:"save",request:d}),await i();let h=d.id??c(d.model),x={...s(d.model)[String(h)]??{},...q(d.changes.values)};for(let[f,v]of Object.entries(d.changes.lines))x[f]=l(x[f]??[],v);for(let[f,v]of Object.entries(d.changes.links))x[f]=p(x[f]??[],v,m(d.fields,f));return s(d.model)[String(h)]=x,{id:h,values:q(x)}},async onchange(d){n.push({method:"onchange",request:d}),await i();let h=e.onchange?.[d.model]?.[d.changed];return h?{values:h(q(d.values))}:{}},async search(d){n.push({method:"search",request:d}),await i();let h=d.query.trim().toLowerCase();return Object.entries(s(d.model)).filter(([,x])=>(d.filter??[]).every(f=>sp(x,f))).map(([x])=>({id:u(x),label:a(d.model,u(x))})).filter(x=>x.label.toLowerCase().includes(h)).slice(0,d.limit??8)},async submit(d){return n.push({method:"submit",request:d}),await i(),r.push(q(d)),{id:r.length}}}}function sp(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 Vr(e){let{page:t}=e,r=e.scheduler??Yt,n=e.messages??Ye.en,o=up(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(y=>y.id):[],s=()=>`fieldia:draft:${t.id}:${c.recordId??"new"}`,a={...kt(t.fields),...q(e.values??{})},c={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:q(a),errors:{},dirty:[],warning:null,error:null,draft:null,step:i[0]??null},u=0,l=0,p=null,m=null,d=new Set,h=new Set,x=null;function f(y){c={...c,...y};for(let _ of[...h])_(c)}function v(y){d.add(y);let _=()=>d.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 D(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(),T=_.invisible.evaluate(k);for(let G=_.parent;!T&&G;G=o.get(G)?.parent??null)T=o.get(G)?.invisible.evaluate(k)??!1;let M=_.field?t.fields[_.field]:void 0;return{invisible:T,readonly:_.readonly.evaluate(k)||M?.readonly===!0,required:_.required.evaluate(k)||M?.required===!0}}function z(y){let _=k=>{if(!y)return!0;for(let T=k.id;T;T=o.get(T)?.parent??null)if(T===y)return!0;return!1};return[...o.values()].filter(k=>k.kind==="field"&&_(k)&&!w(k.id).invisible)}function B(y){let _={};for(let k of z(y)){let T=k.field;if(_[T])continue;let M=t.fields[T],G=qt(M,c.values[T],w(k.id).required,n);if(G&&(_[T]=G),M.type==="one2many")for(let de of c.values[T]??[])for(let[Ae,ze]of Object.entries(M.fields)){let lt=qt(ze,de.values[Ae],ze.required===!0,n);lt&&(_[`${T}.${de.key}.${Ae}`]=lt)}}return _}function te(y,_={}){let k=Object.keys(c.errors).length?re(y):c.errors;f({values:y,dirty:S(y),errors:k,..._})}function re(y){let _=c;c={...c,values:y};let k=B(c.step??void 0);c=_;let T={};for(let M of Object.keys(c.errors))k[M]&&(T[M]=k[M]);return T}function ie(){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 V(){p!==null&&r.clearTimeout(p),p=null,e.drafts?.store.removeItem(s())}function Q(){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}):f({draft:{savedAt:k.savedAt}})}function he(){let y=e.autosave;!y||t.data.kind!=="record"||(m!==null&&r.clearTimeout(m),m=r.setTimeout(()=>{m=null,c.dirty.length&&Object.keys(B()).length===0&&v(ke())},y.delayMs))}function ct(y){let _=e.dataSource;if(!_?.onchange||t.data.kind!=="record")return;let k=++l,T={model:t.data.model,id:c.recordId,changed:y,values:q(c.values)};v(_.onchange(T).then(M=>{if(k!==l)return;let G={...c.values,...M.values??{}};te(G,{warning:M.warning??null})},()=>{}))}function Ze(y){ie(),he(),ct(y)}function Ve(){let y={values:{},lines:{},links:{}};for(let _ of c.dirty){let k=t.fields[_],T=c.values[_],M=a[_];k.type==="one2many"?y.lines[_]=ap(M??[],T??[]):k.type==="many2many"?y.links[_]=cp(M??[],T??[]):y.values[_]=q(T)}return y}function Re(){let y={};for(let _ of z()){let k=_.field;y[k]=q(c.values[k])}return y}async function ke(){let y=B();if(Object.keys(y).length)return f({errors:y}),!1;let _=e.dataSource;f({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:Re()}),V(),f({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:q(c.values)});V();let T=k.values?{...c.values,...k.values}:c.values;return a=q(T),f({status:"saved",recordId:k.id,values:T,dirty:[]}),!0}catch(k){return f({status:"error",error:k.message}),!1}}async function zt(y,_,k,T,M,G){if(y.type!=="many2one"&&y.type!=="many2many"&&y.type!=="reference")throw new Error(`"${_}" is not a many2one, many2many or reference`);if(y.type==="reference"&&!G)throw new Error(`Searching "${_}" needs a model`);let de=e.dataSource;if(!de?.search)return[];let Ae=y.type==="reference"?void 0:y.filter?.map(({field:lt,op:g,value:$,valueFrom:I})=>({field:lt,op:g,value:I!==void 0?k[I]??null:$??null})),ze=y.type==="reference"?G:y.relation;return v(de.search({model:ze,query:T,...Ae?{filter:Ae}:{},limit:M}))}function Ie(y){let _=D(y);if(_.type!=="one2many")throw new Error(`"${y}" is a ${_.type}, not a one2many`);return _}function $t(){return c.step?i.indexOf(c.step):-1}async function Wr(){let y=e.dataSource;if(!(c.recordId==null||t.data.kind!=="record")){if(!y?.load){f({status:"error",error:"This page has no data source to load from"});return}f({status:"loading",error:null});try{let _=await y.load({model:t.data.model,id:c.recordId,fields:t.fields});a={...kt(t.fields),..._},f({status:"ready",values:q(a),dirty:[],errors:{}}),Q()}catch(_){f({status:"error",error:_.message})}}}let ut={page:t,getState:()=>c,subscribe(y){return h.add(y),()=>h.delete(y)},load:()=>v(Wr()),setValue(y,_){D(y),te({...c.values,[y]:q(_)}),Ze(y)},node:w,fieldReadonly:y=>D(y).readonly===!0,validate(){let y=B();return f({errors:y}),Object.keys(y).length===0},save:()=>v(ke()),reset(){V(),f({values:q(a),dirty:[],errors:{},warning:null,draft:null,step:i[0]??null})},changes:Ve,addLine(y,_={}){let k=Ie(y),T=`new-${++u}`,M={key:T,values:{...kt(k.fields),...q(_)}},G=[...c.values[y]??[],M];return te({...c.values,[y]:G}),Ze(y),T},updateLine(y,_,k,T){if(!Ie(y).fields[k])throw new Error(`The lines of "${y}" have no field "${k}"`);let G=(c.values[y]??[]).map(de=>de.key===_?{...de,values:{...de.values,[k]:q(T)}}:de);te({...c.values,[y]:G}),Ze(y)},removeLine(y,_){Ie(y);let k=(c.values[y]??[]).filter(T=>T.key!==_);te({...c.values,[y]:k}),Ze(y)},async search(y,_,k=8,T={}){return zt(D(y),y,P(),_,k,T.model)},async searchLine(y,_,k,T,M=8){let G=Ie(y),de=G.fields[k];if(!de)throw new Error(`The lines of "${y}" have no field "${k}"`);let Ae=(c.values[y]??[]).find(ze=>ze.key===_);if(!Ae)throw new Error(`"${y}" has no line "${_}"`);return zt(de,k,Kt(Ae.values,G.fields),T,M)},steps:()=>i.filter(y=>!w(y).invisible),next(){if(!c.step)return!1;let y=B(c.step);if(Object.keys(y).length)return f({errors:y}),!1;let _=ut.steps(),k=i.slice($t()+1).find(T=>_.includes(T));return k?(f({step:k,errors:{}}),!0):!1},back(){if(!c.step)return!1;let y=ut.steps(),_=i.slice(0,$t()).reverse().find(k=>y.includes(k));return _?(f({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:q(c.values)})))},restoreDraft(){let y=e.drafts?.store.getItem(s());if(!y)return;let _=JSON.parse(y);te({...c.values,..._.values},{draft:null})},discardDraft(){V(),f({draft:null})},async settled(){for(;d.size;)await Promise.allSettled([...d])},dispose(){p!==null&&r.clearTimeout(p),m!==null&&r.clearTimeout(m),h.clear()}};return c.recordId==null&&Q(),ut}function ap(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:q(i.values)});continue}let a={};for(let[c,u]of Object.entries(i.values))JSON.stringify(u)!==JSON.stringify(s.values[c])&&(a[c]=q(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 cp(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 up(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:Ge(a.invisible),readonly:Ge(a.readonly),required:Ge(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 lp=180;function Vu(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function Po(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,d,h=!1;function x(){if(s.replaceChildren(),l.forEach((S,w)=>{let z=t.createElement("li");z.id=`${o}-${w}`,z.setAttribute("role","option"),z.setAttribute("aria-selected",String(w===p)),z.className=w===p?"fd-option fd-active":"fd-option",z.textContent=S.label,z.addEventListener("mousedown",B=>B.preventDefault()),z.addEventListener("click",()=>P(w)),s.append(z)}),!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 f(){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 D(S){clearTimeout(d);let w=++m;d=setTimeout(async()=>{let z=await e.search(S).catch(()=>[]);if(w!==m||t.activeElement!==i)return;let B=e.exclude?.()??new Set;l=z.filter(te=>!B.has(te.id)),p=-1,x(),f()},lp)}return i.addEventListener("input",()=>{u=!0,h||D(i.value)}),i.addEventListener("focus",()=>{h||D("")}),i.addEventListener("keydown",S=>{if(!h)switch(S.key){case"ArrowDown":case"ArrowUp":{if(S.preventDefault(),s.hidden)return D(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(d),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 Oo=({form:e,name:t,field:r,id:n,document:o,labels:i=we.en})=>{let s=Po({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",Vu(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)}}},Ur=({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=Po({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??[],d=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),d!==l&&(l=d,a.replaceChildren(...m.map(h=>{let x=n.createElement("li");x.className="fd-chip";let f=n.createElement("span");if(f.className="fd-chip-label",f.textContent=h.label,x.append(f),!u){let v=n.createElement("button");v.type="button",v.className="fd-chip-remove",v.textContent="\xD7",v.setAttribute("aria-label",Vu(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(""))}}},No=({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 d=n.createElement("span");return d.textContent=u.label,m.append(p,d),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()}}},Zo=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 d=i.createElement("option");d.value=String(m.value),d.textContent=m.label,u.append(d)}let l="";u.addEventListener("change",()=>{l=u.value,t.setValue(r,null)});let p=Po({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 d=m.value;d&&(l=d.model),u.value=l,u.disabled=m.readonly,p.setText(d?.label??""),p.setReadonly(m.readonly||!l)}}};function dp(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"),d=i.createElement("tr");for(let w of c){let z=i.createElement("th");z.scope="col",z.textContent=a.fields[w].label,d.append(z)}let h=i.createElement("th");h.className="fd-lines-tools",d.append(h),m.append(d);let x=i.createElement("tbody");p.append(m,x),l.append(p);let f=i.createElement("button");f.type="button",f.className="fd-button fd-button-link fd-lines-add",f.textContent=`+ ${s.addLine}`,u.append(l,f);let v=new Map,P=null,D=!1;f.addEventListener("click",()=>{P=e.addLine(t);let w=v.get(P);w&&(w.cells[0]?.widget.focus(),P=null)});function S(w){let z=i.createElement("tr");z.dataset.line=w.key;let B=dp(e,t,w.key),te=c.map(V=>{let Q=a.fields[V],he=`${o}-${w.key}-${V}`,ct={type:"field",id:`${n.id}.${w.key}.${V}`,field:V},Ze=Xt({form:B,name:V,field:Q,node:ct,id:he,document:i,labels:s}),Ve=i.createElement("td"),Re=i.createElement("label");Re.className="fd-sr-only",Re.htmlFor=he,Re.textContent=Q.label;let ke=i.createElement("div");return ke.className="fd-cell-error",ke.hidden=!0,Ve.append(Re,Ze.element,ke),z.append(Ve),{name:V,def:Q,widget:Ze,error:ke}}),re=i.createElement("td");re.className="fd-lines-tools";let ie=i.createElement("button");return ie.type="button",ie.className="fd-line-delete",ie.textContent="\xD7",ie.setAttribute("aria-label",s.deleteLine),ie.addEventListener("click",()=>e.removeLine(t,w.key)),re.append(ie),z.append(re),{element:z,cells:te,remove:ie}}return{element:u,focus:()=>(x.querySelector("input, select, textarea")??f).focus(),update(w){D=w.readonly,f.hidden=D;let z=w.value??[],B=e.getState().errors,te=new Set(z.map(re=>re.key));for(let[re,ie]of v)te.has(re)||(ie.element.remove(),v.delete(re));z.forEach((re,ie)=>{let V=v.get(re.key);V||(V=S(re),v.set(re.key,V)),x.children[ie]!==V.element&&x.insertBefore(V.element,x.children[ie]??null),V.remove.hidden=D,D?V.remove.remove():V.remove.isConnected||V.element.lastElementChild?.append(V.remove);for(let Q of V.cells){let he=B[`${t}.${re.key}.${Q.name}`];Q.error.hidden=!he,Q.error.textContent=he??"",Q.widget.update({value:re.values[Q.name],values:re.values,readonly:D||Q.def.readonly===!0,required:Q.def.required===!0,invalid:!!he})}}),P&&v.has(P)&&(v.get(P)?.cells[0]?.widget.focus(),P=null)}}};function fp(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 Uu(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 d=i.createElement("span");d.className="fd-help",d.textContent=s.dropHere,p.append(m,d);let h=i.createElement("div");h.className="fd-file-chosen";let x=i.createElement("span");x.className="fd-file-name";let f=i.createElement("button");f.type="button",f.className="fd-button fd-button-link",f.textContent=s.replace,f.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,f,v),a.append(c,...e==="image"?[l]:[],p,h);let P=!1,D=async S=>{!S||P||t.setValue(r,await fp(S))};return c.addEventListener("change",()=>{D(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"),D(S.dataTransfer?.files?.[0])}),{element:a,focus:()=>(p.hidden?f:c).focus(),update(S){P=S.readonly;let w=S.value;if(p.hidden=!!w||P,h.hidden=!w,f.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 z=w?w.data?`data:${w.type};base64,${w.data}`:w.url??"":"";l.hidden=!z,l.getAttribute("src")!==z&&(z?l.src=z:l.removeAttribute("src"))}}}}}var To=Uu("binary"),Ro=Uu("image");var pp=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),mp=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]);function Io(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(mp.has(a.tagName)){a.remove();continue}if(n(a),!pp.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 Lo=({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=Io(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=Io(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)}}},Br=({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]??qu[i];if(s)return s(e)}return _p(e)}function ue(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=ue(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 hp=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=ue(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)}}},gp=/^-?(\d+\.?\d*|\.\d+)$/,bp=/^-?\.?$/,Fo=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,a=n.type==="integer",c=ue(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 d=m.trim();if(d==="")return null;if(gp.test(d))return Number(d);if(!bp.test(d))return d};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"?ue(s,"span",{class:"fd-currency","aria-hidden":"true"}):null;return{element:l?ue(s,"span",{class:"fd-number"},l,c):c,focus:()=>c.focus(),update(m){let d=s.activeElement===c,h=u(c.value),x=h===void 0||h===m.value;if(!(d&&x)){let f=er(m.value);c.value!==f&&(c.value=f)}if(c.readOnly=m.readonly,je(c,m),l&&n.type==="monetary"){let f=n.currencyField?m.values[n.currencyField]:null;l.textContent=f&&typeof f=="object"&&"label"in f?f.label:typeof f=="string"?f:n.currency??""}}}};function Bu(e){return({form:t,name:r,id:n,document:o})=>{let i=ue(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 Hu(e){return e.type==="selection"?e.options:[]}var yp=({form:e,name:t,field:r,id:n,document:o})=>{let i=Hu(r),s=ue(o,"select",{id:n,class:"fd-input fd-select"},ue(o,"option",{value:""}));return i.forEach((a,c)=>s.append(ue(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 Ju(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Hu(n),a=ue(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),c=s.map((u,l)=>{let p=ue(i,"input",{type:e,name:o,value:String(l),id:`${o}-${l}`});return a.append(ue(i,"label",{class:"fd-choice",for:`${o}-${l}`},p,ue(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 Wu(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=ue(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),u=[];for(let l=s;l<=a;l++){let p=ue(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,d=l.key==="ArrowRight"||l.key==="ArrowUp"?1:l.key==="ArrowLeft"||l.key==="ArrowDown"?-1:0;if(!d)return;l.preventDefault();let h=Math.min(a,Math.max(s,m+d));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,d)=>{let h=s+d;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&&d===0?0:-1,m.disabled=l.readonly}),je(c,l)}}}}var xp=({form:e,name:t,id:r,document:n})=>{let o=ue(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)}}},Jr=e=>String(e).padStart(2,"0"),vp=({form:e,name:t,id:r,document:n})=>{let o=ue(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()}-${Jr(a.getMonth()+1)}-${Jr(a.getDate())}T${Jr(a.getHours())}:${Jr(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 _p({field:e,id:t,document:r}){let n=ue(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=Ku(o.value,e)}}}function Ku(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 qu={char:Qt("text"),"char.email":Qt("email"),"char.phone":Qt("tel"),"char.url":Qt("url"),"char.password":Qt("password"),text:hp,integer:Fo,float:Fo,monetary:Fo,"integer.rating":Wu("rating"),"integer.scale":Wu("scale"),boolean:Bu(),"boolean.toggle":Bu("switch"),selection:yp,"selection.radio":Ju("radio"),"selection.checkboxes":Ju("checkbox"),date:xp,datetime:vp,many2one:Oo,many2many:Ur,"many2many.tags":Ur,"many2many.checkboxes":No,reference:Zo,one2many:Ao,binary:To,image:Ro,html:Lo,json:Br,properties:Br};var Yu=`
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;
@@ -135,6 +135,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
135
135
  .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::before { content: "* "; color: var(--fd-error); }
136
136
  .fd-help { color: var(--fd-muted); font-size: 12.5px; }
137
137
  .fd-error { color: var(--fd-error); font-size: 12.5px; }
138
+ .fd-warning {
139
+ color: var(--fd-warning); background: var(--fd-warning-soft); font-size: 12.5px;
140
+ padding: 3px 8px; border-radius: var(--fd-control-radius); justify-self: start;
141
+ }
138
142
 
139
143
  /* underline: label beside the value, the way a Flectra sheet reads */
140
144
  .fd-form[data-fd-skin="underline"] .fd-field {
@@ -246,16 +250,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
246
250
  .fd-reference { display: grid; grid-template-columns: minmax(7em, 34%) minmax(0, 1fr); gap: 8px; }
247
251
 
248
252
  /* ---- one2many lines ------------------------------------------------------- */
249
- .fd-lines { display: grid; gap: 6px; min-width: 0; }
250
- .fd-lines-scroll { overflow-x: auto; }
253
+ .fd-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
254
+ /* The table scrolls sideways inside its own box; the grid around it must not grow to the table's width. */
255
+ /* position: relative keeps the cells' hidden labels inside the scroll box; without it they widen the page. */
256
+ .fd-lines-scroll { overflow-x: auto; min-width: 0; position: relative; }
251
257
  .fd-lines-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
252
258
  .fd-lines-table th { text-align: start; font-weight: 600; color: var(--fd-muted); font-size: 12.5px; padding: 6px 8px; border-block-end: 1px solid var(--fd-border); white-space: nowrap; }
253
259
  .fd-lines-table td { padding: 4px 8px; border-block-end: 1px solid var(--fd-border); vertical-align: top; min-width: 7em; }
254
260
  .fd-lines-table td.fd-lines-tools, .fd-lines-table th.fd-lines-tools { width: 32px; min-width: 32px; padding-inline: 0; text-align: center; }
255
261
  .fd-lines-table .fd-input { min-height: 28px; }
262
+ /* A yes/no cell sits level with the inputs beside it. */
263
+ .fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }
256
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; }
257
265
  .fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }
258
- .fd-lines-add { justify-self: start; }
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; }
259
272
  .fd-cell-error { color: var(--fd-error); font-size: 12px; }
260
273
  .fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
261
274
 
@@ -288,6 +301,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
288
301
  border-block-end: 1px solid var(--fd-border); padding-block-end: 6px; width: 100%;
289
302
  }
290
303
  .fd-section-description { color: var(--fd-muted); margin: 0; }
304
+ .fd-section-toggle {
305
+ font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
306
+ display: inline-flex; align-items: center; gap: 8px; text-align: start;
307
+ }
308
+ .fd-section-toggle:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 2px; }
309
+ .fd-section-chevron {
310
+ width: 0.5em; height: 0.5em; border: solid currentColor; border-width: 0 2px 2px 0;
311
+ transform: rotate(45deg); margin-block-start: -0.2em; transition: transform 0.15s ease; flex: none;
312
+ }
313
+ .fd-section-folded .fd-section-chevron { transform: rotate(-45deg); margin-block-start: 0; }
314
+ [dir="rtl"] .fd-section-folded .fd-section-chevron { transform: rotate(135deg); }
291
315
  .fd-form[data-fd-skin="outlined"] .fd-sections > .fd-section {
292
316
  background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;
293
317
  }
@@ -338,9 +362,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
338
362
  .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
339
363
  @container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }
340
364
  .fd-card {
341
- position: relative; overflow: hidden; background: var(--fd-surface); border: 1px solid var(--fd-border);
365
+ position: relative; background: var(--fd-surface); border: 1px solid var(--fd-border);
342
366
  border-radius: var(--fd-radius); padding: 24px 28px 28px; display: grid; gap: 18px; min-width: 0;
343
367
  }
368
+ .fd-ribbon-frame { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
344
369
  .fd-ribbon {
345
370
  position: absolute; inset-block-start: 18px; inset-inline-end: -42px; transform: rotate(45deg); width: 160px;
346
371
  text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: #fff; background: var(--fd-muted);
@@ -359,7 +384,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
359
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); }
360
385
  .fd-stats:empty { display: none; }
361
386
  /* A visible ribbon owns the corner: stat buttons keep clear of it. */
362
- .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; }
363
388
  .fd-stat {
364
389
  font: inherit; background: none; border: none; border-inline-start: 1px solid var(--fd-border); cursor: pointer;
365
390
  padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;
@@ -420,7 +445,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
420
445
  }
421
446
  .fd-dialog p { margin: 0; }
422
447
  @media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
423
- `,Gu="fieldia-styles";function Co(e){if(e.getElementById(Gu))return;let t=e.createElement("style");t.id=Gu,t.textContent=Yu,(e.head??e.documentElement).append(t)}var Mo={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"}},wp=Mo.en,kp=0;function zp(e,t){let r=e.ownerDocument,n=Cr(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
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:
424
449
  ${n.issues.map(g=>` ${g.path}: ${g.message}`).join(`
425
- `)}`);let o=n.page,i=t.locale??"en",s=!t.form,a=t.form??Vr({...t,page:o,messages:t.messages??Ye[i]}),c={...Mo[i],...t.labels},u=we[i],l=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++kp}`,m=[],d=[],h=g=>`${p}-${g.replace(/[^A-Za-z0-9_-]/g,"_")}`,x=(g,$)=>g.replace(/\{(\w+)\}/g,(I,j)=>String($[j]??""));Co(r);function f(g,$={},...I){let j=r.createElement(g);for(let[J,C]of Object.entries($))C!==void 0&&j.setAttribute(J,C);return j.append(...I),j}let v=f("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:l,lang:t.locale}),P=t.confirm??Ae;function D(g){let $=o.fields[g.field],I=h(g.id),j=f("div",{class:"fd-field","data-node":g.id,"data-field":g.field,"data-type":$.type});g.colspan&&j.style.setProperty("--fd-span",String(g.colspan));let J=f("label",{class:"fd-label",id:`${I}-label`,for:I},g.label??$.label),C=Xt({form:a,name:g.field,field:$,node:g,id:I,document:r,labels:u},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(C.element.tagName)||(C.element.getAttribute("role")&&C.element.setAttribute("aria-labelledby",J.id),J.addEventListener("click",()=>C.focus()));let R=g.help??$.help,Y=R?f("div",{class:"fd-help",id:`${I}-help`},R):null,E=f("div",{class:"fd-error",id:`${I}-error`,role:"alert",hidden:""});return j.append(J,C.element,...Y?[Y]:[],E),C.destroy&&d.push(()=>C.destroy?.()),m.push(A=>{let W=a.node(g.id);j.hidden=W.invisible,j.classList.toggle("fd-required",W.required);let fe=A.errors[g.field];E.hidden=!fe,E.textContent=fe??"",C.update({value:A.values[g.field],values:A.values,readonly:W.readonly,required:W.required,invalid:!!fe,describedBy:[Y?.id,fe?E.id:void 0].filter(Boolean).join(" ")||void 0})}),j}function S(g,$){m.push(()=>{g.hidden=a.node($).invisible})}function w(g){let $=f("button",{type:"button",class:`fd-button fd-button-${g.style??"secondary"}`,"data-node":g.id},g.label);return $.addEventListener("click",async()=>{g.confirm&&!await P(g.confirm)||await a.runAction(g.id)}),S($,g.id),$}function z(g){let $=g.style??"paragraph",I=f($==="heading"?"h3":"p",{class:`fd-text-${$}`,"data-node":g.id},g.text);return S(I,g.id),I}function B(g){let $=f("div",{class:"fd-slot","data-slot":g.name,"data-node":g.id}),I=t.slots?.[g.name]?.($,{form:a,name:g.name});return I&&d.push(I),S($,g.id),$}function te(g,$=1){let I=f("div",{class:"fd-grid"});return I.style.setProperty("--fd-columns",String($)),I.append(...g.map(V)),I}function re(g){let $=f("fieldset",{class:"fd-section","data-node":g.id});return g.title&&$.append(f("legend",{class:"fd-section-title"},g.title)),g.description&&$.append(f("p",{class:"fd-section-description"},g.description)),$.append(te(g.children,g.columns??1)),S($,g.id),$}function ie(g){let $=f("div",{class:"fd-tabs","data-node":g.id}),I=f("div",{class:"fd-tablist",role:"tablist"}),j=null,J=g.children[0].id,C=g.children.map(R=>{let Y=h(`${R.id}-tab`),E=h(`${R.id}-panel`),A=f("button",{type:"button",class:"fd-tab",role:"tab",id:Y,"aria-controls":E,"data-node":R.id},R.label),W=f("div",{class:"fd-tabpanel",role:"tabpanel",id:E,"aria-labelledby":Y},te(R.children));return A.addEventListener("click",()=>{j=J=R.id,ze(a.getState())}),I.append(A),{tab:R,button:A,panel:W}});return I.addEventListener("keydown",R=>{let Y=C.filter(Xe=>!Xe.button.hidden),E=Y.findIndex(Xe=>Xe.tab.id===J),A={ArrowRight:1,ArrowLeft:-1,Home:-E,End:Y.length-1-E}[R.key];if(A===void 0||E===-1)return;R.preventDefault();let W=v.getAttribute("dir")==="rtl"&&(R.key==="ArrowRight"||R.key==="ArrowLeft"),fe=Y[(E+(W?-A:A)+Y.length)%Y.length];j=J=fe.tab.id,ze(a.getState()),fe.button.focus()}),$.append(I,...C.map(R=>R.panel)),m.push(()=>{$.hidden=a.node(g.id).invisible;let R=C.filter(E=>!a.node(E.tab.id).invisible);j!==null&&R.some(E=>E.tab.id===j)?J=j:R.length&&(J=R[0].tab.id);for(let E of C){let A=E.tab.id===J;E.button.hidden=!R.includes(E),E.button.setAttribute("aria-selected",String(A)),E.button.tabIndex=A?0:-1,E.panel.hidden=!A}}),$}function V(g){switch(g.type){case"field":return D(g);case"button":return w(g);case"text":return z(g);case"slot":return B(g);case"section":return re(g);case"tabs":return ie(g)}}let Q=f("div",{class:"fd-status",role:"status","aria-live":"polite"});m.push(g=>{let $=g.status==="saving"?c.saving:g.status==="saved"?c.saved:g.status==="loading"?c.loading:g.status==="error"?g.error??"":"";Q.textContent=$,Q.classList.toggle("fd-status-error",g.status==="error"),Q.classList.toggle("fd-status-saved",g.status==="saved")});let he=f("div",{class:"fd-draft",hidden:""}),ct=f("span"),Ze=f("button",{type:"button",class:"fd-button fd-button-primary"},c.restore),Ve=f("button",{type:"button",class:"fd-button fd-button-link"},c.discardDraft);Ze.addEventListener("click",()=>a.restoreDraft()),Ve.addEventListener("click",()=>a.discardDraft()),he.append(ct,Ze,Ve),m.push(g=>{he.hidden=!g.draft,g.draft&&(ct.textContent=x(c.draftFound,{time:new Date(g.draft.savedAt).toLocaleString()}))});function Re(){let g=v.querySelector('[aria-invalid="true"]');if(!g)return;(g.matches("input, select, textarea, button")?g:g.querySelector("input, select, textarea, button"))?.focus()}let ke=f("div",{class:"fd-done",hidden:""},f("p",{class:"fd-done-title"},c.submitted)),zt=f("button",{type:"button",class:"fd-button"},c.submitAnother);ke.append(zt);let Ie=f("div",{class:"fd-content"});async function $t(){if(!await a.save()){Re();return}o.data.kind==="responses"&&(Ie.hidden=!0,ke.hidden=!1)}zt.addEventListener("click",()=>{a.reset(),Ie.hidden=!1,ke.hidden=!0});function Wr(){if(!o.title&&!o.description)return null;let g=f("header",{class:"fd-page-head"});return o.title&&g.append(f("h1",{class:"fd-page-title"},o.title)),o.description&&g.append(f("p",{class:"fd-page-description"},o.description)),g}function ut(g){let $=f("div",{class:"fd-sections","data-node":g.id},...g.children.map(V)),I=f("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?c.submit:c.save),j=f("div",{class:"fd-actions fd-actions-end"},Q,I);return f("div",{},$,j)}function y(g){let $=f("div",{class:"fd-wizard","data-node":g.id}),I=f("div",{class:"fd-progress-text"}),j=f("span");$.append(f("div",{class:"fd-progress"},I,f("div",{class:"fd-progress-bar"},j)));let J=g.children.map(A=>{let W=f("section",{class:"fd-step","data-node":A.id,"aria-labelledby":h(`${A.id}-title`)});return W.append(f("h2",{class:"fd-step-title",id:h(`${A.id}-title`)},A.label)),A.description&&W.append(f("p",{class:"fd-section-description"},A.description)),W.append(te(A.children)),$.append(W),{step:A,panel:W}}),C=f("button",{type:"button",class:"fd-button"},c.back),R=f("button",{type:"submit",class:"fd-button fd-button-primary"});$.append(f("div",{class:"fd-wizard-nav"},C,f("span",{class:"fd-spacer"}),Q,R)),C.addEventListener("click",()=>{a.back()&&E()});let Y=()=>{let A=a.steps();return A.indexOf(a.getState().step??"")===A.length-1};T=async()=>{if(Y())return $t();a.next()?E():Re()};function E(){J.find(W=>W.step.id===a.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return m.push(A=>{let W=a.steps(),fe=Math.max(0,W.indexOf(A.step??""));I.textContent=x(c.stepOf,{n:fe+1,total:W.length}),j.style.width=`${(fe+1)/Math.max(1,W.length)*100}%`;for(let{step:Xe,panel:St}of J)St.hidden=Xe.id!==A.step;C.hidden=fe===0,R.textContent=fe===W.length-1?c.submit:c.next}),$}function _(g){let $=f("div",{class:"fd-sheet-page","data-node":g.id}),I=f("div",{class:"fd-actions"}),j=f("button",{type:"submit",class:"fd-button fd-button-primary"},c.save),J=f("button",{type:"button",class:"fd-button"},c.discard);J.addEventListener("click",()=>a.reset()),I.append(j,J,...(g.buttons??[]).map(w),Q),m.push(E=>{let A=E.dirty.length>0&&E.status!=="saving";j.hidden=!A,J.hidden=!A});let C=f("div",{class:"fd-header"},I);g.statusbar&&C.append(k(g.statusbar));let R=f("div",{class:"fd-card"});if(g.ribbon){let E=f("div",{class:`fd-ribbon fd-tone-${g.ribbon.tone??"muted"}`,"data-node":g.ribbon.id},g.ribbon.label);S(E,g.ribbon.id),R.append(E)}if(g.statButtons?.length){let E=f("div",{class:"fd-stats"});for(let A of g.statButtons){let W=f("span",{class:"fd-stat-value"}),fe=f("button",{type:"button",class:"fd-stat","data-node":A.id},W,f("span",{class:"fd-stat-label"},A.label));fe.addEventListener("click",()=>{a.runAction(A.id)}),m.push(Xe=>{fe.hidden=a.node(A.id).invisible;let St=A.field?Xe.values[A.field]:null;W.textContent=St==null?"":String(St)}),E.append(fe)}R.append(E)}for(let E of g.alerts??[]){let A=f("div",{class:`fd-alert fd-tone-${E.tone??"info"}`,role:"status","data-node":E.id},E.message);S(A,E.id),R.append(A)}if(g.title){let E=f("div",{class:"fd-title"});E.append(D({type:"field",id:"#title",field:g.title.field,placeholder:g.title.placeholder})),g.title.subtitleField&&E.append(D({type:"field",id:"#subtitle",field:g.title.subtitleField}));let A=f("div",{class:"fd-title-row"},E);if(g.title.avatarField){let W=D({type:"field",id:"#avatar",field:g.title.avatarField});W.classList.add("fd-avatar"),A.append(W)}R.append(A)}R.append(te(g.children));let Y=f("div",{class:"fd-sheet-layout"},R);return g.sidePanel&&(Y.classList.add("fd-has-side"),Y.append(f("aside",{class:"fd-side"},B(g.sidePanel)))),$.append(C,Y),$}function k(g){let $=o.fields[g.field],I=f("ol",{class:"fd-statusbar","aria-label":$.label});if($.type==="selection"){let J=$.options.filter(C=>!g.visibleStates||g.visibleStates.includes(C.value)).map(C=>{let R=g.clickable?f("button",{type:"button"},f("span",{},C.label)):f("span",{},f("span",{},C.label));return R instanceof HTMLButtonElement&&R.addEventListener("click",()=>a.setValue(g.field,C.value)),I.append(f("li",{},R)),{option:C,inner:R}});m.push(C=>{let R=a.node("#statusbar").readonly;for(let{option:Y,inner:E}of J)Y.value===C.values[g.field]?E.setAttribute("aria-current","step"):E.removeAttribute("aria-current"),E instanceof HTMLButtonElement&&(E.disabled=R)})}else{let j=f("span",{"aria-current":"step"});I.append(f("li",{},j)),m.push(J=>{let C=J.values[g.field];j.textContent=C?.label??""})}return I}let T=null,M=o.layout,G;M.type==="sheet"?G=_(M):M.type==="wizard"?G=y(M):M.type==="tabs"?G=ut({id:`${M.id}-page`,children:[M]}):G=ut(M);let de=M.type==="sheet"?null:Wr();Ie.append(...de?[de]:[],he,G),v.append(Ie,ke),v.addEventListener("submit",g=>{g.preventDefault(),T?T():$t()});function Ae(g){return new Promise($=>{let I=f("p",{id:`${p}-confirm`},g),j=f("button",{type:"button",class:"fd-button"},c.cancel),J=f("button",{type:"button",class:"fd-button fd-button-primary"},c.ok),C=f("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":I.id},I,f("div",{class:"fd-actions fd-actions-end"},j,J)),R=f("div",{class:"fd-dialog-backdrop"},C),Y=E=>{R.remove(),$(E)};j.addEventListener("click",()=>Y(!1)),J.addEventListener("click",()=>Y(!0)),R.addEventListener("keydown",E=>{E.key==="Escape"&&Y(!1)}),v.append(R),J.focus()})}function ze(g){for(let $ of m)$(g)}e.append(v);let lt=a.subscribe(ze);return ze(a.getState()),a.getState().status==="idle"&&a.load(),{form:a,element:v,setSkin(g){v.setAttribute("data-fd-skin",g)},destroy(){lt();for(let g of d)g();v.remove(),s&&a.dispose()}}}var $p="0.1.0";return nl(Sp);})();
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);})();
426
451
  //# sourceMappingURL=fieldia.js.map