@fieldia/viewer 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/fieldia.js +112 -67
- package/bundle/fieldia.js.map +4 -4
- package/package.json +3 -3
- package/src/lib/dialog.js +10 -0
- package/src/lib/dialog.js.map +1 -1
- package/src/lib/dialog.mjs +10 -0
- package/src/lib/dialog.mjs.map +1 -1
- package/src/lib/labels.d.mts +43 -0
- package/src/lib/labels.d.ts +43 -0
- package/src/lib/labels.js +128 -0
- package/src/lib/labels.js.map +1 -0
- package/src/lib/labels.mjs +125 -0
- package/src/lib/labels.mjs.map +1 -0
- package/src/lib/related.d.mts +7 -0
- package/src/lib/related.d.ts +7 -0
- package/src/lib/related.js +88 -0
- package/src/lib/related.js.map +1 -0
- package/src/lib/related.mjs +84 -0
- package/src/lib/related.mjs.map +1 -0
- package/src/lib/viewer.d.mts +33 -26
- package/src/lib/viewer.d.ts +33 -26
- package/src/lib/viewer.js +325 -200
- package/src/lib/viewer.js.map +1 -1
- package/src/lib/viewer.mjs +323 -200
- package/src/lib/viewer.mjs.map +1 -1
package/bundle/fieldia.js
CHANGED
|
@@ -1,61 +1,5 @@
|
|
|
1
|
-
/*! Fieldia 0.
|
|
2
|
-
"use strict";var Fieldia=(()=>{var pr=Object.defineProperty;var Cu=Object.getOwnPropertyDescriptor;var Mu=Object.getOwnPropertyNames;var Du=Object.prototype.hasOwnProperty;var ju=(e,t,r)=>t in e?pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var di=(e,t)=>{for(var r in t)pr(e,r,{get:t[r],enumerable:!0})},Vu=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mu(t))!Du.call(e,o)&&o!==r&&pr(e,o,{get:()=>t[o],enumerable:!(n=Cu(t,o))||n.enumerable});return e};var Bu=e=>Vu(pr({},"__esModule",{value:!0}),e);var ht=(e,t,r)=>ju(e,typeof t!="symbol"?t+"":t,r);var _m={};di(_m,{DEFAULT_LABELS:()=>gm,FIELDIA_CSS:()=>Zu,FIELD_NAME:()=>Fe,FIELD_TYPES:()=>Rl,FORMAT_VERSION:()=>jo,FieldSchema:()=>Do,FieldsSchema:()=>Hr,FilterConditionSchema:()=>Zo,LayoutNodeSchema:()=>xt,LineFieldSchema:()=>Co,LineKindsSchema:()=>Mo,MESSAGES:()=>mt,ModifierSchema:()=>nr,OptionSchema:()=>rr,PageSchema:()=>Tt,PropertyDefinitionSchema:()=>Fo,RootLayoutSchema:()=>Kr,VERSION:()=>km,VIEWER_LABELS:()=>Ft,WIDGET_LABELS:()=>xe,binaryWidget:()=>Xo,browserPreferences:()=>ci,builtInWidgets:()=>Ru,charTagsWidget:()=>Ho,checkValue:()=>ar,compileModifier:()=>ft,createForm:()=>Qr,createMemoryDataSource:()=>fu,createWidget:()=>We,displayValue:()=>Go,emptyValue:()=>ir,evaluateModifier:()=>au,expressionContext:()=>sr,fill:()=>Yr,formatBytes:()=>cr,formatNumber:()=>kt,hostScheduler:()=>lr,htmlWidget:()=>oi,imageWidget:()=>Qo,initialValues:()=>Zt,installStyles:()=>ai,isEmpty:()=>It,isModifierValid:()=>cu,isoWeek:()=>$u,jsonWidget:()=>ii,kindTextField:()=>xu,labelWidget:()=>dr,lineForm:()=>vu,lineKind:()=>pt,linesWidget:()=>Yo,linkAddress:()=>Lu,linkCheckboxesWidget:()=>Ko,many2oneWidget:()=>Jo,memoryPreferences:()=>pm,mountViewer:()=>ui,normalizeNumber:()=>Wo,openFormDialog:()=>un,openSearchDialog:()=>li,pageJsonSchema:()=>su,progressbarWidget:()=>ur,propertiesWidget:()=>ri,referenceWidget:()=>qo,sanitizeHtml:()=>ni,statusbarWidget:()=>on,summary:()=>nn,tagsWidget:()=>rn,validatePage:()=>Gr,wait:()=>Xr,withCalendar:()=>an});var C={};di(C,{BIGINT_FORMAT_RANGES:()=>br,CONSTANT_CATCH:()=>wi,Class:()=>pn,NUMBER_FORMAT_RANGES:()=>Mt,aborted:()=>Re,allowsEval:()=>xn,assert:()=>qu,assertEqual:()=>Uu,assertIs:()=>Hu,assertNever:()=>Ku,assertNotEqual:()=>Wu,assignProp:()=>Pe,attachSchema:()=>xr,base64ToUint8Array:()=>xi,base64urlToUint8Array:()=>md,cached:()=>$t,captureStackTrace:()=>hr,cleanEnum:()=>pd,cleanRegex:()=>Ct,clone:()=>Me,cloneDef:()=>Xu,codePointLength:()=>Dt,constantCatch:()=>ki,createTransparentProxy:()=>od,defineLazy:()=>gn,defineLazyInternal:()=>ee,derived:()=>yd,esc:()=>bn,escapeRegex:()=>Qe,explicitlyAborted:()=>kn,extend:()=>ad,finalizeIssue:()=>je,floatSafeRemainder:()=>hn,getElementAtPath:()=>Qu,getEnumValues:()=>zt,getLengthableOrigin:()=>jt,getParsedType:()=>nd,getSizableOrigin:()=>yi,hexToUint8Array:()=>gd,hide:()=>vr,installLazyProp:()=>kd,isObject:()=>bt,isPlainObject:()=>at,issue:()=>Lt,joinValues:()=>mr,jsonStringifyReplacer:()=>St,members:()=>zn,merge:()=>ld,mergeDefs:()=>Xe,normalizeParams:()=>I,nullish:()=>mn,numKeys:()=>rd,objectClone:()=>Gu,omit:()=>sd,optionalKeys:()=>wn,own:()=>st,parsedType:()=>_n,partial:()=>ud,pick:()=>id,prefixIssues:()=>De,primitiveTypes:()=>gi,promiseAllObject:()=>ed,propertyKeyTypes:()=>vn,randomString:()=>td,rawShape:()=>Et,required:()=>dd,safeExtend:()=>cd,shallowClone:()=>hi,slugify:()=>yn,stringifyPrimitive:()=>gr,toZod:()=>Ju,uint8ArrayToBase64:()=>vi,uint8ArrayToBase64url:()=>hd,uint8ArrayToHex:()=>bd,unwrapMessage:()=>_t});function Uu(e){return e}function Wu(e){return e}function Ju(){return e=>e}function Hu(e){}function Ku(e){throw new Error("Unexpected value in exhaustive check")}function qu(e){}function zt(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 mr(e,t="|"){return e.map(r=>gr(r)).join(t)}function St(e,t){return typeof t=="bigint"?t.toString():t}var fn=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function $t(e){return new fn(e)}function mn(e){return e==null}function Ct(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function hn(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 fi=Symbol("evaluating");function gn(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==fi)return n===void 0&&(n=fi,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Gu(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Pe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Et(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ye(e){return Et(e._zod.def)??e._zod.def.shape}function pi(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Pe(this,t,n),n},enumerable:!0,configurable:!0})}function mi(e,t,r){t in e?Pe(e,t,r):e[t]=r}function gt(e,t,r,n){let o=Ye(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?pi(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):mi(e,i,n?n(s.value,i):s.value))}}function Yu(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?pi(e,r,()=>t[r]):mi(e,r,n.value))}}function Xe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Xu(e){return Xe(e._zod.def)}function Qu(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function ed(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 td(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function bn(e){return JSON.stringify(e)}function yn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var hr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function bt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var xn=$t(()=>{if(Le.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function at(e){if(bt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(bt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function hi(e){return at(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function rd(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var nd=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}`)}},vn=new Set(["string","number","symbol"]),gi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(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 od(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 gr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function wn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Mt={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]},br={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function id(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 gt(i,e,yr(e,t)),Me(e,Xe(r,{shape:i,checks:[]}))}function yr(e,t){let r=Ye(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 sd(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(yr(e,t)),s={};return gt(s,e,Reflect.ownKeys(Ye(e)).filter(a=>!i.has(a))),Me(e,Xe(r,{shape:s,checks:[]}))}function ad(e,t){if(!at(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=Ye(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 Me(e,Xe(e._zod.def,{shape:bi(e,t)}))}function bi(e,t){let r={};return gt(r,e,Reflect.ownKeys(Ye(e))),Yu(r,t),r}function cd(e,t){if(!at(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Me(e,Xe(e._zod.def,{shape:bi(e,t)}))}function ld(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={};gt(r,e,Reflect.ownKeys(Ye(e))),gt(r,t,Reflect.ownKeys(Ye(t)));let n=Xe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Me(e,n)}function ud(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(yr(t,r)):void 0,c={};return gt(c,t,Reflect.ownKeys(Ye(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),Me(t,Xe(t._zod.def,{shape:c,checks:[]}))}function dd(e,t,r){let n=r?new Set(yr(t,r)):void 0,o={};return gt(o,t,Reflect.ownKeys(Ye(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Me(t,Xe(t._zod.def,{shape:o}))}function Re(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 kn(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 De(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function _t(e){return typeof e=="string"?e:e?.message}function xr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function je(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:_t(e.inst?._zod.def?.error?.(e))??_t(i?.(e))??_t(t?.error?.(e))??_t(r.customError?.(e))??_t(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 yi(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var fd=/[\uD800-\uDBFF]/;function Dt(e){let t=e.length;if(!fd.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 jt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _n(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 Lt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function pd(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function xi(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 vi(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function md(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return xi(t+r)}function hd(e){return vi(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gd(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 bd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var pn=class{constructor(...t){}};function zn(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):xd(e,r,n.value)}}function st(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function vr(e,t,r){return st(e,t,r,!1)}function yd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return st(this,r,n(this))},set(o){st(this,r,o)}})}return t}function xd(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:st(this,t,r.bind(this))},set(n){st(this,t,n)}})}function vd(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var dn,it=!1,wd={configurable:!0,get(){it=!0}};function ee(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&dn!==e._zod){dn=void 0;return}dn=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,wd);let o=it;it=!1;try{let i=r(this);return it?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),it=it||o,i}catch(i){throw delete this[t],it=it||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function kd(e,t,r,n){let o=vd(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 wi="~constantCatch";function ki(e){let t=()=>e;return t[wi]=!0,t}var _i;var Sn={value:void 0,enumerable:!1},zi="captureStackTrace"in Error?Error:null;function _d(e){let t=zi;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return zi=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function w(e,t,r,n){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(h,p){if(h._zod){if(h._zod.traits.has(e))return}else{Sn.value=new i(p);try{Object.defineProperty(h,"_zod",Sn)}finally{Sn.value=void 0}}if(h._zod.traits.add(e),t(h,p),a){let m=Object.getPrototypeOf(h),b=h._zod.constr.prototype,y=m;for(;y&&y!==b;)y=Object.getPrototypeOf(y);let g=y??m;a.has(g)||(a.add(g),zn(g,s))}let f=d.prototype;for(let m in f)Object.prototype.hasOwnProperty.call(f,m)&&(m in h||(h[m]=f[m].bind(h)))}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(h){let p=n?.Parent?_d(u):this;c(p,h);let f=p._zod.deferred;if(f){for(let b of f)b();p._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>n?.Parent&&h instanceof n.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ve=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Nt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(_i=globalThis).__zod_globalConfig??(_i.__zod_globalConfig={});var Le=globalThis.__zod_globalConfig;function Te(e){return e&&Object.assign(Le,e),Le}function zd(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,St,2)),e.message}function Sd(e){this._zod.message=e}var $d={get:zd,set:Sd,enumerable:!0,configurable:!0},En={value:void 0,enumerable:!1},Si=new WeakSet([Object.prototype,Error.prototype]),$i=(e,t)=>{e.name="$ZodError",En.value=t,Object.defineProperty(e,"issues",En),En.value=void 0,Object.defineProperty(e,"message",$d);let r=Object.getPrototypeOf(e);Si.has(r)||(Si.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})}}))},Ei=w("$ZodError",$i),Lm=w("$ZodError",$i,void 0,{Parent:Error});function Ed(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Li(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Ed(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ni(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,l=0;for(;l<a.length;){let u=a[l],d=l===a.length-1;if(u==="_errors"){d&&c._errors.push(t(s)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=c[u];d&&h._errors.push(t(s)),c=h,l++}}}};return n(e),r}function wr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var kr=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 Ve;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(l=>je(l,s,Te())));throw hr(c,i?.callee??t),c}return a.value};return t};var _r=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(l=>je(l,s,Te())));throw hr(c,i?.callee??t),c}return a.value};return t};var zr=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 Ve;return i.issues.length?Pi(e,i.issues,o):{success:!0,data:i.value}};function Pi(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>je(o,r,Te()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var Sr=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?Pi(e,i.issues,o):{success:!0,data:i.value}};var Ld=Symbol.for("zod.compile.invalid"),Nd=Symbol.for("zod.compile.fallback"),Ln=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ld)return!0;if(n.definite===!0&&r===void 0)return!1}return Pd(e,t,r)});function Pd(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Nd]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new Ve;return i.issues.length===0}var Nn=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Ai=e=>{let t=kr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,wr(r,s))};return r};var Oi=e=>{let t=kr(e),r=(n,o,i,s)=>t(n,o,i,wr(r,s));return r};var Ri=e=>{let t=_r(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,wr(r,s))};return r};var Ti=e=>{let t=_r(e),r=async(n,o,i,s)=>await t(n,o,i,wr(r,s));return r};var Zi=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return zr(e)(t,r,o)};var Ii=e=>(t,r,n)=>zr(e)(t,r,n);var Fi=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Sr(e)(t,r,o)};var Ci=e=>async(t,r,n)=>Sr(e)(t,r,n);var Mi=/^[cC][0-9a-z]{6,}$/,Di=/^[0-9a-z]+$/,ji=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Vi=/^[0-9a-vA-V]{20}$/,Bi=/^[A-Za-z0-9]{27}$/,Ui=/^[a-zA-Z0-9_-]{21}$/;function Wi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ji=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Hi=/^([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})$/,An=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 Ad="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function qi(){return new RegExp(Ad,"u")}var Gi=/^(?:(?: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])$/,Yi=/^(([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 Xi=/^((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])$/,Qi=/^(([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])$/,es=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ts=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var rs=/^https?$/,ns=/^\+[1-9]\d{6,14}$/;var os="(?:(?:\\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 Od(e){return new RegExp(`^${e}$`)}var is=Od(os);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 ss(e){return new RegExp(`^${Pn(e)}$`)}function as(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(`^${os}T(?:${n})$`)}var cs=/^[\s\S]{0,}$/;var On=/^-?\d+$/,Vt=/^-?\d+(?:\.\d+)?$/,ls=/^(?:true|false)$/i,us=/^null$/i;var ds=/^[^A-Z]*$/,fs=/^[^a-z]*$/;var Se=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Rn=e=>{let t=e.value;return!mn(t)&&t.length!==void 0},$r={number:"number",bigint:"bigint",object:"date"},Tn=w("$ZodCheckLessThan",(e,t)=>{Se.init(e,t);let r=$r[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:$r[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})}}),Zn=w("$ZodCheckGreaterThan",(e,t)=>{Se.init(e,t);let r=$r[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:$r[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})}}),ps=w("$ZodCheckMultipleOf",(e,t)=>{Se.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):hn(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})}}),ms=w("$ZodCheckNumberFormat",(e,t)=>{Se.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Mt[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 hs=w("$ZodCheckMaxLength",(e,t)=>{var r;Se.init(e,t),(r=e._zod.def).when??(r.when=Rn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Dt(o):i)<=t.maximum)return;let a=jt(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gs=w("$ZodCheckMinLength",(e,t)=>{var r;Se.init(e,t),(r=e._zod.def).when??(r.when=Rn),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Dt(o):i)>=t.minimum)return;let a=jt(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),bs=w("$ZodCheckLengthEquals",(e,t)=>{var r;Se.init(e,t),(r=e._zod.def).when??(r.when=Rn),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Dt(o):i;if(s===t.length)return;let a=jt(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})}}),Ut=w("$ZodCheckStringFormat",(e,t)=>{var r,n;Se.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=()=>{})}),ys=w("$ZodCheckRegex",(e,t)=>{Ut.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})}}),xs=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ds),Ut.init(e,t)}),vs=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fs),Ut.init(e,t)}),ws=w("$ZodCheckIncludes",(e,t)=>{Se.init(e,t);let r=Qe(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})}}),ks=w("$ZodCheckStartsWith",(e,t)=>{Se.init(e,t);let r=new RegExp(`^${Qe(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})}}),_s=w("$ZodCheckEndsWith",(e,t)=>{Se.init(e,t);let r=new RegExp(`.*${Qe(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 zs=w("$ZodCheckOverwrite",(e,t)=>{Se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Er=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 $s={major:4,minor:6,patch:5};var se=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$s;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,l)=>{if(a.memo)return a;let u=Re(a),d;for(let h of c){if(h._zod.def.when){if(kn(a)||!h._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=h._zod.check(a);if(f instanceof Promise&&l?.async===!1)throw new Ve;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(xr(a.issues,p,e),u||(u=Re(a,p)))});else{if(a.issues.length===p)continue;xr(a.issues,p,e),u||(u=Re(a,p))}}return d?d.then(()=>a):a},s=(a,c,l)=>{if(Re(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new Ve;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,a,c)):s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new Ve;return l.then(u=>i(u,o,c))}return i(l,o,c)}}},{get"~standard"(){return vr(this,"~standard",Fn(this))},set"~standard"(e){st(this,"~standard",e)}}),Ds=(e,t)=>e.issues.length?{issues:e.issues.map(r=>je(r,t,Te()))}:{value:e.value};async function Rd(e,t){let r={async:!0};return Ds(await e._zod.run({value:t,issues:[]},r),r)}function Fn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Ds(n,r)}catch{}return Rd(e,t)},vendor:"zod",version:1}}var Ar=w("$ZodString",(e,t)=>{se.init(e,t),e._zod.pattern=t.pattern??cs,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}}),de=w("$ZodStringFormat",(e,t)=>{Ut.init(e,t),Ar.init(e,t)}),js=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Hi),de.init(e,t)}),Vs=w("$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=An(n))}else t.pattern??(t.pattern=An());de.init(e,t)}),Bs=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ki),de.init(e,t)}),Us=1,Nr=2;function Ws(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Td(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Ws(e)||Nr:Zd(e,t)}function Zd(e,t){if(!t.normalize&&t.protocol?.source===rs.source&&!/^https?:\/\//i.test(e))return Us;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Nr}return new URL(e)}catch{return Nr}}var Id=/[\t\n\r]/g;function Es(e){return e.replace(Id,"")}function Fd(e,t){return t.lastIndex=0,t.test(e.hostname)}function Cd(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Js=w("$ZodURL",(e,t)=>{de.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Td(n,t);if(o===Us){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Nr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Es(n);return}t.hostname&&!Fd(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&&!Cd(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:Es(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Hs=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qi()),de.init(e,t)}),Ks=w("$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?Ui:Wi(t.length)),de.init(e,t)}),qs=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mi),de.init(e,t)}),Gs=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Di),de.init(e,t)}),Ys=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ji),de.init(e,t)}),Xs=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Vi),de.init(e,t)}),Qs=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Bi),de.init(e,t)}),ea=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=as(t)),de.init(e,t)}),ta=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=is),de.init(e,t)}),ra=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ss(t)),de.init(e,t)}),na=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ji),de.init(e,t)}),oa=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gi),de.init(e,t)}),Md=/^[0-9a-fA-F:.]+$/;function ia(e){return Md.test(e)?Ws(`http://[${e}]`):!1}var sa=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Yi),de.init(e,t),e._zod.check=r=>{ia(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var aa=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xi),de.init(e,t)});function Dd(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:ia(r)}var ca=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qi),de.init(e,t),e._zod.check=r=>{Dd(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function la(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Cn=/^[0-9a-zA-Z+/]*={0,2}$/,ua=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Cn),de.init(e,t),e._zod.check=r=>{la(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Or=/^[A-Za-z0-9_-]*$/;function jd(e){if(!Or.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return la(r)}var da=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Or),de.init(e,t),e._zod.check=r=>{jd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),fa=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ns),de.init(e,t)});function Vd(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 pa=w("$ZodJWT",(e,t)=>{de.init(e,t),e._zod.check=r=>{Vd(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Mn=w("$ZodNumber",(e,t)=>{se.init(e,t),e._zod.pattern=Vt,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}}),ma=w("$ZodNumberFormat",(e,t)=>{ms.init(e,t),Mn.init(e,t)}),ha=w("$ZodBoolean",(e,t)=>{se.init(e,t),e._zod.pattern=ls,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 ga=w("$ZodNull",(e,t)=>{se.init(e,t),e._zod.pattern=us,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 ba=w("$ZodUnknown",(e,t)=>{se.init(e,t),e._zod.parse=r=>r}),ya=w("$ZodNever",(e,t)=>{se.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ls(e,t,r){e.issues.length&&t.issues.push(...De(r,e.issues)),t.value[r]=e.value}var xa=w("$ZodArray",(e,t)=>{se.init(e,t);let r=Le.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 l=i[c],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then(d=>Ls(d,n,c)));else if(Ls(u,n,c),a&&u.issues.length!==0&&Re(u))break}return s.length?Promise.all(s).then(()=>n):n}});function Pr(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(...De(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 Bd=[];function va(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Bd,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=wn(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function wa(e,t,r,n,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,d=l.optin,h=l.optout,p=0;for(let f in t){if(s&&r.issues.length!==p){if(Re(r,p))break;p=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){u==="never"&&a.push(f);continue}if(u==="never"){a.push(f);continue}let m=l.run({value:t[f],issues:[]},n);m instanceof Promise?e.push(m.then(b=>Pr(b,r,f,t,d,h))):Pr(m,r,f,t,d,h)}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 Ud=w("$ZodObject",(e,t)=>{se.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=$t(()=>va(t));ee(e,"propValues",l=>{let u=l.def.shape,d={};for(let h in u){let p=u[h]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,h)||Pe(d,h,new Set);for(let f of p.values)d[h].add(f);p.optin!==void 0&&d[h].add(void 0)}}return d});let i=bt,s=t.catchall,a,c=Le.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let h=[],p=a.shape,f=u?.abortEarly,m=l.issues.length;for(let b of a.allKeys){if(f&&l.issues.length!==m){if(Re(l,m))break;m=l.issues.length}if(b==="__proto__")continue;let y=p[b],g=y._zod.optin,S=y._zod.optout,z=y._zod.run({value:d[b],issues:[]},u);z instanceof Promise?h.push(z.then(_=>Pr(_,l,b,d,g,S))):Pr(z,l,b,d,g,S)}return s?wa(h,d,l,u,o.value,e,f===!0):h.length?Promise.all(h).then(()=>l):l}}),ka=w("$ZodObjectJIT",(e,t)=>{Ud.init(e,t);let r=e._zod.parse,n=$t(()=>va(t)),o=Le.memoizer,i=p=>{let f=n.value,m=f.symbolKeys,b=new Er(["payload","ctx"],{shape:p,inst:e,memo:o,syms:m}),y=_=>`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`,g=(_,E)=>`
|
|
7
|
-
let ${_}_ab = false;
|
|
8
|
-
for (let i = 0; i < ${_}.issues.length; i++) {
|
|
9
|
-
const iss = ${_}.issues[i];
|
|
10
|
-
iss.path = iss.path ? [${E}, ...iss.path] : [${E}];
|
|
11
|
-
payload.issues.push(iss);
|
|
12
|
-
if (iss.continue !== true) ${_}_ab = true;
|
|
13
|
-
}
|
|
14
|
-
if (${_}_ab && ctx && ctx.abortEarly) {
|
|
15
|
-
payload.value = newResult;
|
|
16
|
-
return payload;
|
|
17
|
-
}`;b.write("const input = payload.value;");let S=Object.create(null),z=0;for(let _ of f.allKeys)S[_]=`key_${z++}`;b.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let _ of f.allKeys){if(_==="__proto__")continue;let E=S[_],L=typeof _=="symbol"?`syms[${m.indexOf(_)}]`:bn(_),T=`${L} in input`,U=p[_],W=U?._zod?.optin,ne=W!==void 0,Y=U?._zod?.optout==="optional";if(b.write(`const ${E} = ${y(L)};`),ne&&Y){let X=W==="optional"?`${E}_present`:`${E}.value !== undefined || ${E}_present`;b.write(`
|
|
18
|
-
const ${E}_present = ${T};
|
|
19
|
-
if (!${E}.issues.length || ${E}_present) {
|
|
20
|
-
if (${E}.issues.length) {${g(E,L)}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (${X}) {
|
|
24
|
-
newResult[${L}] = ${E}.value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
`)}else ne?(b.write(`
|
|
29
|
-
if (${E}.issues.length) {${g(E,L)}
|
|
30
|
-
}
|
|
31
|
-
`),W==="defaulted"?b.write(`newResult[${L}] = ${E}.value;`):b.write(`
|
|
32
|
-
if (${E}.value !== undefined || ${T}) {
|
|
33
|
-
newResult[${L}] = ${E}.value;
|
|
34
|
-
}
|
|
35
|
-
`)):b.write(`
|
|
36
|
-
const ${E}_present = ${T};
|
|
37
|
-
if (${E}.issues.length) {${g(E,L)}
|
|
38
|
-
}
|
|
39
|
-
if (!${E}_present && !${E}.issues.length) {
|
|
40
|
-
payload.issues.push({
|
|
41
|
-
code: "invalid_type",
|
|
42
|
-
expected: "nonoptional",
|
|
43
|
-
input: undefined,
|
|
44
|
-
path: [${L}]
|
|
45
|
-
});
|
|
46
|
-
if (ctx && ctx.abortEarly) {
|
|
47
|
-
payload.value = newResult;
|
|
48
|
-
return payload;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (${E}_present) {
|
|
53
|
-
newResult[${L}] = ${E}.value;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
`)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},s,a=bt,c=!Le.jitless,u=c&&xn.value,d=t.catchall,h;e._zod.parse=(p,f)=>{h??(h=n.value);let m=p.value;return a(m)?c&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=i(t.shape)),p=s(p,f),d?wa([],m,p,f,h,e,f?.abortEarly===!0):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Ns(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=>!Re(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=>je(s,n,Te())))}),t)}var Dn=w("$ZodUnion",(e,t)=>{se.init(e,t),ee(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),ee(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ee(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)))}),ee(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=>Ct(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=>Ns(a,n,e,o)):Ns(s,n,e,o)}});function Wd(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 _a=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Dn.init(e,t);let r=e._zod.parse;ee(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[l,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,l)||Pe(i,l,new Set);for(let d of u)i[l].add(d)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=Et(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=$t(()=>Wd(t));e._zod.parse=(o,i)=>{let s=o.value;if(!bt(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(l=>n.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),za=w("$ZodIntersection",(e,t)=>{se.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,l])=>Ps(r,c,l)):Ps(r,i,s)}});function In(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(at(e)&&at(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=In(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=In(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 Ps(e,t,r){let n=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let h=String(l.path[0]);i.has(h)||i.set(h,l),d=[h]}else return!1;for(let h of d)n.has(h)||n.set(h,{}),n.get(h)[u]=!0;return!0};for(let l of t.issues)s(l,"l")||e.issues.push(l);for(let l of r.issues)s(l,"r")||e.issues.push(l);let a=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter(u=>o.keys.includes(u)):[];l.length&&e.issues.push({...o,keys:l});for(let u of a)!l.includes(u)&&i.has(u)&&e.issues.push(i.get(u))}let c=In(t.value,r.value);if(!c.valid){if(Re(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Sa=w("$ZodTuple",(e,t)=>{se.init(e,t);let r=t.items,n=Le.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=As(r,"optin"),l=As(r,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=new Array(r.length),d=t.rest?i?.abortEarly:void 0,h=!1;for(let p=0;p<r.length;p++){let f=r[p]._zod.run({value:s[p],issues:[]},i);f instanceof Promise?a.push(f.then(m=>{u[p]=m})):(u[p]=f,d&&!h&&f.issues.length&&(h=Re(f)))}if(t.rest&&!h){let p=r.length-1,f=s.slice(r.length),m=o.issues.length;for(let b of f){if(d&&o.issues.length!==m){if(Re(o,m))break;m=o.issues.length}p++;let y=t.rest._zod.run({value:b,issues:[]},i);y instanceof Promise?a.push(y.then(g=>Os(g,o,p))):Os(y,o,p)}}return a.length?Promise.all(a).then(()=>Rs(u,o,r,s,l)):Rs(u,o,r,s,l)}});function As(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Os(e,t,r){e.issues.length&&t.issues.push(...De(r,e.issues)),t.value[r]=e.value}function Rs(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(...De(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 $a=w("$ZodRecord",(e,t)=>{se.init(e,t);let r=Le.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!at(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 u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(c.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>je(f,o,Te())),input:u,path:[u],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let p=t.valueType._zod.run({value:i[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&n.issues.push(...De(u,f.issues)),n.value[h]=f.value})):(p.issues.length&&n.issues.push(...De(u,p.issues)),n.value[h]=p.value)}let l;for(let u in i)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;n.value[u]=i[u]}else l=l??[],l.push(u);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Vt.test(l)&&u.issues.length){let f=t.keyType._zod.run({value:Number(l),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(u=f)}if(u.issues.length){t.mode==="loose"?n.value[l]=i[l]:a?(c=c??[],c.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>je(f,o,Te())),input:l,path:[l],inst:e});continue}let h=u.value;if(h==="__proto__")continue;let p=t.valueType._zod.run({value:i[l],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&n.issues.push(...De(l,f.issues)),n.value[h]=f.value})):(p.issues.length&&n.issues.push(...De(l,p.issues)),n.value[h]=p.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 Ea=w("$ZodEnum",(e,t)=>{se.init(e,t);let r=zt(t.entries),n=new Set(r);e._zod.values=n,ee(e,"pattern",o=>{let i=zt(o.def.entries).filter(s=>vn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Qe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),La=w("$ZodLiteral",(e,t)=>{se.init(e,t);let r=new Set(t.values);e._zod.values=r,ee(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Qe(i):i?Qe(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 Na=w("$ZodTransform",(e,t)=>{se.init(e,t),e._zod.optin="optional",Le.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Nt(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 Ve;return r.value=o,r}});function Ts(e,t){return e.value=t.issues.length?void 0:t.value,e}var jn=w("$ZodOptional",(e,t)=>{se.init(e,t),ee(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ee(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),ee(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ct(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=>Ts(r,i)):Ts(r,o)}return t.innerType._zod.run(r,n)}}),Pa=w("$ZodExactOptional",(e,t)=>{jn.init(e,t),ee(e,"values",r=>r.def.innerType._zod.values),ee(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Aa=w("$ZodNullable",(e,t)=>{se.init(e,t),ee(e,"optin",r=>r.def.innerType._zod.optin),ee(e,"optout",r=>r.def.innerType._zod.optout),ee(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ct(n.source)}|null)$`):void 0}),ee(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)}),Oa=w("$ZodDefault",(e,t)=>{se.init(e,t),e._zod.optin="defaulted",ee(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=>Zs(i,t)):Zs(o,t)}});function Zs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ra=w("$ZodPrefault",(e,t)=>{se.init(e,t),e._zod.optin="defaulted",ee(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))}),Ta=w("$ZodNonOptional",(e,t)=>{se.init(e,t),ee(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=>Is(i,e)):Is(o,e)}});function Is(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=>je(o,n,Te()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Za=w("$ZodCatch",(e,t)=>{se.init(e,t),ee(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ee(e,"optout",r=>r.def.innerType._zod.optout),ee(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 Ia=w("$ZodPipe",(e,t)=>{se.init(e,t),ee(e,"values",r=>r.def.in._zod.values),ee(e,"optin",r=>r.def.in._zod.optin),ee(e,"optout",r=>r.def.out._zod.optout),ee(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=>Lr(s,t.in,n)):Lr(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Lr(i,t.out,n)):Lr(o,t.out,n)}});function Lr(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=w("$ZodReadonly",(e,t)=>{se.init(e,t),ee(e,"propValues",r=>r.def.innerType._zod.propValues),ee(e,"values",r=>r.def.innerType._zod.values),ee(e,"optin",r=>r.def.innerType?._zod?.optin),ee(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(Cs):Cs(o)}});function Cs(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Ca=w("$ZodLazy",(e,t)=>{se.init(e,t),gn(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ee(e,"pattern",r=>r.innerType?._zod?.pattern),ee(e,"propValues",r=>r.innerType?._zod?.propValues),ee(e,"optin",r=>r.innerType?._zod?.optin??void 0),ee(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ma=w("$ZodCustom",(e,t)=>{Se.init(e,t),se.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(Lt(o))}}var Bn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Un="~memo",Da=[];function ja(e){return e!==null&&typeof e=="object"}function Vn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Va=new WeakMap,Wt=0,Zr=1,Jt=2;function Ir(e,t,r){let n=Va.get(e);if(n!==void 0)return n?Jt:Wt;if(t.has(e))return Jt;t.add(e);let o=Wt,i=u=>{if(o!==Jt&&u?._zod){let d=Ir(u,t,r);d>o&&(o=d)}},s=(u,d)=>{let h=Wt;for(let p of Reflect.ownKeys(u)){let f=Object.getOwnPropertyDescriptor(u,p);if(d&&!f.enumerable)continue;let m=f.get?Zr:f.value?._zod?Ir(f.value,t,r):Wt;m>h&&(h=m)}return h},a=u=>{u>o&&(o=u)},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Et(c);a(u?s(u,!0):Zr),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);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 u of c.options)i(u);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 u=c._cachedInner??(r?e._zod.innerType:void 0);a(u?Ir(u,t,!1):Zr);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let h=d.value;if(!(!h||typeof h!="object")){if(h._zod)i(h);else if(Array.isArray(h))for(let p of h)i(p)}}}return t.delete(e),Jd(e,o)}function Jd(e,t){return t!==Zr&&Va.set(e,t===Jt),t}function Hd(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Rr,Tr=[],Kd={alloc(e,t,r){let n=Rr;if(!n)return r;Rr=void 0;let o={value:r,issues:null};return n.set(t.value,o),Tr.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"&&qd(i,o.value))throw new Bn;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,l)=>{if(r===void 0){let y=Ir(e,new Set,!1);if(y===Wt)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,l);y===Jt||n?r=!0:n=!0}let u=c.value;if(!ja(u))return s(c,l);let d=l[Un];d||(d={buckets:new WeakMap,backEdges:void 0},l[Un]=d);let h;o===l?h=i:(h=Hd(d,e),o=l,i=h);let p=h.get(u);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...Vn(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;Rr=h;let f=Tr.length,m=s(c,l);Rr=void 0;let b=Tr.length>f?Tr.pop():void 0;return m instanceof Promise?m.then(y=>(b&&(b.issues=y.issues.length?Vn(y.issues):Da),y)):(b&&(b.issues=m.issues.length?Vn(m.issues):Da),m)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Ba(){return Kd}function qd(e,t){let r=e[Un]?.backEdges;return r!==void 0&&ja(t)&&r.has(t)}var Gd=()=>{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=_n(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 ${gr(i.values[0])}`:`Invalid option: expected one of ${mr(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":""}: ${mr(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 Ua(){return{localeError:Gd()}}var Wa;var Wn=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 Yd(){return new Wn}(Wa=globalThis).__zod_globalRegistry??(Wa.__zod_globalRegistry=Yd());var yt=globalThis.__zod_globalRegistry;function Ja(e){return e.checks&&(e.checks=[...e.checks]),e}function Ha(e,t){return new e(Ja({type:"string",...I(t)}))}function Ka(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function qa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Ga(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Ya(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Xa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Qa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function ec(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function tc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function rc(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function nc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function oc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function ic(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function sc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function ac(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function cc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function lc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function uc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function dc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function fc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function pc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function mc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function hc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function gc(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function bc(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function yc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function xc(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function vc(e,t){return new e(Ja({type:"number",checks:[],...I(t)}))}function wc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function kc(e,t){return new e({type:"boolean",...I(t)})}function _c(e,t){return new e({type:"null",...I(t)})}function zc(e){return new e({type:"unknown"})}function Sc(e,t){return new e({type:"never",...I(t)})}function Fr(e,t){return new Tn({check:"less_than",...I(t),value:e,inclusive:!1})}function Ht(e,t){return new Tn({check:"less_than",...I(t),value:e,inclusive:!0})}function Cr(e,t){return new Zn({check:"greater_than",...I(t),value:e,inclusive:!1})}function Kt(e,t){return new Zn({check:"greater_than",...I(t),value:e,inclusive:!0})}function Mr(e,t){return new ps({check:"multiple_of",...I(t),value:e})}function Dr(e,t){return new hs({check:"max_length",...I(t),maximum:e})}function Pt(e,t){return new gs({check:"min_length",...I(t),minimum:e})}function jr(e,t){return new bs({check:"length_equals",...I(t),length:e})}function Jn(e,t){return new ys({check:"string_format",format:"regex",...I(t),pattern:e})}function Hn(e){return new xs({check:"string_format",format:"lowercase",...I(e)})}function Kn(e){return new vs({check:"string_format",format:"uppercase",...I(e)})}function qn(e,t){return new ws({check:"string_format",format:"includes",...I(t),includes:e})}function Gn(e,t){return new ks({check:"string_format",format:"starts_with",...I(t),prefix:e})}function Yn(e,t){return new _s({check:"string_format",format:"ends_with",...I(t),suffix:e})}function ct(e){return new zs({check:"overwrite",tx:e})}function Xn(e){return ct(t=>t.normalize(e))}function Qn(){return ct(e=>e.trim())}function eo(){return ct(e=>e.toLowerCase())}function to(){return ct(e=>e.toUpperCase())}function ro(){return ct(e=>yn(e))}function $c(e,t,r){return new e({type:"array",element:t,...I(r)})}function Ec(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function Lc(e,t){let r=Xd(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Lt(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(Lt(i))}},e(n.value,n)),t);return r}function Xd(e,t){let r=new Se({check:"custom",...I(t)});return r._zod.check=e,r}function qt(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Pe(e,n,r[n]);return e}function Yt(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??yt,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 we(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 ce(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 u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let h=s.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,u)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),ce(d,t,u),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&qt(s.schema,c),t.io==="input"&&Ne(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 Nc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Xt(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 d=e.external.registry.get(s[0])?.id,h=e.external.uri??(f=>f);if(d)return{ref:h(d)};let p=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=p,{defId:p,ref:`${h("__shared")}#/${a}/${Nc(p)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Nc(u)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$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 l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){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 Oc(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;Oc(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 Rc=new Set(["type","properties","required","additionalProperties"]),Pc=["oneOf","anyOf"];function Ac(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function no(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Rc.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 l of t){let u=l.properties?.[s]??Ac(l);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let c=a.length===1?a[0]:no(a)??{allOf:a};Pe(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Ac(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Qd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Rc)if(o in e)return;let r=t.filter(o=>Pc.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=no(t);else{let o=r[0],i=Pc.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=>no([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,qt(e,n))}function Qt(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 l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(f)):qt(l,f),qt(l,u),a._zod.parent===d)for(let b in l)b==="$ref"||b==="allOf"||b in u||delete l[b];if(f.$ref&&p.def)for(let b in l)b==="$ref"||b==="allOf"||b in p.def&&JSON.stringify(l[b])===JSON.stringify(p.def[b])&&delete l[b]}let h=a._zod.parent;if(h&&h!==d){n(h);let p=e.seen.get(h);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let f in l)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(l[f])===JSON.stringify(p.def[f])&&delete l[f]}e.override({zodSchema:a,jsonSchema:l,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())Oc(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 l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(l):a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])Qd(l)}}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)}qt(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,Pe(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:Gt(t,"input",e.processors),output:Gt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ne(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 Ne(n.element,r);if(n.type==="set")return Ne(n.valueType,r);if(n.type==="lazy")return Ne(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 Ne(n.innerType,r);if(n.type==="intersection")return Ne(n.left,r)||Ne(n.right,r);if(n.type==="record"||n.type==="map")return Ne(n.keyType,r)||Ne(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ne(n.in,r)||Ne(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ne(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ne(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ne(o,r))return!0;return!!(n.rest&&Ne(n.rest,r))}return!1}var Tc=(e,t={})=>r=>{let n=Yt({...r,processors:t});return ce(e,n),Xt(n,e),Qt(n,e)},Gt=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Yt({...o??{},target:i,io:t,processors:r});return ce(e,s),Xt(s,e),Qt(s,e)};var At=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Ot=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Zc=(e,t)=>{At(e,"minimum",t),Ot(e,"maximum",t)},Dc=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},jc=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Vc=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Bc=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Ic=(e,t)=>At(e,"minimum",t.minimum),Fc=(e,t)=>Ot(e,"maximum",t.maximum),Cc=e=>(t,r)=>{Bc(t,r.format);let[n,o]=e[r.format];At(t,"minimum",n),Ot(t,"maximum",o)},ef={greater_than:(e,t)=>At(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Ot(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Dc(e,t.value),number_format:Cc(Mt),bigint_format:Cc(br),min_length:Ic,max_length:Fc,length_equals:(e,t)=>Zc(e,t.length),min_size:Ic,max_size:Fc,size_equals:(e,t)=>Zc(e,t.size),string_format:(e,t)=>{Bc(e,t.format),t.pattern&&jc(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)=>Vc(e,t.mime)};function Ae(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)ef[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&At(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&At(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Ot(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Ot(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Dc(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Vc(t,o.mime);for(let i of o.patterns??[])jc(t,i);return t}var tf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rf=new Map([[Cn,es],[Or,ts]]),Uc=e=>rf.get(e)??e,so=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Ae(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=tf[a]??a,o.format===""&&delete o.format,(a==="time"||u)&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){let d=[...c].map(Uc);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},ao=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ae(e);o.type=u?"integer":"number";let d=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),h?p?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let f=new Set;for(let y of a)Number.isFinite(y)&&y!==0?f.add(Math.abs(y)):we(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[m,...b]=f;m!==void 0&&(o.multipleOf=m),b.length&&(o.allOf=[...o.allOf??[],...b.map(y=>({multipleOf:y}))])}},co=(e,t,r,n)=>{r.type="boolean"},Wc=(e,t,r,n)=>{we(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Jc=(e,t,r,n)=>{we(e,t,r,n,"Symbols cannot be represented in JSON Schema")},lo=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Hc=(e,t,r,n)=>{we(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Kc=(e,t,r,n)=>{we(e,t,r,n,"Void cannot be represented in JSON Schema")},uo=(e,t,r,n)=>{r.not={}},qc=(e,t,r,n)=>{},fo=(e,t,r,n)=>{},Gc=(e,t,r,n)=>{we(e,t,r,n,"Date cannot be represented in JSON Schema")},po=(e,t,r,n)=>{let o=e._zod.def,i=zt(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},mo=(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(we(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(we(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},Yc=(e,t,r,n)=>{we(e,t,r,n,"NaN cannot be represented in JSON Schema")},Xc=(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},Qc=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Ae(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})))},el=(e,t,r,n)=>{r.type="boolean"},ho=(e,t,r,n)=>{we(e,t,r,n,"Custom types cannot be represented in JSON Schema")},tl=(e,t,r,n)=>{we(e,t,r,n,"Function types cannot be represented in JSON Schema")},go=(e,t,r,n)=>{we(e,t,r,n,"Transforms cannot be represented in JSON Schema")},rl=(e,t,r,n)=>{we(e,t,r,n,"Map cannot be represented in JSON Schema")},nl=(e,t,r,n)=>{we(e,t,r,n,"Set cannot be represented in JSON Schema")},bo=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=Ae(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=ce(i.element,t,{...n,path:[...n.path,"items"]})};function er(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?er(t.out):t.type==="catch"?er(t.innerType):e._zod.optin}var yo=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&we(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Pe(o.properties,l,ce(s[l],t,{...n,path:[...n.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];(t.io==="input"?er(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=ce(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},xo=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ce(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},vo=(e,t,r,n)=>{let o=e._zod.def,i=ce(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=ce(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},wo=(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((m,b)=>ce(m,t,{...n,path:[...n.path,s,b]})),l=i.rest?ce(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let m=i.items[u-1];if(!(t.io==="input"?er(m)!==void 0:m._zod.optout==="optional"))break;u--}let d=i.items.length,h=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,h?o.items=!1:l&&(o.items=l),u>0&&(o.minItems=u),h&&(o.maxItems=d)):t.target==="openapi-3.0"?(o.items={anyOf:c},l&&o.items.anyOf.push(l),u>0&&(o.minItems=u),h&&(o.maxItems=d)):(o.items=c,h?o.additionalItems=!1:l&&(o.additionalItems=l),u>0&&(o.minItems=u),h&&(o.maxItems=d));let{minimum:p,maximum:f}=Ae(e);typeof p=="number"&&(o.minItems=p),typeof f=="number"&&(o.maxItems=f)};function oo(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let m=oo(e,f,r);return m===f?t:m}for(let f of["anyOf","oneOf"]){let m=t[f];if(!Array.isArray(m))continue;let b=m.map(y=>oo(e,y,r));b.some((y,g)=>y!==m[g])&&(t={...t,[f]:b})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(f=>f==="number"||f==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(f=>typeof f=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:h,...p}=t;return p.enum?p.enum=p.enum.map(f=>typeof f=="number"?String(f):f):typeof p.const=="number"&&(p.const=String(p.const)),o&&(p.type="string",i||(p.pattern=(n.includes("number")?Vt:On).source)),p}var io=new WeakMap;function nf(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 io.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=oo(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 ko=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=Ae(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=ce(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Pe(o.patternProperties,Uc(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ce(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let u=io.get(t);u||(u=[],io.set(t,u),t.deferred.push(()=>nf(t))),u.push(e)}o.additionalProperties=ce(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&er(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(o.required=u.map(String))}},_o=(e,t,r,n)=>{let o=e._zod.def,i=ce(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"}]},zo=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},So=Symbol();function ol(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(we(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),So):JSON.parse(s)}var $o=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=ol(o.defaultValue,e,t,r,n);s!==So&&(r.default=s)},Eo=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=ol(o.defaultValue,e,t,r,n);s!==So&&(r._prefault=s)},Lo=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{we(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},No=(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;ce(s,t,n);let a=t.seen.get(e);a.ref=s},Po=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},il=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Vr=(e,t,r,n)=>{let o=e._zod.def;ce(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ao=(e,t,r,n)=>{let o=e._zod.innerType;ce(o,t,n);let i=t.seen.get(e);i.ref=o},Mc={string:so,number:ao,boolean:co,bigint:Wc,symbol:Jc,null:lo,undefined:Hc,void:Kc,never:uo,any:qc,unknown:fo,date:Gc,enum:po,literal:mo,nan:Yc,template_literal:Xc,file:Qc,success:el,custom:ho,function:tl,transform:go,map:rl,set:nl,array:bo,object:yo,union:xo,intersection:vo,tuple:wo,record:ko,nullable:_o,nonoptional:zo,default:$o,prefault:Eo,catch:Lo,pipe:No,readonly:Po,promise:il,optional:Vr,lazy:Ao};function Oo(e,t){if("_idmap"in e){let n=e,o=Yt({...t,processors:Mc}),i={};for(let c of n._idmap.entries()){let[l,u]=c;ce(u,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[l,u]=c;Xt(o,u),Pe(s,l,Qt(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=Yt({...t,processors:Mc});return ce(e,r),Xt(r,e),Qt(r,e)}var sl=new WeakSet([Object.prototype,Error.prototype]);function Ur(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 pf=(e,t)=>{Ei.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sl.has(r)||(sl.add(r),Ur(r,"format",n=>o=>Ni(n,o)),Ur(r,"flatten",n=>o=>Li(n,o)),Ur(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,St,2)}),Ur(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,St,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Ze=w("ZodError",pf,void 0,{Parent:Error});var al=kr(Ze),cl=_r(Ze),ll=zr(Ze),ul=Sr(Ze),dl=Ai(Ze),fl=Oi(Ze),pl=Ri(Ze),ml=Ti(Ze),hl=Zi(Ze),gl=Ii(Ze),bl=Fi(Ze),yl=Ci(Ze);function hf(){Le.localeError||Te(Ua())}function tr(){Le.memoizer||Te({memoizer:Ba()})}var le=w("ZodType",(e,t)=>(hf(),se.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C.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 Me(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mp(e,t))},superRefine(e,t){return this.check(hp(e,t))},overwrite(e){return this.check(ct(e))},optional(){return wl(this)},exactOptional(){return Qf(this)},nullable(){return kl(this)},nullish(){return wl(kl(this))},nonoptional(e){return ip(this,e)},array(){return pe(this)},or(e){return lt([this,e])},and(e){return Kf(this,e)},transform(e){return _l(this,Xf(e))},default(e){return rp(this,e)},prefault(e){return op(this,e)},catch(e){return ap(this,e)},pipe(e){return _l(this,e)},readonly(){return up(this)},describe(e){let t=this.clone();return yt.add(t,{description:e}),t},meta(...e){if(e.length===0)return yt.get(this);let t=this.clone();return yt.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 C.hide(this,"~standard",{...Fn(this),jsonSchema:{input:Gt(this,"input"),output:Gt(this,"output")}})},set"~standard"(e){C.own(this,"~standard",e)},parse:function e(t,r){return al(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await cl(this,t,r,{callee:e})},safeParse(e,t){return ll(this,e,t)},async safeParseAsync(e,t){return ul(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){C.own(this,"spa",e)},validate(e,t){return Ln(this,e,t)},validateAsync(e,t){return Nn(this,e,t)},encode:function e(t,r){return dl(this,t,r,{callee:e})},decode:function e(t,r){return fl(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await pl(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ml(this,t,r,{callee:e})},safeEncode(e,t){return hl(this,e,t)},safeDecode(e,t){return gl(this,e,t)},async safeEncodeAsync(e,t){return bl(this,e,t)},async safeDecodeAsync(e,t){return yl(this,e,t)},toJSONSchema(e){return Tc(this,{})(e)},get description(){return yt.get(this)?.description},get _def(){return this._zod.def}}),zl=w("_ZodString",(e,t)=>{Ar.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>so(e,r,n,o)},C.derived({format:e=>Ae(e).format??null,minLength:e=>Ae(e).minimum??null,maxLength:e=>Ae(e).maximum??null},{regex(...e){return this.check(Jn(...e))},includes(...e){return this.check(qn(...e))},startsWith(...e){return this.check(Gn(...e))},endsWith(...e){return this.check(Yn(...e))},min(...e){return this.check(Pt(...e))},max(...e){return this.check(Dr(...e))},length(...e){return this.check(jr(...e))},nonempty(...e){return this.check(Pt(1,...e))},lowercase(e){return this.check(Hn(e))},uppercase(e){return this.check(Kn(e))},trim(){return this.check(Qn())},normalize(...e){return this.check(Xn(...e))},toLowerCase(){return this.check(eo())},toUpperCase(){return this.check(to())},slugify(){return this.check(ro())}})),gf=w("ZodString",(e,t)=>{Ar.init(e,t),zl.init(e,t)},{email(e){return this.check(Ka(wf,e))},url(e){return this.check(ec(_f,e))},jwt(e){return this.check(hc(Cf,e))},emoji(e){return this.check(tc(zf,e))},guid(e){return this.check(qa(kf,e))},uuid(e){return this.check(Ga(Wr,e))},uuidv4(e){return this.check(Ya(Wr,e))},uuidv6(e){return this.check(Xa(Wr,e))},uuidv7(e){return this.check(Qa(Wr,e))},nanoid(e){return this.check(rc(Sf,e))},cuid(e){return this.check(nc($f,e))},cuid2(e){return this.check(oc(Ef,e))},ulid(e){return this.check(ic(Lf,e))},base64(e){return this.check(fc(Zf,e))},base64url(e){return this.check(pc(If,e))},xid(e){return this.check(sc(Nf,e))},ksuid(e){return this.check(ac(Pf,e))},ipv4(e){return this.check(cc(Af,e))},ipv6(e){return this.check(lc(Of,e))},cidrv4(e){return this.check(uc(Rf,e))},cidrv6(e){return this.check(dc(Tf,e))},e164(e){return this.check(mc(Ff,e))},datetime(e){return this.check(gc(bf,e))},date(e){return this.check(bc(yf,e))},time(e){return this.check(yc(xf,e))},duration(e){return this.check(xc(vf,e))}});function A(e){return Ha(gf,e)}var fe=w("ZodStringFormat",(e,t)=>{de.init(e,t),zl.init(e,t)}),bf=w("ZodISODateTime",(e,t)=>{ea.init(e,t),fe.init(e,t)}),yf=w("ZodISODate",(e,t)=>{ta.init(e,t),fe.init(e,t)}),xf=w("ZodISOTime",(e,t)=>{ra.init(e,t),fe.init(e,t)}),vf=w("ZodISODuration",(e,t)=>{na.init(e,t),fe.init(e,t)}),wf=w("ZodEmail",(e,t)=>{Bs.init(e,t),fe.init(e,t)});var kf=w("ZodGUID",(e,t)=>{js.init(e,t),fe.init(e,t)});var Wr=w("ZodUUID",(e,t)=>{Vs.init(e,t),fe.init(e,t)});var _f=w("ZodURL",(e,t)=>{Js.init(e,t),fe.init(e,t)});var zf=w("ZodEmoji",(e,t)=>{Hs.init(e,t),fe.init(e,t)});var Sf=w("ZodNanoID",(e,t)=>{Ks.init(e,t),fe.init(e,t)});var $f=w("ZodCUID",(e,t)=>{qs.init(e,t),fe.init(e,t)});var Ef=w("ZodCUID2",(e,t)=>{Gs.init(e,t),fe.init(e,t)});var Lf=w("ZodULID",(e,t)=>{Ys.init(e,t),fe.init(e,t)});var Nf=w("ZodXID",(e,t)=>{Xs.init(e,t),fe.init(e,t)});var Pf=w("ZodKSUID",(e,t)=>{Qs.init(e,t),fe.init(e,t)});var Af=w("ZodIPv4",(e,t)=>{oa.init(e,t),fe.init(e,t)});var Of=w("ZodIPv6",(e,t)=>{sa.init(e,t),fe.init(e,t)});var Rf=w("ZodCIDRv4",(e,t)=>{aa.init(e,t),fe.init(e,t)});var Tf=w("ZodCIDRv6",(e,t)=>{ca.init(e,t),fe.init(e,t)});var Zf=w("ZodBase64",(e,t)=>{ua.init(e,t),fe.init(e,t)});var If=w("ZodBase64URL",(e,t)=>{da.init(e,t),fe.init(e,t)});var Ff=w("ZodE164",(e,t)=>{fa.init(e,t),fe.init(e,t)});var Cf=w("ZodJWT",(e,t)=>{pa.init(e,t),fe.init(e,t)});var Sl=w("ZodNumber",(e,t)=>{Mn.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ao(e,r,n,o),e.isFinite=!0},C.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Ae(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Ae(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Ae(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Ae(e).format??null},{gt(e,t){return this.check(Cr(e,t))},gte(e,t){return this.check(Kt(e,t))},min(e,t){return this.check(Kt(e,t))},lt(e,t){return this.check(Fr(e,t))},lte(e,t){return this.check(Ht(e,t))},max(e,t){return this.check(Ht(e,t))},int(e){return this.check(Je(e))},safe(e){return this.check(Je(e))},positive(e){return this.check(Cr(0,e))},nonnegative(e){return this.check(Kt(0,e))},negative(e){return this.check(Fr(0,e))},nonpositive(e){return this.check(Ht(0,e))},multipleOf(e,t){return this.check(Mr(e,t))},step(e,t){return this.check(Mr(e,t))},finite(){return this}}));function Be(e){return vc(Sl,e)}var Mf=w("ZodNumberFormat",(e,t)=>{ma.init(e,t),Sl.init(e,t)});function Je(e){return wc(Mf,e)}var Df=w("ZodBoolean",(e,t)=>{ha.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>co(e,r,n,o)});function He(e){return kc(Df,e)}var jf=w("ZodNull",(e,t)=>{ga.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lo(e,r,n,o)});function Vf(e){return _c(jf,e)}var Bf=w("ZodUnknown",(e,t)=>{ba.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fo(e,r,n,o)});function xl(){return zc(Bf)}var Uf=w("ZodNever",(e,t)=>{ya.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uo(e,r,n,o)});function $l(e){return Sc(Uf,e)}var Wf=w("ZodArray",(e,t)=>{tr(),xa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bo(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Pt(e,t))},nonempty(e){return this.check(Pt(1,e))},max(e,t){return this.check(Dr(e,t))},length(e,t){return this.check(jr(e,t))},unwrap(){return this.element}});function pe(e,t){return $c(Wf,e,t)}var El=w("ZodObject",(e,t)=>{tr(),ka.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yo(e,r,n,o),C.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ke(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(C.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(C.mergeDefs(this._zod.def,{catchall:xl()}))},loose(){return this.clone(C.mergeDefs(this._zod.def,{catchall:xl()}))},strict(){return this.clone(C.mergeDefs(this._zod.def,{catchall:$l()}))},strip(){return this.clone(C.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return C.extend(this,e)},safeExtend(e){return C.safeExtend(this,e)},merge(e){return C.merge(this,e)},pick(e){return C.pick(this,e)},omit(e){return C.omit(this,e)},partial(...e){return C.partial(To,this,e[0])},exactPartial(...e){return C.partial(Pl,this,e[0],"exactPartial")},required(...e){return C.required(Al,this,e[0])}});function me(e,t){let r={type:"object",shape:e??{},...C.normalizeParams(t)};return new El(r)}function ge(e,t){return new El({type:"object",shape:e,catchall:$l(),...C.normalizeParams(t)})}var Ll=w("ZodUnion",(e,t)=>{Dn.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function lt(e,t){return new Ll({type:"union",options:e,...C.normalizeParams(t)})}var Jf=w("ZodDiscriminatedUnion",(e,t)=>{Ll.init(e,t),_a.init(e,t)});function ut(e,t,r){return new Jf({type:"union",options:t,discriminator:e,...C.normalizeParams(r)})}var Hf=w("ZodIntersection",(e,t)=>{za.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vo(e,r,n,o)});function Kf(e,t){return new Hf({type:"intersection",left:e,right:t})}var qf=w("ZodTuple",(e,t)=>{tr(),Sa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wo(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 To({type:"optional",innerType:t}))})}});function Nl(e,t,r){let n=t instanceof se,o=n?r:t,i=n?t:null;return new qf({type:"tuple",items:e,rest:i,...C.normalizeParams(o)})}var vl=w("ZodRecord",(e,t)=>{tr(),$a.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function dt(e,t,r){return!t||!t._zod?new vl({type:"record",keyType:A(),valueType:e,...C.normalizeParams(t)}):new vl({type:"record",keyType:e,valueType:t,...C.normalizeParams(r)})}var Ro=w("ZodEnum",(e,t)=>{Ea.init(e,t),le.init(e,t),e._zod.processJSONSchema=(n,o,i)=>po(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 Ro({...t,checks:[],...C.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 Ro({...t,checks:[],...C.normalizeParams(o),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ro({type:"enum",entries:r,...C.normalizeParams(t)})}var Gf=w("ZodLiteral",(e,t)=>{La.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(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 G(e,t){return new Gf({type:"literal",values:Array.isArray(e)?e:[e],...C.normalizeParams(t)})}var Yf=w("ZodTransform",(e,t)=>{tr(),Na.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>go(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(C.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(C.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 Xf(e){return new Yf({type:"transform",transform:e})}var To=w("ZodOptional",(e,t)=>{jn.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wl(e){return new To({type:"optional",innerType:e})}var Pl=w("ZodExactOptional",(e,t)=>{Pa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qf(e){return new Pl({type:"optional",innerType:e})}var ep=w("ZodNullable",(e,t)=>{Aa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_o(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kl(e){return new ep({type:"nullable",innerType:e})}var tp=w("ZodDefault",(e,t)=>{Oa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$o(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rp(e,t){return new tp({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var np=w("ZodPrefault",(e,t)=>{Ra.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function op(e,t){return new np({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var Al=w("ZodNonOptional",(e,t)=>{Ta.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ip(e,t){return new Al({type:"nonoptional",innerType:e,...C.normalizeParams(t)})}var sp=w("ZodCatch",(e,t)=>{Za.init(e,t),le.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 ap(e,t){return new sp({type:"catch",innerType:e,catchValue:typeof t=="function"?t:C.constantCatch(t)})}var cp=w("ZodPipe",(e,t)=>{Ia.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>No(e,r,n,o),e.in=t.in,e.out=t.out});function _l(e,t){return new cp({type:"pipe",in:e,out:t})}var lp=w("ZodReadonly",(e,t)=>{Fa.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Po(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function up(e){return new lp({type:"readonly",innerType:e})}var dp=w("ZodLazy",(e,t)=>{Ca.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ao(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function fp(e){return new dp({type:"lazy",getter:e})}var pp=w("ZodCustom",(e,t)=>{Ma.init(e,t),le.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o)});function mp(e,t={}){return Ec(pp,e,t)}function hp(e,t){return Lc(e,t)}function Ol(e){let t=fp(()=>lt([A(e),Be(),He(),Vf(),pe(t),dt(A(),t)]));return t}var Rt=Ol().meta({id:"JsonValue"});var Fe=/^[A-Za-z_][A-Za-z0-9_]*$/,Rl=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"],rr=me({value:lt([A(),Be()]),label:A()}).strict().meta({id:"Option"}),Zo=me({field:A().min(1),op:Ke(["=","!=","<",">","<=",">=","in","not in","like","ilike"]),value:Rt.optional(),valueFrom:A().regex(Fe).optional()}).strict().refine(e=>e.value===void 0!=(e.valueFrom===void 0),{message:"set exactly one of value or valueFrom"}).meta({id:"FilterCondition"}),ke={label:A(),help:A().optional(),required:He().optional(),readonly:He().optional(),default:Rt.optional()},Tl=Je().positive().optional(),Zl=Nl([Je().positive(),Je().nonnegative()]).optional(),Io=A().min(1),Il=pe(Zo).optional(),Fl=me({type:G("char"),...ke,size:Tl,pattern:A().optional()}).strict(),Cl=me({type:G("text"),...ke,size:Tl}).strict(),Ml=me({type:G("html"),...ke}).strict(),Dl=me({type:G("integer"),...ke,min:Be().optional(),max:Be().optional()}).strict(),jl=me({type:G("float"),...ke,min:Be().optional(),max:Be().optional(),digits:Zl}).strict(),Vl=me({type:G("monetary"),...ke,currencyField:A().regex(Fe).optional(),currency:A().regex(/^[A-Z]{3}$/).optional(),min:Be().optional(),max:Be().optional(),digits:Zl}).strict(),Bl=me({type:G("boolean"),...ke}).strict(),Ul=me({type:G("date"),...ke}).strict(),Wl=me({type:G("datetime"),...ke}).strict(),Jl=me({type:G("selection"),...ke,options:pe(rr).min(1),multiple:He().optional()}).strict(),Hl=me({type:G("binary"),...ke,accept:pe(A()).optional(),maxSize:Je().positive().optional()}).strict(),Kl=me({type:G("image"),...ke,maxSize:Je().positive().optional()}).strict(),ql=me({type:G("many2one"),...ke,relation:Io,filter:Il}).strict(),Gl=me({type:G("many2many"),...ke,relation:Io,filter:Il}).strict(),Yl=me({type:G("reference"),...ke,models:pe(rr).min(1)}).strict(),Fo=me({name:A().regex(Fe),label:A(),type:Ke(["char","text","integer","float","boolean","selection","date"]),options:pe(rr).min(1).optional()}).strict().meta({id:"PropertyDefinition"}),Xl=me({type:G("properties"),...ke,definitions:pe(Fo).optional()}).strict(),Ql=me({type:G("json"),...ke}).strict(),Co=ut("type",[Fl,Cl,Ml,Dl,jl,Vl,Bl,Ul,Wl,Jl,Hl,Kl,ql,Gl,Yl,Xl,Ql]).meta({id:"LineField"}),Mo=me({field:A().regex(Fe),text:A().regex(Fe),section:A().min(1).optional(),note:A().min(1).optional()}).strict().meta({id:"LineKinds"}),gp=me({type:G("one2many"),...ke,relation:Io,fields:dt(A().regex(Fe),Co),lineKinds:Mo.optional(),sequenceField:A().regex(Fe).optional()}).strict(),Do=ut("type",[Fl,Cl,Ml,Dl,jl,Vl,Bl,Ul,Wl,Jl,Hl,Kl,ql,Gl,gp,Yl,Xl,Ql]).meta({id:"Field"}),Hr=dt(A().regex(Fe),Do);var nr=lt([He(),A().min(1)]).meta({id:"Modifier"}),Oe=A().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),et=A().regex(Fe),eu=Ke(["info","success","warning","danger","muted"]),Ue=nr.optional(),bp=ge({type:G("field"),id:Oe,field:et,label:A().optional(),widget:A().min(1).optional(),options:dt(A(),Rt).optional(),placeholder:A().optional(),help:A().optional(),colspan:Je().min(1).max(4).optional(),columns:pe(et).min(1).optional(),totals:pe(et).min(1).optional(),optionalColumns:dt(et,Ke(["show","hide"])).optional(),editMode:Ke(["cell","row"]).optional(),invisible:Ue,readonly:nr.optional(),required:nr.optional()}),tu=ge({type:G("button"),id:Oe,label:A(),action:A().min(1),params:dt(A(),Rt).optional(),style:Ke(["primary","secondary","danger","link"]).optional(),confirm:A().optional(),icon:A().optional(),invisible:Ue}),yp=ge({type:G("text"),id:Oe,text:A(),style:Ke(["heading","paragraph","note"]).optional(),invisible:Ue}),ru=ge({type:G("slot"),id:Oe,name:A().min(1),invisible:Ue}),xp=ge({type:G("section"),id:Oe,title:A().optional(),description:A().optional(),columns:lt([G(1),G(2),G(3),G(4)]).optional(),collapsible:He().optional(),collapsed:He().optional(),invisible:Ue,get children(){return pe(xt)}}).meta({id:"SectionNode"}),vp=ge({type:G("tab"),id:Oe,label:A(),icon:A().optional(),invisible:Ue,get children(){return pe(xt)}}).meta({id:"TabNode"}),nu=ge({type:G("tabs"),id:Oe,invisible:Ue,children:pe(vp).min(1)}).meta({id:"TabsNode"}),xt=ut("type",[bp,tu,yp,ru,xp,nu]).meta({id:"LayoutNode"}),wp=ge({type:G("step"),id:Oe,label:A(),description:A().optional(),invisible:Ue,get children(){return pe(xt)}}).meta({id:"StepNode"}),kp=ge({type:G("wizard"),id:Oe,children:pe(wp).min(1)}).meta({id:"WizardNode"}),_p=ge({type:G("sections"),id:Oe,get children(){return pe(xt)}}).meta({id:"SectionsNode"}),zp=ge({id:Oe,label:A(),action:A().min(1),field:et.optional(),icon:A().optional(),invisible:Ue}),Sp=ge({id:Oe,label:A(),tone:eu.optional(),invisible:Ue}),$p=ge({id:Oe,message:A(),tone:eu.optional(),invisible:Ue}),Ep=ge({type:G("sheet"),id:Oe,title:ge({field:et,subtitleField:et.optional(),avatarField:et.optional(),placeholder:A().optional()}).optional(),statusbar:ge({field:et,visibleStates:pe(lt([A(),Be()])).optional(),clickable:He().optional()}).optional(),buttons:pe(tu).optional(),statButtons:pe(zp).optional(),ribbon:Sp.optional(),alerts:pe($p).optional(),get children(){return pe(xt)},sidePanel:ru.optional()}).meta({id:"SheetNode"}),Kr=ut("type",[Ep,_p,nu,kp]).meta({id:"RootLayout"});var jo="0.1",Lp=ut("kind",[ge({kind:G("record"),model:A().min(1)}),ge({kind:G("responses")})]),Tt=ge({fieldia:G(jo),id:A().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/),title:A().optional(),description:A().optional(),data:Lp,fields:Hr,layout:Kr}).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 vt(e,t){switch(e.type){case"BinaryOp":return Np(e,t);case"UnaryOp":return Pp(e,t);case"Literal":return e.value;case"Identifier":return Ap(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Np(e,t){let r=ou(vt(e.left,t)),n=ou(vt(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 tt(r)&&tt(n);case"or":return tt(r)||tt(n);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function Pp(e,t){let r=vt(e.operand,t);if(e.operator.toLowerCase()==="not")return!tt(r);throw new Error(`Unknown unary operator: ${e.operator}`)}function ou(e){return e===void 0?null:e}function tt(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Ap(e,t){let r=t.split("."),n=e;for(let o of r){if(n==null)return;n=n[o]}return n}var Vo=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function or(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:Op(i[0]),value:i[0],position:t.length}),o=r.lastIndex}}function Op(e){let t=e.toLowerCase().trim();return Vo.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 wt=class{constructor(t){ht(this,"tokens");ht(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:Vo.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:Rp(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 Rp(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let r=[],n="",o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];(a==="'"||a==='"')&&(s===0||t[s-1]!=="\\")&&(o?a===i&&(o=!1,i=""):(o=!0,i=a)),a===","&&!o?(r.push(iu(n.trim())),n=""):n+=a}return n.trim()&&r.push(iu(n.trim())),r}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function iu(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function ft(e){if(typeof e!="string"){let r=e===!0;return{source:e,fields:[],evaluate:()=>r}}let t=new wt(or(e)).parse();return{source:e,fields:Tp(t),evaluate(r){try{return tt(vt(t,r))}catch{return!1}}}}function Tp(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 Gr(e){let t=Tt.safeParse(e);if(!t.success)return{ok:!1,issues:t.error.issues.map(o=>({path:Zp(o.path),message:Ip(o)}))};let r=t.data,n=new Bo(r).run();return n.length?{ok:!1,issues:n}:{ok:!0,page:r}}function Zp(e){return e.length===0?"(page)":e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?String(t):`.${String(t)}`).join("")}function Ip(e){return e.code==="invalid_union"&&"discriminator"in e&&e.discriminator?`"${e.discriminator}" is not one of the kinds allowed here`:e.message}var qr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bo=class{constructor(t){ht(this,"page",t);ht(this,"issues",[]);ht(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(qr(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=ft(i).fields}catch(a){this.report(`${r}.${o}`,`cannot read "${i}": ${a.message}`);continue}for(let a of s)qr(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`)}if((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==="properties"&&o.definitions){let s=new Set;o.definitions.forEach((a,c)=>{a.type==="selection"&&!a.options&&this.report(`${i}.definitions[${c}].options`,"a choice property needs its choices"),s.has(a.name)&&this.report(`${i}.definitions[${c}].name`,`"${a.name}" is named twice`),s.add(a.name)})}if(o.type==="one2many"&&(this.checkFields(o.fields,`${i}.fields`),o.lineKinds&&this.checkLineKinds(n,o.lineKinds,o.fields,`${i}.lineKinds`),o.sequenceField!==void 0)){let s=o.fields[o.sequenceField];s?s.type!=="integer"&&this.report(`${i}.sequenceField`,`"${o.sequenceField}" is a ${s.type}; the field that keeps the order of lines must be an integer`):this.report(`${i}.sequenceField`,`"${o.sequenceField}" is not a field of the lines of "${n}"`)}}}checkLineKinds(t,r,n,o){let i=n[r.field];if(!i)this.report(`${o}.field`,`"${r.field}" is not a field of the lines of "${t}"`);else if(i.type!=="selection"&&i.type!=="char")this.report(`${o}.field`,`"${r.field}" is a ${i.type}; the field that says what a line is must be a selection or char`);else if(i.type==="selection")for(let a of["section","note"]){let c=r[a]??a;i.options.some(l=>l.value===c)||this.report(`${o}.${a}`,`"${r.field}" has no option "${c}"`)}let s=n[r.text];s?s.type!=="char"&&s.type!=="text"&&this.report(`${o}.text`,`"${r.text}" is a ${s.type}; a section's or note's text must be a char or text field`):this.report(`${o}.text`,`"${r.text}" is not a field of the lines of "${t}"`)}walkRoot(t,r){if(t.type==="tabs")return this.walkNode(t,r);if(this.claim(t.id,r),t.type==="sheet")return this.walkSheet(t,r);if(t.type==="sections")return this.walkChildren(t.children,r);t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkChildren(t,r){t.forEach((n,o)=>this.walkNode(n,`${r}.children[${o}]`))}walkNode(t,r){switch(this.claim(t.id,r),this.checkModifiers(t,r,t.type==="field"?["invisible","readonly","required"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,r);case"section":return t.collapsible&&!t.title&&this.report(r,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(r,"collapsed needs collapsible: true"),this.walkChildren(t.children,r);case"tabs":return this.walkTabs(t,r);default:return}}walkTabs(t,r){t.children.forEach((n,o)=>{let i=`${r}.children[${o}]`;this.claim(n.id,i),this.checkModifiers(n,i),this.walkChildren(n.children,i)})}walkSheet(t,r){if(t.title&&(this.need(t.title.field,`${r}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${r}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${r}.title.avatarField`)),t.statusbar){let{field:n,visibleStates:o}=t.statusbar,i=this.need(n,`${r}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${r}.statusbar.field`,`"${n}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&o){let s=new Set(i.options.map(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.totals&&(n.type!=="one2many"?this.report(`${r}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${n.type}`):t.totals.forEach((o,i)=>{let s=qr(n.fields,o)?n.fields[o]:void 0;s?["integer","float","monetary"].includes(s.type)||this.report(`${r}.totals[${i}]`,`"${o}" is a ${s.type}; only integer, float and monetary columns add up`):this.report(`${r}.totals[${i}]`,`"${o}" is not a field of the lines of "${t.field}"`)}));for(let[o,i]of Object.entries(t.options??{}))o.endsWith("Field")&&typeof i=="string"&&this.need(i,`${r}.options.${o}`);if(n&&t.editMode&&n.type!=="one2many"&&this.report(`${r}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${n.type}`),n&&t.optionalColumns)if(n.type!=="one2many")this.report(`${r}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${n.type}`);else{let o=t.columns??Object.keys(n.fields).filter(i=>i!==n.lineKinds?.field&&i!==n.sequenceField);for(let i of Object.keys(t.optionalColumns))o.includes(i)||this.report(`${r}.optionalColumns.${i}`,`"${i}" is not a column of "${t.field}"`)}!n||!t.columns||(n.type==="one2many"?t.columns.forEach((o,i)=>{qr(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 su(){return Oo(Tt,{target:"draft-2020-12"})}function au(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=or(e);if(r.length===0)return!1;let o=new wt(r).parse(),i=vt(o,t);return tt(i)}catch{return!1}}function cu(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=or(e);return t.length===0||new wt(t).parse(),!0}catch{return!1}}function ir(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function Zt(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.default!==void 0?ae(n.default):ir(n);return t}function It(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function sr(e,t){let r={};for(let[n,o]of Object.entries(e)){let i=t[n];r[n]=i?Fp(i,o):o}return r}function Fp(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 pt(e,t){let r=e.lineKinds;if(!r)return null;let n=t[r.field];return n===(r.section??"section")?"section":n===(r.note??"note")?"note":null}function ae(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var mt={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 Yr(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>n in t?String(t[n]):r)}function ar(e,t,r,n=mt.en){let o=e.label||"This field",i=(s,a={})=>Yr(n[s],{label:o,...a});if(It(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&&Cp(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 Mp(t,i);case"datetime":return jp(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 Uo(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Uo)?void 0:i("records");case"reference":{let s=t;if(!Uo(t)||typeof s.model!="string")return i("record");if(!e.models.some(a=>a.value===s.model)){let a=uu(e.models.map(c=>c.label),n.or);return i("reference",{models:a,aModels:du(a)})}return}case"binary":case"image":return Vp(e,t,i,n);default:return}}function Cp(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 Uo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function Mp(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 lu(r,n,o)?void 0:t("dateInvalid")}var Dp=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function jp(e,t){let r=typeof e=="string"?Dp.exec(e):null;if(!r)return t("datetimeFormat");let[n,o,i,s,a,c]=r.slice(1).map(l=>Number(l??0));return lu(n,o,i)&&s<24&&a<60&&c<60?void 0:t("datetimeInvalid")}function lu(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 Vp(e,t,r,n){let o=t;if(!Bp(t))return r("file");if("maxSize"in e&&e.maxSize!==void 0&&o.size>e.maxSize)return r("fileSize",{size:cr(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>Up(i,o.type))){let i=uu(e.accept.map(Wp),n.or);return r("fileType",{types:i,aTypes:du(i)})}}function Bp(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function Up(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function Wp(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function uu(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 cr(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 lr={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Xr(e,t=lr){return new Promise(r=>{t.setTimeout(r,e)})}function fu(e={}){let t=ae(e.records??{}),r=[],n=[],o=1e3,i=()=>e.delayMs?Xr(e.delayMs,e.scheduler):Promise.resolve(),s=p=>t[p]??(t[p]={}),a=(p,f)=>{let m=s(p)[String(f)]?.[e.labelField?.[p]??"name"];return typeof m=="string"?m:String(f)},c=p=>Math.max(0,...Object.keys(s(p)).map(Number).filter(Number.isFinite))+1,l=p=>Number.isFinite(Number(p))?Number(p):p;function u(p,f){let m=[...p];for(let b of f)b.op==="create"?m.push({key:b.key,id:++o,values:ae(b.values)}):b.op==="update"?m=m.map(y=>y.id===b.id?{...y,values:{...y.values,...ae(b.values)}}:y):m=m.filter(y=>y.id!==b.id);return m}function d(p,f,m){let b=[...p],y=g=>({id:g,label:a(m,g)});for(let g of f)g.op==="link"&&!b.some(S=>S.id===g.id)?b.push(y(g.id)):g.op==="unlink"?b=b.filter(S=>S.id!==g.id):g.op==="set"?b=g.ids.map(y):g.op==="clear"&&(b=[]);return b}function h(p,f){let m=p[f];return m&&"relation"in m?m.relation:f}return{records:t,responses:r,calls:n,async load(p){n.push({method:"load",request:p}),await i();let f=s(p.model)[String(p.id)];if(!f)throw new Error(`No ${p.model} record with id ${p.id}`);return ae(f)},async save(p){n.push({method:"save",request:p}),await i();let f=p.id??c(p.model),m={...s(p.model)[String(f)]??{},...ae(p.changes.values)};for(let[b,y]of Object.entries(p.changes.lines))m[b]=u(m[b]??[],y);for(let[b,y]of Object.entries(p.changes.links))m[b]=d(m[b]??[],y,h(p.fields,b));return s(p.model)[String(f)]=m,{id:f,values:ae(m)}},async onchange(p){n.push({method:"onchange",request:p}),await i();let f=e.onchange?.[p.model]?.[p.changed],m=e.warnings?.[p.model]?.[p.changed],b=f?{values:f(ae(p.values))}:{},y=m?.(ae(p.values));return y?{...b,warning:y}:b},async search(p){n.push({method:"search",request:p}),await i();let f=p.query.trim().toLowerCase();return Object.entries(s(p.model)).filter(([,m])=>(p.filter??[]).every(b=>Jp(m,b))).map(([m])=>({id:l(m),label:a(p.model,l(m))})).filter(m=>m.label.toLowerCase().includes(f)).slice(0,p.limit??8)},async create(p){n.push({method:"create",request:p}),await i();let f=s(p.model),m=Object.keys(f).reduce((b,y)=>Math.max(b,Number(y)||0),0)+1;return f[String(m)]={name:p.name},{id:m,label:p.name}},async submit(p){return n.push({method:"submit",request:p}),await i(),r.push(ae(p)),{id:r.length}}}}function Jp(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 Qr(e){let{page:t}=e,r=e.scheduler??lr,n=e.messages??mt.en,o=qp(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(x=>x.id):[],s=()=>`fieldia:draft:${t.id}:${c.recordId??"new"}`,a={...Zt(t.fields),...ae(e.values??{})},c={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:ae(a),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null},l=0,u=0,d=null,h=null,p=new Set,f=new Set,m=null;function b(x){c={...c,...x};for(let k of[...f])k(c)}function y(x){p.add(x);let k=()=>p.delete(x);return x.then(k,k),x}function g(){return m?.values!==c.values&&(m={values:c.values,context:sr(c.values,t.fields)}),m.context}function S(x){let k=t.fields[x];if(!k)throw new Error(`The page has no field "${x}"`);return k}function z(x){return Object.keys(t.fields).filter(k=>JSON.stringify(x[k]??null)!==JSON.stringify(a[k]??null))}function _(x){let k=o.get(x);if(!k)throw new Error(`The page has no element "${x}"`);let $=g(),N=k.invisible.evaluate($);for(let O=k.parent;!N&&O;O=o.get(O)?.parent??null)N=o.get(O)?.invisible.evaluate($)??!1;let D=k.field?t.fields[k.field]:void 0;return{invisible:N,readonly:k.readonly.evaluate($)||D?.readonly===!0,required:k.required.evaluate($)||D?.required===!0}}function E(x){let k=$=>{if(!x)return!0;for(let N=$.id;N;N=o.get(N)?.parent??null)if(N===x)return!0;return!1};return[...o.values()].filter($=>$.kind==="field"&&k($)&&!_($.id).invisible)}function L(x){let k={};for(let $ of E(x)){let N=$.field;if(k[N])continue;let D=t.fields[N],O=ar(D,c.values[N],_($.id).required,n);if(O&&(k[N]=O),D.type==="one2many")for(let Q of c.values[N]??[]){let te=pt(D,Q.values);for(let[be,Ee]of Object.entries(D.fields)){if(te&&be!==D.lineKinds?.text)continue;let ve=ar(Ee,Q.values[be],Ee.required===!0,n);ve&&(k[`${N}.${Q.key}.${be}`]=ve)}}}return k}function T(x,k={}){let $=Object.keys(c.errors).length?U(x):c.errors;b({values:x,dirty:z(x),errors:$,...k})}function U(x){let k=c;c={...c,values:x};let $=L(c.step??void 0);c=k;let N={};for(let D of Object.keys(c.errors))$[D]&&(N[D]=$[D]);return N}function W(){let x=e.drafts;x&&(d!==null&&r.clearTimeout(d),d=r.setTimeout(()=>{d=null,x.store.setItem(s(),JSON.stringify({savedAt:new Date().toISOString(),values:c.values}))},x.delayMs??400))}function ne(){d!==null&&r.clearTimeout(d),d=null,e.drafts?.store.removeItem(s())}function Y(){let x=e.drafts;if(!x)return;let k=x.store.getItem(s());if(!k)return;let $;try{$=JSON.parse(k)}catch{x.store.removeItem(s());return}x.restore==="auto"?T({...c.values,...$.values},{draft:null}):b({draft:{savedAt:$.savedAt}})}function X(){let x=e.autosave;!x||t.data.kind!=="record"||(h!==null&&r.clearTimeout(h),h=r.setTimeout(()=>{h=null,c.dirty.length&&Object.keys(L()).length===0&&y(M())},x.delayMs))}function ie(x){let k=e.dataSource;if(!k?.onchange||t.data.kind!=="record")return;let $=++u,N={model:t.data.model,id:c.recordId,changed:x,values:ae(c.values)};y(k.onchange(N).then(D=>{if($!==u)return;let O={...c.values,...D.values??{}};T(O,{warning:D.warning??null,warningField:D.warning?x:null})},()=>{}))}function q(x){W(),X(),ie(x)}function V(){let x={values:{},lines:{},links:{}},k=c.recordId===null||c.recordId===void 0,$=k?Object.keys(t.fields).filter(N=>c.dirty.includes(N)||!It(t.fields[N],c.values[N])):c.dirty;for(let N of $){let D=t.fields[N],O=c.values[N],Q=k?ir(D):a[N];D.type==="one2many"?x.lines[N]=Hp(Q??[],O??[]):D.type==="many2many"?x.links[N]=Kp(Q??[],O??[]):x.values[N]=ae(O)}return x}function R(){let x={};for(let k of E()){let $=k.field;x[$]=ae(c.values[$])}return x}async function M(){let x=L();if(Object.keys(x).length)return b({errors:x}),!1;let k=e.dataSource;b({status:"saving",errors:{},error:null});try{if(t.data.kind==="responses"){if(!k?.submit)throw new Error("This page has no data source to send its answers to");return await k.submit({pageId:t.id,values:R()}),ne(),b({status:"saved"}),!0}if(!k?.save)throw new Error("This page has no data source to save to");let $=await k.save({model:t.data.model,id:c.recordId,fields:t.fields,changes:V(),values:ae(c.values)});ne();let N=$.values?{...c.values,...$.values}:c.values;return a=ae(N),b({status:"saved",recordId:$.id,values:N,dirty:[]}),!0}catch($){return b({status:"error",error:$.message}),!1}}function re(x){return!e.dataSource?.create||!x||x.readonly?null:x.type==="many2one"||x.type==="many2many"?x.relation:null}async function he(x,k,$){let N=re(x),D=e.dataSource;if(!N||!D?.create)throw new Error(`"${k}" cannot make records: its data source has no create, or it is not a link`);return y(D.create({model:N,name:$.trim()}))}async function ze(x,k,$,N,D,O){if(x.type!=="many2one"&&x.type!=="many2many"&&x.type!=="reference")throw new Error(`"${k}" is not a many2one, many2many or reference`);if(x.type==="reference"&&!O)throw new Error(`Searching "${k}" needs a model`);let Q=e.dataSource;if(!Q?.search)return[];let te=x.type==="reference"?void 0:x.filter?.map(({field:Ee,op:ve,value:v,valueFrom:P})=>({field:Ee,op:ve,value:P!==void 0?$[P]??null:v??null})),be=x.type==="reference"?O:x.relation;return y(Q.search({model:be,query:N,...te?{filter:te}:{},limit:D}))}function ye(x){let k=S(x);if(k.type!=="one2many")throw new Error(`"${x}" is a ${k.type}, not a one2many`);return k}function Ce(){return c.step?i.indexOf(c.step):-1}async function Ge(){let x=e.dataSource;if(!(c.recordId==null||t.data.kind!=="record")){if(!x?.load){b({status:"error",error:"This page has no data source to load from"});return}b({status:"loading",error:null});try{let k=await x.load({model:t.data.model,id:c.recordId,fields:t.fields});a={...Zt(t.fields),...k},b({status:"ready",values:ae(a),dirty:[],errors:{}}),Y()}catch(k){b({status:"error",error:k.message})}}}let nt={page:t,getState:()=>c,subscribe(x){return f.add(x),()=>f.delete(x)},load:()=>y(Ge()),setValue(x,k){S(x),T({...c.values,[x]:ae(k)}),q(x)},node:_,fieldReadonly:x=>S(x).readonly===!0,validate(){let x=L();return b({errors:x}),Object.keys(x).length===0},save:()=>y(M()),reset(){ne(),b({values:ae(a),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null})},changes:V,addLine(x,k={}){let $=ye(x),N=`new-${++l}`,D=c.values[x]??[],O={key:N,values:{...Zt($.fields),...ae(k)}};if($.sequenceField&&O.values[$.sequenceField]==null){let te=D.map(be=>be.values[$.sequenceField]).filter(be=>typeof be=="number");O.values[$.sequenceField]=te.length?Math.max(...te)+1:1}let Q=[...D,O];return T({...c.values,[x]:Q}),q(x),N},updateLine(x,k,$,N){if(!ye(x).fields[$])throw new Error(`The lines of "${x}" have no field "${$}"`);let O=(c.values[x]??[]).map(Q=>Q.key===k?{...Q,values:{...Q.values,[$]:ae(N)}}:Q);T({...c.values,[x]:O}),q(x)},moveLine(x,k,$){let D=ye(x).sequenceField;if(!D)throw new Error(`The lines of "${x}" keep no order: give the field a sequenceField`);let O=[...c.values[x]??[]],Q=O.findIndex(F=>F.key===k);if(Q<0)throw new Error(`"${x}" has no line "${k}"`);let te=Math.max(0,Math.min($,O.length-1));if(te===Q)return;let be=O.map(F=>F.values[D]),Ee=be.every((F,H)=>typeof F=="number"&&(H===0||F>be[H-1]));O.splice(te,0,...O.splice(Q,1));let ve=Math.min(Q,te),v=Math.max(Q,te),P=Ee?be.slice(ve,v+1):[],Z=O.map((F,H)=>{let K=Ee?H>=ve&&H<=v?P[H-ve]:F.values[D]:H+1;return K===F.values[D]?F:{...F,values:{...F.values,[D]:K}}});T({...c.values,[x]:Z}),q(x)},removeLine(x,k){ye(x);let $=(c.values[x]??[]).filter(N=>N.key!==k);T({...c.values,[x]:$}),q(x)},async search(x,k,$=8,N={}){return ze(S(x),x,g(),k,$,N.model)},async previewLine(x,k,$){ye(x);let N=c.values[x]??[],D=N.find(ve=>ve.key===k);if(!D)throw new Error(`"${x}" has no line "${k}"`);let O={...D.values,...$},Q=e.dataSource;if(!Q?.onchange||t.data.kind!=="record")return O;let te=N.map(ve=>ve.key===k?{...ve,values:O}:ve),Ee=((await Q.onchange({model:t.data.model,id:c.recordId,changed:x,values:ae({...c.values,[x]:te})})).values?.[x]??[]).find(ve=>ve.key===k);return Ee?{...O,...Ee.values}:O},async searchLine(x,k,$,N,D=8){let O=ye(x),Q=O.fields[$];if(!Q)throw new Error(`The lines of "${x}" have no field "${$}"`);let te=(c.values[x]??[]).find(be=>be.key===k);if(!te)throw new Error(`"${x}" has no line "${k}"`);return ze(Q,$,sr(te.values,O.fields),N,D)},canCreate:x=>re(t.fields[x])!==null,quickCreate:(x,k)=>he(t.fields[x],x,k),canCreateLine:(x,k)=>re(ye(x).fields[k])!==null,quickCreateLine:(x,k,$)=>he(ye(x).fields[k],k,$),steps:()=>i.filter(x=>!_(x).invisible),next(){if(!c.step)return!1;let x=L(c.step);if(Object.keys(x).length)return b({errors:x}),!1;let k=nt.steps(),$=i.slice(Ce()+1).find(N=>k.includes(N));return $?(b({step:$,errors:{}}),!0):!1},back(){if(!c.step)return!1;let x=nt.steps(),k=i.slice(0,Ce()).reverse().find($=>x.includes($));return k?(b({step:k,errors:{}}),!0):!1},async runAction(x){let k=o.get(x);if(!k||k.kind!=="button"&&k.kind!=="stat")throw new Error(`The page has no button "${x}"`);if(_(x).invisible)return;let $=k.source;await y(Promise.resolve(e.onAction?.({id:x,action:$.action,..."params"in $&&$.params?{params:$.params}:{},recordId:c.recordId,values:ae(c.values)})))},restoreDraft(){let x=e.drafts?.store.getItem(s());if(!x)return;let k=JSON.parse(x);T({...c.values,...k.values},{draft:null})},discardDraft(){ne(),b({draft:null})},async settled(){for(;p.size;)await Promise.allSettled([...p])},dispose(){d!==null&&r.clearTimeout(d),h!==null&&r.clearTimeout(h),f.clear()}};return c.recordId==null&&Y(),nt}function Hp(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:ae(i.values)});continue}let a={};for(let[c,l]of Object.entries(i.values))JSON.stringify(l)!==JSON.stringify(s.values[c])&&(a[c]=ae(l));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 Kp(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 qp(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:ft(a.invisible),readonly:ft(a.readonly),required:ft(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 pu=new Map;function mu(e,t){let r=`${e}:${t}`,n=pu.get(r);return n||(n=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),pu.set(r,n)),n}function Gp(e){let t=mu(e,1).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}function kt(e,t,r="en"){return mu(r,t).format(e)}function Wo(e,t="en"){let{group:r,decimal:n}=Gp(t),o=e.replace(/[٠-٩]/g,i=>String(i.charCodeAt(0)-1632)).replace(/[۰-۹]/g,i=>String(i.charCodeAt(0)-1776)).replace(/٫/g,n).replace(/٬/g,r);return o=o.replace(/[\s\u00a0\u202f]/g,""),r.trim()&&(o=o.split(r).join("")),n==="."?o:o.split(n).join(".")}var xe={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",createNamed:"Create \u201C{name}\u201D",createAndEdit:"Create and edit\u2026",searchMore:"Search more\u2026",openNamed:"Open {name}",openLine:"Open line",chooseDate:"Choose a date",previousMonth:"Previous month",nextMonth:"Next month",weekShort:"Wk",week:"Week",formatting:"Formatting",bold:"Bold",italic:"Italic",underline:"Underline",textStyle:"Text style",paragraph:"Paragraph",heading:"Heading",subheading:"Subheading",bulletList:"Bulleted list",numberList:"Numbered list",alignLeft:"Align left",alignCenter:"Align centre",alignRight:"Align right",link:"Link",linkAddress:"Link address",applyLink:"Apply",removeLink:"Remove link",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",addSection:"\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",addNote:"\u0625\u0636\u0627\u0641\u0629 \u0645\u0644\u0627\u062D\u0638\u0629",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",total:"\u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A",lineProblem:"\u0627\u0644\u0633\u0637\u0631 {n}: {message}",moreProblems:"\u0648{n} \u0623\u062E\u0631\u0649",chooseColumns:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",createNamed:"\u0625\u0646\u0634\u0627\u0621 \xAB{name}\xBB",createAndEdit:"\u0625\u0646\u0634\u0627\u0621 \u0648\u062A\u0639\u062F\u064A\u0644\u2026",searchMore:"\u0628\u062D\u062B \u0645\u0648\u0633\u0651\u0639\u2026",openNamed:"\u0641\u062A\u062D {name}",openLine:"\u0641\u062A\u062D \u0627\u0644\u0633\u0637\u0631",chooseDate:"\u0627\u062E\u062A\u064A\u0627\u0631 \u062A\u0627\u0631\u064A\u062E",previousMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0633\u0627\u0628\u0642",nextMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u062A\u0627\u0644\u064A",weekShort:"\u0623\u0633\u0628\u0648\u0639",week:"\u0627\u0644\u0623\u0633\u0628\u0648\u0639",formatting:"\u0627\u0644\u062A\u0646\u0633\u064A\u0642",bold:"\u063A\u0627\u0645\u0642",italic:"\u0645\u0627\u0626\u0644",underline:"\u062A\u0633\u0637\u064A\u0631",textStyle:"\u0646\u0645\u0637 \u0627\u0644\u0646\u0635",paragraph:"\u0641\u0642\u0631\u0629",heading:"\u0639\u0646\u0648\u0627\u0646",subheading:"\u0639\u0646\u0648\u0627\u0646 \u0641\u0631\u0639\u064A",bulletList:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",numberList:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629",alignLeft:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0633\u0627\u0631",alignCenter:"\u062A\u0648\u0633\u064A\u0637",alignRight:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0645\u064A\u0646",link:"\u0631\u0627\u0628\u0637",linkAddress:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0627\u0628\u0637",applyLink:"\u062A\u0637\u0628\u064A\u0642",removeLink:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0627\u0628\u0637",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",addSection:"Abschnitt hinzuf\xFCgen",addNote:"Notiz hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",total:"Summe",lineProblem:"Zeile {n}: {message}",moreProblems:"und {n} weitere",chooseColumns:"Spalten ausw\xE4hlen",createNamed:"\u201E{name}\u201C anlegen",createAndEdit:"Anlegen und bearbeiten\u2026",searchMore:"Weitere suchen\u2026",openNamed:"{name} \xF6ffnen",openLine:"Zeile \xF6ffnen",chooseDate:"Datum ausw\xE4hlen",previousMonth:"Vorheriger Monat",nextMonth:"N\xE4chster Monat",weekShort:"KW",week:"Kalenderwoche",formatting:"Formatierung",bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",textStyle:"Textstil",paragraph:"Absatz",heading:"\xDCberschrift",subheading:"Unter\xFCberschrift",bulletList:"Aufz\xE4hlung",numberList:"Nummerierte Liste",alignLeft:"Linksb\xFCndig",alignCenter:"Zentriert",alignRight:"Rechtsb\xFCndig",link:"Link",linkAddress:"Linkadresse",applyLink:"\xDCbernehmen",removeLink:"Link entfernen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",addSection:"Ajouter une section",addNote:"Ajouter une note",deleteLine:"Supprimer la ligne",total:"Total",lineProblem:"Ligne {n} : {message}",moreProblems:"et {n} de plus",chooseColumns:"Choisir les colonnes",createNamed:"Cr\xE9er \xAB {name} \xBB",createAndEdit:"Cr\xE9er et modifier\u2026",searchMore:"Rechercher plus\u2026",openNamed:"Ouvrir {name}",openLine:"Ouvrir la ligne",chooseDate:"Choisir une date",previousMonth:"Mois pr\xE9c\xE9dent",nextMonth:"Mois suivant",weekShort:"Sem.",week:"Semaine",formatting:"Mise en forme",bold:"Gras",italic:"Italique",underline:"Soulign\xE9",textStyle:"Style du texte",paragraph:"Paragraphe",heading:"Titre",subheading:"Sous-titre",bulletList:"Liste \xE0 puces",numberList:"Liste num\xE9rot\xE9e",alignLeft:"Aligner \xE0 gauche",alignCenter:"Centrer",alignRight:"Aligner \xE0 droite",link:"Lien",linkAddress:"Adresse du lien",applyLink:"Appliquer",removeLink:"Supprimer le lien",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var Yp=180,hu=8;function en(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>t[n]??r)}function tn(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="",l=null,u="",d=new Map,h=!1,p=[],f=-1,m=0,b,y=!1;function g(){if(s.replaceChildren(),p.forEach((L,T)=>{let U=t.createElement("li");U.id=`${o}-${T}`,U.setAttribute("role","option"),U.setAttribute("aria-selected",String(T===f)),U.className=`fd-option${T===f?" fd-active":""}${L===l||d.has(L)?" fd-option-create":""}`,U.textContent=L.label,U.addEventListener("mousedown",W=>W.preventDefault()),U.addEventListener("click",()=>_(T)),s.append(U)}),!p.length){let L=t.createElement("li");L.className="fd-empty",L.textContent=n.noResults,s.append(L)}f>=0?i.setAttribute("aria-activedescendant",`${o}-${f}`):i.removeAttribute("aria-activedescendant")}function S(){s.hidden=!1,i.setAttribute("aria-expanded","true")}function z(){clearTimeout(b),m++,s.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),f=-1}function _(L){let T=p[L];if(!T)return;let U=u;if(z(),h=!1,T===l&&e.create){e.create(U).then(e.pick,()=>{});return}let W=d.get(T);if(W){W(U).then(ne=>ne&&e.pick(ne),()=>{});return}e.pick(T)}function E(L){clearTimeout(b);let T=++m;b=setTimeout(async()=>{let U=await e.search(L).catch(()=>[]);if(T!==m||t.activeElement!==i)return;let W=p[f],ne=W&&W!==l&&!d.has(W)?W.id:void 0,Y=e.exclude?.()??new Set,X=U.filter(V=>!Y.has(V.id)),ie=e.shown!==void 0&&X.length>e.shown;p=ie?X.slice(0,e.shown):X;let q=L.trim();l=null,e.create&&q&&!U.some(V=>V.label.trim().toLowerCase()===q.toLowerCase())&&(u=q,l={id:"__create__",label:en(n.createNamed,{name:q})},p=[...p,l]),u=q,d=new Map((e.more?.(q,ie)??[]).map((V,R)=>[{id:`__more_${R}__`,label:V.label},V.act])),p=[...p,...d.keys()],f=ne===void 0?-1:p.findIndex(V=>V.id===ne),g(),S()},Yp)}return i.addEventListener("input",()=>{h=!0,y||E(i.value)}),i.addEventListener("focus",()=>{y||E("")}),i.addEventListener("keydown",L=>{if(!y)switch(L.key){case"ArrowDown":case"ArrowUp":{if(L.preventDefault(),s.hidden)return E(i.value);if(!p.length)return;f=(f+(L.key==="ArrowDown"?1:-1)+p.length)%p.length,g(),s.children[f]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!s.hidden&&f>=0&&(L.preventDefault(),_(f));return;case"Escape":s.hidden||L.preventDefault(),z(),h=!1,i.value=c;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{m++,clearTimeout(b),z();let L=h&&i.value.trim()===""&&c!=="";h=!1,L?e.onCommitEmpty?.():i.value=c}),{element:a,input:i,setText(L){c=L,h||(i.value=L)},setReadonly(L){y=L,i.readOnly=L,L&&z()},close:z}}function gu(e,t,r){return r.options?.create!==!1&&e.canCreate(t)?n=>e.quickCreate(t,n):void 0}var Jo=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=xe.en,dialogs:a})=>{let c=r.type==="many2one"?r.relation:"",l=!!a&&a.canOpen(c),u=!1,d=tn({document:i,id:o,labels:s,search:f=>e.search(t,f,hu+1),shown:hu,pick:f=>e.setValue(t,f),onCommitEmpty:()=>e.setValue(t,null),create:gu(e,t,n),more:(f,m)=>{if(!a||u)return[];let b=[];return f&&l&&n.options?.create!==!1&&b.push({label:s.createAndEdit,act:y=>a.openRecord(c,{name:y,title:r.label})}),m&&b.push({label:s.searchMore,act:()=>a.searchMore({title:r.label,search:(y,g)=>e.search(t,y,g)})}),b}}),h=l?i.createElement("button"):null;h&&(h.type="button",h.className="fd-combo-open",h.textContent="\u2197",h.hidden=!0,h.addEventListener("click",async()=>{let f=e.getState().values[t];if(!f||!a)return;let m=await a.openRecord(c,{recordId:f.id,title:f.label});m&&m.label!==f.label&&e.setValue(t,m)}));let p=i.createElement("button");return p.type="button",p.className="fd-combo-clear",p.textContent="\xD7",p.setAttribute("aria-label",en(s.clear,{label:r.label})),p.addEventListener("click",()=>{e.setValue(t,null),d.input.focus()}),d.element.append(p,...h?[h]:[]),{element:d.element,focus:()=>d.input.focus(),update(f){let m=f.value;u=f.readonly,d.setText(m?.label??""),d.setReadonly(f.readonly),p.hidden=!m||f.readonly,h&&(h.hidden=!m,m&&h.setAttribute("aria-label",en(s.openNamed,{name:m.label}))),d.input.setAttribute("aria-invalid",String(f.invalid)),d.input.setAttribute("aria-required",String(f.required)),f.describedBy&&d.input.setAttribute("aria-describedby",f.describedBy)}}},rn=({form:e,name:t,node:r,id:n,document:o,labels:i=xe.en})=>{let s=()=>e.getState().values[t]??[],a=o.createElement("div");a.className="fd-tags",a.setAttribute("role","group");let c=o.createElement("ul");c.className="fd-chips";let l=tn({document:o,id:n,labels:i,search:h=>e.search(t,h),pick:h=>{e.setValue(t,[...s(),h]),l.input.value=""},exclude:()=>new Set(s().map(h=>h.id)),onEmptyBackspace:()=>{let h=s();h.length&&e.setValue(t,h.slice(0,-1))},create:gu(e,t,r)});a.append(c,l.element);let u=!1,d="";return{element:a,focus:()=>l.input.focus(),update(h){let p=h.value??[],f=JSON.stringify([h.readonly,p]);u=h.readonly,l.setReadonly(u),l.element.hidden=u,l.input.setAttribute("aria-invalid",String(h.invalid)),h.describedBy&&l.input.setAttribute("aria-describedby",h.describedBy),f!==d&&(d=f,bu(c,p,u,i,m=>e.setValue(t,s().filter(b=>b.id!==m.id))),l.setText(""))}}};function bu(e,t,r,n,o){let i=e.ownerDocument;e.replaceChildren(...t.map(s=>{let a=i.createElement("li");a.className="fd-chip";let c=i.createElement("span");if(c.className="fd-chip-label",c.textContent=s.label,a.append(c),!r){let l=i.createElement("button");l.type="button",l.className="fd-chip-remove",l.textContent="\xD7",l.setAttribute("aria-label",en(n.remove,{name:s.label})),l.addEventListener("click",()=>o(s)),a.append(l)}return a}))}var Ho=({form:e,name:t,node:r,id:n,document:o,labels:i=xe.en})=>{let s=r.options??{},a=typeof s.separator=="string"&&s.separator?s.separator:",",c=Array.isArray(s.suggestions)?s.suggestions.filter(y=>typeof y=="string"):[],l=y=>typeof y=="string"?y.split(a).map(g=>g.trim()).filter(g=>g!==""):[],u=()=>l(e.getState().values[t]),d=y=>e.setValue(t,y.length?y.join(`${a} `):null),h=y=>{let g=y.trim(),S=u();g&&!S.some(z=>z.toLowerCase()===g.toLowerCase())&&d([...S,g])},p=o.createElement("div");p.className="fd-tags",p.setAttribute("role","group");let f=o.createElement("ul");f.className="fd-chips";let m=tn({document:o,id:n,labels:i,search:async y=>{let g=new Set(u().map(z=>z.toLowerCase())),S=y.trim().toLowerCase();return c.filter(z=>!g.has(z.toLowerCase())&&z.toLowerCase().includes(S)).map(z=>({id:z,label:z}))},pick:y=>{h(y.label),m.input.value=""},onEmptyBackspace:()=>{let y=u();y.length&&d(y.slice(0,-1))}});m.input.addEventListener("keydown",y=>{y.key!=="Enter"||y.defaultPrevented||m.input.value.trim()===""||(y.preventDefault(),h(m.input.value),m.input.value="",m.close())}),m.input.addEventListener("input",()=>{let y=m.input.value.split(a);if(!(y.length<2)){for(let g of y.slice(0,-1))h(g);m.input.value=y[y.length-1].trimStart()}}),m.input.addEventListener("change",()=>{m.input.value.trim()&&h(m.input.value)}),p.append(f,m.element);let b="";return{element:p,focus:()=>m.input.focus(),update(y){let g=l(y.value);m.setReadonly(y.readonly),m.element.hidden=y.readonly,m.input.setAttribute("aria-invalid",String(y.invalid)),y.describedBy&&m.input.setAttribute("aria-describedby",y.describedBy);let S=JSON.stringify([y.readonly,g]);S!==b&&(b=S,bu(f,g.map(z=>({id:z,label:z})),y.readonly,i,z=>d(u().filter(_=>_!==z.label))),m.setText(""))}}},Ko=({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(l=>l.id));for(let{record:l,box:u}of i)u.checked=c.has(l.id),u.disabled=s.readonly};return e.search(t,"",50).then(c=>{i=c.map((l,u)=>{let d=n.createElement("input");d.type="checkbox",d.id=`${r}-${u}`,d.addEventListener("change",()=>{let f=e.getState().values[t]??[];e.setValue(t,d.checked?[...f,l]:f.filter(m=>m.id!==l.id))});let h=n.createElement("label");h.className="fd-choice",h.htmlFor=d.id;let p=n.createElement("span");return p.textContent=l.label,h.append(d,p),o.append(h),{record:l,box:d}}),a()}),{element:o,focus:()=>o.querySelector("input")?.focus(),update(c){s={readonly:c.readonly,value:c.value??[]},a()}}},qo=e=>{let{form:t,name:r,field:n,id:o,document:i,labels:s=xe.en}=e,a=n.type==="reference"?n.models:[],c=i.createElement("div");c.className="fd-reference";let l=i.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",n.label),l.append(i.createElement("option"));for(let h of a){let p=i.createElement("option");p.value=String(h.value),p.textContent=h.label,l.append(p)}let u="";l.addEventListener("change",()=>{u=l.value,t.setValue(r,null)});let d=tn({document:i,id:o,labels:s,search:h=>u?t.search(r,h,8,{model:u}):Promise.resolve([]),pick:h=>t.setValue(r,{model:u,id:h.id,label:h.label}),onCommitEmpty:()=>t.setValue(r,null)});return c.append(l,d.element),{element:c,focus:()=>u?d.input.focus():l.focus(),update(h){let p=h.value;p&&(u=p.model),l.value=u,l.disabled=h.readonly,d.setText(p?.label??""),d.setReadonly(h.readonly||!u)}}};function yu(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,r,n,o,i,s]=t;return new Date(Number(r),Number(n)-1,Number(o),Number(i??0),Number(s??0))}function Go(e,t,r={},n="en"){let o=(i,s)=>kt(i,s,n);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(i=>i.label).join(", ");case"selection":{let i=s=>e.options.find(a=>a.value===s)?.label??String(s);return Array.isArray(t)?t.map(i).join(", "):i(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let i=e.currency??(e.currencyField?r[e.currencyField]?.label:void 0),s=o(Number(t),e.digits?.[1]??2);return i?`${i} ${s}`:s}case"date":{let i=yu(String(t));return i?new Intl.DateTimeFormat(n==="en"?"en-GB":n,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(i):String(t)}case"datetime":{let i=yu(String(t));return i?new Intl.DateTimeFormat(n==="en"?"en-GB":n,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(i):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return t.name??"";case"boolean":return t?"\u2713":"";default:return String(t)}}function xu(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function vu(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),canCreate:o=>e.canCreateLine(t,o),quickCreate:(o,i)=>e.quickCreateLine(t,o,i)}}var Yo=({form:e,name:t,field:r,node:n,id:o,document:i,labels:s=xe.en,locale:a,dialogs:c})=>{let l=r,u=l.lineKinds,d=(n.columns??Object.keys(l.fields)).filter(Y=>l.fields[Y]&&Y!==u?.field&&Y!==l.sequenceField&&n.optionalColumns?.[Y]!=="hide"),h=i.createElement("div");h.className="fd-lines",h.id=o,h.setAttribute("role","group");let p=i.createElement("div");p.className="fd-lines-scroll";let f=i.createElement("table");f.className="fd-lines-table";let m=i.createElement("thead"),b=i.createElement("tr");for(let Y of d){let X=i.createElement("th");X.scope="col",X.textContent=l.fields[Y].label,b.append(X)}let y=i.createElement("th");y.className="fd-lines-tools",b.append(y),m.append(b);let g=i.createElement("tbody");f.append(m,g);let S=(n.totals??[]).filter(Y=>d.includes(Y)),z=new Map;if(S.length){let Y=i.createElement("tfoot"),X=i.createElement("tr");X.className="fd-lines-totals",d.forEach((ie,q)=>{let V=i.createElement("td");S.includes(ie)?z.set(ie,V):q===0&&(V.textContent=s.total),X.append(V)}),X.append(i.createElement("td")),Y.append(X),f.append(Y)}p.append(f);let _=i.createElement("div");_.className="fd-lines-adds";let E=(Y,X,ie)=>{let q=i.createElement("button");q.type="button",q.className="fd-button fd-button-link fd-lines-add",q.dataset.add=ie,q.textContent=`+ ${Y}`,q.addEventListener("click",()=>{T=e.addLine(t,X);let V=L.get(T);V&&(V.cells[0]?.widget.focus(),T=null)}),_.append(q)};E(s.addLine,{},"line"),u&&(E(s.addSection,{[u.field]:u.section??"section"},"section"),E(s.addNote,{[u.field]:u.note??"note"},"note")),h.append(p,_);let L=new Map,T=null,U=!1;function W(Y,X,ie,q,V=1){let R=`${o}-${X.key}-${ie}`,M={type:"field",id:`${n.id}.${X.key}.${ie}`,field:ie},re=We({form:vu(e,t,X.key),name:ie,field:q,node:M,id:R,document:i,labels:s,locale:a,dialogs:c}),he=i.createElement("td");he.colSpan=V;let ze=i.createElement("label");ze.className="fd-sr-only",ze.htmlFor=R,ze.textContent=q.label;let ye=i.createElement("div");return ye.className="fd-cell-error",ye.hidden=!0,he.append(ze,re.element,ye),Y.append(he),{name:ie,def:q,widget:re,error:ye}}function ne(Y){let X=i.createElement("tr");X.dataset.line=Y.key;let ie=pt(l,Y.values);ie&&(X.className=`fd-line-${ie}`);let q=ie&&u?[W(X,Y,u.text,xu(l.fields[u.text],ie),d.length)]:d.map(M=>W(X,Y,M,l.fields[M])),V=i.createElement("td");V.className="fd-lines-tools";let R=i.createElement("button");return R.type="button",R.className="fd-line-delete",R.textContent="\xD7",R.setAttribute("aria-label",s.deleteLine),R.addEventListener("click",()=>e.removeLine(t,Y.key)),V.append(R),X.append(V),{element:X,kind:ie,cells:q,remove:R}}return{element:h,focus:()=>(g.querySelector("input, select, textarea")??_.querySelector("button"))?.focus(),update(Y){U=Y.readonly,_.hidden=U;let X=Y.value??[],ie=e.getState().errors,q=new Set(X.map(V=>V.key));for(let[V,R]of L)q.has(V)||(R.element.remove(),L.delete(V));X.forEach((V,R)=>{let M=L.get(V.key);M&&M.kind!==pt(l,V.values)&&(M.element.remove(),M=void 0),M||(M=ne(V),L.set(V.key,M)),g.children[R]!==M.element&&g.insertBefore(M.element,g.children[R]??null),M.remove.hidden=U,U?M.remove.remove():M.remove.isConnected||M.element.lastElementChild?.append(M.remove);for(let re of M.cells){let he=ie[`${t}.${V.key}.${re.name}`];re.error.hidden=!he,re.error.textContent=he??"",re.widget.update({value:V.values[re.name],values:V.values,readonly:U||re.def.readonly===!0,required:re.def.required===!0,invalid:!!he})}});for(let[V,R]of z){let M=X.filter(re=>!pt(l,re.values)).reduce((re,he)=>re+Number(he.values[V]??0),0);R.textContent=Go(l.fields[V],M,X[0]?.values??{},a)}T&&L.has(T)&&(L.get(T)?.cells[0]?.widget.focus(),T=null)}}};function Xp(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 wu(e){return({form:t,name:r,field:n,id:o,document:i,labels:s=xe.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 l=n.type==="binary"?n.accept:e==="image"?["image/*"]:void 0;l&&(c.accept=l.join(","));let u=i.createElement("img");u.className="fd-image-preview",u.alt=n.label,u.hidden=!0;let d=i.createElement("label");d.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",d.htmlFor=o;let h=i.createElement("span");h.className="fd-button",h.textContent=e==="image"?s.uploadImage:s.upload;let p=i.createElement("span");p.className="fd-help",p.textContent=s.dropHere,d.append(h,p);let f=i.createElement("div");f.className="fd-file-chosen";let m=i.createElement("span");m.className="fd-file-name";let b=i.createElement("button");b.type="button",b.className="fd-button fd-button-link",b.textContent=s.replace,b.addEventListener("click",()=>c.click());let y=i.createElement("button");y.type="button",y.className="fd-button fd-button-link",y.textContent=s.removeFile,y.addEventListener("click",()=>t.setValue(r,null)),f.append(m,b,y),a.append(c,...e==="image"?[u]:[],d,f);let g=!1,S=async z=>{!z||g||t.setValue(r,await Xp(z))};return c.addEventListener("change",()=>{S(c.files?.[0]),c.value=""}),a.addEventListener("dragover",z=>{g||(z.preventDefault(),a.classList.add("fd-dragging"))}),a.addEventListener("dragleave",()=>a.classList.remove("fd-dragging")),a.addEventListener("drop",z=>{z.preventDefault(),a.classList.remove("fd-dragging"),S(z.dataTransfer?.files?.[0])}),{element:a,focus:()=>(d.hidden?b:c).focus(),update(z){g=z.readonly;let _=z.value;if(d.hidden=!!_||g,f.hidden=!_,b.hidden=y.hidden=g,c.disabled=g,c.setAttribute("aria-invalid",String(z.invalid)),z.describedBy&&c.setAttribute("aria-describedby",z.describedBy),m.textContent=_?`${_.name} \xB7 ${cr(_.size)}`:"",e==="image"){let E=_?_.data?`data:${_.type};base64,${_.data}`:_.url??"":"";u.hidden=!E,u.getAttribute("src")!==E&&(E?u.src=E:u.removeAttribute("src"))}}}}}var Xo=wu("binary"),Qo=wu("image");var ku=new Map;function _u(e,t){let r=ku.get(t);return r||(r=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),ku.set(t,r)),r.format(e/100)}var ur=e=>{let{node:t,id:r,document:n,locale:o="en"}=e,i=t.options??{},s=typeof i.min=="number"?i.min:0,a=typeof i.max=="number"?i.max:100,c=typeof i.maxField=="string"?i.maxField:null,l=typeof i.color=="string"?i.color:"auto",u=i.showPercent!==!1,d=n.createElement("div");d.className="fd-progressbar",d.setAttribute("role","progressbar");let h=n.createElement("div");h.className="fd-progressbar-fill";let p=n.createElement("span");p.className="fd-progressbar-text",d.append(h,p);let f=null,m=d;return i.editable===!0?(f=We({...e,node:{...t,widget:void 0}}),d.setAttribute("aria-hidden","true"),m=n.createElement("div"),m.className="fd-progressbar-edit",m.append(d,f.element)):d.id=r,{element:m,focus:()=>f?.focus(),update(b){let y=typeof b.value=="number"?b.value:0,g=c?Number(b.values[c]??0):a,S=g>s?Math.min(100,Math.max(0,(y-s)/(g-s)*100)):0,z=Math.round(S*10)/10;h.style.width=`${z}%`,d.setAttribute("aria-valuenow",String(y)),d.setAttribute("aria-valuemin",String(s)),d.setAttribute("aria-valuemax",String(g)),d.setAttribute("aria-valuetext",_u(S,o)),p.textContent=u?_u(S,o):"",d.dataset.tone=l!=="auto"?l:S<30?"danger":S<70?"warning":"success",f?.update(b)}}};function zu(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var dr=({field:e,node:t,id:r,document:n,locale:o="en"})=>{let i=t.options??{},s=u=>typeof i[u]=="string"?i[u]:"",a=u=>typeof i[u]=="string"?i[u]:null,c=e.type==="integer"?0:e.type==="float"||e.type==="monetary"?e.digits?.[1]??2:null,l=n.createElement("output");return l.id=r,l.className="fd-value-text",{element:l,focus:()=>{},update({value:u,values:d}){if(u==null||u===""){l.textContent="";return}let h=c!==null&&typeof u=="number"?kt(u,c,o):nn(u,e),p=a("prefixField"),f=a("suffixField"),m=p?zu(d[p]):s("prefix"),b=f?zu(d[f]):s("suffix");l.textContent=[m,h,b].filter(y=>y!=="").join(" ")}}};var on=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=n.options??{},a=s.clickable===!0,c=Array.isArray(s.visibleStates)?s.visibleStates:null,l=i.createElement("ol");l.className="fd-statusbar",l.id=o,l.setAttribute("aria-label",r.label);let u=m=>m&&typeof m=="object"&&"id"in m?`id:${String(m.id)}`:`v:${String(m)}`,d=r.type==="selection"?r.options.map(m=>({key:u(m.value),label:m.label,value:m.value})):[],h=r.type==="selection",p={value:void 0,readonly:!1};function f(){let{value:m,readonly:b}=p,y=m==null?null:u(m),g=d.filter(S=>!c||c.some(z=>u(z)===S.key)||S.key===y);y&&!g.some(S=>S.key===y)&&m&&typeof m=="object"&&(g=[...g,{key:y,label:m.label,value:m}]),l.replaceChildren(...g.map(S=>{let z=i.createElement("span");z.textContent=S.label;let _=i.createElement(a?"button":"span");_ instanceof HTMLButtonElement&&(_.type="button",_.disabled=b,_.addEventListener("click",()=>e.setValue(t,S.value))),_.append(z),S.key===y&&_.setAttribute("aria-current","step");let E=i.createElement("li");return E.append(_),E}))}return{element:l,focus:()=>l.querySelector("button:not([disabled])")?.focus(),update(m){p={value:m.value,readonly:m.readonly},f(),h||(h=!0,e.search(t,"",20).then(b=>{d=b.map(y=>({key:u(y),label:y.label,value:y})),f()}).catch(()=>{}))}}};function $u(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let r=Date.UTC(t.getUTCFullYear(),0,1);return Math.ceil(((t.getTime()-r)/864e5+1)/7)}var Su=e=>String(e).padStart(2,"0"),ei=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),qe=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function sn(e,t){let r=new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate();return new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),r))}function ti(e,t){if(typeof t!="string"||!t)return null;if(e==="date"){let n=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return n?new Date(Number(n[1]),Number(n[2])-1,Number(n[3])):null}let r=new Date(t);return Number.isNaN(r.getTime())?null:r}function an(e,t,r){let{form:n,name:o,id:i,document:s,locale:a="en"}=t,c=t.labels??xe.en,l=a==="en"?"en-GB":a,u=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),d=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),h=new Intl.DateTimeFormat(l,{weekday:"short"}),p=new Intl.DateTimeFormat(l,{weekday:"long"}),f=s.createElement("button");f.type="button",f.className="fd-calendar-button";let m="http://www.w3.org/2000/svg",b=s.createElementNS(m,"svg");b.setAttribute("viewBox","0 0 16 16"),b.setAttribute("aria-hidden","true");for(let[R,M]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let re=s.createElementNS(m,R);for(let[he,ze]of Object.entries(M))re.setAttribute(he,ze);b.append(re)}f.append(b),f.setAttribute("aria-label",c.chooseDate),f.setAttribute("aria-haspopup","dialog"),f.setAttribute("aria-expanded","false"),f.setAttribute("aria-controls",`${i}-calendar`);let y=s.createElement("div");y.className="fd-calendar",y.id=`${i}-calendar`,y.setAttribute("role","dialog"),y.hidden=!0;let g=s.createElement("div");g.className="fd-calendar-head";let S=s.createElement("button");S.type="button",S.textContent="\u2039",S.setAttribute("aria-label",c.previousMonth);let z=s.createElement("span");z.className="fd-calendar-title",z.setAttribute("aria-live","polite");let _=s.createElement("button");_.type="button",_.textContent="\u203A",_.setAttribute("aria-label",c.nextMonth),g.append(S,z,_);let E=s.createElement("table");E.className="fd-calendar-grid",E.setAttribute("role","grid"),y.append(g,E);let L=s.createElement("span");L.className="fd-date-pick",L.append(e.element,f,y);let T=new Date,U=!1;function W(R){if(r==="date")n.setValue(o,`${R.getFullYear()}-${Su(R.getMonth()+1)}-${Su(R.getDate())}`);else{let M=ti("datetime",n.getState().values[o]),re=new Date(R.getFullYear(),R.getMonth(),R.getDate(),M?.getHours()??0,M?.getMinutes()??0);n.setValue(o,re.toISOString())}q()}function ne(R){let M=ti(r,n.getState().values[o]),re=new Date,he=u.format(T);z.textContent=he,y.setAttribute("aria-label",he);let ze=new Date(T.getFullYear(),T.getMonth(),1),ye=qe(ze,-((ze.getDay()+6)%7)),Ce=s.createElement("tr"),Ge=s.createElement("th");Ge.scope="col",Ge.textContent=c.weekShort,Ge.setAttribute("abbr",c.week),Ce.append(Ge);for(let k=0;k<7;k++){let $=qe(ye,k),N=s.createElement("th");N.scope="col",N.textContent=h.format($).replace(/\.$/,""),N.setAttribute("abbr",p.format($)),Ce.append(N)}let nt=s.createElement("thead");nt.append(Ce);let x=s.createElement("tbody");for(let k=ye;k<=new Date(T.getFullYear(),T.getMonth()+1,0);k=qe(k,7)){let $=s.createElement("tr"),N=s.createElement("th");N.scope="row",N.className="fd-week",N.textContent=String($u(k)),$.append(N);for(let D=0;D<7;D++){let O=qe(k,D),Q=s.createElement("td"),te=s.createElement("button");te.type="button",te.textContent=String(O.getDate()),te.setAttribute("aria-label",d.format(O)),te.tabIndex=ei(O,T)?0:-1,O.getMonth()!==T.getMonth()&&te.classList.add("fd-outside"),M&&ei(O,M)&&te.setAttribute("aria-selected","true"),ei(O,re)&&te.setAttribute("aria-current","date"),te.disabled=U,te.addEventListener("click",()=>W(O)),te.addEventListener("keydown",be=>X(be,O)),Q.append(te),$.append(Q)}x.append($)}E.replaceChildren(nt,x),R&&E.querySelector('button[tabindex="0"]')?.focus()}function Y(R){T=R,ne(!0)}function X(R,M){let re={ArrowLeft:()=>qe(M,-1),ArrowRight:()=>qe(M,1),ArrowUp:()=>qe(M,-7),ArrowDown:()=>qe(M,7),PageUp:()=>sn(M,-1),PageDown:()=>sn(M,1),Home:()=>qe(M,-((M.getDay()+6)%7)),End:()=>qe(M,6-(M.getDay()+6)%7)};re[R.key]?(R.preventDefault(),Y(re[R.key]())):(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),W(M))}function ie(){T=ti(r,n.getState().values[o])??new Date,y.hidden=!1,f.setAttribute("aria-expanded","true"),ne(!0)}function q(){y.hidden||(y.hidden=!0,f.setAttribute("aria-expanded","false"),f.focus())}f.addEventListener("click",()=>y.hidden?ie():q()),S.addEventListener("click",()=>{T=sn(T,-1),ne(!1)}),_.addEventListener("click",()=>{T=sn(T,1),ne(!1)}),y.addEventListener("keydown",R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),q())});let V=R=>{!y.hidden&&!L.contains(R.target)&&(y.hidden=!0,f.setAttribute("aria-expanded","false"))};return s.addEventListener("mousedown",V),{element:L,focus:()=>e.focus(),update(R){U=R.readonly,f.hidden=R.readonly,R.readonly&&(y.hidden=!0),e.update(R)},destroy(){s.removeEventListener("mousedown",V),e.destroy?.()}}}var Qp=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)};function em(e,t){let r=Qp(e);return typeof t=="boolean"?{name:e,label:r,type:"boolean"}:typeof t=="number"?{name:e,label:r,type:Number.isInteger(t)?"integer":"float"}:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?{name:e,label:r,type:"date"}:{name:e,label:r,type:"char"}}var ri=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s}=e,a=n.type==="properties"?n.definitions:void 0,c=()=>{let f=t.getState().values[r];return f&&typeof f=="object"&&!Array.isArray(f)?f:{}},l={...t,getState:()=>({...t.getState(),values:c()}),setValue:(f,m)=>t.setValue(r,{...c(),[f]:m})},u=s.createElement("div");u.className="fd-properties",u.setAttribute("role","group");let d=[],h="";function p(f){for(let m of d)m.widget.destroy?.();d=f.map(m=>{let b=`${i}-${m.name}`,y={type:m.type,label:m.label,...m.options?{options:m.options}:{}},g={type:"field",id:`${o.id}.${m.name}`,field:m.name},S=We({...e,form:l,name:m.name,field:y,node:g,id:b});return{definition:m,widget:S}}),u.replaceChildren(...d.map(({definition:m,widget:b})=>{let y=s.createElement("div");y.className="fd-property",y.dataset.type=m.type;let g=s.createElement("label");return g.htmlFor=`${i}-${m.name}`,g.textContent=m.label,y.append(g,b.element),y}))}return{element:u,focus:()=>d[0]?.widget.focus(),destroy:()=>d.forEach(f=>f.widget.destroy?.()),update(f){let m=c(),b=a??Object.keys(m).map(g=>em(g,m[g])),y=JSON.stringify(b);y!==h&&(h=y,p(b));for(let{definition:g,widget:S}of d)S.update({value:m[g.name]??null,values:m,readonly:f.readonly,required:!1,invalid:!1})}}};var tm=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),rm=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),nm=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),om=new Set(["left","center","right","justify","start","end"]);function ni(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(rm.has(a.tagName)){a.remove();continue}if(n(a),!tm.has(a.tagName)){a.replaceWith(...a.childNodes);continue}let c=a.tagName==="A"?a.getAttribute("href"):null,l=nm.has(a.tagName)?a.style?.textAlign?.trim().toLowerCase():"";for(let u of[...a.attributes])a.removeAttribute(u.name);c&&/^(https?:|mailto:)/i.test(c.trim())&&a.setAttribute("href",c.trim()),l&&om.has(l)&&a.setAttribute("style",`text-align: ${l};`)}};n(r.content);let o=t.createElement("div");return o.append(r.content),o.innerHTML}function Lu(e){let t=e.trim();return/^(https?:\/\/|mailto:)\S+$/i.test(t)?t:/^[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+$/.test(t)?`mailto:${t}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(t)?`https://${t}`:null}var Eu=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["bulletList","insertUnorderedList",'<svg viewBox="0 0 16 16"><circle cx="3" cy="4" r="1.2"/><circle cx="3" cy="8" r="1.2"/><circle cx="3" cy="12" r="1.2"/><path d="M6 4h8M6 8h8M6 12h8"/></svg>'],["numberList","insertOrderedList",'<svg viewBox="0 0 16 16"><path d="M2.5 3h1v3M2 10.5c.5-.8 2-.8 2 .2 0 .8-2 1.3-2 2.3h2M6 4h8M6 8h8M6 12h8"/></svg>'],["alignLeft","justifyLeft",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M2 6.5h8M2 9.5h12M2 12.5h8"/></svg>'],["alignCenter","justifyCenter",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M4 6.5h8M2 9.5h12M4 12.5h8"/></svg>'],["alignRight","justifyRight",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M6 6.5h8M2 9.5h12M6 12.5h8"/></svg>'],["link","createLink",'<svg viewBox="0 0 16 16"><path d="M7 9a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2L8.2 3.6M9 7a3 3 0 0 0-4.2 0L2.5 9.3a3 3 0 0 0 4.2 4.2l1.1-1.1"/></svg>']],oi=({form:e,name:t,node:r,id:n,document:o,labels:i=xe.en})=>{let s=o.createElement("div");s.id=n,s.className="fd-input fd-richtext",s.setAttribute("role","textbox"),s.setAttribute("aria-multiline","true"),s.setAttribute("contenteditable","true");let a=r.options?.toolbar!==!1,c="";s.addEventListener("input",()=>{let d=ni(s.innerHTML,o);c=d,e.setValue(t,d.trim()===""?null:d)}),s.addEventListener("blur",()=>{s.innerHTML!==c&&(s.innerHTML=c)});let l=a?im(s,o,i):null,u=s;return l&&(u=o.createElement("div"),u.className="fd-richtext-box",u.setAttribute("role","group"),s.setAttribute("aria-labelledby",`${n}-label`),u.append(l.bar,l.linkRow,s)),{element:u,focus:()=>s.focus(),destroy:()=>l?.destroy(),update(d){l&&(l.bar.hidden=d.readonly,d.readonly&&(l.linkRow.hidden=!0));let h=ni(typeof d.value=="string"?d.value:"",o);(h!==c||o.activeElement!==s)&&(s.innerHTML!==h&&(s.innerHTML=h),c=h),s.setAttribute("contenteditable",String(!d.readonly)),s.setAttribute("aria-readonly",String(d.readonly)),s.setAttribute("aria-invalid",String(d.invalid)),d.describedBy&&s.setAttribute("aria-describedby",d.describedBy)}}};function im(e,t,r){let n=t.createElement("div");n.className="fd-richtext-bar",n.setAttribute("role","toolbar"),n.setAttribute("aria-label",r.formatting);let o=null,i=()=>{e.focus();let m=t.getSelection();o&&m&&(m.removeAllRanges(),m.addRange(o))},s=(m,b)=>{i(),t.execCommand?.(m,!1,b)},a=t.createElement("select");a.className="fd-richtext-style",a.setAttribute("aria-label",r.textStyle);for(let[m,b]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let y=t.createElement("option");y.value=m,y.textContent=r[b],a.append(y)}a.addEventListener("change",()=>s("formatBlock",`<${a.value}>`));let c=t.createElement("div");c.className="fd-link-row",c.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",r.linkAddress);let u=t.createElement("button");u.type="button",u.className="fd-button fd-link-apply",u.textContent=r.applyLink;let d=t.createElement("button");d.type="button",d.className="fd-button fd-button-link fd-link-remove",d.textContent=r.removeLink,c.append(l,u,d),u.addEventListener("click",()=>{let m=Lu(l.value);if(!m){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),i(),t.execCommand?.("createLink",!1,m),c.hidden=!0}),d.addEventListener("click",()=>{i(),t.execCommand?.("unlink",!1),c.hidden=!0}),l.addEventListener("keydown",m=>{m.key==="Enter"?(m.preventDefault(),u.click()):m.key==="Escape"&&(m.preventDefault(),c.hidden=!0,i())});let h=Eu.map(([m,b,y])=>{let g=t.createElement("button");return g.type="button",g.className="fd-richtext-tool",g.setAttribute("aria-label",r[m]),g.title=r[m],g.innerHTML=y,g.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline"].includes(b)&&g.setAttribute("aria-pressed","false"),g.addEventListener("mousedown",S=>S.preventDefault()),g.addEventListener("click",()=>{if(b!=="createLink")return s(b);c.hidden=!1,l.value="",l.focus()}),g});n.append(a,...h);let p=[a,...h];p.forEach((m,b)=>m.tabIndex=b===0?0:-1),n.addEventListener("keydown",m=>{if(m.key!=="ArrowRight"&&m.key!=="ArrowLeft")return;let b=p.indexOf(t.activeElement);if(b<0)return;let y=getComputedStyle(n).direction==="rtl",g=m.key==="ArrowRight"!==y?1:-1,S=p[(b+g+p.length)%p.length];m.preventDefault(),p.forEach(z=>z.tabIndex=z===S?0:-1),S.focus()});let f=()=>{let m=t.getSelection();if(!m||!m.rangeCount||!e.contains(m.anchorNode))return;o=m.getRangeAt(0).cloneRange();for(let y of h){let g=Eu[h.indexOf(y)][1];y.hasAttribute("aria-pressed")&&y.setAttribute("aria-pressed",String(t.queryCommandState?.(g)??!1))}let b=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");a.value=b==="h2"||b==="h3"?b:"p"};return t.addEventListener("selectionchange",f),{bar:n,linkRow:c,destroy:()=>t.removeEventListener("selectionchange",f)}}var ii=({form:e,name:t,id:r,document:n,labels:o=xe.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 l=c.value===null||c.value===void 0?"":JSON.stringify(c.value,null,2);s.value!==l&&(s.value=l)}s.readOnly=c.readonly,s.setAttribute("aria-invalid",String(c.invalid||!a.hidden))}}};function We(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]??Ru[i];if(s)return s(e)}return fm(e)}function _e(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 rt(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 ln=e=>e==null?"":String(e);function fr(e){return({form:t,name:r,field:n,node:o,id:i,document:s})=>{let a=_e(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 l=ln(c.value);a.value!==l&&(a.value=l),a.readOnly=c.readonly,rt(a,c)}}}}var sm=({form:e,name:t,field:r,node:n,id:o,document:i})=>{let s=_e(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=ln(a.value);s.value!==c&&(s.value=c),s.readOnly=a.readonly,rt(s,a)}}},am=/^-?(\d+\.?\d*|\.\d+)$/,cm=/^-?\.?$/,si=e=>{let{form:t,name:r,field:n,node:o,id:i,document:s,locale:a="en"}=e,c=n.type==="integer",l=c?0:(n.type==="float"||n.type==="monetary"?n.digits?.[1]:void 0)??2,u=_=>typeof _=="number"?kt(_,l,a):ln(_),d=_e(s,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});d.inputMode=c?"numeric":"decimal",o.placeholder&&(d.placeholder=o.placeholder);let h=_=>{let E=Wo(_.trim(),a);if(E==="")return null;if(am.test(E))return Number(E);if(!cm.test(E))return E};d.addEventListener("input",()=>{let _=h(d.value);_!==void 0&&t.setValue(r,_)}),d.addEventListener("blur",()=>{d.value=u(t.getState().values[r])});let p=o.options??{},f=n.type==="monetary"?n.currencyField:void 0,m=f?t.page.fields[f]:void 0,b=f&&m&&p.pickCurrency===!0?We({...e,name:f,field:m,node:{type:"field",id:`${o.id}.currency`,field:f},id:`${i}-currency`}):null;b&&m&&b.element.querySelector("input, select")?.setAttribute("aria-label",m.label),b?.element.matches("input, select")&&m&&b.element.setAttribute("aria-label",m.label);let y=n.type==="monetary"&&!b?_e(s,"span",{class:"fd-currency","aria-hidden":"true"}):null,g=b?.element??y,S=p.symbol==="after";return{element:g?_e(s,"span",{class:`fd-number${S?" fd-currency-after":""}${b?" fd-currency-picked":""}`},...S?[d,g]:[g,d]):d,focus:()=>d.focus(),update(_){let E=s.activeElement===d,L=h(d.value),T=L===void 0||L===_.value;if(!(E&&T)){let U=u(_.value);d.value!==U&&(d.value=U)}if(d.readOnly=_.readonly,rt(d,_),b&&f&&b.update({value:_.values[f],values:_.values,readonly:_.readonly,required:!1,invalid:!1}),y&&n.type==="monetary"){let U=n.currencyField?_.values[n.currencyField]:null;y.textContent=U&&typeof U=="object"&&"label"in U?U.label:typeof U=="string"?U:n.currency??""}}}};function Nu(e){return({form:t,name:r,id:n,document:o})=>{let i=_e(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,rt(i,s)}}}}function Ou(e){return e.type==="selection"?e.options:[]}var lm=({form:e,name:t,field:r,id:n,document:o})=>{let i=Ou(r),s=_e(o,"select",{id:n,class:"fd-input fd-select"},_e(o,"option",{value:""}));return i.forEach((a,c)=>s.append(_e(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(l=>l.value===a.value);s.value=c===-1?"":String(c),s.disabled=a.readonly,rt(s,a)}}};function Pu(e){return({form:t,name:r,field:n,id:o,document:i})=>{let s=Ou(n),a=_e(i,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),c=s.map((l,u)=>{let d=_e(i,"input",{type:e,name:o,value:String(u),id:`${o}-${u}`});return a.append(_e(i,"label",{class:"fd-choice",for:`${o}-${u}`},d,_e(i,"span",{},l.label))),d});return a.addEventListener("change",()=>{if(e==="radio"){let l=c.findIndex(u=>u.checked);t.setValue(r,l===-1?null:s[l].value)}else t.setValue(r,s.filter((l,u)=>c[u].checked).map(l=>l.value))}),{element:a,focus:()=>(c.find(l=>l.checked)??c[0])?.focus(),update(l){let u=Array.isArray(l.value)?l.value:[l.value];c.forEach((d,h)=>{d.checked=u.includes(s[h].value),d.disabled=l.readonly}),rt(a,l)}}}}function Au(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=_e(i,"div",{id:o,class:`fd-points fd-${e}`,role:"radiogroup"}),l=[];for(let u=s;u<=a;u++){let d=_e(i,"button",{type:"button",role:"radio","aria-label":`${u} of ${a}`,"data-value":String(u)},e==="rating"?"\u2605":String(u));e==="scale"&&d.removeAttribute("aria-label"),d.addEventListener("click",()=>t.setValue(r,u)),l.push(d),c.append(d)}return c.addEventListener("keydown",u=>{let d=t.getState().values[r],h=typeof d=="number"?d:s-1,p=u.key==="ArrowRight"||u.key==="ArrowUp"?1:u.key==="ArrowLeft"||u.key==="ArrowDown"?-1:0;if(!p)return;u.preventDefault();let f=Math.min(a,Math.max(s,h+p));t.setValue(r,f),l[f-s]?.focus()}),{element:c,focus:()=>(l.find(u=>u.getAttribute("aria-checked")==="true")??l[0])?.focus(),update(u){let d=typeof u.value=="number"?u.value:null;l.forEach((h,p)=>{let f=s+p;h.setAttribute("aria-checked",String(f===d)),h.classList.toggle("fd-on",e==="rating"?d!==null&&f<=d:f===d),h.tabIndex=f===d||d===null&&p===0?0:-1,h.disabled=u.readonly}),rt(c,u)}}}}var um=e=>{let{form:t,name:r,id:n,document:o,node:i}=e,s=_e(o,"input",{id:n,type:"date",class:"fd-input fd-date"});s.addEventListener("input",()=>t.setValue(r,s.value||null));let a={element:s,focus:()=>s.focus(),update(c){let l=ln(c.value);s.value!==l&&(s.value=l),s.readOnly=c.readonly,rt(s,c)}};return i.options?.weekNumbers===!0?an(a,e,"date"):a},cn=e=>String(e).padStart(2,"0"),dm=e=>{let{form:t,name:r,id:n,document:o,node:i}=e,s=_e(o,"input",{id:n,type:"datetime-local",class:"fd-input fd-datetime"}),a=l=>{if(typeof l!="string"||!l)return"";let u=new Date(l);return Number.isNaN(u.getTime())?"":`${u.getFullYear()}-${cn(u.getMonth()+1)}-${cn(u.getDate())}T${cn(u.getHours())}:${cn(u.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(r,null);let l=new Date(s.value);Number.isNaN(l.getTime())||t.setValue(r,l.toISOString())});let c={element:s,focus:()=>s.focus(),update(l){let u=a(l.value);s.value!==u&&(s.value=u),s.readOnly=l.readonly,rt(s,l)}};return i.options?.weekNumbers===!0?an(c,e,"datetime"):c};function fm({field:e,id:t,document:r}){let n=_e(r,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:n,focus:()=>{},update(o){n.textContent=nn(o.value,e)}}}function nn(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 Ru={char:fr("text"),"char.email":fr("email"),"char.phone":fr("tel"),"char.url":fr("url"),"char.password":fr("password"),"char.tags":Ho,text:sm,integer:si,float:si,monetary:si,"integer.rating":Au("rating"),"integer.scale":Au("scale"),"integer.progressbar":ur,"integer.label":dr,"float.label":dr,"monetary.label":dr,"float.progressbar":ur,"monetary.progressbar":ur,boolean:Nu(),"boolean.toggle":Nu("switch"),selection:lm,"selection.radio":Pu("radio"),"selection.checkboxes":Pu("checkbox"),"selection.statusbar":on,date:um,datetime:dm,many2one:Jo,"many2one.statusbar":on,many2many:rn,"many2many.tags":rn,"many2many.checkboxes":Ko,reference:qo,one2many:Yo,binary:Xo,image:Qo,html:oi,json:ii,properties:ri};var Zu=`
|
|
1
|
+
/*! Fieldia 0.7.0 · MIT · https://fieldia.dev */
|
|
2
|
+
"use strict";var Fieldia=(()=>{var tt=Object.defineProperty;var Wn=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var jn=Object.prototype.hasOwnProperty;var Hn=(e,t,n)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Bn=(e,t)=>{for(var n in t)tt(e,n,{get:t[n],enumerable:!0})},qn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of zn(t))!jn.call(e,a)&&a!==n&&tt(e,a,{get:()=>t[a],enumerable:!(r=Wn(t,a))||r.enumerable});return e};var Jn=e=>qn(tt({},"__esModule",{value:!0}),e);var Ve=(e,t,n)=>Hn(e,typeof t!="symbol"?t+"":t,n);var jr={};Bn(jr,{DEFAULT_LABELS:()=>On,FIELDIA_CSS:()=>Mn,FIELD_NAME:()=>Zt,FIELD_TYPES:()=>nt,FORMAT_VERSION:()=>it,ICONS:()=>Cn,MESSAGES:()=>Te,VERSION:()=>zr,VIEWER_LABELS:()=>Ce,WIDGET_LABELS:()=>de,binaryWidget:()=>It,browserPreferences:()=>Ut,builtInWidgets:()=>Nn,charTagsWidget:()=>Tt,checkPage:()=>st,checkValue:()=>He,compileModifier:()=>Ae,createForm:()=>pt,createMemoryDataSource:()=>sn,createWidget:()=>ke,displayValue:()=>Vt,drawIcon:()=>et,emptyValue:()=>_e,evaluateModifier:()=>en,expressionContext:()=>Ke,fill:()=>lt,formatBytes:()=>Ye,formatNumber:()=>Pe,hostScheduler:()=>Ge,htmlWidget:()=>Ht,imageWidget:()=>Dt,initialValues:()=>ze,installStyles:()=>Jt,isEmpty:()=>je,isModifierValid:()=>tn,isoWeek:()=>wn,jsonWidget:()=>Bt,kindTextField:()=>mn,labelWidget:()=>Xe,lineForm:()=>gn,lineKind:()=>Me,linesWidget:()=>Ot,linkAddress:()=>Sn,linkCheckboxesWidget:()=>Ct,many2oneWidget:()=>Mt,matchesFilter:()=>ut,memoryPreferences:()=>Tr,mountViewer:()=>Kt,normalizeNumber:()=>At,openFormDialog:()=>St,openSearchDialog:()=>_t,progressbarWidget:()=>Ze,propertiesWidget:()=>zt,referenceWidget:()=>$t,sanitizeHtml:()=>jt,saveProblemOf:()=>ct,saveRefused:()=>on,statusbarWidget:()=>yt,summary:()=>ht,tagsWidget:()=>bt,translatePage:()=>dt,wait:()=>ft,wideColumns:()=>rt,withCalendar:()=>xt});var Zt=/^[A-Za-z_][A-Za-z0-9_]*$/,nt=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json"];function rt(e){return typeof e=="object"?e.wide:e??1}var it="0.1";function Oe(e,t){switch(e.type){case"BinaryOp":return Un(e,t);case"UnaryOp":return _n(e,t);case"Literal":return e.value;case"Identifier":return Kn(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Un(e,t){let n=Xt(Oe(e.left,t)),r=Xt(Oe(e.right,t)),a=e.operator.toLowerCase(),i=n!==null&&r!==null;switch(a){case"==":return n===r;case"!=":case"<>":return n!==r;case"<":return i&&n<r;case">":return i&&n>r;case"<=":return i&&n<=r;case">=":return i&&n>=r;case"in":return Array.isArray(r)&&r.includes(n);case"not in":return Array.isArray(r)&&!r.includes(n);case"and":return Ee(n)&&Ee(r);case"or":return Ee(n)||Ee(r);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function _n(e,t){let n=Oe(e.operand,t);if(e.operator.toLowerCase()==="not")return!Ee(n);throw new Error(`Unknown unary operator: ${e.operator}`)}function Xt(e){return e===void 0?null:e}function Ee(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Kn(e,t){let n=t.split("."),r=e;for(let a of n){if(r==null)return;r=r[a]}return r}var Rt=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]);function Je(e){let t=[];if(!e)return t;let n=/(\(|\)|==|!=|<=|>=|<>|<|>|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|-?\d+\.?\d*|\w+(?:\.\w+)*)/iy,r=/\s*/y,a=0;for(;;){if(r.lastIndex=a,r.exec(e),a=r.lastIndex,a>=e.length)return t;n.lastIndex=a;let i=n.exec(e);if(!i)throw new Error(`Unexpected "${e[a]}" at character ${a+1} of: ${e}`);t.push({type:Yn(i[0]),value:i[0],position:t.length}),a=n.lastIndex}}function Yn(e){let t=e.toLowerCase().trim();return Rt.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 Ie=class{constructor(t){Ve(this,"tokens");Ve(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 n=this.previous().value,r=this.parseAnd();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let n=this.previous().value,r=this.parseNot();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,n=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:n}}return this.parseComparison()}parseComparison(){let t=this.parseValue(),n=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...n)){let r=this.previous().value,a=this.parseValue();return{type:"BinaryOp",operator:r.toLowerCase(),left:t,right:a}}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:Rt.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:Gn(t.value)}}if(this.check("IDENTIFIER"))return{type:"Identifier",name:this.advance().value};throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...n){if(this.check(t)){if(n.length===0)return this.advance(),!0;let r=this.peek();if(r&&n.includes(r.value))return this.advance(),!0}return!1}matchLogical(...t){let n=this.peek();if(n&&n.type==="LOGICAL"){let r=n.value.toLowerCase();if(t.map(a=>a.toLowerCase()).includes(r))return this.advance(),!0}return!1}matchOperator(...t){let n=this.peek();if(n&&n.type==="OPERATOR"){let r=n.value.toLowerCase();if(t.map(a=>a.toLowerCase()).includes(r))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,n,r){if(this.check(t)){let a=this.peek();if(a&&a.value===n)return this.advance()}throw new Error(r)}};function Gn(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let n=[],r="",a=!1,i="";for(let o=0;o<t.length;o++){let d=t[o];(d==="'"||d==='"')&&(o===0||t[o-1]!=="\\")&&(a?d===i&&(a=!1,i=""):(a=!0,i=d)),d===","&&!a?(n.push(Qt(r.trim())),r=""):r+=d}return r.trim()&&n.push(Qt(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Qt(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 Ae(e){if(typeof e!="string"){let n=e===!0;return{source:e,fields:[],evaluate:()=>n}}let t=new Ie(Je(e)).parse();return{source:e,fields:Zn(t),evaluate(n){try{return Ee(Oe(t,n))}catch{return!1}}}}function Zn(e){let t=[],n=r=>{switch(r.type){case"Identifier":{let a=r.name.split(".")[0];t.includes(a)||t.push(a);return}case"BinaryOp":n(r.left),n(r.right);return;case"UnaryOp":n(r.operand);return;default:return}};return n(e),t}var at=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ot=class{constructor(t){Ve(this,"page",t);Ve(this,"issues",[]);Ve(this,"ids",new Map)}run(){return this.checkFields(this.page.fields,"fields"),this.walkRoot(this.page.layout,"layout"),this.issues}report(t,n){this.issues.push({path:t,message:n})}claim(t,n){let r=this.ids.get(t);r!==void 0?this.report(n,`duplicate id "${t}", also used at ${r}`):this.ids.set(t,n)}need(t,n,r=this.page.fields){if(at(r,t))return r[t];this.report(n,`no field "${t}"`)}checkModifiers(t,n,r=["invisible"]){for(let a of r){let i=t[a];if(typeof i!="string")continue;let o;try{o=Ae(i).fields}catch(d){this.report(`${n}.${a}`,`cannot read "${i}": ${d.message}`);continue}for(let d of o)at(this.page.fields,d)||this.report(`${n}.${a}`,`"${i}" reads "${d}", which is not a field of this page`)}}checkFields(t,n){for(let[r,a]of Object.entries(t)){let i=`${n}.${r}`;if(a.type==="monetary"&&a.currencyField!==void 0){let o=this.need(a.currencyField,`${i}.currencyField`,t);o&&!["many2one","selection","char"].includes(o.type)&&this.report(`${i}.currencyField`,`"${a.currencyField}" is a ${o.type}; a currency field must be a many2one, selection or char`)}if((a.type==="many2one"||a.type==="many2many")&&a.filter){let o=(d,s)=>{if("any"in d)return d.any.forEach((l,p)=>o(l,`${s}.any[${p}]`));if("all"in d)return d.all.forEach((l,p)=>o(l,`${s}.all[${p}]`));d.valueFrom!==void 0&&this.need(d.valueFrom,`${s}.valueFrom`,t)};a.filter.forEach((d,s)=>{o(d,`${i}.filter[${s}]`)})}if(a.type==="properties"&&a.definitions){let o=new Set;a.definitions.forEach((d,s)=>{d.type==="selection"&&!d.options&&this.report(`${i}.definitions[${s}].options`,"a choice property needs its choices"),o.has(d.name)&&this.report(`${i}.definitions[${s}].name`,`"${d.name}" is named twice`),o.add(d.name)})}if(a.type==="one2many"&&(this.checkFields(a.fields,`${i}.fields`),a.lineKinds&&this.checkLineKinds(r,a.lineKinds,a.fields,`${i}.lineKinds`),a.sequenceField!==void 0)){let o=a.fields[a.sequenceField];o?o.type!=="integer"&&this.report(`${i}.sequenceField`,`"${a.sequenceField}" is a ${o.type}; the field that keeps the order of lines must be an integer`):this.report(`${i}.sequenceField`,`"${a.sequenceField}" is not a field of the lines of "${r}"`)}}}checkLineKinds(t,n,r,a){let i=r[n.field];if(!i)this.report(`${a}.field`,`"${n.field}" is not a field of the lines of "${t}"`);else if(i.type!=="selection"&&i.type!=="char")this.report(`${a}.field`,`"${n.field}" is a ${i.type}; the field that says what a line is must be a selection or char`);else if(i.type==="selection")for(let d of["section","note"]){let s=n[d]??d;i.options.some(l=>l.value===s)||this.report(`${a}.${d}`,`"${n.field}" has no option "${s}"`)}let o=r[n.text];o?o.type!=="char"&&o.type!=="text"&&this.report(`${a}.text`,`"${n.text}" is a ${o.type}; a section's or note's text must be a char or text field`):this.report(`${a}.text`,`"${n.text}" is not a field of the lines of "${t}"`)}walkRoot(t,n){if(t.type==="tabs")return this.walkNode(t,n);if(this.claim(t.id,n),t.type==="sheet")return this.walkSheet(t,n);if(t.type==="sections")return this.walkChildren(t.children,n);t.children.forEach((r,a)=>{let i=`${n}.children[${a}]`;this.claim(r.id,i),this.checkModifiers(r,i),this.walkChildren(r.children,i)})}walkChildren(t,n){t.forEach((r,a)=>this.walkNode(r,`${n}.children[${a}]`))}walkNode(t,n){switch(this.claim(t.id,n),this.checkModifiers(t,n,t.type==="field"?["invisible","readonly","required"]:t.type==="section"?["invisible","readonly"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,n);case"section":return t.collapsible&&!t.title&&this.report(n,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(n,"collapsed needs collapsible: true"),this.walkChildren(t.children,n);case"tabs":return this.walkTabs(t,n);default:return}}walkTabs(t,n){t.children.forEach((r,a)=>{let i=`${n}.children[${a}]`;this.claim(r.id,i),this.checkModifiers(r,i),this.walkChildren(r.children,i)})}walkSheet(t,n){if(t.title&&(this.need(t.title.field,`${n}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${n}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${n}.title.avatarField`)),t.statusbar){let{field:r,visibleStates:a}=t.statusbar,i=this.need(r,`${n}.statusbar.field`);if(i&&i.type!=="selection"&&i.type!=="many2one"&&this.report(`${n}.statusbar.field`,`"${r}" is a ${i.type}; a statusbar needs a selection or many2one`),i?.type==="selection"&&a){let o=new Set(i.options.map(d=>d.value));a.forEach((d,s)=>{o.has(d)||this.report(`${n}.statusbar.visibleStates[${s}]`,`"${d}" is not an option of "${r}"`)})}}t.buttons?.forEach((r,a)=>{this.claim(r.id,`${n}.buttons[${a}]`),this.checkModifiers(r,`${n}.buttons[${a}]`)}),t.statButtons?.forEach((r,a)=>{this.claim(r.id,`${n}.statButtons[${a}]`),this.checkModifiers(r,`${n}.statButtons[${a}]`),r.field!==void 0&&this.need(r.field,`${n}.statButtons[${a}].field`)}),t.ribbon&&(this.claim(t.ribbon.id,`${n}.ribbon`),this.checkModifiers(t.ribbon,`${n}.ribbon`)),t.badges?.forEach((r,a)=>{this.claim(r.id,`${n}.badges[${a}]`),this.checkModifiers(r,`${n}.badges[${a}]`)});for(let r of["above","below"])t.title?.[r]?.forEach((a,i)=>this.walkNode(a,`${n}.title.${r}[${i}]`));t.alerts?.forEach((r,a)=>{this.claim(r.id,`${n}.alerts[${a}]`),this.checkModifiers(r,`${n}.alerts[${a}]`)}),this.walkChildren(t.children,n),t.sidePanel&&(this.claim(t.sidePanel.id,`${n}.sidePanel`),this.checkModifiers(t.sidePanel,`${n}.sidePanel`))}checkFieldNode(t,n){let r=this.need(t.field,`${n}.field`);r&&t.totals&&(r.type!=="one2many"?this.report(`${n}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${r.type}`):t.totals.forEach((a,i)=>{let o=at(r.fields,a)?r.fields[a]:void 0;o?["integer","float","monetary"].includes(o.type)||this.report(`${n}.totals[${i}]`,`"${a}" is a ${o.type}; only integer, float and monetary columns add up`):this.report(`${n}.totals[${i}]`,`"${a}" is not a field of the lines of "${t.field}"`)}));for(let[a,i]of Object.entries(t.options??{}))a.endsWith("Field")&&typeof i=="string"&&this.need(i,`${n}.options.${a}`);if(r&&t.editMode&&r.type!=="one2many"&&this.report(`${n}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&t.optionalColumns)if(r.type!=="one2many")this.report(`${n}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let a=t.columns??Object.keys(r.fields).filter(i=>i!==r.lineKinds?.field&&i!==r.sequenceField);for(let i of Object.keys(t.optionalColumns))a.includes(i)||this.report(`${n}.optionalColumns.${i}`,`"${i}" is not a column of "${t.field}"`)}!r||!t.columns||(r.type==="one2many"?t.columns.forEach((a,i)=>{at(r.fields,a)||this.report(`${n}.columns[${i}]`,`"${a}" is not a field of the lines of "${t.field}"`)}):r.type!=="many2many"&&this.report(`${n}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${r.type}`))}};var Ue=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Xn=["sheet","sections","tabs","wizard"];function st(e){if(!Ue(e))return{ok:!1,issues:[{path:"(page)",message:"a page is a JSON object"}]};let t=[],n=(d,s)=>t.push({path:d,message:s});e.fieldia!=="0.1"&&n("fieldia",`this build reads format ${"0.1"}`),(typeof e.id!="string"||!e.id)&&n("id","a page needs an id");let r=e.data;(!Ue(r)||!(r.kind==="responses"||r.kind==="record"&&typeof r.model=="string"&&r.model))&&n("data",'data is { "kind": "record", "model": \u2026 } or { "kind": "responses" }');let a=e.fields;if(!Ue(a))n("fields","fields is an object of field definitions, by name");else for(let[d,s]of Object.entries(a))(!Ue(s)||!nt.includes(s.type)||typeof s.label!="string")&&n(`fields.${d}`,"a field needs a type Fieldia knows and a label");let i=e.layout;if((!Ue(i)||!Xn.includes(i.type)||!Array.isArray(i.children))&&n("layout","the layout is a sheet, sections, tabs or wizard, with children"),t.length)return{ok:!1,issues:t};let o=e;try{let d=new ot(o).run();return d.length?{ok:!1,issues:d}:{ok:!0,page:o}}catch(d){return{ok:!1,issues:[{path:"(page)",message:`a part of this page cannot be read: ${d.message}`}]}}}var Qn=new Set(["title","description","label","help","placeholder","message","text","confirm","nextLabel","backLabel","finishLabel"]),er=new Set(["lineKinds","filter","default","data"]);function dt(e,t){let n=(r,a)=>{if(typeof r=="string")return a!==null&&Qn.has(a)?t(r):r;if(Array.isArray(r))return r.map(o=>n(o,null));if(r===null||typeof r!="object")return r;let i={};for(let[o,d]of Object.entries(r)){let s=o==="options"&&!Array.isArray(d);i[o]=er.has(o)||s?d:n(d,o)}return i};return n(e,null)}function en(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 n=Je(e);if(n.length===0)return!1;let a=new Ie(n).parse(),i=Oe(a,t);return Ee(i)}catch{return!1}}function tn(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Je(e);return t.length===0||new Ie(t).parse(),!0}catch{return!1}}function _e(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":return e.multiple?[]:null;default:return null}}function ze(e){let t={};for(let[n,r]of Object.entries(e))t[n]=r.default!==void 0?ee(r.default):_e(r);return t}function je(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:!1}function Ke(e,t){let n={};for(let[r,a]of Object.entries(e)){let i=t[r];n[r]=i?tr(i,a):a}return n}function tr(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(n=>n.id);case"one2many":return t.map(n=>n.key);case"reference":{let n=t;return`${n.model},${n.id}`}case"binary":case"image":return t.name;default:return t}}function Me(e,t){let n=e.lineKinds;if(!n)return null;let r=t[n.field];return r===(n.section??"section")?"section":r===(n.note??"note")?"note":null}function ee(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}var Te={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 lt(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n)}function He(e,t,n,r=Te.en){let a=e.label||"This field",i=(o,d={})=>lt(r[o],{label:a,...d});if(je(e,t))return n?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&&nr(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 rr(t,i);case"datetime":return ar(t,i);case"selection":{let o=new Set(e.options.map(s=>s.value)),d=i("choice",{options:e.options.map(s=>s.label).join(", ")});return e.multiple?Array.isArray(t)?t.every(s=>o.has(s))?void 0:d:i("choices"):o.has(t)?void 0:d}case"many2one":return Ft(t)?void 0:i("record");case"many2many":return Array.isArray(t)&&t.every(Ft)?void 0:i("records");case"reference":{let o=t;if(!Ft(t)||typeof o.model!="string")return i("record");if(!e.models.some(d=>d.value===o.model)){let d=rn(e.models.map(s=>s.label),r.or);return i("reference",{models:d,aModels:an(d)})}return}case"binary":case"image":return or(e,t,i,r);default:return}}function nr(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let n=t.indexOf(".");return n===-1?0:t.length-n-1}function Ft(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function rr(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[n,r,a]=e.split("-").map(Number);return nn(n,r,a)?void 0:t("dateInvalid")}var ir=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function ar(e,t){let n=typeof e=="string"?ir.exec(e):null;if(!n)return t("datetimeFormat");let[r,a,i,o,d,s]=n.slice(1).map(l=>Number(l??0));return nn(r,a,i)&&o<24&&d<60&&s<60?void 0:t("datetimeInvalid")}function nn(e,t,n){if(t<1||t>12||n<1)return!1;let r=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return n<=r[t-1]}function or(e,t,n,r){let a=t;if(!sr(t))return n("file");if("maxSize"in e&&e.maxSize!==void 0&&a.size>e.maxSize)return n("fileSize",{size:Ye(e.maxSize)});if(e.type==="binary"&&e.accept&&!e.accept.some(i=>dr(i,a.type))){let i=rn(e.accept.map(lr),r.or);return n("fileType",{types:i,aTypes:an(i)})}}function sr(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function dr(e,t){return e.endsWith("/*")?t.startsWith(e.slice(0,-1)):e===t}function lr(e){return e.endsWith("/*")?e.slice(0,-2):e==="application/pdf"?"PDF":(e.split("/")[1]??e).toUpperCase()}function rn(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function an(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function Ye(e){let t=["bytes","KB","MB","GB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${Number(n.toFixed(1))} ${t[r]}`}function on(e){return Object.assign(new Error(e.message),{problem:e})}function ct(e){let t=e?.problem;if(t&&typeof t.kind=="string")return t;let n=e instanceof Error?e.message:String(e);return e instanceof TypeError&&/fetch|network|load failed/i.test(n)?{kind:"network",message:n}:{kind:"other",message:n}}function ut(e,t){return t.every(n=>Nt(e,n))}function Nt(e,t){return"any"in t?t.any.some(n=>Nt(e,n)):"all"in t?t.all.every(n=>Nt(e,n)):cr(e,t)}function De(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function cr(e,t){let n=e[t.field],r=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"id"in n?n.id:n,a=t.value,i=String(r??"");switch(t.op){case"=":return r===a;case"!=":return r!==a;case"<":return De(r)&&r<a;case">":return De(r)&&r>a;case"<=":return De(r)&&r<=a;case">=":return De(r)&&r>=a;case"in":return Array.isArray(a)&&a.includes(r);case"not in":return Array.isArray(a)&&!a.includes(r);case"like":return i.includes(String(a));case"ilike":return i.toLowerCase().includes(String(a).toLowerCase());case"startswith":return i.toLowerCase().startsWith(String(a).toLowerCase());case"endswith":return i.toLowerCase().endsWith(String(a).toLowerCase());case"set":return De(n);case"notset":return!De(n);case"between":{if(!De(r)||!Array.isArray(a))return!1;let[o,d]=a;return r>=o&&r<=d}}}var Ge={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function ft(e,t=Ge){return new Promise(n=>{t.setTimeout(n,e)})}function sn(e={}){let t=ee(e.records??{}),n=[],r=[],a=1e3,i=()=>e.delayMs?ft(e.delayMs,e.scheduler):Promise.resolve(),o=h=>t[h]??(t[h]={}),d=(h,g)=>{let f=o(h)[String(g)]?.[e.labelField?.[h]??"name"];return typeof f=="string"?f:String(g)},s=h=>Math.max(0,...Object.keys(o(h)).map(Number).filter(Number.isFinite))+1,l=h=>Number.isFinite(Number(h))?Number(h):h;function p(h,g){let f=[...h];for(let w of g)w.op==="create"?f.push({key:w.key,id:++a,values:ee(w.values)}):w.op==="update"?f=f.map(b=>b.id===w.id?{...b,values:{...b.values,...ee(w.values)}}:b):f=f.filter(b=>b.id!==w.id);return f}function y(h,g,f){let w=[...h],b=u=>({id:u,label:d(f,u)});for(let u of g)u.op==="link"&&!w.some(E=>E.id===u.id)?w.push(b(u.id)):u.op==="unlink"?w=w.filter(E=>E.id!==u.id):u.op==="set"?w=u.ids.map(b):u.op==="clear"&&(w=[]);return w}function v(h,g){let f=h[g];return f&&"relation"in f?f.relation:g}return{records:t,responses:n,calls:r,async load(h){r.push({method:"load",request:h}),await i();let g=o(h.model)[String(h.id)];if(!g)throw new Error(`No ${h.model} record with id ${h.id}`);return ee(g)},async save(h){r.push({method:"save",request:h}),await i();let g=h.id??s(h.model),f={...o(h.model)[String(g)]??{},...ee(h.changes.values)};for(let[w,b]of Object.entries(h.changes.lines))f[w]=p(f[w]??[],b);for(let[w,b]of Object.entries(h.changes.links))f[w]=y(f[w]??[],b,v(h.fields,w));return o(h.model)[String(g)]=f,{id:g,values:ee(f)}},async onchange(h){r.push({method:"onchange",request:h}),await i();let g=e.onchange?.[h.model]?.[h.changed],f=e.warnings?.[h.model]?.[h.changed],w=g?{values:g(ee(h.values))}:{},b=f?.(ee(h.values));return b?{...w,warning:b}:w},async search(h){r.push({method:"search",request:h}),await i();let g=h.query.trim().toLowerCase();return Object.entries(o(h.model)).filter(([,f])=>ut(f,h.filter??[])).map(([f])=>({id:l(f),label:d(h.model,l(f))})).filter(f=>f.label.toLowerCase().includes(g)).slice(0,h.limit??8)},async create(h){r.push({method:"create",request:h}),await i();let g=o(h.model),f=Object.keys(g).reduce((w,b)=>Math.max(w,Number(b)||0),0)+1;return g[String(f)]={name:h.name},{id:f,label:h.name}},async submit(h){return r.push({method:"submit",request:h}),await i(),n.push(ee(h)),{id:n.length}}}}function pt(e){let{page:t}=e,n=e.scheduler??Ge,r=e.messages??Te.en,a=pr(t.layout),i=t.layout.type==="wizard"?t.layout.children.map(m=>m.id):[],o=()=>`fieldia:draft:${t.id}:${s.recordId??"new"}`,d={...ze(t.fields),...ee(e.values??{})},s={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:ee(d),errors:{},dirty:[],warning:null,warningField:null,error:null,draft:null,step:i[0]??null,skipped:[],saveProblem:null},l={},p=0,y=0,v=null,h=null,g=new Set,f=new Set,w=null;function b(m){s={...s,...m};for(let x of[...f])x(s)}function u(m){g.add(m);let x=()=>g.delete(m);return m.then(x,x),m}function E(){return w?.values!==s.values&&(w={values:s.values,context:Ke(s.values,t.fields)}),w.context}function k(m){let x=t.fields[m];if(!x)throw new Error(`The page has no field "${m}"`);return x}function F(m){return Object.keys(t.fields).filter(x=>JSON.stringify(m[x]??null)!==JSON.stringify(d[x]??null))}function O(m){let x=a.get(m);if(!x)throw new Error(`The page has no element "${m}"`);let L=E(),S=x.invisible.evaluate(L);for(let z=x.parent;!S&&z;z=a.get(z)?.parent??null)S=a.get(z)?.invisible.evaluate(L)??!1;let N=x.readonly.evaluate(L);for(let z=x.parent;!N&&z;z=a.get(z)?.parent??null)N=a.get(z)?.readonly.evaluate(L)??!1;let T=x.field?t.fields[x.field]:void 0;return{invisible:S,readonly:N||T?.readonly===!0,required:x.required.evaluate(L)||T?.required===!0}}function M(m){let x=S=>{if(!m)return!0;for(let N=S.id;N;N=a.get(N)?.parent??null)if(N===m)return!0;return!1},L=S=>{if(m||!s.skipped.length)return!1;for(let N=S.id;N;N=a.get(N)?.parent??null)if(s.skipped.includes(N))return!0;return!1};return[...a.values()].filter(S=>S.kind==="field"&&x(S)&&!L(S)&&!O(S.id).invisible)}function P(m){let x={};for(let L of M(m)){let S=L.field;if(x[S])continue;let N=t.fields[S],T=He(N,s.values[S],O(L.id).required,r);if(T&&(x[S]=T),N.type==="one2many")for(let z of s.values[S]??[]){let oe=Me(N,z.values);for(let[ae,ue]of Object.entries(N.fields)){if(oe&&ae!==N.lineKinds?.text)continue;let ne=He(ue,z.values[ae],ue.required===!0,r);ne&&(x[`${S}.${z.key}.${ae}`]=ne)}}}return x}function H(m,x={}){let L=Object.keys(s.errors).length?U(m):s.errors;b({values:m,dirty:F(m),errors:L,...x})}function U(m){let x=s;s={...s,values:m};let L=P(s.step??void 0);s=x;let S={};for(let N of Object.keys(s.errors))L[N]&&(S[N]=L[N]);for(let[N,T]of Object.entries(l))JSON.stringify(m[N]??null)===T.value?S[N]??(S[N]=T.message):delete l[N];return S}function re(){let m=e.drafts;m&&(v!==null&&n.clearTimeout(v),v=n.setTimeout(()=>{v=null,m.store.setItem(o(),JSON.stringify({savedAt:new Date().toISOString(),values:s.values}))},m.delayMs??400))}function J(){v!==null&&n.clearTimeout(v),v=null,e.drafts?.store.removeItem(o())}function _(){let m=e.drafts;if(!m)return;let x=m.store.getItem(o());if(!x)return;let L;try{L=JSON.parse(x)}catch{m.store.removeItem(o());return}m.restore==="auto"?H({...s.values,...L.values},{draft:null}):b({draft:{savedAt:L.savedAt}})}function te(){let m=e.autosave;!m||t.data.kind!=="record"||(h!==null&&n.clearTimeout(h),h=n.setTimeout(()=>{h=null,s.dirty.length&&Object.keys(P()).length===0&&u(X())},m.delayMs))}function Z(m){let x=e.dataSource;if(!x?.onchange||t.data.kind!=="record")return;let L=++y,S={model:t.data.model,id:s.recordId,changed:m,values:ee(s.values)};u(x.onchange(S).then(N=>{if(L!==y)return;let T={...s.values,...N.values??{}};H(T,{warning:N.warning??null,warningField:N.warning?m:null})},()=>{}))}function C(m){re(),te(),Z(m)}function $(){let m={values:{},lines:{},links:{}},x=s.recordId===null||s.recordId===void 0,L=x?Object.keys(t.fields).filter(S=>s.dirty.includes(S)||!je(t.fields[S],s.values[S])):s.dirty;for(let S of L){let N=t.fields[S],T=s.values[S],z=x?_e(N):d[S];N.type==="one2many"?m.lines[S]=ur(z??[],T??[]):N.type==="many2many"?m.links[S]=fr(z??[],T??[]):m.values[S]=ee(T)}return m}function W(){let m={};for(let x of M()){let L=x.field;m[L]=ee(s.values[L])}return m}async function X(){let m=P();if(Object.keys(m).length)return b({errors:m}),!1;let x=e.dataSource;l={},b({status:"saving",errors:{},error:null,saveProblem:null});try{if(t.data.kind==="responses"){if(!x?.submit)throw new Error("This page has no data source to send its answers to");return await x.submit({pageId:t.id,values:W()}),J(),b({status:"saved"}),!0}if(!x?.save)throw new Error("This page has no data source to save to");let L=await x.save({model:t.data.model,id:s.recordId,fields:t.fields,changes:$(),values:ee(s.values)});J();let S=L.values?{...s.values,...L.values}:s.values;return d=ee(S),b({status:"saved",recordId:L.id,values:S,dirty:[]}),!0}catch(L){let S=ct(L),N=S.kind==="fields"?S.fields??{}:{};return l=Object.fromEntries(Object.entries(N).map(([T,z])=>[T,{message:z,value:JSON.stringify(s.values[T]??null)}])),b({status:"error",error:S.message,saveProblem:S,errors:{...N}}),!1}}function Q(m){return!e.dataSource?.create||!m||m.readonly?null:m.type==="many2one"||m.type==="many2many"?m.relation:null}async function ce(m,x,L){let S=Q(m),N=e.dataSource;if(!S||!N?.create)throw new Error(`"${x}" cannot make records: its data source has no create, or it is not a link`);return u(N.create({model:S,name:L.trim()}))}async function fe(m,x,L,S,N,T){if(m.type!=="many2one"&&m.type!=="many2many"&&m.type!=="reference")throw new Error(`"${x}" is not a many2one, many2many or reference`);if(m.type==="reference"&&!T)throw new Error(`Searching "${x}" needs a model`);let z=e.dataSource;if(!z?.search)return[];let oe=ne=>"any"in ne?{any:ne.any.map(oe)}:"all"in ne?{all:ne.all.map(oe)}:{field:ne.field,op:ne.op,value:ne.valueFrom!==void 0?L[ne.valueFrom]??null:ne.value??null},ae=m.type==="reference"?void 0:m.filter?.map(oe),ue=m.type==="reference"?T:m.relation;return u(z.search({model:ue,query:S,...ae?{filter:ae}:{},limit:N}))}function pe(m){let x=k(m);if(x.type!=="one2many")throw new Error(`"${m}" is a ${x.type}, not a one2many`);return x}function Se(){return s.step?i.indexOf(s.step):-1}function Fe(m){return a.get(m)?.source?.optional===!0}async function Ne(){let m=e.dataSource;if(!(s.recordId==null||t.data.kind!=="record")){if(!m?.load){b({status:"error",error:"This page has no data source to load from"});return}b({status:"loading",error:null});try{let x=await m.load({model:t.data.model,id:s.recordId,fields:t.fields});d={...ze(t.fields),...x},b({status:"ready",values:ee(d),dirty:[],errors:{}}),_()}catch(x){b({status:"error",error:x.message})}}}let se={page:t,getState:()=>s,subscribe(m){return f.add(m),()=>f.delete(m)},load:()=>u(Ne()),setValue(m,x){k(m),H({...s.values,[m]:ee(x)}),C(m)},node:O,fieldReadonly:m=>k(m).readonly===!0,problem(m){let x=k(m),L=M().filter(S=>S.field===m);return L.length?He(x,s.values[m],L.some(S=>O(S.id).required),r)??null:null},validate(){let m=P();return b({errors:m}),Object.keys(m).length===0},save:()=>u(X()),reset(){J(),l={},b({values:ee(d),dirty:[],errors:{},warning:null,warningField:null,draft:null,step:i[0]??null,skipped:[],saveProblem:null})},changes:$,addLine(m,x={}){let L=pe(m),S=`new-${++p}`,N=s.values[m]??[],T={key:S,values:{...ze(L.fields),...ee(x)}};if(L.sequenceField&&T.values[L.sequenceField]==null){let oe=N.map(ae=>ae.values[L.sequenceField]).filter(ae=>typeof ae=="number");T.values[L.sequenceField]=oe.length?Math.max(...oe)+1:1}let z=[...N,T];return H({...s.values,[m]:z}),C(m),S},updateLine(m,x,L,S){if(!pe(m).fields[L])throw new Error(`The lines of "${m}" have no field "${L}"`);let T=(s.values[m]??[]).map(z=>z.key===x?{...z,values:{...z.values,[L]:ee(S)}}:z);H({...s.values,[m]:T}),C(m)},moveLine(m,x,L){let N=pe(m).sequenceField;if(!N)throw new Error(`The lines of "${m}" keep no order: give the field a sequenceField`);let T=[...s.values[m]??[]],z=T.findIndex(me=>me.key===x);if(z<0)throw new Error(`"${m}" has no line "${x}"`);let oe=Math.max(0,Math.min(L,T.length-1));if(oe===z)return;let ae=T.map(me=>me.values[N]),ue=ae.every((me,be)=>typeof me=="number"&&(be===0||me>ae[be-1]));T.splice(oe,0,...T.splice(z,1));let ne=Math.min(z,oe),Be=Math.max(z,oe),Lt=ue?ae.slice(ne,Be+1):[],Et=T.map((me,be)=>{let ve=ue?be>=ne&&be<=Be?Lt[be-ne]:me.values[N]:be+1;return ve===me.values[N]?me:{...me,values:{...me.values,[N]:ve}}});H({...s.values,[m]:Et}),C(m)},removeLine(m,x){pe(m);let L=(s.values[m]??[]).filter(S=>S.key!==x);H({...s.values,[m]:L}),C(m)},async search(m,x,L=8,S={}){return fe(k(m),m,E(),x,L,S.model)},async previewLine(m,x,L){pe(m);let S=s.values[m]??[],N=S.find(ne=>ne.key===x);if(!N)throw new Error(`"${m}" has no line "${x}"`);let T={...N.values,...L},z=e.dataSource;if(!z?.onchange||t.data.kind!=="record")return T;let oe=S.map(ne=>ne.key===x?{...ne,values:T}:ne),ue=((await z.onchange({model:t.data.model,id:s.recordId,changed:m,values:ee({...s.values,[m]:oe})})).values?.[m]??[]).find(ne=>ne.key===x);return ue?{...T,...ue.values}:T},async searchLine(m,x,L,S,N=8){let T=pe(m),z=T.fields[L];if(!z)throw new Error(`The lines of "${m}" have no field "${L}"`);let oe=(s.values[m]??[]).find(ae=>ae.key===x);if(!oe)throw new Error(`"${m}" has no line "${x}"`);return fe(z,L,Ke(oe.values,T.fields),S,N)},canCreate:m=>Q(t.fields[m])!==null,quickCreate:(m,x)=>ce(t.fields[m],m,x),canCreateLine:(m,x)=>Q(pe(m).fields[x])!==null,quickCreateLine:(m,x,L)=>ce(pe(m).fields[x],x,L),steps:()=>i.filter(m=>!O(m).invisible),next(){if(!s.step)return!1;s.skipped.includes(s.step)&&b({skipped:s.skipped.filter(S=>S!==s.step)});let m=P(s.step);if(Object.keys(m).length)return b({errors:m}),!1;let x=se.steps(),L=i.slice(Se()+1).find(S=>x.includes(S));return L?(b({step:L,errors:{}}),!0):!1},back(){if(!s.step)return!1;let m=se.steps(),x=i.slice(0,Se()).reverse().find(L=>m.includes(L));return x?(b({step:x,errors:{}}),!0):!1},skip(){let m=s.step;if(!m||!Fe(m))return!1;let x=se.steps(),L=x[x.indexOf(m)+1];return L?(b({step:L,errors:{},skipped:[...s.skipped.filter(S=>S!==m),m]}),!0):!1},goTo(m){let x=se.steps(),L=x.indexOf(m),S=s.step?x.indexOf(s.step):-1;if(L===-1||S===-1)return!1;if(L<=S)return b({step:m,errors:{}}),!0;let N=[...s.skipped];for(let T of x.slice(S,L)){if(N.includes(T))continue;let z=P(T);if(Object.keys(z).length){if(Fe(T)){N.push(T);continue}return b({step:T,errors:z,skipped:N}),!1}}return b({step:m,errors:{},skipped:N}),!0},async runAction(m){let x=a.get(m);if(!x||x.kind!=="button"&&x.kind!=="stat")throw new Error(`The page has no button "${m}"`);if(O(m).invisible)return;let L=x.source;await u(Promise.resolve(e.onAction?.({id:m,action:L.action,..."params"in L&&L.params?{params:L.params}:{},recordId:s.recordId,values:ee(s.values)})))},restoreDraft(){let m=e.drafts?.store.getItem(o());if(!m)return;let x=JSON.parse(m);H({...s.values,...x.values},{draft:null})},discardDraft(){J(),b({draft:null})},async settled(){for(;g.size;)await Promise.allSettled([...g])},dispose(){v!==null&&n.clearTimeout(v),h!==null&&n.clearTimeout(h),f.clear()}};return s.recordId==null&&_(),se}function ur(e,t){let n=[],r=new Map(e.filter(i=>i.id!==void 0).map(i=>[i.key,i]));for(let i of t){let o=r.get(i.key);if(i.id===void 0||!o){n.push({op:"create",key:i.key,values:ee(i.values)});continue}let d={};for(let[s,l]of Object.entries(i.values))JSON.stringify(l)!==JSON.stringify(o.values[s])&&(d[s]=ee(l));Object.keys(d).length&&n.push({op:"update",id:i.id,values:d})}let a=new Set(t.map(i=>i.key));for(let i of e)i.id!==void 0&&!a.has(i.key)&&n.push({op:"delete",id:i.id});return n}function fr(e,t){let n=new Set(e.map(a=>a.id)),r=new Set(t.map(a=>a.id));return[...t.filter(a=>!n.has(a.id)).map(a=>({op:"link",id:a.id})),...e.filter(a=>!r.has(a.id)).map(a=>({op:"unlink",id:a.id}))]}function pr(e){let t=new Map,n=(a,i,o,d)=>{t.set(a.id,{id:a.id,parent:i,kind:o,field:d.field,invisible:Ae(d.invisible),readonly:Ae(d.readonly),required:Ae(d.required),source:a})},r=(a,i)=>{for(let o of a)if(o.type==="field")n(o,i,"field",{invisible:o.invisible,readonly:o.readonly,required:o.required,field:o.field});else if(o.type==="button")n(o,i,"button",{invisible:o.invisible});else if(o.type==="tabs"){n(o,i,"other",{invisible:o.invisible});for(let d of o.children)n(d,o.id,"other",{invisible:d.invisible}),r(d.children,d.id)}else o.type==="section"?(n(o,i,"other",{invisible:o.invisible,readonly:o.readonly}),r(o.children,o.id)):n(o,i,"other",{invisible:o.invisible})};if(e.type==="tabs")return r([e],""),t.get(e.id).parent=null,t;if(n(e,null,"other",{}),e.type==="wizard")for(let a of e.children)n(a,e.id,"step",{invisible:a.invisible}),r(a.children,a.id);else if(e.type==="sections")r(e.children,e.id);else{let a=(i,o)=>{o&&n({id:i},e.id,"field",{field:o})};a("#title",e.title?.field),a("#subtitle",e.title?.subtitleField),a("#avatar",e.title?.avatarField),a("#statusbar",e.statusbar?.field);for(let i of e.buttons??[])n(i,e.id,"button",{invisible:i.invisible});for(let i of e.statButtons??[])n(i,e.id,"stat",{invisible:i.invisible});e.ribbon&&n(e.ribbon,e.id,"other",{invisible:e.ribbon.invisible});for(let i of e.alerts??[])n(i,e.id,"other",{invisible:i.invisible});for(let i of e.badges??[])n(i,e.id,"other",{invisible:i.invisible});r([...e.title?.above??[],...e.title?.below??[]],e.id),r(e.children,e.id),e.sidePanel&&n(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible})}return t}var dn=new Map;function ln(e,t){let n=`${e}:${t}`,r=dn.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),dn.set(n,r)),r}function mr(e){let t=ln(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function Pe(e,t,n="en"){return ln(n,t).format(e)}function At(e,t="en"){let{group:n,decimal:r}=mr(t),a=e.replace(/[٠-٩]/g,i=>String(i.charCodeAt(0)-1632)).replace(/[۰-۹]/g,i=>String(i.charCodeAt(0)-1776)).replace(/٫/g,r).replace(/٬/g,n);return a=a.replace(/[\s\u00a0\u202f]/g,""),n.trim()&&(a=a.split(n).join("")),r==="."?a:a.split(r).join(".")}var de={en:{search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",createNamed:"Create \u201C{name}\u201D",createAndEdit:"Create and edit\u2026",searchMore:"Search more\u2026",openNamed:"Open {name}",openLine:"Open line",chooseDate:"Choose a date",previousMonth:"Previous month",nextMonth:"Next month",weekShort:"Wk",week:"Week",formatting:"Formatting",bold:"Bold",italic:"Italic",underline:"Underline",textStyle:"Text style",paragraph:"Paragraph",heading:"Heading",subheading:"Subheading",bulletList:"Bulleted list",numberList:"Numbered list",alignLeft:"Align left",alignCenter:"Align centre",alignRight:"Align right",link:"Link",linkAddress:"Link address",applyLink:"Apply",removeLink:"Remove link",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",invalidJson:"Not valid JSON"},ar:{search:"\u0628\u062D\u062B\u2026",noResults:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",clear:"\u0645\u0633\u062D {label}",addLine:"\u0625\u0636\u0627\u0641\u0629 \u0633\u0637\u0631",addSection:"\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",addNote:"\u0625\u0636\u0627\u0641\u0629 \u0645\u0644\u0627\u062D\u0638\u0629",deleteLine:"\u062D\u0630\u0641 \u0627\u0644\u0633\u0637\u0631",total:"\u0627\u0644\u0625\u062C\u0645\u0627\u0644\u064A",lineProblem:"\u0627\u0644\u0633\u0637\u0631 {n}: {message}",moreProblems:"\u0648{n} \u0623\u062E\u0631\u0649",chooseColumns:"\u0627\u062E\u062A\u064A\u0627\u0631 \u0627\u0644\u0623\u0639\u0645\u062F\u0629",createNamed:"\u0625\u0646\u0634\u0627\u0621 \xAB{name}\xBB",createAndEdit:"\u0625\u0646\u0634\u0627\u0621 \u0648\u062A\u0639\u062F\u064A\u0644\u2026",searchMore:"\u0628\u062D\u062B \u0645\u0648\u0633\u0651\u0639\u2026",openNamed:"\u0641\u062A\u062D {name}",openLine:"\u0641\u062A\u062D \u0627\u0644\u0633\u0637\u0631",chooseDate:"\u0627\u062E\u062A\u064A\u0627\u0631 \u062A\u0627\u0631\u064A\u062E",previousMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0633\u0627\u0628\u0642",nextMonth:"\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u062A\u0627\u0644\u064A",weekShort:"\u0623\u0633\u0628\u0648\u0639",week:"\u0627\u0644\u0623\u0633\u0628\u0648\u0639",formatting:"\u0627\u0644\u062A\u0646\u0633\u064A\u0642",bold:"\u063A\u0627\u0645\u0642",italic:"\u0645\u0627\u0626\u0644",underline:"\u062A\u0633\u0637\u064A\u0631",textStyle:"\u0646\u0645\u0637 \u0627\u0644\u0646\u0635",paragraph:"\u0641\u0642\u0631\u0629",heading:"\u0639\u0646\u0648\u0627\u0646",subheading:"\u0639\u0646\u0648\u0627\u0646 \u0641\u0631\u0639\u064A",bulletList:"\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",numberList:"\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629",alignLeft:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0633\u0627\u0631",alignCenter:"\u062A\u0648\u0633\u064A\u0637",alignRight:"\u0645\u062D\u0627\u0630\u0627\u0629 \u0644\u0644\u064A\u0645\u064A\u0646",link:"\u0631\u0627\u0628\u0637",linkAddress:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0631\u0627\u0628\u0637",applyLink:"\u062A\u0637\u0628\u064A\u0642",removeLink:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0627\u0628\u0637",upload:"\u0631\u0641\u0639 \u0645\u0644\u0641",uploadImage:"\u0625\u0636\u0627\u0641\u0629 \u0635\u0648\u0631\u0629",replace:"\u0627\u0633\u062A\u0628\u062F\u0627\u0644",removeFile:"\u0625\u0632\u0627\u0644\u0629",dropHere:"\u0623\u0648 \u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",invalidJson:"\u0644\u064A\u0633 JSON \u0635\u0627\u0644\u062D\u064B\u0627"},de:{search:"Suchen\u2026",noResults:"Keine Ergebnisse",remove:"{name} entfernen",clear:"{label} leeren",addLine:"Zeile hinzuf\xFCgen",addSection:"Abschnitt hinzuf\xFCgen",addNote:"Notiz hinzuf\xFCgen",deleteLine:"Zeile l\xF6schen",total:"Summe",lineProblem:"Zeile {n}: {message}",moreProblems:"und {n} weitere",chooseColumns:"Spalten ausw\xE4hlen",createNamed:"\u201E{name}\u201C anlegen",createAndEdit:"Anlegen und bearbeiten\u2026",searchMore:"Weitere suchen\u2026",openNamed:"{name} \xF6ffnen",openLine:"Zeile \xF6ffnen",chooseDate:"Datum ausw\xE4hlen",previousMonth:"Vorheriger Monat",nextMonth:"N\xE4chster Monat",weekShort:"KW",week:"Kalenderwoche",formatting:"Formatierung",bold:"Fett",italic:"Kursiv",underline:"Unterstrichen",textStyle:"Textstil",paragraph:"Absatz",heading:"\xDCberschrift",subheading:"Unter\xFCberschrift",bulletList:"Aufz\xE4hlung",numberList:"Nummerierte Liste",alignLeft:"Linksb\xFCndig",alignCenter:"Zentriert",alignRight:"Rechtsb\xFCndig",link:"Link",linkAddress:"Linkadresse",applyLink:"\xDCbernehmen",removeLink:"Link entfernen",upload:"Datei hochladen",uploadImage:"Foto hinzuf\xFCgen",replace:"Ersetzen",removeFile:"Entfernen",dropHere:"oder hier ablegen",invalidJson:"Kein g\xFCltiges JSON"},fr:{search:"Rechercher\u2026",noResults:"Aucun r\xE9sultat",remove:"Retirer {name}",clear:"Effacer {label}",addLine:"Ajouter une ligne",addSection:"Ajouter une section",addNote:"Ajouter une note",deleteLine:"Supprimer la ligne",total:"Total",lineProblem:"Ligne {n} : {message}",moreProblems:"et {n} de plus",chooseColumns:"Choisir les colonnes",createNamed:"Cr\xE9er \xAB {name} \xBB",createAndEdit:"Cr\xE9er et modifier\u2026",searchMore:"Rechercher plus\u2026",openNamed:"Ouvrir {name}",openLine:"Ouvrir la ligne",chooseDate:"Choisir une date",previousMonth:"Mois pr\xE9c\xE9dent",nextMonth:"Mois suivant",weekShort:"Sem.",week:"Semaine",formatting:"Mise en forme",bold:"Gras",italic:"Italique",underline:"Soulign\xE9",textStyle:"Style du texte",paragraph:"Paragraphe",heading:"Titre",subheading:"Sous-titre",bulletList:"Liste \xE0 puces",numberList:"Liste num\xE9rot\xE9e",alignLeft:"Aligner \xE0 gauche",alignCenter:"Centrer",alignRight:"Aligner \xE0 droite",link:"Lien",linkAddress:"Adresse du lien",applyLink:"Appliquer",removeLink:"Supprimer le lien",upload:"T\xE9l\xE9verser un fichier",uploadImage:"Ajouter une photo",replace:"Remplacer",removeFile:"Retirer",dropHere:"ou d\xE9posez-le ici",invalidJson:"JSON invalide"}};var gr=180,cn=8;function mt(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function gt(e){let{document:t,id:n,labels:r}=e,a=`${n}-list`,i=t.createElement("input");Object.assign(i,{id:n,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",a),i.placeholder=r.search;let o=t.createElement("ul");o.id=a,o.className="fd-listbox",o.setAttribute("role","listbox"),o.hidden=!0;let d=t.createElement("div");d.className="fd-combo",d.append(i,o);let s="",l=null,p="",y=new Map,v=!1,h=[],g=-1,f=0,w,b=!1;function u(){if(o.replaceChildren(),h.forEach((M,P)=>{let H=t.createElement("li");H.id=`${a}-${P}`,H.setAttribute("role","option"),H.setAttribute("aria-selected",String(P===g)),H.className=`fd-option${P===g?" fd-active":""}${M===l||y.has(M)?" fd-option-create":""}`,H.textContent=M.label,H.addEventListener("mousedown",U=>U.preventDefault()),H.addEventListener("click",()=>F(P)),o.append(H)}),!h.length){let M=t.createElement("li");M.className="fd-empty",M.textContent=r.noResults,o.append(M)}g>=0?i.setAttribute("aria-activedescendant",`${a}-${g}`):i.removeAttribute("aria-activedescendant")}function E(){o.hidden=!1,i.setAttribute("aria-expanded","true")}function k(){clearTimeout(w),f++,o.hidden=!0,i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant"),g=-1}function F(M){let P=h[M];if(!P)return;let H=p;if(k(),v=!1,P===l&&e.create){e.create(H).then(e.pick,()=>{});return}let U=y.get(P);if(U){U(H).then(re=>re&&e.pick(re),()=>{});return}e.pick(P)}function O(M){clearTimeout(w);let P=++f;w=setTimeout(async()=>{let H=await e.search(M).catch(()=>[]);if(P!==f||t.activeElement!==i)return;let U=h[g],re=U&&U!==l&&!y.has(U)?U.id:void 0,J=e.exclude?.()??new Set,_=H.filter(C=>!J.has(C.id)),te=e.shown!==void 0&&_.length>e.shown;h=te?_.slice(0,e.shown):_;let Z=M.trim();l=null,e.create&&Z&&!H.some(C=>C.label.trim().toLowerCase()===Z.toLowerCase())&&(p=Z,l={id:"__create__",label:mt(r.createNamed,{name:Z})},h=[...h,l]),p=Z,y=new Map((e.more?.(Z,te)??[]).map((C,$)=>[{id:`__more_${$}__`,label:C.label},C.act])),h=[...h,...y.keys()],g=re===void 0?-1:h.findIndex(C=>C.id===re),u(),E()},gr)}return i.addEventListener("input",()=>{v=!0,b||O(i.value)}),i.addEventListener("focus",()=>{b||O("")}),i.addEventListener("keydown",M=>{if(!b)switch(M.key){case"ArrowDown":case"ArrowUp":{if(M.preventDefault(),o.hidden)return O(i.value);if(!h.length)return;g=(g+(M.key==="ArrowDown"?1:-1)+h.length)%h.length,u(),o.children[g]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!o.hidden&&g>=0&&(M.preventDefault(),F(g));return;case"Escape":o.hidden||M.preventDefault(),k(),v=!1,i.value=s;return;case"Backspace":i.value===""&&e.onEmptyBackspace?.();return}}),i.addEventListener("blur",()=>{f++,clearTimeout(w),k();let M=v&&i.value.trim()===""&&s!=="";v=!1,M?e.onCommitEmpty?.():i.value=s}),{element:d,input:i,setText(M){s=M,v||(i.value=M)},setReadonly(M){b=M,i.readOnly=M,M&&k()},close:k}}function un(e,t,n){return n.options?.create!==!1&&e.canCreate(t)?r=>e.quickCreate(t,r):void 0}var Mt=({form:e,name:t,field:n,node:r,id:a,document:i,labels:o=de.en,dialogs:d})=>{let s=n.type==="many2one"?n.relation:"",l=!!d&&d.canOpen(s),p=!1,y=gt({document:i,id:a,labels:o,search:g=>e.search(t,g,cn+1),shown:cn,pick:g=>e.setValue(t,g),onCommitEmpty:()=>e.setValue(t,null),create:un(e,t,r),more:(g,f)=>{if(!d||p)return[];let w=[];return g&&l&&r.options?.create!==!1&&w.push({label:o.createAndEdit,act:b=>d.openRecord(s,{name:b,title:n.label})}),f&&w.push({label:o.searchMore,act:()=>d.searchMore({title:n.label,search:(b,u)=>e.search(t,b,u)})}),w}}),v=l?i.createElement("button"):null;v&&(v.type="button",v.className="fd-combo-open",v.textContent="\u2197",v.hidden=!0,v.addEventListener("click",async()=>{let g=e.getState().values[t];if(!g||!d)return;let f=await d.openRecord(s,{recordId:g.id,title:g.label});f&&f.label!==g.label&&e.setValue(t,f)}));let h=i.createElement("button");return h.type="button",h.className="fd-combo-clear",h.textContent="\xD7",h.setAttribute("aria-label",mt(o.clear,{label:n.label})),h.addEventListener("click",()=>{e.setValue(t,null),y.input.focus()}),y.element.append(h,...v?[v]:[]),{element:y.element,focus:()=>y.input.focus(),update(g){let f=g.value;p=g.readonly,y.setText(f?.label??""),y.setReadonly(g.readonly),h.hidden=!f||g.readonly,v&&(v.hidden=!f,f&&v.setAttribute("aria-label",mt(o.openNamed,{name:f.label}))),y.input.setAttribute("aria-invalid",String(g.invalid)),y.input.setAttribute("aria-required",String(g.required)),g.describedBy&&y.input.setAttribute("aria-describedby",g.describedBy)}}},bt=({form:e,name:t,node:n,id:r,document:a,labels:i=de.en})=>{let o=()=>e.getState().values[t]??[],d=a.createElement("div");d.className="fd-tags",d.setAttribute("role","group");let s=a.createElement("ul");s.className="fd-chips";let l=gt({document:a,id:r,labels:i,search:v=>e.search(t,v),pick:v=>{e.setValue(t,[...o(),v]),l.input.value=""},exclude:()=>new Set(o().map(v=>v.id)),onEmptyBackspace:()=>{let v=o();v.length&&e.setValue(t,v.slice(0,-1))},create:un(e,t,n)});d.append(s,l.element);let p=!1,y="";return{element:d,focus:()=>l.input.focus(),update(v){let h=v.value??[],g=JSON.stringify([v.readonly,h]);p=v.readonly,l.setReadonly(p),l.element.hidden=p,l.input.setAttribute("aria-invalid",String(v.invalid)),v.describedBy&&l.input.setAttribute("aria-describedby",v.describedBy),g!==y&&(y=g,fn(s,h,p,i,f=>e.setValue(t,o().filter(w=>w.id!==f.id))),l.setText(""))}}};function fn(e,t,n,r,a){let i=e.ownerDocument;e.replaceChildren(...t.map(o=>{let d=i.createElement("li");d.className="fd-chip";let s=i.createElement("span");if(s.className="fd-chip-label",s.textContent=o.label,d.append(s),!n){let l=i.createElement("button");l.type="button",l.className="fd-chip-remove",l.textContent="\xD7",l.setAttribute("aria-label",mt(r.remove,{name:o.label})),l.addEventListener("click",()=>a(o)),d.append(l)}return d}))}var Tt=({form:e,name:t,node:n,id:r,document:a,labels:i=de.en})=>{let o=n.options??{},d=typeof o.separator=="string"&&o.separator?o.separator:",",s=Array.isArray(o.suggestions)?o.suggestions.filter(b=>typeof b=="string"):[],l=b=>typeof b=="string"?b.split(d).map(u=>u.trim()).filter(u=>u!==""):[],p=()=>l(e.getState().values[t]),y=b=>e.setValue(t,b.length?b.join(`${d} `):null),v=b=>{let u=b.trim(),E=p();u&&!E.some(k=>k.toLowerCase()===u.toLowerCase())&&y([...E,u])},h=a.createElement("div");h.className="fd-tags",h.setAttribute("role","group");let g=a.createElement("ul");g.className="fd-chips";let f=gt({document:a,id:r,labels:i,search:async b=>{let u=new Set(p().map(k=>k.toLowerCase())),E=b.trim().toLowerCase();return s.filter(k=>!u.has(k.toLowerCase())&&k.toLowerCase().includes(E)).map(k=>({id:k,label:k}))},pick:b=>{v(b.label),f.input.value=""},onEmptyBackspace:()=>{let b=p();b.length&&y(b.slice(0,-1))}});f.input.addEventListener("keydown",b=>{b.key!=="Enter"||b.defaultPrevented||f.input.value.trim()===""||(b.preventDefault(),v(f.input.value),f.input.value="",f.close())}),f.input.addEventListener("input",()=>{let b=f.input.value.split(d);if(!(b.length<2)){for(let u of b.slice(0,-1))v(u);f.input.value=b[b.length-1].trimStart()}}),f.input.addEventListener("change",()=>{f.input.value.trim()&&v(f.input.value)}),h.append(g,f.element);let w="";return{element:h,focus:()=>f.input.focus(),update(b){let u=l(b.value);f.setReadonly(b.readonly),f.element.hidden=b.readonly,f.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&f.input.setAttribute("aria-describedby",b.describedBy);let E=JSON.stringify([b.readonly,u]);E!==w&&(w=E,fn(g,u.map(k=>({id:k,label:k})),b.readonly,i,k=>y(p().filter(F=>F!==k.label))),f.setText(""))}}},Ct=({form:e,name:t,id:n,document:r})=>{let a=r.createElement("div");a.id=n,a.className="fd-choices fd-choices-checkbox",a.setAttribute("role","group");let i=[],o={readonly:!1,value:[]},d=()=>{let s=new Set(o.value.map(l=>l.id));for(let{record:l,box:p}of i)p.checked=s.has(l.id),p.disabled=o.readonly};return e.search(t,"",50).then(s=>{i=s.map((l,p)=>{let y=r.createElement("input");y.type="checkbox",y.id=`${n}-${p}`,y.addEventListener("change",()=>{let g=e.getState().values[t]??[];e.setValue(t,y.checked?[...g,l]:g.filter(f=>f.id!==l.id))});let v=r.createElement("label");v.className="fd-choice",v.htmlFor=y.id;let h=r.createElement("span");return h.textContent=l.label,v.append(y,h),a.append(v),{record:l,box:y}}),d()}),{element:a,focus:()=>a.querySelector("input")?.focus(),update(s){o={readonly:s.readonly,value:s.value??[]},d()}}},$t=e=>{let{form:t,name:n,field:r,id:a,document:i,labels:o=de.en}=e,d=r.type==="reference"?r.models:[],s=i.createElement("div");s.className="fd-reference";let l=i.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",r.label),l.append(i.createElement("option"));for(let v of d){let h=i.createElement("option");h.value=String(v.value),h.textContent=v.label,l.append(h)}let p="";l.addEventListener("change",()=>{p=l.value,t.setValue(n,null)});let y=gt({document:i,id:a,labels:o,search:v=>p?t.search(n,v,8,{model:p}):Promise.resolve([]),pick:v=>t.setValue(n,{model:p,id:v.id,label:v.label}),onCommitEmpty:()=>t.setValue(n,null)});return s.append(l,y.element),{element:s,focus:()=>p?y.input.focus():l.focus(),update(v){let h=v.value;h&&(p=h.model),l.value=p,l.disabled=v.readonly,y.setText(h?.label??""),y.setReadonly(v.readonly||!p)}}};function pn(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,n,r,a,i,o]=t;return new Date(Number(n),Number(r)-1,Number(a),Number(i??0),Number(o??0))}function Vt(e,t,n={},r="en"){let a=(i,o)=>Pe(i,o,r);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(i=>i.label).join(", ");case"selection":{let i=o=>e.options.find(d=>d.value===o)?.label??String(o);return Array.isArray(t)?t.map(i).join(", "):i(t)}case"integer":return a(Number(t),0);case"float":return a(Number(t),e.digits?.[1]??2);case"monetary":{let i=e.currency??(e.currencyField?n[e.currencyField]?.label:void 0),o=a(Number(t),e.digits?.[1]??2);return i?`${i} ${o}`:o}case"date":{let i=pn(String(t));return i?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(i):String(t)}case"datetime":{let i=pn(String(t));return i?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(i):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return t.name??"";case"boolean":return t?"\u2713":"";default:return String(t)}}function mn(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function gn(e,t,n){let r=()=>(e.getState().values[t]??[]).find(a=>a.key===n)?.values??{};return{...e,getState:()=>({...e.getState(),values:r()}),setValue:(a,i)=>e.updateLine(t,n,a,i),search:(a,i,o)=>e.searchLine(t,n,a,i,o),canCreate:a=>e.canCreateLine(t,a),quickCreate:(a,i)=>e.quickCreateLine(t,a,i)}}var Ot=({form:e,name:t,field:n,node:r,id:a,document:i,labels:o=de.en,locale:d,dialogs:s})=>{let l=n,p=l.lineKinds,y=(r.columns??Object.keys(l.fields)).filter(J=>l.fields[J]&&J!==p?.field&&J!==l.sequenceField&&r.optionalColumns?.[J]!=="hide"),v=i.createElement("div");v.className="fd-lines",v.id=a,v.setAttribute("role","group");let h=i.createElement("div");h.className="fd-lines-scroll";let g=i.createElement("table");g.className="fd-lines-table";let f=i.createElement("thead"),w=i.createElement("tr");for(let J of y){let _=i.createElement("th");_.scope="col",_.textContent=l.fields[J].label,w.append(_)}let b=i.createElement("th");b.className="fd-lines-tools",w.append(b),f.append(w);let u=i.createElement("tbody");g.append(f,u);let E=(r.totals??[]).filter(J=>y.includes(J)),k=new Map;if(E.length){let J=i.createElement("tfoot"),_=i.createElement("tr");_.className="fd-lines-totals",y.forEach((te,Z)=>{let C=i.createElement("td");E.includes(te)?k.set(te,C):Z===0&&(C.textContent=o.total),_.append(C)}),_.append(i.createElement("td")),J.append(_),g.append(J)}h.append(g);let F=i.createElement("div");F.className="fd-lines-adds";let O=(J,_,te)=>{let Z=i.createElement("button");Z.type="button",Z.className="fd-button fd-button-link fd-lines-add",Z.dataset.add=te,Z.textContent=`+ ${J}`,Z.addEventListener("click",()=>{P=e.addLine(t,_);let C=M.get(P);C&&(C.cells[0]?.widget.focus(),P=null)}),F.append(Z)};O(o.addLine,{},"line"),p&&(O(o.addSection,{[p.field]:p.section??"section"},"section"),O(o.addNote,{[p.field]:p.note??"note"},"note")),v.append(h,F);let M=new Map,P=null,H=!1;function U(J,_,te,Z,C=1){let $=`${a}-${_.key}-${te}`,W={type:"field",id:`${r.id}.${_.key}.${te}`,field:te},X=ke({form:gn(e,t,_.key),name:te,field:Z,node:W,id:$,document:i,labels:o,locale:d,dialogs:s}),Q=i.createElement("td");Q.colSpan=C;let ce=i.createElement("label");ce.className="fd-sr-only",ce.htmlFor=$,ce.textContent=Z.label;let fe=i.createElement("div");return fe.className="fd-cell-error",fe.hidden=!0,Q.append(ce,X.element,fe),J.append(Q),{name:te,def:Z,widget:X,error:fe}}function re(J){let _=i.createElement("tr");_.dataset.line=J.key;let te=Me(l,J.values);te&&(_.className=`fd-line-${te}`);let Z=te&&p?[U(_,J,p.text,mn(l.fields[p.text],te),y.length)]:y.map(W=>U(_,J,W,l.fields[W])),C=i.createElement("td");C.className="fd-lines-tools";let $=i.createElement("button");return $.type="button",$.className="fd-line-delete",$.textContent="\xD7",$.setAttribute("aria-label",o.deleteLine),$.addEventListener("click",()=>e.removeLine(t,J.key)),C.append($),_.append(C),{element:_,kind:te,cells:Z,remove:$}}return{element:v,focus:()=>(u.querySelector("input, select, textarea")??F.querySelector("button"))?.focus(),update(J){H=J.readonly,F.hidden=H;let _=J.value??[],te=e.getState().errors,Z=new Set(_.map(C=>C.key));for(let[C,$]of M)Z.has(C)||($.element.remove(),M.delete(C));_.forEach((C,$)=>{let W=M.get(C.key);W&&W.kind!==Me(l,C.values)&&(W.element.remove(),W=void 0),W||(W=re(C),M.set(C.key,W)),u.children[$]!==W.element&&u.insertBefore(W.element,u.children[$]??null),W.remove.hidden=H,H?W.remove.remove():W.remove.isConnected||W.element.lastElementChild?.append(W.remove);for(let X of W.cells){let Q=te[`${t}.${C.key}.${X.name}`];X.error.hidden=!Q,X.error.textContent=Q??"",X.widget.update({value:C.values[X.name],values:C.values,readonly:H||X.def.readonly===!0,required:X.def.required===!0,invalid:!!Q})}});for(let[C,$]of k){let W=_.filter(X=>!Me(l,X.values)).reduce((X,Q)=>X+Number(Q.values[C]??0),0);$.textContent=Vt(l.fields[C],W,_[0]?.values??{},d)}P&&M.has(P)&&(M.get(P)?.cells[0]?.widget.focus(),P=null)}}};function br(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let a=String(r.result??"");t({name:e.name,type:e.type,size:e.size,data:a.slice(a.indexOf(",")+1)})},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function bn(e){return({form:t,name:n,field:r,id:a,document:i,labels:o=de.en})=>{let d=i.createElement("div");d.className=`fd-file fd-file-${e}`;let s=i.createElement("input");s.type="file",s.id=a,s.className="fd-sr-only";let l=r.type==="binary"?r.accept:e==="image"?["image/*"]:void 0;l&&(s.accept=l.join(","));let p=i.createElement("img");p.className="fd-image-preview",p.alt=r.label,p.hidden=!0;let y=i.createElement("label");y.className=e==="image"?"fd-file-pick fd-image-pick":"fd-file-pick",y.htmlFor=a;let v=i.createElement("span");v.className="fd-button",v.textContent=e==="image"?o.uploadImage:o.upload;let h=i.createElement("span");h.className="fd-help",h.textContent=o.dropHere,y.append(v,h);let g=i.createElement("div");g.className="fd-file-chosen";let f=i.createElement("span");f.className="fd-file-name";let w=i.createElement("button");w.type="button",w.className="fd-button fd-button-link",w.textContent=o.replace,w.addEventListener("click",()=>s.click());let b=i.createElement("button");b.type="button",b.className="fd-button fd-button-link",b.textContent=o.removeFile,b.addEventListener("click",()=>t.setValue(n,null)),g.append(f,w,b),d.append(s,...e==="image"?[p]:[],y,g);let u=!1,E=async k=>{!k||u||t.setValue(n,await br(k))};return s.addEventListener("change",()=>{E(s.files?.[0]),s.value=""}),d.addEventListener("dragover",k=>{u||(k.preventDefault(),d.classList.add("fd-dragging"))}),d.addEventListener("dragleave",()=>d.classList.remove("fd-dragging")),d.addEventListener("drop",k=>{k.preventDefault(),d.classList.remove("fd-dragging"),E(k.dataTransfer?.files?.[0])}),{element:d,focus:()=>(y.hidden?w:s).focus(),update(k){u=k.readonly;let F=k.value;if(y.hidden=!!F||u,g.hidden=!F,w.hidden=b.hidden=u,s.disabled=u,s.setAttribute("aria-invalid",String(k.invalid)),k.describedBy&&s.setAttribute("aria-describedby",k.describedBy),f.textContent=F?`${F.name} \xB7 ${Ye(F.size)}`:"",e==="image"){let O=F?F.data?`data:${F.type};base64,${F.data}`:F.url??"":"";p.hidden=!O,p.getAttribute("src")!==O&&(O?p.src=O:p.removeAttribute("src"))}}}}}var It=bn("binary"),Dt=bn("image");var hn=new Map;function yn(e,t){let n=hn.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),hn.set(t,n)),n.format(e/100)}var Ze=e=>{let{node:t,id:n,document:r,locale:a="en"}=e,i=t.options??{},o=typeof i.min=="number"?i.min:0,d=typeof i.max=="number"?i.max:100,s=typeof i.maxField=="string"?i.maxField:null,l=typeof i.color=="string"?i.color:"auto",p=i.showPercent!==!1,y=r.createElement("div");y.className="fd-progressbar",y.setAttribute("role","progressbar");let v=r.createElement("div");v.className="fd-progressbar-fill";let h=r.createElement("span");h.className="fd-progressbar-text",y.append(v,h);let g=null,f=y;return i.editable===!0?(g=ke({...e,node:{...t,widget:void 0}}),y.setAttribute("aria-hidden","true"),f=r.createElement("div"),f.className="fd-progressbar-edit",f.append(y,g.element)):y.id=n,{element:f,focus:()=>g?.focus(),update(w){let b=typeof w.value=="number"?w.value:0,u=s?Number(w.values[s]??0):d,E=u>o?Math.min(100,Math.max(0,(b-o)/(u-o)*100)):0,k=Math.round(E*10)/10;v.style.width=`${k}%`,y.setAttribute("aria-valuenow",String(b)),y.setAttribute("aria-valuemin",String(o)),y.setAttribute("aria-valuemax",String(u)),y.setAttribute("aria-valuetext",yn(E,a)),h.textContent=p?yn(E,a):"",y.dataset.tone=l!=="auto"?l:E<30?"danger":E<70?"warning":"success",g?.update(w)}}};function vn(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var Xe=({field:e,node:t,id:n,document:r,locale:a="en"})=>{let i=t.options??{},o=p=>typeof i[p]=="string"?i[p]:"",d=p=>typeof i[p]=="string"?i[p]:null,s=e.type==="integer"?0:e.type==="float"||e.type==="monetary"?e.digits?.[1]??2:null,l=r.createElement("output");return l.id=n,l.className="fd-value-text",{element:l,focus:()=>{},update({value:p,values:y}){if(p==null||p===""){l.textContent="";return}let v=s!==null&&typeof p=="number"?Pe(p,s,a):ht(p,e),h=d("prefixField"),g=d("suffixField"),f=h?vn(y[h]):o("prefix"),w=g?vn(y[g]):o("suffix");l.textContent=[f,v,w].filter(b=>b!=="").join(" ")}}};var yt=({form:e,name:t,field:n,node:r,id:a,document:i})=>{let o=r.options??{},d=o.clickable===!0,s=Array.isArray(o.visibleStates)?o.visibleStates:null,l=i.createElement("ol");l.className="fd-statusbar",l.id=a,l.setAttribute("aria-label",n.label);let p=f=>f&&typeof f=="object"&&"id"in f?`id:${String(f.id)}`:`v:${String(f)}`,y=n.type==="selection"?n.options.map(f=>({key:p(f.value),label:f.label,value:f.value})):[],v=n.type==="selection",h={value:void 0,readonly:!1};function g(){let{value:f,readonly:w}=h,b=f==null?null:p(f),u=y.filter(E=>!s||s.some(k=>p(k)===E.key)||E.key===b);b&&!u.some(E=>E.key===b)&&f&&typeof f=="object"&&(u=[...u,{key:b,label:f.label,value:f}]),l.replaceChildren(...u.map(E=>{let k=i.createElement("span");k.textContent=E.label;let F=i.createElement(d?"button":"span");F instanceof HTMLButtonElement&&(F.type="button",F.disabled=w,F.addEventListener("click",()=>e.setValue(t,E.value))),F.append(k),E.key===b&&F.setAttribute("aria-current","step");let O=i.createElement("li");return O.append(F),O}))}return{element:l,focus:()=>l.querySelector("button:not([disabled])")?.focus(),update(f){h={value:f.value,readonly:f.readonly},g(),v||(v=!0,e.search(t,"",20).then(w=>{y=w.map(b=>({key:p(b),label:b.label,value:b})),g()}).catch(()=>{}))}}};function wn(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=Date.UTC(t.getUTCFullYear(),0,1);return Math.ceil(((t.getTime()-n)/864e5+1)/7)}var xn=e=>String(e).padStart(2,"0"),Pt=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Le=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function vt(e,t){let n=new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate();return new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),n))}function Wt(e,t){if(typeof t!="string"||!t)return null;if(e==="date"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return r?new Date(Number(r[1]),Number(r[2])-1,Number(r[3])):null}let n=new Date(t);return Number.isNaN(n.getTime())?null:n}function xt(e,t,n){let{form:r,name:a,id:i,document:o,locale:d="en"}=t,s=t.labels??de.en,l=d==="en"?"en-GB":d,p=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),y=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),v=new Intl.DateTimeFormat(l,{weekday:"short"}),h=new Intl.DateTimeFormat(l,{weekday:"long"}),g=o.createElement("button");g.type="button",g.className="fd-calendar-button";let f="http://www.w3.org/2000/svg",w=o.createElementNS(f,"svg");w.setAttribute("viewBox","0 0 16 16"),w.setAttribute("aria-hidden","true");for(let[$,W]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let X=o.createElementNS(f,$);for(let[Q,ce]of Object.entries(W))X.setAttribute(Q,ce);w.append(X)}g.append(w),g.setAttribute("aria-label",s.chooseDate),g.setAttribute("aria-haspopup","dialog"),g.setAttribute("aria-expanded","false"),g.setAttribute("aria-controls",`${i}-calendar`);let b=o.createElement("div");b.className="fd-calendar",b.id=`${i}-calendar`,b.setAttribute("role","dialog"),b.hidden=!0;let u=o.createElement("div");u.className="fd-calendar-head";let E=o.createElement("button");E.type="button",E.textContent="\u2039",E.setAttribute("aria-label",s.previousMonth);let k=o.createElement("span");k.className="fd-calendar-title",k.setAttribute("aria-live","polite");let F=o.createElement("button");F.type="button",F.textContent="\u203A",F.setAttribute("aria-label",s.nextMonth),u.append(E,k,F);let O=o.createElement("table");O.className="fd-calendar-grid",O.setAttribute("role","grid"),b.append(u,O);let M=o.createElement("span");M.className="fd-date-pick",M.append(e.element,g,b);let P=new Date,H=!1;function U($){if(n==="date")r.setValue(a,`${$.getFullYear()}-${xn($.getMonth()+1)}-${xn($.getDate())}`);else{let W=Wt("datetime",r.getState().values[a]),X=new Date($.getFullYear(),$.getMonth(),$.getDate(),W?.getHours()??0,W?.getMinutes()??0);r.setValue(a,X.toISOString())}Z()}function re($){let W=Wt(n,r.getState().values[a]),X=new Date,Q=p.format(P);k.textContent=Q,b.setAttribute("aria-label",Q);let ce=new Date(P.getFullYear(),P.getMonth(),1),fe=Le(ce,-((ce.getDay()+6)%7)),pe=o.createElement("tr"),Se=o.createElement("th");Se.scope="col",Se.textContent=s.weekShort,Se.setAttribute("abbr",s.week),pe.append(Se);for(let se=0;se<7;se++){let m=Le(fe,se),x=o.createElement("th");x.scope="col",x.textContent=v.format(m).replace(/\.$/,""),x.setAttribute("abbr",h.format(m)),pe.append(x)}let Fe=o.createElement("thead");Fe.append(pe);let Ne=o.createElement("tbody");for(let se=fe;se<=new Date(P.getFullYear(),P.getMonth()+1,0);se=Le(se,7)){let m=o.createElement("tr"),x=o.createElement("th");x.scope="row",x.className="fd-week",x.textContent=String(wn(se)),m.append(x);for(let L=0;L<7;L++){let S=Le(se,L),N=o.createElement("td"),T=o.createElement("button");T.type="button",T.textContent=String(S.getDate()),T.setAttribute("aria-label",y.format(S)),T.tabIndex=Pt(S,P)?0:-1,S.getMonth()!==P.getMonth()&&T.classList.add("fd-outside"),W&&Pt(S,W)&&T.setAttribute("aria-selected","true"),Pt(S,X)&&T.setAttribute("aria-current","date"),T.disabled=H,T.addEventListener("click",()=>U(S)),T.addEventListener("keydown",z=>_(z,S)),N.append(T),m.append(N)}Ne.append(m)}O.replaceChildren(Fe,Ne),$&&O.querySelector('button[tabindex="0"]')?.focus()}function J($){P=$,re(!0)}function _($,W){let X={ArrowLeft:()=>Le(W,-1),ArrowRight:()=>Le(W,1),ArrowUp:()=>Le(W,-7),ArrowDown:()=>Le(W,7),PageUp:()=>vt(W,-1),PageDown:()=>vt(W,1),Home:()=>Le(W,-((W.getDay()+6)%7)),End:()=>Le(W,6-(W.getDay()+6)%7)};X[$.key]?($.preventDefault(),J(X[$.key]())):($.key==="Enter"||$.key===" ")&&($.preventDefault(),U(W))}function te(){P=Wt(n,r.getState().values[a])??new Date,b.hidden=!1,g.setAttribute("aria-expanded","true"),re(!0)}function Z(){b.hidden||(b.hidden=!0,g.setAttribute("aria-expanded","false"),g.focus())}g.addEventListener("click",()=>b.hidden?te():Z()),E.addEventListener("click",()=>{P=vt(P,-1),re(!1)}),F.addEventListener("click",()=>{P=vt(P,1),re(!1)}),b.addEventListener("keydown",$=>{$.key==="Escape"&&($.preventDefault(),$.stopPropagation(),Z())});let C=$=>{!b.hidden&&!M.contains($.target)&&(b.hidden=!0,g.setAttribute("aria-expanded","false"))};return o.addEventListener("mousedown",C),{element:M,focus:()=>e.focus(),update($){H=$.readonly,g.hidden=$.readonly,$.readonly&&(b.hidden=!0),e.update($)},destroy(){o.removeEventListener("mousedown",C),e.destroy?.()}}}var hr=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)};function yr(e,t){let n=hr(e);return typeof t=="boolean"?{name:e,label:n,type:"boolean"}:typeof t=="number"?{name:e,label:n,type:Number.isInteger(t)?"integer":"float"}:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?{name:e,label:n,type:"date"}:{name:e,label:n,type:"char"}}var zt=e=>{let{form:t,name:n,field:r,node:a,id:i,document:o}=e,d=r.type==="properties"?r.definitions:void 0,s=()=>{let g=t.getState().values[n];return g&&typeof g=="object"&&!Array.isArray(g)?g:{}},l={...t,getState:()=>({...t.getState(),values:s()}),setValue:(g,f)=>t.setValue(n,{...s(),[g]:f})},p=o.createElement("div");p.className="fd-properties",p.setAttribute("role","group");let y=[],v="";function h(g){for(let f of y)f.widget.destroy?.();y=g.map(f=>{let w=`${i}-${f.name}`,b={type:f.type,label:f.label,...f.options?{options:f.options}:{}},u={type:"field",id:`${a.id}.${f.name}`,field:f.name},E=ke({...e,form:l,name:f.name,field:b,node:u,id:w});return{definition:f,widget:E}}),p.replaceChildren(...y.map(({definition:f,widget:w})=>{let b=o.createElement("div");b.className="fd-property",b.dataset.type=f.type;let u=o.createElement("label");return u.htmlFor=`${i}-${f.name}`,u.textContent=f.label,b.append(u,w.element),b}))}return{element:p,focus:()=>y[0]?.widget.focus(),destroy:()=>y.forEach(g=>g.widget.destroy?.()),update(g){let f=s(),w=d??Object.keys(f).map(u=>yr(u,f[u])),b=JSON.stringify(w);b!==v&&(v=b,h(w));for(let{definition:u,widget:E}of y)E.update({value:f[u.name]??null,values:f,readonly:g.readonly,required:!1,invalid:!1})}}};var vr=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),xr=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),wr=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),kr=new Set(["left","center","right","justify","start","end"]);function jt(e,t=globalThis.document){let n=t.createElement("template");n.innerHTML=e;let r=i=>{for(let o of[...i.childNodes]){if(o.nodeType===Node.TEXT_NODE)continue;if(o.nodeType!==Node.ELEMENT_NODE){o.remove();continue}let d=o;if(xr.has(d.tagName)){d.remove();continue}if(r(d),!vr.has(d.tagName)){d.replaceWith(...d.childNodes);continue}let s=d.tagName==="A"?d.getAttribute("href"):null,l=wr.has(d.tagName)?d.style?.textAlign?.trim().toLowerCase():"";for(let p of[...d.attributes])d.removeAttribute(p.name);s&&/^(https?:|mailto:)/i.test(s.trim())&&d.setAttribute("href",s.trim()),l&&kr.has(l)&&d.setAttribute("style",`text-align: ${l};`)}};r(n.content);let a=t.createElement("div");return a.append(n.content),a.innerHTML}function Sn(e){let t=e.trim();return/^(https?:\/\/|mailto:)\S+$/i.test(t)?t:/^[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+$/.test(t)?`mailto:${t}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(t)?`https://${t}`:null}var kn=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["bulletList","insertUnorderedList",'<svg viewBox="0 0 16 16"><circle cx="3" cy="4" r="1.2"/><circle cx="3" cy="8" r="1.2"/><circle cx="3" cy="12" r="1.2"/><path d="M6 4h8M6 8h8M6 12h8"/></svg>'],["numberList","insertOrderedList",'<svg viewBox="0 0 16 16"><path d="M2.5 3h1v3M2 10.5c.5-.8 2-.8 2 .2 0 .8-2 1.3-2 2.3h2M6 4h8M6 8h8M6 12h8"/></svg>'],["alignLeft","justifyLeft",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M2 6.5h8M2 9.5h12M2 12.5h8"/></svg>'],["alignCenter","justifyCenter",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M4 6.5h8M2 9.5h12M4 12.5h8"/></svg>'],["alignRight","justifyRight",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M6 6.5h8M2 9.5h12M6 12.5h8"/></svg>'],["link","createLink",'<svg viewBox="0 0 16 16"><path d="M7 9a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2L8.2 3.6M9 7a3 3 0 0 0-4.2 0L2.5 9.3a3 3 0 0 0 4.2 4.2l1.1-1.1"/></svg>']],Ht=({form:e,name:t,node:n,id:r,document:a,labels:i=de.en})=>{let o=a.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 d=n.options?.toolbar!==!1,s="";o.addEventListener("input",()=>{let y=jt(o.innerHTML,a);s=y,e.setValue(t,y.trim()===""?null:y)}),o.addEventListener("blur",()=>{o.innerHTML!==s&&(o.innerHTML=s)});let l=d?Sr(o,a,i):null,p=o;return l&&(p=a.createElement("div"),p.className="fd-richtext-box",p.setAttribute("role","group"),o.setAttribute("aria-labelledby",`${r}-label`),p.append(l.bar,l.linkRow,o)),{element:p,focus:()=>o.focus(),destroy:()=>l?.destroy(),update(y){l&&(l.bar.hidden=y.readonly,y.readonly&&(l.linkRow.hidden=!0));let v=jt(typeof y.value=="string"?y.value:"",a);(v!==s||a.activeElement!==o)&&(o.innerHTML!==v&&(o.innerHTML=v),s=v),o.setAttribute("contenteditable",String(!y.readonly)),o.setAttribute("aria-readonly",String(y.readonly)),o.setAttribute("aria-invalid",String(y.invalid)),y.describedBy&&o.setAttribute("aria-describedby",y.describedBy)}}};function Sr(e,t,n){let r=t.createElement("div");r.className="fd-richtext-bar",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",n.formatting);let a=null,i=()=>{e.focus();let f=t.getSelection();a&&f&&(f.removeAllRanges(),f.addRange(a))},o=(f,w)=>{i(),t.execCommand?.(f,!1,w)},d=t.createElement("select");d.className="fd-richtext-style",d.setAttribute("aria-label",n.textStyle);for(let[f,w]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let b=t.createElement("option");b.value=f,b.textContent=n[w],d.append(b)}d.addEventListener("change",()=>o("formatBlock",`<${d.value}>`));let s=t.createElement("div");s.className="fd-link-row",s.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",n.linkAddress);let p=t.createElement("button");p.type="button",p.className="fd-button fd-link-apply",p.textContent=n.applyLink;let y=t.createElement("button");y.type="button",y.className="fd-button fd-button-link fd-link-remove",y.textContent=n.removeLink,s.append(l,p,y),p.addEventListener("click",()=>{let f=Sn(l.value);if(!f){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),i(),t.execCommand?.("createLink",!1,f),s.hidden=!0}),y.addEventListener("click",()=>{i(),t.execCommand?.("unlink",!1),s.hidden=!0}),l.addEventListener("keydown",f=>{f.key==="Enter"?(f.preventDefault(),p.click()):f.key==="Escape"&&(f.preventDefault(),s.hidden=!0,i())});let v=kn.map(([f,w,b])=>{let u=t.createElement("button");return u.type="button",u.className="fd-richtext-tool",u.setAttribute("aria-label",n[f]),u.title=n[f],u.innerHTML=b,u.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline"].includes(w)&&u.setAttribute("aria-pressed","false"),u.addEventListener("mousedown",E=>E.preventDefault()),u.addEventListener("click",()=>{if(w!=="createLink")return o(w);s.hidden=!1,l.value="",l.focus()}),u});r.append(d,...v);let h=[d,...v];h.forEach((f,w)=>f.tabIndex=w===0?0:-1),r.addEventListener("keydown",f=>{if(f.key!=="ArrowRight"&&f.key!=="ArrowLeft")return;let w=h.indexOf(t.activeElement);if(w<0)return;let b=getComputedStyle(r).direction==="rtl",u=f.key==="ArrowRight"!==b?1:-1,E=h[(w+u+h.length)%h.length];f.preventDefault(),h.forEach(k=>k.tabIndex=k===E?0:-1),E.focus()});let g=()=>{let f=t.getSelection();if(!f||!f.rangeCount||!e.contains(f.anchorNode))return;a=f.getRangeAt(0).cloneRange();for(let b of v){let u=kn[v.indexOf(b)][1];b.hasAttribute("aria-pressed")&&b.setAttribute("aria-pressed",String(t.queryCommandState?.(u)??!1))}let w=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");d.value=w==="h2"||w==="h3"?w:"p"};return t.addEventListener("selectionchange",g),{bar:r,linkRow:s,destroy:()=>t.removeEventListener("selectionchange",g)}}var Bt=({form:e,name:t,id:n,document:r,labels:a=de.en})=>{let i=r.createElement("div");i.className="fd-json";let o=r.createElement("textarea");o.id=n,o.className="fd-input fd-textarea fd-code",o.spellcheck=!1;let d=r.createElement("div");return d.className="fd-cell-error",d.hidden=!0,i.append(o,d),o.addEventListener("input",()=>{if(o.value.trim()===""){d.hidden=!0,e.setValue(t,null);return}try{let s=JSON.parse(o.value);d.hidden=!0,e.setValue(t,s)}catch{d.hidden=!1,d.textContent=a.invalidJson}}),{element:i,focus:()=>o.focus(),update(s){if(r.activeElement!==o){let l=s.value===null||s.value===void 0?"":JSON.stringify(s.value,null,2);o.value!==l&&(o.value=l)}o.readOnly=s.readonly,o.setAttribute("aria-invalid",String(s.invalid||!d.hidden))}}};function ke(e,t={}){let{field:n,node:r}=e,a=[r.widget?`${n.type}.${r.widget}`:null,n.type==="selection"&&n.multiple?"selection.checkboxes":null,n.type].filter(i=>i!==null);for(let i of a){let o=t[i]??Nn[i];if(o)return o(e)}return Mr(e)}function le(e,t,n={},...r){let a=e.createElement(t);for(let[i,o]of Object.entries(n))o!==void 0&&a.setAttribute(i,o);return a.append(...r),a}function Re(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 kt=e=>e==null?"":String(e);function Qe(e){return({form:t,name:n,field:r,node:a,id:i,document:o})=>{let d=le(o,"input",{id:i,type:e,class:"fd-input",autocomplete:"off"});return r.type==="char"&&r.size!==void 0&&(d.maxLength=r.size),a.placeholder&&(d.placeholder=a.placeholder),d.addEventListener("input",()=>t.setValue(n,d.value===""?null:d.value)),{element:d,focus:()=>d.focus(),update(s){let l=kt(s.value);d.value!==l&&(d.value=l),d.readOnly=s.readonly,Re(d,s)}}}}var Lr=({form:e,name:t,field:n,node:r,id:a,document:i})=>{let o=le(i,"textarea",{id:a,class:"fd-input fd-textarea",rows:"3"});return n.type==="text"&&n.size!==void 0&&(o.maxLength=n.size),r.placeholder&&(o.placeholder=r.placeholder),o.addEventListener("input",()=>e.setValue(t,o.value===""?null:o.value)),{element:o,focus:()=>o.focus(),update(d){let s=kt(d.value);o.value!==s&&(o.value=s),o.readOnly=d.readonly,Re(o,d)}}},Er=/^-?(\d+\.?\d*|\.\d+)$/,Rr=/^-?\.?$/,qt=e=>{let{form:t,name:n,field:r,node:a,id:i,document:o,locale:d="en"}=e,s=r.type==="integer",l=s?0:(r.type==="float"||r.type==="monetary"?r.digits?.[1]:void 0)??2,p=F=>typeof F=="number"?Pe(F,l,d):kt(F),y=le(o,"input",{id:i,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});y.inputMode=s?"numeric":"decimal",a.placeholder&&(y.placeholder=a.placeholder);let v=F=>{let O=At(F.trim(),d);if(O==="")return null;if(Er.test(O))return Number(O);if(!Rr.test(O))return O};y.addEventListener("input",()=>{let F=v(y.value);F!==void 0&&t.setValue(n,F)}),y.addEventListener("blur",()=>{y.value=p(t.getState().values[n])});let h=a.options??{},g=r.type==="monetary"?r.currencyField:void 0,f=g?t.page.fields[g]:void 0,w=g&&f&&h.pickCurrency===!0?ke({...e,name:g,field:f,node:{type:"field",id:`${a.id}.currency`,field:g},id:`${i}-currency`}):null;w&&f&&w.element.querySelector("input, select")?.setAttribute("aria-label",f.label),w?.element.matches("input, select")&&f&&w.element.setAttribute("aria-label",f.label);let b=r.type==="monetary"&&!w?le(o,"span",{class:"fd-currency","aria-hidden":"true"}):null,u=w?.element??b,E=h.symbol==="after";return{element:u?le(o,"span",{class:`fd-number${E?" fd-currency-after":""}${w?" fd-currency-picked":""}`},...E?[y,u]:[u,y]):y,focus:()=>y.focus(),update(F){let O=o.activeElement===y,M=v(y.value),P=M===void 0||M===F.value;if(!(O&&P)){let H=p(F.value);y.value!==H&&(y.value=H)}if(y.readOnly=F.readonly,Re(y,F),w&&g&&w.update({value:F.values[g],values:F.values,readonly:F.readonly,required:!1,invalid:!1}),b&&r.type==="monetary"){let H=r.currencyField?F.values[r.currencyField]:null;b.textContent=H&&typeof H=="object"&&"label"in H?H.label:typeof H=="string"?H:r.currency??""}}}};function Ln(e){return({form:t,name:n,id:r,document:a})=>{let i=le(a,"input",{id:r,type:"checkbox",class:e?"fd-switch":"fd-checkbox",role:e});return i.addEventListener("change",()=>t.setValue(n,i.checked)),{element:i,focus:()=>i.focus(),update(o){i.checked=o.value===!0,i.disabled=o.readonly,Re(i,o)}}}}function Fn(e){return e.type==="selection"?e.options:[]}var Fr=({form:e,name:t,field:n,id:r,document:a})=>{let i=Fn(n),o=le(a,"select",{id:r,class:"fd-input fd-select"},le(a,"option",{value:""}));return i.forEach((d,s)=>o.append(le(a,"option",{value:String(s)},d.label))),o.addEventListener("change",()=>e.setValue(t,o.value===""?null:i[Number(o.value)].value)),{element:o,focus:()=>o.focus(),update(d){let s=i.findIndex(l=>l.value===d.value);o.value=s===-1?"":String(s),o.disabled=d.readonly,Re(o,d)}}};function En(e){return({form:t,name:n,field:r,id:a,document:i})=>{let o=Fn(r),d=le(i,"div",{id:a,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"}),s=o.map((l,p)=>{let y=le(i,"input",{type:e,name:a,value:String(p),id:`${a}-${p}`});return d.append(le(i,"label",{class:"fd-choice",for:`${a}-${p}`},y,le(i,"span",{},l.label))),y});return d.addEventListener("change",()=>{if(e==="radio"){let l=s.findIndex(p=>p.checked);t.setValue(n,l===-1?null:o[l].value)}else t.setValue(n,o.filter((l,p)=>s[p].checked).map(l=>l.value))}),{element:d,focus:()=>(s.find(l=>l.checked)??s[0])?.focus(),update(l){let p=Array.isArray(l.value)?l.value:[l.value];s.forEach((y,v)=>{y.checked=p.includes(o[v].value),y.disabled=l.readonly}),Re(d,l)}}}}function Rn(e){return({form:t,name:n,field:r,id:a,document:i})=>{let o="min"in r&&r.min!==void 0?r.min:e==="rating"?1:0,d="max"in r&&r.max!==void 0?r.max:e==="rating"?5:10,s=le(i,"div",{id:a,class:`fd-points fd-${e}`,role:"radiogroup"}),l=[];for(let p=o;p<=d;p++){let y=le(i,"button",{type:"button",role:"radio","aria-label":`${p} of ${d}`,"data-value":String(p)},e==="rating"?"\u2605":String(p));e==="scale"&&y.removeAttribute("aria-label"),y.addEventListener("click",()=>t.setValue(n,p)),l.push(y),s.append(y)}return s.addEventListener("keydown",p=>{let y=t.getState().values[n],v=typeof y=="number"?y:o-1,h=p.key==="ArrowRight"||p.key==="ArrowUp"?1:p.key==="ArrowLeft"||p.key==="ArrowDown"?-1:0;if(!h)return;p.preventDefault();let g=Math.min(d,Math.max(o,v+h));t.setValue(n,g),l[g-o]?.focus()}),{element:s,focus:()=>(l.find(p=>p.getAttribute("aria-checked")==="true")??l[0])?.focus(),update(p){let y=typeof p.value=="number"?p.value:null;l.forEach((v,h)=>{let g=o+h;v.setAttribute("aria-checked",String(g===y)),v.classList.toggle("fd-on",e==="rating"?y!==null&&g<=y:g===y),v.tabIndex=g===y||y===null&&h===0?0:-1,v.disabled=p.readonly}),Re(s,p)}}}}var Nr=e=>{let{form:t,name:n,id:r,document:a,node:i}=e,o=le(a,"input",{id:r,type:"date",class:"fd-input fd-date"});o.addEventListener("input",()=>t.setValue(n,o.value||null));let d={element:o,focus:()=>o.focus(),update(s){let l=kt(s.value);o.value!==l&&(o.value=l),o.readOnly=s.readonly,Re(o,s)}};return i.options?.weekNumbers===!0?xt(d,e,"date"):d},wt=e=>String(e).padStart(2,"0"),Ar=e=>{let{form:t,name:n,id:r,document:a,node:i}=e,o=le(a,"input",{id:r,type:"datetime-local",class:"fd-input fd-datetime"}),d=l=>{if(typeof l!="string"||!l)return"";let p=new Date(l);return Number.isNaN(p.getTime())?"":`${p.getFullYear()}-${wt(p.getMonth()+1)}-${wt(p.getDate())}T${wt(p.getHours())}:${wt(p.getMinutes())}`};o.addEventListener("input",()=>{if(!o.value)return t.setValue(n,null);let l=new Date(o.value);Number.isNaN(l.getTime())||t.setValue(n,l.toISOString())});let s={element:o,focus:()=>o.focus(),update(l){let p=d(l.value);o.value!==p&&(o.value=p),o.readOnly=l.readonly,Re(o,l)}};return i.options?.weekNumbers===!0?xt(s,e,"datetime"):s};function Mr({field:e,id:t,document:n}){let r=le(n,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:r,focus:()=>{},update(a){r.textContent=ht(a.value,e)}}}function ht(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(n=>n.label).join(", ");case"one2many":{let n=e.length;return`${n} ${n===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 Nn={char:Qe("text"),"char.email":Qe("email"),"char.phone":Qe("tel"),"char.url":Qe("url"),"char.password":Qe("password"),"char.tags":Tt,text:Lr,integer:qt,float:qt,monetary:qt,"integer.rating":Rn("rating"),"integer.scale":Rn("scale"),"integer.progressbar":Ze,"integer.label":Xe,"float.label":Xe,"monetary.label":Xe,"float.progressbar":Ze,"monetary.progressbar":Ze,boolean:Ln(),"boolean.toggle":Ln("switch"),selection:Fr,"selection.radio":En("radio"),"selection.checkboxes":En("checkbox"),"selection.statusbar":yt,date:Nr,datetime:Ar,many2one:Mt,"many2one.statusbar":yt,many2many:bt,"many2many.tags":bt,"many2many.checkboxes":Ct,reference:$t,one2many:Ot,binary:It,image:Dt,html:Ht,json:Bt,properties:zt};var Mn=`
|
|
59
3
|
/* .fd-theme carries the same tokens for things outside a form, such as a dialog over the page. */
|
|
60
4
|
.fd-form, .fd-theme {
|
|
61
5
|
--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
|
|
@@ -122,6 +66,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
122
66
|
.fd-page-title { font-size: 22px; font-weight: 650; margin: 0; line-height: 1.25; }
|
|
123
67
|
.fd-page-description { color: var(--fd-muted); margin: 0; }
|
|
124
68
|
|
|
69
|
+
/* ---- how wide a page goes, and Save above its sections ----------------------- */
|
|
70
|
+
.fd-form[data-max-width="narrow"] { --fd-page-max: 640px; }
|
|
71
|
+
.fd-form[data-max-width="medium"] { --fd-page-max: 900px; }
|
|
72
|
+
.fd-form[data-max-width="wide"] { --fd-page-max: 1180px; }
|
|
73
|
+
.fd-form[data-max-width="full"] { --fd-page-max: none; }
|
|
74
|
+
.fd-form[data-max-width] > .fd-content:not(:has(> .fd-sheet-page)) { max-width: var(--fd-page-max); margin-inline: auto; }
|
|
75
|
+
.fd-actions.fd-actions-top { margin-block-start: 0; padding-block-end: 14px; margin-block-end: 18px; border-block-end: 1px solid var(--fd-border); }
|
|
76
|
+
|
|
77
|
+
/* ---- icons: drawn with lines in the colour of the words beside them ------------ */
|
|
78
|
+
.fd-icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
|
|
79
|
+
.fd-section-title .fd-icon, .fd-tab .fd-icon, .fd-button .fd-icon, .fd-step-title .fd-icon { margin-inline-end: 0.4em; }
|
|
80
|
+
.fd-section-title .fd-icon { color: var(--fd-muted); }
|
|
81
|
+
|
|
125
82
|
/* ---- fields ---------------------------------------------------------------- */
|
|
126
83
|
.fd-grid {
|
|
127
84
|
display: grid;
|
|
@@ -131,6 +88,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
131
88
|
}
|
|
132
89
|
.fd-field { display: grid; gap: 4px; min-width: 0; grid-column: span min(var(--fd-span, 1), var(--fd-columns, 1)); }
|
|
133
90
|
.fd-label { font-weight: var(--fd-label-weight); color: var(--fd-text); }
|
|
91
|
+
/* The \u2713 of a field filled in right, by its label. */
|
|
92
|
+
.fd-valid-mark { color: var(--fd-success); width: 1em; height: 1em; margin-inline-start: 6px; vertical-align: -0.15em; stroke-width: 2.4; }
|
|
134
93
|
.fd-field.fd-required > .fd-label::after { content: " *"; color: var(--fd-error); }
|
|
135
94
|
.fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::after { content: ""; }
|
|
136
95
|
.fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::before { content: "* "; color: var(--fd-error); }
|
|
@@ -157,12 +116,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
157
116
|
@container (max-width: 760px) {
|
|
158
117
|
.fd-form[data-fd-skin="underline"] .fd-grid { grid-template-columns: minmax(0, 1fr); }
|
|
159
118
|
.fd-form[data-fd-skin="underline"] .fd-field { grid-column: auto; }
|
|
119
|
+
/* A section that says how many columns it keeps here keeps them, in either skin. */
|
|
120
|
+
.fd-form .fd-grid[data-columns-medium] { grid-template-columns: repeat(var(--fd-columns-medium), minmax(0, 1fr)); }
|
|
121
|
+
.fd-form .fd-grid[data-columns-medium] > .fd-field { grid-column: span min(var(--fd-span, 1), var(--fd-columns-medium)); }
|
|
122
|
+
/* Kept side by side here, the underline skin's fields have no room for a label beside: it goes above. */
|
|
123
|
+
.fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field { grid-template-columns: minmax(0, 1fr); }
|
|
124
|
+
.fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field > * { grid-column: 1 !important; }
|
|
160
125
|
}
|
|
161
126
|
@container (max-width: 520px) {
|
|
162
127
|
.fd-grid { grid-template-columns: minmax(0, 1fr); }
|
|
163
128
|
.fd-field { grid-column: auto; }
|
|
164
129
|
.fd-form[data-fd-skin="underline"] .fd-field { grid-template-columns: minmax(0, 1fr); }
|
|
165
130
|
.fd-form[data-fd-skin="underline"] .fd-field > * { grid-column: 1 !important; }
|
|
131
|
+
/* The narrow count, or one column when only the medium one was given. */
|
|
132
|
+
.fd-form .fd-grid[data-columns-medium], .fd-form .fd-grid[data-columns-narrow] { grid-template-columns: repeat(var(--fd-columns-narrow, 1), minmax(0, 1fr)); }
|
|
133
|
+
.fd-form .fd-grid[data-columns-medium] > .fd-field, .fd-form .fd-grid[data-columns-narrow] > .fd-field { grid-column: span min(var(--fd-span, 1), var(--fd-columns-narrow, 1)); }
|
|
166
134
|
}
|
|
167
135
|
|
|
168
136
|
/* ---- inputs ---------------------------------------------------------------- */
|
|
@@ -187,6 +155,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
187
155
|
.fd-form[data-fd-skin="underline"] .fd-field.fd-required .fd-input { border-color: var(--fd-accent); }
|
|
188
156
|
.fd-input[readonly] { background: transparent; border-color: transparent; padding-inline: 0; }
|
|
189
157
|
.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); }
|
|
158
|
+
/* A whole form locked reads as a record: plain values in either skin, no boxes, and no prompts to type. */
|
|
159
|
+
.fd-form[data-readonly] .fd-input[readonly] { background: transparent; border-color: transparent; padding-inline: 0; color: var(--fd-text); }
|
|
160
|
+
.fd-form[data-readonly] .fd-input::placeholder { color: transparent; }
|
|
161
|
+
.fd-form[data-readonly] select.fd-input:disabled { appearance: none; background: transparent; border-color: transparent; padding-inline: 0; color: var(--fd-text); opacity: 1; }
|
|
190
162
|
.fd-input[aria-invalid="true"] { border-color: var(--fd-error); }
|
|
191
163
|
.fd-form[data-fd-skin="outlined"] .fd-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 2px rgba(255, 38, 5, 0.06); }
|
|
192
164
|
.fd-textarea { resize: vertical; min-height: 64px; }
|
|
@@ -391,7 +363,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
391
363
|
.fd-statusbar [aria-current="step"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
|
|
392
364
|
[dir="rtl"] .fd-statusbar button, [dir="rtl"] .fd-statusbar span { transform: scaleX(-1); }
|
|
393
365
|
[dir="rtl"] .fd-statusbar button > *, [dir="rtl"] .fd-statusbar span > * { display: inline-block; transform: scaleX(-1); }
|
|
394
|
-
.fd-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1180px; margin: 16px auto 0; padding-inline: 16px; }
|
|
366
|
+
.fd-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: var(--fd-page-max, 1180px); margin: 16px auto 0; padding-inline: 16px; }
|
|
367
|
+
/* Save and Discard closing the sheet, when the page puts them at its foot. */
|
|
368
|
+
.fd-sheet-foot { margin: 4px -28px -28px; padding: 12px 28px; border-block-start: 1px solid var(--fd-border); border-end-start-radius: inherit; border-end-end-radius: inherit; }
|
|
395
369
|
.fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
|
|
396
370
|
@container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }
|
|
397
371
|
.fd-card {
|
|
@@ -409,7 +383,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
409
383
|
.fd-ribbon.fd-tone-success { background: var(--fd-success); }
|
|
410
384
|
.fd-ribbon.fd-tone-warning { background: #d97706; }
|
|
411
385
|
.fd-ribbon.fd-tone-info { background: var(--fd-info); }
|
|
412
|
-
.fd-alert { padding: 10px 14px; border-radius: var(--fd-control-radius); border: 1px solid; font-size: 13.5px; }
|
|
386
|
+
.fd-alert { padding: 10px 14px; border-radius: var(--fd-control-radius); border: 1px solid; font-size: 13.5px; display: flex; align-items: flex-start; gap: 10px; }
|
|
387
|
+
.fd-alert-message { flex: 1 1 auto; min-width: 0; }
|
|
388
|
+
.fd-alert-close { border: none; background: none; color: inherit; cursor: pointer; font: inherit; font-size: 18px; line-height: 1; padding: 0 4px; border-radius: 4px; opacity: 0.75; }
|
|
389
|
+
.fd-alert-close:hover { opacity: 1; }
|
|
390
|
+
.fd-alert-close:focus-visible { outline: 2px solid var(--fd-focus); opacity: 1; }
|
|
413
391
|
.fd-alert.fd-tone-warning { background: var(--fd-warning-soft); border-color: #f0c47a; color: var(--fd-warning); }
|
|
414
392
|
.fd-alert.fd-tone-danger { background: var(--fd-error-soft); border-color: #f1a7a7; color: var(--fd-error); }
|
|
415
393
|
.fd-alert.fd-tone-success { background: var(--fd-success-soft); border-color: #a7d7ab; color: var(--fd-success); }
|
|
@@ -423,6 +401,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
423
401
|
padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;
|
|
424
402
|
}
|
|
425
403
|
.fd-stat:hover { background: var(--fd-page); }
|
|
404
|
+
.fd-stat:has(> .fd-icon) { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; }
|
|
405
|
+
.fd-stat > .fd-icon { width: 22px; height: 22px; color: var(--fd-muted); }
|
|
406
|
+
.fd-stat-words { display: grid; justify-items: start; }
|
|
426
407
|
.fd-stat-value { font-weight: 700; font-size: 15px; color: var(--fd-accent); font-variant-numeric: tabular-nums; }
|
|
427
408
|
.fd-stat-label { font-size: 12.5px; color: var(--fd-muted); }
|
|
428
409
|
.fd-title-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
|
|
@@ -443,10 +424,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
443
424
|
.fd-avatar .fd-file-name { display: none; }
|
|
444
425
|
.fd-avatar .fd-file { justify-items: center; gap: 2px; padding: 0; }
|
|
445
426
|
.fd-avatar .fd-file-chosen { gap: 2px 8px; justify-content: center; font-size: 12.5px; }
|
|
446
|
-
|
|
447
|
-
.fd-
|
|
448
|
-
.fd-form[data-fd-skin="underline"] .fd-title .fd-field
|
|
449
|
-
.fd-
|
|
427
|
+
/* The title and subtitle themselves: big, their labels only for screen readers. */
|
|
428
|
+
.fd-title > .fd-field .fd-input { font-size: 24px; font-weight: 600; min-height: 40px; }
|
|
429
|
+
.fd-form[data-fd-skin="underline"] .fd-title > .fd-field { grid-template-columns: minmax(0, 1fr); }
|
|
430
|
+
.fd-form[data-fd-skin="underline"] .fd-title > .fd-field > * { grid-column: 1; }
|
|
431
|
+
.fd-title > .fd-field > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
432
|
+
/* Fields over and under the title: one row, each label beside its control. */
|
|
433
|
+
.fd-title-above, .fd-title-below { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; }
|
|
434
|
+
.fd-title-above { margin-block-end: 4px; }
|
|
435
|
+
.fd-title-below { margin-block-start: 6px; }
|
|
436
|
+
.fd-form .fd-title-above > .fd-field, .fd-form .fd-title-below > .fd-field { display: flex; align-items: center; gap: 8px; grid-template-columns: none; }
|
|
437
|
+
.fd-form .fd-title-above > .fd-field > *, .fd-form .fd-title-below > .fd-field > * { grid-column: auto !important; }
|
|
438
|
+
.fd-title-above .fd-label:empty, .fd-title-below .fd-label:empty { display: none; }
|
|
439
|
+
/* A choice over the title, such as Individual or Company, speaks for itself: its label is for screen readers. */
|
|
440
|
+
.fd-title-above > .fd-field > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
441
|
+
.fd-title-statusbar { display: flex; }
|
|
442
|
+
/* Badges over the title. */
|
|
443
|
+
.fd-badges { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
444
|
+
.fd-badge {
|
|
445
|
+
display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 10px;
|
|
446
|
+
border-radius: 999px; border: 1px solid var(--fd-border); background: var(--fd-page); color: var(--fd-muted);
|
|
447
|
+
}
|
|
448
|
+
.fd-badge .fd-icon { width: 13px; height: 13px; }
|
|
449
|
+
.fd-badge.fd-tone-info { background: var(--fd-info-soft); border-color: #a9c8ef; color: var(--fd-info); }
|
|
450
|
+
.fd-badge.fd-tone-success { background: var(--fd-success-soft); border-color: #a7d7ab; color: var(--fd-success); }
|
|
451
|
+
.fd-badge.fd-tone-warning { background: var(--fd-warning-soft); border-color: #f0c47a; color: var(--fd-warning); }
|
|
452
|
+
.fd-badge.fd-tone-danger { background: var(--fd-error-soft); border-color: #f1a7a7; color: var(--fd-error); }
|
|
450
453
|
.fd-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
|
|
451
454
|
|
|
452
455
|
/* ---- wizard -------------------------------------------------------------- */
|
|
@@ -505,6 +508,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
505
508
|
.fd-step { display: grid; gap: 18px; }
|
|
506
509
|
.fd-step-title { font-size: 18px; font-weight: 650; margin: 0; }
|
|
507
510
|
.fd-wizard-nav { display: flex; gap: 8px; justify-content: space-between; }
|
|
511
|
+
/* A clickable wizard's steps: numbered, the current one filled, those behind it ticked. */
|
|
512
|
+
.fd-steps-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; counter-reset: fd-step; }
|
|
513
|
+
.fd-steps-list > li { counter-increment: fd-step; }
|
|
514
|
+
.fd-step-link {
|
|
515
|
+
font: inherit; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
|
|
516
|
+
border: 1px solid var(--fd-border); background: var(--fd-surface); color: var(--fd-muted); border-radius: 999px; padding: 4px 12px 4px 6px;
|
|
517
|
+
}
|
|
518
|
+
.fd-step-link::before {
|
|
519
|
+
content: counter(fd-step); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
|
|
520
|
+
background: var(--fd-page); color: var(--fd-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
|
|
521
|
+
}
|
|
522
|
+
.fd-step-link:hover { border-color: var(--fd-accent); color: var(--fd-text); }
|
|
523
|
+
.fd-step-link:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; }
|
|
524
|
+
.fd-step-link.fd-step-done { color: var(--fd-text); }
|
|
525
|
+
.fd-step-link.fd-step-done::before { content: "\u2713"; background: var(--fd-accent-soft); color: var(--fd-accent); }
|
|
526
|
+
/* Skipped is not done: no tick, no colour. */
|
|
527
|
+
.fd-step-link.fd-step-skipped { border-style: dashed; color: var(--fd-muted); }
|
|
528
|
+
.fd-step-link.fd-step-skipped::before { content: "\u2013"; background: var(--fd-page); color: var(--fd-muted); }
|
|
529
|
+
.fd-step-link[aria-current="step"] { border-color: var(--fd-accent); color: var(--fd-accent); font-weight: 600; }
|
|
530
|
+
.fd-step-link[aria-current="step"]::before { content: counter(fd-step); background: var(--fd-accent); color: var(--fd-accent-text); }
|
|
508
531
|
.fd-wizard-nav .fd-spacer { flex: 1; }
|
|
509
532
|
|
|
510
533
|
/* ---- text, status, dialog ------------------------------------------------- */
|
|
@@ -512,6 +535,28 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
512
535
|
.fd-text-paragraph { margin: 0; }
|
|
513
536
|
.fd-text-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
|
|
514
537
|
.fd-status { min-height: 1.4em; color: var(--fd-muted); font-size: 13px; }
|
|
538
|
+
.fd-status-box { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
|
|
539
|
+
.fd-status-box .fd-retry { font-size: 13px; }
|
|
540
|
+
/* Said to screen readers only. */
|
|
541
|
+
.fd-announce { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
542
|
+
/* The server out of reach: a banner over the page, with Retry. */
|
|
543
|
+
.fd-banner {
|
|
544
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; margin-block-end: 16px;
|
|
545
|
+
border: 1px solid #f0c47a; border-radius: var(--fd-control-radius); background: var(--fd-warning-soft); color: var(--fd-warning); font-size: 13.5px;
|
|
546
|
+
}
|
|
547
|
+
.fd-banner-text { flex: 1 1 16em; min-width: 0; }
|
|
548
|
+
.fd-content > .fd-banner:has(+ .fd-draft + .fd-sheet-page), .fd-content > .fd-banner:has(+ .fd-sheet-page) { margin: 12px 16px 0; }
|
|
549
|
+
/* The status as a toast in a corner, or as a bar across the top. */
|
|
550
|
+
.fd-status-box.fd-toast {
|
|
551
|
+
position: fixed; inset-block-end: max(20px, env(safe-area-inset-bottom, 0px)); inset-inline-end: 20px; z-index: 900;
|
|
552
|
+
padding: 10px 16px; border-radius: 8px; background: var(--fd-text); box-shadow: 0 8px 24px rgba(15, 20, 25, 0.25);
|
|
553
|
+
}
|
|
554
|
+
/* Light words on the dark toast, saved or not: the status's own colours are for a light ground. */
|
|
555
|
+
.fd-toast .fd-status, .fd-toast .fd-status.fd-status-saved, .fd-toast .fd-status.fd-status-error { color: var(--fd-surface); font-size: 13.5px; min-height: 0; }
|
|
556
|
+
.fd-toast .fd-retry { color: var(--fd-surface); text-decoration: underline; }
|
|
557
|
+
.fd-toast:has(.fd-status-error) { background: var(--fd-error); }
|
|
558
|
+
.fd-status-box.fd-status-bar { display: flex; justify-content: center; min-height: 32px; padding: 6px 16px; background: var(--fd-surface); border-block-end: 1px solid var(--fd-border); }
|
|
559
|
+
.fd-status-bar .fd-status-error { color: var(--fd-error); }
|
|
515
560
|
.fd-status.fd-status-error { color: var(--fd-error); }
|
|
516
561
|
.fd-status.fd-status-saved { color: var(--fd-success); }
|
|
517
562
|
.fd-draft { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; margin-block-end: 16px;
|
|
@@ -557,7 +602,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
557
602
|
.fd-form-dialog-body:not(:has(.fd-sheet-layout)) { background: var(--fd-surface); padding: 16px 20px 20px; }
|
|
558
603
|
.fd-form-dialog-foot { padding: 12px 16px; border-block-start: 1px solid var(--fd-border); background: var(--fd-surface); margin: 0; }
|
|
559
604
|
@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
|
|
560
|
-
`,Tu="fieldia-styles";function ai(e){if(e.getElementById(Tu))return;let t=e.createElement("style");t.id=Tu,t.textContent=Zu,(e.head??e.documentElement).append(t)}function ci(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(r){try{let n=t()?.getItem(`fieldia:${r}`);return n==null?null:JSON.parse(n)}catch{return null}},set(r,n){try{t()?.setItem(`fieldia:${r}`,JSON.stringify(n))}catch{}}}}function pm(){let e=new Map;return{get:t=>e.has(t)?Iu(e.get(t)):null,set:(t,r)=>{e.set(t,Iu(r))}}}var Iu=e=>JSON.parse(JSON.stringify(e));var Fu=0,mm='button, [href], input, select, textarea, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function un(e){let t=e.container?.ownerDocument??document,r=e.container??t.body,n=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,o={...Ft[e.locale??"en"],...e.labels},i=`fd-dialog-${++Fu}`,s=(g,S={},z)=>{let _=t.createElement(g);for(let[E,L]of Object.entries(S))_.setAttribute(E,L);return z!==void 0&&(_.textContent=z),_},a=s("h2",{id:`${i}-title`,class:"fd-form-dialog-title"},e.title),c=s("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),l=s("div",{class:"fd-form-dialog-body"}),u=s("button",{type:"button",class:"fd-button"},o.discard),d=s("button",{type:"button",class:"fd-button fd-button-primary"},o.saveClose),h=s("div",{class:`fd-theme fd-form-dialog fd-size-${e.size??"medium"}`,"data-fd-skin":e.skin??"underline",role:"dialog","aria-modal":"true","aria-labelledby":a.id,tabindex:"-1"});e.dir&&h.setAttribute("dir",e.dir),h.append(s("div",{class:"fd-form-dialog-head"}),l,s("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),h.firstElementChild?.append(a,c),h.lastElementChild?.append(u,d);let p=s("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});p.append(h),r.append(p);let f=ui(l,{...e,showActions:!1}),m=!1;e.recompute&&hm(f.form,e.page.fields,e.recompute,()=>m);let b=()=>[...h.querySelectorAll(mm)].filter(g=>!g.closest("[hidden], [inert]")&&!g.disabled),y=()=>l.querySelector('input:not([type="hidden"]), select, textarea, [contenteditable="true"]');return(y()??h).focus(),f.form.settled().then(()=>{(t.activeElement===h||!h.contains(t.activeElement))&&y()?.focus()}),new Promise(g=>{let S=z=>{if(m)return;m=!0;let _=f.form.getState(),E={saved:z,recordId:_.recordId??null,values:_.values};f.destroy(),p.remove(),n?.focus(),g(E)};d.addEventListener("click",async()=>{d.disabled=!0;let z=e.mode==="values"?f.check():await f.save();d.disabled=!1,z&&S(!0)}),u.addEventListener("click",()=>S(!1)),c.addEventListener("click",()=>S(!1)),h.addEventListener("keydown",z=>{if(!z.defaultPrevented){if(z.key==="Escape")z.preventDefault(),S(!1);else if(z.key==="Tab"){let _=b();if(!_.length)return;let E=_[0],L=_[_.length-1];z.shiftKey&&t.activeElement===E?(z.preventDefault(),L.focus()):!z.shiftKey&&t.activeElement===L&&(z.preventDefault(),E.focus())}}})})}function hm(e,t,r,n){let o=JSON.stringify(e.getState().values),i=!1;e.subscribe(()=>{let s=e.getState().values,a=JSON.stringify(s);i||a===o||(o=a,r(s).then(c=>{if(!(n()||JSON.stringify(e.getState().values)!==a)){i=!0;for(let[l,u]of Object.entries(c))l in t&&JSON.stringify(s[l]??null)!==JSON.stringify(u??null)&&e.setValue(l,u);i=!1,o=JSON.stringify(e.getState().values)}},()=>{}))})}function li(e){let t=e.container?.ownerDocument??document,r=e.container??t.body,n=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,o=Ft[e.locale??"en"],i=xe[e.locale??"en"],s=`fd-dialog-${++Fu}`,a=(g,S={},z)=>{let _=t.createElement(g);for(let[E,L]of Object.entries(S))_.setAttribute(E,L);return z!==void 0&&(_.textContent=z),_},c=a("h2",{id:`${s}-title`,class:"fd-form-dialog-title"},e.title),l=a("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),u=a("input",{type:"search",class:"fd-input","aria-label":i.search,placeholder:i.search,"aria-controls":`${s}-list`,autocomplete:"off"}),d=a("ul",{id:`${s}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":c.id}),h=a("button",{type:"button",class:"fd-button"},o.cancel),p=a("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":e.skin??"underline",role:"dialog","aria-modal":"true","aria-labelledby":c.id});e.dir&&p.setAttribute("dir",e.dir);let f=a("div",{class:"fd-form-dialog-head"});f.append(c,l);let m=a("div",{class:"fd-form-dialog-body fd-search-body"});m.append(u,d);let b=a("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});b.append(h),p.append(f,m,b);let y=a("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return y.append(p),r.append(y),u.focus(),new Promise(g=>{let S=[],z=-1,_=0,E,L=W=>{clearTimeout(E),_++,y.remove(),n?.focus(),g(W)},T=()=>{d.replaceChildren(...S.map((W,ne)=>{let Y=a("li",{id:`${s}-option-${ne}`,role:"option",class:`fd-option${ne===z?" fd-active":""}`,"aria-selected":String(ne===z)},W.label);return Y.addEventListener("click",()=>L(W)),Y})),S.length||d.append(a("li",{class:"fd-empty"},i.noResults)),z>=0?u.setAttribute("aria-activedescendant",`${s}-option-${z}`):u.removeAttribute("aria-activedescendant")},U=()=>{clearTimeout(E);let W=++_;E=setTimeout(async()=>{let ne=await e.search(u.value,80).catch(()=>[]);W===_&&(S=ne,z=-1,T())},180)};u.addEventListener("input",U),u.addEventListener("keydown",W=>{if(W.key==="ArrowDown"||W.key==="ArrowUp"){if(W.preventDefault(),!S.length)return;z=(z+(W.key==="ArrowDown"?1:-1)+S.length)%S.length,T(),d.children[z]?.scrollIntoView?.({block:"nearest"})}else W.key==="Enter"&&z>=0&&(W.preventDefault(),L(S[z]))}),h.addEventListener("click",()=>L(null)),l.addEventListener("click",()=>L(null)),p.addEventListener("keydown",W=>{W.key==="Escape"&&(W.preventDefault(),L(null))}),U()})}var Ft={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",saveClose:"Save & Close",close:"Close"},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",saveClose:"\u062D\u0641\u0638 \u0648\u0625\u063A\u0644\u0627\u0642",close:"\u0625\u063A\u0644\u0627\u0642"},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",saveClose:"Speichern und schlie\xDFen",close:"Schlie\xDFen"},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",saveClose:"Enregistrer et fermer",close:"Fermer"}},gm=Ft.en,bm=0;function ui(e,t){let r=e.ownerDocument,n=Gr(t.page);if(!n.ok)throw new Error(`This page cannot be shown:
|
|
561
|
-
${
|
|
562
|
-
`)}`);let o=n.page,i=t.locale??"en",s=t.preferences??ci(),a=wm(t),c=!t.form,l=t.form??Qr({...t,page:o,messages:t.messages??mt[i]}),u={...Ft[i],...t.labels},d=xe[i],h=t.dir??(i==="ar"?"rtl":void 0),p=`fd${++bm}`,f=[],m=[],b=v=>`${p}-${v.replace(/[^A-Za-z0-9_-]/g,"_")}`,y=(v,P)=>v.replace(/\{(\w+)\}/g,(Z,F)=>String(P[F]??""));ai(r);function g(v,P={},...Z){let F=r.createElement(v);for(let[H,K]of Object.entries(P))K!==void 0&&F.setAttribute(H,K);return F.append(...Z),F}let S=g("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:h,lang:t.locale}),z=t.confirm??be;function _(v){let P=o.fields[v.field],Z=b(v.id),F=g("div",{class:"fd-field","data-node":v.id,"data-field":v.field,"data-type":P.type});v.colspan&&F.style.setProperty("--fd-span",String(v.colspan));let H=g("label",{class:"fd-label",id:`${Z}-label`,for:Z},v.label??P.label),K=We({form:l,name:v.field,field:P,node:v,id:Z,document:r,labels:d,preferences:s,locale:i,dialogs:a},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(K.element.tagName)||(K.element.getAttribute("role")&&K.element.setAttribute("aria-labelledby",H.id),H.addEventListener("click",()=>K.focus()));let J=v.help??P.help,ue=J?g("div",{class:"fd-help",id:`${Z}-help`},J):null,j=g("div",{class:"fd-error",id:`${Z}-error`,role:"alert",hidden:""}),B=g("div",{class:"fd-warning",role:"status",hidden:""});return F.append(H,K.element,...ue?[ue]:[],j,B),K.destroy&&m.push(()=>K.destroy?.()),f.push(oe=>{let $e=l.node(v.id);F.hidden=$e.invisible,F.classList.toggle("fd-required",$e.required);let Ie=oe.errors[v.field];j.hidden=!Ie,j.textContent=Ie??"";let ot=oe.warning&&oe.warningField===v.field?oe.warning:"";B.hidden=!ot,B.textContent=ot,K.update({value:oe.values[v.field],values:oe.values,readonly:$e.readonly,required:$e.required,invalid:!!Ie,describedBy:[ue?.id,Ie?j.id:void 0].filter(Boolean).join(" ")||void 0})}),F}function E(v,P){f.push(()=>{v.hidden=l.node(P).invisible})}function L(v){let P=g("button",{type:"button",class:`fd-button fd-button-${v.style??"secondary"}`,"data-node":v.id},v.label);return P.addEventListener("click",async()=>{v.confirm&&!await z(v.confirm)||await l.runAction(v.id)}),E(P,v.id),P}function T(v){let P=v.style??"paragraph",Z=g(P==="heading"?"h3":"p",{class:`fd-text-${P}`,"data-node":v.id},v.text);return E(Z,v.id),Z}function U(v){let P=g("div",{class:"fd-slot","data-slot":v.name,"data-node":v.id}),Z=t.slots?.[v.name]?.(P,{form:l,name:v.name});return Z&&m.push(Z),E(P,v.id),P}function W(v,P=1){let Z=g("div",{class:"fd-grid"});return Z.style.setProperty("--fd-columns",String(P)),Z.append(...v.map(ie)),Z}let ne=new Map;function Y(v){let P=g("fieldset",{class:"fd-section","data-node":v.id}),Z=v.description?g("p",{class:"fd-section-description"},v.description):null,F=W(v.children,v.columns??1);if(v.title&&v.collapsible){F.id=b(`${v.id}-content`);let H=g("button",{type:"button",class:"fd-section-toggle","aria-controls":F.id},g("span",{class:"fd-section-chevron","aria-hidden":"true"}),v.title),K=v.collapsed!==!0,J=ue=>{K=ue,H.setAttribute("aria-expanded",String(K)),F.hidden=!K,Z&&(Z.hidden=!K),P.classList.toggle("fd-section-folded",!K)};H.addEventListener("click",()=>J(!K)),ne.set(P,()=>J(!0)),J(K),P.append(g("legend",{class:"fd-section-title"},H))}else v.title&&P.append(g("legend",{class:"fd-section-title"},v.title));return Z&&P.append(Z),P.append(F),E(P,v.id),P}function X(v){let P=g("div",{class:"fd-tabs","data-node":v.id}),Z=g("div",{class:"fd-tablist",role:"tablist"}),F=null,H=v.children[0].id,K=v.children.map(J=>{let ue=b(`${J.id}-tab`),j=b(`${J.id}-panel`),B=g("button",{type:"button",class:"fd-tab",role:"tab",id:ue,"aria-controls":j,"data-node":J.id},J.label),oe=g("div",{class:"fd-tabpanel",role:"tabpanel",id:j,"aria-labelledby":ue},W(J.children));return B.addEventListener("click",()=>{F=H=J.id,Ee(l.getState())}),Z.append(B),{tab:J,button:B,panel:oe}});return Z.addEventListener("keydown",J=>{let ue=K.filter(Ie=>!Ie.button.hidden),j=ue.findIndex(Ie=>Ie.tab.id===H),B={ArrowRight:1,ArrowLeft:-1,Home:-j,End:ue.length-1-j}[J.key];if(B===void 0||j===-1)return;J.preventDefault();let oe=S.getAttribute("dir")==="rtl"&&(J.key==="ArrowRight"||J.key==="ArrowLeft"),$e=ue[(j+(oe?-B:B)+ue.length)%ue.length];F=H=$e.tab.id,Ee(l.getState()),$e.button.focus()}),P.append(Z,...K.map(J=>J.panel)),f.push(()=>{P.hidden=l.node(v.id).invisible;let J=K.filter(j=>!l.node(j.tab.id).invisible);F!==null&&J.some(j=>j.tab.id===F)?H=F:J.length&&(H=J[0].tab.id);for(let j of K){let B=j.tab.id===H;j.button.hidden=!J.includes(j),j.button.setAttribute("aria-selected",String(B)),j.button.tabIndex=B?0:-1,j.panel.hidden=!B}}),P}function ie(v){switch(v.type){case"field":return _(v);case"button":return L(v);case"text":return T(v);case"slot":return U(v);case"section":return Y(v);case"tabs":return X(v)}}let q=g("div",{class:"fd-status",role:"status","aria-live":"polite"});f.push(v=>{let P=v.status==="saving"?u.saving:v.status==="saved"?u.saved:v.status==="loading"?u.loading:v.status==="error"?v.error??"":"";q.textContent=P,q.classList.toggle("fd-status-error",v.status==="error"),q.classList.toggle("fd-status-saved",v.status==="saved")});let V=g("div",{class:"fd-draft",hidden:""}),R=g("span"),M=g("button",{type:"button",class:"fd-button fd-button-primary"},u.restore),re=g("button",{type:"button",class:"fd-button fd-button-link"},u.discardDraft);M.addEventListener("click",()=>l.restoreDraft()),re.addEventListener("click",()=>l.discardDraft()),V.append(R,M,re),f.push(v=>{V.hidden=!v.draft,v.draft&&(R.textContent=y(u.draftFound,{time:new Date(v.draft.savedAt).toLocaleString()}))});function he(){let v=S.querySelector('[aria-invalid="true"]');if(!v)return;for(let Z=v.closest(".fd-section-folded");Z;Z=Z.parentElement?.closest(".fd-section-folded")??null)ne.get(Z)?.();if(!v.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(v.matches("input, select, textarea, button")?v:v.querySelector("input, select, textarea, button"))?.focus()}let ze=g("div",{class:"fd-done",hidden:""},g("p",{class:"fd-done-title"},u.submitted)),ye=g("button",{type:"button",class:"fd-button"},u.submitAnother);ze.append(ye);let Ce=g("div",{class:"fd-content"});async function Ge(){if(!await l.save()){he();return}o.data.kind==="responses"&&(Ce.hidden=!0,ze.hidden=!1)}ye.addEventListener("click",()=>{l.reset(),Ce.hidden=!1,ze.hidden=!0});function nt(){if(!o.title&&!o.description)return null;let v=g("header",{class:"fd-page-head"});return o.title&&v.append(g("h1",{class:"fd-page-title"},o.title)),o.description&&v.append(g("p",{class:"fd-page-description"},o.description)),v}function x(v){let P=g("div",{class:"fd-sections","data-node":v.id},...v.children.map(ie)),Z=g("button",{type:"submit",class:"fd-button fd-button-primary"},o.data.kind==="responses"?u.submit:u.save),F=g("div",{class:"fd-actions fd-actions-end"},q,Z);if(o.data.kind==="record"){let H=g("button",{type:"button",class:"fd-button"},u.discard);H.addEventListener("click",()=>l.reset()),F.insertBefore(H,Z),f.push(K=>{let J=K.dirty.length>0&&K.status!=="saving";Z.hidden=!J,H.hidden=!J})}return t.showActions===!1?g("div",{},P):g("div",{},P,F)}function k(v){let P=g("div",{class:"fd-wizard","data-node":v.id}),Z=g("div",{class:"fd-progress-text"}),F=g("span");P.append(g("div",{class:"fd-progress"},Z,g("div",{class:"fd-progress-bar"},F)));let H=v.children.map(B=>{let oe=g("section",{class:"fd-step","data-node":B.id,"aria-labelledby":b(`${B.id}-title`)});return oe.append(g("h2",{class:"fd-step-title",id:b(`${B.id}-title`)},B.label)),B.description&&oe.append(g("p",{class:"fd-section-description"},B.description)),oe.append(W(B.children)),P.append(oe),{step:B,panel:oe}}),K=g("button",{type:"button",class:"fd-button"},u.back),J=g("button",{type:"submit",class:"fd-button fd-button-primary"});P.append(g("div",{class:"fd-wizard-nav"},K,g("span",{class:"fd-spacer"}),q,J)),K.addEventListener("click",()=>{l.back()&&j()});let ue=()=>{let B=l.steps();return B.indexOf(l.getState().step??"")===B.length-1};D=async()=>{if(ue())return Ge();l.next()?j():he()};function j(){H.find(oe=>oe.step.id===l.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return f.push(B=>{let oe=l.steps(),$e=Math.max(0,oe.indexOf(B.step??""));Z.textContent=y(u.stepOf,{n:$e+1,total:oe.length}),F.style.width=`${($e+1)/Math.max(1,oe.length)*100}%`;for(let{step:Ie,panel:ot}of H)ot.hidden=Ie.id!==B.step;K.hidden=$e===0,J.textContent=$e===oe.length-1?u.submit:u.next}),P}function $(v){let P=g("div",{class:"fd-sheet-page","data-node":v.id}),Z=g("div",{class:"fd-actions"}),F=g("button",{type:"submit",class:"fd-button fd-button-primary"},u.save),H=g("button",{type:"button",class:"fd-button"},u.discard);H.addEventListener("click",()=>l.reset()),t.showActions===!1?Z.append(...(v.buttons??[]).map(L)):Z.append(F,H,...(v.buttons??[]).map(L),q),f.push(j=>{let B=j.dirty.length>0&&j.status!=="saving";F.hidden=!B,H.hidden=!B});let K=g("div",{class:"fd-header"},Z);v.statusbar&&K.append(N(v.statusbar));let J=g("div",{class:"fd-card"});if(v.ribbon){let j=g("div",{class:`fd-ribbon fd-tone-${v.ribbon.tone??"muted"}`,"data-node":v.ribbon.id},v.ribbon.label);E(j,v.ribbon.id),J.append(g("div",{class:"fd-ribbon-frame"},j))}if(v.statButtons?.length){let j=g("div",{class:"fd-stats"});for(let B of v.statButtons){let oe=g("span",{class:"fd-stat-value"}),$e=g("button",{type:"button",class:"fd-stat","data-node":B.id},oe,g("span",{class:"fd-stat-label"},B.label));$e.addEventListener("click",()=>{l.runAction(B.id)}),f.push(Ie=>{$e.hidden=l.node(B.id).invisible;let ot=B.field?Ie.values[B.field]:null;oe.textContent=ot==null?"":String(ot)}),j.append($e)}J.append(j)}for(let j of v.alerts??[]){let B=g("div",{class:`fd-alert fd-tone-${j.tone??"info"}`,role:"status","data-node":j.id},j.message);E(B,j.id),J.append(B)}if(v.title){let j=g("div",{class:"fd-title"});j.append(_({type:"field",id:"#title",field:v.title.field,placeholder:v.title.placeholder})),v.title.subtitleField&&j.append(_({type:"field",id:"#subtitle",field:v.title.subtitleField}));let B=g("div",{class:"fd-title-row"},j);if(v.title.avatarField){let oe=_({type:"field",id:"#avatar",field:v.title.avatarField});oe.classList.add("fd-avatar"),B.append(oe)}J.append(B)}J.append(W(v.children));let ue=g("div",{class:"fd-sheet-layout"},J);return v.sidePanel&&(ue.classList.add("fd-has-side"),ue.append(g("aside",{class:"fd-side"},U(v.sidePanel)))),P.append(K,ue),P}function N(v){let P=o.fields[v.field],Z={clickable:v.clickable===!0};v.visibleStates&&(Z.visibleStates=v.visibleStates);let F={type:"field",id:"#statusbar",field:v.field,widget:"statusbar",options:Z},H=We({form:l,name:v.field,field:P,node:F,id:b("statusbar"),document:r,labels:d,preferences:s,locale:i,dialogs:a},t.widgets);return f.push(K=>H.update({value:K.values[v.field],values:K.values,readonly:l.node("#statusbar").readonly,required:!1,invalid:!1})),H.element}let D=null,O=o.layout,Q;O.type==="sheet"?Q=$(O):O.type==="wizard"?Q=k(O):O.type==="tabs"?Q=x({id:`${O.id}-page`,children:[O]}):Q=x(O);let te=O.type==="sheet"?null:nt();Ce.append(...te?[te]:[],V,Q),S.append(Ce,ze),S.addEventListener("submit",v=>{v.preventDefault(),D?D():Ge()});function be(v){return new Promise(P=>{let Z=g("p",{id:`${p}-confirm`},v),F=g("button",{type:"button",class:"fd-button"},u.cancel),H=g("button",{type:"button",class:"fd-button fd-button-primary"},u.ok),K=g("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":Z.id},Z,g("div",{class:"fd-actions fd-actions-end"},F,H)),J=g("div",{class:"fd-dialog-backdrop"},K),ue=j=>{J.remove(),P(j)};F.addEventListener("click",()=>ue(!1)),H.addEventListener("click",()=>ue(!0)),J.addEventListener("keydown",j=>{j.key==="Escape"&&ue(!1)}),S.append(J),H.focus()})}function Ee(v){for(let P of f)P(v)}e.append(S);let ve=l.subscribe(Ee);return Ee(l.getState()),l.getState().status==="idle"&&l.load(),{form:l,element:S,setSkin(v){S.setAttribute("data-fd-skin",v)},async save(){let v=await l.save();return v||he(),v},check(){let v=l.validate();return v||he(),v},destroy(){ve();for(let v of m)v();S.remove(),c&&l.dispose()}}}function ym(e){return e.layout.type==="sheet"&&e.layout.title?.field?e.layout.title.field:e.fields.name?"name":Object.entries(e.fields).find(([,t])=>t.type==="char")?.[0]??null}function xm(e,t,r){let n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,r?{...i,readonly:!0}:i]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:n,layout:{type:"sections",id:"values",children:[{type:"section",id:"values-section",columns:2,children:Object.keys(n).map(o=>({type:"field",id:`values-${o}`,field:o}))}]}}}function vm(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function wm(e){let t=n=>(typeof e.relatedPages=="function"?e.relatedPages(n):e.relatedPages?.[n])??null,r={locale:e.locale,skin:e.skin,dir:e.dir,widgets:e.widgets,preferences:e.preferences,relatedPages:e.relatedPages};return{canOpen:n=>t(n)!==null,async openRecord(n,o){let i=t(n);if(!i)return null;let s=ym(i),a=await un({...r,page:i,dataSource:e.dataSource,recordId:o.recordId??null,values:o.name&&s?{[s]:o.name}:void 0,title:o.title,size:"large"});if(!a.saved||a.recordId===null)return null;let c=s?a.values[s]:null;return{id:a.recordId,label:typeof c=="string"&&c?c:o.name??o.title}},searchMore:n=>li({title:n.title,search:n.search,locale:e.locale,skin:e.skin,dir:e.dir}),async editValues(n){let o=await un({...r,page:xm(n.fields,n.title,n.readonly===!0),dataSource:vm(e.dataSource),values:n.values,title:n.title,mode:"values",...n.recompute?{recompute:n.recompute}:{}});return o.saved?o.values:null}}}var km="0.5.0";return Bu(_m);})();
|
|
605
|
+
`,An="fieldia-styles";function Jt(e){if(e.getElementById(An))return;let t=e.createElement("style");t.id=An,t.textContent=Mn,(e.head??e.documentElement).append(t)}function Ut(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(n){try{let r=t()?.getItem(`fieldia:${n}`);return r==null?null:JSON.parse(r)}catch{return null}},set(n,r){try{t()?.setItem(`fieldia:${n}`,JSON.stringify(r))}catch{}}}}function Tr(){let e=new Map;return{get:t=>e.has(t)?Tn(e.get(t)):null,set:(t,n)=>{e.set(t,Tn(n))}}}var Tn=e=>JSON.parse(JSON.stringify(e));var Cr="http://www.w3.org/2000/svg",Cn={user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-6 8-6s8 2 8 6"/>',users:'<circle cx="9" cy="8" r="3.5"/><path d="M2 20c0-3.5 3-5.5 7-5.5s7 2 7 5.5"/><circle cx="17" cy="9" r="2.5"/><path d="M16.5 14.5c3 0 5.5 1.6 5.5 4.5"/>',building:'<rect x="4" y="3" width="16" height="18" rx="1"/><path d="M9 21v-4h6v4M8 7h2M14 7h2M8 11h2M14 11h2"/>',home:'<path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/><path d="M10 20v-6h4v6"/>',phone:'<rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/>',mail:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/>',pin:'<path d="M12 21s-7-6.5-7-12a7 7 0 0 1 14 0c0 5.5-7 12-7 12z"/><circle cx="12" cy="9" r="2.5"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/>',money:'<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="3"/><path d="M6 9.5v0M18 14.5v0"/>',cart:'<path d="M3 4h2l2.5 11h11L21 7H6.4"/><circle cx="9" cy="19.5" r="1.5"/><circle cx="17" cy="19.5" r="1.5"/>',box:'<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z"/><path d="M4 7.5l8 4.5 8-4.5M12 12v9"/>',truck:'<path d="M2 6h12v10H2zM14 9h4l3 3.5V16h-7"/><circle cx="6.5" cy="17.5" r="1.8"/><circle cx="17" cy="17.5" r="1.8"/>',receipt:'<path d="M6 3h12v18l-3-2-3 2-3-2-3 2z"/><path d="M9 8h6M9 12h6"/>',file:'<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4M9 12h6M9 16h6"/>',edit:'<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M13.5 6.5l4 4"/>',tag:'<path d="M3 12V4h8l10 10-8 8z"/><circle cx="7.5" cy="8" r="1.5"/>',star:'<path d="M12 3l2.8 6 6.2.6-4.7 4.2 1.4 6.2L12 16.8 6.3 20l1.4-6.2L3 9.6 9.2 9z"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v6M12 7.5v0"/>',warning:'<path d="M12 3l10 18H2z"/><path d="M12 10v5M12 18v0"/>',settings:'<path d="M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',chart:'<path d="M3 20h18M6 20v-8M11 20V5M16 20v-6"/>',link:'<path d="M10 14a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6l-1 1"/><path d="M14 10a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1-1"/>',list:'<path d="M8 6h12M8 12h12M8 18h12M4 6v0M4 12v0M4 18v0"/>',chat:'<path d="M4 5h16v11H9l-5 4z"/>'};function et(e,t,n){let r=t?n?.[t]??Cn[t]:void 0;if(r===void 0)return null;let a=e.createElementNS(Cr,"svg");for(let[i,o]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",class:"fd-icon","data-icon":t}))a.setAttribute(i,o);return a.innerHTML=r,a}var $n=0,$r='button, [href], input, select, textarea, [contenteditable="true"], [tabindex]:not([tabindex="-1"])';function St(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,a={...Ce[e.locale??"en"],...e.labels},i=`fd-dialog-${++$n}`,o=(u,E={},k)=>{let F=t.createElement(u);for(let[O,M]of Object.entries(E))F.setAttribute(O,M);return k!==void 0&&(F.textContent=k),F},d=o("h2",{id:`${i}-title`,class:"fd-form-dialog-title"},e.title),s=o("button",{type:"button",class:"fd-dialog-close","aria-label":a.close},"\xD7"),l=o("div",{class:"fd-form-dialog-body"}),p=o("button",{type:"button",class:"fd-button"},a.discard),y=o("button",{type:"button",class:"fd-button fd-button-primary"},a.saveClose),v=o("div",{class:`fd-theme fd-form-dialog fd-size-${e.size??"medium"}`,"data-fd-skin":e.skin??"underline",role:"dialog","aria-modal":"true","aria-labelledby":d.id,tabindex:"-1"});e.dir&&v.setAttribute("dir",e.dir),v.append(o("div",{class:"fd-form-dialog-head"}),l,o("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),v.firstElementChild?.append(d,s),v.lastElementChild?.append(p,y);let h=o("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});h.append(v),n.append(h);let g=Kt(l,{...e,showActions:!1}),f=!1;e.recompute&&Vr(g.form,e.page.fields,e.recompute,()=>f);let w=()=>[...v.querySelectorAll($r)].filter(u=>!u.closest("[hidden], [inert]")&&!u.disabled),b=()=>l.querySelector('input:not([type="hidden"]), select, textarea, [contenteditable="true"]');return(b()??v).focus(),g.form.settled().then(()=>{(t.activeElement===v||!v.contains(t.activeElement))&&b()?.focus()}),new Promise(u=>{let E=k=>{if(f)return;f=!0;let F=g.form.getState(),O={saved:k,recordId:F.recordId??null,values:F.values};g.destroy(),h.remove(),r?.focus(),u(O)};y.addEventListener("click",async()=>{y.disabled=!0;let k=e.mode==="values"?g.check():await g.save();y.disabled=!1,k&&E(!0)}),p.addEventListener("click",()=>E(!1)),s.addEventListener("click",()=>E(!1)),v.addEventListener("keydown",k=>{if(k.key==="Enter"&&(k.ctrlKey||k.metaKey)&&!k.isComposing){if(k.target.closest(".ag-root-wrapper"))return;k.preventDefault(),t.activeElement?.dispatchEvent(new Event("change",{bubbles:!0})),y.click();return}if(!k.defaultPrevented){if(k.key==="Escape")k.preventDefault(),E(!1);else if(k.key==="Tab"){let F=w();if(!F.length)return;let O=F[0],M=F[F.length-1];k.shiftKey&&t.activeElement===O?(k.preventDefault(),M.focus()):!k.shiftKey&&t.activeElement===M&&(k.preventDefault(),O.focus())}}})})}function Vr(e,t,n,r){let a=JSON.stringify(e.getState().values),i=!1;e.subscribe(()=>{let o=e.getState().values,d=JSON.stringify(o);i||d===a||(a=d,n(o).then(s=>{if(!(r()||JSON.stringify(e.getState().values)!==d)){i=!0;for(let[l,p]of Object.entries(s))l in t&&JSON.stringify(o[l]??null)!==JSON.stringify(p??null)&&e.setValue(l,p);i=!1,a=JSON.stringify(e.getState().values)}},()=>{}))})}function _t(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,a=Ce[e.locale??"en"],i=de[e.locale??"en"],o=`fd-dialog-${++$n}`,d=(u,E={},k)=>{let F=t.createElement(u);for(let[O,M]of Object.entries(E))F.setAttribute(O,M);return k!==void 0&&(F.textContent=k),F},s=d("h2",{id:`${o}-title`,class:"fd-form-dialog-title"},e.title),l=d("button",{type:"button",class:"fd-dialog-close","aria-label":a.close},"\xD7"),p=d("input",{type:"search",class:"fd-input","aria-label":i.search,placeholder:i.search,"aria-controls":`${o}-list`,autocomplete:"off"}),y=d("ul",{id:`${o}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":s.id}),v=d("button",{type:"button",class:"fd-button"},a.cancel),h=d("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":e.skin??"underline",role:"dialog","aria-modal":"true","aria-labelledby":s.id});e.dir&&h.setAttribute("dir",e.dir);let g=d("div",{class:"fd-form-dialog-head"});g.append(s,l);let f=d("div",{class:"fd-form-dialog-body fd-search-body"});f.append(p,y);let w=d("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});w.append(v),h.append(g,f,w);let b=d("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return b.append(h),n.append(b),p.focus(),new Promise(u=>{let E=[],k=-1,F=0,O,M=U=>{clearTimeout(O),F++,b.remove(),r?.focus(),u(U)},P=()=>{y.replaceChildren(...E.map((U,re)=>{let J=d("li",{id:`${o}-option-${re}`,role:"option",class:`fd-option${re===k?" fd-active":""}`,"aria-selected":String(re===k)},U.label);return J.addEventListener("click",()=>M(U)),J})),E.length||y.append(d("li",{class:"fd-empty"},i.noResults)),k>=0?p.setAttribute("aria-activedescendant",`${o}-option-${k}`):p.removeAttribute("aria-activedescendant")},H=()=>{clearTimeout(O);let U=++F;O=setTimeout(async()=>{let re=await e.search(p.value,80).catch(()=>[]);U===F&&(E=re,k=-1,P())},180)};p.addEventListener("input",H),p.addEventListener("keydown",U=>{if(U.key==="ArrowDown"||U.key==="ArrowUp"){if(U.preventDefault(),!E.length)return;k=(k+(U.key==="ArrowDown"?1:-1)+E.length)%E.length,P(),y.children[k]?.scrollIntoView?.({block:"nearest"})}else U.key==="Enter"&&k>=0&&(U.preventDefault(),M(E[k]))}),v.addEventListener("click",()=>M(null)),l.addEventListener("click",()=>M(null)),h.addEventListener("keydown",U=>{U.key==="Escape"&&(U.preventDefault(),M(null))}),H()})}function Or(e){return e.layout.type==="sheet"&&e.layout.title?.field?e.layout.title.field:e.fields.name?"name":Object.entries(e.fields).find(([,t])=>t.type==="char")?.[0]??null}function Ir(e,t,n){let r=Object.fromEntries(Object.entries(e).map(([a,i])=>[a,n?{...i,readonly:!0}:i]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:r,layout:{type:"sections",id:"values",children:[{type:"section",id:"values-section",columns:2,children:Object.keys(r).map(a=>({type:"field",id:`values-${a}`,field:a}))}]}}}function Dr(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function Vn(e){let t=r=>(typeof e.relatedPages=="function"?e.relatedPages(r):e.relatedPages?.[r])??null,n={locale:e.locale,skin:e.skin,dir:e.dir,widgets:e.widgets,preferences:e.preferences,relatedPages:e.relatedPages,translate:e.translate};return{canOpen:r=>t(r)!==null,async openRecord(r,a){let i=t(r);if(!i)return null;let o=Or(i),d=await St({...n,page:i,dataSource:e.dataSource,recordId:a.recordId??null,values:a.name&&o?{[o]:a.name}:void 0,title:a.title,size:"large"});if(!d.saved||d.recordId===null)return null;let s=o?d.values[o]:null;return{id:d.recordId,label:typeof s=="string"&&s?s:a.name??a.title}},searchMore:r=>_t({title:r.title,search:r.search,locale:e.locale,skin:e.skin,dir:e.dir}),async editValues(r){let a=await St({...n,page:Ir(r.fields,r.title,r.readonly===!0),dataSource:Dr(e.dataSource),values:r.values,title:r.title,mode:"values",...r.recompute?{recompute:r.recompute}:{}});return a.saved?a.values:null}}}var Ce={en:{save:"Save",edit:"Edit",done:"Done",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",skip:"Skip",steps:"Steps",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",saveClose:"Save & Close",close:"Close",dismiss:"Dismiss",retry:"Retry",notSaved:"Not saved",notSent:"Not sent",checkFields:"{what}. Check: {fields}",offline:"Could not reach the server. Your changes are still here."},ar:{save:"\u062D\u0641\u0638",edit:"\u062A\u0639\u062F\u064A\u0644",done:"\u062A\u0645",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",skip:"\u062A\u062E\u0637\u064D\u0651",steps:"\u0627\u0644\u062E\u0637\u0648\u0627\u062A",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",saveClose:"\u062D\u0641\u0638 \u0648\u0625\u063A\u0644\u0627\u0642",close:"\u0625\u063A\u0644\u0627\u0642",dismiss:"\u0625\u062E\u0641\u0627\u0621",retry:"\u0623\u0639\u062F \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",notSaved:"\u0644\u0645 \u064A\u064F\u062D\u0641\u0638",notSent:"\u0644\u0645 \u064A\u064F\u0631\u0633\u0644",checkFields:"{what}. \u0631\u0627\u062C\u0650\u0639: {fields}",offline:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0648\u0635\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u062E\u0627\u062F\u0645. \u062A\u0639\u062F\u064A\u0644\u0627\u062A\u0643 \u0645\u0627 \u0632\u0627\u0644\u062A \u0647\u0646\u0627."},de:{save:"Speichern",edit:"Bearbeiten",done:"Fertig",discard:"Verwerfen",saving:"Wird gespeichert\u2026",saved:"Gespeichert",submit:"Absenden",next:"Weiter",back:"Zur\xFCck",skip:"\xDCberspringen",steps:"Schritte",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",saveClose:"Speichern und schlie\xDFen",close:"Schlie\xDFen",dismiss:"Ausblenden",retry:"Erneut versuchen",notSaved:"Nicht gespeichert",notSent:"Nicht gesendet",checkFields:"{what}. Bitte pr\xFCfen: {fields}",offline:"Der Server ist nicht erreichbar. Ihre \xC4nderungen sind noch da."},fr:{save:"Enregistrer",edit:"Modifier",done:"Termin\xE9",discard:"Annuler les modifications",saving:"Enregistrement\u2026",saved:"Enregistr\xE9",submit:"Envoyer",next:"Suivant",back:"Retour",skip:"Passer",steps:"\xC9tapes",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",saveClose:"Enregistrer et fermer",close:"Fermer",dismiss:"Masquer",retry:"R\xE9essayer",notSaved:"Non enregistr\xE9",notSent:"Non envoy\xE9",checkFields:"{what}. \xC0 v\xE9rifier : {fields}",offline:"Le serveur est injoignable. Vos modifications sont toujours l\xE0."}},On=Ce.en;var Pr=0;function Kt(e,t){let n=e.ownerDocument,r=st(t.page);if(!r.ok)throw new Error(`This page cannot be shown:
|
|
606
|
+
${r.issues.map(c=>` ${c.path}: ${c.message}`).join(`
|
|
607
|
+
`)}`);let a=t.translate?dt(r.page,t.translate):r.page,i=t.locale??"en",o=t.preferences??Ut(),d=Vn(t),s=!t.form,l=t.form??pt({...t,page:a,messages:t.messages??Te[i]}),p={...Ce[i],...t.labels},y=de[i],v=t.dir??(i==="ar"?"rtl":void 0),h=`fd${++Pr}`,g=[],f=[],w=c=>`${h}-${c.replace(/[^A-Za-z0-9_-]/g,"_")}`,b=(c,R)=>c.replace(/\{(\w+)\}/g,(A,I)=>String(R[I]??""));Jt(n);function u(c,R={},...A){let I=n.createElement(c);for(let[D,q]of Object.entries(R))q!==void 0&&I.setAttribute(D,q);return I.append(...A),I}function E(c,R){let A=et(n,c,t.icons);return A?[A,R]:[R]}let k=u("form",{class:"fd-form",novalidate:"","data-fd-skin":t.skin??"underline",dir:v,lang:t.locale,"data-max-width":a.maxWidth}),F=t.confirm??Gt;function O(c){let R=a.fields[c.field],A=w(c.id),I=u("div",{class:"fd-field","data-node":c.id,"data-field":c.field,"data-type":R.type});c.colspan&&I.style.setProperty("--fd-span",String(c.colspan));let D=u("label",{class:"fd-label",id:`${A}-label`,for:A},c.label??R.label),q=t.showValid&&!Wr.has(R.type)?et(n,"check"):null;q&&(q.classList.add("fd-valid-mark"),D.append(q));let j=ke({form:l,name:c.field,field:R,node:c,id:A,document:n,labels:y,preferences:o,locale:i,dialogs:d},t.widgets);["INPUT","SELECT","TEXTAREA"].includes(j.element.tagName)||(j.element.getAttribute("role")&&j.element.setAttribute("aria-labelledby",D.id),D.addEventListener("click",()=>j.focus()));let ie=c.help??R.help,Y=ie?u("div",{class:"fd-help",id:`${A}-help`},ie):null,G=u("div",{class:"fd-error",id:`${A}-error`,hidden:""}),he=u("div",{class:"fd-warning",role:"status",hidden:""});return I.append(D,j.element,...Y?[Y]:[],G,he),j.destroy&&f.push(()=>j.destroy?.()),g.push(B=>{let V=l.node(c.id);I.hidden=V.invisible,I.classList.toggle("fd-required",V.required);let K=B.errors[c.field];G.hidden=!K,G.textContent=K??"";let ge=B.warning&&B.warningField===c.field?B.warning:"";if(he.hidden=!ge,he.textContent=ge,q){let we=B.values[c.field],ye=we!=null&&we!==""&&!(Array.isArray(we)&&!we.length),xe=!V.readonly&&!K&&ye&&B.dirty.includes(c.field)&&l.problem(c.field)===null;I.classList.toggle("fd-valid",xe),q.toggleAttribute("hidden",!xe)}j.update({value:B.values[c.field],values:B.values,readonly:V.readonly||C,required:V.required,invalid:!!K,describedBy:[Y?.id,K?G.id:void 0].filter(Boolean).join(" ")||void 0})}),I}function M(c,R){g.push(()=>{c.hidden=l.node(R).invisible})}function P(c){let R=u("button",{type:"button",class:`fd-button fd-button-${c.style??"secondary"}`,"data-node":c.id},...E(c.icon,c.label));return R.addEventListener("click",async()=>{c.confirm&&!await F(c.confirm)||await l.runAction(c.id)}),M(R,c.id),R}function H(c){let R=c.style??"paragraph",A=u(R==="heading"?"h3":"p",{class:`fd-text-${R}`,"data-node":c.id},c.text);return M(A,c.id),A}function U(c){let R=u("div",{class:"fd-slot","data-slot":c.name,"data-node":c.id}),A=t.slots?.[c.name]?.(R,{form:l,name:c.name});return A&&f.push(A),M(R,c.id),R}function re(c,R=1){let A=u("div",{class:"fd-grid"});if(A.style.setProperty("--fd-columns",String(rt(R))),typeof R=="object")for(let I of["medium","narrow"]){let D=R[I];D!==void 0&&(A.setAttribute(`data-columns-${I}`,String(D)),A.style.setProperty(`--fd-columns-${I}`,String(D)))}return A.append(...c.map(Z)),A}let J=new Map;function _(c){let R=u("fieldset",{class:"fd-section","data-node":c.id}),A=c.description?u("p",{class:"fd-section-description"},c.description):null,I=re(c.children,c.columns);if(c.title&&c.collapsible){I.id=w(`${c.id}-content`);let D=u("button",{type:"button",class:"fd-section-toggle","aria-controls":I.id},u("span",{class:"fd-section-chevron","aria-hidden":"true"}),...E(c.icon,c.title)),q=c.collapsed!==!0,j=ie=>{q=ie,D.setAttribute("aria-expanded",String(q)),I.hidden=!q,A&&(A.hidden=!q),R.classList.toggle("fd-section-folded",!q)};D.addEventListener("click",()=>j(!q)),J.set(R,()=>j(!0)),j(q),R.append(u("legend",{class:"fd-section-title"},D))}else c.title&&R.append(u("legend",{class:"fd-section-title"},...E(c.icon,c.title)));return A&&R.append(A),R.append(I),M(R,c.id),R}function te(c){let R=u("div",{class:"fd-tabs","data-node":c.id}),A=u("div",{class:"fd-tablist",role:"tablist"}),I=null,D=c.children[0].id,q=c.children.map(j=>{let ie=w(`${j.id}-tab`),Y=w(`${j.id}-panel`),G=u("button",{type:"button",class:"fd-tab",role:"tab",id:ie,"aria-controls":Y,"data-node":j.id},...E(j.icon,j.label)),he=u("div",{class:"fd-tabpanel",role:"tabpanel",id:Y,"aria-labelledby":ie},re(j.children));return G.addEventListener("click",()=>{I=D=j.id,We(l.getState())}),A.append(G),{tab:j,button:G,panel:he}});return A.addEventListener("keydown",j=>{let ie=q.filter(V=>!V.button.hidden),Y=ie.findIndex(V=>V.tab.id===D),G={ArrowRight:1,ArrowLeft:-1,Home:-Y,End:ie.length-1-Y}[j.key];if(G===void 0||Y===-1)return;j.preventDefault();let he=k.getAttribute("dir")==="rtl"&&(j.key==="ArrowRight"||j.key==="ArrowLeft"),B=ie[(Y+(he?-G:G)+ie.length)%ie.length];I=D=B.tab.id,We(l.getState()),B.button.focus()}),R.append(A,...q.map(j=>j.panel)),g.push(()=>{R.hidden=l.node(c.id).invisible;let j=q.filter(Y=>!l.node(Y.tab.id).invisible);I!==null&&j.some(Y=>Y.tab.id===I)?D=I:j.length&&(D=j[0].tab.id);for(let Y of q){let G=Y.tab.id===D;Y.button.hidden=!j.includes(Y),Y.button.setAttribute("aria-selected",String(G)),Y.button.tabIndex=G?0:-1,Y.panel.hidden=!G}}),R}function Z(c){switch(c.type){case"field":return O(c);case"button":return P(c);case"text":return H(c);case"slot":return U(c);case"section":return _(c);case"tabs":return te(c)}}let C=t.readonly===!0,$=t.editSwitch?u("button",{type:"button",class:"fd-button fd-edit-switch"}):null;$?.addEventListener("click",async()=>{if(C)C=!1;else{if(l.getState().dirty.length&&!await l.save()){l.getState().saveProblem||se(fe(l.getState())),T();return}C=!0}k.toggleAttribute("data-readonly",C),We(l.getState())}),k.toggleAttribute("data-readonly",C),g.push(()=>{$&&($.textContent=C?p.edit:p.done,$.classList.toggle("fd-button-primary",C))});let W=u("div",{class:"fd-status",role:"status","aria-live":"polite"}),X=u("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},p.retry);X.addEventListener("click",()=>{ue()});let Q=u("div",{class:"fd-status-box"},W,X),ce=()=>a.data.kind==="responses"?p.notSent:p.notSaved;function fe(c){let R=[];for(let I of Object.keys(c.errors)){let D=I.split(".")[0],j=k.querySelector(`.fd-field[data-field="${D}"]:not([hidden]) > .fd-label`)?.firstChild?.textContent??a.fields[D]?.label??D;R.includes(j)||R.push(j)}let A=[...k.querySelectorAll(".fd-field[data-field] > .fd-label")].map(I=>I.firstChild?.textContent??"");return R.sort((I,D)=>(A.indexOf(I)+1||1/0)-(A.indexOf(D)+1||1/0)),R.length?b(p.checkFields,{what:ce(),fields:R.join(", ")}):ce()}let pe;g.push(c=>{let R=c.saveProblem,A=c.status==="saving"?p.saving:c.status==="saved"?p.saved:c.status==="loading"?p.loading:c.status==="error"&&R?R.kind==="fields"?fe(c):R.kind==="other"?R.message:ce():c.status==="error"?c.error??"":"";W.textContent=A,X.hidden=!(c.status==="error"&&R?.kind==="other"),W.classList.toggle("fd-status-error",c.status==="error"),W.classList.toggle("fd-status-saved",c.status==="saved"),t.saveStatus==="toast"&&(clearTimeout(pe),Q.hidden=!A,c.status==="saved"&&(pe=setTimeout(()=>Q.hidden=!0,2500)))});let Se=u("button",{type:"button",class:"fd-button fd-retry"},p.retry);Se.addEventListener("click",()=>{ue()});let Fe=u("div",{class:"fd-banner fd-tone-warning",role:"alert",hidden:""},u("span",{class:"fd-banner-text"},p.offline),Se),Ne=u("div",{class:"fd-announce",role:"alert","aria-live":"assertive"});function se(c){Ne.textContent="",setTimeout(()=>Ne.textContent=c,0)}let m=null;g.push(c=>{c.saveProblem!==m&&(m=c.saveProblem,Fe.hidden=m?.kind!=="network",m&&(m.kind==="rule"?Gt(m.message,!1):m.kind==="fields"?se(fe(c)):m.kind==="other"&&se(m.message)))});let x=u("div",{class:"fd-draft",hidden:""}),L=u("span"),S=u("button",{type:"button",class:"fd-button fd-button-primary"},p.restore),N=u("button",{type:"button",class:"fd-button fd-button-link"},p.discardDraft);S.addEventListener("click",()=>l.restoreDraft()),N.addEventListener("click",()=>l.discardDraft()),x.append(L,S,N),g.push(c=>{x.hidden=!c.draft,c.draft&&(L.textContent=b(p.draftFound,{time:new Date(c.draft.savedAt).toLocaleString()}))});function T(){let c=k.querySelector('[aria-invalid="true"]');if(!c)return;for(let A=c.closest(".fd-section-folded");A;A=A.parentElement?.closest(".fd-section-folded")??null)J.get(A)?.();if(!c.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(c.matches("input, select, textarea, button")?c:c.querySelector("input, select, textarea, button"))?.focus()}let z=u("div",{class:"fd-done",hidden:""},u("p",{class:"fd-done-title"},p.submitted)),oe=u("button",{type:"button",class:"fd-button"},p.submitAnother);z.append(oe);let ae=u("div",{class:"fd-content"});async function ue(){if(!await l.save()){l.getState().saveProblem||se(fe(l.getState())),T();return}a.data.kind==="responses"&&(ae.hidden=!0,z.hidden=!1)}oe.addEventListener("click",()=>{l.reset(),ae.hidden=!1,z.hidden=!0});function ne(){if(!a.title&&!a.description)return null;let c=u("header",{class:"fd-page-head"});return a.title&&c.append(u("h1",{class:"fd-page-title"},a.title)),a.description&&c.append(u("p",{class:"fd-page-description"},a.description)),c}function Be(c){let R=u("div",{class:"fd-sections","data-node":c.id},...c.children.map(Z)),A=u("button",{type:"submit",class:"fd-button fd-button-primary"},a.data.kind==="responses"?p.submit:p.save),I=u("div",{class:"fd-actions fd-actions-end"},Q,A);if(a.data.kind==="record"){let D=u("button",{type:"button",class:"fd-button"},p.discard);D.addEventListener("click",()=>l.reset()),I.insertBefore(D,A),g.push(q=>{let j=q.dirty.length>0&&q.status!=="saving"&&!C;A.hidden=!j,D.hidden=!j})}else g.push(()=>A.hidden=C);return $&&I.prepend($),t.showActions===!1?u("div",{},R):a.actionsPosition==="top"?(I.classList.add("fd-actions-top"),u("div",{},I,R)):u("div",{},R,I)}function Lt(c){let R=u("div",{class:"fd-wizard","data-node":c.id}),A=u("div",{class:"fd-progress-text"}),I=u("span");R.append(u("div",{class:"fd-progress"},A,u("div",{class:"fd-progress-bar"},I)));let D=c.clickable?u("ol",{class:"fd-steps-list"}):null,q=new Map;if(D){for(let V of c.children){let K=u("button",{type:"button",class:"fd-step-link"},...E(V.icon,V.label));K.addEventListener("click",()=>{l.goTo(V.id)?B():T()}),q.set(V.id,K),D.append(u("li",{},K))}R.append(u("nav",{class:"fd-steps","aria-label":p.steps},D))}let j=c.children.map(V=>{let K=u("section",{class:"fd-step","data-node":V.id,"aria-labelledby":w(`${V.id}-title`)});return K.append(u("h2",{class:"fd-step-title",id:w(`${V.id}-title`)},...E(V.icon,V.label))),V.description&&K.append(u("p",{class:"fd-section-description"},V.description)),K.append(re(V.children)),R.append(K),{step:V,panel:K}}),ie=u("button",{type:"button",class:"fd-button"},c.backLabel??p.back),Y=u("button",{type:"button",class:"fd-button fd-button-link"},p.skip),G=u("button",{type:"submit",class:"fd-button fd-button-primary"});R.append(u("div",{class:"fd-wizard-nav"},ie,u("span",{class:"fd-spacer"}),Q,Y,G)),ie.addEventListener("click",()=>{l.back()&&B()}),Y.addEventListener("click",()=>{l.skip()&&B()});let he=()=>{let V=l.steps();return V.indexOf(l.getState().step??"")===V.length-1};be=async()=>{if(he())return ue();l.next()?B():T()};function B(){j.find(K=>K.step.id===l.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return g.push(V=>{let K=l.steps(),ge=Math.max(0,K.indexOf(V.step??""));A.textContent=b(p.stepOf,{n:ge+1,total:K.length}),I.style.width=`${(ge+1)/Math.max(1,K.length)*100}%`;for(let{step:ye,panel:xe}of j)xe.hidden=ye.id!==V.step;let we=ge===K.length-1;ie.hidden=ge===0,Y.hidden=we||!c.children.find(ye=>ye.id===V.step)?.optional,G.textContent=we?c.finishLabel??p.submit:c.nextLabel??p.next;for(let[ye,xe]of q){let $e=K.indexOf(ye);xe.parentElement.hidden=$e===-1,xe.classList.toggle("fd-step-done",$e!==-1&&$e<ge),xe.classList.toggle("fd-step-skipped",V.skipped.includes(ye)),ye===V.step?xe.setAttribute("aria-current","step"):xe.removeAttribute("aria-current")}}),R}function Et(c){let R=u("div",{class:"fd-sheet-page","data-node":c.id}),A=u("div",{class:"fd-actions"}),I=u("button",{type:"submit",class:"fd-button fd-button-primary"},p.save),D=u("button",{type:"button",class:"fd-button"},p.discard);D.addEventListener("click",()=>l.reset());let q=a.actionsPosition==="bottom",j=u("div",{class:"fd-actions fd-actions-end fd-sheet-foot"});t.showActions===!1?A.append(...(c.buttons??[]).map(P)):q?(A.append(...(c.buttons??[]).map(P)),j.append(Q,D,I)):A.append(I,D,...(c.buttons??[]).map(P),Q),$&&t.showActions!==!1&&A.prepend($),g.push(B=>{let V=B.dirty.length>0&&B.status!=="saving"&&!C;I.hidden=!V,D.hidden=!V});let ie=u("div",{class:"fd-header"},A),Y=c.statusbar?.position==="title";c.statusbar&&!Y&&ie.append(me(c.statusbar));let G=u("div",{class:"fd-card"});if(c.ribbon){let B=u("div",{class:`fd-ribbon fd-tone-${c.ribbon.tone??"muted"}`,"data-node":c.ribbon.id},c.ribbon.label);M(B,c.ribbon.id),G.append(u("div",{class:"fd-ribbon-frame"},B))}if(c.statButtons?.length){let B=u("div",{class:"fd-stats"});for(let V of c.statButtons){let K=u("span",{class:"fd-stat-value"}),ge=et(n,V.icon,t.icons),we=u("span",{class:"fd-stat-words"},K,u("span",{class:"fd-stat-label"},V.label)),ye=u("button",{type:"button",class:"fd-stat","data-node":V.id},...ge?[ge,we]:[we]);ye.addEventListener("click",()=>{l.runAction(V.id)}),g.push(xe=>{ye.hidden=l.node(V.id).invisible;let $e=V.field?xe.values[V.field]:null;K.textContent=$e==null?"":String($e)}),B.append(ye)}G.append(B)}for(let B of c.alerts??[]){let V=u("div",{class:`fd-alert fd-tone-${B.tone??"info"}`,role:"status","data-node":B.id},u("span",{class:"fd-alert-message"},B.message));if(B.dismissible){let K=!1,ge=u("button",{type:"button",class:"fd-alert-close","aria-label":p.dismiss},"\xD7");ge.addEventListener("click",()=>{K=!0,V.hidden=!0}),V.append(ge),g.push(()=>{V.hidden=K||l.node(B.id).invisible})}else M(V,B.id);G.append(V)}if(c.badges?.length){let B=u("div",{class:"fd-badges"});for(let V of c.badges){let K=u("span",{class:`fd-badge fd-tone-${V.tone??"muted"}`,"data-node":V.id},...E(V.icon,V.label));M(K,V.id),B.append(K)}g.push(()=>{B.hidden=[...B.children].every(V=>V.hidden)}),G.append(B)}if(c.title){let B=u("div",{class:"fd-title"});c.title.above?.length&&B.append(u("div",{class:"fd-title-above"},...c.title.above.map(O))),B.append(O({type:"field",id:"#title",field:c.title.field,placeholder:c.title.placeholder})),c.title.subtitleField&&B.append(O({type:"field",id:"#subtitle",field:c.title.subtitleField})),c.title.below?.length&&B.append(u("div",{class:"fd-title-below"},...c.title.below.map(O)));let V=u("div",{class:"fd-title-row"},B);if(c.title.avatarField){let K=O({type:"field",id:"#avatar",field:c.title.avatarField});K.classList.add("fd-avatar"),V.append(K)}G.append(V)}c.statusbar&&Y&&G.append(u("div",{class:"fd-title-statusbar"},me(c.statusbar))),G.append(re(c.children)),q&&t.showActions!==!1&&(G.append(j),g.push(B=>{j.hidden=B.dirty.length===0&&!W.textContent}));let he=u("div",{class:"fd-sheet-layout"},G);return c.sidePanel&&(he.classList.add("fd-has-side"),he.append(u("aside",{class:"fd-side"},U(c.sidePanel)))),R.append(ie,he),R}function me(c){let R=a.fields[c.field],A={clickable:c.clickable===!0};c.visibleStates&&(A.visibleStates=c.visibleStates);let I={type:"field",id:"#statusbar",field:c.field,widget:"statusbar",options:A},D=ke({form:l,name:c.field,field:R,node:I,id:w("statusbar"),document:n,labels:y,preferences:o,locale:i,dialogs:d},t.widgets);return g.push(q=>D.update({value:q.values[c.field],values:q.values,readonly:l.node("#statusbar").readonly||C,required:!1,invalid:!1})),D.element}let be=null,ve=a.layout,qe;ve.type==="sheet"?qe=Et(ve):ve.type==="wizard"?qe=Lt(ve):ve.type==="tabs"?qe=Be({id:`${ve.id}-page`,children:[ve]}):qe=Be(ve);let Yt=ve.type==="sheet"?null:ne();ae.append(...Yt?[Yt]:[],Fe,x,qe),k.append(ae,z,Ne),t.saveStatus==="toast"?(Q.classList.add("fd-toast"),k.append(Q)):t.saveStatus==="bar"&&(Q.classList.add("fd-status-bar"),ae.prepend(Q)),k.addEventListener("submit",c=>{c.preventDefault(),be?be():ue()});function In(){let c=n.activeElement;c&&k.contains(c)&&(c.tagName==="INPUT"||c.tagName==="TEXTAREA")&&c.dispatchEvent(new Event("change",{bubbles:!0}))}function Dn(c){let R=[...k.querySelectorAll(".fd-field")].filter(D=>!D.closest('[hidden], [data-type="one2many"] .fd-field, .fd-form-dialog')&&!D.parentElement?.closest('[data-type="one2many"]')),A=c.closest(".fd-field"),I=R.slice(R.indexOf(A)+1);for(let D of I){let q=D.querySelector('input:not([type="hidden"]):not([readonly]):not([disabled]), select:not([disabled]), textarea:not([readonly]), [contenteditable="true"]');if(q)return q}return null}k.addEventListener("keydown",c=>{if(c.isComposing||c.key!=="Enter")return;let R=t.keys??{};if(c.ctrlKey||c.metaKey){if(R.saveWithCtrlEnter===!1||t.showActions===!1||c.target.closest(".ag-root-wrapper"))return;c.preventDefault(),In(),be?be():ue();return}if(c.defaultPrevented||!R.enterMovesToNext||c.shiftKey||c.altKey)return;let A=c.target;A.tagName!=="INPUT"&&A.tagName!=="SELECT"||A.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(A.type)||(c.preventDefault(),Dn(A)?.focus())});function Gt(c,R=!0){return new Promise(A=>{let I=u("p",{id:`${h}-confirm`},c),D=u("button",{type:"button",class:"fd-button"},p.cancel),q=u("button",{type:"button",class:"fd-button fd-button-primary"},p.ok),j=u("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":I.id},I,u("div",{class:"fd-actions fd-actions-end"},...R?[D,q]:[q])),ie=u("div",{class:"fd-dialog-backdrop"},j),Y=G=>{ie.remove(),A(G)};D.addEventListener("click",()=>Y(!1)),q.addEventListener("click",()=>Y(!0)),ie.addEventListener("keydown",G=>{G.key==="Escape"&&Y(!1)}),k.append(ie),q.focus()})}function We(c){for(let R of g)R(c)}e.append(k);let Pn=l.subscribe(We);return We(l.getState()),l.getState().status==="idle"&&l.load(),{form:l,element:k,setSkin(c){k.setAttribute("data-fd-skin",c)},async save(){let c=await l.save();return c||T(),c},check(){let c=l.validate();return c||T(),c},setReadonly(c){C=c,k.toggleAttribute("data-readonly",C),We(l.getState())},isReadonly:()=>C,destroy(){Pn();for(let c of f)c();k.remove(),s&&l.dispose()}}}var Wr=new Set(["boolean","one2many","binary","image","html","json","properties"]);var zr="0.7.0";return Jn(jr);})();
|
|
563
608
|
//# sourceMappingURL=fieldia.js.map
|