@fieldia/viewer 0.18.0 → 0.19.1
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/README.md +1 -1
- package/bundle/fieldia.ar.js +2 -2
- package/bundle/fieldia.ar.js.map +2 -2
- package/bundle/fieldia.de.js +2 -2
- package/bundle/fieldia.de.js.map +2 -2
- package/bundle/fieldia.fr.js +2 -2
- package/bundle/fieldia.fr.js.map +2 -2
- package/bundle/fieldia.js +16 -16
- package/bundle/fieldia.js.map +4 -4
- package/package.json +3 -3
- package/src/lib/dialog.js +2 -2
- package/src/lib/dialog.js.map +1 -1
- package/src/lib/dialog.mjs +2 -2
- package/src/lib/dialog.mjs.map +1 -1
- package/src/lib/labels.d.mts +8 -0
- package/src/lib/labels.d.ts +8 -0
- package/src/lib/labels.js +3 -0
- package/src/lib/labels.js.map +1 -1
- package/src/lib/labels.mjs +3 -0
- package/src/lib/labels.mjs.map +1 -1
- package/src/lib/list.js +2 -5
- package/src/lib/list.js.map +1 -1
- package/src/lib/list.mjs +3 -6
- package/src/lib/list.mjs.map +1 -1
- package/src/lib/locales/ar.js +3 -0
- package/src/lib/locales/ar.js.map +1 -1
- package/src/lib/locales/ar.mjs +3 -0
- package/src/lib/locales/ar.mjs.map +1 -1
- package/src/lib/locales/de.js +3 -0
- package/src/lib/locales/de.js.map +1 -1
- package/src/lib/locales/de.mjs +3 -0
- package/src/lib/locales/de.mjs.map +1 -1
- package/src/lib/locales/fr.js +3 -0
- package/src/lib/locales/fr.js.map +1 -1
- package/src/lib/locales/fr.mjs +3 -0
- package/src/lib/locales/fr.mjs.map +1 -1
- package/src/lib/look.d.mts +3 -3
- package/src/lib/look.d.ts +3 -3
- package/src/lib/look.js +1 -1
- package/src/lib/look.js.map +1 -1
- package/src/lib/look.mjs +1 -1
- package/src/lib/look.mjs.map +1 -1
- package/src/lib/place.d.mts +4 -0
- package/src/lib/place.d.ts +4 -0
- package/src/lib/place.js +2 -0
- package/src/lib/place.js.map +1 -1
- package/src/lib/place.mjs +2 -0
- package/src/lib/place.mjs.map +1 -1
- package/src/lib/viewer.d.mts +13 -3
- package/src/lib/viewer.d.ts +13 -3
- package/src/lib/viewer.js +147 -13
- package/src/lib/viewer.js.map +1 -1
- package/src/lib/viewer.mjs +147 -14
- package/src/lib/viewer.mjs.map +1 -1
package/bundle/fieldia.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! Fieldia 0.
|
|
2
|
-
"use strict";var Fieldia=(()=>{var Nr=Object.defineProperty;var nl=Object.getOwnPropertyDescriptor;var rl=Object.getOwnPropertyNames;var il=Object.prototype.hasOwnProperty;var ol=(e,t,n)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var al=(e,t)=>{for(var n in t)Nr(e,n,{get:t[n],enumerable:!0})},sl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rl(t))!il.call(e,i)&&i!==n&&Nr(e,i,{get:()=>t[i],enumerable:!(r=nl(t,i))||r.enumerable});return e};var dl=e=>sl(Nr({},"__esModule",{value:!0}),e);var Wt=(e,t,n)=>ol(e,typeof t!="symbol"?t+"":t,n);var Uf={};al(Uf,{ADDRESS_PARTS:()=>Xr,BROWSER_HOTKEYS:()=>Hr,DEFAULT_LABELS:()=>Ad,DRAWN_IN_CELLS:()=>lc,FIELDIA_CSS:()=>Ld,FIELD_NAME:()=>Dn,FIELD_TYPES:()=>Cr,FIRST_FIELD:()=>Sr,FORMAT_VERSION:()=>Or,FORM_WIDTHS:()=>tf,HOTKEY:()=>ha,ICONS:()=>ks,MESSAGES:()=>Et,PART_LOOKS:()=>na,THEMES:()=>ta,THEME_SKINS:()=>qo,TOKEN_NAMES:()=>_o,VERSION:()=>_f,VIEWER_LABELS:()=>It,WIDGET_LABELS:()=>tt,accentShades:()=>kr,addLanguage:()=>Ii,applyLook:()=>Nn,binaryWidget:()=>hr,browserPreferences:()=>Wo,builtInWidgets:()=>ud,cellText:()=>Tn,charTagsWidget:()=>so,checkPage:()=>sr,checkValue:()=>bn,compileModifier:()=>rt,contrast:()=>Mn,countriesIn:()=>Eo,createForm:()=>ei,createMemoryDataSource:()=>Da,createWidget:()=>Ot,currencyOf:()=>Un,dayOf:()=>mn,describeTypes:()=>cr,detailLines:()=>ai,displayValue:()=>St,distributionIds:()=>vs,distributionModel:()=>fo,distributionWords:()=>di,drawIcon:()=>wt,emptyValue:()=>Rn,evaluateModifier:()=>va,expressionContext:()=>hn,facetsToFilter:()=>fr,fileProblem:()=>lr,fileShown:()=>ho,fill:()=>Je,fillValues:()=>ga,focusField:()=>Ci,formatBytes:()=>en,formatMoney:()=>$n,formatNumber:()=>gt,formatPlain:()=>ao,groupByFields:()=>Gr,hostScheduler:()=>ur,hotkeyWords:()=>jn,htmlWidget:()=>wo,imageWidget:()=>go,initialValues:()=>gn,installListStyles:()=>Pi,installStyles:()=>Do,isEmpty:()=>Kt,isModifierValid:()=>xa,isRightToLeft:()=>qr,isoWeek:()=>Vs,jsonProblem:()=>bi,jsonWidget:()=>ko,keepTabIn:()=>Gt,kindTextField:()=>Rs,labelPlace:()=>Rr,labelWidget:()=>yr,lineForm:()=>li,lineKind:()=>pt,linesWidget:()=>po,linkAddress:()=>Ws,linkAvatar:()=>_n,linkCheckboxesWidget:()=>lo,localizePage:()=>dr,many2oneWidget:()=>gr,matchesFilter:()=>qn,memoryPreferences:()=>rf,mountViewer:()=>Lr,normalizeNumber:()=>Jt,onelineRuns:()=>Zd,openFormDialog:()=>Xn,openFormPanel:()=>Uo,openLineDialog:()=>ci,openSearchDialog:()=>Ko,ownCurrency:()=>Fs,pageWords:()=>ya,planSection:()=>Vi,progressbarWidget:()=>br,propertiesWidget:()=>vo,readFile:()=>ui,readText:()=>Ho,readsAsText:()=>jo,referenceWidget:()=>co,rolesAllow:()=>En,sanitizeHtml:()=>xo,saveProblemOf:()=>Ur,saveRefused:()=>Na,scoreOf:()=>Ma,skinFor:()=>xn,splitValues:()=>Wn,statusbarWidget:()=>mi,suggestions:()=>Jr,summary:()=>pi,tagsWidget:()=>si,translatePage:()=>Bn,ungroup:()=>pr,valuesIn:()=>jr,wait:()=>Yr,wearTokens:()=>wn,wideColumns:()=>fn,withCalendar:()=>hi});var Dn=/^[A-Za-z_][A-Za-z0-9_]*$/,Cr=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json","matrix"];function fn(e){return typeof e=="object"?e.wide:e??1}var Or="0.1";var ta=["material","fluent","apple","bootstrap","shadcn","ant","odoo","google-forms"];var na={inputs:["background","border","corners","textSize","accent"],choices:["accent","background","border","corners","textSize"],groups:["background","border","corners"],buttons:["accent","corners","textSize"],tables:["background","border","textSize"]};var Hi=["id","user","editing","context"],Bi=["id","name","roles"];var bt=e=>typeof e=="number"&&Number.isFinite(e);function Zt(e){return Number.isFinite(e)?Number(e.toPrecision(15)):null}function ia(e,t,n){if(e==="+"&&(typeof t=="string"||typeof n=="string")){let r=ra(t),i=ra(n);return r===null||i===null?null:r+i}if(!bt(t)||!bt(n))return null;switch(e){case"+":return Zt(t+n);case"-":return Zt(t-n);case"*":return Zt(t*n);case"/":return Zt(t/n);case"%":return Zt(t-n*Math.floor(t/n));default:return null}}function ra(e){return e==null?"":typeof e=="string"?e:bt(e)?String(e):null}function oa(e){return bt(e)?Zt(-e):null}function Nt(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function or(e,t){let n=10**Math.trunc(t),r=Number((Math.abs(e)*n).toPrecision(15));return Zt(Math.sign(e)*Math.round(r)/n)}function un(e){let t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function aa(e){let t=e.args[0];return(t.type==="Identifier"?e.env.lines?.(t.name):void 0)??e.value(t)}function sa(e,t,n,r){let i=e[t];return i&&!(i.type==="Literal"&&typeof i.value=="string")?`${n} takes a condition, in quotes, on the lines: ${r}`:void 0}function da(e,t,n){let r=e.args[n];if(r?.type!=="Literal"||typeof r.value!="string")return t;let i=r.value;return t.filter(o=>o!==null&&typeof o=="object"&&e.holds(i,o))}function la(e){if(typeof e!="string")return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]))/864e5:null}function ca(e,t){let n=e.args.flatMap(i=>{let o=e.value(i);return Array.isArray(o)?o:[o]}).filter(i=>i!=null);return!n.length||!n.every(bt)&&!n.every(i=>typeof i=="string")?null:n.reduce((i,o)=>(t?o<i:o>i)?o:i)}var ar=new Map([["round",{takes:[1,2],call({args:e,value:t}){let n=t(e[0]),r=e.length>1?t(e[1]):0;return bt(n)&&bt(r)?or(n,r):null}}],["abs",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return bt(n)?Math.abs(n):null}}],["min",{takes:[1,1/0],call:e=>ca(e,!0)}],["max",{takes:[1,1/0],call:e=>ca(e,!1)}],["len",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return n==null?0:typeof n=="string"||Array.isArray(n)?n.length:null}}],["today",{takes:[0,0],call:({env:e})=>e.today?.()??un(new Date)}],["sum",{takes:[1,3],check(e){let t=e[1];return t&&!(t.type==="Literal"&&typeof t.value=="string")?"sum takes the name of a field, in quotes, after the lines: sum(lines, 'subtotal')":sa(e,2,"sum",`sum(lines, 'amount', "state == 'done'")`)},call(e){let t=aa(e);if(t==null)return 0;if(!Array.isArray(t))return null;let n=e.args[1]?.type==="Literal"?e.args[1].value:void 0,r=0;for(let i of da(e,t,2)){let o=n===void 0?i:i?.[n];bt(o)&&(r+=o)}return Zt(r)}}],["count",{takes:[1,2],check:e=>sa(e,1,"count",`count(lines, "state == 'done'")`),call(e){let t=aa(e);return t==null?0:Array.isArray(t)?da(e,t,1).length:null}}],["days",{takes:[2,2],call({args:e,value:t}){let n=la(t(e[0])),r=la(t(e[1]));return n===null||r===null?null:r-n}}],["if",{takes:[3,3],call:({args:e,value:t})=>Nt(t(e[0]))?t(e[1]):t(e[2])}]]);function fa(e,[t,n]){return n===0?`${e} takes no values`:t===n?`${e} takes ${t} value${t===1?"":"s"}`:n===1/0?`${e} takes ${t} or more values`:`${e} takes ${t} or ${n} values`}var zi=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]),ll=new Set(["+","-","*","/","%"]);function Qt(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,i=0;for(;;){if(r.lastIndex=i,r.exec(e),i=r.lastIndex,i>=e.length)return t;n.lastIndex=i;let o=n.exec(e);if(!o)throw new Error(`Unexpected "${e[i]}" at character ${i+1} of: ${e}`);t.push({type:cl(o[0]),value:o[0],position:t.length}),i=n.lastIndex}}function cl(e){let t=e.toLowerCase().trim();return zi.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":ll.has(e)?"ARITHMETIC":e===","?"COMMA":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var jt=class{constructor(t){Wt(this,"tokens");Wt(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.parseSum(),n=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...n)){let r=this.previous().value,i=this.parseSum();return{type:"BinaryOp",operator:r.toLowerCase(),left:t,right:i}}return t}parseSum(){let t=this.parseProduct();for(;this.match("ARITHMETIC","+","-");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseProduct()};return t}parseProduct(){let t=this.parseUnary();for(;this.match("ARITHMETIC","*","/","%");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseUnary()};return t}parseUnary(){return this.match("ARITHMETIC","-")?{type:"UnaryOp",operator:"-",operand:this.parseUnary()}:this.parseValue()}parseTuple(t){let n=[t];for(;this.match("COMMA")&&!(this.peek()?.type==="PAREN"&&this.peek()?.value===")");)n.push(this.parseOr());return this.consume("PAREN",")",'Expected "," or ")" in a tuple'),{type:"Literal",value:n.map(fl)}}parseCall(t){let n=ar.get(t);if(!n)throw new Error(`no function "${t}": the functions are ${[...ar.keys()].join(", ")}`);this.advance();let r=[];if(!this.match("PAREN",")")){do r.push(this.parseOr());while(this.match("COMMA"));this.consume("PAREN",")",`Expected "," or ")" after a value of ${t}(\u2026)`)}let[i,o]=n.takes;if(r.length<i||r.length>o)throw new Error(fa(t,n.takes));let a=n.check?.(r);if(a)throw new Error(a);return{type:"Call",name:t,args:r}}parseValue(){if(this.match("PAREN","(")){if(this.match("PAREN",")"))return{type:"Literal",value:[]};let t=this.parseOr();return this.check("COMMA")?this.parseTuple(t):(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:zi.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:ul(t.value)}}if(this.check("IDENTIFIER")){let t=this.advance(),n=this.peek();return n?.type==="PAREN"&&n.value==="("?this.parseCall(t.value):{type:"Identifier",name:t.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(i=>i.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(i=>i.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 i=this.peek();if(i&&i.value===n)return this.advance()}throw new Error(r)}};function fl(e){if(e.type==="Literal")return e.value;if(e.type==="UnaryOp"&&e.operator==="-"&&e.operand.type==="Literal"&&typeof e.operand.value=="number")return-e.operand.value;throw new Error("a tuple holds values such as 'draft' or 3, not expressions")}function ul(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let n=[],r="",i=!1,o="";for(let a=0;a<t.length;a++){let s=t[a];(s==="'"||s==='"')&&(a===0||t[a-1]!=="\\")&&(i?s===o&&(i=!1,o=""):(i=!0,o=s)),s===","&&!i?(n.push(ua(r.trim())),r=""):r+=s}return r.trim()&&n.push(ua(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function ua(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 Ct(e,t,n={}){switch(e.type){case"BinaryOp":return pl(e,t,n);case"UnaryOp":return ml(e,t,n);case"Call":return gl(e,t,n);case"Literal":return e.value;case"Identifier":return bl(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function pl(e,t,n){let r=e.operator.toLowerCase();if(r==="and"||r==="or"){let s=Pr(Ct(e.left,t,n));return Nt(s)===(r==="or")?s:Pr(Ct(e.right,t,n))}let i=Pr(Ct(e.left,t,n)),o=Pr(Ct(e.right,t,n)),a=i!==null&&o!==null;switch(r){case"==":return i===o;case"!=":case"<>":return i!==o;case"<":return a&&i<o;case">":return a&&i>o;case"<=":return a&&i<=o;case">=":return a&&i>=o;case"in":return Array.isArray(o)&&o.includes(i);case"not in":return Array.isArray(o)&&!o.includes(i);case"+":case"-":case"*":case"/":case"%":return ia(r,i,o);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function ml(e,t,n){let r=Ct(e.operand,t,n);switch(e.operator.toLowerCase()){case"not":return!Nt(r);case"-":return oa(r);default:throw new Error(`Unknown unary operator: ${e.operator}`)}}function gl(e,t,n){let r=ar.get(e.name);if(!r)throw new Error(`Unknown function: ${e.name}`);return r.call({args:e.args,value:i=>Ct(i,t,n),env:n,holds:(i,o)=>Nt(Ct(hl(i),o,n))})}var pa=new Map;function hl(e){let t=pa.get(e);return t||pa.set(e,t=new jt(Qt(e)).parse()),t}function Pr(e){return e===void 0?null:e}function bl(e,t){let n=t.split("."),r=e;for(let i of n){if(r==null)return;r=r[i]}return r}function pn(e,t){switch(t(e),e.type){case"BinaryOp":pn(e.left,t),pn(e.right,t);return;case"UnaryOp":pn(e.operand,t);return;case"Call":for(let n of e.args)pn(n,t);return;default:return}}function Vr(e){let t=[];return pn(e,n=>{if(n.type!=="Identifier")return;let r=n.name.split(".")[0];t.includes(r)||t.push(r)}),t}function Ir(e){let t=[];return pn(e,n=>{n.type==="Identifier"&&!t.includes(n.name)&&t.push(n.name)}),t}function Dr(e){let t=[];return pn(e,n=>{if(n.type!=="Call"||n.name!=="count"&&n.name!=="sum")return;let[r,i]=n.name==="count"?[n.args[0],n.args[1]]:[n.args[0],n.args[2]];r.type==="Identifier"&&i?.type==="Literal"&&typeof i.value=="string"&&t.push({lines:r.name,condition:i.value})}),t}function ma(e){let t=[];return pn(e,n=>{if(n.type!=="Call"||n.name!=="sum")return;let[r,i]=n.args;r.type==="Identifier"&&i?.type==="Literal"&&t.push({lines:r.name,field:i.value})}),t}function rt(e){if(typeof e!="string"){let n=e===!0;return{source:e,fields:[],paths:[],wheres:[],evaluate:()=>n}}let t=new jt(Qt(e)).parse();return{source:e,fields:Vr(t),paths:Ir(t),wheres:Dr(t),evaluate(n,r){try{return Nt(Ct(t,n,r))}catch{return!1}}}}function Ht(e){let t=new jt(Qt(e)).parse();return{source:e,fields:Vr(t),paths:Ir(t),wheres:Dr(t),sums:ma(t),evaluate(n,r={}){try{return Ct(t,n,r)??null}catch{return null}}}}function Wr(e){let t=[],n=[],r=new Set,i=[],o=a=>{if(r.has(a))return;let s=i.indexOf(a);if(s!==-1){n.push([...i.slice(s),a]);return}i.push(a);for(let d of e.get(a)??[])e.has(d)&&o(d);i.pop(),r.add(a),t.push(a)};for(let a of e.keys())o(a);return{order:t,cycles:n}}var qi=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function jr(e){return[...e.matchAll(qi)].map(t=>t[1])}function ga(e,t){return e.replace(qi,(n,r)=>t(r))}function Wn(e){let t=[],n=0;for(let r of e.matchAll(qi))r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:"",field:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({text:e.slice(n)}),t}var ha=/^(shift\+)?[a-z0-9]$/,Hr=["d","e","f"],jn=e=>`Alt+${e.startsWith("shift+")?"Shift+":""}${e.slice(-1).toUpperCase()}`;var yt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ba=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),_i="text, numbers, yes or no, dates, choices and json can",yl=e=>{let t=e.map(n=>`"${n}"`);return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`},Br=class e{constructor(t,n){Wt(this,"page",t);Wt(this,"line",n);Wt(this,"issues",[]);Wt(this,"ids",new Map);Wt(this,"formNames",new Map);Wt(this,"places",new Set);Wt(this,"goingTo",[])}run(){return this.checkFields(this.page.fields,"fields",this.line?.name,this.line?.parent),this.walkRoot(this.page.layout,"layout"),this.page.on&&this.checkEvents(this.page.on,"on"),this.checkGoingTo(),this.issues}checkGoingTo(){for(let{target:t,path:n}of this.goingTo)this.places.has(t)||this.report(n,`no tab or wizard step "${t}" on this page`)}here(){return this.line?{fields:this.page.fields,lines:this.line.name,parent:this.line.parent}:{fields:this.page.fields}}checkLineForm(t,n,r){let i=t.lineForm?.children;if(!Array.isArray(i))return this.report(`${r}.lineForm`,'a line\u2019s form holds its parts: { "children": [...] }');let o={...this.page,fields:n.fields,layout:{type:"sections",id:`${t.id}#line`,children:i},on:void 0},a=new e(o,{name:t.field,parent:this.page.fields});a.walkChildren(i,`${r}.lineForm`),a.checkGoingTo(),this.issues.push(...a.issues)}checkEvents(t,n){for(let r of["open","beforeSave","afterSave"]){let i=t[r];i&&this.checkSteps(i,`${n}.${r}`)}for(let[r,i]of Object.entries(t.change??{}))this.formNames.has(r)||this.need(r,`${n}.change.${r}`),this.checkSteps(i,`${n}.change.${r}`);for(let[r,i]of Object.entries(t.show??{}))this.goingTo.push({target:r,path:`${n}.show.${r}`}),this.checkSteps(i,`${n}.show.${r}`)}checkPress(t,n){!t.steps&&t.action===void 0&&this.report(n,"a button needs steps, an action, or both");let r="hotkey"in t?t.hotkey:void 0;typeof r=="string"&&Hr.includes(r.replace("shift+",""))&&this.report(`${n}.hotkey`,`${jn(r)} is the browser\u2019s own: pick another key`),t.steps&&this.checkSteps(t.steps,`${n}.steps`)}checkSteps(t,n){let r=this.here();t.forEach((i,o)=>{let a=`${n}[${o}]`;switch(this.checkModifiers(i,a,["when"]),i.do){case"set":{let s=this.need(i.field,`${a}.field`);s&&!ba.has(s.type)&&this.report(`${a}.field`,`a ${s.type} cannot be set from an expression; ${_i}`),this.checkExpression(i.value,`${a}.value`,r);return}case"clear":this.need(i.field,`${a}.field`);return;case"addLine":{let s=this.need(i.field,`${a}.field`);if(s&&s.type!=="one2many")return this.report(`${a}.field`,`"${i.field}" is a ${s.type}; a line is added to a one2many`);for(let[d,l]of Object.entries(i.values??{}))s?.type==="one2many"&&!yt(s.fields,d)&&this.report(`${a}.values.${d}`,`"${d}" is not a field of the lines of "${i.field}"`),this.checkExpression(l,`${a}.values.${d}`,r);return}case"check":i.fields?.forEach((s,d)=>this.need(s,`${a}.fields[${d}]`));return;case"goTo":this.goingTo.push({target:i.target,path:`${a}.target`});return;case"open":i.page===this.page.id&&i.as==="page"&&this.report(`${a}.page`,"a page cannot open itself in its own place"),i.side!==void 0&&i.as!=="panel"&&this.report(`${a}.side`,`a side is where a panel comes from; this opens ${i.as==="page"?"in its place":"in a dialog"}`),i.record!==void 0&&this.checkExpression(i.record,`${a}.record`,r);for(let[s,d]of Object.entries(i.values??{}))this.checkExpression(d,`${a}.values.${s}`,r);i.filter?.forEach((s,d)=>this.checkFilterItem(s,`${a}.filter[${d}]`,r));for(let[s,d]of Object.entries(i.into??{})){this.need(s,`${a}.into.${s}`);try{Ht(d)}catch(l){this.report(`${a}.into.${s}`,`cannot read "${d}": ${l.message}`)}}i.then&&this.checkSteps(i.then,`${a}.then`);return;case"openUrl":this.checkExpression(i.url,`${a}.url`,r);return;default:return}})}checkValuesIn(t,n){for(let r of jr(t))this.need(r,n)}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(yt(r,t))return r[t];this.report(n,`no field "${t}"`)}checkFilterItem(t,n,r){if("any"in t)return t.any.forEach((i,o)=>this.checkFilterItem(i,`${n}.any[${o}]`,r));if("all"in t)return t.all.forEach((i,o)=>this.checkFilterItem(i,`${n}.all[${o}]`,r));t.valueFrom!==void 0&&this.checkValueFrom(t.valueFrom,`${n}.valueFrom`,r)}checkValueFrom(t,n,r){let[i,o]=t.split(".");if(o===void 0){if(yt(r.fields,t)||t==="id"&&r.lines===void 0)return;this.need(t,n,r.fields)}else i==="user"?Bi.includes(o)||this.report(n,`"${t}": the person has an id, name or roles`):i==="context"||(r.lines===void 0?this.report(n,`"${t}": only a line's filter reads parent, the record it is on`):!yt(r.parent??this.page.fields,o)&&o!=="id"&&this.report(n,`"${t}": "${o}" is not a field of this page`))}checkModifiers(t,n,r=["invisible"],i=this.here()){for(let o of r){let a=t[o];if(typeof a!="string")continue;let s;try{s=rt(a)}catch(d){this.report(`${n}.${o}`,`cannot read "${a}": ${d.message}`);continue}this.checkReads(a,s,`${n}.${o}`,i)}}checkReads(t,n,r,i){for(let o of n.wheres){let a=i.fields[o.lines];if(a?.type!=="one2many")continue;let s;try{s=rt(o.condition).fields}catch(d){this.report(r,`cannot read the condition "${o.condition}": ${d.message}`);continue}for(let d of s)yt(a.fields,d)||this.report(r,`"${o.condition}" reads "${d}", which is not a field of the lines of "${o.lines}"`)}for(let o of n.fields){if(yt(i.fields,o))continue;if(i.lines===void 0?Hi.includes(o):o==="user"||o==="parent"||o==="id"||o==="context"){for(let d of n.paths){let[l,f]=d.split(".");l!==o||f===void 0||(o==="user"&&!Bi.includes(f)&&this.report(r,`"${t}" reads "${d}": the person has an id, name or roles`),o==="parent"&&!yt(i.parent??this.page.fields,f)&&!Hi.includes(f)&&this.report(r,`"${t}" reads "${d}": "${f}" is not a field of this page`))}continue}let s=i.lines===void 0?"of this page":`of the lines of "${i.lines}"`;this.report(r,`"${t}" reads "${o}", which is not a field ${s}`)}}checkExpression(t,n,r){let i;try{i=Ht(t)}catch(o){return this.report(n,`cannot read "${t}": ${o.message}`),null}this.checkReads(t,i,n,r);for(let o of i.sums){if(!yt(r.fields,o.lines))continue;let a=r.fields[o.lines];a.type!=="one2many"?this.report(n,`sum adds up the lines of a one2many; "${o.lines}" is a ${a.type}`):yt(a.fields,o.field)||this.report(n,`"${o.field}" is not a field of the lines of "${o.lines}"`)}return i.fields}checkWorkedOut(t,n,r){let i=new Map;for(let[o,a]of Object.entries(t)){let s=`${n}.${o}`;if((a.compute!==void 0||a.setWhen)&&!ba.has(a.type)){a.compute!==void 0&&this.report(`${s}.compute`,`a ${a.type} cannot be worked out; ${_i}`),a.setWhen&&this.report(`${s}.setWhen`,`a ${a.type} cannot be set by a condition; ${_i}`);continue}if(a.compute!==void 0){let d=this.checkExpression(a.compute,`${s}.compute`,r);d&&i.set(o,d)}a.setWhen?.forEach((d,l)=>{this.checkModifiers(d,`${s}.setWhen[${l}]`,["when"],r),d.on?.forEach((f,c)=>this.need(f,`${s}.setWhen[${l}].on[${c}]`,t)),this.checkExpression(d.value,`${s}.setWhen[${l}].value`,r)})}for(let o of Wr(i).cycles){let a=o.slice(0,-1),s=a.length===1?`"${a[0]}" is worked out from itself`:`${yl(a)} are worked out from each other: ${o.join(" \u2192 ")}`;this.report(`${n}.${o[0]}.compute`,s)}}checkFields(t,n,r,i){let o={fields:t,lines:r,...i?{parent:i}:{}};this.checkWorkedOut(t,n,o);for(let[a,s]of Object.entries(t)){let d=`${n}.${a}`;if(s.type==="monetary"&&s.currencyField!==void 0&&this.checkCurrency(s.currencyField,`${d}.currencyField`,t,r,i),s.defaultFrom!==void 0&&this.checkExpression(s.defaultFrom,`${d}.defaultFrom`,o),(s.type==="many2one"||s.type==="many2many")&&s.createValues)for(let[l,f]of Object.entries(s.createValues))this.checkExpression(f,`${d}.createValues.${l}`,o);if(s.type==="one2many"&&s.lineDefaults)for(let[l,f]of Object.entries(s.lineDefaults))yt(s.fields,l)?this.checkExpression(f,`${d}.lineDefaults.${l}`,o):this.report(`${d}.lineDefaults.${l}`,`"${l}" is not a field of the lines of "${a}"`);if((s.type==="many2one"||s.type==="many2many")&&s.filter&&s.filter.forEach((l,f)=>this.checkFilterItem(l,`${d}.filter[${f}]`,o)),s.type==="selection"&&s.optionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.optionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.definitionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitions){let l=new Set;s.definitions.forEach((f,c)=>{f.type==="selection"&&!f.options&&this.report(`${d}.definitions[${c}].options`,"a choice property needs its choices"),l.has(f.name)&&this.report(`${d}.definitions[${c}].name`,`"${f.name}" is named twice`),l.add(f.name)})}if(s.type==="one2many"&&(this.checkFields(s.fields,`${d}.fields`,a,t),"lineKinds"in s&&s.lineKinds&&this.checkLineKinds(a,s.lineKinds,s.fields,`${d}.lineKinds`),s.sequenceField!==void 0)){let l=s.fields[s.sequenceField];l?l.type!=="integer"&&this.report(`${d}.sequenceField`,`"${s.sequenceField}" is a ${l.type}; the field that keeps the order of lines must be an integer`):this.report(`${d}.sequenceField`,`"${s.sequenceField}" is not a field of the lines of "${a}"`)}}}checkCurrency(t,n,r,i,o=this.page.fields){let a;if(!t.startsWith("parent."))a=this.need(t,n,r);else{if(i===void 0)return this.report(n,`"${t}": only a line\u2019s money reads parent, the record it is on`);if(yt(o,t.slice(7)))a=o[t.slice(7)];else return this.report(n,`"${t}": "${t.slice(7)}" is not a field of this page`)}a&&!["many2one","selection","char"].includes(a.type)&&this.report(n,`"${t}" is a ${a.type}; a currency field must be a many2one, selection or char`)}checkLineKinds(t,n,r,i){let o=r[n.field];if(!o)this.report(`${i}.field`,`"${n.field}" is not a field of the lines of "${t}"`);else if(o.type!=="selection"&&o.type!=="char")this.report(`${i}.field`,`"${n.field}" is a ${o.type}; the field that says what a line is must be a selection or char`);else if(o.type==="selection")for(let s of["section","note"]){let d=n[s]??s;o.options.some(l=>l.value===d)||this.report(`${i}.${s}`,`"${n.field}" has no option "${d}"`)}let a=r[n.text];a?a.type!=="char"&&a.type!=="text"&&this.report(`${i}.text`,`"${n.text}" is a ${a.type}; a section's or note's text must be a char or text field`):this.report(`${i}.text`,`"${n.text}" is not a field of the lines of "${t}"`)}walkFooter(t,n){t?.forEach((r,i)=>{this.claim(r.id,`${n}.footer[${i}]`),this.checkModifiers(r,`${n}.footer[${i}]`),this.checkPress(r,`${n}.footer[${i}]`)})}walkRoot(t,n){if(t.type==="tabs")return this.walkNode(t,n);if(this.claim(t.id,n),(t.type==="sheet"||t.type==="sections")&&this.walkFooter(t.footer,n),t.type==="sheet")return this.walkSheet(t,n);if(t.type==="sections")return this.walkChildren(t.children,n);if(t.type==="list")return this.walkList(t,n);t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkList(t,n){this.page.data.kind!=="record"&&this.report("data",'a list shows records: its data needs kind "record" and a model'),t.columns.forEach((o,a)=>this.need(o,`${n}.columns[${a}]`)),t.sort?.forEach((o,a)=>this.need(o.field,`${n}.sort[${a}].field`)),t.searchFields?.forEach((o,a)=>this.need(o,`${n}.searchFields[${a}]`)),t.groupBy?.forEach((o,a)=>this.need(o,`${n}.groupBy[${a}]`));let r=(o,a)=>{if("any"in o)return o.any.forEach((s,d)=>r(s,`${a}.any[${d}]`));if("all"in o)return o.all.forEach((s,d)=>r(s,`${a}.all[${d}]`));this.need(o.field,`${a}.field`),o.valueFrom!==void 0&&this.report(`${a}.valueFrom`,"a list's filter compares with values, not with another field")},i=new Set;t.filters?.forEach((o,a)=>{this.claim(o.id,`${n}.filters[${a}]`),i.add(o.id),o.filter.forEach((s,d)=>r(s,`${n}.filters[${a}].filter[${d}]`))}),t.defaultFilters?.forEach((o,a)=>{i.has(o)||this.report(`${n}.defaultFilters[${a}]`,`no filter "${o}" in this list`)}),t.actions?.forEach((o,a)=>{this.claim(o.id,`${n}.actions[${a}]`),this.checkPress(o,`${n}.actions[${a}]`)}),t.map&&this.walkListMap(t.map,`${n}.map`)}walkListMap(t,n){let r=t.latitude!==void 0||t.longitude!==void 0;if(t.point!==void 0&&r?this.report(n,"a map takes point, or latitude and longitude, not both"):t.point===void 0&&(t.latitude===void 0||t.longitude===void 0)&&this.report(n,"a map needs where each record is: point, or latitude and longitude"),this.checkPlace(t,n,this.here(),t.pin,t.card),t.regions&&this.need(t.regions.field,`${n}.regions.field`),typeof t.heat=="object"&&t.heat.weight!==void 0){let i=this.need(t.heat.weight,`${n}.heat.weight`);i&&i.type!=="float"&&i.type!=="integer"&&i.type!=="monetary"&&this.report(`${n}.heat.weight`,`"${t.heat.weight}" is a ${i.type}; a weight is a number field`)}}checkPlace(t,n,r,i,o){let a=(l,f,c,v)=>{if(l===void 0)return;let m=this.need(l,f,r.fields);m&&!c(m.type)&&this.report(f,`"${l}" is a ${m.type}; ${v}`)},s=l=>l==="float"||l==="integer",d=l=>l==="image"||l==="binary";a(t.point,`${n}.point`,l=>l==="json","a point is kept in a json field"),a(t.latitude,`${n}.latitude`,s,"a latitude is a number field (float or integer)"),a(t.longitude,`${n}.longitude`,s,"a longitude is a number field (float or integer)"),i&&(a(i.image,`${n}.pin.image`,d,"a pin's photo is an image or binary field"),a(i.turn,`${n}.pin.turn`,s,"a turn is a number field, in degrees"),i.iconField!==void 0&&this.need(i.iconField,`${n}.pin.iconField`,r.fields),i.label!==void 0&&this.need(i.label,`${n}.pin.label`,r.fields),i.tones?.forEach((l,f)=>this.checkModifiers(l,`${n}.pin.tones[${f}]`,["when"],r))),o&&(o.title!==void 0&&this.need(o.title,`${n}.card.title`,r.fields),a(o.image,`${n}.card.image`,d,"a card's picture is an image or binary field"),o.fields?.forEach((l,f)=>this.need(l,`${n}.card.fields[${f}]`,r.fields)))}walkMap(t,n){let r=new Map;t.layers.forEach((i,o)=>{let a=`${n}.layers[${o}]`;r.has(i.id)&&this.report(`${a}.id`,`two layers are called "${i.id}"`);let s=i.latitude!==void 0||i.longitude!==void 0,d=i.point!==void 0||s;if([d,!!i.route,!!i.myLocation,!!i.regions,!!i.reachable].filter(Boolean).length!==1&&this.report(a,"a layer is one of: a place (point, or latitude and longitude, for the record or for each of its lines), a route, myLocation, regions, or reachable"),i.regions?.choose!==void 0&&this.need(i.regions.choose,`${a}.regions.choose`),i.point!==void 0&&s?this.report(a,"a layer takes point, or latitude and longitude, not both"):i.point===void 0&&s&&(i.latitude===void 0||i.longitude===void 0)&&this.report(a,"a layer needs both latitude and longitude"),i.lines!==void 0&&!d&&this.report(`${a}.lines`,"a layer of lines needs where each line is: point, or latitude and longitude, of the line's fields"),i.live&&(!d||i.lines!==void 0)&&this.report(`${a}.live`,"live is for a layer of the record's own place: it moves as its fields change"),this.checkModifiers(i,a,["invisible"]),r.set(i.id,{lines:i.lines!==void 0,place:d||!!i.myLocation}),!d)return;if(i.lines===void 0)return this.checkPlace(i,a,this.here(),i.pin,i.card);let f=this.need(i.lines,`${a}.lines`);if(f){if(f.type!=="one2many")return this.report(`${a}.lines`,`"${i.lines}" is a ${f.type}; a layer of lines is a one2many field`);this.checkPlace(i,a,{fields:f.fields,lines:i.lines,parent:this.page.fields},i.pin,i.card)}}),t.layers.forEach((i,o)=>{let a=i.route;if(!a)return;let s=`${n}.layers[${o}].route`,d=(c,v)=>{if(c===void 0)return;let m=r.get(c);m?(!m.place||m.lines)&&this.report(`${s}.${v}`,`a route's ${v} is a layer of one place, or the reader's own; "${c}" is not`):this.report(`${s}.${v}`,`no layer "${c}" on this map`)};if(d(a.from,"from"),d(a.to,"to"),a.through!==void 0){let c=r.get(a.through);c?c.lines||this.report(`${s}.through`,`a route goes through a layer of lines; "${a.through}" is not one`):this.report(`${s}.through`,`no layer "${a.through}" on this map`)}a.to===void 0&&a.through===void 0&&this.report(s,"a route needs where it goes: to, or through");let l=(c,v,m,S)=>{if(c===void 0)return;let g=this.need(c,`${s}.write.${v}`);g&&!m(g.type)&&this.report(`${s}.write.${v}`,`"${c}" is a ${g.type}; ${S}`)},f=c=>c==="float"||c==="integer";l(a.write?.seconds,"seconds",f,"seconds are a number field"),l(a.write?.metres,"metres",f,"metres are a number field"),l(a.write?.line,"line",c=>c==="json","a line is kept in a json field")}),t.layers.forEach((i,o)=>{if(!i.reachable)return;let a=r.get(i.reachable.from),s=`${n}.layers[${o}].reachable.from`;a?(!a.place||a.lines)&&this.report(s,`a reachable area is worked out from a layer of one place, or the reader's own; "${i.reachable.from}" is not`):this.report(s,`no layer "${i.reachable.from}" on this map`)}),t.fences?.forEach((i,o)=>{let a=`${n}.fences[${o}]`,s=t.layers.find(d=>d.id===i.layer);if(s?!s.live&&!s.myLocation&&this.report(`${a}.layer`,`a fence watches a place that moves: a live layer, or the reader's own; "${i.layer}" is not`):this.report(`${a}.layer`,`no layer "${i.layer}" on this map`),i.area!==void 0){let d=this.need(i.area,`${a}.area`);d&&d.type!=="json"&&this.report(`${a}.area`,`"${i.area}" is a ${d.type}; an area is kept in a json field`)}i.within!==void 0&&!t.layers.some(d=>d.id===i.within&&d.reachable)&&this.report(`${a}.within`,`a fence is within a reachable area of this map; "${i.within}" is not one`),this.checkSteps(i.steps,`${a}.steps`)})}walkChildren(t,n){t.forEach((r,i)=>this.walkNode(r,`${n}.children[${i}]`))}walkNode(t,n){switch(this.claim(t.id,n),this.checkModifiers(t,n,t.type==="field"?["invisible","readonly","required"]:t.type==="section"||t.type==="form"?["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"),t.style==="inline"&&t.columns!==void 0&&this.report(`${n}.columns`,"parts on one line take no columns: each is as wide as it needs"),t.style==="inline"&&t.collapsible&&this.report(`${n}.collapsible`,"a line of parts does not fold: its title is its label"),t.style==="inline"&&t.children.forEach((r,i)=>{["field","text","button","spacer"].includes(r.type)||this.report(`${n}.children[${i}]`,`a line of parts holds fields, words and buttons; a ${r.type} needs a row of its own`)}),this.walkChildren(t.children,n);case"tabs":return this.walkTabs(t,n);case"form":return this.checkFormNode(t,n);case"button":return this.checkPress(t,n);case"text":return this.checkValuesIn(t.text,`${n}.text`);case"map":return this.walkMap(t,n);default:return}}checkFormNode(t,n){if(typeof t.page!="string"||typeof t.name!="string")return this.report(n,"a saved form placed here needs the page\u2019s id and a name for its answers");t.page===this.page.id&&this.report(`${n}.page`,"a page cannot be placed inside itself");let r=this.formNames.get(t.name);yt(this.page.fields,t.name)?this.report(`${n}.name`,`"${t.name}" is a field of this page: the saved form\u2019s answers need a name of their own`):r!==void 0?this.report(`${n}.name`,`the answers of the saved form at ${r} go under "${t.name}" already: give each copy a name of its own`):this.formNames.set(t.name,n)}walkTabs(t,n){t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}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.title.placeholderWhen?.forEach((o,a)=>this.checkModifiers(o,`${n}.title.placeholderWhen[${a}]`,["when"]))),t.statusbar){let{field:o,visibleStates:a,durationsField:s,fold:d,saves:l,clickable:f}=t.statusbar,c=`${n}.statusbar`;if(this.checkModifiers(t.statusbar,c),s!==void 0){let m=this.need(s,`${c}.durationsField`);m&&m.type!=="json"&&this.report(`${c}.durationsField`,`"${s}" is a ${m.type}; time per step comes from a json field`)}l&&!f&&this.report(`${c}.saves`,"a click saves only where a step can be clicked (clickable)");let v=this.need(o,`${n}.statusbar.field`);if(d&&v&&v.type!=="many2one"&&this.report(`${c}.fold`,"steps fold by their record (a stage), so only a link\u2019s steps fold; a choice keeps the steps it shows with visibleStates"),v&&v.type!=="selection"&&v.type!=="many2one"&&this.report(`${n}.statusbar.field`,`"${o}" is a ${v.type}; a statusbar needs a selection or many2one`),v?.type==="selection"&&a){let m=new Set(v.options.map(S=>S.value));a.forEach((S,g)=>{m.has(S)||this.report(`${n}.statusbar.visibleStates[${g}]`,`"${S}" is not an option of "${o}"`)})}}t.buttons?.forEach((o,a)=>{this.claim(o.id,`${n}.buttons[${a}]`),this.checkModifiers(o,`${n}.buttons[${a}]`),this.checkPress(o,`${n}.buttons[${a}]`)}),t.statButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.statButtons[${a}]`),this.checkModifiers(o,`${n}.statButtons[${a}]`),this.checkPress(o,`${n}.statButtons[${a}]`);for(let s of["field","unitField","labelField","secondField"]){let d=o[s];d!==void 0&&this.need(d,`${n}.statButtons[${a}].${s}`)}o.secondLabel!==void 0&&o.secondField===void 0&&this.report(`${n}.statButtons[${a}].secondLabel`,"words for a second value need its field (secondField)")});let r=[...t.ribbon?[[t.ribbon,`${n}.ribbon`]]:[],...(t.ribbons??[]).map((o,a)=>[o,`${n}.ribbons[${a}]`])];for(let[o,a]of r)this.claim(o.id,a),this.checkModifiers(o,a),o.labelField!==void 0&&this.need(o.labelField,`${a}.labelField`);t.badges?.forEach((o,a)=>{this.claim(o.id,`${n}.badges[${a}]`),this.checkModifiers(o,`${n}.badges[${a}]`)});for(let o of["above","before","after","below"])t.title?.[o]?.forEach((a,s)=>this.walkNode(a,`${n}.title.${o}[${s}]`));t.alerts?.forEach((o,a)=>{let s=`${n}.alerts[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),this.checkValuesIn(o.message,`${s}.message`),o.messageField!==void 0&&this.need(o.messageField,`${s}.messageField`),o.buttons?.forEach((d,l)=>{this.claim(d.id,`${s}.buttons[${l}]`),this.checkModifiers(d,`${s}.buttons[${l}]`),this.checkPress(d,`${s}.buttons[${l}]`)})}),t.toolbar?.menu?.forEach((o,a)=>{let s=`${n}.toolbar.menu[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),!o.steps&&o.action===void 0&&!o.builtin&&this.report(s,"a menu item needs steps, an action, or a built-in"),o.label===void 0&&!o.builtin&&this.report(`${s}.label`,"a menu item needs words, unless it is a built-in"),o.steps&&this.checkSteps(o.steps,`${s}.steps`)});let i=t.attachmentPreview;if(i){this.checkModifiers(i,`${n}.attachmentPreview`);let o=i.field!==void 0?this.need(i.field,`${n}.attachmentPreview.field`):void 0;o&&o.type!=="binary"&&o.type!=="image"&&this.report(`${n}.attachmentPreview.field`,`"${i.field}" is a ${o.type}; the preview shows a file (binary or image)`)}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`);t.validate?.forEach((i,o)=>{let a=`${n}.validate[${o}]`;if(this.checkModifiers(i,a,["when","holds"]),i.distinct!==void 0&&r&&(r.type!=="one2many"?this.report(`${a}.distinct`,`distinct is for a table of lines; "${t.field}" is a ${r.type}`):yt(r.fields,i.distinct)||this.report(`${a}.distinct`,`"${i.distinct}" is not a field of the lines of "${t.field}"`)),i.pattern!==void 0)try{new RegExp(i.pattern)}catch{this.report(`${a}.pattern`,`"${i.pattern}" is not a regular expression`)}}),t.tones?.forEach((i,o)=>this.checkModifiers(i,`${n}.tones[${o}]`,["when"])),t.placeholderWhen?.forEach((i,o)=>this.checkModifiers(i,`${n}.placeholderWhen[${o}]`,["when"])),this.checkModifiers(t,n,["bold"]),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((i,o)=>{let a=yt(r.fields,i)?r.fields[i]:void 0;a?["integer","float","monetary"].includes(a.type)||this.report(`${n}.totals[${o}]`,`"${i}" is a ${a.type}; only integer, float and monetary columns add up`):this.report(`${n}.totals[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}));for(let[i,o]of Object.entries(t.options??{}))i.endsWith("Field")&&typeof o=="string"&&this.need(o,`${n}.options.${i}`);r&&t.order&&(r.type!=="one2many"?this.report(`${n}.order`,`order only applies to one2many fields; "${t.field}" is a ${r.type}`):t.order.forEach((i,o)=>!yt(r.fields,i.field)&&this.report(`${n}.order[${o}].field`,`"${i.field}" is not a field of the lines of "${t.field}"`))),r&&t.lineForm&&(r.type!=="one2many"?this.report(`${n}.lineForm`,`lineForm only applies to one2many fields; "${t.field}" is a ${r.type}`):this.checkLineForm(t,r,n));for(let i of["lineOpens","cards","fit"])r&&t[i]&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only applies to one2many fields; "${t.field}" is a ${r.type}`);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.lineDelete!==void 0&&r.type!=="one2many"&&this.report(`${n}.lineDelete`,`lineDelete only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons||t.lineDelete!==void 0))if(r.type!=="one2many")(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons)&&this.report(n,`cells, rowTones, rowBold and rowButtons only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i={fields:r.fields,lines:t.field};for(let[o,a]of Object.entries(t.cells??{})){if(!yt(r.fields,o)){this.report(`${n}.cells.${o}`,`"${o}" is not a field of the lines of "${t.field}"`);continue}this.checkModifiers(a,`${n}.cells.${o}`,["invisible","readonly","required","bold"],i),this.checkModifiers(a,`${n}.cells.${o}`,["hidden"]),a.tones?.forEach((s,d)=>this.checkModifiers(s,`${n}.cells.${o}.tones[${d}]`,["when"],i));for(let[s,d]of Object.entries(a.options??{}))s.endsWith("Field")&&typeof d=="string"&&this.need(d,`${n}.cells.${o}.options.${s}`,r.fields)}t.rowTones?.forEach((o,a)=>this.checkModifiers(o,`${n}.rowTones[${a}]`,["when"],i)),this.checkModifiers(t,n,["rowBold","lineDelete"],i),t.rowButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.rowButtons[${a}]`),this.checkModifiers(o,`${n}.rowButtons[${a}]`,["invisible"],i),this.checkPress(o,`${n}.rowButtons[${a}]`)})}for(let i of["selectedButtons","controlButtons"])t[i]&&(r&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only apply to one2many fields; "${t.field}" is a ${r.type}`),t[i].forEach((o,a)=>{this.claim(o.id,`${n}.${i}[${a}]`),this.checkModifiers(o,`${n}.${i}[${a}]`),this.checkPress(o,`${n}.${i}[${a}]`)}));if(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 i=t.columns??Object.keys(r.fields).filter(o=>o!==("lineKinds"in r?r.lineKinds?.field:void 0)&&o!==r.sequenceField);for(let o of Object.keys(t.optionalColumns))i.includes(o)||this.report(`${n}.optionalColumns.${o}`,`"${o}" is not a column of "${t.field}"`)}!r||!t.columns||(r.type==="one2many"?t.columns.forEach((i,o)=>{yt(r.fields,i)?r.fields[i].type==="one2many"&&this.report(`${n}.columns[${o}]`,`"${i}" holds lines of its own: they are edited in the line's form (lineForm), not drawn in its row`):this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}):r.type==="many2many"?t.columns.forEach((i,o)=>{(!r.fields||!yt(r.fields,i))&&this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the records of "${t.field}"`)}):this.report(`${n}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${r.type}`))}};var Hn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),vl=["sheet","sections","tabs","wizard"];function sr(e,t={}){if(!Hn(e))return{ok:!1,issues:[{path:"(page)",message:"a page is a JSON object"}]};let n=[],r=(l,f)=>n.push({path:l,message:f});e.fieldia!=="0.1"&&r("fieldia",`this build reads format ${"0.1"}`),(typeof e.id!="string"||!e.id)&&r("id","a page needs an id");let i=e.data;(!Hn(i)||!(i.kind==="responses"||i.kind==="record"&&typeof i.model=="string"&&i.model))&&r("data",'data is { "kind": "record", "model": \u2026 } or { "kind": "responses" }');let o=e.fields;if(!Hn(o))r("fields","fields is an object of field definitions, by name");else for(let[l,f]of Object.entries(o))(!Hn(f)||!Cr.includes(f.type)||typeof f.label!="string")&&r(`fields.${l}`,"a field needs a type Fieldia knows and a label");let a=e.layout,s=Hn(a)&&a.type==="list";if((!Hn(a)||(s?!Array.isArray(a.columns):!vl.includes(a.type)||!Array.isArray(a.children)))&&r("layout","the layout is a sheet, sections, tabs or wizard, with children, or a list with columns"),n.length)return{ok:!1,issues:n};let d=e;try{let l=new Br(d,t.parent?{name:d.id,parent:t.parent}:void 0).run();return l.length?{ok:!1,issues:l}:{ok:!0,page:d}}catch(l){return{ok:!1,issues:[{path:"(page)",message:`a part of this page cannot be read: ${l.message}`}]}}}var xl=new Set(["title","description","label","help","placeholder","message","text","confirm","alt","caption","tooltip","unit"]),wl=new Set(["lineKinds","filter","default","data","translations","optionalColumns","values","into","params","map"]),kl=e=>t=>t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t;function zr(e,t,n,r,i=!1){if(typeof e=="string")return t!==null&&(t.endsWith("Label")||!i&&xl.has(t))?n(e):e;if(Array.isArray(e))return e.map(a=>zr(a,null,n,r,i));if(e===null||typeof e!="object")return e;r?.(e);let o={};for(let[a,s]of Object.entries(e))a==="layers"&&Array.isArray(s)?o[a]=s.map(kl(n)):o[a]=wl.has(a)?s:zr(s,a,n,r,i||a==="options"&&!Array.isArray(s));return o}function Bn(e,t){return zr(e,null,t)}function ya(e){let t=new Set,n=e.fields,r=(i,o=null)=>zr(i,o,a=>(a.trim()&&t.add(a),a),a=>{a.type==="wizard"&&r(a.children);let s=a.type==="field"?n[a.field]:void 0;if(s){for(let[d,l]of[[a,"label"],[s,"label"],[a,"placeholder"],[a,"help"],[s,"help"]])r(d[l],l);r(s)}});return r({title:e.title,description:e.description,layout:e.layout}),r(e),[...t]}function dr(e,t){let n=e.translations?.[t]??e.translations?.[t.split("-")[0]];return n?Bn(e,r=>n[r]??r):e}function qr(e){let[t,...n]=e.toLowerCase().split("-"),r=n.find(i=>i.length===4&&!/\d/.test(i));return r?/^(arab|hebr|syrc|thaa|nkoo|adlm|rohg)$/.test(r):/^(ar|he|iw|fa|ur|ps|sd|yi|dv|ckb|ug|ks|syr|prs|pnb|azb)$/.test(t)}function En(e,t){if(!e?.length)return!0;let n=e.filter(r=>!r.startsWith("!"));return e.some(r=>r.startsWith("!")&&t.includes(r.slice(1)))?!1:!n.length||n.some(r=>t.includes(r))}function va(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=Qt(e);if(n.length===0)return!1;let i=new jt(n).parse(),o=Ct(i,t);return Nt(o)}catch{return!1}}function xa(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Qt(e);return t.length===0||new jt(t).parse(),!0}catch{return!1}}var wa={};var Sl={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}",choiceOrOther:"Must be one of: {options}, or an answer of its own",matrix:"{label} takes an answer for each row",matrixRow:"Rows are: {rows}",matrixRows:"Answer every row of {label}",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",minFiles:"Add at least {min} files to {label}",maxFiles:"Too many files for {label}: at most {max}",minLength:"{label} must be at least {min} characters",endsWith:"{label} must end with {ending}",atLeast:"Choose at least {min} for {label}",atMost:"Choose at most {max} for {label}",datePast:"{label} must be in the past",dateFuture:"{label} must be in the future",holds:"{label} does not agree with the other answers",distinct:"{column}: {value} is on more than one line of {label}",or:"or",tick:"Tick this box to go on",email:"Enter an email address, like name@example.com",url:"Enter a web address, like example.com",phone:"Enter a phone number, like +20 100 123 4567",time:"Enter a time, like 14:30",before:"{label} can\u2019t be before {min}",after:"{label} can\u2019t be after {max}",weekday:"{label} can\u2019t be on a {days}",minLines:"Add at least {min} to {label}",maxLines:"Too many in {label}: at most {max}",addressParts:"Street address|Address line 2|City|State or region|Postcode|Country",archiveConfirm:"Are you sure that you want to archive this record?",deleteConfirm:"Are you sure you want to delete this record?",locale:"en"},Et={en:Sl,...wa};function Je(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n)}function mn(e,t=un(new Date)){let n=/^today([+-]\d+)?$/.exec(e);if(!n)return e;let[r,i,o]=t.split("-").map(Number);return new Date(Date.UTC(r,i-1,o+Number(n[1]??0))).toISOString().slice(0,10)}var ka=(e,t,n)=>new Intl.DateTimeFormat(t.locale,{...e,timeZone:"UTC",numberingSystem:"latn"}).format(n);function Ui(e,t,n,r){if(e.type!=="date"&&e.type!=="datetime")return;let i=e.type==="date"?t:un(new Date(t)),o=(f,c)=>Je(r[f],{label:e.label,min:c,max:c,days:c}),a=f=>ka({day:"numeric",month:"long",year:"numeric"},r,Date.parse(f)),s=e.min&&mn(e.min,n),d=e.max&&mn(e.max,n);if(s&&i<s)return o("before",a(s));if(d&&i>d)return o("after",a(d));let l=e.days;if(l&&!l.includes(new Date(Date.parse(i)).getUTCDay()||7)){let f=[1,2,3,4,5,6,7].filter(c=>!l.includes(c)).map(c=>ka({weekday:"long"},r,Date.UTC(2024,0,c)));return o("weekday",f.length>1?`${f.slice(0,-1).join(", ")} ${r.or} ${f[f.length-1]}`:f[0])}}function Rn(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":case"binary":case"image":return e.multiple?[]:null;default:return null}}function gn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=i.default;n[r]=o===void 0?Rn(i):i.type==="date"&&typeof o=="string"&&o.startsWith("today")?mn(o,t):Le(o)}return n}function Kt(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:e.type==="matrix"&&typeof t=="object"?Object.values(t).every(n=>n==null||Array.isArray(n)&&!n.length):!1}function hn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=t[r];n[r]=o?Ll(o,i):i}return n}function Ll(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 Array.isArray(t)?t.map(n=>n.name):t.name;default:return t}}function pt(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 _r(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Le(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function bn(e,t,n,r=Et.en,i){let o=e.label||"This field",a=(s,d={})=>Je(r[s],{label:o,...d});if(Kt(e,t))return n?a("required"):void 0;if(e.type==="matrix")return El(e,t,n,a);switch(e.type){case"char":case"text":case"html":return typeof t!="string"?a("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?a("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?a("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?a("number"):e.type==="integer"&&!Number.isInteger(t)?a("integer"):e.min!==void 0&&t<e.min?a("min",{min:e.min}):e.max!==void 0&&t>e.max?a("max",{max:e.max}):e.type!=="integer"&&e.digits&&Rl(t)>e.digits[1]?a("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:a("boolean");case"date":return Fl(t,a)??Ui(e,t,i,r);case"datetime":return $l(t,a)??Ui(e,t,i,r);case"selection":{if(e.optionsFrom)return;let s=new Set(e.options.map(f=>f.value)),d=a(e.other?"choiceOrOther":"choice",{options:e.options.map(f=>f.label).join(", ")}),l=f=>(e.other===!0||e.ownAnswers===!0)&&typeof f=="string"&&f.trim()!==""&&!s.has(f);return e.multiple?Array.isArray(t)?(t.filter(c=>!s.has(c)).length<=1||e.ownAnswers)&&t.every(c=>s.has(c)||l(c))?void 0:d:a("choices"):s.has(t)||l(t)?void 0:d}case"many2one":return Ki(t)?void 0:a("record");case"many2many":return Array.isArray(t)&&t.every(Ki)?void 0:a("records");case"reference":{let s=t;if(!Ki(t)||typeof s.model!="string")return a("record");if(!e.models.some(d=>d.value===s.model)){let d=La(e.models.map(l=>l.label),r.or);return a("reference",{models:d,aModels:Ea(d)})}return}case"binary":case"image":return Tl(e,t,a,r);default:return}}function El(e,t,n,r){if(t===null||typeof t!="object"||Array.isArray(t))return r("matrix");let i=new Set(e.rows.map(d=>String(d.value))),o=new Set(e.columns.map(d=>d.value)),a=r("choice",{options:e.columns.map(d=>d.label).join(", ")});for(let[d,l]of Object.entries(t)){if(!i.has(d))return r("matrixRow",{rows:e.rows.map(c=>c.label).join(", ")});let f=e.multiple&&Array.isArray(l)?l:[l];if(!e.multiple&&Array.isArray(l)||f.some(c=>c!=null&&!o.has(c)))return a}let s=d=>{let l=t[d];return l!=null&&!(Array.isArray(l)&&!l.length)};if(n&&e.rows.some(d=>!s(String(d.value))))return r("matrixRows")}function Rl(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 Ki(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function Fl(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[n,r,i]=e.split("-").map(Number);return Sa(n,r,i)?void 0:t("dateInvalid")}var Al=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function $l(e,t){let n=typeof e=="string"?Al.exec(e):null;if(!n)return t("datetimeFormat");let[r,i,o,a,s,d]=n.slice(1).map(l=>Number(l??0));return Sa(r,i,o)&&a<24&&s<60&&d<60?void 0:t("datetimeInvalid")}function Sa(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 Tl(e,t,n,r){let i=e.multiple?Array.isArray(t)?t:[t]:[t];if(e.multiple&&e.minFiles!==void 0&&i.length<e.minFiles)return n("minFiles",{min:e.minFiles});if(e.multiple&&e.maxFiles!==void 0&&i.length>e.maxFiles)return n("maxFiles",{max:e.maxFiles});for(let o of i){if(!Ml(o))return n("file");let a=lr(e,o,r,e.multiple?o.name:e.label||"This field");if(a)return a}}function lr(e,t,n=Et.en,r=t.name){if(e.maxSize!==void 0&&t.size>e.maxSize)return Je(n.fileSize,{label:r,size:en(e.maxSize)});let i=e.type==="image"?["image/*"]:e.accept;if(i&&!Nl(i,t.type)){let o=cr(i,n.or);return Je(n.fileType,{label:r,types:o,aTypes:Ea(o)})}}function Ml(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function Nl(e,t){return e.some(n=>n.endsWith("/*")?t.startsWith(n.slice(0,-1)):n===t)}var Cl="pdf PDF,msword DOC,wordprocessingml DOCX,opendocument.text ODT,plain TXT,ms-excel XLS,spreadsheetml XLSX,opendocument.spreadsheet ODS,csv CSV,ms-powerpoint PPT,presentationml PPTX,opendocument.presentation ODP".split(",").map(e=>e.split(" "));function Ol(e){if(e.endsWith("/*"))return e.slice(0,-2);let t=e.split("/")[1]??e;return Cl.find(([n])=>t.includes(n))?.[1]??t.toUpperCase()}function cr(e,t){return La([...new Set(e.map(Ol))],t)}function La(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function Ea(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function en(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]}`}var Ra=e=>Math.round(e*1e9)/1e9,Fa=(e,t)=>e.find(n=>n.value===t)?.score??0,Aa=e=>e.reduce((t,n)=>Math.max(t,n.score??0),0),$a=e=>e.reduce((t,n)=>t+Math.max(0,n.score??0),0),Ta=(e,t,n)=>n?Array.isArray(t)?t.reduce((r,i)=>r+Fa(e,i),0):0:Fa(e,t);function Ma(e,t){let n=0,r=0,i=!1;for(let[o,a]of Object.entries(e.fields))if(a.type==="selection"&&a.options.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0;n+=Ta(a.options,t[o],s),r+=s?$a(a.options):Aa(a.options)}else if(a.type==="matrix"&&a.columns.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0,d=t[o],l=d&&typeof d=="object"&&!Array.isArray(d)?d:{};for(let f of a.rows)n+=Ta(a.columns,l[String(f.value)],s),r+=s?$a(a.columns):Aa(a.columns)}return i?{score:Ra(n),max:Ra(r)}:null}function Na(e){return Object.assign(new Error(e.message),{problem:e})}function Ur(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 qn(e,t){return t.every(n=>Ji(e,n))}function Ji(e,t){return"any"in t?t.any.some(n=>Ji(e,n)):"all"in t?t.all.every(n=>Ji(e,n)):Vl(e,t)}function tn(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function Pl(e){return Array.isArray(e)?e.map(t=>t!==null&&typeof t=="object"&&"id"in t?t.id:t):[]}function Vl(e,t){let n=e[t.field],r=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"id"in n?n.id:n,i=t.value,o=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"label"in n?String(n.label):String(r??"");switch(t.op){case"=":return r===i;case"=?":return!tn(i)||r===i;case"contains":case"not contains":{let a=Pl(n),d=(Array.isArray(i)?i:[i]).some(l=>a.includes(l));return t.op==="contains"?d:!d}case"!=":return r!==i;case"<":return tn(r)&&r<i;case">":return tn(r)&&r>i;case"<=":return tn(r)&&r<=i;case">=":return tn(r)&&r>=i;case"in":return Array.isArray(i)&&i.includes(r);case"not in":return Array.isArray(i)&&!i.includes(r);case"like":return o.includes(String(i));case"ilike":return o.toLowerCase().includes(String(i).toLowerCase());case"startswith":return o.toLowerCase().startsWith(String(i).toLowerCase());case"endswith":return o.toLowerCase().endsWith(String(i).toLowerCase());case"set":return tn(n);case"notset":return!tn(n);case"between":{if(!tn(r)||!Array.isArray(i))return!1;let[a,s]=i;return r>=a&&r<=s}case"within":return Il(e,n,i)}}var Gi=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Il(e,t,n){if(!Gi(n))return!1;let r=Ca(e,t,n.longitude);if(!r)return!1;let{lat:i,lng:o}=r;if(Array.isArray(n.polygon))return Dl(o,i,n.polygon);if(Array.isArray(n.center)){let[f,c]=n.center;return Oa(i,o,c,f)<=n.radius}let{south:a,west:s,north:d,east:l}=n;return i<a||i>d?!1:s<=l?o>=s&&o<=l:o>=s||o<=l}function Ca(e,t,n){let r,i;if(typeof n=="string")r=t,i=e[n];else{let o=Gi(t)&&t.type==="Feature"?t.geometry:t,a=Gi(o)&&o.type==="Point"?o.coordinates:null;if(!Array.isArray(a))return null;[i,r]=a}return typeof r=="number"&&typeof i=="number"?{lat:r,lng:i}:null}function Yi(e,t,n){let r=Ca(e,e[t],n.longitude);return r?Oa(r.lat,r.lng,n.lat,n.lng):null}function Dl(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let[a,s]=n[i],[d,l]=n[o];s>t!=l>t&&e<(d-a)*(t-s)/(l-s)+a&&(r=!r)}return r}function Oa(e,t,n,r){let i=Math.PI/180,o=Math.sin((n-e)*i/2)**2+Math.cos(e*i)*Math.cos(n*i)*Math.sin((r-t)*i/2)**2;return 2*63710088e-1*Math.asin(Math.min(1,Math.sqrt(o)))}var zn=null;function Kr(e,t){let n=r=>{if("any"in r){let o=r.any.map(n);return o.includes(zn)?zn:{any:o}}if("all"in r){let o=r.all.map(n).filter(a=>a!==zn);return o.length?{all:o}:zn}let i=r.valueFrom!==void 0?Wl(t,r.valueFrom):r.value??null;return r.op==="=?"?tn(i)?{field:r.field,op:"=",value:i}:zn:{field:r.field,op:r.op,value:i}};return e.map(n).filter(r=>r!==zn)}function Wl(e,t){let n=e;for(let r of t.split("."))n=n===null||typeof n!="object"?void 0:n[r];return n??null}var Pa=new Set(["char","text","html"]),Va=new Set(["integer","float","monetary"]),jl=new Set(["many2one","many2many"]);function Jr(e,t,n,r={searchFor:"Search {field} for: {text}"}){let i=e.trim();if(!i)return[];let o=[];for(let s of n.searchFields??n.columns){let d=t.fields[s];if(!d)continue;let l=(f,c,v,m)=>o.push({field:s,fieldLabel:d.label,op:f,value:c,valueLabel:v,label:m??Je(r.searchFor,{field:d.label,text:i})});if(Pa.has(d.type)||jl.has(d.type))l("ilike",i,i);else if(d.type==="selection"){let f=i.toLowerCase();for(let c of d.options)c.label.toLowerCase().includes(f)&&l("=",c.value,c.label,`${d.label}: ${c.label}`)}else if(Va.has(d.type)){let f=Number(i.replace(/[\s,]/g,""));i&&Number.isFinite(f)&&l("=",f,i)}}let a=s=>{let d=t.fields[s.field]?.type??"";return Pa.has(d)?0:d==="selection"?1:Va.has(d)?2:3};return o.map((s,d)=>({s,i:d})).sort((s,d)=>a(s.s)-a(d.s)||s.i-d.i).map(({s})=>s)}function fr(e,t){let n=[];for(let r of e)if(r.kind==="field"){let i=r.values.map(o=>({field:r.field,op:o.op,value:o.value}));n.push(i.length===1?i[0]:{any:i})}else if(r.kind==="filters"){let i=r.ids.map(o=>t.filters?.find(a=>a.id===o)?.filter??[]).filter(o=>o.length);i.length===1?n.push(...i[0]):i.length>1&&n.push({any:i.map(o=>o.length===1?o[0]:{all:o})})}else r.kind==="custom"&&n.push(...r.filter);return n}function Gr(e){return e.find(t=>t.kind==="groupBy")?.fields??[]}var ur={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Yr(e,t=ur){return new Promise(n=>{t.setTimeout(n,e)})}function Da(e={}){let t=Le(e.records??{}),n=[],r=[],i=new Map,o=1e3,a=()=>e.delayMs?Yr(e.delayMs,e.scheduler):Promise.resolve(),s=p=>t[p]??(t[p]={}),d=(p,b)=>{let h=s(p)[String(b)]?.[e.labelField?.[p]??"name"];return typeof h=="string"?h:String(b)},l=(p,b)=>{let h=e.shows?.[p],x=h?s(p)[String(b.id)]:void 0;if(!h||!x)return b;let L={...b};h.avatar&&typeof x[h.avatar]=="string"&&(L.avatar=x[h.avatar]),h.color&&typeof x[h.color]=="number"&&(L.color=x[h.color]),h.folded&&(L.folded=x[h.folded]===!0);let y=(h.details??[]).map(R=>x[R]).map(R=>R&&typeof R=="object"&&"label"in R?R.label:R).filter(R=>typeof R=="string"&&R.trim());return y.length&&(L.details=y.join(`
|
|
3
|
-
`)),L},f=p=>Math.max(0,...Object.keys(s(p)).map(Number).filter(Number.isFinite))+1,c=p=>Number.isFinite(Number(p))?Number(p):p,v=(p,b)=>({id:c(p),...b});function m(p,b){let h=[...p];for(let x of b)x.op==="create"?h.push({key:x.key,id:++o,values:Le(x.values)}):x.op==="update"?h=h.map(L=>L.id===x.id?{...L,values:{...L.values,...Le(x.values)}}:L):h=h.filter(L=>L.id!==x.id);return h}function S(p,b,h){let x=[...p],L=y=>({id:y,label:d(h,y)});for(let y of b)y.op==="link"&&!x.some(R=>R.id===y.id)?x.push(L(y.id)):y.op==="unlink"?x=x.filter(R=>R.id!==y.id):y.op==="set"?x=y.ids.map(L):y.op==="clear"&&(x=[]);return x}function g(p,b){let h=p[b];return h&&"relation"in h?h.relation:b}return{records:t,responses:n,calls:r,async load(p){r.push({method:"load",request:p}),await a();let b=s(p.model)[String(p.id)];if(!b)throw new Error(`No ${p.model} record with id ${p.id}`);let h=Le(b);if(e.shows)for(let[x,L]of Object.entries(p.fields)){let y=h[x];L.type==="many2one"&&y&&typeof y=="object"&&"id"in y?h[x]=l(L.relation,y):L.type==="many2many"&&Array.isArray(y)&&(h[x]=y.map(R=>l(L.relation,R)))}return h},async save(p){r.push({method:"save",request:p}),await a();let b=p.id??f(p.model),h={...s(p.model)[String(b)]??{},...Le(p.changes.values)};for(let[x,L]of Object.entries(p.changes.lines))h[x]=m(h[x]??[],L);for(let[x,L]of Object.entries(p.changes.links))h[x]=S(h[x]??[],L,g(p.fields,x));return s(p.model)[String(b)]=h,{id:b,values:Le(h)}},async onchange(p){r.push({method:"onchange",request:p}),await a();let b=e.onchange?.[p.model]?.[p.changed],h=e.warnings?.[p.model]?.[p.changed],x=b?{values:b(Le(p.values))}:{},L=h?.(Le(p.values));return L?{...x,warning:L}:x},async search(p){r.push({method:"search",request:p}),await a();let b=p.query.trim().toLowerCase();return Object.entries(s(p.model)).filter(([h,x])=>qn(v(h,x),p.filter??[])).map(([h])=>({id:c(h),label:d(p.model,c(h))})).filter(h=>h.label.toLowerCase().includes(b)).slice(0,p.limit??8).map(h=>l(p.model,h))},async list(p){r.push({method:"list",request:p}),await a();let b=Object.entries(s(p.model)).filter(([h,x])=>qn(v(h,x),p.filter)).map(([h,x])=>({id:c(h),values:x}));return b.sort((h,x)=>{for(let L of p.sort){let y=L.near?Ia(Yi(h.values,L.field,L.near),Yi(x.values,L.field,L.near)):Ia(h.values[L.field],x.values[L.field]);if(y.empty)return y.result;if(y.result)return L.desc?-y.result:y.result}return 0}),{total:b.length,records:b.slice(p.offset,p.offset+p.limit).map(({id:h,values:x})=>({id:h,values:Object.fromEntries(p.fields.map(L=>[L,Le(x[L]??null)]))}))}},async groups(p){r.push({method:"groups",request:p}),await a();let b=new Map;for(let[h,x]of Object.entries(s(p.model))){if(!qn(v(h,x),p.filter))continue;let L=x[p.field]??null,y=L!==null&&typeof L=="object"&&!Array.isArray(L)&&"id"in L?L:null,R=y?y.id:L,E=JSON.stringify(R),k=b.get(E)??{value:R,label:y?y.label:L===null||L===""?"":String(L),count:0};k.count++,b.set(E,k)}return[...b.values()].sort((h,x)=>h.value===null==(x.value===null)?h.label.localeCompare(x.label):h.value===null?1:-1)},async create(p){r.push({method:"create",request:p}),await a();let b=s(p.model),h=Object.keys(b).reduce((x,L)=>Math.max(x,Number(L)||0),0)+1;return b[String(h)]={...Le(p.values??{}),name:p.name},{id:h,label:p.name}},async submit(p){return r.push({method:"submit",request:p}),await a(),n.push(Le(p)),{id:n.length}},async archive(p){r.push({method:"archive",request:p}),await a();let b=s(p.model)[String(p.id)];if(!b)throw new Error(`No ${p.model} record with id ${p.id}`);b.active=!p.archive},async copy(p){r.push({method:"copy",request:p}),await a();let b=s(p.model)[String(p.id)];if(!b)throw new Error(`No ${p.model} record with id ${p.id}`);let h=f(p.model),x=Le(b),L=e.labelField?.[p.model]??"name";typeof x[L]=="string"&&(x[L]=`${x[L]}${e.copySuffix??" (copy)"}`);for(let[y,R]of Object.entries(x))Array.isArray(R)&&R.every(E=>E&&typeof E=="object"&&"key"in E&&"values"in E)&&(x[y]=R.map(E=>({...E,id:++o})));return s(p.model)[String(h)]=x,{id:h,values:Le(x)}},async delete(p){if(r.push({method:"delete",request:p}),await a(),!s(p.model)[String(p.id)])throw new Error(`No ${p.model} record with id ${p.id}`);delete s(p.model)[String(p.id)]},async attachments(p){return r.push({method:"attachments",request:p}),await a(),Le(e.attachments?.[`${p.model}:${p.id}`]??[])},async options(p){r.push({method:"options",request:p}),await a();let b=e.lists?.[p.list];if(!b)throw new Error(`No list "${p.list}"`);return Le(typeof b=="function"?await b(p.values):b)},async definitions(p){r.push({method:"definitions",request:p}),await a();let b=e.definitions?.[p.list];if(!b)throw new Error(`No definitions "${p.list}"`);let h=b(p.values),x=i.get(`${p.list}:${JSON.stringify(h)}`)??[];return Le([...h,...x.filter(L=>!h.some(y=>y.name===L.name))])},async saveDefinitions(p){r.push({method:"saveDefinitions",request:p}),await a();let b=e.definitions?.[p.list]?.(p.values)??[];i.set(`${p.list}:${JSON.stringify(b)}`,Le(p.definitions.filter(h=>!b.some(x=>x.name===h.name))))}}}function Ia(e,t){let n=a=>a==null||a==="";if(n(e)||n(t))return{result:n(e)===n(t)?0:n(e)?1:-1,empty:n(e)!==n(t)};let r=a=>typeof a=="object"&&a!==null&&"label"in a?a.label:a,[i,o]=[r(e),r(t)];return typeof i=="number"&&typeof o=="number"?{result:i-o,empty:!1}:{result:String(i).localeCompare(String(o)),empty:!1}}var Xr=["street","line2","city","region","postcode","country"];function Wa(e,t,n,r){let i=t.options??{},o=t.label??e.label;if(e.type==="one2many"&&Array.isArray(n)&&n.length){if(typeof i.min=="number"&&n.length<i.min)return Je(r.minLines,{label:o,min:i.min});if(typeof i.max=="number"&&n.length>i.max)return Je(r.maxLines,{label:o,max:i.max})}let a=i.requiredParts;if(t.widget!=="address"||!Array.isArray(a)||!n||typeof n!="object"||Array.isArray(n))return;let s=Array.isArray(i.parts)?i.parts:Xr,d=n,l=Xr.findIndex(f=>a.includes(f)&&s.includes(f)&&!String(d[f]??"").trim());return l<0?void 0:Je(r.required,{label:r.addressParts.split("|")[l]})}var Hl={email:/^[^@\s]+@[^@\s]+\.[^@\s]+$/,url:/^(https?:\/\/)?([\p{L}\p{N}-]+\.)+\p{L}{2,}(:\d+)?([/?#]\S*)?$/iu,phone:/^\+?[\p{Nd}\s.()-]+$/u,time:/^([01]\d|2[0-3]):[0-5]\d$/};function Xi(e,t,n,r){let i=t.widget??"";if(e.type!=="char")return Wa(e,t,n,r);if(typeof n!="string"||!n.trim())return;let o=n.trim(),a=t.options??{},s=t.label??e.label,d=Hl[i],l=o.match(/\p{Nd}/gu)?.length??0;if(d&&(!d.test(o)||i==="phone"&&(l<7||l>15)))return r[i];if(i==="time"){if(typeof a.min=="string"&&o<a.min)return Je(r.before,{label:s,min:a.min});if(typeof a.max=="string"&&o>a.max)return Je(r.after,{label:s,max:a.max})}if(i==="tags"&&typeof a.max=="number"&&o.split(typeof a.separator=="string"&&a.separator?a.separator:",").filter(c=>c.trim()).length>a.max)return Je(r.atMost,{label:s,max:a.max})}function ja(e,t,n,r=!0,i={},o){let a={id:t??null,user:{id:n?.id??null,name:n?.name??null,roles:[...n?.roles??[]]},editing:r,context:i,...o?{parent:o}:{}};for(let s of Object.keys(a))s in e&&delete a[s];return a}function Bt(e,t,n){return{...ja(t,n.recordId,n.user,n.editing,n.context,n.parent),...hn(e,t)}}function yn(e,t,n,r=null){let i={parent:n,user:n.user??ja({},null,void 0).user,id:r,context:n.context??{}};for(let o of Object.keys(i))o in t&&delete i[o];return{...i,...hn(e,t)}}function Fn(e,t,n){let r=new Map;return{today:n,lines(i){let o=t[i];if(o?.type!=="one2many")return;let a=r.get(i);return a||(a=(e[i]??[]).filter(d=>pt(o,d.values)===null).map(d=>hn(d.values,o.fields)),r.set(i,a)),a}}}function Ha(e){let t=new Map;for(let[r,i]of Object.entries(e))i.compute!==void 0&&t.set(r,Ht(i.compute));let{order:n}=Wr(new Map([...t].map(([r,i])=>[r,i.fields])));return n.map(r=>[r,t.get(r),e[r]])}function An(e,t){if(e.type==="boolean")return Nt(t);if(t==null)return null;switch(e.type){case"integer":return bt(t)?or(t,0):null;case"float":case"monetary":return bt(t)?e.digits?or(t,e.digits[1]):t:null;case"char":case"text":case"html":return typeof t=="string"?t:bt(t)?String(t):null;case"date":case"datetime":return typeof t=="string"?t:null;default:return t}}function Ba(e,t,n=()=>({recordId:null})){let r=Ha(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=Ha(l.fields);f.length&&i.set(d,{def:l,steps:f})}let o={today:t};function a(d,l,f,c,v){let m=d,S=v(d);for(let[g,p,b]of l){let h=An(b,p.evaluate(S,c));_r(h,m[g])||(m={...m,[g]:h},Object.assign(S,hn({[g]:h},f)))}return m}function s(d,l,f){let c=i.get(d);return!c||pt(c.def,l)!==null?l:a(l,c.steps,c.def.fields,o,v=>yn(v,c.def.fields,f))}return{line:(d,l,f)=>s(d,l,Bt(f,e.fields,n())),apply(d){let l=d,f=i.size?Bt(d,e.fields,n()):{};for(let c of i.keys()){let v=l[c];if(!Array.isArray(v))continue;let m=!1,S=v.map(g=>{let p=s(c,g.values,f);return p===g.values?g:(m=!0,{...g,values:p})});m&&(l={...l,[c]:S})}return r.length?a(l,r,e.fields,Fn(l,e.fields,t),c=>Bt(c,e.fields,n())):l}}}function za(e){return Object.entries(e).flatMap(([t,n])=>(n.setWhen??[]).map((r,i)=>({key:`${t}#${i}`,name:t,def:n,when:rt(r.when??!0),value:Ht(r.value),...r.on?{on:r.on}:{}})))}var Bl={has:()=>!0};function qa(e,t,n=()=>({recordId:null})){let r=za(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=za(l.fields);f.length&&i.set(d,{def:l,rules:f})}let o={today:t};function a(d,l,f,c,v,m,S){let g=d;for(let p of l){if(p.on){let h=`${v}${p.key}@${JSON.stringify(p.on.map(x=>d[x]??null))}`;if(S.add(h),m.has(h)||!p.when.evaluate(f,c))continue}else{if(!p.when.evaluate(f,c))continue;let h=v+p.key;if(S.add(h),m.has(h))continue}let b=An(p.def,p.value.evaluate(f,c));_r(b,g[p.name])||(g={...g,[p.name]:b})}return g}function s(d,l){let f=new Set,c=r.length?a(d,r,Bt(d,e.fields,n()),Fn(d,e.fields,t),"",l,f):d,v=i.size?Bt(d,e.fields,n()):{};for(let[m,{def:S,rules:g}]of i){let p=d[m];if(!Array.isArray(p))continue;let b=!1,h=p.map(x=>{if(pt(S,x.values)!==null)return x;let L=a(x.values,g,yn(x.values,S.fields,v,x.id??null),o,`${m}.${x.key}.`,l,f);return L===x.values?x:(b=!0,{...x,values:L})});b&&(c={...c,[m]:h})}return{values:c,holding:f}}return{apply:s,holding:d=>s(d,Bl).holding}}function _a(e){return(e??[]).map(t=>({rule:t,when:rt(t.when??!0),pattern:t.pattern===void 0?null:new RegExp(`^(?:${t.pattern})$`),holds:t.holds===void 0?null:rt(t.holds)}))}function Ua(e,t,n,r,i){let o={};if(!r.length||Kt(e,n))return o;for(let a of r){let s=a.rule.level??"error";if(o[s]!==void 0||!a.when.evaluate(i.context,i.env))continue;let d=zl(a,e,n,i.now)??Ul(a,i);d&&(o[s]=a.rule.message??Je(i.messages[d.say],{label:t,...d.values}))}return o}function zl({rule:e,pattern:t},n,r,i){let o=typeof r=="string"?r:null;if(o!==null&&e.minLength!==void 0&&o.length<e.minLength)return{say:"minLength",values:{min:e.minLength}};if(o!==null&&e.maxLength!==void 0&&o.length>e.maxLength)return{say:"maxLength",values:{max:e.maxLength}};if(t&&(o!==null||bt(r))&&!t.test(String(r)))return{say:"pattern"};if(o!==null&&e.endsWith!==void 0&&!o.trim().toLowerCase().endsWith(e.endsWith.toLowerCase()))return{say:"endsWith",values:{ending:e.endsWith}};if(bt(r)&&e.min!==void 0&&r<e.min)return{say:"min",values:{min:e.min}};if(bt(r)&&e.max!==void 0&&r>e.max)return{say:"max",values:{max:e.max}};let a=Array.isArray(r)?r.length:null;if(a!==null&&e.atLeast!==void 0&&a<e.atLeast)return{say:"atLeast",values:{min:e.atLeast}};if(a!==null&&e.atMost!==void 0&&a>e.atMost)return{say:"atMost",values:{max:e.atMost}};if(e.distinct!==void 0&&n.type==="one2many"&&Array.isArray(r)){let s=ql(n,r,e.distinct);if(s!==null)return{say:"distinct",values:{column:n.fields[e.distinct]?.label??e.distinct,value:s}}}if(o!==null&&e.date!==void 0){let s=Kl(n,o,i);if(e.date==="past"&&s>=0)return{say:"datePast"};if(e.date==="future"&&s<=0)return{say:"dateFuture"}}}function ql(e,t,n){let r=e.fields[n],i=new Set;for(let o of t){if(pt(e,o.values)!==null)continue;let a=o.values[n];if(a==null||a===""||Array.isArray(a)&&!a.length)continue;let s=typeof a=="object"&&!Array.isArray(a)&&"id"in a?a:null,d=JSON.stringify(s?s.id:a);if(!i.has(d)){i.add(d);continue}return s?s.label:r?.type==="selection"?r.options.find(l=>l.value===a)?.label??String(a):String(a)}return null}var _l=e=>e==null||typeof e=="string"&&!e.trim()||Array.isArray(e)&&!e.length;function Ul({holds:e},t){if(!(!e||e.fields.some(n=>_l(t.context[n]))))return e.evaluate(t.context,t.env)?void 0:{say:"holds"}}function Kl(e,t,n){if(e.type==="datetime")return Math.sign(Date.parse(t)-n.getTime());let r=un(n);return t<r?-1:t>r?1:0}var Ka=new Map;function Jl(e){let t=Ka.get(e);return t||Ka.set(e,t=Ht(e)),t}function Zi(e,t){let n=e.trim();if(Dn.test(n)&&n in t.fields)return Le(t.values[n]);if(n==="user"&&!("user"in t.fields))return t.user?.id==null?null:{id:t.user.id,label:t.user.name??String(t.user.id)};let r=/^parent\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(n);return r&&t.parent&&r[1]in t.parent.fields?Le(t.parent.values[r[1]]):Jl(e).evaluate(t.context,t.env)}function Ja(e,t,n){if(e.type!=="many2one"&&e.type!=="many2many")return An(e,t);let r=i=>{if(i==null||i===!1||i==="")return null;if(typeof i=="number"||typeof i=="string")return{id:i,label:n.labelOf?.(e.relation,i)??String(i)};if(typeof i=="object"&&!Array.isArray(i)&&"id"in i){let o=i;return{id:o.id,label:typeof o.label=="string"?o.label:n.labelOf?.(e.relation,o.id)??String(o.id)}}return null};return e.type==="many2one"?r(Array.isArray(t)?t[0]:t):(Array.isArray(t)?t:[t]).map(r).filter(i=>i!==null)}function Ga(e,t,n){let r={};for(let[i,o]of Object.entries(e)){let a=t[i];a&&(r[i]=Ja(a,Zi(o,n),n))}return r}function Qi(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=Zi(i,t)??null;return n}function eo(e,t){let n={};for(let[r,i]of Object.entries(e))i.defaultFrom!==void 0&&(n[r]=Ja(i,Zi(i.defaultFrom,t),t));return n}function Ya(e){let t=to(e.tones),n=rt(e.bold);return(r,i)=>({tone:no(t,r,i),bold:n.evaluate(r,i)})}var to=e=>(e??[]).map(t=>({tone:t.tone,when:rt(t.when)})),no=(e,t,n)=>e.find(r=>r.when.evaluate(t,n))?.tone??null;function Xa(e){let t=new Map;for(let[s,d]of Object.entries(e.cells??{}))t.set(s,{invisible:rt(d.invisible),readonly:rt(d.readonly),required:rt(d.required),hidden:rt(d.hidden),...d.roles?.length?{roles:d.roles}:{},tones:to(d.tones),bold:rt(d.bold)});let n=to(e.rowTones),r=rt(e.rowBold),i=e.lineDelete===void 0?null:rt(e.lineDelete),o=e.rowButtons??[],a=o.map(s=>({id:s.id,roles:s.roles,invisible:rt(s.invisible)}));return{buttons:o,line(s,d,l){let f={tone:no(n,s,d),bold:r.evaluate(s,d),cells:{},buttons:{},deletable:i?.evaluate(s,d)??!0};for(let[c,v]of t)f.cells[c]={invisible:v.invisible.evaluate(s,d),readonly:v.readonly.evaluate(s,d),required:v.required.evaluate(s,d),tone:no(v.tones,s,d),bold:v.bold.evaluate(s,d)};for(let c of a)f.buttons[c.id]=En(c.roles,l)&&!c.invisible.evaluate(s,d);return f},hidden(s,d,l,f){let c=t.get(s);return!!c&&(!En(c.roles,f)||c.hidden.evaluate(d,l))}}}var Zr=Object.freeze({done:!0}),ro=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),io=e=>e instanceof Error?e.message:String(e);function Za(e){let t=new Map,n=new Map,r=y=>{let R=t.get(y);return R||t.set(y,R=Ht(y)),R};function i(y){if(typeof y=="boolean")return y;let R=n.get(y);R||n.set(y,R=rt(y));let{context:E,env:k}=e.reading();return R.evaluate(E,k)}let o=y=>{let R=y.trim();return Dn.test(R)?R:null};function a(y,R){let E=o(y);if(R&&E!==null&&E in e.fields)return Le(e.values()[E]);let{context:k,env:A}=e.reading();return r(y).evaluate(k,A)}function s(y,R){let E=e.values();for(let[k,A]of Object.entries(e.fields)){if(A.type!=="many2one"&&A.type!=="many2many"||A.relation!==y)continue;let w=E[k],C=(Array.isArray(w)?w:w?[w]:[]).find(O=>O&&O.id===R);if(C)return C.label}}function d(y,R,E=()=>{}){let k=A=>{if(A==null||A===!1||A==="")return null;let w=y.relation,j=C=>E(C)??s(w,C)??String(C);if(typeof A=="number"||typeof A=="string")return{id:A,label:j(A)};if(typeof A=="object"&&!Array.isArray(A)&&"id"in A){let C=A;return{id:C.id,label:typeof C.label=="string"?C.label:j(C.id)}}return null};return y.type==="many2one"?k(R):y.type==="many2many"?(Array.isArray(R)?R:[R]).map(k).filter(A=>A!==null):An(y,R)}function l(y){let R=e.fields[y];if(!R)throw new Error(`The page has no field "${y}"`);return R}async function f(y){return e.host?e.host.ask(y):e.confirm?e.confirm(y):!0}function c(y){return{reason:"cannot",message:y}}async function v(y,R){let E=e.host;if(!E)return c(`Nothing can open "${y.page}" here: the form has no host`);let k=y.record!==void 0?a(y.record,!1):null,A={page:y.page,...y.version!==void 0?{version:y.version}:{},as:y.as??"dialog",...y.side&&y.as==="panel"?{side:y.side}:{},...y.title!==void 0?{title:y.title}:{},recordId:typeof k=="number"||typeof k=="string"&&k!==""?k:null,...y.values?{values:m(y.values)}:{},...y.filter?{filter:Kr(y.filter,e.reading().context)}:{}},w;try{w=await E.open(A)}catch(C){return{reason:"cannot",message:io(C),error:C}}if(!w.saved)return{reason:"closed"};if(y.into&&e.write(S(y.into,w)),!y.then)return null;let j=await L(y.then,R);return j.done?null:{reason:j.reason,message:j.message,step:j.step,error:j.error}}function m(y){let R={};for(let[E,k]of Object.entries(y))R[E]=a(k,!0)??null;return R}function S(y,R){let E=R.values??{},k=R.recordId??null,A={...Gl(E),id:k},w=[R.label,E.display_name,E.name].find(O=>typeof O=="string"&&O!==""),j=O=>O===k?w:void 0,C={};for(let[O,W]of Object.entries(y)){let D=l(O),I=o(W),B=I==="id"?k:I!==null&&!ro.has(D.type)&&I in E?E[I]:r(W).evaluate(A,{today:e.today});C[O]=d(D,B,j)}return C}async function g(y,R){let E={id:R.id,action:y.action,...y.params?{params:Le(y.params)}:{},recordId:e.recordId(),values:Le(e.values()),...R.recordIds?{recordIds:[...R.recordIds]}:{},...R.line?{line:Le(R.line)}:{},...R.lines?{lines:Le(R.lines)}:{}};if(!e.onAction)return null;let k;try{k=await e.onAction(E)??void 0}catch(A){return{reason:"app",message:io(A),error:A}}if(e.answered(E,k),!k)return null;if(k.reload){let A=await e.reload();if(A)return A}if(k.values){let A={};for(let[w,j]of Object.entries(k.values))w in e.fields&&(A[w]=d(e.fields[w],j));e.write(A)}if(k.say!==void 0){let A=typeof k.say=="string"?{message:k.say}:k.say;e.host?.say(A.message,A.tone??"info")}if(k.post!==void 0){let A=typeof k.post=="string"?{message:k.post}:k.post,w=await p(A.message,A.kind??"note",!1);if(w)return w}if(k.record!==void 0){let A=await e.showRecord(k.record);if(A)return A}if(k.open){let A=await v(k.open,R);if(A)return A}return k.stop?(typeof k.stop=="string"&&e.host?.say(k.stop,"warning"),{reason:"app",...typeof k.stop=="string"?{message:k.stop}:{}}):null}async function p(y,R,E){let k=E?Wn(y):[{text:y}],A=k.map(C=>C.field?e.wordsOf(C.field):C.text).join(""),w=k.map(C=>C.field&&e.fields[C.field]?.type==="html"?String(e.values()[C.field]??""):Yl(C.field?e.wordsOf(C.field):C.text)).join("");return await e.post({kind:R,text:A,body:`<p>${w}</p>`})?null:c("Nothing can post a message here: no conversation is beside this record")}async function b(y,R,E){return e.onAction?g({action:y},E):c(`Nothing can ${y} this record here: the data source has no ${R}, and the app takes no actions`)}async function h(y,R){let E=e.recordId();if(E==null)return c(`A new record cannot be ${y==="duplicate"?"duplicated":y==="delete"?"deleted":`${y}d`}: it is not saved yet`);if(y==="archive"||y==="unarchive")return e.archive?(await e.archive(y==="archive"),e.told({archived:y==="archive"},E),e.reload()):b(y,"archive",R);if(y==="duplicate"){if(e.changed()){let w=await e.save(R.chain);if(w)return w}if(!e.copy){let w=await b(y,"copy",R),j=e.recordId();return!w&&j!=null&&j!==E&&e.told({copied:j},E),w}let k=await e.copy(),A=await e.showRecord(k);return A||(e.told({copied:k},E),null)}if(!e.remove){let k=await b(y,"delete",R);return k||e.told({deleted:!0},E),k}return await e.remove(),e.told({deleted:!0},E),null}async function x(y,R){switch(y.do){case"set":{let E=l(y.field);return e.write({[y.field]:d(E,a(y.value,!ro.has(E.type)))}),null}case"clear":return e.write({[y.field]:Rn(l(y.field))}),null;case"addLine":{let E=l(y.field);if(E.type!=="one2many")return c(`"${y.field}" is a ${E.type}; a line is added to a one2many`);let k={};for(let[A,w]of Object.entries(y.values??{})){let j=E.fields[A];if(!j)return c(`The lines of "${y.field}" have no field "${A}"`);k[A]=d(j,a(w,!ro.has(j.type)))}return e.addLine(y.field,k),null}case"check":return e.check(y.fields);case"save":return e.save(R.chain);case"reset":return e.reset(),null;case"goTo":{let E=e.goTo(y.target,R.chain);if(E!==void 0)return E;let k=e.host?.show;return k?(e.showing(R.chain,()=>k.call(e.host,y.target)),null):c(`Nothing can show "${y.target}" here: the form has no host that shows tabs`)}case"say":return e.host?.say(y.message,y.tone??"info"),null;case"ask":return await f(y.message)?null:{reason:"no",message:y.message};case"call":return g(y,R);case"open":return v(y,R);case"close":{let E=e.host?.close;return E?(E.call(e.host),null):c("Nothing can close this form: it has no host, or was not opened in a dialog or panel")}case"reload":return e.reload();case"openUrl":{let E=e.host?.openUrl;if(!E)return c("Nothing can open a web address here: the form has no host that opens one");let k=a(y.url,!1);return typeof k!="string"||!k.trim()?c(`"${y.url}" gives no address to open`):(E.call(e.host,k.trim(),y.newTab??!0),null)}case"archive":case"unarchive":case"duplicate":case"delete":return h(y.do,R);case"post":return p(y.message,y.kind??"note",!0)}}async function L(y,R){for(let E=0;E<y.length;E++){let k=y[E],A;try{if(k.when!==void 0&&!i(k.when))continue;A=await x(k,R)}catch(w){A={reason:"cannot",message:io(w),error:w}}if(A)return{done:!1,stoppedAt:E,step:A.step??k,reason:A.reason,...A.message!==void 0?{message:A.message}:{},...A.error!==void 0?{error:A.error}:{}}}return Zr}return{runSteps:L,ask:f}}function Gl(e){let t={},n=r=>{if(r===null||typeof r!="object")return r;let i=r;return"key"in i&&"values"in i?i.key:"model"in i&&"id"in i?`${i.model},${i.id}`:"id"in i?i.id:"name"in i&&"type"in i&&"size"in i?i.name:r};for(let[r,i]of Object.entries(e))t[r]=Array.isArray(i)?i.map(n):n(i);return t}function Qa(e){let t=new Map;return function(r,i,o,a){if(!i?.length||o.includes(r))return Promise.resolve(Zr);let s=l=>{let f,c=new Promise(v=>f=v).finally(()=>{l.running===c&&!l.queued&&t.delete(r)});return l.running=c,f(e(r,i,[...o,r])),c},d=t.get(r);if(!d){let l={running:Promise.resolve(Zr)};return t.set(r,l),s(l)}if(!a)return Promise.resolve(Zr);if(!d.queued){let l=()=>(d.queued=void 0,s(d));d.queued=d.running.then(l,l)}return d.queued}}function Yl(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]).replace(/\n/g,"<br>")}function ei(e){return ns(e,[]).form}var es=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),oo=e=>e;function ns(e,t){let{page:n}=e,r=e.scheduler??ur,i=e.messages??Et.en,o=nc(n.layout),a=new Map;for(let u of o.values()){let F=u.source.validate;u.kind==="field"&&F&&a.set(u.id,_a(F))}let s=new Map;for(let u of o.values()){let F=u.source;u.kind!=="field"||n.fields[F.field]?.type!=="one2many"||(F.cells||F.rowTones||F.rowBold!==void 0||F.rowButtons||F.lineDelete!==void 0)&&s.set(u.id,{field:F.field,compiled:Xa(F)})}let d=new Map;for(let u of o.values()){let F=u.source;u.kind==="field"&&(F.tones||F.bold!==void 0)&&d.set(u.id,Ya(F))}let l=new Map;for(let u of o.values()){let F=u.source;u.kind==="field"&&F.order?.length&&n.fields[F.field]?.type==="one2many"&&!l.has(F.field)&&l.set(F.field,F.order)}function f(u,F){let N=u;for(let[P,_]of l){if(F&&!F.includes(P))continue;let Q=u[P];if(!Array.isArray(Q)||Q.length<2)continue;let $=[...Q].sort((J,Z)=>Ql(J.values,Z.values,_));$.some((J,Z)=>J!==Q[Z])&&(N={...N,[P]:$})}return N}let c=new Map,v=(u,F)=>{F.placeholderWhen?.length&&c.set(u,{fixed:F.placeholder,when:F.placeholderWhen.map(N=>({text:N.text,holds:rt(N.when)}))})};for(let u of o.values())u.kind==="field"&&"type"in u.source&&v(u.id,u.source);n.layout.type==="sheet"&&n.layout.title&&v("#title",n.layout.title);let m=[...a.values()].some(u=>u.some(F=>F.rule.level==="warning")),S=n.layout.type==="wizard"?n.layout.children.map(u=>u.id):[],g=()=>`fieldia:draft:${n.id}:${T.recordId??"new"}`,p=()=>un(e.now?.()??new Date),b=!1,h=e.editing!==!1,x=e.parent?Bt(e.parent.values,e.parent.fields,{recordId:e.parent.id??null,user:e.user,context:e.context}):void 0,L=()=>({recordId:b?T.recordId:e.recordId??null,user:e.user,editing:h,context:e.context,parent:x}),y=Ba(n,p,L),R=qa(n,p,L),E=new Map;for(let u of o.values())u.kind==="form"&&E.set(u.id,u.source);let k=new Map,A={...n.fields};for(let u of E.values())A[u.name]={type:"json",label:u.title||u.name};let w=!1;function j(u=e.recordId==null,F=!0){let N=gn(A,p());if(u){let P={recordId:null,user:e.user,context:e.context,parent:x};Object.assign(N,eo(n.fields,O(N,n.fields,Bt(N,n.fields,P),Fn(N,n.fields,p))))}return F?f({...N,...Le(e.values??{})}):N}function C(u,F){let N=b?T.values:{};for(let[P,_]of Object.entries(n.fields)){if(_.type!=="many2one"&&_.type!=="many2many"||_.relation!==u)continue;let Q=N[P],$=(Array.isArray(Q)?Q:Q?[Q]:[]).find(J=>J?.id===F);if($)return $.label}}function O(u,F,N,P,_){return{values:u,fields:F,context:N,env:P,..._?{parent:_}:{},...e.user?{user:e.user}:{},labelOf:C}}function W(){let{context:u,env:F}=ge();return O(T.values,n.fields,u,F)}function D(u,F){let P=Ye(u).fields;return O(F,P,yn(F,P,ge().context),{today:p},{values:T.values,fields:n.fields})}function I(u){let F=s.get(u);if(F)return F;let N=o.get(u);if(N?.kind!=="field"||n.fields[N.field]?.type!=="one2many")throw new Error(`"${u}" is not a table of lines`);return null}function B(u,F){let N=I(u);if(!N)return{tone:null,bold:!1,cells:{},buttons:{},deletable:!0};let P=(T.values[N.field]??[]).find(Q=>Q.key===F);if(!P)throw new Error(`"${N.field}" has no line "${F}"`);let _=Ye(N.field);return N.compiled.line(yn(P.values,_.fields,ge().context,P.id??null),{today:p},Te)}function H(u,F){if(!F){let _=xe(u);return _.type==="many2one"||_.type==="many2many"?_.createValues?Qi(_.createValues,W()):{}:{}}let N=(T.values[F.lines]??[]).find(_=>_.key===F.key),P=Ye(F.lines).fields[u];return!N||!P||P.type!=="many2one"&&P.type!=="many2many"||!P.createValues?{}:Qi(P.createValues,D(F.lines,N.values))}let V=y.apply(j()),z=R.holding(V),T={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:Le(V),errors:{},dirty:[],warnings:{},warning:null,warningField:null,error:null,draft:null,step:S[0]??null,skipped:[],saveProblem:null,choices:{},definitions:{}};b=!0;let te={},Y=0,K=0,q=null,oe=null,Ce=new Set,Me=new Set,ke=new Map,$e=[],ae=!1,he=null,ne=null,Te=[...e.user?.roles??[]],Pe={};function we(u){let F=T.values,N=T.errors;if(T={...T,...u},T.errors!==N)for(let P of k.values())P.inner.show(Xl(T.errors,P.name));for(let P of[...Me])P(T);if(T.values!==F){for(let P in T.choices)U(P).dependsOn?.some(_=>F[_]!==T.values[_])&&ie(P);for(let P in T.definitions)Ae(P).dependsOn?.some(_=>F[_]!==T.values[_])&&de(P)}ae&&T.step!==he&&re($e)}function Ve(u,F){let N=ke.get(u);if(N)for(let P of[...N])P(F)}function X(u,F){Ve("change",{field:u,value:T.values[u],values:T.values,by:F});let N=n.on?.change?.[u];F==="person"&&N&&ce(ve(`on.change.${u}`,N,[],!0))}function re(u){let F=T.step;if(F===he||F===null)return;he=F,Ve("step",{step:F});let N=n.on?.show?.[F];N&&ce(ve(`on.show.${F}`,N,u,!0))}function me(u,F){let N=$e;$e=u;try{F()}finally{$e=N}}let U=u=>n.fields[u].optionsFrom;function ie(u){let{list:F}=U(u),N=Pe[u]=(Pe[u]??0)+1,P=$=>N===Pe[u]&&we({choices:{...T.choices,[u]:$}}),_=T.choices[u]?.options??null;P({options:_,loading:!0});let Q=e.dataSource;ce((Q?.options?Q.options({list:F,values:Le(T.values)}):Promise.reject(new Error(`No list "${F}"`))).then($=>P({options:$}),$=>P({options:_,error:$.message??String($)})))}let Ae=u=>n.fields[u].definitionsFrom,Re={};function de(u){let{list:F}=Ae(u),N=Re[u]=(Re[u]??0)+1,P=$=>N===Re[u]&&we({definitions:{...T.definitions,[u]:$}}),_=T.definitions[u]?.definitions??null;P({definitions:_,loading:!0});let Q=e.dataSource;ce((Q?.definitions?Q.definitions({list:F,values:Le(T.values)}):Promise.reject(new Error(`No definitions "${F}"`))).then($=>P({definitions:$}),$=>P({definitions:_,error:$.message??String($)})))}async function pe(u,F){let{list:N}=Ae(u),P=[...T.definitions[u]?.definitions??[],F];we({definitions:{...T.definitions,[u]:{definitions:P}}}),await ce(e.dataSource?.saveDefinitions?.({list:N,values:Le(T.values),definitions:P})??Promise.resolve())}function le(u){let F=n.fields[u],N=T.choices[u]?.options;return F.type==="selection"&&F.optionsFrom&&N?{...F,options:N,optionsFrom:void 0}:F}function ce(u){Ce.add(u);let F=()=>Ce.delete(u);return u.then(F,F),u}function ge(){if(ne?.values!==T.values||ne.recordId!==T.recordId||ne.editing!==h){let u=T.values,F=Bt(u,n.fields,L());ne={values:u,recordId:T.recordId,editing:h,context:F,env:Fn(u,n.fields,p)}}return ne}let fe=()=>ge().context;function xe(u){let F=A[u];if(!F)throw new Error(`The page has no field "${u}"`);return F}function it(u){return Object.keys(A).filter(F=>JSON.stringify(u[F]??null)!==JSON.stringify(V[F]??null))}function lt(u){let F=o.get(u);if(!F)throw new Error(`The page has no element "${u}"`);let{context:N,env:P}=ge(),_=Z=>Z?!En(Z.roles,Te)||Z.invisible.evaluate(N,P):!1,Q=_(F);for(let Z=F.parent;!Q&&Z;Z=o.get(Z)?.parent??null)Q=_(o.get(Z));let $=F.readonly.evaluate(N,P);for(let Z=F.parent;!$&&Z;Z=o.get(Z)?.parent??null)$=o.get(Z)?.readonly.evaluate(N,P)??!1;let J=F.field?n.fields[F.field]:void 0;return{invisible:Q,readonly:$||J!==void 0&&ts(J),required:F.required.evaluate(N,P)||J?.required===!0}}function vt(u,F="field"){let N=_=>{if(!u)return!0;for(let Q=_.id;Q;Q=o.get(Q)?.parent??null)if(Q===u)return!0;return!1},P=_=>{if(u||!T.skipped.length)return!1;for(let Q=_.id;Q;Q=o.get(Q)?.parent??null)if(T.skipped.includes(Q))return!0;return!1};return[...o.values()].filter(_=>_.kind===F&&N(_)&&!P(_)&&!lt(_.id).invisible)}function On(u){let F=a.get(u.id);if(!F)return{};let N=u.field,P=n.fields[N],_=u.source.label??P.label,{context:Q,env:$}=ge();return Ua(P,_,T.values[N],F,{context:Q,env:$,now:e.now?.()??new Date,messages:i})}function Qn(u){let F=u.field;return u.source.widget==="tick"&&n.fields[F].type==="boolean"&&T.values[F]!==!0&<(u.id).required?i.tick:void 0}function Di(u){let F=u.field;return Qn(u)??Xi(n.fields[F],u.source,T.values[F],i)??bn(le(F),T.values[F],lt(u.id).required,i,p())??On(u).error}function zt(){var F;let u={};if(!m)return u;for(let N of vt()){let P=a.has(N.id)?On(N).warning:void 0;P&&(u[F=N.field]??(u[F]=P))}return u}function qt(u,F){let N=T;T={...T,values:u};try{return F()}finally{T=N}}function _t(u){let F={};for(let N of vt(u)){let P=N.field;if(F[P])continue;let _=n.fields[P],Q=Di(N);if(Q&&(F[P]=Q),_.type==="one2many")for(let $ of T.values[P]??[]){let J=pt(_,$.values),Z=s.has(N.id)?B(N.id,$.key).cells:{};for(let[ee,se]of Object.entries(_.fields)){if(J&&ee!==_.lineKinds?.text)continue;let be=Z[ee];if(be?.invisible||s.has(N.id)&&s.get(N.id).compiled.hidden(ee,ge().context,ge().env,Te))continue;let Ue=bn(se,$.values[ee],se.required===!0||be?.required===!0,i,p());Ue&&(F[`${P}.${$.key}.${ee}`]=Ue)}}}for(let N of vt(u,"form")){let P=k.get(N.id);if(P)for(let[_,Q]of Object.entries(P.inner.errorsNow()))F[`${P.name}.${_}`]=Q}return F}function sn(u,F){let N=u;for(let P of k.values())if(!(F!=="start"&&N[P.name]===P.inner.form.getState().values)){w=!0;try{P.inner.take(es(N[P.name])?N[P.name]:{},F)}finally{w=!1}N={...N,[P.name]:oo(P.inner.form.getState().values)}}return N}function Ar(u){let F=y.apply(u);for(let N=0;N<8;N++){let P=R.apply(F,z);if(z=P.holding,P.values===F)break;F=y.apply(P.values)}return F}function Dt(u){let F=y.apply(u);return z=R.holding(F),F}function ot(u,F={},N=!1){let P=sn(N?Dt(u):Ar(u),N?"fresh":"edit"),_=Object.keys(T.errors).length?dn(P):T.errors,Q={};for(let $ of Object.keys(u)){let J=n.fields[$];if(!(u[$]===T.values[$]||!J)&&(Qr(J,u[$])&&(Q[$]=bn(J,u[$],!1,i)),J.type==="one2many"))for(let Z of u[$]??[])for(let[ee,se]of Object.entries(Z.values))Qr(J.fields[ee],se)&&(Q[`${$}.${Z.key}.${ee}`]=bn(J.fields[ee],se,!1,i))}Object.keys(Q).length&&(_={..._,...Q}),we({values:P,dirty:it(P),errors:_,warnings:qt(P,zt),...F})}function dn(u){let F=qt(u,()=>_t(T.step??void 0)),N={};for(let P of Object.keys(T.errors))F[P]&&(N[P]=F[P]);for(let[P,_]of Object.entries(te))JSON.stringify(u[P]??null)===_.value?N[P]??(N[P]=_.message):delete te[P];return N}function $r(){let u=e.drafts;u&&(q!==null&&r.clearTimeout(q),q=r.setTimeout(()=>{q=null,u.store.setItem(g(),JSON.stringify({savedAt:new Date().toISOString(),values:T.values}))},u.delayMs??400))}function kn(){q!==null&&r.clearTimeout(q),q=null,e.drafts?.store.removeItem(g())}function er(){let u=e.drafts;if(!u)return;let F=u.store.getItem(g());if(!F)return;let N;try{N=JSON.parse(F)}catch{u.store.removeItem(g());return}u.restore==="auto"?ot({...T.values,...N.values},{draft:null},!0):we({draft:{savedAt:N.savedAt}})}function Wi(){let u=e.autosave;!u||n.data.kind!=="record"||(oe!==null&&r.clearTimeout(oe),oe=r.setTimeout(()=>{oe=null,T.dirty.length&&Object.keys(_t()).length===0&&ce(tr())},u.delayMs))}function Tr(u){let F=e.dataSource;if(!F?.onchange||n.data.kind!=="record"||ic(n.fields[u],T.values[u]))return;let N=++K,P={model:n.data.model,id:T.recordId,changed:u,values:Le(T.values)};ce(F.onchange(P).then(_=>{if(N!==K)return;let Q={...T.values,..._.values??{}};ot(Q,{warning:_.warning??null,warningField:_.warning?u:null})},()=>{}))}function Ut(u){$r(),Wi(),Tr(u)}function Pn(){let u={values:{},lines:{},links:{}},F=T.recordId===null||T.recordId===void 0,N=F?Object.keys(A).filter(P=>T.dirty.includes(P)||!Kt(A[P],T.values[P])):T.dirty;for(let P of N){let _=A[P],Q=T.values[P],$=F?Rn(_):V[P];_.type==="one2many"?u.lines[P]=ec($??[],Q??[]):_.type==="many2many"?u.links[P]=tc($??[],Q??[]):u.values[P]=Le(Q)}return u}function Mr(){let u={};for(let F of vt()){let N=F.field;u[N]=Le(T.values[N])}for(let F of vt(void 0,"form")){let N=k.get(F.id);N&&(u[N.name]=Le(T.values[N.name]))}return u}async function tr(u=[]){return await ln(u)===null}async function ln(u){if(n.on?.beforeSave){let P=await ve("on.beforeSave",n.on.beforeSave,u,!1);if(!P.done){if(P.reason!=="check"&&P.reason!=="save"){let _={kind:"stopped",reason:P.reason,message:P.message??""};we({status:"error",error:_.message||null,saveProblem:_})}return{reason:"save",...P.message!==void 0?{message:P.message}:{}}}}let F=_t();if(Object.keys(F).length)return we({errors:F}),{reason:"save",message:Object.values(F)[0]};let N=e.dataSource;te={},we({status:"saving",errors:{},error:null,saveProblem:null});try{if(n.data.kind==="responses"){if(!N?.submit)throw new Error("This page has no data source to send its answers to");let Q=Mr();return await N.submit({pageId:n.id,values:Q}),kn(),we({status:"saved"}),Ve("send",{values:Q}),ce(ve("on.afterSave",n.on?.afterSave,u,!1)),null}if(!N?.save)throw new Error("This page has no data source to save to");let P=await N.save({model:n.data.model,id:T.recordId,fields:A,changes:Pn(),values:Le(T.values)});kn();let _=sn(Dt(P.values?f({...T.values,...P.values},Object.keys(P.values)):T.values),"start");return V=Le(_),we({status:"saved",recordId:P.id,values:_,dirty:[],warnings:qt(_,zt)}),Ve("save",{recordId:T.recordId,values:T.values}),ce(ve("on.afterSave",n.on?.afterSave,u,!1)),null}catch(P){let _=Ur(P),Q=_.kind==="fields"?_.fields??{}:{};return te=Object.fromEntries(Object.entries(Q).map(([$,J])=>[$,{message:J,value:JSON.stringify(T.values[$]??null)}])),we({status:"error",error:_.message,saveProblem:_,errors:{...Q}}),{reason:"save",message:_.message}}}async function nr(){Ve("open",{recordId:T.recordId,values:T.values}),await ve("on.open",n.on?.open,[],!0),ae=!0,re([])}function rr(u,F){let N=Object.keys(u);if(N.forEach(xe),!!N.length){ot({...T.values,...Le(u)});for(let P of N)Ut(P);for(let P of N)X(P,F)}}function M(u,F,N){let P=Ye(u),_=T.values[u]??[],Q=`new-${++Y}`;for(;_.some(se=>se.key===Q);)Q=`new-${++Y}`;let $=P.fields,J=gn($,p());Object.assign(J,eo($,D(u,J))),P.lineDefaults&&Object.assign(J,Ga(P.lineDefaults,$,W()));let Z={key:Q,values:{...J,...Le(F)}};if(P.sequenceField&&Z.values[P.sequenceField]==null){let se=_.map(be=>be.values[P.sequenceField]).filter(be=>typeof be=="number");Z.values[P.sequenceField]=se.length?Math.max(...se)+1:1}let ee=[..._,Z];return ot({...T.values,[u]:ee}),Ut(u),X(u,N),Q}function G(u){u?.forEach(xe);let F=_t(),N=u?Object.fromEntries(Object.entries(F).filter(([_])=>u.some(Q=>_===Q||_.startsWith(`${Q}.`)))):F;we({errors:N});let P=Object.values(N)[0];return P===void 0?null:{reason:"check",message:P}}function ue(u,F){if(!S.includes(u))return;if(!qe.steps().includes(u))return{reason:"cannot",message:`The step "${u}" does not apply now`};let N=!1;return me(F,()=>N=qe.goTo(u)),N?null:{reason:"check",message:Object.values(T.errors)[0]}}async function ye(u,F){let N=await Ke.runSteps(u,F);return Ve("run",{id:F.id,steps:u,result:N}),N}function Fe(u){return!e.dataSource?.create||!u||u.readonly?null:u.type==="many2one"||u.type==="many2many"?u.relation:null}async function Ne(u,F,N,P={}){let _=Fe(u),Q=e.dataSource;if(!_||!Q?.create)throw new Error(`"${F}" cannot make records: its data source has no create, or it is not a link`);return ce(Q.create({model:_,name:N.trim(),...Object.keys(P).length?{values:P}:{}}))}async function mt(u,F,N,P,_,Q,$){if(u.type!=="many2one"&&u.type!=="many2many"&&u.type!=="reference"&&u.type!=="json")throw new Error(`"${F}" is not a many2one, many2many, reference or json`);if((u.type==="reference"||u.type==="json")&&!Q)throw new Error(`Searching "${F}" needs a model`);let J=e.dataSource;if(!J?.search)return[];let Z=u.type==="reference"||u.type==="json"||!u.filter?void 0:Kr(u.filter,N),ee=$?[...Z??[],{field:"id",op:"in",value:$}]:Z,se=u.type==="reference"||u.type==="json"?Q:u.relation;return ce(J.search({model:se,query:P,...ee?{filter:ee}:{},limit:_}))}function Ye(u){let F=xe(u);if(F.type!=="one2many")throw new Error(`"${u}" is a ${F.type}, not a one2many`);return F}function st(){return T.step?S.indexOf(T.step):-1}function xt(u){return o.get(u)?.source?.optional===!0}async function Ze(u=!1){let F=e.dataSource;if(T.recordId==null||n.data.kind!=="record")return;if(!F?.load){we({status:"error",error:"This page has no data source to load from"});return}let N=++dt;we({status:"loading",error:null});try{let P=await F.load({model:n.data.model,id:T.recordId,fields:A});if(N!==dt||(V=sn(Dt(f({...gn(A,p()),...P})),"start"),we({status:"ready",values:Le(V),dirty:[],errors:{},warnings:qt(V,zt)}),u))return;er(),ce(nr())}catch(P){N===dt&&we({status:"error",error:P.message})}}let dt=0;async function Ie(u){q!==null&&r.clearTimeout(q),oe!==null&&r.clearTimeout(oe),q=oe=null,te={},he=null,ae=!1;let F={dirty:[],errors:{},warning:null,warningField:null,error:null,draft:null,step:S[0]??null,skipped:[],saveProblem:null};if(u!=null)return we({...F,recordId:u,status:"idle"}),Ze();dt++,V=Dt(j(!0,!1));let N=sn(Le(V),"start");we({...F,recordId:null,status:"ready",values:N,warnings:qt(N,zt)}),er(),await nr()}let at=()=>({model:n.data.model,id:T.recordId,fields:A});async function Se(u){if(e.host?.post)try{return await e.host.post(u)!==!1}catch{return!1}return ke.get("post")?.size?(Ve("post",{recordId:T.recordId,message:u}),!0):!1}let Ke=Za({fields:A,values:()=>T.values,recordId:()=>T.recordId,reading:ge,today:p,write:u=>rr(u,"step"),addLine:(u,F)=>{M(u,F,"step")},check:G,save:ln,async reload(){return T.recordId==null?{reason:"cannot",message:"The record is not saved yet: there is nothing to load again"}:(await Ze(!0),T.status==="error"?{reason:"cannot",message:T.error??"The record could not be loaded again"}:null)},reset:()=>qe.reset(),goTo:ue,showing:me,host:e.host,confirm:e.confirm,onAction:e.onAction,answered:(u,F)=>Ve("action",{request:u,result:F}),changed:()=>T.dirty.length>0,...e.dataSource?.archive&&n.data.kind==="record"?{archive:u=>ce((e.dataSource?.archive)({...at(),archive:u}))}:{},...e.dataSource?.copy&&n.data.kind==="record"?{copy:async()=>(await ce((e.dataSource?.copy)(at()))).id}:{},...e.dataSource?.delete&&n.data.kind==="record"?{remove:()=>ce((e.dataSource?.delete)(at()))}:{},async showRecord(u){return await Ie(u),T.status==="error"?{reason:"cannot",message:T.error??"The record could not be loaded"}:null},told(u,F){"archived"in u?Ve("archive",{recordId:F,archived:u.archived}):"copied"in u?Ve("duplicate",{from:F,recordId:u.copied}):(Ve("delete",{recordId:F}),T.recordId===F&&ce(Ie(null)))},post:Se,wordsOf:u=>rc(xe(u),T.values[u])}),ve=Qa((u,F,N)=>ye(F,{id:u,chain:N}));function ze(u,F){let N=[...u.steps??[]];u.action!==void 0&&N.push({do:"call",action:u.action,..."params"in u&&u.params?{params:u.params}:{}});let P="builtin"in u&&!N.length?u.builtin:void 0;P&&N.push({do:P});let _=P==="archive"?i.archiveConfirm:P==="delete"?i.deleteConfirm:void 0,Q="confirm"in u&&u.confirm!==void 0?u.confirm:_;return ce((async()=>{if(Q&&!await Ke.ask(Q)){let $={done:!1,reason:"no",message:Q};return Ve("run",{id:F.id,steps:N,result:$}),$}return ye(N,F)})())}let qe={page:n,getState:()=>T,subscribe(u){return Me.add(u),()=>Me.delete(u)},load:()=>ce(Ze()),setValue(u,F,N){xe(u),ot({...T.values,[u]:Le(F)}),Ut(u),X(u,N?.by??"person")},setValues:u=>rr(u,"app"),node:lt,openRecord:u=>ce(Ie(u)),post:Se,setEditing(u){u!==h&&(h=u,we({}))},fieldReadonly:u=>ts(xe(u)),loadChoices:ie,loadDefinitions:de,addDefinition:pe,problem(u){xe(u);let F=vt().filter(P=>P.field===u);return F.length?F.map(Qn).find(Boolean)??F.map(P=>Xi(n.fields[u],P.source,T.values[u],i)).find(Boolean)??bn(le(u),T.values[u],F.some(P=>lt(P.id).required),i,p())??F.map(P=>On(P).error).find(P=>P!==void 0)??null:null},validate(){let u=_t();return we({errors:u}),Object.keys(u).length===0},save:()=>ce(tr()),reset(){kn(),te={},z=R.holding(V);let u=sn(Le(V),"start");we({values:u,dirty:[],errors:{},warnings:qt(u,zt),warning:null,warningField:null,draft:null,step:S[0]??null,skipped:[],saveProblem:null})},changes:Pn,addLine:(u,F={})=>M(u,F,"person"),updateLine(u,F,N,P){if(!Ye(u).fields[N])throw new Error(`The lines of "${u}" have no field "${N}"`);let Q=(T.values[u]??[]).map($=>$.key===F?{...$,values:{...$.values,[N]:Le(P)}}:$);ot({...T.values,[u]:Q}),Ut(u),X(u,"person")},moveLine(u,F,N){let _=Ye(u).sequenceField;if(!_)throw new Error(`The lines of "${u}" keep no order: give the field a sequenceField`);let Q=[...T.values[u]??[]],$=Q.findIndex(He=>He.key===F);if($<0)throw new Error(`"${u}" has no line "${F}"`);let J=Math.max(0,Math.min(N,Q.length-1));if(J===$)return;let Z=Q.map(He=>He.values[_]),ee=Z.every((He,Be)=>typeof He=="number"&&(Be===0||He>Z[Be-1]));Q.splice(J,0,...Q.splice($,1));let se=Math.min($,J),be=Math.max($,J),Ue=ee?Z.slice(se,be+1):[],je=Q.map((He,Be)=>{let Ft=ee?Be>=se&&Be<=be?Ue[Be-se]:He.values[_]:Be+1;return Ft===He.values[_]?He:{...He,values:{...He.values,[_]:Ft}}});ot({...T.values,[u]:je}),Ut(u),X(u,"person")},removeLine(u,F){Ye(u);for(let[P,_]of s)if(!(_.field!==u||(o.get(P)?.source).lineDelete===void 0)&&(T.values[u]??[]).some(Q=>Q.key===F)&&!B(P,F).deletable)throw new Error(`The line "${F}" of "${u}" cannot be deleted now: its table's lineDelete does not hold on it`);let N=(T.values[u]??[]).filter(P=>P.key!==F);ot({...T.values,[u]:N}),Ut(u),X(u,"person")},async search(u,F,N=8,P={}){return mt(xe(u),u,fe(),F,N,P.model,P.ids)},async previewLine(u,F,N){Ye(u);let P=T.values[u]??[],_=P.find(se=>se.key===F);if(!_)throw new Error(`"${u}" has no line "${F}"`);let Q=y.line(u,{..._.values,...N},T.values),$=e.dataSource;if(!$?.onchange||n.data.kind!=="record")return Q;let J=P.map(se=>se.key===F?{...se,values:Q}:se),ee=((await $.onchange({model:n.data.model,id:T.recordId,changed:u,values:Le({...T.values,[u]:J})})).values?.[u]??[]).find(se=>se.key===F);return ee?y.line(u,{...Q,...ee.values},T.values):Q},async searchLine(u,F,N,P,_=8,Q={}){let $=Ye(u),J=$.fields[N];if(!J)throw new Error(`The lines of "${u}" have no field "${N}"`);let Z=(T.values[u]??[]).find(ee=>ee.key===F);if(!Z)throw new Error(`"${u}" has no line "${F}"`);return mt(J,N,yn(Z.values,$.fields,fe(),Z.id??null),P,_,Q.model,Q.ids)},canCreate:u=>Fe(n.fields[u])!==null,quickCreate:(u,F)=>Ne(n.fields[u],u,F,n.fields[u]?H(u):{}),canCreateLine:(u,F)=>Fe(Ye(u).fields[F])!==null,quickCreateLine:(u,F,N,P)=>Ne(Ye(u).fields[F],F,N,P?H(F,{lines:u,key:P}):{}),createValues:(u,F)=>H(u,F),steps:()=>S.filter(u=>!lt(u).invisible),next(){if(!T.step)return!1;T.skipped.includes(T.step)&&we({skipped:T.skipped.filter(P=>P!==T.step)});let u=_t(T.step);if(Object.keys(u).length)return we({errors:u}),!1;let F=qe.steps(),N=S.slice(st()+1).find(P=>F.includes(P));return N?(we({step:N,errors:{}}),!0):!1},back(){if(!T.step)return!1;let u=qe.steps(),F=S.slice(0,st()).reverse().find(N=>u.includes(N));return F?(we({step:F,errors:{}}),!0):!1},skip(){let u=T.step;if(!u||!xt(u))return!1;let F=qe.steps(),N=F[F.indexOf(u)+1];return N?(we({step:N,errors:{},skipped:[...T.skipped.filter(P=>P!==u),u]}),!0):!1},goTo(u){let F=qe.steps(),N=F.indexOf(u),P=T.step?F.indexOf(T.step):-1;if(N===-1||P===-1)return!1;if(N<=P)return we({step:u,errors:{}}),!0;let _=[...T.skipped];for(let Q of F.slice(P,N)){if(_.includes(Q))continue;let $=_t(Q);if(Object.keys($).length){if(xt(Q)){_.push(Q);continue}return we({step:Q,errors:$,skipped:_}),!1}}return we({step:u,errors:{},skipped:_}),!0},async runAction(u,F){let N=o.get(u);if(!N||N.kind!=="button"&&N.kind!=="stat")throw new Error(`The page has no button "${u}"`);return lt(u).invisible?{done:!1,reason:"cannot",message:`The button "${u}" is hidden`}:N.parent&&o.get(N.parent)?.source?.selectedButtons?.some(P=>P.id===u)?{done:!1,reason:"cannot",message:`The button "${u}" runs with the lines chosen in its table`}:ze(N.source,{id:u,chain:[],...F?{recordIds:[...F.recordIds]}:{}})},async linkedValues(u,F,N){let P=xe(u);if(P.type!=="many2many")throw new Error(`"${u}" is not a many2many`);let _=e.dataSource;if(!_?.list||!F.length)return[];let Q=await _.list({model:P.relation,fields:[...N],filter:[{field:"id",op:"in",value:[...F]}],sort:[],offset:0,limit:F.length}),$=new Map(Q.records.map(J=>[String(J.id),J]));return F.flatMap(J=>{let Z=$.get(String(J));return Z?[{id:Z.id,values:Z.values}]:[]})},fieldTone(u){let F=d.get(u);if(F){let{context:N,env:P}=ge();return F(N,P)}if(o.get(u)?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);return{tone:null,bold:!1}},placeholder(u){let F=c.get(u);if(!F){let _=o.get(u);if(_?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);let Q=_.source;return u==="#title"&&n.layout.type==="sheet"?n.layout.title?.placeholder:Q.placeholder}let{context:N,env:P}=ge();return F.when.find(_=>_.holds.evaluate(N,P))?.text??F.fixed},lineState:(u,F)=>B(u,F),columnHidden(u,F){let N=I(u),{context:P,env:_}=ge();return N?N.compiled.hidden(F,P,_,Te):!1},async runRowAction(u,F,N){let P=I(u),_=P?.compiled.buttons.find($=>$.id===F);if(!P||!_)throw new Error(`The table "${u}" has no button "${F}"`);if(!B(u,N).buttons[F])return{done:!1,reason:"cannot",message:`The button "${F}" is hidden on this line`};let Q=(T.values[P.field]??[]).find($=>$.key===N);return ze(_,{id:F,chain:[],line:{field:P.field,key:N,values:Le(Q.values)}})},async runLinesAction(u,F,N){let P=o.get(u),_=P?.source,Q=_?.selectedButtons?.find(se=>se.id===F);if(!P||!_||!Q)throw new Error(`The table "${u}" has no button "${F}" for its chosen lines`);let $=T.values[_.field]??[],J=N.map(se=>$.find(be=>be.key===se)??null),Z=N.find((se,be)=>!J[be]);if(Z!==void 0)throw new Error(`"${_.field}" has no line "${Z}"`);if(lt(F).invisible)return{done:!1,reason:"cannot",message:`The button "${F}" is hidden`};if(!N.length)return{done:!1,reason:"cannot",message:`The button "${F}" runs with lines chosen: none is`};let ee=J;return ze(Q,{id:F,chain:[],lines:{field:_.field,keys:[...N],ids:ee.flatMap(se=>se.id===void 0?[]:[se.id]),values:ee.map(se=>Le(se.values))}})},run:(u,F={})=>ce(ye(u,{id:F.id??"run",chain:[],...F.recordIds?{recordIds:[...F.recordIds]}:{}})),shown(u){S.includes(u)||ce(ve(`on.show.${u}`,n.on?.show?.[u],$e,!0))},on(u,F){let N=ke.get(u);return N||ke.set(u,N=new Set),N.add(F),()=>{N.delete(F)}},restoreDraft(){let u=e.drafts?.store.getItem(g());if(!u)return;let F=JSON.parse(u);ot({...T.values,...F.values},{draft:null},!0)},discardDraft(){kn(),we({draft:null})},async settled(){for(;Ce.size;)await Promise.allSettled([...Ce])},embed(u,F){let N=k.get(u);if(N)return N.inner.form;let P=E.get(u);if(!P)throw new Error(`"${u}" is not a saved form placed on this page`);let _=[...t,n.id];if(_.includes(F.id))throw new Error(`a page cannot be placed inside itself: ${[..._.slice(_.indexOf(F.id)),F.id].join(" \u2192 ")}`);let Q=T.values[P.name],$=ns({page:{...F,data:{kind:"responses"}},dataSource:e.dataSource,values:es(Q)?Q:{},onAction:e.onAction,host:e.host,confirm:e.confirm,scheduler:r,messages:i,now:e.now},_);k.set(u,{name:P.name,inner:$}),$.form.on("change",({by:ee})=>{w||X(P.name,ee)}),$.form.subscribe(ee=>{w||ee.values===T.values[P.name]||(ot({...T.values,[P.name]:oo(ee.values)}),Ut(P.name))});let J=oo($.form.getState().values);T.dirty.includes(P.name)||(V={...V,[P.name]:J});let Z={...T.values,[P.name]:J};return we({values:Z,dirty:it(Z)}),$.form},embedded:u=>k.get(u)?.inner.form??null,dispose(){q!==null&&r.clearTimeout(q),oe!==null&&r.clearTimeout(oe),Me.clear(),ke.clear();for(let u of k.values())u.inner.form.dispose()}};return T={...T,warnings:zt()},T.recordId==null&&er(),T.recordId==null&&ce(Promise.resolve().then(nr)),{form:qe,take(u,F){if(F!=="start")return ot({...gn(n.fields,p()),...u},{},F==="fresh");V=Dt({...gn(n.fields,p()),...Le(u)});let N=sn(Le(V),"start");we({values:N,dirty:[],errors:{},warnings:qt(N,zt),warning:null,warningField:null})},errorsNow:()=>_t(),show(u){JSON.stringify(u)!==JSON.stringify(T.errors)&&we({errors:u})}}}function Xl(e,t){let n={};for(let[r,i]of Object.entries(e))r.startsWith(`${t}.`)&&(n[r.slice(t.length+1)]=i);return n}function Zl(e,t){let n=a=>a==null||a===!1||a==="";if(n(e)||n(t))return n(e)===n(t)?0:n(e)?-1:1;let r=a=>a!==null&&typeof a=="object"&&!Array.isArray(a)&&"label"in a?String(a.label):a,i=r(e),o=r(t);return typeof i=="number"&&typeof o=="number"?i-o:typeof i=="boolean"&&typeof o=="boolean"?Number(i)-Number(o):String(i).localeCompare(String(o))}function Ql(e,t,n){for(let r of n){let i=Zl(e[r.field],t[r.field]);if(i)return r.desc?-i:i}return 0}function ts(e){return e.readonly===!0||e.compute!==void 0}function ec(e,t){let n=[],r=new Map(e.filter(o=>o.id!==void 0).map(o=>[o.key,o]));for(let o of t){let a=r.get(o.key);if(o.id===void 0||!a){n.push({op:"create",key:o.key,values:Le(o.values)});continue}let s={};for(let[d,l]of Object.entries(o.values))JSON.stringify(l)!==JSON.stringify(a.values[d])&&(s[d]=Le(l));Object.keys(s).length&&n.push({op:"update",id:o.id,values:s})}let i=new Set(t.map(o=>o.key));for(let o of e)o.id!==void 0&&!i.has(o.key)&&n.push({op:"delete",id:o.id});return n}function tc(e,t){let n=new Set(e.map(i=>i.id)),r=new Set(t.map(i=>i.id));return[...t.filter(i=>!n.has(i.id)).map(i=>({op:"link",id:i.id})),...e.filter(i=>!r.has(i.id)).map(i=>({op:"unlink",id:i.id}))]}function nc(e){let t=new Map,n=(i,o,a,s)=>{let d=i.roles;t.set(i.id,{id:i.id,parent:o,kind:a,field:s.field,...d?.length?{roles:d}:{},invisible:rt(s.invisible),readonly:rt(s.readonly),required:rt(s.required),source:i})},r=(i,o)=>{for(let a of i)if(a.type==="field"){n(a,o,"field",{invisible:a.invisible,readonly:a.readonly,required:a.required,field:a.field});for(let s of[...a.selectedButtons??[],...a.controlButtons??[]])n(s,a.id,"button",{invisible:s.invisible})}else if(a.type==="button")n(a,o,"button",{invisible:a.invisible});else if(a.type==="tabs"){n(a,o,"other",{invisible:a.invisible});for(let s of a.children)n(s,a.id,"other",{invisible:s.invisible}),r(s.children,s.id)}else a.type==="section"?(n(a,o,"other",{invisible:a.invisible,readonly:a.readonly}),r(a.children,a.id)):a.type==="form"?n(a,o,"form",{invisible:a.invisible,readonly:a.readonly}):n(a,o,"other",{invisible:a.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 i of e.children)n(i,e.id,"step",{invisible:i.invisible}),r(i.children,i.id);else if(e.type==="sections"){r(e.children,e.id);for(let i of e.footer??[])n(i,e.id,"button",{invisible:i.invisible})}else if(e.type==="list")for(let i of e.actions??[])n(i,e.id,"button",{invisible:i.invisible});else{let i=(o,a)=>{a&&n({id:o},e.id,"field",{field:a})};i("#title",e.title?.field),i("#subtitle",e.title?.subtitleField),i("#avatar",e.title?.avatarField),e.statusbar&&n({id:"#statusbar",...e.statusbar.roles?{roles:e.statusbar.roles}:{}},e.id,"field",{field:e.statusbar.field,invisible:e.statusbar.invisible});for(let o of[...e.buttons??[],...e.footer??[]])n(o,e.id,"button",{invisible:o.invisible});for(let o of e.statButtons??[])n(o,e.id,"stat",{invisible:o.invisible});for(let o of[...e.ribbon?[e.ribbon]:[],...e.ribbons??[]])n(o,e.id,"other",{invisible:o.invisible});for(let o of e.alerts??[]){n(o,e.id,"other",{invisible:o.invisible});for(let a of o.buttons??[])n(a,o.id,"button",{invisible:a.invisible})}for(let o of e.badges??[])n(o,e.id,"other",{invisible:o.invisible});r([...e.title?.above??[],...e.title?.before??[],...e.title?.after??[],...e.title?.below??[]],e.id),r(e.children,e.id),e.sidePanel&&n(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible});for(let o of e.toolbar?.menu??[])if(n(o,e.id,"button",{invisible:o.invisible}),o.builtin==="archive"||o.builtin==="unarchive"){let a=t.get(o.id),s=a.invisible,d=o.builtin==="unarchive";a.invisible={...s,evaluate:(l,f)=>l.active===!1!==d||s.evaluate(l,f)}}e.attachmentPreview&&n({id:"#preview",...e.attachmentPreview},e.id,"other",{invisible:e.attachmentPreview.invisible})}return t}function rc(e,t){if(e.type==="boolean")return t===!0?"Yes":"No";if(t==null||t===!1)return"";if(e.type==="selection")return e.options.find(r=>r.value===t)?.label??String(t);if(e.type==="html")return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let n=r=>r&&typeof r=="object"&&"label"in r?String(r.label):r&&typeof r=="object"&&"name"in r?String(r.name):String(r);return Array.isArray(t)?t.map(n).join(", "):n(t)}function Qr(e,t){return!!e&&(e.type==="integer"||e.type==="float"||e.type==="monetary")&&typeof t=="string"&&t.trim()!==""}function ic(e,t){return e?.type!=="one2many"?Qr(e,t):(t??[]).some(n=>Object.entries(n.values).some(([r,i])=>Qr(e.fields[r],i)))}var rs=new Map;function is(e,t){let n=`${e}:${t}`,r=rs.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),rs.set(n,r)),r}function $n(e,t,n,r="en"){try{let i=new Intl.NumberFormat(r,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",numberingSystem:"latn",minimumFractionDigits:n,maximumFractionDigits:n}).formatToParts(e);return i.map((o,a)=>o.type==="currency"&&/^(integer|minusSign)$/.test(i[a+1]?.type??"")?`${o.value}\xA0`:o.value).join("")}catch{return`${t} ${gt(e,n,r)}`}}function os(e){let t=is(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function ao(e,t,n="en"){return pr(gt(e,t,n),n)}function pr(e,t="en"){let{group:n}=os(t);return e.split(n).join("")}function gt(e,t,n="en"){return is(n,t).format(e)}function Jt(e,t="en"){let{group:n,decimal:r}=os(t),i=e.replace(/[٠-٩]/g,o=>String(o.charCodeAt(0)-1632)).replace(/[۰-۹]/g,o=>String(o.charCodeAt(0)-1776)).replace(/٫/g,r).replace(/٬/g,n);return i=i.replace(/[\s\u00a0\u202f]/g,""),n.trim()&&(i=i.split(n).join("")),r==="."?i:i.split(r).join(".")}var as={};var oc={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",lineN:"line {n}",noLines:"No lines yet",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",chooseLine:"Choose {name}",chooseAllLines:"Choose every line",linesChosen:"{n} chosen",moreSteps:"More",timeInStep:"{time} in this step",chooseDate:"Choose a date",other:"Other:",otherAnswer:"Your own answer",clearSelection:"Clear selection",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",addFiles:"Add files",addPhotos:"Add photos",dropThem:"or drop them here",upToSize:"up to {size}",upToEach:"up to {size} each",upToFiles:"up to {max} files",fileCount:"{n} files",oneFile:"1 file",fileCountOf:"{n} of {max} files",tooMany:"Up to {max} files: {n} not added",alreadyAdded:"{name}: already added",removeAsk:"Remove {name}?",keep:"Keep",previous:"Previous",next:"Next",download:"Download",close:"Close",fileAt:"{n} of {total}",noPreview:"No preview for this kind of file",showFilesAs:"Show files as",asList:"List",asCards:"Cards",asThumbnails:"Thumbnails",invalidJson:"Not valid JSON",invalidJsonAt:"Not valid JSON: line {line}, column {column}",signaturePad:"Signature pad: draw your signature",signHere:"Sign here",typeSignature:"Or type your name",clearDrawing:"Clear",undo:"Undo",uploadSignature:"Upload a picture",notAnswered:"Not answered",moveUp:"Move {label} up",moveDown:"Move {label} down",movedTo:"{label} moved to place {n} of {total}",addressStreet:"Street address",addressCity:"City",addressLine2:"Address line 2",addressRegion:"State or region",addressPostcode:"Postcode",addressCountry:"Country",entry:"Entry {n}",addAnother:"Add another",copy:"Copy {name}",removed:"{name} removed",loadingChoices:"Loading choices\u2026",choicesFailed:"Load the choices again",notOffered:"{name}: no longer offered",yes:"Yes",no:"No",upTo:"Up to {n}",keepOrder:"Keep this order",ofMax:"{n} of {max}",charactersLeft:"Characters left: {n}",colourNames:"No colour|Red|Orange|Yellow|Cyan|Purple|Almond|Teal|Blue|Raspberry|Green|Violet",copyValue:"Copy",copied:"Copied",noDocument:"No document yet",openInNewTab:"Open in a new tab",account:"Account",share:"Percentage",addAccount:"Add an account",sharesOff:"The shares add up to {n}, not 100%",untaxed:"Untaxed amount",paidOn:"Paid on {date}",amountDue:"Amount due",paymentOf:"Payment of {amount}",journal:"Journal",memo:"Memo",openPayment:"Open",addProperty:"Add a property",propertyName:"Property name",propertyType:"Kind",propertyTypes:"Text|Long text|Whole number|Number|Yes or no|Date",add:"Add",cancel:"Cancel",loading:"Loading\u2026"},tt={en:oc,...as};function ti(e,t){let n=e.ownerDocument,r=n.defaultView,i=typeof t.showPopover=="function";i&&t.setAttribute("popover","manual");let o=!1,a="",s=0;function d(){let v=e.getBoundingClientRect(),m=n.documentElement.clientWidth,S=n.documentElement.clientHeight,[g,p]=[S-v.bottom-10,v.top-10],b=g<160&&p>g;Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",minWidth:`${Math.min(Math.max(v.width,224),m-16)}px`,maxWidth:`${Math.max(v.width,Math.min(448,m-16))}px`,maxHeight:`${Math.max(96,Math.min(240,b?p:g))}px`}),a=`${v.left},${v.top},${v.width},${m},${S}`;let h=t.offsetWidth,x=r?.getComputedStyle(e).direction==="rtl",L=Math.max(8,Math.min(x?v.right-h:v.left,m-h-8));Object.assign(t.style,{left:`${L}px`,top:`${b?v.top-2-t.offsetHeight:v.bottom+2}px`})}let l=()=>{if(o){if(!e.isConnected)return c.hide();d()}},f=()=>{if(!o)return;let v=e.getBoundingClientRect();`${v.left},${v.top},${v.width},${n.documentElement.clientWidth},${n.documentElement.clientHeight}`!==a&&l(),s=r?.requestAnimationFrame(f)??0},c={show(){t.hidden=!1,i&&!t.matches(":popover-open")&&t.showPopover(),d(),o||(n.addEventListener("scroll",l,!0),r?.addEventListener("resize",l)),o=!0,!s&&r?.requestAnimationFrame&&(s=r.requestAnimationFrame(f))},place:l,hide(){i&&t.matches(":popover-open")&&t.hidePopover(),t.hidden=!0,o&&(n.removeEventListener("scroll",l,!0),r?.removeEventListener("resize",l)),s&&r?.cancelAnimationFrame(s),s=0,o=!1}};return c}function Ee(e){return(t,n={},...r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}}var Oe=(e,t)=>e??tt[t??"en"]??tt.en,We=(e,t)=>e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n);function De(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function Rt(e,t){e.hidden!==t&&(e.hidden=t)}function ft(e,t){e.textContent!==t&&(e.textContent=t)}function Xe(e,t){De(e,"aria-invalid",String(t.invalid)),De(e,"aria-describedby",t.describedBy||null)}function ni(e){let t=e("div",{class:"fd-announce",role:"status","aria-live":"polite"});return{element:t,say(n){t.textContent="",t.textContent=n}}}var Vt=e=>e.closest("[dir]")?.getAttribute("dir")==="rtl";function nn(e,t,n,r,i=!0){let o=Ee(e)("button",{type:"button",class:"fd-choice-clear",hidden:""},t.clearSelection);o.addEventListener("click",n);let a=i&&r.options?.clear!==!1,s=!1;return{button:o,allow(d){s=a&&!d.required&&!d.readonly},show(d){Rt(o,!(s&&d))}}}function ri(e,t){let n=e("span"),r=e("button",{type:"button",class:"fd-button fd-button-link"},t.removeFile),i=e("button",{type:"button",class:"fd-button fd-button-link"},t.keep),o=e("div",{class:"fd-file-confirm",hidden:""},n,r,i),a=d=>{},s=d=>{o.hidden=!0,a(d)};return r.addEventListener("click",()=>s(!0)),i.addEventListener("click",()=>s(!1)),o.addEventListener("keydown",d=>d.key==="Escape"&&s(!1)),{element:o,ask(d,l){n.textContent=d,a=l,o.hidden=!1,i.focus()}}}var ac=180,ii=8;function mr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function oi(e){let{document:t,id:n,labels:r}=e,i=`${n}-list`,o=t.createElement("input");Object.assign(o,{id:n,className:"fd-input fd-combo-input",autocomplete:"off"}),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls",i),o.placeholder=e.placeholder||r.search;let a=t.createElement("ul");a.id=i,a.className="fd-listbox",a.setAttribute("role","listbox"),a.hidden=!0;let s=t.createElement("div");s.className="fd-combo",s.append(o,a);let d=ti(o,a),l="",f=null,c="",v=new Map,m=!1,S=[],g=-1,p=0,b,h=!1;function x(){if(a.replaceChildren(),S.forEach((k,A)=>{let w=t.createElement("li");w.id=`${i}-${A}`,w.setAttribute("role","option"),w.setAttribute("aria-selected",String(A===g)),w.className=`fd-option${A===g?" fd-active":""}${k===f||v.has(k)?" fd-option-create":""}`,w.textContent=k.label,w.addEventListener("mousedown",j=>j.preventDefault()),w.addEventListener("click",()=>R(A)),a.append(w)}),!S.length){let k=t.createElement("li");k.className="fd-empty",k.textContent=r.noResults,a.append(k)}g>=0?o.setAttribute("aria-activedescendant",`${i}-${g}`):o.removeAttribute("aria-activedescendant"),d.place()}function L(){d.show(),o.setAttribute("aria-expanded","true")}function y(){clearTimeout(b),p++,d.hide(),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),g=-1}function R(k){let A=S[k];if(!A)return;let w=c;if(y(),m=!1,A===f&&e.create){e.create(w).then(e.pick,()=>{});return}let j=v.get(A);if(j){j(w).then(C=>C&&e.pick(C),()=>{});return}e.pick(A)}function E(k){clearTimeout(b);let A=++p;b=setTimeout(async()=>{let w=await e.search(k).catch(()=>[]);if(A!==p||t.activeElement!==o)return;let j=S[g],C=j&&j!==f&&!v.has(j)?j.id:void 0,O=e.exclude?.()??new Set,W=w.filter(B=>!O.has(B.id)),D=e.shown!==void 0&&W.length>e.shown;S=D?W.slice(0,e.shown):W;let I=k.trim();f=null,e.create&&I&&!w.some(B=>B.label.trim().toLowerCase()===I.toLowerCase())&&(c=I,f={id:"__create__",label:mr(r.createNamed,{name:I})},S=[...S,f]),c=I,v=new Map((e.more?.(I,D)??[]).map((B,H)=>[{id:`__more_${H}__`,label:B.label},B.act])),S=[...S,...v.keys()],g=C===void 0?-1:S.findIndex(B=>B.id===C),x(),L()},ac)}return o.addEventListener("input",()=>{m=!0,h||E(o.value)}),o.addEventListener("focus",()=>{h||E("")}),o.addEventListener("click",()=>{!h&&a.hidden&&t.activeElement===o&&E(m?o.value:"")}),o.addEventListener("keydown",k=>{if(!h)switch(k.key){case"ArrowDown":case"ArrowUp":{if(k.preventDefault(),a.hidden)return E(o.value);if(!S.length)return;g=(g+(k.key==="ArrowDown"?1:-1)+S.length)%S.length,x(),a.children[g]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!a.hidden&&g>=0&&(k.preventDefault(),R(g));return;case"Escape":a.hidden||k.preventDefault(),y(),m=!1,o.value=l;return;case"Backspace":o.value===""&&e.onEmptyBackspace?.();return}}),o.addEventListener("blur",()=>{p++,clearTimeout(b),y();let k=m&&o.value.trim()===""&&l!=="";m=!1,k?e.onCommitEmpty?.():o.value=l}),{element:s,input:o,setText(k){l=k,!m&&o.value!==k&&(o.value=k)},setReadonly(k){h=k,o.readOnly!==k&&(o.readOnly=k),k&&y()},close:y}}function _n(e,t,n){let r=n??e.createElement("span");if(r.className="fd-link-avatar",r.setAttribute("aria-hidden","true"),!t)return r.hidden=!0,r.replaceChildren(),r;if(r.hidden=!1,t.avatar){let i=e.createElement("img");i.src=t.avatar,i.alt="",r.replaceChildren(i)}else{let i=t.label.trim().split(/\s+/).filter(Boolean);r.textContent=(i.length>1?i[0][0]+i[i.length-1][0]:i[0]?.[0]??"").toUpperCase()}return r}function ai(e,t){let n=e.ownerDocument;e.replaceChildren(...t.split(`
|
|
4
|
-
`).map(r=>{let i=n.createElement("div");return i.textContent=r,i}))}function ss(e){let t=e.options??{};return{avatar:t.avatar===!0,details:t.details===!0,colors:t.colors===!0,opens:t.open!==!1}}function ds(e,t,n){return n.options?.create!==!1&&e.canCreate(t)?r=>e.quickCreate(t,r):void 0}var gr=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=tt.en,dialogs:s})=>{let d=n.type==="many2one"?n.relation:"",l=ss(r),f=l.opens&&!!s&&s.canOpen(d),c=!1,v=oi({document:o,id:i,labels:a,search:h=>e.search(t,h,ii+1),shown:ii,pick:h=>e.setValue(t,h),onCommitEmpty:()=>e.setValue(t,null),create:ds(e,t,r),placeholder:r.placeholder,more:(h,x)=>{if(!s||c)return[];let L=[];return h&&f&&r.options?.create!==!1&&L.push({label:a.createAndEdit,act:y=>{let R=e.createValues(t);return s.openRecord(d,{name:y,title:n.label,...Object.keys(R).length?{values:R}:{}})}}),x&&L.push({label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(y,R)=>e.search(t,y,R)})}),L}}),m=f?o.createElement("button"):null;m&&(m.type="button",m.className="fd-combo-open",m.textContent="\u2197",m.hidden=!0,m.addEventListener("click",async()=>{let h=e.getState().values[t];if(!h||!s)return;let x=await s.openRecord(d,{recordId:h.id,title:h.label});x&&x.label!==h.label&&e.setValue(t,x)}));let S=o.createElement("button");S.type="button",S.className="fd-combo-clear",S.textContent="\xD7",S.setAttribute("aria-label",mr(a.clear,{label:n.label})),S.addEventListener("click",()=>{e.setValue(t,null),v.input.focus()}),v.element.append(S,...m?[m]:[]);let g=l.avatar?_n(o,null):null;g&&(v.element.prepend(g),v.element.setAttribute("data-avatar",""));let p=l.details?o.createElement("div"):null,b=v.element;return p&&(p.className="fd-link-details",p.hidden=!0,b=o.createElement("div"),b.className="fd-link",b.append(v.element,p)),{element:b,focus:()=>v.input.focus(),update(h){let x=h.value;if(g&&_n(o,x,g),p){let L=x?.details?.trim()??"";Rt(p,!L),p.textContent!==L.replace(/\n/g,"")&&ai(p,L)}c=h.readonly,v.setText(x?.label??""),v.setReadonly(h.readonly),Rt(S,!x||h.readonly),m&&(Rt(m,!x),x&&De(m,"aria-label",mr(a.openNamed,{name:x.label}))),De(v.input,"aria-invalid",String(h.invalid)),De(v.input,"aria-required",String(h.required)),h.describedBy&&De(v.input,"aria-describedby",h.describedBy)}}},si=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=tt.en,dialogs:s})=>{let d=n.type==="many2many"?n.relation:"",l=ss(r),f=()=>e.getState().values[t]??[],c=o.createElement("div");c.className="fd-tags",c.setAttribute("role","group");let v=o.createElement("ul");v.className="fd-chips";let m=oi({document:o,id:i,labels:a,search:b=>e.search(t,b,ii+1+f().length),shown:ii,pick:b=>{f().some(h=>h.id===b.id)||e.setValue(t,[...f(),b]),m.input.value=""},exclude:()=>new Set(f().map(b=>b.id)),onEmptyBackspace:()=>{let b=f();b.length&&e.setValue(t,b.slice(0,-1))},create:ds(e,t,r),placeholder:r.placeholder,more:(b,h)=>s&&h?[{label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(x,L)=>e.search(t,x,L)})}]:[]}),S=l.opens&&s&&s.canOpen(d)?async b=>{let h=await s.openRecord(d,{recordId:b.id,title:b.label});h&&h.label!==b.label&&e.setValue(t,f().map(x=>x.id===b.id?h:x))}:void 0;c.append(v,m.element);let g=!1,p="";return{element:c,focus:()=>m.input.focus(),update(b){let h=b.value??[],x=JSON.stringify([b.readonly,h]);g=b.readonly,m.setReadonly(g),m.element.hidden=g,m.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&m.input.setAttribute("aria-describedby",b.describedBy),x!==p&&(p=x,ls(v,h,g,a,L=>e.setValue(t,f().filter(y=>y.id!==L.id)),S,l),m.setText(""))}}};function ls(e,t,n,r,i,o,a={}){let s=e.ownerDocument;e.replaceChildren(...t.map(d=>{let l=s.createElement("li");l.className="fd-chip",a.colors&&typeof d.color=="number"&&d.color>=1&&d.color<=11&&l.setAttribute("data-color",String(Math.trunc(d.color))),a.avatar&&l.append(_n(s,d));let f=s.createElement(o?"button":"span");if(f.className="fd-chip-label",f.textContent=d.label,o&&(f.type="button",f.setAttribute("aria-label",mr(r.openNamed,{name:d.label})),f.addEventListener("click",()=>o(d))),l.append(f),!n){let c=s.createElement("button");c.type="button",c.className="fd-chip-remove",c.textContent="\xD7",c.setAttribute("aria-label",mr(r.remove,{name:d.label})),c.addEventListener("click",()=>i(d)),l.append(c)}return l}))}var so=({form:e,name:t,node:n,id:r,document:i,labels:o=tt.en})=>{let a=n.options??{},s=typeof a.separator=="string"&&a.separator?a.separator:",",d=Array.isArray(a.suggestions)?a.suggestions.filter(b=>typeof b=="string"):[],l=b=>typeof b=="string"?b.split(s).map(h=>h.trim()).filter(h=>h!==""):[],f=()=>l(e.getState().values[t]),c=b=>e.setValue(t,b.length?b.join(`${s} `):null),v=b=>{let h=b.trim(),x=f();h&&!x.some(L=>L.toLowerCase()===h.toLowerCase())&&!(x.length>=a.max)&&c([...x,h])},m=i.createElement("div");m.className="fd-tags",m.setAttribute("role","group");let S=i.createElement("ul");S.className="fd-chips";let g=oi({document:i,id:r,labels:o,placeholder:n.placeholder,search:async b=>{let h=new Set(f().map(L=>L.toLowerCase())),x=b.trim().toLowerCase();return d.filter(L=>!h.has(L.toLowerCase())&&L.toLowerCase().includes(x)).map(L=>({id:L,label:L}))},pick:b=>{v(b.label),g.input.value=""},onEmptyBackspace:()=>{let b=f();b.length&&c(b.slice(0,-1))}});g.input.addEventListener("keydown",b=>{b.key!=="Enter"||b.defaultPrevented||g.input.value.trim()===""||(b.preventDefault(),v(g.input.value),g.input.value="",g.close())}),g.input.addEventListener("input",()=>{let b=g.input.value.split(s);if(!(b.length<2)){for(let h of b.slice(0,-1))v(h);g.input.value=b[b.length-1].trimStart()}}),g.input.addEventListener("change",()=>{g.input.value.trim()&&v(g.input.value)}),m.append(S,g.element);let p="";return{element:m,focus:()=>g.input.focus(),update(b){let h=l(b.value);g.setReadonly(b.readonly),g.element.hidden=b.readonly||h.length>=a.max,g.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&g.input.setAttribute("aria-describedby",b.describedBy);let x=JSON.stringify([b.readonly,h]);if(x===p)return;p=x;let L=i.activeElement===g.input;ls(S,h.map(y=>({id:y,label:y})),b.readonly,o,y=>c(f().filter(R=>R!==y.label))),g.setText(""),L&&g.element.hidden&&S.querySelector("li:last-child button")?.focus()}}},lo=({form:e,name:t,id:n,document:r})=>{let i=r.createElement("div");i.id=n,i.className="fd-choices fd-choices-checkbox",i.setAttribute("role","group");let o=[],a={readonly:!1,value:[]},s=()=>{let d=new Set(a.value.map(l=>l.id));for(let{record:l,box:f}of o)f.checked=d.has(l.id),f.disabled=a.readonly};return e.search(t,"",50).then(d=>{o=d.map((l,f)=>{let c=r.createElement("input");c.type="checkbox",c.id=`${n}-${f}`,c.addEventListener("change",()=>{let S=e.getState().values[t]??[];e.setValue(t,c.checked?[...S,l]:S.filter(g=>g.id!==l.id))});let v=r.createElement("label");v.className="fd-choice",v.htmlFor=c.id;let m=r.createElement("span");return m.textContent=l.label,v.append(c,m),i.append(v),{record:l,box:c}}),s()}),{element:i,focus:()=>i.querySelector("input")?.focus(),update(d){a={readonly:d.readonly,value:d.value??[]},s()}}},co=e=>{let{form:t,name:n,field:r,id:i,document:o,labels:a=tt.en}=e,s=r.type==="reference"?r.models:[],d=o.createElement("div");d.className="fd-reference";let l=o.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",r.label),l.append(o.createElement("option"));for(let v of s){let m=o.createElement("option");m.value=String(v.value),m.textContent=v.label,l.append(m)}let f="";l.addEventListener("change",()=>{f=l.value,t.setValue(n,null)});let c=oi({document:o,id:i,labels:a,placeholder:e.node.placeholder,search:v=>f?t.search(n,v,8,{model:f}):Promise.resolve([]),pick:v=>t.setValue(n,{model:f,id:v.id,label:v.label}),onCommitEmpty:()=>t.setValue(n,null)});return d.append(l,c.element),{element:d,focus:()=>f?c.input.focus():l.focus(),update(v){let m=v.value;m&&(f=m.model),l.value=f,l.disabled=v.readonly,c.setText(m?.label??""),c.setReadonly(v.readonly||!f)}}};var cs=e=>String(e).padStart(2,"0");function us(e){let t=Math.round(Math.abs(e)*60);return`${e<0&&t?"-":""}${cs(Math.floor(t/60))}:${cs(t%60)}`}function sc(e,t="en"){let n=Jt(e.trim(),t);if(n==="")return null;let r=/^(-?)(\d+):(\d{1,2})$/.exec(n);if(r){let i=Number(r[3]);if(i>59)return e.trim();let o=Number(r[2])+i/60;return r[1]?-o:o}if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))return Number(n);if(!/^-?(\d+:?)?\.?$/.test(n))return e.trim()}var fs=new Map;function ps(e,t,n){let r=`${e}:${t}:${n}`,i=fs.get(r);return i||(i=new Intl.NumberFormat(e,{style:n,numberingSystem:"latn",minimumFractionDigits:0,maximumFractionDigits:t}),fs.set(r,i)),i}function dc(e,t="en",n=2){return ps(t,n,"percent").format(e)}var ms=e=>e.type==="float"?e.digits?.[1]??2:2;function gs(e,t){let{form:n,name:r,node:i,id:o,document:a}=e,s=Ee(a),d=s("input",{id:o,type:"text",class:`fd-input fd-number-input ${t.className}`,autocomplete:"off",inputmode:t.inputMode});i.placeholder&&(d.placeholder=i.placeholder);let l=m=>typeof m=="number"?t.show(m):m==null?"":String(m);d.addEventListener("input",()=>{let m=t.parse(d.value);m!==void 0&&n.setValue(r,m)}),d.addEventListener("blur",()=>{d.value=l(n.getState().values[r])});let f=typeof i.options?.suffix=="string"&&i.options.suffix?i.options.suffix:t.unit,c=f?s("span",{class:"fd-unit",id:`${o}-unit2`},f):null,v=c?s("span",{class:"fd-number"},d,c):d;return c&&d.style.setProperty("padding-inline-end",`calc(var(--fd-pad-x) + ${f?.length??0}ch + 4px)`),{element:v,focus:()=>d.focus(),update(m){let S=a.activeElement===d,g=t.parse(d.value);if(!(S&&(g===void 0||g===m.value))){let p=l(m.value);d.value!==p&&(d.value=p)}d.readOnly!==m.readonly&&(d.readOnly=m.readonly),De(d,"aria-required",String(m.required)),Xe(d,{...m,describedBy:[m.describedBy,c?.id].filter(Boolean).join(" ")})}}}var hs=e=>{let t=e.locale??"en";return gs(e,{show:us,parse:n=>sc(n,t),inputMode:"text",className:"fd-duration"})},bs=e=>{let t=e.locale??"en",n=ms(e.field);return gs(e,{show:r=>ps(t,n,"decimal").format(Math.round(r*100*10**n)/10**n),parse(r){let i=Jt(r.trim(),t).replace(/%$/,"");if(i==="")return null;if(/^-?(\d+\.?\d*|\.\d+)$/.test(i))return Math.round(Number(i)/100*1e10)/1e10;if(!/^-?\.?$/.test(i))return r.trim()},unit:"%",inputMode:"decimal",className:"fd-percentage"})};function ys(e,t,n,r,i={}){if(typeof n!="number"||e!=="duration"&&e!=="percentage")return null;let o=typeof i.suffix=="string"&&i.suffix?` ${i.suffix}`:"";return e==="duration"?us(n)+o:dc(n,r,ms(t))}var fo=e=>typeof e?.model=="string"?e.model:"account.analytic.account";function vs(e){return[...new Set(uo(e).flatMap(([t])=>t.split(",")))].map(t=>/^\d+$/.test(t)?Number(t):t)}function di(e,t="en",n){let r=i=>`${gt(i,Number.isInteger(i)?0:2,t)}%`;return uo(e).map(([i,o])=>{let a=n?i.split(",").map(s=>n(s)??`#${s}`).join(" \xB7 "):"";return a?`${a} ${r(o)}`:r(o)}).join(n?", ":" \xB7 ")}var uo=e=>e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).map(([t,n])=>[t,typeof n=="number"?n:Number(n)||0]):[],xs=e=>{let{form:t,name:n,node:r,id:i,document:o,labels:a,locale:s="en"}=e,d=Ee(o),l=Oe(a,s),f=fo(r.options),c=new Map,v=j=>j.split(",").map(C=>c.get(C)??`#${C}`).join(" \xB7 "),m=j=>`${gt(j,Number.isInteger(j)?0:2,s)}%`,S=d("tbody"),g=d("td",{class:"fd-distribution-total"}),p=d("table",{class:"fd-lines-table fd-distribution-table"},d("thead",{},d("tr",{},d("th",{scope:"col"},l.account),d("th",{scope:"col",class:"fd-distribution-share"},l.share),d("th",{class:"fd-lines-tools"}))),S,d("tfoot",{},d("tr",{class:"fd-lines-totals"},d("td",{},l.total),g,d("td")))),b=d("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-distribution-add"},`+ ${l.addAccount}`),h=d("div",{class:"fd-warning fd-distribution-off",role:"status",hidden:""}),x=d("div",{id:i,class:"fd-distribution",role:"group"},d("div",{class:"fd-lines-scroll"},p),b,h),L=[],y=!1;function R(){let j={};for(let C of L)C.key&&(j[C.key]=C.share);t.setValue(n,L.some(C=>C.key)?j:null)}function E(j,C){let O=L.length,W=`${i}-${O}-${Math.random().toString(36).slice(2,7)}`,D={key:j,share:C},I={...t,getState:()=>({...t.getState(),values:{account:D.key?{id:D.key,label:v(D.key)}:null}}),setValue:(H,V)=>{let z=V;D.key=z?String(z.id):"",z&&c.set(String(z.id),z.label),R()},search:(H,V,z)=>t.search(n,V,z,{model:f}),canCreate:()=>!1},B={type:"many2one",label:l.account,relation:f};return D.account=gr({...e,form:I,name:"account",field:B,node:{type:"field",id:`${r.id}.account`,field:"account",options:{create:!1}},id:W}),D.input=d("input",{type:"text",class:"fd-input fd-number-input fd-share",inputmode:"decimal",autocomplete:"off","aria-label":l.share}),D.input.addEventListener("input",()=>{let H=Jt(D.input.value.trim(),s);/^\d+\.?\d*$|^\.\d+$/.test(H)&&(D.share=Number(H),R())}),D.remove=d("button",{type:"button",class:"fd-line-delete","aria-label":l.deleteLine},"\xD7"),D.remove.addEventListener("click",()=>{L=L.filter(H=>H!==D),D.account.destroy?.(),D.element.remove(),R(),w()}),D.element=d("tr",{},d("td",{},d("label",{class:"fd-sr-only",for:W},l.account),D.account.element),d("td",{class:"fd-distribution-share"},d("span",{class:"fd-number"},D.input,d("span",{class:"fd-unit"},"%"))),d("td",{class:"fd-lines-tools"},D.remove)),D}b.addEventListener("click",()=>{let j=Math.max(0,100-L.reduce((O,W)=>O+W.share,0)),C=E("",Math.round(j*100)/100);L.push(C),S.append(C.element),w(),C.account.focus()});let k="";function A(j){let C=[...new Set(j.flatMap(W=>W.split(",")))].filter(W=>!c.has(W));if(!C.length||C.join()===k)return;k=C.join();let O=C.map(W=>/^\d+$/.test(W)?Number(W):W);t.search(n,"",C.length,{model:f,ids:O}).then(W=>{for(let D of W)c.set(String(D.id),D.label);w()},()=>{})}function w(){let j=L.reduce((O,W)=>O+W.share,0);ft(g,m(Math.round(j*100)/100));let C=L.some(O=>O.key)&&Math.abs(j-100)>.001;ft(h,C?We(l.sharesOff,{n:m(Math.round(j*100)/100)}):""),Rt(h,!C),Rt(b,y);for(let O of L){O.account.update({value:O.key?{id:O.key,label:v(O.key)}:null,values:{},readonly:y,required:!1,invalid:!1});let W=gt(O.share,Number.isInteger(O.share)?0:2,s);o.activeElement!==O.input&&O.input.value!==W&&(O.input.value=W),O.input.readOnly=y,y?O.remove.remove():O.remove.isConnected||O.element.lastElementChild?.append(O.remove)}}return{element:x,focus:()=>(L[0]?.input??b).focus(),destroy:()=>L.forEach(j=>j.account.destroy?.()),update(j){y=j.readonly;let C=uo(j.value);if(!(C.length===L.filter(W=>W.key).length&&C.every(([W,D],I)=>L.filter(B=>B.key)[I]?.key===W&&L.filter(B=>B.key)[I]?.share===D))){for(let D of L)D.account.destroy?.();let W=L.filter(D=>!D.key);L=C.map(([D,I])=>E(D,I)),L.push(...W.map(D=>E("",D.share))),S.replaceChildren(...L.map(D=>D.element))}A(C.map(([W])=>W)),w()}}};function ws(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,n,r,i,o,a]=t;return new Date(Number(n),Number(r)-1,Number(i),Number(o??0),Number(a??0))}function Un(e,t,n){if(e.type!=="monetary")return null;if(e.currency)return e.currency;if(!e.currencyField)return null;let r=e.currencyField.startsWith("parent.")?n?.[e.currencyField.slice(7)]:t[e.currencyField];return r&&typeof r=="object"&&"label"in r?r.label||null:typeof r=="string"&&r?r:null}function St(e,t,n={},r="en",i){let o=(a,s)=>gt(a,s,r);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(a=>a.label).join(", ");case"selection":{let a=s=>e.options.find(d=>d.value===s)?.label??String(s);return Array.isArray(t)?t.map(a).join(", "):a(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let a=Un(e,n,i);return a?$n(Number(t),a,e.digits?.[1]??2,r):o(Number(t),e.digits?.[1]??2)}case"date":{let a=ws(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(a):String(t)}case"datetime":{let a=ws(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(a):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return[t].flat().map(a=>a.name??"").join(", ");case"boolean":return t?"\u2713":"";default:return String(t)}}function Tn(e,t,n={},r="en",i,o={}){return o.widget==="distribution"&&e.type==="json"?di(t,r):ys(o.widget,e,t,r,o.options)??St(e,t,n,r,i)}var lc=new Set(["progressbar","priority","dot","color","timer","badge"]);var cc="http://www.w3.org/2000/svg",ks={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"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l5 5"/>',filter:'<path d="M3 5h18l-7 8.5V20l-4-2v-4.5z"/>',layers:'<path d="M12 3l9 5-9 5-9-5z"/><path d="M3 13l9 5 9-5"/>',thumb:'<path d="M7 21V10l4-8c1.6 0 2.6 1.3 2.2 3L12.5 9H19a2 2 0 0 1 2 2.3l-1.3 7.6a2.5 2.5 0 0 1-2.5 2.1H7zM7 10H3v11h4"/>'};function wt(e,t,n){let r=t?n?.[t]??ks[t]:void 0;if(r===void 0)return null;let i=e.createElementNS(cc,"svg");for(let[o,a]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}))i.setAttribute(o,a);return i.innerHTML=r,i}function Kn(e,t,n,r,i){if(n.type==="one2many"&&n.sequenceField)return e.moveLine(t,r,i);let o=[...e.getState().values[t]??[]],a=o.findIndex(s=>s.key===r);a<0||i<0||i>=o.length||i===a||(o.splice(i,0,...o.splice(a,1)),e.setValue(t,o))}var fc=new Set(["integer","float","monetary"]),Ss=new Set(["boolean","integer","float","monetary","date","datetime"]),Ls=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function Rs(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function li(e,t,n){let r=()=>(e.getState().values[t]??[]).find(i=>i.key===n)?.values??{};return{...e,getState:()=>({...e.getState(),values:r()}),setValue:(i,o)=>e.updateLine(t,n,i,o),search:(i,o,a,s)=>e.searchLine(t,n,i,o,a,s),canCreate:i=>e.canCreateLine(t,i),quickCreate:(i,o)=>e.quickCreateLine(t,i,o,n),createValues:i=>e.createValues(i,{lines:t,key:n})}}function Fs(e,t){if(e.type!=="monetary"||!e.currencyField?.startsWith("parent."))return e;let{currencyField:n,...r}=e,i=Un(e,{},t);return i&&/^[A-Z]{3}$/.test(i)?{...r,currency:i}:r}async function ci(e,t,n,r,i,o){let a=e.page.fields[t],s=()=>e.getState().values[t]??[],d=v=>e.setValue(t,s().map(m=>m.key===r.key?{...m,values:{...m.values,...v}}:m));if(n.lineOpens==="record"&&r.id!==void 0&&i.canOpen(a.relation)){let v=await i.openRecord(a.relation,{recordId:r.id,title:a.label,withValues:!0}),m=Object.fromEntries(Object.entries(v?.values??{}).filter(([S])=>S in a.fields&&S!==a.sequenceField));Object.keys(m).length&&d(m);return}let l=Object.fromEntries(Object.entries(a.fields).filter(([v])=>v!==a.lineKinds?.field&&v!==a.sequenceField).map(([v,m])=>[v,Fs(m,e.getState().values)])),f=e.getState(),c=await i.editValues({title:a.label,fields:l,values:r.values,readonly:o,recompute:v=>e.previewLine(t,r.key,v),parent:{values:f.values,fields:e.page.fields,id:f.recordId},...n.lineForm?{layout:n.lineForm.children}:{}});c&&d(c)}var po=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=tt.en,locale:s,dialogs:d,widgets:l})=>{let f=n,c=f.lineKinds,v=Ee(o),m=r.options??{},S=Ls(m.min)??0,g=Ls(m.max)??1/0,p=X=>typeof m[X]=="string"&&m[X].trim()?m[X]:null,b=new Map,h=!!(r.cells||r.rowTones||r.rowBold!==void 0||r.rowButtons||r.lineDelete!==void 0),x=(r.columns??Object.keys(f.fields)).filter(X=>f.fields[X]&&f.fields[X].type!=="one2many"&&X!==c?.field&&X!==f.sequenceField&&r.optionalColumns?.[X]!=="hide"),L=o.createElement("div");L.className="fd-lines",L.id=i,r.cards&&(L.dataset.cards=r.cards),r.fit&&(L.dataset.fit=r.fit),L.setAttribute("role","group");let y=o.createElement("div");y.className="fd-lines-scroll";let R=o.createElement("table");R.className="fd-lines-table";let E=o.createElement("thead"),k=o.createElement("tr"),A=!!r.selectedButtons?.length,w=new Set,j=A?v("input",{type:"checkbox",class:"fd-checkbox fd-line-pick fd-line-pick-all","aria-label":a.chooseAllLines}):null;k.append(v("th",{class:"fd-lines-grip"},...j?[j]:[]));for(let X of x){let re=o.createElement("th");re.scope="col",re.dataset.column=X,re.textContent=f.fields[X].label;let me=r.cells?.[X]?.width;me?re.style.width=`${me}ch`:Ss.has(f.fields[X].type)&&(re.dataset.fit=f.fields[X].type),b.set(X,re),k.append(re)}let C=o.createElement("th");C.className="fd-lines-tools",k.append(C),E.append(k);let O=o.createElement("tbody");R.append(E,O);let W=(r.totals??[]).filter(X=>x.includes(X)),D=new Map,I=new Map;if(W.length){let X=o.createElement("tfoot"),re=o.createElement("tr");re.className="fd-lines-totals",re.append(o.createElement("td")),x.forEach((me,U)=>{let ie=o.createElement("td");ie.dataset.column=me,I.set(me,ie),W.includes(me)?D.set(me,ie):U===0&&(ie.textContent=a.total),re.append(ie)}),re.append(o.createElement("td")),X.append(re),R.append(X)}y.append(R);let B=o.createElement("div");B.className="fd-lines-adds";let H=(X,re,me)=>{let U=o.createElement("button");U.type="button",U.className="fd-button fd-button-link fd-lines-add",U.dataset.add=me,U.textContent=`+ ${X}`,U.addEventListener("click",()=>{$e=e.addLine(t,re);let ie=ke.get($e);ie&&(ie.cells[0]?.widget.focus(),$e=null)}),B.append(U)};H(p("addLabel")??a.addLine,{},"line"),c&&(H(p("addSectionLabel")??a.addSection,{[c.field]:c.section??"section"},"section"),H(p("addNoteLabel")??a.addNote,{[c.field]:c.note??"note"},"note"));let V=(r.controlButtons??[]).map(X=>{let re=wt(o,X.icon),me=v("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-lines-control","data-node":X.id},...re?[re]:[],X.label);return me.addEventListener("click",()=>{Ce(me,()=>e.runAction(X.id))}),B.append(me),{id:X.id,button:me}}),z=v("span",{class:"fd-lines-chosen-count",role:"status"}),T=(r.selectedButtons??[]).map(X=>{let re=wt(o,X.icon),me=v("button",{type:"button",class:`fd-button fd-button-${X.style??"secondary"} fd-lines-chosen-button`,"data-node":X.id},...re?[re]:[],X.label);return me.addEventListener("click",()=>{Ce(me,()=>e.runLinesAction(r.id,X.id,ne().filter(U=>w.has(U.key)).map(U=>U.key)))}),{id:X.id,button:me}}),te=A?v("div",{class:"fd-lines-chosen",hidden:""},z,...T.map(X=>X.button)):null,Y=p("emptyLabel"),K=Y?v("div",{class:"fd-help fd-lines-empty"},Y):null,q=ri(v,a),oe=v("div",{class:"fd-sr-only",role:"status"});L.append(...te?[te]:[],y,...K?[K]:[],B,q.element,oe);async function Ce(X,re){if(!X.hasAttribute("aria-busy")){X.setAttribute("aria-busy","true");try{await re()}finally{X.removeAttribute("aria-busy")}}}function Me(){if(!te||!j)return;let X=ne().filter(re=>!pt(f,re.values));for(let re of[...w])X.some(me=>me.key===re)||w.delete(re);te.hidden=ae||w.size===0,z.textContent=We(a.linesChosen,{n:w.size});for(let{id:re,button:me}of T)me.hidden=e.node(re).invisible;j.checked=X.length>0&&w.size===X.length,j.indeterminate=w.size>0&&w.size<X.length,j.disabled=ae||!X.length;for(let[re,me]of ke)me.pick&&(me.pick.checked=w.has(re),me.pick.disabled=ae)}j?.addEventListener("change",()=>{let X=ne().filter(re=>!pt(f,re.values));if(j.checked)for(let re of X)w.add(re.key);else w.clear();Me()});let ke=new Map,$e=null,ae=!1,he=null,ne=()=>e.getState().values[t]??[];for(let X=ne().length;X<S;X++)e.addLine(t);function Te(X,re){let me=ne().findIndex(Ae=>Ae.key===X);if(ae||re===me||re<0||re>=ne().length)return;let U=o.activeElement,ie=ne()[me].values[x[0]];Kn(e,t,f,X,re),U&&U!==o.activeElement&&U.focus(),oe.textContent=We(a.movedTo,{label:typeof ie=="string"&&ie.trim()?ie:We(a.lineN,{n:me+1}),n:re+1,total:ne().length})}function Pe(X,re,me){let U=[...O.children],ie=U.indexOf(X),Ae=U.filter(fe=>fe!==X),Re=X.getBoundingClientRect(),de=Ae.map(fe=>{let xe=fe.getBoundingClientRect();return xe.top+xe.height/2}),pe=ie,le=!1,ce=fe=>{fe.key==="Escape"&&(fe.preventDefault(),ge())};function ge(){for(let fe of U)fe.style.transform="";X.classList.remove("fd-line-lifted"),O.classList.remove("fd-lines-dragging"),o.removeEventListener("keydown",ce,!0),le=!1}return{follow(fe){let xe=fe-me;if(!le){if(Math.abs(xe)<4||ae)return;le=!0,X.classList.add("fd-line-lifted"),O.classList.add("fd-lines-dragging"),o.addEventListener("keydown",ce,!0)}X.style.transform=`translateY(${xe}px)`;let it=Re.top+Re.height/2+xe;pe=de.filter(lt=>lt<it).length,Ae.forEach((lt,vt)=>{lt.style.transform=vt>=ie&&vt<pe?`translateY(${-Re.height}px)`:vt<ie&&vt>=pe?`translateY(${Re.height}px)`:""})},drop(){let fe=le&&pe!==ie;ge(),fe&&Te(re,pe)},settle:ge}}O.addEventListener("keydown",X=>{let re=X.target.closest("tr")?.dataset.line;!re||!X.altKey||X.key!=="ArrowUp"&&X.key!=="ArrowDown"||(X.preventDefault(),Te(re,ne().findIndex(me=>me.key===re)+(X.key==="ArrowUp"?-1:1)))});function we(X,re,me,U,ie=1){let Ae=`${i}-${re.key}-${me}`,Re=pt(f,re.values)?void 0:r.cells?.[me],de=Re?.badge?{widget:"badge"}:Re?.widget?{widget:Re.widget,...Re.options?{options:Re.options}:{}}:Re?.options?{options:Re.options}:{},pe={type:"field",id:`${r.id}.${re.key}.${me}`,field:me,...de},le=Ot({form:li(e,t,re.key),name:me,field:U,node:pe,id:Ae,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ce=o.createElement("td");ce.colSpan=ie,ce.dataset.column=me,Ss.has(U.type)&&(ce.dataset.fit=U.type),ce.dataset.label=U.label;let ge=o.createElement("label");ge.className="fd-sr-only",ge.htmlFor=Ae,ge.textContent=U.label;let fe=o.createElement("div");return fe.className="fd-cell-error",fe.hidden=!0,ce.append(ge,le.element,fe),X.append(ce),{name:me,def:U,widget:le,error:fe,td:ce}}function Ve(X){let re=o.createElement("tr");re.dataset.line=X.key;let me=pt(f,X.values);me&&(re.className=`fd-line-${me}`);let U=v("span",{class:"fd-line-grip fd-rank-grip","aria-hidden":"true"}),ie=null;U.addEventListener("pointerdown",ge=>{ae||ge.button!==0||(ge.preventDefault(),U.setPointerCapture?.(ge.pointerId),ie=Pe(re,X.key,ge.clientY))}),U.addEventListener("pointermove",ge=>ie?.follow(ge.clientY)),U.addEventListener("pointerup",()=>{ie?.drop(),ie=null}),U.addEventListener("pointercancel",()=>{ie?.settle(),ie=null});let Ae=A&&!me?v("input",{type:"checkbox",class:"fd-checkbox fd-line-pick"}):null;Ae?.addEventListener("change",()=>{Ae.checked?w.add(X.key):w.delete(X.key),Me()}),re.append(v("td",{class:"fd-lines-grip"},...Ae?[v("span",{class:"fd-line-lead"},Ae,U)]:[U]));let Re=me&&c?[we(re,X,c.text,Rs(f.fields[c.text],me),x.length)]:x.map(ge=>we(re,X,ge,f.fields[ge])),de=o.createElement("td");de.className="fd-lines-tools";let pe=o.createElement("button");pe.type="button",pe.className="fd-line-delete",pe.textContent="\xD7",pe.setAttribute("aria-label",a.deleteLine),pe.addEventListener("click",()=>{let ge=ne().findIndex(xe=>xe.key===X.key),fe=ne()[ge]?.values??{};if(m.confirmDelete!==!0||Re.every(xe=>Kt(xe.def,fe[xe.name])||fe[xe.name]===!1))return e.removeLine(t,X.key);q.ask(We(a.removeAsk,{name:We(a.lineN,{n:ge+1})}),xe=>{xe&&e.removeLine(t,X.key);let it=ne(),lt=it[xe?Math.min(ge,it.length-1):ge];(lt?ke.get(lt.key)?.remove:B.querySelector("button"))?.focus()})});let le=new Map;for(let ge of me?[]:r.rowButtons??[]){let fe=wt(o,ge.icon),xe=v("button",{type:"button",class:`fd-button fd-button-link fd-line-button${fe?" fd-line-button-icon":""}`,"data-row-button":ge.id,"aria-label":ge.label,title:ge.label});xe.append(fe??ge.label),xe.addEventListener("click",async()=>{if(!xe.hasAttribute("aria-busy")){xe.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,ge.id,X.key)}finally{xe.removeAttribute("aria-busy")}}}),le.set(ge.id,xe),de.append(xe)}let ce=m.copy===!0&&!me?v("button",{type:"button",class:"fd-line-copy"},"\u29C9"):null;if(ce?.addEventListener("click",()=>{let ge=ne(),fe=ge.findIndex(lt=>lt.key===X.key);if(ae||fe<0||ge.length>=g)return;let xe={...ge[fe].values};f.sequenceField&&delete xe[f.sequenceField];let it=e.addLine(t,xe);Kn(e,t,f,it,fe+1),ke.get(it)?.cells[0]?.widget.focus()}),ce&&de.append(ce),(r.lineOpens||r.lineForm)&&d&&!me){let ge=v("button",{type:"button",class:"fd-line-open","aria-label":a.openLine,title:a.openLine},"\u2197");ge.addEventListener("click",()=>{let fe=ne().find(xe=>xe.key===X.key);fe&&ci(e,t,r,fe,d,ae)}),de.append(ge)}return de.append(pe),re.append(de),{element:re,kind:me,cells:Re,remove:pe,grip:U,buttons:le,pick:Ae,copy:ce}}return{element:L,focus:()=>(O.querySelector("input, select, textarea")??B.querySelector("button"))?.focus(),update(X){ae=X.readonly;let re=X.value??[];B.hidden=ae||re.length>=g,ae&&(q.element.hidden=!0),K&&(K.hidden=re.length>0);let me=e.getState().errors,U=new Set(h?x.filter(de=>e.columnHidden(r.id,de)):[]);for(let[de,pe]of b)pe.hidden=U.has(de);for(let[de,pe]of I)pe.hidden=U.has(de);let ie=re.map(de=>de.key).join(" "),Ae=ie!==he;he=ie;for(let[de,pe]of Ae?b:new Map){if(r.cells?.[de]?.width)continue;let le=f.fields[de];if(pe.dataset.fit){if(!fc.has(le.type))continue;let fe=re.reduce((xe,it)=>pt(f,it.values)?xe:Math.max(xe,Tn(le,it.values[de],it.values,s).length),0);pe.style.setProperty("--fd-fit-need",`${fe+4}ch`);continue}let ce=re.reduce((fe,xe)=>pt(f,xe.values)?fe:Math.max(fe,Tn(le,xe.values[de],xe.values,s).length),0),ge=le.type==="many2one"?5:0;pe.style.width=`${Math.min(Math.max(ce,Math.min(le.label.length,10),6),32)+4+ge}ch`,pe.style.minWidth=`${Math.min(Math.max(ce,6),14)+4}ch`}let Re=new Set(re.map(de=>de.key));for(let[de,pe]of ke)Re.has(de)||(pe.element.remove(),ke.delete(de));re.forEach((de,pe)=>{let le=ke.get(de.key);le&&le.kind!==pt(f,de.values)&&(le.element.remove(),le=void 0),le||(le=Ve(de),ke.set(de.key,le)),O.children[pe]!==le.element&&O.insertBefore(le.element,O.children[pe]??null);let ce=h?e.lineState(r.id,de.key):null;le.remove.hidden=ae||re.length<=S||ce?.deletable===!1,le.grip.hidden=ae;let ge=We(a.lineN,{n:pe+1});le.pick?.setAttribute("aria-label",We(a.chooseLine,{name:ge})),le.copy&&(le.copy.setAttribute("aria-label",We(a.copy,{name:ge})),le.copy.title=le.copy.getAttribute("aria-label"),le.copy.hidden=ae||re.length>=g),ae?le.remove.remove():le.remove.isConnected||le.element.lastElementChild?.append(le.remove),Es(le.element,"tone",ce?.tone),le.element.classList.toggle("fd-line-bold",!!ce?.bold);for(let[fe,xe]of le.buttons)xe.hidden=!ce?.buttons[fe];le.kind&&(le.cells[0].td.colSpan=x.length-U.size);for(let fe of le.cells){let xe=me[`${t}.${de.key}.${fe.name}`],it=le.kind?void 0:ce?.cells[fe.name];le.kind||(fe.td.hidden=U.has(fe.name)),fe.widget.element.hidden=!!it?.invisible,Es(fe.td,"tone",it?.tone),fe.td.classList.toggle("fd-cell-bold",!!it?.bold),fe.error.hidden=!xe,fe.error.textContent=xe??"",fe.widget.update({value:de.values[fe.name],values:de.values,parent:X.values,readonly:ae||fe.def.readonly===!0||fe.def.compute!==void 0||!!it?.readonly,required:fe.def.required===!0||!!it?.required,invalid:!!xe})}});for(let[de,pe]of D){let le=re.filter(ce=>!pt(f,ce.values)).reduce((ce,ge)=>ce+Number(ge.values[de]??0),0);pe.textContent=Tn(f.fields[de],le,re[0]?.values??{},s,X.values,r.cells?.[de])}for(let{id:de,button:pe}of V)pe.hidden=e.node(de).invisible;Me(),$e&&ke.has($e)&&(ke.get($e)?.cells[0]?.widget.focus(),$e=null)}}};function Es(e,t,n){n?e.dataset[t]=n:delete e.dataset[t]}var uc='a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function Gt(e,t){if(t.key!=="Tab")return;let n=[...e.querySelectorAll(uc)].filter(a=>!a.closest("[hidden], [inert]")&&!a.disabled);if(!n.length)return;let r=n[0],i=n[n.length-1],o=e.ownerDocument.activeElement;(t.shiftKey?o===r||!e.contains(o):o===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}var ui=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result??"");t({name:e.name,type:e.type,size:e.size,data:i.slice(i.indexOf(",")+1)})},r.onerror=()=>n(r.error),r.readAsDataURL(e)}),$s=e=>(/\.(\w{1,5})$/.exec(e)?.[1]??"").toUpperCase();function fi(e){let t=`${e.type} ${$s(e.name)}`.toLowerCase();return/^image\//.test(t)?"image":/pdf/.test(t)?"pdf":/sheet|excel|csv|xlsx?$|ods$/.test(t)?"sheet":/zip|rar|7z|tar|gz/.test(t)?"zip":/word|opendocument|^text|docx?$|odt$|rtf$/.test(t)?"doc":"file"}var pc=e=>/^text\/|json|xml|csv/.test(e.type),mo=e=>e.data?`data:${e.type};base64,${e.data}`:e.url??"",Ts=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),As=(e,t)=>e("span",{class:"fd-file-icon","data-kind":fi(t),"aria-hidden":"true"},$s(t.name)||"?"),mc={cards:'<path d="M3 3h8v8H3zM13 3h8v8h-8zM3 15h8M13 15h8M3 19h5M13 19h5"/>',thumbnails:'<path d="M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"/>'},gc=(e,t)=>e("span",{class:"fd-file-name",dir:"auto",title:t},e("span",{},t.slice(0,-9)),t.slice(-9));function hc(e,t){let n=t.length/2,[r,i]=[Math.round(n),n/2];for(let a=t.indexOf(" ");a>=0;a=t.indexOf(" ",a+1))Math.abs(a+1-n)<i&&([r,i]=[a+1,Math.abs(a+1-n)]);let o=/^\P{L}*[\p{sc=Arabic}\p{sc=Hebrew}]/u.test(t);return e("span",{class:"fd-file-name",dir:o?"rtl":"ltr",title:t},e("span",{},t.slice(0,r)),e("span",{dir:o?"ltr":"rtl"},e("bdi",{},t.slice(r))))}function Ms(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d="en",preferences:l})=>{let f=r,c=Oe(s,d),v=Et[d]??Et.en,m=Ee(a),S=f.multiple===!0,g=S?f.maxFiles??1/0:1,p=e==="image",b=String(i.options?.files??(p?"thumbnails":"list")),h=b==="thumbnails"?b:"cards",x=i.options?.filesSwitch===!0,L=`${t.page.id}.${i.id}.files`,y=x?l?.get(L):null,R=i.options?.camera,E=f.type==="binary"?f.accept:["image/*"],k=m("div"),A=m("input",{type:"file",id:o,class:"fd-sr-only",accept:E?.join(","),capture:R?R==="user"?"user":"environment":void 0});A.multiple=S;let w=[!p&&E?cr(E,v.or):"",f.maxSize?Je(S?c.upToEach:c.upToSize,{size:en(f.maxSize)}):"",S&&f.maxFiles?Je(c.upToFiles,{max:f.maxFiles}):""].filter(Boolean),j=m("label",{class:"fd-file-pick",for:o},m("span",{class:"fd-button"},S?p?c.addPhotos:c.addFiles:p?c.uploadImage:c.upload),m("span",{class:"fd-help"},S?c.dropThem:c.dropHere)),C=m("span",{class:"fd-help fd-file-limits"},w.join(" \xB7 ")),O=S?m("span",{class:"fd-help fd-file-count"}):null,W=m("ul",{class:"fd-files",role:"list"}),D=m("button",{type:"button",class:"fd-button fd-button-link"},c.replace);D.addEventListener("click",()=>A.click());let I=ri(m,c),B=m("div",{class:"fd-help fd-file-note",role:"status"}),H=(ae,he)=>{let ne=m("button",{type:"button","data-view":ae},wt(a,ae,mc),he);return ne.addEventListener("click",()=>(Y(ae),l?.set(L,ae))),ne},V=x?m("div",{class:"fd-file-views",role:"group","aria-label":c.showFilesAs},H("list",c.asList),H(h,h==="cards"?c.asCards:c.asThumbnails)):null,z=O||V?m("div",{class:"fd-file-bar"},...O?[O]:[],...V?[V]:[]):null,T=[A,j,...w.length?[C]:[]];k.append(...z?[z]:[],W,D,I.element,B);let te=b;function Y(ae){te=ae;let he=ae!=="list";k.className=`fd-file fd-file-${e} fd-files-${ae==="thumbnails"?"thumbs":ae}`,j.classList.toggle("fd-image-pick",he),he?W.after(...T):(z??W).before(...T),V?.querySelectorAll("button").forEach(ne=>ne.setAttribute("aria-pressed",String(ne.dataset.view===ae))),ke()}let K=!1,q=[],oe,Ce=ae=>B.replaceChildren(...ae.map(he=>m("div",{},he))),Me=async ae=>{if(K||!ae.length)return;let he=[],ne=[],Te=0;for(let we of ae){let Ve=lr(f,we,v)??(S&&[...q,...he].some(X=>X.name===we.name)?Je(c.alreadyAdded,{name:we.name}):void 0);Ve?ne.push(Ve):(S?q.length:0)+he.length<g?he.push(we):Te++}if(Te&&S&&ne.push(Je(c.tooMany,{max:g,n:Te})),Ce(ne),!he.length)return;let Pe=await Promise.all(he.map(ui));t.setValue(n,S?[...q,...Pe]:Pe[0])};A.addEventListener("change",()=>{Me([...A.files??[]]),A.value=""}),k.addEventListener("dragover",ae=>{K||(ae.preventDefault(),k.classList.add("fd-dragging"))}),k.addEventListener("dragleave",()=>k.classList.remove("fd-dragging")),k.addEventListener("drop",ae=>{ae.preventDefault(),k.classList.remove("fd-dragging"),Me([...ae.dataTransfer?.files??[]])}),W.addEventListener("click",ae=>{let he=ae.target.closest("button"),ne=Number(he?.dataset.at);if(he){if(he.classList.contains("fd-file-open"))return $e(ne,he);I.ask(Je(c.removeAsk,{name:q[ne].name}),Te=>{let Pe=q[ne];Te&&(t.setValue(n,S?q.filter((we,Ve)=>Ve!==ne):null),Ce([Je(c.removed,{name:Pe.name})])),(W.querySelectorAll(".fd-file-remove")[Te?Math.min(ne,q.length-1):ne]??(j.hidden?D:A)).focus()})}});function ke(){W.replaceChildren(...q.map((ae,he)=>m("li",{class:"fd-file-item"},m("button",{type:"button",class:"fd-file-open","data-at":String(he),"aria-haspopup":"dialog","aria-label":`${ae.name}, ${en(ae.size)}`},...[fi(ae)==="image"&&mo(ae)?m("img",{class:"fd-file-thumb",src:mo(ae),alt:""}):As(m,ae)].map(ne=>te==="cards"?m("span",{class:"fd-file-picture"},ne):ne),(te==="cards"?hc:gc)(m,ae.name),m("span",{class:"fd-file-size"},en(ae.size))),...K?[]:[m("button",{type:"button",class:"fd-file-remove","data-at":String(he),"aria-label":Je(c.remove,{name:ae.name})},"\xD7")])))}Y(y==="list"||y===h?y:b===h?b:"list");function $e(ae,he){let ne=q,Te="",Pe=m("h2",{id:`${o}-view`,class:"fd-form-dialog-title"}),we=m("span",{class:"fd-help"}),Ve=(le,ce,ge)=>{let fe=m("button",{type:"button",class:"fd-button fd-file-step","aria-label":ce},ge);return fe.hidden=ne.length<2,fe.addEventListener("click",()=>de(ae+le)),fe},X=m("a",{class:"fd-button"},c.download),re=m("button",{type:"button",class:"fd-dialog-close","aria-label":c.close},"\xD7"),me=m("div",{class:"fd-file-viewer-body"}),U=m("div",{class:"fd-form-dialog fd-file-viewer",role:"dialog","aria-modal":"true","aria-labelledby":Pe.id,tabindex:"-1"},m("div",{class:"fd-form-dialog-head"},Pe,we,Ve(-1,c.previous,"\u2039"),Ve(1,c.next,"\u203A"),X,re),me),ie=m("div",{class:"fd-dialog-backdrop"},U),Ae=()=>Te.startsWith("blob:")&&URL.revokeObjectURL(Te),Re=le=>m("div",{class:"fd-file-none"},As(m,le),m("strong",{},le.name),en(le.size),m("p",{},c.noPreview));function de(le){ae=(le+ne.length)%ne.length;let ce=ne[ae];Ae();let ge=ce.data?Ts(ce.data):null;Te=ge?URL.createObjectURL(new Blob([ge],{type:ce.type})):ce.url??"",Pe.textContent=ce.name,we.replaceChildren(m("span",{class:"fd-file-size"},en(ce.size)),ne.length>1?` \xB7 ${Je(c.fileAt,{n:ae+1,total:ne.length})}`:""),X.href=Te,X.download=ce.name;let fe=fi(ce);if(fe==="image")return me.replaceChildren(m("img",{src:Te,alt:ce.name}));if(fe==="pdf")return me.replaceChildren(m("iframe",{src:Te,title:ce.name}));if(!pc(ce))return me.replaceChildren(Re(ce));let xe=m("pre",{tabindex:"0"});me.replaceChildren(xe),(ge?Promise.resolve(new TextDecoder().decode(ge.subarray(0,2e5))):fetch(Te).then(it=>it.text())).then(it=>xe.textContent=it.slice(0,2e5),()=>xe.replaceWith(Re(ce)))}let pe=()=>{Ae(),ie.remove(),(he.isConnected?he:W.querySelectorAll(".fd-file-open")[ae])?.focus()};re.addEventListener("click",pe),ie.addEventListener("click",le=>le.target===ie&&pe()),U.addEventListener("keydown",le=>{let ce={ArrowLeft:-1,ArrowRight:1}[le.key];le.key==="Escape"?pe():ce&&ne.length>1&&le.target.tagName!=="PRE"?de(ae+(Vt(k)?-ce:ce)):Gt(U,le)}),de(ae),(k.closest(".fd-form")??a.body).append(ie),U.focus()}return{element:k,focus:()=>(W.querySelector("button")??(j.hidden?D:A)).focus(),update(ae){K=ae.readonly;let he=ae.value;q=Array.isArray(he)?he:he?[he]:[];let ne=q.length>=g;Rt(j,ne||K),Rt(C,K),A.disabled=K,A.hidden=j.hidden,Rt(D,S||!q.length||K),z&&Rt(z,!q.length),O&&ft(O,q.length?S&&f.maxFiles?Je(c.fileCountOf,{n:q.length,max:f.maxFiles}):q.length===1?c.oneFile:Je(c.fileCount,{n:q.length}):""),Xe(A,ae),!(oe===he&&W.dataset.readonly===String(K))&&(oe=he,W.dataset.readonly=String(K),ke())}}}}var hr=Ms("binary"),go=Ms("image");function ho(e,t){let n=fi(t);if(n!=="image"&&n!=="pdf")return null;let r=t.data?URL.createObjectURL(new Blob([Ts(t.data)],{type:t.type})):mo(t),i=e.createElement(n==="image"?"img":"iframe");return i.setAttribute("src",n==="pdf"?`${r}#view=FitH&navpanes=0`:r),i.setAttribute(n==="image"?"alt":"title",t.name),i.setAttribute("data-kind",n),{element:i,url:r,free:()=>{r.startsWith("blob:")&&URL.revokeObjectURL(r)}}}var Ns=new Map;function Cs(e,t){let n=Ns.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),Ns.set(t,n)),n.format(e/100)}var br=e=>{let{field:t,node:n,id:r,document:i,locale:o="en"}=e,a=n.options??{},s=(h,x)=>{let L=a[h]??t[h];return typeof L=="number"?L:x},d=s("min",0),l=s("max",100),f=typeof a.maxField=="string"?a.maxField:null,c=typeof a.color=="string"?a.color:"auto",v=a.showPercent!==!1,m=i.createElement("div");m.className="fd-progressbar",m.setAttribute("role","progressbar");let S=i.createElement("div");S.className="fd-progressbar-fill";let g=i.createElement("span");g.className="fd-progressbar-text",m.append(S,g);let p=null,b=m;return a.editable===!0?(p=Ot({...e,node:{...n,widget:void 0}}),m.setAttribute("aria-hidden","true"),b=i.createElement("div"),b.className="fd-progressbar-edit",b.append(m,p.element)):(m.id=r,m.setAttribute("aria-label",n.label??t.label)),{element:b,focus:()=>p?.focus(),update(h){let x=typeof h.value=="number"?h.value:0,L=f?Number(h.values[f]??0):l,y=L>d?Math.min(100,Math.max(0,(x-d)/(L-d)*100)):0,R=Math.round(y*10)/10;S.style.width=`${R}%`,m.setAttribute("aria-valuenow",String(x)),m.setAttribute("aria-valuemin",String(d)),m.setAttribute("aria-valuemax",String(L)),m.setAttribute("aria-valuetext",Cs(y,o)),g.textContent=v?Cs(y,o):"",m.dataset.tone=c!=="auto"?c:y<30?"danger":y<70?"warning":"success",p?.update(h)}}};function Os(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var yr=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options??{},a=f=>typeof o[f]=="string"?o[f]:"",s=f=>typeof o[f]=="string"?o[f]:null,d=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:f,values:c}){if(f==null||f===""){l.textContent="";return}let v=d!==null&&typeof f=="number"?gt(f,d,i):pi(f,e),m=s("prefixField"),S=s("suffixField"),g=m?Os(c[m]):a("prefix"),p=S?Os(c[S]):a("suffix");l.textContent=[g,v,p].filter(b=>b!=="").join(" ")}}};function bc(e,t){let[n,r]=e>=86400?[e/86400,"day"]:e>=3600?[e/3600,"hour"]:[Math.max(1,e/60),"minute"];try{return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"narrow",maximumFractionDigits:0,numberingSystem:"latn"}).format(Math.floor(n))}catch{return`${Math.floor(n)}${r[0]}`}}var mi=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=tt.en,locale:s="en"})=>{let d=r.options??{},l=d.clickable===!0,f=Array.isArray(d.visibleStates)?d.visibleStates:null,c=typeof d.durationsField=="string"?d.durationsField:null,v=d.fold===!0,m=d.saves===!0,S=o.createElement("ol");S.className="fd-statusbar",S.id=i,S.setAttribute("aria-label",n.label);let g=O=>O&&typeof O=="object"&&"id"in O?`id:${String(O.id)}`:`v:${String(O)}`,p=O=>O&&typeof O=="object"&&"id"in O?String(O.id):String(O),b=n.type==="selection"?n.options.map(O=>({key:g(O.value),label:O.label,value:O.value,folded:!1})):[],h=[],x=O=>O.forEach(W=>"any"in W?x(W.any):"all"in W?x(W.all):W.valueFrom&&h.push(W.valueFrom));n.type==="many2one"&&x(n.filter??[]);let L=n.type==="selection"?"":null,y=0,R={value:void 0,readonly:!1,durations:{}},E="",k=!1,A=O=>{e.setValue(t,O.value),m&&e.settled().then(()=>e.save())};function w(){let{value:O,readonly:W,durations:D}=R,I=S.contains(o.activeElement)?o.activeElement.dataset.key:void 0,B=O==null?null:g(O),H=b.filter(q=>!f||f.some(oe=>g(oe)===q.key)||q.key===B);B&&!H.some(q=>q.key===B)&&O&&typeof O=="object"&&(H=[...H,{key:B,label:O.label,value:O,folded:!1}]);let V=v?H.filter(q=>q.folded&&q.key!==B):[];H=H.filter(q=>!V.includes(q));let z=H.map(q=>c?Number(D[p(q.value)]??0):0),T=JSON.stringify([H.map(q=>[q.key,q.label]),V.map(q=>q.key),z,B,W,k]);if(T===E)return;E=T;let te=H.map((q,oe)=>{let Ce=o.createElement("span");Ce.textContent=q.label;let Me=o.createElement(l?"button":"span");if(Me instanceof HTMLButtonElement&&(Me.type="button",Me.disabled=W,Me.dataset.key=q.key,Me.addEventListener("click",()=>A(q))),Me.append(Ce),z[oe]>0){let $e=o.createElement("small");$e.className="fd-step-time",$e.textContent=bc(z[oe],s),Me.title=a.timeInStep.replace("{time}",$e.textContent),Me.append($e)}q.key===B&&Me.setAttribute("aria-current","step");let ke=o.createElement("li");return ke.append(Me),ke});V.length&&te.push(j(V,W)),S.replaceChildren(...te);let Y=S.querySelector(".fd-step-menu:not([hidden])"),K=Y?.previousElementSibling;if(Y&&K){let q=K.getBoundingClientRect(),oe=o.defaultView,Ce=getComputedStyle(S).direction==="rtl";Y.style.top=`${q.bottom+4}px`,Ce?Y.style.left=`${q.left}px`:Y.style.right=`${Math.max(0,(oe?.innerWidth??q.right)-q.right)}px`}I&&[...S.querySelectorAll("button")].find(q=>q.dataset.key===I)?.focus()}function j(O,W){let D=o.createElement("li");D.className="fd-step-more";let I=o.createElement("button");I.type="button",I.dataset.key="more",I.setAttribute("aria-haspopup","menu"),I.setAttribute("aria-expanded",String(k)),I.setAttribute("aria-label",a.moreSteps),I.title=a.moreSteps;let B=o.createElement("span");B.textContent="\u22EF",B.setAttribute("aria-hidden","true"),I.append(B);let H=o.createElement("div");H.className="fd-step-menu",H.setAttribute("role","menu"),H.hidden=!k;for(let V of O){let z=o.createElement("button");z.type="button",z.setAttribute("role","menuitem"),z.textContent=V.label,z.disabled=W||!l,z.addEventListener("click",()=>{k=!1,A(V),w()}),H.append(z)}return I.addEventListener("click",()=>{k=!k,w(),k&&S.querySelector(".fd-step-menu button:not([disabled])")?.focus()}),H.addEventListener("keydown",V=>{V.key==="Escape"&&(V.stopPropagation(),k=!1,w(),S.querySelector(".fd-step-more > button")?.focus())}),D.append(I,H),D}let C=O=>{k&&!S.contains(O.target)&&(k=!1,w())};return o.addEventListener("pointerdown",C),o.addEventListener("scroll",C,!0),{element:S,focus:()=>S.querySelector("button:not([disabled])")?.focus(),destroy(){o.removeEventListener("pointerdown",C),o.removeEventListener("scroll",C,!0)},update(O){let W=c?O.values?.[c]:null;R={value:O.value,readonly:O.readonly,durations:W&&typeof W=="object"&&!Array.isArray(W)?W:{}},w();let D=n.type==="selection"?"":JSON.stringify(h.map(I=>O.values?.[I]??null));if(L!==D){L=D;let I=++y;e.search(t,"",20).then(B=>{I===y&&(b=B.map(H=>({key:g(H),label:H.label,value:H,folded:H.folded===!0})),w())}).catch(()=>{})}}}};function Vs(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 Ps=e=>String(e).padStart(2,"0"),bo=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Yt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function gi(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 yo(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 hi(e,t,n){let{form:r,name:i,id:o,document:a,locale:s="en"}=t,d=t.labels??tt.en,l=s==="en"?"en-GB":s,f=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),c=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),v=new Intl.DateTimeFormat(l,{weekday:"short"}),m=new Intl.DateTimeFormat(l,{weekday:"long"}),S=a.createElement("button");S.type="button",S.className="fd-calendar-button";let g="http://www.w3.org/2000/svg",p=a.createElementNS(g,"svg");p.setAttribute("viewBox","0 0 16 16"),p.setAttribute("aria-hidden","true");for(let[H,V]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let z=a.createElementNS(g,H);for(let[T,te]of Object.entries(V))z.setAttribute(T,te);p.append(z)}S.append(p),S.setAttribute("aria-label",d.chooseDate),S.setAttribute("aria-haspopup","dialog"),S.setAttribute("aria-expanded","false"),S.setAttribute("aria-controls",`${o}-calendar`);let b=a.createElement("div");b.className="fd-calendar",b.id=`${o}-calendar`,b.setAttribute("role","dialog"),b.hidden=!0;let h=a.createElement("div");h.className="fd-calendar-head";let x=a.createElement("button");x.type="button",x.textContent="\u2039",x.setAttribute("aria-label",d.previousMonth);let L=a.createElement("span");L.className="fd-calendar-title",L.setAttribute("aria-live","polite");let y=a.createElement("button");y.type="button",y.textContent="\u203A",y.setAttribute("aria-label",d.nextMonth),h.append(x,L,y);let R=a.createElement("table");R.className="fd-calendar-grid",R.setAttribute("role","grid"),b.append(h,R);let E=a.createElement("span");E.className="fd-date-pick",E.append(e.element,S,b);let k=new Date,A=!1;function w(H){if(n==="date")r.setValue(i,`${H.getFullYear()}-${Ps(H.getMonth()+1)}-${Ps(H.getDate())}`);else{let V=yo("datetime",r.getState().values[i]),z=new Date(H.getFullYear(),H.getMonth(),H.getDate(),V?.getHours()??0,V?.getMinutes()??0);r.setValue(i,z.toISOString())}I(),E.dispatchEvent(new CustomEvent("fd-picked",{bubbles:!0,detail:{value:r.getState().values[i]}}))}function j(H){let V=yo(n,r.getState().values[i]),z=new Date,T=f.format(k);L.textContent=T,b.setAttribute("aria-label",T);let te=new Date(k.getFullYear(),k.getMonth(),1),Y=Yt(te,-((te.getDay()+6)%7)),K=a.createElement("tr"),q=a.createElement("th");q.scope="col",q.textContent=d.weekShort,q.setAttribute("abbr",d.week),K.append(q);for(let Me=0;Me<7;Me++){let ke=Yt(Y,Me),$e=a.createElement("th");$e.scope="col",$e.textContent=v.format(ke).replace(/\.$/,""),$e.setAttribute("abbr",m.format(ke)),K.append($e)}let oe=a.createElement("thead");oe.append(K);let Ce=a.createElement("tbody");for(let Me=Y;Me<=new Date(k.getFullYear(),k.getMonth()+1,0);Me=Yt(Me,7)){let ke=a.createElement("tr"),$e=a.createElement("th");$e.scope="row",$e.className="fd-week",$e.textContent=String(Vs(Me)),ke.append($e);for(let ae=0;ae<7;ae++){let he=Yt(Me,ae),ne=a.createElement("td"),Te=a.createElement("button");Te.type="button",Te.textContent=String(he.getDate()),Te.setAttribute("aria-label",c.format(he)),Te.tabIndex=bo(he,k)?0:-1,he.getMonth()!==k.getMonth()&&Te.classList.add("fd-outside"),V&&bo(he,V)&&Te.setAttribute("aria-selected","true"),bo(he,z)&&Te.setAttribute("aria-current","date"),Te.disabled=A,Te.addEventListener("click",()=>w(he)),Te.addEventListener("keydown",Pe=>O(Pe,he)),ne.append(Te),ke.append(ne)}Ce.append(ke)}R.replaceChildren(oe,Ce),H&&R.querySelector('button[tabindex="0"]')?.focus()}function C(H){k=H,j(!0)}function O(H,V){let z={ArrowLeft:()=>Yt(V,-1),ArrowRight:()=>Yt(V,1),ArrowUp:()=>Yt(V,-7),ArrowDown:()=>Yt(V,7),PageUp:()=>gi(V,-1),PageDown:()=>gi(V,1),Home:()=>Yt(V,-((V.getDay()+6)%7)),End:()=>Yt(V,6-(V.getDay()+6)%7)};z[H.key]?(H.preventDefault(),C(z[H.key]())):(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),w(V))}function W(){k=yo(n,r.getState().values[i])??new Date,b.hidden=!1,S.setAttribute("aria-expanded","true"),j(!0),D()}function D(){b.style.translate="";let H=b.getBoundingClientRect(),V=a.documentElement.clientWidth;if(!H.width||!V)return;let z=H.left<8?8-H.left:H.right>V-8?Math.max(8-H.left,V-8-H.right):0;z&&(b.style.translate=`${Math.round(z)}px 0`)}function I(){b.hidden||(b.hidden=!0,S.setAttribute("aria-expanded","false"),S.focus())}S.addEventListener("click",()=>b.hidden?W():I()),x.addEventListener("click",()=>{k=gi(k,-1),j(!1)}),y.addEventListener("click",()=>{k=gi(k,1),j(!1)}),b.addEventListener("keydown",H=>{H.key==="Escape"&&(H.preventDefault(),H.stopPropagation(),I())});let B=H=>{!b.hidden&&!E.contains(H.target)&&(b.hidden=!0,S.setAttribute("aria-expanded","false"))};return a.addEventListener("mousedown",B),{element:E,focus:()=>e.focus(),update(H){A=H.readonly,S.hidden=H.readonly,H.readonly&&(b.hidden=!0),e.update(H)},destroy(){a.removeEventListener("mousedown",B),e.destroy?.()}}}var yc=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},Is=e=>e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^(\d)/,"p_$1")||"property";function vc(e,t){let n=yc(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 xc=["char","text","integer","float","boolean","date"],vo=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d}=e,l=Ee(a),f=Oe(s,d),c=r.type==="properties"?r.definitions:void 0,v=r.type==="properties"&&!!r.definitionsFrom,m=()=>{let B=t.getState().values[n];return B&&typeof B=="object"&&!Array.isArray(B)?B:{}},S={...t,getState:()=>({...t.getState(),values:m()}),setValue:(B,H)=>t.setValue(n,{...m(),[B]:H})},g=l("div",{class:"fd-properties-list"}),p=l("div",{class:"fd-properties",role:"group"},g);i.options?.columns===2&&(p.dataset.columns="2");let h=l("div",{class:"fd-help",role:"status",hidden:""});p.append(h);let x=v&&i.options?.add===!0,L=l("button",{type:"button",class:"fd-button fd-button-link fd-property-add",hidden:""},`+ ${f.addProperty}`),y=l("input",{type:"text",class:"fd-input","aria-label":f.propertyName,placeholder:f.propertyName,autocomplete:"off"}),R=f.propertyTypes.split("|"),E=l("select",{class:"fd-input fd-select","aria-label":f.propertyType},...xc.map((B,H)=>l("option",{value:B},R[H]??B))),k=l("button",{type:"button",class:"fd-button fd-button-primary"},f.add),A=l("button",{type:"button",class:"fd-button"},f.cancel),w=l("div",{class:"fd-property-new",hidden:""},y,E,k,A);x&&p.append(L,w);let j=null,C=()=>{w.hidden=!0,L.hidden=!1};L.addEventListener("click",()=>{w.hidden=!1,L.hidden=!0,y.value="",E.value="char",y.focus()}),A.addEventListener("click",()=>{C(),L.focus()});let O=()=>{let B=y.value.trim();if(!B)return y.focus();let H=new Set(W.map(z=>z.definition.name)),V=Is(B);for(let z=2;H.has(V);z++)V=`${Is(B)}_${z}`;j=V,C(),t.addDefinition(n,{name:V,label:B,type:E.value})};k.addEventListener("click",O),w.addEventListener("keydown",B=>{B.key==="Enter"&&B.target===y?(B.preventDefault(),O()):B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),C(),L.focus())});let W=[],D="";function I(B){for(let H of W)H.widget.destroy?.();W=B.map(H=>{let V=`${o}-${H.name}`,z={type:H.type,label:H.label,...H.options?{options:H.options}:{}},T={type:"field",id:`${i.id}.${H.name}`,field:H.name},te=Ot({...e,form:S,name:H.name,field:z,node:T,id:V});return{definition:H,widget:te}}),g.replaceChildren(...W.map(({definition:H,widget:V})=>{let z=a.createElement("div");z.className="fd-property",z.dataset.type=H.type;let T=a.createElement("label");return T.htmlFor=`${o}-${H.name}`,T.textContent=H.label,z.append(T,V.element),z}))}return v&&!t.getState().definitions[n]&&t.loadDefinitions(n),{element:p,focus:()=>(W[0]?.widget??{focus:()=>L.focus()}).focus(),destroy:()=>W.forEach(B=>B.widget.destroy?.()),update(B){let H=m(),V=v?t.getState().definitions[n]:void 0,z=v?V?.definitions??[]:c??Object.keys(H).map(te=>vc(te,H[te])),T=JSON.stringify(z);T!==D&&(D=T,I(z));for(let{definition:te,widget:Y}of W)Y.update({value:H[te.name]??null,values:H,readonly:B.readonly,required:!1,invalid:!1});h.textContent=V?.loading&&!V.definitions?f.loading:V?.error??"",h.hidden=!h.textContent,x&&(B.readonly&&C(),L.hidden=B.readonly||!w.hidden),j&&W.some(te=>te.definition.name===j)&&(W.find(te=>te.definition.name===j)?.widget.focus(),j=null)}}};function bi(e){let t=0,n=()=>{throw t},r=()=>{for(;t<e.length&&`
|
|
1
|
+
/*! Fieldia 0.19.1 · MIT · https://fieldia.dev */
|
|
2
|
+
"use strict";var Fieldia=(()=>{var Ur=Object.defineProperty;var zl=Object.getOwnPropertyDescriptor;var Bl=Object.getOwnPropertyNames;var ql=Object.prototype.hasOwnProperty;var _l=(e,t,n)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ul=(e,t)=>{for(var n in t)Ur(e,n,{get:t[n],enumerable:!0})},Kl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bl(t))!ql.call(e,i)&&i!==n&&Ur(e,i,{get:()=>t[i],enumerable:!(r=zl(t,i))||r.enumerable});return e};var Jl=e=>Kl(Ur({},"__esModule",{value:!0}),e);var Ht=(e,t,n)=>_l(e,typeof t!="symbol"?t+"":t,n);var ju={};Ul(ju,{ADDRESS_PARTS:()=>ci,BROWSER_HOTKEYS:()=>ti,DEFAULT_LABELS:()=>fl,DRAWN_IN_CELLS:()=>Qc,FIELDIA_CSS:()=>sl,FIELD_NAME:()=>_n,FIELD_TYPES:()=>Kr,FIRST_FIELD:()=>Or,FORMAT_VERSION:()=>Jr,FORM_WIDTHS:()=>Jf,HOTKEY:()=>Ja,ICONS:()=>id,MESSAGES:()=>Tt,PART_LOOKS:()=>Pa,SKINS:()=>Ca,THEMES:()=>Na,THEME_SKINS:()=>ga,TOKEN_NAMES:()=>ha,VERSION:()=>Wu,VIEWER_LABELS:()=>Vt,WIDGET_LABELS:()=>Ze,accentShades:()=>Pr,addLanguage:()=>Qi,applyLook:()=>jn,binaryWidget:()=>Ar,browserPreferences:()=>ca,builtInWidgets:()=>Jd,cardLineFields:()=>Ma,cardLines:()=>uo,cardPart:()=>fo,cellText:()=>In,charTagsWidget:()=>Co,checkPage:()=>yr,checkValue:()=>wn,compileModifier:()=>et,contrast:()=>Wn,countriesIn:()=>Xo,createForm:()=>pi,createMemoryDataSource:()=>bs,createWidget:()=>Ot,currencyOf:()=>Qn,dayOf:()=>yn,describeTypes:()=>wr,detailLines:()=>xi,displayValue:()=>At,distributionIds:()=>td,distributionModel:()=>Io,distributionWords:()=>Si,drawIcon:()=>kt,emptyValue:()=>Cn,evaluateModifier:()=>Za,expressionContext:()=>vn,facetsToFilter:()=>kr,fileProblem:()=>vr,fileShown:()=>zo,fill:()=>Ye,fillValues:()=>Ka,focusField:()=>Gi,formatBytes:()=>on,formatMoney:()=>Vn,formatNumber:()=>pt,formatPlain:()=>No,groupByFields:()=>di,hostScheduler:()=>Sr,hotkeyWords:()=>Kn,htmlWidget:()=>Ko,imageWidget:()=>Ho,initialValues:()=>xn,installListStyles:()=>Xi,installStyles:()=>la,isEmpty:()=>Kt,isModifierValid:()=>Qa,isRightToLeft:()=>Mn,isoWeek:()=>yd,jsonProblem:()=>Ci,jsonWidget:()=>Jo,keepTabIn:()=>Gt,kindTextField:()=>dd,labelPlace:()=>Dr,labelWidget:()=>Tr,lineForm:()=>Li,lineKind:()=>gt,linesWidget:()=>Wo,linkAddress:()=>wd,linkAvatar:()=>Zn,linkCheckboxesWidget:()=>Po,localizePage:()=>xr,many2oneWidget:()=>Rr,matchesFilter:()=>Xn,memoryPreferences:()=>Yf,moneyReads:()=>ki,mountViewer:()=>Vr,normalizeNumber:()=>Jt,onelineRuns:()=>Vl,openFormDialog:()=>ir,openFormPanel:()=>ba,openLineDialog:()=>Ei,openSearchDialog:()=>ya,ownCurrency:()=>ld,pageWords:()=>Xa,planSection:()=>Zi,progressbarWidget:()=>$r,propertiesWidget:()=>_o,quietHint:()=>Ol,readFile:()=>Fi,readText:()=>ua,readsAsText:()=>fa,referenceWidget:()=>Oo,rolesAllow:()=>Nn,sanitizeHtml:()=>Uo,saveProblemOf:()=>oi,saveRefused:()=>fs,scoreOf:()=>cs,shortNumber:()=>Vo,skinFor:()=>Ln,splitValues:()=>Un,statusbarWidget:()=>$i,suggestions:()=>si,summary:()=>Ai,tagsWidget:()=>vi,translatePage:()=>Gn,ungroup:()=>Lr,valuesIn:()=>ei,wait:()=>li,wearTokens:()=>En,wearsQuiet:()=>Ti,wideColumns:()=>gn,withCalendar:()=>Ni,writeMoney:()=>wi});var _n=/^[A-Za-z_][A-Za-z0-9_]*$/,Kr=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json","matrix"];function gn(e){return typeof e=="object"?e.wide:e??1}function fo(e){return typeof e=="string"?{field:e}:e}function uo(e){return(e?.fields??[]).map(t=>(Array.isArray(t)?t:[t]).map(fo))}function Ma(e){return[...new Set(uo(e).flatMap(t=>t.map(n=>n.field)))]}var Jr="0.1";var Na=["material","fluent","apple","bootstrap","shadcn","ant","odoo","google-forms"],Ca=["underline","outlined","quiet"];var Pa={inputs:["background","border","corners","textSize","accent"],choices:["accent","background","border","corners","textSize"],groups:["background","border","corners"],buttons:["accent","corners","textSize"],tables:["background","border","textSize"]};var po=["id","user","editing","context"],mo=["id","name","roles"];var wt=e=>typeof e=="number"&&Number.isFinite(e);function nn(e){return Number.isFinite(e)?Number(e.toPrecision(15)):null}function Va(e,t,n){if(e==="+"&&(typeof t=="string"||typeof n=="string")){let r=Oa(t),i=Oa(n);return r===null||i===null?null:r+i}if(!wt(t)||!wt(n))return null;switch(e){case"+":return nn(t+n);case"-":return nn(t-n);case"*":return nn(t*n);case"/":return nn(t/n);case"%":return nn(t-n*Math.floor(t/n));default:return null}}function Oa(e){return e==null?"":typeof e=="string"?e:wt(e)?String(e):null}function Ia(e){return wt(e)?nn(-e):null}function Ct(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function hr(e,t){let n=10**Math.trunc(t),r=Number((Math.abs(e)*n).toPrecision(15));return nn(Math.sign(e)*Math.round(r)/n)}function hn(e){let t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Da(e){let t=e.args[0];return(t.type==="Identifier"?e.env.lines?.(t.name):void 0)??e.value(t)}function Wa(e,t,n,r){let i=e[t];return i&&!(i.type==="Literal"&&typeof i.value=="string")?`${n} takes a condition, in quotes, on the lines: ${r}`:void 0}function ja(e,t,n){let r=e.args[n];if(r?.type!=="Literal"||typeof r.value!="string")return t;let i=r.value;return t.filter(o=>o!==null&&typeof o=="object"&&e.holds(i,o))}function Ha(e){if(typeof e!="string")return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]))/864e5:null}function za(e,t){let n=e.args.flatMap(i=>{let o=e.value(i);return Array.isArray(o)?o:[o]}).filter(i=>i!=null);return!n.length||!n.every(wt)&&!n.every(i=>typeof i=="string")?null:n.reduce((i,o)=>(t?o<i:o>i)?o:i)}var br=new Map([["round",{takes:[1,2],call({args:e,value:t}){let n=t(e[0]),r=e.length>1?t(e[1]):0;return wt(n)&&wt(r)?hr(n,r):null}}],["abs",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return wt(n)?Math.abs(n):null}}],["min",{takes:[1,1/0],call:e=>za(e,!0)}],["max",{takes:[1,1/0],call:e=>za(e,!1)}],["len",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return n==null?0:typeof n=="string"||Array.isArray(n)?n.length:null}}],["today",{takes:[0,0],call:({env:e})=>e.today?.()??hn(new Date)}],["sum",{takes:[1,3],check(e){let t=e[1];return t&&!(t.type==="Literal"&&typeof t.value=="string")?"sum takes the name of a field, in quotes, after the lines: sum(lines, 'subtotal')":Wa(e,2,"sum",`sum(lines, 'amount', "state == 'done'")`)},call(e){let t=Da(e);if(t==null)return 0;if(!Array.isArray(t))return null;let n=e.args[1]?.type==="Literal"?e.args[1].value:void 0,r=0;for(let i of ja(e,t,2)){let o=n===void 0?i:i?.[n];wt(o)&&(r+=o)}return nn(r)}}],["count",{takes:[1,2],check:e=>Wa(e,1,"count",`count(lines, "state == 'done'")`),call(e){let t=Da(e);return t==null?0:Array.isArray(t)?ja(e,t,1).length:null}}],["days",{takes:[2,2],call({args:e,value:t}){let n=Ha(t(e[0])),r=Ha(t(e[1]));return n===null||r===null?null:r-n}}],["if",{takes:[3,3],call:({args:e,value:t})=>Ct(t(e[0]))?t(e[1]):t(e[2])}]]);function Ba(e,[t,n]){return n===0?`${e} takes no values`:t===n?`${e} takes ${t} value${t===1?"":"s"}`:n===1/0?`${e} takes ${t} or more values`:`${e} takes ${t} or ${n} values`}var go=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]),Gl=new Set(["+","-","*","/","%"]);function rn(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,i=0;for(;;){if(r.lastIndex=i,r.exec(e),i=r.lastIndex,i>=e.length)return t;n.lastIndex=i;let o=n.exec(e);if(!o)throw new Error(`Unexpected "${e[i]}" at character ${i+1} of: ${e}`);t.push({type:Yl(o[0]),value:o[0],position:t.length}),i=n.lastIndex}}function Yl(e){let t=e.toLowerCase().trim();return go.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":Gl.has(e)?"ARITHMETIC":e===","?"COMMA":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var zt=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 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.parseSum(),n=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...n)){let r=this.previous().value,i=this.parseSum();return{type:"BinaryOp",operator:r.toLowerCase(),left:t,right:i}}return t}parseSum(){let t=this.parseProduct();for(;this.match("ARITHMETIC","+","-");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseProduct()};return t}parseProduct(){let t=this.parseUnary();for(;this.match("ARITHMETIC","*","/","%");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseUnary()};return t}parseUnary(){return this.match("ARITHMETIC","-")?{type:"UnaryOp",operator:"-",operand:this.parseUnary()}:this.parseValue()}parseTuple(t){let n=[t];for(;this.match("COMMA")&&!(this.peek()?.type==="PAREN"&&this.peek()?.value===")");)n.push(this.parseOr());return this.consume("PAREN",")",'Expected "," or ")" in a tuple'),{type:"Literal",value:n.map(Xl)}}parseCall(t){let n=br.get(t);if(!n)throw new Error(`no function "${t}": the functions are ${[...br.keys()].join(", ")}`);this.advance();let r=[];if(!this.match("PAREN",")")){do r.push(this.parseOr());while(this.match("COMMA"));this.consume("PAREN",")",`Expected "," or ")" after a value of ${t}(\u2026)`)}let[i,o]=n.takes;if(r.length<i||r.length>o)throw new Error(Ba(t,n.takes));let a=n.check?.(r);if(a)throw new Error(a);return{type:"Call",name:t,args:r}}parseValue(){if(this.match("PAREN","(")){if(this.match("PAREN",")"))return{type:"Literal",value:[]};let t=this.parseOr();return this.check("COMMA")?this.parseTuple(t):(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:go.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:Zl(t.value)}}if(this.check("IDENTIFIER")){let t=this.advance(),n=this.peek();return n?.type==="PAREN"&&n.value==="("?this.parseCall(t.value):{type:"Identifier",name:t.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(i=>i.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(i=>i.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 i=this.peek();if(i&&i.value===n)return this.advance()}throw new Error(r)}};function Xl(e){if(e.type==="Literal")return e.value;if(e.type==="UnaryOp"&&e.operator==="-"&&e.operand.type==="Literal"&&typeof e.operand.value=="number")return-e.operand.value;throw new Error("a tuple holds values such as 'draft' or 3, not expressions")}function Zl(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let n=[],r="",i=!1,o="";for(let a=0;a<t.length;a++){let s=t[a];(s==="'"||s==='"')&&(a===0||t[a-1]!=="\\")&&(i?s===o&&(i=!1,o=""):(i=!0,o=s)),s===","&&!i?(n.push(qa(r.trim())),r=""):r+=s}return r.trim()&&n.push(qa(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function qa(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 Pt(e,t,n={}){switch(e.type){case"BinaryOp":return Ql(e,t,n);case"UnaryOp":return ec(e,t,n);case"Call":return tc(e,t,n);case"Literal":return e.value;case"Identifier":return rc(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Ql(e,t,n){let r=e.operator.toLowerCase();if(r==="and"||r==="or"){let s=Gr(Pt(e.left,t,n));return Ct(s)===(r==="or")?s:Gr(Pt(e.right,t,n))}let i=Gr(Pt(e.left,t,n)),o=Gr(Pt(e.right,t,n)),a=i!==null&&o!==null;switch(r){case"==":return i===o;case"!=":case"<>":return i!==o;case"<":return a&&i<o;case">":return a&&i>o;case"<=":return a&&i<=o;case">=":return a&&i>=o;case"in":return Array.isArray(o)&&o.includes(i);case"not in":return Array.isArray(o)&&!o.includes(i);case"+":case"-":case"*":case"/":case"%":return Va(r,i,o);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function ec(e,t,n){let r=Pt(e.operand,t,n);switch(e.operator.toLowerCase()){case"not":return!Ct(r);case"-":return Ia(r);default:throw new Error(`Unknown unary operator: ${e.operator}`)}}function tc(e,t,n){let r=br.get(e.name);if(!r)throw new Error(`Unknown function: ${e.name}`);return r.call({args:e.args,value:i=>Pt(i,t,n),env:n,holds:(i,o)=>Ct(Pt(nc(i),o,n))})}var _a=new Map;function nc(e){let t=_a.get(e);return t||_a.set(e,t=new zt(rn(e)).parse()),t}function Gr(e){return e===void 0?null:e}function rc(e,t){let n=t.split("."),r=e;for(let i of n){if(r==null)return;r=r[i]}return r}function bn(e,t){switch(t(e),e.type){case"BinaryOp":bn(e.left,t),bn(e.right,t);return;case"UnaryOp":bn(e.operand,t);return;case"Call":for(let n of e.args)bn(n,t);return;default:return}}function Yr(e){let t=[];return bn(e,n=>{if(n.type!=="Identifier")return;let r=n.name.split(".")[0];t.includes(r)||t.push(r)}),t}function Xr(e){let t=[];return bn(e,n=>{n.type==="Identifier"&&!t.includes(n.name)&&t.push(n.name)}),t}function Zr(e){let t=[];return bn(e,n=>{if(n.type!=="Call"||n.name!=="count"&&n.name!=="sum")return;let[r,i]=n.name==="count"?[n.args[0],n.args[1]]:[n.args[0],n.args[2]];r.type==="Identifier"&&i?.type==="Literal"&&typeof i.value=="string"&&t.push({lines:r.name,condition:i.value})}),t}function Ua(e){let t=[];return bn(e,n=>{if(n.type!=="Call"||n.name!=="sum")return;let[r,i]=n.args;r.type==="Identifier"&&i?.type==="Literal"&&t.push({lines:r.name,field:i.value})}),t}function et(e){if(typeof e!="string"){let n=e===!0;return{source:e,fields:[],paths:[],wheres:[],evaluate:()=>n}}let t=new zt(rn(e)).parse();return{source:e,fields:Yr(t),paths:Xr(t),wheres:Zr(t),evaluate(n,r){try{return Ct(Pt(t,n,r))}catch{return!1}}}}function Bt(e){let t=new zt(rn(e)).parse();return{source:e,fields:Yr(t),paths:Xr(t),wheres:Zr(t),sums:Ua(t),evaluate(n,r={}){try{return Pt(t,n,r)??null}catch{return null}}}}function Qr(e){let t=[],n=[],r=new Set,i=[],o=a=>{if(r.has(a))return;let s=i.indexOf(a);if(s!==-1){n.push([...i.slice(s),a]);return}i.push(a);for(let d of e.get(a)??[])e.has(d)&&o(d);i.pop(),r.add(a),t.push(a)};for(let a of e.keys())o(a);return{order:t,cycles:n}}var ho=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function ei(e){return[...e.matchAll(ho)].map(t=>t[1])}function Ka(e,t){return e.replace(ho,(n,r)=>t(r))}function Un(e){let t=[],n=0;for(let r of e.matchAll(ho))r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:"",field:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({text:e.slice(n)}),t}var Ja=/^(shift\+)?[a-z0-9]$/,ti=["d","e","f"],Kn=e=>`Alt+${e.startsWith("shift+")?"Shift+":""}${e.slice(-1).toUpperCase()}`;var xt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ga=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),bo="text, numbers, yes or no, dates, choices and json can",ic=e=>{let t=e.map(n=>`"${n}"`);return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`},ni=class e{constructor(t,n){Ht(this,"page",t);Ht(this,"line",n);Ht(this,"issues",[]);Ht(this,"ids",new Map);Ht(this,"formNames",new Map);Ht(this,"places",new Set);Ht(this,"goingTo",[])}run(){return this.checkFields(this.page.fields,"fields",this.line?.name,this.line?.parent),this.walkRoot(this.page.layout,"layout"),this.page.on&&this.checkEvents(this.page.on,"on"),this.checkGoingTo(),this.issues}checkGoingTo(){for(let{target:t,path:n}of this.goingTo)this.places.has(t)||this.report(n,`no tab or wizard step "${t}" on this page`)}here(){return this.line?{fields:this.page.fields,lines:this.line.name,parent:this.line.parent}:{fields:this.page.fields}}checkLineForm(t,n,r){let i=t.lineForm?.children;if(!Array.isArray(i))return this.report(`${r}.lineForm`,'a line\u2019s form holds its parts: { "children": [...] }');let o={...this.page,fields:n.fields,layout:{type:"sections",id:`${t.id}#line`,children:i},on:void 0},a=new e(o,{name:t.field,parent:this.page.fields});a.walkChildren(i,`${r}.lineForm`),a.checkGoingTo(),this.issues.push(...a.issues)}checkEvents(t,n){for(let r of["open","beforeSave","afterSave"]){let i=t[r];i&&this.checkSteps(i,`${n}.${r}`)}for(let[r,i]of Object.entries(t.change??{}))this.formNames.has(r)||this.need(r,`${n}.change.${r}`),this.checkSteps(i,`${n}.change.${r}`);for(let[r,i]of Object.entries(t.show??{}))this.goingTo.push({target:r,path:`${n}.show.${r}`}),this.checkSteps(i,`${n}.show.${r}`)}checkPress(t,n){!t.steps&&t.action===void 0&&this.report(n,"a button needs steps, an action, or both");let r="hotkey"in t?t.hotkey:void 0;typeof r=="string"&&ti.includes(r.replace("shift+",""))&&this.report(`${n}.hotkey`,`${Kn(r)} is the browser\u2019s own: pick another key`),t.steps&&this.checkSteps(t.steps,`${n}.steps`)}checkSteps(t,n){let r=this.here();t.forEach((i,o)=>{let a=`${n}[${o}]`;switch(this.checkModifiers(i,a,["when"]),i.do){case"set":{let s=this.need(i.field,`${a}.field`);s&&!Ga.has(s.type)&&this.report(`${a}.field`,`a ${s.type} cannot be set from an expression; ${bo}`),this.checkExpression(i.value,`${a}.value`,r);return}case"clear":this.need(i.field,`${a}.field`);return;case"addLine":{let s=this.need(i.field,`${a}.field`);if(s&&s.type!=="one2many")return this.report(`${a}.field`,`"${i.field}" is a ${s.type}; a line is added to a one2many`);for(let[d,l]of Object.entries(i.values??{}))s?.type==="one2many"&&!xt(s.fields,d)&&this.report(`${a}.values.${d}`,`"${d}" is not a field of the lines of "${i.field}"`),this.checkExpression(l,`${a}.values.${d}`,r);return}case"check":i.fields?.forEach((s,d)=>this.need(s,`${a}.fields[${d}]`));return;case"goTo":this.goingTo.push({target:i.target,path:`${a}.target`});return;case"open":i.page===this.page.id&&i.as==="page"&&this.report(`${a}.page`,"a page cannot open itself in its own place"),i.side!==void 0&&i.as!=="panel"&&this.report(`${a}.side`,`a side is where a panel comes from; this opens ${i.as==="page"?"in its place":"in a dialog"}`),i.record!==void 0&&this.checkExpression(i.record,`${a}.record`,r);for(let[s,d]of Object.entries(i.values??{}))this.checkExpression(d,`${a}.values.${s}`,r);i.filter?.forEach((s,d)=>this.checkFilterItem(s,`${a}.filter[${d}]`,r));for(let[s,d]of Object.entries(i.into??{})){this.need(s,`${a}.into.${s}`);try{Bt(d)}catch(l){this.report(`${a}.into.${s}`,`cannot read "${d}": ${l.message}`)}}i.then&&this.checkSteps(i.then,`${a}.then`);return;case"openUrl":this.checkExpression(i.url,`${a}.url`,r);return;default:return}})}checkValuesIn(t,n){for(let r of ei(t))this.need(r,n)}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(xt(r,t))return r[t];this.report(n,`no field "${t}"`)}checkFilterItem(t,n,r){if("any"in t)return t.any.forEach((i,o)=>this.checkFilterItem(i,`${n}.any[${o}]`,r));if("all"in t)return t.all.forEach((i,o)=>this.checkFilterItem(i,`${n}.all[${o}]`,r));t.valueFrom!==void 0&&this.checkValueFrom(t.valueFrom,`${n}.valueFrom`,r)}checkValueFrom(t,n,r){let[i,o]=t.split(".");if(o===void 0){if(xt(r.fields,t)||t==="id"&&r.lines===void 0)return;this.need(t,n,r.fields)}else i==="user"?mo.includes(o)||this.report(n,`"${t}": the person has an id, name or roles`):i==="context"||(r.lines===void 0?this.report(n,`"${t}": only a line's filter reads parent, the record it is on`):!xt(r.parent??this.page.fields,o)&&o!=="id"&&this.report(n,`"${t}": "${o}" is not a field of this page`))}checkModifiers(t,n,r=["invisible"],i=this.here()){for(let o of r){let a=t[o];if(typeof a!="string")continue;let s;try{s=et(a)}catch(d){this.report(`${n}.${o}`,`cannot read "${a}": ${d.message}`);continue}this.checkReads(a,s,`${n}.${o}`,i)}}checkReads(t,n,r,i){for(let o of n.wheres){let a=i.fields[o.lines];if(a?.type!=="one2many")continue;let s;try{s=et(o.condition).fields}catch(d){this.report(r,`cannot read the condition "${o.condition}": ${d.message}`);continue}for(let d of s)xt(a.fields,d)||this.report(r,`"${o.condition}" reads "${d}", which is not a field of the lines of "${o.lines}"`)}for(let o of n.fields){if(xt(i.fields,o))continue;if(i.lines===void 0?po.includes(o):o==="user"||o==="parent"||o==="id"||o==="context"){for(let d of n.paths){let[l,f]=d.split(".");l!==o||f===void 0||(o==="user"&&!mo.includes(f)&&this.report(r,`"${t}" reads "${d}": the person has an id, name or roles`),o==="parent"&&!xt(i.parent??this.page.fields,f)&&!po.includes(f)&&this.report(r,`"${t}" reads "${d}": "${f}" is not a field of this page`))}continue}let s=i.lines===void 0?"of this page":`of the lines of "${i.lines}"`;this.report(r,`"${t}" reads "${o}", which is not a field ${s}`)}}checkExpression(t,n,r){let i;try{i=Bt(t)}catch(o){return this.report(n,`cannot read "${t}": ${o.message}`),null}this.checkReads(t,i,n,r);for(let o of i.sums){if(!xt(r.fields,o.lines))continue;let a=r.fields[o.lines];a.type!=="one2many"?this.report(n,`sum adds up the lines of a one2many; "${o.lines}" is a ${a.type}`):xt(a.fields,o.field)||this.report(n,`"${o.field}" is not a field of the lines of "${o.lines}"`)}return i.fields}checkWorkedOut(t,n,r){let i=new Map;for(let[o,a]of Object.entries(t)){let s=`${n}.${o}`;if((a.compute!==void 0||a.setWhen)&&!Ga.has(a.type)){a.compute!==void 0&&this.report(`${s}.compute`,`a ${a.type} cannot be worked out; ${bo}`),a.setWhen&&this.report(`${s}.setWhen`,`a ${a.type} cannot be set by a condition; ${bo}`);continue}if(a.compute!==void 0){let d=this.checkExpression(a.compute,`${s}.compute`,r);d&&i.set(o,d)}a.setWhen?.forEach((d,l)=>{this.checkModifiers(d,`${s}.setWhen[${l}]`,["when"],r),d.on?.forEach((f,c)=>this.need(f,`${s}.setWhen[${l}].on[${c}]`,t)),this.checkExpression(d.value,`${s}.setWhen[${l}].value`,r)})}for(let o of Qr(i).cycles){let a=o.slice(0,-1),s=a.length===1?`"${a[0]}" is worked out from itself`:`${ic(a)} are worked out from each other: ${o.join(" \u2192 ")}`;this.report(`${n}.${o[0]}.compute`,s)}}checkFields(t,n,r,i){let o={fields:t,lines:r,...i?{parent:i}:{}};this.checkWorkedOut(t,n,o);for(let[a,s]of Object.entries(t)){let d=`${n}.${a}`;if(s.type==="monetary"&&s.currencyField!==void 0&&this.checkCurrency(s.currencyField,`${d}.currencyField`,t,r,i),s.type==="monetary"&&s.money?.per?.forEach((l,f)=>this.checkModifiers(l,`${d}.money.per[${f}]`,["when"],o)),s.defaultFrom!==void 0&&this.checkExpression(s.defaultFrom,`${d}.defaultFrom`,o),(s.type==="many2one"||s.type==="many2many")&&s.createValues)for(let[l,f]of Object.entries(s.createValues))this.checkExpression(f,`${d}.createValues.${l}`,o);if(s.type==="one2many"&&s.lineDefaults)for(let[l,f]of Object.entries(s.lineDefaults))xt(s.fields,l)?this.checkExpression(f,`${d}.lineDefaults.${l}`,o):this.report(`${d}.lineDefaults.${l}`,`"${l}" is not a field of the lines of "${a}"`);if((s.type==="many2one"||s.type==="many2many")&&s.filter&&s.filter.forEach((l,f)=>this.checkFilterItem(l,`${d}.filter[${f}]`,o)),s.type==="selection"&&s.optionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.optionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.definitionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitions){let l=new Set;s.definitions.forEach((f,c)=>{f.type==="selection"&&!f.options&&this.report(`${d}.definitions[${c}].options`,"a choice property needs its choices"),l.has(f.name)&&this.report(`${d}.definitions[${c}].name`,`"${f.name}" is named twice`),l.add(f.name)})}if(s.type==="one2many"&&(this.checkFields(s.fields,`${d}.fields`,a,t),"lineKinds"in s&&s.lineKinds&&this.checkLineKinds(a,s.lineKinds,s.fields,`${d}.lineKinds`),s.sequenceField!==void 0)){let l=s.fields[s.sequenceField];l?l.type!=="integer"&&this.report(`${d}.sequenceField`,`"${s.sequenceField}" is a ${l.type}; the field that keeps the order of lines must be an integer`):this.report(`${d}.sequenceField`,`"${s.sequenceField}" is not a field of the lines of "${a}"`)}}}checkCurrency(t,n,r,i,o=this.page.fields){let a;if(!t.startsWith("parent."))a=this.need(t,n,r);else{if(i===void 0)return this.report(n,`"${t}": only a line\u2019s money reads parent, the record it is on`);if(xt(o,t.slice(7)))a=o[t.slice(7)];else return this.report(n,`"${t}": "${t.slice(7)}" is not a field of this page`)}a&&!["many2one","selection","char"].includes(a.type)&&this.report(n,`"${t}" is a ${a.type}; a currency field must be a many2one, selection or char`)}checkLineKinds(t,n,r,i){let o=r[n.field];if(!o)this.report(`${i}.field`,`"${n.field}" is not a field of the lines of "${t}"`);else if(o.type!=="selection"&&o.type!=="char")this.report(`${i}.field`,`"${n.field}" is a ${o.type}; the field that says what a line is must be a selection or char`);else if(o.type==="selection")for(let s of["section","note"]){let d=n[s]??s;o.options.some(l=>l.value===d)||this.report(`${i}.${s}`,`"${n.field}" has no option "${d}"`)}let a=r[n.text];a?a.type!=="char"&&a.type!=="text"&&this.report(`${i}.text`,`"${n.text}" is a ${a.type}; a section's or note's text must be a char or text field`):this.report(`${i}.text`,`"${n.text}" is not a field of the lines of "${t}"`)}walkFooter(t,n){t?.forEach((r,i)=>{this.claim(r.id,`${n}.footer[${i}]`),this.checkModifiers(r,`${n}.footer[${i}]`),this.checkPress(r,`${n}.footer[${i}]`)})}walkRoot(t,n){if(t.type==="tabs")return this.walkNode(t,n);if(this.claim(t.id,n),(t.type==="sheet"||t.type==="sections")&&this.walkFooter(t.footer,n),t.type==="sheet")return this.walkSheet(t,n);if(t.type==="sections")return this.walkChildren(t.children,n);if(t.type==="list")return this.walkList(t,n);t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkList(t,n){this.page.data.kind!=="record"&&this.report("data",'a list shows records: its data needs kind "record" and a model'),t.columns.forEach((o,a)=>this.need(o,`${n}.columns[${a}]`)),t.sort?.forEach((o,a)=>this.need(o.field,`${n}.sort[${a}].field`)),t.searchFields?.forEach((o,a)=>this.need(o,`${n}.searchFields[${a}]`)),t.groupBy?.forEach((o,a)=>this.need(o,`${n}.groupBy[${a}]`));let r=(o,a)=>{if("any"in o)return o.any.forEach((s,d)=>r(s,`${a}.any[${d}]`));if("all"in o)return o.all.forEach((s,d)=>r(s,`${a}.all[${d}]`));this.need(o.field,`${a}.field`),o.valueFrom!==void 0&&this.report(`${a}.valueFrom`,"a list's filter compares with values, not with another field")},i=new Set;t.filters?.forEach((o,a)=>{this.claim(o.id,`${n}.filters[${a}]`),i.add(o.id),o.filter.forEach((s,d)=>r(s,`${n}.filters[${a}].filter[${d}]`))}),t.defaultFilters?.forEach((o,a)=>{i.has(o)||this.report(`${n}.defaultFilters[${a}]`,`no filter "${o}" in this list`)}),t.actions?.forEach((o,a)=>{this.claim(o.id,`${n}.actions[${a}]`),this.checkPress(o,`${n}.actions[${a}]`)}),t.map&&this.walkListMap(t.map,`${n}.map`)}walkListMap(t,n){let r=t.latitude!==void 0||t.longitude!==void 0;if(t.point!==void 0&&r?this.report(n,"a map takes point, or latitude and longitude, not both"):t.point===void 0&&(t.latitude===void 0||t.longitude===void 0)&&this.report(n,"a map needs where each record is: point, or latitude and longitude"),this.checkPlace(t,n,this.here(),t.pin,t.card),t.regions&&this.need(t.regions.field,`${n}.regions.field`),typeof t.heat=="object"&&t.heat.weight!==void 0){let i=this.need(t.heat.weight,`${n}.heat.weight`);i&&i.type!=="float"&&i.type!=="integer"&&i.type!=="monetary"&&this.report(`${n}.heat.weight`,`"${t.heat.weight}" is a ${i.type}; a weight is a number field`)}}checkPlace(t,n,r,i,o){let a=(l,f,c,y)=>{if(l===void 0)return;let p=this.need(l,f,r.fields);p&&!c(p.type)&&this.report(f,`"${l}" is a ${p.type}; ${y}`)},s=l=>l==="float"||l==="integer",d=l=>l==="image"||l==="binary";a(t.point,`${n}.point`,l=>l==="json","a point is kept in a json field"),a(t.latitude,`${n}.latitude`,s,"a latitude is a number field (float or integer)"),a(t.longitude,`${n}.longitude`,s,"a longitude is a number field (float or integer)"),i&&(a(i.image,`${n}.pin.image`,d,"a pin's photo is an image or binary field"),a(i.turn,`${n}.pin.turn`,s,"a turn is a number field, in degrees"),i.iconField!==void 0&&this.need(i.iconField,`${n}.pin.iconField`,r.fields),i.label!==void 0&&this.need(i.label,`${n}.pin.label`,r.fields),i.tones?.forEach((l,f)=>this.checkModifiers(l,`${n}.pin.tones[${f}]`,["when"],r)),i.money?.per?.forEach((l,f)=>this.checkModifiers(l,`${n}.pin.money.per[${f}]`,["when"],r))),o&&(o.title!==void 0&&this.need(o.title,`${n}.card.title`,r.fields),a(o.image,`${n}.card.image`,d,"a card's picture is an image or binary field"),o.fields?.forEach((l,f)=>(Array.isArray(l)?l:[l]).forEach((c,y)=>{let p=`${n}.card.fields[${f}]${Array.isArray(l)?`[${y}]`:""}${typeof c=="string"?"":".field"}`;this.need(typeof c=="string"?c:c.field,p,r.fields)})),a(o.href,`${n}.card.href`,l=>l==="char"||l==="text","a card's link is a text field holding a web address"))}walkMap(t,n){let r=new Map;t.layers.forEach((i,o)=>{let a=`${n}.layers[${o}]`;r.has(i.id)&&this.report(`${a}.id`,`two layers are called "${i.id}"`);let s=i.latitude!==void 0||i.longitude!==void 0,d=i.point!==void 0||s;if([d,!!i.route,!!i.myLocation,!!i.regions,!!i.reachable].filter(Boolean).length!==1&&this.report(a,"a layer is one of: a place (point, or latitude and longitude, for the record or for each of its lines), a route, myLocation, regions, or reachable"),i.regions?.choose!==void 0&&this.need(i.regions.choose,`${a}.regions.choose`),i.point!==void 0&&s?this.report(a,"a layer takes point, or latitude and longitude, not both"):i.point===void 0&&s&&(i.latitude===void 0||i.longitude===void 0)&&this.report(a,"a layer needs both latitude and longitude"),i.lines!==void 0&&!d&&this.report(`${a}.lines`,"a layer of lines needs where each line is: point, or latitude and longitude, of the line's fields"),i.live&&(!d||i.lines!==void 0)&&this.report(`${a}.live`,"live is for a layer of the record's own place: it moves as its fields change"),this.checkModifiers(i,a,["invisible"]),r.set(i.id,{lines:i.lines!==void 0,place:d||!!i.myLocation}),!d)return;if(i.lines===void 0)return this.checkPlace(i,a,this.here(),i.pin,i.card);let f=this.need(i.lines,`${a}.lines`);if(f){if(f.type!=="one2many")return this.report(`${a}.lines`,`"${i.lines}" is a ${f.type}; a layer of lines is a one2many field`);this.checkPlace(i,a,{fields:f.fields,lines:i.lines,parent:this.page.fields},i.pin,i.card)}}),t.layers.forEach((i,o)=>{let a=i.route;if(!a)return;let s=`${n}.layers[${o}].route`,d=(c,y)=>{if(c===void 0)return;let p=r.get(c);p?(!p.place||p.lines)&&this.report(`${s}.${y}`,`a route's ${y} is a layer of one place, or the reader's own; "${c}" is not`):this.report(`${s}.${y}`,`no layer "${c}" on this map`)};if(d(a.from,"from"),d(a.to,"to"),a.through!==void 0){let c=r.get(a.through);c?c.lines||this.report(`${s}.through`,`a route goes through a layer of lines; "${a.through}" is not one`):this.report(`${s}.through`,`no layer "${a.through}" on this map`)}a.to===void 0&&a.through===void 0&&this.report(s,"a route needs where it goes: to, or through");let l=(c,y,p,k)=>{if(c===void 0)return;let g=this.need(c,`${s}.write.${y}`);g&&!p(g.type)&&this.report(`${s}.write.${y}`,`"${c}" is a ${g.type}; ${k}`)},f=c=>c==="float"||c==="integer";l(a.write?.seconds,"seconds",f,"seconds are a number field"),l(a.write?.metres,"metres",f,"metres are a number field"),l(a.write?.line,"line",c=>c==="json","a line is kept in a json field")}),t.layers.forEach((i,o)=>{if(!i.reachable)return;let a=r.get(i.reachable.from),s=`${n}.layers[${o}].reachable.from`;a?(!a.place||a.lines)&&this.report(s,`a reachable area is worked out from a layer of one place, or the reader's own; "${i.reachable.from}" is not`):this.report(s,`no layer "${i.reachable.from}" on this map`)}),t.fences?.forEach((i,o)=>{let a=`${n}.fences[${o}]`,s=t.layers.find(d=>d.id===i.layer);if(s?!s.live&&!s.myLocation&&this.report(`${a}.layer`,`a fence watches a place that moves: a live layer, or the reader's own; "${i.layer}" is not`):this.report(`${a}.layer`,`no layer "${i.layer}" on this map`),i.area!==void 0){let d=this.need(i.area,`${a}.area`);d&&d.type!=="json"&&this.report(`${a}.area`,`"${i.area}" is a ${d.type}; an area is kept in a json field`)}i.within!==void 0&&!t.layers.some(d=>d.id===i.within&&d.reachable)&&this.report(`${a}.within`,`a fence is within a reachable area of this map; "${i.within}" is not one`),this.checkSteps(i.steps,`${a}.steps`)})}walkChildren(t,n){t.forEach((r,i)=>this.walkNode(r,`${n}.children[${i}]`))}walkNode(t,n){switch(this.claim(t.id,n),this.checkModifiers(t,n,t.type==="field"?["invisible","readonly","required"]:t.type==="section"||t.type==="form"?["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"),t.style==="inline"&&t.columns!==void 0&&this.report(`${n}.columns`,"parts on one line take no columns: each is as wide as it needs"),t.style==="inline"&&t.collapsible&&this.report(`${n}.collapsible`,"a line of parts does not fold: its title is its label"),t.style==="inline"&&t.children.forEach((r,i)=>{["field","text","button","spacer"].includes(r.type)||this.report(`${n}.children[${i}]`,`a line of parts holds fields, words and buttons; a ${r.type} needs a row of its own`)}),this.walkChildren(t.children,n);case"tabs":return this.walkTabs(t,n);case"form":return this.checkFormNode(t,n);case"button":return this.checkPress(t,n);case"text":return this.checkValuesIn(t.text,`${n}.text`);case"map":return this.walkMap(t,n);default:return}}checkFormNode(t,n){if(typeof t.page!="string"||typeof t.name!="string")return this.report(n,"a saved form placed here needs the page\u2019s id and a name for its answers");t.page===this.page.id&&this.report(`${n}.page`,"a page cannot be placed inside itself");let r=this.formNames.get(t.name);xt(this.page.fields,t.name)?this.report(`${n}.name`,`"${t.name}" is a field of this page: the saved form\u2019s answers need a name of their own`):r!==void 0?this.report(`${n}.name`,`the answers of the saved form at ${r} go under "${t.name}" already: give each copy a name of its own`):this.formNames.set(t.name,n)}walkTabs(t,n){t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}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.title.placeholderWhen?.forEach((o,a)=>this.checkModifiers(o,`${n}.title.placeholderWhen[${a}]`,["when"]))),t.statusbar){let{field:o,visibleStates:a,durationsField:s,fold:d,saves:l,clickable:f}=t.statusbar,c=`${n}.statusbar`;if(this.checkModifiers(t.statusbar,c),s!==void 0){let p=this.need(s,`${c}.durationsField`);p&&p.type!=="json"&&this.report(`${c}.durationsField`,`"${s}" is a ${p.type}; time per step comes from a json field`)}l&&!f&&this.report(`${c}.saves`,"a click saves only where a step can be clicked (clickable)");let y=this.need(o,`${n}.statusbar.field`);if(d&&y&&y.type!=="many2one"&&this.report(`${c}.fold`,"steps fold by their record (a stage), so only a link\u2019s steps fold; a choice keeps the steps it shows with visibleStates"),y&&y.type!=="selection"&&y.type!=="many2one"&&this.report(`${n}.statusbar.field`,`"${o}" is a ${y.type}; a statusbar needs a selection or many2one`),y?.type==="selection"&&a){let p=new Set(y.options.map(k=>k.value));a.forEach((k,g)=>{p.has(k)||this.report(`${n}.statusbar.visibleStates[${g}]`,`"${k}" is not an option of "${o}"`)})}}t.buttons?.forEach((o,a)=>{this.claim(o.id,`${n}.buttons[${a}]`),this.checkModifiers(o,`${n}.buttons[${a}]`),this.checkPress(o,`${n}.buttons[${a}]`)}),t.statButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.statButtons[${a}]`),this.checkModifiers(o,`${n}.statButtons[${a}]`),this.checkPress(o,`${n}.statButtons[${a}]`);for(let s of["field","unitField","labelField","secondField"]){let d=o[s];d!==void 0&&this.need(d,`${n}.statButtons[${a}].${s}`)}o.secondLabel!==void 0&&o.secondField===void 0&&this.report(`${n}.statButtons[${a}].secondLabel`,"words for a second value need its field (secondField)")});let r=[...t.ribbon?[[t.ribbon,`${n}.ribbon`]]:[],...(t.ribbons??[]).map((o,a)=>[o,`${n}.ribbons[${a}]`])];for(let[o,a]of r)this.claim(o.id,a),this.checkModifiers(o,a),o.labelField!==void 0&&this.need(o.labelField,`${a}.labelField`);t.badges?.forEach((o,a)=>{this.claim(o.id,`${n}.badges[${a}]`),this.checkModifiers(o,`${n}.badges[${a}]`)});for(let o of["above","before","after","below"])t.title?.[o]?.forEach((a,s)=>this.walkNode(a,`${n}.title.${o}[${s}]`));t.alerts?.forEach((o,a)=>{let s=`${n}.alerts[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),this.checkValuesIn(o.message,`${s}.message`),o.messageField!==void 0&&this.need(o.messageField,`${s}.messageField`),o.buttons?.forEach((d,l)=>{this.claim(d.id,`${s}.buttons[${l}]`),this.checkModifiers(d,`${s}.buttons[${l}]`),this.checkPress(d,`${s}.buttons[${l}]`)})}),t.toolbar?.menu?.forEach((o,a)=>{let s=`${n}.toolbar.menu[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),!o.steps&&o.action===void 0&&!o.builtin&&this.report(s,"a menu item needs steps, an action, or a built-in"),o.label===void 0&&!o.builtin&&this.report(`${s}.label`,"a menu item needs words, unless it is a built-in"),o.steps&&this.checkSteps(o.steps,`${s}.steps`)});let i=t.attachmentPreview;if(i){this.checkModifiers(i,`${n}.attachmentPreview`);let o=i.field!==void 0?this.need(i.field,`${n}.attachmentPreview.field`):void 0;o&&o.type!=="binary"&&o.type!=="image"&&this.report(`${n}.attachmentPreview.field`,`"${i.field}" is a ${o.type}; the preview shows a file (binary or image)`)}this.walkChildren(t.children,n),t.sidePanel&&(this.claim(t.sidePanel.id,`${n}.sidePanel`),this.checkModifiers(t.sidePanel,`${n}.sidePanel`))}checkAddressSearch(t,n,r){let i=t.options??{},o=l=>{let f=i[l];return typeof f=="string"&&xt(this.page.fields,f)?this.page.fields[f].type:void 0};n&&n.type!=="char"&&this.report(`${r}.widget`,`address-search is for a char field; "${t.field}" is a ${n.type}`);let a=o("placeField");a&&a!=="json"&&a!=="float"&&this.report(`${r}.options.placeField`,`"${i.placeField}" is a ${a}; a place is kept in a json field, or in a float field (its latitude) with longitudeField`),a==="float"&&i.longitudeField===void 0&&this.report(`${r}.options.placeField`,`"${i.placeField}" keeps a latitude: name the float field for its longitude in longitudeField`),i.longitudeField!==void 0&&a!=="float"&&this.report(`${r}.options.longitudeField`,"longitudeField goes with a placeField that is a float field, its latitude");let s=o("longitudeField");s&&s!=="float"&&this.report(`${r}.options.longitudeField`,`"${i.longitudeField}" is a ${s}; a longitude is kept in a float field`);let d=o("partsField");d&&d!=="json"&&this.report(`${r}.options.partsField`,`"${i.partsField}" is a ${d}; an address's parts are kept in a json field`)}checkFieldNode(t,n){let r=this.need(t.field,`${n}.field`);t.validate?.forEach((i,o)=>{let a=`${n}.validate[${o}]`;if(this.checkModifiers(i,a,["when","holds"]),i.distinct!==void 0&&r&&(r.type!=="one2many"?this.report(`${a}.distinct`,`distinct is for a table of lines; "${t.field}" is a ${r.type}`):xt(r.fields,i.distinct)||this.report(`${a}.distinct`,`"${i.distinct}" is not a field of the lines of "${t.field}"`)),i.pattern!==void 0)try{new RegExp(i.pattern)}catch{this.report(`${a}.pattern`,`"${i.pattern}" is not a regular expression`)}}),t.tones?.forEach((i,o)=>this.checkModifiers(i,`${n}.tones[${o}]`,["when"])),t.placeholderWhen?.forEach((i,o)=>this.checkModifiers(i,`${n}.placeholderWhen[${o}]`,["when"])),this.checkModifiers(t,n,["bold"]),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((i,o)=>{let a=xt(r.fields,i)?r.fields[i]:void 0;a?["integer","float","monetary"].includes(a.type)||this.report(`${n}.totals[${o}]`,`"${i}" is a ${a.type}; only integer, float and monetary columns add up`):this.report(`${n}.totals[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}));for(let[i,o]of Object.entries(t.options??{}))i.endsWith("Field")&&typeof o=="string"&&this.need(o,`${n}.options.${i}`);t.widget==="address-search"&&this.checkAddressSearch(t,r,n),r&&t.order&&(r.type!=="one2many"?this.report(`${n}.order`,`order only applies to one2many fields; "${t.field}" is a ${r.type}`):t.order.forEach((i,o)=>!xt(r.fields,i.field)&&this.report(`${n}.order[${o}].field`,`"${i.field}" is not a field of the lines of "${t.field}"`))),r&&t.lineForm&&(r.type!=="one2many"?this.report(`${n}.lineForm`,`lineForm only applies to one2many fields; "${t.field}" is a ${r.type}`):this.checkLineForm(t,r,n));for(let i of["lineOpens","cards","fit"])r&&t[i]&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only applies to one2many fields; "${t.field}" is a ${r.type}`);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.lineDelete!==void 0&&r.type!=="one2many"&&this.report(`${n}.lineDelete`,`lineDelete only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons||t.lineDelete!==void 0))if(r.type!=="one2many")(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons)&&this.report(n,`cells, rowTones, rowBold and rowButtons only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i={fields:r.fields,lines:t.field};for(let[o,a]of Object.entries(t.cells??{})){if(!xt(r.fields,o)){this.report(`${n}.cells.${o}`,`"${o}" is not a field of the lines of "${t.field}"`);continue}this.checkModifiers(a,`${n}.cells.${o}`,["invisible","readonly","required","bold"],i),this.checkModifiers(a,`${n}.cells.${o}`,["hidden"]),a.tones?.forEach((s,d)=>this.checkModifiers(s,`${n}.cells.${o}.tones[${d}]`,["when"],i));for(let[s,d]of Object.entries(a.options??{}))s.endsWith("Field")&&typeof d=="string"&&this.need(d,`${n}.cells.${o}.options.${s}`,r.fields)}t.rowTones?.forEach((o,a)=>this.checkModifiers(o,`${n}.rowTones[${a}]`,["when"],i)),this.checkModifiers(t,n,["rowBold","lineDelete"],i),t.rowButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.rowButtons[${a}]`),this.checkModifiers(o,`${n}.rowButtons[${a}]`,["invisible"],i),this.checkPress(o,`${n}.rowButtons[${a}]`)})}for(let i of["selectedButtons","controlButtons"])t[i]&&(r&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only apply to one2many fields; "${t.field}" is a ${r.type}`),t[i].forEach((o,a)=>{this.claim(o.id,`${n}.${i}[${a}]`),this.checkModifiers(o,`${n}.${i}[${a}]`),this.checkPress(o,`${n}.${i}[${a}]`)}));if(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 i=t.columns??Object.keys(r.fields).filter(o=>o!==("lineKinds"in r?r.lineKinds?.field:void 0)&&o!==r.sequenceField);for(let o of Object.keys(t.optionalColumns))i.includes(o)||this.report(`${n}.optionalColumns.${o}`,`"${o}" is not a column of "${t.field}"`)}!r||!t.columns||(r.type==="one2many"?t.columns.forEach((i,o)=>{xt(r.fields,i)?r.fields[i].type==="one2many"&&this.report(`${n}.columns[${o}]`,`"${i}" holds lines of its own: they are edited in the line's form (lineForm), not drawn in its row`):this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}):r.type==="many2many"?t.columns.forEach((i,o)=>{(!r.fields||!xt(r.fields,i))&&this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the records of "${t.field}"`)}):this.report(`${n}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${r.type}`))}};var Jn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),oc=["sheet","sections","tabs","wizard"];function yr(e,t={}){if(!Jn(e))return{ok:!1,issues:[{path:"(page)",message:"a page is a JSON object"}]};let n=[],r=(l,f)=>n.push({path:l,message:f});e.fieldia!=="0.1"&&r("fieldia",`this build reads format ${"0.1"}`),(typeof e.id!="string"||!e.id)&&r("id","a page needs an id");let i=e.data;(!Jn(i)||!(i.kind==="responses"||i.kind==="record"&&typeof i.model=="string"&&i.model))&&r("data",'data is { "kind": "record", "model": \u2026 } or { "kind": "responses" }');let o=e.fields;if(!Jn(o))r("fields","fields is an object of field definitions, by name");else for(let[l,f]of Object.entries(o))(!Jn(f)||!Kr.includes(f.type)||typeof f.label!="string")&&r(`fields.${l}`,"a field needs a type Fieldia knows and a label");let a=e.layout,s=Jn(a)&&a.type==="list";if((!Jn(a)||(s?!Array.isArray(a.columns):!oc.includes(a.type)||!Array.isArray(a.children)))&&r("layout","the layout is a sheet, sections, tabs or wizard, with children, or a list with columns"),n.length)return{ok:!1,issues:n};let d=e;try{let l=new ni(d,t.parent?{name:d.id,parent:t.parent}:void 0).run();return l.length?{ok:!1,issues:l}:{ok:!0,page:d}}catch(l){return{ok:!1,issues:[{path:"(page)",message:`a part of this page cannot be read: ${l.message}`}]}}}var ac=new Set(["title","description","label","help","placeholder","message","text","confirm","alt","caption","tooltip","unit","readonlyReason"]),sc=new Set(["lineKinds","filter","default","data","translations","optionalColumns","values","into","params","map"]),dc=e=>t=>{if(t===null||typeof t!="object"||Array.isArray(t))return t;let n=t.unit;return typeof n=="string"?{...t,unit:e(n)}:n===null||typeof n!="object"?t:{...t,unit:Object.fromEntries(Object.entries(n).map(([r,i])=>[r,typeof i=="string"?e(i):i]))}},Ya=e=>t=>{if(t===null||typeof t!="object")return t;let n=t.card;if(!n||!Array.isArray(n.fields))return t;let r=dc(e);return{...t,card:{...n,fields:n.fields.map(i=>Array.isArray(i)?i.map(r):r(i))}}},lc=e=>t=>{let n=t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t;return Ya(e)(n)};function ri(e,t,n,r,i=!1){if(typeof e=="string")return t!==null&&(t.endsWith("Label")||!i&&ac.has(t))?n(e):e;if(Array.isArray(e))return e.map(a=>ri(a,null,n,r,i));if(e===null||typeof e!="object")return e;r?.(e);let o={};for(let[a,s]of Object.entries(e))a==="layers"&&Array.isArray(s)?o[a]=s.map(lc(n)):a==="map"&&s!==null&&typeof s=="object"&&!Array.isArray(s)?o[a]=Ya(n)(s):o[a]=sc.has(a)?s:ri(s,a,n,r,i||a==="options"&&!Array.isArray(s));return o}function Gn(e,t){return ri(e,null,t)}function Xa(e){let t=new Set,n=e.fields,r=(i,o=null)=>ri(i,o,a=>(a.trim()&&t.add(a),a),a=>{a.type==="wizard"&&r(a.children);let s=a.type==="field"?n[a.field]:void 0;if(s){for(let[d,l]of[[a,"label"],[s,"label"],[a,"placeholder"],[a,"help"],[s,"help"],[a,"readonlyReason"]])r(d[l],l);r(s)}});return r({title:e.title,description:e.description,layout:e.layout}),r(e),[...t]}function xr(e,t){let n=e.translations?.[t]??e.translations?.[t.split("-")[0]];return n?Gn(e,r=>n[r]??r):e}function Mn(e){let[t,...n]=e.toLowerCase().split("-"),r=n.find(i=>i.length===4&&!/\d/.test(i));return r?/^(arab|hebr|syrc|thaa|nkoo|adlm|rohg)$/.test(r):/^(ar|he|iw|fa|ur|ps|sd|yi|dv|ckb|ug|ks|syr|prs|pnb|azb)$/.test(t)}function Nn(e,t){if(!e?.length)return!0;let n=e.filter(r=>!r.startsWith("!"));return e.some(r=>r.startsWith("!")&&t.includes(r.slice(1)))?!1:!n.length||n.some(r=>t.includes(r))}function Za(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=rn(e);if(n.length===0)return!1;let i=new zt(n).parse(),o=Pt(i,t);return Ct(o)}catch{return!1}}function Qa(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=rn(e);return t.length===0||new zt(t).parse(),!0}catch{return!1}}var es={};var cc={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}",choiceOrOther:"Must be one of: {options}, or an answer of its own",matrix:"{label} takes an answer for each row",matrixRow:"Rows are: {rows}",matrixRows:"Answer every row of {label}",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",minFiles:"Add at least {min} files to {label}",maxFiles:"Too many files for {label}: at most {max}",minLength:"{label} must be at least {min} characters",endsWith:"{label} must end with {ending}",atLeast:"Choose at least {min} for {label}",atMost:"Choose at most {max} for {label}",datePast:"{label} must be in the past",dateFuture:"{label} must be in the future",holds:"{label} does not agree with the other answers",distinct:"{column}: {value} is on more than one line of {label}",or:"or",tick:"Tick this box to go on",email:"Enter an email address, like name@example.com",url:"Enter a web address, like example.com",phone:"Enter a phone number, like +20 100 123 4567",time:"Enter a time, like 14:30",before:"{label} can\u2019t be before {min}",after:"{label} can\u2019t be after {max}",weekday:"{label} can\u2019t be on a {days}",minLines:"Add at least {min} to {label}",maxLines:"Too many in {label}: at most {max}",addressParts:"Street address|Address line 2|City|State or region|Postcode|Country",archiveConfirm:"Are you sure that you want to archive this record?",deleteConfirm:"Are you sure you want to delete this record?",locale:"en"},Tt={en:cc,...es};function Ye(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n)}function yn(e,t=hn(new Date)){let n=/^today([+-]\d+)?$/.exec(e);if(!n)return e;let[r,i,o]=t.split("-").map(Number);return new Date(Date.UTC(r,i-1,o+Number(n[1]??0))).toISOString().slice(0,10)}var ts=(e,t,n)=>new Intl.DateTimeFormat(t.locale,{...e,timeZone:"UTC",numberingSystem:"latn"}).format(n);function yo(e,t,n,r){if(e.type!=="date"&&e.type!=="datetime")return;let i=e.type==="date"?t:hn(new Date(t)),o=(f,c)=>Ye(r[f],{label:e.label,min:c,max:c,days:c}),a=f=>ts({day:"numeric",month:"long",year:"numeric"},r,Date.parse(f)),s=e.min&&yn(e.min,n),d=e.max&&yn(e.max,n);if(s&&i<s)return o("before",a(s));if(d&&i>d)return o("after",a(d));let l=e.days;if(l&&!l.includes(new Date(Date.parse(i)).getUTCDay()||7)){let f=[1,2,3,4,5,6,7].filter(c=>!l.includes(c)).map(c=>ts({weekday:"long"},r,Date.UTC(2024,0,c)));return o("weekday",f.length>1?`${f.slice(0,-1).join(", ")} ${r.or} ${f[f.length-1]}`:f[0])}}function Cn(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":case"binary":case"image":return e.multiple?[]:null;default:return null}}function xn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=i.default;n[r]=o===void 0?Cn(i):i.type==="date"&&typeof o=="string"&&o.startsWith("today")?yn(o,t):Ae(o)}return n}function Kt(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:e.type==="matrix"&&typeof t=="object"?Object.values(t).every(n=>n==null||Array.isArray(n)&&!n.length):!1}function vn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=t[r];n[r]=o?fc(o,i):i}return n}function fc(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 Array.isArray(t)?t.map(n=>n.name):t.name;default:return t}}function gt(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 ii(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Ae(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function wn(e,t,n,r=Tt.en,i){let o=e.label||"This field",a=(s,d={})=>Ye(r[s],{label:o,...d});if(Kt(e,t))return n?a("required"):void 0;if(e.type==="matrix")return uc(e,t,n,a);switch(e.type){case"char":case"text":case"html":return typeof t!="string"?a("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?a("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?a("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?a("number"):e.type==="integer"&&!Number.isInteger(t)?a("integer"):e.min!==void 0&&t<e.min?a("min",{min:e.min}):e.max!==void 0&&t>e.max?a("max",{max:e.max}):e.type!=="integer"&&e.digits&&pc(t)>e.digits[1]?a("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:a("boolean");case"date":return mc(t,a)??yo(e,t,i,r);case"datetime":return hc(t,a)??yo(e,t,i,r);case"selection":{if(e.optionsFrom)return;let s=new Set(e.options.map(f=>f.value)),d=a(e.other?"choiceOrOther":"choice",{options:e.options.map(f=>f.label).join(", ")}),l=f=>(e.other===!0||e.ownAnswers===!0)&&typeof f=="string"&&f.trim()!==""&&!s.has(f);return e.multiple?Array.isArray(t)?(t.filter(c=>!s.has(c)).length<=1||e.ownAnswers)&&t.every(c=>s.has(c)||l(c))?void 0:d:a("choices"):s.has(t)||l(t)?void 0:d}case"many2one":return xo(t)?void 0:a("record");case"many2many":return Array.isArray(t)&&t.every(xo)?void 0:a("records");case"reference":{let s=t;if(!xo(t)||typeof s.model!="string")return a("record");if(!e.models.some(d=>d.value===s.model)){let d=rs(e.models.map(l=>l.label),r.or);return a("reference",{models:d,aModels:is(d)})}return}case"binary":case"image":return bc(e,t,a,r);default:return}}function uc(e,t,n,r){if(t===null||typeof t!="object"||Array.isArray(t))return r("matrix");let i=new Set(e.rows.map(d=>String(d.value))),o=new Set(e.columns.map(d=>d.value)),a=r("choice",{options:e.columns.map(d=>d.label).join(", ")});for(let[d,l]of Object.entries(t)){if(!i.has(d))return r("matrixRow",{rows:e.rows.map(c=>c.label).join(", ")});let f=e.multiple&&Array.isArray(l)?l:[l];if(!e.multiple&&Array.isArray(l)||f.some(c=>c!=null&&!o.has(c)))return a}let s=d=>{let l=t[d];return l!=null&&!(Array.isArray(l)&&!l.length)};if(n&&e.rows.some(d=>!s(String(d.value))))return r("matrixRows")}function pc(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 xo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function mc(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[n,r,i]=e.split("-").map(Number);return ns(n,r,i)?void 0:t("dateInvalid")}var gc=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function hc(e,t){let n=typeof e=="string"?gc.exec(e):null;if(!n)return t("datetimeFormat");let[r,i,o,a,s,d]=n.slice(1).map(l=>Number(l??0));return ns(r,i,o)&&a<24&&s<60&&d<60?void 0:t("datetimeInvalid")}function ns(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 bc(e,t,n,r){let i=e.multiple?Array.isArray(t)?t:[t]:[t];if(e.multiple&&e.minFiles!==void 0&&i.length<e.minFiles)return n("minFiles",{min:e.minFiles});if(e.multiple&&e.maxFiles!==void 0&&i.length>e.maxFiles)return n("maxFiles",{max:e.maxFiles});for(let o of i){if(!yc(o))return n("file");let a=vr(e,o,r,e.multiple?o.name:e.label||"This field");if(a)return a}}function vr(e,t,n=Tt.en,r=t.name){if(e.maxSize!==void 0&&t.size>e.maxSize)return Ye(n.fileSize,{label:r,size:on(e.maxSize)});let i=e.type==="image"?["image/*"]:e.accept;if(i&&!xc(i,t.type)){let o=wr(i,n.or);return Ye(n.fileType,{label:r,types:o,aTypes:is(o)})}}function yc(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function xc(e,t){return e.some(n=>n.endsWith("/*")?t.startsWith(n.slice(0,-1)):n===t)}var vc="pdf PDF,msword DOC,wordprocessingml DOCX,opendocument.text ODT,plain TXT,ms-excel XLS,spreadsheetml XLSX,opendocument.spreadsheet ODS,csv CSV,ms-powerpoint PPT,presentationml PPTX,opendocument.presentation ODP".split(",").map(e=>e.split(" "));function wc(e){if(e.endsWith("/*"))return e.slice(0,-2);let t=e.split("/")[1]??e;return vc.find(([n])=>t.includes(n))?.[1]??t.toUpperCase()}function wr(e,t){return rs([...new Set(e.map(wc))],t)}function rs(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function is(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function on(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]}`}var os=e=>Math.round(e*1e9)/1e9,as=(e,t)=>e.find(n=>n.value===t)?.score??0,ss=e=>e.reduce((t,n)=>Math.max(t,n.score??0),0),ds=e=>e.reduce((t,n)=>t+Math.max(0,n.score??0),0),ls=(e,t,n)=>n?Array.isArray(t)?t.reduce((r,i)=>r+as(e,i),0):0:as(e,t);function cs(e,t){let n=0,r=0,i=!1;for(let[o,a]of Object.entries(e.fields))if(a.type==="selection"&&a.options.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0;n+=ls(a.options,t[o],s),r+=s?ds(a.options):ss(a.options)}else if(a.type==="matrix"&&a.columns.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0,d=t[o],l=d&&typeof d=="object"&&!Array.isArray(d)?d:{};for(let f of a.rows)n+=ls(a.columns,l[String(f.value)],s),r+=s?ds(a.columns):ss(a.columns)}return i?{score:os(n),max:os(r)}:null}function fs(e){return Object.assign(new Error(e.message),{problem:e})}function oi(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 Xn(e,t){return t.every(n=>vo(e,n))}function vo(e,t){return"any"in t?t.any.some(n=>vo(e,n)):"all"in t?t.all.every(n=>vo(e,n)):Sc(e,t)}function an(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function kc(e){return Array.isArray(e)?e.map(t=>t!==null&&typeof t=="object"&&"id"in t?t.id:t):[]}function Sc(e,t){let n=e[t.field],r=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"id"in n?n.id:n,i=t.value,o=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"label"in n?String(n.label):String(r??"");switch(t.op){case"=":return r===i;case"=?":return!an(i)||r===i;case"contains":case"not contains":{let a=kc(n),d=(Array.isArray(i)?i:[i]).some(l=>a.includes(l));return t.op==="contains"?d:!d}case"!=":return r!==i;case"<":return an(r)&&r<i;case">":return an(r)&&r>i;case"<=":return an(r)&&r<=i;case">=":return an(r)&&r>=i;case"in":return Array.isArray(i)&&i.includes(r);case"not in":return Array.isArray(i)&&!i.includes(r);case"like":return o.includes(String(i));case"ilike":return o.toLowerCase().includes(String(i).toLowerCase());case"startswith":return o.toLowerCase().startsWith(String(i).toLowerCase());case"endswith":return o.toLowerCase().endsWith(String(i).toLowerCase());case"set":return an(n);case"notset":return!an(n);case"between":{if(!an(r)||!Array.isArray(i))return!1;let[a,s]=i;return r>=a&&r<=s}case"within":return Lc(e,n,i)}}var wo=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Lc(e,t,n){if(!wo(n))return!1;let r=us(e,t,n.longitude);if(!r)return!1;let{lat:i,lng:o}=r;if(Array.isArray(n.polygon))return Ec(o,i,n.polygon);if(Array.isArray(n.center)){let[f,c]=n.center;return ps(i,o,c,f)<=n.radius}let{south:a,west:s,north:d,east:l}=n;return i<a||i>d?!1:s<=l?o>=s&&o<=l:o>=s||o<=l}function us(e,t,n){let r,i;if(typeof n=="string")r=t,i=e[n];else{let o=wo(t)&&t.type==="Feature"?t.geometry:t,a=wo(o)&&o.type==="Point"?o.coordinates:null;if(!Array.isArray(a))return null;[i,r]=a}return typeof r=="number"&&typeof i=="number"?{lat:r,lng:i}:null}function ko(e,t,n){let r=us(e,e[t],n.longitude);return r?ps(r.lat,r.lng,n.lat,n.lng):null}function Ec(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let[a,s]=n[i],[d,l]=n[o];s>t!=l>t&&e<(d-a)*(t-s)/(l-s)+a&&(r=!r)}return r}function ps(e,t,n,r){let i=Math.PI/180,o=Math.sin((n-e)*i/2)**2+Math.cos(e*i)*Math.cos(n*i)*Math.sin((r-t)*i/2)**2;return 2*63710088e-1*Math.asin(Math.min(1,Math.sqrt(o)))}var Yn=null;function ai(e,t){let n=r=>{if("any"in r){let o=r.any.map(n);return o.includes(Yn)?Yn:{any:o}}if("all"in r){let o=r.all.map(n).filter(a=>a!==Yn);return o.length?{all:o}:Yn}let i=r.valueFrom!==void 0?Rc(t,r.valueFrom):r.value??null;return r.op==="=?"?an(i)?{field:r.field,op:"=",value:i}:Yn:{field:r.field,op:r.op,value:i}};return e.map(n).filter(r=>r!==Yn)}function Rc(e,t){let n=e;for(let r of t.split("."))n=n===null||typeof n!="object"?void 0:n[r];return n??null}var ms=new Set(["char","text","html"]),gs=new Set(["integer","float","monetary"]),Fc=new Set(["many2one","many2many"]);function si(e,t,n,r={searchFor:"Search {field} for: {text}"}){let i=e.trim();if(!i)return[];let o=[];for(let s of n.searchFields??n.columns){let d=t.fields[s];if(!d)continue;let l=(f,c,y,p)=>o.push({field:s,fieldLabel:d.label,op:f,value:c,valueLabel:y,label:p??Ye(r.searchFor,{field:d.label,text:i})});if(ms.has(d.type)||Fc.has(d.type))l("ilike",i,i);else if(d.type==="selection"){let f=i.toLowerCase();for(let c of d.options)c.label.toLowerCase().includes(f)&&l("=",c.value,c.label,`${d.label}: ${c.label}`)}else if(gs.has(d.type)){let f=Number(i.replace(/[\s,]/g,""));i&&Number.isFinite(f)&&l("=",f,i)}}let a=s=>{let d=t.fields[s.field]?.type??"";return ms.has(d)?0:d==="selection"?1:gs.has(d)?2:3};return o.map((s,d)=>({s,i:d})).sort((s,d)=>a(s.s)-a(d.s)||s.i-d.i).map(({s})=>s)}function kr(e,t){let n=[];for(let r of e)if(r.kind==="field"){let i=r.values.map(o=>({field:r.field,op:o.op,value:o.value}));n.push(i.length===1?i[0]:{any:i})}else if(r.kind==="filters"){let i=r.ids.map(o=>t.filters?.find(a=>a.id===o)?.filter??[]).filter(o=>o.length);i.length===1?n.push(...i[0]):i.length>1&&n.push({any:i.map(o=>o.length===1?o[0]:{all:o})})}else r.kind==="custom"&&n.push(...r.filter);return n}function di(e){return e.find(t=>t.kind==="groupBy")?.fields??[]}var Sr={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function li(e,t=Sr){return new Promise(n=>{t.setTimeout(n,e)})}function bs(e={}){let t=Ae(e.records??{}),n=[],r=[],i=new Map,o=1e3,a=()=>e.delayMs?li(e.delayMs,e.scheduler):Promise.resolve(),s=m=>t[m]??(t[m]={}),d=(m,b)=>{let h=s(m)[String(b)]?.[e.labelField?.[m]??"name"];return typeof h=="string"?h:String(b)},l=(m,b)=>{let h=e.shows?.[m],v=h?s(m)[String(b.id)]:void 0;if(!h||!v)return b;let S={...b};h.avatar&&typeof v[h.avatar]=="string"&&(S.avatar=v[h.avatar]),h.color&&typeof v[h.color]=="number"&&(S.color=v[h.color]),h.folded&&(S.folded=v[h.folded]===!0);let x=(h.details??[]).map(F=>v[F]).map(F=>F&&typeof F=="object"&&"label"in F?F.label:F).filter(F=>typeof F=="string"&&F.trim());return x.length&&(S.details=x.join(`
|
|
3
|
+
`)),S},f=m=>Math.max(0,...Object.keys(s(m)).map(Number).filter(Number.isFinite))+1,c=m=>Number.isFinite(Number(m))?Number(m):m,y=(m,b)=>({id:c(m),...b});function p(m,b){let h=[...m];for(let v of b)v.op==="create"?h.push({key:v.key,id:++o,values:Ae(v.values)}):v.op==="update"?h=h.map(S=>S.id===v.id?{...S,values:{...S.values,...Ae(v.values)}}:S):h=h.filter(S=>S.id!==v.id);return h}function k(m,b,h){let v=[...m],S=x=>({id:x,label:d(h,x)});for(let x of b)x.op==="link"&&!v.some(F=>F.id===x.id)?v.push(S(x.id)):x.op==="unlink"?v=v.filter(F=>F.id!==x.id):x.op==="set"?v=x.ids.map(S):x.op==="clear"&&(v=[]);return v}function g(m,b){let h=m[b];return h&&"relation"in h?h.relation:b}return{records:t,responses:n,calls:r,async load(m){r.push({method:"load",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);let h=Ae(b);if(e.shows)for(let[v,S]of Object.entries(m.fields)){let x=h[v];S.type==="many2one"&&x&&typeof x=="object"&&"id"in x?h[v]=l(S.relation,x):S.type==="many2many"&&Array.isArray(x)&&(h[v]=x.map(F=>l(S.relation,F)))}return h},async save(m){r.push({method:"save",request:m}),await a();let b=m.id??f(m.model),h={...s(m.model)[String(b)]??{},...Ae(m.changes.values)};for(let[v,S]of Object.entries(m.changes.lines))h[v]=p(h[v]??[],S);for(let[v,S]of Object.entries(m.changes.links))h[v]=k(h[v]??[],S,g(m.fields,v));return s(m.model)[String(b)]=h,{id:b,values:Ae(h)}},async onchange(m){r.push({method:"onchange",request:m}),await a();let b=e.onchange?.[m.model]?.[m.changed],h=e.warnings?.[m.model]?.[m.changed],v=b?{values:b(Ae(m.values))}:{},S=h?.(Ae(m.values));return S?{...v,warning:S}:v},async search(m){r.push({method:"search",request:m}),await a();let b=m.query.trim().toLowerCase();return Object.entries(s(m.model)).filter(([h,v])=>Xn(y(h,v),m.filter??[])).map(([h])=>({id:c(h),label:d(m.model,c(h))})).filter(h=>h.label.toLowerCase().includes(b)).slice(0,m.limit??8).map(h=>l(m.model,h))},async list(m){r.push({method:"list",request:m}),await a();let b=Object.entries(s(m.model)).filter(([h,v])=>Xn(y(h,v),m.filter)).map(([h,v])=>({id:c(h),values:v}));return b.sort((h,v)=>{for(let S of m.sort){let x=S.near?hs(ko(h.values,S.field,S.near),ko(v.values,S.field,S.near)):hs(h.values[S.field],v.values[S.field]);if(x.empty)return x.result;if(x.result)return S.desc?-x.result:x.result}return 0}),{total:b.length,records:b.slice(m.offset,m.offset+m.limit).map(({id:h,values:v})=>({id:h,values:Object.fromEntries(m.fields.map(S=>[S,Ae(v[S]??null)]))}))}},async groups(m){r.push({method:"groups",request:m}),await a();let b=new Map;for(let[h,v]of Object.entries(s(m.model))){if(!Xn(y(h,v),m.filter))continue;let S=v[m.field]??null,x=S!==null&&typeof S=="object"&&!Array.isArray(S)&&"id"in S?S:null,F=x?x.id:S,E=JSON.stringify(F),w=b.get(E)??{value:F,label:x?x.label:S===null||S===""?"":String(S),count:0};w.count++,b.set(E,w)}return[...b.values()].sort((h,v)=>h.value===null==(v.value===null)?h.label.localeCompare(v.label):h.value===null?1:-1)},async create(m){r.push({method:"create",request:m}),await a();let b=s(m.model),h=Object.keys(b).reduce((v,S)=>Math.max(v,Number(S)||0),0)+1;return b[String(h)]={...Ae(m.values??{}),name:m.name},{id:h,label:m.name}},async submit(m){return r.push({method:"submit",request:m}),await a(),n.push(Ae(m)),{id:n.length}},async archive(m){r.push({method:"archive",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);b.active=!m.archive},async copy(m){r.push({method:"copy",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);let h=f(m.model),v=Ae(b),S=e.labelField?.[m.model]??"name";typeof v[S]=="string"&&(v[S]=`${v[S]}${e.copySuffix??" (copy)"}`);for(let[x,F]of Object.entries(v))Array.isArray(F)&&F.every(E=>E&&typeof E=="object"&&"key"in E&&"values"in E)&&(v[x]=F.map(E=>({...E,id:++o})));return s(m.model)[String(h)]=v,{id:h,values:Ae(v)}},async delete(m){if(r.push({method:"delete",request:m}),await a(),!s(m.model)[String(m.id)])throw new Error(`No ${m.model} record with id ${m.id}`);delete s(m.model)[String(m.id)]},async attachments(m){return r.push({method:"attachments",request:m}),await a(),Ae(e.attachments?.[`${m.model}:${m.id}`]??[])},async options(m){r.push({method:"options",request:m}),await a();let b=e.lists?.[m.list];if(!b)throw new Error(`No list "${m.list}"`);return Ae(typeof b=="function"?await b(m.values):b)},async definitions(m){r.push({method:"definitions",request:m}),await a();let b=e.definitions?.[m.list];if(!b)throw new Error(`No definitions "${m.list}"`);let h=b(m.values),v=i.get(`${m.list}:${JSON.stringify(h)}`)??[];return Ae([...h,...v.filter(S=>!h.some(x=>x.name===S.name))])},async saveDefinitions(m){r.push({method:"saveDefinitions",request:m}),await a();let b=e.definitions?.[m.list]?.(m.values)??[];i.set(`${m.list}:${JSON.stringify(b)}`,Ae(m.definitions.filter(h=>!b.some(v=>v.name===h.name))))}}}function hs(e,t){let n=a=>a==null||a==="";if(n(e)||n(t))return{result:n(e)===n(t)?0:n(e)?1:-1,empty:n(e)!==n(t)};let r=a=>typeof a=="object"&&a!==null&&"label"in a?a.label:a,[i,o]=[r(e),r(t)];return typeof i=="number"&&typeof o=="number"?{result:i-o,empty:!1}:{result:String(i).localeCompare(String(o)),empty:!1}}var ci=["street","line2","city","region","postcode","country"];function ys(e,t,n,r){let i=t.options??{},o=t.label??e.label;if(e.type==="one2many"&&Array.isArray(n)&&n.length){if(typeof i.min=="number"&&n.length<i.min)return Ye(r.minLines,{label:o,min:i.min});if(typeof i.max=="number"&&n.length>i.max)return Ye(r.maxLines,{label:o,max:i.max})}let a=i.requiredParts;if(t.widget!=="address"||!Array.isArray(a)||!n||typeof n!="object"||Array.isArray(n))return;let s=Array.isArray(i.parts)?i.parts:ci,d=n,l=ci.findIndex(f=>a.includes(f)&&s.includes(f)&&!String(d[f]??"").trim());return l<0?void 0:Ye(r.required,{label:r.addressParts.split("|")[l]})}var Ac={email:/^[^@\s]+@[^@\s]+\.[^@\s]+$/,url:/^(https?:\/\/)?([\p{L}\p{N}-]+\.)+\p{L}{2,}(:\d+)?([/?#]\S*)?$/iu,phone:/^\+?[\p{Nd}\s.()-]+$/u,time:/^([01]\d|2[0-3]):[0-5]\d$/};function So(e,t,n,r){let i=t.widget??"";if(e.type!=="char")return ys(e,t,n,r);if(typeof n!="string"||!n.trim())return;let o=n.trim(),a=t.options??{},s=t.label??e.label,d=Ac[i],l=o.match(/\p{Nd}/gu)?.length??0;if(d&&(!d.test(o)||i==="phone"&&(l<7||l>15)))return r[i];if(i==="time"){if(typeof a.min=="string"&&o<a.min)return Ye(r.before,{label:s,min:a.min});if(typeof a.max=="string"&&o>a.max)return Ye(r.after,{label:s,max:a.max})}if(i==="tags"&&typeof a.max=="number"&&o.split(typeof a.separator=="string"&&a.separator?a.separator:",").filter(c=>c.trim()).length>a.max)return Ye(r.atMost,{label:s,max:a.max})}function xs(e,t,n,r=!0,i={},o){let a={id:t??null,user:{id:n?.id??null,name:n?.name??null,roles:[...n?.roles??[]]},editing:r,context:i,...o?{parent:o}:{}};for(let s of Object.keys(a))s in e&&delete a[s];return a}function qt(e,t,n){return{...xs(t,n.recordId,n.user,n.editing,n.context,n.parent),...vn(e,t)}}function kn(e,t,n,r=null){let i={parent:n,user:n.user??xs({},null,void 0).user,id:r,context:n.context??{}};for(let o of Object.keys(i))o in t&&delete i[o];return{...i,...vn(e,t)}}function Pn(e,t,n){let r=new Map;return{today:n,lines(i){let o=t[i];if(o?.type!=="one2many")return;let a=r.get(i);return a||(a=(e[i]??[]).filter(d=>gt(o,d.values)===null).map(d=>vn(d.values,o.fields)),r.set(i,a)),a}}}function vs(e){let t=new Map;for(let[r,i]of Object.entries(e))i.compute!==void 0&&t.set(r,Bt(i.compute));let{order:n}=Qr(new Map([...t].map(([r,i])=>[r,i.fields])));return n.map(r=>[r,t.get(r),e[r]])}function On(e,t){if(e.type==="boolean")return Ct(t);if(t==null)return null;switch(e.type){case"integer":return wt(t)?hr(t,0):null;case"float":case"monetary":return wt(t)?e.digits?hr(t,e.digits[1]):t:null;case"char":case"text":case"html":return typeof t=="string"?t:wt(t)?String(t):null;case"date":case"datetime":return typeof t=="string"?t:null;default:return t}}function ws(e,t,n=()=>({recordId:null})){let r=vs(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=vs(l.fields);f.length&&i.set(d,{def:l,steps:f})}let o={today:t};function a(d,l,f,c,y){let p=d,k=y(d);for(let[g,m,b]of l){let h=On(b,m.evaluate(k,c));ii(h,p[g])||(p={...p,[g]:h},Object.assign(k,vn({[g]:h},f)))}return p}function s(d,l,f){let c=i.get(d);return!c||gt(c.def,l)!==null?l:a(l,c.steps,c.def.fields,o,y=>kn(y,c.def.fields,f))}return{line:(d,l,f)=>s(d,l,qt(f,e.fields,n())),apply(d){let l=d,f=i.size?qt(d,e.fields,n()):{};for(let c of i.keys()){let y=l[c];if(!Array.isArray(y))continue;let p=!1,k=y.map(g=>{let m=s(c,g.values,f);return m===g.values?g:(p=!0,{...g,values:m})});p&&(l={...l,[c]:k})}return r.length?a(l,r,e.fields,Pn(l,e.fields,t),c=>qt(c,e.fields,n())):l}}}function ks(e){return Object.entries(e).flatMap(([t,n])=>(n.setWhen??[]).map((r,i)=>({key:`${t}#${i}`,name:t,def:n,when:et(r.when??!0),value:Bt(r.value),...r.on?{on:r.on}:{}})))}var $c={has:()=>!0};function Ss(e,t,n=()=>({recordId:null})){let r=ks(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=ks(l.fields);f.length&&i.set(d,{def:l,rules:f})}let o={today:t};function a(d,l,f,c,y,p,k){let g=d;for(let m of l){if(m.on){let h=`${y}${m.key}@${JSON.stringify(m.on.map(v=>d[v]??null))}`;if(k.add(h),p.has(h)||!m.when.evaluate(f,c))continue}else{if(!m.when.evaluate(f,c))continue;let h=y+m.key;if(k.add(h),p.has(h))continue}let b=On(m.def,m.value.evaluate(f,c));ii(b,g[m.name])||(g={...g,[m.name]:b})}return g}function s(d,l){let f=new Set,c=r.length?a(d,r,qt(d,e.fields,n()),Pn(d,e.fields,t),"",l,f):d,y=i.size?qt(d,e.fields,n()):{};for(let[p,{def:k,rules:g}]of i){let m=d[p];if(!Array.isArray(m))continue;let b=!1,h=m.map(v=>{if(gt(k,v.values)!==null)return v;let S=a(v.values,g,kn(v.values,k.fields,y,v.id??null),o,`${p}.${v.key}.`,l,f);return S===v.values?v:(b=!0,{...v,values:S})});b&&(c={...c,[p]:h})}return{values:c,holding:f}}return{apply:s,holding:d=>s(d,$c).holding}}function Ls(e){return(e??[]).map(t=>({rule:t,when:et(t.when??!0),pattern:t.pattern===void 0?null:new RegExp(`^(?:${t.pattern})$`),holds:t.holds===void 0?null:et(t.holds)}))}function Es(e,t,n,r,i){let o={};if(!r.length||Kt(e,n))return o;for(let a of r){let s=a.rule.level??"error";if(o[s]!==void 0||!a.when.evaluate(i.context,i.env))continue;let d=Tc(a,e,n,i.now)??Cc(a,i);d&&(o[s]=a.rule.message??Ye(i.messages[d.say],{label:t,...d.values}))}return o}function Tc({rule:e,pattern:t},n,r,i){let o=typeof r=="string"?r:null;if(o!==null&&e.minLength!==void 0&&o.length<e.minLength)return{say:"minLength",values:{min:e.minLength}};if(o!==null&&e.maxLength!==void 0&&o.length>e.maxLength)return{say:"maxLength",values:{max:e.maxLength}};if(t&&(o!==null||wt(r))&&!t.test(String(r)))return{say:"pattern"};if(o!==null&&e.endsWith!==void 0&&!o.trim().toLowerCase().endsWith(e.endsWith.toLowerCase()))return{say:"endsWith",values:{ending:e.endsWith}};if(wt(r)&&e.min!==void 0&&r<e.min)return{say:"min",values:{min:e.min}};if(wt(r)&&e.max!==void 0&&r>e.max)return{say:"max",values:{max:e.max}};let a=Array.isArray(r)?r.length:null;if(a!==null&&e.atLeast!==void 0&&a<e.atLeast)return{say:"atLeast",values:{min:e.atLeast}};if(a!==null&&e.atMost!==void 0&&a>e.atMost)return{say:"atMost",values:{max:e.atMost}};if(e.distinct!==void 0&&n.type==="one2many"&&Array.isArray(r)){let s=Mc(n,r,e.distinct);if(s!==null)return{say:"distinct",values:{column:n.fields[e.distinct]?.label??e.distinct,value:s}}}if(o!==null&&e.date!==void 0){let s=Pc(n,o,i);if(e.date==="past"&&s>=0)return{say:"datePast"};if(e.date==="future"&&s<=0)return{say:"dateFuture"}}}function Mc(e,t,n){let r=e.fields[n],i=new Set;for(let o of t){if(gt(e,o.values)!==null)continue;let a=o.values[n];if(a==null||a===""||Array.isArray(a)&&!a.length)continue;let s=typeof a=="object"&&!Array.isArray(a)&&"id"in a?a:null,d=JSON.stringify(s?s.id:a);if(!i.has(d)){i.add(d);continue}return s?s.label:r?.type==="selection"?r.options.find(l=>l.value===a)?.label??String(a):String(a)}return null}var Nc=e=>e==null||typeof e=="string"&&!e.trim()||Array.isArray(e)&&!e.length;function Cc({holds:e},t){if(!(!e||e.fields.some(n=>Nc(t.context[n]))))return e.evaluate(t.context,t.env)?void 0:{say:"holds"}}function Pc(e,t,n){if(e.type==="datetime")return Math.sign(Date.parse(t)-n.getTime());let r=hn(n);return t<r?-1:t>r?1:0}var Rs=new Map;function Oc(e){let t=Rs.get(e);return t||Rs.set(e,t=Bt(e)),t}function Lo(e,t){let n=e.trim();if(_n.test(n)&&n in t.fields)return Ae(t.values[n]);if(n==="user"&&!("user"in t.fields))return t.user?.id==null?null:{id:t.user.id,label:t.user.name??String(t.user.id)};let r=/^parent\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(n);return r&&t.parent&&r[1]in t.parent.fields?Ae(t.parent.values[r[1]]):Oc(e).evaluate(t.context,t.env)}function Fs(e,t,n){if(e.type!=="many2one"&&e.type!=="many2many")return On(e,t);let r=i=>{if(i==null||i===!1||i==="")return null;if(typeof i=="number"||typeof i=="string")return{id:i,label:n.labelOf?.(e.relation,i)??String(i)};if(typeof i=="object"&&!Array.isArray(i)&&"id"in i){let o=i;return{id:o.id,label:typeof o.label=="string"?o.label:n.labelOf?.(e.relation,o.id)??String(o.id)}}return null};return e.type==="many2one"?r(Array.isArray(t)?t[0]:t):(Array.isArray(t)?t:[t]).map(r).filter(i=>i!==null)}function As(e,t,n){let r={};for(let[i,o]of Object.entries(e)){let a=t[i];a&&(r[i]=Fs(a,Lo(o,n),n))}return r}function Eo(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=Lo(i,t)??null;return n}function Ro(e,t){let n={};for(let[r,i]of Object.entries(e))i.defaultFrom!==void 0&&(n[r]=Fs(i,Lo(i.defaultFrom,t),t));return n}function $s(e){let t=Fo(e.tones),n=et(e.bold);return(r,i)=>({tone:Ao(t,r,i),bold:n.evaluate(r,i)})}var Fo=e=>(e??[]).map(t=>({tone:t.tone,when:et(t.when)})),Ao=(e,t,n)=>e.find(r=>r.when.evaluate(t,n))?.tone??null;function Ts(e){let t=new Map;for(let[s,d]of Object.entries(e.cells??{}))t.set(s,{invisible:et(d.invisible),readonly:et(d.readonly),required:et(d.required),hidden:et(d.hidden),...d.roles?.length?{roles:d.roles}:{},tones:Fo(d.tones),bold:et(d.bold)});let n=Fo(e.rowTones),r=et(e.rowBold),i=e.lineDelete===void 0?null:et(e.lineDelete),o=e.rowButtons??[],a=o.map(s=>({id:s.id,roles:s.roles,invisible:et(s.invisible)}));return{buttons:o,line(s,d,l){let f={tone:Ao(n,s,d),bold:r.evaluate(s,d),cells:{},buttons:{},deletable:i?.evaluate(s,d)??!0};for(let[c,y]of t)f.cells[c]={invisible:y.invisible.evaluate(s,d),readonly:y.readonly.evaluate(s,d),required:y.required.evaluate(s,d),tone:Ao(y.tones,s,d),bold:y.bold.evaluate(s,d)};for(let c of a)f.buttons[c.id]=Nn(c.roles,l)&&!c.invisible.evaluate(s,d);return f},hidden(s,d,l,f){let c=t.get(s);return!!c&&(!Nn(c.roles,f)||c.hidden.evaluate(d,l))}}}var fi=Object.freeze({done:!0}),$o=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),To=e=>e instanceof Error?e.message:String(e);function Ms(e){let t=new Map,n=new Map,r=x=>{let F=t.get(x);return F||t.set(x,F=Bt(x)),F};function i(x){if(typeof x=="boolean")return x;let F=n.get(x);F||n.set(x,F=et(x));let{context:E,env:w}=e.reading();return F.evaluate(E,w)}let o=x=>{let F=x.trim();return _n.test(F)?F:null};function a(x,F){let E=o(x);if(F&&E!==null&&E in e.fields)return Ae(e.values()[E]);let{context:w,env:A}=e.reading();return r(x).evaluate(w,A)}function s(x,F){let E=e.values();for(let[w,A]of Object.entries(e.fields)){if(A.type!=="many2one"&&A.type!=="many2many"||A.relation!==x)continue;let R=E[w],M=(Array.isArray(R)?R:R?[R]:[]).find(P=>P&&P.id===F);if(M)return M.label}}function d(x,F,E=()=>{}){let w=A=>{if(A==null||A===!1||A==="")return null;let R=x.relation,I=M=>E(M)??s(R,M)??String(M);if(typeof A=="number"||typeof A=="string")return{id:A,label:I(A)};if(typeof A=="object"&&!Array.isArray(A)&&"id"in A){let M=A;return{id:M.id,label:typeof M.label=="string"?M.label:I(M.id)}}return null};return x.type==="many2one"?w(F):x.type==="many2many"?(Array.isArray(F)?F:[F]).map(w).filter(A=>A!==null):On(x,F)}function l(x){let F=e.fields[x];if(!F)throw new Error(`The page has no field "${x}"`);return F}async function f(x){return e.host?e.host.ask(x):e.confirm?e.confirm(x):!0}function c(x){return{reason:"cannot",message:x}}async function y(x,F){let E=e.host;if(!E)return c(`Nothing can open "${x.page}" here: the form has no host`);let w=x.record!==void 0?a(x.record,!1):null,A={page:x.page,...x.version!==void 0?{version:x.version}:{},as:x.as??"dialog",...x.side&&x.as==="panel"?{side:x.side}:{},...x.title!==void 0?{title:x.title}:{},recordId:typeof w=="number"||typeof w=="string"&&w!==""?w:null,...x.values?{values:p(x.values)}:{},...x.filter?{filter:ai(x.filter,e.reading().context)}:{}},R;try{R=await E.open(A)}catch(M){return{reason:"cannot",message:To(M),error:M}}if(!R.saved)return{reason:"closed"};if(x.into&&e.write(k(x.into,R)),!x.then)return null;let I=await S(x.then,F);return I.done?null:{reason:I.reason,message:I.message,step:I.step,error:I.error}}function p(x){let F={};for(let[E,w]of Object.entries(x))F[E]=a(w,!0)??null;return F}function k(x,F){let E=F.values??{},w=F.recordId??null,A={...Vc(E),id:w},R=[F.label,E.display_name,E.name].find(P=>typeof P=="string"&&P!==""),I=P=>P===w?R:void 0,M={};for(let[P,H]of Object.entries(x)){let D=l(P),W=o(H),z=W==="id"?w:W!==null&&!$o.has(D.type)&&W in E?E[W]:r(H).evaluate(A,{today:e.today});M[P]=d(D,z,I)}return M}async function g(x,F){let E={id:F.id,action:x.action,...x.params?{params:Ae(x.params)}:{},recordId:e.recordId(),values:Ae(e.values()),...F.recordIds?{recordIds:[...F.recordIds]}:{},...F.line?{line:Ae(F.line)}:{},...F.lines?{lines:Ae(F.lines)}:{}};if(!e.onAction)return null;let w;try{w=await e.onAction(E)??void 0}catch(A){return{reason:"app",message:To(A),error:A}}if(e.answered(E,w),!w)return null;if(w.reload){let A=await e.reload();if(A)return A}if(w.values){let A={};for(let[R,I]of Object.entries(w.values))R in e.fields&&(A[R]=d(e.fields[R],I));e.write(A)}if(w.say!==void 0){let A=typeof w.say=="string"?{message:w.say}:w.say;e.host?.say(A.message,A.tone??"info")}if(w.post!==void 0){let A=typeof w.post=="string"?{message:w.post}:w.post,R=await m(A.message,A.kind??"note",!1);if(R)return R}if(w.record!==void 0){let A=await e.showRecord(w.record);if(A)return A}if(w.open){let A=await y(w.open,F);if(A)return A}return w.stop?(typeof w.stop=="string"&&e.host?.say(w.stop,"warning"),{reason:"app",...typeof w.stop=="string"?{message:w.stop}:{}}):null}async function m(x,F,E){let w=E?Un(x):[{text:x}],A=w.map(M=>M.field?e.wordsOf(M.field):M.text).join(""),R=w.map(M=>M.field&&e.fields[M.field]?.type==="html"?String(e.values()[M.field]??""):Ic(M.field?e.wordsOf(M.field):M.text)).join("");return await e.post({kind:F,text:A,body:`<p>${R}</p>`})?null:c("Nothing can post a message here: no conversation is beside this record")}async function b(x,F,E){return e.onAction?g({action:x},E):c(`Nothing can ${x} this record here: the data source has no ${F}, and the app takes no actions`)}async function h(x,F){let E=e.recordId();if(E==null)return c(`A new record cannot be ${x==="duplicate"?"duplicated":x==="delete"?"deleted":`${x}d`}: it is not saved yet`);if(x==="archive"||x==="unarchive")return e.archive?(await e.archive(x==="archive"),e.told({archived:x==="archive"},E),e.reload()):b(x,"archive",F);if(x==="duplicate"){if(e.changed()){let R=await e.save(F.chain);if(R)return R}if(!e.copy){let R=await b(x,"copy",F),I=e.recordId();return!R&&I!=null&&I!==E&&e.told({copied:I},E),R}let w=await e.copy(),A=await e.showRecord(w);return A||(e.told({copied:w},E),null)}if(!e.remove){let w=await b(x,"delete",F);return w||e.told({deleted:!0},E),w}return await e.remove(),e.told({deleted:!0},E),null}async function v(x,F){switch(x.do){case"set":{let E=l(x.field);return e.write({[x.field]:d(E,a(x.value,!$o.has(E.type)))}),null}case"clear":return e.write({[x.field]:Cn(l(x.field))}),null;case"addLine":{let E=l(x.field);if(E.type!=="one2many")return c(`"${x.field}" is a ${E.type}; a line is added to a one2many`);let w={};for(let[A,R]of Object.entries(x.values??{})){let I=E.fields[A];if(!I)return c(`The lines of "${x.field}" have no field "${A}"`);w[A]=d(I,a(R,!$o.has(I.type)))}return e.addLine(x.field,w),null}case"check":return e.check(x.fields);case"save":return e.save(F.chain);case"reset":return e.reset(),null;case"goTo":{let E=e.goTo(x.target,F.chain);if(E!==void 0)return E;let w=e.host?.show;return w?(e.showing(F.chain,()=>w.call(e.host,x.target)),null):c(`Nothing can show "${x.target}" here: the form has no host that shows tabs`)}case"say":return e.host?.say(x.message,x.tone??"info"),null;case"ask":return await f(x.message)?null:{reason:"no",message:x.message};case"call":return g(x,F);case"open":return y(x,F);case"close":{let E=e.host?.close;return E?(E.call(e.host),null):c("Nothing can close this form: it has no host, or was not opened in a dialog or panel")}case"reload":return e.reload();case"openUrl":{let E=e.host?.openUrl;if(!E)return c("Nothing can open a web address here: the form has no host that opens one");let w=a(x.url,!1);return typeof w!="string"||!w.trim()?c(`"${x.url}" gives no address to open`):(E.call(e.host,w.trim(),x.newTab??!0),null)}case"archive":case"unarchive":case"duplicate":case"delete":return h(x.do,F);case"post":return m(x.message,x.kind??"note",!0)}}async function S(x,F){for(let E=0;E<x.length;E++){let w=x[E],A;try{if(w.when!==void 0&&!i(w.when))continue;A=await v(w,F)}catch(R){A={reason:"cannot",message:To(R),error:R}}if(A)return{done:!1,stoppedAt:E,step:A.step??w,reason:A.reason,...A.message!==void 0?{message:A.message}:{},...A.error!==void 0?{error:A.error}:{}}}return fi}return{runSteps:S,ask:f}}function Vc(e){let t={},n=r=>{if(r===null||typeof r!="object")return r;let i=r;return"key"in i&&"values"in i?i.key:"model"in i&&"id"in i?`${i.model},${i.id}`:"id"in i?i.id:"name"in i&&"type"in i&&"size"in i?i.name:r};for(let[r,i]of Object.entries(e))t[r]=Array.isArray(i)?i.map(n):n(i);return t}function Ns(e){let t=new Map;return function(r,i,o,a){if(!i?.length||o.includes(r))return Promise.resolve(fi);let s=l=>{let f,c=new Promise(y=>f=y).finally(()=>{l.running===c&&!l.queued&&t.delete(r)});return l.running=c,f(e(r,i,[...o,r])),c},d=t.get(r);if(!d){let l={running:Promise.resolve(fi)};return t.set(r,l),s(l)}if(!a)return Promise.resolve(fi);if(!d.queued){let l=()=>(d.queued=void 0,s(d));d.queued=d.running.then(l,l)}return d.queued}}function Ic(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]).replace(/\n/g,"<br>")}function pi(e){return Os(e,[]).form}var Cs=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Mo=e=>e;function Os(e,t){let{page:n}=e,r=e.scheduler??Sr,i=e.messages??Tt.en,o=Bc(n.layout),a=new Map;for(let u of o.values()){let L=u.source.validate;u.kind==="field"&&L&&a.set(u.id,Ls(L))}let s=new Map;for(let u of o.values()){let L=u.source;u.kind!=="field"||n.fields[L.field]?.type!=="one2many"||(L.cells||L.rowTones||L.rowBold!==void 0||L.rowButtons||L.lineDelete!==void 0)&&s.set(u.id,{field:L.field,compiled:Ts(L)})}let d=new Map;for(let u of o.values()){let L=u.source;u.kind==="field"&&(L.tones||L.bold!==void 0)&&d.set(u.id,$s(L))}let l=new Map;for(let u of o.values()){let L=u.source;u.kind==="field"&&L.order?.length&&n.fields[L.field]?.type==="one2many"&&!l.has(L.field)&&l.set(L.field,L.order)}function f(u,L){let T=u;for(let[C,q]of l){if(L&&!L.includes(C))continue;let Z=u[C];if(!Array.isArray(Z)||Z.length<2)continue;let ee=[...Z].sort(($e,Fe)=>jc($e.values,Fe.values,q));ee.some(($e,Fe)=>$e!==Z[Fe])&&(T={...T,[C]:ee})}return T}let c=new Map,y=(u,L)=>{L.placeholderWhen?.length&&c.set(u,{fixed:L.placeholder,when:L.placeholderWhen.map(T=>({text:T.text,holds:et(T.when)}))})};for(let u of o.values())u.kind==="field"&&"type"in u.source&&y(u.id,u.source);n.layout.type==="sheet"&&n.layout.title&&y("#title",n.layout.title);let p=[...a.values()].some(u=>u.some(L=>L.rule.level==="warning")),k=n.layout.type==="wizard"?n.layout.children.map(u=>u.id):[],g=()=>`fieldia:draft:${n.id}:${$.recordId??"new"}`,m=()=>hn(e.now?.()??new Date),b=!1,h=e.editing!==!1,v=e.parent?qt(e.parent.values,e.parent.fields,{recordId:e.parent.id??null,user:e.user,context:e.context}):void 0,S=()=>({recordId:b?$.recordId:e.recordId??null,user:e.user,editing:h,context:e.context,parent:v}),x=ws(n,m,S),F=Ss(n,m,S),E=new Map;for(let u of o.values())u.kind==="form"&&E.set(u.id,u.source);let w=new Map,A={...n.fields};for(let u of E.values())A[u.name]={type:"json",label:u.title||u.name};let R=!1;function I(u=e.recordId==null,L=!0){let T=xn(A,m());if(u){let C={recordId:null,user:e.user,context:e.context,parent:v};Object.assign(T,Ro(n.fields,P(T,n.fields,qt(T,n.fields,C),Pn(T,n.fields,m))))}return L?f({...T,...Ae(e.values??{})}):T}function M(u,L){let T=b?$.values:{};for(let[C,q]of Object.entries(n.fields)){if(q.type!=="many2one"&&q.type!=="many2many"||q.relation!==u)continue;let Z=T[C],ee=(Array.isArray(Z)?Z:Z?[Z]:[]).find($e=>$e?.id===L);if(ee)return ee.label}}function P(u,L,T,C,q){return{values:u,fields:L,context:T,env:C,...q?{parent:q}:{},...e.user?{user:e.user}:{},labelOf:M}}function H(){let{context:u,env:L}=me();return P($.values,n.fields,u,L)}function D(u,L){let C=Re(u).fields;return P(L,C,kn(L,C,me().context),{today:m},{values:$.values,fields:n.fields})}function W(u){let L=s.get(u);if(L)return L;let T=o.get(u);if(T?.kind!=="field"||n.fields[T.field]?.type!=="one2many")throw new Error(`"${u}" is not a table of lines`);return null}function z(u,L){let T=W(u);if(!T)return{tone:null,bold:!1,cells:{},buttons:{},deletable:!0};let C=($.values[T.field]??[]).find(Z=>Z.key===L);if(!C)throw new Error(`"${T.field}" has no line "${L}"`);let q=Re(T.field);return T.compiled.line(kn(C.values,q.fields,me().context,C.id??null),{today:m},ke)}function j(u,L){if(!L){let q=be(u);return q.type==="many2one"||q.type==="many2many"?q.createValues?Eo(q.createValues,H()):{}:{}}let T=($.values[L.lines]??[]).find(q=>q.key===L.key),C=Re(L.lines).fields[u];return!T||!C||C.type!=="many2one"&&C.type!=="many2many"||!C.createValues?{}:Eo(C.createValues,D(L.lines,T.values))}let V=x.apply(I()),B=F.holding(V),$={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:Ae(V),errors:{},dirty:[],warnings:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null,choices:{},definitions:{}};b=!0;let Q={},X=0,J=0,_=null,te=null,Ve=new Set,Ie=new Set,Ee=new Map,Me=[],ie=!1,ge=null,oe=null,ke=[...e.user?.roles??[]],De={};function xe(u){let L=$.values,T=$.errors;if($={...$,...u},$.errors!==T)for(let C of w.values())C.inner.show(Dc($.errors,C.name));for(let C of[...Ie])C($);if($.values!==L){for(let C in $.choices)U(C).dependsOn?.some(q=>L[q]!==$.values[q])&&re(C);for(let C in $.definitions)Ce(C).dependsOn?.some(q=>L[q]!==$.values[q])&&ae(C)}ie&&$.step!==ge&&ne(Me)}function Xe(u,L){let T=Ee.get(u);if(T)for(let C of[...T])C(L)}function Y(u,L){Xe("change",{field:u,value:$.values[u],values:$.values,by:L});let T=n.on?.change?.[u];L==="person"&&T&&ce(we(`on.change.${u}`,T,[],!0))}function ne(u){let L=$.step;if(L===ge||L===null)return;ge=L,Xe("step",{step:L});let T=n.on?.show?.[L];T&&ce(we(`on.show.${L}`,T,u,!0))}function fe(u,L){let T=Me;Me=u;try{L()}finally{Me=T}}let U=u=>n.fields[u].optionsFrom;function re(u){let{list:L}=U(u),T=De[u]=(De[u]??0)+1,C=ee=>T===De[u]&&xe({choices:{...$.choices,[u]:ee}}),q=$.choices[u]?.options??null;C({options:q,loading:!0});let Z=e.dataSource;ce((Z?.options?Z.options({list:L,values:Ae($.values)}):Promise.reject(new Error(`No list "${L}"`))).then(ee=>C({options:ee}),ee=>C({options:q,error:ee.message??String(ee)})))}let Ce=u=>n.fields[u].definitionsFrom,Pe={};function ae(u){let{list:L}=Ce(u),T=Pe[u]=(Pe[u]??0)+1,C=ee=>T===Pe[u]&&xe({definitions:{...$.definitions,[u]:ee}}),q=$.definitions[u]?.definitions??null;C({definitions:q,loading:!0});let Z=e.dataSource;ce((Z?.definitions?Z.definitions({list:L,values:Ae($.values)}):Promise.reject(new Error(`No definitions "${L}"`))).then(ee=>C({definitions:ee}),ee=>C({definitions:q,error:ee.message??String(ee)})))}async function le(u,L){let{list:T}=Ce(u),C=[...$.definitions[u]?.definitions??[],L];xe({definitions:{...$.definitions,[u]:{definitions:C}}}),await ce(e.dataSource?.saveDefinitions?.({list:T,values:Ae($.values),definitions:C})??Promise.resolve())}function se(u){let L=n.fields[u],T=$.choices[u]?.options;return L.type==="selection"&&L.optionsFrom&&T?{...L,options:T,optionsFrom:void 0}:L}function ce(u){Ve.add(u);let L=()=>Ve.delete(u);return u.then(L,L),u}function me(){if(oe?.values!==$.values||oe.recordId!==$.recordId||oe.editing!==h){let u=$.values,L=qt(u,n.fields,S());oe={values:u,recordId:$.recordId,editing:h,context:L,env:Pn(u,n.fields,m)}}return oe}let he=()=>me().context;function be(u){let L=A[u];if(!L)throw new Error(`The page has no field "${u}"`);return L}function rt(u){return Object.keys(A).filter(L=>JSON.stringify(u[L]??null)!==JSON.stringify(V[L]??null))}function ht(u){let L=o.get(u);if(!L)throw new Error(`The page has no element "${u}"`);let{context:T,env:C}=me(),q=Fe=>Fe?!Nn(Fe.roles,ke)||Fe.invisible.evaluate(T,C):!1,Z=q(L);for(let Fe=L.parent;!Z&&Fe;Fe=o.get(Fe)?.parent??null)Z=q(o.get(Fe));let ee=L.readonly.evaluate(T,C);for(let Fe=L.parent;!ee&&Fe;Fe=o.get(Fe)?.parent??null)ee=o.get(Fe)?.readonly.evaluate(T,C)??!1;let $e=L.field?n.fields[L.field]:void 0;return{invisible:Z,readonly:ee||$e!==void 0&&Ps($e),required:L.required.evaluate(T,C)||$e?.required===!0}}function St(u,L="field"){let T=q=>{if(!u)return!0;for(let Z=q.id;Z;Z=o.get(Z)?.parent??null)if(Z===u)return!0;return!1},C=q=>{if(u||!$.skipped.length)return!1;for(let Z=q.id;Z;Z=o.get(Z)?.parent??null)if($.skipped.includes(Z))return!0;return!1};return[...o.values()].filter(q=>q.kind===L&&T(q)&&!C(q)&&!ht(q.id).invisible)}function Zt(u){let L=a.get(u.id);if(!L)return{};let T=u.field,C=n.fields[T],q=u.source.label??C.label,{context:Z,env:ee}=me();return Es(C,q,$.values[T],L,{context:Z,env:ee,now:e.now?.()??new Date,messages:i})}function ar(u){let L=u.field;return u.source.widget==="tick"&&n.fields[L].type==="boolean"&&$.values[L]!==!0&&ht(u.id).required?i.tick:void 0}function jr(u){let L=u.field;return ar(u)??So(n.fields[L],u.source,$.values[L],i)??wn(se(L),$.values[L],ht(u.id).required,i,m())??Zt(u).error}function Qt(){var L;let u={};if(!p)return u;for(let T of St()){let C=a.has(T.id)?Zt(T).warning:void 0;C&&(u[L=T.field]??(u[L]=C))}return u}function _t(u,L){let T=$;$={...$,values:u};try{return L()}finally{$=T}}function jt(u){let L={};for(let T of St(u)){let C=T.field;if(L[C])continue;let q=n.fields[C],Z=jr(T);if(Z&&(L[C]=Z),q.type==="one2many")for(let ee of $.values[C]??[]){let $e=gt(q,ee.values),Fe=s.has(T.id)?z(T.id,ee.key).cells:{};for(let[O,G]of Object.entries(q.fields)){if($e&&O!==q.lineKinds?.text)continue;let de=Fe[O];if(de?.invisible||s.has(T.id)&&s.get(T.id).compiled.hidden(O,me().context,me().env,ke))continue;let pe=wn(G,ee.values[O],G.required===!0||de?.required===!0,i,m());pe&&(L[`${C}.${ee.key}.${O}`]=pe)}}}for(let T of St(u,"form")){let C=w.get(T.id);if(C)for(let[q,Z]of Object.entries(C.inner.errorsNow()))L[`${C.name}.${q}`]=Z}return L}function fn(u,L){let T=u;for(let C of w.values())if(!(L!=="start"&&T[C.name]===C.inner.form.getState().values)){R=!0;try{C.inner.take(Cs(T[C.name])?T[C.name]:{},L)}finally{R=!1}T={...T,[C.name]:Mo(C.inner.form.getState().values)}}return T}function eo(u){let L=x.apply(u);for(let T=0;T<8;T++){let C=F.apply(L,B);if(B=C.holding,C.values===L)break;L=x.apply(C.values)}return L}function un(u){let L=x.apply(u);return B=F.holding(L),L}function Lt(u,L={},T=!1){let C=fn(T?un(u):eo(u),T?"fresh":"edit"),q=Object.keys($.errors).length?Et(C):$.errors,Z={};for(let ee of Object.keys(u)){let $e=n.fields[ee];if(!(u[ee]===$.values[ee]||!$e)&&(ui($e,u[ee])&&(Z[ee]=wn($e,u[ee],!1,i)),$e.type==="one2many"))for(let Fe of u[ee]??[])for(let[O,G]of Object.entries(Fe.values))ui($e.fields[O],G)&&(Z[`${ee}.${Fe.key}.${O}`]=wn($e.fields[O],G,!1,i))}Object.keys(Z).length&&(q={...q,...Z}),xe({values:C,dirty:rt(C),errors:q,warnings:_t(C,Qt),...L})}function Et(u){let L=_t(u,()=>jt($.step??void 0)),T={};for(let C of Object.keys($.errors))L[C]&&(T[C]=L[C]);for(let[C,q]of Object.entries(Q))JSON.stringify(u[C]??null)===q.value?T[C]??(T[C]=q.message):delete Q[C];return T}function pn(){let u=e.drafts;u&&(_!==null&&r.clearTimeout(_),_=r.setTimeout(()=>{_=null,u.store.setItem(g(),JSON.stringify({savedAt:new Date().toISOString(),values:$.values}))},u.delayMs??400))}function Rn(){_!==null&&r.clearTimeout(_),_=null,e.drafts?.store.removeItem(g())}function zn(){let u=e.drafts;if(!u)return;let L=u.store.getItem(g());if(!L)return;let T;try{T=JSON.parse(L)}catch{u.store.removeItem(g());return}u.restore==="auto"?Lt({...$.values,...T.values},{draft:null},!0):xe({draft:{savedAt:T.savedAt}})}function to(){let u=e.autosave;!u||n.data.kind!=="record"||(te!==null&&r.clearTimeout(te),te=r.setTimeout(()=>{te=null,$.dirty.length&&Object.keys(jt()).length===0&&ce(lr())},u.delayMs))}function no(u){let L=e.dataSource;if(!L?.onchange||n.data.kind!=="record"||_c(n.fields[u],$.values[u]))return;let T=++J,C={model:n.data.model,id:$.recordId,changed:u,values:Ae($.values)};ce(L.onchange(C).then(q=>{if(T!==J)return;let Z={...$.values,...q.values??{}};Lt(Z,{warning:q.warning??null,warningField:q.warning?u:null})},()=>{}))}function Ut(u){pn(),to(),no(u)}function sr(){let u={values:{},lines:{},links:{}},L=$.recordId===null||$.recordId===void 0,T=L?Object.keys(A).filter(C=>$.dirty.includes(C)||!Kt(A[C],$.values[C])):$.dirty;for(let C of T){let q=A[C],Z=$.values[C],ee=L?Cn(q):V[C];q.type==="one2many"?u.lines[C]=Hc(ee??[],Z??[]):q.type==="many2many"?u.links[C]=zc(ee??[],Z??[]):u.values[C]=Ae(Z)}return u}function dr(){let u={};for(let L of St()){let T=L.field;u[T]=Ae($.values[T])}for(let L of St(void 0,"form")){let T=w.get(L.id);T&&(u[T.name]=Ae($.values[T.name]))}return u}async function lr(u=[]){return await cr(u)===null}async function cr(u){if(n.on?.beforeSave){let C=await we("on.beforeSave",n.on.beforeSave,u,!1);if(!C.done){if(C.reason!=="check"&&C.reason!=="save"){let q={kind:"stopped",reason:C.reason,message:C.message??""};xe({status:"error",error:q.message||null,saveProblem:q})}return{reason:"save",...C.message!==void 0?{message:C.message}:{}}}}let L=jt();if(Object.keys(L).length)return xe({errors:L}),{reason:"save",message:Object.values(L)[0]};let T=e.dataSource;Q={},xe({status:"saving",errors:{},error:null,saveProblem:null});try{if(n.data.kind==="responses"){if(!T?.submit)throw new Error("This page has no data source to send its answers to");let Z=dr();return await T.submit({pageId:n.id,values:Z}),Rn(),xe({status:"saved"}),Xe("send",{values:Z}),ce(we("on.afterSave",n.on?.afterSave,u,!1)),null}if(!T?.save)throw new Error("This page has no data source to save to");let C=await T.save({model:n.data.model,id:$.recordId,fields:A,changes:sr(),values:Ae($.values)});Rn();let q=fn(un(C.values?f({...$.values,...C.values},Object.keys(C.values)):$.values),"start");return V=Ae(q),xe({status:"saved",recordId:C.id,values:q,dirty:[],warnings:_t(q,Qt)}),Xe("save",{recordId:$.recordId,values:$.values}),ce(we("on.afterSave",n.on?.afterSave,u,!1)),null}catch(C){let q=oi(C),Z=q.kind==="fields"?q.fields??{}:{};return Q=Object.fromEntries(Object.entries(Z).map(([ee,$e])=>[ee,{message:$e,value:JSON.stringify($.values[ee]??null)}])),xe({status:"error",error:q.message,saveProblem:q,errors:{...Z}}),{reason:"save",message:q.message}}}async function en(){Xe("open",{recordId:$.recordId,values:$.values}),await we("on.open",n.on?.open,[],!0),ie=!0,ne([])}function Hr(u,L){let T=Object.keys(u);if(T.forEach(be),!!T.length){Lt({...$.values,...Ae(u)});for(let C of T)Ut(C);for(let C of T)Y(C,L)}}function fr(u,L,T){let C=Re(u),q=$.values[u]??[],Z=`new-${++X}`;for(;q.some(G=>G.key===Z);)Z=`new-${++X}`;let ee=C.fields,$e=xn(ee,m());Object.assign($e,Ro(ee,D(u,$e))),C.lineDefaults&&Object.assign($e,As(C.lineDefaults,ee,H()));let Fe={key:Z,values:{...$e,...Ae(L)}};if(C.sequenceField&&Fe.values[C.sequenceField]==null){let G=q.map(de=>de.values[C.sequenceField]).filter(de=>typeof de=="number");Fe.values[C.sequenceField]=G.length?Math.max(...G)+1:1}let O=[...q,Fe];return Lt({...$.values,[u]:O}),Ut(u),Y(u,T),Z}function zr(u){u?.forEach(be);let L=jt(),T=u?Object.fromEntries(Object.entries(L).filter(([q])=>u.some(Z=>q===Z||q.startsWith(`${Z}.`)))):L;xe({errors:T});let C=Object.values(T)[0];return C===void 0?null:{reason:"check",message:C}}function N(u,L){if(!k.includes(u))return;if(!ve.steps().includes(u))return{reason:"cannot",message:`The step "${u}" does not apply now`};let T=!1;return fe(L,()=>T=ve.goTo(u)),T?null:{reason:"check",message:Object.values($.errors)[0]}}async function K(u,L){let T=await st.runSteps(u,L);return Xe("run",{id:L.id,steps:u,result:T}),T}function ue(u){return!e.dataSource?.create||!u||u.readonly?null:u.type==="many2one"||u.type==="many2many"?u.relation:null}async function Se(u,L,T,C={}){let q=ue(u),Z=e.dataSource;if(!q||!Z?.create)throw new Error(`"${L}" cannot make records: its data source has no create, or it is not a link`);return ce(Z.create({model:q,name:T.trim(),...Object.keys(C).length?{values:C}:{}}))}async function Ne(u,L,T,C,q,Z,ee){if(u.type!=="many2one"&&u.type!=="many2many"&&u.type!=="reference"&&u.type!=="json")throw new Error(`"${L}" is not a many2one, many2many, reference or json`);if((u.type==="reference"||u.type==="json")&&!Z)throw new Error(`Searching "${L}" needs a model`);let $e=e.dataSource;if(!$e?.search)return[];let Fe=u.type==="reference"||u.type==="json"||!u.filter?void 0:ai(u.filter,T),O=ee?[...Fe??[],{field:"id",op:"in",value:ee}]:Fe,G=u.type==="reference"||u.type==="json"?Z:u.relation;return ce($e.search({model:G,query:C,...O?{filter:O}:{},limit:q}))}function Re(u){let L=be(u);if(L.type!=="one2many")throw new Error(`"${u}" is a ${L.type}, not a one2many`);return L}function bt(){return $.step?k.indexOf($.step):-1}function lt(u){return o.get(u)?.source?.optional===!0}async function vt(u=!1){let L=e.dataSource;if($.recordId==null||n.data.kind!=="record")return;if(!L?.load){xe({status:"error",error:"This page has no data source to load from"});return}let T=++dt;xe({status:"loading",error:null});try{let C=await L.load({model:n.data.model,id:$.recordId,fields:A});if(T!==dt||(V=fn(un(f({...xn(A,m()),...C})),"start"),xe({status:"ready",values:Ae(V),dirty:[],errors:{},warnings:_t(V,Qt)}),u))return;zn(),ce(en())}catch(C){T===dt&&xe({status:"error",error:C.message})}}let dt=0;async function Qe(u){_!==null&&r.clearTimeout(_),te!==null&&r.clearTimeout(te),_=te=null,Q={},ge=null,ie=!1;let L={dirty:[],errors:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null};if(u!=null)return xe({...L,recordId:u,status:"idle"}),vt();dt++,V=un(I(!0,!1));let T=fn(Ae(V),"start");xe({...L,recordId:null,status:"ready",values:T,warnings:_t(T,Qt)}),zn(),await en()}let ct=()=>({model:n.data.model,id:$.recordId,fields:A});async function Be(u){if(e.host?.post)try{return await e.host.post(u)!==!1}catch{return!1}return Ee.get("post")?.size?(Xe("post",{recordId:$.recordId,message:u}),!0):!1}let st=Ms({fields:A,values:()=>$.values,recordId:()=>$.recordId,reading:me,today:m,write:u=>Hr(u,"step"),addLine:(u,L)=>{fr(u,L,"step")},check:zr,save:cr,async reload(){return $.recordId==null?{reason:"cannot",message:"The record is not saved yet: there is nothing to load again"}:(await vt(!0),$.status==="error"?{reason:"cannot",message:$.error??"The record could not be loaded again"}:null)},reset:()=>ve.reset(),goTo:N,showing:fe,host:e.host,confirm:e.confirm,onAction:e.onAction,answered:(u,L)=>Xe("action",{request:u,result:L}),changed:()=>$.dirty.length>0,...e.dataSource?.archive&&n.data.kind==="record"?{archive:u=>ce((e.dataSource?.archive)({...ct(),archive:u}))}:{},...e.dataSource?.copy&&n.data.kind==="record"?{copy:async()=>(await ce((e.dataSource?.copy)(ct()))).id}:{},...e.dataSource?.delete&&n.data.kind==="record"?{remove:()=>ce((e.dataSource?.delete)(ct()))}:{},async showRecord(u){return await Qe(u),$.status==="error"?{reason:"cannot",message:$.error??"The record could not be loaded"}:null},told(u,L){"archived"in u?Xe("archive",{recordId:L,archived:u.archived}):"copied"in u?Xe("duplicate",{from:L,recordId:u.copied}):(Xe("delete",{recordId:L}),$.recordId===L&&ce(Qe(null)))},post:Be,wordsOf:u=>qc(be(u),$.values[u])}),we=Ns((u,L,T)=>K(L,{id:u,chain:T}));function Ue(u,L){let T=[...u.steps??[]];u.action!==void 0&&T.push({do:"call",action:u.action,..."params"in u&&u.params?{params:u.params}:{}});let C="builtin"in u&&!T.length?u.builtin:void 0;C&&T.push({do:C});let q=C==="archive"?i.archiveConfirm:C==="delete"?i.deleteConfirm:void 0,Z="confirm"in u&&u.confirm!==void 0?u.confirm:q;return ce((async()=>{if(Z&&!await st.ask(Z)){let ee={done:!1,reason:"no",message:Z};return Xe("run",{id:L.id,steps:T,result:ee}),ee}return K(T,L)})())}let ve={page:n,getState:()=>$,subscribe(u){return Ie.add(u),()=>Ie.delete(u)},load:()=>ce(vt()),setValue(u,L,T){be(u),Lt({...$.values,[u]:Ae(L)}),Ut(u),Y(u,T?.by??"person")},setValues:u=>Hr(u,"app"),node:ht,openRecord:u=>ce(Qe(u)),post:Be,setEditing(u){u!==h&&(h=u,xe({}))},fieldReadonly:u=>Ps(be(u)),loadChoices:re,loadDefinitions:ae,addDefinition:le,problem(u){be(u);let L=St().filter(C=>C.field===u);return L.length?L.map(ar).find(Boolean)??L.map(C=>So(n.fields[u],C.source,$.values[u],i)).find(Boolean)??wn(se(u),$.values[u],L.some(C=>ht(C.id).required),i,m())??L.map(C=>Zt(C).error).find(C=>C!==void 0)??null:null},validate(){let u=jt();return xe({errors:u}),Object.keys(u).length===0},save:()=>ce(lr()),reset(){Rn(),Q={},B=F.holding(V);let u=fn(Ae(V),"start");xe({values:u,dirty:[],errors:{},warnings:_t(u,Qt),warning:null,warningField:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null})},changes:sr,addLine:(u,L={})=>fr(u,L,"person"),updateLine(u,L,T,C){if(!Re(u).fields[T])throw new Error(`The lines of "${u}" have no field "${T}"`);let Z=($.values[u]??[]).map(ee=>ee.key===L?{...ee,values:{...ee.values,[T]:Ae(C)}}:ee);Lt({...$.values,[u]:Z}),Ut(u),Y(u,"person")},moveLine(u,L,T){let q=Re(u).sequenceField;if(!q)throw new Error(`The lines of "${u}" keep no order: give the field a sequenceField`);let Z=[...$.values[u]??[]],ee=Z.findIndex(Le=>Le.key===L);if(ee<0)throw new Error(`"${u}" has no line "${L}"`);let $e=Math.max(0,Math.min(T,Z.length-1));if($e===ee)return;let Fe=Z.map(Le=>Le.values[q]),O=Fe.every((Le,ye)=>typeof Le=="number"&&(ye===0||Le>Fe[ye-1]));Z.splice($e,0,...Z.splice(ee,1));let G=Math.min(ee,$e),de=Math.max(ee,$e),pe=O?Fe.slice(G,de+1):[],Oe=Z.map((Le,ye)=>{let je=O?ye>=G&&ye<=de?pe[ye-G]:Le.values[q]:ye+1;return je===Le.values[q]?Le:{...Le,values:{...Le.values,[q]:je}}});Lt({...$.values,[u]:Oe}),Ut(u),Y(u,"person")},removeLine(u,L){Re(u);for(let[C,q]of s)if(!(q.field!==u||(o.get(C)?.source).lineDelete===void 0)&&($.values[u]??[]).some(Z=>Z.key===L)&&!z(C,L).deletable)throw new Error(`The line "${L}" of "${u}" cannot be deleted now: its table's lineDelete does not hold on it`);let T=($.values[u]??[]).filter(C=>C.key!==L);Lt({...$.values,[u]:T}),Ut(u),Y(u,"person")},async search(u,L,T=8,C={}){return Ne(be(u),u,he(),L,T,C.model,C.ids)},async previewLine(u,L,T){Re(u);let C=$.values[u]??[],q=C.find(G=>G.key===L);if(!q)throw new Error(`"${u}" has no line "${L}"`);let Z=x.line(u,{...q.values,...T},$.values),ee=e.dataSource;if(!ee?.onchange||n.data.kind!=="record")return Z;let $e=C.map(G=>G.key===L?{...G,values:Z}:G),O=((await ee.onchange({model:n.data.model,id:$.recordId,changed:u,values:Ae({...$.values,[u]:$e})})).values?.[u]??[]).find(G=>G.key===L);return O?x.line(u,{...Z,...O.values},$.values):Z},async searchLine(u,L,T,C,q=8,Z={}){let ee=Re(u),$e=ee.fields[T];if(!$e)throw new Error(`The lines of "${u}" have no field "${T}"`);let Fe=($.values[u]??[]).find(O=>O.key===L);if(!Fe)throw new Error(`"${u}" has no line "${L}"`);return Ne($e,T,kn(Fe.values,ee.fields,he(),Fe.id??null),C,q,Z.model,Z.ids)},canCreate:u=>ue(n.fields[u])!==null,quickCreate:(u,L)=>Se(n.fields[u],u,L,n.fields[u]?j(u):{}),canCreateLine:(u,L)=>ue(Re(u).fields[L])!==null,quickCreateLine:(u,L,T,C)=>Se(Re(u).fields[L],L,T,C?j(L,{lines:u,key:C}):{}),createValues:(u,L)=>j(u,L),steps:()=>k.filter(u=>!ht(u).invisible),next(){if(!$.step)return!1;$.skipped.includes($.step)&&xe({skipped:$.skipped.filter(C=>C!==$.step)});let u=jt($.step);if(Object.keys(u).length)return xe({errors:u}),!1;let L=ve.steps(),T=k.slice(bt()+1).find(C=>L.includes(C));return T?(xe({step:T,errors:{}}),!0):!1},back(){if(!$.step)return!1;let u=ve.steps(),L=k.slice(0,bt()).reverse().find(T=>u.includes(T));return L?(xe({step:L,errors:{}}),!0):!1},skip(){let u=$.step;if(!u||!lt(u))return!1;let L=ve.steps(),T=L[L.indexOf(u)+1];return T?(xe({step:T,errors:{},skipped:[...$.skipped.filter(C=>C!==u),u]}),!0):!1},goTo(u){let L=ve.steps(),T=L.indexOf(u),C=$.step?L.indexOf($.step):-1;if(T===-1||C===-1)return!1;if(T<=C)return xe({step:u,errors:{}}),!0;let q=[...$.skipped];for(let Z of L.slice(C,T)){if(q.includes(Z))continue;let ee=jt(Z);if(Object.keys(ee).length){if(lt(Z)){q.push(Z);continue}return xe({step:Z,errors:ee,skipped:q}),!1}}return xe({step:u,errors:{},skipped:q}),!0},async runAction(u,L){let T=o.get(u);if(!T||T.kind!=="button"&&T.kind!=="stat")throw new Error(`The page has no button "${u}"`);return ht(u).invisible?{done:!1,reason:"cannot",message:`The button "${u}" is hidden`}:T.parent&&o.get(T.parent)?.source?.selectedButtons?.some(C=>C.id===u)?{done:!1,reason:"cannot",message:`The button "${u}" runs with the lines chosen in its table`}:Ue(T.source,{id:u,chain:[],...L?{recordIds:[...L.recordIds]}:{}})},async linkedValues(u,L,T){let C=be(u);if(C.type!=="many2many")throw new Error(`"${u}" is not a many2many`);let q=e.dataSource;if(!q?.list||!L.length)return[];let Z=await q.list({model:C.relation,fields:[...T],filter:[{field:"id",op:"in",value:[...L]}],sort:[],offset:0,limit:L.length}),ee=new Map(Z.records.map($e=>[String($e.id),$e]));return L.flatMap($e=>{let Fe=ee.get(String($e));return Fe?[{id:Fe.id,values:Fe.values}]:[]})},fieldTone(u){let L=d.get(u);if(L){let{context:T,env:C}=me();return L(T,C)}if(o.get(u)?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);return{tone:null,bold:!1}},placeholder(u){let L=c.get(u);if(!L){let q=o.get(u);if(q?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);let Z=q.source;return u==="#title"&&n.layout.type==="sheet"?n.layout.title?.placeholder:Z.placeholder}let{context:T,env:C}=me();return L.when.find(q=>q.holds.evaluate(T,C))?.text??L.fixed},lineState:(u,L)=>z(u,L),columnHidden(u,L){let T=W(u),{context:C,env:q}=me();return T?T.compiled.hidden(L,C,q,ke):!1},async runRowAction(u,L,T){let C=W(u),q=C?.compiled.buttons.find(ee=>ee.id===L);if(!C||!q)throw new Error(`The table "${u}" has no button "${L}"`);if(!z(u,T).buttons[L])return{done:!1,reason:"cannot",message:`The button "${L}" is hidden on this line`};let Z=($.values[C.field]??[]).find(ee=>ee.key===T);return Ue(q,{id:L,chain:[],line:{field:C.field,key:T,values:Ae(Z.values)}})},async runLinesAction(u,L,T){let C=o.get(u),q=C?.source,Z=q?.selectedButtons?.find(G=>G.id===L);if(!C||!q||!Z)throw new Error(`The table "${u}" has no button "${L}" for its chosen lines`);let ee=$.values[q.field]??[],$e=T.map(G=>ee.find(de=>de.key===G)??null),Fe=T.find((G,de)=>!$e[de]);if(Fe!==void 0)throw new Error(`"${q.field}" has no line "${Fe}"`);if(ht(L).invisible)return{done:!1,reason:"cannot",message:`The button "${L}" is hidden`};if(!T.length)return{done:!1,reason:"cannot",message:`The button "${L}" runs with lines chosen: none is`};let O=$e;return Ue(Z,{id:L,chain:[],lines:{field:q.field,keys:[...T],ids:O.flatMap(G=>G.id===void 0?[]:[G.id]),values:O.map(G=>Ae(G.values))}})},run:(u,L={})=>ce(K(u,{id:L.id??"run",chain:[],...L.recordIds?{recordIds:[...L.recordIds]}:{}})),shown(u){k.includes(u)||ce(we(`on.show.${u}`,n.on?.show?.[u],Me,!0))},on(u,L){let T=Ee.get(u);return T||Ee.set(u,T=new Set),T.add(L),()=>{T.delete(L)}},restoreDraft(){let u=e.drafts?.store.getItem(g());if(!u)return;let L=JSON.parse(u);Lt({...$.values,...L.values},{draft:null},!0)},discardDraft(){Rn(),xe({draft:null})},async settled(){for(;Ve.size;)await Promise.allSettled([...Ve])},embed(u,L){let T=w.get(u);if(T)return T.inner.form;let C=E.get(u);if(!C)throw new Error(`"${u}" is not a saved form placed on this page`);let q=[...t,n.id];if(q.includes(L.id))throw new Error(`a page cannot be placed inside itself: ${[...q.slice(q.indexOf(L.id)),L.id].join(" \u2192 ")}`);let Z=$.values[C.name],ee=Os({page:{...L,data:{kind:"responses"}},dataSource:e.dataSource,values:Cs(Z)?Z:{},onAction:e.onAction,host:e.host,confirm:e.confirm,scheduler:r,messages:i,now:e.now},q);w.set(u,{name:C.name,inner:ee}),ee.form.on("change",({by:O})=>{R||Y(C.name,O)}),ee.form.subscribe(O=>{R||O.values===$.values[C.name]||(Lt({...$.values,[C.name]:Mo(O.values)}),Ut(C.name))});let $e=Mo(ee.form.getState().values);$.dirty.includes(C.name)||(V={...V,[C.name]:$e});let Fe={...$.values,[C.name]:$e};return xe({values:Fe,dirty:rt(Fe)}),ee.form},embedded:u=>w.get(u)?.inner.form??null,dispose(){_!==null&&r.clearTimeout(_),te!==null&&r.clearTimeout(te),Ie.clear(),Ee.clear();for(let u of w.values())u.inner.form.dispose()}};return $={...$,warnings:Qt()},$.recordId==null&&zn(),$.recordId==null&&ce(Promise.resolve().then(en)),{form:ve,take(u,L){if(L!=="start")return Lt({...xn(n.fields,m()),...u},{},L==="fresh");V=un({...xn(n.fields,m()),...Ae(u)});let T=fn(Ae(V),"start");xe({values:T,dirty:[],errors:{},warnings:_t(T,Qt),warning:null,warningField:null})},errorsNow:()=>jt(),show(u){JSON.stringify(u)!==JSON.stringify($.errors)&&xe({errors:u})}}}function Dc(e,t){let n={};for(let[r,i]of Object.entries(e))r.startsWith(`${t}.`)&&(n[r.slice(t.length+1)]=i);return n}function Wc(e,t){let n=a=>a==null||a===!1||a==="";if(n(e)||n(t))return n(e)===n(t)?0:n(e)?-1:1;let r=a=>a!==null&&typeof a=="object"&&!Array.isArray(a)&&"label"in a?String(a.label):a,i=r(e),o=r(t);return typeof i=="number"&&typeof o=="number"?i-o:typeof i=="boolean"&&typeof o=="boolean"?Number(i)-Number(o):String(i).localeCompare(String(o))}function jc(e,t,n){for(let r of n){let i=Wc(e[r.field],t[r.field]);if(i)return r.desc?-i:i}return 0}function Ps(e){return e.readonly===!0||e.compute!==void 0}function Hc(e,t){let n=[],r=new Map(e.filter(o=>o.id!==void 0).map(o=>[o.key,o]));for(let o of t){let a=r.get(o.key);if(o.id===void 0||!a){n.push({op:"create",key:o.key,values:Ae(o.values)});continue}let s={};for(let[d,l]of Object.entries(o.values))JSON.stringify(l)!==JSON.stringify(a.values[d])&&(s[d]=Ae(l));Object.keys(s).length&&n.push({op:"update",id:o.id,values:s})}let i=new Set(t.map(o=>o.key));for(let o of e)o.id!==void 0&&!i.has(o.key)&&n.push({op:"delete",id:o.id});return n}function zc(e,t){let n=new Set(e.map(i=>i.id)),r=new Set(t.map(i=>i.id));return[...t.filter(i=>!n.has(i.id)).map(i=>({op:"link",id:i.id})),...e.filter(i=>!r.has(i.id)).map(i=>({op:"unlink",id:i.id}))]}function Bc(e){let t=new Map,n=(i,o,a,s)=>{let d=i.roles;t.set(i.id,{id:i.id,parent:o,kind:a,field:s.field,...d?.length?{roles:d}:{},invisible:et(s.invisible),readonly:et(s.readonly),required:et(s.required),source:i})},r=(i,o)=>{for(let a of i)if(a.type==="field"){n(a,o,"field",{invisible:a.invisible,readonly:a.readonly,required:a.required,field:a.field});for(let s of[...a.selectedButtons??[],...a.controlButtons??[]])n(s,a.id,"button",{invisible:s.invisible})}else if(a.type==="button")n(a,o,"button",{invisible:a.invisible});else if(a.type==="tabs"){n(a,o,"other",{invisible:a.invisible});for(let s of a.children)n(s,a.id,"other",{invisible:s.invisible}),r(s.children,s.id)}else a.type==="section"?(n(a,o,"other",{invisible:a.invisible,readonly:a.readonly}),r(a.children,a.id)):a.type==="form"?n(a,o,"form",{invisible:a.invisible,readonly:a.readonly}):n(a,o,"other",{invisible:a.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 i of e.children)n(i,e.id,"step",{invisible:i.invisible}),r(i.children,i.id);else if(e.type==="sections"){r(e.children,e.id);for(let i of e.footer??[])n(i,e.id,"button",{invisible:i.invisible})}else if(e.type==="list")for(let i of e.actions??[])n(i,e.id,"button",{invisible:i.invisible});else{let i=(o,a)=>{a&&n({id:o},e.id,"field",{field:a})};i("#title",e.title?.field),i("#subtitle",e.title?.subtitleField),i("#avatar",e.title?.avatarField),e.statusbar&&n({id:"#statusbar",...e.statusbar.roles?{roles:e.statusbar.roles}:{}},e.id,"field",{field:e.statusbar.field,invisible:e.statusbar.invisible});for(let o of[...e.buttons??[],...e.footer??[]])n(o,e.id,"button",{invisible:o.invisible});for(let o of e.statButtons??[])n(o,e.id,"stat",{invisible:o.invisible});for(let o of[...e.ribbon?[e.ribbon]:[],...e.ribbons??[]])n(o,e.id,"other",{invisible:o.invisible});for(let o of e.alerts??[]){n(o,e.id,"other",{invisible:o.invisible});for(let a of o.buttons??[])n(a,o.id,"button",{invisible:a.invisible})}for(let o of e.badges??[])n(o,e.id,"other",{invisible:o.invisible});r([...e.title?.above??[],...e.title?.before??[],...e.title?.after??[],...e.title?.below??[]],e.id),r(e.children,e.id),e.sidePanel&&n(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible});for(let o of e.toolbar?.menu??[])if(n(o,e.id,"button",{invisible:o.invisible}),o.builtin==="archive"||o.builtin==="unarchive"){let a=t.get(o.id),s=a.invisible,d=o.builtin==="unarchive";a.invisible={...s,evaluate:(l,f)=>l.active===!1!==d||s.evaluate(l,f)}}e.attachmentPreview&&n({id:"#preview",...e.attachmentPreview},e.id,"other",{invisible:e.attachmentPreview.invisible})}return t}function qc(e,t){if(e.type==="boolean")return t===!0?"Yes":"No";if(t==null||t===!1)return"";if(e.type==="selection")return e.options.find(r=>r.value===t)?.label??String(t);if(e.type==="html")return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let n=r=>r&&typeof r=="object"&&"label"in r?String(r.label):r&&typeof r=="object"&&"name"in r?String(r.name):String(r);return Array.isArray(t)?t.map(n).join(", "):n(t)}function ui(e,t){return!!e&&(e.type==="integer"||e.type==="float"||e.type==="monetary")&&typeof t=="string"&&t.trim()!==""}function _c(e,t){return e?.type!=="one2many"?ui(e,t):(t??[]).some(n=>Object.entries(n.values).some(([r,i])=>ui(e.fields[r],i)))}var Vs=new Map;function Is(e,t){let n=`${e}:${t}`,r=Vs.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),Vs.set(n,r)),r}function Vn(e,t,n,r="en"){try{let i=new Intl.NumberFormat(r,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",numberingSystem:"latn",minimumFractionDigits:n,maximumFractionDigits:n}).formatToParts(e);return i.map((o,a)=>o.type==="currency"&&/^(integer|minusSign)$/.test(i[a+1]?.type??"")?`${o.value}\xA0`:o.value).join("")}catch{return`${t} ${pt(e,n,r)}`}}function Ds(e){let t=Is(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function No(e,t,n="en"){return Lr(pt(e,t,n),n)}function Lr(e,t="en"){let{group:n}=Ds(t);return e.split(n).join("")}function pt(e,t,n="en"){return Is(n,t).format(e)}function Jt(e,t="en"){let{group:n,decimal:r}=Ds(t),i=e.replace(/[٠-٩]/g,o=>String(o.charCodeAt(0)-1632)).replace(/[۰-۹]/g,o=>String(o.charCodeAt(0)-1776)).replace(/٫/g,r).replace(/٬/g,n);return i=i.replace(/[\s\u00a0\u202f]/g,""),n.trim()&&(i=i.split(n).join("")),r==="."?i:i.split(r).join(".")}var Ws={};var Uc={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",lineN:"line {n}",noLines:"No lines yet",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",chooseLine:"Choose {name}",chooseAllLines:"Choose every line",linesChosen:"{n} chosen",moreSteps:"More",timeInStep:"{time} in this step",chooseDate:"Choose a date",other:"Other:",otherAnswer:"Your own answer",clearSelection:"Clear selection",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",addFiles:"Add files",addPhotos:"Add photos",dropThem:"or drop them here",upToSize:"up to {size}",upToEach:"up to {size} each",upToFiles:"up to {max} files",fileCount:"{n} files",oneFile:"1 file",fileCountOf:"{n} of {max} files",tooMany:"Up to {max} files: {n} not added",alreadyAdded:"{name}: already added",removeAsk:"Remove {name}?",keep:"Keep",previous:"Previous",next:"Next",download:"Download",close:"Close",fileAt:"{n} of {total}",noPreview:"No preview for this kind of file",showFilesAs:"Show files as",asList:"List",asCards:"Cards",asThumbnails:"Thumbnails",invalidJson:"Not valid JSON",invalidJsonAt:"Not valid JSON: line {line}, column {column}",signaturePad:"Signature pad: draw your signature",signHere:"Sign here",typeSignature:"Or type your name",clearDrawing:"Clear",undo:"Undo",uploadSignature:"Upload a picture",notAnswered:"Not answered",moveUp:"Move {label} up",moveDown:"Move {label} down",movedTo:"{label} moved to place {n} of {total}",addressStreet:"Street address",addressCity:"City",addressLine2:"Address line 2",addressRegion:"State or region",addressPostcode:"Postcode",addressCountry:"Country",entry:"Entry {n}",addAnother:"Add another",copy:"Copy {name}",removed:"{name} removed",loadingChoices:"Loading choices\u2026",choicesFailed:"Load the choices again",notOffered:"{name}: no longer offered",yes:"Yes",no:"No",upTo:"Up to {n}",keepOrder:"Keep this order",ofMax:"{n} of {max}",charactersLeft:"Characters left: {n}",colourNames:"No colour|Red|Orange|Yellow|Cyan|Purple|Almond|Teal|Blue|Raspberry|Green|Violet",copyValue:"Copy",copied:"Copied",noDocument:"No document yet",openInNewTab:"Open in a new tab",account:"Account",share:"Percentage",addAccount:"Add an account",sharesOff:"The shares add up to {n}, not 100%",untaxed:"Untaxed amount",paidOn:"Paid on {date}",amountDue:"Amount due",paymentOf:"Payment of {amount}",journal:"Journal",memo:"Memo",openPayment:"Open",addProperty:"Add a property",propertyName:"Property name",propertyType:"Kind",propertyTypes:"Text|Long text|Whole number|Number|Yes or no|Date",add:"Add",cancel:"Cancel",loading:"Loading\u2026",perDay:"/day",perNight:"/night",perWeek:"/week",perMonth:"/month",perYear:"/year"},Ze={en:Uc,...Ws};function mi(e,t){let n=e.ownerDocument,r=n.defaultView,i=typeof t.showPopover=="function";i&&t.setAttribute("popover","manual");let o=!1,a="",s=0;function d(){let y=e.getBoundingClientRect(),p=n.documentElement.clientWidth,k=n.documentElement.clientHeight,[g,m]=[k-y.bottom-10,y.top-10],b=g<160&&m>g;Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",minWidth:`${Math.min(Math.max(y.width,224),p-16)}px`,maxWidth:`${Math.max(y.width,Math.min(448,p-16))}px`,maxHeight:`${Math.max(96,Math.min(240,b?m:g))}px`}),a=`${y.left},${y.top},${y.width},${p},${k}`;let h=t.offsetWidth,v=r?.getComputedStyle(e).direction==="rtl",S=Math.max(8,Math.min(v?y.right-h:y.left,p-h-8));Object.assign(t.style,{left:`${S}px`,top:`${b?y.top-2-t.offsetHeight:y.bottom+2}px`})}let l=()=>{if(o){if(!e.isConnected)return c.hide();d()}},f=()=>{if(!o)return;let y=e.getBoundingClientRect();`${y.left},${y.top},${y.width},${n.documentElement.clientWidth},${n.documentElement.clientHeight}`!==a&&l(),s=r?.requestAnimationFrame(f)??0},c={show(){t.hidden=!1,i&&!t.matches(":popover-open")&&t.showPopover(),d(),o||(n.addEventListener("scroll",l,!0),r?.addEventListener("resize",l)),o=!0,!s&&r?.requestAnimationFrame&&(s=r.requestAnimationFrame(f))},place:l,hide(){i&&t.matches(":popover-open")&&t.hidePopover(),t.hidden=!0,o&&(n.removeEventListener("scroll",l,!0),r?.removeEventListener("resize",l)),s&&r?.cancelAnimationFrame(s),s=0,o=!1}};return c}function Te(e){return(t,n={},...r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}}var We=(e,t)=>e??Ze[t??"en"]??Ze.en,ze=(e,t)=>e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n);function He(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function Mt(e,t){e.hidden!==t&&(e.hidden=t)}function ft(e,t){e.textContent!==t&&(e.textContent=t)}function tt(e,t){He(e,"aria-invalid",String(t.invalid)),He(e,"aria-describedby",t.describedBy||null)}function gi(e){let t=e("div",{class:"fd-announce",role:"status","aria-live":"polite"});return{element:t,say(n){t.textContent="",t.textContent=n}}}var Wt=e=>e.closest("[dir]")?.getAttribute("dir")==="rtl";function sn(e,t,n,r,i=!0){let o=Te(e)("button",{type:"button",class:"fd-choice-clear",hidden:""},t.clearSelection);o.addEventListener("click",n);let a=i&&r.options?.clear!==!1,s=!1;return{button:o,allow(d){s=a&&!d.required&&!d.readonly},show(d){Mt(o,!(s&&d))}}}function hi(e,t){let n=e("span"),r=e("button",{type:"button",class:"fd-button fd-button-link"},t.removeFile),i=e("button",{type:"button",class:"fd-button fd-button-link"},t.keep),o=e("div",{class:"fd-file-confirm",hidden:""},n,r,i),a=d=>{},s=d=>{o.hidden=!0,a(d)};return r.addEventListener("click",()=>s(!0)),i.addEventListener("click",()=>s(!1)),o.addEventListener("keydown",d=>d.key==="Escape"&&s(!1)),{element:o,ask(d,l){n.textContent=d,a=l,o.hidden=!1,i.focus()}}}var Kc=180,bi=8;function Er(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function yi(e){let{document:t,id:n,labels:r}=e,i=`${n}-list`,o=t.createElement("input");Object.assign(o,{id:n,className:"fd-input fd-combo-input",autocomplete:"off"}),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls",i),o.placeholder=e.placeholder||r.search;let a=t.createElement("ul");a.id=i,a.className="fd-listbox",a.setAttribute("role","listbox"),a.hidden=!0;let s=t.createElement("div");s.className="fd-combo",s.append(o,a);let d=mi(o,a),l="",f=null,c="",y=new Map,p=!1,k=[],g=-1,m=0,b,h=!1;function v(){if(a.replaceChildren(),k.forEach((w,A)=>{let R=t.createElement("li");R.id=`${i}-${A}`,R.setAttribute("role","option"),R.setAttribute("aria-selected",String(A===g)),R.className=`fd-option${A===g?" fd-active":""}${w===f||y.has(w)?" fd-option-create":""}`,R.textContent=w.label,R.addEventListener("mousedown",I=>I.preventDefault()),R.addEventListener("click",()=>F(A)),a.append(R)}),!k.length){let w=t.createElement("li");w.className="fd-empty",w.textContent=r.noResults,a.append(w)}g>=0?o.setAttribute("aria-activedescendant",`${i}-${g}`):o.removeAttribute("aria-activedescendant"),d.place()}function S(){d.show(),o.setAttribute("aria-expanded","true")}function x(){clearTimeout(b),m++,d.hide(),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),g=-1}function F(w){let A=k[w];if(!A)return;let R=c;if(x(),p=!1,A===f&&e.create){e.create(R).then(e.pick,()=>{});return}let I=y.get(A);if(I){I(R).then(M=>M&&e.pick(M),()=>{});return}e.pick(A)}function E(w){clearTimeout(b);let A=++m;b=setTimeout(async()=>{let R=await e.search(w).catch(()=>[]);if(A!==m||t.activeElement!==o)return;let I=k[g],M=I&&I!==f&&!y.has(I)?I.id:void 0,P=e.exclude?.()??new Set,H=R.filter(z=>!P.has(z.id)),D=e.shown!==void 0&&H.length>e.shown;k=D?H.slice(0,e.shown):H;let W=w.trim();f=null,e.create&&W&&!R.some(z=>z.label.trim().toLowerCase()===W.toLowerCase())&&(c=W,f={id:"__create__",label:Er(r.createNamed,{name:W})},k=[...k,f]),c=W,y=new Map((e.more?.(W,D)??[]).map((z,j)=>[{id:`__more_${j}__`,label:z.label},z.act])),k=[...k,...y.keys()],g=M===void 0?-1:k.findIndex(z=>z.id===M),v(),S()},Kc)}return o.addEventListener("input",()=>{p=!0,h||E(o.value)}),o.addEventListener("focus",()=>{h||E("")}),o.addEventListener("click",()=>{!h&&a.hidden&&t.activeElement===o&&E(p?o.value:"")}),o.addEventListener("keydown",w=>{if(!h)switch(w.key){case"ArrowDown":case"ArrowUp":{if(w.preventDefault(),a.hidden)return E(o.value);if(!k.length)return;g=(g+(w.key==="ArrowDown"?1:-1)+k.length)%k.length,v(),a.children[g]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!a.hidden&&g>=0&&(w.preventDefault(),F(g));return;case"Escape":a.hidden||w.preventDefault(),x(),p=!1,o.value=l;return;case"Backspace":o.value===""&&e.onEmptyBackspace?.();return}}),o.addEventListener("blur",()=>{m++,clearTimeout(b),x();let w=p&&o.value.trim()===""&&l!=="";p=!1,w?e.onCommitEmpty?.():o.value=l}),{element:s,input:o,setText(w){l=w,!p&&o.value!==w&&(o.value=w)},setReadonly(w){h=w,o.readOnly!==w&&(o.readOnly=w),w&&x()},close:x}}function Zn(e,t,n){let r=n??e.createElement("span");if(r.className="fd-link-avatar",r.setAttribute("aria-hidden","true"),!t)return r.hidden=!0,r.replaceChildren(),r;if(r.hidden=!1,t.avatar){let i=e.createElement("img");i.src=t.avatar,i.alt="",r.replaceChildren(i)}else{let i=t.label.trim().split(/\s+/).filter(Boolean);r.textContent=(i.length>1?i[0][0]+i[i.length-1][0]:i[0]?.[0]??"").toUpperCase()}return r}function xi(e,t){let n=e.ownerDocument;e.replaceChildren(...t.split(`
|
|
4
|
+
`).map(r=>{let i=n.createElement("div");return i.textContent=r,i}))}function js(e){let t=e.options??{};return{avatar:t.avatar===!0,details:t.details===!0,colors:t.colors===!0,opens:t.open!==!1}}function Hs(e,t,n){return n.options?.create!==!1&&e.canCreate(t)?r=>e.quickCreate(t,r):void 0}var Rr=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,dialogs:s})=>{let d=n.type==="many2one"?n.relation:"",l=js(r),f=l.opens&&!!s&&s.canOpen(d),c=!1,y=yi({document:o,id:i,labels:a,search:h=>e.search(t,h,bi+1),shown:bi,pick:h=>e.setValue(t,h),onCommitEmpty:()=>e.setValue(t,null),create:Hs(e,t,r),placeholder:r.placeholder,more:(h,v)=>{if(!s||c)return[];let S=[];return h&&f&&r.options?.create!==!1&&S.push({label:a.createAndEdit,act:x=>{let F=e.createValues(t);return s.openRecord(d,{name:x,title:n.label,...Object.keys(F).length?{values:F}:{}})}}),v&&S.push({label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(x,F)=>e.search(t,x,F)})}),S}}),p=f?o.createElement("button"):null;p&&(p.type="button",p.className="fd-combo-open",p.textContent="\u2197",p.hidden=!0,p.addEventListener("click",async()=>{let h=e.getState().values[t];if(!h||!s)return;let v=await s.openRecord(d,{recordId:h.id,title:h.label});v&&v.label!==h.label&&e.setValue(t,v)}));let k=o.createElement("button");k.type="button",k.className="fd-combo-clear",k.textContent="\xD7",k.setAttribute("aria-label",Er(a.clear,{label:n.label})),k.addEventListener("click",()=>{e.setValue(t,null),y.input.focus()}),y.element.append(k,...p?[p]:[]);let g=l.avatar?Zn(o,null):null;g&&(y.element.prepend(g),y.element.setAttribute("data-avatar",""));let m=l.details?o.createElement("div"):null,b=y.element;return m&&(m.className="fd-link-details",m.hidden=!0,b=o.createElement("div"),b.className="fd-link",b.append(y.element,m)),{element:b,focus:()=>y.input.focus(),update(h){let v=h.value;if(g&&Zn(o,v,g),m){let S=v?.details?.trim()??"";Mt(m,!S),m.textContent!==S.replace(/\n/g,"")&&xi(m,S)}c=h.readonly,y.setText(v?.label??""),y.setReadonly(h.readonly),Mt(k,!v||h.readonly),p&&(Mt(p,!v),v&&He(p,"aria-label",Er(a.openNamed,{name:v.label}))),He(y.input,"aria-invalid",String(h.invalid)),He(y.input,"aria-required",String(h.required)),h.describedBy&&He(y.input,"aria-describedby",h.describedBy)}}},vi=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,dialogs:s})=>{let d=n.type==="many2many"?n.relation:"",l=js(r),f=()=>e.getState().values[t]??[],c=o.createElement("div");c.className="fd-tags",c.setAttribute("role","group");let y=o.createElement("ul");y.className="fd-chips";let p=yi({document:o,id:i,labels:a,search:b=>e.search(t,b,bi+1+f().length),shown:bi,pick:b=>{f().some(h=>h.id===b.id)||e.setValue(t,[...f(),b]),p.input.value=""},exclude:()=>new Set(f().map(b=>b.id)),onEmptyBackspace:()=>{let b=f();b.length&&e.setValue(t,b.slice(0,-1))},create:Hs(e,t,r),placeholder:r.placeholder,more:(b,h)=>s&&h?[{label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(v,S)=>e.search(t,v,S)})}]:[]}),k=l.opens&&s&&s.canOpen(d)?async b=>{let h=await s.openRecord(d,{recordId:b.id,title:b.label});h&&h.label!==b.label&&e.setValue(t,f().map(v=>v.id===b.id?h:v))}:void 0;c.append(y,p.element);let g=!1,m="";return{element:c,focus:()=>p.input.focus(),update(b){let h=b.value??[],v=JSON.stringify([b.readonly,h]);g=b.readonly,p.setReadonly(g),p.element.hidden=g,p.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&p.input.setAttribute("aria-describedby",b.describedBy),v!==m&&(m=v,zs(y,h,g,a,S=>e.setValue(t,f().filter(x=>x.id!==S.id)),k,l),p.setText(""))}}};function zs(e,t,n,r,i,o,a={}){let s=e.ownerDocument;e.replaceChildren(...t.map(d=>{let l=s.createElement("li");l.className="fd-chip",a.colors&&typeof d.color=="number"&&d.color>=1&&d.color<=11&&l.setAttribute("data-color",String(Math.trunc(d.color))),a.avatar&&l.append(Zn(s,d));let f=s.createElement(o?"button":"span");if(f.className="fd-chip-label",f.textContent=d.label,o&&(f.type="button",f.setAttribute("aria-label",Er(r.openNamed,{name:d.label})),f.addEventListener("click",()=>o(d))),l.append(f),!n){let c=s.createElement("button");c.type="button",c.className="fd-chip-remove",c.textContent="\xD7",c.setAttribute("aria-label",Er(r.remove,{name:d.label})),c.addEventListener("click",()=>i(d)),l.append(c)}return l}))}var Co=({form:e,name:t,node:n,id:r,document:i,labels:o=Ze.en})=>{let a=n.options??{},s=typeof a.separator=="string"&&a.separator?a.separator:",",d=Array.isArray(a.suggestions)?a.suggestions.filter(b=>typeof b=="string"):[],l=b=>typeof b=="string"?b.split(s).map(h=>h.trim()).filter(h=>h!==""):[],f=()=>l(e.getState().values[t]),c=b=>e.setValue(t,b.length?b.join(`${s} `):null),y=b=>{let h=b.trim(),v=f();h&&!v.some(S=>S.toLowerCase()===h.toLowerCase())&&!(v.length>=a.max)&&c([...v,h])},p=i.createElement("div");p.className="fd-tags",p.setAttribute("role","group");let k=i.createElement("ul");k.className="fd-chips";let g=yi({document:i,id:r,labels:o,placeholder:n.placeholder,search:async b=>{let h=new Set(f().map(S=>S.toLowerCase())),v=b.trim().toLowerCase();return d.filter(S=>!h.has(S.toLowerCase())&&S.toLowerCase().includes(v)).map(S=>({id:S,label:S}))},pick:b=>{y(b.label),g.input.value=""},onEmptyBackspace:()=>{let b=f();b.length&&c(b.slice(0,-1))}});g.input.addEventListener("keydown",b=>{b.key!=="Enter"||b.defaultPrevented||g.input.value.trim()===""||(b.preventDefault(),y(g.input.value),g.input.value="",g.close())}),g.input.addEventListener("input",()=>{let b=g.input.value.split(s);if(!(b.length<2)){for(let h of b.slice(0,-1))y(h);g.input.value=b[b.length-1].trimStart()}}),g.input.addEventListener("change",()=>{g.input.value.trim()&&y(g.input.value)}),p.append(k,g.element);let m="";return{element:p,focus:()=>g.input.focus(),update(b){let h=l(b.value);g.setReadonly(b.readonly),g.element.hidden=b.readonly||h.length>=a.max,g.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&g.input.setAttribute("aria-describedby",b.describedBy);let v=JSON.stringify([b.readonly,h]);if(v===m)return;m=v;let S=i.activeElement===g.input;zs(k,h.map(x=>({id:x,label:x})),b.readonly,o,x=>c(f().filter(F=>F!==x.label))),g.setText(""),S&&g.element.hidden&&k.querySelector("li:last-child button")?.focus()}}},Po=({form:e,name:t,id:n,document:r})=>{let i=r.createElement("div");i.id=n,i.className="fd-choices fd-choices-checkbox",i.setAttribute("role","group");let o=[],a={readonly:!1,value:[]},s=()=>{let d=new Set(a.value.map(l=>l.id));for(let{record:l,box:f}of o)f.checked=d.has(l.id),f.disabled=a.readonly};return e.search(t,"",50).then(d=>{o=d.map((l,f)=>{let c=r.createElement("input");c.type="checkbox",c.id=`${n}-${f}`,c.addEventListener("change",()=>{let k=e.getState().values[t]??[];e.setValue(t,c.checked?[...k,l]:k.filter(g=>g.id!==l.id))});let y=r.createElement("label");y.className="fd-choice",y.htmlFor=c.id;let p=r.createElement("span");return p.textContent=l.label,y.append(c,p),i.append(y),{record:l,box:c}}),s()}),{element:i,focus:()=>i.querySelector("input")?.focus(),update(d){a={readonly:d.readonly,value:d.value??[]},s()}}},Oo=e=>{let{form:t,name:n,field:r,id:i,document:o,labels:a=Ze.en}=e,s=r.type==="reference"?r.models:[],d=o.createElement("div");d.className="fd-reference";let l=o.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",r.label),l.append(o.createElement("option"));for(let y of s){let p=o.createElement("option");p.value=String(y.value),p.textContent=y.label,l.append(p)}let f="";l.addEventListener("change",()=>{f=l.value,t.setValue(n,null)});let c=yi({document:o,id:i,labels:a,placeholder:e.node.placeholder,search:y=>f?t.search(n,y,8,{model:f}):Promise.resolve([]),pick:y=>t.setValue(n,{model:f,id:y.id,label:y.label}),onCommitEmpty:()=>t.setValue(n,null)});return d.append(l,c.element),{element:d,focus:()=>f?c.input.focus():l.focus(),update(y){let p=y.value;p&&(f=p.model),l.value=f,l.disabled=y.readonly,c.setText(p?.label??""),c.setReadonly(y.readonly||!f)}}};function Fr(e,t){try{let n=new Intl.NumberFormat(t,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(1),r=n.findIndex(i=>i.type==="currency");return{text:n[r].value,after:r>n.findIndex(i=>i.type==="integer")}}catch{return{text:e,after:!1}}}var _s=/[\u200e\u200f\u061c]/g,Jc=e=>`\u2068${e}\u2069`,Bs=new Map;function Vo(e,t="en"){let n=Bs.get(t);return n||Bs.set(t,n=new Intl.NumberFormat(t,{notation:"compact",numberingSystem:"latn",maximumFractionDigits:1})),n.format(e).replace(_s,"")}var Gc={day:"perDay",night:"perNight",week:"perWeek",month:"perMonth",year:"perYear"},qs=new WeakMap;function Yc(e,t){if(!e.per)return null;let n=qs.get(e.per);n||(n=e.per.map(({period:i,when:o})=>{let a=o===void 0?null:et(o);return{period:i,holds:s=>!a||a.evaluate(s)}}),qs.set(e.per,n));let r={};for(let[i,o]of Object.entries(t))r[i]=o&&typeof o=="object"&&!Array.isArray(o)&&"id"in o?o.id:o;return n.find(i=>i.holds(r))?.period??null}function wi(e,t,n,r,i,o={}){let a=i.short?Vo(e,r):pt(e,n,r),s=a;if(t&&t!==i.home){let c=/^[A-Z]{3}$/.test(t)?Fr(t,r):null,y=(i.currency==="code"||!c?t:c.text).replace(_s,""),p=i.at?i.at==="after":!!c?.after,k=Mn(r)&&!/^\p{L}+$/u.test(y)?Jc(y):y;s=p?`${a}\xA0${k}`:`${k}\xA0${a}`}let d=Yc(i,o);if(!d)return s;let l=Ze[r]??Ze.en;return`${Mn(r)?`\u2068${s}\u2069`:s}${l[Gc[d]]}`}function ki(e,t){if(e?.type!=="monetary")return[];let n=e.currencyField&&!e.currencyField.startsWith("parent.")?[e.currencyField]:[];for(let r of[e.money,t])for(let i of r?.per??[])i.when!==void 0&&n.push(...et(i.when).fields);return[...new Set(n)]}var Us=e=>String(e).padStart(2,"0");function Js(e){let t=Math.round(Math.abs(e)*60);return`${e<0&&t?"-":""}${Us(Math.floor(t/60))}:${Us(t%60)}`}function Xc(e,t="en"){let n=Jt(e.trim(),t);if(n==="")return null;let r=/^(-?)(\d+):(\d{1,2})$/.exec(n);if(r){let i=Number(r[3]);if(i>59)return e.trim();let o=Number(r[2])+i/60;return r[1]?-o:o}if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))return Number(n);if(!/^-?(\d+:?)?\.?$/.test(n))return e.trim()}var Ks=new Map;function Gs(e,t,n){let r=`${e}:${t}:${n}`,i=Ks.get(r);return i||(i=new Intl.NumberFormat(e,{style:n,numberingSystem:"latn",minimumFractionDigits:0,maximumFractionDigits:t}),Ks.set(r,i)),i}function Zc(e,t="en",n=2){return Gs(t,n,"percent").format(e)}var Ys=e=>e.type==="float"?e.digits?.[1]??2:2;function Xs(e,t){let{form:n,name:r,node:i,id:o,document:a}=e,s=Te(a),d=s("input",{id:o,type:"text",class:`fd-input fd-number-input ${t.className}`,autocomplete:"off",inputmode:t.inputMode});i.placeholder&&(d.placeholder=i.placeholder);let l=p=>typeof p=="number"?t.show(p):p==null?"":String(p);d.addEventListener("input",()=>{let p=t.parse(d.value);p!==void 0&&n.setValue(r,p)}),d.addEventListener("blur",()=>{d.value=l(n.getState().values[r])});let f=typeof i.options?.suffix=="string"&&i.options.suffix?i.options.suffix:t.unit,c=f?s("span",{class:"fd-unit",id:`${o}-unit2`},f):null,y=c?s("span",{class:"fd-number"},d,c):d;return c&&d.style.setProperty("padding-inline-end",`calc(var(--fd-pad-x) + ${f?.length??0}ch + 4px)`),{element:y,focus:()=>d.focus(),update(p){let k=a.activeElement===d,g=t.parse(d.value);if(!(k&&(g===void 0||g===p.value))){let m=l(p.value);d.value!==m&&(d.value=m)}d.readOnly!==p.readonly&&(d.readOnly=p.readonly),He(d,"aria-required",String(p.required)),tt(d,{...p,describedBy:[p.describedBy,c?.id].filter(Boolean).join(" ")})}}}var Zs=e=>{let t=e.locale??"en";return Xs(e,{show:Js,parse:n=>Xc(n,t),inputMode:"text",className:"fd-duration"})},Qs=e=>{let t=e.locale??"en",n=Ys(e.field);return Xs(e,{show:r=>Gs(t,n,"decimal").format(Math.round(r*100*10**n)/10**n),parse(r){let i=Jt(r.trim(),t).replace(/%$/,"");if(i==="")return null;if(/^-?(\d+\.?\d*|\.\d+)$/.test(i))return Math.round(Number(i)/100*1e10)/1e10;if(!/^-?\.?$/.test(i))return r.trim()},unit:"%",inputMode:"decimal",className:"fd-percentage"})};function ed(e,t,n,r,i={}){if(typeof n!="number"||e!=="duration"&&e!=="percentage")return null;let o=typeof i.suffix=="string"&&i.suffix?` ${i.suffix}`:"";return e==="duration"?Js(n)+o:Zc(n,r,Ys(t))}var Io=e=>typeof e?.model=="string"?e.model:"account.analytic.account";function td(e){return[...new Set(Do(e).flatMap(([t])=>t.split(",")))].map(t=>/^\d+$/.test(t)?Number(t):t)}function Si(e,t="en",n){let r=i=>`${pt(i,Number.isInteger(i)?0:2,t)}%`;return Do(e).map(([i,o])=>{let a=n?i.split(",").map(s=>n(s)??`#${s}`).join(" \xB7 "):"";return a?`${a} ${r(o)}`:r(o)}).join(n?", ":" \xB7 ")}var Do=e=>e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).map(([t,n])=>[t,typeof n=="number"?n:Number(n)||0]):[],nd=e=>{let{form:t,name:n,node:r,id:i,document:o,labels:a,locale:s="en"}=e,d=Te(o),l=We(a,s),f=Io(r.options),c=new Map,y=I=>I.split(",").map(M=>c.get(M)??`#${M}`).join(" \xB7 "),p=I=>`${pt(I,Number.isInteger(I)?0:2,s)}%`,k=d("tbody"),g=d("td",{class:"fd-distribution-total"}),m=d("table",{class:"fd-lines-table fd-distribution-table"},d("thead",{},d("tr",{},d("th",{scope:"col"},l.account),d("th",{scope:"col",class:"fd-distribution-share"},l.share),d("th",{class:"fd-lines-tools"}))),k,d("tfoot",{},d("tr",{class:"fd-lines-totals"},d("td",{},l.total),g,d("td")))),b=d("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-distribution-add"},`+ ${l.addAccount}`),h=d("div",{class:"fd-warning fd-distribution-off",role:"status",hidden:""}),v=d("div",{id:i,class:"fd-distribution",role:"group"},d("div",{class:"fd-lines-scroll"},m),b,h),S=[],x=!1;function F(){let I={};for(let M of S)M.key&&(I[M.key]=M.share);t.setValue(n,S.some(M=>M.key)?I:null)}function E(I,M){let P=S.length,H=`${i}-${P}-${Math.random().toString(36).slice(2,7)}`,D={key:I,share:M},W={...t,getState:()=>({...t.getState(),values:{account:D.key?{id:D.key,label:y(D.key)}:null}}),setValue:(j,V)=>{let B=V;D.key=B?String(B.id):"",B&&c.set(String(B.id),B.label),F()},search:(j,V,B)=>t.search(n,V,B,{model:f}),canCreate:()=>!1},z={type:"many2one",label:l.account,relation:f};return D.account=Rr({...e,form:W,name:"account",field:z,node:{type:"field",id:`${r.id}.account`,field:"account",options:{create:!1}},id:H}),D.input=d("input",{type:"text",class:"fd-input fd-number-input fd-share",inputmode:"decimal",autocomplete:"off","aria-label":l.share}),D.input.addEventListener("input",()=>{let j=Jt(D.input.value.trim(),s);/^\d+\.?\d*$|^\.\d+$/.test(j)&&(D.share=Number(j),F())}),D.remove=d("button",{type:"button",class:"fd-line-delete","aria-label":l.deleteLine},"\xD7"),D.remove.addEventListener("click",()=>{S=S.filter(j=>j!==D),D.account.destroy?.(),D.element.remove(),F(),R()}),D.element=d("tr",{},d("td",{},d("label",{class:"fd-sr-only",for:H},l.account),D.account.element),d("td",{class:"fd-distribution-share"},d("span",{class:"fd-number"},D.input,d("span",{class:"fd-unit"},"%"))),d("td",{class:"fd-lines-tools"},D.remove)),D}b.addEventListener("click",()=>{let I=Math.max(0,100-S.reduce((P,H)=>P+H.share,0)),M=E("",Math.round(I*100)/100);S.push(M),k.append(M.element),R(),M.account.focus()});let w="";function A(I){let M=[...new Set(I.flatMap(H=>H.split(",")))].filter(H=>!c.has(H));if(!M.length||M.join()===w)return;w=M.join();let P=M.map(H=>/^\d+$/.test(H)?Number(H):H);t.search(n,"",M.length,{model:f,ids:P}).then(H=>{for(let D of H)c.set(String(D.id),D.label);R()},()=>{})}function R(){let I=S.reduce((P,H)=>P+H.share,0);ft(g,p(Math.round(I*100)/100));let M=S.some(P=>P.key)&&Math.abs(I-100)>.001;ft(h,M?ze(l.sharesOff,{n:p(Math.round(I*100)/100)}):""),Mt(h,!M),Mt(b,x);for(let P of S){P.account.update({value:P.key?{id:P.key,label:y(P.key)}:null,values:{},readonly:x,required:!1,invalid:!1});let H=pt(P.share,Number.isInteger(P.share)?0:2,s);o.activeElement!==P.input&&P.input.value!==H&&(P.input.value=H),P.input.readOnly=x,x?P.remove.remove():P.remove.isConnected||P.element.lastElementChild?.append(P.remove)}}return{element:v,focus:()=>(S[0]?.input??b).focus(),destroy:()=>S.forEach(I=>I.account.destroy?.()),update(I){x=I.readonly;let M=Do(I.value);if(!(M.length===S.filter(H=>H.key).length&&M.every(([H,D],W)=>S.filter(z=>z.key)[W]?.key===H&&S.filter(z=>z.key)[W]?.share===D))){for(let D of S)D.account.destroy?.();let H=S.filter(D=>!D.key);S=M.map(([D,W])=>E(D,W)),S.push(...H.map(D=>E("",D.share))),k.replaceChildren(...S.map(D=>D.element))}A(M.map(([H])=>H)),R()}}};function rd(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,n,r,i,o,a]=t;return new Date(Number(n),Number(r)-1,Number(i),Number(o??0),Number(a??0))}function Qn(e,t,n){if(e.type!=="monetary")return null;if(e.currency)return e.currency;if(!e.currencyField)return null;let r=e.currencyField.startsWith("parent.")?n?.[e.currencyField.slice(7)]:t[e.currencyField];return r&&typeof r=="object"&&"label"in r?r.label||null:typeof r=="string"&&r?r:null}function At(e,t,n={},r="en",i){let o=(a,s)=>pt(a,s,r);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(a=>a.label).join(", ");case"selection":{let a=s=>e.options.find(d=>d.value===s)?.label??String(s);return Array.isArray(t)?t.map(a).join(", "):a(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let a=Qn(e,n,i);return e.money?wi(Number(t),a,e.digits?.[1]??2,r,e.money,n):a?Vn(Number(t),a,e.digits?.[1]??2,r):o(Number(t),e.digits?.[1]??2)}case"date":{let a=rd(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(a):String(t)}case"datetime":{let a=rd(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(a):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return[t].flat().map(a=>a.name??"").join(", ");case"boolean":return t?"\u2713":"";default:return String(t)}}function In(e,t,n={},r="en",i,o={}){return o.widget==="distribution"&&e.type==="json"?Si(t,r):ed(o.widget,e,t,r,o.options)??At(e,t,n,r,i)}var Qc=new Set(["progressbar","priority","dot","color","timer","badge"]);var ef="http://www.w3.org/2000/svg",id={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"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l5 5"/>',filter:'<path d="M3 5h18l-7 8.5V20l-4-2v-4.5z"/>',layers:'<path d="M12 3l9 5-9 5-9-5z"/><path d="M3 13l9 5 9-5"/>',thumb:'<path d="M7 21V10l4-8c1.6 0 2.6 1.3 2.2 3L12.5 9H19a2 2 0 0 1 2 2.3l-1.3 7.6a2.5 2.5 0 0 1-2.5 2.1H7zM7 10H3v11h4"/>'};function kt(e,t,n){let r=t?n?.[t]??id[t]:void 0;if(r===void 0)return null;let i=e.createElementNS(ef,"svg");for(let[o,a]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}))i.setAttribute(o,a);return i.innerHTML=r,i}function er(e,t,n,r,i){if(n.type==="one2many"&&n.sequenceField)return e.moveLine(t,r,i);let o=[...e.getState().values[t]??[]],a=o.findIndex(s=>s.key===r);a<0||i<0||i>=o.length||i===a||(o.splice(i,0,...o.splice(a,1)),e.setValue(t,o))}var tf=new Set(["integer","float","monetary"]),od=new Set(["boolean","integer","float","monetary","date","datetime"]),ad=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function dd(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function Li(e,t,n){let r=()=>(e.getState().values[t]??[]).find(i=>i.key===n)?.values??{};return{...e,getState:()=>({...e.getState(),values:r()}),setValue:(i,o)=>e.updateLine(t,n,i,o),search:(i,o,a,s)=>e.searchLine(t,n,i,o,a,s),canCreate:i=>e.canCreateLine(t,i),quickCreate:(i,o)=>e.quickCreateLine(t,i,o,n),createValues:i=>e.createValues(i,{lines:t,key:n})}}function ld(e,t){if(e.type!=="monetary"||!e.currencyField?.startsWith("parent."))return e;let{currencyField:n,...r}=e,i=Qn(e,{},t);return i&&/^[A-Z]{3}$/.test(i)?{...r,currency:i}:r}async function Ei(e,t,n,r,i,o){let a=e.page.fields[t],s=()=>e.getState().values[t]??[],d=y=>e.setValue(t,s().map(p=>p.key===r.key?{...p,values:{...p.values,...y}}:p));if(n.lineOpens==="record"&&r.id!==void 0&&i.canOpen(a.relation)){let y=await i.openRecord(a.relation,{recordId:r.id,title:a.label,withValues:!0}),p=Object.fromEntries(Object.entries(y?.values??{}).filter(([k])=>k in a.fields&&k!==a.sequenceField));Object.keys(p).length&&d(p);return}let l=Object.fromEntries(Object.entries(a.fields).filter(([y])=>y!==a.lineKinds?.field&&y!==a.sequenceField).map(([y,p])=>[y,ld(p,e.getState().values)])),f=e.getState(),c=await i.editValues({title:a.label,fields:l,values:r.values,readonly:o,recompute:y=>e.previewLine(t,r.key,y),parent:{values:f.values,fields:e.page.fields,id:f.recordId},...n.lineForm?{layout:n.lineForm.children}:{}});c&&d(c)}var Wo=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s,dialogs:d,widgets:l})=>{let f=n,c=f.lineKinds,y=Te(o),p=r.options??{},k=ad(p.min)??0,g=ad(p.max)??1/0,m=Y=>typeof p[Y]=="string"&&p[Y].trim()?p[Y]:null,b=new Map,h=!!(r.cells||r.rowTones||r.rowBold!==void 0||r.rowButtons||r.lineDelete!==void 0),v=(r.columns??Object.keys(f.fields)).filter(Y=>f.fields[Y]&&f.fields[Y].type!=="one2many"&&Y!==c?.field&&Y!==f.sequenceField&&r.optionalColumns?.[Y]!=="hide"),S=o.createElement("div");S.className="fd-lines",S.id=i,r.cards&&(S.dataset.cards=r.cards),r.fit&&(S.dataset.fit=r.fit),S.setAttribute("role","group");let x=o.createElement("div");x.className="fd-lines-scroll";let F=o.createElement("table");F.className="fd-lines-table";let E=o.createElement("thead"),w=o.createElement("tr"),A=!!r.selectedButtons?.length,R=new Set,I=A?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick fd-line-pick-all","aria-label":a.chooseAllLines}):null;w.append(y("th",{class:"fd-lines-grip"},...I?[I]:[]));for(let Y of v){let ne=o.createElement("th");ne.scope="col",ne.dataset.column=Y,ne.textContent=f.fields[Y].label;let fe=r.cells?.[Y]?.width;fe?ne.style.width=`${fe}ch`:od.has(f.fields[Y].type)&&(ne.dataset.fit=f.fields[Y].type),b.set(Y,ne),w.append(ne)}let M=o.createElement("th");M.className="fd-lines-tools",w.append(M),E.append(w);let P=o.createElement("tbody");F.append(E,P);let H=(r.totals??[]).filter(Y=>v.includes(Y)),D=new Map,W=new Map;if(H.length){let Y=o.createElement("tfoot"),ne=o.createElement("tr");ne.className="fd-lines-totals",ne.append(o.createElement("td")),v.forEach((fe,U)=>{let re=o.createElement("td");re.dataset.column=fe,W.set(fe,re),H.includes(fe)?D.set(fe,re):U===0&&(re.textContent=a.total),ne.append(re)}),ne.append(o.createElement("td")),Y.append(ne),F.append(Y)}x.append(F);let z=o.createElement("div");z.className="fd-lines-adds";let j=(Y,ne,fe)=>{let U=o.createElement("button");U.type="button",U.className="fd-button fd-button-link fd-lines-add",U.dataset.add=fe,U.textContent=`+ ${Y}`,U.addEventListener("click",()=>{Me=e.addLine(t,ne);let re=Ee.get(Me);re&&(re.cells[0]?.widget.focus(),Me=null)}),z.append(U)};j(m("addLabel")??a.addLine,{},"line"),c&&(j(m("addSectionLabel")??a.addSection,{[c.field]:c.section??"section"},"section"),j(m("addNoteLabel")??a.addNote,{[c.field]:c.note??"note"},"note"));let V=(r.controlButtons??[]).map(Y=>{let ne=kt(o,Y.icon),fe=y("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-lines-control","data-node":Y.id},...ne?[ne]:[],Y.label);return fe.addEventListener("click",()=>{Ve(fe,()=>e.runAction(Y.id))}),z.append(fe),{id:Y.id,button:fe}}),B=y("span",{class:"fd-lines-chosen-count",role:"status"}),$=(r.selectedButtons??[]).map(Y=>{let ne=kt(o,Y.icon),fe=y("button",{type:"button",class:`fd-button fd-button-${Y.style??"secondary"} fd-lines-chosen-button`,"data-node":Y.id},...ne?[ne]:[],Y.label);return fe.addEventListener("click",()=>{Ve(fe,()=>e.runLinesAction(r.id,Y.id,oe().filter(U=>R.has(U.key)).map(U=>U.key)))}),{id:Y.id,button:fe}}),Q=A?y("div",{class:"fd-lines-chosen",hidden:""},B,...$.map(Y=>Y.button)):null,X=m("emptyLabel"),J=X?y("div",{class:"fd-help fd-lines-empty"},X):null,_=hi(y,a),te=y("div",{class:"fd-sr-only",role:"status"});S.append(...Q?[Q]:[],x,...J?[J]:[],z,_.element,te);async function Ve(Y,ne){if(!Y.hasAttribute("aria-busy")){Y.setAttribute("aria-busy","true");try{await ne()}finally{Y.removeAttribute("aria-busy")}}}function Ie(){if(!Q||!I)return;let Y=oe().filter(ne=>!gt(f,ne.values));for(let ne of[...R])Y.some(fe=>fe.key===ne)||R.delete(ne);Q.hidden=ie||R.size===0,B.textContent=ze(a.linesChosen,{n:R.size});for(let{id:ne,button:fe}of $)fe.hidden=e.node(ne).invisible;I.checked=Y.length>0&&R.size===Y.length,I.indeterminate=R.size>0&&R.size<Y.length,I.disabled=ie||!Y.length;for(let[ne,fe]of Ee)fe.pick&&(fe.pick.checked=R.has(ne),fe.pick.disabled=ie)}I?.addEventListener("change",()=>{let Y=oe().filter(ne=>!gt(f,ne.values));if(I.checked)for(let ne of Y)R.add(ne.key);else R.clear();Ie()});let Ee=new Map,Me=null,ie=!1,ge=null,oe=()=>e.getState().values[t]??[];for(let Y=oe().length;Y<k;Y++)e.addLine(t);function ke(Y,ne){let fe=oe().findIndex(Ce=>Ce.key===Y);if(ie||ne===fe||ne<0||ne>=oe().length)return;let U=o.activeElement,re=oe()[fe].values[v[0]];er(e,t,f,Y,ne),U&&U!==o.activeElement&&U.focus(),te.textContent=ze(a.movedTo,{label:typeof re=="string"&&re.trim()?re:ze(a.lineN,{n:fe+1}),n:ne+1,total:oe().length})}function De(Y,ne,fe){let U=[...P.children],re=U.indexOf(Y),Ce=U.filter(he=>he!==Y),Pe=Y.getBoundingClientRect(),ae=Ce.map(he=>{let be=he.getBoundingClientRect();return be.top+be.height/2}),le=re,se=!1,ce=he=>{he.key==="Escape"&&(he.preventDefault(),me())};function me(){for(let he of U)he.style.transform="";Y.classList.remove("fd-line-lifted"),P.classList.remove("fd-lines-dragging"),o.removeEventListener("keydown",ce,!0),se=!1}return{follow(he){let be=he-fe;if(!se){if(Math.abs(be)<4||ie)return;se=!0,Y.classList.add("fd-line-lifted"),P.classList.add("fd-lines-dragging"),o.addEventListener("keydown",ce,!0)}Y.style.transform=`translateY(${be}px)`;let rt=Pe.top+Pe.height/2+be;le=ae.filter(ht=>ht<rt).length,Ce.forEach((ht,St)=>{ht.style.transform=St>=re&&St<le?`translateY(${-Pe.height}px)`:St<re&&St>=le?`translateY(${Pe.height}px)`:""})},drop(){let he=se&&le!==re;me(),he&&ke(ne,le)},settle:me}}P.addEventListener("keydown",Y=>{let ne=Y.target.closest("tr")?.dataset.line;!ne||!Y.altKey||Y.key!=="ArrowUp"&&Y.key!=="ArrowDown"||(Y.preventDefault(),ke(ne,oe().findIndex(fe=>fe.key===ne)+(Y.key==="ArrowUp"?-1:1)))});function xe(Y,ne,fe,U,re=1){let Ce=`${i}-${ne.key}-${fe}`,Pe=gt(f,ne.values)?void 0:r.cells?.[fe],ae=Pe?.badge?{widget:"badge"}:Pe?.widget?{widget:Pe.widget,...Pe.options?{options:Pe.options}:{}}:Pe?.options?{options:Pe.options}:{},le={type:"field",id:`${r.id}.${ne.key}.${fe}`,field:fe,...ae},se=Ot({form:Li(e,t,ne.key),name:fe,field:U,node:le,id:Ce,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ce=o.createElement("td");ce.colSpan=re,ce.dataset.column=fe,od.has(U.type)&&(ce.dataset.fit=U.type),ce.dataset.label=U.label;let me=o.createElement("label");me.className="fd-sr-only",me.htmlFor=Ce,me.textContent=U.label;let he=o.createElement("div");return he.className="fd-cell-error",he.hidden=!0,ce.append(me,se.element,he),Y.append(ce),{name:fe,def:U,widget:se,error:he,td:ce}}function Xe(Y){let ne=o.createElement("tr");ne.dataset.line=Y.key;let fe=gt(f,Y.values);fe&&(ne.className=`fd-line-${fe}`);let U=y("span",{class:"fd-line-grip fd-rank-grip","aria-hidden":"true"}),re=null;U.addEventListener("pointerdown",me=>{ie||me.button!==0||(me.preventDefault(),U.setPointerCapture?.(me.pointerId),re=De(ne,Y.key,me.clientY))}),U.addEventListener("pointermove",me=>re?.follow(me.clientY)),U.addEventListener("pointerup",()=>{re?.drop(),re=null}),U.addEventListener("pointercancel",()=>{re?.settle(),re=null});let Ce=A&&!fe?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick"}):null;Ce?.addEventListener("change",()=>{Ce.checked?R.add(Y.key):R.delete(Y.key),Ie()}),ne.append(y("td",{class:"fd-lines-grip"},...Ce?[y("span",{class:"fd-line-lead"},Ce,U)]:[U]));let Pe=fe&&c?[xe(ne,Y,c.text,dd(f.fields[c.text],fe),v.length)]:v.map(me=>xe(ne,Y,me,f.fields[me])),ae=o.createElement("td");ae.className="fd-lines-tools";let le=o.createElement("button");le.type="button",le.className="fd-line-delete",le.textContent="\xD7",le.setAttribute("aria-label",a.deleteLine),le.addEventListener("click",()=>{let me=oe().findIndex(be=>be.key===Y.key),he=oe()[me]?.values??{};if(p.confirmDelete!==!0||Pe.every(be=>Kt(be.def,he[be.name])||he[be.name]===!1))return e.removeLine(t,Y.key);_.ask(ze(a.removeAsk,{name:ze(a.lineN,{n:me+1})}),be=>{be&&e.removeLine(t,Y.key);let rt=oe(),ht=rt[be?Math.min(me,rt.length-1):me];(ht?Ee.get(ht.key)?.remove:z.querySelector("button"))?.focus()})});let se=new Map;for(let me of fe?[]:r.rowButtons??[]){let he=kt(o,me.icon),be=y("button",{type:"button",class:`fd-button fd-button-link fd-line-button${he?" fd-line-button-icon":""}`,"data-row-button":me.id,"aria-label":me.label,title:me.label});be.append(he??me.label),be.addEventListener("click",async()=>{if(!be.hasAttribute("aria-busy")){be.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,me.id,Y.key)}finally{be.removeAttribute("aria-busy")}}}),se.set(me.id,be),ae.append(be)}let ce=p.copy===!0&&!fe?y("button",{type:"button",class:"fd-line-copy"},"\u29C9"):null;if(ce?.addEventListener("click",()=>{let me=oe(),he=me.findIndex(ht=>ht.key===Y.key);if(ie||he<0||me.length>=g)return;let be={...me[he].values};f.sequenceField&&delete be[f.sequenceField];let rt=e.addLine(t,be);er(e,t,f,rt,he+1),Ee.get(rt)?.cells[0]?.widget.focus()}),ce&&ae.append(ce),(r.lineOpens||r.lineForm)&&d&&!fe){let me=y("button",{type:"button",class:"fd-line-open","aria-label":a.openLine,title:a.openLine},"\u2197");me.addEventListener("click",()=>{let he=oe().find(be=>be.key===Y.key);he&&Ei(e,t,r,he,d,ie)}),ae.append(me)}return ae.append(le),ne.append(ae),{element:ne,kind:fe,cells:Pe,remove:le,grip:U,buttons:se,pick:Ce,copy:ce}}return{element:S,focus:()=>(P.querySelector("input, select, textarea")??z.querySelector("button"))?.focus(),update(Y){ie=Y.readonly;let ne=Y.value??[];z.hidden=ie||ne.length>=g,ie&&(_.element.hidden=!0),J&&(J.hidden=ne.length>0);let fe=e.getState().errors,U=new Set(h?v.filter(ae=>e.columnHidden(r.id,ae)):[]);for(let[ae,le]of b)le.hidden=U.has(ae);for(let[ae,le]of W)le.hidden=U.has(ae);let re=ne.map(ae=>ae.key).join(" "),Ce=re!==ge;ge=re;for(let[ae,le]of Ce?b:new Map){if(r.cells?.[ae]?.width)continue;let se=f.fields[ae];if(le.dataset.fit){if(!tf.has(se.type))continue;let he=ne.reduce((be,rt)=>gt(f,rt.values)?be:Math.max(be,In(se,rt.values[ae],rt.values,s).length),0);le.style.setProperty("--fd-fit-need",`${he+4}ch`);continue}let ce=ne.reduce((he,be)=>gt(f,be.values)?he:Math.max(he,In(se,be.values[ae],be.values,s).length),0),me=se.type==="many2one"?5:0;le.style.width=`${Math.min(Math.max(ce,Math.min(se.label.length,10),6),32)+4+me}ch`,le.style.minWidth=`${Math.min(Math.max(ce,6),14)+4}ch`}let Pe=new Set(ne.map(ae=>ae.key));for(let[ae,le]of Ee)Pe.has(ae)||(le.element.remove(),Ee.delete(ae));ne.forEach((ae,le)=>{let se=Ee.get(ae.key);se&&se.kind!==gt(f,ae.values)&&(se.element.remove(),se=void 0),se||(se=Xe(ae),Ee.set(ae.key,se)),P.children[le]!==se.element&&P.insertBefore(se.element,P.children[le]??null);let ce=h?e.lineState(r.id,ae.key):null;se.remove.hidden=ie||ne.length<=k||ce?.deletable===!1,se.grip.hidden=ie;let me=ze(a.lineN,{n:le+1});se.pick?.setAttribute("aria-label",ze(a.chooseLine,{name:me})),se.copy&&(se.copy.setAttribute("aria-label",ze(a.copy,{name:me})),se.copy.title=se.copy.getAttribute("aria-label"),se.copy.hidden=ie||ne.length>=g),ie?se.remove.remove():se.remove.isConnected||se.element.lastElementChild?.append(se.remove),sd(se.element,"tone",ce?.tone),se.element.classList.toggle("fd-line-bold",!!ce?.bold);for(let[he,be]of se.buttons)be.hidden=!ce?.buttons[he];se.kind&&(se.cells[0].td.colSpan=v.length-U.size);for(let he of se.cells){let be=fe[`${t}.${ae.key}.${he.name}`],rt=se.kind?void 0:ce?.cells[he.name];se.kind||(he.td.hidden=U.has(he.name)),he.widget.element.hidden=!!rt?.invisible,sd(he.td,"tone",rt?.tone),he.td.classList.toggle("fd-cell-bold",!!rt?.bold),he.error.hidden=!be,he.error.textContent=be??"",he.widget.update({value:ae.values[he.name],values:ae.values,parent:Y.values,readonly:ie||he.def.readonly===!0||he.def.compute!==void 0||!!rt?.readonly,required:he.def.required===!0||!!rt?.required,invalid:!!be})}});for(let[ae,le]of D){let se=ne.filter(ce=>!gt(f,ce.values)).reduce((ce,me)=>ce+Number(me.values[ae]??0),0);le.textContent=In(f.fields[ae],se,ne[0]?.values??{},s,Y.values,r.cells?.[ae])}for(let{id:ae,button:le}of V)le.hidden=e.node(ae).invisible;Ie(),Me&&Ee.has(Me)&&(Ee.get(Me)?.cells[0]?.widget.focus(),Me=null)}}};function sd(e,t,n){n?e.dataset[t]=n:delete e.dataset[t]}var nf='a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function Gt(e,t){if(t.key!=="Tab")return;let n=[...e.querySelectorAll(nf)].filter(a=>!a.closest("[hidden], [inert]")&&!a.disabled);if(!n.length)return;let r=n[0],i=n[n.length-1],o=e.ownerDocument.activeElement;(t.shiftKey?o===r||!e.contains(o):o===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}var Fi=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result??"");t({name:e.name,type:e.type,size:e.size,data:i.slice(i.indexOf(",")+1)})},r.onerror=()=>n(r.error),r.readAsDataURL(e)}),fd=e=>(/\.(\w{1,5})$/.exec(e)?.[1]??"").toUpperCase();function Ri(e){let t=`${e.type} ${fd(e.name)}`.toLowerCase();return/^image\//.test(t)?"image":/pdf/.test(t)?"pdf":/sheet|excel|csv|xlsx?$|ods$/.test(t)?"sheet":/zip|rar|7z|tar|gz/.test(t)?"zip":/word|opendocument|^text|docx?$|odt$|rtf$/.test(t)?"doc":"file"}var rf=e=>/^text\/|json|xml|csv/.test(e.type),jo=e=>e.data?`data:${e.type};base64,${e.data}`:e.url??"",ud=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),cd=(e,t)=>e("span",{class:"fd-file-icon","data-kind":Ri(t),"aria-hidden":"true"},fd(t.name)||"?"),of={cards:'<path d="M3 3h8v8H3zM13 3h8v8h-8zM3 15h8M13 15h8M3 19h5M13 19h5"/>',thumbnails:'<path d="M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"/>'},af=(e,t)=>e("span",{class:"fd-file-name",dir:"auto",title:t},e("span",{},t.slice(0,-9)),t.slice(-9));function sf(e,t){let n=t.length/2,[r,i]=[Math.round(n),n/2];for(let a=t.indexOf(" ");a>=0;a=t.indexOf(" ",a+1))Math.abs(a+1-n)<i&&([r,i]=[a+1,Math.abs(a+1-n)]);let o=/^\P{L}*[\p{sc=Arabic}\p{sc=Hebrew}]/u.test(t);return e("span",{class:"fd-file-name",dir:o?"rtl":"ltr",title:t},e("span",{},t.slice(0,r)),e("span",{dir:o?"ltr":"rtl"},e("bdi",{},t.slice(r))))}function pd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d="en",preferences:l})=>{let f=r,c=We(s,d),y=Tt[d]??Tt.en,p=Te(a),k=f.multiple===!0,g=k?f.maxFiles??1/0:1,m=e==="image",b=String(i.options?.files??(m?"thumbnails":"list")),h=b==="thumbnails"?b:"cards",v=i.options?.filesSwitch===!0,S=`${t.page.id}.${i.id}.files`,x=v?l?.get(S):null,F=i.options?.camera,E=f.type==="binary"?f.accept:["image/*"],w=p("div"),A=p("input",{type:"file",id:o,class:"fd-sr-only",accept:E?.join(","),capture:F?F==="user"?"user":"environment":void 0});A.multiple=k;let R=[!m&&E?wr(E,y.or):"",f.maxSize?Ye(k?c.upToEach:c.upToSize,{size:on(f.maxSize)}):"",k&&f.maxFiles?Ye(c.upToFiles,{max:f.maxFiles}):""].filter(Boolean),I=p("label",{class:"fd-file-pick",for:o},p("span",{class:"fd-button"},k?m?c.addPhotos:c.addFiles:m?c.uploadImage:c.upload),p("span",{class:"fd-help"},k?c.dropThem:c.dropHere)),M=p("span",{class:"fd-help fd-file-limits"},R.join(" \xB7 ")),P=k?p("span",{class:"fd-help fd-file-count"}):null,H=p("ul",{class:"fd-files",role:"list"}),D=p("button",{type:"button",class:"fd-button fd-button-link"},c.replace);D.addEventListener("click",()=>A.click());let W=hi(p,c),z=p("div",{class:"fd-help fd-file-note",role:"status"}),j=(ie,ge)=>{let oe=p("button",{type:"button","data-view":ie},kt(a,ie,of),ge);return oe.addEventListener("click",()=>(X(ie),l?.set(S,ie))),oe},V=v?p("div",{class:"fd-file-views",role:"group","aria-label":c.showFilesAs},j("list",c.asList),j(h,h==="cards"?c.asCards:c.asThumbnails)):null,B=P||V?p("div",{class:"fd-file-bar"},...P?[P]:[],...V?[V]:[]):null,$=[A,I,...R.length?[M]:[]];w.append(...B?[B]:[],H,D,W.element,z);let Q=b;function X(ie){Q=ie;let ge=ie!=="list";w.className=`fd-file fd-file-${e} fd-files-${ie==="thumbnails"?"thumbs":ie}`,I.classList.toggle("fd-image-pick",ge),ge?H.after(...$):(B??H).before(...$),V?.querySelectorAll("button").forEach(oe=>oe.setAttribute("aria-pressed",String(oe.dataset.view===ie))),Ee()}let J=!1,_=[],te,Ve=ie=>z.replaceChildren(...ie.map(ge=>p("div",{},ge))),Ie=async ie=>{if(J||!ie.length)return;let ge=[],oe=[],ke=0;for(let xe of ie){let Xe=vr(f,xe,y)??(k&&[..._,...ge].some(Y=>Y.name===xe.name)?Ye(c.alreadyAdded,{name:xe.name}):void 0);Xe?oe.push(Xe):(k?_.length:0)+ge.length<g?ge.push(xe):ke++}if(ke&&k&&oe.push(Ye(c.tooMany,{max:g,n:ke})),Ve(oe),!ge.length)return;let De=await Promise.all(ge.map(Fi));t.setValue(n,k?[..._,...De]:De[0])};A.addEventListener("change",()=>{Ie([...A.files??[]]),A.value=""}),w.addEventListener("dragover",ie=>{J||(ie.preventDefault(),w.classList.add("fd-dragging"))}),w.addEventListener("dragleave",()=>w.classList.remove("fd-dragging")),w.addEventListener("drop",ie=>{ie.preventDefault(),w.classList.remove("fd-dragging"),Ie([...ie.dataTransfer?.files??[]])}),H.addEventListener("click",ie=>{let ge=ie.target.closest("button"),oe=Number(ge?.dataset.at);if(ge){if(ge.classList.contains("fd-file-open"))return Me(oe,ge);W.ask(Ye(c.removeAsk,{name:_[oe].name}),ke=>{let De=_[oe];ke&&(t.setValue(n,k?_.filter((xe,Xe)=>Xe!==oe):null),Ve([Ye(c.removed,{name:De.name})])),(H.querySelectorAll(".fd-file-remove")[ke?Math.min(oe,_.length-1):oe]??(I.hidden?D:A)).focus()})}});function Ee(){H.replaceChildren(..._.map((ie,ge)=>p("li",{class:"fd-file-item"},p("button",{type:"button",class:"fd-file-open","data-at":String(ge),"aria-haspopup":"dialog","aria-label":`${ie.name}, ${on(ie.size)}`},...[Ri(ie)==="image"&&jo(ie)?p("img",{class:"fd-file-thumb",src:jo(ie),alt:""}):cd(p,ie)].map(oe=>Q==="cards"?p("span",{class:"fd-file-picture"},oe):oe),(Q==="cards"?sf:af)(p,ie.name),p("span",{class:"fd-file-size"},on(ie.size))),...J?[]:[p("button",{type:"button",class:"fd-file-remove","data-at":String(ge),"aria-label":Ye(c.remove,{name:ie.name})},"\xD7")])))}X(x==="list"||x===h?x:b===h?b:"list");function Me(ie,ge){let oe=_,ke="",De=p("h2",{id:`${o}-view`,class:"fd-form-dialog-title"}),xe=p("span",{class:"fd-help"}),Xe=(se,ce,me)=>{let he=p("button",{type:"button",class:"fd-button fd-file-step","aria-label":ce},me);return he.hidden=oe.length<2,he.addEventListener("click",()=>ae(ie+se)),he},Y=p("a",{class:"fd-button"},c.download),ne=p("button",{type:"button",class:"fd-dialog-close","aria-label":c.close},"\xD7"),fe=p("div",{class:"fd-file-viewer-body"}),U=p("div",{class:"fd-form-dialog fd-file-viewer",role:"dialog","aria-modal":"true","aria-labelledby":De.id,tabindex:"-1"},p("div",{class:"fd-form-dialog-head"},De,xe,Xe(-1,c.previous,"\u2039"),Xe(1,c.next,"\u203A"),Y,ne),fe),re=p("div",{class:"fd-dialog-backdrop"},U),Ce=()=>ke.startsWith("blob:")&&URL.revokeObjectURL(ke),Pe=se=>p("div",{class:"fd-file-none"},cd(p,se),p("strong",{},se.name),on(se.size),p("p",{},c.noPreview));function ae(se){ie=(se+oe.length)%oe.length;let ce=oe[ie];Ce();let me=ce.data?ud(ce.data):null;ke=me?URL.createObjectURL(new Blob([me],{type:ce.type})):ce.url??"",De.textContent=ce.name,xe.replaceChildren(p("span",{class:"fd-file-size"},on(ce.size)),oe.length>1?` \xB7 ${Ye(c.fileAt,{n:ie+1,total:oe.length})}`:""),Y.href=ke,Y.download=ce.name;let he=Ri(ce);if(he==="image")return fe.replaceChildren(p("img",{src:ke,alt:ce.name}));if(he==="pdf")return fe.replaceChildren(p("iframe",{src:ke,title:ce.name}));if(!rf(ce))return fe.replaceChildren(Pe(ce));let be=p("pre",{tabindex:"0"});fe.replaceChildren(be),(me?Promise.resolve(new TextDecoder().decode(me.subarray(0,2e5))):fetch(ke).then(rt=>rt.text())).then(rt=>be.textContent=rt.slice(0,2e5),()=>be.replaceWith(Pe(ce)))}let le=()=>{Ce(),re.remove(),(ge.isConnected?ge:H.querySelectorAll(".fd-file-open")[ie])?.focus()};ne.addEventListener("click",le),re.addEventListener("click",se=>se.target===re&&le()),U.addEventListener("keydown",se=>{let ce={ArrowLeft:-1,ArrowRight:1}[se.key];se.key==="Escape"?le():ce&&oe.length>1&&se.target.tagName!=="PRE"?ae(ie+(Wt(w)?-ce:ce)):Gt(U,se)}),ae(ie),(w.closest(".fd-form")??a.body).append(re),U.focus()}return{element:w,focus:()=>(H.querySelector("button")??(I.hidden?D:A)).focus(),update(ie){J=ie.readonly;let ge=ie.value;_=Array.isArray(ge)?ge:ge?[ge]:[];let oe=_.length>=g;Mt(I,oe||J),Mt(M,J),A.disabled=J,A.hidden=I.hidden,Mt(D,k||!_.length||J),B&&Mt(B,!_.length),P&&ft(P,_.length?k&&f.maxFiles?Ye(c.fileCountOf,{n:_.length,max:f.maxFiles}):_.length===1?c.oneFile:Ye(c.fileCount,{n:_.length}):""),tt(A,ie),!(te===ge&&H.dataset.readonly===String(J))&&(te=ge,H.dataset.readonly=String(J),Ee())}}}}var Ar=pd("binary"),Ho=pd("image");function zo(e,t){let n=Ri(t);if(n!=="image"&&n!=="pdf")return null;let r=t.data?URL.createObjectURL(new Blob([ud(t.data)],{type:t.type})):jo(t),i=e.createElement(n==="image"?"img":"iframe");return i.setAttribute("src",n==="pdf"?`${r}#view=FitH&navpanes=0`:r),i.setAttribute(n==="image"?"alt":"title",t.name),i.setAttribute("data-kind",n),{element:i,url:r,free:()=>{r.startsWith("blob:")&&URL.revokeObjectURL(r)}}}var md=new Map;function gd(e,t){let n=md.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),md.set(t,n)),n.format(e/100)}var $r=e=>{let{field:t,node:n,id:r,document:i,locale:o="en"}=e,a=n.options??{},s=(h,v)=>{let S=a[h]??t[h];return typeof S=="number"?S:v},d=s("min",0),l=s("max",100),f=typeof a.maxField=="string"?a.maxField:null,c=typeof a.color=="string"?a.color:"auto",y=a.showPercent!==!1,p=i.createElement("div");p.className="fd-progressbar",p.setAttribute("role","progressbar");let k=i.createElement("div");k.className="fd-progressbar-fill";let g=i.createElement("span");g.className="fd-progressbar-text",p.append(k,g);let m=null,b=p;return a.editable===!0?(m=Ot({...e,node:{...n,widget:void 0}}),p.setAttribute("aria-hidden","true"),b=i.createElement("div"),b.className="fd-progressbar-edit",b.append(p,m.element)):(p.id=r,p.setAttribute("aria-label",n.label??t.label)),{element:b,focus:()=>m?.focus(),update(h){let v=typeof h.value=="number"?h.value:0,S=f?Number(h.values[f]??0):l,x=S>d?Math.min(100,Math.max(0,(v-d)/(S-d)*100)):0,F=Math.round(x*10)/10;k.style.width=`${F}%`,p.setAttribute("aria-valuenow",String(v)),p.setAttribute("aria-valuemin",String(d)),p.setAttribute("aria-valuemax",String(S)),p.setAttribute("aria-valuetext",gd(x,o)),g.textContent=y?gd(x,o):"",p.dataset.tone=c!=="auto"?c:x<30?"danger":x<70?"warning":"success",m?.update(h)}}};function hd(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var Tr=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options??{},a=f=>typeof o[f]=="string"?o[f]:"",s=f=>typeof o[f]=="string"?o[f]:null,d=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:f,values:c}){if(f==null||f===""){l.textContent="";return}let y=d!==null&&typeof f=="number"?pt(f,d,i):Ai(f,e),p=s("prefixField"),k=s("suffixField"),g=p?hd(c[p]):a("prefix"),m=k?hd(c[k]):a("suffix");l.textContent=[g,y,m].filter(b=>b!=="").join(" ")}}};function df(e,t){let[n,r]=e>=86400?[e/86400,"day"]:e>=3600?[e/3600,"hour"]:[Math.max(1,e/60),"minute"];try{return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"narrow",maximumFractionDigits:0,numberingSystem:"latn"}).format(Math.floor(n))}catch{return`${Math.floor(n)}${r[0]}`}}var $i=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s="en"})=>{let d=r.options??{},l=d.clickable===!0,f=Array.isArray(d.visibleStates)?d.visibleStates:null,c=typeof d.durationsField=="string"?d.durationsField:null,y=d.fold===!0,p=d.saves===!0,k=o.createElement("ol");k.className="fd-statusbar",k.id=i,k.setAttribute("aria-label",n.label);let g=P=>P&&typeof P=="object"&&"id"in P?`id:${String(P.id)}`:`v:${String(P)}`,m=P=>P&&typeof P=="object"&&"id"in P?String(P.id):String(P),b=n.type==="selection"?n.options.map(P=>({key:g(P.value),label:P.label,value:P.value,folded:!1})):[],h=[],v=P=>P.forEach(H=>"any"in H?v(H.any):"all"in H?v(H.all):H.valueFrom&&h.push(H.valueFrom));n.type==="many2one"&&v(n.filter??[]);let S=n.type==="selection"?"":null,x=0,F={value:void 0,readonly:!1,durations:{}},E="",w=!1,A=P=>{e.setValue(t,P.value),p&&e.settled().then(()=>e.save())};function R(){let{value:P,readonly:H,durations:D}=F,W=k.contains(o.activeElement)?o.activeElement.dataset.key:void 0,z=P==null?null:g(P),j=b.filter(_=>!f||f.some(te=>g(te)===_.key)||_.key===z);z&&!j.some(_=>_.key===z)&&P&&typeof P=="object"&&(j=[...j,{key:z,label:P.label,value:P,folded:!1}]);let V=y?j.filter(_=>_.folded&&_.key!==z):[];j=j.filter(_=>!V.includes(_));let B=j.map(_=>c?Number(D[m(_.value)]??0):0),$=JSON.stringify([j.map(_=>[_.key,_.label]),V.map(_=>_.key),B,z,H,w]);if($===E)return;E=$;let Q=j.map((_,te)=>{let Ve=o.createElement("span");Ve.textContent=_.label;let Ie=o.createElement(l?"button":"span");if(Ie instanceof HTMLButtonElement&&(Ie.type="button",Ie.disabled=H,Ie.dataset.key=_.key,Ie.addEventListener("click",()=>A(_))),Ie.append(Ve),B[te]>0){let Me=o.createElement("small");Me.className="fd-step-time",Me.textContent=df(B[te],s),Ie.title=a.timeInStep.replace("{time}",Me.textContent),Ie.append(Me)}_.key===z&&Ie.setAttribute("aria-current","step");let Ee=o.createElement("li");return Ee.append(Ie),Ee});V.length&&Q.push(I(V,H)),k.replaceChildren(...Q);let X=k.querySelector(".fd-step-menu:not([hidden])"),J=X?.previousElementSibling;if(X&&J){let _=J.getBoundingClientRect(),te=o.defaultView,Ve=getComputedStyle(k).direction==="rtl";X.style.top=`${_.bottom+4}px`,Ve?X.style.left=`${_.left}px`:X.style.right=`${Math.max(0,(te?.innerWidth??_.right)-_.right)}px`}W&&[...k.querySelectorAll("button")].find(_=>_.dataset.key===W)?.focus()}function I(P,H){let D=o.createElement("li");D.className="fd-step-more";let W=o.createElement("button");W.type="button",W.dataset.key="more",W.setAttribute("aria-haspopup","menu"),W.setAttribute("aria-expanded",String(w)),W.setAttribute("aria-label",a.moreSteps),W.title=a.moreSteps;let z=o.createElement("span");z.textContent="\u22EF",z.setAttribute("aria-hidden","true"),W.append(z);let j=o.createElement("div");j.className="fd-step-menu",j.setAttribute("role","menu"),j.hidden=!w;for(let V of P){let B=o.createElement("button");B.type="button",B.setAttribute("role","menuitem"),B.textContent=V.label,B.disabled=H||!l,B.addEventListener("click",()=>{w=!1,A(V),R()}),j.append(B)}return W.addEventListener("click",()=>{w=!w,R(),w&&k.querySelector(".fd-step-menu button:not([disabled])")?.focus()}),j.addEventListener("keydown",V=>{V.key==="Escape"&&(V.stopPropagation(),w=!1,R(),k.querySelector(".fd-step-more > button")?.focus())}),D.append(W,j),D}let M=P=>{w&&!k.contains(P.target)&&(w=!1,R())};return o.addEventListener("pointerdown",M),o.addEventListener("scroll",M,!0),{element:k,focus:()=>k.querySelector("button:not([disabled])")?.focus(),destroy(){o.removeEventListener("pointerdown",M),o.removeEventListener("scroll",M,!0)},update(P){let H=c?P.values?.[c]:null;F={value:P.value,readonly:P.readonly,durations:H&&typeof H=="object"&&!Array.isArray(H)?H:{}},R();let D=n.type==="selection"?"":JSON.stringify(h.map(W=>P.values?.[W]??null));if(S!==D){S=D;let W=++x;e.search(t,"",20).then(z=>{W===x&&(b=z.map(j=>({key:g(j),label:j.label,value:j,folded:j.folded===!0})),R())}).catch(()=>{})}}}};var lf={char:[void 0,"email","phone","url","password","time","tags","copy"],text:[void 0,"copy"],integer:[void 0],float:[void 0,"duration","percentage"],monetary:[void 0],selection:[void 0,"dot","tags"],date:[void 0,"daterange"],datetime:[void 0,"daterange"],many2one:[void 0],many2many:[void 0,"tags"],reference:[void 0],html:[void 0],json:["address"],properties:[void 0]};function Ti(e,t){return!t.widget&&(e.type==="selection"&&e.multiple||e.type==="many2many"&&t.columns?.length)?!1:lf[e.type]?.includes(t.widget)??!1}var cf=e=>!!e.closest(".fd-field[data-quiet]");function Dn(e,t=()=>e.showPicker?.()){e.addEventListener("click",()=>{if(!(e.readOnly||!cf(e)))try{t()}catch{}})}function yd(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 bd=e=>String(e).padStart(2,"0"),Bo=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Yt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function Mi(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 qo(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 Ni(e,t,n){let{form:r,name:i,id:o,document:a,locale:s="en"}=t,d=t.labels??Ze.en,l=s==="en"?"en-GB":s,f=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),c=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),y=new Intl.DateTimeFormat(l,{weekday:"short"}),p=new Intl.DateTimeFormat(l,{weekday:"long"}),k=a.createElement("button");k.type="button",k.className="fd-calendar-button";let g="http://www.w3.org/2000/svg",m=a.createElementNS(g,"svg");m.setAttribute("viewBox","0 0 16 16"),m.setAttribute("aria-hidden","true");for(let[j,V]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let B=a.createElementNS(g,j);for(let[$,Q]of Object.entries(V))B.setAttribute($,Q);m.append(B)}k.append(m),k.setAttribute("aria-label",d.chooseDate),k.setAttribute("aria-haspopup","dialog"),k.setAttribute("aria-expanded","false"),k.setAttribute("aria-controls",`${o}-calendar`);let b=a.createElement("div");b.className="fd-calendar",b.id=`${o}-calendar`,b.setAttribute("role","dialog"),b.hidden=!0;let h=a.createElement("div");h.className="fd-calendar-head";let v=a.createElement("button");v.type="button",v.textContent="\u2039",v.setAttribute("aria-label",d.previousMonth);let S=a.createElement("span");S.className="fd-calendar-title",S.setAttribute("aria-live","polite");let x=a.createElement("button");x.type="button",x.textContent="\u203A",x.setAttribute("aria-label",d.nextMonth),h.append(v,S,x);let F=a.createElement("table");F.className="fd-calendar-grid",F.setAttribute("role","grid"),b.append(h,F);let E=a.createElement("span");E.className="fd-date-pick",E.append(e.element,k,b);let w=new Date,A=!1;function R(j){if(n==="date")r.setValue(i,`${j.getFullYear()}-${bd(j.getMonth()+1)}-${bd(j.getDate())}`);else{let V=qo("datetime",r.getState().values[i]),B=new Date(j.getFullYear(),j.getMonth(),j.getDate(),V?.getHours()??0,V?.getMinutes()??0);r.setValue(i,B.toISOString())}W(),E.dispatchEvent(new CustomEvent("fd-picked",{bubbles:!0,detail:{value:r.getState().values[i]}}))}function I(j){let V=qo(n,r.getState().values[i]),B=new Date,$=f.format(w);S.textContent=$,b.setAttribute("aria-label",$);let Q=new Date(w.getFullYear(),w.getMonth(),1),X=Yt(Q,-((Q.getDay()+6)%7)),J=a.createElement("tr"),_=a.createElement("th");_.scope="col",_.textContent=d.weekShort,_.setAttribute("abbr",d.week),J.append(_);for(let Ie=0;Ie<7;Ie++){let Ee=Yt(X,Ie),Me=a.createElement("th");Me.scope="col",Me.textContent=y.format(Ee).replace(/\.$/,""),Me.setAttribute("abbr",p.format(Ee)),J.append(Me)}let te=a.createElement("thead");te.append(J);let Ve=a.createElement("tbody");for(let Ie=X;Ie<=new Date(w.getFullYear(),w.getMonth()+1,0);Ie=Yt(Ie,7)){let Ee=a.createElement("tr"),Me=a.createElement("th");Me.scope="row",Me.className="fd-week",Me.textContent=String(yd(Ie)),Ee.append(Me);for(let ie=0;ie<7;ie++){let ge=Yt(Ie,ie),oe=a.createElement("td"),ke=a.createElement("button");ke.type="button",ke.textContent=String(ge.getDate()),ke.setAttribute("aria-label",c.format(ge)),ke.tabIndex=Bo(ge,w)?0:-1,ge.getMonth()!==w.getMonth()&&ke.classList.add("fd-outside"),V&&Bo(ge,V)&&ke.setAttribute("aria-selected","true"),Bo(ge,B)&&ke.setAttribute("aria-current","date"),ke.disabled=A,ke.addEventListener("click",()=>R(ge)),ke.addEventListener("keydown",De=>P(De,ge)),oe.append(ke),Ee.append(oe)}Ve.append(Ee)}F.replaceChildren(te,Ve),j&&F.querySelector('button[tabindex="0"]')?.focus()}function M(j){w=j,I(!0)}function P(j,V){let B={ArrowLeft:()=>Yt(V,-1),ArrowRight:()=>Yt(V,1),ArrowUp:()=>Yt(V,-7),ArrowDown:()=>Yt(V,7),PageUp:()=>Mi(V,-1),PageDown:()=>Mi(V,1),Home:()=>Yt(V,-((V.getDay()+6)%7)),End:()=>Yt(V,6-(V.getDay()+6)%7)};B[j.key]?(j.preventDefault(),M(B[j.key]())):(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),R(V))}function H(){w=qo(n,r.getState().values[i])??new Date,b.hidden=!1,k.setAttribute("aria-expanded","true"),I(!0),D()}function D(){b.style.translate="";let j=b.getBoundingClientRect(),V=a.documentElement.clientWidth;if(!j.width||!V)return;let B=j.left<8?8-j.left:j.right>V-8?Math.max(8-j.left,V-8-j.right):0;B&&(b.style.translate=`${Math.round(B)}px 0`)}function W(){b.hidden||(b.hidden=!0,k.setAttribute("aria-expanded","false"),k.focus())}k.addEventListener("click",()=>b.hidden?H():W()),e.element instanceof HTMLInputElement&&Dn(e.element,()=>b.hidden&&H()),v.addEventListener("click",()=>{w=Mi(w,-1),I(!1)}),x.addEventListener("click",()=>{w=Mi(w,1),I(!1)}),b.addEventListener("keydown",j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),W())});let z=j=>{!b.hidden&&!E.contains(j.target)&&(b.hidden=!0,k.setAttribute("aria-expanded","false"))};return a.addEventListener("mousedown",z),{element:E,focus:()=>e.focus(),update(j){A=j.readonly,k.hidden=j.readonly,j.readonly&&(b.hidden=!0),e.update(j)},destroy(){a.removeEventListener("mousedown",z),e.destroy?.()}}}var ff=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},xd=e=>e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^(\d)/,"p_$1")||"property";function uf(e,t){let n=ff(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 pf=["char","text","integer","float","boolean","date"],_o=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d}=e,l=Te(a),f=We(s,d),c=r.type==="properties"?r.definitions:void 0,y=r.type==="properties"&&!!r.definitionsFrom,p=()=>{let z=t.getState().values[n];return z&&typeof z=="object"&&!Array.isArray(z)?z:{}},k={...t,getState:()=>({...t.getState(),values:p()}),setValue:(z,j)=>t.setValue(n,{...p(),[z]:j})},g=l("div",{class:"fd-properties-list"}),m=l("div",{class:"fd-properties",role:"group"},g);i.options?.columns===2&&(m.dataset.columns="2");let h=l("div",{class:"fd-help",role:"status",hidden:""});m.append(h);let v=y&&i.options?.add===!0,S=l("button",{type:"button",class:"fd-button fd-button-link fd-property-add",hidden:""},`+ ${f.addProperty}`),x=l("input",{type:"text",class:"fd-input","aria-label":f.propertyName,placeholder:f.propertyName,autocomplete:"off"}),F=f.propertyTypes.split("|"),E=l("select",{class:"fd-input fd-select","aria-label":f.propertyType},...pf.map((z,j)=>l("option",{value:z},F[j]??z))),w=l("button",{type:"button",class:"fd-button fd-button-primary"},f.add),A=l("button",{type:"button",class:"fd-button"},f.cancel),R=l("div",{class:"fd-property-new",hidden:""},x,E,w,A);v&&m.append(S,R);let I=null,M=()=>{R.hidden=!0,S.hidden=!1};S.addEventListener("click",()=>{R.hidden=!1,S.hidden=!0,x.value="",E.value="char",x.focus()}),A.addEventListener("click",()=>{M(),S.focus()});let P=()=>{let z=x.value.trim();if(!z)return x.focus();let j=new Set(H.map(B=>B.definition.name)),V=xd(z);for(let B=2;j.has(V);B++)V=`${xd(z)}_${B}`;I=V,M(),t.addDefinition(n,{name:V,label:z,type:E.value})};w.addEventListener("click",P),R.addEventListener("keydown",z=>{z.key==="Enter"&&z.target===x?(z.preventDefault(),P()):z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),M(),S.focus())});let H=[],D="";function W(z){for(let j of H)j.widget.destroy?.();H=z.map(j=>{let V=`${o}-${j.name}`,B={type:j.type,label:j.label,...j.options?{options:j.options}:{}},$={type:"field",id:`${i.id}.${j.name}`,field:j.name},Q=Ot({...e,form:k,name:j.name,field:B,node:$,id:V});return{definition:j,widget:Q}}),g.replaceChildren(...H.map(({definition:j,widget:V})=>{let B=a.createElement("div");B.className="fd-property",B.dataset.type=j.type;let $=a.createElement("label");return $.htmlFor=`${o}-${j.name}`,$.textContent=j.label,B.append($,V.element),B}))}return y&&!t.getState().definitions[n]&&t.loadDefinitions(n),{element:m,focus:()=>(H[0]?.widget??{focus:()=>S.focus()}).focus(),destroy:()=>H.forEach(z=>z.widget.destroy?.()),update(z){let j=p(),V=y?t.getState().definitions[n]:void 0,B=y?V?.definitions??[]:c??Object.keys(j).map(Q=>uf(Q,j[Q])),$=JSON.stringify(B);$!==D&&(D=$,W(B));for(let{definition:Q,widget:X}of H)X.update({value:j[Q.name]??null,values:j,readonly:z.readonly,required:!1,invalid:!1});h.textContent=V?.loading&&!V.definitions?f.loading:V?.error??"",h.hidden=!h.textContent,v&&(z.readonly&&M(),S.hidden=z.readonly||!R.hidden),I&&H.some(Q=>Q.definition.name===I)&&(H.find(Q=>Q.definition.name===I)?.widget.focus(),I=null)}}};function Ci(e){let t=0,n=()=>{throw t},r=()=>{for(;t<e.length&&`
|
|
5
5
|
\r`.includes(e[t]);)t++},i=f=>e[t]===f?t++:n(),o=f=>{for(let c of f)i(c)},a=()=>{for(/[0-9]/.test(e[t]??"")||n();/[0-9]/.test(e[t]??"");)t++};function s(){for(i('"');e[t]!=='"';)if((t>=e.length||e.charCodeAt(t)<32)&&n(),e[t]==="\\")if(t++,'"\\/bfnrt'.includes(e[t]??"x"))t++;else if(e[t]==="u"){t++;for(let f=0;f<4;f++)/[0-9a-fA-F]/.test(e[t]??"")||n(),t++}else n();else t++;t++}function d(){e[t]==="-"&&t++,e[t]==="0"?t++:a(),e[t]==="."&&(t++,a()),(e[t]==="e"||e[t]==="E")&&(t++,(e[t]==="+"||e[t]==="-")&&t++,a())}function l(){r();let f=e[t];if(f==="{"){if(t++,r(),e[t]==="}"){t++;return}for(;;)if(r(),s(),r(),i(":"),l(),r(),e[t]===",")t++;else return void i("}")}if(f==="["){if(t++,r(),e[t]==="]"){t++;return}for(;;)if(l(),r(),e[t]===",")t++;else return void i("]")}if(f==='"')return s();if(f==="-"||/[0-9]/.test(f??""))return d();if(f==="t")return o("true");if(f==="f")return o("false");if(f==="n")return o("null");n()}try{return l(),r(),t<e.length&&n(),null}catch(f){if(typeof f!="number")throw f;let c=e.slice(0,f).split(`
|
|
6
|
-
`);return{offset:f,line:c.length,column:c[c.length-1].length+1}}}var wc=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),kc=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),Sc=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),Lc=new Set(["left","center","right","justify","start","end"]);function xo(e,t=globalThis.document){let n=t.createElement("template");n.innerHTML=e;let r=o=>{for(let a of[...o.childNodes]){if(a.nodeType===Node.TEXT_NODE)continue;if(a.nodeType!==Node.ELEMENT_NODE){a.remove();continue}let s=a;if(kc.has(s.tagName)){s.remove();continue}if(r(s),!wc.has(s.tagName)){s.replaceWith(...s.childNodes);continue}let d=s.tagName==="A"?s.getAttribute("href"):null,l=Sc.has(s.tagName)?s.style?.textAlign?.trim().toLowerCase():"";for(let f of[...s.attributes])s.removeAttribute(f.name);d&&/^(https?:|mailto:)/i.test(d.trim())&&s.setAttribute("href",d.trim()),l&&Lc.has(l)&&s.setAttribute("style",`text-align: ${l};`)}};r(n.content);let i=t.createElement("div");return i.append(n.content),i.innerHTML}function Ws(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 Ds=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["heading","heading","<b>H</b>"],["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>']],wo=({form:e,name:t,node:n,id:r,document:i,labels:o=tt.en})=>{let a=i.createElement("div");a.id=r,a.className="fd-input fd-richtext",a.setAttribute("role","textbox"),a.setAttribute("aria-multiline","true"),a.setAttribute("contenteditable","true"),n.placeholder&&(a.setAttribute("data-placeholder",n.placeholder),a.setAttribute("aria-placeholder",n.placeholder));let s=n.options?.toolbar!==!1,d="";a.addEventListener("input",()=>{let c=xo(a.innerHTML,i);d=c,e.setValue(t,c.trim()===""?null:c)}),a.addEventListener("blur",()=>{a.innerHTML!==d&&(a.innerHTML=d)});let l=s?Ec(a,i,o):null,f=a;return l&&(f=i.createElement("div"),f.className="fd-richtext-box",f.setAttribute("role","group"),a.setAttribute("aria-labelledby",`${r}-label`),f.append(l.bar,l.linkRow,a)),{element:f,focus:()=>a.focus(),destroy:()=>l?.destroy(),update(c){l&&(l.bar.hidden=c.readonly,c.readonly&&(l.linkRow.hidden=!0));let v=xo(typeof c.value=="string"?c.value:"",i);(v!==d||i.activeElement!==a)&&(a.innerHTML!==v&&(a.innerHTML=v),d=v),a.setAttribute("contenteditable",String(!c.readonly)),a.classList.toggle("fd-blank",!v.trim()),a.setAttribute("aria-readonly",String(c.readonly)),a.setAttribute("aria-invalid",String(c.invalid)),c.describedBy&&a.setAttribute("aria-describedby",c.describedBy)}}};function Ec(e,t,n){let r=t.createElement("div");r.className="fd-richtext-bar",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",n.formatting);let i=null,o=()=>{e.focus();let g=t.getSelection();i&&g&&(g.removeAllRanges(),g.addRange(i))},a=(g,p)=>{o(),t.execCommand?.(g,!1,p)},s=t.createElement("select");s.className="fd-richtext-style",s.setAttribute("aria-label",n.textStyle);for(let[g,p]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let b=t.createElement("option");b.value=g,b.textContent=n[p],s.append(b)}s.addEventListener("change",()=>a("formatBlock",`<${s.value}>`));let d=t.createElement("div");d.className="fd-link-row",d.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",n.linkAddress);let f=t.createElement("button");f.type="button",f.className="fd-button fd-link-apply",f.textContent=n.applyLink;let c=t.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-link-remove",c.textContent=n.removeLink,d.append(l,f,c),f.addEventListener("click",()=>{let g=Ws(l.value);if(!g){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),o(),t.execCommand?.("createLink",!1,g),d.hidden=!0}),c.addEventListener("click",()=>{o(),t.execCommand?.("unlink",!1),d.hidden=!0}),l.addEventListener("keydown",g=>{g.key==="Enter"?(g.preventDefault(),f.click()):g.key==="Escape"&&(g.preventDefault(),d.hidden=!0,o())});let v=Ds.map(([g,p,b])=>{let h=t.createElement("button");return h.type="button",h.className="fd-richtext-tool",h.setAttribute("aria-label",n[g]),h.title=n[g],h.innerHTML=b,h.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline","heading"].includes(p)&&h.setAttribute("aria-pressed","false"),h.addEventListener("mousedown",x=>x.preventDefault()),h.addEventListener("click",()=>{if(p==="heading")return a("formatBlock",s.value==="h2"?"<p>":"<h2>");if(p!=="createLink")return a(p);d.hidden=!1,l.value="",l.focus()}),h});r.append(s,...v);let m=[s,...v];m.forEach((g,p)=>g.tabIndex=p===0?0:-1),r.addEventListener("keydown",g=>{if(g.key!=="ArrowRight"&&g.key!=="ArrowLeft")return;let p=m.indexOf(t.activeElement);if(p<0)return;let b=getComputedStyle(r).direction==="rtl",h=g.key==="ArrowRight"!==b?1:-1,x=m[(p+h+m.length)%m.length];g.preventDefault(),m.forEach(L=>L.tabIndex=L===x?0:-1),x.focus()});let S=()=>{let g=t.getSelection();if(!g||!g.rangeCount||!e.contains(g.anchorNode))return;i=g.getRangeAt(0).cloneRange();let p=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");s.value=p==="h2"||p==="h3"?p:"p";for(let b of v){let h=Ds[v.indexOf(b)][1];b.hasAttribute("aria-pressed")&&b.setAttribute("aria-pressed",String(h==="heading"?p==="h2":t.queryCommandState?.(h)??!1))}};return t.addEventListener("selectionchange",S),{bar:r,linkRow:d,destroy:()=>t.removeEventListener("selectionchange",S)}}var ko=({form:e,name:t,id:n,document:r,labels:i=tt.en})=>{let o=r.createElement("div");o.className="fd-json";let a=r.createElement("textarea");a.id=n,a.className="fd-input fd-textarea fd-code",a.spellcheck=!1;let s=r.createElement("div");return s.className="fd-cell-error",s.hidden=!0,o.append(a,s),a.addEventListener("input",()=>{if(a.value.trim()===""){s.hidden=!0,e.setValue(t,null);return}let d=bi(a.value);s.hidden=!d,d?s.textContent=i.invalidJsonAt.replace("{line}",String(d.line)).replace("{column}",String(d.column)):e.setValue(t,JSON.parse(a.value))}),{element:o,focus:()=>a.focus(),update(d){if(r.activeElement!==a){let l=d.value===null||d.value===void 0?"":JSON.stringify(d.value,null,2);a.value!==l&&(a.value=l)}a.readOnly=d.readonly,a.setAttribute("aria-invalid",String(d.invalid||!s.hidden))}}};var js=new WeakMap;function Rc(e){let t=js.get(e);return t===void 0&&(t=Math.floor(Math.random()*4294967296)>>>0,js.set(e,t)),t}function Fc(e,t){let n=e^2654435769;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(r),2246822507),n^=n>>>13;return n>>>0}function Ac(e){let t=e;return()=>{t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function rn(e,t,n,r){if(r.options?.shuffle!==!0)return[...e];let i=(s,d)=>s[d]===!0,o=e.filter(s=>!i(s,"fixed")&&!i(s,"exclusive")),a=Ac(Fc(Rc(t),n));for(let s=o.length-1;s>0;s--){let d=Math.floor(a()*(s+1));[o[s],o[d]]=[o[d],o[s]]}return o.push(...e.filter(s=>!i(s,"fixed")&&i(s,"exclusive"))),e.map(s=>i(s,"fixed")?s:o.shift())}var Hs=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=n,s=a.multiple?"checkbox":"radio",d=(p,b={},...h)=>{let x=o.createElement(p);for(let[L,y]of Object.entries(b))x.setAttribute(L,y);return x.append(...h),x},l=d("table",{id:i,class:"fd-matrix-table"});l.append(d("thead",{},d("tr",{},d("th",{scope:"col"}),...a.columns.map(p=>d("th",{scope:"col"},p.label)))));let f=d("tbody"),c=[],v=[];for(let p of rn(a.rows,e,t,r)){let b=d("tr",{role:s==="radio"?"radiogroup":"group","aria-label":p.label});v.push(b),b.append(d("th",{scope:"row"},p.label));for(let h of a.columns){let x=d("input",{type:s,name:`${i}-${p.value}`,value:String(h.value),"data-row":String(p.value),"aria-label":`${p.label}: ${h.label}`});x.addEventListener("change",()=>{if(a.onePerColumn&&x.checked)for(let L of c)L.value===x.value&&L!==x&&(L.checked=!1);g()}),c.push(x),b.append(d("td",{},d("label",{class:"fd-matrix-pick"},x,d("span",{class:"fd-matrix-column"},h.label))))}f.append(b)}l.append(f);let m=d("div",{class:"fd-matrix"},l),S=p=>a.columns.find(b=>String(b.value)===p)?.value??p;function g(){let p={};for(let b of a.rows){let h=c.filter(x=>x.dataset.row===String(b.value)&&x.checked).map(x=>S(x.value));(a.multiple?h.length:h.length===1)&&(p[String(b.value)]=a.multiple?h:h[0])}e.setValue(t,Object.keys(p).length?p:null)}return{element:m,focus:()=>(c.find(p=>p.checked)??c[0])?.focus(),update(p){let b=p.value&&typeof p.value=="object"&&!Array.isArray(p.value)?p.value:{};for(let h of c){let x=b[h.dataset.row??""],L=Array.isArray(x)?x.map(String):x==null?[]:[String(x)];h.checked=L.includes(h.value),h.disabled=p.readonly}if(l.setAttribute("aria-invalid",String(p.invalid)),s==="radio")for(let h of v)De(h,"aria-required",String(p.required));p.describedBy?l.setAttribute("aria-describedby",p.describedBy):l.removeAttribute("aria-describedby")}}};var Jn=600,vr=180,$c="#1b2a5c",Tc='"Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive',Mc=e=>Math.floor(e.length*3/4)-(e.endsWith("==")?2:e.endsWith("=")?1:0),Nc=e=>e.data??e.url??"",Bs=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Oe(a,s),l=Ee(o),f=r.options??{},c=f.color,v=typeof c=="string"&&/^#[\da-f]{6}$/i.test(c)?c:$c,m=f.penWidth,S=typeof m=="number"&&m>0?m:3,g=f.footerLabel,p=l("canvas",{class:"fd-signature-pad",width:String(Jn),height:String(vr),role:"img","aria-label":d.signaturePad}),b=l("span",{class:"fd-signature-hint","aria-hidden":"true"},r.placeholder||d.signHere),h=l("img",{class:"fd-signature-image",alt:n.label,hidden:""}),x=l("input",{type:"text",class:"fd-input fd-signature-typed","aria-label":d.typeSignature,placeholder:d.typeSignature,autocomplete:"name"}),L=K=>l("button",{type:"button",class:"fd-button fd-button-link",hidden:""},K),y=L(d.undo),R=L(d.clearDrawing);R.classList.add("fd-signature-clear");let E=f.upload===!0?L(d.uploadSignature):null,k=l("input",{type:"file",accept:"image/*",class:"fd-sr-only",tabindex:"-1","aria-hidden":"true"}),A=l("div",{id:i,class:"fd-signature",role:"group"},l("div",{class:"fd-signature-box"},p,h,b),...typeof g=="string"&&g?[l("span",{class:"fd-signature-footer"},g)]:[],l("div",{class:"fd-signature-tools"},x,y,...E?[E,k]:[],R)),w=()=>{let K=p.getContext("2d");return K&&(K.strokeStyle=K.fillStyle=v,K.lineWidth=S,K.lineCap=K.lineJoin="round"),K},j=null,C=!1,O=null,W=[],D=null,I=()=>!W.length&&!O;function B(){let K=w();if(K){K.clearRect(0,0,Jn,vr),O&&(K.font=`italic 64px ${Tc}`,K.textAlign="center",K.textBaseline="middle",K.fillText(O,Jn/2,vr/2,Jn-40));for(let q of W){K.beginPath(),K.arc(q[0].x,q[0].y,S/2,0,Math.PI*2),K.fill();for(let oe=1;oe<q.length;oe++)H(q[oe-1],q[oe])}}}function H(K,q){let oe=w();oe?.beginPath(),oe?.moveTo(K.x,K.y),oe?.lineTo(q.x,q.y),oe?.stroke()}function V(){W=[],O=null,B()}function z(){if(b.hidden=!I(),I())return j=null,e.setValue(t,null);let K;try{K=p.toDataURL("image/png")}catch{return}if(!K)return;let q=K.slice(K.indexOf(",")+1);j=q,e.setValue(t,{name:"signature.png",type:"image/png",size:Mc(q),data:q,...O&&!W.length?{text:O}:{}})}function T(K){let q=p.getBoundingClientRect();return{x:(K.clientX-q.left)*Jn/(q.width||Jn),y:(K.clientY-q.top)*vr/(q.height||vr)}}p.addEventListener("pointerdown",K=>{C||K.button!==0||(K.preventDefault(),p.setPointerCapture?.(K.pointerId),D=T(K),W.push([D]),b.hidden=!0,B())}),p.addEventListener("pointermove",K=>{if(!D)return;let q=T(K);H(D,q),W[W.length-1].push(q),D=q});let te=()=>{D&&(D=null,z())};p.addEventListener("pointerup",te),p.addEventListener("pointercancel",te),x.addEventListener("input",()=>{Y(),W=[],O=x.value.trim()||null,B(),z()}),y.addEventListener("click",()=>{W.pop(),B(),z()}),E?.addEventListener("click",()=>k.click()),k.addEventListener("change",()=>{let K=k.files?.[0];k.value="",K&&ui(K).then(q=>e.setValue(t,q))}),R.addEventListener("click",()=>{V(),j=null,x.value="",Y(),e.setValue(t,null),x.focus()});function Y(){h.hidden=!0,p.hidden=!1}return{element:A,focus:()=>(x.hidden?R:x).focus(),update(K){C=K.readonly;let q=K.value&&typeof K.value=="object"&&!Array.isArray(K.value)?K.value:null,oe=o.activeElement!==x;if(q&&Nc(q)!==j){let Ce=q.data?`data:${q.type};base64,${q.data}`:q.url??"";h.getAttribute("src")!==Ce&&(h.src=Ce),h.hidden=!1,p.hidden=!0,j=null,V(),oe&&(x.value=q.text??"")}else q||((j!==null||!h.hidden)&&(j=null,V(),oe&&(x.value="")),Y());b.hidden=C||!I()||!h.hidden,x.hidden=C,x.readOnly=C,R.hidden=C||!q,y.hidden=C||!W.length||!h.hidden,E&&(E.hidden=C),p.classList.toggle("fd-signature-locked",C),Xe(A,K),x.setAttribute("aria-invalid",String(K.invalid))}}};var So=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Oe(a,s),l=Ee(o),f=E=>E in n&&typeof n[E]=="number"?n[E]:void 0,c=f("min")??0,v=f("max")??100,m=typeof r.options?.step=="number"&&r.options.step>0?r.options.step:1,S=n.type==="integer"?0:n.type==="float"&&n.digits?n.digits[1]:Math.max(0,-Math.floor(Math.log10(m))),g=E=>gt(E,S,s),p=l("input",{id:i,type:"range",class:"fd-slider-input",min:String(c),max:String(v),step:String(m)}),b=l("output",{class:"fd-slider-value",for:i,"aria-hidden":"true"}),h=[r.options?.startLabel,r.options?.endLabel].map(E=>typeof E=="string"?E:""),x=(E,k)=>l("span",{class:k?"fd-slider-last":void 0},g(E),...h[k]?[l("span",{class:"fd-slider-word"},h[k])]:[]),L=l("div",{class:"fd-slider-ends","aria-hidden":"true"},x(c,0),x(v,1)),y=nn(o,d,()=>{e.setValue(t,null),p.focus()},r),R=l("div",{class:"fd-slider"},l("div",{class:"fd-slider-track"},p,b),L,y.button);return h.some(Boolean)&&p.setAttribute("aria-description",h.filter(Boolean).join(" \u2026 ")),p.addEventListener("input",()=>e.setValue(t,Number(p.value))),{element:R,focus:()=>p.focus(),update(E){let k=typeof E.value=="number"?E.value:null;R.classList.toggle("fd-slider-empty",k===null);let A=String(k??(c+v)/2);p.value!==A&&(p.value=A),b.textContent=k===null?"\u2013":g(k),p.setAttribute("aria-valuetext",k===null?d.notAnswered:g(k)),p.disabled=E.readonly,y.allow(E),y.show(k!==null),Xe(p,E)}}};function yi(e,t,n){let r=i=>e.some(o=>o.exclusive&&o.value===i);return r(n)?[n]:[...t.filter(i=>!r(i)),n]}function vi(e,t,n){let r=n.validate?.find(o=>o.atMost!==void 0&&(o.when??!0)===!0&&o.level!=="warning")?.atMost,i=r?e("span",{class:"fd-choice-limit",role:"status"}):null;return{element:i,full(o){let a=!!r&&o>=r;return i&&ft(i,a?We(t.upTo,{n:r}):""),a}}}function xi(e,t){let n=t.options?.columns;n==="row"?e.classList.add("fd-choices-row"):typeof n=="number"&&n>=1&&(e.classList.add("fd-choices-columns"),e.style.setProperty("--fd-choice-columns",String(Math.min(4,Math.round(n)))))}var zs=e=>_s(e,!1),qs=e=>_s(e,!0);function _s({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s},d){let l=Oe(a,s),f=Ee(o),c=n.type==="selection"?n.options:[],v=n.type==="selection"&&n.ownAnswers===!0&&!d,m=`${i}-list`,S=f("input",{id:i,type:"text",class:"fd-input fd-combo-input",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":m,autocomplete:"off",placeholder:r.placeholder||l.search}),g=f("ul",{id:m,class:"fd-listbox",role:"listbox",hidden:""}),p=f("ul",{class:"fd-chips"}),b=f("div",{class:"fd-combo"},S,g),h=ti(S,g),x=d?f("div",{class:"fd-choice-search"},b):f("div",{class:"fd-tags fd-choice-tags"},p,b),L=()=>e.getState().values[t],y=()=>Array.isArray(L())?L():[],R=I=>e.setValue(t,I),E=I=>c.find(B=>B.value===I)?.label??(I==null?"":String(I)),k=[],A=-1,w=!1;function j(){g.replaceChildren(...k.map((I,B)=>{let H=f("li",{id:`${m}-${B}`,role:"option",class:`fd-option${B===A?" fd-active":""}`,"aria-selected":String(B===A)},I.label);return H.addEventListener("mousedown",V=>V.preventDefault()),H.addEventListener("click",()=>W(I)),H})),k.length||g.append(f("li",{class:"fd-empty"},l.noResults)),De(S,"aria-activedescendant",A>=0?`${m}-${A}`:null)}function C(){let I=S.value.trim(),B=d&&I===E(L())?"":I.toLowerCase(),H=new Set(y());k=c.filter(V=>!H.has(V.value)&&V.label.toLowerCase().includes(B)),v&&B&&!H.has(I)&&!c.some(V=>V.label.toLowerCase()===B)&&k.push({value:I,label:We(l.createNamed,{name:I})}),A=-1,j(),h.show(),S.setAttribute("aria-expanded","true")}function O(){h.hide(),A=-1,S.setAttribute("aria-expanded","false"),S.removeAttribute("aria-activedescendant")}function W(I){if(d)return S.value=I.label,R(I.value),O();S.value="",R(yi(c,y(),I.value)),o.activeElement===S?C():O()}d||S.addEventListener("focus",()=>!w&&C()),S.addEventListener("click",()=>!w&&g.hidden&&C()),S.addEventListener("input",()=>!w&&C()),S.addEventListener("blur",()=>{O(),d&&!w&&(S.value.trim()?S.value=E(L()):R(null))}),S.addEventListener("keydown",I=>{if(!w)switch(I.key){case"ArrowDown":case"ArrowUp":{if(I.preventDefault(),g.hidden)return C();if(!k.length)return;let B=I.key==="ArrowDown";A=A===-1?B?0:k.length-1:(A+(B?1:-1)+k.length)%k.length,j(),g.children[A]?.scrollIntoView?.({block:"nearest"});return}case"Enter":{let B=k[A]??(S.value.trim()?k[0]:void 0);if(g.hidden||!B)return;I.preventDefault(),W(B);return}case"Escape":g.hidden||I.preventDefault(),O();return;case"Backspace":!d&&S.value===""&&y().length&&R(y().slice(0,-1));return}});let D="";return{element:x,focus:()=>S.focus(),update(I){if(w=I.readonly,w&&O(),Xe(S,I),De(S,"aria-required",String(I.required)),d){S.readOnly=w,o.activeElement!==S&&(S.value=E(I.value));return}let B=Array.isArray(I.value)?I.value:[];S.hidden=w;let H=JSON.stringify([w,B]);H!==D&&(D=H,p.replaceChildren(...B.map(V=>{let z=E(V),T=f("li",{class:"fd-chip"},f("span",{class:"fd-chip-label"},z));if(!w){let te=f("button",{type:"button",class:"fd-chip-remove","aria-label":We(l.remove,{name:z})},"\xD7");te.addEventListener("click",()=>R(y().filter(Y=>Y!==V))),T.append(te)}return T})),g.hidden||C())}}}var Cc='<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M21 16l-5-5-9 9"/></svg>',Us=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Oe(a,s),l=Ee(o),f=n.type==="selection"&&n.multiple===!0,c=n.type==="selection"?n.options:[],v=rn(c,e,t,r),m=r.options??{},S=m.showLabels===!1,g=l("div",{id:i,class:`fd-image-choices${S?" fd-image-choices-bare":""}`,role:f?"group":"radiogroup","data-size":m.imageSize,"data-fit":m.imageFit});xi(g,r);let p=f?vi(l,d,r):null,b=v.map(R=>{let E=R.image?l("img",{src:R.image,alt:R.alt??"",loading:"lazy",draggable:"false"}):l("span",{class:"fd-image-card-blank"});R.image||(E.innerHTML=Cc);let k=l("button",{type:"button",class:"fd-image-card",role:f?"checkbox":"radio","aria-checked":"false","aria-label":S?R.label:void 0},l("span",{class:"fd-image-card-picture"},E),l("span",{class:"fd-image-card-words"},R.label));return k.addEventListener("click",()=>x(R)),g.append(k),k}),h=()=>e.getState().values[t];function x(R){if(!f)return e.setValue(t,R.value);let E=Array.isArray(h())?h():[],k=new Set(E.includes(R.value)?E.filter(A=>A!==R.value):yi(c,E,R.value));e.setValue(t,c.filter(A=>k.has(A.value)).map(A=>A.value))}let L=!1;f||g.addEventListener("keydown",R=>{if(L)return;let E=b.indexOf(R.target);if(E===-1)return;let k=Vt(g),A={ArrowDown:1,ArrowUp:-1,ArrowRight:k?-1:1,ArrowLeft:k?1:-1},w=R.key==="Home"?0:R.key==="End"?b.length-1:R.key in A?(E+A[R.key]+b.length)%b.length:-1;w!==-1&&(R.preventDefault(),x(v[w]),b[w].focus())});let y=f?null:nn(o,d,()=>{e.setValue(t,null),b[0]?.focus()},r);return p?.element&&g.append(p.element),{element:y?l("div",{class:"fd-choices-box"},g,y.button):g,focus:()=>(b.find(R=>R.getAttribute("aria-checked")==="true")??b[0])?.focus(),update(R){L=R.readonly;let E=new Set(Array.isArray(R.value)?R.value:[R.value]),k=f?-1:Math.max(0,v.findIndex(w=>E.has(w.value))),A=!!p?.full(Array.isArray(R.value)?R.value.length:0);b.forEach((w,j)=>{let C=E.has(v[j].value);w.setAttribute("aria-checked",String(C)),w.tabIndex=f||j===k?0:-1,w.disabled=L||A&&!C&&!v[j].exclusive}),y?.allow(R),y?.show(v.some(w=>E.has(w.value))),Xe(g,R)}}};var Oc=4,Ks=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Oe(a,s),l=Ee(o),f=rn(n.type==="selection"?n.options:[],e,t,r),c=l("ol",{class:"fd-rank-list"}),v=ni(l),m=r.options?.top,S=typeof m=="number"&&m>=1&&m<f.length?Math.floor(m):0,g=l("div",{class:"fd-rank-pool"}),p=l("button",{type:"button",class:"fd-button fd-rank-keep"},d.keepOrder);p.addEventListener("click",()=>e.setValue(t,L.map(C=>C.option.value)));let b=l("div",{id:i,class:"fd-ranking",role:"group"},...S?[l("div",{class:"fd-choice-limit"},We(d.upTo,{n:S})),g,c]:[c,p],v.element),h=f.map(C=>{let O=C.label,W=l("span",{class:"fd-rank-place","aria-hidden":"true"}),D=l("button",{type:"button",class:"fd-rank-move fd-rank-up","aria-label":We(d.moveUp,{label:O})},"\u2191"),I=l("button",{type:"button",class:"fd-rank-move fd-rank-down","aria-label":We(d.moveDown,{label:O})},"\u2193"),B=l("span",{class:"fd-rank-grip","aria-hidden":"true"}),H=l("span",{class:"fd-rank-tools"},D,I),V=l("li",{class:"fd-rank-item","data-value":String(C.value)},B,W,l("span",{class:"fd-rank-words"},O),H),z={option:C,element:V,place:W,up:D,down:I};if(S){let T=l("button",{type:"button",class:"fd-rank-pick"},O);T.addEventListener("click",()=>!x&&L.length<S&&E([...L,z],z));let te=l("button",{type:"button",class:"fd-rank-move fd-rank-out","aria-label":We(d.remove,{name:O})},"\xD7");te.addEventListener("click",()=>{v.say(We(d.removed,{name:O})),e.setValue(t,L.filter(Y=>Y!==z).map(Y=>Y.option.value))}),H.append(te),g.append(T),z.pick=T}return D.addEventListener("click",()=>k(z,-1,"up")),I.addEventListener("click",()=>k(z,1,"down")),V.addEventListener("pointerdown",T=>w(z,T)),z}),x=!1,L=[...h],y=null;function R(C){for(L=C,C.forEach((O,W)=>{c.children[W]!==O.element&&c.insertBefore(O.element,c.children[W]??null),O.place.textContent=String(W+1),O.up.disabled=W===0,O.down.disabled=W===C.length-1});c.children.length>C.length;)c.lastElementChild?.remove()}function E(C,O){v.say(We(d.movedTo,{label:O.option.label,n:C.indexOf(O)+1,total:C.length})),e.setValue(t,C.map(W=>W.option.value))}function k(C,O,W){let D=L.indexOf(C),I=D+O;if(x||I<0||I>=L.length)return;let B=[...L];B.splice(D,1),B.splice(I,0,C),y=C.element.contains(o.activeElement)?{item:C,which:W==="up"&&I===0||W==="down"&&I===B.length-1?W==="up"?"down":"up":W}:null,E(B,C),A()}function A(){if(!y)return;let{item:C,which:O}=y;y=null,C[O].focus()}c.addEventListener("keydown",C=>{if(x||!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;let O=h.find(W=>W.element.contains(C.target));O&&(C.preventDefault(),k(O,C.key==="ArrowUp"?-1:1,C.key==="ArrowUp"?"up":"down"))});function w(C,O){if(x||O.button!==0||O.target.closest("button")||O.pointerType==="touch"&&!O.target.closest(".fd-rank-grip"))return;let W=O.clientY,D=[...L],I=!1;C.element.setPointerCapture?.(O.pointerId);let B=V=>{if(!I&&Math.abs(V.clientY-W)<Oc)return;I||(I=!0,C.element.classList.add("fd-rank-lifted")),V.preventDefault();let z=L.filter(te=>te!==C),T=z.filter(te=>{let Y=te.element.getBoundingClientRect();return Y.top+Y.height/2<V.clientY}).length;L.indexOf(C)!==T&&R([...z.slice(0,T),C,...z.slice(T)])},H=()=>{C.element.removeEventListener("pointermove",B),C.element.removeEventListener("pointerup",H),C.element.removeEventListener("pointercancel",H),C.element.classList.remove("fd-rank-lifted"),L.some((V,z)=>V!==D[z])&&E(L,C)};C.element.addEventListener("pointermove",B),C.element.addEventListener("pointerup",H),C.element.addEventListener("pointercancel",H)}function j(C){let O=(Array.isArray(C)?C:[]).map(W=>h.find(D=>D.option.value===W)).filter(W=>!!W);return S?O.slice(0,S):Array.isArray(C)?[...new Set([...O,...L])]:L}return R(S?[]:L),{element:b,focus:()=>(h.find(C=>C.pick&&!C.pick.hidden&&!C.pick.disabled)?.pick??(L[0]?.down.disabled?L[0]?.up:L[0]?.down))?.focus(),update(C){x=C.readonly,b.classList.toggle("fd-ranking-locked",x);let O=j(C.value);(O.length!==L.length||O.some((W,D)=>W!==L[D])||!S&&!c.children.length)&&R(O);for(let W of h)W.up.hidden=W.down.hidden=x,W.pick&&(W.pick.hidden=L.includes(W),W.pick.disabled=x||L.length>=S,W.element.querySelector(".fd-rank-out").hidden=x);p.hidden=x||Array.isArray(C.value)&&C.value.length>0,A(),Xe(b,C)}}};var Js={street:["addressStreet","street-address"],line2:["addressLine2","address-line2"],city:["addressCity","address-level2"],region:["addressRegion","address-level1"],postcode:["addressPostcode","postal-code"],country:["addressCountry","country"]},Pc=e=>typeof e=="string"&&e in Js,Vc="AC AN BU CP CQ CS DD DG DY EA EU EZ FX HV IC NH QO RH SU TA TP UK UN VD XA XB YD YU ZR ZZ",Lo={};function Eo(e){if(!Lo[e]){let t=new Intl.DisplayNames([e],{type:"region",fallback:"none"}),n=[];for(let r=65;r<91;r++)for(let i=65;i<91;i++){let o=String.fromCharCode(r,i),a=!Vc.includes(o)&&t.of(o);a&&n.push([o,a])}Lo[e]=n.sort((r,i)=>r[1].localeCompare(i[1],e))}return Lo[e]}var Gs=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Oe(o,a),d=Ee(i),l=n.options??{},f=l.parts,c=Array.isArray(f)?f.filter(Pc):["street","city","postcode","country"],v=Array.isArray(l.requiredParts)?l.requiredParts:[],m=typeof l.country=="string"?l.country:"",S=d("div",{id:r,class:"fd-address",role:"group"}),g=(b,h)=>{let x=e.getState().values[t],L=x&&typeof x=="object"&&!Array.isArray(x)?{...x}:{};L[b]=h,m&&c.includes("country")&&L.country===void 0&&(L.country=m);let y=Object.fromEntries(Object.entries(L).filter(([,E])=>typeof E!="string"||E.trim()!=="")),R=Object.keys(y);e.setValue(t,R.length&&(b==="country"||R.join()!=="country"||y.country!==m)?y:null)},p=c.map(b=>{let[h,x]=Js[b],L={id:`${r}-${b}`,class:"fd-input","data-part":b,autocomplete:b==="street"&&c.includes("line2")?"address-line1":x,"aria-required":v.includes(b)?"true":void 0},y=b==="country"?d("select",L,d("option",{value:""}),...Eo(a).map(([R,E])=>d("option",{value:R},E))):d("input",{type:"text",...L});return y.addEventListener(b==="country"?"change":"input",()=>g(b,y.value)),b==="country"&&y.classList.add("fd-select"),S.append(d("div",{class:`fd-address-part fd-address-${b}${v.includes(b)?" fd-required":""}`},d("label",{class:"fd-address-label",for:y.id},s[h]),y)),{part:b,input:y}});return{element:S,focus:()=>p[0]?.input.focus(),update(b){let h=b.value&&typeof b.value=="object"&&!Array.isArray(b.value)?b.value:{};for(let{part:x,input:L}of p){let y=typeof h[x]=="string"?h[x]:x==="country"&&h.country===void 0?m:"";L instanceof HTMLSelectElement?(y&&![...L.options].some(R=>R.value===y)&&L.append(d("option",{value:y},y)),L.disabled=b.readonly):L.readOnly=b.readonly,i.activeElement!==L&&L.value!==y&&(L.value=y),L.setAttribute("aria-invalid",String(b.invalid&&(!v.length||v.includes(x)&&!y.trim())))}Xe(S,b)}}};var Ys=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0,Xs=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s,dialogs:d,widgets:l})=>{let f=Oe(a,s),c=Ee(o),v=n,m=r.options??{},S=Ys(m.min)??0,g=Ys(m.max)??1/0,p=typeof m.itemLabel=="string"&&m.itemLabel.trim()?m.itemLabel.trim():null,b=D=>p?`${p} ${D}`:We(f.entry,{n:D}),h=(r.columns??Object.keys(v.fields)).filter(D=>v.fields[D]&&v.fields[D].type!=="one2many"&&D!==v.sequenceField&&D!==v.lineKinds?.field),x=c("div",{class:"fd-repeat-list"}),L=c("button",{type:"button",class:"fd-button fd-repeat-add"},typeof m.addLabel=="string"&&m.addLabel?m.addLabel:f.addAnother),y=ni(c),R=c("div",{id:i,class:"fd-repeat",role:"group"},x,L,y.element),E=new Map,k=()=>e.getState().values[t]??[],A=!1,w=null;for(let D=k().length;D<S;D++)e.addLine(t);L.addEventListener("click",()=>{if(A||k().length>=g)return;let D=e.addLine(t);w=()=>E.get(D)?.fields[0]?.widget.focus(),W()});function j(D){let I=`${i}-${D.key}-title`,B=c("span",{id:I,class:"fd-repeat-title"}),H=c("button",{type:"button",class:"fd-repeat-remove"},"\xD7"),V=(oe,Ce,Me)=>{let ke=c("button",{type:"button",class:"fd-repeat-tool"},oe);return ke.addEventListener("click",Me),[ke,Ce]},z=()=>k().findIndex(oe=>oe.key===D.key),T=[V("\u2191","moveUp",()=>C(D.key,z()-1)),V("\u2193","moveDown",()=>C(D.key,z()+1)),V("\u29C9","copy",()=>O(D.key))],te=d&&(r.lineOpens||r.lineForm)?c("button",{type:"button",class:"fd-repeat-tool fd-line-open","aria-label":f.openLine,title:f.openLine},"\u2197"):null;te?.addEventListener("click",()=>{let oe=k().find(Ce=>Ce.key===D.key);oe&&d&&ci(e,t,r,oe,d,A)});let Y=c("div",{class:"fd-repeat-fields"}),K=c("div",{class:"fd-repeat-card",role:"group","aria-labelledby":I,"data-line":D.key},c("div",{class:"fd-repeat-head"},B,...T.map(([oe])=>oe),...te?[te]:[],H),Y),q=h.map(oe=>{let Ce=v.fields[oe],Me=`${i}-${D.key}-${oe}`,ke={type:"field",id:`${r.id}.${D.key}.${oe}`,field:oe},$e=Ot({form:li(e,t,D.key),name:oe,field:Ce,node:ke,id:Me,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ae=c("label",{class:"fd-repeat-label",for:Me},Ce.label);["INPUT","SELECT","TEXTAREA"].includes($e.element.tagName)||ae.addEventListener("click",()=>$e.focus());let he=c("div",{class:"fd-cell-error",hidden:""});return Y.append(c("div",{class:"fd-repeat-field"},ae,$e.element,he)),{name:oe,def:Ce,widget:$e,error:he}});return H.addEventListener("click",()=>{let oe=k(),Ce=oe.findIndex(ae=>ae.key===D.key);if(A||Ce===-1||oe.length<=S)return;let Me=B.textContent??"";e.removeLine(t,D.key),y.say(We(f.removed,{name:Me}));let ke=k(),$e=ke[Math.min(Ce,ke.length-1)];w=()=>$e?E.get($e.key)?.fields[0]?.widget.focus():L.focus(),W()}),{element:K,title:B,remove:H,tools:T,fields:q}}function C(D,I){let B=k().findIndex(z=>z.key===D);if(A||I<0||I>=k().length||I===B)return;let H=E.get(D)?.title.textContent??"";Kn(e,t,v,D,I);let V=B>I&&I>0||I===k().length-1?0:1;E.get(D)?.tools[V][0].focus(),y.say(We(f.movedTo,{label:H,n:I+1,total:k().length}))}function O(D){let I=k(),B=I.findIndex(z=>z.key===D);if(A||B<0||I.length>=g)return;let H={...I[B].values};v.sequenceField&&delete H[v.sequenceField];let V=e.addLine(t,H);Kn(e,t,v,V,B+1),E.get(V)?.fields[0]?.widget.focus()}function W(){let D=w;w=null,D?.()}return{element:R,focus:()=>([...E.values()].find(D=>D.element===x.firstElementChild)?.fields[0]?.widget??L).focus(),update(D){A=D.readonly;let I=D.value??[],B=e.getState().errors,H=new Set(I.map(V=>V.key));for(let[V,z]of E)if(!H.has(V)){z.element.remove();for(let T of z.fields)T.widget.destroy?.();E.delete(V)}I.forEach((V,z)=>{let T=E.get(V.key);T||E.set(V.key,T=j(V)),x.children[z]!==T.element&&x.insertBefore(T.element,x.children[z]??null),T.title.textContent=b(z+1),T.remove.setAttribute("aria-label",We(f.remove,{name:T.title.textContent})),T.remove.hidden=A||I.length<=S||r.lineDelete!==void 0&&!e.lineState(r.id,V.key).deletable;for(let[te,Y]of T.tools)te.setAttribute("aria-label",We(f[Y],{label:T.title.textContent,name:T.title.textContent})),te.hidden=A||(Y==="moveUp"?z===0:Y==="moveDown"?z===I.length-1:I.length>=g);for(let te of T.fields){let Y=B[`${t}.${V.key}.${te.name}`];te.error.hidden=!Y,te.error.textContent=Y??"",te.widget.update({value:V.values[te.name],values:V.values,parent:D.values,readonly:A||te.def.readonly===!0,required:te.def.required===!0,invalid:!!Y})}}),L.hidden=A||I.length>=g,Xe(R,D)}}};function Ro(e,{form:t,name:n,field:r,document:i,labels:o,locale:a},s){let d=r.type==="char"||r.type==="text"?r.size:void 0;if(!d||t.page.fields[n]!==r)return e;let l=Ee(i),f=l("div",{class:"fd-count","aria-hidden":"true"}),c=l("div",{class:"fd-sr-only","aria-live":"polite"}),v;return{...e,element:l("div",{class:"fd-counted"},e.element,f,c),update(m){e.update(m);let S=s.value.length;ft(f,`${S} / ${d}`),f.classList.toggle("fd-count-near",S>=d*.9),Rt(f,m.readonly),i.activeElement===s&&(clearTimeout(v),v=setTimeout(()=>ft(c,We(Oe(o,a).charactersLeft,{n:d-S})),700))}}}function Zs(e,t){let n=t.options?.rows;return typeof n=="number"&&(e.rows=n),t.options?.autoGrow===!1?()=>{}:()=>{e.style.height="",e.scrollHeight&&(e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)}}function wi(e,t,n){let r=n.options??{},i=t.type==="char";(i?[r.min,r.max]:"min"in t?[t.min,t.max]:[]).forEach((a,s)=>{typeof a=="string"&&(e[s?"max":"min"]=i?a:mn(a)+(t.type==="datetime"?s?"T23:59":"T00:00":""))}),typeof r.step=="number"&&(e.step=String(r.step*60))}function Fo(e,t){try{let n=new Intl.NumberFormat(t,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(1),r=n.findIndex(i=>i.type==="currency");return{text:n[r].value,after:r>n.findIndex(i=>i.type==="integer")}}catch{return{text:e,after:!1}}}function Qs(e,t){let{form:n,name:r,document:i}=t,o=Oe(t.labels,t.locale),a=i.createElement("div"),s=i.createElement("div"),d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=o.choicesFailed,d.onclick=()=>n.loadChoices(r),s.setAttribute("role","status"),a.style.cssText="display:grid;gap:4px";let l=new Map,f,c=null,v=m=>{f?.destroy?.(),f=e({...t,field:{...t.field,options:m}}),f.element.getAttribute("role")&&f.element.setAttribute("aria-labelledby",`${t.id}-label`),a.replaceChildren(f.element,s,d)};return v([]),n.getState().choices[r]||n.loadChoices(r),{element:a,focus:()=>f.focus(),destroy:()=>f.destroy?.(),update(m){let S=n.getState().choices[r];if(S?.options&&S.options!==c){c=S.options;for(let p of c)l.set(p.value,p.label);v(c)}f.update(m);let g=c&&!t.field.other?[m.value].flat().filter(p=>p!=null&&!c?.some(b=>b.value===p)):[];s.className=S?.loading?"fd-help":"fd-warning",s.textContent=S?.loading?o.loadingChoices:g.length?Je(o.notOffered,{name:g.map(p=>l.get(p)??String(p)).join(", ")}):"",s.hidden=!s.textContent,d.hidden=!S?.error}}}var ed=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a})=>{let s=Oe(o,a),d=Ee(i),l=d("div",{id:r,class:"fd-points fd-yes-no",role:"radiogroup"}),f=!1,c=[!0,!1].map(m=>{let S=n.options?.[m?"yesLabel":"noLabel"],g=d("button",{type:"button",role:"radio"},typeof S=="string"&&S?S:m?s.yes:s.no);return g.addEventListener("click",()=>e.setValue(t,m)),l.append(g),g});l.addEventListener("keydown",m=>{let S=c.indexOf(m.target);f||S===-1||!m.key.startsWith("Arrow")||(m.preventDefault(),e.setValue(t,S===1),c[1-S].focus())});let v=nn(i,s,()=>{e.setValue(t,null),c[0].focus()},n);return{element:d("div",{class:"fd-choices-box"},l,v.button),focus:()=>(c.find(m=>m.getAttribute("aria-checked")==="true")??c[0]).focus(),update(m){f=m.readonly;let S=m.value===!0?0:m.value===!1?1:-1;c.forEach((g,p)=>{De(g,"aria-checked",String(p===S)),g.classList.toggle("fd-on",p===S),g.tabIndex=p===Math.max(0,S)?0:-1,g.disabled=f}),De(l,"aria-required",String(m.required)),v.allow(m),v.show(S!==-1),Xe(l,m)}}};var Ic=new Set(["info","success","warning","danger","muted"]),ki=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options?.tones??{},a=r.createElement("span");return a.id=n,a.className="fd-value-badge",a.hidden=!0,{element:a,focus:()=>{},update({value:s,values:d}){let l=St(e,s,d,i);a.textContent!==l&&(a.textContent=l),a.hidden=l==="";let f=s!==null&&typeof s=="object"&&"id"in s?String(s.id):String(s),c=o[f];typeof c=="string"&&Ic.has(c)?a.dataset.tone=c:delete a.dataset.tone}}};var td=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=tt.en,locale:s,dialogs:d})=>{let l=n,f=Ee(o),c=l.fields??{},v=(r.columns??[]).filter(I=>c[I]),m=I=>typeof r.options?.[I]=="string"&&r.options[I].trim()?r.options[I]:null,S=!!d&&d.canOpen(l.relation),g=f("tr",{},...v.map(I=>f("th",{scope:"col","data-column":I},c[I].label)),f("th",{class:"fd-lines-tools"})),p=f("tbody"),b=f("table",{class:"fd-lines-table fd-links-table"},f("thead",{},g),p),h=f("button",{type:"button",class:"fd-button fd-button-link fd-lines-add","data-add":"line"},`+ ${m("addLabel")??a.addLine}`),x=f("div",{class:"fd-lines-adds"},h),L=m("emptyLabel"),y=L?f("div",{class:"fd-help fd-lines-empty"},L):null,R=f("div",{class:"fd-lines fd-links",id:i,role:"group"},f("div",{class:"fd-lines-scroll"},b),...y?[y]:[],x),E=new Map,k=new Set,A=!1,w=[],j=()=>e.getState().values[t]??[];function C(I,B=!1){let H=I.map(V=>V.id).filter(V=>B||!E.has(String(V))&&!k.has(String(V)));if(H.length){for(let V of H)k.add(String(V));e.linkedValues(t,H,v).then(V=>{for(let{id:z,values:T}of V)E.set(String(z),T);for(let z of H)k.delete(String(z));D()},()=>H.forEach(V=>k.delete(String(V))))}}h.addEventListener("click",async()=>{if(!d||A)return;let I=await d.searchMore({title:l.label,search:(B,H)=>e.search(t,B,H)});!I||j().some(B=>B.id===I.id)||e.setValue(t,[...j(),{id:I.id,label:I.label}])});async function O(I){let B=await d?.openRecord(l.relation,{recordId:I.id,title:I.label});B&&(B.label!==I.label&&e.setValue(t,j().map(H=>H.id===I.id?{id:H.id,label:B.label}:H)),C([I],!0))}function W(I){let B=E.get(String(I.id)),H=v.map((z,T)=>{let te=B?St(c[z],B[z]??null,B,s):T===0?I.label:"";return f("td",{"data-column":z},f("span",{class:"fd-value-text"},te))}),V=f("td",{class:"fd-lines-tools"});if(S){let z=f("button",{type:"button",class:"fd-line-open","aria-label":We(a.openNamed,{name:I.label}),title:a.openLine},"\u2197");z.addEventListener("click",()=>{O(I)}),V.append(z)}if(!A){let z=f("button",{type:"button",class:"fd-line-delete","aria-label":We(a.remove,{name:I.label})},"\xD7");z.addEventListener("click",()=>e.setValue(t,j().filter(T=>T.id!==I.id))),V.append(z)}return f("tr",{"data-record":String(I.id)},...H,V)}function D(){let I=o.activeElement,B=R.contains(I)?I.closest("tr")?.dataset.record:void 0;p.replaceChildren(...w.map(W)),B&&p.querySelector(`tr[data-record="${CSS.escape(B)}"] button`)?.focus()}return{element:R,focus:()=>(p.querySelector("button")??h).focus(),update(I){let B=I.value??[],H=B!==w||I.readonly!==A;A=I.readonly,w=B,x.hidden=A||!d,y&&(y.hidden=B.length>0),De(R,"aria-invalid",String(I.invalid)),De(R,"aria-describedby",I.describedBy||null),H&&D(),C(B)}}};var Ao=({form:e,name:t,field:n,id:r,document:i})=>{let o=Ee(i),a=n.type==="selection"?n.options.map(c=>({value:c.value,label:c.label})):[{value:!1,label:""},{value:!0,label:n.label}],s=o("div",{id:r,class:"fd-priority",role:"radiogroup"}),d=a.slice(1).map((c,v)=>{let m=o("button",{type:"button",role:"radio",class:"fd-priority-star","aria-label":c.label,title:c.label,"data-value":String(c.value)},"\u2605");return m.addEventListener("click",()=>e.setValue(t,l(e.getState().values[t])===v+1?a[0].value:c.value)),s.append(m),m}),l=c=>Math.max(0,a.findIndex(v=>v.value===c)),f=!1;return s.addEventListener("keydown",c=>{if(f)return;let v=Vt(s)?"ArrowLeft":"ArrowRight",m=Vt(s)?"ArrowRight":"ArrowLeft",S=c.key===v||c.key==="ArrowUp"?1:c.key===m||c.key==="ArrowDown"?-1:0;if(!S)return;c.preventDefault();let g=Math.min(a.length-1,Math.max(0,l(e.getState().values[t])+S));e.setValue(t,a[g].value),d[Math.max(0,g-1)]?.focus()}),{element:s,focus:()=>(d.find(c=>c.tabIndex===0)??d[0])?.focus(),update(c){f=c.readonly;let v=l(c.value);d.forEach((m,S)=>{De(m,"aria-checked",String(v===S+1)),m.classList.toggle("fd-on",S<v);let g=v===S+1||v===0&&S===0?0:-1;m.tabIndex!==g&&(m.tabIndex=g),m.disabled!==c.readonly&&(m.disabled=c.readonly)}),Xe(s,c)}}};function Gn(e,t,n,r){let i=e.ownerDocument,o=d=>{!n.contains(d.target)&&!t.contains(d.target)&&s()};function a(){n.hidden=!1,t.setAttribute("aria-expanded","true");let d=e.closest(".fd-form");if(d){d.append(n),Object.assign(n.style,{position:"absolute",top:"0px",left:"0px",right:"auto"});let[l,f,c]=[t.getBoundingClientRect(),n.getBoundingClientRect(),n.offsetWidth],v=getComputedStyle(e).direction==="rtl",m=i.documentElement.clientWidth||c,S=Math.max(8,Math.min(v?l.right-c:l.left,m-c-8));Object.assign(n.style,{top:`${l.bottom-f.top+4}px`,left:`${S-f.left}px`})}i.addEventListener("pointerdown",o,!0)}function s(){if(!n.hidden){if(n.hidden=!0,t.setAttribute("aria-expanded","false"),n.parentElement!==e){e.append(n);for(let d of["position","top","left","right"])n.style.removeProperty(d)}i.removeEventListener("pointerdown",o,!0),r()}}return{open:a,close:s,isOpen:()=>!n.hidden}}var Dc={normal:"muted",grey:"muted",blocked:"danger",red:"danger",done:"success",green:"success",waiting:"warning"},nd=["muted","danger","success","warning","info"],Wc=new Set(["info","success","warning","danger","muted"]),rd=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=Ee(o),s=n.type==="selection"?n.options:[],d=r.options?.tones??{},l=(R,E)=>{let k=d[String(R)];return typeof k=="string"&&Wc.has(k)?k:Dc[String(R)]??nd[E%nd.length]},f=()=>a("span",{class:"fd-dot","aria-hidden":"true"}),c=a("button",{type:"button",id:i,class:"fd-dot-button","aria-haspopup":"menu","aria-expanded":"false","aria-controls":`${i}-menu`},f()),v=r.options?.label===!0?a("span",{class:"fd-dot-label"}):null,m=s.map((R,E)=>{let k=a("div",{role:"menuitemradio",class:"fd-dot-item",tabindex:"-1","data-tone":l(R.value,E)},f(),R.label);return k.addEventListener("click",()=>y(E)),k}),S=a("div",{id:`${i}-menu`,role:"menu",class:"fd-dot-menu","aria-label":n.label,hidden:""},...m),g=a("span",{class:"fd-dot-box"},c,...v?[v]:[],S),p=()=>s.findIndex(R=>R.value===e.getState().values[t]),b=!1,h=Gn(g,c,S,()=>{b&&c.focus(),b=!1});function x(R=Math.max(0,p())){h.open(),m[R]?.focus()}function L(R){b=R,h.close()}function y(R){e.setValue(t,s[R].value),L(!0)}return c.addEventListener("click",()=>S.hidden?x():L(!0)),c.addEventListener("keydown",R=>{R.key!=="ArrowDown"&&R.key!=="ArrowUp"&&R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),x(R.key==="ArrowUp"?p()<0?m.length-1:p():void 0))}),S.addEventListener("keydown",R=>{let E=m.indexOf(o.activeElement),k={ArrowDown:E+1,ArrowUp:E-1,Home:0,End:m.length-1}[R.key];k!==void 0?(R.preventDefault(),m[(k+m.length)%m.length]?.focus()):R.key==="Enter"||R.key===" "?(R.preventDefault(),E>=0&&y(E)):R.key==="Escape"?(R.preventDefault(),R.stopPropagation(),L(!0)):R.key==="Tab"&&L(!0)}),{element:g,focus:()=>c.focus(),destroy:()=>L(!1),update(R){let E=s.findIndex(A=>A.value===R.value),k=E<0?"":s[E].label;De(c,"aria-label",k?`${n.label}: ${k}`:n.label),De(c,"title",k||null),De(c,"data-tone",E<0?"muted":l(R.value,E)),v&&ft(v,k),m.forEach((A,w)=>De(A,"aria-checked",String(w===E))),c.disabled!==R.readonly&&(c.disabled=R.readonly),R.readonly&&L(!1),Xe(c,R)}}};var Si=["transparent","#f06050","#f4a460","#f7cd1f","#6cc1ed","#814968","#eb7e7f","#2c8397","#475577","#d6145f","#30c381","#9365b8"],jc=({form:e,name:t,field:n,id:r,document:i,labels:o,locale:a})=>{let s=Ee(i),d=Oe(o,a).colourNames.split("|"),l=s("button",{type:"button",id:r,class:"fd-colour-button","aria-haspopup":"true","aria-expanded":"false","aria-controls":`${r}-palette`}),f=Si.map((h,x)=>{let L=s("button",{type:"button",role:"radio",class:"fd-colour","aria-label":d[x]??String(x),title:d[x]??String(x),tabindex:"-1","data-colour":String(x)});return L.style.setProperty("--fd-swatch",h),L.addEventListener("click",()=>b(x)),L}),c=s("div",{id:`${r}-palette`,role:"radiogroup",class:"fd-colour-palette","aria-label":n.label,hidden:""},...f),v=s("span",{class:"fd-colour-box"},l,c),m=!1,S=Gn(v,l,c,()=>{m&&l.focus(),m=!1}),g=()=>{let h=e.getState().values[t];return typeof h=="number"&&h>=0&&h<Si.length?h:0};function p(h){m=h,S.close()}function b(h){e.setValue(t,h),p(!0)}return l.addEventListener("click",()=>{if(S.isOpen())return p(!0);S.open(),f[g()].focus()}),c.addEventListener("keydown",h=>{let x=f.indexOf(i.activeElement),L=Vt(v)?"ArrowLeft":"ArrowRight",y=Vt(v)?"ArrowRight":"ArrowLeft",R=h.key===L||h.key==="ArrowDown"?x+1:h.key===y||h.key==="ArrowUp"?x-1:h.key==="Home"?0:h.key==="End"?f.length-1:null;R!==null?(h.preventDefault(),f[(R+f.length)%f.length].focus()):(h.key==="Enter"||h.key===" ")&&x>=0?(h.preventDefault(),b(x)):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),p(!0)):h.key==="Tab"&&p(!0)}),{element:v,focus:()=>l.focus(),destroy:()=>p(!1),update(h){let x=typeof h.value=="number"&&h.value>=0&&h.value<Si.length?h.value:0;l.style.setProperty("--fd-swatch",Si[x]),l.classList.toggle("fd-colour-none",x===0),De(l,"aria-label",`${n.label}: ${d[x]??x}`),De(l,"title",d[x]??String(x)),f.forEach((L,y)=>De(L,"aria-checked",String(y===x))),l.disabled!==h.readonly&&(l.disabled=h.readonly),h.readonly&&p(!1),Xe(l,h)}}},Hc=({form:e,name:t,id:n,document:r})=>{let i=Ee(r),o=i("input",{id:n,type:"color",class:"fd-colour-input"}),a=i("span",{class:"fd-colour-code",dir:"ltr"});return o.addEventListener("input",()=>e.setValue(t,o.value)),{element:i("span",{class:"fd-colour-box"},o,a),focus:()=>o.focus(),update(s){let d=typeof s.value=="string"?s.value:"",l=/^#[0-9a-f]{6}$/i.test(d)?d.toLowerCase():"#000000";o.value!==l&&(o.value=l),ft(a,d),o.disabled!==s.readonly&&(o.disabled=s.readonly),Xe(o,s)}}},$o=e=>e.field.type==="char"?Hc(e):jc(e);var To=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Ee(o),l=Oe(a,s),f=n.type==="text",c=f?d("textarea",{id:i,class:"fd-input fd-textarea",rows:"3"}):d("input",{id:i,type:"text",class:"fd-input",autocomplete:"off"});r.placeholder&&(c.placeholder=r.placeholder),c.addEventListener("input",()=>e.setValue(t,c.value===""?null:c.value));let v=d("button",{type:"button",class:"fd-button fd-copy-button",hidden:""},l.copyValue),m=d("span",{class:"fd-sr-only",role:"status"}),S;return v.addEventListener("click",async()=>{let g=String(e.getState().values[t]??"");if(g){try{await navigator.clipboard.writeText(g)}catch{c.select(),o.execCommand?.("copy")}ft(v,l.copied),ft(m,l.copied),clearTimeout(S),S=setTimeout(()=>{ft(v,l.copyValue),ft(m,"")},2e3)}}),{element:d("span",{class:`fd-copy${f?" fd-copy-long":""}`},c,v,m),focus:()=>c.focus(),destroy:()=>clearTimeout(S),update(g){let p=g.value===null||g.value===void 0?"":String(g.value);c.value!==p&&(c.value=p),c.readOnly!==g.readonly&&(c.readOnly=g.readonly),v.hidden=!p,Xe(c,g)}}};var Ri=e=>String(e).padStart(2,"0"),Xt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),Li=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate())),Ei=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Bc='<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="1.5"></rect><path d="M2 6.5h12M5 1.5v3M11 1.5v3"></path></svg>',Mo=e=>`${e.getFullYear()}-${Ri(e.getMonth()+1)}-${Ri(e.getDate())}`,No=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Ee(o),l=Oe(a,s),f=n.type==="datetime"?"datetime":"date",c=typeof r.options?.endField=="string"?r.options.endField:null,v=c?e.page.fields[c]?.label??c:"",m=s==="en"?"en-GB":s,S=new Intl.DateTimeFormat(m,{month:"long",year:"numeric",numberingSystem:"latn"}),g=new Intl.DateTimeFormat(m,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),p=new Intl.DateTimeFormat(m,{weekday:"short"}),b=Y=>{if(typeof Y!="string"||!Y)return"";if(f==="date")return Y.slice(0,10);let K=new Date(Y);return Number.isNaN(K.getTime())?"":`${Mo(K)}T${Ri(K.getHours())}:${Ri(K.getMinutes())}`},h=Y=>{let K=b(Y),q=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(K);return q?new Date(Number(q[1]),Number(q[2])-1,Number(q[3]),Number(q[4]??0),Number(q[5]??0)):null},x=(Y,K)=>{if(f==="date")return Mo(Y);let q=h(K);return new Date(Y.getFullYear(),Y.getMonth(),Y.getDate(),q?.getHours()??0,q?.getMinutes()??0).toISOString()},L=(Y,K,q)=>{let oe=d("input",{type:f==="date"?"date":"datetime-local",class:"fd-input fd-range-input","aria-label":K,...q?{id:q}:{}});return oe.addEventListener("input",()=>{if(!oe.value)return e.setValue(Y,null);if(f==="date")return e.setValue(Y,oe.value);let Ce=new Date(oe.value);Number.isNaN(Ce.getTime())||e.setValue(Y,Ce.toISOString())}),oe},y=L(t,n.label,i),R=c?L(c,v):null,E=d("button",{type:"button",class:"fd-calendar-button fd-range-button","aria-label":l.chooseDate,"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${i}-range`});E.innerHTML=Bc;let k=d("button",{type:"button","aria-label":l.previousMonth},"\u2039"),A=d("button",{type:"button","aria-label":l.nextMonth},"\u203A"),w=d("span",{class:"fd-calendar-title","aria-live":"polite"}),j=d("table",{class:"fd-calendar-grid",role:"grid"}),C=d("div",{id:`${i}-range`,class:"fd-calendar fd-range-calendar",role:"dialog",hidden:""},d("div",{class:"fd-calendar-head"},k,w,A),j),O=d("div",{class:"fd-range",role:"group"},d("span",{class:"fd-range-box"},y,...R?[d("span",{class:"fd-range-arrow","aria-hidden":"true"},"\u2192"),R]:[]),E,C),W=new Date,D=null,I=null;function B(Y){let K=e.getState().values;if(!c)return e.setValue(t,x(Y,K[t])),T();if(!D)return D=Y,W=Y,H(!0);let[q,oe]=Y<D?[Y,D]:[D,Y];D=null,e.setValue(t,x(q,K[t])),e.setValue(c,x(oe,K[c])),T()}function H(Y){let K=e.getState().values,q=D??h(K[t]),oe=D?I&&I>=D?I:null:c?h(K[c]):null,Ce=S.format(W);w.textContent=Ce,C.setAttribute("aria-label",Ce);let Me=new Date(W.getFullYear(),W.getMonth(),1),ke=Xt(Me,-((Me.getDay()+6)%7)),$e=d("tr",{},...Array.from({length:7},(he,ne)=>d("th",{scope:"col"},p.format(Xt(ke,ne)).replace(/\.$/,"")))),ae=d("tbody");for(let he=ke;he<=new Date(W.getFullYear(),W.getMonth()+1,0);he=Xt(he,7)){let ne=d("tr");for(let Te=0;Te<7;Te++){let Pe=Xt(he,Te),we=d("button",{type:"button","data-day":Mo(Pe),"aria-label":g.format(Pe),tabindex:Ei(Pe,W)?"0":"-1"},String(Pe.getDate()));Pe.getMonth()!==W.getMonth()&&we.classList.add("fd-outside");let Ve=Ei(Pe,q)||Ei(Pe,oe);Ve&&we.setAttribute("aria-selected","true"),q&&oe&&Pe>q&&Pe<oe&&!Ve&&we.classList.add("fd-in-range"),Ei(Pe,new Date)&&we.setAttribute("aria-current","date"),we.addEventListener("click",()=>B(Pe)),we.addEventListener("pointerenter",()=>{if(D){I=Pe;for(let X of j.querySelectorAll("button[data-day]")){let re=h(X.dataset.day);X.classList.toggle("fd-in-range",!!re&&re>D&&re<Pe)}}}),we.addEventListener("keydown",X=>V(X,Pe)),ne.append(d("td",{},we))}ae.append(ne)}j.replaceChildren(d("thead",{},$e),ae),Y&&j.querySelector('button[tabindex="0"]')?.focus()}function V(Y,K){let q=Vt(O),oe={ArrowLeft:()=>Xt(K,q?1:-1),ArrowRight:()=>Xt(K,q?-1:1),ArrowUp:()=>Xt(K,-7),ArrowDown:()=>Xt(K,7),PageUp:()=>Li(K,-1),PageDown:()=>Li(K,1),Home:()=>Xt(K,-((K.getDay()+6)%7)),End:()=>Xt(K,6-(K.getDay()+6)%7)};oe[Y.key]?(Y.preventDefault(),W=oe[Y.key](),D&&(I=W),H(!0)):(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),B(K))}function z(){D=null,I=null,W=h(e.getState().values[t])??new Date,C.hidden=!1,E.setAttribute("aria-expanded","true"),H(!0)}function T(){C.hidden||(C.hidden=!0,D=null,E.setAttribute("aria-expanded","false"),E.focus())}E.addEventListener("click",()=>C.hidden?z():T()),k.addEventListener("click",()=>(W=Li(W,-1),H(!1))),A.addEventListener("click",()=>(W=Li(W,1),H(!1))),C.addEventListener("keydown",Y=>{Y.key==="Escape"&&(Y.preventDefault(),Y.stopPropagation(),T())});let te=Y=>{C.hidden||O.contains(Y.target)||(C.hidden=!0,D=null,E.setAttribute("aria-expanded","false"))};return o.addEventListener("mousedown",te),{element:O,focus:()=>y.focus(),destroy:()=>o.removeEventListener("mousedown",te),update(Y){for(let[K,q]of[[y,Y.value],...R&&c?[[R,Y.values[c]]]:[]]){let oe=b(q);o.activeElement!==K&&K.value!==oe&&(K.value=oe),K.readOnly!==Y.readonly&&(K.readOnly=Y.readonly),K.classList.toggle("fd-blank",!oe)}E.hidden=Y.readonly,Y.readonly&&(C.hidden=!0),De(O,"aria-labelledby",null),Xe(y,Y)}}};var Co=e=>String(e).padStart(2,"0");function zc(e){let t=Math.max(0,Math.floor(e));return`${Co(Math.floor(t/3600))}:${Co(Math.floor(t%3600/60))}:${Co(t%60)}`}var id=e=>{if(typeof e!="string"||!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},Oo=({field:e,node:t,id:n,document:r})=>{let i=Ee(r),o=e.type==="datetime",a=!o&&typeof t.options?.startField=="string"?t.options.startField:null,s=t.options?.unit==="minutes"?60:3600,d=i("span",{class:"fd-timer-time"}),l=i("span",{id:n,role:"timer",class:"fd-timer"},i("span",{class:"fd-timer-dot","aria-hidden":"true"}),d);De(l,"aria-label",e.label);let f=0,c=null,v,m=()=>ft(d,zc(f+(c===null?0:(Date.now()-c)/1e3))),S=()=>{clearInterval(v),v=void 0};return{element:l,focus:()=>{},destroy:S,update(g){f=!o&&typeof g.value=="number"?g.value*s:0,c=o?id(g.value):a?id(g.values[a]):null,c!==null?l.dataset.running="true":delete l.dataset.running,m(),c===null?S():v||(v=setInterval(()=>l.isConnected?m():S(),1e3))}}};var od=e=>typeof e=="number"&&e>0?e:480,qc=e=>/^https?:\/\//i.test(e);function _c(e){if(e.data){let t=Uint8Array.from(atob(e.data),n=>n.charCodeAt(0));return URL.createObjectURL(new Blob([t],{type:e.type||"application/pdf"}))}return e.url??""}var ad=e=>{let t=Ee(e.document),n=Oe(e.labels,e.locale),r=hr({...e,node:{...e.node,widget:void 0}}),i=t("iframe",{class:"fd-embed-frame"});i.style.height=`${od(e.node.options?.height)}px`;let o=t("div",{class:"fd-embed-none"},n.noDocument),a=t("div",{class:"fd-embed-view"}),s,d="",l=()=>d.startsWith("blob:")&&URL.revokeObjectURL(d);return{element:t("div",{class:"fd-embed fd-embed-pdf"},r.element,a),focus:()=>r.focus(),destroy(){l(),r.destroy?.()},update(f){r.update(f);let c=Array.isArray(f.value)?f.value[0]:f.value;c!==s&&(s=c,l(),d=c?_c(c):"",d&&(i.title=c?.name??e.field.label,i.src=d)),a.replaceChildren(...d?[i]:f.readonly?[o]:[])}}},sd=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Ee(o),l=Oe(a,s),f=d("input",{id:i,type:"url",class:"fd-input",autocomplete:"url"});r.placeholder&&(f.placeholder=r.placeholder),f.addEventListener("input",()=>e.setValue(t,f.value===""?null:f.value));let c=d("iframe",{class:"fd-embed-frame",title:n.label,sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",referrerpolicy:"no-referrer",loading:"lazy"});c.style.height=`${od(r.options?.height)}px`;let v=d("a",{class:"fd-button fd-button-link fd-embed-open",target:"_blank",rel:"noopener noreferrer",hidden:""},l.openInNewTab),m=d("div",{class:"fd-embed-view"}),S="";return{element:d("div",{class:"fd-embed"},d("div",{class:"fd-embed-bar"},f,v),m),focus:()=>f.focus(),update(g){let p=typeof g.value=="string"?g.value.trim():"";o.activeElement!==f&&f.value!==(typeof g.value=="string"?g.value:"")&&(f.value=typeof g.value=="string"?g.value:""),f.readOnly!==g.readonly&&(f.readOnly=g.readonly),f.hidden=g.readonly;let b=qc(p)?p:"";b!==S&&(S=b,b&&(c.src=b),m.replaceChildren(...b?[c]:[])),v.hidden=!b,b&&(v.href=b)}}};var on=e=>typeof e=="number"?e:Number(e)||0;function Uc(e,t){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e;if(Array.isArray(n.subtotals)||n.groups_by_subtotal){let i=n.groups_by_subtotal??{},o=n.subtotals??[{name:t,amount:on(n.amount_untaxed)}];return{subtotals:(n.subtotals_order??o.map(s=>s.name)).map(s=>({name:s,amount:on(o.find(d=>d.name===s)?.amount??n.amount_untaxed),groups:(i[s]??[]).map((d,l)=>({name:String(d.tax_group_name??""),amount:on(d.tax_group_amount),at:[s,l]}))})),total:on(n.amount_total)}}let r=(Array.isArray(n.groups)?n.groups:[]).map((i,o)=>({name:String(i.name??""),amount:on(i.amount),at:o}));return{subtotals:[{name:t,amount:on(n.untaxed),groups:r}],total:on(n.total)}}var dd=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Ee(i),d=Oe(o,a),l=n.options??{},f=typeof l.currencyField=="string"?l.currencyField:null,c=typeof l.currency=="string"?l.currency:null,v=s("tbody"),m=s("table",{id:r,class:"fd-tax-totals"},v),S="";function g(p,b){let h=JSON.parse(JSON.stringify(e.getState().values[t])),x=p.amount;if(Array.isArray(p.at)){let[L,y]=p.at;h.groups_by_subtotal[L][y].tax_group_amount=b,h.amount_total=Math.round((on(h.amount_total)+b-x)*100)/100}else h.groups[p.at].amount=b,h.total=Math.round((on(h.total)+b-x)*100)/100;e.setValue(t,h)}return{element:m,focus:()=>m.querySelector("input")?.focus(),update(p){let b=Uc(p.value,d.untaxed),h=f?p.values[f]:null,x=c??(h&&typeof h=="object"&&"label"in h?h.label:typeof h=="string"?h:""),L=A=>/^[A-Z]{3}$/.test(x)?$n(A,x,2,a):gt(A,2,a),y=l.editable===!0&&!p.readonly,R=JSON.stringify([b,x,y]);if(R===S||m.contains(i.activeElement))return;S=R;let E=(A,w,j)=>s("tr",{class:j},s("th",{scope:"row"},A),s("td",{},w)),k=[];for(let A of b?.subtotals??[]){k.push(E(A.name,L(A.amount),"fd-tax-subtotal"));for(let w of A.groups){if(!y){k.push(E(w.name,L(w.amount),"fd-tax-group"));continue}let j=s("input",{type:"text",class:"fd-input fd-number-input",inputmode:"decimal",autocomplete:"off","aria-label":w.name});j.value=gt(w.amount,2,a),j.addEventListener("change",()=>{let C=Jt(j.value.trim(),a);/^-?(\d+\.?\d*|\.\d+)$/.test(C)&&g(w,Number(C))}),k.push(E(w.name,j,"fd-tax-group"))}}b&&k.push(E(d.total,L(b.total),"fd-tax-total")),v.replaceChildren(...k)}}};var Fi=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function Kc(e){return(Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.content)?e.content:[]).filter(n=>n&&typeof n=="object").map(n=>({date:Fi(n.date),amount:typeof n.amount=="number"?n.amount:Number(n.amount)||0,name:Fi(n.name),journal:Fi(n.journal_name??n.journal),memo:Fi(n.ref??n.memo),id:n.account_payment_id??n.payment_id??n.id??null}))}var ld=({node:e,id:t,document:n,labels:r,locale:i="en",dialogs:o})=>{let a=Ee(n),s=Oe(r,i),d=e.options??{},l=typeof d.currencyField=="string"?d.currencyField:null,f=typeof d.dueField=="string"?d.dueField:null,c=typeof d.model=="string"?d.model:"account.payment",v=a("ul",{class:"fd-payments-list"}),m=a("div",{class:"fd-payment-due",hidden:""}),S=a("div",{id:t,class:"fd-payments"},v,m),g={type:"date",label:""},p="",b=null;return{element:S,focus:()=>v.querySelector("button")?.focus(),destroy:()=>b?.(),update(h){let x=l?h.values[l]:null,L=x&&typeof x=="object"&&"label"in x?x.label:typeof x=="string"?x:"",y=A=>/^[A-Z]{3}$/.test(L)?$n(A,L,2,i):gt(A,2,i),R=Kc(h.value),E=f?h.values[f]:null,k=JSON.stringify([R,L,E]);k!==p&&(p=k,b?.(),v.replaceChildren(...R.map((A,w)=>{let j=y(A.amount),C=a("button",{type:"button",class:"fd-payment-info","aria-label":We(s.paymentOf,{amount:j}),"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${t}-payment-${w}`},"i"),O=(z,T)=>T?[a("dt",{},z),a("dd",{},T)]:[],W=A.id!==null&&o?.canOpen(c)?a("button",{type:"button",class:"fd-button fd-button-link fd-payment-open"},s.openPayment):null,D=a("div",{id:`${t}-payment-${w}`,class:"fd-payment-details",role:"dialog","aria-label":We(s.paymentOf,{amount:j}),tabindex:"-1",hidden:""},a("strong",{},A.name||j),a("span",{class:"fd-payment-details-amount"},j),a("dl",{},...O(s.journal,A.journal),...O(s.memo,A.memo)),...W?[W]:[]),I=a("li",{class:"fd-payment"},C,a("span",{class:"fd-payment-date"},We(s.paidOn,{date:St(g,A.date,{},i)})),a("span",{class:"fd-payment-amount"},j),D),B=!1,H=Gn(I,C,D,()=>{B&&C.focus(),B=!1,b===V&&(b=null)}),V=()=>H.close();return C.addEventListener("click",()=>{if(H.isOpen())return V();b?.(),H.open(),b=V,(W??D).focus()}),D.addEventListener("keydown",z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),B=!0,V())}),W?.addEventListener("click",()=>{V(),o?.openRecord(c,{recordId:A.id,title:A.name||j})}),I})),m.hidden=E==null,m.replaceChildren(a("span",{},s.amountDue),a("strong",{},typeof E=="number"?y(E):"")))}}};function Ot(e,t=e.widgets??{}){let n=e.widgets===t?e:{...e,widgets:t},{field:r,node:i}=n,o=[i.widget?`${r.type}.${i.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type==="many2many"&&i.columns?.length?"many2many.table":null,r.type].filter(a=>a!==null);for(let a of o){let s=t[a]??ud[a];if(s)return r.type==="selection"&&r.optionsFrom?Qs(s,n):s(n)}return ef(n)}function nt(e,t,n={},...r){let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}function an(e,t){De(e,"aria-invalid",String(t.invalid)),De(e,"aria-required",e.getAttribute("role")==="group"?null:String(t.required)),De(e,"aria-describedby",t.describedBy||null)}var Ti=e=>e==null?"":String(e);function Yn(e){return t=>{let{form:n,name:r,field:i,node:o,id:a,document:s}=t,d=nt(s,"input",{id:a,type:e,class:"fd-input",autocomplete:/^(email|tel|url)$/.test(e)?e:"off"});return i.type==="char"&&i.size!==void 0&&(d.maxLength=i.size),e==="time"&&wi(d,i,o),o.placeholder&&(d.placeholder=o.placeholder),d.addEventListener("input",()=>n.setValue(r,d.value===""?null:d.value)),Ro({element:d,focus:()=>d.focus(),update(l){let f=Ti(l.value);d.value!==f&&(d.value=f),d.readOnly!==l.readonly&&(d.readOnly=l.readonly),an(d,l)}},t,d)}}var Jc=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=nt(a,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),i.placeholder&&(s.placeholder=i.placeholder);let d=Zs(s,i);return s.addEventListener("input",()=>{d(),t.setValue(n,s.value===""?null:s.value)}),Ro({element:s,focus:()=>s.focus(),update(l){let f=Ti(l.value);s.value!==f&&(s.value=f,d()),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),an(s,l)}},e,s)},Gc=/^-?(\d+\.?\d*|\.\d+)$/,Yc=/^-?\.?$/,Po=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,locale:s="en"}=e,d=r.type==="integer",l=d?0:(r.type==="float"||r.type==="monetary"?r.digits?.[1]:void 0)??2,f=w=>typeof w=="number"?gt(w,l,s):Ti(w),c=nt(a,"input",{id:o,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=d?"numeric":"decimal",i.placeholder&&(c.placeholder=i.placeholder);let v=w=>{let j=Jt(w.trim(),s);if(j==="")return null;if(Gc.test(j))return Number(j);if(!Yc.test(j))return j};c.addEventListener("input",()=>{let w=v(c.value);w!==void 0&&t.setValue(n,w)}),c.addEventListener("focus",()=>{queueMicrotask(()=>{let w=t.getState().values[n];if(a.activeElement!==c||c.readOnly||typeof w!="number"||c.value!==f(w))return;let j=c.value,[C,O]=[c.selectionStart??j.length,c.selectionEnd??j.length],W=D=>pr(j.slice(0,D),s).length;c.value=pr(j,s),c.setSelectionRange(W(C),W(O))})}),c.addEventListener("blur",()=>{c.value=f(t.getState().values[n])});let m=i.options??{},S=r.type==="monetary"?r.currencyField:void 0,g=S?t.page.fields[S]:void 0,p=S&&g&&m.pickCurrency===!0?Ot({...e,name:S,field:g,node:{type:"field",id:`${i.id}.currency`,field:S},id:`${o}-currency`}):null;p&&g&&p.element.querySelector("input, select")?.setAttribute("aria-label",g.label),p?.element.matches("input, select")&&g&&p.element.setAttribute("aria-label",g.label);let b=m.symbol?m.symbol==="after":r.type==="monetary"&&Fo(r.currency??"USD",s).after,h=(w,j)=>nt(a,"span",{class:`fd-unit${r.type==="monetary"?" fd-currency":""}`,id:`${o}-unit${j}`},w),x=r.type==="monetary"&&!p?h("",0):null,[L,y]=["prefix","suffix"].map((w,j)=>typeof m[w]=="string"&&m[w]?h(m[w],j+1):null),R=(b?null:p?.element??x)??L,E=(b?p?.element??x:null)??y,k=[R,E].filter(w=>!!w&&w!==p?.element);return{element:R||E?nt(a,"span",{class:`fd-number${b?" fd-currency-after":""}${p?" fd-currency-picked":""}`},...[R,c,E].filter(w=>!!w)):c,focus:()=>c.focus(),update(w){let j=a.activeElement===c,C=v(c.value),O=C===void 0||C===w.value;if(!(j&&O)){let W=j&&!w.readonly&&typeof w.value=="number"?ao(w.value,l,s):f(w.value);c.value!==W&&(c.value=W)}if(c.readOnly!==w.readonly&&(c.readOnly=w.readonly),an(c,{...w,describedBy:[w.describedBy,...k.map(W=>W.id)].filter(Boolean).join(" ")}),p&&S&&p.update({value:w.values[S],values:w.values,readonly:w.readonly,required:!1,invalid:!1}),x&&r.type==="monetary"){let W=Un(r,w.values,w.parent)??"";ft(x,/^[A-Z]{3}$/.test(W)?Fo(W,s).text:W)}for(let[W,D]of[[R,"start"],[E,"end"]])W&&k.includes(W)&&c.style.setProperty(`padding-inline-${D}`,`calc(var(--fd-pad-x) + ${W.textContent?.length??0}ch + 4px)`)}}};function Vo(e="box"){let t=e==="switch"?{class:"fd-switch",role:"switch"}:{class:e==="tick"?"fd-checkbox fd-tick":"fd-checkbox"};return({form:n,name:r,id:i,document:o})=>{let a=nt(o,"input",{id:i,type:"checkbox",...t});return a.addEventListener("change",()=>n.setValue(r,a.checked)),{element:a,focus:()=>a.focus(),update(s){a.checked=s.value===!0,a.disabled!==s.readonly&&(a.disabled=s.readonly),an(a,s)}}}}function $i(e){return e.type==="selection"?e.options:[]}var Xc=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=i.options?.search;if(s===!0||s!==!1&&$i(r).length>15)return qs(e);let d=rn($i(r),t,n,i),l=nt(a,"option",{value:""}),f=nt(a,"select",{id:o,class:"fd-input fd-select"},l);return d.forEach((c,v)=>f.append(nt(a,"option",{value:String(v)},c.label))),f.addEventListener("change",()=>t.setValue(n,f.value===""?null:d[Number(f.value)].value)),{element:f,focus:()=>f.focus(),update(c){let v=d.findIndex(m=>m.value===c.value);f.value=v===-1?"":String(v),l.hidden=c.required&&v!==-1,f.disabled!==c.readonly&&(f.disabled=c.readonly),an(f,c)}}};function cd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=rn($i(r),t,n,i),f=Oe(s,d),c=nt(a,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"});xi(c,i);let v=e==="checkbox"?vi(Ee(a),f,i):null,m=l.map((y,R)=>{let E=nt(a,"input",{type:e,name:o,value:String(R),id:`${o}-${R}`});return c.append(nt(a,"label",{class:"fd-choice",for:`${o}-${R}`},E,nt(a,"span",{},y.label))),E}),S=r.type==="selection"&&r.other===!0,g=S?nt(a,"input",{type:e,name:o,value:"other",id:`${o}-other`}):null,p=S?nt(a,"input",{type:"text",class:"fd-input fd-other-input","aria-label":f.otherAnswer,autocomplete:"off"}):null;g&&p&&(c.append(nt(a,"div",{class:"fd-choice fd-choice-other"},nt(a,"label",{class:"fd-choice-other-pick",for:`${o}-other`},g,nt(a,"span",{},f.other)),p)),p.addEventListener("input",()=>{g.checked||(g.checked=!0),b(g)}),g.addEventListener("change",()=>{g.checked&&p.focus()})),v?.element&&c.append(v.element);function b(y){if(e==="checkbox"&&y instanceof HTMLInputElement&&y.checked){let E=l[m.indexOf(y)]?.exclusive===!0;m.forEach((k,A)=>k!==y&&(E||l[A].exclusive)&&(k.checked=!1)),E&&g&&(g.checked=!1)}let R=g?.checked&&p&&p.value.trim()?p.value:null;if(e==="radio"){let E=m.findIndex(k=>k.checked);t.setValue(n,E!==-1?l[E].value:R)}else{let E=new Set(l.filter((k,A)=>m[A].checked));t.setValue(n,[...$i(r).filter(k=>E.has(k)).map(k=>k.value),...R!==null?[R]:[]])}}c.addEventListener("change",y=>{y.target!==p&&b(y.target)});let h=new Set(l.map(y=>y.value)),x=()=>m.some(y=>y.checked)||g?.checked===!0,L=e==="radio"?nn(a,f,()=>{for(let y of[...m,g])y&&(y.checked=!1);t.setValue(n,null),(m[0]??g)?.focus()},i):null;return{element:L?nt(a,"div",{class:"fd-choices-box"},c,L.button):c,focus:()=>(m.find(y=>y.checked)??(g?.checked?p:null)??m[0])?.focus(),update(y){let R=Array.isArray(y.value)?y.value:[y.value],E=!!v?.full(Array.isArray(y.value)?y.value.length:0);if(m.forEach((k,A)=>{k.checked=R.includes(l[A].value);let w=y.readonly||E&&!k.checked&&!l[A].exclusive;k.disabled!==w&&(k.disabled=w)}),g&&p){let k=R.find(j=>typeof j=="string"&&!h.has(j)),A=g.checked&&!p.value.trim()&&(e==="checkbox"||R.every(j=>j==null));g.checked=k!==void 0||A,k!==void 0&&a.activeElement!==p&&(p.value=k);let w=y.readonly||E&&!g.checked;g.disabled!==w&&(g.disabled=p.disabled=w)}L?.allow(y),L?.show(x()),an(c,y)}}}}function fd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=Oe(s,d),f="min"in r&&typeof r.min=="number"?r.min:e==="rating"?1:0,c="max"in r&&typeof r.max=="number"?r.max:e==="rating"?5:10,v=e==="rating"?i.options?.icon:"number",m=v!=="number",S=e==="scale"&&i.options?.nps===!0&&f===0&&c===10,g=nt(a,"div",{id:o,class:`fd-points fd-${m?"rating":"scale"}${m?` fd-rating-${v??"star"}`:""}${S?" fd-nps":""}`,role:"radiogroup"}),p=[],b=e==="rating"&&f===c,h=e==="rating"&&(b||i.options?.clear===!1),x=!1;for(let E=f;E<=c;E++){let k=nt(a,"button",{type:"button",role:"radio","aria-label":We(l.ofMax,{n:E,max:c}),"data-value":String(E)},v==="thumb"?wt(a,"thumb"):v==="heart"?"\u2665":m?"\u2605":String(E));e==="scale"&&k.removeAttribute("aria-label"),S&&(k.dataset.tone=E<7?"low":E<9?"mid":"high"),k.addEventListener("click",()=>t.setValue(n,h&&!x&&t.getState().values[n]===E?null:E)),p.push(k),g.append(k)}g.addEventListener("keydown",E=>{let k=t.getState().values[n],A=typeof k=="number"?k:f-1,w=E.key==="ArrowRight"||E.key==="ArrowUp"?1:E.key==="ArrowLeft"||E.key==="ArrowDown"?-1:0;if(!w)return;E.preventDefault();let j=Math.min(c,Math.max(f,A+w));t.setValue(n,j),p[j-f]?.focus()});let L=[i.options?.startLabel,i.options?.endLabel].map(E=>typeof E=="string"?E:""),y=nn(a,l,()=>{t.setValue(n,null),p[0]?.focus()},i,!b),R=L.some(Boolean)?nt(a,"div",{class:"fd-scale-box"},g,nt(a,"div",{class:"fd-scale-ends","aria-hidden":"true"},nt(a,"span",{},L[0]),nt(a,"span",{},L[1]))):g;return L.some(Boolean)&&g.setAttribute("aria-description",L.filter(Boolean).join(" \u2026 ")),{element:nt(a,"div",{class:"fd-choices-box"},R,y.button),focus:()=>(p.find(E=>E.getAttribute("aria-checked")==="true")??p[0])?.focus(),update(E){let k=typeof E.value=="number"?E.value:null;x=E.required,p.forEach((A,w)=>{let j=f+w;De(A,"aria-checked",String(j===k)),A.classList.toggle("fd-on",m?k!==null&&j<=k:j===k);let C=j===k||k===null&&w===0?0:-1;A.tabIndex!==C&&(A.tabIndex=C),A.disabled!==E.readonly&&(A.disabled=E.readonly)}),y.allow(E),y.show(k!==null),an(g,E)}}}}var Zc=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=nt(o,"input",{id:i,type:"date",class:"fd-input fd-date"});wi(s,r,a),s.addEventListener("input",()=>t.setValue(n,s.value||null));let d={element:s,focus:()=>s.focus(),update(l){let f=Ti(l.value);s.value!==f&&(s.value=f),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),s.classList.toggle("fd-blank",!f),an(s,l)}};return a.options?.weekNumbers===!0?hi(d,e,"date"):d},Ai=e=>String(e).padStart(2,"0"),Qc=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=nt(o,"input",{id:i,type:"datetime-local",class:"fd-input fd-datetime"});wi(s,r,a);let d=f=>{if(typeof f!="string"||!f)return"";let c=new Date(f);return Number.isNaN(c.getTime())?"":`${c.getFullYear()}-${Ai(c.getMonth()+1)}-${Ai(c.getDate())}T${Ai(c.getHours())}:${Ai(c.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(n,null);let f=new Date(s.value);Number.isNaN(f.getTime())||t.setValue(n,f.toISOString())});let l={element:s,focus:()=>s.focus(),update(f){let c=d(f.value);s.value!==c&&(s.value=c),s.readOnly!==f.readonly&&(s.readOnly=f.readonly),s.classList.toggle("fd-blank",!c),an(s,f)}};return a.options?.weekNumbers===!0?hi(l,e,"datetime"):l};function ef({field:e,id:t,document:n}){let r=nt(n,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:r,focus:()=>{},update(i){r.textContent=pi(i.value,e)}}}function pi(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].flat().map(n=>n.name).join(", ");case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var ud={char:Yn("text"),"char.email":Yn("email"),"char.phone":Yn("tel"),"char.url":Yn("url"),"char.password":Yn("password"),"char.time":Yn("time"),"char.tags":so,text:Jc,integer:Po,float:Po,monetary:Po,"integer.rating":fd("rating"),"integer.scale":fd("scale"),"integer.slider":So,"float.slider":So,"integer.progressbar":br,"integer.label":yr,"float.label":yr,"monetary.label":yr,"float.progressbar":br,"float.duration":hs,"float.percentage":bs,"monetary.progressbar":br,boolean:Vo(),"boolean.toggle":Vo("switch"),"boolean.tick":Vo("tick"),"boolean.buttons":ed,"boolean.priority":Ao,"selection.priority":Ao,"selection.dot":rd,"integer.color":$o,"char.color":$o,"char.copy":To,"text.copy":To,"date.daterange":No,"datetime.daterange":No,"float.timer":Oo,"datetime.timer":Oo,"binary.pdf":ad,"char.embed":sd,"json.distribution":xs,"json.tax-totals":dd,"json.payments":ld,selection:Xc,"selection.radio":cd("radio"),"selection.checkboxes":cd("checkbox"),"selection.tags":zs,"selection.image-choice":Us,"selection.ranking":Ks,"selection.statusbar":mi,date:Zc,datetime:Qc,many2one:gr,"many2one.statusbar":mi,many2many:si,"many2many.tags":si,"many2many.checkboxes":lo,"many2many.table":td,reference:co,one2many:po,"one2many.cards":Xs,binary:hr,"binary.signature":Bs,image:go,html:wo,json:ko,"json.address":Gs,properties:vo,matrix:Hs,"char.badge":ki,"selection.badge":ki,"many2one.badge":ki};var pd=`.fd-signature{display:grid;gap:8px;justify-items:start;width:100%;max-width:480px;min-width:0}.fd-signature-box{position:relative;width:100%;aspect-ratio:10 / 3;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:#fff;overflow:hidden}.fd-signature-box:has(.fd-signature-pad:not([hidden]):not(.fd-signature-locked)):hover{border-color:var(--fd-accent)}.fd-signature-pad,.fd-signature-image{display:block;width:100%;height:100%}.fd-signature-pad{touch-action:none;cursor:crosshair}.fd-signature-pad.fd-signature-locked{cursor:default}.fd-signature-image{object-fit:contain}.fd-signature-hint{position:absolute;inset-inline:18px;inset-block-end:16px;padding-block-start:4px;pointer-events:none;border-block-start:1px solid var(--fd-border-strong);color:var(--fd-muted);font-size:12.5px}.fd-signature-tools{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;width:100%}.fd-signature-typed{flex:1 1 200px;min-width:0}.fd-signature-footer{margin-block-start:-4px;color:var(--fd-muted);font-size:12.5px}.fd-slider{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:14px;row-gap:0;align-items:center;width:100%;max-width:440px;min-width:0}.fd-slider-track{display:contents}.fd-slider-input{width:100%;min-width:0;height:26px;margin:0;accent-color:var(--fd-accent);cursor:pointer}.fd-slider-input:disabled{cursor:default}.fd-slider-value{min-width:2.5em;text-align:start;font-variant-numeric:tabular-nums;font-weight:600}.fd-slider-ends{grid-column:1;display:flex;justify-content:space-between;gap:12px;font-size:12.5px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-slider-empty .fd-slider-input{filter:grayscale(1);opacity:.55}.fd-slider-empty .fd-slider-value{color:var(--fd-muted);font-weight:400}.fd-slider .fd-choice-clear{grid-column:1 / -1}.fd-image-choices{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr));gap:12px;width:100%;min-width:0}.fd-image-card{position:relative;display:grid;grid-template-rows:auto 1fr;padding:0;margin:0;overflow:hidden;cursor:pointer;font:inherit;color:var(--fd-text);text-align:start;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);transition:border-color .15s ease,box-shadow .15s ease}.fd-image-card:hover:not(:disabled){border-color:var(--fd-accent)}.fd-image-card:disabled{cursor:default}.fd-image-card:disabled:not([aria-checked=true]){opacity:.6}.fd-image-card[aria-checked=true]{border-color:var(--fd-accent);box-shadow:0 0 0 1px var(--fd-accent)}.fd-image-card-picture{display:block;aspect-ratio:4 / 3;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-image-card-picture img{display:block;width:100%;height:100%;object-fit:cover}.fd-image-card-blank{display:grid;place-items:center;width:100%;height:100%;color:var(--fd-border-strong)}.fd-image-card-blank svg{width:36%;height:36%;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.fd-image-card-words{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;font-size:13.5px;line-height:1.35}.fd-image-card-words:before{content:"";flex:none;width:16px;height:16px;margin-block-start:1px;box-sizing:border-box;border:1.5px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface)}.fd-image-card[role=checkbox] .fd-image-card-words:before{border-radius:4px}.fd-image-card[aria-checked=true] .fd-image-card-words:before{border-color:var(--fd-accent);background:var(--fd-accent);box-shadow:inset 0 0 0 3px var(--fd-surface)}.fd-image-card[role=checkbox][aria-checked=true] .fd-image-card-words:before{box-shadow:none;background:var(--fd-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat}.fd-image-choices+.fd-choice-clear{justify-self:end}.fd-ranking{width:100%;max-width:480px;min-width:0}.fd-rank-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.fd-rank-item{display:flex;align-items:center;gap:10px;padding-block:5px;padding-inline:8px 5px;min-height:40px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);cursor:grab;user-select:none;-webkit-user-select:none}.fd-rank-item.fd-rank-lifted{position:relative;z-index:1;cursor:grabbing;border-color:var(--fd-accent);box-shadow:0 6px 18px #0f141929}.fd-ranking-locked .fd-rank-item{cursor:default}.fd-rank-grip{flex:none;width:10px;height:16px;touch-action:none;background:radial-gradient(circle,var(--fd-border-strong) 1.3px,transparent 1.7px) 0 0 / 5px 5.33px}.fd-ranking-locked .fd-rank-grip{visibility:hidden}.fd-rank-place{flex:none;display:grid;place-items:center;min-width:24px;height:24px;padding-inline:4px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}.fd-rank-words{flex:1;min-width:0;overflow-wrap:anywhere}.fd-rank-tools{flex:none;display:inline-flex;gap:2px}.fd-rank-move{width:30px;height:30px;padding:0;font:inherit;font-size:15px;line-height:1;color:var(--fd-muted);background:none;border:1px solid transparent;border-radius:4px;cursor:pointer}.fd-rank-move:hover:not(:disabled){background:var(--fd-page);border-color:var(--fd-border);color:var(--fd-text)}.fd-rank-move:disabled{opacity:.3;cursor:default}.fd-address{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;width:100%;max-width:560px;min-width:0}.fd-address-part{display:grid;gap:3px;min-width:0;align-content:start}.fd-address-street,.fd-address-line2{grid-column:1 / -1}.fd-address-part.fd-required>.fd-address-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-address-label{font-size:12.5px;color:var(--fd-muted)}@container (max-width: 420px){.fd-address{grid-template-columns:minmax(0,1fr)}}.fd-repeat{display:grid;gap:10px;justify-items:start;width:100%;min-width:0}.fd-repeat-list{display:grid;gap:10px;width:100%;min-width:0}.fd-repeat-list:empty{display:none}.fd-repeat-card{display:grid;gap:8px;min-width:0;padding:10px 14px 14px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-radius),6px)}.fd-repeat-head{display:flex;align-items:center;gap:2px;min-height:28px}.fd-repeat-title{font-weight:600;font-size:13.5px;margin-inline-end:auto}.fd-repeat-remove,.fd-repeat-tool{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:18px;line-height:1;padding:4px 8px;border-radius:4px}.fd-repeat-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-repeat-tool{font-size:15px;min-width:24px;min-height:24px}.fd-repeat-tool:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-repeat-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:10px 14px}.fd-repeat-field{display:grid;gap:3px;min-width:0;align-content:start}.fd-repeat-label{font-size:12.5px;color:var(--fd-muted)}.fd-repeat-add{border-style:dashed}`;var md='.fd-yes-no button{min-width:76px}.fd-choices-columns{display:grid;grid-template-columns:repeat(var(--fd-choice-columns),minmax(0,1fr))}.fd-choices-row{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.fd-choice-limit{grid-column:1 / -1;flex-basis:100%;font-size:12.5px;color:var(--fd-muted)}.fd-choice-limit:empty{display:none}.fd-image-choices[data-size=small]{--fd-card: 96px}.fd-image-choices[data-size=large]{--fd-card: 210px}.fd-image-choices[data-size]{grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--fd-card, 130px)),1fr))}.fd-image-choices[data-fit=whole] img{object-fit:contain}.fd-image-choices-bare .fd-image-card-words{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0;font-size:0}.fd-choice-search .fd-combo:after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.fd-rank-pool{display:flex;flex-wrap:wrap;gap:8px;margin-block:6px 10px}.fd-rank-pick{min-height:32px;padding:4px 12px;font:inherit;color:inherit;cursor:pointer;background:var(--fd-surface);border:1px dashed var(--fd-border-strong);border-radius:999px}.fd-rank-pick:disabled{opacity:.5;cursor:default}.fd-rank-list:empty{display:none}.fd-rank-keep{margin-block-start:8px}.fd-matrix-pick{display:inline-flex;align-items:center;gap:8px}.fd-matrix-column{display:none}@container (max-width: 520px){.fd-choices-columns{grid-template-columns:minmax(0,1fr)}.fd-image-choices.fd-image-choices{grid-auto-flow:row;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-matrix-table,.fd-matrix-table :is(tbody,tr,th,td){display:block}.fd-matrix-table thead{display:none}.fd-matrix-table tr{padding:10px 12px;margin-block-end:10px;border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-matrix-table :is(th,td){padding:2px 0;border:0;text-align:start}.fd-matrix-pick{min-height:32px}.fd-matrix-column{display:inline}}';var gd='.fd-counted{display:grid;gap:2px;min-width:0}.fd-count{justify-self:end;direction:ltr;unicode-bidi:isolate;font-size:12px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-count-near{color:var(--fd-warning);font-weight:600}.fd-number:not(.fd-currency-picked){position:relative;display:block}.fd-field>.fd-number:not(.fd-currency-picked){align-self:start}.fd-number>.fd-unit{position:absolute;inset-block:0;display:flex;align-items:center;pointer-events:none;color:var(--fd-muted)}.fd-number>.fd-unit:first-child{inset-inline-start:var(--fd-pad-x)}.fd-number>.fd-unit:last-child{inset-inline-end:var(--fd-pad-x)}.fd-rating-heart button.fd-on{color:#e5484d}.fd-rating-thumb button.fd-on{color:var(--fd-accent)}.fd-rating .fd-icon{display:block;width:1em;height:1em}.fd-rating .fd-on .fd-icon{fill:currentColor}.fd-slider-word{display:block;max-width:12em}.fd-slider-last{text-align:end}.fd-nps [data-tone=low]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-nps [data-tone=mid]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-nps [data-tone=high]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-nps button{background:var(--fd-tone-soft);border-color:var(--fd-tone);color:var(--fd-tone);font-weight:600}.fd-nps button.fd-on{background:var(--fd-tone);border-color:var(--fd-tone);color:var(--fd-surface)}.fd-nps [data-value="7"],.fd-nps [data-value="9"]{margin-inline-start:8px}.fd-choices-box>.fd-scale-box{justify-self:start}';var hd=".fd-form[data-inputs~=bg] :is(.fd-input:not([readonly]),.fd-calendar-button){background:var(--fd-inputs-bg)}.fd-form[data-inputs~=border] :is(.fd-input,.fd-calendar-button){--fd-border: var(--fd-inputs-border);--fd-border-strong: var(--fd-inputs-border)}.fd-form[data-inputs~=radius] :is(.fd-input,.fd-calendar-button){--fd-control-radius: var(--fd-inputs-radius)}.fd-form[data-inputs~=size] :where(.fd-input){font-size:var(--fd-inputs-size)}.fd-form[data-inputs~=accent] :is(.fd-input,.fd-combo,.fd-tags,.fd-date-pick){--fd-accent: var(--fd-inputs-accent);--fd-accent-text: var(--fd-inputs-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}.fd-form[data-choices~=accent] :is(.fd-choices,.fd-points,.fd-image-choices,.fd-ranking,.fd-checkbox,.fd-switch,.fd-matrix-table,.fd-slider){--fd-accent: var(--fd-choices-accent);--fd-accent-text: var(--fd-choices-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface))}.fd-form[data-choices~=bg] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-surface: var(--fd-choices-bg)}.fd-form[data-choices~=border] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-border: var(--fd-choices-border)}.fd-form[data-choices~=radius] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-control-radius: var(--fd-choices-radius)}.fd-form[data-choices~=size] :is(.fd-choices,.fd-points,.fd-image-card-words,.fd-rank-list){font-size:var(--fd-choices-size)}.fd-form[data-groups~=bg] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){background:var(--fd-groups-bg);--fd-ground: var(--fd-groups-bg)}.fd-form[data-groups~=border] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border:1px solid var(--fd-groups-border)}.fd-form[data-groups~=radius] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border-radius:var(--fd-groups-radius)}.fd-form[data-fd-skin=underline]:is([data-groups~=bg],[data-groups~=border]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){padding:var(--fd-group-pad, 18px 22px);border-radius:var(--fd-groups-radius, var(--fd-radius))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button{--fd-accent: var(--fd-buttons-accent);--fd-accent-text: var(--fd-buttons-accent-text);--fd-focus: var(--fd-accent);--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}:is(.fd-form,.fd-form-dialog)[data-buttons~=radius] .fd-button{border-radius:var(--fd-buttons-radius)}:is(.fd-form,.fd-form-dialog)[data-buttons~=size] .fd-button{font-size:var(--fd-buttons-size)}.fd-form[data-tables~=bg] :is(.fd-lines-table,.fd-matrix-table) thead th{background:var(--fd-tables-bg)}.fd-form[data-tables~=border] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){border-color:var(--fd-tables-border)}.fd-form[data-tables~=size] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){font-size:var(--fd-tables-size)}";var bd='.fd-read-text{min-width:0;min-height:var(--fd-control-height, 30px);padding-block:calc(var(--fd-pad-y) + 1px);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45;color:var(--fd-text)}.fd-field:is([data-type=integer],[data-type=float],[data-type=monetary])>.fd-read-text{font-variant-numeric:tabular-nums}.fd-read-text{unicode-bidi:plaintext;text-align:left}[dir=rtl] .fd-read-text{text-align:right}.fd-read-text{padding-inline:var(--fd-pad-x)}.fd-form[data-fd-skin=outlined] .fd-read-text{padding-inline:calc(var(--fd-pad-x) + 1px)}.fd-form :is(.fd-title,.fd-title-line) .fd-read-text{padding-inline:0}.fd-read-text a,.fd-read-link{color:var(--fd-accent);text-decoration:none}.fd-read-link{border:none;background:none;padding:0;font:inherit;cursor:pointer;text-align:start}.fd-read-text a:hover,.fd-read-link:hover{text-decoration:underline}.fd-read-link:focus-visible,.fd-read-text a:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-field>.fd-value-badge{justify-self:start;align-self:start;width:fit-content;margin-block:calc((var(--fd-control-height, 30px) - 24px) / 2)}.fd-title>.fd-field>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-ribbon[title]{pointer-events:auto;cursor:help}.fd-value{font-weight:600}.fd-alert:has(>.fd-alert-actions){flex-wrap:wrap;align-items:baseline}.fd-alert-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}.fd-alert-actions .fd-button{min-height:0;padding-block:0;font-size:inherit}.fd-alert-actions .fd-button-link{color:inherit;padding-inline:0;text-decoration:underline;text-underline-offset:2px;font-weight:600}.fd-text-alert{grid-column:1 / -1;margin:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden]))>:is(.fd-ribbon-frame+.fd-alert,.fd-ribbon-frame+.fd-stats[hidden]+.fd-alert){margin-inline-end:72px}.fd-stat-pair{gap:1px}.fd-stat-row{display:inline-flex;align-items:baseline;gap:5px}.fd-stat-row>.fd-stat-label:after{content:":"}.fd-stat-pair .fd-stat-value{font-size:13.5px}@container (max-width: 520px){.fd-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.fd-stat{min-width:0;padding-inline:12px;text-align:start;column-gap:8px}.fd-stat:has(>.fd-icon){column-gap:8px}.fd-stat-value{font-size:14px}.fd-stat:nth-child(odd of:not([hidden])){border-inline-start:none}.fd-stat:nth-child(n+3 of:not([hidden])){border-block-start:1px solid var(--fd-border)}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(2 of:not([hidden])){padding-inline-end:64px}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(4 of:not([hidden])){padding-inline-end:36px}}.fd-step-time{margin-inline-start:6px;font-size:11.5px;font-weight:400;font-variant-numeric:tabular-nums}.fd-statusbar li.fd-step-more>button{padding-inline:16px 20px;letter-spacing:1px}.fd-statusbar li.fd-step-more>.fd-step-menu{position:fixed;z-index:30;display:grid;min-width:160px;margin:0;padding:4px 0;clip-path:none;transform:none;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;white-space:nowrap}.fd-statusbar li.fd-step-more>.fd-step-menu[hidden]{display:none}.fd-statusbar .fd-step-menu>button{font:inherit;font-size:13px;text-align:start;border:none;background:none;color:inherit;padding:6px 14px;cursor:pointer;transform:none}.fd-statusbar .fd-step-menu>button:hover:not(:disabled),.fd-statusbar .fd-step-menu>button:focus-visible{background:var(--fd-accent-soft);outline:none}.fd-statusbar .fd-step-menu>button:disabled{cursor:default;color:var(--fd-muted)}.fd-hotkey{display:none}[data-hotkeys] .fd-hotkey{display:inline-block;margin-inline-start:6px;padding:0 4px;border:1px solid currentColor;border-radius:3px;font:600 10.5px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.85;vertical-align:1px}.fd-link-avatar{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:10px;font-weight:700;line-height:1;vertical-align:middle}.fd-link-avatar img{width:100%;height:100%;object-fit:cover}.fd-combo[data-avatar]>.fd-link-avatar{position:absolute;inset-inline-start:4px;pointer-events:none}.fd-combo[data-avatar]>.fd-link-avatar[hidden]~.fd-combo-input{padding-inline-start:var(--fd-pad-x)}.fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:32px}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar{inset-inline-start:0}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:28px}.fd-read-text>.fd-link-avatar{margin-inline-end:6px}.fd-chip>.fd-link-avatar{width:18px;height:18px;font-size:9px;margin-inline:-4px 2px}.fd-link{display:grid;gap:2px;min-width:0}.fd-link-details{font-size:12.5px;line-height:1.4;color:var(--fd-muted);text-align:left}[dir=rtl] .fd-link-details{text-align:right}.fd-link-details>div{unicode-bidi:plaintext}.fd-chip[data-color]{background:color-mix(in srgb,var(--fd-tag) 18%,var(--fd-surface));border-color:color-mix(in srgb,var(--fd-tag) 55%,var(--fd-surface))}.fd-chip[data-color="1"]{--fd-tag: #f06050}.fd-chip[data-color="2"]{--fd-tag: #f4a460}.fd-chip[data-color="3"]{--fd-tag: #f7cd1f}.fd-chip[data-color="4"]{--fd-tag: #6cc1ed}.fd-chip[data-color="5"]{--fd-tag: #814968}.fd-chip[data-color="6"]{--fd-tag: #eb7e7f}.fd-chip[data-color="7"]{--fd-tag: #2c8397}.fd-chip[data-color="8"]{--fd-tag: #475577}.fd-chip[data-color="9"]{--fd-tag: #d6145f}.fd-chip[data-color="10"]{--fd-tag: #30c381}.fd-chip[data-color="11"]{--fd-tag: #9365b8}.fd-oneline-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;min-height:var(--fd-control-height, 30px)}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;flex:0 1 auto;width:auto;min-width:0;grid-template-columns:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{grid-column:auto!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:not([data-labels=beside]):not([data-labels=above])>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>:is(.fd-error,.fd-warning){flex-basis:100%}.fd-oneline-row .fd-input{width:12em;max-width:100%}.fd-form .fd-oneline-pair{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:6px 10px;flex:0 1 auto;max-width:100%;min-width:0}.fd-form .fd-oneline-pair:not(:has(>:not([hidden]))){display:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{max-width:100%}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{max-width:100%;min-width:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference]) .fd-input{width:15em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=integer],[data-type=float]) .fd-input{width:7em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=monetary] .fd-input{width:8.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=date],[data-type=datetime]) .fd-input{width:9.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime] .fd-input{width:14em}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]){flex:1 1 auto}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime])>:not(.fd-label){flex:1 1 auto}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]) .fd-input{width:100%;min-width:min(100%,var(--fd-oneline-min, 9.5em))}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime]{--fd-oneline-min: 14em}.fd-form .fd-oneline-words{margin:0;padding:0;border:0;background:none;color:var(--fd-text)}.fd-form .fd-oneline-words.fd-text-note{color:var(--fd-muted);font-size:12.5px}.fd-form .fd-oneline:not(:has(>.fd-label))>.fd-oneline-row{grid-column:1 / -1!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-button-link{padding-inline:0;min-height:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>.fd-read-text{min-height:0;padding-block:0}.fd-title-label{font-size:12.5px;font-weight:600;color:var(--fd-muted)}';var yd='.fd-priority{display:inline-flex;align-items:center;gap:1px}.fd-priority-star{border:none;background:none;padding:0 1px;min-width:0;font:inherit;font-size:20px;line-height:1;color:var(--fd-border-strong);cursor:pointer}.fd-priority-star.fd-on{color:#e8a317}.fd-priority:not(:has(:disabled)):hover .fd-priority-star{color:#e8a317}.fd-priority:not(:has(:disabled)) .fd-priority-star:hover~.fd-priority-star{color:var(--fd-border-strong)}.fd-priority-star:disabled{cursor:default}.fd-title-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;min-width:0}.fd-title-line>.fd-title-name{flex:1 1 18em;min-width:0}.fd-title-line>.fd-title-name .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-title-line>.fd-title-name>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-form .fd-title-line>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form .fd-title-line>.fd-field>*{grid-column:1!important}.fd-form .fd-title-line>.fd-title-side{display:flex;align-items:center;flex:none}.fd-title-line>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-line .fd-priority-star{font-size:24px}.fd-dot-box{position:relative;display:inline-flex;align-items:center;gap:6px}.fd-dot-button{display:inline-grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:none;cursor:pointer}.fd-dot-button:hover:not(:disabled){background:var(--fd-accent-soft)}.fd-dot-button:disabled{cursor:default}.fd-dot{display:inline-block;width:12px;height:12px;flex:none;border-radius:50%;background:var(--fd-dot, var(--fd-border-strong))}.fd-dot-button[data-tone=muted],.fd-dot-item[data-tone=muted]{--fd-dot: var(--fd-border-strong)}.fd-dot-button[data-tone=danger],.fd-dot-item[data-tone=danger]{--fd-dot: var(--fd-error)}.fd-dot-button[data-tone=success],.fd-dot-item[data-tone=success]{--fd-dot: var(--fd-success)}.fd-dot-button[data-tone=warning],.fd-dot-item[data-tone=warning]{--fd-dot: #d97706}.fd-dot-button[data-tone=info],.fd-dot-item[data-tone=info]{--fd-dot: var(--fd-info)}.fd-dot-label{font-size:13px;color:var(--fd-muted)}.fd-dot-menu{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:180px;padding:4px;display:grid;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-dot-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:4px;cursor:pointer;white-space:nowrap;font-size:14px}.fd-dot-item:hover,.fd-dot-item:focus{background:var(--fd-accent-soft);outline:none}.fd-dot-item[aria-checked=true]{font-weight:600}.fd-colour-box{position:relative;display:inline-flex;align-items:center;gap:8px}.fd-colour-button,.fd-colour{width:24px;height:24px;padding:0;border:1px solid var(--fd-border-strong);border-radius:4px;background:var(--fd-swatch, transparent);cursor:pointer}.fd-colour-button:disabled{cursor:default}.fd-colour-none,.fd-colour[data-colour="0"]{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--fd-error) calc(50% - 1px),var(--fd-error) calc(50% + 1px),transparent calc(50% + 1px))}.fd-colour-palette{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;display:grid;grid-template-columns:repeat(6,24px);gap:6px;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-colour[aria-checked=true]{box-shadow:0 0 0 2px var(--fd-surface),0 0 0 4px var(--fd-accent)}.fd-colour-input{width:44px;height:30px;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-colour-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;color:var(--fd-muted)}.fd-copy{display:flex;align-items:center;gap:8px;min-width:0}.fd-copy>.fd-input{flex:1 1 auto;min-width:0}.fd-copy-long{align-items:flex-start}.fd-copy-button{flex:none}.fd-range{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.fd-range-box{flex:1 1 8em;display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.fd-range-box>.fd-input{flex:1 1 9em;min-width:0}.fd-range-box>.fd-input[type=datetime-local]{flex-basis:13em}.fd-range-arrow{flex:none;display:inline-block;color:var(--fd-muted)}.fd-range-arrow:dir(rtl){transform:scaleX(-1)}.fd-range-calendar .fd-calendar-grid td button.fd-in-range{background:var(--fd-accent-soft);border-radius:0}.fd-timer{display:inline-flex;align-items:center;gap:8px;font-variant-numeric:tabular-nums;font-weight:600;direction:ltr;unicode-bidi:isolate}.fd-timer-dot{width:8px;height:8px;border-radius:50%;background:var(--fd-border-strong)}.fd-timer[data-running] .fd-timer-dot{background:var(--fd-success);animation:fd-timer-beat 1s ease-in-out infinite alternate}.fd-timer[data-running] .fd-timer-time{color:var(--fd-success)}@keyframes fd-timer-beat{to{opacity:.35}}@media(prefers-reduced-motion:reduce){.fd-timer[data-running] .fd-timer-dot{animation:none}}.fd-embed{display:grid;gap:8px;min-width:0}.fd-embed-bar{display:flex;align-items:center;gap:8px;min-width:0}.fd-embed-bar>.fd-input{flex:1 1 auto;min-width:0}.fd-embed-open{flex:none}.fd-embed-frame{display:block;width:100%;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-page)}.fd-embed-none{padding:24px 12px;text-align:center;color:var(--fd-muted);border:1px dashed var(--fd-border);border-radius:max(var(--fd-control-radius),4px)}.fd-distribution{display:grid;gap:6px;min-width:0}.fd-distribution-table .fd-distribution-share{width:8.5em}.fd-distribution-table .fd-share{text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch)}.fd-distribution-total{font-weight:600;text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch + 4px);font-variant-numeric:tabular-nums}.fd-distribution-add{justify-self:start}.fd-tax-totals{justify-self:end;border-collapse:collapse;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-tax-totals th{text-align:start;font-weight:400;color:var(--fd-muted);padding:3px 16px 3px 0;padding-inline:0 16px}.fd-tax-totals td{text-align:end;padding:3px 0;white-space:nowrap}.fd-tax-totals .fd-tax-subtotal th{color:var(--fd-text)}.fd-tax-totals .fd-tax-total :is(th,td){font-weight:700;color:var(--fd-text);font-size:15px;border-top:1px solid var(--fd-border);padding-top:6px}.fd-tax-totals .fd-input{width:9em;text-align:end}.fd-payments{display:grid;gap:6px;justify-self:end;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-payments-list{list-style:none;margin:0;padding:0;display:grid;gap:4px}.fd-payment{position:relative;display:flex;align-items:center;gap:8px}.fd-payment-info{flex:none;width:20px;height:20px;padding:0;border:1px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface);color:var(--fd-muted);font:italic 600 12px/1 Georgia,serif;cursor:pointer}.fd-payment-info:hover,.fd-payment-info[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-payment-date{flex:1 1 auto;font-style:italic;color:var(--fd-muted)}.fd-payment-amount{white-space:nowrap}.fd-payment-details{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:240px;display:grid;gap:6px;padding:10px 12px;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-payment-details dl{display:grid;grid-template-columns:auto 1fr;gap:2px 12px;margin:0}.fd-payment-details dt{color:var(--fd-muted)}.fd-payment-details dd{margin:0}.fd-payment-open{justify-self:start}.fd-payment-due{display:flex;justify-content:space-between;gap:16px;padding-top:6px;border-top:1px solid var(--fd-border);font-weight:600}.fd-properties-list{display:grid;gap:8px;min-width:0}.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--fd-gap-x, 24px)}@container (max-width: 520px){.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:minmax(0,1fr)}}.fd-property-add{justify-self:start}.fd-property-new{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.fd-property-new>.fd-input{flex:1 1 10em;width:auto}';var vd='.fd-grid>.fd-section[data-place=tracks]{--fd-tracks: min(var(--fd-span, 1), var(--fd-cols));grid-template-columns:subgrid;column-gap:var(--fd-gap-x)}.fd-form .fd-section[data-place=tracks]>.fd-grid{--fd-cols: var(--fd-tracks);grid-column:1 / -1;grid-template-columns:subgrid}.fd-section[data-place]>.fd-section-description{grid-column:1 / -1}.fd-grid>.fd-section[data-place=shared]{container-type:inline-size}.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: var(--fd-columns, 1)}@container (max-width: 330px){.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: 1}}.fd-form{--fd-ground: transparent}.fd-card,.fd-form[data-fd-skin=outlined] .fd-section[data-style=card][data-on-page]{--fd-ground: var(--fd-surface)}fieldset.fd-section[data-style]{background-color:var(--fd-ground)}.fd-form .fd-section[data-style=line]>.fd-section-title{border-block-end:1px solid var(--fd-border);padding-block-end:8px}.fd-form .fd-section[data-style=plain]>.fd-section-title{border-block-end:0;padding-block-end:0}.fd-form .fd-section[data-style=framed]{border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:6px 18px 18px}.fd-form .fd-section[data-style=framed]>.fd-section-title{float:none;width:auto;max-width:100%;padding:0 6px;margin-inline-start:-6px;border:0}.fd-form .fd-field[data-labels]{grid-template-columns:minmax(0,1fr)}.fd-form .fd-field[data-labels]>*{grid-column:1 / -1}.fd-form .fd-field[data-labels=beside]{container-type:inline-size;grid-template-columns:minmax(0,var(--fd-label-width, 140px)) minmax(0,1fr);column-gap:14px}@container (min-width: 300px){.fd-form .fd-field[data-labels=beside]>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=beside]>:not(.fd-label){grid-column:2}}.fd-form .fd-field[data-labels=hidden]>.fd-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form .fd-field[data-labels=after]{grid-template-columns:auto minmax(0,1fr);column-gap:9px;align-items:start;--fd-tick-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=after]>:is(.fd-tick,:has(>.fd-tick)){grid-column:1;grid-row:1;display:flex;margin-block-start:calc(var(--fd-tick-drop) + (1.45em - 17px) / 2)}.fd-form .fd-field[data-labels=after] .fd-tick{width:17px;height:17px}.fd-form .fd-field[data-labels=after]>:not(.fd-tick,:has(>.fd-tick)){grid-column:2}.fd-form .fd-field[data-labels=after]>.fd-label{grid-row:1;margin-block-start:var(--fd-tick-drop);font-weight:inherit;line-height:1.45;cursor:pointer}.fd-form .fd-field[data-labels=beside]:focus-within,.fd-grid>.fd-section[data-place=shared]:focus-within{z-index:3}:is(.fd-grid,.fd-sections)>.fd-button{justify-self:start}.fd-form .fd-text-note{background:color-mix(in srgb,var(--fd-text) 6%,transparent);color:var(--fd-text);border-radius:var(--fd-control-radius, 6px);padding:10px 12px}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-font=serif]{--fd-font: "Source Serif 4", Georgia, serif}:is(.fd-form,.fd-form-dialog)[data-font=rounded]{--fd-font: Nunito, "Varela Round", system-ui}:is(.fd-form,.fd-form-dialog)[data-density=compact]{--fd-gap-y: 10px;--fd-gap-x: 16px;--fd-control-height: 30px;--fd-gap-block: 16px;--fd-group-pad: 14px 16px}:is(.fd-form,.fd-form-dialog)[data-density=comfortable]{--fd-gap-y: 16px;--fd-gap-x: 20px;--fd-control-height: 36px;--fd-gap-block: 22px;--fd-group-pad: 18px 22px}:is(.fd-form,.fd-form-dialog)[data-density=roomy]{--fd-gap-y: 22px;--fd-gap-x: 28px;--fd-control-height: 42px;--fd-gap-block: 30px;--fd-group-pad: 24px 30px}:is(.fd-form,.fd-form-dialog)[data-corners=square]{--fd-radius: 0px;--fd-control-radius: 0px}:is(.fd-form,.fd-form-dialog)[data-corners=soft]{--fd-radius: 10px;--fd-control-radius: 6px}:is(.fd-form,.fd-form-dialog)[data-corners=round]{--fd-radius: 16px;--fd-control-radius: 12px}.fd-form[data-scheme]{--fd-ground: var(--fd-page)}}.fd-form[data-scheme]{color-scheme:light;background:var(--fd-page);color:var(--fd-text);border-radius:var(--fd-radius)}:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{color-scheme:dark}}.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:20px}.fd-form-dialog-body>.fd-form[data-scheme]{background:none;border-radius:0}.fd-form-dialog-body>.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:0}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}}:is(.fd-form,.fd-form-dialog)[data-accent]{--fd-accent: var(--fd-look-accent);--fd-accent-text: var(--fd-look-accent-text);--fd-focus: var(--fd-look-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-scheme=dark][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}}:is(.fd-form,.fd-form-dialog)[data-fd-skin=outlined][data-accent]{--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}}:is(.fd-form,.fd-form-dialog)[data-accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}.fd-form[data-accent] .fd-page-head{border-block-end:3px solid var(--fd-accent);padding-block-end:14px}';var vn='system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif',xd={material:{light:{font:`Roboto, ${vn}`,text:"#1d1b20",muted:"#49454f",page:"#fef7ff",surface:"#ffffff",border:"#79747e","border-strong":"#49454f",accent:"#6750a4","accent-text":"#ffffff","accent-soft":"#eaddff",focus:"#6750a4","focus-ring":"none",error:"#b3261e","error-soft":"#f9dedc",radius:"12px","control-radius":"4px","control-height":"48px","pad-y":"10px","pad-x":"16px","input-border":"0 0 1px 0","label-weight":"500","gap-x":"24px","gap-y":"20px",fill:"#ece6f0"},dark:{text:"#e6e0e9",muted:"#cac4d0",page:"#141218",surface:"#1d1b20",border:"#938f99","border-strong":"#cac4d0",accent:"#d0bcff","accent-text":"#381e72","accent-soft":"#4f378b",focus:"#d0bcff",error:"#f2b8b5","error-soft":"#601410",fill:"#36343b",edge:"#938f99"}},fluent:{light:{font:`"Segoe UI Variable Text", "Segoe UI", ${vn}`,text:"#242424",muted:"#616161",page:"#f5f5f5",surface:"#ffffff",border:"#d1d1d1","border-strong":"#616161",accent:"#0f6cbd","accent-text":"#ffffff","accent-soft":"#ebf3fc",focus:"#0f6cbd","focus-ring":"none",error:"#c50f1f","error-soft":"#fdf3f4",radius:"8px","control-radius":"4px","control-height":"32px","pad-y":"5px","pad-x":"10px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#ffffff",muted:"#d6d6d6",page:"#1f1f1f",surface:"#292929",border:"#666666","border-strong":"#adadad",accent:"#479ef5","accent-text":"#0a0a0a","accent-soft":"#0e4775",focus:"#479ef5",error:"#e37d80","error-soft":"#3b1012",edge:"#adadad"}},apple:{light:{font:`-apple-system, BlinkMacSystemFont, "SF Pro Text", ${vn}`,text:"#1d1d1f",muted:"#6e6e73",page:"#f2f2f7",surface:"#ffffff",border:"#d1d1d6","border-strong":"#8e8e93",accent:"#0066cc","accent-text":"#ffffff","accent-soft":"#e5f0fb",focus:"#0066cc","focus-ring":"0 0 0 4px rgba(0, 113, 227, 0.25)",error:"#d70015","error-soft":"#ffebec",radius:"12px","control-radius":"10px","control-height":"40px","pad-y":"8px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"20px","gap-y":"16px",fill:"#f2f2f7"},dark:{text:"#f5f5f7",muted:"#a1a1a6",page:"#000000",surface:"#1c1c1e",border:"#38383a","border-strong":"#636366",accent:"#409cff","accent-text":"#000000","accent-soft":"#0f2b4d",focus:"#409cff","focus-ring":"0 0 0 4px rgba(64, 156, 255, 0.3)",error:"#ff6961","error-soft":"#3a1412",fill:"#2c2c2e",edge:"#636366"}},bootstrap:{light:{font:vn,text:"#212529",muted:"#5c636a",page:"#f8f9fa",surface:"#ffffff",border:"#dee2e6","border-strong":"#adb5bd",accent:"#0a58ca","accent-text":"#ffffff","accent-soft":"#cfe2ff",focus:"#86b7fe","focus-ring":"0 0 0 0.25rem rgba(13, 110, 253, 0.25)",error:"#b02a37","error-soft":"#f8d7da",radius:"6px","control-radius":"6px","control-height":"38px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#dee2e6",muted:"#adb5bd",page:"#212529",surface:"#2b3035",border:"#495057","border-strong":"#6c757d",accent:"#6ea8fe","accent-text":"#000000","accent-soft":"#031633",focus:"#6ea8fe","focus-ring":"0 0 0 0.25rem rgba(110, 168, 254, 0.25)",error:"#ea868f","error-soft":"#2c0b0e",edge:"#6c757d"}},shadcn:{light:{font:`Geist, Inter, ${vn}`,text:"#09090b",muted:"#64646c",page:"#fafafa",surface:"#ffffff",border:"#e4e4e7","border-strong":"#a1a1aa",accent:"#18181b","accent-text":"#fafafa","accent-soft":"#f4f4f5",focus:"#a1a1aa","focus-ring":"0 0 0 3px rgba(161, 161, 170, 0.5)",error:"#dc2626","error-soft":"#fef2f2",radius:"10px","control-radius":"8px","control-height":"36px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"24px","gap-y":"16px"},dark:{text:"#fafafa",muted:"#a1a1aa",page:"#09090b",surface:"#18181b",border:"#3f3f46","border-strong":"#71717a",accent:"#e4e4e7","accent-text":"#18181b","accent-soft":"#27272a",focus:"#71717a","focus-ring":"0 0 0 3px rgba(113, 113, 122, 0.5)",error:"#f87171","error-soft":"#450a0a",edge:"#71717a"}},ant:{light:{font:vn,text:"rgba(0, 0, 0, 0.88)",muted:"rgba(0, 0, 0, 0.55)",page:"#f5f5f5",surface:"#ffffff",border:"#d9d9d9","border-strong":"#bfbfbf",accent:"#1365d9","accent-text":"#ffffff","accent-soft":"#e6f4ff",focus:"#1365d9","focus-ring":"0 0 0 2px rgba(5, 145, 255, 0.12)",error:"#c63c3d","error-soft":"#fff2f0",radius:"8px","control-radius":"6px","pad-y":"4px","pad-x":"11px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"18px"},dark:{text:"rgba(255, 255, 255, 0.85)",muted:"rgba(255, 255, 255, 0.6)",page:"#000000",surface:"#141414",border:"#424242","border-strong":"#595959",accent:"#3c89e8","accent-text":"#000000","accent-soft":"#111a2c",focus:"#3c89e8","focus-ring":"0 0 0 2px rgba(60, 137, 232, 0.2)",error:"#e86e6b","error-soft":"#2c1618",edge:"#595959"}},odoo:{light:{font:vn,text:"#1f2937",muted:"#4b5563",page:"#f9fafb",surface:"#ffffff",border:"#d1d5db","border-strong":"#9ca3af",accent:"#714b67","accent-text":"#ffffff","accent-soft":"#f3edf2",focus:"#714b67","focus-ring":"none",error:"#c4161c","error-soft":"#fdecec",radius:"4px","control-radius":"0px","pad-y":"3px","pad-x":"4px","input-border":"0 0 1px 0","label-weight":"600","gap-x":"32px","gap-y":"14px"},dark:{text:"#e5e7eb",muted:"#9ca3af",page:"#111827",surface:"#1f2937",border:"#4b5563","border-strong":"#6b7280",accent:"#c79fbc","accent-text":"#1f1020","accent-soft":"#3b2836",focus:"#c79fbc",error:"#f6878b","error-soft":"#3a1214",edge:"#6b7280"}},"google-forms":{light:{font:`Roboto, Arial, ${vn}`,text:"#202124",muted:"#5f6368",page:"#f0ebf8",surface:"#ffffff",border:"#dadce0","border-strong":"#80868b",accent:"#673ab7","accent-text":"#ffffff","accent-soft":"#ede7f6",focus:"#673ab7","focus-ring":"none",error:"#d93025","error-soft":"#fce8e6",radius:"8px","control-radius":"0px","control-height":"36px","pad-y":"6px","pad-x":"0px","input-border":"0 0 1px 0","label-weight":"400","gap-x":"24px","gap-y":"12px"},dark:{text:"#e8e3ee",muted:"#b8b0c4",page:"#1c1822",surface:"#2a2431",border:"#4a4255","border-strong":"#7b7088",accent:"#c4abf2","accent-text":"#1d1528","accent-soft":"#3b2f52",focus:"#c4abf2",error:"#f28b82","error-soft":"#3c1714",edge:"#7b7088"}}},Io=e=>Object.entries(e).map(([t,n])=>`--fd-${t}: ${n};`).join(" "),_e=e=>`:is(.fd-form, .fd-form-dialog, .fd-theme)[data-fd-theme="${e}"]`,xr=':is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page])',wd=Object.keys(xd).map(e=>{let{light:t,dark:n}=xd[e],r=`${_e(e)}[data-scheme="dark"]`;return`${_e(e)} { ${Io(t)} }
|
|
7
|
-
${r} { ${
|
|
8
|
-
@media (prefers-color-scheme: dark) { ${_e(e)}[data-scheme="auto"] { ${
|
|
6
|
+
`);return{offset:f,line:c.length,column:c[c.length-1].length+1}}}var mf=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),gf=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),hf=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),bf=new Set(["left","center","right","justify","start","end"]);function Uo(e,t=globalThis.document){let n=t.createElement("template");n.innerHTML=e;let r=o=>{for(let a of[...o.childNodes]){if(a.nodeType===Node.TEXT_NODE)continue;if(a.nodeType!==Node.ELEMENT_NODE){a.remove();continue}let s=a;if(gf.has(s.tagName)){s.remove();continue}if(r(s),!mf.has(s.tagName)){s.replaceWith(...s.childNodes);continue}let d=s.tagName==="A"?s.getAttribute("href"):null,l=hf.has(s.tagName)?s.style?.textAlign?.trim().toLowerCase():"";for(let f of[...s.attributes])s.removeAttribute(f.name);d&&/^(https?:|mailto:)/i.test(d.trim())&&s.setAttribute("href",d.trim()),l&&bf.has(l)&&s.setAttribute("style",`text-align: ${l};`)}};r(n.content);let i=t.createElement("div");return i.append(n.content),i.innerHTML}function wd(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 vd=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["heading","heading","<b>H</b>"],["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>']],Ko=({form:e,name:t,node:n,id:r,document:i,labels:o=Ze.en})=>{let a=i.createElement("div");a.id=r,a.className="fd-input fd-richtext",a.setAttribute("role","textbox"),a.setAttribute("aria-multiline","true"),a.setAttribute("contenteditable","true"),n.placeholder&&(a.setAttribute("data-placeholder",n.placeholder),a.setAttribute("aria-placeholder",n.placeholder));let s=n.options?.toolbar!==!1,d="";a.addEventListener("input",()=>{let c=Uo(a.innerHTML,i);d=c,e.setValue(t,c.trim()===""?null:c)}),a.addEventListener("blur",()=>{a.innerHTML!==d&&(a.innerHTML=d)});let l=s?yf(a,i,o):null,f=a;return l&&(f=i.createElement("div"),f.className="fd-richtext-box",f.setAttribute("role","group"),a.setAttribute("aria-labelledby",`${r}-label`),f.append(l.bar,l.linkRow,a)),{element:f,focus:()=>a.focus(),destroy:()=>l?.destroy(),update(c){l&&(l.bar.hidden=c.readonly,c.readonly&&(l.linkRow.hidden=!0));let y=Uo(typeof c.value=="string"?c.value:"",i);(y!==d||i.activeElement!==a)&&(a.innerHTML!==y&&(a.innerHTML=y),d=y),a.setAttribute("contenteditable",String(!c.readonly)),a.classList.toggle("fd-blank",!y.trim()),a.setAttribute("aria-readonly",String(c.readonly)),a.setAttribute("aria-invalid",String(c.invalid)),c.describedBy&&a.setAttribute("aria-describedby",c.describedBy)}}};function yf(e,t,n){let r=t.createElement("div");r.className="fd-richtext-bar",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",n.formatting);let i=null,o=()=>{e.focus();let g=t.getSelection();i&&g&&(g.removeAllRanges(),g.addRange(i))},a=(g,m)=>{o(),t.execCommand?.(g,!1,m)},s=t.createElement("select");s.className="fd-richtext-style",s.setAttribute("aria-label",n.textStyle);for(let[g,m]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let b=t.createElement("option");b.value=g,b.textContent=n[m],s.append(b)}s.addEventListener("change",()=>a("formatBlock",`<${s.value}>`));let d=t.createElement("div");d.className="fd-link-row",d.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",n.linkAddress);let f=t.createElement("button");f.type="button",f.className="fd-button fd-link-apply",f.textContent=n.applyLink;let c=t.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-link-remove",c.textContent=n.removeLink,d.append(l,f,c),f.addEventListener("click",()=>{let g=wd(l.value);if(!g){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),o(),t.execCommand?.("createLink",!1,g),d.hidden=!0}),c.addEventListener("click",()=>{o(),t.execCommand?.("unlink",!1),d.hidden=!0}),l.addEventListener("keydown",g=>{g.key==="Enter"?(g.preventDefault(),f.click()):g.key==="Escape"&&(g.preventDefault(),d.hidden=!0,o())});let y=vd.map(([g,m,b])=>{let h=t.createElement("button");return h.type="button",h.className="fd-richtext-tool",h.setAttribute("aria-label",n[g]),h.title=n[g],h.innerHTML=b,h.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline","heading"].includes(m)&&h.setAttribute("aria-pressed","false"),h.addEventListener("mousedown",v=>v.preventDefault()),h.addEventListener("click",()=>{if(m==="heading")return a("formatBlock",s.value==="h2"?"<p>":"<h2>");if(m!=="createLink")return a(m);d.hidden=!1,l.value="",l.focus()}),h});r.append(s,...y);let p=[s,...y];p.forEach((g,m)=>g.tabIndex=m===0?0:-1),r.addEventListener("keydown",g=>{if(g.key!=="ArrowRight"&&g.key!=="ArrowLeft")return;let m=p.indexOf(t.activeElement);if(m<0)return;let b=getComputedStyle(r).direction==="rtl",h=g.key==="ArrowRight"!==b?1:-1,v=p[(m+h+p.length)%p.length];g.preventDefault(),p.forEach(S=>S.tabIndex=S===v?0:-1),v.focus()});let k=()=>{let g=t.getSelection();if(!g||!g.rangeCount||!e.contains(g.anchorNode))return;i=g.getRangeAt(0).cloneRange();let m=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");s.value=m==="h2"||m==="h3"?m:"p";for(let b of y){let h=vd[y.indexOf(b)][1];b.hasAttribute("aria-pressed")&&b.setAttribute("aria-pressed",String(h==="heading"?m==="h2":t.queryCommandState?.(h)??!1))}};return t.addEventListener("selectionchange",k),{bar:r,linkRow:d,destroy:()=>t.removeEventListener("selectionchange",k)}}var Jo=({form:e,name:t,id:n,document:r,labels:i=Ze.en})=>{let o=r.createElement("div");o.className="fd-json";let a=r.createElement("textarea");a.id=n,a.className="fd-input fd-textarea fd-code",a.spellcheck=!1;let s=r.createElement("div");return s.className="fd-cell-error",s.hidden=!0,o.append(a,s),a.addEventListener("input",()=>{if(a.value.trim()===""){s.hidden=!0,e.setValue(t,null);return}let d=Ci(a.value);s.hidden=!d,d?s.textContent=i.invalidJsonAt.replace("{line}",String(d.line)).replace("{column}",String(d.column)):e.setValue(t,JSON.parse(a.value))}),{element:o,focus:()=>a.focus(),update(d){if(r.activeElement!==a){let l=d.value===null||d.value===void 0?"":JSON.stringify(d.value,null,2);a.value!==l&&(a.value=l)}a.readOnly=d.readonly,a.setAttribute("aria-invalid",String(d.invalid||!s.hidden))}}};var kd=new WeakMap;function xf(e){let t=kd.get(e);return t===void 0&&(t=Math.floor(Math.random()*4294967296)>>>0,kd.set(e,t)),t}function vf(e,t){let n=e^2654435769;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(r),2246822507),n^=n>>>13;return n>>>0}function wf(e){let t=e;return()=>{t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function dn(e,t,n,r){if(r.options?.shuffle!==!0)return[...e];let i=(s,d)=>s[d]===!0,o=e.filter(s=>!i(s,"fixed")&&!i(s,"exclusive")),a=wf(vf(xf(t),n));for(let s=o.length-1;s>0;s--){let d=Math.floor(a()*(s+1));[o[s],o[d]]=[o[d],o[s]]}return o.push(...e.filter(s=>!i(s,"fixed")&&i(s,"exclusive"))),e.map(s=>i(s,"fixed")?s:o.shift())}var Sd=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=n,s=a.multiple?"checkbox":"radio",d=(m,b={},...h)=>{let v=o.createElement(m);for(let[S,x]of Object.entries(b))v.setAttribute(S,x);return v.append(...h),v},l=d("table",{id:i,class:"fd-matrix-table"});l.append(d("thead",{},d("tr",{},d("th",{scope:"col"}),...a.columns.map(m=>d("th",{scope:"col"},m.label)))));let f=d("tbody"),c=[],y=[];for(let m of dn(a.rows,e,t,r)){let b=d("tr",{role:s==="radio"?"radiogroup":"group","aria-label":m.label});y.push(b),b.append(d("th",{scope:"row"},m.label));for(let h of a.columns){let v=d("input",{type:s,name:`${i}-${m.value}`,value:String(h.value),"data-row":String(m.value),"aria-label":`${m.label}: ${h.label}`});v.addEventListener("change",()=>{if(a.onePerColumn&&v.checked)for(let S of c)S.value===v.value&&S!==v&&(S.checked=!1);g()}),c.push(v),b.append(d("td",{},d("label",{class:"fd-matrix-pick"},v,d("span",{class:"fd-matrix-column"},h.label))))}f.append(b)}l.append(f);let p=d("div",{class:"fd-matrix"},l),k=m=>a.columns.find(b=>String(b.value)===m)?.value??m;function g(){let m={};for(let b of a.rows){let h=c.filter(v=>v.dataset.row===String(b.value)&&v.checked).map(v=>k(v.value));(a.multiple?h.length:h.length===1)&&(m[String(b.value)]=a.multiple?h:h[0])}e.setValue(t,Object.keys(m).length?m:null)}return{element:p,focus:()=>(c.find(m=>m.checked)??c[0])?.focus(),update(m){let b=m.value&&typeof m.value=="object"&&!Array.isArray(m.value)?m.value:{};for(let h of c){let v=b[h.dataset.row??""],S=Array.isArray(v)?v.map(String):v==null?[]:[String(v)];h.checked=S.includes(h.value),h.disabled=m.readonly}if(l.setAttribute("aria-invalid",String(m.invalid)),s==="radio")for(let h of y)He(h,"aria-required",String(m.required));m.describedBy?l.setAttribute("aria-describedby",m.describedBy):l.removeAttribute("aria-describedby")}}};var tr=600,Mr=180,kf="#1b2a5c",Sf='"Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive',Lf=e=>Math.floor(e.length*3/4)-(e.endsWith("==")?2:e.endsWith("=")?1:0),Ef=e=>e.data??e.url??"",Ld=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=r.options??{},c=f.color,y=typeof c=="string"&&/^#[\da-f]{6}$/i.test(c)?c:kf,p=f.penWidth,k=typeof p=="number"&&p>0?p:3,g=f.footerLabel,m=l("canvas",{class:"fd-signature-pad",width:String(tr),height:String(Mr),role:"img","aria-label":d.signaturePad}),b=l("span",{class:"fd-signature-hint","aria-hidden":"true"},r.placeholder||d.signHere),h=l("img",{class:"fd-signature-image",alt:n.label,hidden:""}),v=l("input",{type:"text",class:"fd-input fd-signature-typed","aria-label":d.typeSignature,placeholder:d.typeSignature,autocomplete:"name"}),S=J=>l("button",{type:"button",class:"fd-button fd-button-link",hidden:""},J),x=S(d.undo),F=S(d.clearDrawing);F.classList.add("fd-signature-clear");let E=f.upload===!0?S(d.uploadSignature):null,w=l("input",{type:"file",accept:"image/*",class:"fd-sr-only",tabindex:"-1","aria-hidden":"true"}),A=l("div",{id:i,class:"fd-signature",role:"group"},l("div",{class:"fd-signature-box"},m,h,b),...typeof g=="string"&&g?[l("span",{class:"fd-signature-footer"},g)]:[],l("div",{class:"fd-signature-tools"},v,x,...E?[E,w]:[],F)),R=()=>{let J=m.getContext("2d");return J&&(J.strokeStyle=J.fillStyle=y,J.lineWidth=k,J.lineCap=J.lineJoin="round"),J},I=null,M=!1,P=null,H=[],D=null,W=()=>!H.length&&!P;function z(){let J=R();if(J){J.clearRect(0,0,tr,Mr),P&&(J.font=`italic 64px ${Sf}`,J.textAlign="center",J.textBaseline="middle",J.fillText(P,tr/2,Mr/2,tr-40));for(let _ of H){J.beginPath(),J.arc(_[0].x,_[0].y,k/2,0,Math.PI*2),J.fill();for(let te=1;te<_.length;te++)j(_[te-1],_[te])}}}function j(J,_){let te=R();te?.beginPath(),te?.moveTo(J.x,J.y),te?.lineTo(_.x,_.y),te?.stroke()}function V(){H=[],P=null,z()}function B(){if(b.hidden=!W(),W())return I=null,e.setValue(t,null);let J;try{J=m.toDataURL("image/png")}catch{return}if(!J)return;let _=J.slice(J.indexOf(",")+1);I=_,e.setValue(t,{name:"signature.png",type:"image/png",size:Lf(_),data:_,...P&&!H.length?{text:P}:{}})}function $(J){let _=m.getBoundingClientRect();return{x:(J.clientX-_.left)*tr/(_.width||tr),y:(J.clientY-_.top)*Mr/(_.height||Mr)}}m.addEventListener("pointerdown",J=>{M||J.button!==0||(J.preventDefault(),m.setPointerCapture?.(J.pointerId),D=$(J),H.push([D]),b.hidden=!0,z())}),m.addEventListener("pointermove",J=>{if(!D)return;let _=$(J);j(D,_),H[H.length-1].push(_),D=_});let Q=()=>{D&&(D=null,B())};m.addEventListener("pointerup",Q),m.addEventListener("pointercancel",Q),v.addEventListener("input",()=>{X(),H=[],P=v.value.trim()||null,z(),B()}),x.addEventListener("click",()=>{H.pop(),z(),B()}),E?.addEventListener("click",()=>w.click()),w.addEventListener("change",()=>{let J=w.files?.[0];w.value="",J&&Fi(J).then(_=>e.setValue(t,_))}),F.addEventListener("click",()=>{V(),I=null,v.value="",X(),e.setValue(t,null),v.focus()});function X(){h.hidden=!0,m.hidden=!1}return{element:A,focus:()=>(v.hidden?F:v).focus(),update(J){M=J.readonly;let _=J.value&&typeof J.value=="object"&&!Array.isArray(J.value)?J.value:null,te=o.activeElement!==v;if(_&&Ef(_)!==I){let Ve=_.data?`data:${_.type};base64,${_.data}`:_.url??"";h.getAttribute("src")!==Ve&&(h.src=Ve),h.hidden=!1,m.hidden=!0,I=null,V(),te&&(v.value=_.text??"")}else _||((I!==null||!h.hidden)&&(I=null,V(),te&&(v.value="")),X());b.hidden=M||!W()||!h.hidden,v.hidden=M,v.readOnly=M,F.hidden=M||!_,x.hidden=M||!H.length||!h.hidden,E&&(E.hidden=M),m.classList.toggle("fd-signature-locked",M),tt(A,J),v.setAttribute("aria-invalid",String(J.invalid))}}};var Go=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=We(a,s),l=Te(o),f=E=>E in n&&typeof n[E]=="number"?n[E]:void 0,c=f("min")??0,y=f("max")??100,p=typeof r.options?.step=="number"&&r.options.step>0?r.options.step:1,k=n.type==="integer"?0:n.type==="float"&&n.digits?n.digits[1]:Math.max(0,-Math.floor(Math.log10(p))),g=E=>pt(E,k,s),m=l("input",{id:i,type:"range",class:"fd-slider-input",min:String(c),max:String(y),step:String(p)}),b=l("output",{class:"fd-slider-value",for:i,"aria-hidden":"true"}),h=[r.options?.startLabel,r.options?.endLabel].map(E=>typeof E=="string"?E:""),v=(E,w)=>l("span",{class:w?"fd-slider-last":void 0},g(E),...h[w]?[l("span",{class:"fd-slider-word"},h[w])]:[]),S=l("div",{class:"fd-slider-ends","aria-hidden":"true"},v(c,0),v(y,1)),x=sn(o,d,()=>{e.setValue(t,null),m.focus()},r),F=l("div",{class:"fd-slider"},l("div",{class:"fd-slider-track"},m,b),S,x.button);return h.some(Boolean)&&m.setAttribute("aria-description",h.filter(Boolean).join(" \u2026 ")),m.addEventListener("input",()=>e.setValue(t,Number(m.value))),{element:F,focus:()=>m.focus(),update(E){let w=typeof E.value=="number"?E.value:null;F.classList.toggle("fd-slider-empty",w===null);let A=String(w??(c+y)/2);m.value!==A&&(m.value=A),b.textContent=w===null?"\u2013":g(w),m.setAttribute("aria-valuetext",w===null?d.notAnswered:g(w)),m.disabled=E.readonly,x.allow(E),x.show(w!==null),tt(m,E)}}};function Pi(e,t,n){let r=i=>e.some(o=>o.exclusive&&o.value===i);return r(n)?[n]:[...t.filter(i=>!r(i)),n]}function Oi(e,t,n){let r=n.validate?.find(o=>o.atMost!==void 0&&(o.when??!0)===!0&&o.level!=="warning")?.atMost,i=r?e("span",{class:"fd-choice-limit",role:"status"}):null;return{element:i,full(o){let a=!!r&&o>=r;return i&&ft(i,a?ze(t.upTo,{n:r}):""),a}}}function Vi(e,t){let n=t.options?.columns;n==="row"?e.classList.add("fd-choices-row"):typeof n=="number"&&n>=1&&(e.classList.add("fd-choices-columns"),e.style.setProperty("--fd-choice-columns",String(Math.min(4,Math.round(n)))))}var Ed=e=>Fd(e,!1),Rd=e=>Fd(e,!0);function Fd({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s},d){let l=We(a,s),f=Te(o),c=n.type==="selection"?n.options:[],y=n.type==="selection"&&n.ownAnswers===!0&&!d,p=`${i}-list`,k=f("input",{id:i,type:"text",class:"fd-input fd-combo-input",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":p,autocomplete:"off",placeholder:r.placeholder||l.search}),g=f("ul",{id:p,class:"fd-listbox",role:"listbox",hidden:""}),m=f("ul",{class:"fd-chips"}),b=f("div",{class:"fd-combo"},k,g),h=mi(k,g),v=d?f("div",{class:"fd-choice-search"},b):f("div",{class:"fd-tags fd-choice-tags"},m,b),S=()=>e.getState().values[t],x=()=>Array.isArray(S())?S():[],F=W=>e.setValue(t,W),E=W=>c.find(z=>z.value===W)?.label??(W==null?"":String(W)),w=[],A=-1,R=!1;function I(){g.replaceChildren(...w.map((W,z)=>{let j=f("li",{id:`${p}-${z}`,role:"option",class:`fd-option${z===A?" fd-active":""}`,"aria-selected":String(z===A)},W.label);return j.addEventListener("mousedown",V=>V.preventDefault()),j.addEventListener("click",()=>H(W)),j})),w.length||g.append(f("li",{class:"fd-empty"},l.noResults)),He(k,"aria-activedescendant",A>=0?`${p}-${A}`:null)}function M(){let W=k.value.trim(),z=d&&W===E(S())?"":W.toLowerCase(),j=new Set(x());w=c.filter(V=>!j.has(V.value)&&V.label.toLowerCase().includes(z)),y&&z&&!j.has(W)&&!c.some(V=>V.label.toLowerCase()===z)&&w.push({value:W,label:ze(l.createNamed,{name:W})}),A=-1,I(),h.show(),k.setAttribute("aria-expanded","true")}function P(){h.hide(),A=-1,k.setAttribute("aria-expanded","false"),k.removeAttribute("aria-activedescendant")}function H(W){if(d)return k.value=W.label,F(W.value),P();k.value="",F(Pi(c,x(),W.value)),o.activeElement===k?M():P()}d||k.addEventListener("focus",()=>!R&&M()),k.addEventListener("click",()=>!R&&g.hidden&&M()),k.addEventListener("input",()=>!R&&M()),k.addEventListener("blur",()=>{P(),d&&!R&&(k.value.trim()?k.value=E(S()):F(null))}),k.addEventListener("keydown",W=>{if(!R)switch(W.key){case"ArrowDown":case"ArrowUp":{if(W.preventDefault(),g.hidden)return M();if(!w.length)return;let z=W.key==="ArrowDown";A=A===-1?z?0:w.length-1:(A+(z?1:-1)+w.length)%w.length,I(),g.children[A]?.scrollIntoView?.({block:"nearest"});return}case"Enter":{let z=w[A]??(k.value.trim()?w[0]:void 0);if(g.hidden||!z)return;W.preventDefault(),H(z);return}case"Escape":g.hidden||W.preventDefault(),P();return;case"Backspace":!d&&k.value===""&&x().length&&F(x().slice(0,-1));return}});let D="";return{element:v,focus:()=>k.focus(),update(W){if(R=W.readonly,R&&P(),tt(k,W),He(k,"aria-required",String(W.required)),d){k.readOnly=R,o.activeElement!==k&&(k.value=E(W.value));return}let z=Array.isArray(W.value)?W.value:[];k.hidden=R;let j=JSON.stringify([R,z]);j!==D&&(D=j,m.replaceChildren(...z.map(V=>{let B=E(V),$=f("li",{class:"fd-chip"},f("span",{class:"fd-chip-label"},B));if(!R){let Q=f("button",{type:"button",class:"fd-chip-remove","aria-label":ze(l.remove,{name:B})},"\xD7");Q.addEventListener("click",()=>F(x().filter(X=>X!==V))),$.append(Q)}return $})),g.hidden||M())}}}var Rf='<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M21 16l-5-5-9 9"/></svg>',Ad=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=n.type==="selection"&&n.multiple===!0,c=n.type==="selection"?n.options:[],y=dn(c,e,t,r),p=r.options??{},k=p.showLabels===!1,g=l("div",{id:i,class:`fd-image-choices${k?" fd-image-choices-bare":""}`,role:f?"group":"radiogroup","data-size":p.imageSize,"data-fit":p.imageFit});Vi(g,r);let m=f?Oi(l,d,r):null,b=y.map(F=>{let E=F.image?l("img",{src:F.image,alt:F.alt??"",loading:"lazy",draggable:"false"}):l("span",{class:"fd-image-card-blank"});F.image||(E.innerHTML=Rf);let w=l("button",{type:"button",class:"fd-image-card",role:f?"checkbox":"radio","aria-checked":"false","aria-label":k?F.label:void 0},l("span",{class:"fd-image-card-picture"},E),l("span",{class:"fd-image-card-words"},F.label));return w.addEventListener("click",()=>v(F)),g.append(w),w}),h=()=>e.getState().values[t];function v(F){if(!f)return e.setValue(t,F.value);let E=Array.isArray(h())?h():[],w=new Set(E.includes(F.value)?E.filter(A=>A!==F.value):Pi(c,E,F.value));e.setValue(t,c.filter(A=>w.has(A.value)).map(A=>A.value))}let S=!1;f||g.addEventListener("keydown",F=>{if(S)return;let E=b.indexOf(F.target);if(E===-1)return;let w=Wt(g),A={ArrowDown:1,ArrowUp:-1,ArrowRight:w?-1:1,ArrowLeft:w?1:-1},R=F.key==="Home"?0:F.key==="End"?b.length-1:F.key in A?(E+A[F.key]+b.length)%b.length:-1;R!==-1&&(F.preventDefault(),v(y[R]),b[R].focus())});let x=f?null:sn(o,d,()=>{e.setValue(t,null),b[0]?.focus()},r);return m?.element&&g.append(m.element),{element:x?l("div",{class:"fd-choices-box"},g,x.button):g,focus:()=>(b.find(F=>F.getAttribute("aria-checked")==="true")??b[0])?.focus(),update(F){S=F.readonly;let E=new Set(Array.isArray(F.value)?F.value:[F.value]),w=f?-1:Math.max(0,y.findIndex(R=>E.has(R.value))),A=!!m?.full(Array.isArray(F.value)?F.value.length:0);b.forEach((R,I)=>{let M=E.has(y[I].value);R.setAttribute("aria-checked",String(M)),R.tabIndex=f||I===w?0:-1,R.disabled=S||A&&!M&&!y[I].exclusive}),x?.allow(F),x?.show(y.some(R=>E.has(R.value))),tt(g,F)}}};var Ff=4,$d=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=dn(n.type==="selection"?n.options:[],e,t,r),c=l("ol",{class:"fd-rank-list"}),y=gi(l),p=r.options?.top,k=typeof p=="number"&&p>=1&&p<f.length?Math.floor(p):0,g=l("div",{class:"fd-rank-pool"}),m=l("button",{type:"button",class:"fd-button fd-rank-keep"},d.keepOrder);m.addEventListener("click",()=>e.setValue(t,S.map(M=>M.option.value)));let b=l("div",{id:i,class:"fd-ranking",role:"group"},...k?[l("div",{class:"fd-choice-limit"},ze(d.upTo,{n:k})),g,c]:[c,m],y.element),h=f.map(M=>{let P=M.label,H=l("span",{class:"fd-rank-place","aria-hidden":"true"}),D=l("button",{type:"button",class:"fd-rank-move fd-rank-up","aria-label":ze(d.moveUp,{label:P})},"\u2191"),W=l("button",{type:"button",class:"fd-rank-move fd-rank-down","aria-label":ze(d.moveDown,{label:P})},"\u2193"),z=l("span",{class:"fd-rank-grip","aria-hidden":"true"}),j=l("span",{class:"fd-rank-tools"},D,W),V=l("li",{class:"fd-rank-item","data-value":String(M.value)},z,H,l("span",{class:"fd-rank-words"},P),j),B={option:M,element:V,place:H,up:D,down:W};if(k){let $=l("button",{type:"button",class:"fd-rank-pick"},P);$.addEventListener("click",()=>!v&&S.length<k&&E([...S,B],B));let Q=l("button",{type:"button",class:"fd-rank-move fd-rank-out","aria-label":ze(d.remove,{name:P})},"\xD7");Q.addEventListener("click",()=>{y.say(ze(d.removed,{name:P})),e.setValue(t,S.filter(X=>X!==B).map(X=>X.option.value))}),j.append(Q),g.append($),B.pick=$}return D.addEventListener("click",()=>w(B,-1,"up")),W.addEventListener("click",()=>w(B,1,"down")),V.addEventListener("pointerdown",$=>R(B,$)),B}),v=!1,S=[...h],x=null;function F(M){for(S=M,M.forEach((P,H)=>{c.children[H]!==P.element&&c.insertBefore(P.element,c.children[H]??null),P.place.textContent=String(H+1),P.up.disabled=H===0,P.down.disabled=H===M.length-1});c.children.length>M.length;)c.lastElementChild?.remove()}function E(M,P){y.say(ze(d.movedTo,{label:P.option.label,n:M.indexOf(P)+1,total:M.length})),e.setValue(t,M.map(H=>H.option.value))}function w(M,P,H){let D=S.indexOf(M),W=D+P;if(v||W<0||W>=S.length)return;let z=[...S];z.splice(D,1),z.splice(W,0,M),x=M.element.contains(o.activeElement)?{item:M,which:H==="up"&&W===0||H==="down"&&W===z.length-1?H==="up"?"down":"up":H}:null,E(z,M),A()}function A(){if(!x)return;let{item:M,which:P}=x;x=null,M[P].focus()}c.addEventListener("keydown",M=>{if(v||!M.altKey||M.key!=="ArrowUp"&&M.key!=="ArrowDown")return;let P=h.find(H=>H.element.contains(M.target));P&&(M.preventDefault(),w(P,M.key==="ArrowUp"?-1:1,M.key==="ArrowUp"?"up":"down"))});function R(M,P){if(v||P.button!==0||P.target.closest("button")||P.pointerType==="touch"&&!P.target.closest(".fd-rank-grip"))return;let H=P.clientY,D=[...S],W=!1;M.element.setPointerCapture?.(P.pointerId);let z=V=>{if(!W&&Math.abs(V.clientY-H)<Ff)return;W||(W=!0,M.element.classList.add("fd-rank-lifted")),V.preventDefault();let B=S.filter(Q=>Q!==M),$=B.filter(Q=>{let X=Q.element.getBoundingClientRect();return X.top+X.height/2<V.clientY}).length;S.indexOf(M)!==$&&F([...B.slice(0,$),M,...B.slice($)])},j=()=>{M.element.removeEventListener("pointermove",z),M.element.removeEventListener("pointerup",j),M.element.removeEventListener("pointercancel",j),M.element.classList.remove("fd-rank-lifted"),S.some((V,B)=>V!==D[B])&&E(S,M)};M.element.addEventListener("pointermove",z),M.element.addEventListener("pointerup",j),M.element.addEventListener("pointercancel",j)}function I(M){let P=(Array.isArray(M)?M:[]).map(H=>h.find(D=>D.option.value===H)).filter(H=>!!H);return k?P.slice(0,k):Array.isArray(M)?[...new Set([...P,...S])]:S}return F(k?[]:S),{element:b,focus:()=>(h.find(M=>M.pick&&!M.pick.hidden&&!M.pick.disabled)?.pick??(S[0]?.down.disabled?S[0]?.up:S[0]?.down))?.focus(),update(M){v=M.readonly,b.classList.toggle("fd-ranking-locked",v);let P=I(M.value);(P.length!==S.length||P.some((H,D)=>H!==S[D])||!k&&!c.children.length)&&F(P);for(let H of h)H.up.hidden=H.down.hidden=v,H.pick&&(H.pick.hidden=S.includes(H),H.pick.disabled=v||S.length>=k,H.element.querySelector(".fd-rank-out").hidden=v);m.hidden=v||Array.isArray(M.value)&&M.value.length>0,A(),tt(b,M)}}};var Td={street:["addressStreet","street-address"],line2:["addressLine2","address-line2"],city:["addressCity","address-level2"],region:["addressRegion","address-level1"],postcode:["addressPostcode","postal-code"],country:["addressCountry","country"]},Af=e=>typeof e=="string"&&e in Td,$f="AC AN BU CP CQ CS DD DG DY EA EU EZ FX HV IC NH QO RH SU TA TP UK UN VD XA XB YD YU ZR ZZ",Yo={};function Xo(e){if(!Yo[e]){let t=new Intl.DisplayNames([e],{type:"region",fallback:"none"}),n=[];for(let r=65;r<91;r++)for(let i=65;i<91;i++){let o=String.fromCharCode(r,i),a=!$f.includes(o)&&t.of(o);a&&n.push([o,a])}Yo[e]=n.sort((r,i)=>r[1].localeCompare(i[1],e))}return Yo[e]}var Md=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=We(o,a),d=Te(i),l=n.options??{},f=l.parts,c=Array.isArray(f)?f.filter(Af):["street","city","postcode","country"],y=Array.isArray(l.requiredParts)?l.requiredParts:[],p=typeof l.country=="string"?l.country:"",k=d("div",{id:r,class:"fd-address",role:"group"}),g=(b,h)=>{let v=e.getState().values[t],S=v&&typeof v=="object"&&!Array.isArray(v)?{...v}:{};S[b]=h,p&&c.includes("country")&&S.country===void 0&&(S.country=p);let x=Object.fromEntries(Object.entries(S).filter(([,E])=>typeof E!="string"||E.trim()!=="")),F=Object.keys(x);e.setValue(t,F.length&&(b==="country"||F.join()!=="country"||x.country!==p)?x:null)},m=c.map(b=>{let[h,v]=Td[b],S={id:`${r}-${b}`,class:"fd-input","data-part":b,autocomplete:b==="street"&&c.includes("line2")?"address-line1":v,"aria-required":y.includes(b)?"true":void 0},x=b==="country"?d("select",S,d("option",{value:""}),...Xo(a).map(([F,E])=>d("option",{value:F},E))):d("input",{type:"text",...S});return x.addEventListener(b==="country"?"change":"input",()=>g(b,x.value)),b==="country"&&x.classList.add("fd-select"),k.append(d("div",{class:`fd-address-part fd-address-${b}${y.includes(b)?" fd-required":""}`},d("label",{class:"fd-address-label",for:x.id},s[h]),x)),{part:b,input:x}});return{element:k,focus:()=>m[0]?.input.focus(),update(b){let h=b.value&&typeof b.value=="object"&&!Array.isArray(b.value)?b.value:{};for(let{part:v,input:S}of m){let x=typeof h[v]=="string"?h[v]:v==="country"&&h.country===void 0?p:"";S instanceof HTMLSelectElement?(x&&![...S.options].some(F=>F.value===x)&&S.append(d("option",{value:x},x)),S.disabled=b.readonly):S.readOnly=b.readonly,i.activeElement!==S&&S.value!==x&&(S.value=x),S.setAttribute("aria-invalid",String(b.invalid&&(!y.length||y.includes(v)&&!x.trim())))}tt(k,b)}}};var Nd=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0,Cd=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s,dialogs:d,widgets:l})=>{let f=We(a,s),c=Te(o),y=n,p=r.options??{},k=Nd(p.min)??0,g=Nd(p.max)??1/0,m=typeof p.itemLabel=="string"&&p.itemLabel.trim()?p.itemLabel.trim():null,b=D=>m?`${m} ${D}`:ze(f.entry,{n:D}),h=(r.columns??Object.keys(y.fields)).filter(D=>y.fields[D]&&y.fields[D].type!=="one2many"&&D!==y.sequenceField&&D!==y.lineKinds?.field),v=c("div",{class:"fd-repeat-list"}),S=c("button",{type:"button",class:"fd-button fd-repeat-add"},typeof p.addLabel=="string"&&p.addLabel?p.addLabel:f.addAnother),x=gi(c),F=c("div",{id:i,class:"fd-repeat",role:"group"},v,S,x.element),E=new Map,w=()=>e.getState().values[t]??[],A=!1,R=null;for(let D=w().length;D<k;D++)e.addLine(t);S.addEventListener("click",()=>{if(A||w().length>=g)return;let D=e.addLine(t);R=()=>E.get(D)?.fields[0]?.widget.focus(),H()});function I(D){let W=`${i}-${D.key}-title`,z=c("span",{id:W,class:"fd-repeat-title"}),j=c("button",{type:"button",class:"fd-repeat-remove"},"\xD7"),V=(te,Ve,Ie)=>{let Ee=c("button",{type:"button",class:"fd-repeat-tool"},te);return Ee.addEventListener("click",Ie),[Ee,Ve]},B=()=>w().findIndex(te=>te.key===D.key),$=[V("\u2191","moveUp",()=>M(D.key,B()-1)),V("\u2193","moveDown",()=>M(D.key,B()+1)),V("\u29C9","copy",()=>P(D.key))],Q=d&&(r.lineOpens||r.lineForm)?c("button",{type:"button",class:"fd-repeat-tool fd-line-open","aria-label":f.openLine,title:f.openLine},"\u2197"):null;Q?.addEventListener("click",()=>{let te=w().find(Ve=>Ve.key===D.key);te&&d&&Ei(e,t,r,te,d,A)});let X=c("div",{class:"fd-repeat-fields"}),J=c("div",{class:"fd-repeat-card",role:"group","aria-labelledby":W,"data-line":D.key},c("div",{class:"fd-repeat-head"},z,...$.map(([te])=>te),...Q?[Q]:[],j),X),_=h.map(te=>{let Ve=y.fields[te],Ie=`${i}-${D.key}-${te}`,Ee={type:"field",id:`${r.id}.${D.key}.${te}`,field:te},Me=Ot({form:Li(e,t,D.key),name:te,field:Ve,node:Ee,id:Ie,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ie=c("label",{class:"fd-repeat-label",for:Ie},Ve.label);["INPUT","SELECT","TEXTAREA"].includes(Me.element.tagName)||ie.addEventListener("click",()=>Me.focus());let ge=c("div",{class:"fd-cell-error",hidden:""});return X.append(c("div",{class:"fd-repeat-field"},ie,Me.element,ge)),{name:te,def:Ve,widget:Me,error:ge}});return j.addEventListener("click",()=>{let te=w(),Ve=te.findIndex(ie=>ie.key===D.key);if(A||Ve===-1||te.length<=k)return;let Ie=z.textContent??"";e.removeLine(t,D.key),x.say(ze(f.removed,{name:Ie}));let Ee=w(),Me=Ee[Math.min(Ve,Ee.length-1)];R=()=>Me?E.get(Me.key)?.fields[0]?.widget.focus():S.focus(),H()}),{element:J,title:z,remove:j,tools:$,fields:_}}function M(D,W){let z=w().findIndex(B=>B.key===D);if(A||W<0||W>=w().length||W===z)return;let j=E.get(D)?.title.textContent??"";er(e,t,y,D,W);let V=z>W&&W>0||W===w().length-1?0:1;E.get(D)?.tools[V][0].focus(),x.say(ze(f.movedTo,{label:j,n:W+1,total:w().length}))}function P(D){let W=w(),z=W.findIndex(B=>B.key===D);if(A||z<0||W.length>=g)return;let j={...W[z].values};y.sequenceField&&delete j[y.sequenceField];let V=e.addLine(t,j);er(e,t,y,V,z+1),E.get(V)?.fields[0]?.widget.focus()}function H(){let D=R;R=null,D?.()}return{element:F,focus:()=>([...E.values()].find(D=>D.element===v.firstElementChild)?.fields[0]?.widget??S).focus(),update(D){A=D.readonly;let W=D.value??[],z=e.getState().errors,j=new Set(W.map(V=>V.key));for(let[V,B]of E)if(!j.has(V)){B.element.remove();for(let $ of B.fields)$.widget.destroy?.();E.delete(V)}W.forEach((V,B)=>{let $=E.get(V.key);$||E.set(V.key,$=I(V)),v.children[B]!==$.element&&v.insertBefore($.element,v.children[B]??null),$.title.textContent=b(B+1),$.remove.setAttribute("aria-label",ze(f.remove,{name:$.title.textContent})),$.remove.hidden=A||W.length<=k||r.lineDelete!==void 0&&!e.lineState(r.id,V.key).deletable;for(let[Q,X]of $.tools)Q.setAttribute("aria-label",ze(f[X],{label:$.title.textContent,name:$.title.textContent})),Q.hidden=A||(X==="moveUp"?B===0:X==="moveDown"?B===W.length-1:W.length>=g);for(let Q of $.fields){let X=z[`${t}.${V.key}.${Q.name}`];Q.error.hidden=!X,Q.error.textContent=X??"",Q.widget.update({value:V.values[Q.name],values:V.values,parent:D.values,readonly:A||Q.def.readonly===!0,required:Q.def.required===!0,invalid:!!X})}}),S.hidden=A||W.length>=g,tt(F,D)}}};function Zo(e,{form:t,name:n,field:r,document:i,labels:o,locale:a},s){let d=r.type==="char"||r.type==="text"?r.size:void 0;if(!d||t.page.fields[n]!==r)return e;let l=Te(i),f=l("div",{class:"fd-count","aria-hidden":"true"}),c=l("div",{class:"fd-sr-only","aria-live":"polite"}),y;return{...e,element:l("div",{class:"fd-counted"},e.element,f,c),update(p){e.update(p);let k=s.value.length;ft(f,`${k} / ${d}`),f.classList.toggle("fd-count-near",k>=d*.9),Mt(f,p.readonly),i.activeElement===s&&(clearTimeout(y),y=setTimeout(()=>ft(c,ze(We(o,a).charactersLeft,{n:d-k})),700))}}}function Pd(e,t){let n=t.options?.rows;return typeof n=="number"&&(e.rows=n),t.options?.autoGrow===!1?()=>{}:()=>{e.style.height="",e.scrollHeight&&(e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)}}function Ii(e,t,n){let r=n.options??{},i=t.type==="char";(i?[r.min,r.max]:"min"in t?[t.min,t.max]:[]).forEach((a,s)=>{typeof a=="string"&&(e[s?"max":"min"]=i?a:yn(a)+(t.type==="datetime"?s?"T23:59":"T00:00":""))}),typeof r.step=="number"&&(e.step=String(r.step*60))}function Od(e,t){let{form:n,name:r,document:i}=t,o=We(t.labels,t.locale),a=i.createElement("div"),s=i.createElement("div"),d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=o.choicesFailed,d.onclick=()=>n.loadChoices(r),s.setAttribute("role","status"),a.style.cssText="display:grid;gap:4px";let l=new Map,f,c=null,y=p=>{f?.destroy?.(),f=e({...t,field:{...t.field,options:p}}),f.element.getAttribute("role")&&f.element.setAttribute("aria-labelledby",`${t.id}-label`),a.replaceChildren(f.element,s,d)};return y([]),n.getState().choices[r]||n.loadChoices(r),{element:a,focus:()=>f.focus(),destroy:()=>f.destroy?.(),update(p){let k=n.getState().choices[r];if(k?.options&&k.options!==c){c=k.options;for(let m of c)l.set(m.value,m.label);y(c)}f.update(p);let g=c&&!t.field.other?[p.value].flat().filter(m=>m!=null&&!c?.some(b=>b.value===m)):[];s.className=k?.loading?"fd-help":"fd-warning",s.textContent=k?.loading?o.loadingChoices:g.length?Ye(o.notOffered,{name:g.map(m=>l.get(m)??String(m)).join(", ")}):"",s.hidden=!s.textContent,d.hidden=!k?.error}}}var Vd=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a})=>{let s=We(o,a),d=Te(i),l=d("div",{id:r,class:"fd-points fd-yes-no",role:"radiogroup"}),f=!1,c=[!0,!1].map(p=>{let k=n.options?.[p?"yesLabel":"noLabel"],g=d("button",{type:"button",role:"radio"},typeof k=="string"&&k?k:p?s.yes:s.no);return g.addEventListener("click",()=>e.setValue(t,p)),l.append(g),g});l.addEventListener("keydown",p=>{let k=c.indexOf(p.target);f||k===-1||!p.key.startsWith("Arrow")||(p.preventDefault(),e.setValue(t,k===1),c[1-k].focus())});let y=sn(i,s,()=>{e.setValue(t,null),c[0].focus()},n);return{element:d("div",{class:"fd-choices-box"},l,y.button),focus:()=>(c.find(p=>p.getAttribute("aria-checked")==="true")??c[0]).focus(),update(p){f=p.readonly;let k=p.value===!0?0:p.value===!1?1:-1;c.forEach((g,m)=>{He(g,"aria-checked",String(m===k)),g.classList.toggle("fd-on",m===k),g.tabIndex=m===Math.max(0,k)?0:-1,g.disabled=f}),He(l,"aria-required",String(p.required)),y.allow(p),y.show(k!==-1),tt(l,p)}}};var Tf=new Set(["info","success","warning","danger","muted"]),Di=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options?.tones??{},a=r.createElement("span");return a.id=n,a.className="fd-value-badge",a.hidden=!0,{element:a,focus:()=>{},update({value:s,values:d}){let l=At(e,s,d,i);a.textContent!==l&&(a.textContent=l),a.hidden=l==="";let f=s!==null&&typeof s=="object"&&"id"in s?String(s.id):String(s),c=o[f];typeof c=="string"&&Tf.has(c)?a.dataset.tone=c:delete a.dataset.tone}}};var Id=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s,dialogs:d})=>{let l=n,f=Te(o),c=l.fields??{},y=(r.columns??[]).filter(W=>c[W]),p=W=>typeof r.options?.[W]=="string"&&r.options[W].trim()?r.options[W]:null,k=!!d&&d.canOpen(l.relation),g=f("tr",{},...y.map(W=>f("th",{scope:"col","data-column":W},c[W].label)),f("th",{class:"fd-lines-tools"})),m=f("tbody"),b=f("table",{class:"fd-lines-table fd-links-table"},f("thead",{},g),m),h=f("button",{type:"button",class:"fd-button fd-button-link fd-lines-add","data-add":"line"},`+ ${p("addLabel")??a.addLine}`),v=f("div",{class:"fd-lines-adds"},h),S=p("emptyLabel"),x=S?f("div",{class:"fd-help fd-lines-empty"},S):null,F=f("div",{class:"fd-lines fd-links",id:i,role:"group"},f("div",{class:"fd-lines-scroll"},b),...x?[x]:[],v),E=new Map,w=new Set,A=!1,R=[],I=()=>e.getState().values[t]??[];function M(W,z=!1){let j=W.map(V=>V.id).filter(V=>z||!E.has(String(V))&&!w.has(String(V)));if(j.length){for(let V of j)w.add(String(V));e.linkedValues(t,j,y).then(V=>{for(let{id:B,values:$}of V)E.set(String(B),$);for(let B of j)w.delete(String(B));D()},()=>j.forEach(V=>w.delete(String(V))))}}h.addEventListener("click",async()=>{if(!d||A)return;let W=await d.searchMore({title:l.label,search:(z,j)=>e.search(t,z,j)});!W||I().some(z=>z.id===W.id)||e.setValue(t,[...I(),{id:W.id,label:W.label}])});async function P(W){let z=await d?.openRecord(l.relation,{recordId:W.id,title:W.label});z&&(z.label!==W.label&&e.setValue(t,I().map(j=>j.id===W.id?{id:j.id,label:z.label}:j)),M([W],!0))}function H(W){let z=E.get(String(W.id)),j=y.map((B,$)=>{let Q=z?At(c[B],z[B]??null,z,s):$===0?W.label:"";return f("td",{"data-column":B},f("span",{class:"fd-value-text"},Q))}),V=f("td",{class:"fd-lines-tools"});if(k){let B=f("button",{type:"button",class:"fd-line-open","aria-label":ze(a.openNamed,{name:W.label}),title:a.openLine},"\u2197");B.addEventListener("click",()=>{P(W)}),V.append(B)}if(!A){let B=f("button",{type:"button",class:"fd-line-delete","aria-label":ze(a.remove,{name:W.label})},"\xD7");B.addEventListener("click",()=>e.setValue(t,I().filter($=>$.id!==W.id))),V.append(B)}return f("tr",{"data-record":String(W.id)},...j,V)}function D(){let W=o.activeElement,z=F.contains(W)?W.closest("tr")?.dataset.record:void 0;m.replaceChildren(...R.map(H)),z&&m.querySelector(`tr[data-record="${CSS.escape(z)}"] button`)?.focus()}return{element:F,focus:()=>(m.querySelector("button")??h).focus(),update(W){let z=W.value??[],j=z!==R||W.readonly!==A;A=W.readonly,R=z,v.hidden=A||!d,x&&(x.hidden=z.length>0),He(F,"aria-invalid",String(W.invalid)),He(F,"aria-describedby",W.describedBy||null),j&&D(),M(z)}}};var Qo=({form:e,name:t,field:n,id:r,document:i})=>{let o=Te(i),a=n.type==="selection"?n.options.map(c=>({value:c.value,label:c.label})):[{value:!1,label:""},{value:!0,label:n.label}],s=o("div",{id:r,class:"fd-priority",role:"radiogroup"}),d=a.slice(1).map((c,y)=>{let p=o("button",{type:"button",role:"radio",class:"fd-priority-star","aria-label":c.label,title:c.label,"data-value":String(c.value)},"\u2605");return p.addEventListener("click",()=>e.setValue(t,l(e.getState().values[t])===y+1?a[0].value:c.value)),s.append(p),p}),l=c=>Math.max(0,a.findIndex(y=>y.value===c)),f=!1;return s.addEventListener("keydown",c=>{if(f)return;let y=Wt(s)?"ArrowLeft":"ArrowRight",p=Wt(s)?"ArrowRight":"ArrowLeft",k=c.key===y||c.key==="ArrowUp"?1:c.key===p||c.key==="ArrowDown"?-1:0;if(!k)return;c.preventDefault();let g=Math.min(a.length-1,Math.max(0,l(e.getState().values[t])+k));e.setValue(t,a[g].value),d[Math.max(0,g-1)]?.focus()}),{element:s,focus:()=>(d.find(c=>c.tabIndex===0)??d[0])?.focus(),update(c){f=c.readonly;let y=l(c.value);d.forEach((p,k)=>{He(p,"aria-checked",String(y===k+1)),p.classList.toggle("fd-on",k<y);let g=y===k+1||y===0&&k===0?0:-1;p.tabIndex!==g&&(p.tabIndex=g),p.disabled!==c.readonly&&(p.disabled=c.readonly)}),tt(s,c)}}};function nr(e,t,n,r){let i=e.ownerDocument,o=d=>{!n.contains(d.target)&&!t.contains(d.target)&&s()};function a(){n.hidden=!1,t.setAttribute("aria-expanded","true");let d=e.closest(".fd-form");if(d){d.append(n),Object.assign(n.style,{position:"absolute",top:"0px",left:"0px",right:"auto"});let[l,f,c]=[t.getBoundingClientRect(),n.getBoundingClientRect(),n.offsetWidth],y=getComputedStyle(e).direction==="rtl",p=i.documentElement.clientWidth||c,k=Math.max(8,Math.min(y?l.right-c:l.left,p-c-8));Object.assign(n.style,{top:`${l.bottom-f.top+4}px`,left:`${k-f.left}px`})}i.addEventListener("pointerdown",o,!0)}function s(){if(!n.hidden){if(n.hidden=!0,t.setAttribute("aria-expanded","false"),n.parentElement!==e){e.append(n);for(let d of["position","top","left","right"])n.style.removeProperty(d)}i.removeEventListener("pointerdown",o,!0),r()}}return{open:a,close:s,isOpen:()=>!n.hidden}}var Mf={normal:"muted",grey:"muted",blocked:"danger",red:"danger",done:"success",green:"success",waiting:"warning"},Dd=["muted","danger","success","warning","info"],Nf=new Set(["info","success","warning","danger","muted"]),Wd=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=Te(o),s=n.type==="selection"?n.options:[],d=r.options?.tones??{},l=(F,E)=>{let w=d[String(F)];return typeof w=="string"&&Nf.has(w)?w:Mf[String(F)]??Dd[E%Dd.length]},f=()=>a("span",{class:"fd-dot","aria-hidden":"true"}),c=a("button",{type:"button",id:i,class:"fd-dot-button","aria-haspopup":"menu","aria-expanded":"false","aria-controls":`${i}-menu`},f()),y=a("span",{class:"fd-dot-label","data-quiet-words":r.options?.label===!0?void 0:""}),p=s.map((F,E)=>{let w=a("div",{role:"menuitemradio",class:"fd-dot-item",tabindex:"-1","data-tone":l(F.value,E)},f(),F.label);return w.addEventListener("click",()=>x(E)),w}),k=a("div",{id:`${i}-menu`,role:"menu",class:"fd-dot-menu","aria-label":n.label,hidden:""},...p),g=a("span",{class:"fd-dot-box"},c,y,k),m=()=>s.findIndex(F=>F.value===e.getState().values[t]),b=!1,h=nr(g,c,k,()=>{b&&c.focus(),b=!1});function v(F=Math.max(0,m())){h.open(),p[F]?.focus()}function S(F){b=F,h.close()}function x(F){e.setValue(t,s[F].value),S(!0)}return c.addEventListener("click",()=>k.hidden?v():S(!0)),c.addEventListener("keydown",F=>{F.key!=="ArrowDown"&&F.key!=="ArrowUp"&&F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),v(F.key==="ArrowUp"?m()<0?p.length-1:m():void 0))}),k.addEventListener("keydown",F=>{let E=p.indexOf(o.activeElement),w={ArrowDown:E+1,ArrowUp:E-1,Home:0,End:p.length-1}[F.key];w!==void 0?(F.preventDefault(),p[(w+p.length)%p.length]?.focus()):F.key==="Enter"||F.key===" "?(F.preventDefault(),E>=0&&x(E)):F.key==="Escape"?(F.preventDefault(),F.stopPropagation(),S(!0)):F.key==="Tab"&&S(!0)}),{element:g,focus:()=>c.focus(),destroy:()=>S(!1),update(F){let E=s.findIndex(A=>A.value===F.value),w=E<0?"":s[E].label;He(c,"aria-label",w?`${n.label}: ${w}`:n.label),He(c,"title",w||null),He(c,"data-tone",E<0?"muted":l(F.value,E)),ft(y,w),p.forEach((A,R)=>He(A,"aria-checked",String(R===E))),c.disabled!==F.readonly&&(c.disabled=F.readonly),F.readonly&&S(!1),tt(c,F)}}};var Wi=["transparent","#f06050","#f4a460","#f7cd1f","#6cc1ed","#814968","#eb7e7f","#2c8397","#475577","#d6145f","#30c381","#9365b8"],Cf=({form:e,name:t,field:n,id:r,document:i,labels:o,locale:a})=>{let s=Te(i),d=We(o,a).colourNames.split("|"),l=s("button",{type:"button",id:r,class:"fd-colour-button","aria-haspopup":"true","aria-expanded":"false","aria-controls":`${r}-palette`}),f=Wi.map((h,v)=>{let S=s("button",{type:"button",role:"radio",class:"fd-colour","aria-label":d[v]??String(v),title:d[v]??String(v),tabindex:"-1","data-colour":String(v)});return S.style.setProperty("--fd-swatch",h),S.addEventListener("click",()=>b(v)),S}),c=s("div",{id:`${r}-palette`,role:"radiogroup",class:"fd-colour-palette","aria-label":n.label,hidden:""},...f),y=s("span",{class:"fd-colour-box"},l,c),p=!1,k=nr(y,l,c,()=>{p&&l.focus(),p=!1}),g=()=>{let h=e.getState().values[t];return typeof h=="number"&&h>=0&&h<Wi.length?h:0};function m(h){p=h,k.close()}function b(h){e.setValue(t,h),m(!0)}return l.addEventListener("click",()=>{if(k.isOpen())return m(!0);k.open(),f[g()].focus()}),c.addEventListener("keydown",h=>{let v=f.indexOf(i.activeElement),S=Wt(y)?"ArrowLeft":"ArrowRight",x=Wt(y)?"ArrowRight":"ArrowLeft",F=h.key===S||h.key==="ArrowDown"?v+1:h.key===x||h.key==="ArrowUp"?v-1:h.key==="Home"?0:h.key==="End"?f.length-1:null;F!==null?(h.preventDefault(),f[(F+f.length)%f.length].focus()):(h.key==="Enter"||h.key===" ")&&v>=0?(h.preventDefault(),b(v)):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),m(!0)):h.key==="Tab"&&m(!0)}),{element:y,focus:()=>l.focus(),destroy:()=>m(!1),update(h){let v=typeof h.value=="number"&&h.value>=0&&h.value<Wi.length?h.value:0;l.style.setProperty("--fd-swatch",Wi[v]),l.classList.toggle("fd-colour-none",v===0),He(l,"aria-label",`${n.label}: ${d[v]??v}`),He(l,"title",d[v]??String(v)),f.forEach((S,x)=>He(S,"aria-checked",String(x===v))),l.disabled!==h.readonly&&(l.disabled=h.readonly),h.readonly&&m(!1),tt(l,h)}}},Pf=({form:e,name:t,id:n,document:r})=>{let i=Te(r),o=i("input",{id:n,type:"color",class:"fd-colour-input"}),a=i("span",{class:"fd-colour-code",dir:"ltr"});return o.addEventListener("input",()=>e.setValue(t,o.value)),{element:i("span",{class:"fd-colour-box"},o,a),focus:()=>o.focus(),update(s){let d=typeof s.value=="string"?s.value:"",l=/^#[0-9a-f]{6}$/i.test(d)?d.toLowerCase():"#000000";o.value!==l&&(o.value=l),ft(a,d),o.disabled!==s.readonly&&(o.disabled=s.readonly),tt(o,s)}}},ea=e=>e.field.type==="char"?Pf(e):Cf(e);var ta=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Te(o),l=We(a,s),f=n.type==="text",c=f?d("textarea",{id:i,class:"fd-input fd-textarea",rows:"3"}):d("input",{id:i,type:"text",class:"fd-input",autocomplete:"off"});r.placeholder&&(c.placeholder=r.placeholder),c.addEventListener("input",()=>e.setValue(t,c.value===""?null:c.value));let y=d("button",{type:"button",class:"fd-button fd-copy-button",hidden:""},l.copyValue),p=d("span",{class:"fd-sr-only",role:"status"}),k;return y.addEventListener("click",async()=>{let g=String(e.getState().values[t]??"");if(g){try{await navigator.clipboard.writeText(g)}catch{c.select(),o.execCommand?.("copy")}ft(y,l.copied),ft(p,l.copied),clearTimeout(k),k=setTimeout(()=>{ft(y,l.copyValue),ft(p,"")},2e3)}}),{element:d("span",{class:`fd-copy${f?" fd-copy-long":""}`},c,y,p),focus:()=>c.focus(),destroy:()=>clearTimeout(k),update(g){let m=g.value===null||g.value===void 0?"":String(g.value);c.value!==m&&(c.value=m),c.readOnly!==g.readonly&&(c.readOnly=g.readonly),y.hidden=!m,tt(c,g)}}};var zi=e=>String(e).padStart(2,"0"),Xt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),ji=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate())),Hi=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Of='<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="1.5"></rect><path d="M2 6.5h12M5 1.5v3M11 1.5v3"></path></svg>',na=e=>`${e.getFullYear()}-${zi(e.getMonth()+1)}-${zi(e.getDate())}`,ra=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Te(o),l=We(a,s),f=n.type==="datetime"?"datetime":"date",c=typeof r.options?.endField=="string"?r.options.endField:null,y=c?e.page.fields[c]?.label??c:"",p=s==="en"?"en-GB":s,k=new Intl.DateTimeFormat(p,{month:"long",year:"numeric",numberingSystem:"latn"}),g=new Intl.DateTimeFormat(p,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),m=new Intl.DateTimeFormat(p,{weekday:"short"}),b=X=>{if(typeof X!="string"||!X)return"";if(f==="date")return X.slice(0,10);let J=new Date(X);return Number.isNaN(J.getTime())?"":`${na(J)}T${zi(J.getHours())}:${zi(J.getMinutes())}`},h=X=>{let J=b(X),_=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(J);return _?new Date(Number(_[1]),Number(_[2])-1,Number(_[3]),Number(_[4]??0),Number(_[5]??0)):null},v=(X,J)=>{if(f==="date")return na(X);let _=h(J);return new Date(X.getFullYear(),X.getMonth(),X.getDate(),_?.getHours()??0,_?.getMinutes()??0).toISOString()},S=(X,J,_)=>{let te=d("input",{type:f==="date"?"date":"datetime-local",class:"fd-input fd-range-input","aria-label":J,..._?{id:_}:{}});return te.addEventListener("input",()=>{if(!te.value)return e.setValue(X,null);if(f==="date")return e.setValue(X,te.value);let Ve=new Date(te.value);Number.isNaN(Ve.getTime())||e.setValue(X,Ve.toISOString())}),Dn(te,()=>M.hidden&&B()),te},x=S(t,n.label,i),F=c?S(c,y):null,E=d("button",{type:"button",class:"fd-calendar-button fd-range-button","aria-label":l.chooseDate,"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${i}-range`});E.innerHTML=Of;let w=d("button",{type:"button","aria-label":l.previousMonth},"\u2039"),A=d("button",{type:"button","aria-label":l.nextMonth},"\u203A"),R=d("span",{class:"fd-calendar-title","aria-live":"polite"}),I=d("table",{class:"fd-calendar-grid",role:"grid"}),M=d("div",{id:`${i}-range`,class:"fd-calendar fd-range-calendar",role:"dialog",hidden:""},d("div",{class:"fd-calendar-head"},w,R,A),I),P=d("div",{class:"fd-range",role:"group"},d("span",{class:"fd-range-box"},x,...F?[d("span",{class:"fd-range-arrow","aria-hidden":"true"},"\u2192"),F]:[]),E,M),H=new Date,D=null,W=null;function z(X){let J=e.getState().values;if(!c)return e.setValue(t,v(X,J[t])),$();if(!D)return D=X,H=X,j(!0);let[_,te]=X<D?[X,D]:[D,X];D=null,e.setValue(t,v(_,J[t])),e.setValue(c,v(te,J[c])),$()}function j(X){let J=e.getState().values,_=D??h(J[t]),te=D?W&&W>=D?W:null:c?h(J[c]):null,Ve=k.format(H);R.textContent=Ve,M.setAttribute("aria-label",Ve);let Ie=new Date(H.getFullYear(),H.getMonth(),1),Ee=Xt(Ie,-((Ie.getDay()+6)%7)),Me=d("tr",{},...Array.from({length:7},(ge,oe)=>d("th",{scope:"col"},m.format(Xt(Ee,oe)).replace(/\.$/,"")))),ie=d("tbody");for(let ge=Ee;ge<=new Date(H.getFullYear(),H.getMonth()+1,0);ge=Xt(ge,7)){let oe=d("tr");for(let ke=0;ke<7;ke++){let De=Xt(ge,ke),xe=d("button",{type:"button","data-day":na(De),"aria-label":g.format(De),tabindex:Hi(De,H)?"0":"-1"},String(De.getDate()));De.getMonth()!==H.getMonth()&&xe.classList.add("fd-outside");let Xe=Hi(De,_)||Hi(De,te);Xe&&xe.setAttribute("aria-selected","true"),_&&te&&De>_&&De<te&&!Xe&&xe.classList.add("fd-in-range"),Hi(De,new Date)&&xe.setAttribute("aria-current","date"),xe.addEventListener("click",()=>z(De)),xe.addEventListener("pointerenter",()=>{if(D){W=De;for(let Y of I.querySelectorAll("button[data-day]")){let ne=h(Y.dataset.day);Y.classList.toggle("fd-in-range",!!ne&&ne>D&&ne<De)}}}),xe.addEventListener("keydown",Y=>V(Y,De)),oe.append(d("td",{},xe))}ie.append(oe)}I.replaceChildren(d("thead",{},Me),ie),X&&I.querySelector('button[tabindex="0"]')?.focus()}function V(X,J){let _=Wt(P),te={ArrowLeft:()=>Xt(J,_?1:-1),ArrowRight:()=>Xt(J,_?-1:1),ArrowUp:()=>Xt(J,-7),ArrowDown:()=>Xt(J,7),PageUp:()=>ji(J,-1),PageDown:()=>ji(J,1),Home:()=>Xt(J,-((J.getDay()+6)%7)),End:()=>Xt(J,6-(J.getDay()+6)%7)};te[X.key]?(X.preventDefault(),H=te[X.key](),D&&(W=H),j(!0)):(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),z(J))}function B(){D=null,W=null,H=h(e.getState().values[t])??new Date,M.hidden=!1,E.setAttribute("aria-expanded","true"),j(!0)}function $(){M.hidden||(M.hidden=!0,D=null,E.setAttribute("aria-expanded","false"),E.focus())}E.addEventListener("click",()=>M.hidden?B():$()),w.addEventListener("click",()=>(H=ji(H,-1),j(!1))),A.addEventListener("click",()=>(H=ji(H,1),j(!1))),M.addEventListener("keydown",X=>{X.key==="Escape"&&(X.preventDefault(),X.stopPropagation(),$())});let Q=X=>{M.hidden||P.contains(X.target)||(M.hidden=!0,D=null,E.setAttribute("aria-expanded","false"))};return o.addEventListener("mousedown",Q),{element:P,focus:()=>x.focus(),destroy:()=>o.removeEventListener("mousedown",Q),update(X){for(let[J,_]of[[x,X.value],...F&&c?[[F,X.values[c]]]:[]]){let te=b(_);o.activeElement!==J&&J.value!==te&&(J.value=te),J.readOnly!==X.readonly&&(J.readOnly=X.readonly),J.classList.toggle("fd-blank",!te)}E.hidden=X.readonly,X.readonly&&(M.hidden=!0),He(P,"aria-labelledby",null),tt(x,X)}}};var ia=e=>String(e).padStart(2,"0");function Vf(e){let t=Math.max(0,Math.floor(e));return`${ia(Math.floor(t/3600))}:${ia(Math.floor(t%3600/60))}:${ia(t%60)}`}var jd=e=>{if(typeof e!="string"||!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},oa=({field:e,node:t,id:n,document:r})=>{let i=Te(r),o=e.type==="datetime",a=!o&&typeof t.options?.startField=="string"?t.options.startField:null,s=t.options?.unit==="minutes"?60:3600,d=i("span",{class:"fd-timer-time"}),l=i("span",{id:n,role:"timer",class:"fd-timer"},i("span",{class:"fd-timer-dot","aria-hidden":"true"}),d);He(l,"aria-label",e.label);let f=0,c=null,y,p=()=>ft(d,Vf(f+(c===null?0:(Date.now()-c)/1e3))),k=()=>{clearInterval(y),y=void 0};return{element:l,focus:()=>{},destroy:k,update(g){f=!o&&typeof g.value=="number"?g.value*s:0,c=o?jd(g.value):a?jd(g.values[a]):null,c!==null?l.dataset.running="true":delete l.dataset.running,p(),c===null?k():y||(y=setInterval(()=>l.isConnected?p():k(),1e3))}}};var Hd=e=>typeof e=="number"&&e>0?e:480,If=e=>/^https?:\/\//i.test(e);function Df(e){if(e.data){let t=Uint8Array.from(atob(e.data),n=>n.charCodeAt(0));return URL.createObjectURL(new Blob([t],{type:e.type||"application/pdf"}))}return e.url??""}var zd=e=>{let t=Te(e.document),n=We(e.labels,e.locale),r=Ar({...e,node:{...e.node,widget:void 0}}),i=t("iframe",{class:"fd-embed-frame"});i.style.height=`${Hd(e.node.options?.height)}px`;let o=t("div",{class:"fd-embed-none"},n.noDocument),a=t("div",{class:"fd-embed-view"}),s,d="",l=()=>d.startsWith("blob:")&&URL.revokeObjectURL(d);return{element:t("div",{class:"fd-embed fd-embed-pdf"},r.element,a),focus:()=>r.focus(),destroy(){l(),r.destroy?.()},update(f){r.update(f);let c=Array.isArray(f.value)?f.value[0]:f.value;c!==s&&(s=c,l(),d=c?Df(c):"",d&&(i.title=c?.name??e.field.label,i.src=d)),a.replaceChildren(...d?[i]:f.readonly?[o]:[])}}},Bd=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Te(o),l=We(a,s),f=d("input",{id:i,type:"url",class:"fd-input",autocomplete:"url"});r.placeholder&&(f.placeholder=r.placeholder),f.addEventListener("input",()=>e.setValue(t,f.value===""?null:f.value));let c=d("iframe",{class:"fd-embed-frame",title:n.label,sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",referrerpolicy:"no-referrer",loading:"lazy"});c.style.height=`${Hd(r.options?.height)}px`;let y=d("a",{class:"fd-button fd-button-link fd-embed-open",target:"_blank",rel:"noopener noreferrer",hidden:""},l.openInNewTab),p=d("div",{class:"fd-embed-view"}),k="";return{element:d("div",{class:"fd-embed"},d("div",{class:"fd-embed-bar"},f,y),p),focus:()=>f.focus(),update(g){let m=typeof g.value=="string"?g.value.trim():"";o.activeElement!==f&&f.value!==(typeof g.value=="string"?g.value:"")&&(f.value=typeof g.value=="string"?g.value:""),f.readOnly!==g.readonly&&(f.readOnly=g.readonly),f.hidden=g.readonly;let b=If(m)?m:"";b!==k&&(k=b,b&&(c.src=b),p.replaceChildren(...b?[c]:[])),y.hidden=!b,b&&(y.href=b)}}};var ln=e=>typeof e=="number"?e:Number(e)||0;function Wf(e,t){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e;if(Array.isArray(n.subtotals)||n.groups_by_subtotal){let i=n.groups_by_subtotal??{},o=n.subtotals??[{name:t,amount:ln(n.amount_untaxed)}];return{subtotals:(n.subtotals_order??o.map(s=>s.name)).map(s=>({name:s,amount:ln(o.find(d=>d.name===s)?.amount??n.amount_untaxed),groups:(i[s]??[]).map((d,l)=>({name:String(d.tax_group_name??""),amount:ln(d.tax_group_amount),at:[s,l]}))})),total:ln(n.amount_total)}}let r=(Array.isArray(n.groups)?n.groups:[]).map((i,o)=>({name:String(i.name??""),amount:ln(i.amount),at:o}));return{subtotals:[{name:t,amount:ln(n.untaxed),groups:r}],total:ln(n.total)}}var qd=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Te(i),d=We(o,a),l=n.options??{},f=typeof l.currencyField=="string"?l.currencyField:null,c=typeof l.currency=="string"?l.currency:null,y=s("tbody"),p=s("table",{id:r,class:"fd-tax-totals"},y),k="";function g(m,b){let h=JSON.parse(JSON.stringify(e.getState().values[t])),v=m.amount;if(Array.isArray(m.at)){let[S,x]=m.at;h.groups_by_subtotal[S][x].tax_group_amount=b,h.amount_total=Math.round((ln(h.amount_total)+b-v)*100)/100}else h.groups[m.at].amount=b,h.total=Math.round((ln(h.total)+b-v)*100)/100;e.setValue(t,h)}return{element:p,focus:()=>p.querySelector("input")?.focus(),update(m){let b=Wf(m.value,d.untaxed),h=f?m.values[f]:null,v=c??(h&&typeof h=="object"&&"label"in h?h.label:typeof h=="string"?h:""),S=A=>/^[A-Z]{3}$/.test(v)?Vn(A,v,2,a):pt(A,2,a),x=l.editable===!0&&!m.readonly,F=JSON.stringify([b,v,x]);if(F===k||p.contains(i.activeElement))return;k=F;let E=(A,R,I)=>s("tr",{class:I},s("th",{scope:"row"},A),s("td",{},R)),w=[];for(let A of b?.subtotals??[]){w.push(E(A.name,S(A.amount),"fd-tax-subtotal"));for(let R of A.groups){if(!x){w.push(E(R.name,S(R.amount),"fd-tax-group"));continue}let I=s("input",{type:"text",class:"fd-input fd-number-input",inputmode:"decimal",autocomplete:"off","aria-label":R.name});I.value=pt(R.amount,2,a),I.addEventListener("change",()=>{let M=Jt(I.value.trim(),a);/^-?(\d+\.?\d*|\.\d+)$/.test(M)&&g(R,Number(M))}),w.push(E(R.name,I,"fd-tax-group"))}}b&&w.push(E(d.total,S(b.total),"fd-tax-total")),y.replaceChildren(...w)}}};var Bi=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function jf(e){return(Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.content)?e.content:[]).filter(n=>n&&typeof n=="object").map(n=>({date:Bi(n.date),amount:typeof n.amount=="number"?n.amount:Number(n.amount)||0,name:Bi(n.name),journal:Bi(n.journal_name??n.journal),memo:Bi(n.ref??n.memo),id:n.account_payment_id??n.payment_id??n.id??null}))}var _d=({node:e,id:t,document:n,labels:r,locale:i="en",dialogs:o})=>{let a=Te(n),s=We(r,i),d=e.options??{},l=typeof d.currencyField=="string"?d.currencyField:null,f=typeof d.dueField=="string"?d.dueField:null,c=typeof d.model=="string"?d.model:"account.payment",y=a("ul",{class:"fd-payments-list"}),p=a("div",{class:"fd-payment-due",hidden:""}),k=a("div",{id:t,class:"fd-payments"},y,p),g={type:"date",label:""},m="",b=null;return{element:k,focus:()=>y.querySelector("button")?.focus(),destroy:()=>b?.(),update(h){let v=l?h.values[l]:null,S=v&&typeof v=="object"&&"label"in v?v.label:typeof v=="string"?v:"",x=A=>/^[A-Z]{3}$/.test(S)?Vn(A,S,2,i):pt(A,2,i),F=jf(h.value),E=f?h.values[f]:null,w=JSON.stringify([F,S,E]);w!==m&&(m=w,b?.(),y.replaceChildren(...F.map((A,R)=>{let I=x(A.amount),M=a("button",{type:"button",class:"fd-payment-info","aria-label":ze(s.paymentOf,{amount:I}),"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${t}-payment-${R}`},"i"),P=(B,$)=>$?[a("dt",{},B),a("dd",{},$)]:[],H=A.id!==null&&o?.canOpen(c)?a("button",{type:"button",class:"fd-button fd-button-link fd-payment-open"},s.openPayment):null,D=a("div",{id:`${t}-payment-${R}`,class:"fd-payment-details",role:"dialog","aria-label":ze(s.paymentOf,{amount:I}),tabindex:"-1",hidden:""},a("strong",{},A.name||I),a("span",{class:"fd-payment-details-amount"},I),a("dl",{},...P(s.journal,A.journal),...P(s.memo,A.memo)),...H?[H]:[]),W=a("li",{class:"fd-payment"},M,a("span",{class:"fd-payment-date"},ze(s.paidOn,{date:At(g,A.date,{},i)})),a("span",{class:"fd-payment-amount"},I),D),z=!1,j=nr(W,M,D,()=>{z&&M.focus(),z=!1,b===V&&(b=null)}),V=()=>j.close();return M.addEventListener("click",()=>{if(j.isOpen())return V();b?.(),j.open(),b=V,(H??D).focus()}),D.addEventListener("keydown",B=>{B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),z=!0,V())}),H?.addEventListener("click",()=>{V(),o?.openRecord(c,{recordId:A.id,title:A.name||I})}),W})),p.hidden=E==null,p.replaceChildren(a("span",{},s.amountDue),a("strong",{},typeof E=="number"?x(E):"")))}}};function Ot(e,t=e.widgets??{}){let n=e.widgets===t?e:{...e,widgets:t},{field:r,node:i}=n,o=[i.widget?`${r.type}.${i.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type==="many2many"&&i.columns?.length?"many2many.table":null,r.type].filter(a=>a!==null);for(let a of o){let s=t[a]??Jd[a];if(s)return r.type==="selection"&&r.optionsFrom?Od(s,n):s(n)}return Kf(n)}function at(e,t,n={},...r){let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}function cn(e,t){He(e,"aria-invalid",String(t.invalid)),He(e,"aria-required",e.getAttribute("role")==="group"?null:String(t.required)),He(e,"aria-describedby",t.describedBy||null)}var Ui=e=>e==null?"":String(e);function rr(e){return t=>{let{form:n,name:r,field:i,node:o,id:a,document:s}=t,d=at(s,"input",{id:a,type:e,class:"fd-input",autocomplete:/^(email|tel|url)$/.test(e)?e:"off"});return i.type==="char"&&i.size!==void 0&&(d.maxLength=i.size),e==="time"&&Ii(d,i,o),o.placeholder&&(d.placeholder=o.placeholder),d.addEventListener("input",()=>n.setValue(r,d.value===""?null:d.value)),Zo({element:d,focus:()=>d.focus(),update(l){let f=Ui(l.value);d.value!==f&&(d.value=f),d.readOnly!==l.readonly&&(d.readOnly=l.readonly),cn(d,l)}},t,d)}}var Hf=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=at(a,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),i.placeholder&&(s.placeholder=i.placeholder);let d=Pd(s,i);return s.addEventListener("input",()=>{d(),t.setValue(n,s.value===""?null:s.value)}),Zo({element:s,focus:()=>s.focus(),update(l){let f=Ui(l.value);s.value!==f&&(s.value=f,d()),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),cn(s,l)}},e,s)},zf=/^-?(\d+\.?\d*|\.\d+)$/,Bf=/^-?\.?$/,aa=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,locale:s="en"}=e,d=r.type==="integer",l=d?0:(r.type==="float"||r.type==="monetary"?r.digits?.[1]:void 0)??2,f=I=>typeof I=="number"?pt(I,l,s):Ui(I),c=at(a,"input",{id:o,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=d?"numeric":"decimal",i.placeholder&&(c.placeholder=i.placeholder);let y=I=>{let M=Jt(I.trim(),s);if(M==="")return null;if(zf.test(M))return Number(M);if(!Bf.test(M))return M};c.addEventListener("input",()=>{let I=y(c.value);I!==void 0&&t.setValue(n,I)}),c.addEventListener("focus",()=>{queueMicrotask(()=>{let I=t.getState().values[n];if(a.activeElement!==c||c.readOnly||typeof I!="number"||c.value!==f(I))return;let M=c.value,[P,H]=[c.selectionStart??M.length,c.selectionEnd??M.length],D=W=>Lr(M.slice(0,W),s).length;c.value=Lr(M,s),c.setSelectionRange(D(P),D(H))})}),c.addEventListener("blur",()=>{c.value=f(t.getState().values[n])});let p=i.options??{},k=r.type==="monetary"?r.currencyField:void 0,g=k?t.page.fields[k]:void 0,m=k&&g&&p.pickCurrency===!0?Ot({...e,name:k,field:g,node:{type:"field",id:`${i.id}.currency`,field:k},id:`${o}-currency`}):null;m&&g&&m.element.querySelector("input, select")?.setAttribute("aria-label",g.label),m?.element.matches("input, select")&&g&&m.element.setAttribute("aria-label",g.label);let b=r.type==="monetary"?r.money:void 0,h=p.symbol?p.symbol==="after":b?.at?b.at==="after":r.type==="monetary"&&Fr(r.currency??"USD",s).after,v=(I,M)=>at(a,"span",{class:`fd-unit${r.type==="monetary"?" fd-currency":""}`,id:`${o}-unit${M}`},I),S=r.type==="monetary"&&!m?v("",0):null,[x,F]=["prefix","suffix"].map((I,M)=>typeof p[I]=="string"&&p[I]?v(p[I],M+1):null),E=(h?null:m?.element??S)??x,w=(h?m?.element??S:null)??F,A=[E,w].filter(I=>!!I&&I!==m?.element);return{element:E||w?at(a,"span",{class:`fd-number${h?" fd-currency-after":""}${m?" fd-currency-picked":""}`},...[E,c,w].filter(I=>!!I)):c,focus:()=>c.focus(),update(I){let M=a.activeElement===c,P=y(c.value),H=P===void 0||P===I.value;if(!(M&&H)){let D=M&&!I.readonly&&typeof I.value=="number"?No(I.value,l,s):f(I.value);c.value!==D&&(c.value=D)}if(c.readOnly!==I.readonly&&(c.readOnly=I.readonly),cn(c,{...I,describedBy:[I.describedBy,...A.map(D=>D.id)].filter(Boolean).join(" ")}),m&&k&&m.update({value:I.values[k],values:I.values,readonly:I.readonly,required:!1,invalid:!1}),S&&r.type==="monetary"){let D=Qn(r,I.values,I.parent)??"";ft(S,/^[A-Z]{3}$/.test(D)&&b?.currency!=="code"?Fr(D,s).text:D)}for(let[D,W]of[[E,"start"],[w,"end"]])D&&A.includes(D)&&c.style.setProperty(`padding-inline-${W}`,`calc(var(--fd-pad-x) + ${D.textContent?.length??0}ch + 4px)`)}}};function sa(e="box"){let t=e==="switch"?{class:"fd-switch",role:"switch"}:{class:e==="tick"?"fd-checkbox fd-tick":"fd-checkbox"};return({form:n,name:r,id:i,document:o})=>{let a=at(o,"input",{id:i,type:"checkbox",...t});return a.addEventListener("change",()=>n.setValue(r,a.checked)),{element:a,focus:()=>a.focus(),update(s){a.checked=s.value===!0,a.disabled!==s.readonly&&(a.disabled=s.readonly),cn(a,s)}}}}function _i(e){return e.type==="selection"?e.options:[]}var qf=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=i.options?.search;if(s===!0||s!==!1&&_i(r).length>15)return Rd(e);let d=dn(_i(r),t,n,i),l=at(a,"option",{value:""}),f=at(a,"select",{id:o,class:"fd-input fd-select"},l);return d.forEach((c,y)=>f.append(at(a,"option",{value:String(y)},c.label))),f.addEventListener("change",()=>t.setValue(n,f.value===""?null:d[Number(f.value)].value)),{element:f,focus:()=>f.focus(),update(c){let y=d.findIndex(p=>p.value===c.value);f.value=y===-1?"":String(y),l.hidden=c.required&&y!==-1,f.disabled!==c.readonly&&(f.disabled=c.readonly),cn(f,c)}}};function Ud(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=dn(_i(r),t,n,i),f=We(s,d),c=at(a,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"});Vi(c,i);let y=e==="checkbox"?Oi(Te(a),f,i):null,p=l.map((x,F)=>{let E=at(a,"input",{type:e,name:o,value:String(F),id:`${o}-${F}`});return c.append(at(a,"label",{class:"fd-choice",for:`${o}-${F}`},E,at(a,"span",{},x.label))),E}),k=r.type==="selection"&&r.other===!0,g=k?at(a,"input",{type:e,name:o,value:"other",id:`${o}-other`}):null,m=k?at(a,"input",{type:"text",class:"fd-input fd-other-input","aria-label":f.otherAnswer,autocomplete:"off"}):null;g&&m&&(c.append(at(a,"div",{class:"fd-choice fd-choice-other"},at(a,"label",{class:"fd-choice-other-pick",for:`${o}-other`},g,at(a,"span",{},f.other)),m)),m.addEventListener("input",()=>{g.checked||(g.checked=!0),b(g)}),g.addEventListener("change",()=>{g.checked&&m.focus()})),y?.element&&c.append(y.element);function b(x){if(e==="checkbox"&&x instanceof HTMLInputElement&&x.checked){let E=l[p.indexOf(x)]?.exclusive===!0;p.forEach((w,A)=>w!==x&&(E||l[A].exclusive)&&(w.checked=!1)),E&&g&&(g.checked=!1)}let F=g?.checked&&m&&m.value.trim()?m.value:null;if(e==="radio"){let E=p.findIndex(w=>w.checked);t.setValue(n,E!==-1?l[E].value:F)}else{let E=new Set(l.filter((w,A)=>p[A].checked));t.setValue(n,[..._i(r).filter(w=>E.has(w)).map(w=>w.value),...F!==null?[F]:[]])}}c.addEventListener("change",x=>{x.target!==m&&b(x.target)});let h=new Set(l.map(x=>x.value)),v=()=>p.some(x=>x.checked)||g?.checked===!0,S=e==="radio"?sn(a,f,()=>{for(let x of[...p,g])x&&(x.checked=!1);t.setValue(n,null),(p[0]??g)?.focus()},i):null;return{element:S?at(a,"div",{class:"fd-choices-box"},c,S.button):c,focus:()=>(p.find(x=>x.checked)??(g?.checked?m:null)??p[0])?.focus(),update(x){let F=Array.isArray(x.value)?x.value:[x.value],E=!!y?.full(Array.isArray(x.value)?x.value.length:0);if(p.forEach((w,A)=>{w.checked=F.includes(l[A].value);let R=x.readonly||E&&!w.checked&&!l[A].exclusive;w.disabled!==R&&(w.disabled=R)}),g&&m){let w=F.find(I=>typeof I=="string"&&!h.has(I)),A=g.checked&&!m.value.trim()&&(e==="checkbox"||F.every(I=>I==null));g.checked=w!==void 0||A,w!==void 0&&a.activeElement!==m&&(m.value=w);let R=x.readonly||E&&!g.checked;g.disabled!==R&&(g.disabled=m.disabled=R)}S?.allow(x),S?.show(v()),cn(c,x)}}}}function Kd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=We(s,d),f="min"in r&&typeof r.min=="number"?r.min:e==="rating"?1:0,c="max"in r&&typeof r.max=="number"?r.max:e==="rating"?5:10,y=e==="rating"?i.options?.icon:"number",p=y!=="number",k=e==="scale"&&i.options?.nps===!0&&f===0&&c===10,g=at(a,"div",{id:o,class:`fd-points fd-${p?"rating":"scale"}${p?` fd-rating-${y??"star"}`:""}${k?" fd-nps":""}`,role:"radiogroup"}),m=[],b=e==="rating"&&f===c,h=e==="rating"&&(b||i.options?.clear===!1),v=!1;for(let E=f;E<=c;E++){let w=at(a,"button",{type:"button",role:"radio","aria-label":ze(l.ofMax,{n:E,max:c}),"data-value":String(E)},y==="thumb"?kt(a,"thumb"):y==="heart"?"\u2665":p?"\u2605":String(E));e==="scale"&&w.removeAttribute("aria-label"),k&&(w.dataset.tone=E<7?"low":E<9?"mid":"high"),w.addEventListener("click",()=>t.setValue(n,h&&!v&&t.getState().values[n]===E?null:E)),m.push(w),g.append(w)}g.addEventListener("keydown",E=>{let w=t.getState().values[n],A=typeof w=="number"?w:f-1,R=E.key==="ArrowRight"||E.key==="ArrowUp"?1:E.key==="ArrowLeft"||E.key==="ArrowDown"?-1:0;if(!R)return;E.preventDefault();let I=Math.min(c,Math.max(f,A+R));t.setValue(n,I),m[I-f]?.focus()});let S=[i.options?.startLabel,i.options?.endLabel].map(E=>typeof E=="string"?E:""),x=sn(a,l,()=>{t.setValue(n,null),m[0]?.focus()},i,!b),F=S.some(Boolean)?at(a,"div",{class:"fd-scale-box"},g,at(a,"div",{class:"fd-scale-ends","aria-hidden":"true"},at(a,"span",{},S[0]),at(a,"span",{},S[1]))):g;return S.some(Boolean)&&g.setAttribute("aria-description",S.filter(Boolean).join(" \u2026 ")),{element:at(a,"div",{class:"fd-choices-box"},F,x.button),focus:()=>(m.find(E=>E.getAttribute("aria-checked")==="true")??m[0])?.focus(),update(E){let w=typeof E.value=="number"?E.value:null;v=E.required,m.forEach((A,R)=>{let I=f+R;He(A,"aria-checked",String(I===w)),A.classList.toggle("fd-on",p?w!==null&&I<=w:I===w);let M=I===w||w===null&&R===0?0:-1;A.tabIndex!==M&&(A.tabIndex=M),A.disabled!==E.readonly&&(A.disabled=E.readonly)}),x.allow(E),x.show(w!==null),cn(g,E)}}}}var _f=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=at(o,"input",{id:i,type:"date",class:"fd-input fd-date"});Ii(s,r,a),s.addEventListener("input",()=>t.setValue(n,s.value||null));let d={element:s,focus:()=>s.focus(),update(l){let f=Ui(l.value);s.value!==f&&(s.value=f),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),s.classList.toggle("fd-blank",!f),cn(s,l)}};return a.options?.weekNumbers===!0?Ni(d,e,"date"):(Dn(s),d)},qi=e=>String(e).padStart(2,"0"),Uf=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=at(o,"input",{id:i,type:"datetime-local",class:"fd-input fd-datetime"});Ii(s,r,a);let d=f=>{if(typeof f!="string"||!f)return"";let c=new Date(f);return Number.isNaN(c.getTime())?"":`${c.getFullYear()}-${qi(c.getMonth()+1)}-${qi(c.getDate())}T${qi(c.getHours())}:${qi(c.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(n,null);let f=new Date(s.value);Number.isNaN(f.getTime())||t.setValue(n,f.toISOString())});let l={element:s,focus:()=>s.focus(),update(f){let c=d(f.value);s.value!==c&&(s.value=c),s.readOnly!==f.readonly&&(s.readOnly=f.readonly),s.classList.toggle("fd-blank",!c),cn(s,f)}};return a.options?.weekNumbers===!0?Ni(l,e,"datetime"):(Dn(s),l)};function Kf({field:e,id:t,document:n}){let r=at(n,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:r,focus:()=>{},update(i){r.textContent=Ai(i.value,e)}}}function Ai(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].flat().map(n=>n.name).join(", ");case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var Jd={char:rr("text"),"char.email":rr("email"),"char.phone":rr("tel"),"char.url":rr("url"),"char.password":rr("password"),"char.time":rr("time"),"char.tags":Co,text:Hf,integer:aa,float:aa,monetary:aa,"integer.rating":Kd("rating"),"integer.scale":Kd("scale"),"integer.slider":Go,"float.slider":Go,"integer.progressbar":$r,"integer.label":Tr,"float.label":Tr,"monetary.label":Tr,"float.progressbar":$r,"float.duration":Zs,"float.percentage":Qs,"monetary.progressbar":$r,boolean:sa(),"boolean.toggle":sa("switch"),"boolean.tick":sa("tick"),"boolean.buttons":Vd,"boolean.priority":Qo,"selection.priority":Qo,"selection.dot":Wd,"integer.color":ea,"char.color":ea,"char.copy":ta,"text.copy":ta,"date.daterange":ra,"datetime.daterange":ra,"float.timer":oa,"datetime.timer":oa,"binary.pdf":zd,"char.embed":Bd,"json.distribution":nd,"json.tax-totals":qd,"json.payments":_d,selection:qf,"selection.radio":Ud("radio"),"selection.checkboxes":Ud("checkbox"),"selection.tags":Ed,"selection.image-choice":Ad,"selection.ranking":$d,"selection.statusbar":$i,date:_f,datetime:Uf,many2one:Rr,"many2one.statusbar":$i,many2many:vi,"many2many.tags":vi,"many2many.checkboxes":Po,"many2many.table":Id,reference:Oo,one2many:Wo,"one2many.cards":Cd,binary:Ar,"binary.signature":Ld,image:Ho,html:Ko,json:Jo,"json.address":Md,properties:_o,matrix:Sd,"char.badge":Di,"selection.badge":Di,"many2one.badge":Di};var Gd=`.fd-signature{display:grid;gap:8px;justify-items:start;width:100%;max-width:480px;min-width:0}.fd-signature-box{position:relative;width:100%;aspect-ratio:10 / 3;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:#fff;overflow:hidden}.fd-signature-box:has(.fd-signature-pad:not([hidden]):not(.fd-signature-locked)):hover{border-color:var(--fd-accent)}.fd-signature-pad,.fd-signature-image{display:block;width:100%;height:100%}.fd-signature-pad{touch-action:none;cursor:crosshair}.fd-signature-pad.fd-signature-locked{cursor:default}.fd-signature-image{object-fit:contain}.fd-signature-hint{position:absolute;inset-inline:18px;inset-block-end:16px;padding-block-start:4px;pointer-events:none;border-block-start:1px solid var(--fd-border-strong);color:var(--fd-muted);font-size:12.5px}.fd-signature-tools{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;width:100%}.fd-signature-typed{flex:1 1 200px;min-width:0}.fd-signature-footer{margin-block-start:-4px;color:var(--fd-muted);font-size:12.5px}.fd-slider{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:14px;row-gap:0;align-items:center;width:100%;max-width:440px;min-width:0}.fd-slider-track{display:contents}.fd-slider-input{width:100%;min-width:0;height:26px;margin:0;accent-color:var(--fd-accent);cursor:pointer}.fd-slider-input:disabled{cursor:default}.fd-slider-value{min-width:2.5em;text-align:start;font-variant-numeric:tabular-nums;font-weight:600}.fd-slider-ends{grid-column:1;display:flex;justify-content:space-between;gap:12px;font-size:12.5px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-slider-empty .fd-slider-input{filter:grayscale(1);opacity:.55}.fd-slider-empty .fd-slider-value{color:var(--fd-muted);font-weight:400}.fd-slider .fd-choice-clear{grid-column:1 / -1}.fd-image-choices{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr));gap:12px;width:100%;min-width:0}.fd-image-card{position:relative;display:grid;grid-template-rows:auto 1fr;padding:0;margin:0;overflow:hidden;cursor:pointer;font:inherit;color:var(--fd-text);text-align:start;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);transition:border-color .15s ease,box-shadow .15s ease}.fd-image-card:hover:not(:disabled){border-color:var(--fd-accent)}.fd-image-card:disabled{cursor:default}.fd-image-card:disabled:not([aria-checked=true]){opacity:.6}.fd-image-card[aria-checked=true]{border-color:var(--fd-accent);box-shadow:0 0 0 1px var(--fd-accent)}.fd-image-card-picture{display:block;aspect-ratio:4 / 3;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-image-card-picture img{display:block;width:100%;height:100%;object-fit:cover}.fd-image-card-blank{display:grid;place-items:center;width:100%;height:100%;color:var(--fd-border-strong)}.fd-image-card-blank svg{width:36%;height:36%;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.fd-image-card-words{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;font-size:13.5px;line-height:1.35}.fd-image-card-words:before{content:"";flex:none;width:16px;height:16px;margin-block-start:1px;box-sizing:border-box;border:1.5px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface)}.fd-image-card[role=checkbox] .fd-image-card-words:before{border-radius:4px}.fd-image-card[aria-checked=true] .fd-image-card-words:before{border-color:var(--fd-accent);background:var(--fd-accent);box-shadow:inset 0 0 0 3px var(--fd-surface)}.fd-image-card[role=checkbox][aria-checked=true] .fd-image-card-words:before{box-shadow:none;background:var(--fd-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat}.fd-image-choices+.fd-choice-clear{justify-self:end}.fd-ranking{width:100%;max-width:480px;min-width:0}.fd-rank-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.fd-rank-item{display:flex;align-items:center;gap:10px;padding-block:5px;padding-inline:8px 5px;min-height:40px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);cursor:grab;user-select:none;-webkit-user-select:none}.fd-rank-item.fd-rank-lifted{position:relative;z-index:1;cursor:grabbing;border-color:var(--fd-accent);box-shadow:0 6px 18px #0f141929}.fd-ranking-locked .fd-rank-item{cursor:default}.fd-rank-grip{flex:none;width:10px;height:16px;touch-action:none;background:radial-gradient(circle,var(--fd-border-strong) 1.3px,transparent 1.7px) 0 0 / 5px 5.33px}.fd-ranking-locked .fd-rank-grip{visibility:hidden}.fd-rank-place{flex:none;display:grid;place-items:center;min-width:24px;height:24px;padding-inline:4px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}.fd-rank-words{flex:1;min-width:0;overflow-wrap:anywhere}.fd-rank-tools{flex:none;display:inline-flex;gap:2px}.fd-rank-move{width:30px;height:30px;padding:0;font:inherit;font-size:15px;line-height:1;color:var(--fd-muted);background:none;border:1px solid transparent;border-radius:4px;cursor:pointer}.fd-rank-move:hover:not(:disabled){background:var(--fd-page);border-color:var(--fd-border);color:var(--fd-text)}.fd-rank-move:disabled{opacity:.3;cursor:default}.fd-address{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;width:100%;max-width:560px;min-width:0}.fd-address-part{display:grid;gap:3px;min-width:0;align-content:start}.fd-address-street,.fd-address-line2{grid-column:1 / -1}.fd-address-part.fd-required>.fd-address-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-address-label{font-size:12.5px;color:var(--fd-muted)}@container (max-width: 420px){.fd-address{grid-template-columns:minmax(0,1fr)}}.fd-repeat{display:grid;gap:10px;justify-items:start;width:100%;min-width:0}.fd-repeat-list{display:grid;gap:10px;width:100%;min-width:0}.fd-repeat-list:empty{display:none}.fd-repeat-card{display:grid;gap:8px;min-width:0;padding:10px 14px 14px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-radius),6px)}.fd-repeat-head{display:flex;align-items:center;gap:2px;min-height:28px}.fd-repeat-title{font-weight:600;font-size:13.5px;margin-inline-end:auto}.fd-repeat-remove,.fd-repeat-tool{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:18px;line-height:1;padding:4px 8px;border-radius:4px}.fd-repeat-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-repeat-tool{font-size:15px;min-width:24px;min-height:24px}.fd-repeat-tool:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-repeat-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:10px 14px}.fd-repeat-field{display:grid;gap:3px;min-width:0;align-content:start}.fd-repeat-label{font-size:12.5px;color:var(--fd-muted)}.fd-repeat-add{border-style:dashed}`;var Yd='.fd-yes-no button{min-width:76px}.fd-choices-columns{display:grid;grid-template-columns:repeat(var(--fd-choice-columns),minmax(0,1fr))}.fd-choices-row{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.fd-choice-limit{grid-column:1 / -1;flex-basis:100%;font-size:12.5px;color:var(--fd-muted)}.fd-choice-limit:empty{display:none}.fd-image-choices[data-size=small]{--fd-card: 96px}.fd-image-choices[data-size=large]{--fd-card: 210px}.fd-image-choices[data-size]{grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--fd-card, 130px)),1fr))}.fd-image-choices[data-fit=whole] img{object-fit:contain}.fd-image-choices-bare .fd-image-card-words{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0;font-size:0}.fd-choice-search .fd-combo:after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.fd-rank-pool{display:flex;flex-wrap:wrap;gap:8px;margin-block:6px 10px}.fd-rank-pick{min-height:32px;padding:4px 12px;font:inherit;color:inherit;cursor:pointer;background:var(--fd-surface);border:1px dashed var(--fd-border-strong);border-radius:999px}.fd-rank-pick:disabled{opacity:.5;cursor:default}.fd-rank-list:empty{display:none}.fd-rank-keep{margin-block-start:8px}.fd-matrix-pick{display:inline-flex;align-items:center;gap:8px}.fd-matrix-column{display:none}@container (max-width: 520px){.fd-choices-columns{grid-template-columns:minmax(0,1fr)}.fd-image-choices.fd-image-choices{grid-auto-flow:row;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-matrix-table,.fd-matrix-table :is(tbody,tr,th,td){display:block}.fd-matrix-table thead{display:none}.fd-matrix-table tr{padding:10px 12px;margin-block-end:10px;border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-matrix-table :is(th,td){padding:2px 0;border:0;text-align:start}.fd-matrix-pick{min-height:32px}.fd-matrix-column{display:inline}}';var Xd='.fd-counted{display:grid;gap:2px;min-width:0}.fd-count{justify-self:end;direction:ltr;unicode-bidi:isolate;font-size:12px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-count-near{color:var(--fd-warning);font-weight:600}.fd-number:not(.fd-currency-picked){position:relative;display:block}.fd-field>.fd-number:not(.fd-currency-picked){align-self:start}.fd-number>.fd-unit{position:absolute;inset-block:0;display:flex;align-items:center;pointer-events:none;color:var(--fd-muted)}.fd-number>.fd-unit:first-child{inset-inline-start:var(--fd-pad-x)}.fd-number>.fd-unit:last-child{inset-inline-end:var(--fd-pad-x)}.fd-rating-heart button.fd-on{color:#e5484d}.fd-rating-thumb button.fd-on{color:var(--fd-accent)}.fd-rating .fd-icon{display:block;width:1em;height:1em}.fd-rating .fd-on .fd-icon{fill:currentColor}.fd-slider-word{display:block;max-width:12em}.fd-slider-last{text-align:end}.fd-nps [data-tone=low]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-nps [data-tone=mid]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-nps [data-tone=high]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-nps button{background:var(--fd-tone-soft);border-color:var(--fd-tone);color:var(--fd-tone);font-weight:600}.fd-nps button.fd-on{background:var(--fd-tone);border-color:var(--fd-tone);color:var(--fd-surface)}.fd-nps [data-value="7"],.fd-nps [data-value="9"]{margin-inline-start:8px}.fd-choices-box>.fd-scale-box{justify-self:start}';var Zd=".fd-form[data-inputs~=bg] :is(.fd-input:not([readonly]),.fd-calendar-button){background:var(--fd-inputs-bg)}.fd-form[data-inputs~=border] :is(.fd-input,.fd-calendar-button){--fd-border: var(--fd-inputs-border);--fd-border-strong: var(--fd-inputs-border)}.fd-form[data-inputs~=radius] :is(.fd-input,.fd-calendar-button){--fd-control-radius: var(--fd-inputs-radius)}.fd-form[data-inputs~=size] :where(.fd-input){font-size:var(--fd-inputs-size)}.fd-form[data-inputs~=accent] :is(.fd-input,.fd-combo,.fd-tags,.fd-date-pick){--fd-accent: var(--fd-inputs-accent);--fd-accent-text: var(--fd-inputs-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}.fd-form[data-choices~=accent] :is(.fd-choices,.fd-points,.fd-image-choices,.fd-ranking,.fd-checkbox,.fd-switch,.fd-matrix-table,.fd-slider){--fd-accent: var(--fd-choices-accent);--fd-accent-text: var(--fd-choices-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface))}.fd-form[data-choices~=bg] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-surface: var(--fd-choices-bg)}.fd-form[data-choices~=border] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-border: var(--fd-choices-border)}.fd-form[data-choices~=radius] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-control-radius: var(--fd-choices-radius)}.fd-form[data-choices~=size] :is(.fd-choices,.fd-points,.fd-image-card-words,.fd-rank-list){font-size:var(--fd-choices-size)}.fd-form[data-groups~=bg] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){background:var(--fd-groups-bg);--fd-ground: var(--fd-groups-bg)}.fd-form[data-groups~=border] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border:1px solid var(--fd-groups-border)}.fd-form[data-groups~=radius] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border-radius:var(--fd-groups-radius)}.fd-form[data-fd-skin=underline]:is([data-groups~=bg],[data-groups~=border]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){padding:var(--fd-group-pad, 18px 22px);border-radius:var(--fd-groups-radius, var(--fd-radius))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button{--fd-accent: var(--fd-buttons-accent);--fd-accent-text: var(--fd-buttons-accent-text);--fd-focus: var(--fd-accent);--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}:is(.fd-form,.fd-form-dialog)[data-buttons~=radius] .fd-button{border-radius:var(--fd-buttons-radius)}:is(.fd-form,.fd-form-dialog)[data-buttons~=size] .fd-button{font-size:var(--fd-buttons-size)}.fd-form[data-tables~=bg] :is(.fd-lines-table,.fd-matrix-table) thead th{background:var(--fd-tables-bg)}.fd-form[data-tables~=border] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){border-color:var(--fd-tables-border)}.fd-form[data-tables~=size] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){font-size:var(--fd-tables-size)}";var Qd='.fd-read-text{min-width:0;min-height:var(--fd-control-height, 30px);padding-block:calc(var(--fd-pad-y) + 1px);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45;color:var(--fd-text)}.fd-field:is([data-type=integer],[data-type=float],[data-type=monetary])>.fd-read-text{font-variant-numeric:tabular-nums}.fd-read-text{unicode-bidi:plaintext;text-align:left}[dir=rtl] .fd-read-text{text-align:right}.fd-read-text{padding-inline:var(--fd-pad-x)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-read-text{padding-inline:calc(var(--fd-pad-x) + 1px)}.fd-form :is(.fd-title,.fd-title-line) .fd-read-text{padding-inline:0}.fd-read-text a,.fd-read-link{color:var(--fd-accent);text-decoration:none}.fd-read-link{border:none;background:none;padding:0;font:inherit;cursor:pointer;text-align:start}.fd-read-text a:hover,.fd-read-link:hover{text-decoration:underline}.fd-read-link:focus-visible,.fd-read-text a:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-field>.fd-value-badge{justify-self:start;align-self:start;width:fit-content;margin-block:calc((var(--fd-control-height, 30px) - 24px) / 2)}.fd-title>.fd-field>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-ribbon[title]{pointer-events:auto;cursor:help}.fd-value{font-weight:600}.fd-alert:has(>.fd-alert-actions){flex-wrap:wrap;align-items:baseline}.fd-alert-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}.fd-alert-actions .fd-button{min-height:0;padding-block:0;font-size:inherit}.fd-alert-actions .fd-button-link{color:inherit;padding-inline:0;text-decoration:underline;text-underline-offset:2px;font-weight:600}.fd-text-alert{grid-column:1 / -1;margin:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden]))>:is(.fd-ribbon-frame+.fd-alert,.fd-ribbon-frame+.fd-stats[hidden]+.fd-alert){margin-inline-end:72px}.fd-stat-pair{gap:1px}.fd-stat-row{display:inline-flex;align-items:baseline;gap:5px}.fd-stat-row>.fd-stat-label:after{content:":"}.fd-stat-pair .fd-stat-value{font-size:13.5px}@container (max-width: 520px){.fd-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.fd-stat{min-width:0;padding-inline:12px;text-align:start;column-gap:8px}.fd-stat:has(>.fd-icon){column-gap:8px}.fd-stat-value{font-size:14px}.fd-stat:nth-child(odd of:not([hidden])){border-inline-start:none}.fd-stat:nth-child(n+3 of:not([hidden])){border-block-start:1px solid var(--fd-border)}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(2 of:not([hidden])){padding-inline-end:64px}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(4 of:not([hidden])){padding-inline-end:36px}}.fd-step-time{margin-inline-start:6px;font-size:11.5px;font-weight:400;font-variant-numeric:tabular-nums}.fd-statusbar li.fd-step-more>button{padding-inline:16px 20px;letter-spacing:1px}.fd-statusbar li.fd-step-more>.fd-step-menu{position:fixed;z-index:30;display:grid;min-width:160px;margin:0;padding:4px 0;clip-path:none;transform:none;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;white-space:nowrap}.fd-statusbar li.fd-step-more>.fd-step-menu[hidden]{display:none}.fd-statusbar .fd-step-menu>button{font:inherit;font-size:13px;text-align:start;border:none;background:none;color:inherit;padding:6px 14px;cursor:pointer;transform:none}.fd-statusbar .fd-step-menu>button:hover:not(:disabled),.fd-statusbar .fd-step-menu>button:focus-visible{background:var(--fd-accent-soft);outline:none}.fd-statusbar .fd-step-menu>button:disabled{cursor:default;color:var(--fd-muted)}.fd-hotkey{display:none}[data-hotkeys] .fd-hotkey{display:inline-block;margin-inline-start:6px;padding:0 4px;border:1px solid currentColor;border-radius:3px;font:600 10.5px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.85;vertical-align:1px}.fd-link-avatar{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:10px;font-weight:700;line-height:1;vertical-align:middle}.fd-link-avatar img{width:100%;height:100%;object-fit:cover}.fd-combo[data-avatar]>.fd-link-avatar{position:absolute;inset-inline-start:4px;pointer-events:none}.fd-combo[data-avatar]>.fd-link-avatar[hidden]~.fd-combo-input{padding-inline-start:var(--fd-pad-x)}.fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:32px}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar{inset-inline-start:0}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:28px}.fd-read-text>.fd-link-avatar{margin-inline-end:6px}.fd-chip>.fd-link-avatar{width:18px;height:18px;font-size:9px;margin-inline:-4px 2px}.fd-link{display:grid;gap:2px;min-width:0}.fd-link-details{font-size:12.5px;line-height:1.4;color:var(--fd-muted);text-align:left}[dir=rtl] .fd-link-details{text-align:right}.fd-link-details>div{unicode-bidi:plaintext}.fd-chip[data-color]{background:color-mix(in srgb,var(--fd-tag) 18%,var(--fd-surface));border-color:color-mix(in srgb,var(--fd-tag) 55%,var(--fd-surface))}.fd-chip[data-color="1"]{--fd-tag: #f06050}.fd-chip[data-color="2"]{--fd-tag: #f4a460}.fd-chip[data-color="3"]{--fd-tag: #f7cd1f}.fd-chip[data-color="4"]{--fd-tag: #6cc1ed}.fd-chip[data-color="5"]{--fd-tag: #814968}.fd-chip[data-color="6"]{--fd-tag: #eb7e7f}.fd-chip[data-color="7"]{--fd-tag: #2c8397}.fd-chip[data-color="8"]{--fd-tag: #475577}.fd-chip[data-color="9"]{--fd-tag: #d6145f}.fd-chip[data-color="10"]{--fd-tag: #30c381}.fd-chip[data-color="11"]{--fd-tag: #9365b8}.fd-oneline-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;min-height:var(--fd-control-height, 30px)}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;flex:0 1 auto;width:auto;min-width:0;grid-template-columns:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{grid-column:auto!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:not([data-labels=beside]):not([data-labels=above])>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>:is(.fd-error,.fd-warning){flex-basis:100%}.fd-oneline-row .fd-input{width:12em;max-width:100%}.fd-form .fd-oneline-pair{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:6px 10px;flex:0 1 auto;max-width:100%;min-width:0}.fd-form .fd-oneline-pair:not(:has(>:not([hidden]))){display:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{max-width:100%}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{max-width:100%;min-width:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference]) .fd-input{width:15em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=integer],[data-type=float]) .fd-input{width:7em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=monetary] .fd-input{width:8.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=date],[data-type=datetime]) .fd-input{width:9.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime] .fd-input{width:14em}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]){flex:1 1 auto}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime])>:not(.fd-label){flex:1 1 auto}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]) .fd-input{width:100%;min-width:min(100%,var(--fd-oneline-min, 9.5em))}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime]{--fd-oneline-min: 14em}.fd-form .fd-oneline-words{margin:0;padding:0;border:0;background:none;color:var(--fd-text)}.fd-form .fd-oneline-words.fd-text-note{color:var(--fd-muted);font-size:12.5px}.fd-form .fd-oneline:not(:has(>.fd-label))>.fd-oneline-row{grid-column:1 / -1!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-button-link{padding-inline:0;min-height:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>.fd-read-text{min-height:0;padding-block:0}.fd-title-label{font-size:12.5px;font-weight:600;color:var(--fd-muted)}';var el='.fd-priority{display:inline-flex;align-items:center;gap:1px}.fd-priority-star{border:none;background:none;padding:0 1px;min-width:0;font:inherit;font-size:20px;line-height:1;color:var(--fd-border-strong);cursor:pointer}.fd-priority-star.fd-on{color:#e8a317}.fd-priority:not(:has(:disabled)):hover .fd-priority-star{color:#e8a317}.fd-priority:not(:has(:disabled)) .fd-priority-star:hover~.fd-priority-star{color:var(--fd-border-strong)}.fd-priority-star:disabled{cursor:default}.fd-title-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;min-width:0}.fd-title-line>.fd-title-name{flex:1 1 18em;min-width:0}.fd-title-line>.fd-title-name .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-title-line>.fd-title-name>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-form .fd-title-line>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form .fd-title-line>.fd-field>*{grid-column:1!important}.fd-form .fd-title-line>.fd-title-side{display:flex;align-items:center;flex:none}.fd-title-line>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-line .fd-priority-star{font-size:24px}.fd-dot-box{position:relative;display:inline-flex;align-items:center;gap:6px}.fd-dot-button{display:inline-grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:none;cursor:pointer}.fd-dot-button:hover:not(:disabled){background:var(--fd-accent-soft)}.fd-dot-button:disabled{cursor:default}.fd-dot{display:inline-block;width:12px;height:12px;flex:none;border-radius:50%;background:var(--fd-dot, var(--fd-border-strong))}.fd-dot-button[data-tone=muted],.fd-dot-item[data-tone=muted]{--fd-dot: var(--fd-border-strong)}.fd-dot-button[data-tone=danger],.fd-dot-item[data-tone=danger]{--fd-dot: var(--fd-error)}.fd-dot-button[data-tone=success],.fd-dot-item[data-tone=success]{--fd-dot: var(--fd-success)}.fd-dot-button[data-tone=warning],.fd-dot-item[data-tone=warning]{--fd-dot: #d97706}.fd-dot-button[data-tone=info],.fd-dot-item[data-tone=info]{--fd-dot: var(--fd-info)}.fd-dot-label{font-size:13px;color:var(--fd-muted)}.fd-dot-menu{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:180px;padding:4px;display:grid;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-dot-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:4px;cursor:pointer;white-space:nowrap;font-size:14px}.fd-dot-item:hover,.fd-dot-item:focus{background:var(--fd-accent-soft);outline:none}.fd-dot-item[aria-checked=true]{font-weight:600}.fd-dot-item[aria-checked=true]:after{content:"\u2713";margin-inline-start:auto;padding-inline-start:16px;color:var(--fd-accent)}.fd-colour-box{position:relative;display:inline-flex;align-items:center;gap:8px}.fd-colour-button,.fd-colour{width:24px;height:24px;padding:0;border:1px solid var(--fd-border-strong);border-radius:4px;background:var(--fd-swatch, transparent);cursor:pointer}.fd-colour-button:disabled{cursor:default}.fd-colour-none,.fd-colour[data-colour="0"]{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--fd-error) calc(50% - 1px),var(--fd-error) calc(50% + 1px),transparent calc(50% + 1px))}.fd-colour-palette{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;display:grid;grid-template-columns:repeat(6,24px);gap:6px;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-colour[aria-checked=true]{box-shadow:0 0 0 2px var(--fd-surface),0 0 0 4px var(--fd-accent)}.fd-colour-input{width:44px;height:30px;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-colour-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;color:var(--fd-muted)}.fd-copy{display:flex;align-items:center;gap:8px;min-width:0}.fd-copy>.fd-input{flex:1 1 auto;min-width:0}.fd-copy-long{align-items:flex-start}.fd-copy-button{flex:none}.fd-range{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.fd-range-box{flex:1 1 8em;display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.fd-range-box>.fd-input{flex:1 1 9em;min-width:0}.fd-range-box>.fd-input[type=datetime-local]{flex-basis:13em}.fd-range-arrow{flex:none;display:inline-block;color:var(--fd-muted)}.fd-range-arrow:dir(rtl){transform:scaleX(-1)}.fd-range-calendar .fd-calendar-grid td button.fd-in-range{background:var(--fd-accent-soft);border-radius:0}.fd-timer{display:inline-flex;align-items:center;gap:8px;font-variant-numeric:tabular-nums;font-weight:600;direction:ltr;unicode-bidi:isolate}.fd-timer-dot{width:8px;height:8px;border-radius:50%;background:var(--fd-border-strong)}.fd-timer[data-running] .fd-timer-dot{background:var(--fd-success);animation:fd-timer-beat 1s ease-in-out infinite alternate}.fd-timer[data-running] .fd-timer-time{color:var(--fd-success)}@keyframes fd-timer-beat{to{opacity:.35}}@media(prefers-reduced-motion:reduce){.fd-timer[data-running] .fd-timer-dot{animation:none}}.fd-embed{display:grid;gap:8px;min-width:0}.fd-embed-bar{display:flex;align-items:center;gap:8px;min-width:0}.fd-embed-bar>.fd-input{flex:1 1 auto;min-width:0}.fd-embed-open{flex:none}.fd-embed-frame{display:block;width:100%;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-page)}.fd-embed-none{padding:24px 12px;text-align:center;color:var(--fd-muted);border:1px dashed var(--fd-border);border-radius:max(var(--fd-control-radius),4px)}.fd-distribution{display:grid;gap:6px;min-width:0}.fd-distribution-table .fd-distribution-share{width:8.5em}.fd-distribution-table .fd-share{text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch)}.fd-distribution-total{font-weight:600;text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch + 4px);font-variant-numeric:tabular-nums}.fd-distribution-add{justify-self:start}.fd-tax-totals{justify-self:end;border-collapse:collapse;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-tax-totals th{text-align:start;font-weight:400;color:var(--fd-muted);padding:3px 16px 3px 0;padding-inline:0 16px}.fd-tax-totals td{text-align:end;padding:3px 0;white-space:nowrap}.fd-tax-totals .fd-tax-subtotal th{color:var(--fd-text)}.fd-tax-totals .fd-tax-total :is(th,td){font-weight:700;color:var(--fd-text);font-size:15px;border-top:1px solid var(--fd-border);padding-top:6px}.fd-tax-totals .fd-input{width:9em;text-align:end}.fd-payments{display:grid;gap:6px;justify-self:end;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-payments-list{list-style:none;margin:0;padding:0;display:grid;gap:4px}.fd-payment{position:relative;display:flex;align-items:center;gap:8px}.fd-payment-info{flex:none;width:20px;height:20px;padding:0;border:1px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface);color:var(--fd-muted);font:italic 600 12px/1 Georgia,serif;cursor:pointer}.fd-payment-info:hover,.fd-payment-info[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-payment-date{flex:1 1 auto;font-style:italic;color:var(--fd-muted)}.fd-payment-amount{white-space:nowrap}.fd-payment-details{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:240px;display:grid;gap:6px;padding:10px 12px;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-payment-details dl{display:grid;grid-template-columns:auto 1fr;gap:2px 12px;margin:0}.fd-payment-details dt{color:var(--fd-muted)}.fd-payment-details dd{margin:0}.fd-payment-open{justify-self:start}.fd-payment-due{display:flex;justify-content:space-between;gap:16px;padding-top:6px;border-top:1px solid var(--fd-border);font-weight:600}.fd-properties-list{display:grid;gap:8px;min-width:0}.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--fd-gap-x, 24px)}@container (max-width: 520px){.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:minmax(0,1fr)}}.fd-property-add{justify-self:start}.fd-property-new{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.fd-property-new>.fd-input{flex:1 1 10em;width:auto}';var tl='.fd-dot-label[data-quiet-words]{display:none}.fd-form .fd-field[data-in-quiet]>.fd-label{color:var(--fd-muted)}.fd-form .fd-field[data-quiet]{--fd-quiet-pad: max(var(--fd-pad-x), 6px)}.fd-form .fd-field[data-quiet] :where(.fd-input){padding-inline-start:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *),.fd-tags,.fd-dot-box){border:1px solid transparent;border-radius:max(var(--fd-control-radius),4px);background-color:transparent;box-shadow:none;transition:border-color .12s ease,background-color .12s ease,box-shadow .12s ease}.fd-form .fd-field[data-quiet]:not(:focus-within) .fd-count{visibility:hidden}.fd-form .fd-field[data-quiet] textarea.fd-input:not(:focus){resize:none}.fd-form .fd-field[data-quiet]>.fd-number:not(.fd-currency-picked){max-width:18em}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]){color:var(--fd-text);opacity:1;cursor:default}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]):not(.fd-combo[data-avatar]>*){padding-inline:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet]>.fd-read-text{padding-inline:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet][data-locked] :is(.fd-input,.fd-dot-label),.fd-form .fd-field[data-quiet][data-locked]>.fd-read-text{color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-input:not(:focus){color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-dot-label:empty:before{content:attr(data-hint);color:var(--fd-muted)}.fd-form .fd-field[data-quiet] :is(.fd-input[aria-invalid=true]:not(.fd-tags *),.fd-tags:has(.fd-input[aria-invalid=true]),.fd-dot-box:has(>[aria-invalid=true])){border-color:var(--fd-error)}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-input:not(.fd-tags *),.fd-tags):not([readonly],:disabled,[contenteditable=false]),.fd-form .fd-field[data-quiet]>:is(.fd-input,.fd-tags,.fd-dot-box:not(:has(:disabled))):not([readonly],:disabled,[contenteditable=false]):hover{border-color:var(--fd-border);background-color:var(--fd-inputs-bg, var(--fd-surface))}}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *):not([readonly],:disabled,[contenteditable=false]):focus,.fd-tags:focus-within,.fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true]))){border-color:var(--fd-accent);background-color:var(--fd-inputs-bg, var(--fd-surface));box-shadow:0 0 0 1px var(--fd-accent)}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],[contenteditable=false]):focus-visible{outline:2px solid var(--fd-accent);outline-offset:0}.fd-form .fd-field[data-quiet] select.fd-input{appearance:none;padding-inline-end:calc(var(--fd-quiet-pad) + 14px);background-image:none}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled){background-image:linear-gradient(45deg,transparent 50%,var(--fd-muted) 50%),linear-gradient(135deg,var(--fd-muted) 50%,transparent 50%);background-position:calc(100% - var(--fd-quiet-pad) - 5px) 55%,calc(100% - var(--fd-quiet-pad)) 55%;background-size:5px 5px;background-repeat:no-repeat}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus):dir(rtl),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled):dir(rtl){background-position:var(--fd-quiet-pad) 55%,calc(var(--fd-quiet-pad) + 5px) 55%}.fd-form .fd-field[data-quiet] .fd-combo:is(.fd-choice-search *,:has(>.fd-combo-clear[hidden])):has(>.fd-combo-input:not([readonly])):after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden}.fd-form .fd-field[data-quiet] .fd-combo:focus-within:after{visibility:visible}.fd-form .fd-field[data-quiet] .fd-choice-search .fd-combo:has(>.fd-combo-input[readonly]):after{content:none}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl){position:relative;text-align:right}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl)::-webkit-calendar-picker-indicator{position:absolute;left:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] .fd-input::-webkit-calendar-picker-indicator{opacity:0;transition:opacity .12s ease}.fd-form .fd-field[data-quiet] .fd-input:not([readonly]):focus::-webkit-calendar-picker-indicator{opacity:1}.fd-form .fd-field[data-quiet]:not(:focus-within) :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open){visibility:hidden}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open),.fd-form .fd-field[data-quiet]>:hover .fd-combo:after{visibility:visible}.fd-form .fd-field[data-quiet]>:hover .fd-input:not([readonly])::-webkit-calendar-picker-indicator,.fd-form .fd-field[data-quiet]>.fd-input:not([readonly]):hover::-webkit-calendar-picker-indicator{opacity:1}}.fd-form .fd-field[data-quiet] .fd-link>.fd-link-details{padding-inline-start:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet] .fd-tags{padding:1px var(--fd-quiet-pad);min-height:var(--fd-control-height, 30px)}.fd-form .fd-field[data-quiet] .fd-tags .fd-input{border:0;background-color:transparent;box-shadow:none;padding-inline-start:0}.fd-form .fd-field[data-quiet] .fd-tags:has(.fd-chip) .fd-combo-input:not(:focus)::placeholder{color:transparent}.fd-form .fd-field[data-quiet] .fd-dot-box{display:flex;gap:8px;min-height:var(--fd-control-height, 30px);padding-block:0;padding-inline:var(--fd-quiet-pad) calc(var(--fd-quiet-pad) + 16px)}.fd-form .fd-field[data-quiet] .fd-dot-box:after{content:"";position:absolute;inset-inline-end:calc(var(--fd-quiet-pad) + 2px);inset-block-start:50%;width:6px;height:6px;margin-block-start:-5px;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden;pointer-events:none}.fd-form .fd-field[data-quiet] .fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true])):after{visibility:visible}@media(hover:hover){.fd-form .fd-field[data-quiet] .fd-dot-box:not(:has(:disabled)):hover:after{visibility:visible}}.fd-form .fd-field[data-quiet] .fd-dot-button{margin-inline-start:-6px;margin-inline-end:-4px;background:none}.fd-form .fd-field[data-quiet] .fd-dot-button:before{content:"";position:absolute;inset:0}.fd-form .fd-field[data-quiet] .fd-dot-button:focus-visible{outline:none}.fd-form .fd-field[data-quiet] .fd-dot-label{display:inline;font-size:inherit;color:var(--fd-text)}.fd-form .fd-field[data-quiet] .fd-richtext-box{position:relative}.fd-form .fd-field[data-quiet] .fd-richtext{min-height:64px}.fd-form .fd-field[data-quiet] .fd-richtext[contenteditable=false]{min-height:0}.fd-form .fd-field[data-quiet] .fd-richtext>*{unicode-bidi:plaintext;text-align:left}.fd-form .fd-field[data-quiet] .fd-richtext>:dir(rtl){text-align:right}.fd-form .fd-field[data-quiet] .fd-richtext-box:not(:focus-within)>:is(.fd-richtext-bar,.fd-link-row){display:none}.fd-form .fd-field[data-quiet] .fd-richtext-box>:is(.fd-richtext-bar,.fd-link-row){position:absolute;inset-inline:0;z-index:25;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-surface);box-shadow:0 6px 18px #0f141924}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-richtext-bar{inset-block-start:calc(100% + 4px)}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-link-row{inset-block-start:calc(100% + 46px)}.fd-lock-wrap{position:relative;display:inline-flex;vertical-align:-.15em;margin-inline-start:6px}.fd-lock{display:inline-grid;place-items:center;width:18px;height:18px;padding:0;border:0;border-radius:4px;background:none;color:var(--fd-muted)}button.fd-lock{cursor:help}.fd-lock .fd-icon{width:14px;height:14px;margin:0}.fd-lock:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}';var nl='.fd-grid>.fd-section[data-place=tracks]{--fd-tracks: min(var(--fd-span, 1), var(--fd-cols));grid-template-columns:subgrid;column-gap:var(--fd-gap-x)}.fd-form .fd-section[data-place=tracks]>.fd-grid{--fd-cols: var(--fd-tracks);grid-column:1 / -1;grid-template-columns:subgrid}.fd-section[data-place]>.fd-section-description{grid-column:1 / -1}.fd-grid>.fd-section[data-place=shared]{container-type:inline-size}.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: var(--fd-columns, 1)}@container (max-width: 330px){.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: 1}}.fd-form{--fd-ground: transparent}.fd-card,.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-section[data-style=card][data-on-page]{--fd-ground: var(--fd-surface)}fieldset.fd-section[data-style]{background-color:var(--fd-ground)}.fd-form .fd-section[data-style=line]>.fd-section-title{border-block-end:1px solid var(--fd-border);padding-block-end:8px}.fd-form .fd-section[data-style=plain]>.fd-section-title{border-block-end:0;padding-block-end:0}.fd-form .fd-section[data-style=framed]{border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:6px 18px 18px}.fd-form .fd-section[data-style=framed]>.fd-section-title{float:none;width:auto;max-width:100%;padding:0 6px;margin-inline-start:-6px;border:0}.fd-form .fd-field[data-labels]{grid-template-columns:minmax(0,1fr)}.fd-form .fd-field[data-labels]>*{grid-column:1 / -1}.fd-form .fd-field[data-labels=beside]{container-type:inline-size;grid-template-columns:minmax(0,var(--fd-label-width, 140px)) minmax(0,1fr);column-gap:14px}@container (min-width: 300px){.fd-form .fd-field[data-labels=beside]>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=beside]>:not(.fd-label){grid-column:2}}.fd-form .fd-field[data-labels=hidden]>.fd-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form .fd-field[data-labels=after]{grid-template-columns:auto minmax(0,1fr);column-gap:9px;align-items:start;--fd-tick-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=after]>:is(.fd-tick,:has(>.fd-tick)){grid-column:1;grid-row:1;display:flex;margin-block-start:calc(var(--fd-tick-drop) + (1.45em - 17px) / 2)}.fd-form .fd-field[data-labels=after] .fd-tick{width:17px;height:17px}.fd-form .fd-field[data-labels=after]>:not(.fd-tick,:has(>.fd-tick)){grid-column:2}.fd-form .fd-field[data-labels=after]>.fd-label{grid-row:1;margin-block-start:var(--fd-tick-drop);font-weight:inherit;line-height:1.45;cursor:pointer}.fd-form .fd-field[data-labels=beside]:focus-within,.fd-grid>.fd-section[data-place=shared]:focus-within{z-index:3}:is(.fd-grid,.fd-sections)>.fd-button{justify-self:start}.fd-form .fd-text-note{background:color-mix(in srgb,var(--fd-text) 6%,transparent);color:var(--fd-text);border-radius:var(--fd-control-radius, 6px);padding:10px 12px}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-font=serif]{--fd-font: "Source Serif 4", Georgia, serif}:is(.fd-form,.fd-form-dialog)[data-font=rounded]{--fd-font: Nunito, "Varela Round", system-ui}:is(.fd-form,.fd-form-dialog)[data-density=compact]{--fd-gap-y: 10px;--fd-gap-x: 16px;--fd-control-height: 30px;--fd-gap-block: 16px;--fd-group-pad: 14px 16px}:is(.fd-form,.fd-form-dialog)[data-density=comfortable]{--fd-gap-y: 16px;--fd-gap-x: 20px;--fd-control-height: 36px;--fd-gap-block: 22px;--fd-group-pad: 18px 22px}:is(.fd-form,.fd-form-dialog)[data-density=roomy]{--fd-gap-y: 22px;--fd-gap-x: 28px;--fd-control-height: 42px;--fd-gap-block: 30px;--fd-group-pad: 24px 30px}:is(.fd-form,.fd-form-dialog)[data-corners=square]{--fd-radius: 0px;--fd-control-radius: 0px}:is(.fd-form,.fd-form-dialog)[data-corners=soft]{--fd-radius: 10px;--fd-control-radius: 6px}:is(.fd-form,.fd-form-dialog)[data-corners=round]{--fd-radius: 16px;--fd-control-radius: 12px}.fd-form[data-scheme]{--fd-ground: var(--fd-page)}}.fd-form[data-scheme]{color-scheme:light;background:var(--fd-page);color:var(--fd-text);border-radius:var(--fd-radius)}:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{color-scheme:dark}}.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:20px}.fd-form-dialog-body>.fd-form[data-scheme]{background:none;border-radius:0}.fd-form-dialog-body>.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:0}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}}:is(.fd-form,.fd-form-dialog)[data-accent]{--fd-accent: var(--fd-look-accent);--fd-accent-text: var(--fd-look-accent-text);--fd-focus: var(--fd-look-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-scheme=dark][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}}:is(.fd-form,.fd-form-dialog):is([data-fd-skin=outlined],[data-fd-skin=quiet])[data-accent]{--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}}:is(.fd-form,.fd-form-dialog)[data-accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}.fd-form[data-accent] .fd-page-head{border-block-end:3px solid var(--fd-accent);padding-block-end:14px}';var Sn='system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif',rl={material:{light:{font:`Roboto, ${Sn}`,text:"#1d1b20",muted:"#49454f",page:"#fef7ff",surface:"#ffffff",border:"#79747e","border-strong":"#49454f",accent:"#6750a4","accent-text":"#ffffff","accent-soft":"#eaddff",focus:"#6750a4","focus-ring":"none",error:"#b3261e","error-soft":"#f9dedc",radius:"12px","control-radius":"4px","control-height":"48px","pad-y":"10px","pad-x":"16px","input-border":"0 0 1px 0","label-weight":"500","gap-x":"24px","gap-y":"20px",fill:"#ece6f0"},dark:{text:"#e6e0e9",muted:"#cac4d0",page:"#141218",surface:"#1d1b20",border:"#938f99","border-strong":"#cac4d0",accent:"#d0bcff","accent-text":"#381e72","accent-soft":"#4f378b",focus:"#d0bcff",error:"#f2b8b5","error-soft":"#601410",fill:"#36343b",edge:"#938f99"}},fluent:{light:{font:`"Segoe UI Variable Text", "Segoe UI", ${Sn}`,text:"#242424",muted:"#616161",page:"#f5f5f5",surface:"#ffffff",border:"#d1d1d1","border-strong":"#616161",accent:"#0f6cbd","accent-text":"#ffffff","accent-soft":"#ebf3fc",focus:"#0f6cbd","focus-ring":"none",error:"#c50f1f","error-soft":"#fdf3f4",radius:"8px","control-radius":"4px","control-height":"32px","pad-y":"5px","pad-x":"10px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#ffffff",muted:"#d6d6d6",page:"#1f1f1f",surface:"#292929",border:"#666666","border-strong":"#adadad",accent:"#479ef5","accent-text":"#0a0a0a","accent-soft":"#0e4775",focus:"#479ef5",error:"#e37d80","error-soft":"#3b1012",edge:"#adadad"}},apple:{light:{font:`-apple-system, BlinkMacSystemFont, "SF Pro Text", ${Sn}`,text:"#1d1d1f",muted:"#6e6e73",page:"#f2f2f7",surface:"#ffffff",border:"#d1d1d6","border-strong":"#8e8e93",accent:"#0066cc","accent-text":"#ffffff","accent-soft":"#e5f0fb",focus:"#0066cc","focus-ring":"0 0 0 4px rgba(0, 113, 227, 0.25)",error:"#d70015","error-soft":"#ffebec",radius:"12px","control-radius":"10px","control-height":"40px","pad-y":"8px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"20px","gap-y":"16px",fill:"#f2f2f7"},dark:{text:"#f5f5f7",muted:"#a1a1a6",page:"#000000",surface:"#1c1c1e",border:"#38383a","border-strong":"#636366",accent:"#409cff","accent-text":"#000000","accent-soft":"#0f2b4d",focus:"#409cff","focus-ring":"0 0 0 4px rgba(64, 156, 255, 0.3)",error:"#ff6961","error-soft":"#3a1412",fill:"#2c2c2e",edge:"#636366"}},bootstrap:{light:{font:Sn,text:"#212529",muted:"#5c636a",page:"#f8f9fa",surface:"#ffffff",border:"#dee2e6","border-strong":"#adb5bd",accent:"#0a58ca","accent-text":"#ffffff","accent-soft":"#cfe2ff",focus:"#86b7fe","focus-ring":"0 0 0 0.25rem rgba(13, 110, 253, 0.25)",error:"#b02a37","error-soft":"#f8d7da",radius:"6px","control-radius":"6px","control-height":"38px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#dee2e6",muted:"#adb5bd",page:"#212529",surface:"#2b3035",border:"#495057","border-strong":"#6c757d",accent:"#6ea8fe","accent-text":"#000000","accent-soft":"#031633",focus:"#6ea8fe","focus-ring":"0 0 0 0.25rem rgba(110, 168, 254, 0.25)",error:"#ea868f","error-soft":"#2c0b0e",edge:"#6c757d"}},shadcn:{light:{font:`Geist, Inter, ${Sn}`,text:"#09090b",muted:"#64646c",page:"#fafafa",surface:"#ffffff",border:"#e4e4e7","border-strong":"#a1a1aa",accent:"#18181b","accent-text":"#fafafa","accent-soft":"#f4f4f5",focus:"#a1a1aa","focus-ring":"0 0 0 3px rgba(161, 161, 170, 0.5)",error:"#dc2626","error-soft":"#fef2f2",radius:"10px","control-radius":"8px","control-height":"36px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"24px","gap-y":"16px"},dark:{text:"#fafafa",muted:"#a1a1aa",page:"#09090b",surface:"#18181b",border:"#3f3f46","border-strong":"#71717a",accent:"#e4e4e7","accent-text":"#18181b","accent-soft":"#27272a",focus:"#71717a","focus-ring":"0 0 0 3px rgba(113, 113, 122, 0.5)",error:"#f87171","error-soft":"#450a0a",edge:"#71717a"}},ant:{light:{font:Sn,text:"rgba(0, 0, 0, 0.88)",muted:"rgba(0, 0, 0, 0.55)",page:"#f5f5f5",surface:"#ffffff",border:"#d9d9d9","border-strong":"#bfbfbf",accent:"#1365d9","accent-text":"#ffffff","accent-soft":"#e6f4ff",focus:"#1365d9","focus-ring":"0 0 0 2px rgba(5, 145, 255, 0.12)",error:"#c63c3d","error-soft":"#fff2f0",radius:"8px","control-radius":"6px","pad-y":"4px","pad-x":"11px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"18px"},dark:{text:"rgba(255, 255, 255, 0.85)",muted:"rgba(255, 255, 255, 0.6)",page:"#000000",surface:"#141414",border:"#424242","border-strong":"#595959",accent:"#3c89e8","accent-text":"#000000","accent-soft":"#111a2c",focus:"#3c89e8","focus-ring":"0 0 0 2px rgba(60, 137, 232, 0.2)",error:"#e86e6b","error-soft":"#2c1618",edge:"#595959"}},odoo:{light:{font:Sn,text:"#1f2937",muted:"#4b5563",page:"#f9fafb",surface:"#ffffff",border:"#d1d5db","border-strong":"#9ca3af",accent:"#714b67","accent-text":"#ffffff","accent-soft":"#f3edf2",focus:"#714b67","focus-ring":"none",error:"#c4161c","error-soft":"#fdecec",radius:"4px","control-radius":"0px","pad-y":"3px","pad-x":"4px","input-border":"0 0 1px 0","label-weight":"600","gap-x":"32px","gap-y":"14px"},dark:{text:"#e5e7eb",muted:"#9ca3af",page:"#111827",surface:"#1f2937",border:"#4b5563","border-strong":"#6b7280",accent:"#c79fbc","accent-text":"#1f1020","accent-soft":"#3b2836",focus:"#c79fbc",error:"#f6878b","error-soft":"#3a1214",edge:"#6b7280"}},"google-forms":{light:{font:`Roboto, Arial, ${Sn}`,text:"#202124",muted:"#5f6368",page:"#f0ebf8",surface:"#ffffff",border:"#dadce0","border-strong":"#80868b",accent:"#673ab7","accent-text":"#ffffff","accent-soft":"#ede7f6",focus:"#673ab7","focus-ring":"none",error:"#d93025","error-soft":"#fce8e6",radius:"8px","control-radius":"0px","control-height":"36px","pad-y":"6px","pad-x":"0px","input-border":"0 0 1px 0","label-weight":"400","gap-x":"24px","gap-y":"12px"},dark:{text:"#e8e3ee",muted:"#b8b0c4",page:"#1c1822",surface:"#2a2431",border:"#4a4255","border-strong":"#7b7088",accent:"#c4abf2","accent-text":"#1d1528","accent-soft":"#3b2f52",focus:"#c4abf2",error:"#f28b82","error-soft":"#3c1714",edge:"#7b7088"}}},da=e=>Object.entries(e).map(([t,n])=>`--fd-${t}: ${n};`).join(" "),_e=e=>`:is(.fd-form, .fd-form-dialog, .fd-theme)[data-fd-theme="${e}"]`,Nr=':is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page])',il=Object.keys(rl).map(e=>{let{light:t,dark:n}=rl[e],r=`${_e(e)}[data-scheme="dark"]`;return`${_e(e)} { ${da(t)} }
|
|
7
|
+
${r} { ${da(n)} }
|
|
8
|
+
@media (prefers-color-scheme: dark) { ${_e(e)}[data-scheme="auto"] { ${da(n)} } }`}).join(`
|
|
9
9
|
`).replace(/^/,`@layer fieldia-tokens {
|
|
10
10
|
`).concat(`
|
|
11
|
-
}`),
|
|
11
|
+
}`),ol=`
|
|
12
12
|
/* A themed form paints its own ground, as one with a scheme does: Google Forms' lilac, Apple's grey. In a dialog, the dialog is its ground. */
|
|
13
13
|
.fd-form[data-fd-theme] { background: var(--fd-page); color: var(--fd-text); border-radius: var(--fd-radius); }
|
|
14
14
|
.fd-form[data-fd-theme] > .fd-content:not(:has(> .fd-sheet-page)) { padding: 20px; }
|
|
@@ -19,7 +19,7 @@ ${_e("material")} .fd-input:not([readonly]) { background: var(--fd-fill); border
|
|
|
19
19
|
${_e("material")} .fd-input:focus { box-shadow: inset 0 -1px 0 0 var(--fd-focus); }
|
|
20
20
|
${_e("material")} .fd-button { border-radius: 20px; min-height: 40px; padding-inline: 24px; font-weight: 500; letter-spacing: 0.01em; border-color: var(--fd-border); }
|
|
21
21
|
${_e("material")} .fd-tab[aria-selected="true"] { border-block-end-width: 3px; }
|
|
22
|
-
${_e("material")} ${
|
|
22
|
+
${_e("material")} ${Nr} { border-color: transparent; background: color-mix(in srgb, var(--fd-accent) 4%, var(--fd-surface)); }
|
|
23
23
|
|
|
24
24
|
/* Fluent: a darker bottom edge under every box, an accent bar on focus; semibold buttons; the picked tab in words, not the accent. */
|
|
25
25
|
${_e("fluent")} .fd-input:not([readonly]) { border-block-end-color: var(--fd-border-strong); }
|
|
@@ -31,7 +31,7 @@ ${_e("fluent")} .fd-tab[aria-selected="true"] { color: var(--fd-text); border-bl
|
|
|
31
31
|
${_e("apple")} .fd-input:not([readonly]) { background: var(--fd-fill); border-color: transparent; }
|
|
32
32
|
${_e("apple")} .fd-input:not([readonly]):focus { background: var(--fd-surface); border-color: var(--fd-focus); }
|
|
33
33
|
${_e("apple")} .fd-button { border-radius: 980px; padding-inline: 18px; font-weight: 500; }
|
|
34
|
-
${_e("apple")} ${
|
|
34
|
+
${_e("apple")} ${Nr} { border-color: transparent; }
|
|
35
35
|
|
|
36
36
|
/* Bootstrap: its buttons' weight and padding. */
|
|
37
37
|
${_e("bootstrap")} .fd-button { padding-inline: 12px; }
|
|
@@ -52,14 +52,14 @@ ${_e("odoo")} .fd-button { border-radius: 4px; }
|
|
|
52
52
|
/* Google Forms: the title a card with a band of the accent along its top; each question its own card; answers underlined. */
|
|
53
53
|
${_e("google-forms")} .fd-page-head { background: var(--fd-surface); border: 1px solid var(--fd-border); border-block-start: 10px solid var(--fd-accent); border-radius: var(--fd-radius); padding: 22px 24px; }
|
|
54
54
|
${_e("google-forms")} .fd-page-title { font-size: 32px; font-weight: 400; line-height: 1.2; }
|
|
55
|
-
${_e("google-forms")} ${
|
|
56
|
-
${_e("google-forms")} ${
|
|
57
|
-
${_e("google-forms")} ${
|
|
55
|
+
${_e("google-forms")} ${Nr} { background: none; border: 0; padding: 0; }
|
|
56
|
+
${_e("google-forms")} ${Nr} > .fd-grid > .fd-field:not(.fd-oneline) { background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 22px 24px; }
|
|
57
|
+
${_e("google-forms")} ${Nr} > .fd-grid > .fd-field:focus-within { border-inline-start: 6px solid var(--fd-accent); padding-inline-start: 19px; }
|
|
58
58
|
${_e("google-forms")} .fd-label { font-size: 16px; }
|
|
59
59
|
${_e("google-forms")} .fd-input:not([readonly]) { background: transparent; }
|
|
60
60
|
${_e("google-forms")} .fd-input:focus { box-shadow: inset 0 -1px 0 0 var(--fd-focus); }
|
|
61
61
|
${_e("google-forms")} .fd-button { border-radius: 4px; font-weight: 500; }
|
|
62
|
-
`;var tf={medium:760,narrow:520},nf='@layer fieldia-tokens{.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;--fd-text: #212529;--fd-muted: #636976;--fd-page: #f2f3f5;--fd-surface: #ffffff;--fd-border: #cfd4da;--fd-border-strong: #9aa3ad;--fd-accent: #002855;--fd-accent-text: #ffffff;--fd-accent-soft: #e6ebf2;--fd-focus: #002855;--fd-focus-ring: none;--fd-error: #c62828;--fd-error-soft: #fdecea;--fd-success: #2e7d32;--fd-success-soft: #e8f5e9;--fd-warning: #8a5300;--fd-warning-soft: #fff4e0;--fd-info: #0b5cad;--fd-info-soft: #e7f0fb;--fd-radius: 0px;--fd-control-radius: 0px;--fd-pad-y: 3px;--fd-pad-x: 4px;--fd-input-border: 0 0 1px 0;--fd-label-weight: 600;--fd-gap-x: 32px;--fd-gap-y: 14px}.fd-form[data-fd-skin=outlined],.fd-theme[data-fd-skin=outlined]{--fd-text: rgba(0, 0, 0, .88);--fd-muted: rgba(0, 0, 0, .55);--fd-page: #f5f5f5;--fd-border: #d9d9d9;--fd-border-strong: #bfbfbf;--fd-accent: #1365d9;--fd-accent-soft: #e6f4ff;--fd-focus: #1365d9;--fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, .12);--fd-error: #c63c3d;--fd-error-soft: #fff2f0;--fd-radius: 8px;--fd-control-radius: 6px;--fd-pad-y: 4px;--fd-pad-x: 11px;--fd-input-border: 1px;--fd-label-weight: 400;--fd-gap-x: 24px;--fd-gap-y: 18px}}.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){container-type:inline-size;font-family:var(--fd-font);font-size:14px;line-height:1.45;color:var(--fd-text);-webkit-text-size-adjust:100%}.fd-form *,.fd-form *:before,.fd-form *:after{box-sizing:border-box}.fd-form [hidden]{display:none!important}.fd-page-head{display:grid;gap:4px;margin-block-end:20px}.fd-page-title{font-size:22px;font-weight:650;margin:0;line-height:1.25}.fd-page-description{color:var(--fd-muted);margin:0}.fd-form[data-max-width=narrow]{--fd-page-max: 640px}.fd-form[data-max-width=medium]{--fd-page-max: 900px}.fd-form[data-max-width=wide]{--fd-page-max: 1180px}.fd-form[data-max-width=full]{--fd-page-max: none}.fd-form[data-max-width]>.fd-content:not(:has(>.fd-sheet-page)){max-width:var(--fd-page-max);margin-inline:auto}.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)}.fd-icon{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em}.fd-section-title .fd-icon,.fd-tab .fd-icon,.fd-button .fd-icon,.fd-step-title .fd-icon{margin-inline-end:.4em}.fd-section-title .fd-icon{color:var(--fd-muted)}.fd-grid{--fd-cols: var(--fd-columns, 1);--fd-span: 1;display:grid;grid-template-columns:repeat(var(--fd-cols),minmax(0,1fr));gap:var(--fd-gap-y) var(--fd-gap-x);align-items:start}.fd-grid>*{grid-column:span min(var(--fd-span, 1),var(--fd-cols))}.fd-grid[data-twelfths]{column-gap:min(var(--fd-gap-x),100% / 24)}.fd-field{display:grid;gap:4px;min-width:0}.fd-label{font-weight:var(--fd-label-weight);color:var(--fd-text)}.fd-valid-mark{color:var(--fd-success);width:1em;height:1em;margin-inline-start:6px;vertical-align:-.15em;stroke-width:2.4}.fd-field.fd-required>.fd-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-form[data-fd-skin=outlined] .fd-field.fd-required>.fd-label:after{content:none}.fd-form[data-fd-skin=outlined] .fd-field.fd-required>.fd-label:before{content:"*";margin-inline-end:.25em;color:var(--fd-error)}.fd-help{color:var(--fd-muted);font-size:12.5px}.fd-help-tip-wrap{position:relative;display:inline-flex;vertical-align:.05em;margin-inline-start:6px}.fd-label>.fd-help-tip-wrap{position:absolute;margin-block-start:.15em}.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:22px}.fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap):after{padding-inline-start:22px}.fd-form:not([data-fd-skin=outlined]) .fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:0}.fd-help-tip{all:unset;box-sizing:border-box;display:inline-grid;place-items:center;width:16px;height:16px;border:1px solid var(--fd-border);border-radius:50%;color:var(--fd-muted);font-size:11px;font-weight:600;line-height:1;cursor:help}.fd-help-tip:hover,.fd-help-tip[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-help-tip:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-help-bubble{position:absolute;inset-block-start:calc(100% + 6px);inset-inline-start:-8px;z-index:30;width:max-content;max-width:min(280px,calc(100vw - 16px));padding:6px 9px;border-radius:6px;background:var(--fd-text);color:var(--fd-surface);font-size:12.5px;font-weight:400;line-height:1.4;white-space:normal;box-shadow:0 6px 18px #0000002e}.fd-page-title,.fd-page-description,.fd-section-description,.fd-label,.fd-help,.fd-text-heading,.fd-text-paragraph,.fd-text-note,.fd-choice>span{unicode-bidi:plaintext;text-align:match-parent;text-align:-webkit-match-parent}.fd-error{color:var(--fd-error);font-size:12.5px}.fd-warning{color:var(--fd-warning);background:var(--fd-warning-soft);font-size:12.5px;padding:3px 8px;border-radius:var(--fd-control-radius);justify-self:start}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr);column-gap:12px}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]>*{grid-column:1!important}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>:not(.fd-label){grid-column:2}.fd-form[data-fd-skin=underline] .fd-section[data-row=skin]{--fd-row-label: var(--fd-label-width, 11em);--fd-row-gap: 12px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row=beside]{--fd-row-label: var(--fd-label-width, 140px);--fd-row-gap: 14px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row]{padding-inline-start:calc(var(--fd-row-label, 0px) + var(--fd-row-gap, 0px))}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child{grid-template-columns:minmax(0,1fr);position:relative}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>:not(.fd-label){grid-column:1}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>.fd-label{position:var(--fd-row-place, static);inset-inline-start:calc(-1 * (var(--fd-row-label, 0px) + var(--fd-row-gap, 0px)));inset-block-start:0;width:var(--fd-row-label, auto);padding-block-start:var(--fd-row-drop, 0px)}@container (max-width: 760px){.fd-form[data-fd-skin=underline] .fd-grid{--fd-cols: 1}.fd-form .fd-grid[data-columns-medium]{--fd-cols: var(--fd-columns-medium)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels]))>*{grid-column:1!important}}@container (max-width: 520px){.fd-grid{--fd-cols: 1}.fd-form .fd-section.fd-section[data-row]{--fd-row-label: auto;--fd-row-gap: 0px;--fd-row-place: static;--fd-row-drop: 0px}.fd-form .fd-section[data-row]{padding-inline-start:0}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>*{grid-column:1!important}.fd-form .fd-grid[data-columns-medium],.fd-form .fd-grid[data-columns-narrow]{--fd-cols: var(--fd-columns-narrow, 1)}.fd-form .fd-file-viewer>:first-child{padding-inline-end:16px}.fd-form .fd-file-viewer h2{flex-basis:100%;margin-inline-end:36px}}.fd-input{width:100%;min-width:0;font:inherit;color:inherit;background:var(--fd-surface);border:solid var(--fd-border);border-width:var(--fd-input-border);border-radius:var(--fd-control-radius);padding:var(--fd-pad-y) var(--fd-pad-x);min-height:var(--fd-control-height, 30px);text-overflow:ellipsis;transition:border-color .15s ease,box-shadow .15s ease}.fd-input::placeholder{color:var(--fd-muted);opacity:.8}.fd-input:hover{border-color:var(--fd-border-strong)}.fd-input:focus{outline:none;border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-form[data-fd-skin=underline] .fd-input{background:transparent}.fd-form[data-fd-skin=underline] .fd-input:focus{box-shadow:0 1px 0 0 var(--fd-focus)}.fd-form[data-fd-skin=underline] .fd-field.fd-required .fd-input{border-color:var(--fd-accent)}.fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0}.fd-form[data-fd-skin=outlined] .fd-input[readonly]{background:color-mix(in srgb,var(--fd-text) 5%,var(--fd-surface));border-color:var(--fd-border);padding-inline:var(--fd-pad-x);color:var(--fd-muted)}.fd-form[data-readonly] .fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text)}.fd-form[data-readonly] .fd-input::placeholder{color:transparent}.fd-input[readonly]::placeholder,.fd-form .fd-input.fd-blank[readonly]{color:transparent}.fd-blank[readonly]::-webkit-calendar-picker-indicator{display:none}.fd-form[data-readonly] select.fd-input:disabled{appearance:none;background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text);opacity:1}.fd-input[aria-invalid=true]{border-color:var(--fd-error)}.fd-form[data-fd-skin=outlined] .fd-input[aria-invalid=true]:focus{box-shadow:0 0 0 2px #ff26050f}.fd-textarea{resize:vertical;min-height:64px}.fd-select{appearance:auto}.fd-number{display:flex;align-items:baseline;gap:6px}.fd-number-input{font-variant-numeric:tabular-nums}.fd-currency{color:var(--fd-muted);font-size:12.5px;font-weight:600}.fd-currency-after>.fd-number-input{text-align:end}.fd-currency-picked{align-items:center}.fd-currency-picked>:not(.fd-number-input){flex:0 0 104px;min-width:0}.fd-currency-picked>.fd-number-input{flex:1 1 auto;min-width:0}.fd-pending{color:var(--fd-muted);font-style:italic}.fd-pending:empty:before{content:"\u2014"}.fd-checkbox,.fd-choice input{width:16px;height:16px;accent-color:var(--fd-accent);margin:0}.fd-switch{appearance:none;width:34px;height:20px;margin:0;border-radius:999px;position:relative;background:var(--fd-border-strong);cursor:pointer;transition:background .2s ease}.fd-switch:after{content:"";position:absolute;inset-block-start:2px;inset-inline-start:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s ease;box-shadow:0 1px 2px #00000040}.fd-switch:checked{background:var(--fd-accent)}.fd-switch:checked:after{transform:translate(14px)}[dir=rtl] .fd-switch:checked:after{transform:translate(-14px)}.fd-choices{display:flex;flex-wrap:wrap;gap:6px 18px}.fd-choice{display:inline-flex;align-items:center;gap:8px;cursor:pointer}.fd-choice-other{cursor:default;flex:1 1 260px;max-width:420px;min-width:0}.fd-choice-other-pick{display:inline-flex;align-items:center;gap:8px;cursor:pointer;flex:none}.fd-choice-other .fd-other-input{flex:1;min-width:6em;width:auto;min-height:30px;padding-block:2px}.fd-scale-box{display:inline-grid;gap:4px;max-width:100%}.fd-scale-ends{display:flex;justify-content:space-between;gap:16px;font-size:12.5px;color:var(--fd-muted)}.fd-choices-box{display:grid;gap:6px;min-width:0}.fd-choice-clear{justify-self:end;font:inherit;font-size:13px;color:var(--fd-muted);background:none;border:0;padding:2px 4px;border-radius:4px;cursor:pointer}.fd-choice-clear:hover{color:var(--fd-text);text-decoration:underline;text-underline-offset:3px}.fd-lines-table .fd-choice-clear,.fd-grid-editor .fd-choice-clear{display:none}.fd-points{display:flex;flex-wrap:wrap;gap:6px}.fd-points button{font:inherit;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text);border-radius:var(--fd-control-radius);min-width:34px;height:34px;padding:0 8px}.fd-points button.fd-on{background:var(--fd-accent);color:var(--fd-accent-text);border-color:var(--fd-accent)}.fd-rating button{border:none;background:none;font-size:24px;color:var(--fd-border-strong);padding:0 2px;min-width:0}.fd-rating button.fd-on{background:none;color:#f5a623}.fd-points button:disabled,.fd-choice input:disabled{cursor:default}.fd-form :focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-form .fd-input:focus-visible{outline:none}.fd-combo{position:relative;display:flex;align-items:center;min-width:0}.fd-combo-input{padding-inline-end:30px}.fd-combo-clear{position:absolute;inset-inline-end:3px;border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-clear:hover{color:var(--fd-text);background:var(--fd-page)}.fd-combo:has(>.fd-combo-open:not([hidden])) .fd-combo-input{padding-inline-end:56px}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]) .fd-combo-input[readonly]{padding-inline-end:var(--fd-pad-x)}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]):has(>.fd-combo-open:not([hidden])) .fd-combo-input[readonly]{padding-inline-end:30px}.fd-combo:has(>.fd-combo-input[readonly])>.fd-combo-clear[hidden]~.fd-combo-open{inset-inline-end:3px}.fd-combo-open{position:absolute;inset-inline-end:29px;border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-open:hover{background:var(--fd-page)}.fd-listbox{position:absolute;inset-inline:0;inset-block-start:calc(100% + 2px);z-index:20;margin:0;padding:4px 0;list-style:none;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;max-height:240px;overflow-y:auto}.fd-option{padding:6px 12px;cursor:pointer}.fd-option:hover,.fd-option.fd-active{background:var(--fd-accent-soft)}.fd-option-create{color:var(--fd-accent);border-block-start:1px solid var(--fd-border)}.fd-empty{padding:6px 12px;color:var(--fd-muted);font-style:italic}.fd-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:0}.fd-chips{display:contents;list-style:none;margin:0;padding:0}.fd-chip{display:inline-flex;align-items:center;gap:4px;padding:1px 4px 1px 10px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-text);font-size:13px;line-height:22px}button.fd-chip-label{border:none;padding:0;background:none;font:inherit;color:inherit;cursor:pointer}button.fd-chip-label:hover{text-decoration:underline}.fd-chip-remove{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:0 4px;border-radius:999px}.fd-chip-remove:hover{color:var(--fd-error)}.fd-tags .fd-combo{flex:1 1 140px}.fd-reference{display:grid;grid-template-columns:minmax(7em,34%) minmax(0,1fr);gap:8px}.fd-lines{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}.fd-lines-scroll{overflow-x:auto;min-width:0;position:relative}.fd-lines-table{width:100%;border-collapse:collapse;font-size:13.5px}.fd-lines-table th{text-align:start;font-weight:600;color:var(--fd-muted);font-size:12.5px;padding:6px 8px;border-block-end:1px solid var(--fd-border);white-space:nowrap}.fd-lines-table td{padding:4px 8px;border-block-end:1px solid var(--fd-border);vertical-align:top;min-width:7em}.fd-lines-table td.fd-lines-tools,.fd-lines-table th.fd-lines-tools{width:32px;min-width:32px;padding-inline:0;text-align:center}.fd-lines-table .fd-input{min-height:28px}.fd-lines-table td>.fd-checkbox,.fd-lines-table td>.fd-switch{margin-block-start:6px}.fd-lines-table .fd-lines-grip{width:1px;min-width:0;padding-inline:6px 2px}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td):is(.fd-lines-grip,.fd-lines-tools){position:sticky;z-index:1;background-color:var(--fd-surface)}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-grip{inset-inline-start:0}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-tools{inset-inline-end:0}.fd-lines-table td[data-fit]{min-width:0}.fd-lines-table thead th:not(.fd-lines-grip,.fd-lines-tools){white-space:normal}.fd-lines-table thead th{vertical-align:bottom}.fd-lines-table th[data-fit=boolean]{width:5em;min-width:5em}.fd-lines-table th[data-fit=integer]{width:max(7em,var(--fd-fit-need, 0px));min-width:max(7em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=float]{width:max(7.5em,var(--fd-fit-need, 0px));min-width:max(7.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=monetary]{width:max(11.5em,var(--fd-fit-need, 0px));min-width:max(11.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=date]{width:9em;min-width:9em}.fd-lines-table th[data-fit=datetime]{width:12.5em;min-width:12.5em}.fd-lines-table th:is([data-fit=integer],[data-fit=float],[data-fit=monetary]){text-align:end}.fd-lines-table td:is([data-fit=integer],[data-fit=float],[data-fit=monetary]) input{text-align:end}@media(hover:hover)and (pointer:fine){.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) .fd-input:not([aria-invalid=true]){border-color:transparent;background-color:transparent;box-shadow:none}.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) :is(.fd-combo-open,.fd-combo-clear){visibility:hidden}}.fd-line-grip{display:block;margin-block-start:7px;cursor:grab}.fd-lines-dragging,.fd-lines-dragging *{cursor:grabbing;user-select:none}.fd-lines-dragging>tr:not(.fd-line-lifted){transition:transform .15s ease}.fd-line-lifted{position:relative;z-index:2;box-shadow:0 6px 18px #0f141929}.fd-line-lifted>td{background:var(--fd-surface)}.fd-line-delete{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:4px 6px;border-radius:4px;min-width:24px;min-height:24px}.fd-line-delete:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-lines-table [data-tone=info]{--fd-line-tone: var(--fd-info);--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-lines-table [data-tone=success]{--fd-line-tone: var(--fd-success);--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-lines-table [data-tone=warning]{--fd-line-tone: var(--fd-warning);--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-lines-table [data-tone=danger]{--fd-line-tone: var(--fd-error);--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-lines-table [data-tone=muted]{--fd-line-tone: var(--fd-muted);--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-lines-table [data-tone] :is(input,select,textarea,.fd-input,.fd-display){color:var(--fd-line-tone);-webkit-text-fill-color:var(--fd-line-tone)}.fd-lines-table :is(.fd-line-bold,.fd-cell-bold) :is(input,select,textarea,.fd-input,.fd-display){font-weight:600}.fd-lines-table td.fd-lines-tools{white-space:nowrap}.fd-lines-table:has(.fd-line-button) td.fd-lines-tools{text-align:end;padding-inline-end:4px}.fd-line-button{padding:2px 6px;font-size:12.5px;vertical-align:middle}.fd-line-button-icon{padding:4px;color:var(--fd-muted)}.fd-line-button-icon:hover{color:var(--fd-accent)}.fd-line-button svg{width:15px;height:15px;display:block}.fd-lines-totals td{padding:8px;font-weight:600;border-block-start:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-lines-adds{display:flex;flex-wrap:wrap;gap:4px 16px;justify-self:start}.fd-lines-control{display:inline-flex;align-items:center;gap:6px}.fd-lines-control svg,.fd-lines-chosen-button svg{width:15px;height:15px}.fd-line-lead{display:inline-flex;align-items:center;gap:4px;margin-block-start:6px}.fd-line-lead .fd-line-grip{margin-block-start:0}.fd-lines-table th.fd-lines-grip:has(.fd-line-pick-all){padding-block:4px}.fd-lines-chosen{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:6px 10px;border-radius:var(--fd-radius);background:var(--fd-accent-soft)}.fd-lines-chosen[hidden]{display:none}.fd-lines-chosen-count{font-weight:600;font-size:13px;margin-inline-end:6px}.fd-lines-chosen-button{display:inline-flex;align-items:center;gap:6px;padding-block:3px}.fd-lines-table .fd-line-open{border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:4px 6px;border-radius:4px}.fd-lines-table .fd-line-open:hover{background:var(--fd-accent-soft)}.fd-links-table td{vertical-align:middle}.fd-links-table .fd-value-text{padding-block:4px}.fd-lines[data-fit=content] .fd-lines-table{width:auto;max-width:100%}.fd-lines[data-fit=content] .fd-lines-table td{min-width:0}.fd-lines[data-cards]{container:fd-lines / inline-size}@container fd-lines (max-width: 520px){.fd-lines[data-cards=narrow] .fd-lines-table,.fd-lines[data-cards=narrow] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=narrow] .fd-lines-table thead{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=narrow] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=narrow] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip .fd-line-grip{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr:has(.fd-line-pick){padding-inline-start:36px}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-tools{width:auto;text-align:end}.fd-lines[data-cards=narrow] .fd-lines-totals td:empty{display:none}}.fd-lines[data-cards=always] .fd-lines-table,.fd-lines[data-cards=always] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=always] .fd-lines-table thead{display:none}.fd-lines[data-cards=always] .fd-lines-table tr{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px 12px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=always] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=always] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-grip,.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{grid-column:1 / -1;width:auto}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{text-align:end}.fd-line-copy{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:4px 6px;border-radius:4px}.fd-line-copy:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-line-section td{background:var(--fd-page)}.fd-line-section .fd-input{font-weight:600}.fd-line-note .fd-input{font-style:italic}.fd-cell-error{color:var(--fd-error);font-size:12px}.fd-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-file{display:grid;gap:8px;justify-items:start;padding:6px 0;border-radius:var(--fd-control-radius);min-width:0}.fd-file.fd-dragging{outline:2px dashed var(--fd-accent);outline-offset:4px}.fd-file-pick{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;cursor:pointer}.fd-file input:focus-visible+.fd-file-pick{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-files-list .fd-file-pick{justify-self:stretch;padding:10px 14px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-pick:hover,.fd-dragging .fd-file-pick{border-color:var(--fd-accent)}.fd-files{list-style:none;margin:0;padding:0;display:grid;gap:6px;justify-self:stretch;min-width:0}.fd-files:empty{display:none}.fd-file-item{position:relative;display:flex;align-items:center;gap:2px;min-width:0}.fd-file-open{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:5px 8px;font:inherit;color:inherit;text-align:start;cursor:pointer;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius)}.fd-file-open:hover{border-color:var(--fd-accent)}.fd-file-thumb,.fd-file-icon{flex:none;width:36px;height:36px;border-radius:3px;object-fit:cover}.fd-file-icon{display:grid;place-items:end center;padding-block-end:4px;font-size:9px;font-weight:700;color:#fff;background:var(--fd-kind, #5b6573);clip-path:polygon(0 0,68% 0,100% 28%,100% 100%,0 100%)}.fd-file-icon[data-kind=pdf]{--fd-kind: #c62828}.fd-file-icon[data-kind=doc]{--fd-kind: #1f5fbf}.fd-file-icon[data-kind=sheet]{--fd-kind: #1d7a3e}.fd-file-icon[data-kind=zip]{--fd-kind: #8a5300}.fd-file-name{flex:1;display:flex;min-width:0;white-space:pre}.fd-file-name>span{overflow:hidden;text-overflow:ellipsis}.fd-file-size{color:var(--fd-muted);font-size:12.5px;font-variant-numeric:tabular-nums;unicode-bidi:plaintext}.fd-file-remove{flex:none;width:32px;height:32px;border:none;border-radius:999px;background:none;color:var(--fd-muted);font-size:20px;line-height:1;cursor:pointer}.fd-file-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-file-confirm:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px}.fd-file-note:empty{display:none}.fd-file-note{color:var(--fd-warning)}.fd-file-bar{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;justify-self:stretch}.fd-file-views{display:flex;gap:2px;margin-inline-start:auto;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-views button{display:flex;align-items:center;gap:6px;min-height:28px;padding:2px 10px;font:inherit;font-size:13px;color:var(--fd-muted);cursor:pointer;border:none;border-radius:calc(var(--fd-control-radius) - 2px);background:none}.fd-file-views [aria-pressed=true]{color:var(--fd-text);background:var(--fd-surface);box-shadow:0 0 0 1px var(--fd-border)}.fd-files-thumbs{display:flex;flex-wrap:wrap;align-items:flex-start}.fd-files-thumbs>*{flex-basis:100%}:is(.fd-files-thumbs,.fd-files-cards)>.fd-files{display:contents}.fd-files-thumbs .fd-file-item,.fd-image-pick{flex:none;width:96px;height:96px}.fd-files-thumbs .fd-file-open{height:100%;padding:6px;flex-direction:column;justify-content:center;gap:4px;overflow:hidden;font-size:12px}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-thumb{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit}.fd-files-thumbs .fd-file-name{flex:none;max-width:100%}.fd-files-thumbs .fd-file-size,.fd-files-thumbs .fd-file-thumb~*{display:none}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-remove{position:absolute;inset-block-start:4px;inset-inline-end:4px;width:26px;height:26px;font-size:17px;background:#0f14199e;color:#fff;opacity:0}.fd-file-item:is(:hover,:focus-within) .fd-file-remove{opacity:1}@media(hover:none){.fd-file-item .fd-file-remove{opacity:1}}.fd-image-pick{display:grid;place-content:center;justify-items:center;gap:2px;padding:6px;text-align:center;font-size:12px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-files-cards{grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-files-cards>*{grid-column:1 / -1}.fd-files-cards>.fd-image-pick{grid-column:auto;justify-self:stretch;width:auto;height:auto;min-height:96px}.fd-files-cards .fd-file-item{justify-self:stretch;align-items:stretch}.fd-files-cards .fd-file-open{flex-direction:column;align-items:stretch;gap:2px;padding:0 0 8px;overflow:hidden}.fd-file-picture{position:relative;display:grid;place-items:center;aspect-ratio:4 / 3;margin-block-end:6px;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-file-picture .fd-file-icon{width:44px;height:56px;padding-block-end:8px;font-size:12px}.fd-files-cards :is(.fd-file-name,.fd-file-size){padding-inline:8px}.fd-files-cards .fd-file-name{flex:none;flex-wrap:wrap;font-size:13px;line-height:1.35}.fd-files-cards .fd-file-name>span{max-width:100%}.fd-image-pick .fd-button{border:none;background:none;color:var(--fd-accent);padding:0;min-height:0;font-size:13px}.fd-file-viewer{max-width:1000px;height:min(88vh,100%);background:var(--fd-surface)}.fd-file-viewer>:first-child{position:relative;flex-wrap:wrap;justify-content:start;gap:6px 10px;padding-block:8px;padding-inline-end:52px}.fd-file-viewer .fd-dialog-close{position:absolute;inset-block-start:10px;inset-inline-end:10px}.fd-file-viewer h2{flex:1 1 10em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-file-step{font-size:18px;line-height:1;min-width:34px}.fd-file-viewer a{text-decoration:none}.fd-file-viewer-body{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;background:var(--fd-page)}.fd-file-viewer-body img{max-width:100%;max-height:100%;object-fit:contain}.fd-file-viewer-body :is(iframe,pre){flex:1;align-self:stretch;margin:0;border:0;background:var(--fd-surface)}.fd-file-viewer-body pre{padding:14px 16px;overflow:auto;font:13px/1.5 monospace;white-space:pre-wrap;overflow-wrap:anywhere}.fd-file-none{display:grid;justify-items:center;gap:4px;padding:24px;text-align:center;color:var(--fd-muted)}.fd-file-none strong{color:var(--fd-text);overflow-wrap:anywhere}.fd-file-none .fd-file-icon{width:64px;height:64px;font-size:14px;padding-block-end:8px}.fd-richtext{min-height:96px;line-height:1.5;overflow-wrap:anywhere}.fd-richtext-box{display:grid;gap:0;min-width:0}.fd-richtext-box>.fd-richtext{border-start-start-radius:0;border-start-end-radius:0}.fd-richtext-bar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:4px;min-width:0;border:1px solid var(--fd-border);border-block-end:none;border-start-start-radius:var(--fd-control-radius);border-start-end-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-richtext-style{font:inherit;font-size:12.5px;padding:3px 6px;margin-inline-end:4px;border:1px solid var(--fd-border);border-radius:4px;background:var(--fd-surface);color:var(--fd-text)}.fd-richtext-tool{display:grid;place-items:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:14px}.fd-richtext-tool:hover{background:var(--fd-surface)}.fd-richtext-tool[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-richtext-tool svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round}.fd-richtext-tool svg circle{fill:currentColor;stroke:none}.fd-link-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:6px;border:1px solid var(--fd-border);border-block-end:none;background:var(--fd-surface)}.fd-link-row>.fd-input{flex:1 1 200px;min-width:0}.fd-richtext.fd-blank[contenteditable=true]:before{content:attr(data-placeholder);position:absolute;color:var(--fd-muted);opacity:.8;pointer-events:none}.fd-richtext[contenteditable=false]{background:transparent;border-color:transparent;padding-inline:0;min-height:0}.fd-richtext p{margin:0 0 6px}textarea.fd-code{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:12.5px;min-height:96px}.fd-sections{display:grid;gap:var(--fd-gap-block, 24px)}.fd-section{border:0;margin:0;padding:0;min-width:0;display:grid;gap:14px}.fd-section-title{font-size:15px;font-weight:650;padding:0;margin:0;float:inline-start;width:100%}.fd-section-title+*{clear:both}.fd-form[data-fd-skin=underline] .fd-section-title{text-transform:uppercase;letter-spacing:.05em;font-size:12.5px;color:var(--fd-muted);border-block-end:1px solid var(--fd-border);padding-block-end:6px;width:100%}.fd-section-description{color:var(--fd-muted);margin:0}.fd-section-toggle{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-align:start}.fd-section-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-section-chevron{width:.5em;height:.5em;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin-block-start:-.2em;transition:transform .15s ease;flex:none}.fd-section-folded .fd-section-chevron{transform:rotate(-45deg);margin-block-start:0}[dir=rtl] .fd-section-folded .fd-section-chevron{transform:rotate(135deg)}.fd-form[data-fd-skin=outlined] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:var(--fd-group-pad, 20px 24px)}.fd-form-part-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-form-part-problem{padding:10px 12px;border:1px dashed var(--fd-border);border-radius:var(--fd-radius)}.fd-tablist{display:flex;gap:2px;border-block-end:1px solid var(--fd-border);overflow-x:auto;scrollbar-width:none}.fd-tablist::-webkit-scrollbar{display:none}.fd-tabbar{position:relative;min-width:0;--fd-fade: to right}[dir=rtl] .fd-tabbar{--fd-fade: to left}.fd-tabbar[data-more=start]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px)}.fd-tabbar[data-more=end]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabbar[data-more="start end"]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px,#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabs-scroll{position:absolute;inset-block:0 1px;z-index:1;width:28px;padding:0;border:none;background:none;cursor:pointer;color:var(--fd-muted);display:grid;place-items:center}.fd-tabs-scroll[hidden]{display:none}.fd-tabs-scroll:hover{color:var(--fd-accent)}.fd-tabs-scroll:before{content:"";width:7px;height:7px;border:solid currentColor;border-width:0 0 2px 2px}.fd-tabs-before{inset-inline-start:0}.fd-tabs-after{inset-inline-end:0}.fd-tabs-before:before{transform:translate(2px) rotate(45deg)}.fd-tabs-after:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-before:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-after:before{transform:translate(2px) rotate(45deg)}.fd-tab{font:inherit;background:none;border:none;cursor:pointer;padding:8px 14px;color:var(--fd-muted);border-block-end:2px solid transparent;margin-block-end:-1px;white-space:nowrap}.fd-tab[aria-selected=true]{color:var(--fd-accent);border-block-end-color:var(--fd-accent);font-weight:600}.fd-tab[data-problem]:after{content:"";display:inline-block;width:6px;height:6px;margin-inline-start:6px;border-radius:50%;background:var(--fd-error);vertical-align:.15em}.fd-tabpanel{padding-block:16px;display:grid;gap:16px}.fd-button{font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:6px;justify-content:center;min-height:var(--fd-control-height, 32px);padding:4px 14px;border-radius:var(--fd-control-radius);border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text)}.fd-button:hover{border-color:var(--fd-accent);color:var(--fd-accent)}.fd-button-primary{background:var(--fd-accent);border-color:var(--fd-accent);color:var(--fd-accent-text)}.fd-button-primary:hover{color:var(--fd-accent-text);filter:brightness(1.12)}.fd-button-danger{color:var(--fd-error);border-color:var(--fd-error)}.fd-button-danger:hover{background:var(--fd-error);color:var(--fd-surface)}.fd-button-link{border-color:transparent;background:none;color:var(--fd-accent);padding-inline:4px}.fd-form[data-fd-skin=underline] .fd-button{border-radius:3px}.fd-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.fd-actions-end{justify-content:flex-end;margin-block-start:24px}.fd-sheet-page{background:var(--fd-page);padding:0 0 32px;min-width:0}.fd-header{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;background:var(--fd-surface);border-block-end:1px solid var(--fd-border);padding:8px 16px}.fd-statusbar{display:flex;list-style:none;margin:0;padding:0;overflow-x:auto}.fd-statusbar li{display:flex}.fd-statusbar li>*{font:inherit;font-size:13px;border:none;background:var(--fd-page);color:var(--fd-muted);padding:5px 18px 5px 22px;margin-inline-start:-6px;white-space:nowrap;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%,10px 50%)}.fd-statusbar li:first-child>*{margin-inline-start:0;padding-inline-start:14px;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%)}.fd-statusbar li>button{cursor:pointer}.fd-statusbar li>[aria-current=step]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}[dir=rtl] .fd-statusbar li>*{transform:scaleX(-1)}[dir=rtl] .fd-statusbar li>*>*{display:inline-block;transform:scaleX(-1)}.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}.fd-sheet-layout{align-items:start}.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}@container (min-width: 1534px){.fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr) minmax(260px,360px);max-width:calc(var(--fd-page-max, 1180px) + 376px)}}.fd-sheet-layout.fd-has-side[data-side-beside=always]{grid-template-columns:minmax(0,1fr) minmax(260px,360px)}.fd-form{container-name:fd-form}@container fd-form (max-width: 520px){.fd-form [data-hide-on~=narrow]{display:none!important}}@container fd-form (min-width: 521px) and (max-width: 760px){.fd-form [data-hide-on~=medium]{display:none!important}}@container fd-form (min-width: 761px){.fd-form [data-hide-on~=wide]{display:none!important}}.fd-card{position:relative;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:24px 28px 28px;display:grid;gap:18px;min-width:0;container-type:inline-size}.fd-ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}.fd-ribbon{position:absolute;inset-block-start:18px;inset-inline-end:-42px;transform:rotate(45deg);width:160px;text-align:center;font-size:12px;font-weight:700;padding:4px 0;color:#fff;background:#5f6670;text-transform:uppercase;letter-spacing:.06em;pointer-events:none}[dir=rtl] .fd-ribbon{transform:rotate(-45deg)}.fd-ribbon.fd-tone-danger{background:#c63c3d}.fd-ribbon.fd-tone-success{background:#2e7d32}.fd-ribbon.fd-tone-warning{background:#a14f00}.fd-ribbon.fd-tone-info{background:#1365d9}.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}.fd-alert-message{flex:1 1 auto;min-width:0}.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:.75}.fd-alert-close:hover{opacity:1}.fd-alert-close:focus-visible{outline:2px solid var(--fd-focus);opacity:1}.fd-alert.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-alert.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-alert.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-alert.fd-tone-info,.fd-alert:not([class*=fd-tone-]){background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-stats{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:0;margin:-24px -28px 0;border-block-end:1px solid var(--fd-border)}.fd-stats:empty{display:none}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:104px}.fd-stat{font:inherit;background:none;border:none;border-inline-start:1px solid var(--fd-border);cursor:pointer;padding:8px 18px;display:grid;justify-items:start;line-height:1.2;color:var(--fd-text);min-width:120px}.fd-stat:hover{background:var(--fd-page)}.fd-stat:has(>.fd-icon){grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:10px}.fd-stat>.fd-icon{width:22px;height:22px;color:var(--fd-muted)}.fd-stat-words{display:grid;justify-items:start}.fd-stat-value{font-weight:700;font-size:15px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-stat-label{font-size:12.5px;color:var(--fd-muted)}.fd-title-row{display:flex;gap:16px;align-items:flex-start;justify-content:space-between}.fd-title{display:grid;gap:4px;flex:1 1 auto;min-width:0}.fd-avatar{flex:none}.fd-avatar>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form[data-fd-skin=underline] .fd-avatar{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-avatar>*{grid-column:1!important}.fd-avatar .fd-file{justify-items:center;gap:4px 8px;padding:0;justify-content:center}.fd-avatar :is(.fd-file-item,.fd-image-pick){width:88px;height:88px}.fd-avatar :is(.fd-image-pick .fd-help,.fd-file-limits){display:none}.fd-avatar .fd-button-link{flex-basis:auto;font-size:12.5px}.fd-title>.fd-field .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-form[data-fd-skin=underline] .fd-title>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-title>.fd-field>*{grid-column:1}.fd-title>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-above,.fd-title-below{display:flex;flex-wrap:wrap;align-items:center;gap:6px 24px}.fd-title-above{margin-block-end:4px}.fd-title-below{margin-block-start:6px}.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}.fd-form .fd-title-above>.fd-field>*,.fd-form .fd-title-below>.fd-field>*{grid-column:auto!important}.fd-title-above .fd-label:empty,.fd-title-below .fd-label:empty{display:none}.fd-title-above>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-statusbar{display:flex}.fd-badges{display:flex;flex-wrap:wrap;gap:6px}.fd-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;line-height:1;padding:5px 10px;border-radius:999px;border:1px solid var(--fd-border);background:var(--fd-page);color:var(--fd-muted)}.fd-badge .fd-icon{width:13px;height:13px}.fd-badge.fd-tone-info{background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-badge.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-badge.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-badge.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-side{display:grid;gap:12px;align-content:start;min-width:0}.fd-wizard{display:grid;gap:20px}.fd-progress{display:grid;gap:8px}.fd-progress-text{color:var(--fd-muted);font-size:13px}.fd-value-text{display:block;padding-block:6px;font-variant-numeric:tabular-nums}.fd-field[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-field[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-field[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-field[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-field[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-field[data-tone] :is(input,select,textarea,.fd-value-text,.fd-pending){color:var(--fd-tone);-webkit-text-fill-color:var(--fd-tone)}.fd-field.fd-value-bold :is(input,select,textarea,.fd-value-text,.fd-pending,.fd-value-badge){font-weight:700}.fd-value-badge{justify-self:start;align-self:center;display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:999px;font-size:12.5px;line-height:18px;font-weight:500;color:var(--fd-tone, var(--fd-muted));background:var(--fd-tone-soft, color-mix(in srgb, var(--fd-tone, var(--fd-muted)) 14%, transparent))}.fd-value-badge[hidden]{display:none}.fd-value-badge[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-value-badge[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-value-badge[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-value-badge[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-value-badge[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-date-pick{position:relative;display:flex;align-items:center;gap:6px;min-width:0}.fd-date-pick>.fd-input{flex:1 1 auto;min-width:0}.fd-calendar-button{flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;padding:0;cursor:pointer;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface);color:var(--fd-muted)}.fd-calendar-button:hover,.fd-calendar-button[aria-expanded=true]{color:var(--fd-text);background:var(--fd-page)}.fd-calendar-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round}.fd-calendar{position:absolute;inset-block-start:calc(100% + 4px);inset-inline-end:0;z-index:30;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 8px 24px #0f141924}.fd-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px 6px}.fd-calendar-head button{border:none;background:none;cursor:pointer;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;color:var(--fd-text)}.fd-calendar-head button:hover{background:var(--fd-page)}.fd-calendar-title{font-weight:600}.fd-calendar-grid{border-collapse:collapse;font-variant-numeric:tabular-nums}.fd-calendar-grid th{font-size:11.5px;font-weight:600;color:var(--fd-muted);padding:4px 0;width:34px;text-align:center}.fd-calendar-grid .fd-week{color:var(--fd-accent);font-weight:600;border-inline-end:1px solid var(--fd-border)}.fd-calendar-grid td{padding:1px}.fd-calendar-grid td button{width:32px;height:30px;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:13px}.fd-calendar-grid td button:hover{background:var(--fd-accent-soft)}.fd-calendar-grid td button.fd-outside{color:var(--fd-muted);opacity:.6}.fd-calendar-grid td button[aria-current=date]{box-shadow:inset 0 0 0 1px var(--fd-accent)}.fd-calendar-grid td button[aria-selected=true]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}.fd-calendar-grid td button:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}.fd-properties{display:grid;gap:8px;min-width:0}.fd-property{display:grid;grid-template-columns:minmax(120px,30%) minmax(0,1fr);align-items:center;gap:12px;min-width:0}.fd-property>label{color:var(--fd-muted);font-size:13px}.fd-property[data-type=boolean]>:last-child{justify-self:start}.fd-form[data-fd-skin=underline] .fd-property{grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-property>label{color:var(--fd-text);font-size:inherit;font-weight:var(--fd-label-weight)}@container (max-width: 520px){.fd-property{grid-template-columns:minmax(0,1fr);gap:4px}}.fd-progressbar{position:relative;height:22px;min-width:120px;border-radius:999px;overflow:hidden;background:var(--fd-page);border:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-progressbar-fill{height:100%;background:var(--fd-success);transition:width .2s ease}.fd-progressbar[data-tone=warning] .fd-progressbar-fill{background:#d97706}.fd-progressbar[data-tone=danger] .fd-progressbar-fill{background:var(--fd-error)}.fd-progressbar[data-tone=info] .fd-progressbar-fill{background:var(--fd-info)}.fd-progressbar-text{position:absolute;inset-block:2px;left:50%;translate:-50% 0;display:grid;place-items:center;padding-inline:7px;border-radius:999px;background:var(--fd-surface);font-size:12px;line-height:1;font-weight:600;color:var(--fd-text)}.fd-progressbar-text:empty{display:none}.fd-progressbar-edit{display:flex;align-items:center;gap:12px;min-width:0}.fd-progressbar-edit>.fd-progressbar{flex:1 1 auto}.fd-progressbar-edit>.fd-input{flex:0 0 96px}.fd-progress-bar{height:4px;background:var(--fd-border);border-radius:999px;overflow:hidden}.fd-progress-bar>span{display:block;height:100%;background:var(--fd-accent);transition:width .25s ease}.fd-step{display:grid;gap:18px}.fd-step-title{font-size:18px;font-weight:650;margin:0}.fd-wizard-nav{display:flex;gap:8px;justify-content:space-between}.fd-steps-list{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0;counter-reset:fd-step}.fd-steps-list>li{counter-increment:fd-step}.fd-step-link{font:inherit;font-size:13.5px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-muted);border-radius:999px;padding:4px 12px 4px 6px}.fd-step-link:before{content:counter(fd-step);display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--fd-page);color:var(--fd-muted);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}.fd-step-link:hover{border-color:var(--fd-accent);color:var(--fd-text)}.fd-step-link:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-step-link.fd-step-done{color:var(--fd-text)}.fd-step-link.fd-step-done:before{content:"\u2713";background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-step-link.fd-step-skipped{border-style:dashed;color:var(--fd-muted)}.fd-step-link.fd-step-skipped:before{content:"\u2013";background:var(--fd-page);color:var(--fd-muted)}.fd-step-link[aria-current=step]{border-color:var(--fd-accent);color:var(--fd-accent);font-weight:600}.fd-step-link[aria-current=step]:before{content:counter(fd-step);background:var(--fd-accent);color:var(--fd-accent-text)}.fd-wizard-nav .fd-spacer{flex:1}.fd-text-heading{font-size:16px;font-weight:650;margin:0}.fd-matrix{overflow-x:auto;max-width:100%}.fd-matrix-table{border-collapse:collapse;min-width:100%}.fd-matrix-table th,.fd-matrix-table td{padding:6px 10px;text-align:center;border-bottom:1px solid var(--fd-border)}.fd-matrix-table thead th{font-weight:500;font-size:13px;color:var(--fd-muted)}.fd-matrix-table tbody th{text-align:start;font-weight:500}.fd-matrix-table input{accent-color:var(--fd-accent);width:16px;height:16px;margin:0}.fd-divider{grid-column:1 / -1;width:100%;border:0;border-top:1px solid var(--fd-border);margin:4px 0}.fd-block{min-width:0}.fd-spacer{min-height:24px}.fd-image{display:block;max-width:100%;height:auto;border-radius:var(--fd-radius)}.fd-figure{display:grid;justify-items:start;gap:6px;margin:0}.fd-figure[data-align=center]{justify-items:center}.fd-figure[data-align=end]{justify-items:end}.fd-figure>a,.fd-figure .fd-image{width:var(--fd-image-width, auto);max-width:100%}.fd-figure>a{display:block;border-radius:var(--fd-radius)}.fd-caption{font-size:13px;color:var(--fd-muted)}.fd-text-paragraph{margin:0}.fd-text-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-status{min-height:1.4em;color:var(--fd-muted);font-size:13px}.fd-status-box{display:inline-flex;align-items:center;gap:6px;min-width:0}.fd-status-box .fd-retry{font-size:13px}.fd-announce{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-banner{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 14px;margin-block-end:16px;border:1px solid #f0c47a;border-radius:var(--fd-control-radius);background:var(--fd-warning-soft);color:var(--fd-warning);font-size:13.5px}.fd-banner-text{flex:1 1 16em;min-width:0}.fd-content>.fd-banner:has(+.fd-draft+.fd-sheet-page),.fd-content>.fd-banner:has(+.fd-sheet-page){margin:12px 16px 0}.fd-status-box.fd-toast{position:fixed;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));inset-inline-end:20px;z-index:900;padding:10px 16px;border-radius:8px;background:var(--fd-text);box-shadow:0 8px 24px #0f141940}.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}.fd-toast .fd-retry{color:var(--fd-surface);text-decoration:underline}.fd-toast:has(.fd-status-error){background:var(--fd-error)}.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)}.fd-status-bar .fd-status-error,.fd-status.fd-status-error{color:var(--fd-error)}.fd-status.fd-status-saved{color:var(--fd-success)}.fd-draft{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;padding:10px 14px;margin-block-end:16px;background:var(--fd-info-soft);border:1px solid #a9c8ef;border-radius:var(--fd-control-radius)}.fd-done{padding:40px 0;text-align:center;display:grid;gap:12px;justify-items:center}.fd-done-title{font-size:20px;font-weight:650;margin:0}.fd-dialog-backdrop{position:fixed;inset:0;background:#0f141973;display:grid;place-items:center;z-index:1000;padding:16px}.fd-dialog{background:var(--fd-surface);color:var(--fd-text);border-radius:max(var(--fd-radius),6px);max-width:420px;width:100%;padding:20px 22px;display:grid;gap:16px;box-shadow:0 10px 30px #0003;font-family:var(--fd-font);border:1px solid var(--fd-edge, transparent)}.fd-dialog p{margin:0}.fd-says{position:fixed;inset-inline:16px;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));z-index:1100;display:grid;justify-items:center;gap:8px;pointer-events:none}.fd-say{pointer-events:auto;display:flex;align-items:center;gap:8px;max-width:420px;padding-block:8px;padding-inline:14px 6px;border:1px solid var(--fd-border);border-inline-start:4px solid var(--fd-tone);border-radius:max(var(--fd-control-radius),6px);background:var(--fd-surface);color:var(--fd-text);box-shadow:0 8px 24px #0f141940;font-size:13.5px}.fd-say>span{flex:1 1 auto;min-width:0}.fd-button[aria-busy=true],.fd-stat[aria-busy=true]{cursor:progress}.fd-button[aria-busy=true]:after{content:"";width:.85em;height:.85em;border:2px solid currentColor;border-inline-end-color:transparent;border-radius:50%;animation:fd-spin .8s linear infinite}@keyframes fd-spin{to{rotate:1turn}}.fd-back{margin:8px 12px}.fd-back:before{content:"\u2190"}.fd-back:dir(rtl):before{content:"\u2192"}.fd-form[data-scheme]>.fd-back{margin:12px 20px 0}.fd-form-dialog{display:flex;flex-direction:column;width:100%;max-height:min(90vh,100%);min-height:0;background:var(--fd-page);color:var(--fd-text);border-radius:max(var(--fd-radius),8px);box-shadow:0 24px 64px #0f14194d;overflow:hidden}.fd-form-dialog:focus{outline:none}.fd-form-dialog.fd-size-small{max-width:440px}.fd-form-dialog.fd-size-medium{max-width:760px}.fd-form-dialog.fd-size-large{max-width:1080px}.fd-form-dialog-backdrop:has(>.fd-size-full),.fd-form-panel-backdrop{padding:0}.fd-form-dialog:is(.fd-size-full,.fd-form-panel){max-height:none;height:100%;border-radius:0}.fd-size-full{max-width:none}.fd-form-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-block-end:1px solid var(--fd-border);background:var(--fd-surface)}.fd-form-dialog-title{margin:0;font-size:16px;font-weight:600}.fd-dialog-close{border:none;background:none;cursor:pointer;font-size:22px;line-height:1;padding:2px 8px;border-radius:4px;color:var(--fd-muted)}.fd-dialog-close:hover{background:var(--fd-page);color:var(--fd-text)}.fd-form-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;container-type:inline-size}.fd-form-dialog-body .fd-sheet-layout{margin-block-start:12px}.fd-form-dialog-body .fd-page-title{display:none}.fd-form-dialog-body .fd-page-head:not(:has(.fd-page-description)){display:none}.fd-form-dialog-body .fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr)}.fd-form-dialog-body .fd-side{display:none}.fd-search-body{display:grid;gap:12px;align-content:start}.fd-search-list{list-style:none;margin:0;padding:0;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:auto;max-height:min(60vh,520px)}.fd-search-list .fd-option{padding:8px 12px}.fd-search-list .fd-option+.fd-option{border-block-start:1px solid var(--fd-border)}.fd-search-list .fd-empty{padding:10px 12px;color:var(--fd-muted)}.fd-form-dialog-body:not(:has(.fd-sheet-layout)){background:var(--fd-surface);padding:16px 20px 20px}.fd-form-dialog-foot{padding:12px 16px;border-block-start:1px solid var(--fd-border);background:var(--fd-surface);margin:0}.fd-form-panel-backdrop{justify-items:end}.fd-form-panel{max-width:560px;position:relative}.fd-form-panel>.fd-dialog-backdrop{position:absolute}.fd-width-narrow{max-width:420px}.fd-width-wide{max-width:720px}.fd-form-panel[data-side=start]{justify-self:start}.fd-form-panel[data-side=left]{justify-self:left}.fd-form-panel[data-side=right]{justify-self:right}.fd-form-panel[data-side=top]{align-self:start;--fd-from: 0 -100%;--fd-back: 48px 0 0}.fd-form-panel[data-side=bottom]{align-self:end;--fd-from: 0 100%;--fd-back: 0 0 48px}.fd-form-panel[data-side=end]:dir(rtl),.fd-form-panel[data-side=start]:dir(ltr),.fd-form-panel[data-side=left]{--fd-from: -100% 0;--fd-back: 0 0 0 48px}.fd-form-panel:is([data-side=top],[data-side=bottom]){max-width:none;height:60%}.fd-form-panel.fd-height-short{height:40%}.fd-form-panel.fd-height-tall{height:85%}.fd-form-panel[data-behind]{margin:var(--fd-back, 0 48px 0 0)}@media(max-width:600px){.fd-form-dialog.fd-form-panel[data-side]{max-width:none;height:100%;margin:0;--fd-from: 0 100%}.fd-form-dialog.fd-form-panel[data-side=top]{--fd-from: 0 -100%}}@media(prefers-reduced-motion:no-preference){.fd-form-panel{animation:fd-slide .25s ease-out;transition:margin .2s}}@keyframes fd-slide{0%{translate:var(--fd-from, 100% 0)}}@media(prefers-reduced-motion:reduce){.fd-form *,.fd-form *:before,.fd-form *:after{transition:none!important}.fd-button[aria-busy=true]:after{animation:none}}',Ld=nf+wd+vd+gd+bd+yd+kd+pd+md+hd,Sd="fieldia-styles";function Do(e){if(e.getElementById(Sd))return;let t=e.createElement("style");t.id=Sd,t.textContent=Ld,(e.head??e.documentElement).append(t)}function Wo(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 rf(){let e=new Map;return{get:t=>e.has(t)?Ed(e.get(t)):null,set:(t,n)=>{e.set(t,Ed(n))}}}var Ed=e=>JSON.parse(JSON.stringify(e));function jo(e,t){let n=t.widget;switch(e.type){case"char":return!n||n==="email"||n==="phone"||n==="url";case"selection":return!n&&!e.multiple&&!e.optionsFrom;case"text":case"integer":case"float":return!n||n==="duration"||n==="percentage";case"monetary":case"date":case"datetime":case"many2one":case"reference":return!n;default:return!1}}var of={email:[/^[^\s@]+@[^\s@]+$/,"mailto:"],phone:[/^\+?[\d\s().-]{3,}$/,"tel:"],url:[/^https?:\/\/\S+$/i,""]};function af(e,t,n,r){if(t.type!=="integer"&&t.type!=="float"||n.widget||r===null||r===void 0||e==="")return e;let i=o=>typeof n.options?.[o]=="string"?n.options[o].trim():"";return[i("prefix"),e,i("suffix")].filter(Boolean).join(" ")}function Ho(e){let{document:t,field:n,node:r,locale:i="en",labels:o=tt.en,dialogs:a}=e,s=t.createElement("div");s.className="fd-read-text",s.id=`${e.id}-text`;let d=n.type==="many2one"?n.relation:null,l=d!==null&&r.options?.open!==!1&&!!a?.canOpen(d),f="";return{element:s,update(c,v){let m=af(Tn(n,c,v,i,void 0,{widget:r.widget,options:r.options}),n,r,c),S=JSON.stringify([m,c??null]);if(S===f)return;f=S;let g=r.widget?of[r.widget]:void 0,p=d!==null&&c&&typeof c=="object"&&"id"in c?c:null,b;if(g&&typeof c=="string"&&g[0].test(c.trim())){let L=t.createElement("a");L.href=`${g[1]}${c.trim()}`,r.widget==="url"&&Object.assign(L,{target:"_blank",rel:"noopener noreferrer"}),L.textContent=m,b=L}else if(l&&p){let L=t.createElement("button");L.type="button",L.className="fd-read-link",L.textContent=m,L.setAttribute("aria-label",o.openNamed.replace("{name}",p.label)),L.addEventListener("click",()=>{a?.openRecord(d,{recordId:p.id,title:p.label})}),b=L}else b=t.createTextNode(m);let h=p&&r.options?.avatar===!0?[_n(t,p)]:[],x=[];if(p?.details?.trim()&&r.options?.details===!0){let L=t.createElement("div");L.className="fd-link-details",ai(L,p.details.trim()),x.push(L)}s.replaceChildren(...h,b,...x)}}}var Rd={};var sf={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",discardChanges:"Discard your changes?",dismiss:"Dismiss",helpFor:"Help for {label}",retry:"Retry",notSaved:"Not saved",notSent:"Not sent",checkFields:"{what}. Check: {fields}",offline:"Could not reach the server. Your changes are still here.",previousPage:"Previous page",nextPage:"Next page",range:"{from}\u2013{to} / {total}",selected:"{n} selected",clearSelection:"Clear",selectAll:"Select all",showAs:"Show as",viewList:"List",viewMap:"Map",viewBoth:"List and map",selectRecord:"Select {name}",noRecords:"No records match.",loadFailed:"Could not load the records.",search:"Search\u2026",searchLabel:"Search",searchFor:"Search {field} for: {text}",searchOptions:"Search options",filters:"Filters",groupBy:"Group By",favourites:"Favourites",or:"or",removeFacet:"Remove {label}",addCustomFilter:"Add a custom filter",field:"Field",condition:"Condition",value:"Value",apply:"Apply",saveSearch:"Save current search",searchName:"Name of the search",useByDefault:"Use by default",deleteFavourite:"Delete {name}",noFavourites:"No saved searches yet.",opIs:"is",opIsNot:"is not",opContains:"contains",opGreater:"greater than",opLess:"less than",opSet:"is set",opNotSet:"is not set",yes:"Yes",no:"No",none:"None",loadMore:"Show {n} more",formMissing:"The saved form \u201C{page}\u201D cannot be found.",formInItself:"The saved form \u201C{page}\u201D is not shown here: it would be placed inside itself ({chain}).",formNotPlaceable:"The saved form \u201C{page}\u201D cannot be placed here: only a form of sections or tabs can.",formBroken:"The saved form \u201C{page}\u201D cannot be shown.",pageMissing:"The page \u201C{page}\u201D cannot be found.",actions:"Actions",print:"Print",archive:"Archive",unarchive:"Unarchive",duplicate:"Duplicate",delete:"Delete",breadcrumbs:"Breadcrumbs",newRecord:"New",records:"Records",recordAt:"{n} / {total}",previousRecord:"Previous record",nextRecord:"Next record",attachment:"Attachment: {name}",openAttachment:"Open",previousAttachment:"Previous attachment",nextAttachment:"Next attachment"},It={en:sf,...Rd},Ad=It.en,df=new Map([["ar","Arabic"],["de","German"],["fr","French"]]),Fd=new Set;function wr(e="en"){let t=e.split("-")[0];if(Object.prototype.hasOwnProperty.call(It,t))return t;let n=df.get(t);return n&&!Fd.has(t)&&(Fd.add(t),console.warn(`Fieldia: this page is in ${n}, but only English words are loaded, so Fieldia's own words show in English. Load the ${n} ones after fieldia.js: <script src="https://cdn.jsdelivr.net/npm/@fieldia/viewer/bundle/fieldia.${t}.js"><\/script>`)),"en"}var Bo="#111418",Nd="#1f2329",lf="#f2f3f5";var zo=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),cf=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function $d(e){let[t,n,r]=zo(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function Mn(e,t){let[n,r]=[$d(e),$d(t)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}var ff=e=>Mn(e,"#ffffff")>=4.5?"#ffffff":Bo,uf=e=>Mn(e,Bo)>=Mn(e,"#ffffff")?Bo:"#ffffff",Cd=(e,t,n)=>cf(zo(e).map((r,i)=>r+(zo(t)[i]-r)*n)),pf=(e,t)=>Cd(t,e,.12),Td=(e,t)=>[...t,pf(e,t[0])].every(n=>Mn(e,n)>=4.5);function Mi(e,t,n){let r=e;for(let i=1;i<=40&&!n(r);i++)r=Cd(e,t,i/40);return r}function kr(e,t={light:[],dark:[]}){let n=e.toLowerCase(),r=Mi(n,"#000000",o=>Td(o,["#ffffff",lf,...t.light])),i=Mi(n,"#ffffff",o=>Td(o,[Nd,...t.dark]));return{accent:r,accentText:ff(r),dark:i,darkText:uf(i)}}var mf=["#212529","#636976","#c63c3d"],gf=["#e8eaed","#a3a9b2","#ff8a7a"],hf={accent:"#1365d9",dark:"#5aa2ff"},Md={background:"bg",border:"border",corners:"radius",textSize:"size",accent:"accent"},bf={small:"13px",large:"16px"},yf={square:[0,0],soft:[6,10],round:[12,16]};function vf(e,t){let n=(d,l)=>t.scheme==="dark"?l:t.scheme==="auto"?`light-dark(${d}, ${l})`:d,r=t.accent?kr(t.accent):hf,i=Object.entries(t.parts??{}),o=(d,l,f)=>e.style.setProperty(`--fd-${d}-${l}`,f),a={light:[],dark:[]},s=d=>l=>d.every(f=>Mn(f,l)>=4.5);for(let[d,l]of i){let f=l.background?.toLowerCase();if(!f)continue;let c=Mi(f,"#ffffff",s([...mf,r.accent])),v=Mi(f,Nd,s([...gf,r.dark]));a.light.push(c),a.dark.push(v),o(d,"bg",n(c,v))}for(let[d,l]of i){let f=Object.keys(Md).filter(c=>l[c]).map(c=>Md[c]);if(f.length&&e.setAttribute(`data-${d}`,f.join(" ")),l.border&&o(d,"border",l.border),l.corners&&o(d,"radius",`${yf[l.corners][d==="groups"?1:0]}px`),l.textSize&&o(d,"size",bf[l.textSize]),l.accent){let c=kr(l.accent,a);o(d,"accent",n(c.accent,c.dark)),o(d,"accent-text",n(c.accentText,c.darkText))}}}var qo={material:"outlined",fluent:"outlined",apple:"outlined",bootstrap:"outlined",shadcn:"outlined",ant:"outlined",odoo:"underline","google-forms":"outlined"};function xn(e,t){return e??(t?qo[t]:"underline")}var _o=["text","muted","page","surface","fill","border","border-strong","edge","accent","accent-text","accent-soft","accent-hover","focus","focus-ring","error","error-soft","success","success-soft","warning","warning-soft","info","info-soft","radius","control-radius","font","label-weight"];function wn(e,t){for(let n of _o){let r=t?.[n];r?e.style.setProperty(`--fd-${n}`,r):e.style.removeProperty(`--fd-${n}`)}}function Nn(e,t){if(t){t.theme&&e.setAttribute("data-fd-theme",t.theme);for(let n of["font","density","corners","scheme"]){let r=t[n];r&&e.setAttribute(`data-${n}`,r)}if(t.labelWidth&&e.style.setProperty("--fd-label-width",`${t.labelWidth}px`),t.accent){let n=kr(t.accent);e.setAttribute("data-accent",""),e.style.setProperty("--fd-look-accent",n.accent),e.style.setProperty("--fd-look-accent-text",n.accentText),e.style.setProperty("--fd-look-accent-dark",n.dark),e.style.setProperty("--fd-look-accent-dark-text",n.darkText)}vf(e,t)}}function Cn(e,t,n){let r=jn(t);e.setAttribute("data-hotkey",t),e.setAttribute("aria-keyshortcuts",r),e.title=`${n} (${r})`;let i=e.ownerDocument.createElement("kbd");i.className="fd-hotkey",i.setAttribute("aria-hidden","true"),i.dir="ltr",i.textContent=`${t.startsWith("shift+")?"\u21E7":""}${t.slice(-1).toUpperCase()}`,e.append(i)}function Ni(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return null;let t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code);return t?`${e.shiftKey?"shift+":""}${(t[1]??t[2]).toLowerCase()}`:null}var Od=0,Sr='input:not([type="hidden"]), select, textarea, [contenteditable="true"]';function Ci(e){return[...e.querySelectorAll(".fd-field[data-focus]")].find(n=>!n.closest("[hidden]"))?.querySelector(Sr)??null}var Pd=e=>(t,n={},r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))i.setAttribute(o,a);return r!==void 0&&(i.textContent=r),i};function Xn(e){return Vd(e,`fd-size-${e.size??"medium"}`)}function Uo(e){let t=e.side??"end";return Vd(e,`fd-form-panel ${t==="top"||t==="bottom"?`fd-height-${e.height??"medium"}`:`fd-width-${e.width??"medium"}`}`,t)}function Vd(e,t,n){let r=!!n,i=e.container?.ownerDocument??document,o=e.container??i.body,a=i.activeElement instanceof i.defaultView.HTMLElement?i.activeElement:null,s={...It[wr(e.locale)],...e.labels},d=`fd-dialog-${++Od}`,l=Pd(i),f=l("h2",{id:`${d}-title`,class:"fd-form-dialog-title"},e.title),c=l("button",{type:"button",class:"fd-dialog-close","aria-label":s.close},"\xD7"),v=l("div",{class:"fd-form-dialog-body"}),m=l("button",{type:"button",class:"fd-button"},s.discard),S=l("button",{type:"button",class:"fd-button fd-button-primary"},r&&e.mode==="values"?s.done:s.saveClose),g=e.page.look??e.look,p=e.theme??g?.theme,b=l("div",{class:`fd-theme fd-form-dialog ${t}`,"data-fd-skin":xn(e.skin,p),role:"dialog","aria-modal":"true","aria-labelledby":f.id,tabindex:"-1"});n&&b.setAttribute("data-side",n),e.dir&&b.setAttribute("dir",e.dir),Nn(b,p?{...g,theme:p}:g),wn(b,e.tokens),b.append(l("div",{class:"fd-form-dialog-head"}),v,l("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),b.firstElementChild?.append(f,c);let x=(e.page.layout.type==="sections"||e.page.layout.type==="sheet"?e.page.layout.footer??[]:[]).map(A=>({node:A,button:l("button",{type:"button",class:`fd-button fd-button-${A.style??"secondary"}`,"data-node":A.id},A.label)}));for(let{node:A,button:w}of x)A.hotkey&&Cn(w,A.hotkey,A.label);b.lastElementChild?.append(...x.length?x.map(A=>A.button):[m,S]);let L=l("div",{class:`fd-dialog-backdrop fd-form-dialog-backdrop${r?" fd-form-panel-backdrop":""}`});L.append(b);let y=r?[...i.querySelectorAll(".fd-form-panel")].pop():void 0;y?.setAttribute("data-behind",""),o.append(L);let R=Lr(v,{...e,page:g&&!e.page.look?{...e.page,look:g}:e.page,showActions:!1,records:void 0,breadcrumbs:void 0,host:{...e.host,close:()=>m.click()}});r&&R.element.dir&&(L.dir=R.element.dir);let E=!1;e.recompute&&xf(R.form,e.page.fields,e.recompute,()=>E);let k=()=>Ci(v)??v.querySelector(Sr);return(k()??b).focus(),R.form.settled().then(()=>{(i.activeElement===b||!b.contains(i.activeElement))&&k()?.focus()}),new Promise(A=>{let w=D=>{if(E)return;E=!0;let I=R.form.getState(),B={saved:D,recordId:I.recordId??null,values:I.values};R.destroy(),L.remove(),y?.removeAttribute("data-behind"),a?.focus(),A(B)},j=()=>new Promise(D=>{let I=i.activeElement,B=l("p",{id:`${d}-ask`},s.discardChanges),H=l("button",{type:"button",class:"fd-button"},s.cancel),V=l("button",{type:"button",class:"fd-button fd-button-primary"},s.discard),z=l("div",{class:"fd-actions fd-actions-end"}),T=l("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":B.id}),te=l("div",{class:"fd-dialog-backdrop"});z.append(H,V),T.append(B,z),te.append(T);let Y=K=>{te.remove(),I?.focus(),D(K)};H.addEventListener("click",()=>Y(!1)),V.addEventListener("click",()=>Y(!0)),te.addEventListener("keydown",K=>{K.stopPropagation(),K.key==="Escape"?Y(!1):Gt(T,K)}),b.append(te),H.focus()}),C=async()=>{(!r||!R.form.getState().dirty.length||await j())&&w(!1)};S.addEventListener("click",async()=>{S.disabled=!0;let D=e.mode==="values"?R.check():await R.save();S.disabled=!1,D&&w(!0)}),m.addEventListener("click",()=>w(!1));let O=!1;R.on("save",()=>O=!0),R.on("send",()=>O=!0);let W=()=>{for(let{node:D,button:I}of x)I.hidden=R.form.node(D.id).invisible};x.length&&(W(),R.form.subscribe(W));for(let{node:D,button:I}of x)I.addEventListener("click",async()=>{if(I.hasAttribute("aria-busy"))return;I.setAttribute("aria-busy","true"),O=!1;let B=await R.form.runAction(D.id);I.removeAttribute("aria-busy"),!E&&(O?w(!0):(B.reason==="check"||B.reason==="save")&&R.check())});c.addEventListener("click",C),b.addEventListener("keyup",D=>D.key==="Alt"&&b.removeAttribute("data-hotkeys")),b.addEventListener("keydown",D=>{D.key==="Alt"&&b.setAttribute("data-hotkeys","");let I=Ni(D),B=I?x.find(({node:H,button:V})=>H.hotkey===I&&!V.hidden&&!V.disabled)?.button:void 0;if(B){D.preventDefault(),b.removeAttribute("data-hotkeys"),B.click();return}if(D.key==="Enter"&&(D.ctrlKey||D.metaKey)&&!D.isComposing){if(D.target.closest(".ag-root-wrapper"))return;D.preventDefault(),i.activeElement?.dispatchEvent(new Event("change",{bubbles:!0})),x.length?x.find(({node:H,button:V})=>H.style==="primary"&&!V.hidden)?.button.click():S.click();return}D.defaultPrevented||(D.key==="Escape"?(D.preventDefault(),C()):Gt(b,D))})})}function xf(e,t,n,r){let i=JSON.stringify(e.getState().values),o=!1;e.subscribe(()=>{let a=e.getState().values,s=JSON.stringify(a);o||s===i||(i=s,n(a).then(d=>{if(r()||JSON.stringify(e.getState().values)!==s)return;o=!0;let l=Object.fromEntries(Object.entries(d).filter(([f,c])=>f in t&&JSON.stringify(a[f]??null)!==JSON.stringify(c??null)));Object.keys(l).length&&e.setValues(l),o=!1,i=JSON.stringify(e.getState().values)},()=>{}))})}function Ko(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,i=wr(e.locale),o=It[i],a=tt[i],s=`fd-dialog-${++Od}`,d=Pd(t),l=d("h2",{id:`${s}-title`,class:"fd-form-dialog-title"},e.title),f=d("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),c=d("input",{type:"search",class:"fd-input","aria-label":a.search,placeholder:a.search,"aria-controls":`${s}-list`,autocomplete:"off"}),v=d("ul",{id:`${s}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":l.id}),m=d("button",{type:"button",class:"fd-button"},o.cancel),S=d("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":xn(e.skin,e.theme??e.look?.theme),role:"dialog","aria-modal":"true","aria-labelledby":l.id});e.dir&&S.setAttribute("dir",e.dir);let g=e.theme??e.look?.theme;Nn(S,g?{...e.look,theme:g}:e.look),wn(S,e.tokens);let p=d("div",{class:"fd-form-dialog-head"});p.append(l,f);let b=d("div",{class:"fd-form-dialog-body fd-search-body"});b.append(c,v);let h=d("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});h.append(m),S.append(p,b,h);let x=d("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return x.append(S),n.append(x),c.focus(),new Promise(L=>{let y=[],R=-1,E=0,k,A=C=>{clearTimeout(k),E++,x.remove(),r?.focus(),L(C)},w=()=>{v.replaceChildren(...y.map((C,O)=>{let W=d("li",{id:`${s}-option-${O}`,role:"option",class:`fd-option${O===R?" fd-active":""}`,"aria-selected":String(O===R)},C.label);return W.addEventListener("click",()=>A(C)),W})),y.length||v.append(d("li",{class:"fd-empty"},a.noResults)),R>=0?c.setAttribute("aria-activedescendant",`${s}-option-${R}`):c.removeAttribute("aria-activedescendant")},j=()=>{clearTimeout(k);let C=++E;k=setTimeout(async()=>{let O=await e.search(c.value,80).catch(()=>[]);C===E&&(y=O,R=-1,w())},180)};c.addEventListener("input",j),c.addEventListener("keydown",C=>{if(C.key==="ArrowDown"||C.key==="ArrowUp"){if(C.preventDefault(),!y.length)return;R=(R+(C.key==="ArrowDown"?1:-1)+y.length)%y.length,w(),v.children[R]?.scrollIntoView?.({block:"nearest"})}else C.key==="Enter"&&R>=0&&(C.preventDefault(),A(y[R]))}),m.addEventListener("click",()=>A(null)),f.addEventListener("click",()=>A(null)),S.addEventListener("keydown",C=>{C.key==="Escape"?(C.preventDefault(),A(null)):Gt(S,C)}),j()})}function Jo(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 wf(e,t,n,r){let i=Object.fromEntries(Object.entries(e).map(([o,a])=>[o,n?{...a,readonly:!0}:a]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:i,layout:{type:"sections",id:"values",children:r??[{type:"section",id:"values-section",columns:2,children:Object.keys(i).map(o=>({type:"field",id:`values-${o}`,field:o}))}]}}}function Er(e,t){let{pages:n,relatedPages:r}=e,i="model"in t?t.model:t.version===void 0?t.id:`${t.id}@${t.version}`,o=typeof n=="function"?n(t):n&&Object.prototype.hasOwnProperty.call(n,i)?n[i]:null;return o instanceof Promise?o.then(a=>a??null):o||!("model"in t)?o??null:(typeof r=="function"?r(t.model):r?.[t.model])??null}function kf(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function Id(e,t){let n=i=>Er(e,{model:i}),r={locale:e.locale,skin:e.skin,theme:e.theme??e.page.look?.theme,get tokens(){return e.tokens},dir:e.dir,widgets:e.widgets,preferences:e.preferences,pages:e.pages,relatedPages:e.relatedPages,translate:e.translate,look:e.page.look,user:e.user,context:e.context};return{canOpen:i=>n(i)!==null,async openRecord(i,o){let a=await n(i);if(!a)return null;let s=Jo(a),d=await Xn({...r,page:a,dataSource:e.dataSource,recordId:o.recordId??null,values:o.name||o.values?{...o.values??{},...o.name&&s?{[s]:o.name}:{}}:void 0,title:o.title,size:"large",...t?{host:{say:t}}:{}});if(!d.saved||d.recordId===null)return null;let l=s?d.values[s]:null,f=typeof l=="string"&&l?l:o.name??o.title;return o.withValues?{id:d.recordId,label:f,values:d.values}:{id:d.recordId,label:f}},searchMore:i=>Ko({title:i.title,search:i.search,locale:e.locale,skin:e.skin,theme:e.theme,tokens:e.tokens,dir:e.dir,look:e.page.look}),async editValues(i){let o=await Xn({...r,page:wf(i.fields,i.title,i.readonly===!0,i.layout),...i.parent?{parent:i.parent}:{},dataSource:kf(e.dataSource),values:i.values,title:i.title,...i.layout?{size:"large"}:{},mode:"values",...i.recompute?{recompute:i.recompute}:{},...t?{host:{say:t}}:{}});return o.saved?o.values:null}}}var Dd=e=>`favourites:${e.id}`;function Oi(e,t){let n=e.get(Dd(t));return Array.isArray(n)?n:[]}function Wd(e,t,n){let r=Oi(t,n).find(i=>i.isDefault);return r?r.facets:e.defaultFilters?.length?[{kind:"filters",ids:[...e.defaultFilters],labels:e.defaultFilters.map(i=>e.filters?.find(o=>o.id===i)?.label??i)}]:[]}function jd(e){let{page:t,el:n,labels:r,fill:i,preferences:o}=e,a=n("ul",{class:"fd-favourite-list"}),s=n("p",{class:"fd-favourites-none"},r.noFavourites),d=n("input",{class:"fd-input","aria-label":r.searchName,placeholder:r.searchName}),l=n("input",{type:"checkbox"}),f=n("button",{type:"button",class:"fd-button fd-button-primary"},r.save),c=n("div",{class:"fd-favourite-form",hidden:""},d,n("label",{class:"fd-favourite-default"},l,r.useByDefault),f),v=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.saveSearch),m=g=>o.set(Dd(t),g);function S(){let g=Oi(o,t);s.hidden=g.length>0,a.replaceChildren(...g.map(p=>{let b=n("button",{type:"button",class:"fd-search-option","data-default":p.isDefault?"true":void 0},p.name);b.addEventListener("click",()=>e.apply(p.facets));let h=n("button",{type:"button",class:"fd-favourite-remove","aria-label":i(r.deleteFavourite,{name:p.name})},"\xD7");return h.addEventListener("click",()=>{m(Oi(o,t).filter(x=>x.name!==p.name)),S()}),n("li",{class:"fd-favourite"},b,h)}))}return v.addEventListener("click",()=>{c.hidden=!c.hidden,v.setAttribute("aria-expanded",String(!c.hidden)),c.hidden||d.focus()}),f.addEventListener("click",()=>{let g=d.value.trim();if(!g)return d.focus();let p={name:g,facets:e.current(),...l.checked?{isDefault:!0}:{}},b=Oi(o,t).filter(h=>h.name!==g).map(h=>l.checked?{name:h.name,facets:h.facets}:h);m([...b,p]),d.value="",l.checked=!1,c.hidden=!0,v.setAttribute("aria-expanded","false"),S()}),S(),{list:a,none:s,open:v,form:c}}function Sf(e,t,n){let r=e.page.fields[t];return n.value===null?e.labels.none:r.type==="selection"?r.options.find(i=>i.value===n.value)?.label??n.label:r.type==="boolean"?n.value?e.labels.yes:e.labels.no:n.label||String(n.value)}function Lf(e){let t=Number(e.dataset.level),n=e.nextElementSibling;for(;n&&Number(n.dataset.level??0)>t;){let r=n.nextElementSibling;n.remove(),n=r}}function Go(e,t,n,r,i){let{el:o,labels:a}=e,s=i[n],d=[...r,t.value===null?{field:s,op:"notset",value:null}:{field:s,op:"=",value:t.value}],l=o("button",{type:"button",class:"fd-group-toggle","aria-expanded":"false"},o("span",{class:"fd-group-label"},Sf(e,s,t))," ",o("span",{class:"fd-group-count"},`(${t.count})`)),f=o("tr",{class:"fd-list-group","data-level":String(n),"aria-level":String(n+1)},o("td",{colspan:String(e.columns)},l));f.style.setProperty("--fd-level",String(n));let c=!1;async function v(){c=!0;try{let S=n+1<i.length?(await e.dataSource.groups?.({model:e.model,field:i[n+1],filter:d}))?.map(g=>Go(e,g,n+1,d,i))??[]:await m(0);if(!f.isConnected||l.getAttribute("aria-expanded")!=="true")return;f.after(...S),e.changed()}finally{c=!1}}async function m(S){let g=await e.dataSource.list({model:e.model,fields:e.fields,filter:d,sort:e.sort(),offset:S,limit:e.pageSize}),p=g.records.map(L=>e.recordRow(L,n+1)),b=g.total-S-g.records.length;if(b<=0)return p;let h=o("button",{type:"button",class:"fd-button fd-button-link"},e.fill(a.loadMore,{n:b})),x=o("tr",{class:"fd-list-more","data-level":String(n+1)},o("td",{colspan:String(e.columns)},h));return x.style.setProperty("--fd-level",String(n)),h.addEventListener("click",async()=>{h.disabled=!0;let L=await m(S+g.records.length);x.isConnected&&(x.replaceWith(...L),e.changed())}),[...p,x]}return l.addEventListener("click",()=>{let S=l.getAttribute("aria-expanded")==="true";l.setAttribute("aria-expanded",String(!S)),S?(Lf(f),e.changed()):c||v()}),f}var Ef='.fd-list{display:grid;gap:10px;min-width:0}.fd-list [hidden]{display:none!important}.fd-list-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;min-height:34px}.fd-list{container:fd-list / inline-size}.fd-list-views{display:inline-flex;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:hidden}.fd-list-views .fd-button{border:0;border-radius:0;min-height:32px;padding-inline:12px}.fd-list-views .fd-button+.fd-button{border-inline-start:1px solid var(--fd-border)}.fd-list-views .fd-button[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent);font-weight:600}.fd-list-body{display:grid;gap:16px;min-width:0}.fd-list-records{display:grid;gap:10px;min-width:0;align-content:start}.fd-list[data-view=list] .fd-list-map,.fd-list[data-view=map] .fd-list-records,.fd-list[data-view=map] .fd-pager{display:none}.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,3fr) minmax(320px,2fr);align-items:start}.fd-list[data-view=both] .fd-list-map{position:sticky;top:8px}@container fd-list (max-width: 860px){.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,1fr)}.fd-list[data-view=both] .fd-list-map{position:static;order:-1}}.fd-list-row.fd-list-hot>td{background:var(--fd-accent-soft)}.fd-search{position:relative;flex:1 1 360px;max-width:680px;min-width:0;container:fd-search / inline-size}.fd-search-field{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:34px;box-sizing:border-box;padding:2px 2px 2px 8px;padding-inline:8px 2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-search-field:focus-within{border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-search-field>.fd-icon,.fd-search-field>svg{width:16px;height:16px;color:var(--fd-muted);flex:none}.fd-facets{display:contents}.fd-facet{display:inline-flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:24px;padding-block:0;padding-inline:6px 0;border-radius:3px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:13px;line-height:18px}.fd-facet svg{width:13px;height:13px;flex:none}.fd-facet[data-kind=groupBy]{background:var(--fd-success-soft);color:var(--fd-success)}.fd-facet-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-facet-remove{all:unset;cursor:pointer;display:grid;place-items:center;width:24px;height:24px;border-radius:2px;font-size:15px;line-height:1;opacity:.7}.fd-facet-remove:hover,.fd-facet-remove:focus-visible{opacity:1;background:var(--fd-surface)}.fd-search-input{flex:1 1 140px;min-width:100px;border:none;outline:none;background:none;font:inherit;font-size:14px;color:var(--fd-text);padding:5px 4px}.fd-form .fd-search-input:focus-visible{outline:none}.fd-search-toggle{all:unset;cursor:pointer;display:grid;place-items:center;width:30px;height:28px;border-radius:3px;color:var(--fd-muted)}.fd-search-toggle:before{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}.fd-search-toggle[aria-expanded=true]:before{transform:translateY(2px) rotate(-135deg)}.fd-search-toggle:hover,.fd-search-toggle[aria-expanded=true]{background:var(--fd-page);color:var(--fd-text)}.fd-search-toggle:focus-visible{outline:2px solid var(--fd-focus)}.fd-search-suggestions,.fd-search-panel{position:absolute;z-index:30;inset-inline:0;top:calc(100% + 4px);box-sizing:border-box;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);box-shadow:0 10px 28px #0f172a24}.fd-search-suggestions{list-style:none;margin:0;padding:4px 0}.fd-search-suggestions [role=option]{padding:7px 12px;cursor:pointer;font-size:14px}.fd-search-suggestions [role=option][aria-selected=true]{background:var(--fd-accent-soft)}.fd-search-panel{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);padding-block:6px}.fd-search-group{display:flex;flex-direction:column;align-items:stretch;gap:1px;padding:4px 10px 8px;min-width:0}.fd-search-group+.fd-search-group{border-inline-start:1px solid var(--fd-border)}@container fd-search (max-width: 540px){.fd-search-panel{grid-auto-flow:row}.fd-search-group+.fd-search-group{border-inline-start:none;border-block-start:1px solid var(--fd-border);padding-block-start:8px}}.fd-search-heading{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13.5px;padding:4px 6px 6px}.fd-search-heading svg{width:15px;height:15px}.fd-search-group[data-group-kind=filters] .fd-search-heading svg{color:var(--fd-accent)}.fd-search-group[data-group-kind=groupBy] .fd-search-heading svg{color:var(--fd-success)}.fd-search-group[data-group-kind=favourites] .fd-search-heading svg{color:var(--fd-warning)}.fd-search-option{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:6px;padding:5px 6px;border-radius:4px;font-size:14px;color:var(--fd-text)}.fd-search-option:before{content:"";width:14px;flex:none;text-align:center;color:var(--fd-accent);font-weight:700}.fd-search-option[aria-pressed=true]:before{content:"\u2713"}.fd-search-option:hover,.fd-search-option:focus-visible{background:var(--fd-page)}.fd-search-add{color:var(--fd-muted);margin-block-start:4px}.fd-search-add:before{content:"+";color:var(--fd-muted);font-weight:400}.fd-custom-filter,.fd-favourite-form{display:grid;gap:6px;padding:6px}.fd-custom-filter .fd-input,.fd-favourite-form .fd-input{width:100%;box-sizing:border-box;min-height:30px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:3px 6px;font:inherit;font-size:13.5px;background:var(--fd-surface);color:var(--fd-text)}.fd-favourite-default{display:flex;align-items:center;gap:6px;font-size:13.5px}.fd-favourite-list{list-style:none;margin:0;padding:0}.fd-favourite{display:flex;align-items:center}.fd-favourite .fd-search-option{flex:1;min-width:0}.fd-favourite .fd-search-option[data-default=true]:before{content:"\u2605";color:var(--fd-warning)}.fd-favourite-remove{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:4px;color:var(--fd-muted)}.fd-favourite-remove:hover{background:var(--fd-page);color:var(--fd-error)}.fd-favourites-none{margin:0;padding:4px 6px;color:var(--fd-muted);font-size:13px}.fd-list-selection{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:3px 4px 3px 10px;border-radius:var(--fd-control-radius);background:var(--fd-accent-soft)}.fd-list-count{font-weight:600;font-size:13.5px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-pager-text{color:var(--fd-muted);font-size:13.5px;font-variant-numeric:tabular-nums;margin-inline-end:6px;white-space:nowrap}.fd-pager-button{min-width:32px;padding-inline:0;font-size:18px;line-height:1}.fd-list-scroll{overflow-x:auto;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-list-table{width:100%;border-collapse:collapse;font-size:14px}.fd-list-table th{text-align:start;font-weight:600;font-size:13px;color:var(--fd-text);padding:8px 10px;border-block-end:1px solid var(--fd-border-strong);white-space:nowrap;background:var(--fd-surface)}.fd-list-table td{padding:7px 10px;border-block-end:1px solid var(--fd-border);max-width:28em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-list-table tbody tr:last-child td{border-block-end:none}.fd-list-table .fd-num{text-align:end;font-variant-numeric:tabular-nums}.fd-list-table th.fd-list-check,.fd-list-table td.fd-list-check{width:36px;padding-inline:10px 0}.fd-list-checkbox{width:16px;height:16px;margin:0;vertical-align:middle;accent-color:var(--fd-accent);cursor:pointer}.fd-list-sort{all:unset;box-sizing:border-box;width:100%;cursor:pointer;display:flex;align-items:center;gap:4px;font:inherit;color:inherit}.fd-list-sort:after{content:"";width:0;height:0;border-inline:4px solid transparent;opacity:0}.fd-list-sort:hover:after{opacity:.35;border-block-start:5px solid currentColor}.fd-list-table th[aria-sort=ascending] .fd-list-sort:after{opacity:1;border-block-start:none;border-block-end:5px solid currentColor}.fd-list-table th[aria-sort=descending] .fd-list-sort:after{opacity:1;border-block-end:none;border-block-start:5px solid currentColor}.fd-list-table th.fd-num .fd-list-sort{justify-content:flex-end}.fd-list-table th.fd-num .fd-list-sort:after{order:-1}.fd-list-sort:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-list-row:hover td{background:var(--fd-page)}.fd-list-openable{cursor:pointer}.fd-list-row[aria-selected=true] td{background:var(--fd-accent-soft)}.fd-list-row:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-list-table[aria-busy=true] tbody{opacity:.6;transition:opacity .2s .15s}.fd-list-group td{padding:0;background:var(--fd-page)}.fd-group-toggle{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;padding-inline-start:calc(12px + var(--fd-level, 0) * 22px);font-weight:600;font-size:13.5px;color:var(--fd-text)}.fd-group-toggle:before{content:"";flex:none;width:6px;height:6px;border-top:1.5px solid currentColor;border-right:1.5px solid currentColor;transform:rotate(45deg);transition:transform .12s}.fd-group-toggle:dir(rtl):before{transform:rotate(-135deg)}.fd-group-toggle[aria-expanded=true]:before{transform:rotate(135deg)}.fd-group-toggle:hover{background:var(--fd-accent-soft)}.fd-group-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-group-count{color:var(--fd-muted);font-weight:400;font-variant-numeric:tabular-nums}.fd-list-more td{padding:4px 10px;padding-inline-start:calc(46px + var(--fd-level, 0) * 22px)}.fd-list-empty,.fd-list-failed{margin:0;padding:28px 12px;text-align:center;color:var(--fd-muted)}.fd-list-failed{color:var(--fd-error)}';function Pi(e){if(e.getElementById("fd-list-styles"))return;let t=e.createElement("style");t.id="fd-list-styles",t.textContent=Ef,e.head.append(t)}var Rf=[["ilike","opContains"],["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],Ff=[["ilike","opContains"],["set","opSet"],["notset","opNotSet"]],Af=[["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],$f=[["=","opIs"],["!=","opIsNot"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]],Tf=[["=","opIs"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]];function Yo(e){switch(e.type){case"char":case"text":case"html":return Rf;case"many2one":case"many2many":return Ff;case"selection":return Af;case"integer":case"float":case"monetary":return $f;case"date":case"datetime":return Tf;case"boolean":return[["=","opIs"]];default:return[]}}function Hd(e){let{page:t,el:n,labels:r}=e,i=Object.entries(t.fields).filter(([,g])=>Yo(g).length),o=n("select",{class:"fd-input","aria-label":r.field},...i.map(([g,p])=>n("option",{value:g},p.label))),a=n("select",{class:"fd-input","aria-label":r.condition}),s=n("span",{class:"fd-custom-filter-value"}),d=n("button",{type:"button",class:"fd-button fd-button-primary"},r.apply),l=n("div",{class:"fd-custom-filter",hidden:""},o,a,s,d),f=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.addCustomFilter),c=n("input",{class:"fd-input","aria-label":r.value}),v=()=>t.fields[o.value];function m(){a.replaceChildren(...Yo(v()).map(([g,p])=>n("option",{value:g},r[p]))),S()}function S(){let g=v();if(g.type==="selection")c=n("select",{class:"fd-input","aria-label":r.value},...g.options.map(p=>n("option",{value:String(p.value)},p.label)));else if(g.type==="boolean")c=n("select",{class:"fd-input","aria-label":r.value},n("option",{value:"true"},r.yes),n("option",{value:"false"},r.no));else{let p=["integer","float","monetary"].includes(g.type)?"number":g.type==="date"?"date":g.type==="datetime"?"datetime-local":"text";c=n("input",{class:"fd-input",type:p,"aria-label":r.value})}s.replaceChildren(c),s.hidden=a.value==="set"||a.value==="notset"}return o.addEventListener("change",m),a.addEventListener("change",()=>s.hidden=a.value==="set"||a.value==="notset"),f.addEventListener("click",()=>{l.hidden=!l.hidden,f.setAttribute("aria-expanded",String(!l.hidden)),l.hidden||o.focus()}),d.addEventListener("click",()=>{let g=v(),p=a.value,b=r[Yo(g).find(([L])=>L===p)?.[1]??"opIs"],h=null,x="";if(!s.hidden){let L=c.value.trim();if(!L)return c.focus();if(g.type==="selection"){let y=g.options.find(R=>String(R.value)===L);h=y?.value??L,x=y?.label??L}else if(g.type==="boolean")h=L==="true",x=h?r.yes:r.no;else if(["integer","float","monetary"].includes(g.type)){if(h=Number(L),!Number.isFinite(h))return c.focus();x=L}else h=L,x=L}e.add({kind:"custom",label:[g.label,b,x].filter(Boolean).join(" "),filter:[{field:o.value,op:p,value:h}]}),l.hidden=!0,f.setAttribute("aria-expanded","false")}),m(),{button:f,form:l}}function Mf(e,t){let n=` ${t.or} `;switch(e.kind){case"field":return`${e.label}: ${e.values.map(r=>r.label).join(n)}`;case"filters":return e.labels.join(n);case"groupBy":return e.labels.join(" > ");case"custom":return e.label}}function Bd(e){let{page:t,node:n,doc:r,el:i,labels:o,fill:a,uid:s}=e,d=e.facets,l=V=>{let z=wt(r,V,e.icons);return z?.setAttribute("aria-hidden","true"),z?[z]:[]};function f(V){d=V,x(),D(),e.onChange(d)}let c=s(`${n.id}-suggestions`),v=s(`${n.id}-search-panel`),m=i("input",{class:"fd-search-input",role:"combobox",autocomplete:"off",placeholder:o.search,"aria-label":o.searchLabel,"aria-autocomplete":"list","aria-expanded":"false","aria-controls":c}),S=i("div",{class:"fd-facets"}),g=i("ul",{class:"fd-search-suggestions",role:"listbox",id:c,"aria-label":o.searchLabel,hidden:""}),p=i("button",{type:"button",class:"fd-search-toggle","aria-label":o.searchOptions,"aria-expanded":"false","aria-controls":v}),b=[],h=0;function x(){S.replaceChildren(...d.map((V,z)=>{let T=Mf(V,o),te=i("button",{type:"button",class:"fd-facet-remove","aria-label":a(o.removeFacet,{label:T})},"\xD7");te.addEventListener("click",()=>{f(d.filter((K,q)=>q!==z)),m.focus()});let Y=V.kind==="groupBy"?"layers":V.kind==="field"?"":"filter";return i("span",{class:"fd-facet","data-kind":V.kind},...Y?l(Y):[],i("span",{class:"fd-facet-text"},T),te)}))}function L(){g.replaceChildren(...b.map((V,z)=>{let T=i("li",{role:"option",id:`${c}-${z}`,"aria-selected":String(z===h)},V.label);return T.addEventListener("mousedown",te=>te.preventDefault()),T.addEventListener("click",()=>R(V)),T})),g.hidden=b.length===0,m.setAttribute("aria-expanded",String(!g.hidden)),g.hidden?m.removeAttribute("aria-activedescendant"):m.setAttribute("aria-activedescendant",`${c}-${h}`)}function y(){b=[],L()}function R(V){let z={op:V.op,value:V.value,label:V.valueLabel},T=d.findIndex(Y=>Y.kind==="field"&&Y.field===V.field),te=[...d];if(T<0)te.push({kind:"field",field:V.field,label:V.fieldLabel,values:[z]});else{let Y=te[T];Y.values.some(q=>q.op===z.op&&JSON.stringify(q.value)===JSON.stringify(z.value))||(te[T]={...Y,values:[...Y.values,z]})}m.value="",y(),f(te)}m.addEventListener("input",()=>{b=Jr(m.value,t,n,{searchFor:o.searchFor}),h=0,L()}),m.addEventListener("blur",y),m.addEventListener("keydown",V=>{V.isComposing||((V.key==="ArrowDown"||V.key==="ArrowUp")&&b.length?(V.preventDefault(),h=(h+(V.key==="ArrowDown"?1:b.length-1))%b.length,L()):V.key==="Enter"?(V.preventDefault(),b.length&&R(b[h])):V.key==="Backspace"&&!m.value&&d.length?f(d.slice(0,-1)):V.key==="Escape"&&!g.hidden&&(V.preventDefault(),y()))});let E=(V,z,T)=>i("div",{class:"fd-search-heading",id:T},...l(V),z),k=(V,z)=>{let T=d.findIndex(oe=>oe.kind===V),te=T<0?[]:V==="filters"?d[T].ids:d[T].fields,Y=te.includes(z)?te.filter(oe=>oe!==z):[...te,z],K=V==="filters"?{kind:V,ids:Y,labels:Y.map(oe=>n.filters?.find(Ce=>Ce.id===oe)?.label??oe)}:{kind:V,fields:Y,labels:Y.map(oe=>t.fields[oe]?.label??oe)},q=[...d];T<0?q.push(K):Y.length?q[T]=K:q.splice(T,1),f(q)},A=(n.filters??[]).map(V=>{let z=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-filter":V.id},V.label);return z.addEventListener("click",()=>k("filters",V.id)),z}),w=(n.groupBy??[]).map(V=>{let z=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-group":V},t.fields[V].label);return z.addEventListener("click",()=>k("groupBy",V)),z}),j=Hd({page:t,el:i,labels:o,add:V=>f([...d,V])}),C=jd({page:t,el:i,labels:o,fill:a,preferences:e.preferences,current:()=>d,apply:f}),O=(V,z,T,...te)=>i("div",{class:"fd-search-group","data-group-kind":V,role:"group","aria-labelledby":`${v}-${V}`},E(z,T,`${v}-${V}`),...te),W=i("div",{class:"fd-search-panel",id:v,hidden:""},O("filters","filter",o.filters,...A,j.button,j.form),...w.length?[O("groupBy","layers",o.groupBy,...w)]:[],O("favourites","star",o.favourites,C.list,C.none,C.open,C.form));function D(){let V=d.find(T=>T.kind==="filters")?.ids??[],z=d.find(T=>T.kind==="groupBy")?.fields??[];for(let T of A)T.setAttribute("aria-pressed",String(V.includes(T.dataset.filter??"")));for(let T of w)T.setAttribute("aria-pressed",String(z.includes(T.dataset.group??"")))}function I(V){W.hidden=!V,p.setAttribute("aria-expanded",String(V)),V&&y()}p.addEventListener("click",()=>I(W.hidden)),W.addEventListener("keydown",V=>{V.key==="Escape"&&(V.preventDefault(),I(!1),p.focus())});let B=i("div",{class:"fd-search"},i("div",{class:"fd-search-field"},...l("search"),S,m,p),g,W),H=V=>{!W.hidden&&!B.contains(V.target)&&I(!1)};return r.addEventListener("pointerdown",H),x(),D(),{element:B,add(V){let z=V.kind==="custom"?V.label:null;f([...d.filter(T=>!(z!==null&&T.kind==="custom"&&T.label===z)),V])},destroy:()=>r.removeEventListener("pointerdown",H)}}var zd=new Set(["integer","float","monetary"]),Nf=new Set(["one2many","many2many","binary","image","html","json","properties"]);function qd(e){let{page:t,node:n,form:r,el:i,labels:o,fill:a,locale:s,doc:d}=e;Pi(d);let l=n.pageSize??40,f=n.sort??[],c=f,v=0,m=0,S=[],g=new WeakMap,p=()=>[...w.querySelectorAll(".fd-list-row")].map(U=>g.get(U)),b=t.data.kind==="record"?t.data.model:"",h=Wd(n,e.preferences,t),x=new Set,L=0,y=!1,R=[...new Set(n.columns.flatMap(U=>{let ie=t.fields[U];return ie.type==="monetary"&&ie.currencyField?[U,ie.currencyField]:[U]}))],E=(U,ie)=>St(t.fields[U],ie[U],ie,s),k=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":o.selectAll}),A=n.columns.map(U=>{let ie=t.fields[U],Ae=i("th",{scope:"col","data-field":U,class:zd.has(ie.type)?"fd-num":void 0});if(Nf.has(ie.type))Ae.append(ie.label);else{let Re=i("button",{type:"button",class:"fd-list-sort"},ie.label);Re.addEventListener("click",()=>{let de=c[0]?.field===U?!c[0].desc:!1;c=[{field:U,...de?{desc:de}:{}},...f.filter(pe=>pe.field!==U)],v=0,ke()}),Ae.append(Re)}return Ae}),w=i("tbody"),j=i("table",{class:"fd-list-table","aria-label":t.title},i("thead",{},i("tr",{},i("th",{class:"fd-list-check",scope:"col"},k),...A)),w),C=i("p",{class:"fd-list-empty",hidden:""},o.noRecords),O=i("button",{type:"button",class:"fd-button fd-button-link"},o.retry),W=i("p",{class:"fd-list-failed",role:"alert",hidden:""},o.loadFailed," ",O);O.addEventListener("click",()=>{ke()});function D(U,ie=0){let Ae=E(n.columns[0],U.values)||String(U.id),Re=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":a(o.selectRecord,{name:Ae})});Re.checked=x.has(U.id),Re.addEventListener("change",()=>{Re.checked?x.add(U.id):x.delete(U.id),z(),ne?.chosenChanged()});let de=i("tr",{class:e.onOpenRecord?"fd-list-row fd-list-openable":"fd-list-row",tabindex:"0","data-id":String(U.id),"data-level":ie?String(ie):void 0},i("td",{class:"fd-list-check"},Re),...n.columns.map(pe=>i("td",{class:zd.has(t.fields[pe].type)?"fd-num":void 0},i("bdi",{},E(pe,U.values)))));return de.addEventListener("click",pe=>{let le=pe.target.closest("td");if(le?.classList.contains("fd-list-check")){pe.target===le&&Re.click();return}e.onOpenRecord?.(U.id)}),de.addEventListener("keydown",pe=>{pe.target===de&&(pe.key==="Enter"?(pe.preventDefault(),e.onOpenRecord?.(U.id)):pe.key===" "?(pe.preventDefault(),Re.click()):(pe.key==="ArrowDown"||pe.key==="ArrowUp")&&(pe.preventDefault(),(pe.key==="ArrowDown"?de.nextElementSibling:de.previousElementSibling)?.focus()))}),de.addEventListener("mouseenter",()=>ne?.highlight(U.id)),de.addEventListener("mouseleave",()=>ne?.highlight(null)),de.addEventListener("focus",()=>ne?.highlight(U.id)),g.set(de,U),de}let I=i("span",{class:"fd-list-count",role:"status"}),B=i("button",{type:"button",class:"fd-button fd-button-link"},o.clearSelection),H=(n.actions??[]).map(U=>{let ie=i("button",{type:"button",class:`fd-button fd-button-${U.style??"secondary"}`,"data-node":U.id},...e.withIcon(U.icon,U.label));return ie.addEventListener("click",()=>{e.press(ie,async()=>{let Ae=await r.runAction(U.id,{recordIds:[...x]});return await Promise.all([ke(),ne?.reload()]),Ae})}),ie}),V=i("div",{class:"fd-list-selection",hidden:""},I,...H,B);B.addEventListener("click",()=>{x.clear();for(let U of w.querySelectorAll(".fd-list-checkbox"))U.checked=!1;z()}),k.addEventListener("change",()=>{for(let U of p())k.checked?x.add(U.id):x.delete(U.id);for(let U of w.querySelectorAll(".fd-list-checkbox"))U.checked=k.checked;z()});function z(){let U=p(),ie=U.filter(Ae=>x.has(Ae.id)).length;k.checked=U.length>0&&ie===U.length,k.indeterminate=ie>0&&ie<U.length,V.hidden=x.size===0,I.textContent=a(o.selected,{n:x.size});for(let Ae of w.querySelectorAll(".fd-list-row"))Ae.setAttribute("aria-selected",String([...x].some(Re=>String(Re)===Ae.dataset.id)))}let T=i("span",{class:"fd-pager-text"}),te=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.previousPage},"\u2039"),Y=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.nextPage},"\u203A"),K=i("div",{class:"fd-pager",role:"group"},T,te,Y);te.addEventListener("click",()=>{v=Math.max(0,v-l),ke()}),Y.addEventListener("click",()=>{v+=l,ke()});function q(){K.hidden=m===0,T.textContent=a(o.range,{from:v+1,to:Math.min(v+S.length,m),total:m}),te.disabled=v===0,Y.disabled=v+l>=m}function oe(){for(let U of A){let ie=!c[0]?.near&&c[0]?.field===U.dataset.field?c[0]:null;ie?U.setAttribute("aria-sort",ie.desc?"descending":"ascending"):U.removeAttribute("aria-sort")}}function Ce(){if(he==="list"){let U=new Set(p().map(ie=>ie.id));for(let ie of[...x])U.has(ie)||x.delete(ie)}z(),ne?.chosenChanged()}let Me=U=>({page:t,el:i,labels:o,fill:a,dataSource:U,model:b,fields:R,columns:n.columns.length+1,pageSize:l,sort:()=>c,recordRow:D,changed:Ce});async function ke(){let U=++L;oe(),j.setAttribute("aria-busy","true");let ie=[];try{let Ae=[...e.fixedFilter??[],...fr(h,n)],Re=Gr(h),de=e.dataSource;if(Re.length&&de?.groups&&de.list){let pe=await de.groups({model:b,field:Re[0],filter:Ae});if(U!==L||y)return;S=[],m=0,ie=pe.map(le=>Go(Me(de),le,0,Ae,Re))}else{let pe=de?.list?await de.list({model:b,fields:R,filter:Ae,sort:c,offset:v,limit:l}):{records:[],total:0};if(U!==L||y)return;if(!pe.records.length&&pe.total>0&&v>0)return v=Math.floor((pe.total-1)/l)*l,ke();S=pe.records,m=pe.total,ie=S.map(le=>D(le))}W.hidden=!0}catch{if(U!==L||y)return;S=[],m=0,W.hidden=!1}w.replaceChildren(...ie),C.hidden=ie.length>0||!W.hidden,j.removeAttribute("aria-busy"),q(),Ce()}let $e=Bd({page:t,node:n,doc:d,el:i,labels:o,fill:a,uid:e.uid,icons:e.icons,preferences:e.preferences,facets:h,onChange(U){h=U,v=0,ke(),ne?.reload()}}),ae=n.map?e.views?.map:void 0,he=ae?n.map?.view??"list":"list",ne=null,Te=i("div",{class:"fd-list-map"}),Pe=()=>[...e.fixedFilter??[],...fr(h,n)];function we(){ne||!ae||(ne=ae({page:t,node:n,dataSource:e.dataSource,document:d,locale:s,icons:e.icons,filter:Pe,isChosen:U=>x.has(U),choose(U,ie){ie?x.add(U):x.delete(U);for(let Ae of w.querySelectorAll(".fd-list-row")){if(Ae.dataset.id!==String(U))continue;let Re=Ae.querySelector(".fd-list-checkbox");Re&&(Re.checked=ie)}z(),ne?.chosenChanged()},...e.onOpenRecord?{open:e.onOpenRecord}:{},highlight(U){for(let ie of w.querySelectorAll(".fd-list-row")){let Ae=U!==null&&ie.dataset.id===String(U);ie.classList.toggle("fd-list-hot",Ae),Ae&&he==="both"&&ie.scrollIntoView({block:"nearest"})}},addSearch:({label:U,filter:ie})=>$e.add({kind:"custom",label:U,filter:ie}),sort:()=>c,sortBy(U){c=U??f,v=0,ke(),ne?.reload()},actions:(n.actions??[]).map(U=>({id:U.id,label:U.label,...U.style?{style:U.style}:{}})),act:(U,ie,Ae)=>e.press(Ae,async()=>{let Re=await r.runAction(U,{recordIds:ie});return await Promise.all([ke(),ne?.reload()]),Re})}),Te.append(ne.element),ne.reload())}let Ve=["list","map","both"].map(U=>{let ie=i("button",{type:"button",class:"fd-button fd-list-view","data-view":U,"aria-pressed":"false"},U==="list"?o.viewList:U==="map"?o.viewMap:o.viewBoth);return ie.addEventListener("click",()=>re(U)),ie}),X=i("div",{class:"fd-list-views",role:"group","aria-label":o.showAs},...Ve);X.hidden=!ae;function re(U){he=U,me.dataset.view=he;for(let ie of Ve)ie.setAttribute("aria-pressed",String(ie.dataset.view===he));he!=="list"&&(we(),ne?.shown())}let me=i("div",{class:"fd-list","data-node":n.id},i("div",{class:"fd-list-bar"},$e.element,X,K),V,i("div",{class:"fd-list-body"},i("div",{class:"fd-list-records"},i("div",{class:"fd-list-scroll"},j),C,W),Te));return re(he),ke(),{element:me,reload:async()=>{await Promise.all([ke(),ne?.reload()])},destroy(){y=!0,$e.destroy(),ne?.destroy()}}}function Vi(e,t){let n=e.style??"card",r=n==="plain"&&!e.title,i=fn(e.columns),o=e.colspan??1,a=r&&t.columns>1?o===1&&i>1?"shared":"tracks":void 0;return{style:n,arrangement:r,at:a,inner:{columns:a==="tracks"?Math.min(o,t.columns):i,onPage:t.onPage&&(n==="plain"||n==="line"),labels:e.labels??t.labels}}}var Cf=new Set(["one2many","matrix"]);function Rr(e,t,n){if(t==="boolean"&&e.widget==="tick")return"after";let r=e.labels??n;return r==="beside"&&Cf.has(t)?"above":r}function et(e,t){e.hidden!==t&&(e.hidden=t)}function Lt(e,t){e.textContent!==t&&(e.textContent=t)}function kt(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}async function _d(e,t){let{options:n}=e,r=n.onOpen?.(t);if(r)return r;let i=await Er(n,t.version===void 0?{id:t.page}:{id:t.page,version:t.version});if(!i)throw new Error(e.missing(t.page));let o=n.page.look,a={...n,page:o&&!i.look?{...i,look:o}:i,form:void 0,recordId:t.recordId??null,values:t.values,listFilter:t.filter,drafts:void 0,autosave:void 0,readonly:void 0,editSwitch:void 0,saveStatus:void 0,records:void 0,breadcrumbs:void 0},s=t.title??e.title(i),d={...a,host:{...n.host,say:e.say,post:e.post}},l=t.as==="page"?await Of(e,{...a,host:{...n.host,post:e.post}}):t.as==="panel"?await Uo({...d,title:s,side:t.side}):await Xn({...d,title:s,size:i.layout.type==="sheet"?"large":"medium"}),f=Jo(i),c=f?l.values[f]:void 0;return{...l,...typeof c=="string"&&c?{label:c}:{}}}function Of(e,t){let{place:n,root:r}=e,i=n.ownerDocument,o=i.activeElement;return new Promise(a=>{let s=!1,d=m=>{if(s)return;s=!0;let S=f.form.getState();f.destroy(),r.hidden=!1,o?.isConnected&&o.focus(),a({saved:m,recordId:S.recordId??null,values:S.values})};r.hidden=!0;let l=e.options.breadcrumbs?[...e.options.breadcrumbs,{label:e.name(),open:()=>d(!1)}]:void 0,f=Lr(n,{...t,breadcrumbs:l,host:{...t.host,close:()=>d(!1)}}),c=i.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-back",c.textContent=e.back,c.addEventListener("click",()=>d(!1)),f.element.querySelector(".fd-breadcrumbs")||f.element.prepend(c);let v=()=>{f.form.settled().then(()=>d(!0))};f.on("save",v),f.on("send",v),(Ci(f.element)??f.element.querySelector(Sr)??c).focus()})}function Ud(e,t,n){let r=t("div",{class:"fd-says",role:"status","aria-live":"polite"});return e.append(r),(i,o)=>{let a=t("button",{type:"button",class:"fd-alert-close","aria-label":n},"\xD7"),s=t("div",{class:"fd-say","data-tone":o},t("span",{},i),a);s.style.setProperty("--fd-tone",`var(--fd-${o==="danger"?"error":o})`);let d,l=()=>clearTimeout(d),f=()=>{l(),s.remove()},c=()=>{l(),d=setTimeout(f,o==="warning"||o==="danger"?1e4:6e3)};for(a.addEventListener("click",f),s.addEventListener("mouseenter",l),s.addEventListener("focusin",l),s.addEventListener("mouseleave",c),s.addEventListener("focusout",c),r.append(s);r.children.length>4;)r.firstElementChild?.remove();Pf(r,t,i),c()}}function Pf(e,t,n){let r=[...e.ownerDocument.querySelectorAll('[aria-modal="true"]')].filter(a=>!a.contains(e)),i=r[r.length-1];if(!i)return;let o=i.querySelector(":scope > .fd-says-echo");o||(o=t("div",{class:"fd-says-echo fd-sr-only",role:"status","aria-live":"polite"}),i.append(o)),o.textContent=n}var Zn=64;function Kd(e,t){let n=()=>e.closest("[dir]")?.getAttribute("dir")==="rtl",r=v=>t("button",{type:"button",class:`fd-tabs-scroll fd-tabs-${v}`,tabindex:"-1","aria-hidden":"true",hidden:""}),i=r("before"),o=r("after"),a=t("div",{class:"fd-tabbar"},i,e,o),s=v=>e.scrollBy({left:v*(n()?-1:1)*Math.max(e.clientWidth-2*Zn,Zn),behavior:"smooth"});i.addEventListener("click",()=>s(-1)),o.addEventListener("click",()=>s(1));function d(){let v=Math.abs(e.scrollLeft),m=v>1,S=v+e.clientWidth<e.scrollWidth-1;et(i,!m),et(o,!S);let g=[m&&"start",S&&"end"].filter(Boolean).join(" ");kt(a,"data-more",g||null)}function l(v){if(!e.clientWidth||e.scrollWidth<=e.clientWidth)return;let m=e.getBoundingClientRect(),S=v.getBoundingClientRect();S.left<m.left+Zn?e.scrollLeft+=S.left-m.left-Zn:S.right>m.right-Zn&&(e.scrollLeft+=S.right-m.right+Zn),d()}e.addEventListener("scroll",d,{passive:!0});let f=e.ownerDocument.defaultView,c=f&&"ResizeObserver"in f?new f.ResizeObserver(()=>d()):null;return c?.observe(e),{element:a,measure:d,reveal:l,destroy:()=>c?.disconnect()}}function Xo(e,t,n,r){let i=Wn(n);if(!i.some(s=>s.field))return{nodes:[n],update:()=>{}};let o=[];return{nodes:i.map(s=>{if(!s.field)return s.text;let d=e.createElement("bdi");return d.className="fd-value",d.dataset.field=s.field,o.push({field:s.field,span:d}),d}),update(s){for(let{field:d,span:l}of o){let f=t[d],c=f?St(f,s[d],s,r):"";l.textContent!==c&&(l.textContent=c)}}}}var Vf={gear:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>'},Fr=(e,t)=>e!=null&&t!=null&&String(e)===String(t);function Jd(e){let{el:t,labels:n,toolbar:r}=e,i=r?.menu??[],o=r?.breadcrumbs===!1?void 0:e.breadcrumbs,a=r?.pager===!1?void 0:e.records;if(!i.length&&!o?.length&&!a)return null;let s=[],d=[],l=t("div",{class:"fd-record-bar"});if(o?.length){let f=t("span",{class:"fd-crumb-current","aria-current":"page"}),c=t("ol",{},...o.map(v=>{let m=v.href!==void 0?t("a",{class:"fd-crumb",href:v.href},v.label):t("button",{type:"button",class:"fd-crumb"},v.label);return v.open&&m.addEventListener("click",S=>{S.preventDefault(),v.open?.()}),t("li",{},m)}),t("li",{},f));l.append(t("nav",{class:"fd-breadcrumbs","aria-label":n.breadcrumbs},c)),s.push(()=>Lt(f,e.name()||n.newRecord))}return i.length&&l.append(If(e,i,s,d)),a&&l.append(Df(e,a,o,s,d)),{element:l,update:()=>{for(let f of s)f()},destroy:()=>{for(let f of d)f()}}}function If(e,t,n,r){let{doc:i,el:o,form:a,labels:s}=e,d=e.uid("record-menu"),l=o("button",{type:"button",class:"fd-button fd-record-gear",id:`${d}-button`,"aria-haspopup":"menu","aria-expanded":"false","aria-controls":d,title:s.actions}),f=wt(i,"gear",Vf);f&&l.append(f),l.append(o("span",{class:"fd-record-gear-words"},s.actions));let c=o("div",{class:"fd-record-menu",role:"menu",id:d,"aria-labelledby":l.id,hidden:""}),v=t.map(E=>{let k=E.label??(E.builtin?s[E.builtin]:E.id),A=o("button",{type:"button",role:"menuitem",tabindex:"-1",class:"fd-record-menu-item","data-node":E.id},...e.withIcon(E.icon,k));return E.builtin==="delete"&&A.classList.add("fd-record-menu-danger"),A.addEventListener("click",()=>{R(!0),e.press(l,()=>a.runAction(E.id))}),{item:E,button:A}}),m=v.filter(E=>E.item.group==="print"),S=v.filter(E=>E.item.group!=="print"),g=o("div",{class:"fd-record-menu-heading",role:"presentation"},s.print),p=o("div",{role:"group","aria-label":s.print},g,...m.map(E=>E.button)),b=o("div",{class:"fd-record-menu-rule",role:"separator"});c.append(...m.length?[p]:[],...m.length&&S.length?[b]:[],...S.map(E=>E.button));let h=o("div",{class:"fd-record-actions"},l,c),x=()=>v.filter(E=>!E.button.hidden).map(E=>E.button),L=E=>{h.contains(E.target)||R(!1)};function y(E){if(!c.hidden)return;c.hidden=!1,c.removeAttribute("data-end");let k=c.getBoundingClientRect();(k.right>i.documentElement.clientWidth-4||k.left<4)&&c.setAttribute("data-end",""),l.setAttribute("aria-expanded","true"),i.addEventListener("pointerdown",L,!0);let A=x();(E==="first"?A[0]:A[A.length-1])?.focus()}function R(E){c.hidden||(c.hidden=!0,l.setAttribute("aria-expanded","false"),i.removeEventListener("pointerdown",L,!0),E&&l.focus())}return r.push(()=>i.removeEventListener("pointerdown",L,!0)),l.addEventListener("click",()=>c.hidden?y("first"):R(!1)),l.addEventListener("keydown",E=>{(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),y(E.key==="ArrowDown"?"first":"last"))}),c.addEventListener("keydown",E=>{let k=x(),A=k.indexOf(i.activeElement),w={ArrowDown:A+1,ArrowUp:A-1,Home:0,End:k.length-1}[E.key];w!==void 0?(E.preventDefault(),k[(w+k.length)%k.length]?.focus()):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),R(!0)):E.key==="Tab"&&R(!1)}),n.push(()=>{for(let{item:E,button:k}of v)et(k,a.node(E.id).invisible);et(p,!m.some(E=>!E.button.hidden)),et(b,p.hidden||!S.some(E=>!E.button.hidden)),et(h,!v.some(E=>!E.button.hidden))}),h}function Df(e,t,n,r,i){let{el:o,form:a,labels:s}=e,d=Array.isArray(t)?[...t]:null,l=Array.isArray(t)?null:t,f=d?d.length:l.total,c=d?-1:l.at,v=d?null:a.getState().recordId,m=!1,S=()=>{let y=a.getState().recordId;return d?d.findIndex(R=>Fr(R,y)):Fr(v,y)?c:-1},g=o("span",{class:"fd-record-pager-text",dir:"ltr"}),p=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.previousRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),b=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.nextRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A"));Cn(p,"p",s.previousRecord),Cn(b,"n",s.nextRecord);let h=o("div",{class:"fd-record-pager",role:"group","aria-label":s.records},g,p,b),x=async y=>d?d[y]:l.id(y);async function L(y){let R=S();if(!(m||R===-1||f<2)){m=!0;try{let E=(R+y+f)%f;if(!await e.leave())return;let k=await x(E);c=E,v=k,await a.openRecord(k)}finally{m=!1}}}return p.addEventListener("click",()=>{L(-1)}),b.addEventListener("click",()=>{L(1)}),i.push(a.on("duplicate",({from:y,recordId:R})=>{if(!d)return;let E=d.findIndex(k=>Fr(k,y));d.splice(E+1,0,R),f=d.length,e.render()}),a.on("delete",({recordId:y})=>{let R=d?d.findIndex(A=>Fr(A,y)):Fr(v,y)?c:-1;if(R===-1)return;if(d&&d.splice(R,1),f=d?d.length:f-1,f<1)return void n?.[n.length-1]?.open?.();c=Math.min(R,f-1);let E=A=>{v=A,a.openRecord(A)},k=d?d[c]:l.id(c);k instanceof Promise?k.then(E):E(k)})),r.push(()=>{let y=S();et(h,y===-1),Lt(g,e.fill(s.recordAt,{n:y+1,total:f}));let R=f<2;kt(p,"aria-disabled",R?"true":null),kt(b,"aria-disabled",R?"true":null)}),h}var Wf=e=>/^image\//.test(e.type)||/pdf/i.test(e.type)||/\.pdf$/i.test(e.name),jf=e=>(Array.isArray(e)?e:e?[e]:[]).filter(t=>t&&typeof t=="object"&&"name"in t);function Gd(e){let{el:t,form:n,labels:r,node:i}=e,o=t("span",{class:"fd-attachment-name",dir:"auto"}),a=t("span",{class:"fd-attachment-count",dir:"ltr"}),s=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.previousAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),d=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.nextAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A")),l=t("a",{class:"fd-button fd-button-link fd-attachment-open",target:"_blank",rel:"noopener"},r.openAttachment),f=t("div",{class:"fd-attachment-body"}),c=t("aside",{class:"fd-attachment-preview",hidden:""},t("div",{class:"fd-attachment-head"},o,a,s,d,l),f),v=[],m=0,S=null,g,p=0,b,h;function x(){S?.free(),S=null;let k=v[m];if(!k)return f.replaceChildren();let A=ho(e.doc,k);S=A,f.replaceChildren(...A?[A.element]:[]),Lt(o,k.name),Lt(a,v.length>1?e.fill(r.recordAt,{n:m+1,total:v.length}):""),et(s,v.length<2),et(d,v.length<2),kt(l,"href",A?.url??null),kt(c,"aria-label",e.fill(r.attachment,{name:k.name}))}let L=k=>{m=(m+k+v.length)%v.length,x()};s.addEventListener("click",()=>L(-1)),d.addEventListener("click",()=>L(1));let y=k=>{v=k.filter(Wf),m=0,x(),R()},R=()=>et(c,n.node("#preview").invisible||!v.length);function E(k){let A=e.dataSource,w=++p;if(g=k.recordId,k.recordId==null||!A?.attachments||e.page.data.kind!=="record")return y([]);A.attachments({model:e.page.data.model,id:k.recordId,fields:e.page.fields}).then(j=>w===p&&y(j),()=>w===p&&y([]))}return{element:c,update(k){if(i.field){let A=k.values[i.field];A!==h&&(h=A,y(jf(A)))}else k.status!=="loading"&&k.status!=="idle"&&(k.recordId!==g||k.status==="saved"&&b!=="saved")&&E(k);b=k.status,R()},destroy:()=>S?.free()}}var Hf='.fd-record-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-height:46px;box-sizing:border-box;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-form>.fd-content>.fd-record-bar{margin:-4px 0 12px;border-radius:var(--fd-radius);border:1px solid var(--fd-border)}.fd-breadcrumbs{min-width:0}.fd-breadcrumbs ol{display:flex;flex-wrap:wrap;align-items:center;list-style:none;margin:0;padding:0;font-size:17px;line-height:1.3}.fd-breadcrumbs li{display:flex;align-items:center;min-width:0}.fd-breadcrumbs li+li:before{content:"/";color:var(--fd-muted);padding-inline:8px}.fd-crumb{all:unset;cursor:pointer;color:var(--fd-accent);border-radius:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-crumb:hover{text-decoration:underline}.fd-crumb:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-crumb-current{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-record-actions{position:relative}.fd-record-actions[hidden]{display:none}.fd-record-gear{display:inline-flex;align-items:center;gap:6px}.fd-record-gear svg{width:16px;height:16px;flex:none}.fd-record-menu{position:absolute;z-index:40;inset-block-start:calc(100% + 4px);inset-inline-start:0;display:grid;min-width:220px;max-width:min(320px,90vw);padding:4px;box-sizing:border-box;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #00000029}.fd-record-menu[data-end]{inset-inline-start:auto;inset-inline-end:0}.fd-record-menu[hidden],.fd-record-menu [hidden]{display:none}.fd-record-menu [role=group]{display:grid}.fd-record-menu-heading{padding:6px 12px 2px;font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--fd-muted)}.fd-record-menu-rule{margin:4px 0;border-block-start:1px solid var(--fd-border)}.fd-record-menu-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 12px;border-radius:3px;cursor:pointer;color:var(--fd-text)}.fd-record-menu-item svg{width:16px;height:16px;flex:none;color:var(--fd-muted)}.fd-record-menu-item:hover,.fd-record-menu-item:focus{background:var(--fd-accent-soft)}.fd-record-menu-item:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-record-menu-danger{color:var(--fd-error)}.fd-record-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-record-pager[hidden]{display:none}.fd-record-pager-text{padding-inline-end:6px;font-variant-numeric:tabular-nums;color:var(--fd-muted);white-space:nowrap}.fd-record-step{min-width:34px;padding-inline:8px;font-size:18px;line-height:1}.fd-record-step[aria-disabled=true]{opacity:.5;cursor:default}@container fd-form (max-width: 520px){.fd-record-bar{padding-inline:12px;gap:6px 8px}.fd-record-gear-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-breadcrumbs ol{flex-wrap:nowrap;font-size:15px}.fd-breadcrumbs li:not(:nth-last-child(-n+2)){display:none}.fd-breadcrumbs li:nth-last-child(2):before{content:"\u2039";padding-inline:0 6px;font-size:20px;color:var(--fd-accent)}}.fd-attachment-preview{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);overflow:hidden}.fd-attachment-preview[hidden]{display:none}.fd-attachment-head{display:flex;align-items:center;gap:6px;padding:6px 8px 6px 12px;padding-inline:12px 8px;border-block-end:1px solid var(--fd-border);min-width:0}.fd-attachment-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.fd-attachment-count{color:var(--fd-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.fd-attachment-head [hidden]{display:none}.fd-attachment-body{display:grid;min-height:0;background:var(--fd-page)}.fd-attachment-body>iframe{width:100%;height:100%;min-height:70vh;border:0;background:#fff}.fd-attachment-body>img{display:block;max-width:100%;max-height:80vh;margin:auto;object-fit:contain}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){max-width:none;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);grid-template-rows:auto 1fr}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden]))>:is(.fd-card,.fd-side){grid-column:1}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:2;grid-row:1 / span 2;position:sticky;top:8px;height:calc(100vh - 16px);max-height:1200px}@container (max-width: 1000px){.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){grid-template-columns:minmax(0,1fr)}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:1;grid-row:auto;position:static;height:auto}.fd-attachment-body>iframe{min-height:60vh}}@container (max-width: 1000px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr) minmax(240px,300px)}}@container (max-width: 600px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr)}}';function Yd(e){if(e.getElementById("fd-record-styles"))return;let t=e.createElement("style");t.id="fd-record-styles",t.textContent=Hf,(e.head??e.documentElement).append(t)}var Bf=0;function Lr(e,t){let n={...t},r=e.ownerDocument,i=sr(n.page,n.parent?{parent:n.parent.fields}:{});if(!i.ok)throw new Error(`This page cannot be shown:
|
|
63
|
-
${i.issues.map(
|
|
64
|
-
`)}`);let o=n.locale??i.page.language,a=o?dr(i.page,o):i.page,s=n.translate?Bn(a,n.translate):a,d=M=>{let G=o?dr(M,o):M;return n.translate?Bn(G,n.translate):G},l=wr(o),f=n.preferences??Wo(),c=Id(n,(M,G)=>S.say(M,G)),v=!n.form,m={...It[l],...n.labels},S={open:M=>_d({options:n,place:e,root:O,title:G=>d(G).title||G.id,back:m.back,missing:G=>A(m.pageMissing,{page:G}),say:(G,ue)=>S.say(G,ue),post:G=>g.post(G),name:()=>On()||m.newRecord},M),say:(M,G)=>D(M,G),ask:M=>W(M),show:M=>{if(!I.get(M)?.())throw new Error(`No tab "${M}" can be shown here`)},openUrl:(M,G)=>G?r.defaultView?.open(M,"_blank","noopener,noreferrer"):r.defaultView?.location.assign(M),...n.host},g=n.form??ei({...n,page:s,host:S,messages:n.messages??Et[l]}),p=tt[l],b=n.dir??(o&&qr(o)?"rtl":void 0),h=`fd${++Bf}`,x=[],L=x,y=[],R=!1,E=M=>`${h}-${M.replace(/[^A-Za-z0-9_-]/g,"_")}`,k=E,A=(M,G)=>M.replace(/\{(\w+)\}/g,(ue,ye)=>String(G[ye]??""));Do(r),Yd(r);function w(M,G={},...ue){let ye=r.createElement(M);for(let[Fe,Ne]of Object.entries(G))Ne!==void 0&&ye.setAttribute(Fe,Ne);return ye.append(...ue),ye}function j(M,G){let ue=wt(r,M,n.icons),ye=w("bdi",{},G);return ue?[ue,ye]:[ye]}let C=n.theme??s.look?.theme,O=w("form",{class:"fd-form",novalidate:"","data-fd-skin":xn(n.skin,C),dir:b,lang:o,"data-max-width":s.maxWidth});Nn(O,C?{...s.look,theme:C}:s.look),wn(O,n.tokens);let W=n.confirm??tr,D=Ud(O,w,m.dismiss),I=new Map,B=new Map;async function H(M,G){if(!M.hasAttribute("aria-busy")){M.setAttribute("aria-busy","true"),M.setAttribute("aria-disabled","true");try{let{reason:ue}=await G();(ue==="check"||ue==="save")&&(g.getState().saveProblem||Re(re(g.getState())),fe())}finally{M.removeAttribute("aria-busy"),M.removeAttribute("aria-disabled")}}}let V=[],z=new Map,T=()=>ln(g.getState()),te=!1,Y=!1;function K(M,G){G&&M.style.setProperty("--fd-span",String(G))}let q=M=>({columns:1,onPage:M,labels:s.look?.labels});function oe(M){let{form:G,page:ue}=M,ye=$=>E(M.prefix+$),Fe=$=>L.push(M.root?$:()=>$(G.getState()));function Ne($,J){let Z=ue.fields[$.field],ee=ye($.id),se=Rr($,Z.type,J),be=w("div",{class:"fd-field","data-node":$.id,"data-field":$.field,"data-path":M.path+$.field,"data-type":Z.type,"data-labels":se,"data-focus":$.focus&&M.root?"":void 0});$.colspan&&be.style.setProperty("--fd-span",String($.colspan));let Ue=$.label??Z.label,je=w("label",{class:"fd-label",id:`${ee}-label`,for:ee},qf(Ue)),He=n.showValid&&!zf.has(Z.type)?wt(r,"check"):null;He&&(He.classList.add("fd-valid-mark"),je.append(He));let Be=Ot({form:G,name:$.field,field:Z,node:$,id:ee,document:r,labels:p,preferences:f,locale:l,dialogs:c},n.widgets);$.focus&&M.root&&V.push({wrapper:be,focus:()=>Be.focus()});let Ft=Be.element.matches(Xd)?Be.element:Be.element.querySelector(Xd);se==="hidden"&&!$.placeholder&&Ft?.setAttribute("placeholder",Ue);let Qe=Ft?.getAttribute("placeholder")??null,ht=$.placeholderWhen?.length?Ft:null;["INPUT","SELECT","TEXTAREA"].includes(Be.element.tagName)||((Be.element.getAttribute("role")?Be.element:Be.element.querySelector(`[id="${ee}"][role]`))?.setAttribute("aria-labelledby",je.id),je.addEventListener("click",Ln=>{Ln.target.closest?.(".fd-help-tip-wrap")||Be.focus()}));let ut=$.help??Z.help,Mt=$.helpShown??ue.look?.helpShown??"below",At=ut&&Mt!=="tooltip"?w("div",{class:"fd-help",id:`${ee}-help`},ut):null,ct=ut&&Mt!=="below"?mt(`${ee}-tip`,ut,A(m.helpFor,{label:Ue})):null;ct&&se==="hidden"?Be.element.after(ct.element):ct&&(je.append(ct.element),je.dir="auto");let Ge=w("div",{class:"fd-error",id:`${ee}-error`,hidden:""}),$t=w("div",{class:"fd-warning",id:`${ee}-warning`,role:"status",hidden:""});be.append(...se==="after"?[Be.element,je]:[je,Be.element],...At?[At]:[],Ge,$t);let Pt=ue.look?.readonlyShown==="text"&&jo(Z,$)?Ho({document:r,field:Z,node:$,id:ee,locale:l,labels:p,dialogs:c}):null;Pt&&Be.element.after(Pt.element),Be.destroy&&y.push(()=>Be.destroy?.());let Vn=!1,Sn="";be.addEventListener("focusin",()=>Vn=!0),be.addEventListener("focusout",Tt=>{be.contains(Tt.relatedTarget)||(Vn=!1,queueMicrotask(()=>Zo(G.getState())))});let el=$.tones!==void 0||$.bold!==void 0,Zo=Tt=>{let Ln=G.node($.id);if(et(be,Ln.invisible),be.classList.toggle("fd-required",Ln.required),el){let cn=G.fieldTone($.id);kt(be,"data-tone",cn.tone),be.classList.toggle("fd-value-bold",cn.bold)}ht&&kt(ht,"placeholder",G.placeholder($.id)??Qe);let In=Tt.errors[$.field];et(Ge,!In),Lt(Ge,In??"");let Qo=Tt.warnings[$.field]??"";(!Vn||!Qo)&&(Sn=Qo);let ji=[In?"":Sn,Tt.warning&&Tt.warningField===$.field?Tt.warning:""].filter(Boolean).join(" ");if(et($t,!ji),Lt($t,ji),He){let cn=Tt.values[$.field],tl=cn!=null&&cn!==""&&!(Array.isArray(cn)&&!cn.length),ea=!Ln.readonly&&!In&&tl&&Tt.dirty.includes($.field)&&G.problem($.field)===null;be.classList.toggle("fd-valid",ea),He.toggleAttribute("hidden",!ea)}let ir=Ln.readonly||ne||M.locked();Pt&&(et(Be.element,ir),et(Pt.element,!ir),kt(be,"data-read-text",ir?"":null),ir&&Pt.update(Tt.values[$.field],Tt.values)),Be.update({value:Tt.values[$.field],values:Tt.values,readonly:ir,required:Ln.required,invalid:!!In,describedBy:[At?.id??ct?.bubble.id,In?Ge.id:void 0,ji?$t.id:void 0].filter(Boolean).join(" ")||void 0})};return Fe(Zo),be}function mt($,J,Z){let ee=w("span",{class:"fd-help-bubble",role:"tooltip",id:$,hidden:""},J),se=w("button",{type:"button",class:"fd-help-tip","aria-label":Z,"aria-expanded":"false","aria-controls":$},"?"),be=!1,Ue=je=>{ee.hidden=!je,se.setAttribute("aria-expanded",String(je)),je&&Ye(ee)};return se.addEventListener("mouseenter",()=>Ue(!0)),se.addEventListener("mouseleave",()=>Ue(be)),se.addEventListener("focus",()=>Ue(!0)),se.addEventListener("blur",()=>(be=!1,Ue(!1))),se.addEventListener("click",je=>{je.preventDefault(),be=!be,Ue(be)}),se.addEventListener("keydown",je=>{je.key!=="Escape"||ee.hidden||(je.stopPropagation(),be=!1,Ue(!1))}),{element:w("span",{class:"fd-help-tip-wrap"},se,ee),bubble:ee}}function Ye($){$.style.transform="";let J=$.getBoundingClientRect(),Z=r.documentElement.clientWidth,ee=8,se=J.right>Z-ee?Z-ee-J.right:J.left<ee?ee-J.left:0;se&&($.style.transform=`translateX(${Math.round(se)}px)`)}function st($,J){Fe(()=>et($,G.node(J).invisible))}function xt($){let J=w("button",{type:"button",class:`fd-button fd-button-${$.style??"secondary"}`,"data-node":$.id},...j($.icon,$.label));return $.hotkey&&Cn(J,$.hotkey,$.label),K(J,$.colspan),J.addEventListener("click",()=>{H(J,()=>G.runAction($.id))}),st(J,$.id),u($,J)}function Ze($,J=!1){let Z=$.style??"paragraph",ee=Xo(r,ue.fields,$.text,l),se=J?w("span",{class:`fd-oneline-words fd-text-${Z}`,"data-node":$.id},...ee.nodes):Z==="alert"?w("div",{class:`fd-alert fd-text-alert fd-tone-${$.tone??"info"}`,role:"status","data-node":$.id},w("span",{class:"fd-alert-message"},...ee.nodes)):w(Z==="heading"?"h3":"p",{class:`fd-text-${Z}`,"data-node":$.id},...ee.nodes);return K(se,$.colspan),st(se,$.id),Fe(be=>ee.update(be.values)),se}function dt($){let J=w("div",{class:"fd-slot","data-slot":$.name,"data-node":$.id}),Z=n.slots?.[$.name]?.(J,{form:G,name:$.name});return Z&&y.push(Z),st(J,$.id),J}function Ie($,J,Z){let ee=w("div",{class:"fd-grid"});if(J!==null&&(ee.style.setProperty("--fd-columns",String(fn(J))),fn(J)===12&&ee.setAttribute("data-twelfths",""),typeof J=="object"))for(let se of["medium","narrow"]){let be=J[se];be!==void 0&&(ee.setAttribute(`data-columns-${se}`,String(be)),ee.style.setProperty(`--fd-columns-${se}`,String(be)))}return ee.append(...$.map(se=>qe(se,Z))),ee}function at($,J){let[Z]=$.children;if(!J.arrangement||J.at==="tracks"||fn($.columns)!==12||$.children.length<2||Z?.type!=="field"||$.children.reduce((be,Ue)=>be+(Ue.colspan??1),0)>12)return null;let ee=ue.fields[Z.field]?.type,se=ee?Rr(Z,ee,J.inner.labels):"hidden";return se===void 0?"skin":se==="beside"?"beside":null}function Se($,J){let Z=w("div",{class:"fd-field fd-oneline","data-node":$.id,"data-style":"inline","data-labels":J.labels});K(Z,$.colspan);let ee=w("div",{class:"fd-oneline-row",role:"group"},...Zd($.children).map(se=>{let be=se.map(Ue=>qe(Ue,{columns:1,onPage:!1,inline:!0}));return be.length===1?be[0]:w("span",{class:"fd-oneline-pair"},...be)}));if($.title){let se=w("span",{class:"fd-label",id:ye(`${$.id}-label`)},$.title);ee.setAttribute("aria-labelledby",se.id),Z.append(se)}return Z.append(ee),st(Z,$.id),Z}function Ke($,J){if($.style==="inline")return Se($,J);let Z=Vi($,J),ee=w(Z.arrangement?"div":"fieldset",{class:"fd-section","data-node":$.id,"data-style":Z.style,"data-place":Z.at,"data-on-page":Z.style==="card"&&J.onPage?"":void 0});K(ee,$.colspan);let se=at($,Z);se&&ee.setAttribute("data-row",se),$.labelWidth&&ee.style.setProperty("--fd-label-width",`${$.labelWidth}px`);let be=$.description?w("p",{class:"fd-section-description"},$.description):null,Ue=Ie($.children,Z.at==="tracks"?null:$.columns,Z.inner);if($.title&&$.collapsible){Ue.id=ye(`${$.id}-content`);let je=w("button",{type:"button",class:"fd-section-toggle","aria-controls":Ue.id},w("span",{class:"fd-section-chevron","aria-hidden":"true"}),...j($.icon,$.title)),He=$.collapsed!==!0,Be=Ft=>{He=Ft,je.setAttribute("aria-expanded",String(He)),Ue.hidden=!He,be&&(be.hidden=!He),ee.classList.toggle("fd-section-folded",!He)};je.addEventListener("click",()=>Be(!He)),z.set(ee,()=>Be(!0)),Be(He),ee.append(w("legend",{class:"fd-section-title"},je))}else $.title&&ee.append(w("legend",{class:"fd-section-title"},...j($.icon,$.title)));return be&&ee.append(be),ee.append(Ue),st(ee,$.id),ee}function ve($,J){let Z=w("div",{class:"fd-tabs","data-node":$.id});K(Z,$.colspan);let ee=w("div",{class:"fd-tablist",role:"tablist"}),se=null,be=$.children[0].id,Ue=Qe=>{se=be=Qe,T(),G.shown(Qe)},je=$.children.map(Qe=>{let ht=ye(`${Qe.id}-tab`),ut=ye(`${Qe.id}-panel`),Mt=w("button",{type:"button",class:"fd-tab",role:"tab",id:ht,"aria-controls":ut,"data-node":Qe.id},...j(Qe.icon,Qe.label)),At=w("div",{class:"fd-tabpanel",role:"tabpanel",id:ut,"aria-labelledby":ht}),ct=[],Ge=!1,$t=()=>{if(Ge)return;Ge=!0;let Sn=L;L=ct;try{At.append(Ie(Qe.children,1,{columns:1,onPage:J.onPage,labels:J.labels}))}finally{L=Sn}},Pt=()=>!G.node(Qe.id).invisible&&(Ue(Qe.id),!0);Mt.addEventListener("click",()=>Ue(Qe.id)),I.has(Qe.id)||I.set(Qe.id,Pt);let Vn=ze(Qe.children);if(M.root)for(let Sn of Vn)B.has(Sn)||B.set(Sn,Pt);return ee.append(Mt),{tab:Qe,button:Mt,panel:At,own:ct,build:$t,fields:Vn}});ee.addEventListener("keydown",Qe=>{let ht=je.filter(Ge=>!Ge.button.hidden),ut=ht.findIndex(Ge=>Ge.tab.id===be),Mt={ArrowRight:1,ArrowLeft:-1,Home:-ut,End:ht.length-1-ut}[Qe.key];if(Mt===void 0||ut===-1)return;Qe.preventDefault();let At=O.getAttribute("dir")==="rtl"&&(Qe.key==="ArrowRight"||Qe.key==="ArrowLeft"),ct=ht[(ut+(At?-Mt:Mt)+ht.length)%ht.length];Ue(ct.tab.id),ct.button.focus()});let He=Kd(ee,w);y.push(He.destroy),Z.append(He.element,...je.map(Qe=>Qe.panel));let Be="",Ft="";return Fe(Qe=>{let ht=G.node($.id).invisible;et(Z,ht);let ut=je.filter(Ge=>!G.node(Ge.tab.id).invisible);se!==null&&ut.some(Ge=>Ge.tab.id===se)?be=se:ut.length&&(be=ut[0].tab.id);let At=G.getState().errors;for(let Ge of je){let $t=Ge.tab.id===be;if(et(Ge.button,!ut.includes(Ge)),kt(Ge.button,"aria-selected",String($t)),Ge.button.tabIndex!==($t?0:-1)&&(Ge.button.tabIndex=$t?0:-1),kt(Ge.button,"data-problem",Ge.fields.some(Pt=>At[Pt])?"":null),et(Ge.panel,!$t),$t&&!ht){Ge.build();for(let Pt of Ge.own)Pt(Qe)}}let ct=ut.map(Ge=>Ge.tab.id).join(" ");if(ct!==Be&&(Be=ct,He.measure()),be!==Ft&&ee.clientWidth){Ft=be;let Ge=je.find($t=>$t.tab.id===be);Ge&&He.reveal(Ge.button)}}),Z}function ze($){return $.flatMap(J=>J.type==="field"?[J.field]:J.type==="section"?ze(J.children):J.type==="tabs"?J.children.flatMap(Z=>ze(Z.children)):[])}function qe($,J){return u($,F($,J))}function u($,J){return $.hideOn?.length&&(J.dataset.hideOn=$.hideOn.join(" ")),J}function F($,J){switch($.type){case"field":return Ne($,J.labels);case"button":return xt($);case"text":return Ze($,J.inline);case"slot":return dt($);case"section":return Ke($,J);case"tabs":return ve($,J);case"divider":case"spacer":case"image":return P($);case"form":return Q($,J);case"map":return N($)}}function N($){if(!n.maps)return R||console.warn("[Fieldia] This page has a map: give the viewer `maps` (mapParts from @fieldia/map) to draw it."),R=!0,w("div",{class:"fd-map-part","data-node":$.id,hidden:""});let J=n.maps({node:$,page:ue,form:G,document:r,locale:l,icons:n.icons});return J.element.classList.add("fd-map-part"),J.element.dataset.node=$.id,K(J.element,$.colspan??12),Fe(Z=>J.update(Z)),J.destroy&&y.push(()=>J.destroy?.()),st(J.element,$.id),J.element}function P($){let J=$.type==="divider"?w("hr",{class:"fd-divider","data-node":$.id}):$.type==="spacer"?w("div",{class:"fd-block fd-spacer","aria-hidden":"true","data-node":$.id}):_($);return $.type!=="divider"&&$.colspan&&J.style.setProperty("--fd-span",String($.colspan)),st(J,$.id),J}function _($){let J=w("img",{class:"fd-image",src:$.src,alt:$.alt,loading:"lazy"}),Z=$.href&&/^(https?:\/\/|mailto:)/i.test($.href)?$.href:void 0,ee=w("figure",{class:"fd-block fd-figure","data-node":$.id,"data-align":$.align},Z?w("a",{href:Z,target:"_blank",rel:"noopener noreferrer"},J):J,...$.caption?[w("figcaption",{class:"fd-caption"},$.caption)]:[]),se=typeof $.width=="number"?`${$.width}px`:$.width&&{small:"160px",medium:"320px",large:"480px",full:"100%"}[$.width];return se&&ee.style.setProperty("--fd-image-width",se),ee}function Q($,J){let Z=w("fieldset",{class:"fd-section fd-form-part","data-node":$.id,"data-style":"card","data-on-page":J.onPage?"":void 0,"aria-busy":"true"});K(Z,$.colspan);let ee=w("p",{class:"fd-form-part-note"},m.loading);Z.append(ee),st(Z,$.id);let se=je=>{Z.removeAttribute("aria-busy"),ee.textContent=je,ee.classList.add("fd-form-part-problem")},be=je=>{if(Y)return;if(!je)return se(A(m.formMissing,{page:$.page}));let He=d(je),Be=He.title||je.id,Ft=M.chain.findIndex(ct=>ct.id===je.id);if(Ft!==-1)return se(A(m.formInItself,{page:Be,chain:[...M.chain.slice(Ft).map(ct=>ct.title),Be].join(" \u2192 ")}));if(je.layout.type!=="sections"&&je.layout.type!=="tabs")return se(A(m.formNotPlaceable,{page:Be}));let Qe=sr(He),ht;try{if(!Qe.ok)throw new Error(Qe.issues.map(ct=>`${ct.path}: ${ct.message}`).join("; "));ht=G.embed($.id,He)}catch(ct){return console.warn(`Fieldia: the saved form "${je.id}" cannot be shown: ${ct.message}`),se(A(m.formBroken,{page:Be}))}let ut=$.title??He.title??"";Z.setAttribute("data-title",ut),ut&&Z.prepend(w("legend",{class:"fd-section-title"},...j(void 0,ut)));let Mt=oe({root:!1,form:ht,page:He,prefix:`${M.prefix}${$.id}-`,chain:[...M.chain,{id:je.id,title:Be}],locked:()=>M.locked()||G.node($.id).readonly,path:`${M.path}${$.name}.`}),At=He.layout;ee.replaceWith(Mt.grid(At.type==="tabs"?[At]:At.children,1,{columns:1,onPage:!1,labels:J.labels})),Z.removeAttribute("aria-busy"),y.push(ht.subscribe(T)),te&&T()},Ue;try{Ue=Er(n,$.version===void 0?{id:$.page}:{id:$.page,version:$.version})}catch{Ue=null}return Ue instanceof Promise?Ue.then(be,()=>be(null)):be(Ue),Z}return{item:qe,grid:Ie,fieldItem:Ne,buttonItem:xt,hideWhen:st,slotItem:dt}}let{item:Ce,grid:Me,fieldItem:ke,buttonItem:$e,hideWhen:ae,slotItem:he}=oe({root:!0,form:g,page:s,prefix:"",chain:[{id:s.id,title:s.title||s.id}],locked:()=>!1,path:""}),ne=n.readonly===!0,Te=n.editSwitch?w("button",{type:"button",class:"fd-button fd-edit-switch"}):null;Te?.addEventListener("click",async()=>{if(ne)ne=!1;else{if(g.getState().dirty.length&&!await g.save()){g.getState().saveProblem||Re(re(g.getState())),fe();return}ne=!0}O.toggleAttribute("data-readonly",ne),g.setEditing(!ne),ln(g.getState())}),O.toggleAttribute("data-readonly",ne),g.setEditing(!ne),x.push(()=>{Te&&(Te.textContent=ne?m.edit:m.done,Te.classList.toggle("fd-button-primary",ne))});let Pe=w("div",{class:"fd-status",role:"status","aria-live":"polite"}),we=w("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},m.retry);we.addEventListener("click",()=>{vt()});let Ve=w("div",{class:"fd-status-box"},Pe,we),X=()=>s.data.kind==="responses"?m.notSent:m.notSaved;function re(M){let G=[...O.querySelectorAll(".fd-field[data-path]")],ue=[];for(let Fe of Object.keys(M.errors)){let Ne;for(let Ze=Fe;Ze&&!Ne;Ze=Ze.slice(0,Math.max(0,Ze.lastIndexOf("."))))Ne=G.find(dt=>dt.getAttribute("data-path")===Ze&&!dt.hidden);let mt=Fe.split(".")[0],Ye=Ne?.querySelector(":scope > .fd-label")?.firstChild?.textContent??s.fields[mt]?.label??mt,st=Ne?.closest(".fd-form-part")?.getAttribute("data-title"),xt=st?`${Ye} (${st})`:Ye;ue.some(Ze=>Ze.name===xt)||ue.push({name:xt,at:Ne?G.indexOf(Ne):1/0})}let ye=ue.sort((Fe,Ne)=>Fe.at-Ne.at).map(Fe=>Fe.name);return ye.length?A(m.checkFields,{what:X(),fields:ye.join(", ")}):X()}let me;x.push(M=>{let G=M.saveProblem,ue=M.status==="saving"?m.saving:M.status==="saved"?m.saved:M.status==="loading"?m.loading:M.status==="error"&&G?G.kind==="fields"?re(M):G.kind==="other"?G.message:X():M.status==="error"?M.error??"":"";kt(Pe,"aria-live",M.status==="error"&&G?"off":"polite"),Lt(Pe,ue),et(we,!(M.status==="error"&&G?.kind==="other")),Pe.classList.toggle("fd-status-error",M.status==="error"),Pe.classList.toggle("fd-status-saved",M.status==="saved"),n.saveStatus==="toast"&&(clearTimeout(me),Ve.hidden=!ue,M.status==="saved"&&(me=setTimeout(()=>Ve.hidden=!0,2500)))});let U=w("button",{type:"button",class:"fd-button fd-retry"},m.retry);U.addEventListener("click",()=>{vt()});let ie=w("div",{class:"fd-banner fd-tone-warning",role:"alert",hidden:""},w("span",{class:"fd-banner-text"},m.offline),U),Ae=w("div",{class:"fd-announce",role:"alert","aria-live":"assertive"});function Re(M){Ae.textContent="",setTimeout(()=>Ae.textContent=M,0)}let de=null;x.push(M=>{M.saveProblem!==de&&(de=M.saveProblem,ie.hidden=de?.kind!=="network",de&&(de.kind==="rule"?tr(de.message,!1):de.kind==="fields"?Re(re(M)):de.kind==="other"&&Re(de.message)))});let pe=w("div",{class:"fd-draft",hidden:""}),le=w("span"),ce=w("button",{type:"button",class:"fd-button fd-button-primary"},m.restore),ge=w("button",{type:"button",class:"fd-button fd-button-link"},m.discardDraft);ce.addEventListener("click",()=>g.restoreDraft()),ge.addEventListener("click",()=>g.discardDraft()),pe.append(le,ce,ge),x.push(M=>{et(pe,!M.draft),M.draft&&(le.textContent=A(m.draftFound,{time:new Date(M.draft.savedAt).toLocaleString()}))});function fe(){if(![...O.querySelectorAll('[aria-invalid="true"]')].find(ye=>!ye.closest(".fd-tabpanel[hidden]"))){let ye=g.getState().errors,Fe=[...B.keys()].find(Ne=>ye[Ne]);Fe&&B.get(Fe)?.()}let G=[...O.querySelectorAll('[aria-invalid="true"]')].find(ye=>!ye.closest(".fd-tabpanel[hidden]"))??null;if(!G)return;for(let ye=G.closest(".fd-section-folded");ye;ye=ye.parentElement?.closest(".fd-section-folded")??null)z.get(ye)?.();if(!G.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(G.matches("input, select, textarea, button")?G:G.querySelector("input, select, textarea, button"))?.focus()}let xe=w("div",{class:"fd-done",hidden:""},w("p",{class:"fd-done-title"},m.submitted)),it=w("button",{type:"button",class:"fd-button"},m.submitAnother);xe.append(it);let lt=w("div",{class:"fd-content"});async function vt(){if(!await g.save()){g.getState().saveProblem||Re(re(g.getState())),fe();return}s.data.kind==="responses"&&(lt.hidden=!0,xe.hidden=!1)}it.addEventListener("click",()=>{g.reset(),lt.hidden=!1,xe.hidden=!0});function On(){let M=g.getState();if(M.recordId==null)return"";let G=s.layout.type==="sheet"?s.layout.title?.field:void 0;return(G?St(s.fields[G],M.values[G],M.values,l):"")||s.title||""}function Qn(M){if(s.data.kind!=="record")return null;let G=Jd({doc:r,el:w,form:g,toolbar:M,records:n.records,breadcrumbs:n.breadcrumbs,labels:m,icons:n.icons,uid:k,fill:A,withIcon:j,press:H,name:On,render:T,async leave(){if(!g.getState().dirty.length)return!0;let ue=await g.save();return ue||(g.getState().saveProblem||Re(re(g.getState())),fe()),ue}});return G?(x.push(G.update),y.push(G.destroy),G.element):null}function Di(){if(!s.title&&!s.description)return null;let M=w("header",{class:"fd-page-head"});return s.title&&M.append(w("h1",{class:"fd-page-title"},s.title)),s.description&&M.append(w("p",{class:"fd-page-description"},s.description)),M}function zt(M){return!M?.length||n.showActions===!1?null:w("div",{class:"fd-actions fd-actions-end fd-page-footer"},Ve,...M.map($e))}function qt(M){let G=w("div",{class:"fd-sections","data-node":M.id},...M.children.map(Ne=>Ce(Ne,q(!0)))),ue=zt(M.footer);if(ue)return w("div",{},G,ue);let ye=w("button",{type:"submit",class:"fd-button fd-button-primary"},s.data.kind==="responses"?m.submit:m.save),Fe=w("div",{class:"fd-actions fd-actions-end"},Ve,ye);if(s.data.kind==="record"){let Ne=w("button",{type:"button",class:"fd-button"},m.discard);Ne.addEventListener("click",()=>g.reset()),Fe.insertBefore(Ne,ye),x.push(mt=>{let Ye=mt.dirty.length>0&&mt.status!=="saving"&&!ne;et(ye,!Ye),et(Ne,!Ye)})}else x.push(()=>et(ye,ne));return Te&&Fe.prepend(Te),n.showActions===!1?w("div",{},G):s.actionsPosition==="top"?(Fe.classList.add("fd-actions-top"),w("div",{},Fe,G)):w("div",{},G,Fe)}function _t(M){let G=w("div",{class:"fd-wizard","data-node":M.id}),ue=w("div",{class:"fd-progress-text"}),ye=w("span");G.append(w("div",{class:"fd-progress"},ue,w("div",{class:"fd-progress-bar"},ye)));let Fe=M.clickable?w("ol",{class:"fd-steps-list"}):null,Ne=new Map;if(Fe){for(let Ie of M.children){let at=w("button",{type:"button",class:"fd-step-link"},...j(Ie.icon,Ie.label));at.addEventListener("click",()=>{g.goTo(Ie.id)?dt():fe()}),Ne.set(Ie.id,at),Fe.append(w("li",{},at))}G.append(w("nav",{class:"fd-steps","aria-label":m.steps},Fe))}let mt=M.children.map(Ie=>{let at=w("section",{class:"fd-step","data-node":Ie.id,"aria-labelledby":k(`${Ie.id}-title`)});return at.append(w("h2",{class:"fd-step-title",id:k(`${Ie.id}-title`)},...j(Ie.icon,Ie.label))),Ie.description&&at.append(w("p",{class:"fd-section-description"},Ie.description)),at.append(Me(Ie.children,1,q(!1))),G.append(at),{step:Ie,panel:at}}),Ye=w("button",{type:"button",class:"fd-button"},M.backLabel??m.back),st=w("button",{type:"button",class:"fd-button fd-button-link"},m.skip),xt=w("button",{type:"submit",class:"fd-button fd-button-primary"});G.append(w("div",{class:"fd-wizard-nav"},Ye,w("span",{class:"fd-spacer"}),Ve,st,xt)),Ye.addEventListener("click",()=>{g.back()&&dt()}),st.addEventListener("click",()=>{g.skip()&&dt()});let Ze=()=>{let Ie=g.steps();return Ie.indexOf(g.getState().step??"")===Ie.length-1};Dt=async()=>{if(Ze())return vt();g.next()?dt():fe()};function dt(){mt.find(at=>at.step.id===g.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return x.push(Ie=>{let at=g.steps(),Se=Math.max(0,at.indexOf(Ie.step??""));ue.textContent=A(m.stepOf,{n:Se+1,total:at.length}),ye.style.width=`${(Se+1)/Math.max(1,at.length)*100}%`;for(let{step:ve,panel:ze}of mt)ze.hidden=ve.id!==Ie.step;let Ke=Se===at.length-1;Ye.hidden=Se===0,st.hidden=Ke||!M.children.find(ve=>ve.id===Ie.step)?.optional,xt.textContent=Ke?M.finishLabel??m.submit:M.nextLabel??m.next;for(let[ve,ze]of Ne){let qe=at.indexOf(ve);ze.parentElement.hidden=qe===-1,ze.classList.toggle("fd-step-done",qe!==-1&&qe<Se),ze.classList.toggle("fd-step-skipped",Ie.skipped.includes(ve)),ve===Ie.step?ze.setAttribute("aria-current","step"):ze.removeAttribute("aria-current")}}),G}function sn(M){let G=w("div",{class:"fd-sheet-page","data-node":M.id}),ue=w("div",{class:"fd-actions"}),ye=w("button",{type:"submit",class:"fd-button fd-button-primary"},m.save),Fe=w("button",{type:"button",class:"fd-button"},m.discard);Fe.addEventListener("click",()=>g.reset());let Ne=s.actionsPosition==="bottom",mt=w("div",{class:"fd-actions fd-actions-end fd-sheet-foot"}),Ye=zt(M.footer);n.showActions===!1||Ye?ue.append(...(M.buttons??[]).map($e)):Ne?(ue.append(...(M.buttons??[]).map($e)),mt.append(Ve,Fe,ye)):ue.append(ye,Fe,...(M.buttons??[]).map($e),Ve),Te&&n.showActions!==!1&&ue.prepend(Te),x.push(Se=>{let Ke=Se.dirty.length>0&&Se.status!=="saving"&&!ne;ye.hidden=!Ke,Fe.hidden=!Ke});let st=w("div",{class:"fd-header"},ue),xt=M.statusbar?.position==="title";M.statusbar&&!xt&&st.append(Ar(M.statusbar));let Ze=w("div",{class:"fd-card"}),dt=[...M.ribbon?[M.ribbon]:[],...M.ribbons??[]];if(dt.length){let Se=w("div",{class:"fd-ribbon-frame"}),Ke=dt.map(ve=>{let ze=w("div",{class:`fd-ribbon fd-tone-${ve.tone??"muted"}`,"data-node":ve.id,title:ve.tooltip},ve.label);return Se.append(ze),{ribbon:ve,element:ze}});x.push(ve=>{let ze=!1;for(let{ribbon:qe,element:u}of Ke){let F=!ze&&!g.node(qe.id).invisible;if(ze||(ze=F),et(u,!F),!F)continue;let N=qe.labelField?St(s.fields[qe.labelField],ve.values[qe.labelField],ve.values,l):"";Lt(u,N||qe.label)}}),Ze.append(Se)}if(M.statButtons?.length){let Se=w("div",{class:"fd-stats"}),Ke=(ve,ze)=>ve&&s.fields[ve]?St(s.fields[ve],ze[ve],ze,l):"";for(let ve of M.statButtons){let ze=w("span",{class:"fd-stat-value"}),qe=w("span",{class:"fd-stat-label"},ve.label),u=ve.secondField&&ve.secondLabel!==void 0?{value:w("span",{class:"fd-stat-value"}),label:w("span",{class:"fd-stat-label"},ve.secondLabel)}:null,F=wt(r,ve.icon,n.icons),N=u?w("span",{class:"fd-stat-words fd-stat-pair"},w("span",{class:"fd-stat-row"},qe,ze),w("span",{class:"fd-stat-row"},u.label,u.value)):w("span",{class:"fd-stat-words"},ze,qe),P=ve.help?k(`${ve.id}-help`):void 0,_=w("button",{type:"button",class:"fd-stat","data-node":ve.id,title:ve.help||void 0,"aria-describedby":P},...F?[F,N]:[N]);P&&Se.append(w("span",{class:"fd-sr-only",id:P},ve.help)),_.addEventListener("click",()=>{H(_,()=>g.runAction(ve.id))}),x.push(Q=>{_.hidden=g.node(ve.id).invisible;let $=Q.values,J=Ke(ve.unitField,$)||ve.unit||"",Z=Ke(ve.field,$),ee=Ke(ve.secondField,$);u?(Lt(ze,Z),Lt(u.value,[ee,J].filter(Boolean).join(" "))):Lt(ze,[[Z,ee].filter(Boolean).join(" / "),Z||ee?J:""].filter(Boolean).join(" ")),Lt(qe,Ke(ve.labelField,$)||ve.label)}),Se.append(_)}x.push(()=>{Se.hidden=[...Se.querySelectorAll(":scope > .fd-stat")].every(ve=>ve.hidden)}),Ze.append(Se)}for(let Se of M.alerts??[]){let Ke=Xo(r,s.fields,Se.message,l),ve=w("span",{class:"fd-alert-message"},...Ke.nodes),ze=!1,qe=w("div",{class:`fd-alert fd-tone-${Se.tone??"info"}`,role:"status","data-node":Se.id},ve);if(Se.buttons?.length&&qe.append(w("span",{class:"fd-alert-actions"},...Se.buttons.map(u=>$e({...u,style:u.style??"link"})))),x.push(u=>{Ke.update(u.values);let F=Se.messageField?u.values[Se.messageField]:null,N=typeof F=="string"?F.trim():"";N?Lt(ve,N):ze&&ve.replaceChildren(...Ke.nodes),ze=!!N}),Se.dismissible){let u=!1,F=w("button",{type:"button",class:"fd-alert-close","aria-label":m.dismiss},"\xD7");F.addEventListener("click",()=>{u=!0,qe.hidden=!0}),qe.append(F),x.push(()=>{qe.hidden=u||g.node(Se.id).invisible})}else ae(qe,Se.id);Ze.append(qe)}if(M.badges?.length){let Se=w("div",{class:"fd-badges"});for(let Ke of M.badges){let ve=w("span",{class:`fd-badge fd-tone-${Ke.tone??"muted"}`,"data-node":Ke.id},...j(Ke.icon,Ke.label));ae(ve,Ke.id),Se.append(ve)}x.push(()=>{Se.hidden=[...Se.children].every(Ke=>Ke.hidden)}),Ze.append(Se)}if(M.title){let Se=w("div",{class:"fd-title"});M.title.label&&Se.append(w("label",{class:"fd-title-label",for:k("#title")},M.title.label)),M.title.above?.length&&Se.append(w("div",{class:"fd-title-above"},...M.title.above.map(u=>ke(u))));let Ke=ke({type:"field",id:"#title",field:M.title.field,placeholder:M.title.placeholder,...M.title.placeholderWhen?{placeholderWhen:M.title.placeholderWhen}:{},...M.title.focus?{focus:!0}:{}}),ve=M.title.before??[],ze=M.title.after??[];if(ve.length||ze.length){Ke.classList.add("fd-title-name");let u=F=>{let N=ke(F);return N.classList.add("fd-title-side"),N};Se.append(w("div",{class:"fd-title-line"},...ve.map(u),Ke,...ze.map(u)))}else Se.append(Ke);M.title.subtitleField&&Se.append(ke({type:"field",id:"#subtitle",field:M.title.subtitleField})),M.title.below?.length&&Se.append(w("div",{class:"fd-title-below"},...M.title.below.map(u=>ke(u))));let qe=w("div",{class:"fd-title-row"},Se);if(M.title.avatarField){let u=ke({type:"field",id:"#avatar",field:M.title.avatarField});u.classList.add("fd-avatar"),qe.append(u)}Ze.append(qe)}M.statusbar&&xt&&Ze.append(w("div",{class:"fd-title-statusbar"},Ar(M.statusbar))),Ze.append(Me(M.children,1,q(!1))),Ye&&Ze.append(Ye),Ne&&n.showActions!==!1&&(Ze.append(mt),x.push(Se=>{mt.hidden=Se.dirty.length===0&&!Pe.textContent}));let Ie=w("div",{class:"fd-sheet-layout"},Ze);if(M.attachmentPreview){let Se=Gd({doc:r,el:w,form:g,page:s,node:M.attachmentPreview,dataSource:n.dataSource,labels:m,fill:A});Ie.classList.add("fd-has-preview"),Ie.append(Se.element),x.push(Se.update),y.push(Se.destroy)}M.sidePanel&&(Ie.classList.add("fd-has-side"),M.sidePanelBeside&&Ie.setAttribute("data-side-beside",M.sidePanelBeside),Ie.append(w("aside",{class:"fd-side"},he(M.sidePanel))));let at=Qn(M.toolbar);return G.append(...at?[at]:[],st,Ie),G}function Ar(M){let G=s.fields[M.field],ue={clickable:M.clickable===!0};M.visibleStates&&(ue.visibleStates=M.visibleStates);for(let Ne of["durationsField","fold","saves"])M[Ne]!==void 0&&(ue[Ne]=M[Ne]);let ye={type:"field",id:"#statusbar",field:M.field,widget:"statusbar",options:ue},Fe=Ot({form:g,name:M.field,field:G,node:ye,id:k("statusbar"),document:r,labels:p,preferences:f,locale:l,dialogs:c},n.widgets);return Fe.destroy&&y.push(()=>Fe.destroy?.()),x.push(Ne=>{et(Fe.element,g.node("#statusbar").invisible),Fe.update({value:Ne.values[M.field],values:Ne.values,readonly:g.node("#statusbar").readonly||ne,required:!1,invalid:!1})}),Fe.element}let Dt=null,ot=s.layout,dn;if(ot.type==="sheet")dn=sn(ot);else if(ot.type==="wizard")dn=_t(ot);else if(ot.type==="tabs")dn=qt({id:`${ot.id}-page`,children:[ot]});else if(ot.type==="list"){let M=qd({page:s,node:ot,form:g,dataSource:n.dataSource,doc:r,el:w,labels:m,locale:l,fill:A,press:H,withIcon:j,uid:k,icons:n.icons,preferences:f,onOpenRecord:n.onOpenRecord,...n.listFilter?{fixedFilter:n.listFilter}:{},...n.listViews?{views:n.listViews}:{}});y.push(M.destroy),dn=M.element}else dn=qt(ot);let $r=ot.type==="sheet"?null:Di(),kn=ot.type==="sections"||ot.type==="tabs"?Qn(void 0):null;lt.append(...kn?[kn]:[],...$r?[$r]:[],ie,pe,dn),O.append(lt,xe,Ae),n.saveStatus==="toast"?(Ve.classList.add("fd-toast"),O.append(Ve)):n.saveStatus==="bar"&&(Ve.classList.add("fd-status-bar"),lt.prepend(Ve)),O.addEventListener("mouseover",M=>{let G=M.target;if(G.tagName!=="INPUT"||!G.classList.contains("fd-input")||G.title&&!G.hasAttribute("data-cut-title"))return;let ue=G.scrollWidth>G.clientWidth&&G.value!=="";kt(G,"title",ue?G.value:null),kt(G,"data-cut-title",ue?"":null)}),O.addEventListener("submit",M=>{M.preventDefault(),ot.type!=="list"&&(Dt?Dt():vt())});function er(){let M=r.activeElement;M&&O.contains(M)&&(M.tagName==="INPUT"||M.tagName==="TEXTAREA")&&M.dispatchEvent(new Event("change",{bubbles:!0}))}function Wi(M){let G=[...O.querySelectorAll(".fd-field")].filter(Fe=>!Fe.closest('[hidden], [data-type="one2many"] .fd-field, .fd-form-dialog')&&!Fe.parentElement?.closest('[data-type="one2many"]')),ue=M.closest(".fd-field"),ye=G.slice(G.indexOf(ue)+1);for(let Fe of ye){let Ne=Fe.querySelector('input:not([type="hidden"]):not([readonly]):not([disabled]), select:not([disabled]), textarea:not([readonly]), [contenteditable="true"]');if(Ne)return Ne}return null}O.addEventListener("keydown",M=>{if(M.isComposing||M.key!=="Enter"||ot.type==="list"||M.target.closest(".fd-slot"))return;let G=n.keys??{};if(M.ctrlKey||M.metaKey){if(G.saveWithCtrlEnter===!1||n.showActions===!1||M.target.closest(".ag-root-wrapper"))return;M.preventDefault(),er(),Dt?Dt():vt();return}let ue=M.target,ye=ue.getAttribute("aria-multiline")==="false";M.defaultPrevented&&!ye||!G.enterMovesToNext||M.shiftKey||M.altKey||ue.tagName!=="INPUT"&&ue.tagName!=="SELECT"&&!ye||ue.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(ue.type)||(M.preventDefault(),Wi(ue)?.focus())});function Tr(M){let G=M instanceof Element?M.closest(".fd-form"):null;if(G)return G===O&&!O.querySelector(":scope > .fd-dialog-backdrop");let ue=[...r.querySelectorAll('[aria-modal="true"]')].filter(Fe=>!Fe.closest("[hidden]"));return(ue[ue.length-1]??r).querySelector(".fd-form")===O}let Ut=M=>{if(M.key==="Alt"){Tr(M.target)&&O.setAttribute("data-hotkeys","");return}let G=Ni(M);if(!G||!Tr(M.target))return;let ue=[...O.querySelectorAll(`button[data-hotkey="${G}"]`)].find(ye=>ye.closest(".fd-form")===O&&!ye.closest("[hidden]")&&!ye.disabled&&!ye.hasAttribute("aria-busy"));ue&&(M.preventDefault(),O.removeAttribute("data-hotkeys"),ue.click())},Pn=()=>O.removeAttribute("data-hotkeys"),Mr=M=>M.key==="Alt"&&Pn();r.addEventListener("keydown",Ut),r.addEventListener("keyup",Mr),r.defaultView?.addEventListener("blur",Pn),y.push(()=>{r.removeEventListener("keydown",Ut),r.removeEventListener("keyup",Mr),r.defaultView?.removeEventListener("blur",Pn)});function tr(M,G=!0){return new Promise(ue=>{let ye=w("p",{id:`${h}-confirm`},M),Fe=w("button",{type:"button",class:"fd-button"},m.cancel),Ne=w("button",{type:"button",class:"fd-button fd-button-primary"},m.ok),mt=w("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":ye.id},ye,w("div",{class:"fd-actions fd-actions-end"},...G?[Fe,Ne]:[Ne])),Ye=w("div",{class:"fd-dialog-backdrop"},mt),st=O.ownerDocument,xt=st.activeElement,Ze=dt=>{Ye.remove(),((Se=>!!Se&&Se!==st.body&&Se.isConnected&&!Se.closest("[hidden]"))(xt)?xt:O.querySelector('button[type="submit"]:not([hidden])'))?.focus(),ue(dt)};Fe.addEventListener("click",()=>Ze(!1)),Ne.addEventListener("click",()=>Ze(!0)),Ye.addEventListener("keydown",dt=>{dt.stopPropagation(),dt.key==="Escape"?(dt.preventDefault(),Ze(!1)):Gt(mt,dt)}),O.append(Ye),Ne.focus()})}function ln(M){for(let G of x)G(M)}e.append(O);let nr=g.subscribe(ln);y.push(g.on("run",({result:M})=>{(M.reason==="cannot"||M.reason==="app"&&M.error!==void 0)&&S.say(M.message??"",M.reason==="app"?"danger":"warning")})),ln(g.getState()),te=!0;let rr=!1;return V.length&&y.push(g.on("open",()=>{let M=!rr;rr=!0,queueMicrotask(()=>{if(Y||!O.isConnected||O.closest("[hidden]")||typeof O.checkVisibility=="function"&&!O.checkVisibility())return;let G=r.activeElement;!(!G||G===r.body||G===r.documentElement)&&!(M&&O.contains(G))||V.find(ye=>!ye.wrapper.closest("[hidden]"))?.focus()})})),g.getState().status==="idle"&&g.load(),{form:g,element:O,setSkin(M){O.setAttribute("data-fd-skin",M)},setTheme(M){M?O.setAttribute("data-fd-theme",M):O.removeAttribute("data-fd-theme"),O.setAttribute("data-fd-skin",xn(n.skin,M??void 0))},setTokens(M){n.tokens=M??void 0,wn(O,M)},async save(){let M=await g.save();return M||fe(),M},check(){let M=g.validate();return M||fe(),M},setReadonly(M){ne=M,O.toggleAttribute("data-readonly",ne),g.setEditing(!ne),ln(g.getState())},isReadonly:()=>ne,on:(M,G)=>{let ue=g.on(M,G);return y.push(ue),ue},setValues:M=>g.setValues(M),run:(M,G)=>g.run(M,G),destroy(){Y=!0,nr();for(let M of y)M();O.remove(),v&&g.dispose()}}}var Xd='input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea',zf=new Set(["boolean","one2many","binary","image","html","json","properties"]);function qf(e){return e.replace(/\s+([^\p{L}\p{N}\s]{1,3})$/u,"\xA0$1")}function Zd(e){let t=[],n=0;for(;n<e.length;){let r=[e[n]],i=e[n].type==="field";if(!i&&e[n].type==="text"&&e[n+1]?.type==="field"&&(r.push(e[++n]),i=!0),n++,i)for(;e[n]?.type==="text"&&e[n+1]?.type!=="field";)r.push(e[n++]);t.push(r)}return t}function Ii(e,t){Et[e]={...Et.en,...t.messages},tt[e]={...tt.en,...t.widgets},It[e]={...It.en,...t.viewer}}var _f="0.18.0",Qd=globalThis;for(let[e,t]of Qd.FieldiaLanguages??[])Ii(e,t);delete Qd.FieldiaLanguages;return dl(Uf);})();
|
|
62
|
+
`;var Jf={medium:760,narrow:520},Gf='@layer fieldia-tokens{.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;--fd-text: #212529;--fd-muted: #636976;--fd-page: #f2f3f5;--fd-surface: #ffffff;--fd-border: #cfd4da;--fd-border-strong: #9aa3ad;--fd-accent: #002855;--fd-accent-text: #ffffff;--fd-accent-soft: #e6ebf2;--fd-focus: #002855;--fd-focus-ring: none;--fd-error: #c62828;--fd-error-soft: #fdecea;--fd-success: #2e7d32;--fd-success-soft: #e8f5e9;--fd-warning: #8a5300;--fd-warning-soft: #fff4e0;--fd-info: #0b5cad;--fd-info-soft: #e7f0fb;--fd-radius: 0px;--fd-control-radius: 0px;--fd-pad-y: 3px;--fd-pad-x: 4px;--fd-input-border: 0 0 1px 0;--fd-label-weight: 600;--fd-gap-x: 32px;--fd-gap-y: 14px}:is(.fd-form,.fd-theme):is([data-fd-skin=outlined],[data-fd-skin=quiet]){--fd-text: rgba(0, 0, 0, .88);--fd-muted: rgba(0, 0, 0, .55);--fd-page: #f5f5f5;--fd-border: #d9d9d9;--fd-border-strong: #bfbfbf;--fd-accent: #1365d9;--fd-accent-soft: #e6f4ff;--fd-focus: #1365d9;--fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, .12);--fd-error: #c63c3d;--fd-error-soft: #fff2f0;--fd-radius: 8px;--fd-control-radius: 6px;--fd-pad-y: 4px;--fd-pad-x: 11px;--fd-input-border: 1px;--fd-label-weight: 400;--fd-gap-x: 24px;--fd-gap-y: 18px}:is(.fd-form,.fd-theme)[data-fd-skin=quiet]{--fd-pad-x: 8px}}.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){container-type:inline-size;font-family:var(--fd-font);font-size:14px;line-height:1.45;color:var(--fd-text);-webkit-text-size-adjust:100%}.fd-form *,.fd-form *:before,.fd-form *:after{box-sizing:border-box}.fd-form [hidden]{display:none!important}.fd-page-head{display:grid;gap:4px;margin-block-end:20px}.fd-page-title{font-size:22px;font-weight:650;margin:0;line-height:1.25}.fd-page-description{color:var(--fd-muted);margin:0}.fd-form[data-max-width=narrow]{--fd-page-max: 640px}.fd-form[data-max-width=medium]{--fd-page-max: 900px}.fd-form[data-max-width=wide]{--fd-page-max: 1180px}.fd-form[data-max-width=full]{--fd-page-max: none}.fd-form[data-max-width]>.fd-content:not(:has(>.fd-sheet-page)){max-width:var(--fd-page-max);margin-inline:auto}.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)}.fd-icon{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em}.fd-section-title .fd-icon,.fd-tab .fd-icon,.fd-button .fd-icon,.fd-step-title .fd-icon{margin-inline-end:.4em}.fd-section-title .fd-icon{color:var(--fd-muted)}.fd-grid{--fd-cols: var(--fd-columns, 1);--fd-span: 1;display:grid;grid-template-columns:repeat(var(--fd-cols),minmax(0,1fr));gap:var(--fd-gap-y) var(--fd-gap-x);align-items:start}.fd-grid>*{grid-column:span min(var(--fd-span, 1),var(--fd-cols))}.fd-grid[data-twelfths]{column-gap:min(var(--fd-gap-x),100% / 24)}.fd-field{display:grid;gap:4px;min-width:0}.fd-label{font-weight:var(--fd-label-weight);color:var(--fd-text)}.fd-valid-mark{color:var(--fd-success);width:1em;height:1em;margin-inline-start:6px;vertical-align:-.15em;stroke-width:2.4}.fd-field.fd-required>.fd-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:after{content:none}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:before{content:"*";margin-inline-end:.25em;color:var(--fd-error)}.fd-help{color:var(--fd-muted);font-size:12.5px}.fd-help-tip-wrap{position:relative;display:inline-flex;vertical-align:.05em;margin-inline-start:6px}.fd-label>.fd-help-tip-wrap{position:absolute;margin-block-start:.15em}.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:22px}.fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap):after{padding-inline-start:22px}.fd-form:not([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:0}.fd-help-tip{all:unset;box-sizing:border-box;display:inline-grid;place-items:center;width:16px;height:16px;border:1px solid var(--fd-border);border-radius:50%;color:var(--fd-muted);font-size:11px;font-weight:600;line-height:1;cursor:help}.fd-help-tip:hover,.fd-help-tip[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-help-tip:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-help-bubble{position:absolute;inset-block-start:calc(100% + 6px);inset-inline-start:-8px;z-index:30;width:max-content;max-width:min(280px,calc(100vw - 16px));padding:6px 9px;border-radius:6px;background:var(--fd-text);color:var(--fd-surface);font-size:12.5px;font-weight:400;line-height:1.4;white-space:normal;box-shadow:0 6px 18px #0000002e}.fd-page-title,.fd-page-description,.fd-section-description,.fd-label,.fd-help,.fd-text-heading,.fd-text-paragraph,.fd-text-note,.fd-choice>span{unicode-bidi:plaintext;text-align:match-parent;text-align:-webkit-match-parent}.fd-error{color:var(--fd-error);font-size:12.5px}.fd-warning{color:var(--fd-warning);background:var(--fd-warning-soft);font-size:12.5px;padding:3px 8px;border-radius:var(--fd-control-radius);justify-self:start}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr);column-gap:12px}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]>*{grid-column:1!important}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>:not(.fd-label){grid-column:2}.fd-form[data-fd-skin=underline] .fd-section[data-row=skin]{--fd-row-label: var(--fd-label-width, 11em);--fd-row-gap: 12px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row=beside]{--fd-row-label: var(--fd-label-width, 140px);--fd-row-gap: 14px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row]{padding-inline-start:calc(var(--fd-row-label, 0px) + var(--fd-row-gap, 0px))}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child{grid-template-columns:minmax(0,1fr);position:relative}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>:not(.fd-label){grid-column:1}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>.fd-label{position:var(--fd-row-place, static);inset-inline-start:calc(-1 * (var(--fd-row-label, 0px) + var(--fd-row-gap, 0px)));inset-block-start:0;width:var(--fd-row-label, auto);padding-block-start:var(--fd-row-drop, 0px)}@container (max-width: 760px){.fd-form[data-fd-skin=underline] .fd-grid{--fd-cols: 1}.fd-form .fd-grid[data-columns-medium]{--fd-cols: var(--fd-columns-medium)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels]))>*{grid-column:1!important}}@container (max-width: 520px){.fd-grid{--fd-cols: 1}.fd-form .fd-section.fd-section[data-row]{--fd-row-label: auto;--fd-row-gap: 0px;--fd-row-place: static;--fd-row-drop: 0px}.fd-form .fd-section[data-row]{padding-inline-start:0}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>*{grid-column:1!important}.fd-form .fd-grid[data-columns-medium],.fd-form .fd-grid[data-columns-narrow]{--fd-cols: var(--fd-columns-narrow, 1)}.fd-form .fd-file-viewer>:first-child{padding-inline-end:16px}.fd-form .fd-file-viewer h2{flex-basis:100%;margin-inline-end:36px}}.fd-input{width:100%;min-width:0;font:inherit;color:inherit;background:var(--fd-surface);border:solid var(--fd-border);border-width:var(--fd-input-border);border-radius:var(--fd-control-radius);padding:var(--fd-pad-y) var(--fd-pad-x);min-height:var(--fd-control-height, 30px);text-overflow:ellipsis;transition:border-color .15s ease,box-shadow .15s ease}.fd-input::placeholder{color:var(--fd-muted);opacity:.8}.fd-input:hover{border-color:var(--fd-border-strong)}.fd-input:focus{outline:none;border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-form[data-fd-skin=underline] .fd-input{background:transparent}.fd-form[data-fd-skin=underline] .fd-input:focus{box-shadow:0 1px 0 0 var(--fd-focus)}.fd-form[data-fd-skin=underline] .fd-field.fd-required:not([data-quiet]) .fd-input{border-color:var(--fd-accent)}.fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[readonly]{background:color-mix(in srgb,var(--fd-text) 5%,var(--fd-surface));border-color:var(--fd-border);padding-inline:var(--fd-pad-x);color:var(--fd-muted)}.fd-form[data-readonly] .fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text)}.fd-form[data-readonly] .fd-input::placeholder{color:transparent}.fd-input[readonly]::placeholder,.fd-form .fd-input.fd-blank[readonly]{color:transparent}.fd-blank[readonly]::-webkit-calendar-picker-indicator{display:none}.fd-form[data-readonly] select.fd-input:disabled{appearance:none;background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text);opacity:1}.fd-input[aria-invalid=true]{border-color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[aria-invalid=true]:focus{box-shadow:0 0 0 2px #ff26050f}.fd-textarea{resize:vertical;min-height:64px}.fd-select{appearance:auto}.fd-number{display:flex;align-items:baseline;gap:6px}.fd-number-input{font-variant-numeric:tabular-nums}.fd-currency{color:var(--fd-muted);font-size:12.5px;font-weight:600}.fd-currency-after>.fd-number-input{text-align:end}.fd-currency-picked{align-items:center}.fd-currency-picked>:not(.fd-number-input){flex:0 0 104px;min-width:0}.fd-currency-picked>.fd-number-input{flex:1 1 auto;min-width:0}.fd-pending{color:var(--fd-muted);font-style:italic}.fd-pending:empty:before{content:"\u2014"}.fd-checkbox,.fd-choice input{width:16px;height:16px;accent-color:var(--fd-accent);margin:0}.fd-switch{appearance:none;width:34px;height:20px;margin:0;border-radius:999px;position:relative;background:var(--fd-border-strong);cursor:pointer;transition:background .2s ease}.fd-switch:after{content:"";position:absolute;inset-block-start:2px;inset-inline-start:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s ease;box-shadow:0 1px 2px #00000040}.fd-switch:checked{background:var(--fd-accent)}.fd-switch:checked:after{transform:translate(14px)}[dir=rtl] .fd-switch:checked:after{transform:translate(-14px)}.fd-choices{display:flex;flex-wrap:wrap;gap:6px 18px}.fd-choice{display:inline-flex;align-items:center;gap:8px;cursor:pointer}.fd-choice-other{cursor:default;flex:1 1 260px;max-width:420px;min-width:0}.fd-choice-other-pick{display:inline-flex;align-items:center;gap:8px;cursor:pointer;flex:none}.fd-choice-other .fd-other-input{flex:1;min-width:6em;width:auto;min-height:30px;padding-block:2px}.fd-scale-box{display:inline-grid;gap:4px;max-width:100%}.fd-scale-ends{display:flex;justify-content:space-between;gap:16px;font-size:12.5px;color:var(--fd-muted)}.fd-choices-box{display:grid;gap:6px;min-width:0}.fd-choice-clear{justify-self:end;font:inherit;font-size:13px;color:var(--fd-muted);background:none;border:0;padding:2px 4px;border-radius:4px;cursor:pointer}.fd-choice-clear:hover{color:var(--fd-text);text-decoration:underline;text-underline-offset:3px}.fd-lines-table .fd-choice-clear,.fd-grid-editor .fd-choice-clear{display:none}.fd-points{display:flex;flex-wrap:wrap;gap:6px}.fd-points button{font:inherit;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text);border-radius:var(--fd-control-radius);min-width:34px;height:34px;padding:0 8px}.fd-points button.fd-on{background:var(--fd-accent);color:var(--fd-accent-text);border-color:var(--fd-accent)}.fd-rating button{border:none;background:none;font-size:24px;color:var(--fd-border-strong);padding:0 2px;min-width:0}.fd-rating button.fd-on{background:none;color:#f5a623}.fd-points button:disabled,.fd-choice input:disabled{cursor:default}.fd-form :focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-form .fd-input:focus-visible{outline:none}.fd-combo{position:relative;display:flex;align-items:center;min-width:0}.fd-combo-input{padding-inline-end:30px}.fd-combo-clear{position:absolute;inset-inline-end:3px;border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-clear:hover{color:var(--fd-text);background:var(--fd-page)}.fd-combo:has(>.fd-combo-open:not([hidden])) .fd-combo-input{padding-inline-end:56px}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]) .fd-combo-input[readonly]{padding-inline-end:var(--fd-pad-x)}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]):has(>.fd-combo-open:not([hidden])) .fd-combo-input[readonly]{padding-inline-end:30px}.fd-combo:has(>.fd-combo-input[readonly])>.fd-combo-clear[hidden]~.fd-combo-open{inset-inline-end:3px}.fd-combo-open{position:absolute;inset-inline-end:29px;border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-open:hover{background:var(--fd-page)}.fd-listbox{position:absolute;inset-inline:0;inset-block-start:calc(100% + 2px);z-index:20;margin:0;padding:4px 0;list-style:none;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;max-height:240px;overflow-y:auto}.fd-option{padding:6px 12px;cursor:pointer}.fd-option:hover,.fd-option.fd-active{background:var(--fd-accent-soft)}.fd-option-create{color:var(--fd-accent);border-block-start:1px solid var(--fd-border)}.fd-empty{padding:6px 12px;color:var(--fd-muted);font-style:italic}.fd-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:0}.fd-chips{display:contents;list-style:none;margin:0;padding:0}.fd-chip{display:inline-flex;align-items:center;gap:4px;padding:1px 4px 1px 10px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-text);font-size:13px;line-height:22px}button.fd-chip-label{border:none;padding:0;background:none;font:inherit;color:inherit;cursor:pointer}button.fd-chip-label:hover{text-decoration:underline}.fd-chip-remove{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:0 4px;border-radius:999px}.fd-chip-remove:hover{color:var(--fd-error)}.fd-tags .fd-combo{flex:1 1 140px}.fd-reference{display:grid;grid-template-columns:minmax(7em,34%) minmax(0,1fr);gap:8px}.fd-lines{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}.fd-lines-scroll{overflow-x:auto;min-width:0;position:relative}.fd-lines-table{width:100%;border-collapse:collapse;font-size:13.5px}.fd-lines-table th{text-align:start;font-weight:600;color:var(--fd-muted);font-size:12.5px;padding:6px 8px;border-block-end:1px solid var(--fd-border);white-space:nowrap}.fd-lines-table td{padding:4px 8px;border-block-end:1px solid var(--fd-border);vertical-align:top;min-width:7em}.fd-lines-table td.fd-lines-tools,.fd-lines-table th.fd-lines-tools{width:32px;min-width:32px;padding-inline:0;text-align:center}.fd-lines-table .fd-input{min-height:28px}.fd-lines-table td>.fd-checkbox,.fd-lines-table td>.fd-switch{margin-block-start:6px}.fd-lines-table .fd-lines-grip{width:1px;min-width:0;padding-inline:6px 2px}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td):is(.fd-lines-grip,.fd-lines-tools){position:sticky;z-index:1;background-color:var(--fd-surface)}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-grip{inset-inline-start:0}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-tools{inset-inline-end:0}.fd-lines-table td[data-fit]{min-width:0}.fd-lines-table thead th:not(.fd-lines-grip,.fd-lines-tools){white-space:normal}.fd-lines-table thead th{vertical-align:bottom}.fd-lines-table th[data-fit=boolean]{width:5em;min-width:5em}.fd-lines-table th[data-fit=integer]{width:max(7em,var(--fd-fit-need, 0px));min-width:max(7em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=float]{width:max(7.5em,var(--fd-fit-need, 0px));min-width:max(7.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=monetary]{width:max(11.5em,var(--fd-fit-need, 0px));min-width:max(11.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=date]{width:9em;min-width:9em}.fd-lines-table th[data-fit=datetime]{width:12.5em;min-width:12.5em}.fd-lines-table th:is([data-fit=integer],[data-fit=float],[data-fit=monetary]){text-align:end}.fd-lines-table td:is([data-fit=integer],[data-fit=float],[data-fit=monetary]) input{text-align:end}@media(hover:hover)and (pointer:fine){.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) .fd-input:not([aria-invalid=true]){border-color:transparent;background-color:transparent;box-shadow:none}.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) :is(.fd-combo-open,.fd-combo-clear){visibility:hidden}}.fd-line-grip{display:block;margin-block-start:7px;cursor:grab}.fd-lines-dragging,.fd-lines-dragging *{cursor:grabbing;user-select:none}.fd-lines-dragging>tr:not(.fd-line-lifted){transition:transform .15s ease}.fd-line-lifted{position:relative;z-index:2;box-shadow:0 6px 18px #0f141929}.fd-line-lifted>td{background:var(--fd-surface)}.fd-line-delete{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:4px 6px;border-radius:4px;min-width:24px;min-height:24px}.fd-line-delete:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-lines-table [data-tone=info]{--fd-line-tone: var(--fd-info);--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-lines-table [data-tone=success]{--fd-line-tone: var(--fd-success);--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-lines-table [data-tone=warning]{--fd-line-tone: var(--fd-warning);--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-lines-table [data-tone=danger]{--fd-line-tone: var(--fd-error);--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-lines-table [data-tone=muted]{--fd-line-tone: var(--fd-muted);--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-lines-table [data-tone] :is(input,select,textarea,.fd-input,.fd-display){color:var(--fd-line-tone);-webkit-text-fill-color:var(--fd-line-tone)}.fd-lines-table :is(.fd-line-bold,.fd-cell-bold) :is(input,select,textarea,.fd-input,.fd-display){font-weight:600}.fd-lines-table td.fd-lines-tools{white-space:nowrap}.fd-lines-table:has(.fd-line-button) td.fd-lines-tools{text-align:end;padding-inline-end:4px}.fd-line-button{padding:2px 6px;font-size:12.5px;vertical-align:middle}.fd-line-button-icon{padding:4px;color:var(--fd-muted)}.fd-line-button-icon:hover{color:var(--fd-accent)}.fd-line-button svg{width:15px;height:15px;display:block}.fd-lines-totals td{padding:8px;font-weight:600;border-block-start:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-lines-adds{display:flex;flex-wrap:wrap;gap:4px 16px;justify-self:start}.fd-lines-control{display:inline-flex;align-items:center;gap:6px}.fd-lines-control svg,.fd-lines-chosen-button svg{width:15px;height:15px}.fd-line-lead{display:inline-flex;align-items:center;gap:4px;margin-block-start:6px}.fd-line-lead .fd-line-grip{margin-block-start:0}.fd-lines-table th.fd-lines-grip:has(.fd-line-pick-all){padding-block:4px}.fd-lines-chosen{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:6px 10px;border-radius:var(--fd-radius);background:var(--fd-accent-soft)}.fd-lines-chosen[hidden]{display:none}.fd-lines-chosen-count{font-weight:600;font-size:13px;margin-inline-end:6px}.fd-lines-chosen-button{display:inline-flex;align-items:center;gap:6px;padding-block:3px}.fd-lines-table .fd-line-open{border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:4px 6px;border-radius:4px}.fd-lines-table .fd-line-open:hover{background:var(--fd-accent-soft)}.fd-links-table td{vertical-align:middle}.fd-links-table .fd-value-text{padding-block:4px}.fd-lines[data-fit=content] .fd-lines-table{width:auto;max-width:100%}.fd-lines[data-fit=content] .fd-lines-table td{min-width:0}.fd-lines[data-cards]{container:fd-lines / inline-size}@container fd-lines (max-width: 520px){.fd-lines[data-cards=narrow] .fd-lines-table,.fd-lines[data-cards=narrow] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=narrow] .fd-lines-table thead{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=narrow] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=narrow] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip .fd-line-grip{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr:has(.fd-line-pick){padding-inline-start:36px}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-tools{width:auto;text-align:end}.fd-lines[data-cards=narrow] .fd-lines-totals td:empty{display:none}}.fd-lines[data-cards=always] .fd-lines-table,.fd-lines[data-cards=always] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=always] .fd-lines-table thead{display:none}.fd-lines[data-cards=always] .fd-lines-table tr{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px 12px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=always] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=always] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-grip,.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{grid-column:1 / -1;width:auto}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{text-align:end}.fd-line-copy{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:4px 6px;border-radius:4px}.fd-line-copy:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-line-section td{background:var(--fd-page)}.fd-line-section .fd-input{font-weight:600}.fd-line-note .fd-input{font-style:italic}.fd-cell-error{color:var(--fd-error);font-size:12px}.fd-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-file{display:grid;gap:8px;justify-items:start;padding:6px 0;border-radius:var(--fd-control-radius);min-width:0}.fd-file.fd-dragging{outline:2px dashed var(--fd-accent);outline-offset:4px}.fd-file-pick{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;cursor:pointer}.fd-file input:focus-visible+.fd-file-pick{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-files-list .fd-file-pick{justify-self:stretch;padding:10px 14px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-pick:hover,.fd-dragging .fd-file-pick{border-color:var(--fd-accent)}.fd-files{list-style:none;margin:0;padding:0;display:grid;gap:6px;justify-self:stretch;min-width:0}.fd-files:empty{display:none}.fd-file-item{position:relative;display:flex;align-items:center;gap:2px;min-width:0}.fd-file-open{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:5px 8px;font:inherit;color:inherit;text-align:start;cursor:pointer;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius)}.fd-file-open:hover{border-color:var(--fd-accent)}.fd-file-thumb,.fd-file-icon{flex:none;width:36px;height:36px;border-radius:3px;object-fit:cover}.fd-file-icon{display:grid;place-items:end center;padding-block-end:4px;font-size:9px;font-weight:700;color:#fff;background:var(--fd-kind, #5b6573);clip-path:polygon(0 0,68% 0,100% 28%,100% 100%,0 100%)}.fd-file-icon[data-kind=pdf]{--fd-kind: #c62828}.fd-file-icon[data-kind=doc]{--fd-kind: #1f5fbf}.fd-file-icon[data-kind=sheet]{--fd-kind: #1d7a3e}.fd-file-icon[data-kind=zip]{--fd-kind: #8a5300}.fd-file-name{flex:1;display:flex;min-width:0;white-space:pre}.fd-file-name>span{overflow:hidden;text-overflow:ellipsis}.fd-file-size{color:var(--fd-muted);font-size:12.5px;font-variant-numeric:tabular-nums;unicode-bidi:plaintext}.fd-file-remove{flex:none;width:32px;height:32px;border:none;border-radius:999px;background:none;color:var(--fd-muted);font-size:20px;line-height:1;cursor:pointer}.fd-file-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-file-confirm:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px}.fd-file-note:empty{display:none}.fd-file-note{color:var(--fd-warning)}.fd-file-bar{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;justify-self:stretch}.fd-file-views{display:flex;gap:2px;margin-inline-start:auto;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-views button{display:flex;align-items:center;gap:6px;min-height:28px;padding:2px 10px;font:inherit;font-size:13px;color:var(--fd-muted);cursor:pointer;border:none;border-radius:calc(var(--fd-control-radius) - 2px);background:none}.fd-file-views [aria-pressed=true]{color:var(--fd-text);background:var(--fd-surface);box-shadow:0 0 0 1px var(--fd-border)}.fd-files-thumbs{display:flex;flex-wrap:wrap;align-items:flex-start}.fd-files-thumbs>*{flex-basis:100%}:is(.fd-files-thumbs,.fd-files-cards)>.fd-files{display:contents}.fd-files-thumbs .fd-file-item,.fd-image-pick{flex:none;width:96px;height:96px}.fd-files-thumbs .fd-file-open{height:100%;padding:6px;flex-direction:column;justify-content:center;gap:4px;overflow:hidden;font-size:12px}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-thumb{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit}.fd-files-thumbs .fd-file-name{flex:none;max-width:100%}.fd-files-thumbs .fd-file-size,.fd-files-thumbs .fd-file-thumb~*{display:none}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-remove{position:absolute;inset-block-start:4px;inset-inline-end:4px;width:26px;height:26px;font-size:17px;background:#0f14199e;color:#fff;opacity:0}.fd-file-item:is(:hover,:focus-within) .fd-file-remove{opacity:1}@media(hover:none){.fd-file-item .fd-file-remove{opacity:1}}.fd-image-pick{display:grid;place-content:center;justify-items:center;gap:2px;padding:6px;text-align:center;font-size:12px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-files-cards{grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-files-cards>*{grid-column:1 / -1}.fd-files-cards>.fd-image-pick{grid-column:auto;justify-self:stretch;width:auto;height:auto;min-height:96px}.fd-files-cards .fd-file-item{justify-self:stretch;align-items:stretch}.fd-files-cards .fd-file-open{flex-direction:column;align-items:stretch;gap:2px;padding:0 0 8px;overflow:hidden}.fd-file-picture{position:relative;display:grid;place-items:center;aspect-ratio:4 / 3;margin-block-end:6px;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-file-picture .fd-file-icon{width:44px;height:56px;padding-block-end:8px;font-size:12px}.fd-files-cards :is(.fd-file-name,.fd-file-size){padding-inline:8px}.fd-files-cards .fd-file-name{flex:none;flex-wrap:wrap;font-size:13px;line-height:1.35}.fd-files-cards .fd-file-name>span{max-width:100%}.fd-image-pick .fd-button{border:none;background:none;color:var(--fd-accent);padding:0;min-height:0;font-size:13px}.fd-file-viewer{max-width:1000px;height:min(88vh,100%);background:var(--fd-surface)}.fd-file-viewer>:first-child{position:relative;flex-wrap:wrap;justify-content:start;gap:6px 10px;padding-block:8px;padding-inline-end:52px}.fd-file-viewer .fd-dialog-close{position:absolute;inset-block-start:10px;inset-inline-end:10px}.fd-file-viewer h2{flex:1 1 10em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-file-step{font-size:18px;line-height:1;min-width:34px}.fd-file-viewer a{text-decoration:none}.fd-file-viewer-body{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;background:var(--fd-page)}.fd-file-viewer-body img{max-width:100%;max-height:100%;object-fit:contain}.fd-file-viewer-body :is(iframe,pre){flex:1;align-self:stretch;margin:0;border:0;background:var(--fd-surface)}.fd-file-viewer-body pre{padding:14px 16px;overflow:auto;font:13px/1.5 monospace;white-space:pre-wrap;overflow-wrap:anywhere}.fd-file-none{display:grid;justify-items:center;gap:4px;padding:24px;text-align:center;color:var(--fd-muted)}.fd-file-none strong{color:var(--fd-text);overflow-wrap:anywhere}.fd-file-none .fd-file-icon{width:64px;height:64px;font-size:14px;padding-block-end:8px}.fd-richtext{min-height:96px;line-height:1.5;overflow-wrap:anywhere}.fd-richtext-box{display:grid;gap:0;min-width:0}.fd-richtext-box>.fd-richtext{border-start-start-radius:0;border-start-end-radius:0}.fd-richtext-bar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:4px;min-width:0;border:1px solid var(--fd-border);border-block-end:none;border-start-start-radius:var(--fd-control-radius);border-start-end-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-richtext-style{font:inherit;font-size:12.5px;padding:3px 6px;margin-inline-end:4px;border:1px solid var(--fd-border);border-radius:4px;background:var(--fd-surface);color:var(--fd-text)}.fd-richtext-tool{display:grid;place-items:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:14px}.fd-richtext-tool:hover{background:var(--fd-surface)}.fd-richtext-tool[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-richtext-tool svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round}.fd-richtext-tool svg circle{fill:currentColor;stroke:none}.fd-link-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:6px;border:1px solid var(--fd-border);border-block-end:none;background:var(--fd-surface)}.fd-link-row>.fd-input{flex:1 1 200px;min-width:0}.fd-richtext.fd-blank[contenteditable=true]:before{content:attr(data-placeholder);position:absolute;color:var(--fd-muted);opacity:.8;pointer-events:none}.fd-richtext[contenteditable=false]{background:transparent;border-color:transparent;padding-inline:0;min-height:0}.fd-richtext p{margin:0 0 6px}textarea.fd-code{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:12.5px;min-height:96px}.fd-sections{display:grid;gap:var(--fd-gap-block, 24px)}.fd-section{border:0;margin:0;padding:0;min-width:0;display:grid;gap:14px}.fd-section-title{font-size:15px;font-weight:650;padding:0;margin:0;float:inline-start;width:100%}.fd-section-title+*{clear:both}.fd-form[data-fd-skin=underline] .fd-section-title{text-transform:uppercase;letter-spacing:.05em;font-size:12.5px;color:var(--fd-muted);border-block-end:1px solid var(--fd-border);padding-block-end:6px;width:100%}.fd-section-description{color:var(--fd-muted);margin:0}.fd-section-toggle{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-align:start}.fd-section-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-section-chevron{width:.5em;height:.5em;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin-block-start:-.2em;transition:transform .15s ease;flex:none}.fd-section-folded .fd-section-chevron{transform:rotate(-45deg);margin-block-start:0}[dir=rtl] .fd-section-folded .fd-section-chevron{transform:rotate(135deg)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:var(--fd-group-pad, 20px 24px)}.fd-form-part-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-form-part-problem{padding:10px 12px;border:1px dashed var(--fd-border);border-radius:var(--fd-radius)}.fd-tablist{display:flex;gap:2px;border-block-end:1px solid var(--fd-border);overflow-x:auto;scrollbar-width:none}.fd-tablist::-webkit-scrollbar{display:none}.fd-tabbar{position:relative;min-width:0;--fd-fade: to right}[dir=rtl] .fd-tabbar{--fd-fade: to left}.fd-tabbar[data-more=start]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px)}.fd-tabbar[data-more=end]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabbar[data-more="start end"]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px,#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabs-scroll{position:absolute;inset-block:0 1px;z-index:1;width:28px;padding:0;border:none;background:none;cursor:pointer;color:var(--fd-muted);display:grid;place-items:center}.fd-tabs-scroll[hidden]{display:none}.fd-tabs-scroll:hover{color:var(--fd-accent)}.fd-tabs-scroll:before{content:"";width:7px;height:7px;border:solid currentColor;border-width:0 0 2px 2px}.fd-tabs-before{inset-inline-start:0}.fd-tabs-after{inset-inline-end:0}.fd-tabs-before:before{transform:translate(2px) rotate(45deg)}.fd-tabs-after:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-before:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-after:before{transform:translate(2px) rotate(45deg)}.fd-tab{font:inherit;background:none;border:none;cursor:pointer;padding:8px 14px;color:var(--fd-muted);border-block-end:2px solid transparent;margin-block-end:-1px;white-space:nowrap}.fd-tab[aria-selected=true]{color:var(--fd-accent);border-block-end-color:var(--fd-accent);font-weight:600}.fd-tab[data-problem]:after{content:"";display:inline-block;width:6px;height:6px;margin-inline-start:6px;border-radius:50%;background:var(--fd-error);vertical-align:.15em}.fd-tabpanel{padding-block:16px;display:grid;gap:16px}.fd-button{font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:6px;justify-content:center;min-height:var(--fd-control-height, 32px);padding:4px 14px;border-radius:var(--fd-control-radius);border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text)}.fd-button:hover{border-color:var(--fd-accent);color:var(--fd-accent)}.fd-button-primary{background:var(--fd-accent);border-color:var(--fd-accent);color:var(--fd-accent-text)}.fd-button-primary:hover{color:var(--fd-accent-text);filter:brightness(1.12)}.fd-button-danger{color:var(--fd-error);border-color:var(--fd-error)}.fd-button-danger:hover{background:var(--fd-error);color:var(--fd-surface)}.fd-button-link{border-color:transparent;background:none;color:var(--fd-accent);padding-inline:4px}.fd-form[data-fd-skin=underline] .fd-button{border-radius:3px}.fd-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.fd-actions-end{justify-content:flex-end;margin-block-start:24px}.fd-sheet-page{background:var(--fd-page);padding:0 0 32px;min-width:0}.fd-header{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;background:var(--fd-surface);border-block-end:1px solid var(--fd-border);padding:8px 16px}.fd-statusbar{display:flex;list-style:none;margin:0;padding:0;overflow-x:auto}.fd-statusbar li{display:flex}.fd-statusbar li>*{font:inherit;font-size:13px;border:none;background:var(--fd-page);color:var(--fd-muted);padding:5px 18px 5px 22px;margin-inline-start:-6px;white-space:nowrap;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%,10px 50%)}.fd-statusbar li:first-child>*{margin-inline-start:0;padding-inline-start:14px;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%)}.fd-statusbar li>button{cursor:pointer}.fd-statusbar li>[aria-current=step]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}[dir=rtl] .fd-statusbar li>*{transform:scaleX(-1)}[dir=rtl] .fd-statusbar li>*>*{display:inline-block;transform:scaleX(-1)}.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}.fd-sheet-layout{align-items:start}.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}@container (min-width: 1534px){.fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr) minmax(260px,360px);max-width:calc(var(--fd-page-max, 1180px) + 376px)}}.fd-sheet-layout.fd-has-side[data-side-beside=always]{grid-template-columns:minmax(0,1fr) minmax(260px,360px)}.fd-form{container-name:fd-form}@container fd-form (max-width: 520px){.fd-form [data-hide-on~=narrow]{display:none!important}}@container fd-form (min-width: 521px) and (max-width: 760px){.fd-form [data-hide-on~=medium]{display:none!important}}@container fd-form (min-width: 761px){.fd-form [data-hide-on~=wide]{display:none!important}}.fd-card{position:relative;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:24px 28px 28px;display:grid;gap:18px;min-width:0;container-type:inline-size}.fd-ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}.fd-ribbon{position:absolute;inset-block-start:18px;inset-inline-end:-42px;transform:rotate(45deg);width:160px;text-align:center;font-size:12px;font-weight:700;padding:4px 0;color:#fff;background:#5f6670;text-transform:uppercase;letter-spacing:.06em;pointer-events:none}[dir=rtl] .fd-ribbon{transform:rotate(-45deg)}.fd-ribbon.fd-tone-danger{background:#c63c3d}.fd-ribbon.fd-tone-success{background:#2e7d32}.fd-ribbon.fd-tone-warning{background:#a14f00}.fd-ribbon.fd-tone-info{background:#1365d9}.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}.fd-alert-message{flex:1 1 auto;min-width:0}.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:.75}.fd-alert-close:hover{opacity:1}.fd-alert-close:focus-visible{outline:2px solid var(--fd-focus);opacity:1}.fd-alert.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-alert.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-alert.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-alert.fd-tone-info,.fd-alert:not([class*=fd-tone-]){background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-stats{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:0;margin:-24px -28px 0;border-block-end:1px solid var(--fd-border)}.fd-stats:empty{display:none}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:104px}.fd-stat{font:inherit;background:none;border:none;border-inline-start:1px solid var(--fd-border);cursor:pointer;padding:8px 18px;display:grid;justify-items:start;line-height:1.2;color:var(--fd-text);min-width:120px}.fd-stat:hover{background:var(--fd-page)}.fd-stat:has(>.fd-icon){grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:10px}.fd-stat>.fd-icon{width:22px;height:22px;color:var(--fd-muted)}.fd-stat-words{display:grid;justify-items:start}.fd-stat-value{font-weight:700;font-size:15px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-stat-label{font-size:12.5px;color:var(--fd-muted)}.fd-title-row{display:flex;gap:16px;align-items:flex-start;justify-content:space-between}.fd-title{display:grid;gap:4px;flex:1 1 auto;min-width:0}.fd-avatar{flex:none}.fd-avatar>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form[data-fd-skin=underline] .fd-avatar{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-avatar>*{grid-column:1!important}.fd-avatar .fd-file{justify-items:center;gap:4px 8px;padding:0;justify-content:center}.fd-avatar :is(.fd-file-item,.fd-image-pick){width:88px;height:88px}.fd-avatar :is(.fd-image-pick .fd-help,.fd-file-limits){display:none}.fd-avatar .fd-button-link{flex-basis:auto;font-size:12.5px}.fd-title>.fd-field .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-form[data-fd-skin=underline] .fd-title>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-title>.fd-field>*{grid-column:1}.fd-title>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-above,.fd-title-below{display:flex;flex-wrap:wrap;align-items:center;gap:6px 24px}.fd-title-above{margin-block-end:4px}.fd-title-below{margin-block-start:6px}.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}.fd-form .fd-title-above>.fd-field>*,.fd-form .fd-title-below>.fd-field>*{grid-column:auto!important}.fd-title-above .fd-label:empty,.fd-title-below .fd-label:empty{display:none}.fd-title-above>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-statusbar{display:flex}.fd-badges{display:flex;flex-wrap:wrap;gap:6px}.fd-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;line-height:1;padding:5px 10px;border-radius:999px;border:1px solid var(--fd-border);background:var(--fd-page);color:var(--fd-muted)}.fd-badge .fd-icon{width:13px;height:13px}.fd-badge.fd-tone-info{background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-badge.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-badge.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-badge.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-side{display:grid;gap:12px;align-content:start;min-width:0}.fd-wizard{display:grid;gap:20px}.fd-progress{display:grid;gap:8px}.fd-progress-text{color:var(--fd-muted);font-size:13px}.fd-value-text{display:block;padding-block:6px;font-variant-numeric:tabular-nums}.fd-field[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-field[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-field[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-field[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-field[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-field[data-tone] :is(input,select,textarea,.fd-value-text,.fd-pending){color:var(--fd-tone);-webkit-text-fill-color:var(--fd-tone)}.fd-field.fd-value-bold :is(input,select,textarea,.fd-value-text,.fd-pending,.fd-value-badge){font-weight:700}.fd-value-badge{justify-self:start;align-self:center;display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:999px;font-size:12.5px;line-height:18px;font-weight:500;color:var(--fd-tone, var(--fd-muted));background:var(--fd-tone-soft, color-mix(in srgb, var(--fd-tone, var(--fd-muted)) 14%, transparent))}.fd-value-badge[hidden]{display:none}.fd-value-badge[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-value-badge[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-value-badge[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-value-badge[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-value-badge[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-date-pick{position:relative;display:flex;align-items:center;gap:6px;min-width:0}.fd-date-pick>.fd-input{flex:1 1 auto;min-width:0}.fd-calendar-button{flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;padding:0;cursor:pointer;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface);color:var(--fd-muted)}.fd-calendar-button:hover,.fd-calendar-button[aria-expanded=true]{color:var(--fd-text);background:var(--fd-page)}.fd-calendar-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round}.fd-calendar{position:absolute;inset-block-start:calc(100% + 4px);inset-inline-end:0;z-index:30;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 8px 24px #0f141924}.fd-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px 6px}.fd-calendar-head button{border:none;background:none;cursor:pointer;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;color:var(--fd-text)}.fd-calendar-head button:hover{background:var(--fd-page)}.fd-calendar-title{font-weight:600}.fd-calendar-grid{border-collapse:collapse;font-variant-numeric:tabular-nums}.fd-calendar-grid th{font-size:11.5px;font-weight:600;color:var(--fd-muted);padding:4px 0;width:34px;text-align:center}.fd-calendar-grid .fd-week{color:var(--fd-accent);font-weight:600;border-inline-end:1px solid var(--fd-border)}.fd-calendar-grid td{padding:1px}.fd-calendar-grid td button{width:32px;height:30px;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:13px}.fd-calendar-grid td button:hover{background:var(--fd-accent-soft)}.fd-calendar-grid td button.fd-outside{color:var(--fd-muted);opacity:.6}.fd-calendar-grid td button[aria-current=date]{box-shadow:inset 0 0 0 1px var(--fd-accent)}.fd-calendar-grid td button[aria-selected=true]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}.fd-calendar-grid td button:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}.fd-properties{display:grid;gap:8px;min-width:0}.fd-property{display:grid;grid-template-columns:minmax(120px,30%) minmax(0,1fr);align-items:center;gap:12px;min-width:0}.fd-property>label{color:var(--fd-muted);font-size:13px}.fd-property[data-type=boolean]>:last-child{justify-self:start}.fd-form[data-fd-skin=underline] .fd-property{grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-property>label{color:var(--fd-text);font-size:inherit;font-weight:var(--fd-label-weight)}@container (max-width: 520px){.fd-property{grid-template-columns:minmax(0,1fr);gap:4px}}.fd-progressbar{position:relative;height:22px;min-width:120px;border-radius:999px;overflow:hidden;background:var(--fd-page);border:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-progressbar-fill{height:100%;background:var(--fd-success);transition:width .2s ease}.fd-progressbar[data-tone=warning] .fd-progressbar-fill{background:#d97706}.fd-progressbar[data-tone=danger] .fd-progressbar-fill{background:var(--fd-error)}.fd-progressbar[data-tone=info] .fd-progressbar-fill{background:var(--fd-info)}.fd-progressbar-text{position:absolute;inset-block:2px;left:50%;translate:-50% 0;display:grid;place-items:center;padding-inline:7px;border-radius:999px;background:var(--fd-surface);font-size:12px;line-height:1;font-weight:600;color:var(--fd-text)}.fd-progressbar-text:empty{display:none}.fd-progressbar-edit{display:flex;align-items:center;gap:12px;min-width:0}.fd-progressbar-edit>.fd-progressbar{flex:1 1 auto}.fd-progressbar-edit>.fd-input{flex:0 0 96px}.fd-progress-bar{height:4px;background:var(--fd-border);border-radius:999px;overflow:hidden}.fd-progress-bar>span{display:block;height:100%;background:var(--fd-accent);transition:width .25s ease}.fd-step{display:grid;gap:18px}.fd-step-title{font-size:18px;font-weight:650;margin:0}.fd-wizard-nav{display:flex;gap:8px;justify-content:space-between}.fd-steps-list{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0;counter-reset:fd-step}.fd-steps-list>li{counter-increment:fd-step}.fd-step-link{font:inherit;font-size:13.5px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-muted);border-radius:999px;padding:4px 12px 4px 6px}.fd-step-link:before{content:counter(fd-step);display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--fd-page);color:var(--fd-muted);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}.fd-step-link:hover{border-color:var(--fd-accent);color:var(--fd-text)}.fd-step-link:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-step-link.fd-step-done{color:var(--fd-text)}.fd-step-link.fd-step-done:before{content:"\u2713";background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-step-link.fd-step-skipped{border-style:dashed;color:var(--fd-muted)}.fd-step-link.fd-step-skipped:before{content:"\u2013";background:var(--fd-page);color:var(--fd-muted)}.fd-step-link[aria-current=step]{border-color:var(--fd-accent);color:var(--fd-accent);font-weight:600}.fd-step-link[aria-current=step]:before{content:counter(fd-step);background:var(--fd-accent);color:var(--fd-accent-text)}.fd-wizard-nav .fd-spacer{flex:1}.fd-text-heading{font-size:16px;font-weight:650;margin:0}.fd-matrix{overflow-x:auto;max-width:100%}.fd-matrix-table{border-collapse:collapse;min-width:100%}.fd-matrix-table th,.fd-matrix-table td{padding:6px 10px;text-align:center;border-bottom:1px solid var(--fd-border)}.fd-matrix-table thead th{font-weight:500;font-size:13px;color:var(--fd-muted)}.fd-matrix-table tbody th{text-align:start;font-weight:500}.fd-matrix-table input{accent-color:var(--fd-accent);width:16px;height:16px;margin:0}.fd-divider{grid-column:1 / -1;width:100%;border:0;border-top:1px solid var(--fd-border);margin:4px 0}.fd-block{min-width:0}.fd-spacer{min-height:24px}.fd-image{display:block;max-width:100%;height:auto;border-radius:var(--fd-radius)}.fd-figure{display:grid;justify-items:start;gap:6px;margin:0}.fd-figure[data-align=center]{justify-items:center}.fd-figure[data-align=end]{justify-items:end}.fd-figure>a,.fd-figure .fd-image{width:var(--fd-image-width, auto);max-width:100%}.fd-figure>a{display:block;border-radius:var(--fd-radius)}.fd-caption{font-size:13px;color:var(--fd-muted)}.fd-text-paragraph{margin:0}.fd-text-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-status{min-height:1.4em;color:var(--fd-muted);font-size:13px}.fd-status-box{display:inline-flex;align-items:center;gap:6px;min-width:0}.fd-status-box .fd-retry{font-size:13px}.fd-announce{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-banner{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 14px;margin-block-end:16px;border:1px solid #f0c47a;border-radius:var(--fd-control-radius);background:var(--fd-warning-soft);color:var(--fd-warning);font-size:13.5px}.fd-banner-text{flex:1 1 16em;min-width:0}.fd-content>.fd-banner:has(+.fd-draft+.fd-sheet-page),.fd-content>.fd-banner:has(+.fd-sheet-page){margin:12px 16px 0}.fd-status-box.fd-toast{position:fixed;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));inset-inline-end:20px;z-index:900;padding:10px 16px;border-radius:8px;background:var(--fd-text);box-shadow:0 8px 24px #0f141940}.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}.fd-toast .fd-retry{color:var(--fd-surface);text-decoration:underline}.fd-toast:has(.fd-status-error){background:var(--fd-error)}.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)}.fd-status-bar .fd-status-error,.fd-status.fd-status-error{color:var(--fd-error)}.fd-status.fd-status-saved{color:var(--fd-success)}.fd-draft{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;padding:10px 14px;margin-block-end:16px;background:var(--fd-info-soft);border:1px solid #a9c8ef;border-radius:var(--fd-control-radius)}.fd-done{padding:40px 0;text-align:center;display:grid;gap:12px;justify-items:center}.fd-done-title{font-size:20px;font-weight:650;margin:0}.fd-dialog-backdrop{position:fixed;inset:0;background:#0f141973;display:grid;place-items:center;z-index:1000;padding:16px}.fd-dialog{background:var(--fd-surface);color:var(--fd-text);border-radius:max(var(--fd-radius),6px);max-width:420px;width:100%;padding:20px 22px;display:grid;gap:16px;box-shadow:0 10px 30px #0003;font-family:var(--fd-font);border:1px solid var(--fd-edge, transparent)}.fd-dialog p{margin:0}.fd-says{position:fixed;inset-inline:16px;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));z-index:1100;display:grid;justify-items:center;gap:8px;pointer-events:none}.fd-say{pointer-events:auto;display:flex;align-items:center;gap:8px;max-width:420px;padding-block:8px;padding-inline:14px 6px;border:1px solid var(--fd-border);border-inline-start:4px solid var(--fd-tone);border-radius:max(var(--fd-control-radius),6px);background:var(--fd-surface);color:var(--fd-text);box-shadow:0 8px 24px #0f141940;font-size:13.5px}.fd-say>span{flex:1 1 auto;min-width:0}.fd-button[aria-busy=true],.fd-stat[aria-busy=true]{cursor:progress}.fd-button[aria-busy=true]:after{content:"";width:.85em;height:.85em;border:2px solid currentColor;border-inline-end-color:transparent;border-radius:50%;animation:fd-spin .8s linear infinite}@keyframes fd-spin{to{rotate:1turn}}.fd-back{margin:8px 12px}.fd-back:before{content:"\u2190"}.fd-back:dir(rtl):before{content:"\u2192"}.fd-form[data-scheme]>.fd-back{margin:12px 20px 0}.fd-form-dialog{display:flex;flex-direction:column;width:100%;max-height:min(90vh,100%);min-height:0;background:var(--fd-page);color:var(--fd-text);border-radius:max(var(--fd-radius),8px);box-shadow:0 24px 64px #0f14194d;overflow:hidden}.fd-form-dialog:focus{outline:none}.fd-form-dialog.fd-size-small{max-width:440px}.fd-form-dialog.fd-size-medium{max-width:760px}.fd-form-dialog.fd-size-large{max-width:1080px}.fd-form-dialog-backdrop:has(>.fd-size-full),.fd-form-panel-backdrop{padding:0}.fd-form-dialog:is(.fd-size-full,.fd-form-panel){max-height:none;height:100%;border-radius:0}.fd-size-full{max-width:none}.fd-form-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-block-end:1px solid var(--fd-border);background:var(--fd-surface)}.fd-form-dialog-title{margin:0;font-size:16px;font-weight:600}.fd-dialog-close{border:none;background:none;cursor:pointer;font-size:22px;line-height:1;padding:2px 8px;border-radius:4px;color:var(--fd-muted)}.fd-dialog-close:hover{background:var(--fd-page);color:var(--fd-text)}.fd-form-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;container-type:inline-size}.fd-form-dialog-body .fd-sheet-layout{margin-block-start:12px}.fd-form-dialog-body .fd-page-title{display:none}.fd-form-dialog-body .fd-page-head:not(:has(.fd-page-description)){display:none}.fd-form-dialog-body .fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr)}.fd-form-dialog-body .fd-side{display:none}.fd-search-body{display:grid;gap:12px;align-content:start}.fd-search-list{list-style:none;margin:0;padding:0;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:auto;max-height:min(60vh,520px)}.fd-search-list .fd-option{padding:8px 12px}.fd-search-list .fd-option+.fd-option{border-block-start:1px solid var(--fd-border)}.fd-search-list .fd-empty{padding:10px 12px;color:var(--fd-muted)}.fd-form-dialog-body:not(:has(.fd-sheet-layout)){background:var(--fd-surface);padding:16px 20px 20px}.fd-form-dialog-foot{padding:12px 16px;border-block-start:1px solid var(--fd-border);background:var(--fd-surface);margin:0}.fd-form-panel-backdrop{justify-items:end}.fd-form-panel{max-width:560px;position:relative}.fd-form-panel>.fd-dialog-backdrop{position:absolute}.fd-width-narrow{max-width:420px}.fd-width-wide{max-width:720px}.fd-form-panel[data-side=start]{justify-self:start}.fd-form-panel[data-side=left]{justify-self:left}.fd-form-panel[data-side=right]{justify-self:right}.fd-form-panel[data-side=top]{align-self:start;--fd-from: 0 -100%;--fd-back: 48px 0 0}.fd-form-panel[data-side=bottom]{align-self:end;--fd-from: 0 100%;--fd-back: 0 0 48px}.fd-form-panel[data-side=end]:dir(rtl),.fd-form-panel[data-side=start]:dir(ltr),.fd-form-panel[data-side=left]{--fd-from: -100% 0;--fd-back: 0 0 0 48px}.fd-form-panel:is([data-side=top],[data-side=bottom]){max-width:none;height:60%}.fd-form-panel.fd-height-short{height:40%}.fd-form-panel.fd-height-tall{height:85%}.fd-form-panel[data-behind]{margin:var(--fd-back, 0 48px 0 0)}@media(max-width:600px){.fd-form-dialog.fd-form-panel[data-side]{max-width:none;height:100%;margin:0;--fd-from: 0 100%}.fd-form-dialog.fd-form-panel[data-side=top]{--fd-from: 0 -100%}}@media(prefers-reduced-motion:no-preference){.fd-form-panel{animation:fd-slide .25s ease-out;transition:margin .2s}}@keyframes fd-slide{0%{translate:var(--fd-from, 100% 0)}}@media(prefers-reduced-motion:reduce){.fd-form *,.fd-form *:before,.fd-form *:after{transition:none!important}.fd-button[aria-busy=true]:after{animation:none}}',sl=Gf+il+nl+Xd+Qd+el+ol+tl+Gd+Yd+Zd,al="fieldia-styles";function la(e){if(e.getElementById(al))return;let t=e.createElement("style");t.id=al,t.textContent=sl,(e.head??e.documentElement).append(t)}function ca(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 Yf(){let e=new Map;return{get:t=>e.has(t)?dl(e.get(t)):null,set:(t,n)=>{e.set(t,dl(n))}}}var dl=e=>JSON.parse(JSON.stringify(e));function fa(e,t){let n=t.widget;switch(e.type){case"char":return!n||n==="email"||n==="phone"||n==="url";case"selection":return!n&&!e.multiple&&!e.optionsFrom;case"text":case"integer":case"float":return!n||n==="duration"||n==="percentage";case"monetary":case"date":case"datetime":case"many2one":case"reference":return!n;default:return!1}}var Xf={email:[/^[^\s@]+@[^\s@]+$/,"mailto:"],phone:[/^\+?[\d\s().-]{3,}$/,"tel:"],url:[/^https?:\/\/\S+$/i,""]};function Zf(e,t,n,r){if(t.type!=="integer"&&t.type!=="float"||n.widget||r===null||r===void 0||e==="")return e;let i=o=>typeof n.options?.[o]=="string"?n.options[o].trim():"";return[i("prefix"),e,i("suffix")].filter(Boolean).join(" ")}function ua(e){let{document:t,field:n,node:r,locale:i="en",labels:o=Ze.en,dialogs:a}=e,s=t.createElement("div");s.className="fd-read-text",s.id=`${e.id}-text`;let d=n.type==="many2one"?n.relation:null,l=d!==null&&r.options?.open!==!1&&!!a?.canOpen(d),f="";return{element:s,update(c,y){let p=Zf(In(n,c,y,i,void 0,{widget:r.widget,options:r.options}),n,r,c),k=JSON.stringify([p,c??null]);if(k===f)return;f=k;let g=r.widget?Xf[r.widget]:void 0,m=d!==null&&c&&typeof c=="object"&&"id"in c?c:null,b;if(g&&typeof c=="string"&&g[0].test(c.trim())){let S=t.createElement("a");S.href=`${g[1]}${c.trim()}`,r.widget==="url"&&Object.assign(S,{target:"_blank",rel:"noopener noreferrer"}),S.textContent=p,b=S}else if(l&&m){let S=t.createElement("button");S.type="button",S.className="fd-read-link",S.textContent=p,S.setAttribute("aria-label",o.openNamed.replace("{name}",m.label)),S.addEventListener("click",()=>{a?.openRecord(d,{recordId:m.id,title:m.label})}),b=S}else b=t.createTextNode(p);let h=m&&r.options?.avatar===!0?[Zn(t,m)]:[],v=[];if(m?.details?.trim()&&r.options?.details===!0){let S=t.createElement("div");S.className="fd-link-details",xi(S,m.details.trim()),v.push(S)}s.replaceChildren(...h,b,...v)}}}var ll={};var Qf={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",discardChanges:"Discard your changes?",dismiss:"Dismiss",helpFor:"Help for {label}",quietHint:"Add {label}",quietAnswer:"Your answer",locked:"Locked: {label}",retry:"Retry",notSaved:"Not saved",notSent:"Not sent",checkFields:"{what}. Check: {fields}",offline:"Could not reach the server. Your changes are still here.",previousPage:"Previous page",nextPage:"Next page",range:"{from}\u2013{to} / {total}",selected:"{n} selected",clearSelection:"Clear",selectAll:"Select all",showAs:"Show as",viewList:"List",viewMap:"Map",viewBoth:"List and map",selectRecord:"Select {name}",noRecords:"No records match.",loadFailed:"Could not load the records.",search:"Search\u2026",searchLabel:"Search",searchFor:"Search {field} for: {text}",searchOptions:"Search options",filters:"Filters",groupBy:"Group By",favourites:"Favourites",or:"or",removeFacet:"Remove {label}",addCustomFilter:"Add a custom filter",field:"Field",condition:"Condition",value:"Value",apply:"Apply",saveSearch:"Save current search",searchName:"Name of the search",useByDefault:"Use by default",deleteFavourite:"Delete {name}",noFavourites:"No saved searches yet.",opIs:"is",opIsNot:"is not",opContains:"contains",opGreater:"greater than",opLess:"less than",opSet:"is set",opNotSet:"is not set",yes:"Yes",no:"No",none:"None",loadMore:"Show {n} more",formMissing:"The saved form \u201C{page}\u201D cannot be found.",formInItself:"The saved form \u201C{page}\u201D is not shown here: it would be placed inside itself ({chain}).",formNotPlaceable:"The saved form \u201C{page}\u201D cannot be placed here: only a form of sections or tabs can.",formBroken:"The saved form \u201C{page}\u201D cannot be shown.",pageMissing:"The page \u201C{page}\u201D cannot be found.",actions:"Actions",print:"Print",archive:"Archive",unarchive:"Unarchive",duplicate:"Duplicate",delete:"Delete",breadcrumbs:"Breadcrumbs",newRecord:"New",records:"Records",recordAt:"{n} / {total}",previousRecord:"Previous record",nextRecord:"Next record",attachment:"Attachment: {name}",openAttachment:"Open",previousAttachment:"Previous attachment",nextAttachment:"Next attachment"},Vt={en:Qf,...ll},fl=Vt.en,eu=new Map([["ar","Arabic"],["de","German"],["fr","French"]]),cl=new Set;function Cr(e="en"){let t=e.split("-")[0];if(Object.prototype.hasOwnProperty.call(Vt,t))return t;let n=eu.get(t);return n&&!cl.has(t)&&(cl.add(t),console.warn(`Fieldia: this page is in ${n}, but only English words are loaded, so Fieldia's own words show in English. Load the ${n} ones after fieldia.js: <script src="https://cdn.jsdelivr.net/npm/@fieldia/viewer/bundle/fieldia.${t}.js"><\/script>`)),"en"}var pa="#111418",gl="#1f2329",tu="#f2f3f5";var ma=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),nu=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function ul(e){let[t,n,r]=ma(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function Wn(e,t){let[n,r]=[ul(e),ul(t)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}var ru=e=>Wn(e,"#ffffff")>=4.5?"#ffffff":pa,iu=e=>Wn(e,pa)>=Wn(e,"#ffffff")?pa:"#ffffff",hl=(e,t,n)=>nu(ma(e).map((r,i)=>r+(ma(t)[i]-r)*n)),ou=(e,t)=>hl(t,e,.12),pl=(e,t)=>[...t,ou(e,t[0])].every(n=>Wn(e,n)>=4.5);function Ki(e,t,n){let r=e;for(let i=1;i<=40&&!n(r);i++)r=hl(e,t,i/40);return r}function Pr(e,t={light:[],dark:[]}){let n=e.toLowerCase(),r=Ki(n,"#000000",o=>pl(o,["#ffffff",tu,...t.light])),i=Ki(n,"#ffffff",o=>pl(o,[gl,...t.dark]));return{accent:r,accentText:ru(r),dark:i,darkText:iu(i)}}var au=["#212529","#636976","#c63c3d"],su=["#e8eaed","#a3a9b2","#ff8a7a"],du={accent:"#1365d9",dark:"#5aa2ff"},ml={background:"bg",border:"border",corners:"radius",textSize:"size",accent:"accent"},lu={small:"13px",large:"16px"},cu={square:[0,0],soft:[6,10],round:[12,16]};function fu(e,t){let n=(d,l)=>t.scheme==="dark"?l:t.scheme==="auto"?`light-dark(${d}, ${l})`:d,r=t.accent?Pr(t.accent):du,i=Object.entries(t.parts??{}),o=(d,l,f)=>e.style.setProperty(`--fd-${d}-${l}`,f),a={light:[],dark:[]},s=d=>l=>d.every(f=>Wn(f,l)>=4.5);for(let[d,l]of i){let f=l.background?.toLowerCase();if(!f)continue;let c=Ki(f,"#ffffff",s([...au,r.accent])),y=Ki(f,gl,s([...su,r.dark]));a.light.push(c),a.dark.push(y),o(d,"bg",n(c,y))}for(let[d,l]of i){let f=Object.keys(ml).filter(c=>l[c]).map(c=>ml[c]);if(f.length&&e.setAttribute(`data-${d}`,f.join(" ")),l.border&&o(d,"border",l.border),l.corners&&o(d,"radius",`${cu[l.corners][d==="groups"?1:0]}px`),l.textSize&&o(d,"size",lu[l.textSize]),l.accent){let c=Pr(l.accent,a);o(d,"accent",n(c.accent,c.dark)),o(d,"accent-text",n(c.accentText,c.darkText))}}}var ga={material:"outlined",fluent:"outlined",apple:"outlined",bootstrap:"outlined",shadcn:"outlined",ant:"outlined",odoo:"underline","google-forms":"outlined"};function Ln(e,t){return e??(t?ga[t]:"underline")}var ha=["text","muted","page","surface","fill","border","border-strong","edge","accent","accent-text","accent-soft","accent-hover","focus","focus-ring","error","error-soft","success","success-soft","warning","warning-soft","info","info-soft","radius","control-radius","font","label-weight"];function En(e,t){for(let n of ha){let r=t?.[n];r?e.style.setProperty(`--fd-${n}`,r):e.style.removeProperty(`--fd-${n}`)}}function jn(e,t){if(t){t.theme&&e.setAttribute("data-fd-theme",t.theme);for(let n of["font","density","corners","scheme"]){let r=t[n];r&&e.setAttribute(`data-${n}`,r)}if(t.labelWidth&&e.style.setProperty("--fd-label-width",`${t.labelWidth}px`),t.accent){let n=Pr(t.accent);e.setAttribute("data-accent",""),e.style.setProperty("--fd-look-accent",n.accent),e.style.setProperty("--fd-look-accent-text",n.accentText),e.style.setProperty("--fd-look-accent-dark",n.dark),e.style.setProperty("--fd-look-accent-dark-text",n.darkText)}fu(e,t)}}function Hn(e,t,n){let r=Kn(t);e.setAttribute("data-hotkey",t),e.setAttribute("aria-keyshortcuts",r),e.title=`${n} (${r})`;let i=e.ownerDocument.createElement("kbd");i.className="fd-hotkey",i.setAttribute("aria-hidden","true"),i.dir="ltr",i.textContent=`${t.startsWith("shift+")?"\u21E7":""}${t.slice(-1).toUpperCase()}`,e.append(i)}function Ji(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return null;let t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code);return t?`${e.shiftKey?"shift+":""}${(t[1]??t[2]).toLowerCase()}`:null}var bl=0,Or='input:not([type="hidden"]), select, textarea, [contenteditable="true"]';function Gi(e){return[...e.querySelectorAll(".fd-field[data-focus]")].find(n=>!n.closest("[hidden]"))?.querySelector(Or)??null}var yl=e=>(t,n={},r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))i.setAttribute(o,a);return r!==void 0&&(i.textContent=r),i};function ir(e){return xl(e,`fd-size-${e.size??"medium"}`)}function ba(e){let t=e.side??"end";return xl(e,`fd-form-panel ${t==="top"||t==="bottom"?`fd-height-${e.height??"medium"}`:`fd-width-${e.width??"medium"}`}`,t)}function xl(e,t,n){let r=!!n,i=e.container?.ownerDocument??document,o=e.container??i.body,a=i.activeElement instanceof i.defaultView.HTMLElement?i.activeElement:null,s={...Vt[Cr(e.locale)],...e.labels},d=`fd-dialog-${++bl}`,l=yl(i),f=l("h2",{id:`${d}-title`,class:"fd-form-dialog-title"},e.title),c=l("button",{type:"button",class:"fd-dialog-close","aria-label":s.close},"\xD7"),y=l("div",{class:"fd-form-dialog-body"}),p=l("button",{type:"button",class:"fd-button"},s.discard),k=l("button",{type:"button",class:"fd-button fd-button-primary"},r&&e.mode==="values"?s.done:s.saveClose),g=e.page.look??e.look,m=e.theme??g?.theme,b=l("div",{class:`fd-theme fd-form-dialog ${t}`,"data-fd-skin":Ln(e.skin??g?.skin,m),role:"dialog","aria-modal":"true","aria-labelledby":f.id,tabindex:"-1"});n&&b.setAttribute("data-side",n),e.dir&&b.setAttribute("dir",e.dir),jn(b,m?{...g,theme:m}:g),En(b,e.tokens),b.append(l("div",{class:"fd-form-dialog-head"}),y,l("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),b.firstElementChild?.append(f,c);let v=(e.page.layout.type==="sections"||e.page.layout.type==="sheet"?e.page.layout.footer??[]:[]).map(A=>({node:A,button:l("button",{type:"button",class:`fd-button fd-button-${A.style??"secondary"}`,"data-node":A.id},A.label)}));for(let{node:A,button:R}of v)A.hotkey&&Hn(R,A.hotkey,A.label);b.lastElementChild?.append(...v.length?v.map(A=>A.button):[p,k]);let S=l("div",{class:`fd-dialog-backdrop fd-form-dialog-backdrop${r?" fd-form-panel-backdrop":""}`});S.append(b);let x=r?[...i.querySelectorAll(".fd-form-panel")].pop():void 0;x?.setAttribute("data-behind",""),o.append(S);let F=Vr(y,{...e,page:g&&!e.page.look?{...e.page,look:g}:e.page,showActions:!1,records:void 0,breadcrumbs:void 0,host:{...e.host,close:()=>p.click()}});r&&F.element.dir&&(S.dir=F.element.dir);let E=!1;e.recompute&&uu(F.form,e.page.fields,e.recompute,()=>E);let w=()=>Gi(y)??y.querySelector(Or);return(w()??b).focus(),F.form.settled().then(()=>{(i.activeElement===b||!b.contains(i.activeElement))&&w()?.focus()}),new Promise(A=>{let R=D=>{if(E)return;E=!0;let W=F.form.getState(),z={saved:D,recordId:W.recordId??null,values:W.values};F.destroy(),S.remove(),x?.removeAttribute("data-behind"),a?.focus(),A(z)},I=()=>new Promise(D=>{let W=i.activeElement,z=l("p",{id:`${d}-ask`},s.discardChanges),j=l("button",{type:"button",class:"fd-button"},s.cancel),V=l("button",{type:"button",class:"fd-button fd-button-primary"},s.discard),B=l("div",{class:"fd-actions fd-actions-end"}),$=l("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":z.id}),Q=l("div",{class:"fd-dialog-backdrop"});B.append(j,V),$.append(z,B),Q.append($);let X=J=>{Q.remove(),W?.focus(),D(J)};j.addEventListener("click",()=>X(!1)),V.addEventListener("click",()=>X(!0)),Q.addEventListener("keydown",J=>{J.stopPropagation(),J.key==="Escape"?X(!1):Gt($,J)}),b.append(Q),j.focus()}),M=async()=>{(!r||!F.form.getState().dirty.length||await I())&&R(!1)};k.addEventListener("click",async()=>{k.disabled=!0;let D=e.mode==="values"?F.check():await F.save();k.disabled=!1,D&&R(!0)}),p.addEventListener("click",()=>R(!1));let P=!1;F.on("save",()=>P=!0),F.on("send",()=>P=!0);let H=()=>{for(let{node:D,button:W}of v)W.hidden=F.form.node(D.id).invisible};v.length&&(H(),F.form.subscribe(H));for(let{node:D,button:W}of v)W.addEventListener("click",async()=>{if(W.hasAttribute("aria-busy"))return;W.setAttribute("aria-busy","true"),P=!1;let z=await F.form.runAction(D.id);W.removeAttribute("aria-busy"),!E&&(P?R(!0):(z.reason==="check"||z.reason==="save")&&F.check())});c.addEventListener("click",M),b.addEventListener("keyup",D=>D.key==="Alt"&&b.removeAttribute("data-hotkeys")),b.addEventListener("keydown",D=>{D.key==="Alt"&&b.setAttribute("data-hotkeys","");let W=Ji(D),z=W?v.find(({node:j,button:V})=>j.hotkey===W&&!V.hidden&&!V.disabled)?.button:void 0;if(z){D.preventDefault(),b.removeAttribute("data-hotkeys"),z.click();return}if(D.key==="Enter"&&(D.ctrlKey||D.metaKey)&&!D.isComposing){if(D.target.closest(".ag-root-wrapper"))return;D.preventDefault(),i.activeElement?.dispatchEvent(new Event("change",{bubbles:!0})),v.length?v.find(({node:j,button:V})=>j.style==="primary"&&!V.hidden)?.button.click():k.click();return}D.defaultPrevented||(D.key==="Escape"?(D.preventDefault(),M()):Gt(b,D))})})}function uu(e,t,n,r){let i=JSON.stringify(e.getState().values),o=!1;e.subscribe(()=>{let a=e.getState().values,s=JSON.stringify(a);o||s===i||(i=s,n(a).then(d=>{if(r()||JSON.stringify(e.getState().values)!==s)return;o=!0;let l=Object.fromEntries(Object.entries(d).filter(([f,c])=>f in t&&JSON.stringify(a[f]??null)!==JSON.stringify(c??null)));Object.keys(l).length&&e.setValues(l),o=!1,i=JSON.stringify(e.getState().values)},()=>{}))})}function ya(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,i=Cr(e.locale),o=Vt[i],a=Ze[i],s=`fd-dialog-${++bl}`,d=yl(t),l=d("h2",{id:`${s}-title`,class:"fd-form-dialog-title"},e.title),f=d("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),c=d("input",{type:"search",class:"fd-input","aria-label":a.search,placeholder:a.search,"aria-controls":`${s}-list`,autocomplete:"off"}),y=d("ul",{id:`${s}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":l.id}),p=d("button",{type:"button",class:"fd-button"},o.cancel),k=d("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":Ln(e.skin??e.look?.skin,e.theme??e.look?.theme),role:"dialog","aria-modal":"true","aria-labelledby":l.id});e.dir&&k.setAttribute("dir",e.dir);let g=e.theme??e.look?.theme;jn(k,g?{...e.look,theme:g}:e.look),En(k,e.tokens);let m=d("div",{class:"fd-form-dialog-head"});m.append(l,f);let b=d("div",{class:"fd-form-dialog-body fd-search-body"});b.append(c,y);let h=d("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});h.append(p),k.append(m,b,h);let v=d("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return v.append(k),n.append(v),c.focus(),new Promise(S=>{let x=[],F=-1,E=0,w,A=M=>{clearTimeout(w),E++,v.remove(),r?.focus(),S(M)},R=()=>{y.replaceChildren(...x.map((M,P)=>{let H=d("li",{id:`${s}-option-${P}`,role:"option",class:`fd-option${P===F?" fd-active":""}`,"aria-selected":String(P===F)},M.label);return H.addEventListener("click",()=>A(M)),H})),x.length||y.append(d("li",{class:"fd-empty"},a.noResults)),F>=0?c.setAttribute("aria-activedescendant",`${s}-option-${F}`):c.removeAttribute("aria-activedescendant")},I=()=>{clearTimeout(w);let M=++E;w=setTimeout(async()=>{let P=await e.search(c.value,80).catch(()=>[]);M===E&&(x=P,F=-1,R())},180)};c.addEventListener("input",I),c.addEventListener("keydown",M=>{if(M.key==="ArrowDown"||M.key==="ArrowUp"){if(M.preventDefault(),!x.length)return;F=(F+(M.key==="ArrowDown"?1:-1)+x.length)%x.length,R(),y.children[F]?.scrollIntoView?.({block:"nearest"})}else M.key==="Enter"&&F>=0&&(M.preventDefault(),A(x[F]))}),p.addEventListener("click",()=>A(null)),f.addEventListener("click",()=>A(null)),k.addEventListener("keydown",M=>{M.key==="Escape"?(M.preventDefault(),A(null)):Gt(k,M)}),I()})}function xa(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 pu(e,t,n,r){let i=Object.fromEntries(Object.entries(e).map(([o,a])=>[o,n?{...a,readonly:!0}:a]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:i,layout:{type:"sections",id:"values",children:r??[{type:"section",id:"values-section",columns:2,children:Object.keys(i).map(o=>({type:"field",id:`values-${o}`,field:o}))}]}}}function Ir(e,t){let{pages:n,relatedPages:r}=e,i="model"in t?t.model:t.version===void 0?t.id:`${t.id}@${t.version}`,o=typeof n=="function"?n(t):n&&Object.prototype.hasOwnProperty.call(n,i)?n[i]:null;return o instanceof Promise?o.then(a=>a??null):o||!("model"in t)?o??null:(typeof r=="function"?r(t.model):r?.[t.model])??null}function mu(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function vl(e,t){let n=i=>Ir(e,{model:i}),r={locale:e.locale,skin:e.skin,theme:e.theme??e.page.look?.theme,get tokens(){return e.tokens},dir:e.dir,widgets:e.widgets,preferences:e.preferences,pages:e.pages,relatedPages:e.relatedPages,translate:e.translate,look:e.page.look,user:e.user,context:e.context};return{canOpen:i=>n(i)!==null,async openRecord(i,o){let a=await n(i);if(!a)return null;let s=xa(a),d=await ir({...r,page:a,dataSource:e.dataSource,recordId:o.recordId??null,values:o.name||o.values?{...o.values??{},...o.name&&s?{[s]:o.name}:{}}:void 0,title:o.title,size:"large",...t?{host:{say:t}}:{}});if(!d.saved||d.recordId===null)return null;let l=s?d.values[s]:null,f=typeof l=="string"&&l?l:o.name??o.title;return o.withValues?{id:d.recordId,label:f,values:d.values}:{id:d.recordId,label:f}},searchMore:i=>ya({title:i.title,search:i.search,locale:e.locale,skin:e.skin,theme:e.theme,tokens:e.tokens,dir:e.dir,look:e.page.look}),async editValues(i){let o=await ir({...r,page:pu(i.fields,i.title,i.readonly===!0,i.layout),...i.parent?{parent:i.parent}:{},dataSource:mu(e.dataSource),values:i.values,title:i.title,...i.layout?{size:"large"}:{},mode:"values",...i.recompute?{recompute:i.recompute}:{},...t?{host:{say:t}}:{}});return o.saved?o.values:null}}}var wl=e=>`favourites:${e.id}`;function Yi(e,t){let n=e.get(wl(t));return Array.isArray(n)?n:[]}function kl(e,t,n){let r=Yi(t,n).find(i=>i.isDefault);return r?r.facets:e.defaultFilters?.length?[{kind:"filters",ids:[...e.defaultFilters],labels:e.defaultFilters.map(i=>e.filters?.find(o=>o.id===i)?.label??i)}]:[]}function Sl(e){let{page:t,el:n,labels:r,fill:i,preferences:o}=e,a=n("ul",{class:"fd-favourite-list"}),s=n("p",{class:"fd-favourites-none"},r.noFavourites),d=n("input",{class:"fd-input","aria-label":r.searchName,placeholder:r.searchName}),l=n("input",{type:"checkbox"}),f=n("button",{type:"button",class:"fd-button fd-button-primary"},r.save),c=n("div",{class:"fd-favourite-form",hidden:""},d,n("label",{class:"fd-favourite-default"},l,r.useByDefault),f),y=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.saveSearch),p=g=>o.set(wl(t),g);function k(){let g=Yi(o,t);s.hidden=g.length>0,a.replaceChildren(...g.map(m=>{let b=n("button",{type:"button",class:"fd-search-option","data-default":m.isDefault?"true":void 0},m.name);b.addEventListener("click",()=>e.apply(m.facets));let h=n("button",{type:"button",class:"fd-favourite-remove","aria-label":i(r.deleteFavourite,{name:m.name})},"\xD7");return h.addEventListener("click",()=>{p(Yi(o,t).filter(v=>v.name!==m.name)),k()}),n("li",{class:"fd-favourite"},b,h)}))}return y.addEventListener("click",()=>{c.hidden=!c.hidden,y.setAttribute("aria-expanded",String(!c.hidden)),c.hidden||d.focus()}),f.addEventListener("click",()=>{let g=d.value.trim();if(!g)return d.focus();let m={name:g,facets:e.current(),...l.checked?{isDefault:!0}:{}},b=Yi(o,t).filter(h=>h.name!==g).map(h=>l.checked?{name:h.name,facets:h.facets}:h);p([...b,m]),d.value="",l.checked=!1,c.hidden=!0,y.setAttribute("aria-expanded","false"),k()}),k(),{list:a,none:s,open:y,form:c}}function gu(e,t,n){let r=e.page.fields[t];return n.value===null?e.labels.none:r.type==="selection"?r.options.find(i=>i.value===n.value)?.label??n.label:r.type==="boolean"?n.value?e.labels.yes:e.labels.no:n.label||String(n.value)}function hu(e){let t=Number(e.dataset.level),n=e.nextElementSibling;for(;n&&Number(n.dataset.level??0)>t;){let r=n.nextElementSibling;n.remove(),n=r}}function va(e,t,n,r,i){let{el:o,labels:a}=e,s=i[n],d=[...r,t.value===null?{field:s,op:"notset",value:null}:{field:s,op:"=",value:t.value}],l=o("button",{type:"button",class:"fd-group-toggle","aria-expanded":"false"},o("span",{class:"fd-group-label"},gu(e,s,t))," ",o("span",{class:"fd-group-count"},`(${t.count})`)),f=o("tr",{class:"fd-list-group","data-level":String(n),"aria-level":String(n+1)},o("td",{colspan:String(e.columns)},l));f.style.setProperty("--fd-level",String(n));let c=!1;async function y(){c=!0;try{let k=n+1<i.length?(await e.dataSource.groups?.({model:e.model,field:i[n+1],filter:d}))?.map(g=>va(e,g,n+1,d,i))??[]:await p(0);if(!f.isConnected||l.getAttribute("aria-expanded")!=="true")return;f.after(...k),e.changed()}finally{c=!1}}async function p(k){let g=await e.dataSource.list({model:e.model,fields:e.fields,filter:d,sort:e.sort(),offset:k,limit:e.pageSize}),m=g.records.map(S=>e.recordRow(S,n+1)),b=g.total-k-g.records.length;if(b<=0)return m;let h=o("button",{type:"button",class:"fd-button fd-button-link"},e.fill(a.loadMore,{n:b})),v=o("tr",{class:"fd-list-more","data-level":String(n+1)},o("td",{colspan:String(e.columns)},h));return v.style.setProperty("--fd-level",String(n)),h.addEventListener("click",async()=>{h.disabled=!0;let S=await p(k+g.records.length);v.isConnected&&(v.replaceWith(...S),e.changed())}),[...m,v]}return l.addEventListener("click",()=>{let k=l.getAttribute("aria-expanded")==="true";l.setAttribute("aria-expanded",String(!k)),k?(hu(f),e.changed()):c||y()}),f}var bu='.fd-list{display:grid;gap:10px;min-width:0}.fd-list [hidden]{display:none!important}.fd-list-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;min-height:34px}.fd-list{container:fd-list / inline-size}.fd-list-views{display:inline-flex;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:hidden}.fd-list-views .fd-button{border:0;border-radius:0;min-height:32px;padding-inline:12px}.fd-list-views .fd-button+.fd-button{border-inline-start:1px solid var(--fd-border)}.fd-list-views .fd-button[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent);font-weight:600}.fd-list-body{display:grid;gap:16px;min-width:0}.fd-list-records{display:grid;gap:10px;min-width:0;align-content:start}.fd-list[data-view=list] .fd-list-map,.fd-list[data-view=map] .fd-list-records,.fd-list[data-view=map] .fd-pager{display:none}.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,3fr) minmax(320px,2fr);align-items:start}.fd-list[data-view=both] .fd-list-map{position:sticky;top:8px}@container fd-list (max-width: 860px){.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,1fr)}.fd-list[data-view=both] .fd-list-map{position:static;order:-1}}.fd-list-row.fd-list-hot>td{background:var(--fd-accent-soft)}.fd-search{position:relative;flex:1 1 360px;max-width:680px;min-width:0;container:fd-search / inline-size}.fd-search-field{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:34px;box-sizing:border-box;padding:2px 2px 2px 8px;padding-inline:8px 2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-search-field:focus-within{border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-search-field>.fd-icon,.fd-search-field>svg{width:16px;height:16px;color:var(--fd-muted);flex:none}.fd-facets{display:contents}.fd-facet{display:inline-flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:24px;padding-block:0;padding-inline:6px 0;border-radius:3px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:13px;line-height:18px}.fd-facet svg{width:13px;height:13px;flex:none}.fd-facet[data-kind=groupBy]{background:var(--fd-success-soft);color:var(--fd-success)}.fd-facet-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-facet-remove{all:unset;cursor:pointer;display:grid;place-items:center;width:24px;height:24px;border-radius:2px;font-size:15px;line-height:1;opacity:.7}.fd-facet-remove:hover,.fd-facet-remove:focus-visible{opacity:1;background:var(--fd-surface)}.fd-search-input{flex:1 1 140px;min-width:100px;border:none;outline:none;background:none;font:inherit;font-size:14px;color:var(--fd-text);padding:5px 4px}.fd-form .fd-search-input:focus-visible{outline:none}.fd-search-toggle{all:unset;cursor:pointer;display:grid;place-items:center;width:30px;height:28px;border-radius:3px;color:var(--fd-muted)}.fd-search-toggle:before{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}.fd-search-toggle[aria-expanded=true]:before{transform:translateY(2px) rotate(-135deg)}.fd-search-toggle:hover,.fd-search-toggle[aria-expanded=true]{background:var(--fd-page);color:var(--fd-text)}.fd-search-toggle:focus-visible{outline:2px solid var(--fd-focus)}.fd-search-suggestions,.fd-search-panel{position:absolute;z-index:30;inset-inline:0;top:calc(100% + 4px);box-sizing:border-box;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);box-shadow:0 10px 28px #0f172a24}.fd-search-suggestions{list-style:none;margin:0;padding:4px 0}.fd-search-suggestions [role=option]{padding:7px 12px;cursor:pointer;font-size:14px}.fd-search-suggestions [role=option][aria-selected=true]{background:var(--fd-accent-soft)}.fd-search-panel{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);padding-block:6px}.fd-search-group{display:flex;flex-direction:column;align-items:stretch;gap:1px;padding:4px 10px 8px;min-width:0}.fd-search-group+.fd-search-group{border-inline-start:1px solid var(--fd-border)}@container fd-search (max-width: 540px){.fd-search-panel{grid-auto-flow:row}.fd-search-group+.fd-search-group{border-inline-start:none;border-block-start:1px solid var(--fd-border);padding-block-start:8px}}.fd-search-heading{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13.5px;padding:4px 6px 6px}.fd-search-heading svg{width:15px;height:15px}.fd-search-group[data-group-kind=filters] .fd-search-heading svg{color:var(--fd-accent)}.fd-search-group[data-group-kind=groupBy] .fd-search-heading svg{color:var(--fd-success)}.fd-search-group[data-group-kind=favourites] .fd-search-heading svg{color:var(--fd-warning)}.fd-search-option{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:6px;padding:5px 6px;border-radius:4px;font-size:14px;color:var(--fd-text)}.fd-search-option:before{content:"";width:14px;flex:none;text-align:center;color:var(--fd-accent);font-weight:700}.fd-search-option[aria-pressed=true]:before{content:"\u2713"}.fd-search-option:hover,.fd-search-option:focus-visible{background:var(--fd-page)}.fd-search-add{color:var(--fd-muted);margin-block-start:4px}.fd-search-add:before{content:"+";color:var(--fd-muted);font-weight:400}.fd-custom-filter,.fd-favourite-form{display:grid;gap:6px;padding:6px}.fd-custom-filter .fd-input,.fd-favourite-form .fd-input{width:100%;box-sizing:border-box;min-height:30px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:3px 6px;font:inherit;font-size:13.5px;background:var(--fd-surface);color:var(--fd-text)}.fd-favourite-default{display:flex;align-items:center;gap:6px;font-size:13.5px}.fd-favourite-list{list-style:none;margin:0;padding:0}.fd-favourite{display:flex;align-items:center}.fd-favourite .fd-search-option{flex:1;min-width:0}.fd-favourite .fd-search-option[data-default=true]:before{content:"\u2605";color:var(--fd-warning)}.fd-favourite-remove{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:4px;color:var(--fd-muted)}.fd-favourite-remove:hover{background:var(--fd-page);color:var(--fd-error)}.fd-favourites-none{margin:0;padding:4px 6px;color:var(--fd-muted);font-size:13px}.fd-list-selection{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:3px 4px 3px 10px;border-radius:var(--fd-control-radius);background:var(--fd-accent-soft)}.fd-list-count{font-weight:600;font-size:13.5px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-pager-text{color:var(--fd-muted);font-size:13.5px;font-variant-numeric:tabular-nums;margin-inline-end:6px;white-space:nowrap}.fd-pager-button{min-width:32px;padding-inline:0;font-size:18px;line-height:1}.fd-list-scroll{overflow-x:auto;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-list-table{width:100%;border-collapse:collapse;font-size:14px}.fd-list-table th{text-align:start;font-weight:600;font-size:13px;color:var(--fd-text);padding:8px 10px;border-block-end:1px solid var(--fd-border-strong);white-space:nowrap;background:var(--fd-surface)}.fd-list-table td{padding:7px 10px;border-block-end:1px solid var(--fd-border);max-width:28em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-list-table tbody tr:last-child td{border-block-end:none}.fd-list-table .fd-num{text-align:end;font-variant-numeric:tabular-nums}.fd-list-table th.fd-list-check,.fd-list-table td.fd-list-check{width:36px;padding-inline:10px 0}.fd-list-checkbox{width:16px;height:16px;margin:0;vertical-align:middle;accent-color:var(--fd-accent);cursor:pointer}.fd-list-sort{all:unset;box-sizing:border-box;width:100%;cursor:pointer;display:flex;align-items:center;gap:4px;font:inherit;color:inherit}.fd-list-sort:after{content:"";width:0;height:0;border-inline:4px solid transparent;opacity:0}.fd-list-sort:hover:after{opacity:.35;border-block-start:5px solid currentColor}.fd-list-table th[aria-sort=ascending] .fd-list-sort:after{opacity:1;border-block-start:none;border-block-end:5px solid currentColor}.fd-list-table th[aria-sort=descending] .fd-list-sort:after{opacity:1;border-block-end:none;border-block-start:5px solid currentColor}.fd-list-table th.fd-num .fd-list-sort{justify-content:flex-end}.fd-list-table th.fd-num .fd-list-sort:after{order:-1}.fd-list-sort:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-list-row:hover td{background:var(--fd-page)}.fd-list-openable{cursor:pointer}.fd-list-row[aria-selected=true] td{background:var(--fd-accent-soft)}.fd-list-row:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-list-table[aria-busy=true] tbody{opacity:.6;transition:opacity .2s .15s}.fd-list-group td{padding:0;background:var(--fd-page)}.fd-group-toggle{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;padding-inline-start:calc(12px + var(--fd-level, 0) * 22px);font-weight:600;font-size:13.5px;color:var(--fd-text)}.fd-group-toggle:before{content:"";flex:none;width:6px;height:6px;border-top:1.5px solid currentColor;border-right:1.5px solid currentColor;transform:rotate(45deg);transition:transform .12s}.fd-group-toggle:dir(rtl):before{transform:rotate(-135deg)}.fd-group-toggle[aria-expanded=true]:before{transform:rotate(135deg)}.fd-group-toggle:hover{background:var(--fd-accent-soft)}.fd-group-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-group-count{color:var(--fd-muted);font-weight:400;font-variant-numeric:tabular-nums}.fd-list-more td{padding:4px 10px;padding-inline-start:calc(46px + var(--fd-level, 0) * 22px)}.fd-list-empty,.fd-list-failed{margin:0;padding:28px 12px;text-align:center;color:var(--fd-muted)}.fd-list-failed{color:var(--fd-error)}';function Xi(e){if(e.getElementById("fd-list-styles"))return;let t=e.createElement("style");t.id="fd-list-styles",t.textContent=bu,e.head.append(t)}var yu=[["ilike","opContains"],["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],xu=[["ilike","opContains"],["set","opSet"],["notset","opNotSet"]],vu=[["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],wu=[["=","opIs"],["!=","opIsNot"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]],ku=[["=","opIs"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]];function wa(e){switch(e.type){case"char":case"text":case"html":return yu;case"many2one":case"many2many":return xu;case"selection":return vu;case"integer":case"float":case"monetary":return wu;case"date":case"datetime":return ku;case"boolean":return[["=","opIs"]];default:return[]}}function Ll(e){let{page:t,el:n,labels:r}=e,i=Object.entries(t.fields).filter(([,g])=>wa(g).length),o=n("select",{class:"fd-input","aria-label":r.field},...i.map(([g,m])=>n("option",{value:g},m.label))),a=n("select",{class:"fd-input","aria-label":r.condition}),s=n("span",{class:"fd-custom-filter-value"}),d=n("button",{type:"button",class:"fd-button fd-button-primary"},r.apply),l=n("div",{class:"fd-custom-filter",hidden:""},o,a,s,d),f=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.addCustomFilter),c=n("input",{class:"fd-input","aria-label":r.value}),y=()=>t.fields[o.value];function p(){a.replaceChildren(...wa(y()).map(([g,m])=>n("option",{value:g},r[m]))),k()}function k(){let g=y();if(g.type==="selection")c=n("select",{class:"fd-input","aria-label":r.value},...g.options.map(m=>n("option",{value:String(m.value)},m.label)));else if(g.type==="boolean")c=n("select",{class:"fd-input","aria-label":r.value},n("option",{value:"true"},r.yes),n("option",{value:"false"},r.no));else{let m=["integer","float","monetary"].includes(g.type)?"number":g.type==="date"?"date":g.type==="datetime"?"datetime-local":"text";c=n("input",{class:"fd-input",type:m,"aria-label":r.value})}s.replaceChildren(c),s.hidden=a.value==="set"||a.value==="notset"}return o.addEventListener("change",p),a.addEventListener("change",()=>s.hidden=a.value==="set"||a.value==="notset"),f.addEventListener("click",()=>{l.hidden=!l.hidden,f.setAttribute("aria-expanded",String(!l.hidden)),l.hidden||o.focus()}),d.addEventListener("click",()=>{let g=y(),m=a.value,b=r[wa(g).find(([S])=>S===m)?.[1]??"opIs"],h=null,v="";if(!s.hidden){let S=c.value.trim();if(!S)return c.focus();if(g.type==="selection"){let x=g.options.find(F=>String(F.value)===S);h=x?.value??S,v=x?.label??S}else if(g.type==="boolean")h=S==="true",v=h?r.yes:r.no;else if(["integer","float","monetary"].includes(g.type)){if(h=Number(S),!Number.isFinite(h))return c.focus();v=S}else h=S,v=S}e.add({kind:"custom",label:[g.label,b,v].filter(Boolean).join(" "),filter:[{field:o.value,op:m,value:h}]}),l.hidden=!0,f.setAttribute("aria-expanded","false")}),p(),{button:f,form:l}}function Su(e,t){let n=` ${t.or} `;switch(e.kind){case"field":return`${e.label}: ${e.values.map(r=>r.label).join(n)}`;case"filters":return e.labels.join(n);case"groupBy":return e.labels.join(" > ");case"custom":return e.label}}function El(e){let{page:t,node:n,doc:r,el:i,labels:o,fill:a,uid:s}=e,d=e.facets,l=V=>{let B=kt(r,V,e.icons);return B?.setAttribute("aria-hidden","true"),B?[B]:[]};function f(V){d=V,v(),D(),e.onChange(d)}let c=s(`${n.id}-suggestions`),y=s(`${n.id}-search-panel`),p=i("input",{class:"fd-search-input",role:"combobox",autocomplete:"off",placeholder:o.search,"aria-label":o.searchLabel,"aria-autocomplete":"list","aria-expanded":"false","aria-controls":c}),k=i("div",{class:"fd-facets"}),g=i("ul",{class:"fd-search-suggestions",role:"listbox",id:c,"aria-label":o.searchLabel,hidden:""}),m=i("button",{type:"button",class:"fd-search-toggle","aria-label":o.searchOptions,"aria-expanded":"false","aria-controls":y}),b=[],h=0;function v(){k.replaceChildren(...d.map((V,B)=>{let $=Su(V,o),Q=i("button",{type:"button",class:"fd-facet-remove","aria-label":a(o.removeFacet,{label:$})},"\xD7");Q.addEventListener("click",()=>{f(d.filter((J,_)=>_!==B)),p.focus()});let X=V.kind==="groupBy"?"layers":V.kind==="field"?"":"filter";return i("span",{class:"fd-facet","data-kind":V.kind},...X?l(X):[],i("span",{class:"fd-facet-text"},$),Q)}))}function S(){g.replaceChildren(...b.map((V,B)=>{let $=i("li",{role:"option",id:`${c}-${B}`,"aria-selected":String(B===h)},V.label);return $.addEventListener("mousedown",Q=>Q.preventDefault()),$.addEventListener("click",()=>F(V)),$})),g.hidden=b.length===0,p.setAttribute("aria-expanded",String(!g.hidden)),g.hidden?p.removeAttribute("aria-activedescendant"):p.setAttribute("aria-activedescendant",`${c}-${h}`)}function x(){b=[],S()}function F(V){let B={op:V.op,value:V.value,label:V.valueLabel},$=d.findIndex(X=>X.kind==="field"&&X.field===V.field),Q=[...d];if($<0)Q.push({kind:"field",field:V.field,label:V.fieldLabel,values:[B]});else{let X=Q[$];X.values.some(_=>_.op===B.op&&JSON.stringify(_.value)===JSON.stringify(B.value))||(Q[$]={...X,values:[...X.values,B]})}p.value="",x(),f(Q)}p.addEventListener("input",()=>{b=si(p.value,t,n,{searchFor:o.searchFor}),h=0,S()}),p.addEventListener("blur",x),p.addEventListener("keydown",V=>{V.isComposing||((V.key==="ArrowDown"||V.key==="ArrowUp")&&b.length?(V.preventDefault(),h=(h+(V.key==="ArrowDown"?1:b.length-1))%b.length,S()):V.key==="Enter"?(V.preventDefault(),b.length&&F(b[h])):V.key==="Backspace"&&!p.value&&d.length?f(d.slice(0,-1)):V.key==="Escape"&&!g.hidden&&(V.preventDefault(),x()))});let E=(V,B,$)=>i("div",{class:"fd-search-heading",id:$},...l(V),B),w=(V,B)=>{let $=d.findIndex(te=>te.kind===V),Q=$<0?[]:V==="filters"?d[$].ids:d[$].fields,X=Q.includes(B)?Q.filter(te=>te!==B):[...Q,B],J=V==="filters"?{kind:V,ids:X,labels:X.map(te=>n.filters?.find(Ve=>Ve.id===te)?.label??te)}:{kind:V,fields:X,labels:X.map(te=>t.fields[te]?.label??te)},_=[...d];$<0?_.push(J):X.length?_[$]=J:_.splice($,1),f(_)},A=(n.filters??[]).map(V=>{let B=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-filter":V.id},V.label);return B.addEventListener("click",()=>w("filters",V.id)),B}),R=(n.groupBy??[]).map(V=>{let B=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-group":V},t.fields[V].label);return B.addEventListener("click",()=>w("groupBy",V)),B}),I=Ll({page:t,el:i,labels:o,add:V=>f([...d,V])}),M=Sl({page:t,el:i,labels:o,fill:a,preferences:e.preferences,current:()=>d,apply:f}),P=(V,B,$,...Q)=>i("div",{class:"fd-search-group","data-group-kind":V,role:"group","aria-labelledby":`${y}-${V}`},E(B,$,`${y}-${V}`),...Q),H=i("div",{class:"fd-search-panel",id:y,hidden:""},P("filters","filter",o.filters,...A,I.button,I.form),...R.length?[P("groupBy","layers",o.groupBy,...R)]:[],P("favourites","star",o.favourites,M.list,M.none,M.open,M.form));function D(){let V=d.find($=>$.kind==="filters")?.ids??[],B=d.find($=>$.kind==="groupBy")?.fields??[];for(let $ of A)$.setAttribute("aria-pressed",String(V.includes($.dataset.filter??"")));for(let $ of R)$.setAttribute("aria-pressed",String(B.includes($.dataset.group??"")))}function W(V){H.hidden=!V,m.setAttribute("aria-expanded",String(V)),V&&x()}m.addEventListener("click",()=>W(H.hidden)),H.addEventListener("keydown",V=>{V.key==="Escape"&&(V.preventDefault(),W(!1),m.focus())});let z=i("div",{class:"fd-search"},i("div",{class:"fd-search-field"},...l("search"),k,p,m),g,H),j=V=>{!H.hidden&&!z.contains(V.target)&&W(!1)};return r.addEventListener("pointerdown",j),v(),D(),{element:z,add(V){let B=V.kind==="custom"?V.label:null;f([...d.filter($=>!(B!==null&&$.kind==="custom"&&$.label===B)),V])},destroy:()=>r.removeEventListener("pointerdown",j)}}var Rl=new Set(["integer","float","monetary"]),Lu=new Set(["one2many","many2many","binary","image","html","json","properties"]);function Fl(e){let{page:t,node:n,form:r,el:i,labels:o,fill:a,locale:s,doc:d}=e;Xi(d);let l=n.pageSize??40,f=n.sort??[],c=f,y=0,p=0,k=[],g=new WeakMap,m=()=>[...R.querySelectorAll(".fd-list-row")].map(U=>g.get(U)),b=t.data.kind==="record"?t.data.model:"",h=kl(n,e.preferences,t),v=new Set,S=0,x=!1,F=[...new Set(n.columns.flatMap(U=>[U,...ki(t.fields[U])]))],E=(U,re)=>At(t.fields[U],re[U],re,s),w=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":o.selectAll}),A=n.columns.map(U=>{let re=t.fields[U],Ce=i("th",{scope:"col","data-field":U,class:Rl.has(re.type)?"fd-num":void 0});if(Lu.has(re.type))Ce.append(re.label);else{let Pe=i("button",{type:"button",class:"fd-list-sort"},re.label);Pe.addEventListener("click",()=>{let ae=c[0]?.field===U?!c[0].desc:!1;c=[{field:U,...ae?{desc:ae}:{}},...f.filter(le=>le.field!==U)],y=0,Ee()}),Ce.append(Pe)}return Ce}),R=i("tbody"),I=i("table",{class:"fd-list-table","aria-label":t.title},i("thead",{},i("tr",{},i("th",{class:"fd-list-check",scope:"col"},w),...A)),R),M=i("p",{class:"fd-list-empty",hidden:""},o.noRecords),P=i("button",{type:"button",class:"fd-button fd-button-link"},o.retry),H=i("p",{class:"fd-list-failed",role:"alert",hidden:""},o.loadFailed," ",P);P.addEventListener("click",()=>{Ee()});function D(U,re=0){let Ce=E(n.columns[0],U.values)||String(U.id),Pe=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":a(o.selectRecord,{name:Ce})});Pe.checked=v.has(U.id),Pe.addEventListener("change",()=>{Pe.checked?v.add(U.id):v.delete(U.id),B(),oe?.chosenChanged()});let ae=i("tr",{class:e.onOpenRecord?"fd-list-row fd-list-openable":"fd-list-row",tabindex:"0","data-id":String(U.id),"data-level":re?String(re):void 0},i("td",{class:"fd-list-check"},Pe),...n.columns.map(le=>i("td",{class:Rl.has(t.fields[le].type)?"fd-num":void 0},i("bdi",{},E(le,U.values)))));return ae.addEventListener("click",le=>{let se=le.target.closest("td");if(se?.classList.contains("fd-list-check")){le.target===se&&Pe.click();return}e.onOpenRecord?.(U.id)}),ae.addEventListener("keydown",le=>{le.target===ae&&(le.key==="Enter"?(le.preventDefault(),e.onOpenRecord?.(U.id)):le.key===" "?(le.preventDefault(),Pe.click()):(le.key==="ArrowDown"||le.key==="ArrowUp")&&(le.preventDefault(),(le.key==="ArrowDown"?ae.nextElementSibling:ae.previousElementSibling)?.focus()))}),ae.addEventListener("mouseenter",()=>oe?.highlight(U.id)),ae.addEventListener("mouseleave",()=>oe?.highlight(null)),ae.addEventListener("focus",()=>oe?.highlight(U.id)),g.set(ae,U),ae}let W=i("span",{class:"fd-list-count",role:"status"}),z=i("button",{type:"button",class:"fd-button fd-button-link"},o.clearSelection),j=(n.actions??[]).map(U=>{let re=i("button",{type:"button",class:`fd-button fd-button-${U.style??"secondary"}`,"data-node":U.id},...e.withIcon(U.icon,U.label));return re.addEventListener("click",()=>{e.press(re,async()=>{let Ce=await r.runAction(U.id,{recordIds:[...v]});return await Promise.all([Ee(),oe?.reload()]),Ce})}),re}),V=i("div",{class:"fd-list-selection",hidden:""},W,...j,z);z.addEventListener("click",()=>{v.clear();for(let U of R.querySelectorAll(".fd-list-checkbox"))U.checked=!1;B()}),w.addEventListener("change",()=>{for(let U of m())w.checked?v.add(U.id):v.delete(U.id);for(let U of R.querySelectorAll(".fd-list-checkbox"))U.checked=w.checked;B()});function B(){let U=m(),re=U.filter(Ce=>v.has(Ce.id)).length;w.checked=U.length>0&&re===U.length,w.indeterminate=re>0&&re<U.length,V.hidden=v.size===0,W.textContent=a(o.selected,{n:v.size});for(let Ce of R.querySelectorAll(".fd-list-row"))Ce.setAttribute("aria-selected",String([...v].some(Pe=>String(Pe)===Ce.dataset.id)))}let $=i("span",{class:"fd-pager-text"}),Q=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.previousPage},"\u2039"),X=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.nextPage},"\u203A"),J=i("div",{class:"fd-pager",role:"group"},$,Q,X);Q.addEventListener("click",()=>{y=Math.max(0,y-l),Ee()}),X.addEventListener("click",()=>{y+=l,Ee()});function _(){J.hidden=p===0,$.textContent=a(o.range,{from:y+1,to:Math.min(y+k.length,p),total:p}),Q.disabled=y===0,X.disabled=y+l>=p}function te(){for(let U of A){let re=!c[0]?.near&&c[0]?.field===U.dataset.field?c[0]:null;re?U.setAttribute("aria-sort",re.desc?"descending":"ascending"):U.removeAttribute("aria-sort")}}function Ve(){if(ge==="list"){let U=new Set(m().map(re=>re.id));for(let re of[...v])U.has(re)||v.delete(re)}B(),oe?.chosenChanged()}let Ie=U=>({page:t,el:i,labels:o,fill:a,dataSource:U,model:b,fields:F,columns:n.columns.length+1,pageSize:l,sort:()=>c,recordRow:D,changed:Ve});async function Ee(){let U=++S;te(),I.setAttribute("aria-busy","true");let re=[];try{let Ce=[...e.fixedFilter??[],...kr(h,n)],Pe=di(h),ae=e.dataSource;if(Pe.length&&ae?.groups&&ae.list){let le=await ae.groups({model:b,field:Pe[0],filter:Ce});if(U!==S||x)return;k=[],p=0,re=le.map(se=>va(Ie(ae),se,0,Ce,Pe))}else{let le=ae?.list?await ae.list({model:b,fields:F,filter:Ce,sort:c,offset:y,limit:l}):{records:[],total:0};if(U!==S||x)return;if(!le.records.length&&le.total>0&&y>0)return y=Math.floor((le.total-1)/l)*l,Ee();k=le.records,p=le.total,re=k.map(se=>D(se))}H.hidden=!0}catch{if(U!==S||x)return;k=[],p=0,H.hidden=!1}R.replaceChildren(...re),M.hidden=re.length>0||!H.hidden,I.removeAttribute("aria-busy"),_(),Ve()}let Me=El({page:t,node:n,doc:d,el:i,labels:o,fill:a,uid:e.uid,icons:e.icons,preferences:e.preferences,facets:h,onChange(U){h=U,y=0,Ee(),oe?.reload()}}),ie=n.map?e.views?.map:void 0,ge=ie?n.map?.view??"list":"list",oe=null,ke=i("div",{class:"fd-list-map"}),De=()=>[...e.fixedFilter??[],...kr(h,n)];function xe(){oe||!ie||(oe=ie({page:t,node:n,dataSource:e.dataSource,document:d,locale:s,icons:e.icons,filter:De,isChosen:U=>v.has(U),choose(U,re){re?v.add(U):v.delete(U);for(let Ce of R.querySelectorAll(".fd-list-row")){if(Ce.dataset.id!==String(U))continue;let Pe=Ce.querySelector(".fd-list-checkbox");Pe&&(Pe.checked=re)}B(),oe?.chosenChanged()},...e.onOpenRecord?{open:e.onOpenRecord}:{},highlight(U){for(let re of R.querySelectorAll(".fd-list-row")){let Ce=U!==null&&re.dataset.id===String(U);re.classList.toggle("fd-list-hot",Ce),Ce&&ge==="both"&&re.scrollIntoView({block:"nearest"})}},addSearch:({label:U,filter:re})=>Me.add({kind:"custom",label:U,filter:re}),sort:()=>c,sortBy(U){c=U??f,y=0,Ee(),oe?.reload()},actions:(n.actions??[]).map(U=>({id:U.id,label:U.label,...U.style?{style:U.style}:{}})),act:(U,re,Ce)=>e.press(Ce,async()=>{let Pe=await r.runAction(U,{recordIds:re});return await Promise.all([Ee(),oe?.reload()]),Pe})}),ke.append(oe.element),oe.reload())}let Xe=["list","map","both"].map(U=>{let re=i("button",{type:"button",class:"fd-button fd-list-view","data-view":U,"aria-pressed":"false"},U==="list"?o.viewList:U==="map"?o.viewMap:o.viewBoth);return re.addEventListener("click",()=>ne(U)),re}),Y=i("div",{class:"fd-list-views",role:"group","aria-label":o.showAs},...Xe);Y.hidden=!ie;function ne(U){ge=U,fe.dataset.view=ge;for(let re of Xe)re.setAttribute("aria-pressed",String(re.dataset.view===ge));ge!=="list"&&(xe(),oe?.shown())}let fe=i("div",{class:"fd-list","data-node":n.id},i("div",{class:"fd-list-bar"},Me.element,Y,J),V,i("div",{class:"fd-list-body"},i("div",{class:"fd-list-records"},i("div",{class:"fd-list-scroll"},I),M,H),ke));return ne(ge),Ee(),{element:fe,reload:async()=>{await Promise.all([Ee(),oe?.reload()])},destroy(){x=!0,Me.destroy(),oe?.destroy()}}}function Zi(e,t){let n=e.style??"card",r=n==="plain"&&!e.title,i=gn(e.columns),o=e.colspan??1,a=r&&t.columns>1?o===1&&i>1?"shared":"tracks":void 0;return{style:n,arrangement:r,at:a,inner:{columns:a==="tracks"?Math.min(o,t.columns):i,onPage:t.onPage&&(n==="plain"||n==="line"),labels:e.labels??t.labels,quiet:e.quiet??t.quiet,reason:e.readonlyReason??t.reason}}}var Eu=new Set(["one2many","matrix"]);function Dr(e,t,n){if(t==="boolean"&&e.widget==="tick")return"after";let r=e.labels??n;return r==="beside"&&Eu.has(t)?"above":r}function nt(e,t){e.hidden!==t&&(e.hidden=t)}function $t(e,t){e.textContent!==t&&(e.textContent=t)}function ut(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}async function Al(e,t){let{options:n}=e,r=n.onOpen?.(t);if(r)return r;let i=await Ir(n,t.version===void 0?{id:t.page}:{id:t.page,version:t.version});if(!i)throw new Error(e.missing(t.page));let o=n.page.look,a={...n,page:o&&!i.look?{...i,look:o}:i,form:void 0,recordId:t.recordId??null,values:t.values,listFilter:t.filter,drafts:void 0,autosave:void 0,readonly:void 0,editSwitch:void 0,saveStatus:void 0,records:void 0,breadcrumbs:void 0},s=t.title??e.title(i),d={...a,host:{...n.host,say:e.say,post:e.post}},l=t.as==="page"?await Ru(e,{...a,host:{...n.host,post:e.post}}):t.as==="panel"?await ba({...d,title:s,side:t.side}):await ir({...d,title:s,size:i.layout.type==="sheet"?"large":"medium"}),f=xa(i),c=f?l.values[f]:void 0;return{...l,...typeof c=="string"&&c?{label:c}:{}}}function Ru(e,t){let{place:n,root:r}=e,i=n.ownerDocument,o=i.activeElement;return new Promise(a=>{let s=!1,d=p=>{if(s)return;s=!0;let k=f.form.getState();f.destroy(),r.hidden=!1,o?.isConnected&&o.focus(),a({saved:p,recordId:k.recordId??null,values:k.values})};r.hidden=!0;let l=e.options.breadcrumbs?[...e.options.breadcrumbs,{label:e.name(),open:()=>d(!1)}]:void 0,f=Vr(n,{...t,breadcrumbs:l,host:{...t.host,close:()=>d(!1)}}),c=i.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-back",c.textContent=e.back,c.addEventListener("click",()=>d(!1)),f.element.querySelector(".fd-breadcrumbs")||f.element.prepend(c);let y=()=>{f.form.settled().then(()=>d(!0))};f.on("save",y),f.on("send",y),(Gi(f.element)??f.element.querySelector(Or)??c).focus()})}function $l(e,t,n){let r=t("div",{class:"fd-says",role:"status","aria-live":"polite"});return e.append(r),(i,o)=>{let a=t("button",{type:"button",class:"fd-alert-close","aria-label":n},"\xD7"),s=t("div",{class:"fd-say","data-tone":o},t("span",{},i),a);s.style.setProperty("--fd-tone",`var(--fd-${o==="danger"?"error":o})`);let d,l=()=>clearTimeout(d),f=()=>{l(),s.remove()},c=()=>{l(),d=setTimeout(f,o==="warning"||o==="danger"?1e4:6e3)};for(a.addEventListener("click",f),s.addEventListener("mouseenter",l),s.addEventListener("focusin",l),s.addEventListener("mouseleave",c),s.addEventListener("focusout",c),r.append(s);r.children.length>4;)r.firstElementChild?.remove();Fu(r,t,i),c()}}function Fu(e,t,n){let r=[...e.ownerDocument.querySelectorAll('[aria-modal="true"]')].filter(a=>!a.contains(e)),i=r[r.length-1];if(!i)return;let o=i.querySelector(":scope > .fd-says-echo");o||(o=t("div",{class:"fd-says-echo fd-sr-only",role:"status","aria-live":"polite"}),i.append(o)),o.textContent=n}var or=64;function Tl(e,t){let n=()=>e.closest("[dir]")?.getAttribute("dir")==="rtl",r=y=>t("button",{type:"button",class:`fd-tabs-scroll fd-tabs-${y}`,tabindex:"-1","aria-hidden":"true",hidden:""}),i=r("before"),o=r("after"),a=t("div",{class:"fd-tabbar"},i,e,o),s=y=>e.scrollBy({left:y*(n()?-1:1)*Math.max(e.clientWidth-2*or,or),behavior:"smooth"});i.addEventListener("click",()=>s(-1)),o.addEventListener("click",()=>s(1));function d(){let y=Math.abs(e.scrollLeft),p=y>1,k=y+e.clientWidth<e.scrollWidth-1;nt(i,!p),nt(o,!k);let g=[p&&"start",k&&"end"].filter(Boolean).join(" ");ut(a,"data-more",g||null)}function l(y){if(!e.clientWidth||e.scrollWidth<=e.clientWidth)return;let p=e.getBoundingClientRect(),k=y.getBoundingClientRect();k.left<p.left+or?e.scrollLeft+=k.left-p.left-or:k.right>p.right-or&&(e.scrollLeft+=k.right-p.right+or),d()}e.addEventListener("scroll",d,{passive:!0});let f=e.ownerDocument.defaultView,c=f&&"ResizeObserver"in f?new f.ResizeObserver(()=>d()):null;return c?.observe(e),{element:a,measure:d,reveal:l,destroy:()=>c?.disconnect()}}function ka(e,t,n,r){let i=Un(n);if(!i.some(s=>s.field))return{nodes:[n],update:()=>{}};let o=[];return{nodes:i.map(s=>{if(!s.field)return s.text;let d=e.createElement("bdi");return d.className="fd-value",d.dataset.field=s.field,o.push({field:s.field,span:d}),d}),update(s){for(let{field:d,span:l}of o){let f=t[d],c=f?At(f,s[d],s,r):"";l.textContent!==c&&(l.textContent=c)}}}}var Au={gear:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>'},Wr=(e,t)=>e!=null&&t!=null&&String(e)===String(t);function Ml(e){let{el:t,labels:n,toolbar:r}=e,i=r?.menu??[],o=r?.breadcrumbs===!1?void 0:e.breadcrumbs,a=r?.pager===!1?void 0:e.records;if(!i.length&&!o?.length&&!a)return null;let s=[],d=[],l=t("div",{class:"fd-record-bar"});if(o?.length){let f=t("span",{class:"fd-crumb-current","aria-current":"page"}),c=t("ol",{},...o.map(y=>{let p=y.href!==void 0?t("a",{class:"fd-crumb",href:y.href},y.label):t("button",{type:"button",class:"fd-crumb"},y.label);return y.open&&p.addEventListener("click",k=>{k.preventDefault(),y.open?.()}),t("li",{},p)}),t("li",{},f));l.append(t("nav",{class:"fd-breadcrumbs","aria-label":n.breadcrumbs},c)),s.push(()=>$t(f,e.name()||n.newRecord))}return i.length&&l.append($u(e,i,s,d)),a&&l.append(Tu(e,a,o,s,d)),{element:l,update:()=>{for(let f of s)f()},destroy:()=>{for(let f of d)f()}}}function $u(e,t,n,r){let{doc:i,el:o,form:a,labels:s}=e,d=e.uid("record-menu"),l=o("button",{type:"button",class:"fd-button fd-record-gear",id:`${d}-button`,"aria-haspopup":"menu","aria-expanded":"false","aria-controls":d,title:s.actions}),f=kt(i,"gear",Au);f&&l.append(f),l.append(o("span",{class:"fd-record-gear-words"},s.actions));let c=o("div",{class:"fd-record-menu",role:"menu",id:d,"aria-labelledby":l.id,hidden:""}),y=t.map(E=>{let w=E.label??(E.builtin?s[E.builtin]:E.id),A=o("button",{type:"button",role:"menuitem",tabindex:"-1",class:"fd-record-menu-item","data-node":E.id},...e.withIcon(E.icon,w));return E.builtin==="delete"&&A.classList.add("fd-record-menu-danger"),A.addEventListener("click",()=>{F(!0),e.press(l,()=>a.runAction(E.id))}),{item:E,button:A}}),p=y.filter(E=>E.item.group==="print"),k=y.filter(E=>E.item.group!=="print"),g=o("div",{class:"fd-record-menu-heading",role:"presentation"},s.print),m=o("div",{role:"group","aria-label":s.print},g,...p.map(E=>E.button)),b=o("div",{class:"fd-record-menu-rule",role:"separator"});c.append(...p.length?[m]:[],...p.length&&k.length?[b]:[],...k.map(E=>E.button));let h=o("div",{class:"fd-record-actions"},l,c),v=()=>y.filter(E=>!E.button.hidden).map(E=>E.button),S=E=>{h.contains(E.target)||F(!1)};function x(E){if(!c.hidden)return;c.hidden=!1,c.removeAttribute("data-end");let w=c.getBoundingClientRect();(w.right>i.documentElement.clientWidth-4||w.left<4)&&c.setAttribute("data-end",""),l.setAttribute("aria-expanded","true"),i.addEventListener("pointerdown",S,!0);let A=v();(E==="first"?A[0]:A[A.length-1])?.focus()}function F(E){c.hidden||(c.hidden=!0,l.setAttribute("aria-expanded","false"),i.removeEventListener("pointerdown",S,!0),E&&l.focus())}return r.push(()=>i.removeEventListener("pointerdown",S,!0)),l.addEventListener("click",()=>c.hidden?x("first"):F(!1)),l.addEventListener("keydown",E=>{(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),x(E.key==="ArrowDown"?"first":"last"))}),c.addEventListener("keydown",E=>{let w=v(),A=w.indexOf(i.activeElement),R={ArrowDown:A+1,ArrowUp:A-1,Home:0,End:w.length-1}[E.key];R!==void 0?(E.preventDefault(),w[(R+w.length)%w.length]?.focus()):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),F(!0)):E.key==="Tab"&&F(!1)}),n.push(()=>{for(let{item:E,button:w}of y)nt(w,a.node(E.id).invisible);nt(m,!p.some(E=>!E.button.hidden)),nt(b,m.hidden||!k.some(E=>!E.button.hidden)),nt(h,!y.some(E=>!E.button.hidden))}),h}function Tu(e,t,n,r,i){let{el:o,form:a,labels:s}=e,d=Array.isArray(t)?[...t]:null,l=Array.isArray(t)?null:t,f=d?d.length:l.total,c=d?-1:l.at,y=d?null:a.getState().recordId,p=!1,k=()=>{let x=a.getState().recordId;return d?d.findIndex(F=>Wr(F,x)):Wr(y,x)?c:-1},g=o("span",{class:"fd-record-pager-text",dir:"ltr"}),m=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.previousRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),b=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.nextRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A"));Hn(m,"p",s.previousRecord),Hn(b,"n",s.nextRecord);let h=o("div",{class:"fd-record-pager",role:"group","aria-label":s.records},g,m,b),v=async x=>d?d[x]:l.id(x);async function S(x){let F=k();if(!(p||F===-1||f<2)){p=!0;try{let E=(F+x+f)%f;if(!await e.leave())return;let w=await v(E);c=E,y=w,await a.openRecord(w)}finally{p=!1}}}return m.addEventListener("click",()=>{S(-1)}),b.addEventListener("click",()=>{S(1)}),i.push(a.on("duplicate",({from:x,recordId:F})=>{if(!d)return;let E=d.findIndex(w=>Wr(w,x));d.splice(E+1,0,F),f=d.length,e.render()}),a.on("delete",({recordId:x})=>{let F=d?d.findIndex(A=>Wr(A,x)):Wr(y,x)?c:-1;if(F===-1)return;if(d&&d.splice(F,1),f=d?d.length:f-1,f<1)return void n?.[n.length-1]?.open?.();c=Math.min(F,f-1);let E=A=>{y=A,a.openRecord(A)},w=d?d[c]:l.id(c);w instanceof Promise?w.then(E):E(w)})),r.push(()=>{let x=k();nt(h,x===-1),$t(g,e.fill(s.recordAt,{n:x+1,total:f}));let F=f<2;ut(m,"aria-disabled",F?"true":null),ut(b,"aria-disabled",F?"true":null)}),h}var Mu=e=>/^image\//.test(e.type)||/pdf/i.test(e.type)||/\.pdf$/i.test(e.name),Nu=e=>(Array.isArray(e)?e:e?[e]:[]).filter(t=>t&&typeof t=="object"&&"name"in t);function Nl(e){let{el:t,form:n,labels:r,node:i}=e,o=t("span",{class:"fd-attachment-name",dir:"auto"}),a=t("span",{class:"fd-attachment-count",dir:"ltr"}),s=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.previousAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),d=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.nextAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A")),l=t("a",{class:"fd-button fd-button-link fd-attachment-open",target:"_blank",rel:"noopener"},r.openAttachment),f=t("div",{class:"fd-attachment-body"}),c=t("aside",{class:"fd-attachment-preview",hidden:""},t("div",{class:"fd-attachment-head"},o,a,s,d,l),f),y=[],p=0,k=null,g,m=0,b,h;function v(){k?.free(),k=null;let w=y[p];if(!w)return f.replaceChildren();let A=zo(e.doc,w);k=A,f.replaceChildren(...A?[A.element]:[]),$t(o,w.name),$t(a,y.length>1?e.fill(r.recordAt,{n:p+1,total:y.length}):""),nt(s,y.length<2),nt(d,y.length<2),ut(l,"href",A?.url??null),ut(c,"aria-label",e.fill(r.attachment,{name:w.name}))}let S=w=>{p=(p+w+y.length)%y.length,v()};s.addEventListener("click",()=>S(-1)),d.addEventListener("click",()=>S(1));let x=w=>{y=w.filter(Mu),p=0,v(),F()},F=()=>nt(c,n.node("#preview").invisible||!y.length);function E(w){let A=e.dataSource,R=++m;if(g=w.recordId,w.recordId==null||!A?.attachments||e.page.data.kind!=="record")return x([]);A.attachments({model:e.page.data.model,id:w.recordId,fields:e.page.fields}).then(I=>R===m&&x(I),()=>R===m&&x([]))}return{element:c,update(w){if(i.field){let A=w.values[i.field];A!==h&&(h=A,x(Nu(A)))}else w.status!=="loading"&&w.status!=="idle"&&(w.recordId!==g||w.status==="saved"&&b!=="saved")&&E(w);b=w.status,F()},destroy:()=>k?.free()}}var Cu='.fd-record-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-height:46px;box-sizing:border-box;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-form>.fd-content>.fd-record-bar{margin:-4px 0 12px;border-radius:var(--fd-radius);border:1px solid var(--fd-border)}.fd-breadcrumbs{min-width:0}.fd-breadcrumbs ol{display:flex;flex-wrap:wrap;align-items:center;list-style:none;margin:0;padding:0;font-size:17px;line-height:1.3}.fd-breadcrumbs li{display:flex;align-items:center;min-width:0}.fd-breadcrumbs li+li:before{content:"/";color:var(--fd-muted);padding-inline:8px}.fd-crumb{all:unset;cursor:pointer;color:var(--fd-accent);border-radius:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-crumb:hover{text-decoration:underline}.fd-crumb:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-crumb-current{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-record-actions{position:relative}.fd-record-actions[hidden]{display:none}.fd-record-gear{display:inline-flex;align-items:center;gap:6px}.fd-record-gear svg{width:16px;height:16px;flex:none}.fd-record-menu{position:absolute;z-index:40;inset-block-start:calc(100% + 4px);inset-inline-start:0;display:grid;min-width:220px;max-width:min(320px,90vw);padding:4px;box-sizing:border-box;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #00000029}.fd-record-menu[data-end]{inset-inline-start:auto;inset-inline-end:0}.fd-record-menu[hidden],.fd-record-menu [hidden]{display:none}.fd-record-menu [role=group]{display:grid}.fd-record-menu-heading{padding:6px 12px 2px;font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--fd-muted)}.fd-record-menu-rule{margin:4px 0;border-block-start:1px solid var(--fd-border)}.fd-record-menu-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 12px;border-radius:3px;cursor:pointer;color:var(--fd-text)}.fd-record-menu-item svg{width:16px;height:16px;flex:none;color:var(--fd-muted)}.fd-record-menu-item:hover,.fd-record-menu-item:focus{background:var(--fd-accent-soft)}.fd-record-menu-item:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-record-menu-danger{color:var(--fd-error)}.fd-record-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-record-pager[hidden]{display:none}.fd-record-pager-text{padding-inline-end:6px;font-variant-numeric:tabular-nums;color:var(--fd-muted);white-space:nowrap}.fd-record-step{min-width:34px;padding-inline:8px;font-size:18px;line-height:1}.fd-record-step[aria-disabled=true]{opacity:.5;cursor:default}@container fd-form (max-width: 520px){.fd-record-bar{padding-inline:12px;gap:6px 8px}.fd-record-gear-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-breadcrumbs ol{flex-wrap:nowrap;font-size:15px}.fd-breadcrumbs li:not(:nth-last-child(-n+2)){display:none}.fd-breadcrumbs li:nth-last-child(2):before{content:"\u2039";padding-inline:0 6px;font-size:20px;color:var(--fd-accent)}}.fd-attachment-preview{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);overflow:hidden}.fd-attachment-preview[hidden]{display:none}.fd-attachment-head{display:flex;align-items:center;gap:6px;padding:6px 8px 6px 12px;padding-inline:12px 8px;border-block-end:1px solid var(--fd-border);min-width:0}.fd-attachment-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.fd-attachment-count{color:var(--fd-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.fd-attachment-head [hidden]{display:none}.fd-attachment-body{display:grid;min-height:0;background:var(--fd-page)}.fd-attachment-body>iframe{width:100%;height:100%;min-height:70vh;border:0;background:#fff}.fd-attachment-body>img{display:block;max-width:100%;max-height:80vh;margin:auto;object-fit:contain}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){max-width:none;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);grid-template-rows:auto 1fr}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden]))>:is(.fd-card,.fd-side){grid-column:1}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:2;grid-row:1 / span 2;position:sticky;top:8px;height:calc(100vh - 16px);max-height:1200px}@container (max-width: 1000px){.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){grid-template-columns:minmax(0,1fr)}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:1;grid-row:auto;position:static;height:auto}.fd-attachment-body>iframe{min-height:60vh}}@container (max-width: 1000px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr) minmax(240px,300px)}}@container (max-width: 600px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr)}}';function Cl(e){if(e.getElementById("fd-record-styles"))return;let t=e.createElement("style");t.id="fd-record-styles",t.textContent=Cu,(e.head??e.documentElement).append(t)}var Pu=0;function Vr(e,t){let n={...t},r=e.ownerDocument,i=yr(n.page,n.parent?{parent:n.parent.fields}:{});if(!i.ok)throw new Error(`This page cannot be shown:
|
|
63
|
+
${i.issues.map(N=>` ${N.path}: ${N.message}`).join(`
|
|
64
|
+
`)}`);let o=n.locale??i.page.language,a=o?xr(i.page,o):i.page,s=n.translate?Gn(a,n.translate):a,d=N=>{let K=o?xr(N,o):N;return n.translate?Gn(K,n.translate):K},l=Cr(o),f=n.preferences??ca(),c=vl(n,(N,K)=>k.say(N,K)),y=!n.form,p={...Vt[l],...n.labels},k={open:N=>Al({options:n,place:e,root:P,title:K=>d(K).title||K.id,back:p.back,missing:K=>A(p.pageMissing,{page:K}),say:(K,ue)=>k.say(K,ue),post:K=>g.post(K),name:()=>ar()||p.newRecord},N),say:(N,K)=>D(N,K),ask:N=>H(N),show:N=>{if(!W.get(N)?.())throw new Error(`No tab "${N}" can be shown here`)},openUrl:(N,K)=>K?r.defaultView?.open(N,"_blank","noopener,noreferrer"):r.defaultView?.location.assign(N),...n.host},g=n.form??pi({...n,page:s,host:k,messages:n.messages??Tt[l]}),m=Ze[l],b=n.dir??(o&&Mn(o)?"rtl":void 0),h=`fd${++Pu}`,v=[],S=v,x=[],F=!1,E=N=>`${h}-${N.replace(/[^A-Za-z0-9_-]/g,"_")}`,w=E,A=(N,K)=>N.replace(/\{(\w+)\}/g,(ue,Se)=>String(K[Se]??""));la(r),Cl(r);function R(N,K={},...ue){let Se=r.createElement(N);for(let[Ne,Re]of Object.entries(K))Re!==void 0&&Se.setAttribute(Ne,Re);return Se.append(...ue),Se}function I(N,K){let ue=kt(r,N,n.icons),Se=R("bdi",{},K);return ue?[ue,Se]:[Se]}let M=n.theme??s.look?.theme,P=R("form",{class:"fd-form",novalidate:"","data-fd-skin":Ln(n.skin??s.look?.skin,M),dir:b,lang:o,"data-max-width":s.maxWidth});jn(P,M?{...s.look,theme:M}:s.look),En(P,n.tokens);let H=n.confirm??cr,D=$l(P,R,p.dismiss),W=new Map,z=new Map;async function j(N,K){if(!N.hasAttribute("aria-busy")){N.setAttribute("aria-busy","true"),N.setAttribute("aria-disabled","true");try{let{reason:ue}=await K();(ue==="check"||ue==="save")&&(g.getState().saveProblem||ae(fe(g.getState())),be())}finally{N.removeAttribute("aria-busy"),N.removeAttribute("aria-disabled")}}}let V=[],B=[],$=new Map,Q=()=>en(g.getState()),X=!1,J=!1;function _(N,K){K&&N.style.setProperty("--fd-span",String(K))}let te=N=>({columns:1,onPage:N,labels:s.look?.labels});function Ve(N){let{form:K,page:ue}=N,Se=O=>E(N.prefix+O),Ne=O=>S.push(N.root?O:()=>O(K.getState()));function Re(O,G,de={}){let pe=ue.fields[O.field],Oe=Se(O.id),Le=Dr(O,pe.type,G),ye=R("div",{class:"fd-field","data-node":O.id,"data-field":O.field,"data-path":N.path+O.field,"data-type":pe.type,"data-labels":Le,"data-focus":O.focus&&N.root?"":void 0});O.colspan&&ye.style.setProperty("--fd-span",String(O.colspan));let je=O.label??pe.label,qe=R("label",{class:"fd-label",id:`${Oe}-label`,for:Oe},Du(je)),it=n.showValid&&!Iu.has(pe.type)?kt(r,"check"):null;it&&(it.classList.add("fd-valid-mark"),qe.append(it));let Ge=Ot({form:K,name:O.field,field:pe,node:O,id:Oe,document:r,labels:m,preferences:f,locale:l,dialogs:c},n.widgets);O.focus&&N.root&&V.push({wrapper:ye,focus:()=>Ge.focus()});let Ke=Ge.element.matches(Pl)?Ge.element:Ge.element.querySelector(Pl);Le==="hidden"&&!O.placeholder&&Ke?.setAttribute("placeholder",je);let Rt=Ke?.getAttribute("placeholder")??null,mt=O.placeholderWhen?.length?Ke:null,It=O.quiet??de.quiet,Dt=Ti(pe,O),yt=()=>It??P.getAttribute("data-fd-skin")==="quiet",ot=!!O.placeholder||Le==="hidden"||pe.type==="json"||pe.type==="properties",Nt=Ol(je,l,p),tn=()=>!ot&&ye.hasAttribute("data-quiet")?Nt:Rt,ur=O.placeholder||(Le==="hidden"?je:Nt),Fn=Ge.element instanceof HTMLSelectElement?Ge.element.querySelector(':scope > option[value=""]'):null,ro=Ge.element.matches(".fd-richtext")?Ge.element:Ge.element.querySelector(":scope > .fd-richtext"),Sa=Ge.element.querySelector(":scope > .fd-dot-label"),La=()=>{let Je=yt(),Ft=Dt&&Je;ye.toggleAttribute("data-in-quiet",Je),ye.toggleAttribute("data-quiet",Ft),Ke&&!mt&&ut(Ke,"placeholder",tn()),Fn&&(Fn.textContent=Ft?ur:""),ro&&!O.placeholder&&(ut(ro,"data-placeholder",Ft?Nt:null),ut(ro,"aria-placeholder",Ft?Nt:null)),Sa&&ut(Sa,"data-hint",Ft?ur:null)};B.push(La),La(),["INPUT","SELECT","TEXTAREA"].includes(Ge.element.tagName)||((Ge.element.getAttribute("role")?Ge.element:Ge.element.querySelector(`[id="${Oe}"][role]`))?.setAttribute("aria-labelledby",qe.id),qe.addEventListener("click",Ft=>{Ft.target.closest?.(".fd-help-tip-wrap, .fd-lock-wrap")||Ge.focus()}));let Br=O.help??pe.help,Ea=O.helpShown??ue.look?.helpShown??"below",io=Br&&Ea!=="tooltip"?R("div",{class:"fd-help",id:`${Oe}-help`},Br):null,An=Br&&Ea!=="below"?bt(`${Oe}-tip`,Br,A(p.helpFor,{label:je})):null;An&&Le==="hidden"?Ge.element.after(An.element):An&&(qe.append(An.element),qe.dir="auto");let pr=O.readonlyReason??de.reason,Dl=O.readonly===!0||pe.readonly===!0||pe.compute!==void 0,mr=null,$n=null,gr=!1,Wl=()=>{if($n)return $n;let Je=kt(r,"lock",n.icons)??"";return mr=pr?lt(`${Oe}-lock`,pr,A(p.locked,{label:je}),"fd-lock",Je):null,$n=mr?.element??R("span",{class:"fd-lock-wrap"},R("span",{class:"fd-lock","aria-hidden":"true"},Je)),Le==="hidden"?Ge.element.after($n):qe.insertBefore($n,An&&Le!=="after"?An.element:null),$n},oo=Je=>mr?.point(Je&&gr&&ye.hasAttribute("data-in-quiet"));if(pr)for(let[Je,Ft]of[["mouseenter",!0],["mouseleave",!1],["focusin",!0],["focusout",!1]])Ge.element.addEventListener(Je,()=>oo(Ft));let qr=R("div",{class:"fd-error",id:`${Oe}-error`,hidden:""}),_r=R("div",{class:"fd-warning",id:`${Oe}-warning`,role:"status",hidden:""});ye.append(...Le==="after"?[Ge.element,qe]:[qe,Ge.element],...io?[io]:[],qr,_r);let Tn=ue.look?.readonlyShown==="text"&&fa(pe,O)?ua({document:r,field:pe,node:O,id:Oe,locale:l,labels:m,dialogs:c}):null;if(Tn&&Ge.element.after(Tn.element),Tn&&pr)for(let[Je,Ft]of[["mouseenter",!0],["mouseleave",!1]])Tn.element.addEventListener(Je,()=>oo(Ft));Ge.destroy&&x.push(()=>Ge.destroy?.());let ao=!1,Ra="";ye.addEventListener("focusin",()=>ao=!0),ye.addEventListener("focusout",Je=>{ye.contains(Je.relatedTarget)||(ao=!1,queueMicrotask(()=>Fa(K.getState())))});let so;ye.addEventListener("focusin",Je=>{ye.contains(Je.relatedTarget)||(so=K.getState().values[O.field])}),ye.addEventListener("keydown",Je=>{Je.key!=="Escape"||Je.defaultPrevented||!ye.hasAttribute("data-quiet")||JSON.stringify(K.getState().values[O.field]??null)!==JSON.stringify(so??null)&&(Je.preventDefault(),Je.stopPropagation(),K.setValue(O.field,so??null))});let jl=O.tones!==void 0||O.bold!==void 0,Fa=Je=>{let Ft=K.node(O.id);if(nt(ye,Ft.invisible),ye.classList.toggle("fd-required",Ft.required),jl){let mn=K.fieldTone(O.id);ut(ye,"data-tone",mn.tone),ye.classList.toggle("fd-value-bold",mn.bold)}mt&&ut(mt,"placeholder",K.placeholder(O.id)??tn());let Bn=Je.errors[O.field];nt(qr,!Bn),$t(qr,Bn??"");let Aa=Je.warnings[O.field]??"";(!ao||!Aa)&&(Ra=Aa);let lo=[Bn?"":Ra,Je.warning&&Je.warningField===O.field?Je.warning:""].filter(Boolean).join(" ");if(nt(_r,!lo),$t(_r,lo),it){let mn=Je.values[O.field],Hl=mn!=null&&mn!==""&&!(Array.isArray(mn)&&!mn.length),Ta=!Ft.readonly&&!Bn&&Hl&&Je.dirty.includes(O.field)&&K.problem(O.field)===null;ye.classList.toggle("fd-valid",Ta),it.toggleAttribute("hidden",!Ta)}let qn=Ft.readonly||ke||N.locked(),$a=ye.hasAttribute("data-quiet");gr=qn&&!ke;let co=gr&&(!!pr||ye.hasAttribute("data-in-quiet")&&!Dl);(co||$n)&&nt(Wl(),!co),gr||oo(!1),ut(ye,"data-locked",$a&&co?"":null),ut(ye,"data-empty",$a&&Ou(Je.values[O.field])?"":null),Tn&&(nt(Ge.element,qn),nt(Tn.element,!qn),ut(ye,"data-read-text",qn?"":null),qn&&Tn.update(Je.values[O.field],Je.values)),Ge.update({value:Je.values[O.field],values:Je.values,readonly:qn,required:Ft.required,invalid:!!Bn,describedBy:[io?.id??An?.bubble.id,mr&&gr?mr.bubble.id:void 0,Bn?qr.id:void 0,lo?_r.id:void 0].filter(Boolean).join(" ")||void 0})};return Ne(Fa),ye}function bt(O,G,de){return lt(O,G,de,"fd-help-tip","?")}function lt(O,G,de,pe,Oe){let Le=R("span",{class:"fd-help-bubble",role:"tooltip",id:O,hidden:""},G),ye=R("button",{type:"button",class:pe,"aria-label":de,"aria-expanded":"false","aria-controls":O},Oe);pe==="fd-lock"&&ye.setAttribute("aria-describedby",O);let je=!1,qe=it=>{Le.hidden=!it,ye.setAttribute("aria-expanded",String(it)),it&&vt(Le)};return ye.addEventListener("mouseenter",()=>qe(!0)),ye.addEventListener("mouseleave",()=>qe(je)),ye.addEventListener("focus",()=>qe(!0)),ye.addEventListener("blur",()=>(je=!1,qe(!1))),ye.addEventListener("click",it=>{it.preventDefault(),je=!je,qe(je)}),ye.addEventListener("keydown",it=>{it.key!=="Escape"||Le.hidden||(it.stopPropagation(),je=!1,qe(!1))}),{element:R("span",{class:pe==="fd-lock"?"fd-lock-wrap":"fd-help-tip-wrap"},ye,Le),bubble:Le,point:it=>qe(it||je)}}function vt(O){O.style.transform="";let G=O.getBoundingClientRect(),de=r.documentElement.clientWidth,pe=8,Oe=G.right>de-pe?de-pe-G.right:G.left<pe?pe-G.left:0;Oe&&(O.style.transform=`translateX(${Math.round(Oe)}px)`)}function dt(O,G){Ne(()=>nt(O,K.node(G).invisible))}function Qe(O){let G=R("button",{type:"button",class:`fd-button fd-button-${O.style??"secondary"}`,"data-node":O.id},...I(O.icon,O.label));return O.hotkey&&Hn(G,O.hotkey,O.label),_(G,O.colspan),G.addEventListener("click",()=>{j(G,()=>K.runAction(O.id))}),dt(G,O.id),C(O,G)}function ct(O,G=!1){let de=O.style??"paragraph",pe=ka(r,ue.fields,O.text,l),Oe=G?R("span",{class:`fd-oneline-words fd-text-${de}`,"data-node":O.id},...pe.nodes):de==="alert"?R("div",{class:`fd-alert fd-text-alert fd-tone-${O.tone??"info"}`,role:"status","data-node":O.id},R("span",{class:"fd-alert-message"},...pe.nodes)):R(de==="heading"?"h3":"p",{class:`fd-text-${de}`,"data-node":O.id},...pe.nodes);return _(Oe,O.colspan),dt(Oe,O.id),Ne(Le=>pe.update(Le.values)),Oe}function Be(O){let G=R("div",{class:"fd-slot","data-slot":O.name,"data-node":O.id}),de=n.slots?.[O.name]?.(G,{form:K,name:O.name});return de&&x.push(de),dt(G,O.id),G}function st(O,G,de){let pe=R("div",{class:"fd-grid"});if(G!==null&&(pe.style.setProperty("--fd-columns",String(gn(G))),gn(G)===12&&pe.setAttribute("data-twelfths",""),typeof G=="object"))for(let Oe of["medium","narrow"]){let Le=G[Oe];Le!==void 0&&(pe.setAttribute(`data-columns-${Oe}`,String(Le)),pe.style.setProperty(`--fd-columns-${Oe}`,String(Le)))}return pe.append(...O.map(Oe=>T(Oe,de))),pe}function we(O,G){let[de]=O.children;if(!G.arrangement||G.at==="tracks"||gn(O.columns)!==12||O.children.length<2||de?.type!=="field"||O.children.reduce((Le,ye)=>Le+(ye.colspan??1),0)>12)return null;let pe=ue.fields[de.field]?.type,Oe=pe?Dr(de,pe,G.inner.labels):"hidden";return Oe===void 0?"skin":Oe==="beside"?"beside":null}function Ue(O,G){let de=R("div",{class:"fd-field fd-oneline","data-node":O.id,"data-style":"inline","data-labels":G.labels});_(de,O.colspan);let pe=R("div",{class:"fd-oneline-row",role:"group"},...Vl(O.children).map(Le=>{let ye=Le.map(je=>T(je,{columns:1,onPage:!1,inline:!0,quiet:O.quiet??G.quiet,reason:O.readonlyReason??G.reason}));return ye.length===1?ye[0]:R("span",{class:"fd-oneline-pair"},...ye)}));if(O.title){let Le=R("span",{class:"fd-label",id:Se(`${O.id}-label`)},O.title);pe.setAttribute("aria-labelledby",Le.id),de.append(Le)}de.append(pe),dt(de,O.id);let Oe=()=>de.toggleAttribute("data-in-quiet",O.quiet??G.quiet??P.getAttribute("data-fd-skin")==="quiet");return B.push(Oe),Oe(),de}function ve(O,G){if(O.style==="inline")return Ue(O,G);let de=Zi(O,G),pe=R(de.arrangement?"div":"fieldset",{class:"fd-section","data-node":O.id,"data-style":de.style,"data-place":de.at,"data-on-page":de.style==="card"&&G.onPage?"":void 0});_(pe,O.colspan);let Oe=we(O,de);Oe&&pe.setAttribute("data-row",Oe),O.labelWidth&&pe.style.setProperty("--fd-label-width",`${O.labelWidth}px`);let Le=O.description?R("p",{class:"fd-section-description"},O.description):null,ye=st(O.children,de.at==="tracks"?null:O.columns,de.inner);if(O.title&&O.collapsible){ye.id=Se(`${O.id}-content`);let je=R("button",{type:"button",class:"fd-section-toggle","aria-controls":ye.id},R("span",{class:"fd-section-chevron","aria-hidden":"true"}),...I(O.icon,O.title)),qe=O.collapsed!==!0,it=Ge=>{qe=Ge,je.setAttribute("aria-expanded",String(qe)),ye.hidden=!qe,Le&&(Le.hidden=!qe),pe.classList.toggle("fd-section-folded",!qe)};je.addEventListener("click",()=>it(!qe)),$.set(pe,()=>it(!0)),it(qe),pe.append(R("legend",{class:"fd-section-title"},je))}else O.title&&pe.append(R("legend",{class:"fd-section-title"},...I(O.icon,O.title)));return Le&&pe.append(Le),pe.append(ye),dt(pe,O.id),pe}function u(O,G){let de=R("div",{class:"fd-tabs","data-node":O.id});_(de,O.colspan);let pe=R("div",{class:"fd-tablist",role:"tablist"}),Oe=null,Le=O.children[0].id,ye=Ke=>{Oe=Le=Ke,Q(),K.shown(Ke)},je=O.children.map(Ke=>{let Rt=Se(`${Ke.id}-tab`),mt=Se(`${Ke.id}-panel`),It=R("button",{type:"button",class:"fd-tab",role:"tab",id:Rt,"aria-controls":mt,"data-node":Ke.id},...I(Ke.icon,Ke.label)),Dt=R("div",{class:"fd-tabpanel",role:"tabpanel",id:mt,"aria-labelledby":Rt}),yt=[],ot=!1,Nt=()=>{if(ot)return;ot=!0;let Fn=S;S=yt;try{Dt.append(st(Ke.children,1,{columns:1,onPage:G.onPage,labels:G.labels,quiet:G.quiet,reason:G.reason}))}finally{S=Fn}},tn=()=>!K.node(Ke.id).invisible&&(ye(Ke.id),!0);It.addEventListener("click",()=>ye(Ke.id)),W.has(Ke.id)||W.set(Ke.id,tn);let ur=L(Ke.children);if(N.root)for(let Fn of ur)z.has(Fn)||z.set(Fn,tn);return pe.append(It),{tab:Ke,button:It,panel:Dt,own:yt,build:Nt,fields:ur}});pe.addEventListener("keydown",Ke=>{let Rt=je.filter(ot=>!ot.button.hidden),mt=Rt.findIndex(ot=>ot.tab.id===Le),It={ArrowRight:1,ArrowLeft:-1,Home:-mt,End:Rt.length-1-mt}[Ke.key];if(It===void 0||mt===-1)return;Ke.preventDefault();let Dt=P.getAttribute("dir")==="rtl"&&(Ke.key==="ArrowRight"||Ke.key==="ArrowLeft"),yt=Rt[(mt+(Dt?-It:It)+Rt.length)%Rt.length];ye(yt.tab.id),yt.button.focus()});let qe=Tl(pe,R);x.push(qe.destroy),de.append(qe.element,...je.map(Ke=>Ke.panel));let it="",Ge="";return Ne(Ke=>{let Rt=K.node(O.id).invisible;nt(de,Rt);let mt=je.filter(ot=>!K.node(ot.tab.id).invisible);Oe!==null&&mt.some(ot=>ot.tab.id===Oe)?Le=Oe:mt.length&&(Le=mt[0].tab.id);let Dt=K.getState().errors;for(let ot of je){let Nt=ot.tab.id===Le;if(nt(ot.button,!mt.includes(ot)),ut(ot.button,"aria-selected",String(Nt)),ot.button.tabIndex!==(Nt?0:-1)&&(ot.button.tabIndex=Nt?0:-1),ut(ot.button,"data-problem",ot.fields.some(tn=>Dt[tn])?"":null),nt(ot.panel,!Nt),Nt&&!Rt){ot.build();for(let tn of ot.own)tn(Ke)}}let yt=mt.map(ot=>ot.tab.id).join(" ");if(yt!==it&&(it=yt,qe.measure()),Le!==Ge&&pe.clientWidth){Ge=Le;let ot=je.find(Nt=>Nt.tab.id===Le);ot&&qe.reveal(ot.button)}}),de}function L(O){return O.flatMap(G=>G.type==="field"?[G.field]:G.type==="section"?L(G.children):G.type==="tabs"?G.children.flatMap(de=>L(de.children)):[])}function T(O,G){return C(O,q(O,G))}function C(O,G){return O.hideOn?.length&&(G.dataset.hideOn=O.hideOn.join(" ")),G}function q(O,G){switch(O.type){case"field":return Re(O,G.labels,G);case"button":return Qe(O);case"text":return ct(O,G.inline);case"slot":return Be(O);case"section":return ve(O,G);case"tabs":return u(O,G);case"divider":case"spacer":case"image":return ee(O);case"form":return Fe(O,G);case"map":return Z(O)}}function Z(O){if(!n.maps)return F||console.warn("[Fieldia] This page has a map: give the viewer `maps` (mapParts from @fieldia/map) to draw it."),F=!0,R("div",{class:"fd-map-part","data-node":O.id,hidden:""});let G=n.maps({node:O,page:ue,form:K,document:r,locale:l,icons:n.icons});return G.element.classList.add("fd-map-part"),G.element.dataset.node=O.id,_(G.element,O.colspan??12),Ne(de=>G.update(de)),G.destroy&&x.push(()=>G.destroy?.()),dt(G.element,O.id),G.element}function ee(O){let G=O.type==="divider"?R("hr",{class:"fd-divider","data-node":O.id}):O.type==="spacer"?R("div",{class:"fd-block fd-spacer","aria-hidden":"true","data-node":O.id}):$e(O);return O.type!=="divider"&&O.colspan&&G.style.setProperty("--fd-span",String(O.colspan)),dt(G,O.id),G}function $e(O){let G=R("img",{class:"fd-image",src:O.src,alt:O.alt,loading:"lazy"}),de=O.href&&/^(https?:\/\/|mailto:)/i.test(O.href)?O.href:void 0,pe=R("figure",{class:"fd-block fd-figure","data-node":O.id,"data-align":O.align},de?R("a",{href:de,target:"_blank",rel:"noopener noreferrer"},G):G,...O.caption?[R("figcaption",{class:"fd-caption"},O.caption)]:[]),Oe=typeof O.width=="number"?`${O.width}px`:O.width&&{small:"160px",medium:"320px",large:"480px",full:"100%"}[O.width];return Oe&&pe.style.setProperty("--fd-image-width",Oe),pe}function Fe(O,G){let de=R("fieldset",{class:"fd-section fd-form-part","data-node":O.id,"data-style":"card","data-on-page":G.onPage?"":void 0,"aria-busy":"true"});_(de,O.colspan);let pe=R("p",{class:"fd-form-part-note"},p.loading);de.append(pe),dt(de,O.id);let Oe=je=>{de.removeAttribute("aria-busy"),pe.textContent=je,pe.classList.add("fd-form-part-problem")},Le=je=>{if(J)return;if(!je)return Oe(A(p.formMissing,{page:O.page}));let qe=d(je),it=qe.title||je.id,Ge=N.chain.findIndex(yt=>yt.id===je.id);if(Ge!==-1)return Oe(A(p.formInItself,{page:it,chain:[...N.chain.slice(Ge).map(yt=>yt.title),it].join(" \u2192 ")}));if(je.layout.type!=="sections"&&je.layout.type!=="tabs")return Oe(A(p.formNotPlaceable,{page:it}));let Ke=yr(qe),Rt;try{if(!Ke.ok)throw new Error(Ke.issues.map(yt=>`${yt.path}: ${yt.message}`).join("; "));Rt=K.embed(O.id,qe)}catch(yt){return console.warn(`Fieldia: the saved form "${je.id}" cannot be shown: ${yt.message}`),Oe(A(p.formBroken,{page:it}))}let mt=O.title??qe.title??"";de.setAttribute("data-title",mt),mt&&de.prepend(R("legend",{class:"fd-section-title"},...I(void 0,mt)));let It=Ve({root:!1,form:Rt,page:qe,prefix:`${N.prefix}${O.id}-`,chain:[...N.chain,{id:je.id,title:it}],locked:()=>N.locked()||K.node(O.id).readonly,path:`${N.path}${O.name}.`}),Dt=qe.layout;pe.replaceWith(It.grid(Dt.type==="tabs"?[Dt]:Dt.children,1,{columns:1,onPage:!1,labels:G.labels,quiet:G.quiet})),de.removeAttribute("aria-busy"),x.push(Rt.subscribe(Q)),X&&Q()},ye;try{ye=Ir(n,O.version===void 0?{id:O.page}:{id:O.page,version:O.version})}catch{ye=null}return ye instanceof Promise?ye.then(Le,()=>Le(null)):Le(ye),de}return{item:T,grid:st,fieldItem:Re,buttonItem:Qe,hideWhen:dt,slotItem:Be}}let{item:Ie,grid:Ee,fieldItem:Me,buttonItem:ie,hideWhen:ge,slotItem:oe}=Ve({root:!0,form:g,page:s,prefix:"",chain:[{id:s.id,title:s.title||s.id}],locked:()=>!1,path:""}),ke=n.readonly===!0,De=n.editSwitch?R("button",{type:"button",class:"fd-button fd-edit-switch"}):null;De?.addEventListener("click",async()=>{if(ke)ke=!1;else{if(g.getState().dirty.length&&!await g.save()){g.getState().saveProblem||ae(fe(g.getState())),be();return}ke=!0}P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),en(g.getState())}),P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),v.push(()=>{De&&(De.textContent=ke?p.edit:p.done,De.classList.toggle("fd-button-primary",ke))});let xe=R("div",{class:"fd-status",role:"status","aria-live":"polite"}),Xe=R("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},p.retry);Xe.addEventListener("click",()=>{Zt()});let Y=R("div",{class:"fd-status-box"},xe,Xe),ne=()=>s.data.kind==="responses"?p.notSent:p.notSaved;function fe(N){let K=[...P.querySelectorAll(".fd-field[data-path]")],ue=[];for(let Ne of Object.keys(N.errors)){let Re;for(let Qe=Ne;Qe&&!Re;Qe=Qe.slice(0,Math.max(0,Qe.lastIndexOf("."))))Re=K.find(ct=>ct.getAttribute("data-path")===Qe&&!ct.hidden);let bt=Ne.split(".")[0],lt=Re?.querySelector(":scope > .fd-label")?.firstChild?.textContent??s.fields[bt]?.label??bt,vt=Re?.closest(".fd-form-part")?.getAttribute("data-title"),dt=vt?`${lt} (${vt})`:lt;ue.some(Qe=>Qe.name===dt)||ue.push({name:dt,at:Re?K.indexOf(Re):1/0})}let Se=ue.sort((Ne,Re)=>Ne.at-Re.at).map(Ne=>Ne.name);return Se.length?A(p.checkFields,{what:ne(),fields:Se.join(", ")}):ne()}let U;v.push(N=>{let K=N.saveProblem,ue=N.status==="saving"?p.saving:N.status==="saved"?p.saved:N.status==="loading"?p.loading:N.status==="error"&&K?K.kind==="fields"?fe(N):K.kind==="other"?K.message:ne():N.status==="error"?N.error??"":"";ut(xe,"aria-live",N.status==="error"&&K?"off":"polite"),$t(xe,ue),nt(Xe,!(N.status==="error"&&K?.kind==="other")),xe.classList.toggle("fd-status-error",N.status==="error"),xe.classList.toggle("fd-status-saved",N.status==="saved"),n.saveStatus==="toast"&&(clearTimeout(U),Y.hidden=!ue,N.status==="saved"&&(U=setTimeout(()=>Y.hidden=!0,2500)))});let re=R("button",{type:"button",class:"fd-button fd-retry"},p.retry);re.addEventListener("click",()=>{Zt()});let Ce=R("div",{class:"fd-banner fd-tone-warning",role:"alert",hidden:""},R("span",{class:"fd-banner-text"},p.offline),re),Pe=R("div",{class:"fd-announce",role:"alert","aria-live":"assertive"});function ae(N){Pe.textContent="",setTimeout(()=>Pe.textContent=N,0)}let le=null;v.push(N=>{N.saveProblem!==le&&(le=N.saveProblem,Ce.hidden=le?.kind!=="network",le&&(le.kind==="rule"?cr(le.message,!1):le.kind==="fields"?ae(fe(N)):le.kind==="other"&&ae(le.message)))});let se=R("div",{class:"fd-draft",hidden:""}),ce=R("span"),me=R("button",{type:"button",class:"fd-button fd-button-primary"},p.restore),he=R("button",{type:"button",class:"fd-button fd-button-link"},p.discardDraft);me.addEventListener("click",()=>g.restoreDraft()),he.addEventListener("click",()=>g.discardDraft()),se.append(ce,me,he),v.push(N=>{nt(se,!N.draft),N.draft&&(ce.textContent=A(p.draftFound,{time:new Date(N.draft.savedAt).toLocaleString()}))});function be(){if(![...P.querySelectorAll('[aria-invalid="true"]')].find(Se=>!Se.closest(".fd-tabpanel[hidden]"))){let Se=g.getState().errors,Ne=[...z.keys()].find(Re=>Se[Re]);Ne&&z.get(Ne)?.()}let K=[...P.querySelectorAll('[aria-invalid="true"]')].find(Se=>!Se.closest(".fd-tabpanel[hidden]"))??null;if(!K)return;for(let Se=K.closest(".fd-section-folded");Se;Se=Se.parentElement?.closest(".fd-section-folded")??null)$.get(Se)?.();if(!K.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(K.matches("input, select, textarea, button")?K:K.querySelector("input, select, textarea, button"))?.focus()}let rt=R("div",{class:"fd-done",hidden:""},R("p",{class:"fd-done-title"},p.submitted)),ht=R("button",{type:"button",class:"fd-button"},p.submitAnother);rt.append(ht);let St=R("div",{class:"fd-content"});async function Zt(){if(!await g.save()){g.getState().saveProblem||ae(fe(g.getState())),be();return}s.data.kind==="responses"&&(St.hidden=!0,rt.hidden=!1)}ht.addEventListener("click",()=>{g.reset(),St.hidden=!1,rt.hidden=!0});function ar(){let N=g.getState();if(N.recordId==null)return"";let K=s.layout.type==="sheet"?s.layout.title?.field:void 0;return(K?At(s.fields[K],N.values[K],N.values,l):"")||s.title||""}function jr(N){if(s.data.kind!=="record")return null;let K=Ml({doc:r,el:R,form:g,toolbar:N,records:n.records,breadcrumbs:n.breadcrumbs,labels:p,icons:n.icons,uid:w,fill:A,withIcon:I,press:j,name:ar,render:Q,async leave(){if(!g.getState().dirty.length)return!0;let ue=await g.save();return ue||(g.getState().saveProblem||ae(fe(g.getState())),be()),ue}});return K?(v.push(K.update),x.push(K.destroy),K.element):null}function Qt(){if(!s.title&&!s.description)return null;let N=R("header",{class:"fd-page-head"});return s.title&&N.append(R("h1",{class:"fd-page-title"},s.title)),s.description&&N.append(R("p",{class:"fd-page-description"},s.description)),N}function _t(N){return!N?.length||n.showActions===!1?null:R("div",{class:"fd-actions fd-actions-end fd-page-footer"},Y,...N.map(ie))}function jt(N){let K=R("div",{class:"fd-sections","data-node":N.id},...N.children.map(Re=>Ie(Re,te(!0)))),ue=_t(N.footer);if(ue)return R("div",{},K,ue);let Se=R("button",{type:"submit",class:"fd-button fd-button-primary"},s.data.kind==="responses"?p.submit:p.save),Ne=R("div",{class:"fd-actions fd-actions-end"},Y,Se);if(s.data.kind==="record"){let Re=R("button",{type:"button",class:"fd-button"},p.discard);Re.addEventListener("click",()=>g.reset()),Ne.insertBefore(Re,Se),v.push(bt=>{let lt=bt.dirty.length>0&&bt.status!=="saving"&&!ke;nt(Se,!lt),nt(Re,!lt)})}else v.push(()=>nt(Se,ke));return De&&Ne.prepend(De),n.showActions===!1?R("div",{},K):s.actionsPosition==="top"?(Ne.classList.add("fd-actions-top"),R("div",{},Ne,K)):R("div",{},K,Ne)}function fn(N){let K=R("div",{class:"fd-wizard","data-node":N.id}),ue=R("div",{class:"fd-progress-text"}),Se=R("span");K.append(R("div",{class:"fd-progress"},ue,R("div",{class:"fd-progress-bar"},Se)));let Ne=N.clickable?R("ol",{class:"fd-steps-list"}):null,Re=new Map;if(Ne){for(let Be of N.children){let st=R("button",{type:"button",class:"fd-step-link"},...I(Be.icon,Be.label));st.addEventListener("click",()=>{g.goTo(Be.id)?ct():be()}),Re.set(Be.id,st),Ne.append(R("li",{},st))}K.append(R("nav",{class:"fd-steps","aria-label":p.steps},Ne))}let bt=N.children.map(Be=>{let st=R("section",{class:"fd-step","data-node":Be.id,"aria-labelledby":w(`${Be.id}-title`)});return st.append(R("h2",{class:"fd-step-title",id:w(`${Be.id}-title`)},...I(Be.icon,Be.label))),Be.description&&st.append(R("p",{class:"fd-section-description"},Be.description)),st.append(Ee(Be.children,1,te(!1))),K.append(st),{step:Be,panel:st}}),lt=R("button",{type:"button",class:"fd-button"},N.backLabel??p.back),vt=R("button",{type:"button",class:"fd-button fd-button-link"},p.skip),dt=R("button",{type:"submit",class:"fd-button fd-button-primary"});K.append(R("div",{class:"fd-wizard-nav"},lt,R("span",{class:"fd-spacer"}),Y,vt,dt)),lt.addEventListener("click",()=>{g.back()&&ct()}),vt.addEventListener("click",()=>{g.skip()&&ct()});let Qe=()=>{let Be=g.steps();return Be.indexOf(g.getState().step??"")===Be.length-1};Lt=async()=>{if(Qe())return Zt();g.next()?ct():be()};function ct(){bt.find(st=>st.step.id===g.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return v.push(Be=>{let st=g.steps(),we=Math.max(0,st.indexOf(Be.step??""));ue.textContent=A(p.stepOf,{n:we+1,total:st.length}),Se.style.width=`${(we+1)/Math.max(1,st.length)*100}%`;for(let{step:ve,panel:u}of bt)u.hidden=ve.id!==Be.step;let Ue=we===st.length-1;lt.hidden=we===0,vt.hidden=Ue||!N.children.find(ve=>ve.id===Be.step)?.optional,dt.textContent=Ue?N.finishLabel??p.submit:N.nextLabel??p.next;for(let[ve,u]of Re){let L=st.indexOf(ve);u.parentElement.hidden=L===-1,u.classList.toggle("fd-step-done",L!==-1&&L<we),u.classList.toggle("fd-step-skipped",Be.skipped.includes(ve)),ve===Be.step?u.setAttribute("aria-current","step"):u.removeAttribute("aria-current")}}),K}function eo(N){let K=R("div",{class:"fd-sheet-page","data-node":N.id}),ue=R("div",{class:"fd-actions"}),Se=R("button",{type:"submit",class:"fd-button fd-button-primary"},p.save),Ne=R("button",{type:"button",class:"fd-button"},p.discard);Ne.addEventListener("click",()=>g.reset());let Re=s.actionsPosition==="bottom",bt=R("div",{class:"fd-actions fd-actions-end fd-sheet-foot"}),lt=_t(N.footer);n.showActions===!1||lt?ue.append(...(N.buttons??[]).map(ie)):Re?(ue.append(...(N.buttons??[]).map(ie)),bt.append(Y,Ne,Se)):ue.append(Se,Ne,...(N.buttons??[]).map(ie),Y),De&&n.showActions!==!1&&ue.prepend(De),v.push(we=>{let Ue=we.dirty.length>0&&we.status!=="saving"&&!ke;Se.hidden=!Ue,Ne.hidden=!Ue});let vt=R("div",{class:"fd-header"},ue),dt=N.statusbar?.position==="title";N.statusbar&&!dt&&vt.append(un(N.statusbar));let Qe=R("div",{class:"fd-card"}),ct=[...N.ribbon?[N.ribbon]:[],...N.ribbons??[]];if(ct.length){let we=R("div",{class:"fd-ribbon-frame"}),Ue=ct.map(ve=>{let u=R("div",{class:`fd-ribbon fd-tone-${ve.tone??"muted"}`,"data-node":ve.id,title:ve.tooltip},ve.label);return we.append(u),{ribbon:ve,element:u}});v.push(ve=>{let u=!1;for(let{ribbon:L,element:T}of Ue){let C=!u&&!g.node(L.id).invisible;if(u||(u=C),nt(T,!C),!C)continue;let q=L.labelField?At(s.fields[L.labelField],ve.values[L.labelField],ve.values,l):"";$t(T,q||L.label)}}),Qe.append(we)}if(N.statButtons?.length){let we=R("div",{class:"fd-stats"}),Ue=(ve,u)=>ve&&s.fields[ve]?At(s.fields[ve],u[ve],u,l):"";for(let ve of N.statButtons){let u=R("span",{class:"fd-stat-value"}),L=R("span",{class:"fd-stat-label"},ve.label),T=ve.secondField&&ve.secondLabel!==void 0?{value:R("span",{class:"fd-stat-value"}),label:R("span",{class:"fd-stat-label"},ve.secondLabel)}:null,C=kt(r,ve.icon,n.icons),q=T?R("span",{class:"fd-stat-words fd-stat-pair"},R("span",{class:"fd-stat-row"},L,u),R("span",{class:"fd-stat-row"},T.label,T.value)):R("span",{class:"fd-stat-words"},u,L),Z=ve.help?w(`${ve.id}-help`):void 0,ee=R("button",{type:"button",class:"fd-stat","data-node":ve.id,title:ve.help||void 0,"aria-describedby":Z},...C?[C,q]:[q]);Z&&we.append(R("span",{class:"fd-sr-only",id:Z},ve.help)),ee.addEventListener("click",()=>{j(ee,()=>g.runAction(ve.id))}),v.push($e=>{ee.hidden=g.node(ve.id).invisible;let Fe=$e.values,O=Ue(ve.unitField,Fe)||ve.unit||"",G=Ue(ve.field,Fe),de=Ue(ve.secondField,Fe);T?($t(u,G),$t(T.value,[de,O].filter(Boolean).join(" "))):$t(u,[[G,de].filter(Boolean).join(" / "),G||de?O:""].filter(Boolean).join(" ")),$t(L,Ue(ve.labelField,Fe)||ve.label)}),we.append(ee)}v.push(()=>{we.hidden=[...we.querySelectorAll(":scope > .fd-stat")].every(ve=>ve.hidden)}),Qe.append(we)}for(let we of N.alerts??[]){let Ue=ka(r,s.fields,we.message,l),ve=R("span",{class:"fd-alert-message"},...Ue.nodes),u=!1,L=R("div",{class:`fd-alert fd-tone-${we.tone??"info"}`,role:"status","data-node":we.id},ve);if(we.buttons?.length&&L.append(R("span",{class:"fd-alert-actions"},...we.buttons.map(T=>ie({...T,style:T.style??"link"})))),v.push(T=>{Ue.update(T.values);let C=we.messageField?T.values[we.messageField]:null,q=typeof C=="string"?C.trim():"";q?$t(ve,q):u&&ve.replaceChildren(...Ue.nodes),u=!!q}),we.dismissible){let T=!1,C=R("button",{type:"button",class:"fd-alert-close","aria-label":p.dismiss},"\xD7");C.addEventListener("click",()=>{T=!0,L.hidden=!0}),L.append(C),v.push(()=>{L.hidden=T||g.node(we.id).invisible})}else ge(L,we.id);Qe.append(L)}if(N.badges?.length){let we=R("div",{class:"fd-badges"});for(let Ue of N.badges){let ve=R("span",{class:`fd-badge fd-tone-${Ue.tone??"muted"}`,"data-node":Ue.id},...I(Ue.icon,Ue.label));ge(ve,Ue.id),we.append(ve)}v.push(()=>{we.hidden=[...we.children].every(Ue=>Ue.hidden)}),Qe.append(we)}if(N.title){let we=R("div",{class:"fd-title"});N.title.label&&we.append(R("label",{class:"fd-title-label",for:w("#title")},N.title.label)),N.title.above?.length&&we.append(R("div",{class:"fd-title-above"},...N.title.above.map(T=>Me(T))));let Ue=Me({type:"field",id:"#title",field:N.title.field,placeholder:N.title.placeholder,...N.title.placeholderWhen?{placeholderWhen:N.title.placeholderWhen}:{},...N.title.focus?{focus:!0}:{}}),ve=N.title.before??[],u=N.title.after??[];if(ve.length||u.length){Ue.classList.add("fd-title-name");let T=C=>{let q=Me(C);return q.classList.add("fd-title-side"),q};we.append(R("div",{class:"fd-title-line"},...ve.map(T),Ue,...u.map(T)))}else we.append(Ue);N.title.subtitleField&&we.append(Me({type:"field",id:"#subtitle",field:N.title.subtitleField})),N.title.below?.length&&we.append(R("div",{class:"fd-title-below"},...N.title.below.map(T=>Me(T))));let L=R("div",{class:"fd-title-row"},we);if(N.title.avatarField){let T=Me({type:"field",id:"#avatar",field:N.title.avatarField});T.classList.add("fd-avatar"),L.append(T)}Qe.append(L)}N.statusbar&&dt&&Qe.append(R("div",{class:"fd-title-statusbar"},un(N.statusbar))),Qe.append(Ee(N.children,1,te(!1))),lt&&Qe.append(lt),Re&&n.showActions!==!1&&(Qe.append(bt),v.push(we=>{bt.hidden=we.dirty.length===0&&!xe.textContent}));let Be=R("div",{class:"fd-sheet-layout"},Qe);if(N.attachmentPreview){let we=Nl({doc:r,el:R,form:g,page:s,node:N.attachmentPreview,dataSource:n.dataSource,labels:p,fill:A});Be.classList.add("fd-has-preview"),Be.append(we.element),v.push(we.update),x.push(we.destroy)}N.sidePanel&&(Be.classList.add("fd-has-side"),N.sidePanelBeside&&Be.setAttribute("data-side-beside",N.sidePanelBeside),Be.append(R("aside",{class:"fd-side"},oe(N.sidePanel))));let st=jr(N.toolbar);return K.append(...st?[st]:[],vt,Be),K}function un(N){let K=s.fields[N.field],ue={clickable:N.clickable===!0};N.visibleStates&&(ue.visibleStates=N.visibleStates);for(let Re of["durationsField","fold","saves"])N[Re]!==void 0&&(ue[Re]=N[Re]);let Se={type:"field",id:"#statusbar",field:N.field,widget:"statusbar",options:ue},Ne=Ot({form:g,name:N.field,field:K,node:Se,id:w("statusbar"),document:r,labels:m,preferences:f,locale:l,dialogs:c},n.widgets);return Ne.destroy&&x.push(()=>Ne.destroy?.()),v.push(Re=>{nt(Ne.element,g.node("#statusbar").invisible),Ne.update({value:Re.values[N.field],values:Re.values,readonly:g.node("#statusbar").readonly||ke,required:!1,invalid:!1})}),Ne.element}let Lt=null,Et=s.layout,pn;if(Et.type==="sheet")pn=eo(Et);else if(Et.type==="wizard")pn=fn(Et);else if(Et.type==="tabs")pn=jt({id:`${Et.id}-page`,children:[Et]});else if(Et.type==="list"){let N=Fl({page:s,node:Et,form:g,dataSource:n.dataSource,doc:r,el:R,labels:p,locale:l,fill:A,press:j,withIcon:I,uid:w,icons:n.icons,preferences:f,onOpenRecord:n.onOpenRecord,...n.listFilter?{fixedFilter:n.listFilter}:{},...n.listViews?{views:n.listViews}:{}});x.push(N.destroy),pn=N.element}else pn=jt(Et);let Rn=Et.type==="sheet"?null:Qt(),zn=Et.type==="sections"||Et.type==="tabs"?jr(void 0):null;St.append(...zn?[zn]:[],...Rn?[Rn]:[],Ce,se,pn),P.append(St,rt,Pe),n.saveStatus==="toast"?(Y.classList.add("fd-toast"),P.append(Y)):n.saveStatus==="bar"&&(Y.classList.add("fd-status-bar"),St.prepend(Y)),P.addEventListener("mouseover",N=>{let K=N.target;if(K.tagName!=="INPUT"||!K.classList.contains("fd-input")||K.title&&!K.hasAttribute("data-cut-title"))return;let ue=K.scrollWidth>K.clientWidth&&K.value!=="";ut(K,"title",ue?K.value:null),ut(K,"data-cut-title",ue?"":null)}),P.addEventListener("submit",N=>{N.preventDefault(),Et.type!=="list"&&(Lt?Lt():Zt())});function to(){let N=r.activeElement;N&&P.contains(N)&&(N.tagName==="INPUT"||N.tagName==="TEXTAREA")&&N.dispatchEvent(new Event("change",{bubbles:!0}))}function no(N){let K=[...P.querySelectorAll(".fd-field")].filter(Ne=>!Ne.closest('[hidden], [data-type="one2many"] .fd-field, .fd-form-dialog')&&!Ne.parentElement?.closest('[data-type="one2many"]')),ue=N.closest(".fd-field"),Se=K.slice(K.indexOf(ue)+1);for(let Ne of Se){let Re=Ne.querySelector('input:not([type="hidden"]):not([readonly]):not([disabled]), select:not([disabled]), textarea:not([readonly]), [contenteditable="true"]');if(Re)return Re}return null}P.addEventListener("keydown",N=>{if(N.isComposing||N.key!=="Enter"||Et.type==="list"||N.target.closest(".fd-slot"))return;let K=n.keys??{};if(N.ctrlKey||N.metaKey){if(K.saveWithCtrlEnter===!1||n.showActions===!1||N.target.closest(".ag-root-wrapper"))return;N.preventDefault(),to(),Lt?Lt():Zt();return}let ue=N.target,Se=ue.getAttribute("aria-multiline")==="false";N.defaultPrevented&&!Se||!K.enterMovesToNext||N.shiftKey||N.altKey||ue.tagName!=="INPUT"&&ue.tagName!=="SELECT"&&!Se||ue.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(ue.type)||(N.preventDefault(),no(ue)?.focus())});function Ut(N){let K=N instanceof Element?N.closest(".fd-form"):null;if(K)return K===P&&!P.querySelector(":scope > .fd-dialog-backdrop");let ue=[...r.querySelectorAll('[aria-modal="true"]')].filter(Ne=>!Ne.closest("[hidden]"));return(ue[ue.length-1]??r).querySelector(".fd-form")===P}let sr=N=>{if(N.key==="Alt"){Ut(N.target)&&P.setAttribute("data-hotkeys","");return}let K=Ji(N);if(!K||!Ut(N.target))return;let ue=[...P.querySelectorAll(`button[data-hotkey="${K}"]`)].find(Se=>Se.closest(".fd-form")===P&&!Se.closest("[hidden]")&&!Se.disabled&&!Se.hasAttribute("aria-busy"));ue&&(N.preventDefault(),P.removeAttribute("data-hotkeys"),ue.click())},dr=()=>P.removeAttribute("data-hotkeys"),lr=N=>N.key==="Alt"&&dr();r.addEventListener("keydown",sr),r.addEventListener("keyup",lr),r.defaultView?.addEventListener("blur",dr),x.push(()=>{r.removeEventListener("keydown",sr),r.removeEventListener("keyup",lr),r.defaultView?.removeEventListener("blur",dr)});function cr(N,K=!0){return new Promise(ue=>{let Se=R("p",{id:`${h}-confirm`},N),Ne=R("button",{type:"button",class:"fd-button"},p.cancel),Re=R("button",{type:"button",class:"fd-button fd-button-primary"},p.ok),bt=R("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":Se.id},Se,R("div",{class:"fd-actions fd-actions-end"},...K?[Ne,Re]:[Re])),lt=R("div",{class:"fd-dialog-backdrop"},bt),vt=P.ownerDocument,dt=vt.activeElement,Qe=ct=>{lt.remove(),((we=>!!we&&we!==vt.body&&we.isConnected&&!we.closest("[hidden]"))(dt)?dt:P.querySelector('button[type="submit"]:not([hidden])'))?.focus(),ue(ct)};Ne.addEventListener("click",()=>Qe(!1)),Re.addEventListener("click",()=>Qe(!0)),lt.addEventListener("keydown",ct=>{ct.stopPropagation(),ct.key==="Escape"?(ct.preventDefault(),Qe(!1)):Gt(bt,ct)}),P.append(lt),Re.focus()})}function en(N){for(let K of v)K(N)}e.append(P);let Hr=g.subscribe(en);x.push(g.on("run",({result:N})=>{(N.reason==="cannot"||N.reason==="app"&&N.error!==void 0)&&k.say(N.message??"",N.reason==="app"?"danger":"warning")})),en(g.getState());function fr(){for(let N of B)N();X&&Q()}X=!0;let zr=!1;return V.length&&x.push(g.on("open",()=>{let N=!zr;zr=!0,queueMicrotask(()=>{if(J||!P.isConnected||P.closest("[hidden]")||typeof P.checkVisibility=="function"&&!P.checkVisibility())return;let K=r.activeElement;!(!K||K===r.body||K===r.documentElement)&&!(N&&P.contains(K))||V.find(Se=>!Se.wrapper.closest("[hidden]"))?.focus()})})),g.getState().status==="idle"&&g.load(),{form:g,element:P,setSkin(N){P.setAttribute("data-fd-skin",N),fr()},setTheme(N){N?P.setAttribute("data-fd-theme",N):P.removeAttribute("data-fd-theme"),P.setAttribute("data-fd-skin",Ln(n.skin??s.look?.skin,N??void 0)),fr()},setTokens(N){n.tokens=N??void 0,En(P,N)},async save(){let N=await g.save();return N||be(),N},check(){let N=g.validate();return N||be(),N},setReadonly(N){ke=N,P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),en(g.getState())},isReadonly:()=>ke,on:(N,K)=>{let ue=g.on(N,K);return x.push(ue),ue},setValues:N=>g.setValues(N),run:(N,K)=>g.run(N,K),destroy(){J=!0,Hr();for(let N of x)N();P.remove(),y&&g.dispose()}}}var Pl='input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea',Ou=e=>e==null||e===""||Array.isArray(e)&&!e.length;function Vu(e,t){return(t==="en"||t==="fr")&&/^\p{Lu}\p{Ll}/u.test(e)?e[0].toLocaleLowerCase(t)+e.slice(1):e}function Ol(e,t,n=Vt[t]){return/[?؟]\s*$/.test(e)?n.quietAnswer:n.quietHint.replace("{label}",Vu(e,t))}var Iu=new Set(["boolean","one2many","binary","image","html","json","properties"]);function Du(e){return e.replace(/\s+([^\p{L}\p{N}\s]{1,3})$/u,"\xA0$1")}function Vl(e){let t=[],n=0;for(;n<e.length;){let r=[e[n]],i=e[n].type==="field";if(!i&&e[n].type==="text"&&e[n+1]?.type==="field"&&(r.push(e[++n]),i=!0),n++,i)for(;e[n]?.type==="text"&&e[n+1]?.type!=="field";)r.push(e[n++]);t.push(r)}return t}function Qi(e,t){Tt[e]={...Tt.en,...t.messages},Ze[e]={...Ze.en,...t.widgets},Vt[e]={...Vt.en,...t.viewer}}var Wu="0.19.1",Il=globalThis;for(let[e,t]of Il.FieldiaLanguages??[])Qi(e,t);delete Il.FieldiaLanguages;return Jl(ju);})();
|
|
65
65
|
//# sourceMappingURL=fieldia.js.map
|