@fieldia/viewer 0.1.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.
@@ -0,0 +1,426 @@
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(`
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
+ ${r.join(`
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}];
11
+ payload.issues.push(iss);
12
+ if (iss.continue !== true) ${w}_ab = true;
13
+ }
14
+ if (${w}_ab && ctx && ctx.abortEarly) {
15
+ payload.value = newResult;
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)}
21
+ }
22
+
23
+ if (${he}) {
24
+ newResult[${B}] = ${z}.value;
25
+ }
26
+ }
27
+
28
+ `)}else V?(f.write(`
29
+ if (${z}.issues.length) {${P(z,B)}
30
+ }
31
+ `),ie==="defaulted"?f.write(`newResult[${B}] = ${z}.value;`):f.write(`
32
+ if (${z}.value !== undefined || ${te}) {
33
+ newResult[${B}] = ${z}.value;
34
+ }
35
+ `)):f.write(`
36
+ const ${z}_present = ${te};
37
+ if (${z}.issues.length) {${P(z,B)}
38
+ }
39
+ if (!${z}_present && !${z}.issues.length) {
40
+ payload.issues.push({
41
+ code: "invalid_type",
42
+ expected: "nonoptional",
43
+ input: undefined,
44
+ path: [${B}]
45
+ });
46
+ if (ctx && ctx.abortEarly) {
47
+ payload.value = newResult;
48
+ return payload;
49
+ }
50
+ }
51
+
52
+ if (${z}_present) {
53
+ newResult[${B}] = ${z}.value;
54
+ }
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>
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=`
59
+ .fd-form {
60
+ --fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
61
+ --fd-text: #212529;
62
+ --fd-muted: #6b7280;
63
+ --fd-page: #f2f3f5;
64
+ --fd-surface: #ffffff;
65
+ --fd-border: #cfd4da;
66
+ --fd-border-strong: #9aa3ad;
67
+ --fd-accent: #002855;
68
+ --fd-accent-text: #ffffff;
69
+ --fd-accent-soft: #e6ebf2;
70
+ --fd-focus: #002855;
71
+ --fd-focus-ring: none;
72
+ --fd-error: #c62828;
73
+ --fd-error-soft: #fdecea;
74
+ --fd-success: #2e7d32;
75
+ --fd-success-soft: #e8f5e9;
76
+ --fd-warning: #8a5300;
77
+ --fd-warning-soft: #fff4e0;
78
+ --fd-info: #0b5cad;
79
+ --fd-info-soft: #e7f0fb;
80
+ --fd-radius: 0px;
81
+ --fd-control-radius: 0px;
82
+ --fd-pad-y: 3px;
83
+ --fd-pad-x: 4px;
84
+ --fd-input-border: 0 0 1px 0;
85
+ --fd-label-weight: 600;
86
+ --fd-gap-x: 32px;
87
+ --fd-gap-y: 14px;
88
+ container-type: inline-size;
89
+ font-family: var(--fd-font);
90
+ font-size: 14px;
91
+ line-height: 1.45;
92
+ color: var(--fd-text);
93
+ -webkit-text-size-adjust: 100%;
94
+ }
95
+ .fd-form[data-fd-skin="outlined"] {
96
+ --fd-text: rgba(0, 0, 0, 0.88);
97
+ --fd-muted: rgba(0, 0, 0, 0.55);
98
+ --fd-page: #f5f5f5;
99
+ --fd-border: #d9d9d9;
100
+ --fd-border-strong: #bfbfbf;
101
+ --fd-accent: #1677ff;
102
+ --fd-accent-soft: #e6f4ff;
103
+ --fd-focus: #1677ff;
104
+ --fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, 0.12);
105
+ --fd-error: #ff4d4f;
106
+ --fd-error-soft: #fff2f0;
107
+ --fd-radius: 8px;
108
+ --fd-control-radius: 6px;
109
+ --fd-pad-y: 4px;
110
+ --fd-pad-x: 11px;
111
+ --fd-input-border: 1px;
112
+ --fd-label-weight: 400;
113
+ --fd-gap-x: 24px;
114
+ --fd-gap-y: 18px;
115
+ }
116
+ .fd-form *, .fd-form *::before, .fd-form *::after { box-sizing: border-box; }
117
+ .fd-form [hidden] { display: none !important; }
118
+
119
+ /* ---- page frame ---------------------------------------------------------- */
120
+ .fd-page-head { display: grid; gap: 4px; margin-block-end: 20px; }
121
+ .fd-page-title { font-size: 22px; font-weight: 650; margin: 0; line-height: 1.25; }
122
+ .fd-page-description { color: var(--fd-muted); margin: 0; }
123
+
124
+ /* ---- fields ---------------------------------------------------------------- */
125
+ .fd-grid {
126
+ display: grid;
127
+ grid-template-columns: repeat(var(--fd-columns, 1), minmax(0, 1fr));
128
+ gap: var(--fd-gap-y) var(--fd-gap-x);
129
+ align-items: start;
130
+ }
131
+ .fd-field { display: grid; gap: 4px; min-width: 0; grid-column: span min(var(--fd-span, 1), var(--fd-columns, 1)); }
132
+ .fd-label { font-weight: var(--fd-label-weight); color: var(--fd-text); }
133
+ .fd-field.fd-required > .fd-label::after { content: " *"; color: var(--fd-error); }
134
+ .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::after { content: ""; }
135
+ .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::before { content: "* "; color: var(--fd-error); }
136
+ .fd-help { color: var(--fd-muted); font-size: 12.5px; }
137
+ .fd-error { color: var(--fd-error); font-size: 12.5px; }
138
+
139
+ /* underline: label beside the value, the way a Flectra sheet reads */
140
+ .fd-form[data-fd-skin="underline"] .fd-field {
141
+ /* One label width for every field, so a field spanning two columns lines up with its neighbours. */
142
+ grid-template-columns: var(--fd-label-width, 11em) minmax(0, 1fr);
143
+ column-gap: 12px;
144
+ align-items: baseline;
145
+ }
146
+ .fd-form[data-fd-skin="underline"] .fd-field > .fd-label { grid-column: 1; }
147
+ /* A table of lines needs the full width: its label sits above it. */
148
+ .fd-form[data-fd-skin="underline"] .fd-field[data-type="one2many"] { grid-template-columns: minmax(0, 1fr); }
149
+ .fd-form[data-fd-skin="underline"] .fd-field[data-type="one2many"] > * { grid-column: 1 !important; }
150
+ .fd-form[data-fd-skin="underline"] .fd-field > :not(.fd-label) { grid-column: 2; }
151
+ /* A label beside every value needs room twice over: the underline skin stacks its columns sooner. */
152
+ @container (max-width: 760px) {
153
+ .fd-form[data-fd-skin="underline"] .fd-grid { grid-template-columns: minmax(0, 1fr); }
154
+ .fd-form[data-fd-skin="underline"] .fd-field { grid-column: auto; }
155
+ }
156
+ @container (max-width: 520px) {
157
+ .fd-grid { grid-template-columns: minmax(0, 1fr); }
158
+ .fd-field { grid-column: auto; }
159
+ .fd-form[data-fd-skin="underline"] .fd-field { grid-template-columns: minmax(0, 1fr); }
160
+ .fd-form[data-fd-skin="underline"] .fd-field > * { grid-column: 1 !important; }
161
+ }
162
+
163
+ /* ---- inputs ---------------------------------------------------------------- */
164
+ .fd-input {
165
+ width: 100%;
166
+ min-width: 0;
167
+ font: inherit;
168
+ color: inherit;
169
+ background: var(--fd-surface);
170
+ border: solid var(--fd-border);
171
+ border-width: var(--fd-input-border);
172
+ border-radius: var(--fd-control-radius);
173
+ padding: var(--fd-pad-y) var(--fd-pad-x);
174
+ min-height: 30px;
175
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
176
+ }
177
+ .fd-input::placeholder { color: var(--fd-muted); opacity: 0.8; }
178
+ .fd-input:hover { border-color: var(--fd-border-strong); }
179
+ .fd-input:focus { outline: none; border-color: var(--fd-focus); box-shadow: var(--fd-focus-ring); }
180
+ .fd-form[data-fd-skin="underline"] .fd-input { background: transparent; }
181
+ .fd-form[data-fd-skin="underline"] .fd-input:focus { box-shadow: 0 1px 0 0 var(--fd-focus); }
182
+ .fd-form[data-fd-skin="underline"] .fd-field.fd-required .fd-input { border-color: var(--fd-accent); }
183
+ .fd-input[readonly] { background: transparent; border-color: transparent; padding-inline: 0; }
184
+ .fd-form[data-fd-skin="outlined"] .fd-input[readonly] { background: rgba(0, 0, 0, 0.04); border-color: var(--fd-border); padding-inline: var(--fd-pad-x); color: var(--fd-muted); }
185
+ .fd-input[aria-invalid="true"] { border-color: var(--fd-error); }
186
+ .fd-form[data-fd-skin="outlined"] .fd-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 2px rgba(255, 38, 5, 0.06); }
187
+ .fd-textarea { resize: vertical; min-height: 64px; }
188
+ .fd-select { appearance: auto; }
189
+ .fd-number { display: flex; align-items: baseline; gap: 6px; }
190
+ .fd-number-input { font-variant-numeric: tabular-nums; }
191
+ .fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }
192
+ .fd-pending { color: var(--fd-muted); font-style: italic; }
193
+ .fd-pending:empty::before { content: "\u2014"; }
194
+
195
+ .fd-checkbox, .fd-choice input { width: 16px; height: 16px; accent-color: var(--fd-accent); margin: 0; }
196
+ .fd-switch {
197
+ appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 999px; position: relative;
198
+ background: var(--fd-border-strong); cursor: pointer; transition: background 0.2s ease;
199
+ }
200
+ .fd-switch::after {
201
+ content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 16px; height: 16px;
202
+ border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
203
+ }
204
+ .fd-switch:checked { background: var(--fd-accent); }
205
+ .fd-switch:checked::after { transform: translateX(14px); }
206
+ [dir="rtl"] .fd-switch:checked::after { transform: translateX(-14px); }
207
+ .fd-choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }
208
+ .fd-choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
209
+ .fd-points { display: flex; flex-wrap: wrap; gap: 6px; }
210
+ .fd-points button {
211
+ font: inherit; cursor: pointer; border: 1px solid var(--fd-border); background: var(--fd-surface);
212
+ color: var(--fd-text); border-radius: var(--fd-control-radius); min-width: 34px; height: 34px; padding: 0 8px;
213
+ }
214
+ .fd-points button.fd-on { background: var(--fd-accent); color: var(--fd-accent-text); border-color: var(--fd-accent); }
215
+ .fd-rating button { border: none; background: none; font-size: 24px; color: var(--fd-border-strong); padding: 0 2px; min-width: 0; }
216
+ .fd-rating button.fd-on { background: none; color: #f5a623; }
217
+ .fd-points button:disabled, .fd-choice input:disabled { cursor: default; }
218
+ .fd-form :focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; }
219
+ .fd-form .fd-input:focus-visible { outline: none; }
220
+
221
+ /* ---- pickers: many2one, many2many, reference ------------------------------ */
222
+ .fd-combo { position: relative; display: flex; align-items: center; min-width: 0; }
223
+ .fd-combo-input { padding-inline-end: 28px; }
224
+ .fd-combo-clear {
225
+ position: absolute; inset-inline-end: 4px; border: none; background: none; cursor: pointer; color: var(--fd-muted);
226
+ font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px;
227
+ }
228
+ .fd-combo-clear:hover { color: var(--fd-text); background: var(--fd-page); }
229
+ .fd-listbox {
230
+ position: absolute; inset-inline: 0; inset-block-start: calc(100% + 2px); z-index: 20; margin: 0; padding: 4px 0;
231
+ list-style: none; background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 4px);
232
+ box-shadow: 0 8px 24px rgba(15, 20, 25, 0.12); max-height: 240px; overflow-y: auto;
233
+ }
234
+ .fd-option { padding: 6px 12px; cursor: pointer; }
235
+ .fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }
236
+ .fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }
237
+ .fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
238
+ .fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }
239
+ .fd-chip {
240
+ display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; border-radius: 999px;
241
+ background: var(--fd-accent-soft); color: var(--fd-text); font-size: 13px; line-height: 22px;
242
+ }
243
+ .fd-chip-remove { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 999px; }
244
+ .fd-chip-remove:hover { color: var(--fd-error); }
245
+ .fd-tags .fd-combo { flex: 1 1 140px; }
246
+ .fd-reference { display: grid; grid-template-columns: minmax(7em, 34%) minmax(0, 1fr); gap: 8px; }
247
+
248
+ /* ---- one2many lines ------------------------------------------------------- */
249
+ .fd-lines { display: grid; gap: 6px; min-width: 0; }
250
+ .fd-lines-scroll { overflow-x: auto; }
251
+ .fd-lines-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
252
+ .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
+ .fd-lines-table td { padding: 4px 8px; border-block-end: 1px solid var(--fd-border); vertical-align: top; min-width: 7em; }
254
+ .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
+ .fd-lines-table .fd-input { min-height: 28px; }
256
+ .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
+ .fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }
258
+ .fd-lines-add { justify-self: start; }
259
+ .fd-cell-error { color: var(--fd-error); font-size: 12px; }
260
+ .fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
261
+
262
+ /* ---- files, images, rich text, json ------------------------------------ */
263
+ .fd-file { display: grid; gap: 8px; justify-items: start; padding: 6px 0; border-radius: var(--fd-control-radius); }
264
+ .fd-file.fd-dragging { outline: 2px dashed var(--fd-accent); outline-offset: 4px; }
265
+ .fd-file-pick { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }
266
+ .fd-file-chosen { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
267
+ .fd-file-name { font-variant-numeric: tabular-nums; }
268
+ .fd-image-pick {
269
+ width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);
270
+ display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);
271
+ }
272
+ .fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }
273
+ .fd-image-pick:hover { border-color: var(--fd-accent); }
274
+ .fd-avatar .fd-image-pick { width: 88px; height: 88px; }
275
+ .fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }
276
+ .fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }
277
+ .fd-richtext[contenteditable="false"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }
278
+ .fd-richtext p { margin: 0 0 6px; }
279
+ .fd-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }
280
+
281
+ /* ---- sections, tabs ---------------------------------------------------- */
282
+ .fd-sections { display: grid; gap: 24px; }
283
+ .fd-section { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }
284
+ .fd-section-title { font-size: 15px; font-weight: 650; padding: 0; margin: 0; float: inline-start; width: 100%; }
285
+ .fd-section-title + * { clear: both; }
286
+ .fd-form[data-fd-skin="underline"] .fd-section-title {
287
+ text-transform: uppercase; letter-spacing: 0.05em; font-size: 12.5px; color: var(--fd-muted);
288
+ border-block-end: 1px solid var(--fd-border); padding-block-end: 6px; width: 100%;
289
+ }
290
+ .fd-section-description { color: var(--fd-muted); margin: 0; }
291
+ .fd-form[data-fd-skin="outlined"] .fd-sections > .fd-section {
292
+ background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;
293
+ }
294
+ .fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }
295
+ .fd-tab {
296
+ font: inherit; background: none; border: none; cursor: pointer; padding: 8px 14px; color: var(--fd-muted);
297
+ border-block-end: 2px solid transparent; margin-block-end: -1px; white-space: nowrap;
298
+ }
299
+ .fd-tab[aria-selected="true"] { color: var(--fd-accent); border-block-end-color: var(--fd-accent); font-weight: 600; }
300
+ .fd-tabpanel { padding-block: 16px; display: grid; gap: 16px; }
301
+
302
+ /* ---- buttons ---------------------------------------------------------- */
303
+ .fd-button {
304
+ font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
305
+ min-height: 32px; padding: 4px 14px; border-radius: var(--fd-control-radius);
306
+ border: 1px solid var(--fd-border); background: var(--fd-surface); color: var(--fd-text);
307
+ }
308
+ .fd-button:hover { border-color: var(--fd-accent); color: var(--fd-accent); }
309
+ .fd-button-primary { background: var(--fd-accent); border-color: var(--fd-accent); color: var(--fd-accent-text); }
310
+ .fd-button-primary:hover { color: var(--fd-accent-text); filter: brightness(1.12); }
311
+ .fd-button-danger { color: var(--fd-error); border-color: var(--fd-error); }
312
+ .fd-button-danger:hover { background: var(--fd-error); color: #fff; }
313
+ .fd-button-link { border-color: transparent; background: none; color: var(--fd-accent); padding-inline: 4px; }
314
+ .fd-form[data-fd-skin="underline"] .fd-button { border-radius: 3px; }
315
+ .fd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
316
+ .fd-actions-end { justify-content: flex-end; margin-block-start: 24px; }
317
+
318
+ /* ---- record sheet --------------------------------------------------------- */
319
+ .fd-sheet-page { background: var(--fd-page); padding: 0 0 32px; min-width: 0; }
320
+ .fd-header {
321
+ display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
322
+ background: var(--fd-surface); border-block-end: 1px solid var(--fd-border); padding: 8px 16px;
323
+ }
324
+ .fd-statusbar { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; }
325
+ .fd-statusbar li { display: flex; }
326
+ .fd-statusbar button, .fd-statusbar span {
327
+ font: inherit; font-size: 13px; border: none; background: var(--fd-page); color: var(--fd-muted);
328
+ padding: 5px 18px 5px 22px; margin-inline-start: -6px; white-space: nowrap;
329
+ clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
330
+ }
331
+ .fd-statusbar li:first-child button, .fd-statusbar li:first-child span { margin-inline-start: 0; padding-inline-start: 14px;
332
+ clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
333
+ .fd-statusbar button { cursor: pointer; }
334
+ .fd-statusbar [aria-current="step"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
335
+ [dir="rtl"] .fd-statusbar button, [dir="rtl"] .fd-statusbar span { transform: scaleX(-1); }
336
+ [dir="rtl"] .fd-statusbar button > *, [dir="rtl"] .fd-statusbar span > * { display: inline-block; transform: scaleX(-1); }
337
+ .fd-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1180px; margin: 16px auto 0; padding-inline: 16px; }
338
+ .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
339
+ @container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }
340
+ .fd-card {
341
+ position: relative; overflow: hidden; background: var(--fd-surface); border: 1px solid var(--fd-border);
342
+ border-radius: var(--fd-radius); padding: 24px 28px 28px; display: grid; gap: 18px; min-width: 0;
343
+ }
344
+ .fd-ribbon {
345
+ position: absolute; inset-block-start: 18px; inset-inline-end: -42px; transform: rotate(45deg); width: 160px;
346
+ text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: #fff; background: var(--fd-muted);
347
+ text-transform: uppercase; letter-spacing: 0.06em; pointer-events: none;
348
+ }
349
+ [dir="rtl"] .fd-ribbon { transform: rotate(-45deg); }
350
+ .fd-ribbon.fd-tone-danger { background: var(--fd-error); }
351
+ .fd-ribbon.fd-tone-success { background: var(--fd-success); }
352
+ .fd-ribbon.fd-tone-warning { background: #d97706; }
353
+ .fd-ribbon.fd-tone-info { background: var(--fd-info); }
354
+ .fd-alert { padding: 10px 14px; border-radius: var(--fd-control-radius); border: 1px solid; font-size: 13.5px; }
355
+ .fd-alert.fd-tone-warning { background: var(--fd-warning-soft); border-color: #f0c47a; color: var(--fd-warning); }
356
+ .fd-alert.fd-tone-danger { background: var(--fd-error-soft); border-color: #f1a7a7; color: var(--fd-error); }
357
+ .fd-alert.fd-tone-success { background: var(--fd-success-soft); border-color: #a7d7ab; color: var(--fd-success); }
358
+ .fd-alert.fd-tone-info, .fd-alert:not([class*="fd-tone-"]) { background: var(--fd-info-soft); border-color: #a9c8ef; color: var(--fd-info); }
359
+ .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
+ .fd-stats:empty { display: none; }
361
+ /* 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; }
363
+ .fd-stat {
364
+ font: inherit; background: none; border: none; border-inline-start: 1px solid var(--fd-border); cursor: pointer;
365
+ padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;
366
+ }
367
+ .fd-stat:hover { background: var(--fd-page); }
368
+ .fd-stat-value { font-weight: 700; font-size: 15px; color: var(--fd-accent); font-variant-numeric: tabular-nums; }
369
+ .fd-stat-label { font-size: 12.5px; color: var(--fd-muted); }
370
+ .fd-title-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
371
+ .fd-title { display: grid; gap: 4px; flex: 1 1 auto; min-width: 0; }
372
+ .fd-avatar { flex: none; }
373
+ .fd-avatar > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
374
+ .fd-form[data-fd-skin="underline"] .fd-avatar { grid-template-columns: minmax(0, 1fr); }
375
+ .fd-form[data-fd-skin="underline"] .fd-avatar > * { grid-column: 1 !important; }
376
+ .fd-avatar .fd-image-pick {
377
+ width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);
378
+ display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);
379
+ }
380
+ .fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }
381
+ .fd-image-pick:hover { border-color: var(--fd-accent); }
382
+ .fd-avatar .fd-image-pick { width: 88px; height: 88px; }
383
+ .fd-image-preview { width: 88px; height: 88px; }
384
+ .fd-avatar .fd-file-pick .fd-help { display: none; }
385
+ .fd-avatar .fd-file-name { display: none; }
386
+ .fd-avatar .fd-file { justify-items: center; gap: 2px; padding: 0; }
387
+ .fd-avatar .fd-file-chosen { gap: 2px 8px; justify-content: center; font-size: 12.5px; }
388
+ .fd-title .fd-input { font-size: 24px; font-weight: 600; min-height: 40px; }
389
+ .fd-form[data-fd-skin="underline"] .fd-title .fd-field { grid-template-columns: minmax(0, 1fr); }
390
+ .fd-form[data-fd-skin="underline"] .fd-title .fd-field > * { grid-column: 1; }
391
+ .fd-title .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
392
+ .fd-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
393
+
394
+ /* ---- wizard -------------------------------------------------------------- */
395
+ .fd-wizard { display: grid; gap: 20px; }
396
+ .fd-progress { display: grid; gap: 8px; }
397
+ .fd-progress-text { color: var(--fd-muted); font-size: 13px; }
398
+ .fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }
399
+ .fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }
400
+ .fd-step { display: grid; gap: 18px; }
401
+ .fd-step-title { font-size: 18px; font-weight: 650; margin: 0; }
402
+ .fd-wizard-nav { display: flex; gap: 8px; justify-content: space-between; }
403
+ .fd-wizard-nav .fd-spacer { flex: 1; }
404
+
405
+ /* ---- text, status, dialog ------------------------------------------------- */
406
+ .fd-text-heading { font-size: 16px; font-weight: 650; margin: 0; }
407
+ .fd-text-paragraph { margin: 0; }
408
+ .fd-text-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
409
+ .fd-status { min-height: 1.4em; color: var(--fd-muted); font-size: 13px; }
410
+ .fd-status.fd-status-error { color: var(--fd-error); }
411
+ .fd-status.fd-status-saved { color: var(--fd-success); }
412
+ .fd-draft { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; margin-block-end: 16px;
413
+ background: var(--fd-info-soft); border: 1px solid #a9c8ef; border-radius: var(--fd-control-radius); }
414
+ .fd-done { padding: 40px 0; text-align: center; display: grid; gap: 12px; justify-items: center; }
415
+ .fd-done-title { font-size: 20px; font-weight: 650; margin: 0; }
416
+ .fd-dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); display: grid; place-items: center; z-index: 1000; padding: 16px; }
417
+ .fd-dialog {
418
+ background: var(--fd-surface); color: var(--fd-text); border-radius: max(var(--fd-radius), 6px); max-width: 420px; width: 100%;
419
+ padding: 20px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-family: var(--fd-font);
420
+ }
421
+ .fd-dialog p { margin: 0; }
422
+ @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:
424
+ ${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);})();
426
+ //# sourceMappingURL=fieldia.js.map