@fieldia/viewer 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/fieldia.ar.js +2 -2
- package/bundle/fieldia.de.js +2 -2
- package/bundle/fieldia.fr.js +2 -2
- package/bundle/fieldia.js +10 -10
- package/bundle/fieldia.js.map +3 -3
- package/package.json +3 -3
- package/src/lib/list.d.mts +5 -1
- package/src/lib/list.d.ts +5 -1
- package/src/lib/list.js +9 -1
- package/src/lib/list.js.map +1 -1
- package/src/lib/list.mjs +9 -1
- package/src/lib/list.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 Zd=Object.getOwnPropertyDescriptor;var Qd=Object.getOwnPropertyNames;var el=Object.prototype.hasOwnProperty;var tl=(e,t,n)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var nl=(e,t)=>{for(var n in t)Nr(e,n,{get:t[n],enumerable:!0})},rl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qd(t))!el.call(e,i)&&i!==n&&Nr(e,i,{get:()=>t[i],enumerable:!(r=Zd(t,i))||r.enumerable});return e};var il=e=>rl(Nr({},"__esModule",{value:!0}),e);var Wt=(e,t,n)=>tl(e,typeof t!="symbol"?t+"":t,n);var qf={};nl(qf,{ADDRESS_PARTS:()=>Xr,BROWSER_HOTKEYS:()=>jr,DEFAULT_LABELS:()=>Ld,DRAWN_IN_CELLS:()=>sc,FIELDIA_CSS:()=>xd,FIELD_NAME:()=>Dn,FIELD_TYPES:()=>Cr,FIRST_FIELD:()=>Sr,FORMAT_VERSION:()=>Or,FORM_WIDTHS:()=>Qc,HOTKEY:()=>ga,ICONS:()=>ys,MESSAGES:()=>Et,PART_LOOKS:()=>ta,THEMES:()=>ea,THEME_SKINS:()=>Bo,TOKEN_NAMES:()=>qo,VERSION:()=>Bf,VIEWER_LABELS:()=>It,WIDGET_LABELS:()=>tt,accentShades:()=>kr,addLanguage:()=>Ii,applyLook:()=>Nn,binaryWidget:()=>hr,browserPreferences:()=>Do,builtInWidgets:()=>dd,cellText:()=>Tn,charTagsWidget:()=>ao,checkPage:()=>sr,checkValue:()=>bn,compileModifier:()=>rt,contrast:()=>Mn,countriesIn:()=>Lo,createForm:()=>ei,createMemoryDataSource:()=>Oa,createWidget:()=>Ot,currencyOf:()=>Un,dayOf:()=>mn,describeTypes:()=>cr,detailLines:()=>ai,displayValue:()=>St,distributionIds:()=>gs,distributionModel:()=>co,distributionWords:()=>di,drawIcon:()=>wt,emptyValue:()=>Rn,evaluateModifier:()=>ya,expressionContext:()=>hn,facetsToFilter:()=>fr,fileProblem:()=>lr,fileShown:()=>go,fill:()=>Je,fillValues:()=>ma,focusField:()=>Ci,formatBytes:()=>en,formatMoney:()=>$n,formatNumber:()=>gt,formatPlain:()=>oo,groupByFields:()=>Gr,hostScheduler:()=>ur,hotkeyWords:()=>Hn,htmlWidget:()=>xo,imageWidget:()=>mo,initialValues:()=>gn,installListStyles:()=>Pi,installStyles:()=>Io,isEmpty:()=>Kt,isModifierValid:()=>va,isRightToLeft:()=>qr,isoWeek:()=>Ns,jsonProblem:()=>bi,jsonWidget:()=>wo,keepTabIn:()=>Gt,kindTextField:()=>ks,labelPlace:()=>Rr,labelWidget:()=>yr,lineForm:()=>li,lineKind:()=>pt,linesWidget:()=>uo,linkAddress:()=>Ps,linkAvatar:()=>_n,linkCheckboxesWidget:()=>so,localizePage:()=>dr,many2oneWidget:()=>gr,matchesFilter:()=>qn,memoryPreferences:()=>tf,mountViewer:()=>Lr,normalizeNumber:()=>Jt,onelineRuns:()=>Jd,openFormDialog:()=>Xn,openFormPanel:()=>_o,openLineDialog:()=>ci,openSearchDialog:()=>Uo,ownCurrency:()=>Ss,pageWords:()=>ba,planSection:()=>Vi,progressbarWidget:()=>br,propertiesWidget:()=>yo,readFile:()=>ui,readText:()=>Ho,readsAsText:()=>Wo,referenceWidget:()=>lo,rolesAllow:()=>En,sanitizeHtml:()=>vo,saveProblemOf:()=>Ur,saveRefused:()=>Ma,scoreOf:()=>Ta,skinFor:()=>xn,splitValues:()=>Wn,statusbarWidget:()=>mi,suggestions:()=>Jr,summary:()=>pi,tagsWidget:()=>si,translatePage:()=>zn,ungroup:()=>pr,valuesIn:()=>Hr,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 ea=["material","fluent","apple","bootstrap","shadcn","ant","odoo","google-forms"];var ta={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 ji=["id","user","editing","context"],zi=["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 ra(e,t,n){if(e==="+"&&(typeof t=="string"||typeof n=="string")){let r=na(t),i=na(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 na(e){return e==null?"":typeof e=="string"?e:bt(e)?String(e):null}function ia(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 oa(e){let t=e.args[0];return(t.type==="Identifier"?e.env.lines?.(t.name):void 0)??e.value(t)}function aa(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 sa(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 da(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 la(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=>la(e,!0)}],["max",{takes:[1,1/0],call:e=>la(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')":aa(e,2,"sum",`sum(lines, 'amount', "state == 'done'")`)},call(e){let t=oa(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 sa(e,t,2)){let o=n===void 0?i:i?.[n];bt(o)&&(r+=o)}return Zt(r)}}],["count",{takes:[1,2],check:e=>aa(e,1,"count",`count(lines, "state == 'done'")`),call(e){let t=oa(e);return t==null?0:Array.isArray(t)?sa(e,t,1).length:null}}],["days",{takes:[2,2],call({args:e,value:t}){let n=da(t(e[0])),r=da(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 ca(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 Bi=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]),ol=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:al(o[0]),value:o[0],position:t.length}),i=n.lastIndex}}function al(e){let t=e.toLowerCase().trim();return Bi.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":ol.has(e)?"ARITHMETIC":e===","?"COMMA":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var Ht=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(sl)}}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(ca(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:Bi.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:dl(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 sl(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 dl(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(fa(r.trim())),r=""):r+=s}return r.trim()&&n.push(fa(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function fa(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 ll(e,t,n);case"UnaryOp":return cl(e,t,n);case"Call":return fl(e,t,n);case"Literal":return e.value;case"Identifier":return pl(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function ll(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 ra(r,i,o);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function cl(e,t,n){let r=Ct(e.operand,t,n);switch(e.operator.toLowerCase()){case"not":return!Nt(r);case"-":return ia(r);default:throw new Error(`Unknown unary operator: ${e.operator}`)}}function fl(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(ul(i),o,n))})}var ua=new Map;function ul(e){let t=ua.get(e);return t||ua.set(e,t=new Ht(Qt(e)).parse()),t}function Pr(e){return e===void 0?null:e}function pl(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 pa(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 Ht(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 jt(e){let t=new Ht(Qt(e)).parse();return{source:e,fields:Vr(t),paths:Ir(t),wheres:Dr(t),sums:pa(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 Hr(e){return[...e.matchAll(qi)].map(t=>t[1])}function ma(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 ga=/^(shift\+)?[a-z0-9]$/,jr=["d","e","f"],Hn=e=>`Alt+${e.startsWith("shift+")?"Shift+":""}${e.slice(-1).toUpperCase()}`;var yt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ha=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),_i="text, numbers, yes or no, dates, choices and json can",ml=e=>{let t=e.map(n=>`"${n}"`);return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`},zr=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"&&jr.includes(r.replace("shift+",""))&&this.report(`${n}.hotkey`,`${Hn(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&&!ha.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{jt(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 Hr(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"?zi.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?ji.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"&&!zi.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)&&!ji.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=jt(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)&&!ha.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`:`${ml(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;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)}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].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, or myLocation"),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")})}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 jn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),gl=["sheet","sections","tabs","wizard"];function sr(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)||!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=jn(a)&&a.type==="list";if((!jn(a)||(s?!Array.isArray(a.columns):!gl.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 zr(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 hl=new Set(["title","description","label","help","placeholder","message","text","confirm","alt","caption","tooltip","unit"]),bl=new Set(["lineKinds","filter","default","data","translations","optionalColumns","values","into","params","map"]),yl=e=>t=>t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t;function Br(e,t,n,r,i=!1){if(typeof e=="string")return t!==null&&(t.endsWith("Label")||!i&&hl.has(t))?n(e):e;if(Array.isArray(e))return e.map(a=>Br(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(yl(n)):o[a]=bl.has(a)?s:Br(s,a,n,r,i||a==="options"&&!Array.isArray(s));return o}function zn(e,t){return Br(e,null,t)}function ba(e){let t=new Set,n=e.fields,r=(i,o=null)=>Br(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?zn(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 ya(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 Ht(n).parse(),o=Ct(i,t);return Nt(o)}catch{return!1}}function va(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=Qt(e);return t.length===0||new Ht(t).parse(),!0}catch{return!1}}var xa={};var vl={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:vl,...xa};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 wa=(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=>wa({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=>wa({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?xl(o,i):i}return n}function xl(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 wl(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&&kl(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 Sl(t,a)??Ui(e,t,i,r);case"datetime":return El(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=Sa(e.models.map(l=>l.label),r.or);return a("reference",{models:d,aModels:La(d)})}return}case"binary":case"image":return Rl(e,t,a,r);default:return}}function wl(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 kl(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 Sl(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 ka(n,r,i)?void 0:t("dateInvalid")}var Ll=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function El(e,t){let n=typeof e=="string"?Ll.exec(e):null;if(!n)return t("datetimeFormat");let[r,i,o,a,s,d]=n.slice(1).map(l=>Number(l??0));return ka(r,i,o)&&a<24&&s<60&&d<60?void 0:t("datetimeInvalid")}function ka(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 Rl(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(!Fl(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&&!Al(i,t.type)){let o=cr(i,n.or);return Je(n.fileType,{label:r,types:o,aTypes:La(o)})}}function Fl(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function Al(e,t){return e.some(n=>n.endsWith("/*")?t.startsWith(n.slice(0,-1)):n===t)}var $l="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 Tl(e){if(e.endsWith("/*"))return e.slice(0,-2);let t=e.split("/")[1]??e;return $l.find(([n])=>t.includes(n))?.[1]??t.toUpperCase()}function cr(e,t){return Sa([...new Set(e.map(Tl))],t)}function Sa(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function La(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 Ea=e=>Math.round(e*1e9)/1e9,Ra=(e,t)=>e.find(n=>n.value===t)?.score??0,Fa=e=>e.reduce((t,n)=>Math.max(t,n.score??0),0),Aa=e=>e.reduce((t,n)=>t+Math.max(0,n.score??0),0),$a=(e,t,n)=>n?Array.isArray(t)?t.reduce((r,i)=>r+Ra(e,i),0):0:Ra(e,t);function Ta(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+=$a(a.options,t[o],s),r+=s?Aa(a.options):Fa(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+=$a(a.columns,l[String(f.value)],s),r+=s?Aa(a.columns):Fa(a.columns)}return i?{score:Ea(n),max:Ea(r)}:null}function Ma(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=>Gi(e,n))}function Gi(e,t){return"any"in t?t.any.some(n=>Gi(e,n)):"all"in t?t.all.every(n=>Gi(e,n)):Nl(e,t)}function tn(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function Ml(e){return Array.isArray(e)?e.map(t=>t!==null&&typeof t=="object"&&"id"in t?t.id:t):[]}function Nl(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=Ml(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 Cl(e,n,i)}}var Ji=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Cl(e,t,n){if(!Ji(n))return!1;let r,i;if(typeof n.longitude=="string")r=t,i=e[n.longitude];else{let l=Ji(t)&&t.type==="Feature"?t.geometry:t,f=Ji(l)&&l.type==="Point"?l.coordinates:null;if(!Array.isArray(f))return!1;[i,r]=f}if(typeof r!="number"||typeof i!="number")return!1;if(Array.isArray(n.polygon))return Ol(i,r,n.polygon);if(Array.isArray(n.center)){let[l,f]=n.center;return Pl(r,i,f,l)<=n.radius}let{south:o,west:a,north:s,east:d}=n;return r<o||r>s?!1:a<=d?i>=a&&i<=d:i>=a||i<=d}function Ol(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 Pl(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 Bn=null;function Kr(e,t){let n=r=>{if("any"in r){let o=r.any.map(n);return o.includes(Bn)?Bn:{any:o}}if("all"in r){let o=r.all.map(n).filter(a=>a!==Bn);return o.length?{all:o}:Bn}let i=r.valueFrom!==void 0?Vl(t,r.valueFrom):r.value??null;return r.op==="=?"?tn(i)?{field:r.field,op:"=",value:i}:Bn:{field:r.field,op:r.op,value:i}};return e.map(n).filter(r=>r!==Bn)}function Vl(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 Na=new Set(["char","text","html"]),Ca=new Set(["integer","float","monetary"]),Il=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(Na.has(d.type)||Il.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(Ca.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 Na.has(d)?0:d==="selection"?1:Ca.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 Oa(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=Dl(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 Dl(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 Pa(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 Wl={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 Yi(e,t,n,r){let i=t.widget??"";if(e.type!=="char")return Pa(e,t,n,r);if(typeof n!="string"||!n.trim())return;let o=n.trim(),a=t.options??{},s=t.label??e.label,d=Wl[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 Va(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 zt(e,t,n){return{...Va(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??Va({},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 Ia(e){let t=new Map;for(let[r,i]of Object.entries(e))i.compute!==void 0&&t.set(r,jt(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 Da(e,t,n=()=>({recordId:null})){let r=Ia(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=Ia(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,zt(f,e.fields,n())),apply(d){let l=d,f=i.size?zt(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=>zt(c,e.fields,n())):l}}}function Wa(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:jt(r.value),...r.on?{on:r.on}:{}})))}var Hl={has:()=>!0};function Ha(e,t,n=()=>({recordId:null})){let r=Wa(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=Wa(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,zt(d,e.fields,n()),Fn(d,e.fields,t),"",l,f):d,v=i.size?zt(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,Hl).holding}}function ja(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 za(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=jl(a,e,n,i.now)??ql(a,i);d&&(o[s]=a.rule.message??Je(i.messages[d.say],{label:t,...d.values}))}return o}function jl({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=zl(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=_l(n,o,i);if(e.date==="past"&&s>=0)return{say:"datePast"};if(e.date==="future"&&s<=0)return{say:"dateFuture"}}}function zl(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 Bl=e=>e==null||typeof e=="string"&&!e.trim()||Array.isArray(e)&&!e.length;function ql({holds:e},t){if(!(!e||e.fields.some(n=>Bl(t.context[n]))))return e.evaluate(t.context,t.env)?void 0:{say:"holds"}}function _l(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 Ba=new Map;function Ul(e){let t=Ba.get(e);return t||Ba.set(e,t=jt(e)),t}function Xi(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]]):Ul(e).evaluate(t.context,t.env)}function qa(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 _a(e,t,n){let r={};for(let[i,o]of Object.entries(e)){let a=t[i];a&&(r[i]=qa(a,Xi(o,n),n))}return r}function Zi(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=Xi(i,t)??null;return n}function Qi(e,t){let n={};for(let[r,i]of Object.entries(e))i.defaultFrom!==void 0&&(n[r]=qa(i,Xi(i.defaultFrom,t),t));return n}function Ua(e){let t=eo(e.tones),n=rt(e.bold);return(r,i)=>({tone:to(t,r,i),bold:n.evaluate(r,i)})}var eo=e=>(e??[]).map(t=>({tone:t.tone,when:rt(t.when)})),to=(e,t,n)=>e.find(r=>r.when.evaluate(t,n))?.tone??null;function Ka(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:eo(d.tones),bold:rt(d.bold)});let n=eo(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:to(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:to(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}),no=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),ro=e=>e instanceof Error?e.message:String(e);function Ja(e){let t=new Map,n=new Map,r=y=>{let R=t.get(y);return R||t.set(y,R=jt(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,H=C=>E(C)??s(w,C)??String(C);if(typeof A=="number"||typeof A=="string")return{id:A,label:H(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:H(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:ro(C),error:C}}if(!w.saved)return{reason:"closed"};if(y.into&&e.write(S(y.into,w)),!y.then)return null;let H=await L(y.then,R);return H.done?null:{reason:H.reason,message:H.message,step:H.step,error:H.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={...Kl(E),id:k},w=[R.label,E.display_name,E.name].find(O=>typeof O=="string"&&O!==""),H=O=>O===k?w:void 0,C={};for(let[O,W]of Object.entries(y)){let D=l(O),I=o(W),z=I==="id"?k:I!==null&&!no.has(D.type)&&I in E?E[I]:r(W).evaluate(A,{today:e.today});C[O]=d(D,z,H)}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:ro(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,H]of Object.entries(k.values))w in e.fields&&(A[w]=d(e.fields[w],H));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]??""):Jl(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),H=e.recordId();return!w&&H!=null&&H!==E&&e.told({copied:H},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,!no.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 H=E.fields[A];if(!H)return c(`The lines of "${y.field}" have no field "${A}"`);k[A]=d(H,a(w,!no.has(H.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:ro(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 Kl(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 Ga(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 Jl(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]).replace(/\n/g,"<br>")}function ei(e){return Za(e,[]).form}var Ya=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),io=e=>e;function Za(e,t){let{page:n}=e,r=e.scheduler??ur,i=e.messages??Et.en,o=ec(n.layout),a=new Map;for(let u of o.values()){let F=u.source.validate;u.kind==="field"&&F&&a.set(u.id,ja(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:Ka(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,Ua(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)=>Xl(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?zt(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=Da(n,p,L),R=Ha(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 H(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,Qi(n.fields,O(N,n.fields,zt(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 z(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 j(u,F){if(!F){let _=ve(u);return _.type==="many2one"||_.type==="many2many"?_.createValues?Zi(_.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?{}:Zi(P.createValues,D(F.lines,N.values))}let V=y.apply(H()),B=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 xe(u){let F=T.values,N=T.errors;if(T={...T,...u},T.errors!==N)for(let P of k.values())P.inner.show(Gl(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(ye(`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(ye(`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]&&xe({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]&&xe({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 ue(u,F){let{list:N}=Ae(u),P=[...T.definitions[u]?.definitions??[],F];xe({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=zt(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 ve(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&&Xa(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 za(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)??Yi(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 Bt(){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)?z(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(Ya(N[P.name])?N[P.name]:{},F)}finally{w=!1}N={...N,[P.name]:io(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,B);if(B=P.holding,P.values===F)break;F=y.apply(P.values)}return F}function Dt(u){let F=y.apply(u);return B=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}),xe({values:P,dirty:it(P),errors:_,warnings:qt(P,Bt),...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):xe({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"||nc(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]=Zl($??[],Q??[]):_.type==="many2many"?u.links[P]=Ql($??[],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 ye("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??""};xe({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 xe({errors:F}),{reason:"save",message:Object.values(F)[0]};let N=e.dataSource;te={},xe({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(),xe({status:"saved"}),Ve("send",{values:Q}),ce(ye("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(_),xe({status:"saved",recordId:P.id,values:_,dirty:[],warnings:qt(_,Bt)}),Ve("save",{recordId:T.recordId,values:T.values}),ce(ye("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)}])),xe({status:"error",error:_.message,saveProblem:_,errors:{...Q}}),{reason:"save",message:_.message}}}async function nr(){Ve("open",{recordId:T.recordId,values:T.values}),await ye("on.open",n.on?.open,[],!0),ae=!0,re([])}function rr(u,F){let N=Object.keys(u);if(N.forEach(ve),!!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,Qi($,D(u,J))),P.lineDefaults&&Object.assign(J,_a(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(ve);let F=_t(),N=u?Object.fromEntries(Object.entries(F).filter(([_])=>u.some(Q=>_===Q||_.startsWith(`${Q}.`)))):F;xe({errors:N});let P=Object.values(N)[0];return P===void 0?null:{reason:"check",message:P}}function pe(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 we(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=ve(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){xe({status:"error",error:"This page has no data source to load from"});return}let N=++dt;xe({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"),xe({status:"ready",values:Le(V),dirty:[],errors:{},warnings:qt(V,Bt)}),u))return;er(),ce(nr())}catch(P){N===dt&&xe({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 xe({...F,recordId:u,status:"idle"}),Ze();dt++,V=Dt(H(!0,!1));let N=sn(Le(V),"start");xe({...F,recordId:null,status:"ready",values:N,warnings:qt(N,Bt)}),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=Ja({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:pe,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=>tc(ve(u),T.values[u])}),ye=Ga((u,F,N)=>we(F,{id:u,chain:N}));function Be(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 we(N,F)})())}let qe={page:n,getState:()=>T,subscribe(u){return Me.add(u),()=>Me.delete(u)},load:()=>ce(Ze()),setValue(u,F,N){ve(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,xe({}))},fieldReadonly:u=>Xa(ve(u)),loadChoices:ie,loadDefinitions:de,addDefinition:ue,problem(u){ve(u);let F=vt().filter(P=>P.field===u);return F.length?F.map(Qn).find(Boolean)??F.map(P=>Yi(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 xe({errors:u}),Object.keys(u).length===0},save:()=>ce(tr()),reset(){kn(),te={},B=R.holding(V);let u=sn(Le(V),"start");xe({values:u,dirty:[],errors:{},warnings:qt(u,Bt),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(je=>je.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(je=>je.values[_]),ee=Z.every((je,ze)=>typeof je=="number"&&(ze===0||je>Z[ze-1]));Q.splice(J,0,...Q.splice($,1));let se=Math.min($,J),be=Math.max($,J),Ue=ee?Z.slice(se,be+1):[],He=Q.map((je,ze)=>{let Ft=ee?ze>=se&&ze<=be?Ue[ze-se]:je.values[_]:ze+1;return Ft===je.values[_]?je:{...je,values:{...je.values,[_]:Ft}}});ot({...T.values,[u]:He}),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)&&!z(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(ve(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]?j(u):{}),canCreateLine:(u,F)=>Fe(Ye(u).fields[F])!==null,quickCreateLine:(u,F,N,P)=>Ne(Ye(u).fields[F],F,N,P?j(F,{lines:u,key:P}):{}),createValues:(u,F)=>j(u,F),steps:()=>S.filter(u=>!lt(u).invisible),next(){if(!T.step)return!1;T.skipped.includes(T.step)&&xe({skipped:T.skipped.filter(P=>P!==T.step)});let u=_t(T.step);if(Object.keys(u).length)return xe({errors:u}),!1;let F=qe.steps(),N=S.slice(st()+1).find(P=>F.includes(P));return N?(xe({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?(xe({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?(xe({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 xe({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 xe({step:Q,errors:$,skipped:_}),!1}}return xe({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`}:Be(N.source,{id:u,chain:[],...F?{recordIds:[...F.recordIds]}:{}})},async linkedValues(u,F,N){let P=ve(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)=>z(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(!z(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 Be(_,{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 Be(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(we(u,{id:F.id??"run",chain:[],...F.recordIds?{recordIds:[...F.recordIds]}:{}})),shown(u){S.includes(u)||ce(ye(`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(),xe({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],$=Za({page:{...F,data:{kind:"responses"}},dataSource:e.dataSource,values:Ya(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]:io(ee.values)}),Ut(P.name))});let J=io($.form.getState().values);T.dirty.includes(P.name)||(V={...V,[P.name]:J});let Z={...T.values,[P.name]:J};return xe({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:Bt()},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");xe({values:N,dirty:[],errors:{},warnings:qt(N,Bt),warning:null,warningField:null})},errorsNow:()=>_t(),show(u){JSON.stringify(u)!==JSON.stringify(T.errors)&&xe({errors:u})}}}function Gl(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 Yl(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 Xl(e,t,n){for(let r of n){let i=Yl(e[r.field],t[r.field]);if(i)return r.desc?-i:i}return 0}function Xa(e){return e.readonly===!0||e.compute!==void 0}function Zl(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 Ql(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 ec(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 tc(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 nc(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 Qa=new Map;function es(e,t){let n=`${e}:${t}`,r=Qa.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),Qa.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 ts(e){let t=es(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function oo(e,t,n="en"){return pr(gt(e,t,n),n)}function pr(e,t="en"){let{group:n}=ts(t);return e.split(n).join("")}function gt(e,t,n="en"){return es(n,t).format(e)}function Jt(e,t="en"){let{group:n,decimal:r}=ts(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 ns={};var rc={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:rc,...ns};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 ic=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",H=>H.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 H=v.get(A);if(H){H(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 H=S[g],C=H&&H!==f&&!v.has(H)?H.id:void 0,O=e.exclude?.()??new Set,W=w.filter(z=>!O.has(z.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(z=>z.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((z,j)=>[{id:`__more_${j}__`,label:z.label},z.act])),S=[...S,...v.keys()],g=C===void 0?-1:S.findIndex(z=>z.id===C),x(),L()},ic)}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 rs(e){let t=e.options??{};return{avatar:t.avatar===!0,details:t.details===!0,colors:t.colors===!0,opens:t.open!==!1}}function is(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=rs(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:is(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=rs(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:is(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,os(v,h,g,a,L=>e.setValue(t,f().filter(y=>y.id!==L.id)),S,l),m.setText(""))}}};function os(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 ao=({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;os(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()}}},so=({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()}}},lo=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 as=e=>String(e).padStart(2,"0");function ds(e){let t=Math.round(Math.abs(e)*60);return`${e<0&&t?"-":""}${as(Math.floor(t/60))}:${as(t%60)}`}function oc(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 ss=new Map;function ls(e,t,n){let r=`${e}:${t}:${n}`,i=ss.get(r);return i||(i=new Intl.NumberFormat(e,{style:n,numberingSystem:"latn",minimumFractionDigits:0,maximumFractionDigits:t}),ss.set(r,i)),i}function ac(e,t="en",n=2){return ls(t,n,"percent").format(e)}var cs=e=>e.type==="float"?e.digits?.[1]??2:2;function fs(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 us=e=>{let t=e.locale??"en";return fs(e,{show:ds,parse:n=>oc(n,t),inputMode:"text",className:"fd-duration"})},ps=e=>{let t=e.locale??"en",n=cs(e.field);return fs(e,{show:r=>ls(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 ms(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"?ds(n)+o:ac(n,r,cs(t))}var co=e=>typeof e?.model=="string"?e.model:"account.analytic.account";function gs(e){return[...new Set(fo(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 fo(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 fo=e=>e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).map(([t,n])=>[t,typeof n=="number"?n:Number(n)||0]):[],hs=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=co(r.options),c=new Map,v=H=>H.split(",").map(C=>c.get(C)??`#${C}`).join(" \xB7 "),m=H=>`${gt(H,Number.isInteger(H)?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 H={};for(let C of L)C.key&&(H[C.key]=C.share);t.setValue(n,L.some(C=>C.key)?H:null)}function E(H,C){let O=L.length,W=`${i}-${O}-${Math.random().toString(36).slice(2,7)}`,D={key:H,share:C},I={...t,getState:()=>({...t.getState(),values:{account:D.key?{id:D.key,label:v(D.key)}:null}}),setValue:(j,V)=>{let B=V;D.key=B?String(B.id):"",B&&c.set(String(B.id),B.label),R()},search:(j,V,B)=>t.search(n,V,B,{model:f}),canCreate:()=>!1},z={type:"many2one",label:l.account,relation:f};return D.account=gr({...e,form:I,name:"account",field:z,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 j=Jt(D.input.value.trim(),s);/^\d+\.?\d*$|^\.\d+$/.test(j)&&(D.share=Number(j),R())}),D.remove=d("button",{type:"button",class:"fd-line-delete","aria-label":l.deleteLine},"\xD7"),D.remove.addEventListener("click",()=>{L=L.filter(j=>j!==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 H=Math.max(0,100-L.reduce((O,W)=>O+W.share,0)),C=E("",Math.round(H*100)/100);L.push(C),S.append(C.element),w(),C.account.focus()});let k="";function A(H){let C=[...new Set(H.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 H=L.reduce((O,W)=>O+W.share,0);ft(g,m(Math.round(H*100)/100));let C=L.some(O=>O.key)&&Math.abs(H-100)>.001;ft(h,C?We(l.sharesOff,{n:m(Math.round(H*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(H=>H.account.destroy?.()),update(H){y=H.readonly;let C=fo(H.value);if(!(C.length===L.filter(W=>W.key).length&&C.every(([W,D],I)=>L.filter(z=>z.key)[I]?.key===W&&L.filter(z=>z.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 bs(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=bs(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=bs(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):ms(o.widget,e,t,r,o.options)??St(e,t,n,r,i)}var sc=new Set(["progressbar","priority","dot","color","timer","badge"]);var dc="http://www.w3.org/2000/svg",ys={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]??ys[t]:void 0;if(r===void 0)return null;let i=e.createElementNS(dc,"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 lc=new Set(["integer","float","monetary"]),vs=new Set(["boolean","integer","float","monetary","date","datetime"]),xs=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function ks(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 Ss(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,Ss(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 uo=({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=xs(m.min)??0,g=xs(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,H=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"},...H?[H]:[]));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`:vs.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 z=o.createElement("div");z.className="fd-lines-adds";let j=(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)}),z.append(U)};j(p("addLabel")??a.addLine,{},"line"),c&&(j(p("addSectionLabel")??a.addSection,{[c.field]:c.section??"section"},"section"),j(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))}),z.append(me),{id:X.id,button:me}}),B=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:""},B,...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]:[],z,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||!H)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,B.textContent=We(a.linesChosen,{n:w.size});for(let{id:re,button:me}of T)me.hidden=e.node(re).invisible;H.checked=X.length>0&&w.size===X.length,H.indeterminate=w.size>0&&w.size<X.length,H.disabled=ae||!X.length;for(let[re,me]of ke)me.pick&&(me.pick.checked=w.has(re),me.pick.disabled=ae)}H?.addEventListener("change",()=>{let X=ne().filter(re=>!pt(f,re.values));if(H.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 ve=fe.getBoundingClientRect();return ve.top+ve.height/2}),ue=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 ve=fe-me;if(!le){if(Math.abs(ve)<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(${ve}px)`;let it=Re.top+Re.height/2+ve;ue=de.filter(lt=>lt<it).length,Ae.forEach((lt,vt)=>{lt.style.transform=vt>=ie&&vt<ue?`translateY(${-Re.height}px)`:vt<ie&&vt>=ue?`translateY(${Re.height}px)`:""})},drop(){let fe=le&&ue!==ie;ge(),fe&&Te(re,ue)},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 xe(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}:{},ue={type:"field",id:`${r.id}.${re.key}.${me}`,field:me,...de},le=Ot({form:li(e,t,re.key),name:me,field:U,node:ue,id:Ae,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ce=o.createElement("td");ce.colSpan=ie,ce.dataset.column=me,vs.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?[xe(re,X,c.text,ks(f.fields[c.text],me),x.length)]:x.map(ge=>xe(re,X,ge,f.fields[ge])),de=o.createElement("td");de.className="fd-lines-tools";let ue=o.createElement("button");ue.type="button",ue.className="fd-line-delete",ue.textContent="\xD7",ue.setAttribute("aria-label",a.deleteLine),ue.addEventListener("click",()=>{let ge=ne().findIndex(ve=>ve.key===X.key),fe=ne()[ge]?.values??{};if(m.confirmDelete!==!0||Re.every(ve=>Kt(ve.def,fe[ve.name])||fe[ve.name]===!1))return e.removeLine(t,X.key);q.ask(We(a.removeAsk,{name:We(a.lineN,{n:ge+1})}),ve=>{ve&&e.removeLine(t,X.key);let it=ne(),lt=it[ve?Math.min(ge,it.length-1):ge];(lt?ke.get(lt.key)?.remove:z.querySelector("button"))?.focus()})});let le=new Map;for(let ge of me?[]:r.rowButtons??[]){let fe=wt(o,ge.icon),ve=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});ve.append(fe??ge.label),ve.addEventListener("click",async()=>{if(!ve.hasAttribute("aria-busy")){ve.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,ge.id,X.key)}finally{ve.removeAttribute("aria-busy")}}}),le.set(ge.id,ve),de.append(ve)}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 ve={...ge[fe].values};f.sequenceField&&delete ve[f.sequenceField];let it=e.addLine(t,ve);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(ve=>ve.key===X.key);fe&&ci(e,t,r,fe,d,ae)}),de.append(ge)}return de.append(ue),re.append(de),{element:re,kind:me,cells:Re,remove:ue,grip:U,buttons:le,pick:Ae,copy:ce}}return{element:L,focus:()=>(O.querySelector("input, select, textarea")??z.querySelector("button"))?.focus(),update(X){ae=X.readonly;let re=X.value??[];z.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,ue]of b)ue.hidden=U.has(de);for(let[de,ue]of I)ue.hidden=U.has(de);let ie=re.map(de=>de.key).join(" "),Ae=ie!==he;he=ie;for(let[de,ue]of Ae?b:new Map){if(r.cells?.[de]?.width)continue;let le=f.fields[de];if(ue.dataset.fit){if(!lc.has(le.type))continue;let fe=re.reduce((ve,it)=>pt(f,it.values)?ve:Math.max(ve,Tn(le,it.values[de],it.values,s).length),0);ue.style.setProperty("--fd-fit-need",`${fe+4}ch`);continue}let ce=re.reduce((fe,ve)=>pt(f,ve.values)?fe:Math.max(fe,Tn(le,ve.values[de],ve.values,s).length),0),ge=le.type==="many2one"?5:0;ue.style.width=`${Math.min(Math.max(ce,Math.min(le.label.length,10),6),32)+4+ge}ch`,ue.style.minWidth=`${Math.min(Math.max(ce,6),14)+4}ch`}let Re=new Set(re.map(de=>de.key));for(let[de,ue]of ke)Re.has(de)||(ue.element.remove(),ke.delete(de));re.forEach((de,ue)=>{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[ue]!==le.element&&O.insertBefore(le.element,O.children[ue]??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:ue+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),ws(le.element,"tone",ce?.tone),le.element.classList.toggle("fd-line-bold",!!ce?.bold);for(let[fe,ve]of le.buttons)ve.hidden=!ce?.buttons[fe];le.kind&&(le.cells[0].td.colSpan=x.length-U.size);for(let fe of le.cells){let ve=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,ws(fe.td,"tone",it?.tone),fe.td.classList.toggle("fd-cell-bold",!!it?.bold),fe.error.hidden=!ve,fe.error.textContent=ve??"",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:!!ve})}});for(let[de,ue]of D){let le=re.filter(ce=>!pt(f,ce.values)).reduce((ce,ge)=>ce+Number(ge.values[de]??0),0);ue.textContent=Tn(f.fields[de],le,re[0]?.values??{},s,X.values,r.cells?.[de])}for(let{id:de,button:ue}of V)ue.hidden=e.node(de).invisible;Me(),$e&&ke.has($e)&&(ke.get($e)?.cells[0]?.widget.focus(),$e=null)}}};function ws(e,t,n){n?e.dataset[t]=n:delete e.dataset[t]}var cc='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(cc)].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)}),Es=e=>(/\.(\w{1,5})$/.exec(e)?.[1]??"").toUpperCase();function fi(e){let t=`${e.type} ${Es(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 fc=e=>/^text\/|json|xml|csv/.test(e.type),po=e=>e.data?`data:${e.type};base64,${e.data}`:e.url??"",Rs=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Ls=(e,t)=>e("span",{class:"fd-file-icon","data-kind":fi(t),"aria-hidden":"true"},Es(t.name)||"?"),uc={cards:'<path d="M3 3h8v8H3zM13 3h8v8h-8zM3 15h8M13 15h8M3 19h5M13 19h5"/>',thumbnails:'<path d="M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"/>'},pc=(e,t)=>e("span",{class:"fd-file-name",dir:"auto",title:t},e("span",{},t.slice(0,-9)),t.slice(-9));function mc(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 Fs(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),H=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),z=m("div",{class:"fd-help fd-file-note",role:"status"}),j=(ae,he)=>{let ne=m("button",{type:"button","data-view":ae},wt(a,ae,uc),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},j("list",c.asList),j(h,h==="cards"?c.asCards:c.asThumbnails)):null,B=O||V?m("div",{class:"fd-file-bar"},...O?[O]:[],...V?[V]:[]):null,T=[A,H,...w.length?[C]:[]];k.append(...B?[B]:[],W,D,I.element,z);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}`,H.classList.toggle("fd-image-pick",he),he?W.after(...T):(B??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=>z.replaceChildren(...ae.map(he=>m("div",{},he))),Me=async ae=>{if(K||!ae.length)return;let he=[],ne=[],Te=0;for(let xe of ae){let Ve=lr(f,xe,v)??(S&&[...q,...he].some(X=>X.name===xe.name)?Je(c.alreadyAdded,{name:xe.name}):void 0);Ve?ne.push(Ve):(S?q.length:0)+he.length<g?he.push(xe):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((xe,Ve)=>Ve!==ne):null),Ce([Je(c.removed,{name:Pe.name})])),(W.querySelectorAll(".fd-file-remove")[Te?Math.min(ne,q.length-1):ne]??(H.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"&&po(ae)?m("img",{class:"fd-file-thumb",src:po(ae),alt:""}):Ls(m,ae)].map(ne=>te==="cards"?m("span",{class:"fd-file-picture"},ne):ne),(te==="cards"?mc:pc)(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"}),xe=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,xe,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"},Ls(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?Rs(ce.data):null;Te=ge?URL.createObjectURL(new Blob([ge],{type:ce.type})):ce.url??"",Pe.textContent=ce.name,xe.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(!fc(ce))return me.replaceChildren(Re(ce));let ve=m("pre",{tabindex:"0"});me.replaceChildren(ve),(ge?Promise.resolve(new TextDecoder().decode(ge.subarray(0,2e5))):fetch(Te).then(it=>it.text())).then(it=>ve.textContent=it.slice(0,2e5),()=>ve.replaceWith(Re(ce)))}let ue=()=>{Ae(),ie.remove(),(he.isConnected?he:W.querySelectorAll(".fd-file-open")[ae])?.focus()};re.addEventListener("click",ue),ie.addEventListener("click",le=>le.target===ie&&ue()),U.addEventListener("keydown",le=>{let ce={ArrowLeft:-1,ArrowRight:1}[le.key];le.key==="Escape"?ue():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")??(H.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(H,ne||K),Rt(C,K),A.disabled=K,A.hidden=H.hidden,Rt(D,S||!q.length||K),B&&Rt(B,!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=Fs("binary"),mo=Fs("image");function go(e,t){let n=fi(t);if(n!=="image"&&n!=="pdf")return null;let r=t.data?URL.createObjectURL(new Blob([Rs(t.data)],{type:t.type})):po(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 As=new Map;function $s(e,t){let n=As.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),As.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",$s(y,o)),g.textContent=v?$s(y,o):"",m.dataset.tone=c!=="auto"?c:y<30?"danger":y<70?"warning":"success",p?.update(h)}}};function Ts(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?Ts(c[m]):a("prefix"),p=S?Ts(c[S]):a("suffix");l.textContent=[g,v,p].filter(b=>b!=="").join(" ")}}};function gc(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,z=O==null?null:g(O),j=b.filter(q=>!f||f.some(oe=>g(oe)===q.key)||q.key===z);z&&!j.some(q=>q.key===z)&&O&&typeof O=="object"&&(j=[...j,{key:z,label:O.label,value:O,folded:!1}]);let V=v?j.filter(q=>q.folded&&q.key!==z):[];j=j.filter(q=>!V.includes(q));let B=j.map(q=>c?Number(D[p(q.value)]??0):0),T=JSON.stringify([j.map(q=>[q.key,q.label]),V.map(q=>q.key),B,z,W,k]);if(T===E)return;E=T;let te=j.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),B[oe]>0){let $e=o.createElement("small");$e.className="fd-step-time",$e.textContent=gc(B[oe],s),Me.title=a.timeInStep.replace("{time}",$e.textContent),Me.append($e)}q.key===z&&Me.setAttribute("aria-current","step");let ke=o.createElement("li");return ke.append(Me),ke});V.length&&te.push(H(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 H(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 z=o.createElement("span");z.textContent="\u22EF",z.setAttribute("aria-hidden","true"),I.append(z);let j=o.createElement("div");j.className="fd-step-menu",j.setAttribute("role","menu"),j.hidden=!k;for(let V of O){let B=o.createElement("button");B.type="button",B.setAttribute("role","menuitem"),B.textContent=V.label,B.disabled=W||!l,B.addEventListener("click",()=>{k=!1,A(V),w()}),j.append(B)}return I.addEventListener("click",()=>{k=!k,w(),k&&S.querySelector(".fd-step-menu button:not([disabled])")?.focus()}),j.addEventListener("keydown",V=>{V.key==="Escape"&&(V.stopPropagation(),k=!1,w(),S.querySelector(".fd-step-more > button")?.focus())}),D.append(I,j),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(z=>{I===y&&(b=z.map(j=>({key:g(j),label:j.label,value:j,folded:j.folded===!0})),w())}).catch(()=>{})}}}};function Ns(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 Ms=e=>String(e).padStart(2,"0"),ho=(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 bo(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[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[T,te]of Object.entries(V))B.setAttribute(T,te);p.append(B)}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(j){if(n==="date")r.setValue(i,`${j.getFullYear()}-${Ms(j.getMonth()+1)}-${Ms(j.getDate())}`);else{let V=bo("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())}I(),E.dispatchEvent(new CustomEvent("fd-picked",{bubbles:!0,detail:{value:r.getState().values[i]}}))}function H(j){let V=bo(n,r.getState().values[i]),B=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(Ns(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=ho(he,k)?0:-1,he.getMonth()!==k.getMonth()&&Te.classList.add("fd-outside"),V&&ho(he,V)&&Te.setAttribute("aria-selected","true"),ho(he,B)&&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),j&&R.querySelector('button[tabindex="0"]')?.focus()}function C(j){k=j,H(!0)}function O(j,V){let B={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)};B[j.key]?(j.preventDefault(),C(B[j.key]())):(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),w(V))}function W(){k=bo(n,r.getState().values[i])??new Date,b.hidden=!1,S.setAttribute("aria-expanded","true"),H(!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 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),H(!1)}),y.addEventListener("click",()=>{k=gi(k,1),H(!1)}),b.addEventListener("keydown",j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),I())});let z=j=>{!b.hidden&&!E.contains(j.target)&&(b.hidden=!0,S.setAttribute("aria-expanded","false"))};return a.addEventListener("mousedown",z),{element:E,focus:()=>e.focus(),update(j){A=j.readonly,S.hidden=j.readonly,j.readonly&&(b.hidden=!0),e.update(j)},destroy(){a.removeEventListener("mousedown",z),e.destroy?.()}}}var hc=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},Cs=e=>e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^(\d)/,"p_$1")||"property";function bc(e,t){let n=hc(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 yc=["char","text","integer","float","boolean","date"],yo=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 z=t.getState().values[n];return z&&typeof z=="object"&&!Array.isArray(z)?z:{}},S={...t,getState:()=>({...t.getState(),values:m()}),setValue:(z,j)=>t.setValue(n,{...m(),[z]:j})},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},...yc.map((z,j)=>l("option",{value:z},R[j]??z))),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 H=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 z=y.value.trim();if(!z)return y.focus();let j=new Set(W.map(B=>B.definition.name)),V=Cs(z);for(let B=2;j.has(V);B++)V=`${Cs(z)}_${B}`;H=V,C(),t.addDefinition(n,{name:V,label:z,type:E.value})};k.addEventListener("click",O),w.addEventListener("keydown",z=>{z.key==="Enter"&&z.target===y?(z.preventDefault(),O()):z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),C(),L.focus())});let W=[],D="";function I(z){for(let j of W)j.widget.destroy?.();W=z.map(j=>{let V=`${o}-${j.name}`,B={type:j.type,label:j.label,...j.options?{options:j.options}:{}},T={type:"field",id:`${i.id}.${j.name}`,field:j.name},te=Ot({...e,form:S,name:j.name,field:B,node:T,id:V});return{definition:j,widget:te}}),g.replaceChildren(...W.map(({definition:j,widget:V})=>{let B=a.createElement("div");B.className="fd-property",B.dataset.type=j.type;let T=a.createElement("label");return T.htmlFor=`${o}-${j.name}`,T.textContent=j.label,B.append(T,V.element),B}))}return v&&!t.getState().definitions[n]&&t.loadDefinitions(n),{element:p,focus:()=>(W[0]?.widget??{focus:()=>L.focus()}).focus(),destroy:()=>W.forEach(z=>z.widget.destroy?.()),update(z){let j=m(),V=v?t.getState().definitions[n]:void 0,B=v?V?.definitions??[]:c??Object.keys(j).map(te=>bc(te,j[te])),T=JSON.stringify(B);T!==D&&(D=T,I(B));for(let{definition:te,widget:Y}of W)Y.update({value:j[te.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,x&&(z.readonly&&C(),L.hidden=z.readonly||!w.hidden),H&&W.some(te=>te.definition.name===H)&&(W.find(te=>te.definition.name===H)?.widget.focus(),H=null)}}};function bi(e){let t=0,n=()=>{throw t},r=()=>{for(;t<e.length&&`
|
|
1
|
+
/*! Fieldia 0.17.0 · MIT · https://fieldia.dev */
|
|
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 _=ve(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,we=new Map,$e=[],ae=!1,he=null,ne=null,Te=[...e.user?.roles??[]],Pe={};function xe(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=we.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(ye(`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(ye(`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]&&xe({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]&&xe({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 ue(u,F){let{list:N}=Ae(u),P=[...T.definitions[u]?.definitions??[],F];xe({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 ve(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}),xe({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):xe({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 ye("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??""};xe({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 xe({errors:F}),{reason:"save",message:Object.values(F)[0]};let N=e.dataSource;te={},xe({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(),xe({status:"saved"}),Ve("send",{values:Q}),ce(ye("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(_),xe({status:"saved",recordId:P.id,values:_,dirty:[],warnings:qt(_,zt)}),Ve("save",{recordId:T.recordId,values:T.values}),ce(ye("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)}])),xe({status:"error",error:_.message,saveProblem:_,errors:{...Q}}),{reason:"save",message:_.message}}}async function nr(){Ve("open",{recordId:T.recordId,values:T.values}),await ye("on.open",n.on?.open,[],!0),ae=!0,re([])}function rr(u,F){let N=Object.keys(u);if(N.forEach(ve),!!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(ve);let F=_t(),N=u?Object.fromEntries(Object.entries(F).filter(([_])=>u.some(Q=>_===Q||_.startsWith(`${Q}.`)))):F;xe({errors:N});let P=Object.values(N)[0];return P===void 0?null:{reason:"check",message:P}}function pe(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 ke(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=ve(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){xe({status:"error",error:"This page has no data source to load from"});return}let N=++dt;xe({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"),xe({status:"ready",values:Le(V),dirty:[],errors:{},warnings:qt(V,zt)}),u))return;er(),ce(nr())}catch(P){N===dt&&xe({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 xe({...F,recordId:u,status:"idle"}),Ze();dt++,V=Dt(j(!0,!1));let N=sn(Le(V),"start");xe({...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 we.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:pe,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(ve(u),T.values[u])}),ye=Qa((u,F,N)=>ke(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 ke(N,F)})())}let qe={page:n,getState:()=>T,subscribe(u){return Me.add(u),()=>Me.delete(u)},load:()=>ce(Ze()),setValue(u,F,N){ve(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,xe({}))},fieldReadonly:u=>ts(ve(u)),loadChoices:ie,loadDefinitions:de,addDefinition:ue,problem(u){ve(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 xe({errors:u}),Object.keys(u).length===0},save:()=>ce(tr()),reset(){kn(),te={},z=R.holding(V);let u=sn(Le(V),"start");xe({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(ve(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)&&xe({skipped:T.skipped.filter(P=>P!==T.step)});let u=_t(T.step);if(Object.keys(u).length)return xe({errors:u}),!1;let F=qe.steps(),N=S.slice(st()+1).find(P=>F.includes(P));return N?(xe({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?(xe({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?(xe({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 xe({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 xe({step:Q,errors:$,skipped:_}),!1}}return xe({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=ve(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(ke(u,{id:F.id??"run",chain:[],...F.recordIds?{recordIds:[...F.recordIds]}:{}})),shown(u){S.includes(u)||ce(ye(`on.show.${u}`,n.on?.show?.[u],$e,!0))},on(u,F){let N=we.get(u);return N||we.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(),xe({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 xe({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(),we.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");xe({values:N,dirty:[],errors:{},warnings:qt(N,zt),warning:null,warningField:null})},errorsNow:()=>_t(),show(u){JSON.stringify(u)!==JSON.stringify(T.errors)&&xe({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=we.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 we)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 we=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 ve=fe.getBoundingClientRect();return ve.top+ve.height/2}),ue=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 ve=fe-me;if(!le){if(Math.abs(ve)<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(${ve}px)`;let it=Re.top+Re.height/2+ve;ue=de.filter(lt=>lt<it).length,Ae.forEach((lt,vt)=>{lt.style.transform=vt>=ie&&vt<ue?`translateY(${-Re.height}px)`:vt<ie&&vt>=ue?`translateY(${Re.height}px)`:""})},drop(){let fe=le&&ue!==ie;ge(),fe&&Te(re,ue)},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 xe(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}:{},ue={type:"field",id:`${r.id}.${re.key}.${me}`,field:me,...de},le=Ot({form:li(e,t,re.key),name:me,field:U,node:ue,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?[xe(re,X,c.text,Rs(f.fields[c.text],me),x.length)]:x.map(ge=>xe(re,X,ge,f.fields[ge])),de=o.createElement("td");de.className="fd-lines-tools";let ue=o.createElement("button");ue.type="button",ue.className="fd-line-delete",ue.textContent="\xD7",ue.setAttribute("aria-label",a.deleteLine),ue.addEventListener("click",()=>{let ge=ne().findIndex(ve=>ve.key===X.key),fe=ne()[ge]?.values??{};if(m.confirmDelete!==!0||Re.every(ve=>Kt(ve.def,fe[ve.name])||fe[ve.name]===!1))return e.removeLine(t,X.key);q.ask(We(a.removeAsk,{name:We(a.lineN,{n:ge+1})}),ve=>{ve&&e.removeLine(t,X.key);let it=ne(),lt=it[ve?Math.min(ge,it.length-1):ge];(lt?we.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),ve=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});ve.append(fe??ge.label),ve.addEventListener("click",async()=>{if(!ve.hasAttribute("aria-busy")){ve.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,ge.id,X.key)}finally{ve.removeAttribute("aria-busy")}}}),le.set(ge.id,ve),de.append(ve)}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 ve={...ge[fe].values};f.sequenceField&&delete ve[f.sequenceField];let it=e.addLine(t,ve);Kn(e,t,f,it,fe+1),we.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(ve=>ve.key===X.key);fe&&ci(e,t,r,fe,d,ae)}),de.append(ge)}return de.append(ue),re.append(de),{element:re,kind:me,cells:Re,remove:ue,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,ue]of b)ue.hidden=U.has(de);for(let[de,ue]of I)ue.hidden=U.has(de);let ie=re.map(de=>de.key).join(" "),Ae=ie!==he;he=ie;for(let[de,ue]of Ae?b:new Map){if(r.cells?.[de]?.width)continue;let le=f.fields[de];if(ue.dataset.fit){if(!fc.has(le.type))continue;let fe=re.reduce((ve,it)=>pt(f,it.values)?ve:Math.max(ve,Tn(le,it.values[de],it.values,s).length),0);ue.style.setProperty("--fd-fit-need",`${fe+4}ch`);continue}let ce=re.reduce((fe,ve)=>pt(f,ve.values)?fe:Math.max(fe,Tn(le,ve.values[de],ve.values,s).length),0),ge=le.type==="many2one"?5:0;ue.style.width=`${Math.min(Math.max(ce,Math.min(le.label.length,10),6),32)+4+ge}ch`,ue.style.minWidth=`${Math.min(Math.max(ce,6),14)+4}ch`}let Re=new Set(re.map(de=>de.key));for(let[de,ue]of we)Re.has(de)||(ue.element.remove(),we.delete(de));re.forEach((de,ue)=>{let le=we.get(de.key);le&&le.kind!==pt(f,de.values)&&(le.element.remove(),le=void 0),le||(le=Ve(de),we.set(de.key,le)),O.children[ue]!==le.element&&O.insertBefore(le.element,O.children[ue]??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:ue+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,ve]of le.buttons)ve.hidden=!ce?.buttons[fe];le.kind&&(le.cells[0].td.colSpan=x.length-U.size);for(let fe of le.cells){let ve=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=!ve,fe.error.textContent=ve??"",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:!!ve})}});for(let[de,ue]of D){let le=re.filter(ce=>!pt(f,ce.values)).reduce((ce,ge)=>ce+Number(ge.values[de]??0),0);ue.textContent=Tn(f.fields[de],le,re[0]?.values??{},s,X.values,r.cells?.[de])}for(let{id:de,button:ue}of V)ue.hidden=e.node(de).invisible;Me(),$e&&we.has($e)&&(we.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))),we()}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 xe of ae){let Ve=lr(f,xe,v)??(S&&[...q,...he].some(X=>X.name===xe.name)?Je(c.alreadyAdded,{name:xe.name}):void 0);Ve?ne.push(Ve):(S?q.length:0)+he.length<g?he.push(xe):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((xe,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 we(){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"}),xe=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,xe,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,xe.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 ve=m("pre",{tabindex:"0"});me.replaceChildren(ve),(ge?Promise.resolve(new TextDecoder().decode(ge.subarray(0,2e5))):fetch(Te).then(it=>it.text())).then(it=>ve.textContent=it.slice(0,2e5),()=>ve.replaceWith(Re(ce)))}let ue=()=>{Ae(),ie.remove(),(he.isConnected?he:W.querySelectorAll(".fd-file-open")[ae])?.focus()};re.addEventListener("click",ue),ie.addEventListener("click",le=>le.target===ie&&ue()),U.addEventListener("keydown",le=>{let ce={ArrowLeft:-1,ArrowRight:1}[le.key];le.key==="Escape"?ue():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),we())}}}}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 we=o.createElement("li");return we.append(Me),we});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 we=Yt(Y,Me),$e=a.createElement("th");$e.scope="col",$e.textContent=v.format(we).replace(/\.$/,""),$e.setAttribute("abbr",m.format(we)),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 we=a.createElement("tr"),$e=a.createElement("th");$e.scope="row",$e.className="fd-week",$e.textContent=String(Vs(Me)),we.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),we.append(ne)}Ce.append(we)}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&&`
|
|
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 vc=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),xc=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),wc=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),kc=new Set(["left","center","right","justify","start","end"]);function vo(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(xc.has(s.tagName)){s.remove();continue}if(r(s),!vc.has(s.tagName)){s.replaceWith(...s.childNodes);continue}let d=s.tagName==="A"?s.getAttribute("href"):null,l=wc.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&&kc.has(l)&&s.setAttribute("style",`text-align: ${l};`)}};r(n.content);let i=t.createElement("div");return i.append(n.content),i.innerHTML}function Ps(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 Os=[["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>']],xo=({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=vo(a.innerHTML,i);d=c,e.setValue(t,c.trim()===""?null:c)}),a.addEventListener("blur",()=>{a.innerHTML!==d&&(a.innerHTML=d)});let l=s?Sc(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=vo(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 Sc(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=Ps(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=Os.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=Os[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 wo=({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 Vs=new WeakMap;function Lc(e){let t=Vs.get(e);return t===void 0&&(t=Math.floor(Math.random()*4294967296)>>>0,Vs.set(e,t)),t}function Ec(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 Rc(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=Rc(Ec(Lc(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 Is=({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,Fc="#1b2a5c",Ac='"Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive',$c=e=>Math.floor(e.length*3/4)-(e.endsWith("==")?2:e.endsWith("=")?1:0),Tc=e=>e.data??e.url??"",Ds=({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:Fc,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},H=null,C=!1,O=null,W=[],D=null,I=()=>!W.length&&!O;function z(){let K=w();if(K){K.clearRect(0,0,Jn,vr),O&&(K.font=`italic 64px ${Ac}`,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++)j(q[oe-1],q[oe])}}}function j(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,z()}function B(){if(b.hidden=!I(),I())return H=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);H=q,e.setValue(t,{name:"signature.png",type:"image/png",size:$c(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,z())}),p.addEventListener("pointermove",K=>{if(!D)return;let q=T(K);j(D,q),W[W.length-1].push(q),D=q});let te=()=>{D&&(D=null,B())};p.addEventListener("pointerup",te),p.addEventListener("pointercancel",te),x.addEventListener("input",()=>{Y(),W=[],O=x.value.trim()||null,z(),B()}),y.addEventListener("click",()=>{W.pop(),z(),B()}),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(),H=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&&Tc(q)!==H){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,H=null,V(),oe&&(x.value=q.text??"")}else q||((H!==null||!h.hidden)&&(H=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 ko=({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 Ws=e=>js(e,!1),Hs=e=>js(e,!0);function js({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(z=>z.value===I)?.label??(I==null?"":String(I)),k=[],A=-1,w=!1;function H(){g.replaceChildren(...k.map((I,z)=>{let j=f("li",{id:`${m}-${z}`,role:"option",class:`fd-option${z===A?" fd-active":""}`,"aria-selected":String(z===A)},I.label);return j.addEventListener("mousedown",V=>V.preventDefault()),j.addEventListener("click",()=>W(I)),j})),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(),z=d&&I===E(L())?"":I.toLowerCase(),j=new Set(y());k=c.filter(V=>!j.has(V.value)&&V.label.toLowerCase().includes(z)),v&&z&&!j.has(I)&&!c.some(V=>V.label.toLowerCase()===z)&&k.push({value:I,label:We(l.createNamed,{name:I})}),A=-1,H(),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 z=I.key==="ArrowDown";A=A===-1?z?0:k.length-1:(A+(z?1:-1)+k.length)%k.length,H(),g.children[A]?.scrollIntoView?.({block:"nearest"});return}case"Enter":{let z=k[A]??(S.value.trim()?k[0]:void 0);if(g.hidden||!z)return;I.preventDefault(),W(z);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 z=Array.isArray(I.value)?I.value:[];S.hidden=w;let j=JSON.stringify([w,z]);j!==D&&(D=j,p.replaceChildren(...z.map(V=>{let B=E(V),T=f("li",{class:"fd-chip"},f("span",{class:"fd-chip-label"},B));if(!w){let te=f("button",{type:"button",class:"fd-chip-remove","aria-label":We(l.remove,{name:B})},"\xD7");te.addEventListener("click",()=>R(y().filter(Y=>Y!==V))),T.append(te)}return T})),g.hidden||C())}}}var Mc='<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>',zs=({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=Mc);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,H)=>{let C=E.has(v[H].value);w.setAttribute("aria-checked",String(C)),w.tabIndex=f||H===k?0:-1,w.disabled=L||A&&!C&&!v[H].exclusive}),y?.allow(R),y?.show(v.some(w=>E.has(w.value))),Xe(g,R)}}};var Nc=4,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=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"),z=l("span",{class:"fd-rank-grip","aria-hidden":"true"}),j=l("span",{class:"fd-rank-tools"},D,I),V=l("li",{class:"fd-rank-item","data-value":String(C.value)},z,W,l("span",{class:"fd-rank-words"},O),j),B={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,B],B));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!==B).map(Y=>Y.option.value))}),j.append(te),g.append(T),B.pick=T}return D.addEventListener("click",()=>k(B,-1,"up")),I.addEventListener("click",()=>k(B,1,"down")),V.addEventListener("pointerdown",T=>w(B,T)),B}),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 z=[...L];z.splice(D,1),z.splice(I,0,C),y=C.element.contains(o.activeElement)?{item:C,which:W==="up"&&I===0||W==="down"&&I===z.length-1?W==="up"?"down":"up":W}:null,E(z,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 z=V=>{if(!I&&Math.abs(V.clientY-W)<Nc)return;I||(I=!0,C.element.classList.add("fd-rank-lifted")),V.preventDefault();let B=L.filter(te=>te!==C),T=B.filter(te=>{let Y=te.element.getBoundingClientRect();return Y.top+Y.height/2<V.clientY}).length;L.indexOf(C)!==T&&R([...B.slice(0,T),C,...B.slice(T)])},j=()=>{C.element.removeEventListener("pointermove",z),C.element.removeEventListener("pointerup",j),C.element.removeEventListener("pointercancel",j),C.element.classList.remove("fd-rank-lifted"),L.some((V,B)=>V!==D[B])&&E(L,C)};C.element.addEventListener("pointermove",z),C.element.addEventListener("pointerup",j),C.element.addEventListener("pointercancel",j)}function H(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=H(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 qs={street:["addressStreet","street-address"],line2:["addressLine2","address-line2"],city:["addressCity","address-level2"],region:["addressRegion","address-level1"],postcode:["addressPostcode","postal-code"],country:["addressCountry","country"]},Cc=e=>typeof e=="string"&&e in qs,Oc="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",So={};function Lo(e){if(!So[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=!Oc.includes(o)&&t.of(o);a&&n.push([o,a])}So[e]=n.sort((r,i)=>r[1].localeCompare(i[1],e))}return So[e]}var _s=({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(Cc):["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]=qs[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:""}),...Lo(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 Us=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0,Ks=({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=Us(m.min)??0,g=Us(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 H(D){let I=`${i}-${D.key}-title`,z=c("span",{id:I,class:"fd-repeat-title"}),j=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]},B=()=>k().findIndex(oe=>oe.key===D.key),T=[V("\u2191","moveUp",()=>C(D.key,B()-1)),V("\u2193","moveDown",()=>C(D.key,B()+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"},z,...T.map(([oe])=>oe),...te?[te]:[],j),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 j.addEventListener("click",()=>{let oe=k(),Ce=oe.findIndex(ae=>ae.key===D.key);if(A||Ce===-1||oe.length<=S)return;let Me=z.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:z,remove:j,tools:T,fields:q}}function C(D,I){let z=k().findIndex(B=>B.key===D);if(A||I<0||I>=k().length||I===z)return;let j=E.get(D)?.title.textContent??"";Kn(e,t,v,D,I);let V=z>I&&I>0||I===k().length-1?0:1;E.get(D)?.tools[V][0].focus(),y.say(We(f.movedTo,{label:j,n:I+1,total:k().length}))}function O(D){let I=k(),z=I.findIndex(B=>B.key===D);if(A||z<0||I.length>=g)return;let j={...I[z].values};v.sequenceField&&delete j[v.sequenceField];let V=e.addLine(t,j);Kn(e,t,v,V,z+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??[],z=e.getState().errors,j=new Set(I.map(V=>V.key));for(let[V,B]of E)if(!j.has(V)){B.element.remove();for(let T of B.fields)T.widget.destroy?.();E.delete(V)}I.forEach((V,B)=>{let T=E.get(V.key);T||E.set(V.key,T=H(V)),x.children[B]!==T.element&&x.insertBefore(T.element,x.children[B]??null),T.title.textContent=b(B+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"?B===0:Y==="moveDown"?B===I.length-1:I.length>=g);for(let te of T.fields){let Y=z[`${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 Eo(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 Js(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 Ro(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 Gs(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 Ys=({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 Pc=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"&&Pc.has(c)?a.dataset.tone=c:delete a.dataset.tone}}};var Xs=({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=[],H=()=>e.getState().values[t]??[];function C(I,z=!1){let j=I.map(V=>V.id).filter(V=>z||!E.has(String(V))&&!k.has(String(V)));if(j.length){for(let V of j)k.add(String(V));e.linkedValues(t,j,v).then(V=>{for(let{id:B,values:T}of V)E.set(String(B),T);for(let B of j)k.delete(String(B));D()},()=>j.forEach(V=>k.delete(String(V))))}}h.addEventListener("click",async()=>{if(!d||A)return;let I=await d.searchMore({title:l.label,search:(z,j)=>e.search(t,z,j)});!I||H().some(z=>z.id===I.id)||e.setValue(t,[...H(),{id:I.id,label:I.label}])});async function O(I){let z=await d?.openRecord(l.relation,{recordId:I.id,title:I.label});z&&(z.label!==I.label&&e.setValue(t,H().map(j=>j.id===I.id?{id:j.id,label:z.label}:j)),C([I],!0))}function W(I){let z=E.get(String(I.id)),j=v.map((B,T)=>{let te=z?St(c[B],z[B]??null,z,s):T===0?I.label:"";return f("td",{"data-column":B},f("span",{class:"fd-value-text"},te))}),V=f("td",{class:"fd-lines-tools"});if(S){let B=f("button",{type:"button",class:"fd-line-open","aria-label":We(a.openNamed,{name:I.label}),title:a.openLine},"\u2197");B.addEventListener("click",()=>{O(I)}),V.append(B)}if(!A){let B=f("button",{type:"button",class:"fd-line-delete","aria-label":We(a.remove,{name:I.label})},"\xD7");B.addEventListener("click",()=>e.setValue(t,H().filter(T=>T.id!==I.id))),V.append(B)}return f("tr",{"data-record":String(I.id)},...j,V)}function D(){let I=o.activeElement,z=R.contains(I)?I.closest("tr")?.dataset.record:void 0;p.replaceChildren(...w.map(W)),z&&p.querySelector(`tr[data-record="${CSS.escape(z)}"] button`)?.focus()}return{element:R,focus:()=>(p.querySelector("button")??h).focus(),update(I){let z=I.value??[],j=z!==w||I.readonly!==A;A=I.readonly,w=z,x.hidden=A||!d,y&&(y.hidden=z.length>0),De(R,"aria-invalid",String(I.invalid)),De(R,"aria-describedby",I.describedBy||null),j&&D(),C(z)}}};var Fo=({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 Vc={normal:"muted",grey:"muted",blocked:"danger",red:"danger",done:"success",green:"success",waiting:"warning"},Zs=["muted","danger","success","warning","info"],Ic=new Set(["info","success","warning","danger","muted"]),Qs=({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"&&Ic.has(k)?k:Vc[String(R)]??Zs[E%Zs.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"],Dc=({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)}}},Wc=({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)}}},Ao=e=>e.field.type==="char"?Wc(e):Dc(e);var $o=({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(),Hc='<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>',To=e=>`${e.getFullYear()}-${Ri(e.getMonth()+1)}-${Ri(e.getDate())}`,Mo=({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())?"":`${To(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 To(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=Hc;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"}),H=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),H),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 z(Y){let K=e.getState().values;if(!c)return e.setValue(t,x(Y,K[t])),T();if(!D)return D=Y,W=Y,j(!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 j(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),xe=d("button",{type:"button","data-day":To(Pe),"aria-label":g.format(Pe),tabindex:Ei(Pe,W)?"0":"-1"},String(Pe.getDate()));Pe.getMonth()!==W.getMonth()&&xe.classList.add("fd-outside");let Ve=Ei(Pe,q)||Ei(Pe,oe);Ve&&xe.setAttribute("aria-selected","true"),q&&oe&&Pe>q&&Pe<oe&&!Ve&&xe.classList.add("fd-in-range"),Ei(Pe,new Date)&&xe.setAttribute("aria-current","date"),xe.addEventListener("click",()=>z(Pe)),xe.addEventListener("pointerenter",()=>{if(D){I=Pe;for(let X of H.querySelectorAll("button[data-day]")){let re=h(X.dataset.day);X.classList.toggle("fd-in-range",!!re&&re>D&&re<Pe)}}}),xe.addEventListener("keydown",X=>V(X,Pe)),ne.append(d("td",{},xe))}ae.append(ne)}H.replaceChildren(d("thead",{},$e),ae),Y&&H.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),j(!0)):(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),z(K))}function B(){D=null,I=null,W=h(e.getState().values[t])??new Date,C.hidden=!1,E.setAttribute("aria-expanded","true"),j(!0)}function T(){C.hidden||(C.hidden=!0,D=null,E.setAttribute("aria-expanded","false"),E.focus())}E.addEventListener("click",()=>C.hidden?B():T()),k.addEventListener("click",()=>(W=Li(W,-1),j(!1))),A.addEventListener("click",()=>(W=Li(W,1),j(!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 No=e=>String(e).padStart(2,"0");function jc(e){let t=Math.max(0,Math.floor(e));return`${No(Math.floor(t/3600))}:${No(Math.floor(t%3600/60))}:${No(t%60)}`}var ed=e=>{if(typeof e!="string"||!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},Co=({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,jc(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?ed(g.value):a?ed(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 td=e=>typeof e=="number"&&e>0?e:480,zc=e=>/^https?:\/\//i.test(e);function Bc(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 nd=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=`${td(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?Bc(c):"",d&&(i.title=c?.name??e.field.label,i.src=d)),a.replaceChildren(...d?[i]:f.readonly?[o]:[])}}},rd=({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=`${td(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=zc(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 qc(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 id=({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=qc(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,H)=>s("tr",{class:H},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 H=s("input",{type:"text",class:"fd-input fd-number-input",inputmode:"decimal",autocomplete:"off","aria-label":w.name});H.value=gt(w.amount,2,a),H.addEventListener("change",()=>{let C=Jt(H.value.trim(),a);/^-?(\d+\.?\d*|\.\d+)$/.test(C)&&g(w,Number(C))}),k.push(E(w.name,H,"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 _c(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 od=({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=_c(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 H=y(A.amount),C=a("button",{type:"button",class:"fd-payment-info","aria-label":We(s.paymentOf,{amount:H}),"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${t}-payment-${w}`},"i"),O=(B,T)=>T?[a("dt",{},B),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:H}),tabindex:"-1",hidden:""},a("strong",{},A.name||H),a("span",{class:"fd-payment-details-amount"},H),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"},H),D),z=!1,j=Gn(I,C,D,()=>{z&&C.focus(),z=!1,b===V&&(b=null)}),V=()=>j.close();return C.addEventListener("click",()=>{if(j.isOpen())return V();b?.(),j.open(),b=V,(W??D).focus()}),D.addEventListener("keydown",B=>{B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),z=!0,V())}),W?.addEventListener("click",()=>{V(),o?.openRecord(c,{recordId:A.id,title:A.name||H})}),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]??dd[a];if(s)return r.type==="selection"&&r.optionsFrom?Gs(s,n):s(n)}return Zc(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)),Eo({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 Uc=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=Js(s,i);return s.addEventListener("input",()=>{d(),t.setValue(n,s.value===""?null:s.value)}),Eo({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)},Kc=/^-?(\d+\.?\d*|\.\d+)$/,Jc=/^-?\.?$/,Oo=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 H=Jt(w.trim(),s);if(H==="")return null;if(Kc.test(H))return Number(H);if(!Jc.test(H))return H};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 H=c.value,[C,O]=[c.selectionStart??H.length,c.selectionEnd??H.length],W=D=>pr(H.slice(0,D),s).length;c.value=pr(H,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"&&Ro(r.currency??"USD",s).after,h=(w,H)=>nt(a,"span",{class:`fd-unit${r.type==="monetary"?" fd-currency":""}`,id:`${o}-unit${H}`},w),x=r.type==="monetary"&&!p?h("",0):null,[L,y]=["prefix","suffix"].map((w,H)=>typeof m[w]=="string"&&m[w]?h(m[w],H+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 H=a.activeElement===c,C=v(c.value),O=C===void 0||C===w.value;if(!(H&&O)){let W=H&&!w.readonly&&typeof w.value=="number"?oo(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)?Ro(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 Po(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 Gc=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 Hs(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 ad(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(H=>typeof H=="string"&&!h.has(H)),A=g.checked&&!p.value.trim()&&(e==="checkbox"||R.every(H=>H==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 sd(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 H=Math.min(c,Math.max(f,A+w));t.setValue(n,H),p[H-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 H=f+w;De(A,"aria-checked",String(H===k)),A.classList.toggle("fd-on",m?k!==null&&H<=k:H===k);let C=H===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 Yc=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"),Xc=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 Zc({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 dd={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":ao,text:Uc,integer:Oo,float:Oo,monetary:Oo,"integer.rating":sd("rating"),"integer.scale":sd("scale"),"integer.slider":ko,"float.slider":ko,"integer.progressbar":br,"integer.label":yr,"float.label":yr,"monetary.label":yr,"float.progressbar":br,"float.duration":us,"float.percentage":ps,"monetary.progressbar":br,boolean:Po(),"boolean.toggle":Po("switch"),"boolean.tick":Po("tick"),"boolean.buttons":Ys,"boolean.priority":Fo,"selection.priority":Fo,"selection.dot":Qs,"integer.color":Ao,"char.color":Ao,"char.copy":$o,"text.copy":$o,"date.daterange":Mo,"datetime.daterange":Mo,"float.timer":Co,"datetime.timer":Co,"binary.pdf":nd,"char.embed":rd,"json.distribution":hs,"json.tax-totals":id,"json.payments":od,selection:Gc,"selection.radio":ad("radio"),"selection.checkboxes":ad("checkbox"),"selection.tags":Ws,"selection.image-choice":zs,"selection.ranking":Bs,"selection.statusbar":mi,date:Yc,datetime:Xc,many2one:gr,"many2one.statusbar":mi,many2many:si,"many2many.tags":si,"many2many.checkboxes":so,"many2many.table":Xs,reference:lo,one2many:uo,"one2many.cards":Ks,binary:hr,"binary.signature":Ds,image:mo,html:xo,json:wo,"json.address":_s,properties:yo,matrix:Is,"char.badge":ki,"selection.badge":ki,"many2one.badge":ki};var ld=`.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 cd='.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 fd='.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 ud=".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 pd='.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 md='.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 gd='.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',hd={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"}}},Vo=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])',bd=Object.keys(hd).map(e=>{let{light:t,dark:n}=hd[e],r=`${_e(e)}[data-scheme="dark"]`;return`${_e(e)} { ${Vo(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 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 we=c("button",{type:"button",class:"fd-repeat-tool"},oe);return we.addEventListener("click",Me),[we,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}`,we={type:"field",id:`${r.id}.${D.key}.${oe}`,field:oe},$e=Ot({form:li(e,t,D.key),name:oe,field:Ce,node:we,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 we=k(),$e=we[Math.min(Ce,we.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),we=Xt(Me,-((Me.getDay()+6)%7)),$e=d("tr",{},...Array.from({length:7},(he,ne)=>d("th",{scope:"col"},p.format(Xt(we,ne)).replace(/\.$/,"")))),ae=d("tbody");for(let he=we;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),xe=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()&&xe.classList.add("fd-outside");let Ve=Ei(Pe,q)||Ei(Pe,oe);Ve&&xe.setAttribute("aria-selected","true"),q&&oe&&Pe>q&&Pe<oe&&!Ve&&xe.classList.add("fd-in-range"),Ei(Pe,new Date)&&xe.setAttribute("aria-current","date"),xe.addEventListener("click",()=>B(Pe)),xe.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)}}}),xe.addEventListener("keydown",X=>V(X,Pe)),ne.append(d("td",{},xe))}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} { ${Io(n)} }
|
|
8
|
+
@media (prefers-color-scheme: dark) { ${_e(e)}[data-scheme="auto"] { ${Io(n)} } }`}).join(`
|
|
9
9
|
`).replace(/^/,`@layer fieldia-tokens {
|
|
10
10
|
`).concat(`
|
|
11
|
-
}`),
|
|
11
|
+
}`),kd=`
|
|
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; }
|
|
@@ -59,7 +59,7 @@ ${_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 Qc={medium:760,narrow:520},ef='@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}}',xd=ef+bd+gd+fd+pd+md+yd+ld+cd+ud,vd="fieldia-styles";function Io(e){if(e.getElementById(vd))return;let t=e.createElement("style");t.id=vd,t.textContent=xd,(e.head??e.documentElement).append(t)}function Do(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 tf(){let e=new Map;return{get:t=>e.has(t)?wd(e.get(t)):null,set:(t,n)=>{e.set(t,wd(n))}}}var wd=e=>JSON.parse(JSON.stringify(e));function Wo(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 nf={email:[/^[^\s@]+@[^\s@]+$/,"mailto:"],phone:[/^\+?[\d\s().-]{3,}$/,"tel:"],url:[/^https?:\/\/\S+$/i,""]};function rf(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=rf(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?nf[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 kd={};var of={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:of,...kd},Ld=It.en,af=new Map([["ar","Arabic"],["de","German"],["fr","French"]]),Sd=new Set;function wr(e="en"){let t=e.split("-")[0];if(Object.prototype.hasOwnProperty.call(It,t))return t;let n=af.get(t);return n&&!Sd.has(t)&&(Sd.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 jo="#111418",Ad="#1f2329",sf="#f2f3f5";var zo=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),df=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function Ed(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]=[Ed(e),Ed(t)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}var lf=e=>Mn(e,"#ffffff")>=4.5?"#ffffff":jo,cf=e=>Mn(e,jo)>=Mn(e,"#ffffff")?jo:"#ffffff",$d=(e,t,n)=>df(zo(e).map((r,i)=>r+(zo(t)[i]-r)*n)),ff=(e,t)=>$d(t,e,.12),Rd=(e,t)=>[...t,ff(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=$d(e,t,i/40);return r}function kr(e,t={light:[],dark:[]}){let n=e.toLowerCase(),r=Mi(n,"#000000",o=>Rd(o,["#ffffff",sf,...t.light])),i=Mi(n,"#ffffff",o=>Rd(o,[Ad,...t.dark]));return{accent:r,accentText:lf(r),dark:i,darkText:cf(i)}}var uf=["#212529","#636976","#c63c3d"],pf=["#e8eaed","#a3a9b2","#ff8a7a"],mf={accent:"#1365d9",dark:"#5aa2ff"},Fd={background:"bg",border:"border",corners:"radius",textSize:"size",accent:"accent"},gf={small:"13px",large:"16px"},hf={square:[0,0],soft:[6,10],round:[12,16]};function bf(e,t){let n=(d,l)=>t.scheme==="dark"?l:t.scheme==="auto"?`light-dark(${d}, ${l})`:d,r=t.accent?kr(t.accent):mf,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([...uf,r.accent])),v=Mi(f,Ad,s([...pf,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(Fd).filter(c=>l[c]).map(c=>Fd[c]);if(f.length&&e.setAttribute(`data-${d}`,f.join(" ")),l.border&&o(d,"border",l.border),l.corners&&o(d,"radius",`${hf[l.corners][d==="groups"?1:0]}px`),l.textSize&&o(d,"size",gf[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 Bo={material:"outlined",fluent:"outlined",apple:"outlined",bootstrap:"outlined",shadcn:"outlined",ant:"outlined",odoo:"underline","google-forms":"outlined"};function xn(e,t){return e??(t?Bo[t]:"underline")}var qo=["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 qo){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)}bf(e,t)}}function Cn(e,t,n){let r=Hn(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 Td=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 Md=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 Nd(e,`fd-size-${e.size??"medium"}`)}function _o(e){let t=e.side??"end";return Nd(e,`fd-form-panel ${t==="top"||t==="bottom"?`fd-height-${e.height??"medium"}`:`fd-width-${e.width??"medium"}`}`,t)}function Nd(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-${++Td}`,l=Md(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&&yf(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(),z={saved:D,recordId:I.recordId??null,values:I.values};R.destroy(),L.remove(),y?.removeAttribute("data-behind"),a?.focus(),A(z)},H=()=>new Promise(D=>{let I=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"}),T=l("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":z.id}),te=l("div",{class:"fd-dialog-backdrop"});B.append(j,V),T.append(z,B),te.append(T);let Y=K=>{te.remove(),I?.focus(),D(K)};j.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),j.focus()}),C=async()=>{(!r||!R.form.getState().dirty.length||await H())&&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 z=await R.form.runAction(D.id);I.removeAttribute("aria-busy"),!E&&(O?w(!0):(z.reason==="check"||z.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),z=I?x.find(({node:j,button:V})=>j.hotkey===I&&!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})),x.length?x.find(({node:j,button:V})=>j.style==="primary"&&!V.hidden)?.button.click():S.click();return}D.defaultPrevented||(D.key==="Escape"?(D.preventDefault(),C()):Gt(b,D))})})}function yf(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 Uo(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-${++Td}`,d=Md(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")},H=()=>{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",H),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)}),H()})}function Ko(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 vf(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 xf(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function Cd(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=Ko(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=>Uo({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:vf(i.fields,i.title,i.readonly===!0,i.layout),...i.parent?{parent:i.parent}:{},dataSource:xf(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 Od=e=>`favourites:${e.id}`;function Oi(e,t){let n=e.get(Od(t));return Array.isArray(n)?n:[]}function Pd(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 Vd(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(Od(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 wf(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 kf(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 Jo(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"},wf(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=>Jo(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?(kf(f),e.changed()):c||v()}),f}var Sf='.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=Sf,e.head.append(t)}var Lf=[["ilike","opContains"],["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],Ef=[["ilike","opContains"],["set","opSet"],["notset","opNotSet"]],Rf=[["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],Ff=[["=","opIs"],["!=","opIsNot"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]],Af=[["=","opIs"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]];function Go(e){switch(e.type){case"char":case"text":case"html":return Lf;case"many2one":case"many2many":return Ef;case"selection":return Rf;case"integer":case"float":case"monetary":return Ff;case"date":case"datetime":return Af;case"boolean":return[["=","opIs"]];default:return[]}}function Id(e){let{page:t,el:n,labels:r}=e,i=Object.entries(t.fields).filter(([,g])=>Go(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(...Go(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[Go(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 $f(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 Dd(e){let{page:t,node:n,doc:r,el:i,labels:o,fill:a,uid:s}=e,d=e.facets,l=V=>{let B=wt(r,V,e.icons);return B?.setAttribute("aria-hidden","true"),B?[B]:[]};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,B)=>{let T=$f(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!==B)),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,B)=>{let T=i("li",{role:"option",id:`${c}-${B}`,"aria-selected":String(B===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 B={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:[B]});else{let Y=te[T];Y.values.some(q=>q.op===B.op&&JSON.stringify(q.value)===JSON.stringify(B.value))||(te[T]={...Y,values:[...Y.values,B]})}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,B,T)=>i("div",{class:"fd-search-heading",id:T},...l(V),B),k=(V,B)=>{let T=d.findIndex(oe=>oe.kind===V),te=T<0?[]:V==="filters"?d[T].ids:d[T].fields,Y=te.includes(B)?te.filter(oe=>oe!==B):[...te,B],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 B=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-filter":V.id},V.label);return B.addEventListener("click",()=>k("filters",V.id)),B}),w=(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",()=>k("groupBy",V)),B}),H=Id({page:t,el:i,labels:o,add:V=>f([...d,V])}),C=Vd({page:t,el:i,labels:o,fill:a,preferences:e.preferences,current:()=>d,apply:f}),O=(V,B,T,...te)=>i("div",{class:"fd-search-group","data-group-kind":V,role:"group","aria-labelledby":`${v}-${V}`},E(B,T,`${v}-${V}`),...te),W=i("div",{class:"fd-search-panel",id:v,hidden:""},O("filters","filter",o.filters,...A,H.button,H.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??[],B=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(B.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 z=i("div",{class:"fd-search"},i("div",{class:"fd-search-field"},...l("search"),S,m,p),g,W),j=V=>{!W.hidden&&!z.contains(V.target)&&I(!1)};return r.addEventListener("pointerdown",j),x(),D(),{element:z,add(V){let B=V.kind==="custom"?V.label:null;f([...d.filter(T=>!(B!==null&&T.kind==="custom"&&T.label===B)),V])},destroy:()=>r.removeEventListener("pointerdown",j)}}var Wd=new Set(["integer","float","monetary"]),Tf=new Set(["one2many","many2many","binary","image","html","json","properties"]);function Hd(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=Pd(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:Wd.has(ie.type)?"fd-num":void 0});if(Tf.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(ue=>ue.field!==U)],v=0,ke()}),Ae.append(Re)}return Ae}),w=i("tbody"),H=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),B(),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(ue=>i("td",{class:Wd.has(t.fields[ue].type)?"fd-num":void 0},i("bdi",{},E(ue,U.values)))));return de.addEventListener("click",ue=>{let le=ue.target.closest("td");if(le?.classList.contains("fd-list-check")){ue.target===le&&Re.click();return}e.onOpenRecord?.(U.id)}),de.addEventListener("keydown",ue=>{ue.target===de&&(ue.key==="Enter"?(ue.preventDefault(),e.onOpenRecord?.(U.id)):ue.key===" "?(ue.preventDefault(),Re.click()):(ue.key==="ArrowDown"||ue.key==="ArrowUp")&&(ue.preventDefault(),(ue.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"}),z=i("button",{type:"button",class:"fd-button fd-button-link"},o.clearSelection),j=(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,...j,z);z.addEventListener("click",()=>{x.clear();for(let U of w.querySelectorAll(".fd-list-checkbox"))U.checked=!1;B()}),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;B()});function B(){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]?.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)}B(),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(),H.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 ue=await de.groups({model:b,field:Re[0],filter:Ae});if(U!==L||y)return;S=[],m=0,ie=ue.map(le=>Jo(Me(de),le,0,Ae,Re))}else{let ue=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(!ue.records.length&&ue.total>0&&v>0)return v=Math.floor((ue.total-1)/l)*l,ke();S=ue.records,m=ue.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,H.removeAttribute("aria-busy"),q(),Ce()}let $e=Dd({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 xe(){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)}B(),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}),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"&&(xe(),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"},H),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 Mf=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"&&Mf.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 jd(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 Nf(e,{...a,host:{...n.host,post:e.post}}):t.as==="panel"?await _o({...d,title:s,side:t.side}):await Xn({...d,title:s,size:i.layout.type==="sheet"?"large":"medium"}),f=Ko(i),c=f?l.values[f]:void 0;return{...l,...typeof c=="string"&&c?{label:c}:{}}}function Nf(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 zd(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();Cf(r,t,i),c()}}function Cf(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 Bd(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 Yo(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 Of={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 qd(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(Pf(e,i,s,d)),a&&l.append(Vf(e,a,o,s,d)),{element:l,update:()=>{for(let f of s)f()},destroy:()=>{for(let f of d)f()}}}function Pf(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",Of);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 Vf(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 If=e=>/^image\//.test(e.type)||/pdf/i.test(e.type)||/\.pdf$/i.test(e.name),Df=e=>(Array.isArray(e)?e:e?[e]:[]).filter(t=>t&&typeof t=="object"&&"name"in t);function _d(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=go(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(If),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(H=>w===p&&y(H),()=>w===p&&y([]))}return{element:c,update(k){if(i.field){let A=k.values[i.field];A!==h&&(h=A,y(Df(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 Wf='.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 Ud(e){if(e.getElementById("fd-record-styles"))return;let t=e.createElement("style");t.id="fd-record-styles",t.textContent=Wf,(e.head??e.documentElement).append(t)}var Hf=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:
|
|
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(ue=>ue.field!==U)],v=0,we()}),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",()=>{we()});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(ue=>i("td",{class:zd.has(t.fields[ue].type)?"fd-num":void 0},i("bdi",{},E(ue,U.values)))));return de.addEventListener("click",ue=>{let le=ue.target.closest("td");if(le?.classList.contains("fd-list-check")){ue.target===le&&Re.click();return}e.onOpenRecord?.(U.id)}),de.addEventListener("keydown",ue=>{ue.target===de&&(ue.key==="Enter"?(ue.preventDefault(),e.onOpenRecord?.(U.id)):ue.key===" "?(ue.preventDefault(),Re.click()):(ue.key==="ArrowDown"||ue.key==="ArrowUp")&&(ue.preventDefault(),(ue.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([we(),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),we()}),Y.addEventListener("click",()=>{v+=l,we()});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 we(){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 ue=await de.groups({model:b,field:Re[0],filter:Ae});if(U!==L||y)return;S=[],m=0,ie=ue.map(le=>Go(Me(de),le,0,Ae,Re))}else{let ue=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(!ue.records.length&&ue.total>0&&v>0)return v=Math.floor((ue.total-1)/l)*l,we();S=ue.records,m=ue.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,we(),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 xe(){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,we(),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([we(),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"&&(xe(),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),we(),{element:me,reload:async()=>{await Promise.all([we(),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
63
|
${i.issues.map(M=>` ${M.path}: ${M.message}`).join(`
|
|
64
|
-
`)}`);let o=n.locale??i.page.language,a=o?dr(i.page,o):i.page,s=n.translate?zn(a,n.translate):a,d=M=>{let G=o?dr(M,o):M;return n.translate?zn(G,n.translate):G},l=wr(o),f=n.preferences??Do(),c=Cd(n,(M,G)=>S.say(M,G)),v=!n.form,m={...It[l],...n.labels},S={open:M=>jd({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,pe)=>S.say(G,pe),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${++Hf}`,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,(pe,we)=>String(G[we]??""));Io(r),Ud(r);function w(M,G={},...pe){let we=r.createElement(M);for(let[Fe,Ne]of Object.entries(G))Ne!==void 0&&we.setAttribute(Fe,Ne);return we.append(...pe),we}function H(M,G){let pe=wt(r,M,n.icons),we=w("bdi",{},G);return pe?[pe,we]:[we]}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=zd(O,w,m.dismiss),I=new Map,z=new Map;async function j(M,G){if(!M.hasAttribute("aria-busy")){M.setAttribute("aria-busy","true"),M.setAttribute("aria-disabled","true");try{let{reason:pe}=await G();(pe==="check"||pe==="save")&&(g.getState().saveProblem||Re(re(g.getState())),fe())}finally{M.removeAttribute("aria-busy"),M.removeAttribute("aria-disabled")}}}let V=[],B=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:pe}=M,we=$=>E(M.prefix+$),Fe=$=>L.push(M.root?$:()=>$(G.getState()));function Ne($,J){let Z=pe.fields[$.field],ee=we($.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,He=w("label",{class:"fd-label",id:`${ee}-label`,for:ee},zf(Ue)),je=n.showValid&&!jf.has(Z.type)?wt(r,"check"):null;je&&(je.classList.add("fd-valid-mark"),He.append(je));let ze=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:()=>ze.focus()});let Ft=ze.element.matches(Kd)?ze.element:ze.element.querySelector(Kd);se==="hidden"&&!$.placeholder&&Ft?.setAttribute("placeholder",Ue);let Qe=Ft?.getAttribute("placeholder")??null,ht=$.placeholderWhen?.length?Ft:null;["INPUT","SELECT","TEXTAREA"].includes(ze.element.tagName)||((ze.element.getAttribute("role")?ze.element:ze.element.querySelector(`[id="${ee}"][role]`))?.setAttribute("aria-labelledby",He.id),He.addEventListener("click",Ln=>{Ln.target.closest?.(".fd-help-tip-wrap")||ze.focus()}));let ut=$.help??Z.help,Mt=$.helpShown??pe.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"?ze.element.after(ct.element):ct&&(He.append(ct.element),He.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"?[ze.element,He]:[He,ze.element],...At?[At]:[],Ge,$t);let Pt=pe.look?.readonlyShown==="text"&&Wo(Z,$)?Ho({document:r,field:Z,node:$,id:ee,locale:l,labels:p,dialogs:c}):null;Pt&&ze.element.after(Pt.element),ze.destroy&&y.push(()=>ze.destroy?.());let Vn=!1,Sn="";be.addEventListener("focusin",()=>Vn=!0),be.addEventListener("focusout",Tt=>{be.contains(Tt.relatedTarget)||(Vn=!1,queueMicrotask(()=>Xo(G.getState())))});let Yd=$.tones!==void 0||$.bold!==void 0,Xo=Tt=>{let Ln=G.node($.id);if(et(be,Ln.invisible),be.classList.toggle("fd-required",Ln.required),Yd){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 Zo=Tt.warnings[$.field]??"";(!Vn||!Zo)&&(Sn=Zo);let Hi=[In?"":Sn,Tt.warning&&Tt.warningField===$.field?Tt.warning:""].filter(Boolean).join(" ");if(et($t,!Hi),Lt($t,Hi),je){let cn=Tt.values[$.field],Xd=cn!=null&&cn!==""&&!(Array.isArray(cn)&&!cn.length),Qo=!Ln.readonly&&!In&&Xd&&Tt.dirty.includes($.field)&&G.problem($.field)===null;be.classList.toggle("fd-valid",Qo),je.toggleAttribute("hidden",!Qo)}let ir=Ln.readonly||ne||M.locked();Pt&&(et(ze.element,ir),et(Pt.element,!ir),kt(be,"data-read-text",ir?"":null),ir&&Pt.update(Tt.values[$.field],Tt.values)),ze.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,Hi?$t.id:void 0].filter(Boolean).join(" ")||void 0})};return Fe(Xo),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=He=>{ee.hidden=!He,se.setAttribute("aria-expanded",String(He)),He&&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",He=>{He.preventDefault(),be=!be,Ue(be)}),se.addEventListener("keydown",He=>{He.key!=="Escape"||ee.hidden||(He.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},...H($.icon,$.label));return $.hotkey&&Cn(J,$.hotkey,$.label),K(J,$.colspan),J.addEventListener("click",()=>{j(J,()=>G.runAction($.id))}),st(J,$.id),u($,J)}function Ze($,J=!1){let Z=$.style??"paragraph",ee=Yo(r,pe.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=pe.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"},...Jd($.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:we(`${$.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=we(`${$.id}-content`);let He=w("button",{type:"button",class:"fd-section-toggle","aria-controls":Ue.id},w("span",{class:"fd-section-chevron","aria-hidden":"true"}),...H($.icon,$.title)),je=$.collapsed!==!0,ze=Ft=>{je=Ft,He.setAttribute("aria-expanded",String(je)),Ue.hidden=!je,be&&(be.hidden=!je),ee.classList.toggle("fd-section-folded",!je)};He.addEventListener("click",()=>ze(!je)),B.set(ee,()=>ze(!0)),ze(je),ee.append(w("legend",{class:"fd-section-title"},He))}else $.title&&ee.append(w("legend",{class:"fd-section-title"},...H($.icon,$.title)));return be&&ee.append(be),ee.append(Ue),st(ee,$.id),ee}function ye($,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)},He=$.children.map(Qe=>{let ht=we(`${Qe.id}-tab`),ut=we(`${Qe.id}-panel`),Mt=w("button",{type:"button",class:"fd-tab",role:"tab",id:ht,"aria-controls":ut,"data-node":Qe.id},...H(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=Be(Qe.children);if(M.root)for(let Sn of Vn)z.has(Sn)||z.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=He.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 je=Bd(ee,w);y.push(je.destroy),Z.append(je.element,...He.map(Qe=>Qe.panel));let ze="",Ft="";return Fe(Qe=>{let ht=G.node($.id).invisible;et(Z,ht);let ut=He.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 He){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!==ze&&(ze=ct,je.measure()),be!==Ft&&ee.clientWidth){Ft=be;let Ge=He.find($t=>$t.tab.id===be);Ge&&je.reveal(Ge.button)}}),Z}function Be($){return $.flatMap(J=>J.type==="field"?[J.field]:J.type==="section"?Be(J.children):J.type==="tabs"?J.children.flatMap(Z=>Be(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 ye($,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:pe,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=He=>{Z.removeAttribute("aria-busy"),ee.textContent=He,ee.classList.add("fd-form-part-problem")},be=He=>{if(Y)return;if(!He)return se(A(m.formMissing,{page:$.page}));let je=d(He),ze=je.title||He.id,Ft=M.chain.findIndex(ct=>ct.id===He.id);if(Ft!==-1)return se(A(m.formInItself,{page:ze,chain:[...M.chain.slice(Ft).map(ct=>ct.title),ze].join(" \u2192 ")}));if(He.layout.type!=="sections"&&He.layout.type!=="tabs")return se(A(m.formNotPlaceable,{page:ze}));let Qe=sr(je),ht;try{if(!Qe.ok)throw new Error(Qe.issues.map(ct=>`${ct.path}: ${ct.message}`).join("; "));ht=G.embed($.id,je)}catch(ct){return console.warn(`Fieldia: the saved form "${He.id}" cannot be shown: ${ct.message}`),se(A(m.formBroken,{page:ze}))}let ut=$.title??je.title??"";Z.setAttribute("data-title",ut),ut&&Z.prepend(w("legend",{class:"fd-section-title"},...H(void 0,ut)));let Mt=oe({root:!1,form:ht,page:je,prefix:`${M.prefix}${$.id}-`,chain:[...M.chain,{id:He.id,title:ze}],locked:()=>M.locked()||G.node($.id).readonly,path:`${M.path}${$.name}.`}),At=je.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"}),xe=w("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},m.retry);xe.addEventListener("click",()=>{vt()});let Ve=w("div",{class:"fd-status-box"},Pe,xe),X=()=>s.data.kind==="responses"?m.notSent:m.notSaved;function re(M){let G=[...O.querySelectorAll(".fd-field[data-path]")],pe=[];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;pe.some(Ze=>Ze.name===xt)||pe.push({name:xt,at:Ne?G.indexOf(Ne):1/0})}let we=pe.sort((Fe,Ne)=>Fe.at-Ne.at).map(Fe=>Fe.name);return we.length?A(m.checkFields,{what:X(),fields:we.join(", ")}):X()}let me;x.push(M=>{let G=M.saveProblem,pe=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,pe),et(xe,!(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=!pe,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 ue=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()),ue.append(le,ce,ge),x.push(M=>{et(ue,!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(we=>!we.closest(".fd-tabpanel[hidden]"))){let we=g.getState().errors,Fe=[...z.keys()].find(Ne=>we[Ne]);Fe&&z.get(Fe)?.()}let G=[...O.querySelectorAll('[aria-invalid="true"]')].find(we=>!we.closest(".fd-tabpanel[hidden]"))??null;if(!G)return;for(let we=G.closest(".fd-section-folded");we;we=we.parentElement?.closest(".fd-section-folded")??null)B.get(we)?.();if(!G.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(G.matches("input, select, textarea, button")?G:G.querySelector("input, select, textarea, button"))?.focus()}let ve=w("div",{class:"fd-done",hidden:""},w("p",{class:"fd-done-title"},m.submitted)),it=w("button",{type:"button",class:"fd-button"},m.submitAnother);ve.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,ve.hidden=!1)}it.addEventListener("click",()=>{g.reset(),lt.hidden=!1,ve.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=qd({doc:r,el:w,form:g,toolbar:M,records:n.records,breadcrumbs:n.breadcrumbs,labels:m,icons:n.icons,uid:k,fill:A,withIcon:H,press:j,name:On,render:T,async leave(){if(!g.getState().dirty.length)return!0;let pe=await g.save();return pe||(g.getState().saveProblem||Re(re(g.getState())),fe()),pe}});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 Bt(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)))),pe=Bt(M.footer);if(pe)return w("div",{},G,pe);let we=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,we);if(s.data.kind==="record"){let Ne=w("button",{type:"button",class:"fd-button"},m.discard);Ne.addEventListener("click",()=>g.reset()),Fe.insertBefore(Ne,we),x.push(mt=>{let Ye=mt.dirty.length>0&&mt.status!=="saving"&&!ne;et(we,!Ye),et(Ne,!Ye)})}else x.push(()=>et(we,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}),pe=w("div",{class:"fd-progress-text"}),we=w("span");G.append(w("div",{class:"fd-progress"},pe,w("div",{class:"fd-progress-bar"},we)));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"},...H(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`)},...H(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??""));pe.textContent=A(m.stepOf,{n:Se+1,total:at.length}),we.style.width=`${(Se+1)/Math.max(1,at.length)*100}%`;for(let{step:ye,panel:Be}of mt)Be.hidden=ye.id!==Ie.step;let Ke=Se===at.length-1;Ye.hidden=Se===0,st.hidden=Ke||!M.children.find(ye=>ye.id===Ie.step)?.optional,xt.textContent=Ke?M.finishLabel??m.submit:M.nextLabel??m.next;for(let[ye,Be]of Ne){let qe=at.indexOf(ye);Be.parentElement.hidden=qe===-1,Be.classList.toggle("fd-step-done",qe!==-1&&qe<Se),Be.classList.toggle("fd-step-skipped",Ie.skipped.includes(ye)),ye===Ie.step?Be.setAttribute("aria-current","step"):Be.removeAttribute("aria-current")}}),G}function sn(M){let G=w("div",{class:"fd-sheet-page","data-node":M.id}),pe=w("div",{class:"fd-actions"}),we=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=Bt(M.footer);n.showActions===!1||Ye?pe.append(...(M.buttons??[]).map($e)):Ne?(pe.append(...(M.buttons??[]).map($e)),mt.append(Ve,Fe,we)):pe.append(we,Fe,...(M.buttons??[]).map($e),Ve),Te&&n.showActions!==!1&&pe.prepend(Te),x.push(Se=>{let Ke=Se.dirty.length>0&&Se.status!=="saving"&&!ne;we.hidden=!Ke,Fe.hidden=!Ke});let st=w("div",{class:"fd-header"},pe),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(ye=>{let Be=w("div",{class:`fd-ribbon fd-tone-${ye.tone??"muted"}`,"data-node":ye.id,title:ye.tooltip},ye.label);return Se.append(Be),{ribbon:ye,element:Be}});x.push(ye=>{let Be=!1;for(let{ribbon:qe,element:u}of Ke){let F=!Be&&!g.node(qe.id).invisible;if(Be||(Be=F),et(u,!F),!F)continue;let N=qe.labelField?St(s.fields[qe.labelField],ye.values[qe.labelField],ye.values,l):"";Lt(u,N||qe.label)}}),Ze.append(Se)}if(M.statButtons?.length){let Se=w("div",{class:"fd-stats"}),Ke=(ye,Be)=>ye&&s.fields[ye]?St(s.fields[ye],Be[ye],Be,l):"";for(let ye of M.statButtons){let Be=w("span",{class:"fd-stat-value"}),qe=w("span",{class:"fd-stat-label"},ye.label),u=ye.secondField&&ye.secondLabel!==void 0?{value:w("span",{class:"fd-stat-value"}),label:w("span",{class:"fd-stat-label"},ye.secondLabel)}:null,F=wt(r,ye.icon,n.icons),N=u?w("span",{class:"fd-stat-words fd-stat-pair"},w("span",{class:"fd-stat-row"},qe,Be),w("span",{class:"fd-stat-row"},u.label,u.value)):w("span",{class:"fd-stat-words"},Be,qe),P=ye.help?k(`${ye.id}-help`):void 0,_=w("button",{type:"button",class:"fd-stat","data-node":ye.id,title:ye.help||void 0,"aria-describedby":P},...F?[F,N]:[N]);P&&Se.append(w("span",{class:"fd-sr-only",id:P},ye.help)),_.addEventListener("click",()=>{j(_,()=>g.runAction(ye.id))}),x.push(Q=>{_.hidden=g.node(ye.id).invisible;let $=Q.values,J=Ke(ye.unitField,$)||ye.unit||"",Z=Ke(ye.field,$),ee=Ke(ye.secondField,$);u?(Lt(Be,Z),Lt(u.value,[ee,J].filter(Boolean).join(" "))):Lt(Be,[[Z,ee].filter(Boolean).join(" / "),Z||ee?J:""].filter(Boolean).join(" ")),Lt(qe,Ke(ye.labelField,$)||ye.label)}),Se.append(_)}x.push(()=>{Se.hidden=[...Se.querySelectorAll(":scope > .fd-stat")].every(ye=>ye.hidden)}),Ze.append(Se)}for(let Se of M.alerts??[]){let Ke=Yo(r,s.fields,Se.message,l),ye=w("span",{class:"fd-alert-message"},...Ke.nodes),Be=!1,qe=w("div",{class:`fd-alert fd-tone-${Se.tone??"info"}`,role:"status","data-node":Se.id},ye);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(ye,N):Be&&ye.replaceChildren(...Ke.nodes),Be=!!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 ye=w("span",{class:`fd-badge fd-tone-${Ke.tone??"muted"}`,"data-node":Ke.id},...H(Ke.icon,Ke.label));ae(ye,Ke.id),Se.append(ye)}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}:{}}),ye=M.title.before??[],Be=M.title.after??[];if(ye.length||Be.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"},...ye.map(u),Ke,...Be.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=_d({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],pe={clickable:M.clickable===!0};M.visibleStates&&(pe.visibleStates=M.visibleStates);for(let Ne of["durationsField","fold","saves"])M[Ne]!==void 0&&(pe[Ne]=M[Ne]);let we={type:"field",id:"#statusbar",field:M.field,widget:"statusbar",options:pe},Fe=Ot({form:g,name:M.field,field:G,node:we,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=Hd({page:s,node:ot,form:g,dataSource:n.dataSource,doc:r,el:w,labels:m,locale:l,fill:A,press:j,withIcon:H,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,ue,dn),O.append(lt,ve,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 pe=G.scrollWidth>G.clientWidth&&G.value!=="";kt(G,"title",pe?G.value:null),kt(G,"data-cut-title",pe?"":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"]')),pe=M.closest(".fd-field"),we=G.slice(G.indexOf(pe)+1);for(let Fe of we){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}if(M.defaultPrevented||!G.enterMovesToNext||M.shiftKey||M.altKey)return;let pe=M.target;pe.tagName!=="INPUT"&&pe.tagName!=="SELECT"||pe.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(pe.type)||(M.preventDefault(),Wi(pe)?.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 pe=[...r.querySelectorAll('[aria-modal="true"]')].filter(Fe=>!Fe.closest("[hidden]"));return(pe[pe.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 pe=[...O.querySelectorAll(`button[data-hotkey="${G}"]`)].find(we=>we.closest(".fd-form")===O&&!we.closest("[hidden]")&&!we.disabled&&!we.hasAttribute("aria-busy"));pe&&(M.preventDefault(),O.removeAttribute("data-hotkeys"),pe.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(pe=>{let we=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":we.id},we,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(),pe(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(we=>!we.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 pe=g.on(M,G);return y.push(pe),pe},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 Kd='input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea',jf=new Set(["boolean","one2many","binary","image","html","json","properties"]);function zf(e){return e.replace(/\s+([^\p{L}\p{N}\s]{1,3})$/u,"\xA0$1")}function Jd(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 Bf="0.16.0",Gd=globalThis;for(let[e,t]of Gd.FieldiaLanguages??[])Ii(e,t);delete Gd.FieldiaLanguages;return il(qf);})();
|
|
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,pe)=>S.say(G,pe),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,(pe,ke)=>String(G[ke]??""));Do(r),Yd(r);function w(M,G={},...pe){let ke=r.createElement(M);for(let[Fe,Ne]of Object.entries(G))Ne!==void 0&&ke.setAttribute(Fe,Ne);return ke.append(...pe),ke}function j(M,G){let pe=wt(r,M,n.icons),ke=w("bdi",{},G);return pe?[pe,ke]:[ke]}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:pe}=await G();(pe==="check"||pe==="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:pe}=M,ke=$=>E(M.prefix+$),Fe=$=>L.push(M.root?$:()=>$(G.getState()));function Ne($,J){let Z=pe.fields[$.field],ee=ke($.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??pe.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=pe.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,pe.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=pe.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:ke(`${$.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=ke(`${$.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 ye($,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=ke(`${Qe.id}-tab`),ut=ke(`${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 ye($,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:pe,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:we,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"}),xe=w("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},m.retry);xe.addEventListener("click",()=>{vt()});let Ve=w("div",{class:"fd-status-box"},Pe,xe),X=()=>s.data.kind==="responses"?m.notSent:m.notSaved;function re(M){let G=[...O.querySelectorAll(".fd-field[data-path]")],pe=[];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;pe.some(Ze=>Ze.name===xt)||pe.push({name:xt,at:Ne?G.indexOf(Ne):1/0})}let ke=pe.sort((Fe,Ne)=>Fe.at-Ne.at).map(Fe=>Fe.name);return ke.length?A(m.checkFields,{what:X(),fields:ke.join(", ")}):X()}let me;x.push(M=>{let G=M.saveProblem,pe=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,pe),et(xe,!(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=!pe,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 ue=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()),ue.append(le,ce,ge),x.push(M=>{et(ue,!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(ke=>!ke.closest(".fd-tabpanel[hidden]"))){let ke=g.getState().errors,Fe=[...B.keys()].find(Ne=>ke[Ne]);Fe&&B.get(Fe)?.()}let G=[...O.querySelectorAll('[aria-invalid="true"]')].find(ke=>!ke.closest(".fd-tabpanel[hidden]"))??null;if(!G)return;for(let ke=G.closest(".fd-section-folded");ke;ke=ke.parentElement?.closest(".fd-section-folded")??null)z.get(ke)?.();if(!G.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(G.matches("input, select, textarea, button")?G:G.querySelector("input, select, textarea, button"))?.focus()}let ve=w("div",{class:"fd-done",hidden:""},w("p",{class:"fd-done-title"},m.submitted)),it=w("button",{type:"button",class:"fd-button"},m.submitAnother);ve.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,ve.hidden=!1)}it.addEventListener("click",()=>{g.reset(),lt.hidden=!1,ve.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 pe=await g.save();return pe||(g.getState().saveProblem||Re(re(g.getState())),fe()),pe}});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)))),pe=zt(M.footer);if(pe)return w("div",{},G,pe);let ke=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,ke);if(s.data.kind==="record"){let Ne=w("button",{type:"button",class:"fd-button"},m.discard);Ne.addEventListener("click",()=>g.reset()),Fe.insertBefore(Ne,ke),x.push(mt=>{let Ye=mt.dirty.length>0&&mt.status!=="saving"&&!ne;et(ke,!Ye),et(Ne,!Ye)})}else x.push(()=>et(ke,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}),pe=w("div",{class:"fd-progress-text"}),ke=w("span");G.append(w("div",{class:"fd-progress"},pe,w("div",{class:"fd-progress-bar"},ke)));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??""));pe.textContent=A(m.stepOf,{n:Se+1,total:at.length}),ke.style.width=`${(Se+1)/Math.max(1,at.length)*100}%`;for(let{step:ye,panel:ze}of mt)ze.hidden=ye.id!==Ie.step;let Ke=Se===at.length-1;Ye.hidden=Se===0,st.hidden=Ke||!M.children.find(ye=>ye.id===Ie.step)?.optional,xt.textContent=Ke?M.finishLabel??m.submit:M.nextLabel??m.next;for(let[ye,ze]of Ne){let qe=at.indexOf(ye);ze.parentElement.hidden=qe===-1,ze.classList.toggle("fd-step-done",qe!==-1&&qe<Se),ze.classList.toggle("fd-step-skipped",Ie.skipped.includes(ye)),ye===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}),pe=w("div",{class:"fd-actions"}),ke=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?pe.append(...(M.buttons??[]).map($e)):Ne?(pe.append(...(M.buttons??[]).map($e)),mt.append(Ve,Fe,ke)):pe.append(ke,Fe,...(M.buttons??[]).map($e),Ve),Te&&n.showActions!==!1&&pe.prepend(Te),x.push(Se=>{let Ke=Se.dirty.length>0&&Se.status!=="saving"&&!ne;ke.hidden=!Ke,Fe.hidden=!Ke});let st=w("div",{class:"fd-header"},pe),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(ye=>{let ze=w("div",{class:`fd-ribbon fd-tone-${ye.tone??"muted"}`,"data-node":ye.id,title:ye.tooltip},ye.label);return Se.append(ze),{ribbon:ye,element:ze}});x.push(ye=>{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],ye.values[qe.labelField],ye.values,l):"";Lt(u,N||qe.label)}}),Ze.append(Se)}if(M.statButtons?.length){let Se=w("div",{class:"fd-stats"}),Ke=(ye,ze)=>ye&&s.fields[ye]?St(s.fields[ye],ze[ye],ze,l):"";for(let ye of M.statButtons){let ze=w("span",{class:"fd-stat-value"}),qe=w("span",{class:"fd-stat-label"},ye.label),u=ye.secondField&&ye.secondLabel!==void 0?{value:w("span",{class:"fd-stat-value"}),label:w("span",{class:"fd-stat-label"},ye.secondLabel)}:null,F=wt(r,ye.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=ye.help?k(`${ye.id}-help`):void 0,_=w("button",{type:"button",class:"fd-stat","data-node":ye.id,title:ye.help||void 0,"aria-describedby":P},...F?[F,N]:[N]);P&&Se.append(w("span",{class:"fd-sr-only",id:P},ye.help)),_.addEventListener("click",()=>{H(_,()=>g.runAction(ye.id))}),x.push(Q=>{_.hidden=g.node(ye.id).invisible;let $=Q.values,J=Ke(ye.unitField,$)||ye.unit||"",Z=Ke(ye.field,$),ee=Ke(ye.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(ye.labelField,$)||ye.label)}),Se.append(_)}x.push(()=>{Se.hidden=[...Se.querySelectorAll(":scope > .fd-stat")].every(ye=>ye.hidden)}),Ze.append(Se)}for(let Se of M.alerts??[]){let Ke=Xo(r,s.fields,Se.message,l),ye=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},ye);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(ye,N):ze&&ye.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 ye=w("span",{class:`fd-badge fd-tone-${Ke.tone??"muted"}`,"data-node":Ke.id},...j(Ke.icon,Ke.label));ae(ye,Ke.id),Se.append(ye)}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=>we(u))));let Ke=we({type:"field",id:"#title",field:M.title.field,placeholder:M.title.placeholder,...M.title.placeholderWhen?{placeholderWhen:M.title.placeholderWhen}:{},...M.title.focus?{focus:!0}:{}}),ye=M.title.before??[],ze=M.title.after??[];if(ye.length||ze.length){Ke.classList.add("fd-title-name");let u=F=>{let N=we(F);return N.classList.add("fd-title-side"),N};Se.append(w("div",{class:"fd-title-line"},...ye.map(u),Ke,...ze.map(u)))}else Se.append(Ke);M.title.subtitleField&&Se.append(we({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=>we(u))));let qe=w("div",{class:"fd-title-row"},Se);if(M.title.avatarField){let u=we({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],pe={clickable:M.clickable===!0};M.visibleStates&&(pe.visibleStates=M.visibleStates);for(let Ne of["durationsField","fold","saves"])M[Ne]!==void 0&&(pe[Ne]=M[Ne]);let ke={type:"field",id:"#statusbar",field:M.field,widget:"statusbar",options:pe},Fe=Ot({form:g,name:M.field,field:G,node:ke,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,ue,dn),O.append(lt,ve,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 pe=G.scrollWidth>G.clientWidth&&G.value!=="";kt(G,"title",pe?G.value:null),kt(G,"data-cut-title",pe?"":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"]')),pe=M.closest(".fd-field"),ke=G.slice(G.indexOf(pe)+1);for(let Fe of ke){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}if(M.defaultPrevented||!G.enterMovesToNext||M.shiftKey||M.altKey)return;let pe=M.target;pe.tagName!=="INPUT"&&pe.tagName!=="SELECT"||pe.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(pe.type)||(M.preventDefault(),Wi(pe)?.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 pe=[...r.querySelectorAll('[aria-modal="true"]')].filter(Fe=>!Fe.closest("[hidden]"));return(pe[pe.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 pe=[...O.querySelectorAll(`button[data-hotkey="${G}"]`)].find(ke=>ke.closest(".fd-form")===O&&!ke.closest("[hidden]")&&!ke.disabled&&!ke.hasAttribute("aria-busy"));pe&&(M.preventDefault(),O.removeAttribute("data-hotkeys"),pe.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(pe=>{let ke=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":ke.id},ke,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(),pe(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(ke=>!ke.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 pe=g.on(M,G);return y.push(pe),pe},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.17.0",Qd=globalThis;for(let[e,t]of Qd.FieldiaLanguages??[])Ii(e,t);delete Qd.FieldiaLanguages;return dl(Uf);})();
|
|
65
65
|
//# sourceMappingURL=fieldia.js.map
|