jupiter-dynamic-forms 1.22.3 → 1.22.5
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/dist/core/concept-tree.d.ts +8 -1
- package/dist/core/concept-tree.d.ts.map +1 -1
- package/dist/core/dynamic-form.d.ts +45 -3
- package/dist/core/dynamic-form.d.ts.map +1 -1
- package/dist/core/form-field.d.ts +1 -0
- package/dist/core/form-field.d.ts.map +1 -1
- package/dist/core/form-section.d.ts +2 -1
- package/dist/core/form-section.d.ts.map +1 -1
- package/dist/core/formula-validation-dialog.d.ts +3 -0
- package/dist/core/formula-validation-dialog.d.ts.map +1 -1
- package/dist/index.js +384 -232
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +611 -95
- package/dist/index.mjs.map +1 -1
- package/dist/schema/types.d.ts +25 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/utils/formula-expression-evaluator.d.ts +3 -0
- package/dist/utils/formula-expression-evaluator.d.ts.map +1 -1
- package/dist/utils/formula-precondition-evaluator.d.ts +5 -1
- package/dist/utils/formula-precondition-evaluator.d.ts.map +1 -1
- package/dist/utils/formula-variable-resolver.d.ts +16 -27
- package/dist/utils/formula-variable-resolver.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
* Copyright 2017 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const w={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},I=(e=w,t,i)=>{const{kind:o,metadata:r}=i;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===o){const{name:o}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,r,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=i;return function(i){const r=this[o];t.call(this,i),this.requestUpdate(o,r,e)}}throw Error("Unsupported decorator location: "+o)};function S(e){return(t,i)=>"object"==typeof i?I(e,t,i):((e,t,i)=>{const o=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),o?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/function C(e){return S({...e,state:!0,attribute:!1})}class ${static validateField(e,t,i,o,r,n=[]){const a=[];for(const s of n){const n=this.validateRule(e,t,i,o,r,s);n&&a.push(n)}return a}static validateRule(e,t,i,o,r,n){const a=null==o||""===o;switch(n.type){case"required":if(a)return this.createError(e,t,i,n);break;case"min":if(!a&&"number"==typeof o&&o<n.value)return this.createError(e,t,i,n);break;case"max":if(!a&&"number"==typeof o&&o>n.value)return this.createError(e,t,i,n);break;case"minLength":if(!a&&"string"==typeof o&&o.length<n.value)return this.createError(e,t,i,n);break;case"maxLength":if(!a&&"string"==typeof o&&o.length>n.value)return this.createError(e,t,i,n);break;case"pattern":if(!a&&"string"==typeof o){if(!new RegExp(n.value).test(o))return this.createError(e,t,i,n)}break;case"email":if(!a&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,n)}break;case"url":if(!a&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,n)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${n.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class k{static formatPeriodDisplay(e,t){if(!e||!t)return`${e} / ${t}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}static createUniqueConceptId(e,t){let i=e.id;if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),o=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");i=`${e.id}_${o}`}if(t){return`${i}__${this.createSectionHash(t)}`}return i}static createSectionHash(e){let t=0;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t&=t}return Math.abs(t).toString(36).substr(0,6)}static _extractDocumentationLabels(e){const t={};return e.filter(e=>"http://www.xbrl.org/2003/role/documentation"===e.role).forEach(e=>{t[e.lang]=e.label}),t}static buildFormSchema(e,t,i,o="en",r){var n,a;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const s=e.presentation[0],l=null==(n=e.hypercubes)?void 0:n[0],d=Array.isArray(e.datatypes)?e.datatypes:(null==(a=e.datatypes)?void 0:a.concepts)||[],c=[];return s.roles.forEach(e=>{const n=this.buildSectionFromRole(e,t,i,l,o,r);d&&d.length>0?(n.datatypes=d,d.length,n.id):console.warn(`⚠️ [buildFormSchema] No datatypes available for section ${n.id}`),this.assignFieldColumnIds(n),c.push(n)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(s.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:c}}static buildSectionFromRole(e,t,i,o,r="en",n){var a,s;let l;if(e.labels&&e.labels.length>0){const t=e.labels.find(e=>e.lang===r),i=e.labels.find(e=>"en"===e.lang)||e.labels[0];l=(t||i).label}else l=this.extractRoleTitle(e.role||e.id||"Unknown Role");const d=this.getAllNonAbstractConcepts(e),c=new Set(d.filter(e=>e.periodType).map(e=>e.periodType));let p=null==o?void 0:o.roles.find(t=>t.roleId===e.id);const u=null==n?void 0:n[e.id];p&&(null==u?void 0:u.dimensionSelections)&&u.dimensionSelections.length>0&&(e.id,p=this.filterHypercubeDimensionsBySelection(p,u.dimensionSelections));const h=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",p,d,c,u,r),m={periodTypes:c,availableColumnIds:h.map(e=>e.id),availableColumns:h},f=[],b=new Map;return(null==(a=e.presentationLinkbase)?void 0:a.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const n=this.buildConceptTree(o,0,t,i,m,e.id,r,b);n&&f.push(n)}),p&&(null==(s=p.items)?void 0:s.length)||!o||f.forEach(t=>this.applyCrossRoleDimensions(t,e.id,o,r)),{id:e.id,title:l,description:e.description||`Section for ${l}`,concepts:f,columns:h,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role},showPeriodControl:c.size>1,showPreviousYear:!0===e.showPreviousYear,instant:!0===e.instant,duration:!0===e.duration}}static buildConceptTree(e,t,i,o,r,n,a="en",s,l){var d,c;const p=this.getPreferredLabel(e.labels,a,e.preferredLabel),u=(null==(d=e.preferredLabel)?void 0:d.includes("periodStartLabel"))?"start":(null==(c=e.preferredLabel)?void 0:c.includes("periodEndLabel"))?"end":l,h="start"===u?"periodStartLabel":"end"===u?"periodEndLabel":void 0,m=[];if(!e.elementAbstract){let t=[];t=(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?r.availableColumnIds:["duration"],t.forEach(t=>{var n;const s=null==(n=null==r?void 0:r.availableColumns)?void 0:n.find(e=>e.id===t),d=(null==s?void 0:s.periodStartDate)||i,c=(null==s?void 0:s.periodEndDate)||o,p=this.createFieldFromConcept(e,d,c,t,l,a);p&&m.push(p)})}const f=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const l=this.buildConceptTree(e,t+1,i,o,r,n,a,s,u);l&&f.push(l)});if(!(m.length>0||f.length>0))return null;let b=this.createUniqueConceptId(e,n);if(s){const e=s.get(b)??0;s.set(b,e+1),e>0&&(b=`${b}__occ${e+1}`)}const g={conceptName:e.conceptName,type:e.type,substitutionGroup:e.substitutionGroup,periodType:e.periodType,balance:e.balance,documentationLabels:this._extractDocumentationLabels(e.labels)};return{id:b,originalConceptId:e.id,name:e.conceptName,label:p,description:`${e.conceptName} (${e.type})`,type:e.type,level:t,children:f,fields:m,conceptMetadata:g,facts:e.facts||[],collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType,balance:e.balance,preferredLabel:e.preferredLabel,effectivePeriodRole:h}}static createFieldFromConcept(e,t,i,o,r,n="en"){var a;const s=this.mapXBRLTypeToFieldType(e.type),l=this.getPreferredLabel(e.labels,n,e.preferredLabel);let d;d=o||"duration";const c={id:`${e.id}_${d}_field`,conceptId:e.id,columnId:d,type:s,label:l,placeholder:`Enter ${l.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null,periodType:"instant"===e.periodType||"duration"===e.periodType?e.periodType:void 0,periodStartDate:t||"2025-01-01",periodEndDate:i||"2025-12-31",periodInstantDate:"instant"===e.periodType?(null==(a=e.preferredLabel)?void 0:a.includes("periodStartLabel"))||"start"===r?this.subtractOneDay(t||"2025-01-01"):i||t||"2025-01-01":void 0};return"nl-cd_DescriptionLocationNL__a64trl"===e.id&&(e.id,e.periodType),c}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e,t="en",i){if(!e||0===e.length)return"Unnamed Concept";const o=e.filter(e=>e.lang===t),r=o.length>0?o:e;if(i){const t=o.find(e=>e.role===i);if(t)return t.label;const r=e.find(e=>e.role===i);if(r)return r.label}const n=r.find(e=>e.preferredLabel);if(n)return n.label;const a=r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(a)return a.label;const s=r.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return s?s.label:r.length>0?r[0].label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static filterHypercubeDimensionsBySelection(e,t){const i=JSON.parse(JSON.stringify(e));return i.items&&0!==i.items.length?(i.items.forEach(e=>{e.dimensions&&(e.dimensions=e.dimensions.map(e=>{var i,o;const r=t.find(t=>t.dimensionId===e.id);if(!r||!r.selectedMemberIds||0===r.selectedMemberIds.length)return e;const n={...e};return n.members=this.filterMembersBySelection(e.members,r.selectedMemberIds),e.id,null==(i=e.members)||i.length,null==(o=n.members)||o.length,n}))}),i):i}static filterMembersBySelection(e,t){if(!e||!Array.isArray(e))return[];const i=[];return e.forEach(e=>{if(t.includes(e.id)&&i.push({...e,children:[]}),e.children&&e.children.length>0){const o=this.filterMembersBySelection(e.children,t);i.push(...o)}}),i}static findCrossRoleDimensions(e,t,i,o="en"){var r,n;const a=[];for(const d of i.roles)if(d.roleId!==t)for(const t of d.items)if((null==(r=t.conceptIds)?void 0:r.includes(e))&&(null==(n=t.dimensions)?void 0:n.some(e=>e.typedMember))){a.push(d);break}if(1!==a.length)return null;const s=a[0].items.find(t=>{var i;return null==(i=t.conceptIds)?void 0:i.includes(e)});if(!s)return null;const l=[];for(const d of s.dimensions){if(!d.typedMember)continue;const e=d.labels.find(e=>e.lang===o)||d.labels.find(e=>"en"===e.lang)||d.labels[0],t=(null==e?void 0:e.label)||d.id;l.push({axisId:d.id,axisLabel:t,typedMemberId:d.typedMember.id,memberLabel:t,type:d.typedMember.type,validation:d.typedMember.validation})}return l.length>0?l:null}static applyCrossRoleDimensions(e,t,i,o){var r;if(!e.abstract&&e.fields&&e.fields.length>0){const r=this.findCrossRoleDimensions(e.originalConceptId,t,i,o);r&&e.fields.forEach(e=>{e.crossRoleTypedMembers=r})}null==(r=e.children)||r.forEach(e=>this.applyCrossRoleDimensions(e,t,i,o))}static generateDefaultColumnsForRole(e,t,i,o,r,n,a,s="en"){var l,d;const c=r||this.getAllNonAbstractConcepts(e),p=n||new Set(c.filter(e=>e.periodType).map(e=>e.periodType));if(0===c.length)return[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let u=[];if(1===(null==(l=null==o?void 0:o.items)?void 0:l.length)){const e=o.items[0];1===e.dimensions.length?u=this.generateSingleDimensionColumns(e.dimensions[0],t,i,p,s):e.dimensions.length>1&&(u=this.generateMultiDimensionColumns(e.dimensions,t,i,p,s)),a&&(u=this.filterColumnsByPeriodPreferences(u,a))}else(null==(d=null==o?void 0:o.items)?void 0:d.length)&&o.items.length;const h=[];u.length>0?h.push(...u):0===p.size?h.push({id:"default",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i}):h.push({id:"duration",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i});let m=h;if(a&&(m=this.filterColumnsByPeriodPreferences(h,a)),null==a?void 0:a.showPreviousYear){const e=this.generatePreviousYearColumns(m,t,i);m=[...m,...e]}return m}static getPreviousYearDate(e){try{const t=new Date(e);return t.setFullYear(t.getFullYear()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error calculating previous year for date ${e}:`,t),e}}static subtractOneDay(e){try{const t=new Date(e);return t.setDate(t.getDate()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error subtracting one day from date ${e}:`,t),e}}static generatePreviousYearColumns(e,t,i){const o=[],r=this.getPreviousYearDate(t),n=this.getPreviousYearDate(i);return e.forEach((e,t)=>{let i=e.title,a="",s="";e.dimensionData?(i=e.title,a=this.formatPeriodDisplay(r,n),s=`${e.id}_prev`):(i=this.formatPeriodDisplay(r,n),a="",s=`duration_prev_${t}`),o.push({...e,id:s,title:i,description:a,order:e.order+100,removable:!1,periodStartDate:r,periodEndDate:n,dimensionData:e.dimensionData?{...e.dimensionData,dimensionId:`${e.dimensionData.dimensionId}_prev`}:void 0})}),o}static filterColumnsByPeriodPreferences(e,t){return e.filter(e=>{var i,o,r,n;const a=e.id.includes("duration")||(null==(o=null==(i=e.dimensionData)?void 0:i.dimensionId)?void 0:o.includes("duration")),s=e.id.includes("instant")||(null==(n=null==(r=e.dimensionData)?void 0:r.dimensionId)?void 0:n.includes("instant"));return!a&&!s||!(a&&!t.showDuration)&&!(s&&!t.showInstant)})}static generateSingleDimensionColumns(e,t,i,o,r="en"){if(e.typedMember&&(!e.members||0===e.members.length)){const n=this.getPreferredLabel(e.labels,r)||e.conceptName,a={axisId:e.id,axisLabel:n,typedMemberId:e.typedMember.id,type:e.typedMember.type,validation:e.typedMember.validation,dimensionKey:`${n} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`},s=[];return 0===o.size?s.push({id:"typed-default",title:n,description:"Typed dimension input column",type:"dimension",dimensionData:{dimensionId:"typed-default",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?s.push({id:"typed-instant",title:`${n} `,description:i,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):(1===o.size&&o.has("duration"),s.push({id:"typed-duration",title:`${n} `,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:t,periodEndDate:i})),s}if(!e.members||!Array.isArray(e.members))return[];if(0===e.members.length)return[];const n=this.getPreferredLabel(e.labels,r)||e.conceptName,a=e.members[0],s=this.getPreferredLabel(a.labels,r)||a.conceptName,l={axisId:e.id,axisLabel:n,memberId:a.id,memberLabel:s,dimensionKey:`${n} | ${s}`,dimensionIdKey:`${e.id} | ${a.id}`},d=[];return 0===o.size?d.push({id:"default",title:l.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?d.push({id:"instant",title:`${l.memberLabel}`,description:i,type:"dimension",dimensionData:{dimensionId:"instant",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):1===o.size&&o.has("duration")?d.push({id:"duration",title:`${l.memberLabel}`,description:`${t} / ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):d.push({id:"duration",title:`${l.memberLabel}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"duration",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}),d}static generateMultiDimensionColumns(e,t,i,o,r="en"){e.some(e=>e.typedMember);const n=e.filter(e=>!!e.typedMember||!!(e.members&&Array.isArray(e.members)&&e.members.length>0));if(0===n.length)return[];const a=n.map(e=>{const t=this.getPreferredLabel(e.labels,r)||e.conceptName;if(e.typedMember)return{id:e.id,axisLabel:t,isTyped:!0,typedMemberId:e.typedMember.id,type:e.typedMember.type,validation:e.typedMember.validation,members:[{id:"[typed]",label:`${t}`}]};const i=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:t,isTyped:!1,members:i.map(e=>({id:e.id,label:this.getPreferredLabel(e.labels,r)||e.conceptName}))}}),s=this.generateDimensionCombinations(a),l=[];return s.forEach((e,o)=>{const r=e.map(e=>e.memberLabel).join(" | "),n=e.filter(e=>e.isTyped),a=e.filter(e=>!e.isTyped),s={dimensionId:`multi_${o}`,memberValue:r,memberLabel:r,combinations:a.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:n.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel,type:e.type,validation:e.validation})),hasTypedMembers:n.length>0,memberKey:r,dimensionIdKey:[...a.map(e=>`${e.axisId}|${e.memberId}`),...n.map(e=>`${e.axisId}|[typed]`)].join("::")};l.push({id:`duration_${o}`,title:`${r}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{...s,dimensionId:`duration_${o}`},order:o,removable:!1,periodStartDate:t,periodEndDate:i})}),l}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label,isTyped:e[0].isTyped||!1,typedMemberId:e[0].typedMemberId,type:e[0].type,validation:e[0].validation}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId,type:t.type,validation:t.validation}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId,type:t.type,validation:t.validation},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){if(!e)return"Unnamed Section";const t=e.match(/^\[[\d]+\]\s*(.+)$/);if(t)return t[1].trim();if(e.match(/^[a-z]+:[^:]*$/i)||e.match(/^urn:[^:]+:[^:]+/i)){const t=e.split(/[:\-]/);return t[t.length-1].replace(/[_\-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}return e.trim()||"Unnamed Section"}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}const T={en:{conceptInfo:{title:"Concept Information",conceptName:"Concept name",type:"Type",substitutionGroup:"Substitution group",periodType:"Period type",balance:"Balance",documentation:"Documentation",instant:"Instant",duration:"Duration",close:"Close"},form:{markAsComplete:"Mark as Complete",loading:"Loading form...",submit:"Validate",save:"Save",saveDraft:"Save Draft",savingDraft:"Saving draft",errors:"Errors",modified:"Modified",valid:"Valid",yes:"Yes",no:"No",noRoleSelected:"No Role Selected",pleaseSelectRole:"Please select a role from the list on the left.",expandPanel:"Expand side panel",collapsePanel:"Collapse side panel",validate:"Validate",preview:"Preview",download:"Download",cancelValidation:"Cancel Validation",lastValidationResults:"Last Validation Results",validationInProgress:"Validation In Progress",quickValidate:"Quick Validate"},filter:{selectRoles:"Select Roles",filterRoles:"Filter Roles",title:"Filter Roles",description:"Select the roles you want to display in the form. You can search and choose specific roles to focus on or manage all available roles.",searchPlaceholder:"Search..",clearSearch:"Clear search",showingResults:"Showing",of:"of",roles:"roles",matching:"matching",selectAll:"Select All",selectNone:"Select None",selectFiltered:"Select Filtered",deselectFiltered:"Deselect Filtered",deselectAll:"Deselect All",reset:"Reset",noRolesFound:"No roles found matching",tryDifferentSearch:"Try a different search term or clear the search.",noRolesAvailable:"No roles available.",cancel:"Cancel",applyFilter:"Apply Filter",showPeriodColumn:"Show Period Column:",additionalOptions:"Additional Options:",showPreviousYear:"Show previous year",duration:"Duration",instant:"Instant",uri:"URI",dimensionMemberSelection:"Dimension Member Selection",selectAllMembers:"Select All",clearMembers:"Clear",availableRoles:"Available Roles",chosenRoles:"Chosen Roles",roleCount:"role(s)",rolesSelected:"role(s) selected",addSelectedRole:"Add selected role",addAllRoles:"Add all roles",removeSelectedRole:"Remove selected role",removeAllRoles:"Remove all roles",advancedFilter:"Advanced Filter",backToFilterRoles:"← Back",showFactsOnly:"Show facts only",showFactsOnlyDescription:"Hide all blank rows and sections. Only roles and rows with at least one filled value will be shown.",searchByConcept:"Search by concept",searchByConceptDescription:"Type concept name or label to filter roles and rows. Press Apply Filter to apply.",searchByConceptPlaceholder:"Type concept name or label and press Apply Filter...",clearFilters:"Clear Filters",resetFilter:"Reset",bannerConcept:'Filtered by "{{concept}}" — {{count}} row(s) visible',bannerFactsOnly:"Only filled-in fields are shown",showAll:"Show all"},column:{addColumn:"Add Column",columnOptions:"Column Options",columnType:"Column Type",instantSingleDate:"Instant (single date)",durationDates:"Duration (start and end dates)",instantDate:"Instant Date",startPeriodDate:"Start Period Date",endPeriodDate:"End Period Date",availableDimensions:"Available Dimensions",dimensionsDescription:"Select dimensions to include in the column. Domain members can be selected here, while typed dimension values will be entered directly in the column header.",enterValue:"Enter value for",enterValuePlaceholder:"Enter value...",selectMember:"Select member:",noMembersAvailable:"No members available for this dimension",cancel:"Cancel",removeColumn:"Remove column",hideColumn:"Hide column",showColumn:"Double-click to show column",required:"required"},section:{enterPlaceholder:"Enter",position:"Section {{current}} of {{total}}",previous:"← Previous",next:"Next: {{title}} →",locateInList:"Show this section in the list on the left",amountScaleBase:"Amounts in €",amountScaleFactor:"Amounts in € × {{factor}}"},field:{selectOption:"Select an option...",select:"Select...",emptyOption:"—",enterDetailedExplanation:"Detailed explanation",enterAmountNoDecimals:"Amount, no decimals",enterCurrency:"0.00",enterText:"Text",enterWholeNumber:"Whole number",enterPositiveNumber:"Positive number",enterDecimalValue:"Decimal value",enterNumberOfShares:"Number of shares",yearFormat:"YYYY",enterPercentage:"e.g. 0.25 for 25% or 0.2550 for 25.50%",emailPlaceholder:"email@example.com",urlPlaceholder:"https://example.com",phonePlaceholder:"+1 (555) 000-0000",enterValue:"Value",enterDetailedInformation:"Detailed information",scale:"Scale",addText:"Add text",editText:"Edit",save:"Save",cancel:"Cancel",characters:"characters",editPeriod:"Edit Period",from:"From",to:"To",date:"Date",unit:"Unit",selectUnit:"Select Unit",leaveBlankForInf:"Leave blank for INF",prefilledLocked:"Pre-filled — cannot be changed here",invalidNumber:'Can\'t read "{{value}}" as a number',noDecimalsAllowed:"This field doesn't accept decimals",negativeNotAllowed:"A negative value isn't allowed here",ambiguousNumber:'"{{value}}" is ambiguous — retype it without the thousands separator'},admin:{title:"Configure Roles",description:"Select which roles should display the 'Show Previous Year' checkbox and configure period type columns."},validation:{summary:"Please fix the following errors before submitting:",errorsFound:"errors found",unitRequired:"Unit is required. Please select a unit via the period icon.",typedMemberRequired:"This field is required because data has been entered in this column."},xbrlValidation:{patternMismatch:"Value does not match required pattern: {{pattern}}",invalidPattern:"Invalid pattern configuration: {{pattern}}",exactLength:"Value must be exactly {{required}} characters (current: {{current}})",minLength:"Value must be at least {{required}} characters (current: {{current}})",maxLength:"Value must not exceed {{required}} characters (current: {{current}})",totalDigits:"Value must not exceed {{required}} total digits (current: {{current}})",ruleSummaryPattern:"Must match pattern: {{pattern}}",ruleSummaryExactLength:"Must be exactly {{required}} characters",ruleSummaryMinLength:"Minimum {{required}} characters",ruleSummaryMaxLength:"Maximum {{required}} characters",ruleSummaryTotalDigits:"Maximum {{required}} total digits"},error:{popup:{title:"Validation Errors",message:"Please fix the following validation errors before saving:",field:"Field:",value:"Value:",errors:"Errors:",clickToFocus:"Click to focus this field",ok:"OK"}},typedDimensionWarning:{title:"Typed dimension values missing",message:"The form contains errors for the following roles where a typed dimension value is missing. Do you still want to continue?",role:"Role:",field:"Field:",value:"Value:",clickToFocus:"Click to go to this fact",continue:"Continue to validate",cancel:"Cancel"},calculationWarning:{title:"Calculation warning",summaryLine:'Total "{{label}}" should equal {{calculated}}, but you entered {{entered}}.',childrenPrefix:"Children:",childAdded:"{{label}} = {{value}} (added)",childSubtracted:"{{label}} = {{value}} (subtracted, opposite balance)",added:"Added",subtracted:"Subtracted (opposite balance)"},balanceCheck:{balanced:"{{column}}: In balance",difference:"Difference {{column}}: {{amount}}"},formulaValidation:{dialogTitle:"Formula check results",allPassed:"All formula checks passed",summaryCount:"{{failed}} of {{total}} checks failed",summaryCountBreakdown:"{{warnings}} warnings, {{errors}} errors",severityWarning:"Warning",severityError:"Error",close:"Close"},scrollToConcept:{revealRole:{title:"Role not in your filtered list",message:'This field is in the role "{{role}}", which is not in your filtered list of roles. Do you want to make this role visible?',confirm:"Yes, show role",cancel:"No"}}},nl:{conceptInfo:{title:"Conceptinformatie",conceptName:"Conceptnaam",type:"Type",substitutionGroup:"Substitutiegroep",periodType:"Periodetype",balance:"Saldo",documentation:"Documentatie",instant:"Moment",duration:"Periode",close:"Sluiten"},form:{markAsComplete:"Markeren als volledig behandeld",loading:"Formulier laden...",submit:"Valideren",save:"Opslaan",saveDraft:"Concept opslaan",savingDraft:"Concept opslaan...",errors:"Fouten",modified:"Gewijzigd",valid:"Geldig",yes:"Ja",no:"Nee",noRoleSelected:"Geen rol geselecteerd",pleaseSelectRole:"Selecteer een rol uit de lijst aan de linkerkant.",expandPanel:"Zijpaneel uitvouwen",collapsePanel:"Zijpaneel inklappen",validate:"Valideren",preview:"Voorbeeld",download:"Downloaden",cancelValidation:"Validatie annuleren",lastValidationResults:"Laatste validatieresultaten",validationInProgress:"Validatie bezig",quickValidate:"Snel valideren"},filter:{selectRoles:"Rollen selecteren",filterRoles:"Rollen filteren",title:"Rollen filteren",description:"Selecteer de rollen die u in het formulier wilt weergeven. U kunt zoeken en specifieke rollen kiezen om op te focussen of alle beschikbare rollen beheren.",searchPlaceholder:"Zoek rollen op naam, ID of URI...",clearSearch:"Zoekopdracht wissen",showingResults:"Weergeven",of:"van",roles:"rollen",matching:"overeenkomend met",selectAll:"Alles selecteren",selectNone:"Niets selecteren",selectFiltered:"Gefilterd selecteren",deselectFiltered:"Gefilterd deselecteren",deselectAll:"Alles deselecteren",reset:"Resetten",noRolesFound:"Geen rollen gevonden die overeenkomen met",tryDifferentSearch:"Probeer een andere zoekterm of wis de zoekopdracht.",noRolesAvailable:"Geen rollen beschikbaar.",cancel:"Annuleren",applyFilter:"Filter toepassen",showPeriodColumn:"Periodekolom weergeven:",additionalOptions:"Aanvullende opties:",showPreviousYear:"Vorig jaar weergeven",duration:"Duur",instant:"Moment",uri:"URI",dimensionMemberSelection:"Dimensieleden selectie",selectAllMembers:"Alles selecteren",clearMembers:"Wissen",availableRoles:"Beschikbare rollen",chosenRoles:"Gekozen rollen",roleCount:"rol(len)",rolesSelected:"rol(len) geselecteerd",addSelectedRole:"Geselecteerde rol toevoegen",addAllRoles:"Alle rollen toevoegen",removeSelectedRole:"Geselecteerde rol verwijderen",removeAllRoles:"Alle rollen verwijderen",advancedFilter:"Geavanceerd filter",backToFilterRoles:"← Terug",showFactsOnly:"Alleen feiten weergeven",showFactsOnlyDescription:"Verberg alle lege rijen en secties. Alleen rollen en rijen met minimaal één ingevulde waarde worden weergegeven.",searchByConcept:"Zoeken op concept",searchByConceptDescription:"Typ een conceptnaam of label om rollen en rijen te filteren. Druk op Filter toepassen om te activeren.",searchByConceptPlaceholder:"Typ conceptnaam of label en druk op Filter toepassen...",clearFilters:"Filters wissen",resetFilter:"Resetten",bannerConcept:'Gefilterd op "{{concept}}" — {{count}} rij(en) zichtbaar',bannerFactsOnly:"Alleen ingevulde velden worden getoond",showAll:"Alles tonen"},column:{addColumn:"Kolom toevoegen",columnOptions:"Kolomopties",columnType:"Kolomtype",instantSingleDate:"Moment (enkele datum)",durationDates:"Duur (begin- en einddatum)",instantDate:"Momentdatum",startPeriodDate:"Startdatum periode",endPeriodDate:"Einddatum periode",availableDimensions:"Beschikbare dimensies",dimensionsDescription:"Selecteer dimensies om in de kolom op te nemen. Domeinleden kunnen hier worden geselecteerd, terwijl getypte dimensiewaarden direct in de kolomkop worden ingevoerd.",enterValue:"Voer waarde in voor",enterValuePlaceholder:"Voer waarde in...",selectMember:"Selecteer lid:",noMembersAvailable:"Geen leden beschikbaar voor deze dimensie",cancel:"Annuleren",removeColumn:"Kolom verwijderen",hideColumn:"Kolom verbergen",showColumn:"Dubbelklik om kolom te tonen",required:"verplicht"},section:{enterPlaceholder:"Invoeren",position:"Onderdeel {{current}} van {{total}}",previous:"← Vorige",next:"Volgende: {{title}} →",locateInList:"Toon dit onderdeel in de lijst aan de linkerkant",amountScaleBase:"Bedragen in €",amountScaleFactor:"Bedragen in € × {{factor}}"},field:{selectOption:"Selecteer een optie...",select:"Selecteer...",emptyOption:"—",enterDetailedExplanation:"Gedetailleerde uitleg",enterAmountNoDecimals:"Bedrag, zonder decimalen",enterCurrency:"0,00",enterText:"Tekst",enterWholeNumber:"Geheel getal",enterPositiveNumber:"Positief getal",enterDecimalValue:"Decimale waarde",enterNumberOfShares:"Aantal aandelen",yearFormat:"JJJJ",enterPercentage:"bijv. 0,25 voor 25% of 0,2550 voor 25,50%",emailPlaceholder:"email@voorbeeld.nl",urlPlaceholder:"https://voorbeeld.nl",phonePlaceholder:"+31 (0)20 123 4567",enterValue:"Waarde",enterDetailedInformation:"Gedetailleerde informatie",scale:"Schaal",addText:"Tekst toevoegen",editText:"Bewerken",save:"Opslaan",cancel:"Annuleren",characters:"tekens",editPeriod:"Periode bewerken",from:"Van",to:"Tot",date:"Datum",unit:"Eenheid",selectUnit:"Selecteer eenheid",leaveBlankForInf:"Leeg laten voor INF",prefilledLocked:"Vooraf ingevuld — kan hier niet worden gewijzigd",invalidNumber:"Kan '{{value}}' niet lezen als getal",noDecimalsAllowed:"Dit veld accepteert geen decimalen",negativeNotAllowed:"Een negatieve waarde is hier niet toegestaan",ambiguousNumber:"'{{value}}' is dubbelzinnig — typ het opnieuw zonder duizendtalscheidingsteken"},admin:{title:"Rollen configureren",description:"Selecteer welke rollen het selectievakje 'Vorig jaar weergeven' moeten weergeven en configureer periodetype kolommen."},validation:{summary:"Corrigeer de volgende fouten voordat u indient:",errorsFound:"fouten gevonden",unitRequired:"Eenheid is verplicht. Selecteer een eenheid via het periodeicoon.",typedMemberRequired:"Dit veld is verplicht omdat er gegevens zijn ingevoerd in deze kolom."},xbrlValidation:{patternMismatch:"Waarde voldoet niet aan het vereiste patroon: {{pattern}}",invalidPattern:"Ongeldige patternconfiguratie: {{pattern}}",exactLength:"Waarde moet exact {{required}} tekens bevatten (huidig: {{current}})",minLength:"Waarde moet minimaal {{required}} tekens bevatten (huidig: {{current}})",maxLength:"Waarde mag niet meer dan {{required}} tekens bevatten (huidig: {{current}})",totalDigits:"Waarde mag niet meer dan {{required}} cijfers bevatten (huidig: {{current}})",ruleSummaryPattern:"Moet overeenkomen met patroon: {{pattern}}",ruleSummaryExactLength:"Moet exact {{required}} tekens bevatten",ruleSummaryMinLength:"Minimaal {{required}} tekens",ruleSummaryMaxLength:"Maximaal {{required}} tekens",ruleSummaryTotalDigits:"Maximaal {{required}} cijfers"},error:{popup:{title:"Validatiefouten",message:"Corrigeer de volgende validatiefouten voordat u opslaat:",field:"Veld:",value:"Waarde:",errors:"Fouten:",clickToFocus:"Klik om dit veld te focussen",ok:"OK"}},typedDimensionWarning:{title:"Waarden voor typed dimensie ontbreken",message:"Het formulier bevat fouten voor de volgende rollen waar een waarde voor de typed dimensie ontbreekt. Wilt u toch doorgaan?",role:"Rol:",field:"Veld:",value:"Waarde:",clickToFocus:"Klik om naar dit feit te gaan",continue:"Doorgaan met valideren",cancel:"Annuleren"},calculationWarning:{title:"Berekeningswaarschuwing",summaryLine:'Totaal "{{label}}" zou {{calculated}} moeten zijn, maar u heeft {{entered}} ingevoerd.',childrenPrefix:"Onderdelen:",childAdded:"{{label}} = {{value}} (opgeteld)",childSubtracted:"{{label}} = {{value}} (afgetrokken, tegengestelde balans)",added:"Opgeteld",subtracted:"Afgetrokken (tegengestelde balans)"},balanceCheck:{balanced:"{{column}}: In balans",difference:"Verschil {{column}}: {{amount}}"},formulaValidation:{dialogTitle:"Resultaten formulecontrole",allPassed:"Alle formulecontroles geslaagd",summaryCount:"{{failed}} van {{total}} controles mislukt",summaryCountBreakdown:"{{warnings}} waarschuwingen, {{errors}} fouten",severityWarning:"Waarschuwing",severityError:"Fout",close:"Sluiten"},scrollToConcept:{revealRole:{title:"Rol niet in uw gefilterde lijst",message:'Dit veld staat in de rol "{{role}}", die niet in uw gefilterde lijst met rollen staat. Wilt u deze rol zichtbaar maken?',confirm:"Ja, rol tonen",cancel:"Nee"}}}};class E{static setLanguage(e){T[e]?this.currentLanguage=e:(console.warn(`Language '${e}' not supported, falling back to 'en'`),this.currentLanguage="en")}static getLanguage(){return this.currentLanguage}static t(e,t){const i=e.split(".");let o=T[this.currentLanguage];for(const r of i){if(!o||"object"!=typeof o||!(r in o))return console.warn(`Translation key '${e}' not found for language '${this.currentLanguage}'`),e;o=o[r]}return t&&"string"==typeof o?this.interpolate(o,t):o}static interpolate(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,i)=>i in t?String(t[i]):e)}static has(e){const t=e.split(".");let i=T[this.currentLanguage];for(const o of t){if(!i||"object"!=typeof i||!(o in i))return!1;i=i[o]}return void 0!==i}static getAvailableLanguages(){return Object.keys(T)}}function F(e){return!!(null==e?void 0:e.toLowerCase().includes("totallabel"))}E.currentLanguage="en";class R{constructor(e=!1){this.DRAFT_DATA_KEY="jupiter-form-draft-data",this.DRAFT_METADATA_KEY="jupiter-form-draft-metadata",this.STORAGE_VERSION="1.0",this._storage=e?sessionStorage:localStorage}saveDraft(e,t){try{const i={formData:e,metadata:{...t,savedAt:(new Date).toISOString()},version:this.STORAGE_VERSION};return this._storage.setItem(this.DRAFT_DATA_KEY,JSON.stringify(i.formData)),this._storage.setItem(this.DRAFT_METADATA_KEY,JSON.stringify(i.metadata)),e.length,i.metadata.savedAt,t.selectedRoleIds.length,t.customColumns.length,!0}catch(i){return console.error("❌ Failed to save draft:",i),!1}}loadDraft(){try{const e=this._storage.getItem(this.DRAFT_DATA_KEY),t=this._storage.getItem(this.DRAFT_METADATA_KEY);if(!e||!t)return null;const i=JSON.parse(e),o=JSON.parse(t);return i.length,o.savedAt,o.selectedRoleIds.length,o.customColumns.length,{formData:i,metadata:o,version:this.STORAGE_VERSION}}catch(e){return console.error("❌ Failed to load draft:",e),null}}hasDraft(){return null!==this._storage.getItem(this.DRAFT_DATA_KEY)&&null!==this._storage.getItem(this.DRAFT_METADATA_KEY)}getDraftMetadata(){try{const e=this._storage.getItem(this.DRAFT_METADATA_KEY);return e?JSON.parse(e):null}catch(e){return console.error("❌ Failed to load draft metadata:",e),null}}clearDraft(){try{return this._storage.removeItem(this.DRAFT_DATA_KEY),this._storage.removeItem(this.DRAFT_METADATA_KEY),!0}catch(e){return console.error("❌ Failed to clear draft:",e),!1}}getDraftAge(){const e=this.getDraftMetadata();if(!e)return null;const t=new Date(e.savedAt);return(new Date).getTime()-t.getTime()}isDraftStale(e){const t=this.getDraftAge();return null!==t&&t>e}extractCustomColumns(e){const t=[];return e.forEach(e=>{e.columns&&Array.isArray(e.columns)&&e.columns.forEach(i=>{t.push({sectionId:e.id,columnId:i.id,label:i.title,description:i.description,periodType:this._inferPeriodTypeFromColumn(i),date:i.periodStartDate,startDate:i.periodStartDate,endDate:i.periodEndDate,dimensionData:i.dimensionData})})}),t}_inferPeriodTypeFromColumn(e){return e.periodStartDate&&e.periodEndDate?"duration":"instant"}createMetadataSnapshot(e,t,i,o,r,n,a,s,l,d="en",c,p,u,h,m){return{periodStartDate:e,periodEndDate:t,language:i,reportingLanguage:d,selectedRoleIds:o,customColumns:this.extractCustomColumns(r),typedMemberData:n,periodPreferences:a,periodData:s,unitData:l,decimalsData:p,repeatCounts:c,roleCompletedStates:u,hiddenColumns:h,totalManuallyEditedData:m,schemaVersion:this.STORAGE_VERSION}}validateDraftCompatibility(e,t,i){const o=[];e.metadata.periodStartDate!==t&&o.push(`Draft period start (${e.metadata.periodStartDate}) differs from current (${t})`),e.metadata.periodEndDate!==i&&o.push(`Draft period end (${e.metadata.periodEndDate}) differs from current (${i})`);const r=this.getDraftAge();r&&r>6048e5&&o.push(`Draft is ${Math.floor(r/864e5)} days old`);return{compatible:0===o.length,warnings:o}}}const M=.01;class j extends Error{constructor(e,t,i="unsupported-syntax"){super(e),this.test=t,this.reason=i,this.name="FormulaExpressionError"}}const A=/\s*(?:(\$[A-Za-z_][\w-]*)|(-?\d+(?:\.\d+)?)|([A-Za-z][\w:-]*)|('[^']*')|(\()|(\))|(\+)|(-)|(=))/y;class P{constructor(e,t){this.tokens=e,this.test=t,this.pos=0}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e){const t=this.next();if(t.type!==e)throw new j(`Expected ${e} but got ${t.type} ("${t.value}")`,this.test,"parse-error");return t}parseBoolExpr(){const e=this.parseOrExpr();if("EOF"!==this.peek().type)throw new j(`Unexpected trailing token "${this.peek().value}"`,this.test,"unsupported-syntax");return e}parseOrExpr(){const e=[this.parseAndExpr()];for(;"IDENT"===this.peek().type&&"or"===this.peek().value;)this.next(),e.push(this.parseAndExpr());return 1===e.length?e[0]:{kind:"or",terms:e}}parseAndExpr(){const e=[this.parseBoolTerm()];for(;"IDENT"===this.peek().type&&"and"===this.peek().value;)this.next(),e.push(this.parseBoolTerm());return 1===e.length?e[0]:{kind:"and",terms:e}}parseBoolTerm(){const e=this.peek();if("IDENT"===e.type&&"not"===e.value){this.next(),this.expect("LPAREN");const e=this.parseOrExpr();return this.expect("RPAREN"),{kind:"not",arg:e}}if("IDENT"===e.type&&"empty"===e.value){this.next(),this.expect("LPAREN");const e=this.expect("VARIABLE").value;return this.expect("RPAREN"),{kind:"empty",variable:e}}if("IDENT"===e.type&&"xff:has-fallback-value"===e.value){this.next(),this.expect("LPAREN");const e=this.next();if("IDENT"!==e.type||"xs:QName"!==e.value)throw new j(`Expected xs:QName(...) inside xff:has-fallback-value(...), got "${e.value}"`,this.test,"unsupported-syntax");this.expect("LPAREN");const t=this.expect("STRING").value;return this.expect("RPAREN"),this.expect("RPAREN"),{kind:"hasFallbackValue",variableName:t}}const t=this.parseValueExpr(),i=this.peek();if("EQUALS"===i.type)return this.next(),{kind:"comparison",op:"=",left:t,right:this.parseValueExpr()};if("IDENT"===i.type&&"eq"===i.value)return this.next(),{kind:"comparison",op:"eq",left:t,right:this.parseValueExpr()};throw new j(`Expected a comparison operator ("=" or "eq") after value expression, got "${i.value}"`,this.test,"unsupported-syntax")}parseValueExpr(){const e=[];let t=1;for("PLUS"===this.peek().type?this.next():"MINUS"===this.peek().type&&(this.next(),t=-1),e.push({sign:t,term:this.parseValueTerm()});"PLUS"===this.peek().type||"MINUS"===this.peek().type;){const t="PLUS"===this.next().type?1:-1;e.push({sign:t,term:this.parseValueTerm()})}return 1===e.length&&1===e[0].sign?e[0].term:{kind:"additive",terms:e}}parseValueTerm(){const e=this.peek();if("NUMBER"===e.type)return this.next(),{kind:"number",value:Number(e.value)};if("STRING"===e.type)return this.next(),{kind:"string",value:e.value};if("VARIABLE"===e.type)return this.next(),{kind:"variable",name:e.value};if("IDENT"===e.type&&"sum"===e.value){this.next(),this.expect("LPAREN");const e=this.expect("VARIABLE").value;return this.expect("RPAREN"),{kind:"sum",variable:e}}if("LPAREN"===e.type){this.next();const e=this.parseValueExpr();return this.expect("RPAREN"),e}throw new j(`Expected a number, variable, sum(...), or parenthesized expression, got "${e.value}"`,this.test,"unsupported-syntax")}}function L(e,t){return e.get(t)}function N(e,t,i){switch(e.kind){case"number":case"string":return e.value;case"sum":return function(e,t,i){const o=L(t,e);return void 0===o?0:(Array.isArray(o)?o:[o]).reduce((t,o)=>{if("string"==typeof o)throw new j(`Variable "$${e}" resolved to a non-numeric value ("${o}") and cannot be used in sum(...)`,i,"unsupported-syntax");return t+o},0)}(e.variable,t,i);case"variable":{const o=L(t,e.name);if(void 0===o)throw new j(`Variable "$${e.name}" has no bound fact and cannot be evaluated directly (only sum()/empty() tolerate an unbound variable)`,i,"unbound-variable");if(Array.isArray(o))throw new j(`Variable "$${e.name}" is a sequence and must be wrapped in sum(...) to be used in arithmetic`,i,"unsupported-syntax");return o}case"additive":return e.terms.reduce((e,{sign:o,term:r})=>{const n=N(r,t,i);if("string"==typeof n)throw new j(`Non-numeric value ("${n}") cannot be used in arithmetic (+ / -)`,i,"unsupported-syntax");return e+o*n},0)}}function V(e,t,i,o){switch(e.kind){case"or":return e.terms.some(e=>V(e,t,i,o));case"and":return e.terms.every(e=>V(e,t,i,o));case"not":return!V(e.arg,t,i,o);case"empty":{const i=L(t,e.variable);return void 0===i||Array.isArray(i)&&0===i.length}case"hasFallbackValue":{const t=o.get(e.variableName);if(void 0===t)throw new j(`xff:has-fallback-value(xs:QName('${e.variableName}')) could not be evaluated — no fallback-usage tracked for this variable (either not one of this assertion's FACT_VARIABLEs, or it matched zero facts with no fallbackValue declared)`,i,"unbound-variable");return t}case"comparison":{const o=N(e.left,t,i),r=N(e.right,t,i);return"string"==typeof o||"string"==typeof r?String(o)===String(r):Math.abs(o-r)<M}}}function O(e,t,i=new Map){const o=function(e){const t=[];A.lastIndex=0;let i=0;for(;i<e.length;){A.lastIndex=i;const o=A.exec(e);if(!o||o.index!==i){if(/^\s*$/.test(e.slice(i)))break;throw new j(`Unrecognized token at position ${i}: "${e.slice(i,i+10)}..."`,e,"unsupported-syntax")}const[r,n,a,s,l,d,c,p,u,h]=o;n?t.push({type:"VARIABLE",value:n.slice(1)}):a?t.push({type:"NUMBER",value:a}):s?t.push({type:"IDENT",value:s}):l?t.push({type:"STRING",value:l.slice(1,-1)}):d?t.push({type:"LPAREN",value:d}):c?t.push({type:"RPAREN",value:c}):p?t.push({type:"PLUS",value:p}):u?t.push({type:"MINUS",value:u}):h&&t.push({type:"EQUALS",value:h}),i+=r.length}return t.push({type:"EOF",value:""}),t}(e);return V(new P(o,e).parseBoolExpr(),t,e,i)}const z=/^\.\s*(eq|ne|gt|lt|ge|le)\s+(-?\d+(?:\.\d+)?)$/;function J(e){return!!(null==e?void 0:e.toLowerCase().includes("totallabel"))}function B(e){return!!(null==e?void 0:e.toLowerCase().includes("negatedtotallabel"))}function U(e,t,i=0){if(!t.isAbstract(e))return e;if(i>5)return null;const o=t.getChildren(e).find(e=>J(t.getPreferredLabel(e)));return o?U(o,t,i+1):null}function q(e,t,i,o,r){if(i<0)return o;const n=e[t];if(B(r.getPreferredLabel(n)))return o.length>0?o:[e[i]];if(o.length>0)return[e[i],...o];if(B(r.getPreferredLabel(e[i]))){let t=-1;for(let o=i-1;o>=0;o--)if(J(r.getPreferredLabel(e[o]))){t=o;break}return t>=0?[e[t],e[i]]:[e[i]]}return[e[i]]}function H(e){return null!=e&&""!==e}function W(e){const t=[];for(const i of Object.keys(e)){const o=e[i]||{};for(const e of Object.keys(o))H(o[e])&&t.push({conceptId:i,columnId:e})}return t}function K(e,t,i,o,r,n){const a={conceptId:e.id,qname:e.name,balance:e.balance,effectivePeriodRole:e.effectivePeriodRole};i.set(e.id,a),(t.get(e.name)??t.set(e.name,[]).get(e.name)).push(a);const s=e.children||[],l=s.length>0,d=!0===r.get(e.name);(!o.has(e.name)||l&&!d)&&(o.set(e.name,e.id),r.set(e.name,l)),n.set(e.id,s.map(e=>e.id)),s.forEach(e=>K(e,t,i,o,r,n))}function Y(e){const t=[e.id];return(e.children||[]).forEach(e=>t.push(...Y(e))),t}function Q(e,t,i,o,r){t.has(e.conceptName)||t.set(e.conceptName,e.id),i.has(e.conceptName)||i.set(e.conceptName,(e.children||[]).map(e=>e.id)),o.has(e.conceptName)||o.set(e.conceptName,Y(e)),(e.children||[]).forEach(e=>{r.add(e.id),Q(e,t,i,o,r)})}const G={getId:e=>e.id,getPreferredLabel:e=>e.preferredLabel,isAbstract:e=>!0===e.abstract,getChildren:e=>e.children||[]};function X(e,t,i,o,r,n,a){const s=new Map,l=new Map,d=new Map,c=new Map,p=new Map,u=new Map,h=new Map;i.forEach(e=>{const t=new Map,i=new Map,o=new Map;e.concepts.forEach(e=>K(e,s,l,i,o,t)),c.set(e.roleURI,t),d.set(e.roleURI,i),p.set(e.roleURI,function(e,t){const i=new Map;function o(e,o){const r=[];for(const i of o){const e=U(i,t);e&&r.push(t.getId(e))}0!==r.length&&i.set(t.getId(e),r)}return function e(i){for(let r=0;r<i.length;r++){const n=i[r];if(J(t.getPreferredLabel(n))&&0===t.getChildren(n).length){let e=-1;for(let o=r-1;o>=0;o--)if(J(t.getPreferredLabel(i[o]))){e=o;break}const a=i.slice(e+1,r),s=q(i,r,e,a,t);s.length>0&&o(n,s)}const a=t.getChildren(n);a.length>0&&e(a)}}(e),i}(e.concepts,G));for(const r of t.keys())h.set(r,e.roleURI);e.columns&&u.set(e.roleURI,e.columns)});const m=new Map;d.forEach((e,t)=>{const i=c.get(t),o=p.get(t);e.forEach((e,r)=>{var n;const a=(null==i?void 0:i.get(e))||[],s=a.length>0?a:(null==o?void 0:o.get(e))||[];0!==s.length&&(m.has(r)||m.set(r,new Map),null==(n=m.get(r))||n.set(t,s))})});const f=new Map,b=new Map,g=new Map,v=new Map,y=new Set;return(o||[]).forEach(e=>{e.items.forEach(e=>{e.dimensions.forEach(e=>{f.has(e.conceptName)||f.set(e.conceptName,e.id),(e.members||[]).forEach(e=>Q(e,b,g,v,y))})})}),{formData:e,columns:t,periodStartDate:r,periodEndDate:n,conceptByQName:s,conceptById:l,conceptIdByQNamePerRole:d,childrenByRole:c,totalGroupChildrenByRole:p,crossRoleChildrenByQName:m,dimensionQNameToId:f,memberQNameToId:b,memberChildrenByQName:g,memberDescendantOrSelfIdsByQName:v,memberIdsWithParent:y,columnsByRole:u,roleURIByConceptId:h,allCandidates:W(e),typedMemberData:a??{}}}function Z(e,t){const i=[],o=[...e.get(t)||[]],r=new Set;for(;o.length>0;){const t=o.pop();r.has(t)||(r.add(t),i.push(t),o.push(...e.get(t)||[]))}return i}function ee(e){return`${e.conceptId}::${e.columnId}`}function te(e,t){return se(e.filters.map(i=>ae(i,t.allCandidates,t,e.filters)))}function ie(e,t){var i;const o=e.roleURIByConceptId.get(t.conceptId);return(o?null==(i=e.columnsByRole.get(o))?void 0:i.find(e=>e.id===t.columnId):void 0)??e.columns.find(e=>e.id===t.columnId)}function oe(e,t,i){if(!(null==e?void 0:e.dimensionData))return!1;return!(e.dimensionData.axisId!==t||void 0!==i&&e.dimensionData.memberId!==i)||(e.dimensionData.combinations||[]).some(e=>e.axisId===t&&(void 0===i||e.memberId===i))}function re(e,t){return{start:(null==e?void 0:e.periodStartDate)??t.periodStartDate,end:(null==e?void 0:e.periodEndDate)??t.periodEndDate}}function ne(e,t,i,o){var r,n;switch(e.type){case"CONCEPT_NAME":{const o=e.attributes["concept.qname"],r=o?i.conceptByQName.get(o):void 0;if(!r||0===r.length)return[];const n=new Set(r.map(e=>e.conceptId));return t.filter(e=>n.has(e.conceptId))}case"CONCEPT_BALANCE":{const o=e.attributes.balance;return t.filter(e=>{var t;return(null==(t=i.conceptById.get(e.conceptId))?void 0:t.balance)===o})}case"CONCEPT_RELATION":{const o=e.attributes.qname,a=e.attributes.linkrole,s=e.attributes.axis,l=o&&a?null==(r=i.conceptIdByQNamePerRole.get(a))?void 0:r.get(o):void 0,d=a?i.childrenByRole.get(a):void 0;if(!l||!d)return[];let c;if("descendant"===s)c=Z(d,l);else{const e=d.get(l)||[];c=e.length>0?e:(null==(n=i.totalGroupChildrenByRole.get(a??""))?void 0:n.get(l))||[],0===c.length&&(c=function(e,t,i){if(!e)return[];const o=i.crossRoleChildrenByQName.get(e);if(!o)return[];const r=Array.from(o.entries()).filter(([e])=>e!==t);return 1===r.length?r[0][1]:[]}(o,a,i))}const p=new Set(c);return t.filter(e=>p.has(e.conceptId))}case"EXPLICIT_DIMENSION":{const r=e.attributes["dimension.qname"],n=e.attributes["member.qname"],a=r?i.dimensionQNameToId.get(r):void 0;if(!a)return[];const s=e.attributes["member.axis"];if(n&&"child"===s)return function(e,t,i,o,r){var n,a;const s=o.memberChildrenByQName.get(e)||[];if(s.length>0){const e=i.filter(e=>s.some(i=>oe(ie(o,e),t,i)));if(e.length>0)return e}const l=r.find(e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis),d=null==l?void 0:l.attributes.linkrole,c=null==l?void 0:l.attributes.qname,p=c&&d?null==(n=o.conceptIdByQNamePerRole.get(d))?void 0:n.get(c):void 0,u=new Set(p&&d&&(null==(a=o.childrenByRole.get(d))?void 0:a.get(p))||[]);return 0===u.size?[]:i.filter(e=>!u.has(e.conceptId))}(n,a,t,i,o);if(n&&"descendant-or-self"===s)return function(e,t,i,o){const r=o.memberDescendantOrSelfIdsByQName.get(e)||[];return 0===r.length?[]:i.filter(e=>r.some(i=>oe(ie(o,e),t,i)))}(n,a,t,i);const l=n?i.memberQNameToId.get(n):void 0;return t.filter(e=>oe(ie(i,e),a,l))}case"TYPED_DIMENSION":{const o=e.attributes["dimension.qname"],r=o?i.dimensionQNameToId.get(o):void 0;return r?t.filter(e=>function(e,t,i){if(!function(e,t){return!!(null==e?void 0:e.dimensionData)&&(void 0!==e.dimensionData.typedMemberId&&e.dimensionData.axisId===t||(e.dimensionData.typedMembers||[]).some(e=>e.axisId===t))}(ie(e,t),i))return!1;const o=e.typedMemberData[t.columnId];return void 0===o||!!o[i]}(i,e,r)):[]}case"PERIOD_INSTANT":case"PERIOD_END":{const o=e.attributes.date;return t.filter(e=>function(e,t,i){const o=function(e){if(e)return e.startsWith("$")?e.slice(1):e}(t);if(!o)return!1;const r=function(e,t){const i=e.includes("StartDate"),o=e.includes("EndDate")||"FinancialReportingPeriodCurrentEndDateParam"===e;if(e.startsWith("FinancialReportingPeriodCurrent"))return i?{start:t.periodStartDate}:o?{end:t.periodEndDate}:void 0;if(e.startsWith("FinancialReportingPeriodPrePrevious")||e.startsWith("FinancialReportingPeriodPrevious")){const e=function(e){return e.columns.find(t=>void 0!==t.periodEndDate&&t.periodEndDate<e.periodEndDate)}(t);if(!e)return;return i?{start:e.periodStartDate}:o?{end:e.periodEndDate}:void 0}}(o,i);if(!r)return!1;const n=re(e,i),a=r.end??r.start;return n.end===a}(ie(i,e),o,i))}case"OR_FILTER":return function(e){const t=new Map;return e.forEach(e=>e.forEach(e=>t.set(ee(e),e))),Array.from(t.values())}(e.children.map(e=>ae(e,t,i,o)));case"ASPECT_COVER":return t;case"UNKNOWN":{const o=e.attributes.boundary;if("start"===o||"end"===o){const e="start"===o?"periodStartLabel":"periodEndLabel";return t.filter(t=>{var o;return(null==(o=i.conceptById.get(t.conceptId))?void 0:o.effectivePeriodRole)===e})}return t}default:return[]}}function ae(e,t,i,o){const r=ne(e,t,i,o);if(!e.complement)return r;const n=new Set(r.map(ee));return t.filter(e=>!n.has(ee(e)))}function se(e){return 0===e.length?[]:e.reduce((e,t)=>{const i=new Set(t.map(ee));return e.filter(e=>i.has(ee(e)))})}function le(e){if(null==e||""===e)return;const t=parseFloat(String(e));return Number.isNaN(t)?String(e):t}function de(e){return e.some(e=>"PERIOD_INSTANT"===e.type||"PERIOD_END"===e.type||"OR_FILTER"===e.type&&de(e.children))}function ce(e,t,i){if(e.length<=1||de(t.filters))return e;const o=e.filter(e=>re(ie(i,e),i).end===i.periodEndDate);return o.length>0?o:e}function pe(e,t){return function(e,t){const i=new Map;e.forEach(e=>{var o;const r=(null==(o=t.conceptById.get(e.conceptId))?void 0:o.qname)??e.conceptId,n=`${e.columnId}::${r}`,a=i.get(n);a?a.push(e):i.set(n,[e])});const o=[];return i.forEach(e=>{if(e.length<=1)return void o.push(...e);const i=e.map(e=>{var i;return null==(i=t.conceptById.get(e.conceptId))?void 0:i.effectivePeriodRole}),r=e.filter((e,t)=>"periodEndLabel"===i[t]),n=new Set(i).size>1;o.push(...n&&r.length>0?r:e)}),o}(function(e,t,i){var o,r;if(t.bindAsSequence)return e;if(new Set(e.map(e=>e.conceptId)).size<=1)return e;const n=t.filters.find(e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis),a=null==n?void 0:n.attributes.qname,s=null==n?void 0:n.attributes.linkrole,l=a&&s?null==(o=i.conceptIdByQNamePerRole.get(s))?void 0:o.get(a):void 0,d=new Set(l&&s&&(null==(r=i.childrenByRole.get(s))?void 0:r.get(l))||[]);return 0===d.size?e:e.filter(e=>d.has(e.conceptId))}(ce(te(e,t),e,t),e,t),t)}function ue(e,t){const i=new Set;for(const o of e.filters){if("EXPLICIT_DIMENSION"!==o.type||o.complement||o.cover)continue;if(o.attributes["member.qname"])continue;const e=t.dimensionQNameToId.get(o.attributes["dimension.qname"]??"");e&&i.add(e)}return i}function he(e,t,i){var o;const r=ie(e,t);if(null==r?void 0:r.dimensionData)return r.dimensionData.axisId===i?r.dimensionData.memberId:null==(o=(r.dimensionData.combinations||[]).find(e=>e.axisId===i))?void 0:o.memberId}function me(e,t,i){const o=new Map;if(e.forEach(e=>o.set(e.name,pe(e,t))),i){const i=new Set;e.forEach(e=>ue(e,t).forEach(e=>i.add(e))),i.forEach(i=>{const r=function(e,t,i,o){for(const r of e){if(r.bindAsSequence)continue;if(!ue(r,o).has(t))continue;const e=i.get(r.name)||[],n=new Set(e.map(e=>he(o,e,t)).filter(e=>void 0!==e));if(1===n.size)return{memberId:[...n][0],variableName:r.name,ambiguous:!1};const a=[...n].filter(e=>!o.memberIdsWithParent.has(e));if(1===a.length)return{memberId:a[0],variableName:r.name,ambiguous:!0}}}(e,i,o,t);r&&e.forEach(e=>{const n=e.bindAsSequence&&ue(e,t).has(i),a=r.ambiguous&&e.name===r.variableName;if(!n&&!a)return;const s=o.get(e.name)||[];o.set(e.name,s.filter(e=>he(t,e,i)===r.memberId))})})}const r=new Map;return e.forEach(e=>r.set(e.name,function(e,t,i){const o=t.map(e=>{var t;return le(null==(t=i.formData[e.conceptId])?void 0:t[e.columnId])}).filter(e=>void 0!==e);if(0===o.length&&"()"===e.fallbackValue)return[];if(e.bindAsSequence){if(0===o.length)return;return o}return 0!==o.length?(o.length>1&&console.warn(`[formula-variable-resolver] Variable "${e.name}" is scalar (bindAsSequence: false) but matched ${o.length} facts; using the first match by column order. This can legitimately happen when filters under-constrain the candidate set.`),o[0]):void 0}(e,o.get(e.name)||[],t))),r}function fe(e){const t=Object.entries(e.attributes).filter(([e])=>"id"!==e).sort(([e],[t])=>e.localeCompare(t));return JSON.stringify({type:e.type,complement:e.complement,cover:e.cover,attrs:t})}function be(e,t){return te(e,t).length}function ge(e,t){return!(be(e,t)>0)&&(void 0!==e.fallbackValue||void 0)}function ve(e){const t=[];for(const i of e)if("CONCEPT_NAME"===i.type){const e=i.attributes["concept.qname"];e&&t.push(e)}else"OR_FILTER"===i.type&&t.push(...ve(i.children));return t}function ye(e){return ve(e.filters)}function xe(e,t,i){const o=i.columns.map(e=>({conceptId:t,columnId:e.id}));return se(e.filters.map(t=>ae(t,o,i,e.filters))).map(e=>e.columnId)}class _e{evaluate(e,t,i){var o;const r=null==(o=e.formula)?void 0:o[0];if(!r)return[];const n=[];for(const a of r.roles)for(const e of a.assertions)n.push(this._evaluateAssertion(e,a,t,i));return n}summarize(e){const t={totalAssertions:e.length,evaluated:0,skipped:0,passed:0,failed:0,failedWarnings:0,failedErrors:0};for(const i of e)i.skipped?t.skipped+=1:(t.evaluated+=1,i.satisfied?t.passed+=1:(t.failed+=1,"ERROR"===i.severity?t.failedErrors+=1:t.failedWarnings+=1));return t}_evaluateAssertion(e,t,i,o){try{const r=function(e,t){return me(e.variables,t,e.implicitFiltering)}(e,i),n=function(e){if("VALUE_ASSERTION"!==e.type||2!==e.variables.length)return;const t=e.variables.find(e=>!e.bindAsSequence),i=e.variables.find(e=>e.bindAsSequence);if(!t||!i)return;const o=e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis&&!e.complement&&!e.cover,r=t.filters.find(o),n=i.filters.find(o);if(!r||!n)return;const a=r.attributes.qname,s=r.attributes.linkrole;if(!a||!s)return;if(n.attributes.qname!==a||n.attributes.linkrole!==s)return;const l=t.filters.find(e=>"EXPLICIT_DIMENSION"===e.type&&!e.complement&&e.cover&&!("member.axis"in e.attributes)),d=i.filters.find(e=>"EXPLICIT_DIMENSION"===e.type&&!e.complement&&e.cover&&"child"===e.attributes["member.axis"]);if(!l||!d)return;const c=l.attributes["dimension.qname"],p=l.attributes["member.qname"];if(!c||!p)return;if(d.attributes["dimension.qname"]!==c||d.attributes["member.qname"]!==p)return;const u=t.filters.filter(e=>e!==r&&e!==l).map(fe).sort(),h=i.filters.filter(e=>e!==n&&e!==d).map(fe).sort();return u.length!==h.length||u.some((e,t)=>e!==h[t])?void 0:{scalarVariable:t,sequenceVariable:i,anchorQName:a,linkrole:s,dimensionQName:c,memberQName:p}}(e),a=n?function(e,t){var i;const{scalarVariable:o,sequenceVariable:r,anchorQName:n,linkrole:a,dimensionQName:s,memberQName:l}=e,d=null==(i=t.conceptIdByQNamePerRole.get(a))?void 0:i.get(n),c=t.childrenByRole.get(a);if(!d||!c)return"not-applicable";const p=Z(c,d);if(0===p.length)return"not-applicable";const u=t.dimensionQNameToId.get(s),h=t.memberQNameToId.get(l),m=t.memberChildrenByQName.get(l)||[];if(!u||!h||0===m.length)return"not-applicable";const f=o.filters.filter(e=>!("CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis||"EXPLICIT_DIMENSION"===e.type&&e.attributes["dimension.qname"]===s)),b=f.length>0?se(f.map(e=>ae(e,t.allCandidates,t,f))):t.allCandidates,g=new Set(p),v=new Map;if(b.forEach(e=>{if(!g.has(e.conceptId))return;const t=v.get(e.conceptId);t?t.push(e):v.set(e.conceptId,[e])}),!Array.from(v.values()).some(e=>e.some(e=>m.some(i=>oe(ie(t,e),u,i)))))return"not-applicable";let y=!1;for(const x of p){const e=v.get(x);if(!e||0===e.length)continue;const i=ce(e.filter(e=>oe(ie(t,e),u,h)),o,t),n=ce(e.filter(e=>m.some(i=>oe(ie(t,e),u,i))),r,t),a=i.map(e=>{var i;return le(null==(i=t.formData[e.conceptId])?void 0:i[e.columnId])}).filter(e=>"number"==typeof e),s=n.map(e=>{var i;return le(null==(i=t.formData[e.conceptId])?void 0:i[e.columnId])}).filter(e=>"number"==typeof e);if(0===a.length||0===s.length)continue;a.length>1&&console.warn(`[formula-variable-resolver] SumOfMembersOnAbstract concept "${x}" matched ${a.length} aggregate-member facts; using the first by column order.`);const l=a[0],d=s.reduce((e,t)=>e+t,0);if(y=!0,Math.abs(l-d)>=M)return!1}return!!y||"unresolvable"}(n,i):void 0,s=void 0!==a&&"not-applicable"!==a;if("VALUE_ASSERTION"===e.type&&!s){const i=function(e,t){for(const i of e.variables)if(void 0===t.get(i.name))return{satisfied:!1,skipReason:"unresolvable"};return{satisfied:!0}}(e,r);if(!i.satisfied)return this._skippedResult(e,t,i.skipReason??"unresolvable")}const l=function(e,t){var i;if(!(null==(i=e.test)?void 0:i.includes("has-fallback-value"))&&!e.preconditions.some(e=>e.test.includes("has-fallback-value")))return new Map;const o=new Map;for(const r of e.variables){const e=ge(r,t);void 0!==e&&o.set(r.name,e)}return o}(e,i),d=function(e,t,i=new Map){if(0===e.length)return{satisfied:!0};for(const r of e){let e;try{e=O(r.test,t,i)}catch(o){if(o instanceof j)return{satisfied:!1,skipReason:"unresolvable"};throw o}if(!e)return{satisfied:!1,skipReason:"precondition"}}return{satisfied:!0}}(e.preconditions,r,l);if(!d.satisfied)return this._skippedResult(e,t,d.skipReason??"unresolvable");if("EXISTENCE_ASSERTION"===e.type){const r=1===e.variables.length?be(e.variables[0],i):function(e,t){const i=new Map;for(const o of e)for(const e of te(o,t))i.set(ee(e),e);return i.size}(e.variables,i),n=function(e,t){const i=(e??"").trim();return""===i?t>0:i.split(/\bor\b/).some(e=>{const o=z.exec(e.trim());if(!o)throw new j(`Unsupported existence-assertion test shape: "${e.trim()}"`,i,"unsupported-syntax");const[,r,n]=o;return function(e,t,i){switch(e){case"eq":return t===i;case"ne":return t!==i;case"gt":return t>i;case"lt":return t<i;case"ge":return t>=i;case"le":return t<=i}}(r,t,Number(n))})}(e.test,r);return this._evaluatedResult(e,t,i,n,o,r)}if(s)return"unresolvable"===a?this._skippedResult(e,t,"unresolvable"):this._evaluatedResult(e,t,i,a,o);const c=O(e.test,r,l);return this._evaluatedResult(e,t,i,c,o)}catch(r){if(r instanceof j)return console.warn(`[FormulaValidationService] Assertion "${e.id}" could not be evaluated (${r.reason}): ${r.message}`),this._skippedResult(e,t,"unresolvable");throw r}}_skippedResult(e,t,i){return{assertionId:e.id,roleURI:t.roleURI,roleLabel:t.role,type:e.type,severity:e.severity,satisfied:!1,skipped:!0,skipReason:i}}_evaluatedResult(e,t,i,o,r,n){const a=o?void 0:this._pickMessage(e,r);return{assertionId:e.id,roleURI:t.roleURI,roleLabel:t.role,type:e.type,severity:e.severity,satisfied:o,skipped:!1,message:a,matchedFactCount:n,conceptLinks:a?this._buildConceptLinks(e,t.roleURI,i,a):void 0}}_pickMessage(e,t){const i=e.messages;if(0===i.length)return;const o=i.find(e=>e.xmlLang===t)??i.find(e=>"en"===e.xmlLang)??i[0];return this._stripTechnicalDetail(o.text)}_stripTechnicalDetail(e){const t=e.indexOf("{");return-1===t?e.trim():e.slice(0,t).replace(/\|\s*$/,"").trim()}_buildConceptLinks(e,t,i,o){var r,n,a;const s=[],l=new Set;for(const d of e.variables)for(const e of ye(d)){const c=(null==(r=i.conceptIdByQNamePerRole.get(t))?void 0:r.get(e))??(null==(a=null==(n=i.conceptByQName.get(e))?void 0:n[0])?void 0:a.conceptId);if(!c)continue;const p=e.includes(":")?e.split(":").pop():e;if(l.has(p))continue;if(!new RegExp("`"+this._escapeRegExp(p)+"`").test(o))continue;const u=xe(d,c,i);s.push({label:p,conceptQName:e,conceptId:c,columnId:u[0]}),l.add(p)}return s}_escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class De{static findMatchingFact(e,t){if(!e||0===e.length)return null;const i=e.filter(e=>this.matchesPeriod(e,t));if(0===i.length)return null;const o=i.filter(e=>this.matchesDimensions(e,t));if(0===o.length)return null;if(o.length>1&&t.unit){const e=o.find(e=>this.matchesUnit(e,t));if(e)return e}return o[0]}static matchesPeriod(e,t){const i=this.parsePeriod(e.period);return"instant"===t.periodType&&t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:"duration"===t.periodType&&t.periodStartDate&&t.periodEndDate?!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate:t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:!t.periodStartDate||!t.periodEndDate||!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate}static matchesDimensions(e,t){const i=e.dimensions||[],o=this.extractDimensionsFromContext(t);if(0===o.length)return 0===i.length;if(0===i.length&&o.length>0)return!1;if(i.length!==o.length)return!1;return o.every(e=>i.some(t=>{if(!(this.normalizeAxisId(t.dimension)===this.normalizeAxisId(e.axisId)))return!1;if("explicit"===t.dimensionType&&e.memberId){return this.normalizeMemberId(t.member||"")===this.normalizeMemberId(e.memberId)}return!("typed"!==t.dimensionType||!e.isTyped)}))}static matchesUnit(e,t){if(!t.unit||!e.unitMeasure)return!0;return this.normalizeUnit(e.unitMeasure)===this.normalizeUnit(t.unit)}static parsePeriod(e){if(e.includes(" / ")){const[t,i]=e.split(" / ").map(e=>e.trim());return{isInstant:!1,startDate:t,endDate:i}}return{isInstant:!0,instantDate:e.trim()}}static extractDimensionsFromContext(e){if(!e.dimensionData)return[];const t=[];return e.dimensionData.combinations&&e.dimensionData.combinations.length>0&&e.dimensionData.combinations.forEach(e=>{t.push({axisId:e.axisId,memberId:e.memberId})}),e.dimensionData.typedMembers&&e.dimensionData.typedMembers.length>0&&e.dimensionData.typedMembers.forEach(e=>{t.push({axisId:e.axisId,memberId:"[typed]",isTyped:!0})}),t}static normalizeAxisId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){e.split("_");const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeMemberId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeUnit(e){if(!e)return"";const t=e.split(":");return t.length>1?t[1]:t[0]}static extractTypedValues(e,t){const i={};if(!e||0===e.length)return i;return e.filter(e=>this.matchesPeriod(e,t)&&this.matchesDimensions(e,t)).forEach(e=>{e.dimensions&&e.dimensions.forEach(e=>{if("typed"===e.dimensionType&&e.typedMemberValue){const t=this.normalizeAxisId(e.dimension);i[t]=e.typedMemberValue}})}),i}static debugMatch(e,t){t.conceptId,t.columnId,"instant"===t.periodType?t.periodInstantDate:(t.periodStartDate,t.periodEndDate),this.extractDimensionsFromContext(t),e.map(e=>{var t;return{value:e.value,period:e.period,dimensions:null==(t=e.dimensions)?void 0:t.map(e=>`${e.dimension}:${e.member}`)}});const i=this.findMatchingFact(e,t);i&&i.value}}const Ie=1,we=2,Se=3,Ce=4,$e=5,ke=e=>"string"==typeof e?e.trim().toLowerCase():"",Te=e=>e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);function Ee(e){const t=e.replace(/[/#:]+$/,""),i=Math.max(t.lastIndexOf(":"),t.lastIndexOf("/"),t.lastIndexOf("#"));return i>=0?t.slice(i+1):t}function Fe(e,t){var i,o;const r=[t.id,null==(i=t.metadata)?void 0:i.roleURI].map(ke).filter(Boolean),n=[t.title,t.description,null==(o=t.metadata)?void 0:o.originalRole].map(ke).filter(Boolean),a=r.map(Ee),s=/\s/.test(e)?null:Ee(e);if(r.includes(e))return{tier:Ie,looseness:0};if(s&&a.includes(s))return{tier:we,looseness:0};if(n.includes(e))return{tier:Se,looseness:0};const l=s??e,d=[...a,...n];let c=null;for(const u of d)if(u.includes(l)||l.includes(u)){const e=Math.abs(u.length-l.length);(null===c||e<c)&&(c=e)}if(null!==c)return{tier:Ce,looseness:c};const p=new Set(Te(l));if(!p.size)return null;for(const u of d){const e=new Set(Te(u));if([...p].every(t=>e.has(t))){const t=e.size-p.size;(null===c||t<c)&&(c=t)}}return null!==c?{tier:$e,looseness:c}:null}function Re(e){var t,i;if(!e)return[];const o=[];if(null==(t=e.combinations)?void 0:t.length)for(const r of e.combinations)o.push({key:r.axisId||r.memberLabel,label:r.memberLabel});else{const t=e.selectedDimensions;for(const e of t??[])!e.isTyped&&e.memberLabel&&o.push({key:e.axisId,label:e.memberLabel})}if(null==(i=e.typedMembers)?void 0:i.length)for(const r of e.typedMembers)o.push({key:r.axisId,label:r.axisLabel});return 0===o.length&&e.memberLabel&&(e.axisId||e.axisLabel)&&o.push({key:e.axisId||e.axisLabel,label:e.memberLabel}),o}const Me={"nl-types:formattedExplanationItemType":{fieldType:"textarea",placeholder:E.t("field.enterDetailedExplanation")},"nl-types:monetaryNoDecimals20ItemType":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")},"xbrli:monetaryItemType":{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")},"xbrli:stringItemType":{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterText")},"xbrli:dateItemType":{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"},"xbrli:dateTimeItemType":{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"},"xbrli:integerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,step:1,placeholder:E.t("field.enterWholeNumber")},"xbrli:nonNegativeIntegerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:0,step:1,placeholder:E.t("field.enterPositiveNumber")},"xbrli:positiveIntegerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:1,step:1,placeholder:E.t("field.enterPositiveNumber")},"xbrli:decimalItemType":{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")},"xbrli:sharesItemType":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,min:0,step:.01,placeholder:E.t("field.enterNumberOfShares")},"xbrli:shares":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,min:0,step:.01,placeholder:E.t("field.enterNumberOfShares")},"xbrli:gYearItemType":{fieldType:"number",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:1900,max:2100,step:1,placeholder:E.t("field.yearFormat")},"xbrli:booleanItemType":{fieldType:"boolean"},"xbrli:pureItemType":{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")},"xbrli:percentItemType":{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")},"xbrli:emailItemType":{fieldType:"email",htmlInputType:"email",placeholder:E.t("field.emailPlaceholder")},"xbrli:urlItemType":{fieldType:"url",htmlInputType:"url",placeholder:E.t("field.urlPlaceholder")},"xbrli:telephoneItemType":{fieldType:"tel",htmlInputType:"tel",placeholder:E.t("field.phonePlaceholder")}};function je(e,t){if(!e)return{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")};if(t&&t.length>0){const i=Ve(e,t);if(i.length>0){return ze(i,t)}}if(Me[e])return Me[e];const i=e.toLowerCase();if(i.includes("monetary"))return i.includes("nodecimals")||i.includes("no-decimals")?{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")};if(i.includes("explanation")||i.includes("description")||i.includes("notes")||i.includes("formatted"))return{fieldType:"textarea",placeholder:E.t("field.enterDetailedInformation")};if(i.includes("date"))return i.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"}:{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"};if(i.includes("boolean")||i.includes("bool"))return{fieldType:"boolean"};if(i.includes("integer")||i.includes("int")){const e=i.includes("nonnegative")||i.includes("non-negative");return{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:i.includes("positive")?1:e?0:void 0,step:1,placeholder:E.t("field.enterWholeNumber")}}return i.includes("decimal")||i.includes("numeric")||i.includes("number")?{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")}:i.includes("percent")||i.includes("pure")?{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")}:{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")}}function Ae(e){return"textarea"===e}function Pe(e){return"boolean"===e}function Le(e){return["number","decimal","integer","currency","percentage"].includes(e)}function Ne(e){return"select"===e}function Ve(e,t){const i=[];if(!e)return i;if(!t||0===t.length)return i.push(e),i;let o=e;const r=new Set;for(;o;){if(i.push(o),r.has(o)){console.warn(`Circular reference detected in datatype hierarchy for type: ${o}`);break}r.add(o);const e=t.find(e=>e.type===o);if(!e||!e.basetype||""===e.basetype.trim())break;o=e.basetype}return i}function Oe(e,t){if(e&&0!==e.length&&t&&0!==t.length)for(const i of e){const e=t.find(e=>e.type===i);if(e&&e.enumerations&&e.enumerations.length>0)return e.enumerations.map(e=>({id:e.id||e.value,value:e.value,label:e.value}))}}function ze(e,t){if(!e||0===e.length)return{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")};if(t&&t.length>0){const i=Oe(e,t);if(i&&i.length>0)return{fieldType:"select",enumerations:i,placeholder:E.t("field.selectOption")}}const i=e.map(e=>e.toLowerCase()),o=i.join("|");if(e.some(e=>"nl-types:formattedExplanationItemType"===e)||o.includes("formattedexplanation")||o.includes("formatted")&&o.includes("explanation"))return{fieldType:"textarea",placeholder:E.t("field.enterDetailedExplanation")};if(i.some(e=>e.includes("date")))return o.includes("datetime")||o.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"}:{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"};if(i.some(e=>e.includes("boolean")||e.includes("bool")))return{fieldType:"boolean"};if(i.some(e=>e.includes("integer")||"integer"===e)){const e=o.includes("nonnegative")||o.includes("non-negative");return{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:o.includes("positive")?1:e?0:void 0,step:1,placeholder:E.t("field.enterWholeNumber")}}return i.some(e=>e.includes("percent")||e.includes("pure"))?{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterPercentage")}:i.some(e=>e.includes("decimal")||"decimal"===e)?o.includes("monetary")||o.includes("currency")?o.includes("nodecimals")||o.includes("no-decimals")||o.includes("nodecimals20")?{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:E.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:E.t("field.enterCurrency")}:{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:E.t("field.enterDecimalValue")}:e.some(e=>"xbrli:stringItemType"===e)||i.some(e=>"string"===e||e.includes("stringitem"))?{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterText")}:{fieldType:"text",htmlInputType:"text",placeholder:E.t("field.enterValue")}}class Je{static validateConceptValue(e,t,i){if(null==t||""===t)return{valid:!0,errors:[]};if(!e||!i||0===i.length)return{valid:!0,errors:[]};const o=this.findDatatype(e,i);return o&&o.validation?this.validateAgainstRules(t,o.validation):{valid:!0,errors:[]}}static validateAgainstRules(e,t){const i=[];if(null==e||""===e)return{valid:!0,errors:[]};if(!t)return{valid:!0,errors:[]};const o=String(e);if(t.pattern){const e=this.validatePattern(o,t.pattern);e&&i.push(e)}if(void 0!==t.length){const e=this.validateExactLength(o,t.length);e&&i.push(e)}if(void 0!==t.minLength){const e=this.validateMinLength(o,t.minLength);e&&i.push(e)}if(void 0!==t.maxLength){const e=this.validateMaxLength(o,t.maxLength);e&&i.push(e)}if(void 0!==t.totalDigits){const e=this.validateTotalDigits(o,t.totalDigits);e&&i.push(e)}return{valid:0===i.length,errors:i}}static findDatatype(e,t){let i=t.find(t=>t.type===e);if(i)return i;const o=new Set;let r=e;for(;r&&!o.has(r)&&(o.add(r),i=t.find(e=>e.type===r),i);){if(i.validation)return i;r=i.basetype}}static validatePattern(e,t){try{if(!new RegExp(`^${t}$`).test(e))return{type:"pattern",message:E.t("xbrlValidation.patternMismatch",{pattern:t}),expectedValue:t,actualValue:e}}catch(i){return console.error(`Invalid regex pattern: ${t}`,i),{type:"pattern",message:E.t("xbrlValidation.invalidPattern",{pattern:t}),expectedValue:t,actualValue:e}}return null}static validateExactLength(e,t){return e.length!==t?{type:"length",message:E.t("xbrlValidation.exactLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMinLength(e,t){return e.length<t?{type:"minLength",message:E.t("xbrlValidation.minLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMaxLength(e,t){return e.length>t?{type:"maxLength",message:E.t("xbrlValidation.maxLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateTotalDigits(e,t){const i=e.replace(/[^\d]/g,"");return i.length>t?{type:"totalDigits",message:E.t("xbrlValidation.totalDigits",{required:t,current:i.length}),expectedValue:t,actualValue:i.length}:null}static getValidationRulesSummary(e,t){if(!e||!t)return[];const i=this.findDatatype(e,t);if(!i||!i.validation)return[];const o=i.validation,r=[];return o.pattern&&r.push(E.t("xbrlValidation.ruleSummaryPattern",{pattern:o.pattern})),void 0!==o.length&&r.push(E.t("xbrlValidation.ruleSummaryExactLength",{required:o.length})),void 0!==o.minLength&&r.push(E.t("xbrlValidation.ruleSummaryMinLength",{required:o.minLength})),void 0!==o.maxLength&&r.push(E.t("xbrlValidation.ruleSummaryMaxLength",{required:o.maxLength})),void 0!==o.totalDigits&&r.push(E.t("xbrlValidation.ruleSummaryTotalDigits",{required:o.totalDigits})),r}}function Be(e){return e.length>=1&&e[0].length>=1&&e[0].length<=3&&e.slice(1).every(e=>3===e.length)}function Ue(e,t={}){const i=!1!==t.allowDecimals,o=!1!==t.allowNegative,r=(t.locale??"nl-NL").toLowerCase().startsWith("nl");let n=e.trim();if(""===n)return{ok:!1,reason:"unreadable"};if(n=n.replace(/EUR/gi,"").replace(/[€'\s]/g,""),""===n)return{ok:!1,reason:"unreadable"};let a=!1;const s=/^\((.*)\)$/.exec(n);if(s&&(a=!0,n=s[1]),n.startsWith("+")?n=n.slice(1):n.startsWith("-")?(a=!0,n=n.slice(1)):n.endsWith("-")&&(a=!0,n=n.slice(0,-1)),""===n||!/^[0-9.,]+$/.test(n))return{ok:!1,reason:"unreadable"};const l=(n.match(/\./g)||[]).length,d=(n.match(/,/g)||[]).length;let c,p=!1;if(0===l&&0===d)c=n,p=!0;else if(l>0&&d>0){const e=n.lastIndexOf("."),t=n.lastIndexOf(","),i=e>t?".":",",o="."===i?",":".",r="."===i?l:d,a="."===i?e:t,s=[...n].every((e,t)=>e!==o||t<a);if(1!==r||!s)return{ok:!1,reason:"unreadable"};const p=n.slice(0,a),u=n.slice(a+1),h=p.split(o);if(!Be(h)||0===u.length)return{ok:!1,reason:"unreadable"};c=`${h.join("")}.${u}`}else if(l>=2||d>=2){const e=l>=2?".":",",t=n.split(e);if(!Be(t))return{ok:!1,reason:"unreadable"};c=t.join(""),p=!0}else{const e=1===l?".":",",t=n.indexOf(e),o=n.slice(0,t),a=n.slice(t+1);if(""===o||""===a)return{ok:!1,reason:"unreadable"};const s=3===a.length&&"0"!==o;if(r)if("."===e)i?c=`${o}.${a}`:s?(c=o+a,p=!0):c=`${o}.${a}`;else if(s){if(i)return{ok:!1,reason:"ambiguous"};c=o+a,p=!0}else c=`${o}.${a}`;else if("."===e)c=`${o}.${a}`;else{if(!s)return{ok:!1,reason:"unreadable"};c=o+a,p=!0}}if(null===c)return{ok:!1,reason:"unreadable"};const u=Number(c);if(!Number.isFinite(u))return{ok:!1,reason:"unreadable"};if(a&&!o)return{ok:!1,reason:"negativeNotAllowed"};const h=a?-u:u;return i||p||h===Math.trunc(h)?{ok:!0,value:h}:{ok:!1,reason:"decimalsNotAllowed"}}var qe=Object.defineProperty,He=Object.getOwnPropertyDescriptor,We=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?He(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&qe(t,i,n),n};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.defaultUnits=[],this.value=null,this.disabled=!1,this.locale="en-US",this.numberLocale="nl-NL",this.hideLabel=!1,this.mode="inputForm",this.globalDecimals="INF",this.typedMemberValues={},this._errors=[],this._xbrlErrors=[],this._touched=!1,this._showPeriodPopup=!1,this._availableUnits=[],this._numericDraftValue=null,this._focused=!1}willUpdate(e){var t;(e.has("value")||e.has("field"))&&this._validateField(),e.has("unit")&&this.unit&&(this.unit,this.conceptId,this.columnId,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:null==(t=this.field)?void 0:t.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0}))),e.has("field")&&this.field&&(this.conceptId.includes("DescriptionLocationNL")||this.columnId.startsWith("col-"))&&(this.conceptId,this.columnId,this.field.periodType,this.field.periodStartDate,this.field.periodEndDate,this.field.periodInstantDate)}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=$.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_isRoundingLevelConcept(){return!!this.conceptId&&this.conceptId.includes("DocumentIntendedRoundingLevel")}_renderLockIcon(){const t=this.prefilledTooltip||E.t("field.prefilledLocked");return e.html`
|
|
22
|
+
*/function C(e){return S({...e,state:!0,attribute:!1})}class ${static validateField(e,t,i,o,r,n=[]){const a=[];for(const s of n){const n=this.validateRule(e,t,i,o,r,s);n&&a.push(n)}return a}static validateRule(e,t,i,o,r,n){const a=null==o||""===o;switch(n.type){case"required":if(a)return this.createError(e,t,i,n);break;case"min":if(!a&&"number"==typeof o&&o<n.value)return this.createError(e,t,i,n);break;case"max":if(!a&&"number"==typeof o&&o>n.value)return this.createError(e,t,i,n);break;case"minLength":if(!a&&"string"==typeof o&&o.length<n.value)return this.createError(e,t,i,n);break;case"maxLength":if(!a&&"string"==typeof o&&o.length>n.value)return this.createError(e,t,i,n);break;case"pattern":if(!a&&"string"==typeof o){if(!new RegExp(n.value).test(o))return this.createError(e,t,i,n)}break;case"email":if(!a&&"string"==typeof o){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))return this.createError(e,t,i,n)}break;case"url":if(!a&&"string"==typeof o)try{new URL(o)}catch{return this.createError(e,t,i,n)}break;case"custom":break;default:console.warn(`Unknown validation rule type: ${n.type}`)}return null}static createError(e,t,i,o){return{fieldId:e,conceptId:t,columnId:i,message:o.message,severity:o.severity||"error",rule:o}}static validateDataType(e,t){if(null==e||""===e)return{valid:!0,convertedValue:e};switch(t){case"number":case"decimal":case"currency":case"percentage":{const t=Number(e);return isNaN(t)?{valid:!1,error:"Invalid number format"}:{valid:!0,convertedValue:t}}case"date":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid date format"}:{valid:!0,convertedValue:t.toISOString().split("T")[0]}}case"datetime":{const t=new Date(e);return isNaN(t.getTime())?{valid:!1,error:"Invalid datetime format"}:{valid:!0,convertedValue:t.toISOString()}}case"boolean":if("boolean"==typeof e)return{valid:!0,convertedValue:e};if("string"==typeof e){const t=e.toLowerCase();if("true"===t||"1"===t)return{valid:!0,convertedValue:!0};if("false"===t||"0"===t)return{valid:!0,convertedValue:!1}}return{valid:!1,error:"Invalid boolean format"};case"text":case"textarea":case"email":case"url":case"tel":return{valid:!0,convertedValue:String(e)};default:return{valid:!0,convertedValue:e}}}static formatValue(e,t,i="en-US"){if(null==e)return"";switch(t){case"number":return new Intl.NumberFormat(i).format(Number(e));case"decimal":return new Intl.NumberFormat(i,{minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(e));case"currency":return new Intl.NumberFormat(i,{style:"currency",currency:"USD"}).format(Number(e));case"percentage":return new Intl.NumberFormat(i,{style:"percent",minimumFractionDigits:2}).format(Number(e)/100);case"date":return new Date(e).toLocaleDateString(i);case"datetime":return new Date(e).toLocaleString(i);default:return String(e)}}}class k{static formatPeriodDisplay(e,t){if(!e||!t)return`${e} / ${t}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}static createUniqueConceptId(e,t){let i=e.id;if(e.preferredLabel&&""!==e.preferredLabel.trim()){const t=e.preferredLabel.match(/\/([^\/]+)$/),o=t?t[1]:e.preferredLabel.replace(/[^a-zA-Z0-9]/g,"_");i=`${e.id}_${o}`}if(t){return`${i}__${this.createSectionHash(t)}`}return i}static createSectionHash(e){let t=0;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t&=t}return Math.abs(t).toString(36).substr(0,6)}static _extractDocumentationLabels(e){const t={};return e.filter(e=>"http://www.xbrl.org/2003/role/documentation"===e.role).forEach(e=>{t[e.lang]=e.label}),t}static buildFormSchema(e,t,i,o="en",r){var n,a;if(!e.presentation||0===e.presentation.length)throw new Error("XBRL presentation data is required");const s=e.presentation[0],l=null==(n=e.hypercubes)?void 0:n[0],d=Array.isArray(e.datatypes)?e.datatypes:(null==(a=e.datatypes)?void 0:a.concepts)||[],c=[];return s.roles.forEach(e=>{const n=this.buildSectionFromRole(e,t,i,l,o,r);d&&d.length>0?(n.datatypes=d,d.length,n.id):console.warn(`⚠️ [buildFormSchema] No datatypes available for section ${n.id}`),this.assignFieldColumnIds(n),c.push(n)}),{formId:`xbrl-form-${Date.now()}`,title:`XBRL Form - ${this.extractEntityName(s.entrypoint)}`,description:"Dynamic form generated from XBRL taxonomy data",version:"1.0.0",sections:c}}static buildSectionFromRole(e,t,i,o,r="en",n){var a,s;let l;if(e.labels&&e.labels.length>0){const t=e.labels.find(e=>e.lang===r),i=e.labels.find(e=>"en"===e.lang)||e.labels[0];l=(t||i).label}else l=this.extractRoleTitle(e.role||e.id||"Unknown Role");const d=this.getAllNonAbstractConcepts(e),c=new Set(d.filter(e=>e.periodType).map(e=>e.periodType));let p=null==o?void 0:o.roles.find(t=>t.roleId===e.id);const u=null==n?void 0:n[e.id];p&&(null==u?void 0:u.dimensionSelections)&&u.dimensionSelections.length>0&&(e.id,p=this.filterHypercubeDimensionsBySelection(p,u.dimensionSelections));const h=this.generateDefaultColumnsForRole(e,t||"2025-01-01",i||"2025-12-31",p,d,c,u,r),m={periodTypes:c,availableColumnIds:h.map(e=>e.id),availableColumns:h},f=[],b=new Map;return(null==(a=e.presentationLinkbase)?void 0:a.concepts)&&e.presentationLinkbase.concepts.forEach(o=>{const n=this.buildConceptTree(o,0,t,i,m,e.id,r,b);n&&f.push(n)}),p&&(null==(s=p.items)?void 0:s.length)||!o||f.forEach(t=>this.applyCrossRoleDimensions(t,e.id,o,r)),{id:e.id,title:l,description:e.description||`Section for ${l}`,concepts:f,columns:h,expanded:!1,metadata:{roleURI:e.roleURI,originalRole:e.role},showPeriodControl:c.size>1,showPreviousYear:!0===e.showPreviousYear,instant:!0===e.instant,duration:!0===e.duration}}static buildConceptTree(e,t,i,o,r,n,a="en",s,l){var d,c;const p=this.getPreferredLabel(e.labels,a,e.preferredLabel),u=(null==(d=e.preferredLabel)?void 0:d.includes("periodStartLabel"))?"start":(null==(c=e.preferredLabel)?void 0:c.includes("periodEndLabel"))?"end":l,h="start"===u?"periodStartLabel":"end"===u?"periodEndLabel":void 0,m=[];if(!e.elementAbstract){let t=[];t=(null==r?void 0:r.availableColumnIds)&&r.availableColumnIds.length>0?r.availableColumnIds:["duration"],t.forEach(t=>{var n;const s=null==(n=null==r?void 0:r.availableColumns)?void 0:n.find(e=>e.id===t),d=(null==s?void 0:s.periodStartDate)||i,c=(null==s?void 0:s.periodEndDate)||o,p=this.createFieldFromConcept(e,d,c,t,l,a);p&&m.push(p)})}const f=[];e.children&&e.children.length>0&&e.children.forEach(e=>{const l=this.buildConceptTree(e,t+1,i,o,r,n,a,s,u);l&&f.push(l)});if(!(m.length>0||f.length>0))return null;let b=this.createUniqueConceptId(e,n);if(s){const e=s.get(b)??0;s.set(b,e+1),e>0&&(b=`${b}__occ${e+1}`)}const g={conceptName:e.conceptName,type:e.type,substitutionGroup:e.substitutionGroup,periodType:e.periodType,balance:e.balance,documentationLabels:this._extractDocumentationLabels(e.labels)};return{id:b,originalConceptId:e.id,name:e.conceptName,label:p,description:`${e.conceptName} (${e.type})`,type:e.type,level:t,children:f,fields:m,conceptMetadata:g,facts:e.facts||[],collapsed:t>0,abstract:e.elementAbstract,periodType:e.periodType,balance:e.balance,preferredLabel:e.preferredLabel,effectivePeriodRole:h}}static createFieldFromConcept(e,t,i,o,r,n="en"){var a;const s=this.mapXBRLTypeToFieldType(e.type),l=this.getPreferredLabel(e.labels,n,e.preferredLabel);let d;d=o||"duration";const c={id:`${e.id}_${d}_field`,conceptId:e.id,columnId:d,type:s,label:l,placeholder:`Enter ${l.toLowerCase()}`,required:!1,disabled:e.elementAbstract,defaultValue:null,periodType:"instant"===e.periodType||"duration"===e.periodType?e.periodType:void 0,periodStartDate:t||"2025-01-01",periodEndDate:i||"2025-12-31",periodInstantDate:"instant"===e.periodType?(null==(a=e.preferredLabel)?void 0:a.includes("periodStartLabel"))||"start"===r?this.subtractOneDay(t||"2025-01-01"):i||t||"2025-01-01":void 0};return"nl-cd_DescriptionLocationNL__a64trl"===e.id&&(e.id,e.periodType),c}static mapXBRLTypeToFieldType(e){return{"xbrli:stringItemType":"text","xbrli:monetaryItemType":"currency","xbrli:integerItemType":"number","xbrli:decimalItemType":"decimal","xbrli:percentItemType":"percentage","xbrli:dateItemType":"date","xbrli:booleanItemType":"boolean","dtr-types:domainItemType":"select","bw2-titel9:chamberOfCommerceRegistrationNumberItemType":"text"}[e]||"text"}static getPreferredLabel(e,t="en",i){if(!e||0===e.length)return"Unnamed Concept";const o=e.filter(e=>e.lang===t),r=o.length>0?o:e;if(i){const t=o.find(e=>e.role===i);if(t)return t.label;const r=e.find(e=>e.role===i);if(r)return r.label}const n=r.find(e=>e.preferredLabel);if(n)return n.label;const a=r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role);if(a)return a.label;const s=r.find(e=>"http://www.xbrl.org/2003/role/terseLabel"===e.role);return s?s.label:r.length>0?r[0].label:e[0].label}static assignFieldColumnIds(e){if(!e.columns||0===e.columns.length)return;const t=e.columns.map(e=>e.id);e.concepts.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static assignColumnIdsToConceptFields(e,t){e.fields=e.fields.filter(e=>t.includes(e.columnId)),e.children&&e.children.forEach(e=>{this.assignColumnIdsToConceptFields(e,t)})}static countFieldsInTree(e){let t=e.fields.length;return e.children&&e.children.forEach(e=>{t+=this.countFieldsInTree(e)}),t}static getAllNonAbstractConcepts(e){var t;const i=[];return(null==(t=e.presentationLinkbase)?void 0:t.concepts)&&e.presentationLinkbase.concepts.forEach(e=>{this.collectNonAbstractConcepts(e,i)}),i}static collectNonAbstractConcepts(e,t){e.elementAbstract||t.push(e),e.children&&e.children.length>0&&e.children.forEach(e=>{this.collectNonAbstractConcepts(e,t)})}static filterHypercubeDimensionsBySelection(e,t){const i=JSON.parse(JSON.stringify(e));return i.items&&0!==i.items.length?(i.items.forEach(e=>{e.dimensions&&(e.dimensions=e.dimensions.map(e=>{var i,o;const r=t.find(t=>t.dimensionId===e.id);if(!r||!r.selectedMemberIds||0===r.selectedMemberIds.length)return e;const n={...e};return n.members=this.filterMembersBySelection(e.members,r.selectedMemberIds),e.id,null==(i=e.members)||i.length,null==(o=n.members)||o.length,n}))}),i):i}static filterMembersBySelection(e,t){if(!e||!Array.isArray(e))return[];const i=[];return e.forEach(e=>{if(t.includes(e.id)&&i.push({...e,children:[]}),e.children&&e.children.length>0){const o=this.filterMembersBySelection(e.children,t);i.push(...o)}}),i}static findCrossRoleDimensions(e,t,i,o="en"){var r,n;const a=[];for(const d of i.roles)if(d.roleId!==t)for(const t of d.items)if((null==(r=t.conceptIds)?void 0:r.includes(e))&&(null==(n=t.dimensions)?void 0:n.some(e=>e.typedMember))){a.push(d);break}if(1!==a.length)return null;const s=a[0].items.find(t=>{var i;return null==(i=t.conceptIds)?void 0:i.includes(e)});if(!s)return null;const l=[];for(const d of s.dimensions){if(!d.typedMember)continue;const e=d.labels.find(e=>e.lang===o)||d.labels.find(e=>"en"===e.lang)||d.labels[0],t=(null==e?void 0:e.label)||d.id;l.push({axisId:d.id,axisLabel:t,typedMemberId:d.typedMember.id,memberLabel:t,type:d.typedMember.type,validation:d.typedMember.validation})}return l.length>0?l:null}static applyCrossRoleDimensions(e,t,i,o){var r;if(!e.abstract&&e.fields&&e.fields.length>0){const r=this.findCrossRoleDimensions(e.originalConceptId,t,i,o);r&&e.fields.forEach(e=>{e.crossRoleTypedMembers=r})}null==(r=e.children)||r.forEach(e=>this.applyCrossRoleDimensions(e,t,i,o))}static generateDefaultColumnsForRole(e,t,i,o,r,n,a,s="en"){var l,d;const c=r||this.getAllNonAbstractConcepts(e),p=n||new Set(c.filter(e=>e.periodType).map(e=>e.periodType));if(0===c.length)return[{id:"default",title:"Value",description:"Default value column",type:"base",order:0,removable:!1}];let u=[];if(1===(null==(l=null==o?void 0:o.items)?void 0:l.length)){const e=o.items[0];1===e.dimensions.length?u=this.generateSingleDimensionColumns(e.dimensions[0],t,i,p,s):e.dimensions.length>1&&(u=this.generateMultiDimensionColumns(e.dimensions,t,i,p,s)),a&&(u=this.filterColumnsByPeriodPreferences(u,a))}else(null==(d=null==o?void 0:o.items)?void 0:d.length)&&o.items.length;const h=[];u.length>0?h.push(...u):0===p.size?h.push({id:"default",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i}):h.push({id:"duration",title:this.formatPeriodDisplay(t,i),description:"",type:"base",order:0,removable:!1,periodStartDate:t,periodEndDate:i});let m=h;if(a&&(m=this.filterColumnsByPeriodPreferences(h,a)),null==a?void 0:a.showPreviousYear){const e=this.generatePreviousYearColumns(m,t,i);m=[...m,...e]}return m}static getPreviousYearDate(e){try{const t=new Date(e);return t.setFullYear(t.getFullYear()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error calculating previous year for date ${e}:`,t),e}}static subtractOneDay(e){try{const t=new Date(e);return t.setDate(t.getDate()-1),t.toISOString().split("T")[0]}catch(t){return console.error(`Error subtracting one day from date ${e}:`,t),e}}static generatePreviousYearColumns(e,t,i){const o=[],r=this.getPreviousYearDate(t),n=this.getPreviousYearDate(i);return e.forEach((e,t)=>{let i=e.title,a="",s="";e.dimensionData?(i=e.title,a=this.formatPeriodDisplay(r,n),s=`${e.id}_prev`):(i=this.formatPeriodDisplay(r,n),a="",s=`duration_prev_${t}`),o.push({...e,id:s,title:i,description:a,order:e.order+100,removable:!1,periodStartDate:r,periodEndDate:n,dimensionData:e.dimensionData?{...e.dimensionData,dimensionId:`${e.dimensionData.dimensionId}_prev`}:void 0})}),o}static filterColumnsByPeriodPreferences(e,t){return e.filter(e=>{var i,o,r,n;const a=e.id.includes("duration")||(null==(o=null==(i=e.dimensionData)?void 0:i.dimensionId)?void 0:o.includes("duration")),s=e.id.includes("instant")||(null==(n=null==(r=e.dimensionData)?void 0:r.dimensionId)?void 0:n.includes("instant"));return!a&&!s||!(a&&!t.showDuration)&&!(s&&!t.showInstant)})}static generateSingleDimensionColumns(e,t,i,o,r="en"){if(e.typedMember&&(!e.members||0===e.members.length)){const n=this.getPreferredLabel(e.labels,r)||e.conceptName,a={axisId:e.id,axisLabel:n,typedMemberId:e.typedMember.id,type:e.typedMember.type,validation:e.typedMember.validation,dimensionKey:`${n} | [Typed Input]`,dimensionIdKey:`${e.id}|[typed]`},s=[];return 0===o.size?s.push({id:"typed-default",title:n,description:"Typed dimension input column",type:"dimension",dimensionData:{dimensionId:"typed-default",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?s.push({id:"typed-instant",title:`${n} `,description:i,type:"dimension",dimensionData:{dimensionId:"typed-instant",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):(1===o.size&&o.has("duration"),s.push({id:"typed-duration",title:`${n} `,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"typed-duration",axisId:a.axisId,memberId:"[typed]",memberValue:"Typed Input",memberLabel:"Typed Input",axis:a.axisLabel,axisLabel:a.axisLabel,memberKey:a.dimensionKey,dimensionIdKey:a.dimensionIdKey,hasTypedMembers:!0,typedMemberId:a.typedMemberId,typedMembers:[{axisId:a.axisId,axisLabel:a.axisLabel,typedMemberId:a.typedMemberId,memberLabel:a.axisLabel,type:a.type,validation:a.validation}]},order:0,removable:!1,periodStartDate:t,periodEndDate:i})),s}if(!e.members||!Array.isArray(e.members))return[];if(0===e.members.length)return[];const n=this.getPreferredLabel(e.labels,r)||e.conceptName,a=e.members[0],s=this.getPreferredLabel(a.labels,r)||a.conceptName,l={axisId:e.id,axisLabel:n,memberId:a.id,memberLabel:s,dimensionKey:`${n} | ${s}`,dimensionIdKey:`${e.id} | ${a.id}`},d=[];return 0===o.size?d.push({id:"default",title:l.memberLabel,description:"Default value column",type:"dimension",dimensionData:{dimensionId:"default",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):1===o.size&&o.has("instant")?d.push({id:"instant",title:`${l.memberLabel}`,description:i,type:"dimension",dimensionData:{dimensionId:"instant",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:i,periodEndDate:i}):1===o.size&&o.has("duration")?d.push({id:"duration",title:`${l.memberLabel}`,description:`${t} / ${i}`,type:"dimension",dimensionData:{dimensionId:"duration",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}):d.push({id:"duration",title:`${l.memberLabel}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{dimensionId:"duration",axisId:l.axisId,memberId:l.memberId,memberValue:l.memberLabel,memberLabel:l.memberLabel,axis:l.axisLabel,axisLabel:l.axisLabel,memberKey:l.dimensionKey,dimensionIdKey:l.dimensionIdKey},order:0,removable:!1,periodStartDate:t,periodEndDate:i}),d}static generateMultiDimensionColumns(e,t,i,o,r="en"){e.some(e=>e.typedMember);const n=e.filter(e=>!!e.typedMember||!!(e.members&&Array.isArray(e.members)&&e.members.length>0));if(0===n.length)return[];const a=n.map(e=>{const t=this.getPreferredLabel(e.labels,r)||e.conceptName;if(e.typedMember)return{id:e.id,axisLabel:t,isTyped:!0,typedMemberId:e.typedMember.id,type:e.typedMember.type,validation:e.typedMember.validation,members:[{id:"[typed]",label:`${t}`}]};const i=this.getAllDimensionMembers(e.members);return{id:e.id,axisLabel:t,isTyped:!1,members:i.map(e=>({id:e.id,label:this.getPreferredLabel(e.labels,r)||e.conceptName}))}}),s=this.generateDimensionCombinations(a),l=[];return s.forEach((e,o)=>{const r=e.map(e=>e.memberLabel).join(" | "),n=e.filter(e=>e.isTyped),a=e.filter(e=>!e.isTyped),s={dimensionId:`multi_${o}`,memberValue:r,memberLabel:r,combinations:a.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,memberId:e.memberId,memberLabel:e.memberLabel})),typedMembers:n.map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.typedMemberId,memberLabel:e.memberLabel,type:e.type,validation:e.validation})),hasTypedMembers:n.length>0,memberKey:r,dimensionIdKey:[...a.map(e=>`${e.axisId}|${e.memberId}`),...n.map(e=>`${e.axisId}|[typed]`)].join("::")};l.push({id:`duration_${o}`,title:`${r}`,description:this.formatPeriodDisplay(t,i),type:"dimension",dimensionData:{...s,dimensionId:`duration_${o}`},order:o,removable:!1,periodStartDate:t,periodEndDate:i})}),l}static getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this.getAllDimensionMembers(e.children))}),t}static generateDimensionCombinations(e){if(0===e.length)return[];if(1===e.length)return e[0].members.map(t=>[{axisId:e[0].id,axisLabel:e[0].axisLabel,memberId:t.id,memberLabel:t.label,isTyped:e[0].isTyped||!1,typedMemberId:e[0].typedMemberId,type:e[0].type,validation:e[0].validation}]);const[t,...i]=e,o=this.generateDimensionCombinations(i),r=[];return t.members.forEach(e=>{0===o.length?r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId,type:t.type,validation:t.validation}]):o.forEach(i=>{r.push([{axisId:t.id,axisLabel:t.axisLabel,memberId:e.id,memberLabel:e.label,isTyped:t.isTyped||!1,typedMemberId:t.typedMemberId,type:t.type,validation:t.validation},...i])})}),r}static formatDateForDisplay(e){try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return e}}static extractEntityName(e){try{const t=new URL(e).pathname.split("/");return t[t.length-1].replace(".xsd","").replace(/[^a-zA-Z0-9]/g," ").trim()||"Entity"}catch{return"Entity"}}static extractRoleTitle(e){if(!e)return"Unnamed Section";const t=e.match(/^\[[\d]+\]\s*(.+)$/);if(t)return t[1].trim();if(e.match(/^[a-z]+:[^:]*$/i)||e.match(/^urn:[^:]+:[^:]+/i)){const t=e.split(/[:\-]/);return t[t.length-1].replace(/[_\-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}return e.trim()||"Unnamed Section"}static extractRoleOrder(e){const t=e.match(/^\[([\d]+)\]/);return t?parseInt(t[1],10):0}static buildColumnsFromHypercubes(){return[{id:"default",label:"Values",type:"data"}]}}const T={en:{conceptInfo:{title:"Concept Information",conceptName:"Concept name",type:"Type",substitutionGroup:"Substitution group",periodType:"Period type",balance:"Balance",documentation:"Documentation",instant:"Instant",duration:"Duration",close:"Close"},form:{markAsComplete:"Mark as Complete",loading:"Loading form...",submit:"Validate",save:"Save",saveDraft:"Save Draft",savingDraft:"Saving draft",errors:"Errors",modified:"Modified",valid:"Valid",yes:"Yes",no:"No",noRoleSelected:"No Role Selected",pleaseSelectRole:"Please select a role from the list on the left.",expandPanel:"Expand side panel",collapsePanel:"Collapse side panel",validate:"Validate",preview:"Preview",download:"Download",cancelValidation:"Cancel Validation",lastValidationResults:"Last Validation Results",validationInProgress:"Validation In Progress",quickValidate:"Quick Validate"},filter:{selectRoles:"Select Roles",filterRoles:"Filter Roles",title:"Filter Roles",description:"Select the roles you want to display in the form. You can search and choose specific roles to focus on or manage all available roles.",searchPlaceholder:"Search..",clearSearch:"Clear search",showingResults:"Showing",of:"of",roles:"roles",matching:"matching",selectAll:"Select All",selectNone:"Select None",selectFiltered:"Select Filtered",deselectFiltered:"Deselect Filtered",deselectAll:"Deselect All",reset:"Reset",noRolesFound:"No roles found matching",tryDifferentSearch:"Try a different search term or clear the search.",noRolesAvailable:"No roles available.",cancel:"Cancel",applyFilter:"Apply Filter",showPeriodColumn:"Show Period Column:",additionalOptions:"Additional Options:",showPreviousYear:"Show previous year",duration:"Duration",instant:"Instant",uri:"URI",dimensionMemberSelection:"Dimension Member Selection",selectAllMembers:"Select All",clearMembers:"Clear",availableRoles:"Available Roles",chosenRoles:"Chosen Roles",roleCount:"role(s)",rolesSelected:"role(s) selected",addSelectedRole:"Add selected role",addAllRoles:"Add all roles",removeSelectedRole:"Remove selected role",removeAllRoles:"Remove all roles",advancedFilter:"Advanced Filter",backToFilterRoles:"← Back",showFactsOnly:"Show facts only",showFactsOnlyDescription:"Hide all blank rows and sections. Only roles and rows with at least one filled value will be shown.",searchByConcept:"Search by concept",searchByConceptDescription:"Type concept name or label to filter roles and rows. Press Apply Filter to apply.",searchByConceptPlaceholder:"Type concept name or label and press Apply Filter...",clearFilters:"Clear Filters",resetFilter:"Reset",bannerConcept:'Filtered by "{{concept}}" — {{count}} row(s) visible',bannerFactsOnly:"Only filled-in fields are shown",showAll:"Show all"},column:{addColumn:"Add Column",columnOptions:"Column Options",columnType:"Column Type",instantSingleDate:"Instant (single date)",durationDates:"Duration (start and end dates)",instantDate:"Instant Date",startPeriodDate:"Start Period Date",endPeriodDate:"End Period Date",availableDimensions:"Available Dimensions",dimensionsDescription:"Select dimensions to include in the column. Domain members can be selected here, while typed dimension values will be entered directly in the column header.",enterValue:"Enter value for",enterValuePlaceholder:"Enter value...",selectMember:"Select member:",noMembersAvailable:"No members available for this dimension",cancel:"Cancel",removeColumn:"Remove column",hideColumn:"Hide column",showColumn:"Double-click to show column",required:"required"},section:{enterPlaceholder:"Enter",position:"Section {{current}} of {{total}}",previous:"← Previous",next:"Next: {{title}} →",locateInList:"Show this section in the list on the left",amountScaleBase:"Amounts in €",amountScaleFactor:"Amounts in € × {{factor}}"},field:{selectOption:"Select an option...",select:"Select...",emptyOption:"—",enterDetailedExplanation:"Detailed explanation",enterAmountNoDecimals:"Amount, no decimals",enterCurrency:"0.00",enterText:"Text",enterWholeNumber:"Whole number",enterPositiveNumber:"Positive number",enterDecimalValue:"Decimal value",enterNumberOfShares:"Number of shares",yearFormat:"YYYY",enterPercentage:"e.g. 0.25 for 25% or 0.2550 for 25.50%",emailPlaceholder:"email@example.com",urlPlaceholder:"https://example.com",phonePlaceholder:"+1 (555) 000-0000",enterValue:"Value",enterDetailedInformation:"Detailed information",scale:"Scale",addText:"Add text",editText:"Edit",save:"Save",cancel:"Cancel",characters:"characters",editPeriod:"Edit Period",from:"From",to:"To",date:"Date",unit:"Unit",selectUnit:"Select Unit",leaveBlankForInf:"Leave blank for INF",prefilledLocked:"Pre-filled — cannot be changed here",notApplicablePriorYear:"Not required for the previous year",invalidNumber:'Can\'t read "{{value}}" as a number',noDecimalsAllowed:"This field doesn't accept decimals",negativeNotAllowed:"A negative value isn't allowed here",ambiguousNumber:'"{{value}}" is ambiguous — retype it without the thousands separator'},admin:{title:"Configure Roles",description:"Select which roles should display the 'Show Previous Year' checkbox and configure period type columns."},validation:{summary:"Please fix the following errors before submitting:",errorsFound:"errors found",unitRequired:"Unit is required. Please select a unit via the period icon.",typedMemberRequired:"This field is required because data has been entered in this column."},xbrlValidation:{patternMismatch:"Value does not match required pattern: {{pattern}}",invalidPattern:"Invalid pattern configuration: {{pattern}}",exactLength:"Value must be exactly {{required}} characters (current: {{current}})",minLength:"Value must be at least {{required}} characters (current: {{current}})",maxLength:"Value must not exceed {{required}} characters (current: {{current}})",totalDigits:"Value must not exceed {{required}} total digits (current: {{current}})",ruleSummaryPattern:"Must match pattern: {{pattern}}",ruleSummaryExactLength:"Must be exactly {{required}} characters",ruleSummaryMinLength:"Minimum {{required}} characters",ruleSummaryMaxLength:"Maximum {{required}} characters",ruleSummaryTotalDigits:"Maximum {{required}} total digits"},error:{popup:{title:"Validation Errors",message:"Please fix the following validation errors before saving:",field:"Field:",value:"Value:",errors:"Errors:",clickToFocus:"Click to focus this field",ok:"OK"}},typedDimensionWarning:{title:"Typed dimension values missing",message:"The form contains errors for the following roles where a typed dimension value is missing. Do you still want to continue?",role:"Role:",field:"Field:",value:"Value:",clickToFocus:"Click to go to this fact",continue:"Continue to validate",cancel:"Cancel"},validateWarningPopup:{title:"Validation warnings"},duplicateFactWarning:{title:"Duplicate facts with different values",message:"The same concept, period and dimensions were found with different values entered in different roles. Only one value can be correct — click a fact below to review and fix it.",role:"Role:",value:"Value:",clickToFocus:"Click to go to this fact",cellTooltip:"This value differs from the same fact entered elsewhere — click to review",close:"Close"},calculationWarning:{title:"Calculation warning",summaryLine:'Total "{{label}}" should equal {{calculated}}, but you entered {{entered}}.',childrenPrefix:"Children:",childAdded:"{{label}} = {{value}} (added)",childSubtracted:"{{label}} = {{value}} (subtracted, opposite balance)",added:"Added",subtracted:"Subtracted (opposite balance)"},balanceCheck:{balanced:"{{column}}: In balance",difference:"Difference {{column}}: {{amount}}"},formulaValidation:{dialogTitle:"Formula check results",allPassed:"All formula checks passed",summaryCount:"{{failed}} of {{total}} checks failed",summaryCountBreakdown:"{{warnings}} warnings, {{errors}} errors",severityWarning:"Warning",severityError:"Error",close:"Close",breakdownLabel:"Values checked:"},scrollToConcept:{revealRole:{title:"Role not in your filtered list",message:'This field is in the role "{{role}}", which is not in your filtered list of roles. Do you want to make this role visible?',confirm:"Yes, show role",cancel:"No"}}},nl:{conceptInfo:{title:"Conceptinformatie",conceptName:"Conceptnaam",type:"Type",substitutionGroup:"Substitutiegroep",periodType:"Periodetype",balance:"Saldo",documentation:"Documentatie",instant:"Moment",duration:"Periode",close:"Sluiten"},form:{markAsComplete:"Markeren als volledig behandeld",loading:"Formulier laden...",submit:"Valideren",save:"Opslaan",saveDraft:"Concept opslaan",savingDraft:"Concept opslaan...",errors:"Fouten",modified:"Gewijzigd",valid:"Geldig",yes:"Ja",no:"Nee",noRoleSelected:"Geen rol geselecteerd",pleaseSelectRole:"Selecteer een rol uit de lijst aan de linkerkant.",expandPanel:"Zijpaneel uitvouwen",collapsePanel:"Zijpaneel inklappen",validate:"Valideren",preview:"Voorbeeld",download:"Downloaden",cancelValidation:"Validatie annuleren",lastValidationResults:"Laatste validatieresultaten",validationInProgress:"Validatie bezig",quickValidate:"Snel valideren"},filter:{selectRoles:"Rollen selecteren",filterRoles:"Rollen filteren",title:"Rollen filteren",description:"Selecteer de rollen die u in het formulier wilt weergeven. U kunt zoeken en specifieke rollen kiezen om op te focussen of alle beschikbare rollen beheren.",searchPlaceholder:"Zoek rollen op naam, ID of URI...",clearSearch:"Zoekopdracht wissen",showingResults:"Weergeven",of:"van",roles:"rollen",matching:"overeenkomend met",selectAll:"Alles selecteren",selectNone:"Niets selecteren",selectFiltered:"Gefilterd selecteren",deselectFiltered:"Gefilterd deselecteren",deselectAll:"Alles deselecteren",reset:"Resetten",noRolesFound:"Geen rollen gevonden die overeenkomen met",tryDifferentSearch:"Probeer een andere zoekterm of wis de zoekopdracht.",noRolesAvailable:"Geen rollen beschikbaar.",cancel:"Annuleren",applyFilter:"Filter toepassen",showPeriodColumn:"Periodekolom weergeven:",additionalOptions:"Aanvullende opties:",showPreviousYear:"Vorig jaar weergeven",duration:"Duur",instant:"Moment",uri:"URI",dimensionMemberSelection:"Dimensieleden selectie",selectAllMembers:"Alles selecteren",clearMembers:"Wissen",availableRoles:"Beschikbare rollen",chosenRoles:"Gekozen rollen",roleCount:"rol(len)",rolesSelected:"rol(len) geselecteerd",addSelectedRole:"Geselecteerde rol toevoegen",addAllRoles:"Alle rollen toevoegen",removeSelectedRole:"Geselecteerde rol verwijderen",removeAllRoles:"Alle rollen verwijderen",advancedFilter:"Geavanceerd filter",backToFilterRoles:"← Terug",showFactsOnly:"Alleen feiten weergeven",showFactsOnlyDescription:"Verberg alle lege rijen en secties. Alleen rollen en rijen met minimaal één ingevulde waarde worden weergegeven.",searchByConcept:"Zoeken op concept",searchByConceptDescription:"Typ een conceptnaam of label om rollen en rijen te filteren. Druk op Filter toepassen om te activeren.",searchByConceptPlaceholder:"Typ conceptnaam of label en druk op Filter toepassen...",clearFilters:"Filters wissen",resetFilter:"Resetten",bannerConcept:'Gefilterd op "{{concept}}" — {{count}} rij(en) zichtbaar',bannerFactsOnly:"Alleen ingevulde velden worden getoond",showAll:"Alles tonen"},column:{addColumn:"Kolom toevoegen",columnOptions:"Kolomopties",columnType:"Kolomtype",instantSingleDate:"Moment (enkele datum)",durationDates:"Duur (begin- en einddatum)",instantDate:"Momentdatum",startPeriodDate:"Startdatum periode",endPeriodDate:"Einddatum periode",availableDimensions:"Beschikbare dimensies",dimensionsDescription:"Selecteer dimensies om in de kolom op te nemen. Domeinleden kunnen hier worden geselecteerd, terwijl getypte dimensiewaarden direct in de kolomkop worden ingevoerd.",enterValue:"Voer waarde in voor",enterValuePlaceholder:"Voer waarde in...",selectMember:"Selecteer lid:",noMembersAvailable:"Geen leden beschikbaar voor deze dimensie",cancel:"Annuleren",removeColumn:"Kolom verwijderen",hideColumn:"Kolom verbergen",showColumn:"Dubbelklik om kolom te tonen",required:"verplicht"},section:{enterPlaceholder:"Invoeren",position:"Onderdeel {{current}} van {{total}}",previous:"← Vorige",next:"Volgende: {{title}} →",locateInList:"Toon dit onderdeel in de lijst aan de linkerkant",amountScaleBase:"Bedragen in €",amountScaleFactor:"Bedragen in € × {{factor}}"},field:{selectOption:"Selecteer een optie...",select:"Selecteer...",emptyOption:"—",enterDetailedExplanation:"Gedetailleerde uitleg",enterAmountNoDecimals:"Bedrag, zonder decimalen",enterCurrency:"0,00",enterText:"Tekst",enterWholeNumber:"Geheel getal",enterPositiveNumber:"Positief getal",enterDecimalValue:"Decimale waarde",enterNumberOfShares:"Aantal aandelen",yearFormat:"JJJJ",enterPercentage:"bijv. 0,25 voor 25% of 0,2550 voor 25,50%",emailPlaceholder:"email@voorbeeld.nl",urlPlaceholder:"https://voorbeeld.nl",phonePlaceholder:"+31 (0)20 123 4567",enterValue:"Waarde",enterDetailedInformation:"Gedetailleerde informatie",scale:"Schaal",addText:"Tekst toevoegen",editText:"Bewerken",save:"Opslaan",cancel:"Annuleren",characters:"tekens",editPeriod:"Periode bewerken",from:"Van",to:"Tot",date:"Datum",unit:"Eenheid",selectUnit:"Selecteer eenheid",leaveBlankForInf:"Leeg laten voor INF",prefilledLocked:"Vooraf ingevuld — kan hier niet worden gewijzigd",notApplicablePriorYear:"Niet vereist voor het voorgaande jaar",invalidNumber:"Kan '{{value}}' niet lezen als getal",noDecimalsAllowed:"Dit veld accepteert geen decimalen",negativeNotAllowed:"Een negatieve waarde is hier niet toegestaan",ambiguousNumber:"'{{value}}' is dubbelzinnig — typ het opnieuw zonder duizendtalscheidingsteken"},admin:{title:"Rollen configureren",description:"Selecteer welke rollen het selectievakje 'Vorig jaar weergeven' moeten weergeven en configureer periodetype kolommen."},validation:{summary:"Corrigeer de volgende fouten voordat u indient:",errorsFound:"fouten gevonden",unitRequired:"Eenheid is verplicht. Selecteer een eenheid via het periodeicoon.",typedMemberRequired:"Dit veld is verplicht omdat er gegevens zijn ingevoerd in deze kolom."},xbrlValidation:{patternMismatch:"Waarde voldoet niet aan het vereiste patroon: {{pattern}}",invalidPattern:"Ongeldige patternconfiguratie: {{pattern}}",exactLength:"Waarde moet exact {{required}} tekens bevatten (huidig: {{current}})",minLength:"Waarde moet minimaal {{required}} tekens bevatten (huidig: {{current}})",maxLength:"Waarde mag niet meer dan {{required}} tekens bevatten (huidig: {{current}})",totalDigits:"Waarde mag niet meer dan {{required}} cijfers bevatten (huidig: {{current}})",ruleSummaryPattern:"Moet overeenkomen met patroon: {{pattern}}",ruleSummaryExactLength:"Moet exact {{required}} tekens bevatten",ruleSummaryMinLength:"Minimaal {{required}} tekens",ruleSummaryMaxLength:"Maximaal {{required}} tekens",ruleSummaryTotalDigits:"Maximaal {{required}} cijfers"},error:{popup:{title:"Validatiefouten",message:"Corrigeer de volgende validatiefouten voordat u opslaat:",field:"Veld:",value:"Waarde:",errors:"Fouten:",clickToFocus:"Klik om dit veld te focussen",ok:"OK"}},typedDimensionWarning:{title:"Waarden voor typed dimensie ontbreken",message:"Het formulier bevat fouten voor de volgende rollen waar een waarde voor de typed dimensie ontbreekt. Wilt u toch doorgaan?",role:"Rol:",field:"Veld:",value:"Waarde:",clickToFocus:"Klik om naar dit feit te gaan",continue:"Doorgaan met valideren",cancel:"Annuleren"},validateWarningPopup:{title:"Validatiewaarschuwingen"},duplicateFactWarning:{title:"Dubbele feiten met verschillende waarden",message:"Hetzelfde concept, dezelfde periode en dimensies zijn gevonden met verschillende waarden in verschillende rollen. Slechts één waarde kan juist zijn — klik op een feit hieronder om het te controleren en te corrigeren.",role:"Rol:",value:"Waarde:",clickToFocus:"Klik om naar dit feit te gaan",cellTooltip:"Deze waarde wijkt af van hetzelfde feit dat elders is ingevoerd — klik om te controleren",close:"Sluiten"},calculationWarning:{title:"Berekeningswaarschuwing",summaryLine:'Totaal "{{label}}" zou {{calculated}} moeten zijn, maar u heeft {{entered}} ingevoerd.',childrenPrefix:"Onderdelen:",childAdded:"{{label}} = {{value}} (opgeteld)",childSubtracted:"{{label}} = {{value}} (afgetrokken, tegengestelde balans)",added:"Opgeteld",subtracted:"Afgetrokken (tegengestelde balans)"},balanceCheck:{balanced:"{{column}}: In balans",difference:"Verschil {{column}}: {{amount}}"},formulaValidation:{dialogTitle:"Resultaten formulecontrole",allPassed:"Alle formulecontroles geslaagd",summaryCount:"{{failed}} van {{total}} controles mislukt",summaryCountBreakdown:"{{warnings}} waarschuwingen, {{errors}} fouten",severityWarning:"Waarschuwing",severityError:"Fout",close:"Sluiten",breakdownLabel:"Gecontroleerde waarden:"},scrollToConcept:{revealRole:{title:"Rol niet in uw gefilterde lijst",message:'Dit veld staat in de rol "{{role}}", die niet in uw gefilterde lijst met rollen staat. Wilt u deze rol zichtbaar maken?',confirm:"Ja, rol tonen",cancel:"Nee"}}}};class F{static setLanguage(e){T[e]?this.currentLanguage=e:(console.warn(`Language '${e}' not supported, falling back to 'en'`),this.currentLanguage="en")}static getLanguage(){return this.currentLanguage}static t(e,t){const i=e.split(".");let o=T[this.currentLanguage];for(const r of i){if(!o||"object"!=typeof o||!(r in o))return console.warn(`Translation key '${e}' not found for language '${this.currentLanguage}'`),e;o=o[r]}return t&&"string"==typeof o?this.interpolate(o,t):o}static interpolate(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,i)=>i in t?String(t[i]):e)}static has(e){const t=e.split(".");let i=T[this.currentLanguage];for(const o of t){if(!i||"object"!=typeof i||!(o in i))return!1;i=i[o]}return void 0!==i}static getAvailableLanguages(){return Object.keys(T)}}function E(e){return!!(null==e?void 0:e.toLowerCase().includes("totallabel"))}F.currentLanguage="en";class R{constructor(e=!1){this.DRAFT_DATA_KEY="jupiter-form-draft-data",this.DRAFT_METADATA_KEY="jupiter-form-draft-metadata",this.STORAGE_VERSION="1.0",this._storage=e?sessionStorage:localStorage}saveDraft(e,t){try{const i={formData:e,metadata:{...t,savedAt:(new Date).toISOString()},version:this.STORAGE_VERSION};return this._storage.setItem(this.DRAFT_DATA_KEY,JSON.stringify(i.formData)),this._storage.setItem(this.DRAFT_METADATA_KEY,JSON.stringify(i.metadata)),e.length,i.metadata.savedAt,t.selectedRoleIds.length,t.customColumns.length,!0}catch(i){return console.error("❌ Failed to save draft:",i),!1}}loadDraft(){try{const e=this._storage.getItem(this.DRAFT_DATA_KEY),t=this._storage.getItem(this.DRAFT_METADATA_KEY);if(!e||!t)return null;const i=JSON.parse(e),o=JSON.parse(t);return i.length,o.savedAt,o.selectedRoleIds.length,o.customColumns.length,{formData:i,metadata:o,version:this.STORAGE_VERSION}}catch(e){return console.error("❌ Failed to load draft:",e),null}}hasDraft(){return null!==this._storage.getItem(this.DRAFT_DATA_KEY)&&null!==this._storage.getItem(this.DRAFT_METADATA_KEY)}getDraftMetadata(){try{const e=this._storage.getItem(this.DRAFT_METADATA_KEY);return e?JSON.parse(e):null}catch(e){return console.error("❌ Failed to load draft metadata:",e),null}}clearDraft(){try{return this._storage.removeItem(this.DRAFT_DATA_KEY),this._storage.removeItem(this.DRAFT_METADATA_KEY),!0}catch(e){return console.error("❌ Failed to clear draft:",e),!1}}getDraftAge(){const e=this.getDraftMetadata();if(!e)return null;const t=new Date(e.savedAt);return(new Date).getTime()-t.getTime()}isDraftStale(e){const t=this.getDraftAge();return null!==t&&t>e}extractCustomColumns(e){const t=[];return e.forEach(e=>{e.columns&&Array.isArray(e.columns)&&e.columns.forEach(i=>{t.push({sectionId:e.id,columnId:i.id,label:i.title,description:i.description,periodType:this._inferPeriodTypeFromColumn(i),date:i.periodStartDate,startDate:i.periodStartDate,endDate:i.periodEndDate,dimensionData:i.dimensionData})})}),t}_inferPeriodTypeFromColumn(e){return e.periodStartDate&&e.periodEndDate?"duration":"instant"}createMetadataSnapshot(e,t,i,o,r,n,a,s,l,d="en",c,p,u,h,m){return{periodStartDate:e,periodEndDate:t,language:i,reportingLanguage:d,selectedRoleIds:o,customColumns:this.extractCustomColumns(r),typedMemberData:n,periodPreferences:a,periodData:s,unitData:l,decimalsData:p,repeatCounts:c,roleCompletedStates:u,hiddenColumns:h,totalManuallyEditedData:m,schemaVersion:this.STORAGE_VERSION}}validateDraftCompatibility(e,t,i){const o=[];e.metadata.periodStartDate!==t&&o.push(`Draft period start (${e.metadata.periodStartDate}) differs from current (${t})`),e.metadata.periodEndDate!==i&&o.push(`Draft period end (${e.metadata.periodEndDate}) differs from current (${i})`);const r=this.getDraftAge();r&&r>6048e5&&o.push(`Draft is ${Math.floor(r/864e5)} days old`);return{compatible:0===o.length,warnings:o}}}const M=.01;class j extends Error{constructor(e,t,i="unsupported-syntax"){super(e),this.test=t,this.reason=i,this.name="FormulaExpressionError"}}const P=/\s*(?:(\$[A-Za-z_][\w-]*)|(-?\d+(?:\.\d+)?)|([A-Za-z][\w:-]*)|('[^']*')|(\()|(\))|(\+)|(-)|(=))/y;class A{constructor(e,t){this.tokens=e,this.test=t,this.pos=0}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e){const t=this.next();if(t.type!==e)throw new j(`Expected ${e} but got ${t.type} ("${t.value}")`,this.test,"parse-error");return t}parseBoolExpr(){const e=this.parseOrExpr();if("EOF"!==this.peek().type)throw new j(`Unexpected trailing token "${this.peek().value}"`,this.test,"unsupported-syntax");return e}parseOrExpr(){const e=[this.parseAndExpr()];for(;"IDENT"===this.peek().type&&"or"===this.peek().value;)this.next(),e.push(this.parseAndExpr());return 1===e.length?e[0]:{kind:"or",terms:e}}parseAndExpr(){const e=[this.parseBoolTerm()];for(;"IDENT"===this.peek().type&&"and"===this.peek().value;)this.next(),e.push(this.parseBoolTerm());return 1===e.length?e[0]:{kind:"and",terms:e}}parseBoolTerm(){const e=this.peek();if("LPAREN"===e.type){const e=this.pos;try{this.next();const e=this.parseOrExpr();return this.expect("RPAREN"),e}catch(o){if(!(o instanceof j))throw o;this.pos=e}}if("IDENT"===e.type&&"not"===e.value){this.next(),this.expect("LPAREN");const e=this.parseOrExpr();return this.expect("RPAREN"),{kind:"not",arg:e}}if("IDENT"===e.type&&"empty"===e.value){this.next(),this.expect("LPAREN");const e=this.expect("VARIABLE").value;return this.expect("RPAREN"),{kind:"empty",variable:e}}if("IDENT"===e.type&&"xff:has-fallback-value"===e.value){this.next(),this.expect("LPAREN");const e=this.next();if("IDENT"!==e.type||"xs:QName"!==e.value)throw new j(`Expected xs:QName(...) inside xff:has-fallback-value(...), got "${e.value}"`,this.test,"unsupported-syntax");this.expect("LPAREN");const t=this.expect("STRING").value;return this.expect("RPAREN"),this.expect("RPAREN"),{kind:"hasFallbackValue",variableName:t}}const t=this.parseValueExpr(),i=this.peek();if("EQUALS"===i.type)return this.next(),{kind:"comparison",op:"=",left:t,right:this.parseValueExpr()};if("IDENT"===i.type&&"eq"===i.value)return this.next(),{kind:"comparison",op:"eq",left:t,right:this.parseValueExpr()};throw new j(`Expected a comparison operator ("=" or "eq") after value expression, got "${i.value}"`,this.test,"unsupported-syntax")}parseValueExpr(){const e=[];let t=1;for("PLUS"===this.peek().type?this.next():"MINUS"===this.peek().type&&(this.next(),t=-1),e.push({sign:t,term:this.parseValueTerm()});"PLUS"===this.peek().type||"MINUS"===this.peek().type;){const t="PLUS"===this.next().type?1:-1;e.push({sign:t,term:this.parseValueTerm()})}return 1===e.length&&1===e[0].sign?e[0].term:{kind:"additive",terms:e}}parseValueTerm(){const e=this.peek();if("NUMBER"===e.type)return this.next(),{kind:"number",value:Number(e.value)};if("STRING"===e.type)return this.next(),{kind:"string",value:e.value};if("VARIABLE"===e.type)return this.next(),{kind:"variable",name:e.value};if("IDENT"===e.type&&"sum"===e.value){this.next(),this.expect("LPAREN");const e=this.expect("VARIABLE").value;return this.expect("RPAREN"),{kind:"sum",variable:e}}if("LPAREN"===e.type){this.next();const e=this.parseValueExpr();return this.expect("RPAREN"),e}throw new j(`Expected a number, variable, sum(...), or parenthesized expression, got "${e.value}"`,this.test,"unsupported-syntax")}}function L(e,t){return e.get(t)}function N(e,t,i){switch(e.kind){case"number":case"string":return e.value;case"sum":return function(e,t,i){const o=L(t,e);return void 0===o?0:(Array.isArray(o)?o:[o]).reduce((t,o)=>{if("string"==typeof o)throw new j(`Variable "$${e}" resolved to a non-numeric value ("${o}") and cannot be used in sum(...)`,i,"unsupported-syntax");return t+o},0)}(e.variable,t,i);case"variable":{const o=L(t,e.name);if(void 0===o)throw new j(`Variable "$${e.name}" has no bound fact and cannot be evaluated directly (only sum()/empty() tolerate an unbound variable)`,i,"unbound-variable");if(Array.isArray(o))throw new j(`Variable "$${e.name}" is a sequence and must be wrapped in sum(...) to be used in arithmetic`,i,"unsupported-syntax");return o}case"additive":return e.terms.reduce((e,{sign:o,term:r})=>{const n=N(r,t,i);if("string"==typeof n)throw new j(`Non-numeric value ("${n}") cannot be used in arithmetic (+ / -)`,i,"unsupported-syntax");return e+o*n},0)}}function V(e,t,i,o){switch(e.kind){case"or":return e.terms.some(e=>V(e,t,i,o));case"and":return e.terms.every(e=>V(e,t,i,o));case"not":return!V(e.arg,t,i,o);case"empty":{const i=L(t,e.variable);return void 0===i||Array.isArray(i)&&0===i.length}case"hasFallbackValue":{const t=o.get(e.variableName);if(void 0===t)throw new j(`xff:has-fallback-value(xs:QName('${e.variableName}')) could not be evaluated — no fallback-usage tracked for this variable (either not one of this assertion's FACT_VARIABLEs, or it matched zero facts with no fallbackValue declared)`,i,"unbound-variable");return t}case"comparison":{const o=N(e.left,t,i),r=N(e.right,t,i);return"string"==typeof o||"string"==typeof r?String(o)===String(r):Math.abs(o-r)<M}}}function O(e,t,i=new Map){const o=function(e){const t=[];P.lastIndex=0;let i=0;for(;i<e.length;){P.lastIndex=i;const o=P.exec(e);if(!o||o.index!==i){if(/^\s*$/.test(e.slice(i)))break;throw new j(`Unrecognized token at position ${i}: "${e.slice(i,i+10)}..."`,e,"unsupported-syntax")}const[r,n,a,s,l,d,c,p,u,h]=o;n?t.push({type:"VARIABLE",value:n.slice(1)}):a?t.push({type:"NUMBER",value:a}):s?t.push({type:"IDENT",value:s}):l?t.push({type:"STRING",value:l.slice(1,-1)}):d?t.push({type:"LPAREN",value:d}):c?t.push({type:"RPAREN",value:c}):p?t.push({type:"PLUS",value:p}):u?t.push({type:"MINUS",value:u}):h&&t.push({type:"EQUALS",value:h}),i+=r.length}return t.push({type:"EOF",value:""}),t}(e);return V(new A(o,e).parseBoolExpr(),t,e,i)}const z=/^\.\s*(eq|ne|gt|lt|ge|le)\s+(-?\d+(?:\.\d+)?)$/;function J(e){return!!(null==e?void 0:e.toLowerCase().includes("totallabel"))}function B(e){return!!(null==e?void 0:e.toLowerCase().includes("negatedtotallabel"))}function U(e,t,i=0){if(!t.isAbstract(e))return e;if(i>5)return null;const o=t.getChildren(e).find(e=>J(t.getPreferredLabel(e)));return o?U(o,t,i+1):null}function q(e,t,i,o,r){if(i<0)return o;const n=e[t];if(B(r.getPreferredLabel(n)))return o.length>0?o:[e[i]];if(o.length>0)return[e[i],...o];if(B(r.getPreferredLabel(e[i]))){let t=-1;for(let o=i-1;o>=0;o--)if(J(r.getPreferredLabel(e[o]))){t=o;break}return t>=0?[e[t],e[i]]:[e[i]]}return[e[i]]}function H(e){return null!=e&&""!==e}function W(e){const t=[];for(const i of Object.keys(e)){const o=e[i]||{};for(const e of Object.keys(o))H(o[e])&&t.push({conceptId:i,columnId:e})}return t}function K(e,t,i,o,r,n){const a={conceptId:e.id,qname:e.name,balance:e.balance,effectivePeriodRole:e.effectivePeriodRole};i.set(e.id,a),(t.get(e.name)??t.set(e.name,[]).get(e.name)).push(a);const s=e.children||[],l=s.length>0,d=!0===r.get(e.name);(!o.has(e.name)||l&&!d)&&(o.set(e.name,e.id),r.set(e.name,l)),n.set(e.id,s.map(e=>e.id)),s.forEach(e=>K(e,t,i,o,r,n))}function Y(e){const t=[e.id];return(e.children||[]).forEach(e=>t.push(...Y(e))),t}function Q(e,t,i,o,r){t.has(e.conceptName)||t.set(e.conceptName,e.id),i.has(e.conceptName)||i.set(e.conceptName,(e.children||[]).map(e=>e.id)),o.has(e.conceptName)||o.set(e.conceptName,Y(e)),(e.children||[]).forEach(e=>{r.add(e.id),Q(e,t,i,o,r)})}const G={getId:e=>e.id,getPreferredLabel:e=>e.preferredLabel,isAbstract:e=>!0===e.abstract,getChildren:e=>e.children||[]};function X(e,t,i,o,r,n,a){const s=new Map,l=new Map,d=new Map,c=new Map,p=new Map,u=new Map,h=new Map;i.forEach(e=>{const t=new Map,i=new Map,o=new Map;e.concepts.forEach(e=>K(e,s,l,i,o,t)),c.set(e.roleURI,t),d.set(e.roleURI,i),p.set(e.roleURI,function(e,t){const i=new Map;function o(e,o){const r=[];for(const i of o){const e=U(i,t);e&&r.push(t.getId(e))}0!==r.length&&i.set(t.getId(e),r)}return function e(i){for(let r=0;r<i.length;r++){const n=i[r];if(J(t.getPreferredLabel(n))&&0===t.getChildren(n).length){let e=-1;for(let o=r-1;o>=0;o--)if(J(t.getPreferredLabel(i[o]))){e=o;break}const a=i.slice(e+1,r),s=q(i,r,e,a,t);s.length>0&&o(n,s)}const a=t.getChildren(n);a.length>0&&e(a)}}(e),i}(e.concepts,G));for(const r of t.keys())h.set(r,e.roleURI);e.columns&&u.set(e.roleURI,e.columns)});const m=new Map;d.forEach((e,t)=>{const i=c.get(t),o=p.get(t);e.forEach((e,r)=>{var n;const a=(null==i?void 0:i.get(e))||[],s=a.length>0?a:(null==o?void 0:o.get(e))||[];0!==s.length&&(m.has(r)||m.set(r,new Map),null==(n=m.get(r))||n.set(t,s))})});const f=new Map,b=new Map,g=new Map,v=new Map,y=new Set;return(o||[]).forEach(e=>{e.items.forEach(e=>{e.dimensions.forEach(e=>{f.has(e.conceptName)||f.set(e.conceptName,e.id),(e.members||[]).forEach(e=>Q(e,b,g,v,y))})})}),{formData:e,columns:t,periodStartDate:r,periodEndDate:n,conceptByQName:s,conceptById:l,conceptIdByQNamePerRole:d,childrenByRole:c,totalGroupChildrenByRole:p,crossRoleChildrenByQName:m,dimensionQNameToId:f,memberQNameToId:b,memberChildrenByQName:g,memberDescendantOrSelfIdsByQName:v,memberIdsWithParent:y,columnsByRole:u,roleURIByConceptId:h,allCandidates:W(e),typedMemberData:a??{}}}function Z(e,t){const i=[],o=[...e.get(t)||[]],r=new Set;for(;o.length>0;){const t=o.pop();r.has(t)||(r.add(t),i.push(t),o.push(...e.get(t)||[]))}return i}function ee(e){return`${e.conceptId}::${e.columnId}`}function te(e,t,i){return se(e.filters.map(o=>ae(o,t.allCandidates,t,e.filters,i)))}function ie(e,t){var i;const o=e.roleURIByConceptId.get(t.conceptId);return(o?null==(i=e.columnsByRole.get(o))?void 0:i.find(e=>e.id===t.columnId):void 0)??e.columns.find(e=>e.id===t.columnId)}function oe(e,t,i){if(!(null==e?void 0:e.dimensionData))return!1;return!(e.dimensionData.axisId!==t||void 0!==i&&e.dimensionData.memberId!==i)||(e.dimensionData.combinations||[]).some(e=>e.axisId===t&&(void 0===i||e.memberId===i))}function re(e,t){return{start:(null==e?void 0:e.periodStartDate)??t.periodStartDate,end:(null==e?void 0:e.periodEndDate)??t.periodEndDate}}function ne(e,t,i,o,r){var n,a;switch(e.type){case"CONCEPT_NAME":{const o=e.attributes["concept.qname"],n=o?i.conceptByQName.get(o):void 0;if(!n||0===n.length)return[];const a=r?n.filter(e=>i.roleURIByConceptId.get(e.conceptId)===r):[],s=a.length>0?a:n,l=new Set(s.map(e=>e.conceptId));return t.filter(e=>l.has(e.conceptId))}case"CONCEPT_BALANCE":{const o=e.attributes.balance;return t.filter(e=>{var t;return(null==(t=i.conceptById.get(e.conceptId))?void 0:t.balance)===o})}case"CONCEPT_RELATION":{const o=e.attributes.qname,r=e.attributes.linkrole,s=e.attributes.axis,l=o&&r?null==(n=i.conceptIdByQNamePerRole.get(r))?void 0:n.get(o):void 0,d=r?i.childrenByRole.get(r):void 0;if(!l||!d)return[];let c;if("descendant"===s)c=Z(d,l);else{const e=d.get(l)||[];c=e.length>0?e:(null==(a=i.totalGroupChildrenByRole.get(r??""))?void 0:a.get(l))||[],0===c.length&&(c=function(e,t,i){if(!e)return[];const o=i.crossRoleChildrenByQName.get(e);if(!o)return[];const r=Array.from(o.entries()).filter(([e])=>e!==t);return 1===r.length?r[0][1]:[]}(o,r,i))}const p=new Set(c);return t.filter(e=>p.has(e.conceptId))}case"EXPLICIT_DIMENSION":{const r=e.attributes["dimension.qname"],n=e.attributes["member.qname"],a=r?i.dimensionQNameToId.get(r):void 0;if(!a)return[];const s=e.attributes["member.axis"];if(n&&"child"===s)return function(e,t,i,o,r){var n,a;const s=o.memberChildrenByQName.get(e)||[];if(s.length>0){const e=i.filter(e=>s.some(i=>oe(ie(o,e),t,i)));if(e.length>0)return e}const l=r.find(e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis),d=null==l?void 0:l.attributes.linkrole,c=null==l?void 0:l.attributes.qname,p=c&&d?null==(n=o.conceptIdByQNamePerRole.get(d))?void 0:n.get(c):void 0,u=new Set(p&&d&&(null==(a=o.childrenByRole.get(d))?void 0:a.get(p))||[]);return 0===u.size?[]:i.filter(e=>!u.has(e.conceptId))}(n,a,t,i,o);if(n&&"descendant-or-self"===s)return function(e,t,i,o){const r=o.memberDescendantOrSelfIdsByQName.get(e)||[];return 0===r.length?[]:i.filter(e=>r.some(i=>oe(ie(o,e),t,i)))}(n,a,t,i);const l=n?i.memberQNameToId.get(n):void 0;return t.filter(e=>oe(ie(i,e),a,l))}case"TYPED_DIMENSION":{const o=e.attributes["dimension.qname"],r=o?i.dimensionQNameToId.get(o):void 0;return r?t.filter(e=>function(e,t,i){if(!function(e,t){return!!(null==e?void 0:e.dimensionData)&&(void 0!==e.dimensionData.typedMemberId&&e.dimensionData.axisId===t||(e.dimensionData.typedMembers||[]).some(e=>e.axisId===t))}(ie(e,t),i))return!1;const o=e.typedMemberData[t.columnId];return void 0===o||!!o[i]}(i,e,r)):[]}case"PERIOD_INSTANT":case"PERIOD_END":{const o=e.attributes.date;return t.filter(e=>function(e,t,i){const o=function(e){if(e)return e.startsWith("$")?e.slice(1):e}(t);if(!o)return!1;const r=function(e,t){const i=e.includes("StartDate"),o=e.includes("EndDate")||"FinancialReportingPeriodCurrentEndDateParam"===e;if(e.startsWith("FinancialReportingPeriodCurrent"))return i?{start:t.periodStartDate}:o?{end:t.periodEndDate}:void 0;if(e.startsWith("FinancialReportingPeriodPrePrevious")||e.startsWith("FinancialReportingPeriodPrevious")){const e=function(e){return e.columns.find(t=>void 0!==t.periodEndDate&&t.periodEndDate<e.periodEndDate)}(t);if(!e)return;return i?{start:e.periodStartDate}:o?{end:e.periodEndDate}:void 0}}(o,i);if(!r)return!1;const n=re(e,i),a=r.end??r.start;return n.end===a}(ie(i,e),o,i))}case"OR_FILTER":return function(e){const t=new Map;return e.forEach(e=>e.forEach(e=>t.set(ee(e),e))),Array.from(t.values())}(e.children.map(e=>ae(e,t,i,o,r)));case"ASPECT_COVER":return t;case"UNKNOWN":{const o=e.attributes.boundary;if("start"===o||"end"===o){const e="start"===o?"periodStartLabel":"periodEndLabel";return t.filter(t=>{var o;return(null==(o=i.conceptById.get(t.conceptId))?void 0:o.effectivePeriodRole)===e})}return t}default:return[]}}function ae(e,t,i,o,r){const n=ne(e,t,i,o,r);if(!e.complement)return n;const a=new Set(n.map(ee));return t.filter(e=>!a.has(ee(e)))}function se(e){return 0===e.length?[]:e.reduce((e,t)=>{const i=new Set(t.map(ee));return e.filter(e=>i.has(ee(e)))})}function le(e){if(null==e||""===e)return;const t=parseFloat(String(e));return Number.isNaN(t)?String(e):t}function de(e){return e.some(e=>"PERIOD_INSTANT"===e.type||"PERIOD_END"===e.type||"OR_FILTER"===e.type&&de(e.children))}function ce(e,t,i){return 0===e.length||de(t.filters)?e:e.filter(e=>re(ie(i,e),i).end===i.periodEndDate)}function pe(e,t,i){return function(e,t){const i=new Map;e.forEach(e=>{var o;const r=(null==(o=t.conceptById.get(e.conceptId))?void 0:o.qname)??e.conceptId,n=`${e.columnId}::${r}`,a=i.get(n);a?a.push(e):i.set(n,[e])});const o=[];return i.forEach(e=>{if(e.length<=1)return void o.push(...e);const i=e.map(e=>{var i;return null==(i=t.conceptById.get(e.conceptId))?void 0:i.effectivePeriodRole}),r=e.filter((e,t)=>"periodEndLabel"===i[t]),n=new Set(i).size>1;o.push(...n&&r.length>0?r:e)}),o}(function(e,t,i){var o,r;if(t.bindAsSequence)return e;if(new Set(e.map(e=>e.conceptId)).size<=1)return e;const n=t.filters.find(e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis),a=null==n?void 0:n.attributes.qname,s=null==n?void 0:n.attributes.linkrole,l=a&&s?null==(o=i.conceptIdByQNamePerRole.get(s))?void 0:o.get(a):void 0,d=new Set(l&&s&&(null==(r=i.childrenByRole.get(s))?void 0:r.get(l))||[]);return 0===d.size?e:e.filter(e=>d.has(e.conceptId))}(ce(te(e,t,i),e,t),e,t),t)}function ue(e,t){const i=new Set;for(const o of e.filters){if("EXPLICIT_DIMENSION"!==o.type||o.complement||o.cover)continue;if(o.attributes["member.qname"])continue;const e=t.dimensionQNameToId.get(o.attributes["dimension.qname"]??"");e&&i.add(e)}return i}function he(e,t,i){var o;const r=ie(e,t);if(null==r?void 0:r.dimensionData)return r.dimensionData.axisId===i?r.dimensionData.memberId:null==(o=(r.dimensionData.combinations||[]).find(e=>e.axisId===i))?void 0:o.memberId}function me(e,t,i,o){const r=new Map;if(e.forEach(e=>r.set(e.name,pe(e,t,o))),i){const i=new Set;e.forEach(e=>ue(e,t).forEach(e=>i.add(e))),i.forEach(i=>{const o=function(e,t,i,o){for(const r of e){if(r.bindAsSequence)continue;if(!ue(r,o).has(t))continue;const e=i.get(r.name)||[],n=new Set(e.map(e=>he(o,e,t)).filter(e=>void 0!==e));if(1===n.size)return{memberId:[...n][0],variableName:r.name,ambiguous:!1};const a=[...n].filter(e=>!o.memberIdsWithParent.has(e));if(1===a.length)return{memberId:a[0],variableName:r.name,ambiguous:!0}}}(e,i,r,t);o&&e.forEach(e=>{const n=e.bindAsSequence&&ue(e,t).has(i),a=o.ambiguous&&e.name===o.variableName;if(!n&&!a)return;const s=r.get(e.name)||[];r.set(e.name,s.filter(e=>he(t,e,i)===o.memberId))})})}return r}function fe(e,t,i,o){const r=me(e,t,i,o),n=new Map;return e.forEach(e=>n.set(e.name,function(e,t,i){const o=t.map(e=>{var t;return le(null==(t=i.formData[e.conceptId])?void 0:t[e.columnId])}).filter(e=>void 0!==e);if(0===o.length&&"()"===e.fallbackValue)return[];if(e.bindAsSequence){if(0===o.length)return;return o}return 0!==o.length?(o.length>1&&console.warn(`[formula-variable-resolver] Variable "${e.name}" is scalar (bindAsSequence: false) but matched ${o.length} facts; using the first match by column order. This can legitimately happen when filters under-constrain the candidate set.`),o[0]):void 0}(e,r.get(e.name)||[],t))),n}function be(e){const t=Object.entries(e.attributes).filter(([e])=>"id"!==e).sort(([e],[t])=>e.localeCompare(t));return JSON.stringify({type:e.type,complement:e.complement,cover:e.cover,attrs:t})}function ge(e,t){return te(e,t).length}function ve(e,t){return!(ge(e,t)>0)&&(void 0!==e.fallbackValue||void 0)}function ye(e){const t=[];for(const i of e)if("CONCEPT_NAME"===i.type){const e=i.attributes["concept.qname"];e&&t.push(e)}else"OR_FILTER"===i.type&&t.push(...ye(i.children));return t}function xe(e){return ye(e.filters)}function _e(e,t,i){const o=i.columns.map(e=>({conceptId:t,columnId:e.id}));return se(e.filters.map(t=>ae(t,o,i,e.filters))).map(e=>e.columnId)}class De{evaluate(e,t,i){var o;const r=null==(o=e.formula)?void 0:o[0];if(!r)return[];const n=[];for(const a of r.roles)for(const e of a.assertions)n.push(this._evaluateAssertion(e,a,t,i));return n}summarize(e){const t={totalAssertions:e.length,evaluated:0,skipped:0,passed:0,failed:0,failedWarnings:0,failedErrors:0};for(const i of e)i.skipped?t.skipped+=1:(t.evaluated+=1,i.satisfied?t.passed+=1:(t.failed+=1,"ERROR"===i.severity?t.failedErrors+=1:t.failedWarnings+=1));return t}_evaluateAssertion(e,t,i,o){try{const r=function(e,t,i){return fe(e.variables,t,e.implicitFiltering,i)}(e,i,t.roleURI),n=function(e){if("VALUE_ASSERTION"!==e.type||2!==e.variables.length)return;const t=e.variables.find(e=>!e.bindAsSequence),i=e.variables.find(e=>e.bindAsSequence);if(!t||!i)return;const o=e=>"CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis&&!e.complement&&!e.cover,r=t.filters.find(o),n=i.filters.find(o);if(!r||!n)return;const a=r.attributes.qname,s=r.attributes.linkrole;if(!a||!s)return;if(n.attributes.qname!==a||n.attributes.linkrole!==s)return;const l=t.filters.find(e=>"EXPLICIT_DIMENSION"===e.type&&!e.complement&&e.cover&&!("member.axis"in e.attributes)),d=i.filters.find(e=>"EXPLICIT_DIMENSION"===e.type&&!e.complement&&e.cover&&"child"===e.attributes["member.axis"]);if(!l||!d)return;const c=l.attributes["dimension.qname"],p=l.attributes["member.qname"];if(!c||!p)return;if(d.attributes["dimension.qname"]!==c||d.attributes["member.qname"]!==p)return;const u=t.filters.filter(e=>e!==r&&e!==l).map(be).sort(),h=i.filters.filter(e=>e!==n&&e!==d).map(be).sort();return u.length!==h.length||u.some((e,t)=>e!==h[t])?void 0:{scalarVariable:t,sequenceVariable:i,anchorQName:a,linkrole:s,dimensionQName:c,memberQName:p}}(e),a=n?function(e,t){var i;const{scalarVariable:o,sequenceVariable:r,anchorQName:n,linkrole:a,dimensionQName:s,memberQName:l}=e,d=null==(i=t.conceptIdByQNamePerRole.get(a))?void 0:i.get(n),c=t.childrenByRole.get(a);if(!d||!c)return"not-applicable";const p=Z(c,d);if(0===p.length)return"not-applicable";const u=t.dimensionQNameToId.get(s),h=t.memberQNameToId.get(l),m=t.memberChildrenByQName.get(l)||[];if(!u||!h||0===m.length)return"not-applicable";const f=o.filters.filter(e=>!("CONCEPT_RELATION"===e.type&&"descendant"===e.attributes.axis||"EXPLICIT_DIMENSION"===e.type&&e.attributes["dimension.qname"]===s)),b=f.length>0?se(f.map(e=>ae(e,t.allCandidates,t,f))):t.allCandidates,g=new Set(p),v=new Map;if(b.forEach(e=>{if(!g.has(e.conceptId))return;const t=v.get(e.conceptId);t?t.push(e):v.set(e.conceptId,[e])}),!Array.from(v.values()).some(e=>e.some(e=>m.some(i=>oe(ie(t,e),u,i)))))return"not-applicable";let y=!1;for(const x of p){const e=v.get(x);if(!e||0===e.length)continue;const i=ce(e.filter(e=>oe(ie(t,e),u,h)),o,t),n=ce(e.filter(e=>m.some(i=>oe(ie(t,e),u,i))),r,t),a=i.map(e=>{var i;return le(null==(i=t.formData[e.conceptId])?void 0:i[e.columnId])}).filter(e=>"number"==typeof e),s=n.map(e=>{var i;return le(null==(i=t.formData[e.conceptId])?void 0:i[e.columnId])}).filter(e=>"number"==typeof e);if(0===a.length||0===s.length)continue;a.length>1&&console.warn(`[formula-variable-resolver] SumOfMembersOnAbstract concept "${x}" matched ${a.length} aggregate-member facts; using the first by column order.`);const l=a[0],d=s.reduce((e,t)=>e+t,0);if(y=!0,Math.abs(l-d)>=M)return!1}return!!y||"unresolvable"}(n,i):void 0,s=void 0!==a&&"not-applicable"!==a;if("VALUE_ASSERTION"===e.type&&!s){const i=function(e,t){for(const i of e.variables)if(void 0===t.get(i.name))return{satisfied:!1,skipReason:"unresolvable"};return{satisfied:!0}}(e,r);if(!i.satisfied)return this._skippedResult(e,t,i.skipReason??"unresolvable")}const l=function(e,t){var i;if(!(null==(i=e.test)?void 0:i.includes("has-fallback-value"))&&!e.preconditions.some(e=>e.test.includes("has-fallback-value")))return new Map;const o=new Map;for(const r of e.variables){const e=ve(r,t);void 0!==e&&o.set(r.name,e)}return o}(e,i),d=function(e,t,i=new Map){if(0===e.length)return{satisfied:!0};for(const r of e){let e;try{e=O(r.test,t,i)}catch(o){if(o instanceof j)return{satisfied:!1,skipReason:"unresolvable"};throw o}if(!e)return{satisfied:!1,skipReason:"precondition"}}return{satisfied:!0}}(e.preconditions,r,l);if(!d.satisfied)return this._skippedResult(e,t,d.skipReason??"unresolvable");if("EXISTENCE_ASSERTION"===e.type){const r=1===e.variables.length?ge(e.variables[0],i):function(e,t){const i=new Map;for(const o of e)for(const e of te(o,t))i.set(ee(e),e);return i.size}(e.variables,i),n=function(e,t){const i=(e??"").trim();return""===i?t>0:i.split(/\bor\b/).some(e=>{const o=z.exec(e.trim());if(!o)throw new j(`Unsupported existence-assertion test shape: "${e.trim()}"`,i,"unsupported-syntax");const[,r,n]=o;return function(e,t,i){switch(e){case"eq":return t===i;case"ne":return t!==i;case"gt":return t>i;case"lt":return t<i;case"ge":return t>=i;case"le":return t<=i}}(r,t,Number(n))})}(e.test,r);return this._evaluatedResult(e,t,i,n,o,r)}if(s)return"unresolvable"===a?this._skippedResult(e,t,"unresolvable"):this._evaluatedResult(e,t,i,a,o);const c=O(e.test,r,l),p=c?void 0:function(e,t,i,o){const r=e.filter(e=>e.bindAsSequence);if(0===r.length)return;const n=me(e,t,i,o),a=[];for(const s of r){const e=(n.get(s.name)||[]).map(e=>{var i,o;return{conceptId:e.conceptId,conceptQName:null==(i=t.conceptById.get(e.conceptId))?void 0:i.qname,columnId:e.columnId,value:le(null==(o=t.formData[e.conceptId])?void 0:o[e.columnId])}}).filter(e=>void 0!==e.value&&void 0!==e.conceptQName);e.length>0&&a.push({variableName:s.name,candidates:e})}return a.length>0?a:void 0}(e.variables,i,e.implicitFiltering,t.roleURI);return this._evaluatedResult(e,t,i,c,o,void 0,p)}catch(r){if(r instanceof j)return console.warn(`[FormulaValidationService] Assertion "${e.id}" could not be evaluated (${r.reason}): ${r.message}`),this._skippedResult(e,t,"unresolvable");throw r}}_skippedResult(e,t,i){return{assertionId:e.id,roleURI:t.roleURI,roleLabel:t.role,type:e.type,severity:e.severity,satisfied:!1,skipped:!0,skipReason:i}}_evaluatedResult(e,t,i,o,r,n,a){const s=o?void 0:this._pickMessage(e,r);return{assertionId:e.id,roleURI:t.roleURI,roleLabel:t.role,type:e.type,severity:e.severity,satisfied:o,skipped:!1,message:s,matchedFactCount:n,conceptLinks:s?this._buildConceptLinks(e,t.roleURI,i,s):void 0,variableBreakdown:a}}_pickMessage(e,t){const i=e.messages;if(0===i.length)return;const o=i.find(e=>e.xmlLang===t)??i.find(e=>"en"===e.xmlLang)??i[0];return this._stripTechnicalDetail(o.text)}_stripTechnicalDetail(e){const t=e.indexOf("{");return-1===t?e.trim():e.slice(0,t).replace(/\|\s*$/,"").trim()}_buildConceptLinks(e,t,i,o){var r,n,a;const s=[],l=new Set;for(const d of e.variables)for(const e of xe(d)){const c=(null==(r=i.conceptIdByQNamePerRole.get(t))?void 0:r.get(e))??(null==(a=null==(n=i.conceptByQName.get(e))?void 0:n[0])?void 0:a.conceptId);if(!c)continue;const p=e.includes(":")?e.split(":").pop():e;if(l.has(p))continue;if(!new RegExp("`"+this._escapeRegExp(p)+"`").test(o))continue;const u=_e(d,c,i);s.push({label:p,conceptQName:e,conceptId:c,columnId:u[0]}),l.add(p)}return s}_escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class we{static findMatchingFact(e,t){if(!e||0===e.length)return null;const i=e.filter(e=>this.matchesPeriod(e,t));if(0===i.length)return null;const o=i.filter(e=>this.matchesDimensions(e,t));if(0===o.length)return null;if(o.length>1&&t.unit){const e=o.find(e=>this.matchesUnit(e,t));if(e)return e}return o[0]}static matchesPeriod(e,t){const i=this.parsePeriod(e.period);return"instant"===t.periodType&&t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:"duration"===t.periodType&&t.periodStartDate&&t.periodEndDate?!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate:t.periodInstantDate?i.isInstant&&i.instantDate===t.periodInstantDate:!t.periodStartDate||!t.periodEndDate||!i.isInstant&&i.startDate===t.periodStartDate&&i.endDate===t.periodEndDate}static matchesDimensions(e,t){const i=e.dimensions||[],o=this.extractDimensionsFromContext(t);if(0===o.length)return 0===i.length;if(0===i.length&&o.length>0)return!1;if(i.length!==o.length)return!1;return o.every(e=>i.some(t=>{if(!(this.normalizeAxisId(t.dimension)===this.normalizeAxisId(e.axisId)))return!1;if("explicit"===t.dimensionType&&e.memberId){return this.normalizeMemberId(t.member||"")===this.normalizeMemberId(e.memberId)}return!("typed"!==t.dimensionType||!e.isTyped)}))}static matchesUnit(e,t){if(!t.unit||!e.unitMeasure)return!0;return this.normalizeUnit(e.unitMeasure)===this.normalizeUnit(t.unit)}static parsePeriod(e){if(e.includes(" / ")){const[t,i]=e.split(" / ").map(e=>e.trim());return{isInstant:!1,startDate:t,endDate:i}}return{isInstant:!0,instantDate:e.trim()}}static extractDimensionsFromContext(e){if(!e.dimensionData)return[];const t=[];return e.dimensionData.combinations&&e.dimensionData.combinations.length>0&&e.dimensionData.combinations.forEach(e=>{t.push({axisId:e.axisId,memberId:e.memberId})}),e.dimensionData.typedMembers&&e.dimensionData.typedMembers.length>0&&e.dimensionData.typedMembers.forEach(e=>{t.push({axisId:e.axisId,memberId:"[typed]",isTyped:!0})}),t}static normalizeAxisId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){e.split("_");const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeMemberId(e){if(!e)return"";if(e.includes(":")){const t=e.split(":");return t[1]||t[0]}if(e.includes("_")){const t=e.lastIndexOf("_");if(t>0)return e.substring(t+1)}return e}static normalizeUnit(e){if(!e)return"";const t=e.split(":");return t.length>1?t[1]:t[0]}static extractTypedValues(e,t){const i={};if(!e||0===e.length)return i;return e.filter(e=>this.matchesPeriod(e,t)&&this.matchesDimensions(e,t)).forEach(e=>{e.dimensions&&e.dimensions.forEach(e=>{if("typed"===e.dimensionType&&e.typedMemberValue){const t=this.normalizeAxisId(e.dimension);i[t]=e.typedMemberValue}})}),i}static debugMatch(e,t){t.conceptId,t.columnId,"instant"===t.periodType?t.periodInstantDate:(t.periodStartDate,t.periodEndDate),this.extractDimensionsFromContext(t),e.map(e=>{var t;return{value:e.value,period:e.period,dimensions:null==(t=e.dimensions)?void 0:t.map(e=>`${e.dimension}:${e.member}`)}});const i=this.findMatchingFact(e,t);i&&i.value}}const Ie=1,Se=2,Ce=3,$e=4,ke=5,Te=e=>"string"==typeof e?e.trim().toLowerCase():"",Fe=e=>e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);function Ee(e){const t=e.replace(/[/#:]+$/,""),i=Math.max(t.lastIndexOf(":"),t.lastIndexOf("/"),t.lastIndexOf("#"));return i>=0?t.slice(i+1):t}function Re(e,t){var i,o;const r=[t.id,null==(i=t.metadata)?void 0:i.roleURI].map(Te).filter(Boolean),n=[t.title,t.description,null==(o=t.metadata)?void 0:o.originalRole].map(Te).filter(Boolean),a=r.map(Ee),s=/\s/.test(e)?null:Ee(e);if(r.includes(e))return{tier:Ie,looseness:0};if(s&&a.includes(s))return{tier:Se,looseness:0};if(n.includes(e))return{tier:Ce,looseness:0};const l=s??e,d=[...a,...n];let c=null;for(const u of d)if(u.includes(l)||l.includes(u)){const e=Math.abs(u.length-l.length);(null===c||e<c)&&(c=e)}if(null!==c)return{tier:$e,looseness:c};const p=new Set(Fe(l));if(!p.size)return null;for(const u of d){const e=new Set(Fe(u));if([...p].every(t=>e.has(t))){const t=e.size-p.size;(null===c||t<c)&&(c=t)}}return null!==c?{tier:ke,looseness:c}:null}function Me(e){var t,i;if(!e)return[];const o=[];if(null==(t=e.combinations)?void 0:t.length)for(const r of e.combinations)o.push({key:r.axisId||r.memberLabel,label:r.memberLabel});else{const t=e.selectedDimensions;for(const e of t??[])!e.isTyped&&e.memberLabel&&o.push({key:e.axisId,label:e.memberLabel})}if(null==(i=e.typedMembers)?void 0:i.length)for(const r of e.typedMembers)o.push({key:r.axisId,label:r.axisLabel});return 0===o.length&&e.memberLabel&&(e.axisId||e.axisLabel)&&o.push({key:e.axisId||e.axisLabel,label:e.memberLabel}),o}const je={"nl-types:formattedExplanationItemType":{fieldType:"textarea",placeholder:F.t("field.enterDetailedExplanation")},"nl-types:monetaryNoDecimals20ItemType":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:F.t("field.enterAmountNoDecimals")},"xbrli:monetaryItemType":{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterCurrency")},"xbrli:stringItemType":{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterText")},"xbrli:dateItemType":{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"},"xbrli:dateTimeItemType":{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"},"xbrli:integerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,step:1,placeholder:F.t("field.enterWholeNumber")},"xbrli:nonNegativeIntegerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:0,step:1,placeholder:F.t("field.enterPositiveNumber")},"xbrli:positiveIntegerItemType":{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:1,step:1,placeholder:F.t("field.enterPositiveNumber")},"xbrli:decimalItemType":{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:F.t("field.enterDecimalValue")},"xbrli:sharesItemType":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,min:0,step:.01,placeholder:F.t("field.enterNumberOfShares")},"xbrli:shares":{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,min:0,step:.01,placeholder:F.t("field.enterNumberOfShares")},"xbrli:gYearItemType":{fieldType:"number",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:1900,max:2100,step:1,placeholder:F.t("field.yearFormat")},"xbrli:booleanItemType":{fieldType:"boolean"},"xbrli:pureItemType":{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterPercentage")},"xbrli:percentItemType":{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterPercentage")},"xbrli:emailItemType":{fieldType:"email",htmlInputType:"email",placeholder:F.t("field.emailPlaceholder")},"xbrli:urlItemType":{fieldType:"url",htmlInputType:"url",placeholder:F.t("field.urlPlaceholder")},"xbrli:telephoneItemType":{fieldType:"tel",htmlInputType:"tel",placeholder:F.t("field.phonePlaceholder")}};function Pe(e,t){if(!e)return{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterValue")};if(t&&t.length>0){const i=Oe(e,t);if(i.length>0){return Je(i,t)}}if(je[e])return je[e];const i=e.toLowerCase();if(i.includes("monetary"))return i.includes("nodecimals")||i.includes("no-decimals")?{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:F.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterCurrency")};if(i.includes("explanation")||i.includes("description")||i.includes("notes")||i.includes("formatted"))return{fieldType:"textarea",placeholder:F.t("field.enterDetailedInformation")};if(i.includes("date"))return i.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"}:{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"};if(i.includes("boolean")||i.includes("bool"))return{fieldType:"boolean"};if(i.includes("integer")||i.includes("int")){const e=i.includes("nonnegative")||i.includes("non-negative");return{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:i.includes("positive")?1:e?0:void 0,step:1,placeholder:F.t("field.enterWholeNumber")}}return i.includes("decimal")||i.includes("numeric")||i.includes("number")?{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:F.t("field.enterDecimalValue")}:i.includes("percent")||i.includes("pure")?{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterPercentage")}:{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterValue")}}function Ae(e){return"textarea"===e}function Le(e){return"boolean"===e}function Ne(e){return["number","decimal","integer","currency","percentage"].includes(e)}function Ve(e){return"select"===e}function Oe(e,t){const i=[];if(!e)return i;if(!t||0===t.length)return i.push(e),i;let o=e;const r=new Set;for(;o;){if(i.push(o),r.has(o)){console.warn(`Circular reference detected in datatype hierarchy for type: ${o}`);break}r.add(o);const e=t.find(e=>e.type===o);if(!e||!e.basetype||""===e.basetype.trim())break;o=e.basetype}return i}function ze(e,t){if(e&&0!==e.length&&t&&0!==t.length)for(const i of e){const e=t.find(e=>e.type===i);if(e&&e.enumerations&&e.enumerations.length>0)return e.enumerations.map(e=>({id:e.id||e.value,value:e.value,label:e.value}))}}function Je(e,t){if(!e||0===e.length)return{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterValue")};if(t&&t.length>0){const i=ze(e,t);if(i&&i.length>0)return{fieldType:"select",enumerations:i,placeholder:F.t("field.selectOption")}}const i=e.map(e=>e.toLowerCase()),o=i.join("|");if(e.some(e=>"nl-types:formattedExplanationItemType"===e)||o.includes("formattedexplanation")||o.includes("formatted")&&o.includes("explanation"))return{fieldType:"textarea",placeholder:F.t("field.enterDetailedExplanation")};if(i.some(e=>e.includes("date")))return o.includes("datetime")||o.includes("time")?{fieldType:"datetime",htmlInputType:"datetime-local",min:"1900-01-01T00:00",max:"2100-12-31T23:59"}:{fieldType:"date",htmlInputType:"date",min:"1900-01-01",max:"2100-12-31"};if(i.some(e=>e.includes("boolean")||e.includes("bool")))return{fieldType:"boolean"};if(i.some(e=>e.includes("integer")||"integer"===e)){const e=o.includes("nonnegative")||o.includes("non-negative");return{fieldType:"integer",htmlInputType:"text",inputMode:"numeric",allowDecimals:!1,min:o.includes("positive")?1:e?0:void 0,step:1,placeholder:F.t("field.enterWholeNumber")}}return i.some(e=>e.includes("percent")||e.includes("pure"))?{fieldType:"percentage",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterPercentage")}:i.some(e=>e.includes("decimal")||"decimal"===e)?o.includes("monetary")||o.includes("currency")?o.includes("nodecimals")||o.includes("no-decimals")||o.includes("nodecimals20")?{fieldType:"number",htmlInputType:"text",inputMode:"decimal",allowDecimals:!1,step:1,placeholder:F.t("field.enterAmountNoDecimals")}:{fieldType:"currency",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:.01,placeholder:F.t("field.enterCurrency")}:{fieldType:"decimal",htmlInputType:"text",inputMode:"decimal",allowDecimals:!0,step:"any",placeholder:F.t("field.enterDecimalValue")}:e.some(e=>"xbrli:stringItemType"===e)||i.some(e=>"string"===e||e.includes("stringitem"))?{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterText")}:{fieldType:"text",htmlInputType:"text",placeholder:F.t("field.enterValue")}}class Be{static validateConceptValue(e,t,i){if(null==t||""===t)return{valid:!0,errors:[]};if(!e||!i||0===i.length)return{valid:!0,errors:[]};const o=this.findDatatype(e,i);return o&&o.validation?this.validateAgainstRules(t,o.validation):{valid:!0,errors:[]}}static validateAgainstRules(e,t){const i=[];if(null==e||""===e)return{valid:!0,errors:[]};if(!t)return{valid:!0,errors:[]};const o=String(e);if(t.pattern){const e=this.validatePattern(o,t.pattern);e&&i.push(e)}if(void 0!==t.length){const e=this.validateExactLength(o,t.length);e&&i.push(e)}if(void 0!==t.minLength){const e=this.validateMinLength(o,t.minLength);e&&i.push(e)}if(void 0!==t.maxLength){const e=this.validateMaxLength(o,t.maxLength);e&&i.push(e)}if(void 0!==t.totalDigits){const e=this.validateTotalDigits(o,t.totalDigits);e&&i.push(e)}return{valid:0===i.length,errors:i}}static findDatatype(e,t){let i=t.find(t=>t.type===e);if(i)return i;const o=new Set;let r=e;for(;r&&!o.has(r)&&(o.add(r),i=t.find(e=>e.type===r),i);){if(i.validation)return i;r=i.basetype}}static validatePattern(e,t){try{if(!new RegExp(`^${t}$`).test(e))return{type:"pattern",message:F.t("xbrlValidation.patternMismatch",{pattern:t}),expectedValue:t,actualValue:e}}catch(i){return console.error(`Invalid regex pattern: ${t}`,i),{type:"pattern",message:F.t("xbrlValidation.invalidPattern",{pattern:t}),expectedValue:t,actualValue:e}}return null}static validateExactLength(e,t){return e.length!==t?{type:"length",message:F.t("xbrlValidation.exactLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMinLength(e,t){return e.length<t?{type:"minLength",message:F.t("xbrlValidation.minLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateMaxLength(e,t){return e.length>t?{type:"maxLength",message:F.t("xbrlValidation.maxLength",{required:t,current:e.length}),expectedValue:t,actualValue:e.length}:null}static validateTotalDigits(e,t){const i=e.replace(/[^\d]/g,"");return i.length>t?{type:"totalDigits",message:F.t("xbrlValidation.totalDigits",{required:t,current:i.length}),expectedValue:t,actualValue:i.length}:null}static getValidationRulesSummary(e,t){if(!e||!t)return[];const i=this.findDatatype(e,t);if(!i||!i.validation)return[];const o=i.validation,r=[];return o.pattern&&r.push(F.t("xbrlValidation.ruleSummaryPattern",{pattern:o.pattern})),void 0!==o.length&&r.push(F.t("xbrlValidation.ruleSummaryExactLength",{required:o.length})),void 0!==o.minLength&&r.push(F.t("xbrlValidation.ruleSummaryMinLength",{required:o.minLength})),void 0!==o.maxLength&&r.push(F.t("xbrlValidation.ruleSummaryMaxLength",{required:o.maxLength})),void 0!==o.totalDigits&&r.push(F.t("xbrlValidation.ruleSummaryTotalDigits",{required:o.totalDigits})),r}}function Ue(e){return e.length>=1&&e[0].length>=1&&e[0].length<=3&&e.slice(1).every(e=>3===e.length)}function qe(e,t={}){const i=!1!==t.allowDecimals,o=!1!==t.allowNegative,r=(t.locale??"nl-NL").toLowerCase().startsWith("nl");let n=e.trim();if(""===n)return{ok:!1,reason:"unreadable"};if(n=n.replace(/EUR/gi,"").replace(/[€'\s]/g,""),""===n)return{ok:!1,reason:"unreadable"};let a=!1;const s=/^\((.*)\)$/.exec(n);if(s&&(a=!0,n=s[1]),n.startsWith("+")?n=n.slice(1):n.startsWith("-")?(a=!0,n=n.slice(1)):n.endsWith("-")&&(a=!0,n=n.slice(0,-1)),""===n||!/^[0-9.,]+$/.test(n))return{ok:!1,reason:"unreadable"};const l=(n.match(/\./g)||[]).length,d=(n.match(/,/g)||[]).length;let c,p=!1;if(0===l&&0===d)c=n,p=!0;else if(l>0&&d>0){const e=n.lastIndexOf("."),t=n.lastIndexOf(","),i=e>t?".":",",o="."===i?",":".",r="."===i?l:d,a="."===i?e:t,s=[...n].every((e,t)=>e!==o||t<a);if(1!==r||!s)return{ok:!1,reason:"unreadable"};const p=n.slice(0,a),u=n.slice(a+1),h=p.split(o);if(!Ue(h)||0===u.length)return{ok:!1,reason:"unreadable"};c=`${h.join("")}.${u}`}else if(l>=2||d>=2){const e=l>=2?".":",",t=n.split(e);if(!Ue(t))return{ok:!1,reason:"unreadable"};c=t.join(""),p=!0}else{const e=1===l?".":",",t=n.indexOf(e),o=n.slice(0,t),a=n.slice(t+1);if(""===o||""===a)return{ok:!1,reason:"unreadable"};const s=3===a.length&&"0"!==o;if(r)if("."===e)i?c=`${o}.${a}`:s?(c=o+a,p=!0):c=`${o}.${a}`;else if(s){if(i)return{ok:!1,reason:"ambiguous"};c=o+a,p=!0}else c=`${o}.${a}`;else if("."===e)c=`${o}.${a}`;else{if(!s)return{ok:!1,reason:"unreadable"};c=o+a,p=!0}}if(null===c)return{ok:!1,reason:"unreadable"};const u=Number(c);if(!Number.isFinite(u))return{ok:!1,reason:"unreadable"};if(a&&!o)return{ok:!1,reason:"negativeNotAllowed"};const h=a?-u:u;return i||p||h===Math.trunc(h)?{ok:!0,value:h}:{ok:!1,reason:"decimalsNotAllowed"}}var He=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Ke=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?We(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&He(t,i,n),n};exports.JupiterFormField=class extends e.LitElement{constructor(){super(...arguments),this.defaultUnits=[],this.value=null,this.disabled=!1,this.locale="en-US",this.numberLocale="nl-NL",this.hideLabel=!1,this.mode="inputForm",this.globalDecimals="INF",this.typedMemberValues={},this._errors=[],this._xbrlErrors=[],this._touched=!1,this._showPeriodPopup=!1,this._availableUnits=[],this._numericDraftValue=null,this._focused=!1}willUpdate(e){var t;(e.has("value")||e.has("field"))&&this._validateField(),e.has("unit")&&this.unit&&this.hasUpdated&&(this.unit,this.conceptId,this.columnId,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:null==(t=this.field)?void 0:t.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0}))),e.has("field")&&this.field&&(this.conceptId.includes("DescriptionLocationNL")||this.columnId.startsWith("col-"))&&(this.conceptId,this.columnId,this.field.periodType,this.field.periodStartDate,this.field.periodEndDate,this.field.periodInstantDate)}_validateField(){var e;(null==(e=this.field)?void 0:e.validation)&&(this._errors=$.validateField(this.field.id,this.conceptId,this.columnId,this.value,this.field.type,this.field.validation))}_isRoundingLevelConcept(){return!!this.conceptId&&this.conceptId.includes("DocumentIntendedRoundingLevel")}_isDisabledForPriorYear(){return!!this.conceptId&&!!this.columnId&&this.conceptId.includes("BalanceSheetBeforeAfterAppropriationResults")&&this.columnId.includes("_prev")}_renderLockIcon(){const t=this.prefilledTooltip||F.t("field.prefilledLocked");return e.html`
|
|
23
23
|
<svg class="lock-icon" viewBox="0 0 24 24" role="img" aria-label="${t}">
|
|
24
24
|
<title>${t}</title>
|
|
25
25
|
<path fill="currentColor" d="M12 1a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V11a2 2 0 0 0-2-2h-1V6a5 5 0 0 0-5-5zm-3 8V6a3 3 0 0 1 6 0v3z"/>
|
|
26
26
|
</svg>
|
|
27
|
-
`}_isNumericField(){var e;return Le(je(this.conceptType,this.datatypes).fieldType||(null==(e=this.field)?void 0:e.type)||"text")||"number"===this._getInputType()}_isIntermediateNumericValue(e){return"-"===e||"."===e||"-."===e||","===e||"-,"===e}_getNumberParseOptions(){const e=je(this.conceptType,this.datatypes),t=void 0===e.min||"number"==typeof e.min&&e.min<0;return{locale:this.numberLocale,allowDecimals:!1!==e.allowDecimals,allowNegative:t}}_numberParseErrorMessage(e,t){switch(e){case"decimalsNotAllowed":return E.t("field.noDecimalsAllowed");case"negativeNotAllowed":return E.t("field.negativeNotAllowed");case"ambiguous":return E.t("field.ambiguousNumber",{value:t});default:return E.t("field.invalidNumber",{value:t})}}_handleInput(e){const t=e.target;if(t instanceof HTMLInputElement&&("date"===t.type||"datetime-local"===t.type)){if("change"!==e.type)return}else if("INPUT"===t.tagName&&"checkbox"!==t.type&&"change"===e.type)return;const i=this.value;let o=t.value;if(this._isNumericField()){const e=t.value;if(this._numericDraftValue=e,""===e||this._isIntermediateNumericValue(e))o=null;else{const t=Ue(e,this._getNumberParseOptions());o=t.ok?t.value:null}}else"boolean"===this.field.type?(o=t.checked,this._numericDraftValue=null):this._numericDraftValue=null;this.value=o,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:o,oldValue:i},bubbles:!0}))}_handleFocus(){this._focused=!0,this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._focused=!1;let e=!1,t=null;if(this._isNumericField()&&null!==this._numericDraftValue){e=!0;const i=this._numericDraftValue;if(""===i||this._isIntermediateNumericValue(i))this.value=null,this._numericDraftValue=null;else{const e=Ue(i,this._getNumberParseOptions());e.ok?(this.value=e.value,this._numericDraftValue=null):(this.value=null,t={type:"invalidNumber",message:this._numberParseErrorMessage(e.reason,i)})}}if(this._isPercentItemType()&&e&&null!==this.value&&void 0!==this.value){const e=Number(this.value);if(!isNaN(e)&&Math.abs(e)>1){this.value=e/100;const t=e;this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:this.value,oldValue:t},bubbles:!0}))}}this._touched=!0,this._validateXBRLDatatype(),this._validateUnitSelection(),t&&(this._xbrlErrors=[t,...this._xbrlErrors]),this.field.id,this.conceptId,this.columnId,this._xbrlErrors,this.value,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,xbrlValidationErrors:this._xbrlErrors},bubbles:!0,composed:!0})),this._xbrlErrors.length}_isMonetaryType(){if(!this.conceptType||!this.datatypes)return!1;if(this.conceptType.includes("monetary")||this.conceptType.includes("Monetary"))return!0;return Ve(this.conceptType,this.datatypes).some(e=>e.includes("monetary")||e.includes("Monetary"))}_isPercentItemType(){if(!this.conceptType)return!1;if(this.conceptType.toLowerCase().includes("percent"))return!0;if(!this.datatypes)return!1;return Ve(this.conceptType,this.datatypes).some(e=>e.toLowerCase().includes("percent"))}_handleKeyDown(e){const t=e.target;if(!this._isNumericField())return;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))return;if(e.ctrlKey||e.metaKey)return;const i=je(this.conceptType,this.datatypes),o=void 0===i.min||"number"==typeof i.min&&i.min<0;("-"!==e.key||!o||t.value.includes("-")||0!==t.selectionStart&&0!==t.value.length)&&("."!==e.key||!1===i.allowDecimals||t.value.includes("."))&&","!==e.key&&"€"!==e.key&&"("!==e.key&&")"!==e.key&&" "!==e.key&&(e.key>="0"&&e.key<="9"||e.preventDefault())}_validateXBRLDatatype(){if(this._xbrlErrors=[],null===this.value||void 0===this.value||""===this.value)return;if(!this.conceptType||!this.datatypes||0===this.datatypes.length)return;const e=Je.validateConceptValue(this.conceptType,this.value,this.datatypes);e.valid?this.conceptId:(this._xbrlErrors=e.errors,this.conceptId,this.conceptType,this.value,this._xbrlErrors)}_validateUnitSelection(){if(null===this.value||void 0===this.value||""===this.value)return;const e=this._collectUnitsForConceptType();if(0===e.length)return;if(this.unit)return;const t=e.find(e=>!0===e.isDefault)??(1===e.length?e[0]:null);if(t)return this.unit=t.id,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})),this.unit,void this.conceptId;this._xbrlErrors=[...this._xbrlErrors,{type:"unit",message:E.t("validation.unitRequired"),expectedValue:e.map(e=>e.label).join(", "),actualValue:""}],this.conceptId}_handlePeriodIconClick(){if(!this._isRoundingLevelConcept()){if(this._availableUnits=this._collectUnitsForConceptType(),this._availableUnits.length,this.conceptId,this._availableUnits,this.unit,this.conceptId,this.columnId,!this.unit&&this._availableUnits.length>0){let e=null;const t=this._availableUnits.find(e=>!0===e.isDefault);t?(e=t.id,t.id,t.label):1===this._availableUnits.length&&(e=this._availableUnits[0].id),e&&(this.unit=e,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})))}else this.unit&&(this.unit,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})));this._showPeriodPopup=!0}}_collectUnitsForConceptType(){if(!this.conceptType||!this.datatypes)return[];const e=Ve(this.conceptType,this.datatypes);this.conceptId,this.conceptType;for(const t of e){const e=this.datatypes.find(e=>e.type===t);if(e&&e.units&&Array.isArray(e.units)&&e.units.length>0)return e.units.length,e.units}return this.conceptId,[]}_closePeriodPopup(){this._showPeriodPopup=!1}_handleUnitChange(e){const t=e.target.value;this.conceptId,this.columnId,this.unit,this.unit=t,this.unit;const i={fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit};this.dispatchEvent(new CustomEvent("unit-change",{detail:i,bubbles:!0,composed:!0}))}_handleDecimalsChange(e){const t=e.target.value.trim(),i=parseFloat(t),o=t&&!isNaN(i)?String(Math.abs(i)):""===t?"":t;this.decimals=o||void 0,this.dispatchEvent(new CustomEvent("decimals-change",{detail:{conceptId:this.conceptId,columnId:this.columnId,decimals:this.decimals},bubbles:!0,composed:!0}))}_handlePopupOverlayClick(e){e.target===e.currentTarget&&this._closePeriodPopup()}_ensureTextDialogStyles(){if(document.getElementById("jdf-text-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-text-dialog-styles",e.textContent="\n dialog.jdf-text-entry-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 600px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n font-family: inherit;\n /* JDF-118: don't rely on the UA's default margin:auto centering — a host page's\n * { margin: 0 } reset wins over it and pins the dialog to the top-left corner.\n Position explicitly instead, independent of any margin. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-text-entry-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-text-dialog-header {\n background: #f0f2f5; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ddd;\n }\n .jdf-text-dialog-title {\n font-size: 15px; font-weight: 600; color: #333; margin: 0;\n font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n }\n .jdf-text-dialog-close {\n flex-shrink: 0; width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit; margin-left: 8px;\n }\n .jdf-text-dialog-close:hover { background: #ddd; color: #333; }\n .jdf-text-dialog-body { padding: 20px 20px 12px; }\n .jdf-text-dialog-textarea {\n /* JDF-118: at least 60vh tall by default, growing further with content (up to 75vh,\n see the input listener below), instead of the old cramped 200px/50vh cap. */\n width: 100%; min-height: 60vh; max-height: 75vh;\n padding: 10px 12px; font-size: 14px; font-family: inherit;\n border: 1px solid #ddd; border-radius: 4px;\n box-sizing: border-box; resize: vertical; line-height: 1.5;\n color: #333; background: #fff;\n }\n .jdf-text-dialog-textarea:focus {\n outline: none; border-color: #1976d2;\n box-shadow: 0 0 0 2px rgba(25,118,210,0.2);\n }\n .jdf-text-dialog-char-count {\n margin-top: 4px; font-size: 12px; color: #888; text-align: right;\n font-family: inherit;\n }\n .jdf-text-dialog-actions {\n display: flex; justify-content: flex-end; gap: 8px;\n padding: 12px 20px 16px; border-top: 1px solid #eee;\n }\n .jdf-text-dialog-cancel {\n padding: 7px 18px; border: 1px solid #ddd; border-radius: 4px;\n background: transparent; color: #555; font-size: 14px;\n cursor: pointer; font-family: inherit;\n }\n .jdf-text-dialog-cancel:hover { background: #f5f5f5; }\n .jdf-text-dialog-save {\n padding: 7px 18px; border: none; border-radius: 4px;\n background: #1976d2; color: #fff; font-size: 14px;\n cursor: pointer; font-family: inherit; font-weight: 500;\n }\n .jdf-text-dialog-save:hover { background: #1565c0; }\n ",document.head.appendChild(e)}_openTextDialog(e,t){var i;this._ensureTextDialogStyles(),null==(i=document.getElementById("jdf-text-entry-dialog"))||i.remove();const o=document.createElement("dialog");o.id="jdf-text-entry-dialog",o.className="jdf-text-entry-dialog",o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-labelledby","jdf-text-dialog-title"),o.innerHTML='\n <div class="jdf-text-dialog-header">\n <h3 class="jdf-text-dialog-title" id="jdf-text-dialog-title"></h3>\n <button class="jdf-text-dialog-close" type="button" aria-label="Close">×</button>\n </div>\n <div class="jdf-text-dialog-body">\n <textarea class="jdf-text-dialog-textarea" spellcheck="true"></textarea>\n <div class="jdf-text-dialog-char-count"></div>\n </div>\n <div class="jdf-text-dialog-actions">\n <button class="jdf-text-dialog-cancel" type="button"></button>\n <button class="jdf-text-dialog-save" type="button"></button>\n </div>\n ';const r=t,n=o.querySelector(".jdf-text-dialog-title");n.textContent=r||t,n.title=r||t,o.querySelector(".jdf-text-dialog-cancel").textContent=E.t("field.cancel"),o.querySelector(".jdf-text-dialog-save").textContent=E.t("field.save");const a=o.querySelector(".jdf-text-dialog-textarea"),s=o.querySelector(".jdf-text-dialog-char-count");a.value=e,s.textContent=`${e.length} ${E.t("field.characters")}`;const l=()=>{a.style.height="auto";const e=.75*window.innerHeight;a.style.height=`${Math.min(a.scrollHeight,e)}px`};a.addEventListener("input",()=>{s.textContent=`${a.value.length} ${E.t("field.characters")}`,l()}),l(),o.querySelector(".jdf-text-dialog-close").addEventListener("click",()=>o.close()),o.querySelector(".jdf-text-dialog-cancel").addEventListener("click",()=>o.close()),o.querySelector(".jdf-text-dialog-save").addEventListener("click",()=>{const e=a.value,t=this.value;this.value=e,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:e,oldValue:t},bubbles:!0})),o.close()}),o.addEventListener("click",e=>{const t=o.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&o.close()}),o.addEventListener("close",()=>o.remove()),document.body.appendChild(o),o.showModal(),a.focus()}_renderTextDialogTrigger(t,i,o=!1){const r=null!=t&&""!==String(t).trim(),n=r?String(t):"";return i?e.html`
|
|
27
|
+
`}_isNumericField(){var e;return Ne(Pe(this.conceptType,this.datatypes).fieldType||(null==(e=this.field)?void 0:e.type)||"text")||"number"===this._getInputType()}_isIntermediateNumericValue(e){return"-"===e||"."===e||"-."===e||","===e||"-,"===e}_getNumberParseOptions(){const e=Pe(this.conceptType,this.datatypes),t=void 0===e.min||"number"==typeof e.min&&e.min<0;return{locale:this.numberLocale,allowDecimals:!1!==e.allowDecimals,allowNegative:t}}_numberParseErrorMessage(e,t){switch(e){case"decimalsNotAllowed":return F.t("field.noDecimalsAllowed");case"negativeNotAllowed":return F.t("field.negativeNotAllowed");case"ambiguous":return F.t("field.ambiguousNumber",{value:t});default:return F.t("field.invalidNumber",{value:t})}}_handleInput(e){const t=e.target;if(t instanceof HTMLInputElement&&("date"===t.type||"datetime-local"===t.type)){if("change"!==e.type)return}else if("INPUT"===t.tagName&&"checkbox"!==t.type&&"change"===e.type)return;const i=this.value;let o=t.value;if(this._isNumericField()){const e=t.value;if(this._numericDraftValue=e,""===e||this._isIntermediateNumericValue(e))o=null;else{const t=qe(e,this._getNumberParseOptions());o=t.ok?t.value:null}}else"boolean"===this.field.type?(o=t.checked,this._numericDraftValue=null):this._numericDraftValue=null;this.value=o,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:o,oldValue:i},bubbles:!0}))}_handleFocus(){this._focused=!0,this.dispatchEvent(new CustomEvent("field-focus",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId},bubbles:!0}))}_handleBlur(){this._focused=!1;let e=!1,t=null;if(this._isNumericField()&&null!==this._numericDraftValue){e=!0;const i=this._numericDraftValue;if(""===i||this._isIntermediateNumericValue(i))this.value=null,this._numericDraftValue=null;else{const e=qe(i,this._getNumberParseOptions());e.ok?(this.value=e.value,this._numericDraftValue=null):(this.value=null,t={type:"invalidNumber",message:this._numberParseErrorMessage(e.reason,i)})}}if(this._isPercentItemType()&&e&&null!==this.value&&void 0!==this.value){const e=Number(this.value);if(!isNaN(e)&&Math.abs(e)>1){this.value=e/100;const t=e;this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:this.value,oldValue:t},bubbles:!0}))}}this._touched=!0,this._validateXBRLDatatype(),this._validateUnitSelection(),t&&(this._xbrlErrors=[t,...this._xbrlErrors]),this.field.id,this.conceptId,this.columnId,this._xbrlErrors,this.value,this.dispatchEvent(new CustomEvent("field-blur",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,xbrlValidationErrors:this._xbrlErrors},bubbles:!0,composed:!0})),this._xbrlErrors.length}_isMonetaryType(){if(!this.conceptType||!this.datatypes)return!1;if(this.conceptType.includes("monetary")||this.conceptType.includes("Monetary"))return!0;return Oe(this.conceptType,this.datatypes).some(e=>e.includes("monetary")||e.includes("Monetary"))}_isPercentItemType(){if(!this.conceptType)return!1;if(this.conceptType.toLowerCase().includes("percent"))return!0;if(!this.datatypes)return!1;return Oe(this.conceptType,this.datatypes).some(e=>e.toLowerCase().includes("percent"))}_handleKeyDown(e){const t=e.target;if(!this._isNumericField())return;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))return;if(e.ctrlKey||e.metaKey)return;const i=Pe(this.conceptType,this.datatypes),o=void 0===i.min||"number"==typeof i.min&&i.min<0;("-"!==e.key||!o||t.value.includes("-")||0!==t.selectionStart&&0!==t.value.length)&&("."!==e.key||!1===i.allowDecimals||t.value.includes("."))&&","!==e.key&&"€"!==e.key&&"("!==e.key&&")"!==e.key&&" "!==e.key&&(e.key>="0"&&e.key<="9"||e.preventDefault())}_validateXBRLDatatype(){if(this._xbrlErrors=[],null===this.value||void 0===this.value||""===this.value)return;if(!this.conceptType||!this.datatypes||0===this.datatypes.length)return;const e=Be.validateConceptValue(this.conceptType,this.value,this.datatypes);e.valid?this.conceptId:(this._xbrlErrors=e.errors,this.conceptId,this.conceptType,this.value,this._xbrlErrors)}_validateUnitSelection(){if(null===this.value||void 0===this.value||""===this.value)return;const e=this._collectUnitsForConceptType();if(0===e.length)return;if(this.unit)return;const t=e.find(e=>!0===e.isDefault)??(1===e.length?e[0]:null);if(t)return this.unit=t.id,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})),this.unit,void this.conceptId;this._xbrlErrors=[...this._xbrlErrors,{type:"unit",message:F.t("validation.unitRequired"),expectedValue:e.map(e=>e.label).join(", "),actualValue:""}],this.conceptId}_handlePeriodIconClick(){if(!this._isRoundingLevelConcept()){if(this._availableUnits=this._collectUnitsForConceptType(),this._availableUnits.length,this.conceptId,this._availableUnits,this.unit,this.conceptId,this.columnId,!this.unit&&this._availableUnits.length>0){let e=null;const t=this._availableUnits.find(e=>!0===e.isDefault);t?(e=t.id,t.id,t.label):1===this._availableUnits.length&&(e=this._availableUnits[0].id),e&&(this.unit=e,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})))}else this.unit&&(this.unit,this.dispatchEvent(new CustomEvent("unit-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit},bubbles:!0,composed:!0})));this._showPeriodPopup=!0}}_collectUnitsForConceptType(){if(!this.conceptType||!this.datatypes)return[];const e=Oe(this.conceptType,this.datatypes);this.conceptId,this.conceptType;for(const t of e){const e=this.datatypes.find(e=>e.type===t);if(e&&e.units&&Array.isArray(e.units)&&e.units.length>0)return e.units.length,e.units}return this.conceptId,[]}_closePeriodPopup(){this._showPeriodPopup=!1}_handleUnitChange(e){const t=e.target.value;this.conceptId,this.columnId,this.unit,this.unit=t,this.unit;const i={fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,unit:this.unit};this.dispatchEvent(new CustomEvent("unit-change",{detail:i,bubbles:!0,composed:!0}))}_handleDecimalsChange(e){const t=e.target.value.trim(),i=parseFloat(t),o=t&&!isNaN(i)?String(Math.abs(i)):""===t?"":t;this.decimals=o||void 0,this.dispatchEvent(new CustomEvent("decimals-change",{detail:{conceptId:this.conceptId,columnId:this.columnId,decimals:this.decimals},bubbles:!0,composed:!0}))}_handlePopupOverlayClick(e){e.target===e.currentTarget&&this._closePeriodPopup()}_ensureTextDialogStyles(){if(document.getElementById("jdf-text-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-text-dialog-styles",e.textContent="\n dialog.jdf-text-entry-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 600px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n font-family: inherit;\n /* JDF-118: don't rely on the UA's default margin:auto centering — a host page's\n * { margin: 0 } reset wins over it and pins the dialog to the top-left corner.\n Position explicitly instead, independent of any margin. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-text-entry-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-text-dialog-header {\n background: #f0f2f5; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ddd;\n }\n .jdf-text-dialog-title {\n font-size: 15px; font-weight: 600; color: #333; margin: 0;\n font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n }\n .jdf-text-dialog-close {\n flex-shrink: 0; width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit; margin-left: 8px;\n }\n .jdf-text-dialog-close:hover { background: #ddd; color: #333; }\n .jdf-text-dialog-body { padding: 20px 20px 12px; }\n .jdf-text-dialog-textarea {\n /* JDF-118: at least 60vh tall by default, growing further with content (up to 75vh,\n see the input listener below), instead of the old cramped 200px/50vh cap. */\n width: 100%; min-height: 60vh; max-height: 75vh;\n padding: 10px 12px; font-size: 14px; font-family: inherit;\n border: 1px solid #ddd; border-radius: 4px;\n box-sizing: border-box; resize: vertical; line-height: 1.5;\n color: #333; background: #fff;\n }\n .jdf-text-dialog-textarea:focus {\n outline: none; border-color: #1976d2;\n box-shadow: 0 0 0 2px rgba(25,118,210,0.2);\n }\n .jdf-text-dialog-char-count {\n margin-top: 4px; font-size: 12px; color: #888; text-align: right;\n font-family: inherit;\n }\n .jdf-text-dialog-actions {\n display: flex; justify-content: flex-end; gap: 8px;\n padding: 12px 20px 16px; border-top: 1px solid #eee;\n }\n .jdf-text-dialog-cancel {\n padding: 7px 18px; border: 1px solid #ddd; border-radius: 4px;\n background: transparent; color: #555; font-size: 14px;\n cursor: pointer; font-family: inherit;\n }\n .jdf-text-dialog-cancel:hover { background: #f5f5f5; }\n .jdf-text-dialog-save {\n padding: 7px 18px; border: none; border-radius: 4px;\n background: #1976d2; color: #fff; font-size: 14px;\n cursor: pointer; font-family: inherit; font-weight: 500;\n }\n .jdf-text-dialog-save:hover { background: #1565c0; }\n ",document.head.appendChild(e)}_openTextDialog(e,t){var i;this._ensureTextDialogStyles(),null==(i=document.getElementById("jdf-text-entry-dialog"))||i.remove();const o=document.createElement("dialog");o.id="jdf-text-entry-dialog",o.className="jdf-text-entry-dialog",o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-labelledby","jdf-text-dialog-title"),o.innerHTML='\n <div class="jdf-text-dialog-header">\n <h3 class="jdf-text-dialog-title" id="jdf-text-dialog-title"></h3>\n <button class="jdf-text-dialog-close" type="button" aria-label="Close">×</button>\n </div>\n <div class="jdf-text-dialog-body">\n <textarea class="jdf-text-dialog-textarea" spellcheck="true"></textarea>\n <div class="jdf-text-dialog-char-count"></div>\n </div>\n <div class="jdf-text-dialog-actions">\n <button class="jdf-text-dialog-cancel" type="button"></button>\n <button class="jdf-text-dialog-save" type="button"></button>\n </div>\n ';const r=t,n=o.querySelector(".jdf-text-dialog-title");n.textContent=r||t,n.title=r||t,o.querySelector(".jdf-text-dialog-cancel").textContent=F.t("field.cancel"),o.querySelector(".jdf-text-dialog-save").textContent=F.t("field.save");const a=o.querySelector(".jdf-text-dialog-textarea"),s=o.querySelector(".jdf-text-dialog-char-count");a.value=e,s.textContent=`${e.length} ${F.t("field.characters")}`;const l=()=>{a.style.height="auto";const e=.75*window.innerHeight;a.style.height=`${Math.min(a.scrollHeight,e)}px`};a.addEventListener("input",()=>{s.textContent=`${a.value.length} ${F.t("field.characters")}`,l()}),l(),o.querySelector(".jdf-text-dialog-close").addEventListener("click",()=>o.close()),o.querySelector(".jdf-text-dialog-cancel").addEventListener("click",()=>o.close()),o.querySelector(".jdf-text-dialog-save").addEventListener("click",()=>{const e=a.value,t=this.value;this.value=e,this._touched=!0,this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,value:e,oldValue:t},bubbles:!0})),o.close()}),o.addEventListener("click",e=>{const t=o.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&o.close()}),o.addEventListener("close",()=>o.remove()),document.body.appendChild(o),o.showModal(),a.focus()}_renderTextDialogTrigger(t,i,o=!1){const r=null!=t&&""!==String(t).trim(),n=r?String(t):"";return i?e.html`
|
|
28
28
|
<span class="text-readonly-label ${r?"":"empty"} ${o?"locked":""}"
|
|
29
29
|
title="${n}">${r?n:"—"}</span>
|
|
30
30
|
${o?this._renderLockIcon():""}
|
|
@@ -35,30 +35,31 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
35
35
|
${n}
|
|
36
36
|
</span>
|
|
37
37
|
<button class="text-edit-btn" type="button"
|
|
38
|
-
aria-label="${
|
|
38
|
+
aria-label="${F.t("field.editText")}"
|
|
39
39
|
@click="${()=>{var e;return this._openTextDialog(n,(null==(e=this.field)?void 0:e.label)||"")}}">
|
|
40
|
-
✎ ${
|
|
40
|
+
✎ ${F.t("field.editText")}
|
|
41
41
|
</button>
|
|
42
42
|
</div>
|
|
43
43
|
`:e.html`
|
|
44
44
|
<button class="text-trigger-btn" type="button"
|
|
45
|
-
aria-label="${
|
|
45
|
+
aria-label="${F.t("field.addText")}"
|
|
46
46
|
@click="${()=>{var e;return this._openTextDialog("",(null==(e=this.field)?void 0:e.label)||"")}}">
|
|
47
47
|
<span class="text-trigger-plus" aria-hidden="true">+</span>
|
|
48
|
-
<span class="text-trigger-label">${
|
|
48
|
+
<span class="text-trigger-label">${F.t("field.addText")}</span>
|
|
49
49
|
</button>
|
|
50
|
-
`}_handlePeriodChange(e,t){const i=e.target.value;this.conceptId,this.columnId,"instant"===t?this.periodInstantDate=i:"start"===t?this.periodStartDate=i:"end"===t&&(this.periodEndDate=i),this.periodStartDate,this.periodEndDate,this.periodInstantDate,this.dispatchEvent(new CustomEvent("period-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType,periodStartDate:this.periodStartDate,periodEndDate:this.periodEndDate,periodInstantDate:this.periodInstantDate,unit:this.unit},bubbles:!0,composed:!0})),this.conceptId,this.columnId,this.field.periodType}_handleCrossRoleTypedMemberChange(e,t){const i=e.target.value;this.typedMemberValues={...this.typedMemberValues,[t]:i},this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:this.columnId,conceptId:this.conceptId,axisId:t,value:i},bubbles:!0,composed:!0}))}_renderReadonlyValue(t){const i=
|
|
50
|
+
`}_handlePeriodChange(e,t){const i=e.target.value;this.conceptId,this.columnId,"instant"===t?this.periodInstantDate=i:"start"===t?this.periodStartDate=i:"end"===t&&(this.periodEndDate=i),this.periodStartDate,this.periodEndDate,this.periodInstantDate,this.dispatchEvent(new CustomEvent("period-change",{detail:{fieldId:this.field.id,conceptId:this.conceptId,columnId:this.columnId,periodType:this.field.periodType,periodStartDate:this.periodStartDate,periodEndDate:this.periodEndDate,periodInstantDate:this.periodInstantDate,unit:this.unit},bubbles:!0,composed:!0})),this.conceptId,this.columnId,this.field.periodType}_handleCrossRoleTypedMemberChange(e,t){const i=e.target.value;this.typedMemberValues={...this.typedMemberValues,[t]:i},this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:this.columnId,conceptId:this.conceptId,axisId:t,value:i},bubbles:!0,composed:!0}))}_renderReadonlyValue(t){const i=Pe(this.conceptType,this.datatypes),o=i.fieldType||this.field.type||"text";let r;if("boolean"===o||Le(o))r=t?F.t("form.yes"):F.t("form.no");else if("select"===o||"select"===this.field.type){const e=(i.enumerations||this.field.options||[]).find(e=>e.value===t);r=e?e.label||e.value:t??""}else r=null!=t?String(t):"";const n=""===r||null==r,a=this._isMonetaryType();return e.html`<span class="readonly-value ${n?"empty":""} ${a?"monetary":""}">${n?"—":r}</span>`}_renderInput(t=this.value,i=this.disabled,o=!1,r){if("readonly"===this.mode)return this._renderReadonlyValue(t);const n=this._errors.some(e=>"error"===e.severity),a=this._errors.some(e=>"warning"===e.severity),s=`field-input ${n?"error":a?"warning":""} ${this._isMonetaryType()?"monetary":""} ${o?"locked":""}`,l=`${this.conceptId}__${this.columnId}`,d=`data[${this.conceptId}][${this.columnId}]`,c=Pe(this.conceptType,this.datatypes);this.conceptType;const p=c.fieldType||this.field.type||"text";if("textarea"===p||Ae(p))return this._renderTextDialogTrigger(t,i||this.field.disabled||!1,o);if("select"===p||"select"===this.field.type){const o=c.enumerations||this.field.options||[];return e.html`
|
|
51
51
|
<select
|
|
52
|
-
id="${
|
|
53
|
-
name="${
|
|
54
|
-
class="${
|
|
52
|
+
id="${l}"
|
|
53
|
+
name="${d}"
|
|
54
|
+
class="${s}"
|
|
55
55
|
.value="${t??""}"
|
|
56
56
|
?disabled="${i||this.field.disabled}"
|
|
57
|
+
title="${r||""}"
|
|
57
58
|
@change="${this._handleInput}"
|
|
58
59
|
@focus="${this._handleFocus}"
|
|
59
60
|
@blur="${this._handleBlur}"
|
|
60
61
|
>
|
|
61
|
-
<option value="">${
|
|
62
|
+
<option value="">${F.t("field.emptyOption")}</option>
|
|
62
63
|
${o.map(i=>{const o=i.value,r=i.label||i.value,n=i.disabled||!1;return e.html`
|
|
63
64
|
<option
|
|
64
65
|
value="${o}"
|
|
@@ -69,11 +70,11 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
69
70
|
</option>
|
|
70
71
|
`})}
|
|
71
72
|
</select>
|
|
72
|
-
`}if("boolean"===
|
|
73
|
+
`}if("boolean"===p||Le(p))return e.html`
|
|
73
74
|
<div class="checkbox-container">
|
|
74
75
|
<input
|
|
75
|
-
id="${
|
|
76
|
-
name="${
|
|
76
|
+
id="${l}"
|
|
77
|
+
name="${d}"
|
|
77
78
|
type="checkbox"
|
|
78
79
|
class="field-input"
|
|
79
80
|
.checked="${Boolean(t)}"
|
|
@@ -84,20 +85,20 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
84
85
|
/>
|
|
85
86
|
<span>${this.field.label}</span>
|
|
86
87
|
</div>
|
|
87
|
-
`;const
|
|
88
|
+
`;const u=c.htmlInputType||this._getInputType(),h=void 0!==c.step?c.step:Ne(p)?"any":void 0,m=c.min,f=c.max;let b;b=this._isNumericField()&&null!==this._numericDraftValue?this._numericDraftValue:"percentage"===p&&null!=t&&""!==t?Number(t).toFixed(4):t??"";const g=c.placeholder||this.field.placeholder||"",v=`${l}-hint`,y=g?e.html`<span id="${v}" class="field-hint-sr-only">${g}</span>`:"";return"date"===u||"datetime-local"===u?e.html`
|
|
88
89
|
<div class="date-wrapper">
|
|
89
90
|
<input
|
|
90
|
-
id="${
|
|
91
|
-
name="${
|
|
92
|
-
type="${
|
|
93
|
-
inputmode="${
|
|
94
|
-
class="${
|
|
95
|
-
.value="${
|
|
91
|
+
id="${l}"
|
|
92
|
+
name="${d}"
|
|
93
|
+
type="${u}"
|
|
94
|
+
inputmode="${c.inputMode||""}"
|
|
95
|
+
class="${s}"
|
|
96
|
+
.value="${b}"
|
|
96
97
|
?disabled="${i||this.field.disabled}"
|
|
97
|
-
placeholder="${this._focused?
|
|
98
|
-
aria-describedby="${
|
|
99
|
-
min="${void 0!==
|
|
100
|
-
max="${void 0!==
|
|
98
|
+
placeholder="${this._focused?g:""}"
|
|
99
|
+
aria-describedby="${g?v:e.nothing}"
|
|
100
|
+
min="${void 0!==m?m:""}"
|
|
101
|
+
max="${void 0!==f?f:""}"
|
|
101
102
|
@input="${this._handleInput}"
|
|
102
103
|
@change="${this._handleInput}"
|
|
103
104
|
@focus="${this._handleFocus}"
|
|
@@ -108,31 +109,31 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
108
109
|
a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14
|
|
109
110
|
a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
|
|
110
111
|
</svg>
|
|
111
|
-
${
|
|
112
|
+
${y}
|
|
112
113
|
</div>
|
|
113
114
|
`:e.html`
|
|
114
115
|
<input
|
|
115
|
-
id="${
|
|
116
|
-
name="${
|
|
117
|
-
type="${
|
|
118
|
-
inputmode="${
|
|
119
|
-
class="${
|
|
120
|
-
.value="${
|
|
116
|
+
id="${l}"
|
|
117
|
+
name="${d}"
|
|
118
|
+
type="${u}"
|
|
119
|
+
inputmode="${c.inputMode||""}"
|
|
120
|
+
class="${s}"
|
|
121
|
+
.value="${b}"
|
|
121
122
|
?disabled="${i||this.field.disabled}"
|
|
122
|
-
placeholder="${this._focused?
|
|
123
|
-
aria-describedby="${
|
|
124
|
-
step="${void 0!==
|
|
125
|
-
min="${void 0!==
|
|
126
|
-
max="${void 0!==
|
|
123
|
+
placeholder="${this._focused?g:""}"
|
|
124
|
+
aria-describedby="${g?v:e.nothing}"
|
|
125
|
+
step="${void 0!==h?h:""}"
|
|
126
|
+
min="${void 0!==m?m:""}"
|
|
127
|
+
max="${void 0!==f?f:""}"
|
|
127
128
|
@input="${this._handleInput}"
|
|
128
129
|
@change="${this._handleInput}"
|
|
129
130
|
@focus="${this._handleFocus}"
|
|
130
131
|
@blur="${this._handleBlur}"
|
|
131
132
|
@keydown="${this._handleKeyDown}"
|
|
132
|
-
/>${
|
|
133
|
+
/>${y}
|
|
133
134
|
`}_getInputType(){switch(this.field.type){case"number":case"decimal":case"currency":case"percentage":default:return"text";case"date":return"date";case"datetime":return"datetime-local";case"email":return"email";case"url":return"url";case"tel":return"tel"}}_extractBaseConceptId(e){const t=e.split("__");return t.length>1?t.slice(0,-1).join("__"):e}_renderPeriodControls(){return"nl-cd_DescriptionLocationNL__a64trl"===this.conceptId&&(this.conceptId,this.columnId,this.field.periodType,this.field.periodStartDate,this.field.periodEndDate),this.field.periodType?"instant"===this.field.periodType?e.html`
|
|
134
135
|
<div class="period-controls">
|
|
135
|
-
<label>${
|
|
136
|
+
<label>${F.t("field.date")}:</label>
|
|
136
137
|
<div class="date-wrapper">
|
|
137
138
|
<input
|
|
138
139
|
type="date"
|
|
@@ -151,7 +152,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
151
152
|
</div>
|
|
152
153
|
`:"duration"===this.field.periodType?e.html`
|
|
153
154
|
<div class="period-controls">
|
|
154
|
-
<label>${
|
|
155
|
+
<label>${F.t("field.from")}:</label>
|
|
155
156
|
<div class="date-wrapper">
|
|
156
157
|
<input
|
|
157
158
|
type="date"
|
|
@@ -167,7 +168,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
167
168
|
a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14z"/>
|
|
168
169
|
</svg>
|
|
169
170
|
</div>
|
|
170
|
-
<label>${
|
|
171
|
+
<label>${F.t("field.to")}:</label>
|
|
171
172
|
<div class="date-wrapper">
|
|
172
173
|
<input
|
|
173
174
|
type="date"
|
|
@@ -188,7 +189,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
188
189
|
<div class="period-popup-overlay" @click="${this._handlePopupOverlayClick}" @keydown="${this._handlePeriodPopupKeydown}">
|
|
189
190
|
<div class="period-popup" @click="${e=>e.stopPropagation()}">
|
|
190
191
|
<div class="period-popup-header">
|
|
191
|
-
<div class="period-popup-title">${
|
|
192
|
+
<div class="period-popup-title">${F.t("field.editPeriod")}</div>
|
|
192
193
|
<button class="period-popup-close" @click="${this._closePeriodPopup}">
|
|
193
194
|
×
|
|
194
195
|
</button>
|
|
@@ -197,7 +198,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
197
198
|
<div class="period-popup-content">
|
|
198
199
|
${"instant"===this.field.periodType?e.html`
|
|
199
200
|
<div class="period-controls">
|
|
200
|
-
<label>${
|
|
201
|
+
<label>${F.t("field.date")}:</label>
|
|
201
202
|
<div class="date-wrapper">
|
|
202
203
|
<input
|
|
203
204
|
type="date"
|
|
@@ -216,7 +217,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
216
217
|
</div>
|
|
217
218
|
`:e.html`
|
|
218
219
|
<div class="period-controls">
|
|
219
|
-
<label>${
|
|
220
|
+
<label>${F.t("field.from")}:</label>
|
|
220
221
|
<div class="date-wrapper">
|
|
221
222
|
<input
|
|
222
223
|
type="date"
|
|
@@ -236,7 +237,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
236
237
|
</div>
|
|
237
238
|
</div>
|
|
238
239
|
<div class="period-controls">
|
|
239
|
-
<label>${
|
|
240
|
+
<label>${F.t("field.to")}:</label>
|
|
240
241
|
<div class="date-wrapper">
|
|
241
242
|
<input
|
|
242
243
|
type="date"
|
|
@@ -257,14 +258,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
257
258
|
|
|
258
259
|
${this._availableUnits.length>0?e.html`
|
|
259
260
|
<div class="period-controls">
|
|
260
|
-
<label>${
|
|
261
|
+
<label>${F.t("field.unit")}:</label>
|
|
261
262
|
<select
|
|
262
263
|
.value="${this.unit||""}"
|
|
263
264
|
@change="${this._handleUnitChange}"
|
|
264
265
|
?disabled="${this.disabled}"
|
|
265
266
|
class="unit-select"
|
|
266
267
|
>
|
|
267
|
-
<option value="">${
|
|
268
|
+
<option value="">${F.t("field.selectUnit")}</option>
|
|
268
269
|
${this._availableUnits.map(t=>e.html`
|
|
269
270
|
<option value="${t.id}" ?selected="${this.unit===t.id}">
|
|
270
271
|
${t.label||t.id}
|
|
@@ -276,12 +277,12 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
276
277
|
|
|
277
278
|
${this._isMonetaryType()?e.html`
|
|
278
279
|
<div class="period-controls">
|
|
279
|
-
<label>${
|
|
280
|
+
<label>${F.t("field.scale")}:</label>
|
|
280
281
|
<input
|
|
281
282
|
type="number"
|
|
282
283
|
min="0"
|
|
283
284
|
class="typed-member-input"
|
|
284
|
-
placeholder="${
|
|
285
|
+
placeholder="${F.t("field.leaveBlankForInf")}"
|
|
285
286
|
.value="${void 0!==this.decimals&&null!==this.decimals&&""!==this.decimals?this.decimals:"INF"!==this.globalDecimals?this.globalDecimals:""}"
|
|
286
287
|
@input="${this._handleDecimalsChange}"
|
|
287
288
|
?disabled="${this.disabled}"
|
|
@@ -306,7 +307,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
306
307
|
</div>
|
|
307
308
|
</div>
|
|
308
309
|
</div>
|
|
309
|
-
`}render(){var t,i;if(!this.field)return console.error("[FormField] No field provided!",{conceptId:this.conceptId,columnId:this.columnId}),e.html`<div>Error: No field data</div>`;const o=!this.hideLabel&&"boolean"!==this.field.type,r=this.field.periodType&&("instant"===this.field.periodType||"duration"===this.field.periodType),n=this._extractBaseConceptId(this.conceptId),a="admin"!==this.mode&&this.masterData&&n in this.masterData,s=this._isRoundingLevelConcept();let
|
|
310
|
+
`}render(){var t,i;if(!this.field)return console.error("[FormField] No field provided!",{conceptId:this.conceptId,columnId:this.columnId}),e.html`<div>Error: No field data</div>`;const o=!this.hideLabel&&"boolean"!==this.field.type,r=this.field.periodType&&("instant"===this.field.periodType||"duration"===this.field.periodType),n=this._extractBaseConceptId(this.conceptId),a="admin"!==this.mode&&this.masterData&&n in this.masterData,s=this._isRoundingLevelConcept(),l=this._isDisabledForPriorYear();let d=null;if(this.facts&&this.facts.length>0&&!a){const e={conceptId:n,columnId:this.columnId,periodStartDate:this.periodStartDate||this.field.periodStartDate,periodEndDate:this.periodEndDate||this.field.periodEndDate,periodInstantDate:this.periodInstantDate||this.field.periodInstantDate,periodType:this.field.periodType,unit:this.unit,dimensionData:null==(t=this.column)?void 0:t.dimensionData},o=n.includes("BalanceSheet")||n.includes("CostsIncorporation")||n.includes("Assets");o&&this.facts.length>0&&(this.columnId,this.facts.length,"instant"===e.periodType?e.periodInstantDate:(e.periodStartDate,e.periodEndDate),e.dimensionData,this.facts.map(e=>{var t;return{value:e.value,period:e.period,dimensions:null==(t=e.dimensions)?void 0:t.map(e=>`${e.dimension}:${e.member}`)}}));const r=we.findMatchingFact(this.facts,e);r?(d=r.value,(o||n.includes("StreetName"))&&(this.columnId,r.value,r.period,null==(i=r.dimensions)||i.map(e=>`${e.dimension}:${e.member}`))):o&&this.facts.length>0&&(this.columnId,this.facts.length)}const c=null!==this.value&&void 0!==this.value,p=l?null:a?this.masterData[n]:c?this.value:d,u=a||s||l||this.disabled||"readonly"===this.mode,h=(a||s)&&"readonly"!==this.mode,m=Pe(this.conceptType,this.datatypes).fieldType||this.field.type||"text",f="textarea"===m||Ae(m);return e.html`
|
|
310
311
|
<div class="field-container">
|
|
311
312
|
${o?e.html`
|
|
312
313
|
<label class="field-label ${this.field.required?"required":""}">
|
|
@@ -315,11 +316,11 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
315
316
|
`:""}
|
|
316
317
|
|
|
317
318
|
<div class="field-wrapper">
|
|
318
|
-
${this._renderInput(
|
|
319
|
+
${this._renderInput(p,u,h,l?F.t("field.notApplicablePriorYear"):void 0)}
|
|
319
320
|
|
|
320
|
-
${
|
|
321
|
+
${h&&!f||r&&"readonly"!==this.mode&&!s?e.html`
|
|
321
322
|
<div class="field-trailing-icons">
|
|
322
|
-
${
|
|
323
|
+
${h&&!f?this._renderLockIcon():""}
|
|
323
324
|
${r&&"readonly"!==this.mode&&!s?e.html`
|
|
324
325
|
<button
|
|
325
326
|
class="period-icon-btn"
|
|
@@ -901,7 +902,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
901
902
|
:host(.concept-highlight) {
|
|
902
903
|
animation: concept-highlight-pulse 10s ease-out forwards;
|
|
903
904
|
}
|
|
904
|
-
`,We([S({type:Object})],exports.JupiterFormField.prototype,"field",2),We([S({type:String})],exports.JupiterFormField.prototype,"conceptId",2),We([S({type:String})],exports.JupiterFormField.prototype,"conceptType",2),We([S({type:Array})],exports.JupiterFormField.prototype,"datatypes",2),We([S({type:Array})],exports.JupiterFormField.prototype,"defaultUnits",2),We([S({type:String})],exports.JupiterFormField.prototype,"columnId",2),We([S()],exports.JupiterFormField.prototype,"value",2),We([S({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),We([S({type:String})],exports.JupiterFormField.prototype,"locale",2),We([S({type:String})],exports.JupiterFormField.prototype,"numberLocale",2),We([S({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),We([S({type:String})],exports.JupiterFormField.prototype,"mode",2),We([S({type:Object})],exports.JupiterFormField.prototype,"masterData",2),We([S({type:String})],exports.JupiterFormField.prototype,"prefilledTooltip",2),We([S({type:Array})],exports.JupiterFormField.prototype,"facts",2),We([S({type:Object})],exports.JupiterFormField.prototype,"column",2),We([S({type:String})],exports.JupiterFormField.prototype,"periodStartDate",2),We([S({type:String})],exports.JupiterFormField.prototype,"periodEndDate",2),We([S({type:String})],exports.JupiterFormField.prototype,"periodInstantDate",2),We([S({type:String})],exports.JupiterFormField.prototype,"unit",2),We([S({type:String})],exports.JupiterFormField.prototype,"decimals",2),We([S({type:String})],exports.JupiterFormField.prototype,"globalDecimals",2),We([S({type:Object})],exports.JupiterFormField.prototype,"typedMemberValues",2),We([C()],exports.JupiterFormField.prototype,"_errors",2),We([C()],exports.JupiterFormField.prototype,"_xbrlErrors",2),We([C()],exports.JupiterFormField.prototype,"_touched",2),We([C()],exports.JupiterFormField.prototype,"_showPeriodPopup",2),We([C()],exports.JupiterFormField.prototype,"_availableUnits",2),We([C()],exports.JupiterFormField.prototype,"_numericDraftValue",2),We([C()],exports.JupiterFormField.prototype,"_focused",2),exports.JupiterFormField=We([t("jupiter-form-field")],exports.JupiterFormField);var Ke=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Qe=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Ye(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&Ke(t,i,n),n};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.decimalsData={},this.globalDecimals="INF",this.defaultUnits=[],this.disabled=!1,this.locale="en-US",this.numberLocale="nl-NL",this.expandedConcepts=new Set,this.mode="inputForm",this.typedMemberData={},this.showAddButton=!1,this.showRemoveButton=!1,this.language="en",this.rowFocused=!1,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_handleAddRepeat(){this.dispatchEvent(new CustomEvent("add-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handleRemoveRepeat(){this.dispatchEvent(new CustomEvent("remove-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handleFieldFocus(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-focus",{detail:e.detail,bubbles:!0}))}_handlePeriodChange(e){e.detail,e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0}))}_getDocLabel(){const e=this.concept.conceptMetadata;if(!e)return"";const t=this.language||this.locale.split("-")[0];return e.documentationLabels[t]||e.documentationLabels.en||e.documentationLabels.nl||""}_escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}_ensureDialogStyles(){if(document.getElementById("jdf-concept-info-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-concept-info-dialog-styles",e.textContent="\n dialog.jdf-concept-info-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 480px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n /* JDF-118: don't rely on the UA's default margin:auto centering — a host page's\n * { margin: 0 } reset (index.html has one) wins over it and pins the dialog to the\n top-left corner. Position explicitly instead, independent of any margin. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-concept-info-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-dialog-header {\n background: #f0f2f5; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ddd;\n }\n .jdf-dialog-title { font-size: 15px; font-weight: 600; color: #333; margin: 0; font-family: inherit; }\n .jdf-dialog-close-btn {\n width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit;\n }\n .jdf-dialog-close-btn:hover { background: #ddd; color: #333; }\n .jdf-dialog-body { padding: 20px; }\n .jdf-info-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: inherit; }\n .jdf-info-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }\n .jdf-info-table td { padding: 9px 4px; vertical-align: top; }\n .jdf-info-label { font-weight: 600; color: #666; width: 40%; white-space: nowrap; padding-right: 16px; }\n .jdf-info-value { color: #333; word-break: break-all; }\n .jdf-info-value.doc-text { font-style: italic; color: #555; line-height: 1.5; word-break: normal; }\n .jdf-period-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }\n .jdf-period-pill.instant { background: rgba(25,118,210,0.1); color: #1565c0; border: 1px solid rgba(25,118,210,0.3); }\n .jdf-period-pill.duration { background: rgba(56,142,60,0.1); color: #2e7d32; border: 1px solid rgba(56,142,60,0.3); }\n .jdf-balance-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; text-transform: capitalize; }\n .jdf-balance-pill.debit { background: rgba(211,47,47,0.1); color: #c62828; border: 1px solid rgba(211,47,47,0.3); }\n .jdf-balance-pill.credit { background: rgba(56,142,60,0.1); color: #2e7d32; border: 1px solid rgba(56,142,60,0.3); }\n ",document.head.appendChild(e)}_openInfoDialog(e){var t;e.stopPropagation(),this._ensureDialogStyles();const i=this.concept.conceptMetadata,o=this._getDocLabel(),r=(null==i?void 0:i.periodType)||this.concept.periodType,n=(null==i?void 0:i.balance)||this.concept.balance,a="instant"===r?E.t("conceptInfo.instant"):E.t("conceptInfo.duration"),s=[{label:E.t("conceptInfo.conceptName"),valueHtml:this._escapeHtml((null==i?void 0:i.conceptName)||this.concept.name)},{label:E.t("conceptInfo.type"),valueHtml:this._escapeHtml((null==i?void 0:i.type)||this.concept.type||"—")}];(null==i?void 0:i.substitutionGroup)&&s.push({label:E.t("conceptInfo.substitutionGroup"),valueHtml:this._escapeHtml(i.substitutionGroup)}),s.push({label:E.t("conceptInfo.periodType"),valueHtml:`<span class="jdf-period-pill ${r}">${this._escapeHtml(a)}</span>`}),n&&s.push({label:E.t("conceptInfo.balance"),valueHtml:`<span class="jdf-balance-pill ${n}">${this._escapeHtml(n)}</span>`}),o&&s.push({label:E.t("conceptInfo.documentation"),valueHtml:this._escapeHtml(o),isDoc:!0});const l=s.map(e=>`\n <tr>\n <td class="jdf-info-label">${this._escapeHtml(e.label)}</td>\n <td class="jdf-info-value${e.isDoc?" doc-text":""}">${e.valueHtml}</td>\n </tr>\n `).join(""),d=document.createElement("dialog");d.className="jdf-concept-info-dialog",d.innerHTML=`\n <div class="jdf-dialog-header">\n <h3 class="jdf-dialog-title">${this._escapeHtml(E.t("conceptInfo.title"))}</h3>\n <button class="jdf-dialog-close-btn" type="button" aria-label="${this._escapeHtml(E.t("conceptInfo.close"))}">×</button>\n </div>\n <div class="jdf-dialog-body">\n <table class="jdf-info-table">${l}</table>\n </div>\n `,document.body.appendChild(d),null==(t=d.querySelector(".jdf-dialog-close-btn"))||t.addEventListener("click",()=>d.close()),d.addEventListener("click",e=>{const t=d.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&d.close()}),d.addEventListener("close",()=>document.body.removeChild(d)),d.showModal()}_ensureCalcWarningDialogStyles(){if(document.getElementById("jdf-calc-warning-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-calc-warning-dialog-styles",e.textContent="\n dialog.jdf-calc-warning-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 480px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n /* JDF-118: see jdf-concept-info-dialog above — explicit centering, immune to host margin resets. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-calc-warning-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-calc-warning-header {\n background: #fff3e0; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ffcc80;\n }\n .jdf-calc-warning-title { font-size: 15px; font-weight: 600; color: #e65100; margin: 0; font-family: inherit; }\n .jdf-calc-warning-close-btn {\n width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit;\n }\n .jdf-calc-warning-close-btn:hover { background: #ffe0b2; color: #e65100; }\n .jdf-calc-warning-body { padding: 20px; font-family: inherit; font-size: 13px; color: #333; }\n .jdf-calc-warning-summary { margin: 0 0 12px 0; font-weight: 600; }\n .jdf-calc-warning-table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: inherit; }\n .jdf-calc-warning-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }\n .jdf-calc-warning-table td { padding: 6px 4px; vertical-align: top; }\n .jdf-calc-warning-sign { font-weight: 600; white-space: nowrap; }\n .jdf-calc-warning-sign.added { color: #2e7d32; }\n .jdf-calc-warning-sign.subtracted { color: #c62828; }\n ",document.head.appendChild(e)}_openCalculationWarningDialog(e,t){var i;e.stopPropagation(),this._ensureCalcWarningDialogStyles();const o=t.children.map(e=>`\n <tr>\n <td>${this._escapeHtml(e.label)}</td>\n <td>${this._escapeHtml(String(e.value))}</td>\n <td>${this._escapeHtml(e.balance||"—")}</td>\n <td class="jdf-calc-warning-sign ${1===e.weight?"added":"subtracted"}">\n ${this._escapeHtml(1===e.weight?E.t("calculationWarning.added"):E.t("calculationWarning.subtracted"))}\n </td>\n </tr>\n `).join(""),r=document.createElement("dialog");r.className="jdf-calc-warning-dialog",r.innerHTML=`\n <div class="jdf-calc-warning-header">\n <h3 class="jdf-calc-warning-title">⚠️ ${this._escapeHtml(E.t("calculationWarning.title"))}</h3>\n <button class="jdf-calc-warning-close-btn" type="button" aria-label="${this._escapeHtml(E.t("conceptInfo.close"))}">×</button>\n </div>\n <div class="jdf-calc-warning-body">\n <p class="jdf-calc-warning-summary">${this._escapeHtml(t.message)}</p>\n <table class="jdf-calc-warning-table">${o}</table>\n </div>\n `,document.body.appendChild(r),null==(i=r.querySelector(".jdf-calc-warning-close-btn"))||i.addEventListener("click",()=>r.close()),r.addEventListener("click",e=>{const t=r.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&r.close()}),r.addEventListener("close",()=>document.body.removeChild(r)),r.showModal()}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1,r=F(this.concept.preferredLabel);return e.html`
|
|
905
|
+
`,Ke([S({type:Object})],exports.JupiterFormField.prototype,"field",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"conceptId",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"conceptType",2),Ke([S({type:Array})],exports.JupiterFormField.prototype,"datatypes",2),Ke([S({type:Array})],exports.JupiterFormField.prototype,"defaultUnits",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"columnId",2),Ke([S()],exports.JupiterFormField.prototype,"value",2),Ke([S({type:Boolean})],exports.JupiterFormField.prototype,"disabled",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"locale",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"numberLocale",2),Ke([S({type:Boolean})],exports.JupiterFormField.prototype,"hideLabel",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"mode",2),Ke([S({type:Object})],exports.JupiterFormField.prototype,"masterData",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"prefilledTooltip",2),Ke([S({type:Array})],exports.JupiterFormField.prototype,"facts",2),Ke([S({type:Object})],exports.JupiterFormField.prototype,"column",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"periodStartDate",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"periodEndDate",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"periodInstantDate",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"unit",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"decimals",2),Ke([S({type:String})],exports.JupiterFormField.prototype,"globalDecimals",2),Ke([S({type:Object})],exports.JupiterFormField.prototype,"typedMemberValues",2),Ke([C()],exports.JupiterFormField.prototype,"_errors",2),Ke([C()],exports.JupiterFormField.prototype,"_xbrlErrors",2),Ke([C()],exports.JupiterFormField.prototype,"_touched",2),Ke([C()],exports.JupiterFormField.prototype,"_showPeriodPopup",2),Ke([C()],exports.JupiterFormField.prototype,"_availableUnits",2),Ke([C()],exports.JupiterFormField.prototype,"_numericDraftValue",2),Ke([C()],exports.JupiterFormField.prototype,"_focused",2),exports.JupiterFormField=Ke([t("jupiter-form-field")],exports.JupiterFormField);var Ye=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,Ge=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Qe(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&Ye(t,i,n),n};exports.JupiterConceptTree=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.decimalsData={},this.globalDecimals="INF",this.defaultUnits=[],this.disabled=!1,this.locale="en-US",this.numberLocale="nl-NL",this.expandedConcepts=new Set,this.mode="inputForm",this.typedMemberData={},this.showAddButton=!1,this.showRemoveButton=!1,this.language="en",this.rowFocused=!1,this._expanded=!0}connectedCallback(){super.connectedCallback(),this._expanded=this.expandedConcepts.has(this.concept.id)}willUpdate(e){super.willUpdate(e),e.has("expandedConcepts")&&(this._expanded=this.expandedConcepts.has(this.concept.id))}_toggleExpanded(){this._expanded=!this._expanded,this.dispatchEvent(new CustomEvent("concept-expand",{detail:{conceptId:this.concept.id,expanded:this._expanded},bubbles:!0}))}_getFieldForColumn(e){var t;return null==(t=this.concept.fields)?void 0:t.find(t=>t.columnId===e)}_getFieldValue(e){var t;return null==(t=this.formData[this.concept.id])?void 0:t[e.columnId]}_handleFieldChange(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0}))}_handleAddRepeat(){this.dispatchEvent(new CustomEvent("add-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handleRemoveRepeat(){this.dispatchEvent(new CustomEvent("remove-concept-repeat",{detail:{conceptId:this.concept.id},bubbles:!0,composed:!0}))}_handleFieldFocus(e){e.stopPropagation(),this.dispatchEvent(new CustomEvent("field-focus",{detail:e.detail,bubbles:!0}))}_handlePeriodChange(e){e.detail,e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0}))}_getDocLabel(){const e=this.concept.conceptMetadata;if(!e)return"";const t=this.language||this.locale.split("-")[0];return e.documentationLabels[t]||e.documentationLabels.en||e.documentationLabels.nl||""}_escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}_ensureDialogStyles(){if(document.getElementById("jdf-concept-info-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-concept-info-dialog-styles",e.textContent="\n dialog.jdf-concept-info-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 480px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n /* JDF-118: don't rely on the UA's default margin:auto centering — a host page's\n * { margin: 0 } reset (index.html has one) wins over it and pins the dialog to the\n top-left corner. Position explicitly instead, independent of any margin. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-concept-info-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-dialog-header {\n background: #f0f2f5; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ddd;\n }\n .jdf-dialog-title { font-size: 15px; font-weight: 600; color: #333; margin: 0; font-family: inherit; }\n .jdf-dialog-close-btn {\n width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit;\n }\n .jdf-dialog-close-btn:hover { background: #ddd; color: #333; }\n .jdf-dialog-body { padding: 20px; }\n .jdf-info-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: inherit; }\n .jdf-info-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }\n .jdf-info-table td { padding: 9px 4px; vertical-align: top; }\n .jdf-info-label { font-weight: 600; color: #666; width: 40%; white-space: nowrap; padding-right: 16px; }\n .jdf-info-value { color: #333; word-break: break-all; }\n .jdf-info-value.doc-text { font-style: italic; color: #555; line-height: 1.5; word-break: normal; }\n .jdf-period-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }\n .jdf-period-pill.instant { background: rgba(25,118,210,0.1); color: #1565c0; border: 1px solid rgba(25,118,210,0.3); }\n .jdf-period-pill.duration { background: rgba(56,142,60,0.1); color: #2e7d32; border: 1px solid rgba(56,142,60,0.3); }\n .jdf-balance-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; text-transform: capitalize; }\n .jdf-balance-pill.debit { background: rgba(211,47,47,0.1); color: #c62828; border: 1px solid rgba(211,47,47,0.3); }\n .jdf-balance-pill.credit { background: rgba(56,142,60,0.1); color: #2e7d32; border: 1px solid rgba(56,142,60,0.3); }\n ",document.head.appendChild(e)}_openInfoDialog(e){var t;e.stopPropagation(),this._ensureDialogStyles();const i=this.concept.conceptMetadata,o=this._getDocLabel(),r=(null==i?void 0:i.periodType)||this.concept.periodType,n=(null==i?void 0:i.balance)||this.concept.balance,a="instant"===r?F.t("conceptInfo.instant"):F.t("conceptInfo.duration"),s=[{label:F.t("conceptInfo.conceptName"),valueHtml:this._escapeHtml((null==i?void 0:i.conceptName)||this.concept.name)},{label:F.t("conceptInfo.type"),valueHtml:this._escapeHtml((null==i?void 0:i.type)||this.concept.type||"—")}];(null==i?void 0:i.substitutionGroup)&&s.push({label:F.t("conceptInfo.substitutionGroup"),valueHtml:this._escapeHtml(i.substitutionGroup)}),s.push({label:F.t("conceptInfo.periodType"),valueHtml:`<span class="jdf-period-pill ${r}">${this._escapeHtml(a)}</span>`}),n&&s.push({label:F.t("conceptInfo.balance"),valueHtml:`<span class="jdf-balance-pill ${n}">${this._escapeHtml(n)}</span>`}),o&&s.push({label:F.t("conceptInfo.documentation"),valueHtml:this._escapeHtml(o),isDoc:!0});const l=s.map(e=>`\n <tr>\n <td class="jdf-info-label">${this._escapeHtml(e.label)}</td>\n <td class="jdf-info-value${e.isDoc?" doc-text":""}">${e.valueHtml}</td>\n </tr>\n `).join(""),d=document.createElement("dialog");d.className="jdf-concept-info-dialog",d.innerHTML=`\n <div class="jdf-dialog-header">\n <h3 class="jdf-dialog-title">${this._escapeHtml(F.t("conceptInfo.title"))}</h3>\n <button class="jdf-dialog-close-btn" type="button" aria-label="${this._escapeHtml(F.t("conceptInfo.close"))}">×</button>\n </div>\n <div class="jdf-dialog-body">\n <table class="jdf-info-table">${l}</table>\n </div>\n `,document.body.appendChild(d),null==(t=d.querySelector(".jdf-dialog-close-btn"))||t.addEventListener("click",()=>d.close()),d.addEventListener("click",e=>{const t=d.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&d.close()}),d.addEventListener("close",()=>document.body.removeChild(d)),d.showModal()}_ensureCalcWarningDialogStyles(){if(document.getElementById("jdf-calc-warning-dialog-styles"))return;const e=document.createElement("style");e.id="jdf-calc-warning-dialog-styles",e.textContent="\n dialog.jdf-calc-warning-dialog {\n border: none; border-radius: 8px; padding: 0;\n max-width: 480px; width: 90vw;\n box-shadow: 0 8px 32px rgba(0,0,0,0.2); overflow: hidden;\n /* JDF-118: see jdf-concept-info-dialog above — explicit centering, immune to host margin resets. */\n position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0;\n }\n dialog.jdf-calc-warning-dialog::backdrop { background: rgba(0,0,0,0.35); }\n .jdf-calc-warning-header {\n background: #fff3e0; padding: 14px 20px;\n display: flex; align-items: center; justify-content: space-between;\n border-bottom: 1px solid #ffcc80;\n }\n .jdf-calc-warning-title { font-size: 15px; font-weight: 600; color: #e65100; margin: 0; font-family: inherit; }\n .jdf-calc-warning-close-btn {\n width: 28px; height: 28px; border: none; background: transparent;\n font-size: 20px; line-height: 1; cursor: pointer; color: #666;\n border-radius: 4px; display: flex; align-items: center; justify-content: center;\n padding: 0; font-family: inherit;\n }\n .jdf-calc-warning-close-btn:hover { background: #ffe0b2; color: #e65100; }\n .jdf-calc-warning-body { padding: 20px; font-family: inherit; font-size: 13px; color: #333; }\n .jdf-calc-warning-summary { margin: 0 0 12px 0; font-weight: 600; }\n .jdf-calc-warning-table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: inherit; }\n .jdf-calc-warning-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }\n .jdf-calc-warning-table td { padding: 6px 4px; vertical-align: top; }\n .jdf-calc-warning-sign { font-weight: 600; white-space: nowrap; }\n .jdf-calc-warning-sign.added { color: #2e7d32; }\n .jdf-calc-warning-sign.subtracted { color: #c62828; }\n ",document.head.appendChild(e)}_handleDuplicateFactWarningBadgeClick(e,t){e.stopPropagation(),this.dispatchEvent(new CustomEvent("duplicate-fact-warning-click",{detail:{mismatch:t},bubbles:!0,composed:!0}))}_openCalculationWarningDialog(e,t){var i;e.stopPropagation(),this._ensureCalcWarningDialogStyles();const o=t.children.map(e=>`\n <tr>\n <td>${this._escapeHtml(e.label)}</td>\n <td>${this._escapeHtml(String(e.value))}</td>\n <td>${this._escapeHtml(e.balance||"—")}</td>\n <td class="jdf-calc-warning-sign ${1===e.weight?"added":"subtracted"}">\n ${this._escapeHtml(1===e.weight?F.t("calculationWarning.added"):F.t("calculationWarning.subtracted"))}\n </td>\n </tr>\n `).join(""),r=document.createElement("dialog");r.className="jdf-calc-warning-dialog",r.innerHTML=`\n <div class="jdf-calc-warning-header">\n <h3 class="jdf-calc-warning-title">⚠️ ${this._escapeHtml(F.t("calculationWarning.title"))}</h3>\n <button class="jdf-calc-warning-close-btn" type="button" aria-label="${this._escapeHtml(F.t("conceptInfo.close"))}">×</button>\n </div>\n <div class="jdf-calc-warning-body">\n <p class="jdf-calc-warning-summary">${this._escapeHtml(t.message)}</p>\n <table class="jdf-calc-warning-table">${o}</table>\n </div>\n `,document.body.appendChild(r),null==(i=r.querySelector(".jdf-calc-warning-close-btn"))||i.addEventListener("click",()=>r.close()),r.addEventListener("click",e=>{const t=r.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&r.close()}),r.addEventListener("close",()=>document.body.removeChild(r)),r.showModal()}render(){const t=this.concept.children&&this.concept.children.length>0,i=this.concept.level||0,o=this.concept.abstract||!1,r=E(this.concept.preferredLabel);return e.html`
|
|
905
906
|
<!-- Concept Name Cell (Left Column) -->
|
|
906
907
|
<td class="concept-name-cell ${o?"abstract":t?"":"leaf"} ${this.rowFocused?"row-focused":""}">
|
|
907
908
|
<div class="concept-content" style="--level: ${i}">
|
|
@@ -918,7 +919,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
918
919
|
${this.concept.balance?e.html`
|
|
919
920
|
<div class="concept-balance ${this.concept.balance}">${this.concept.balance}</div>
|
|
920
921
|
`:""}
|
|
921
|
-
<button class="concept-info-btn" type="button" tabindex="-1" title="${
|
|
922
|
+
<button class="concept-info-btn" type="button" tabindex="-1" title="${F.t("conceptInfo.title")}"
|
|
922
923
|
@click="${this._openInfoDialog}">ℹ</button>
|
|
923
924
|
${this.showAddButton?e.html`
|
|
924
925
|
<button class="repeat-btn" type="button" tabindex="-1" title="Add row"
|
|
@@ -932,32 +933,41 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
932
933
|
</td>
|
|
933
934
|
|
|
934
935
|
<!-- Input Field Cells (Period Columns) - Only for non-abstract concepts -->
|
|
935
|
-
${this.columns.map(t=>{var i,n,a,s,l;if(t.hidden)return e.html`<td class="field-cell hidden-column"></td>`;const
|
|
936
|
-
<td class="field-cell ${
|
|
937
|
-
${
|
|
936
|
+
${this.columns.map(t=>{var i,n,a,s,l,d;if(t.hidden)return e.html`<td class="field-cell hidden-column"></td>`;const c=this._getFieldForColumn(t.id),p=!o&&c,u=null==(n=null==(i=this.unitData)?void 0:i[this.concept.id])?void 0:n[t.id],h=null==(s=null==(a=this.decimalsData)?void 0:a[this.concept.id])?void 0:s[t.id],m="readonly"!==this.mode?null==(l=this.calculationMismatches)?void 0:l.get(`${this.concept.id}__${t.id}`):void 0,f="readonly"!==this.mode?null==(d=this.duplicateFactWarnings)?void 0:d.get(`${this.concept.id}__${t.id}`):void 0;return e.html`
|
|
937
|
+
<td class="field-cell ${p?"":"empty"} ${o?"abstract-row":""} ${r?"total-row":""} ${this.highlightType&&t.id===this.highlightColumnId?"highlight-"+this.highlightType:""} ${m?"calc-warning":""} ${f?"duplicate-fact-warning":""} ${this.rowFocused?"row-focused":""}">
|
|
938
|
+
${m?e.html`
|
|
938
939
|
<button
|
|
939
940
|
class="calc-warning-badge"
|
|
940
941
|
type="button"
|
|
941
942
|
tabindex="-1"
|
|
942
|
-
title="${
|
|
943
|
-
@click="${e=>this._openCalculationWarningDialog(e,
|
|
943
|
+
title="${m.message}"
|
|
944
|
+
@click="${e=>this._openCalculationWarningDialog(e,m)}"
|
|
944
945
|
>!</button>
|
|
945
946
|
`:""}
|
|
946
|
-
${
|
|
947
|
+
${f?e.html`
|
|
948
|
+
<button
|
|
949
|
+
class="duplicate-warning-badge"
|
|
950
|
+
type="button"
|
|
951
|
+
tabindex="-1"
|
|
952
|
+
title="${F.t("duplicateFactWarning.cellTooltip")}"
|
|
953
|
+
@click="${e=>this._handleDuplicateFactWarningBadgeClick(e,f)}"
|
|
954
|
+
>≠</button>
|
|
955
|
+
`:""}
|
|
956
|
+
${p?e.html`
|
|
947
957
|
<jupiter-form-field
|
|
948
|
-
.field="${
|
|
958
|
+
.field="${c}"
|
|
949
959
|
.conceptId="${this.concept.id}"
|
|
950
960
|
.conceptType="${this.concept.type}"
|
|
951
961
|
.datatypes="${this.datatypes}"
|
|
952
962
|
.defaultUnits="${this.defaultUnits}"
|
|
953
963
|
.columnId="${t.id}"
|
|
954
|
-
.value="${this._getFieldValue(
|
|
955
|
-
.unit="${
|
|
956
|
-
.decimals="${
|
|
964
|
+
.value="${this._getFieldValue(c)}"
|
|
965
|
+
.unit="${u||""}"
|
|
966
|
+
.decimals="${h}"
|
|
957
967
|
.globalDecimals="${this.globalDecimals}"
|
|
958
|
-
.periodStartDate="${
|
|
959
|
-
.periodEndDate="${
|
|
960
|
-
.periodInstantDate="${
|
|
968
|
+
.periodStartDate="${c.periodStartDate||t.periodStartDate}"
|
|
969
|
+
.periodEndDate="${c.periodEndDate||t.periodEndDate}"
|
|
970
|
+
.periodInstantDate="${c.periodInstantDate||("instant"===c.periodType?c.periodEndDate||c.periodStartDate:void 0)}"
|
|
961
971
|
.disabled="${this.disabled}"
|
|
962
972
|
.locale="${this.locale}"
|
|
963
973
|
.numberLocale="${this.numberLocale}"
|
|
@@ -1191,6 +1201,38 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1191
1201
|
background: #e65100;
|
|
1192
1202
|
}
|
|
1193
1203
|
|
|
1204
|
+
/* Live counterpart to the Validate pre-flight's duplicate-fact-value check — deliberately a
|
|
1205
|
+
distinct color from calc-warning's amber so the two non-blocking warnings never look like
|
|
1206
|
+
the same issue when both land on the same cell. */
|
|
1207
|
+
.field-cell.duplicate-fact-warning {
|
|
1208
|
+
box-shadow: inset 0 0 0 2px var(--jupiter-duplicate-warning-color, #8e24aa);
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.duplicate-warning-badge {
|
|
1212
|
+
position: absolute;
|
|
1213
|
+
top: 2px;
|
|
1214
|
+
left: 2px;
|
|
1215
|
+
width: 16px;
|
|
1216
|
+
height: 16px;
|
|
1217
|
+
border-radius: 50%;
|
|
1218
|
+
border: none;
|
|
1219
|
+
background: var(--jupiter-duplicate-warning-color, #8e24aa);
|
|
1220
|
+
color: #fff;
|
|
1221
|
+
font-size: 10px;
|
|
1222
|
+
font-weight: 700;
|
|
1223
|
+
line-height: 1;
|
|
1224
|
+
padding: 0;
|
|
1225
|
+
display: flex;
|
|
1226
|
+
align-items: center;
|
|
1227
|
+
justify-content: center;
|
|
1228
|
+
cursor: pointer;
|
|
1229
|
+
z-index: 3;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
.duplicate-warning-badge:hover {
|
|
1233
|
+
background: #6a1b9a;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1194
1236
|
/* Row-level highlight while a field in this row has focus. Applied to every
|
|
1195
1237
|
cell so the row stays identifiable even after the user scrolls the table
|
|
1196
1238
|
horizontally away from the focused input. */
|
|
@@ -1274,20 +1316,20 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1274
1316
|
animation: concept-row-highlight-pulse 10s ease-out forwards;
|
|
1275
1317
|
}
|
|
1276
1318
|
|
|
1277
|
-
`,
|
|
1319
|
+
`,Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"concept",2),Ge([S({type:Array})],exports.JupiterConceptTree.prototype,"columns",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"formData",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"periodData",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"unitData",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"decimalsData",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"globalDecimals",2),Ge([S({type:Array})],exports.JupiterConceptTree.prototype,"defaultUnits",2),Ge([S({type:Boolean})],exports.JupiterConceptTree.prototype,"disabled",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"locale",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"numberLocale",2),Ge([S({type:Set})],exports.JupiterConceptTree.prototype,"expandedConcepts",2),Ge([S({type:Array})],exports.JupiterConceptTree.prototype,"datatypes",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"mode",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"masterData",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"prefilledTooltip",2),Ge([S({type:Array})],exports.JupiterConceptTree.prototype,"facts",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"typedMemberData",2),Ge([S({type:Boolean})],exports.JupiterConceptTree.prototype,"showAddButton",2),Ge([S({type:Boolean})],exports.JupiterConceptTree.prototype,"showRemoveButton",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"highlightType",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"highlightColumnId",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"calculationMismatches",2),Ge([S({type:Object})],exports.JupiterConceptTree.prototype,"duplicateFactWarnings",2),Ge([S({type:String})],exports.JupiterConceptTree.prototype,"language",2),Ge([S({type:Boolean})],exports.JupiterConceptTree.prototype,"rowFocused",2),Ge([C()],exports.JupiterConceptTree.prototype,"_expanded",2),exports.JupiterConceptTree=Ge([t("jupiter-concept-tree")],exports.JupiterConceptTree);var Xe=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,et=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?Ze(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&Xe(t,i,n),n};exports.JupiterAddColumnDialog=class extends e.LitElement{constructor(){super(...arguments),this.periodType="duration",this.open=!1,this.availableDimensions=[],this.periodStartDate="",this.periodEndDate="",this._startDate="",this._endDate="",this._instantDate="",this._selectedType="duration",this._selectedDimensions=new Map,this._typedValueErrors={}}updated(e){e.has("open")&&this.open&&this._resetForm(),e.has("availableDimensions")}connectedCallback(){super.connectedCallback(),this._resetForm()}willUpdate(e){super.willUpdate(e),e.has("open")&&this.open&&this._resetForm()}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleConfirm(){if(!this._isFormValid())return;const e={periodType:"mixed"===this.periodType?"duration":this.periodType};"instant"===this.periodType?e.instantDate=this._instantDate:(e.startDate=this._startDate,e.endDate=this._endDate),this._selectedDimensions.size>0&&(e.selectedDimensions=Array.from(this._selectedDimensions.values())),this.dispatchEvent(new CustomEvent("column-add",{detail:e,bubbles:!0}))}_isFormValid(){return"mixed"===this.periodType||"duration"===this.periodType?!!this._startDate&&!!this._endDate&&this._startDate<=this._endDate:"instant"===this.periodType&&!!this._instantDate}_handleStartDateChange(e){this._startDate=e.target.value}_handleEndDateChange(e){this._endDate=e.target.value}_handleSelectedTypeChange(e){this._selectedType=e.target.value}_handleInstantDateChange(e){this._instantDate=e.target.value}_handleDimensionToggle(e,t){var i,o;if(t.target.checked){const t=this.availableDimensions.find(t=>t.id===e);if(t){const r={axisId:t.id,axisLabel:t.axisLabel,isTyped:!(!t.typedMember||t.members&&0!==t.members.length),dataType:null==(i=t.typedMember)?void 0:i.dataType,validation:null==(o=t.typedMember)?void 0:o.validation};this._selectedDimensions.set(e,r)}}else this._selectedDimensions.delete(e);this.requestUpdate()}_handleMemberSelection(e,t,i){const o=this._selectedDimensions.get(e);o&&(o.memberId=t,o.memberLabel=i,this._selectedDimensions.set(e,o),this.requestUpdate())}_handleTypedValueChange(e,t){const i=t.target,o=i instanceof HTMLInputElement&&"checkbox"===i.type?String(i.checked):i.value,r=this._selectedDimensions.get(e);r&&(r.typedValue=o,this._selectedDimensions.set(e,r))}_validateTypedValue(e,t,i,o){const r=e in this._typedValueErrors;if(!o){if(r){const t={...this._typedValueErrors};delete t[e],this._typedValueErrors=t}return}const n=i?Be.validateAgainstRules(o,i):Be.validateConceptValue(t,o,this.datatypes);if(n.valid){if(r){const t={...this._typedValueErrors};delete t[e],this._typedValueErrors=t}}else this._typedValueErrors={...this._typedValueErrors,[e]:n.errors}}_handleTypedValueBlur(e,t,i,o){const r=o.target,n=r instanceof HTMLInputElement&&"checkbox"===r.type?String(r.checked):r.value;this._validateTypedValue(e,t,i,n)}_renderTypedValueErrors(t){const i=this._typedValueErrors[t];return i&&0!==i.length?e.html`
|
|
1278
1320
|
<div class="typed-input-errors">
|
|
1279
1321
|
${i.map(t=>e.html`<span class="typed-input-error">${t.message}</span>`)}
|
|
1280
1322
|
</div>
|
|
1281
|
-
`:""}_getTypedValueInputConfig(e){return
|
|
1323
|
+
`:""}_getTypedValueInputConfig(e){return Pe(e,this.datatypes)}_renderTypedValueInput(t,i,o,r){var n;const a=this._getTypedValueInputConfig(i),s="typed-input "+(!!(null==(n=this._typedValueErrors[t])?void 0:n.length)?"has-error":""),l=e=>this._handleTypedValueChange(t,e),d=e=>this._handleTypedValueBlur(t,i,o,e);if("select"===a.fieldType||Ve(a.fieldType)){const t=a.enumerations||[];return e.html`
|
|
1282
1324
|
<select class="${s}" .value="${r}" @change="${l}" @blur="${d}">
|
|
1283
|
-
<option value="">${a.placeholder||
|
|
1325
|
+
<option value="">${a.placeholder||F.t("field.select")}</option>
|
|
1284
1326
|
${t.map(t=>e.html`
|
|
1285
1327
|
<option value="${t.value}" ?selected="${r===t.value}">
|
|
1286
1328
|
${t.label||t.value}
|
|
1287
1329
|
</option>
|
|
1288
1330
|
`)}
|
|
1289
1331
|
</select>
|
|
1290
|
-
`}if("boolean"===a.fieldType||
|
|
1332
|
+
`}if("boolean"===a.fieldType||Le(a.fieldType))return e.html`
|
|
1291
1333
|
<input
|
|
1292
1334
|
type="checkbox"
|
|
1293
1335
|
class="${s}"
|
|
@@ -1306,19 +1348,19 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1306
1348
|
step="${void 0!==a.step?a.step:""}"
|
|
1307
1349
|
@input="${l}"
|
|
1308
1350
|
@blur="${d}"
|
|
1309
|
-
placeholder="${a.placeholder||
|
|
1351
|
+
placeholder="${a.placeholder||F.t("column.enterValuePlaceholder")}"
|
|
1310
1352
|
/>
|
|
1311
1353
|
`}_resetForm(){this._startDate=this.periodStartDate||"",this._endDate=this.periodEndDate||"",this._instantDate=this.periodEndDate||this.periodStartDate||"",this._selectedType="instant"===this.periodType?"instant":"duration",this._selectedDimensions.clear(),this._typedValueErrors={},this._autoSelectSingleMemberDimensions(),this.requestUpdate()}_autoSelectSingleMemberDimensions(){this.availableDimensions.forEach(e=>{var t,i;if(e.members&&e.members.length>0){const t=e.members[0],i={axisId:e.id,axisLabel:e.axisLabel,memberId:t.id,memberLabel:t.label,isTyped:!1};this._selectedDimensions.set(e.id,i),e.axisLabel,t.label}else if(e.typedMember&&(!e.members||0===e.members.length)){const o={axisId:e.id,axisLabel:e.axisLabel,isTyped:!0,dataType:null==(t=e.typedMember)?void 0:t.dataType,validation:null==(i=e.typedMember)?void 0:i.validation};this._selectedDimensions.set(e.id,o),e.axisLabel}})}render(){if(!this.open)return e.html``;const t=this._isFormValid();return e.html`
|
|
1312
1354
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
1313
1355
|
<div class="dialog-header">
|
|
1314
|
-
<h2 class="dialog-title">${
|
|
1356
|
+
<h2 class="dialog-title">${F.t("column.addColumn")}</h2>
|
|
1315
1357
|
|
|
1316
1358
|
</div>
|
|
1317
1359
|
|
|
1318
1360
|
<div class="dialog-content">
|
|
1319
1361
|
${"instant"===this.periodType?e.html`
|
|
1320
1362
|
<div class="form-group">
|
|
1321
|
-
<label class="form-label required">${
|
|
1363
|
+
<label class="form-label required">${F.t("column.instantDate")}</label>
|
|
1322
1364
|
<div class="date-wrapper">
|
|
1323
1365
|
<input
|
|
1324
1366
|
type="date"
|
|
@@ -1339,7 +1381,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1339
1381
|
`:e.html`
|
|
1340
1382
|
<div class="form-group date-row">
|
|
1341
1383
|
<div class="date-field">
|
|
1342
|
-
<label class="form-label required">${
|
|
1384
|
+
<label class="form-label required">${F.t("column.startPeriodDate")}</label>
|
|
1343
1385
|
<div class="date-wrapper">
|
|
1344
1386
|
<input
|
|
1345
1387
|
type="date"
|
|
@@ -1358,7 +1400,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1358
1400
|
</div>
|
|
1359
1401
|
</div>
|
|
1360
1402
|
<div class="date-field">
|
|
1361
|
-
<label class="form-label required">${
|
|
1403
|
+
<label class="form-label required">${F.t("column.endPeriodDate")}</label>
|
|
1362
1404
|
<div class="date-wrapper">
|
|
1363
1405
|
<input
|
|
1364
1406
|
type="date"
|
|
@@ -1382,8 +1424,8 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1382
1424
|
<!-- Dimensions Section -->
|
|
1383
1425
|
${this.availableDimensions.length>0?e.html`
|
|
1384
1426
|
<div class="dimensions-section">
|
|
1385
|
-
<h3>${
|
|
1386
|
-
<p class="form-description">${
|
|
1427
|
+
<h3>${F.t("column.availableDimensions")}</h3>
|
|
1428
|
+
<p class="form-description">${F.t("column.dimensionsDescription")}</p>
|
|
1387
1429
|
|
|
1388
1430
|
${this.availableDimensions.map(t=>{var i,o;const r=this._selectedDimensions.has(t.id),n=this._selectedDimensions.get(t.id),a=!(!t.typedMember||t.members&&0!==t.members.length);return e.html`
|
|
1389
1431
|
<div class="dimension-item">
|
|
@@ -1405,7 +1447,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1405
1447
|
${a?e.html`
|
|
1406
1448
|
<!-- Typed Dimension Input -->
|
|
1407
1449
|
<div class="member-selection">
|
|
1408
|
-
<label>${
|
|
1450
|
+
<label>${F.t("column.enterValue")} ${t.conceptName}:</label>
|
|
1409
1451
|
${this._renderTypedValueInput(t.id,null==(i=t.typedMember)?void 0:i.dataType,null==(o=t.typedMember)?void 0:o.validation,(null==n?void 0:n.typedValue)||"")}
|
|
1410
1452
|
${this._renderTypedValueErrors(t.id)}
|
|
1411
1453
|
</div>
|
|
@@ -1413,7 +1455,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1413
1455
|
<!-- Domain Members Selection -->
|
|
1414
1456
|
${t.members&&t.members.length>0?e.html`
|
|
1415
1457
|
<div class="member-selection">
|
|
1416
|
-
<label>${
|
|
1458
|
+
<label>${F.t("column.selectMember")}</label>
|
|
1417
1459
|
<div class="member-list">
|
|
1418
1460
|
${t.members.map(i=>e.html`
|
|
1419
1461
|
<div class="member-option">
|
|
@@ -1432,7 +1474,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1432
1474
|
</div>
|
|
1433
1475
|
</div>
|
|
1434
1476
|
`:e.html`
|
|
1435
|
-
<p class="form-description">${
|
|
1477
|
+
<p class="form-description">${F.t("column.noMembersAvailable")}</p>
|
|
1436
1478
|
`}
|
|
1437
1479
|
`}
|
|
1438
1480
|
</div>
|
|
@@ -1445,14 +1487,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1445
1487
|
|
|
1446
1488
|
<div class="dialog-actions">
|
|
1447
1489
|
<button class="btn btn-cancel" @click="${this._handleCancel}">
|
|
1448
|
-
${
|
|
1490
|
+
${F.t("column.cancel")}
|
|
1449
1491
|
</button>
|
|
1450
1492
|
<button
|
|
1451
1493
|
class="btn btn-primary"
|
|
1452
1494
|
?disabled="${!t}"
|
|
1453
1495
|
@click="${this._handleConfirm}"
|
|
1454
1496
|
>
|
|
1455
|
-
${
|
|
1497
|
+
${F.t("column.addColumn")}
|
|
1456
1498
|
</button>
|
|
1457
1499
|
</div>
|
|
1458
1500
|
</div>
|
|
@@ -1773,11 +1815,11 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1773
1815
|
margin: 0 0 12px 0;
|
|
1774
1816
|
line-height: 1.4;
|
|
1775
1817
|
}
|
|
1776
|
-
`,Ze([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),Ze([S({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),Ze([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),Ze([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodStartDate",2),Ze([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodEndDate",2),Ze([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"datatypes",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),Ze([C()],exports.JupiterAddColumnDialog.prototype,"_typedValueErrors",2),exports.JupiterAddColumnDialog=Ze([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var et=Object.defineProperty,tt=Object.getOwnPropertyDescriptor,it=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?tt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&et(t,i,n),n};function ot(e,t){if(!e)return 0;const i=e.toLowerCase(),o=t.toLowerCase(),r=o.indexOf(i);if(-1!==r){const e=o[r-1];return 1e4-r+(0===r||!e||/[^a-z0-9]/.test(e)?500:0)}let n=0,a=0,s=0;for(let l=0;l<o.length&&n<i.length;l++)o[l]===i[n]?(n++,a++,s+=a):a=0;return n===i.length?s:-1}exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.decimalsData={},this.globalDecimals="INF",this.typedMemberData={},this.repeatCounts={},this.defaultUnits=[],this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.numberLocale="nl-NL",this.isFirstSection=!1,this.availableDimensions=[],this.hideHeader=!1,this.mode="inputForm",this.showFactsOnly=!1,this.periodStartDate="",this.periodEndDate="",this.language="en",this.calculationEnabled=!1,this.totalManuallyEditedData={},this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._openMenuColumnId=null,this._insertAfterColumnId=null,this._typedMemberErrors={},this._boundFieldBlur=e=>{if(this._clearHighlights(),this._focusedConceptId=null,"readonly"===this.mode||!this.calculationEnabled)return;const t=e.detail;(null==t?void 0:t.conceptId)&&(null==t?void 0:t.columnId)&&this._runCalculationCheck(t.conceptId,t.columnId)},this._expandedConcepts=new Set,this._allTreeExpanded=!1,this._highlightMap=new Map,this._focusedConceptId=null,this._calculationMismatches=new Map,this._balanceCheckTotals=null,this._totalChildrenMap=new Map,this._memberParentMap=new Map,this._totalConceptMap=new Map,this._totalChildConceptsMap=new Map,this._sessionManuallyEditedTotals=new Set}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType(),this._checkAndExpandFirstSection(),document.addEventListener("click",()=>this._closeColumnMenu()),this.addEventListener("field-blur",this._boundFieldBlur)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",()=>this._closeColumnMenu()),this.removeEventListener("field-blur",this._boundFieldBlur)}willUpdate(e){var t;super.willUpdate(e),(e.has("section")||e.has("calculationEnabled"))&&(this._balanceCheckTotals=this.calculationEnabled&&(null==(t=this.section)?void 0:t.concepts)?function(e){let t,i;const o=e=>{var r,n;for(const a of e){if(F(a.preferredLabel)){const e=(null==(r=a.conceptMetadata)?void 0:r.conceptName)??a.name;"jenv-bw2-i:Assets"===e?t=a.id:"jenv-bw2-i:EquityAndLiabilities"===e&&(i=a.id)}(null==(n=a.children)?void 0:n.length)&&o(a.children)}};return o(e),t&&i?{assetsConceptId:t,equityConceptId:i}:null}(this.section.concepts):null)}updated(e){var t;super.updated(e),(e.has("isFirstSection")||e.has("section"))&&this._checkAndExpandFirstSection(),(e.has("section")||e.has("calculationEnabled"))&&(this.calculationEnabled&&(null==(t=this.section)?void 0:t.concepts)?this._buildTotalMaps(this.section.concepts):this._clearCalculationState()),e.has("totalManuallyEditedData")&&this._sessionManuallyEditedTotals.clear()}_checkAndExpandFirstSection(){this.isFirstSection&&this.section&&this.section.concepts&&(this._expanded=!0,setTimeout(()=>{this._expandAllTrees()},0))}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return this._sectionPeriodType="duration",void this.section.id;const t=new Set(e.map(e=>e.periodType).filter(Boolean));if(0===t.size)this._sectionPeriodType="duration";else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration"}else this._sectionPeriodType="mixed"}_getAllNonAbstractConcepts(e){const t=[];for(const i of e)i.abstract||t.push(i),i.children&&t.push(...this._getAllNonAbstractConcepts(i.children));return t}_toggleExpanded(){this.collapsible&&(this._expanded=!this._expanded,this._expanded&&this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}async revealConcept(e){var t;const i=this._findAncestorIds((null==(t=this.section)?void 0:t.concepts)??[],e);if(!i)return!1;this._expanded||(this._expanded=!0,this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:!0},bubbles:!0})));const o=new Set([...this._expandedConcepts,...i]);if(o.size!==this._expandedConcepts.size){this._expandedConcepts=o;const e=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=e.length>0&&e.every(e=>o.has(e))}return await this.updateComplete,!0}_findAncestorIds(e,t,i=[]){var o;for(const r of e){if(r.id===t)return i;if(null==(o=r.children)?void 0:o.length){const e=this._findAncestorIds(r.children,t,[...i,r.id]);if(e)return e}}return null}_handleRemoveColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleHideColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-hide",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleShowColumn(e){this.dispatchEvent(new CustomEvent("column-show",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_toggleColumnMenu(e,t){t.stopPropagation(),this._openMenuColumnId=this._openMenuColumnId===e?null:e}_closeColumnMenu(){this._openMenuColumnId=null}_handleAddColumnFromMenu(e,t){t.stopPropagation(),this._openMenuColumnId=null,this._insertAfterColumnId=e,this._handleAddColumn()}_handleAddColumn(){const e=this._determineButtonPeriodType();this._sectionPeriodType=e,this._showAddColumnDialog=!0}_determineButtonPeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return"duration";const t=new Set(e.map(e=>e.periodType).filter(e=>null!=e));if(0===t.size)return"duration";if(1===t.size){return"instant"===Array.from(t)[0]?"instant":"duration"}return"mixed"}_getConceptsWithFields(e){const t=[];for(const i of e)!i.abstract&&i.fields&&i.fields.length>0&&t.push(i),i.children&&t.push(...this._getConceptsWithFields(i.children));return t}_handleDialogCancel(){this._showAddColumnDialog=!1}_handleColumnAdd(e){e.stopPropagation(),this._showAddColumnDialog=!1,this.dispatchEvent(new CustomEvent("column-add-request",{detail:{sectionId:this.section.id,columnRequest:e.detail,insertAfterColumnId:this._insertAfterColumnId},bubbles:!0})),this._insertAfterColumnId=null}_handleFieldChange(e){e.stopPropagation();const{conceptId:t,columnId:i}=e.detail||{};t&&i&&this._totalConceptMap.has(t)&&(this._sessionManuallyEditedTotals.add(`${t}__${i}`),this.dispatchEvent(new CustomEvent("total-manually-edited",{detail:{conceptId:t,columnId:i},bubbles:!0,composed:!0}))),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0,composed:!0}))}_handlePeriodChange(e){e.detail,e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0}))}_flattenConcepts(e,t=new Set){const i=[];for(const o of e)if(i.push(o),o.children&&o.children.length>0&&t.has(o.id)){const e=this._flattenConcepts(o.children,t);i.push(...e)}return i}_isTotalManuallyEdited(e,t){var i,o;const r=`${e}__${t}`;return!!this._sessionManuallyEditedTotals.has(r)||!0===(null==(o=null==(i=this.totalManuallyEditedData)?void 0:i[e])?void 0:o[t])}_isConceptRowBlank(e){var t;for(const i of this.columns){const o=null==(t=this.formData[e.id])?void 0:t[i.id];if(null!=o&&""!==o)return!1}return!0}_getAllConceptIds(e){const t=[];for(const i of e)i.children&&i.children.length>0&&(t.push(i.id),t.push(...this._getAllConceptIds(i.children)));return t}_expandAllTrees(){const e=this._getAllConceptIds(this.section.concepts||[]);this._expandedConcepts=new Set([...this._expandedConcepts,...e]),this._allTreeExpanded=!0}_collapseAllTrees(){this._expandedConcepts=new Set,this._allTreeExpanded=!1}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail,o=new Set(this._expandedConcepts);i?o.add(t):o.delete(t),this._expandedConcepts=o;const r=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=r.length>0&&r.every(e=>o.has(e)),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_buildTotalMaps(e){this._totalChildrenMap.clear(),this._memberParentMap.clear(),this._totalConceptMap.clear(),this._totalChildConceptsMap.clear(),this._traverseTotalGroups(e)}_clearCalculationState(){this._totalChildrenMap.clear(),this._memberParentMap.clear(),this._totalConceptMap.clear(),this._totalChildConceptsMap.clear();for(const e of Array.from(this._calculationMismatches.keys()))this._clearCalculationMismatch(e)}static _isTotalLabel(e){return F(e)}static _isNegatedTotalLabel(e){return!!(null==e?void 0:e.toLowerCase().includes("negatedtotallabel"))}static _resolveValueConcept(e,t=0){var i;if(!e.abstract)return e;if(t>5||!(null==(i=e.children)?void 0:i.length))return null;const o=e.children.find(e=>exports.JupiterFormSection._isTotalLabel(e.preferredLabel));return o?exports.JupiterFormSection._resolveValueConcept(o,t+1):null}_registerTotalGroup(e,t){const i=t.map(e=>exports.JupiterFormSection._resolveValueConcept(e)).filter(e=>null!==e);if(0===i.length)return;const o=i.map(e=>e.id);this._totalChildrenMap.set(e.id,o),this._totalConceptMap.set(e.id,e),this._totalChildConceptsMap.set(e.id,i);for(const r of o)this._memberParentMap.set(r,e.id)}_resolveTotalGroupMembers(e,t,i,o){if(i<0)return o;const r=e[t];if(exports.JupiterFormSection._isNegatedTotalLabel(r.preferredLabel))return o.length>0?o:[e[i]];if(o.length>0)return[e[i],...o];if(exports.JupiterFormSection._isNegatedTotalLabel(e[i].preferredLabel)){let t=-1;for(let o=i-1;o>=0;o--)if(exports.JupiterFormSection._isTotalLabel(e[o].preferredLabel)){t=o;break}return t>=0?[e[t],e[i]]:[e[i]]}return[e[i]]}_traverseTotalGroups(e){var t,i;for(let o=0;o<e.length;o++){const r=e[o];if(exports.JupiterFormSection._isTotalLabel(r.preferredLabel))if(null==(t=r.children)?void 0:t.length)this._registerTotalGroup(r,r.children);else{let t=-1;for(let r=o-1;r>=0;r--)if(exports.JupiterFormSection._isTotalLabel(e[r].preferredLabel)){t=r;break}const i=e.slice(t+1,o),n=this._resolveTotalGroupMembers(e,o,t,i);n.length>0&&this._registerTotalGroup(r,n)}(null==(i=r.children)?void 0:i.length)&&this._traverseTotalGroups(r.children)}}_runCalculationCheck(e,t){const i=new Set;this._totalConceptMap.has(e)&&i.add(e);const o=this._memberParentMap.get(e);o&&i.add(o);for(const r of i)this._evaluateTotal(r,t)}_evaluateTotal(e,t){var i,o;const r=this._totalConceptMap.get(e),n=`${e}__${t}`,a=this._totalChildConceptsMap.get(e)||[],{calculatedSum:s,hasAnyValue:l,breakdown:d}=this._buildCalculationBreakdown(a,this.formData,t,r.balance);if(!this._isTotalManuallyEdited(e,t)){if(l){const o=null==(i=this.formData[e])?void 0:i[t],r=parseFloat(o);(null==o||""===o||isNaN(r)||!exports.JupiterFormSection._checkTotal(r,s))&&this._dispatchCalculationTotalAutoPopulated(e,t,s)}return void this._clearCalculationMismatch(n)}const c=null==(o=this.formData[e])?void 0:o[t];if(null==c||""===c)return void this._clearCalculationMismatch(n);const p=parseFloat(c);if(isNaN(p))return void this._clearCalculationMismatch(n);if(!l||exports.JupiterFormSection._checkTotal(p,s))return void this._clearCalculationMismatch(n);const u={totalConceptId:e,totalLabel:r.label,columnId:t,sectionId:this.section.id,enteredTotal:p,calculatedSum:s,children:d},h={...u,message:exports.JupiterFormSection._buildMismatchMessage(u)},m=new Map(this._calculationMismatches);m.set(n,h),this._calculationMismatches=m,this._dispatchCalculationMismatchChanged(n,h)}_dispatchCalculationTotalAutoPopulated(e,t,i){this.dispatchEvent(new CustomEvent("calculation-total-auto-populated",{detail:{conceptId:e,columnId:t,value:i,sectionId:this.section.id},bubbles:!0,composed:!0}))}_clearCalculationMismatch(e){if(!this._calculationMismatches.has(e))return;const t=new Map(this._calculationMismatches);t.delete(e),this._calculationMismatches=t,this._dispatchCalculationMismatchChanged(e,null)}_dispatchCalculationMismatchChanged(e,t){this.dispatchEvent(new CustomEvent("calculation-mismatch-changed",{detail:{key:e,mismatch:t},bubbles:!0,composed:!0}))}static _resolveWeight(e,t){return e&&t&&e!==t?-1:1}_resolveMemberContributions(e,t,i,o,r,n=0){var a;const s=parseFloat(null==(a=i[e.id])?void 0:a[o]);if(!isNaN(s))return[{conceptId:e.id,label:e.label,value:s,balance:e.balance,weight:t}];if(n>=5||r.has(e.id))return[];const l=this._totalChildConceptsMap.get(e.id);if(!l)return[];const d=new Set(r).add(e.id),c=[];for(const p of l){const r=t*exports.JupiterFormSection._resolveWeight(e.balance,p.balance);c.push(...this._resolveMemberContributions(p,r,i,o,d,n+1))}return c}_buildCalculationBreakdown(e,t,i,o){let r=0,n=!1;const a=[];for(const s of e){const e=exports.JupiterFormSection._resolveWeight(o,s.balance),l=this._resolveMemberContributions(s,e,t,i,new Set);for(const t of l)r+=t.weight*t.value,n=!0,a.push(t)}return{calculatedSum:r,hasAnyValue:n,breakdown:a}}static _checkTotal(e,t){return Math.abs(t-e)<M}static _formatNumber(e){return Number.isInteger(e)?String(e):e.toFixed(2)}static _buildMismatchMessage(e){const t=E.t("calculationWarning.summaryLine",{label:e.totalLabel,calculated:exports.JupiterFormSection._formatNumber(e.calculatedSum),entered:exports.JupiterFormSection._formatNumber(e.enteredTotal)});if(0===e.children.length)return t;const i=e.children.map(e=>E.t(1===e.weight?"calculationWarning.childAdded":"calculationWarning.childSubtracted",{label:e.label,value:exports.JupiterFormSection._formatNumber(e.value)}));return`${t} ${E.t("calculationWarning.childrenPrefix")} ${i.join("; ")}`}_handleFieldFocusForHighlight(e){var t,i;const o=null==(t=e.detail)?void 0:t.conceptId,r=null==(i=e.detail)?void 0:i.columnId;if(!o||!r)return;this._focusedConceptId=o;const n=new Map;if(this._totalChildrenMap.has(o)){n.set(o,{type:"total",columnId:r});for(const e of this._totalChildrenMap.get(o))n.set(e,{type:"member",columnId:r})}else{const e=this._memberParentMap.get(o);if(e){n.set(e,{type:"total",columnId:r});for(const t of this._totalChildrenMap.get(e))n.set(t,{type:"member",columnId:r})}}this._highlightMap=n}_clearHighlights(){this._highlightMap.size>0&&(this._highlightMap=new Map)}_handleBalanceCheckClick(e){var t,i,o;if(!this._balanceCheckTotals)return;const{assetsConceptId:r,equityConceptId:n}=this._balanceCheckTotals,a=new Map(this._highlightMap);a.set(r,{type:"total",columnId:e}),a.set(n,{type:"total",columnId:e}),this._highlightMap=a;const s=Array.from((null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-concept-tree"))??[]);let l=null;for(const c of s){if(l=Array.from((null==(i=c.shadowRoot)?void 0:i.querySelectorAll("jupiter-form-field"))??[]).find(t=>t.conceptId===r&&t.columnId===e),l)break}if(!l)return;l.scrollIntoView({behavior:"smooth",block:"center"});const d=null==(o=this.shadowRoot)?void 0:o.querySelector(".table-container");if(d&&d.scrollWidth>d.clientWidth){const e=l.getBoundingClientRect(),t=d.getBoundingClientRect(),i=Math.max(0,e.left-t.left+d.scrollLeft-d.clientWidth/2+e.width/2);d.scrollTo({left:i,behavior:"smooth"})}}_formatBalanceDifferenceAmount(e){try{return new Intl.NumberFormat(this.locale,{maximumFractionDigits:2}).format(Math.abs(e))}catch{return exports.JupiterFormSection._formatNumber(Math.abs(e))}}_renderBalanceCheckStrip(){if(!this.calculationEnabled||!this._balanceCheckTotals)return"";const t=function(e,t,i){var o,r;const n=[];for(const a of t){if(a.hidden)continue;const t=parseFloat(null==(o=e[i.assetsConceptId])?void 0:o[a.id]),s=parseFloat(null==(r=e[i.equityConceptId])?void 0:r[a.id]);if(isNaN(t)||isNaN(s))continue;const l=t-s,d=a.description&&a.description!==a.title?`${a.title} ${a.description}`:a.title;n.push({columnId:a.id,columnLabel:d,assetsValue:t,equityValue:s,difference:l,balanced:Math.abs(l)<M})}return n}(this.formData,this.columns,this._balanceCheckTotals);return 0===t.length?"":e.html`
|
|
1818
|
+
`,et([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodType",2),et([S({type:Boolean})],exports.JupiterAddColumnDialog.prototype,"open",2),et([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"availableDimensions",2),et([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodStartDate",2),et([S({type:String})],exports.JupiterAddColumnDialog.prototype,"periodEndDate",2),et([S({type:Array})],exports.JupiterAddColumnDialog.prototype,"datatypes",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_startDate",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_endDate",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_instantDate",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_selectedType",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_selectedDimensions",2),et([C()],exports.JupiterAddColumnDialog.prototype,"_typedValueErrors",2),exports.JupiterAddColumnDialog=et([t("jupiter-add-column-dialog")],exports.JupiterAddColumnDialog);var tt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ot=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?it(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&tt(t,i,n),n};function rt(e,t){if(!e)return 0;const i=e.toLowerCase(),o=t.toLowerCase(),r=o.indexOf(i);if(-1!==r){const e=o[r-1];return 1e4-r+(0===r||!e||/[^a-z0-9]/.test(e)?500:0)}let n=0,a=0,s=0;for(let l=0;l<o.length&&n<i.length;l++)o[l]===i[n]?(n++,a++,s+=a):a=0;return n===i.length?s:-1}exports.JupiterFormSection=class extends e.LitElement{constructor(){super(...arguments),this.columns=[],this.formData={},this.periodData={},this.unitData={},this.decimalsData={},this.globalDecimals="INF",this.typedMemberData={},this.repeatCounts={},this.defaultUnits=[],this.disabled=!1,this.collapsible=!0,this.locale="en-US",this.numberLocale="nl-NL",this.isFirstSection=!1,this.availableDimensions=[],this.hideHeader=!1,this.mode="inputForm",this.showFactsOnly=!1,this.periodStartDate="",this.periodEndDate="",this.language="en",this.calculationEnabled=!1,this.totalManuallyEditedData={},this._expanded=!0,this._showAddColumnDialog=!1,this._sectionPeriodType="duration",this._openMenuColumnId=null,this._insertAfterColumnId=null,this._typedMemberErrors={},this._boundFieldBlur=e=>{if(this._clearHighlights(),this._focusedConceptId=null,"readonly"===this.mode||!this.calculationEnabled)return;const t=e.detail;(null==t?void 0:t.conceptId)&&(null==t?void 0:t.columnId)&&this._runCalculationCheck(t.conceptId,t.columnId)},this._expandedConcepts=new Set,this._allTreeExpanded=!1,this._highlightMap=new Map,this._focusedConceptId=null,this._calculationMismatches=new Map,this._balanceCheckTotals=null,this._totalChildrenMap=new Map,this._memberParentMap=new Map,this._totalConceptMap=new Map,this._totalChildConceptsMap=new Map,this._sessionManuallyEditedTotals=new Set}connectedCallback(){super.connectedCallback(),this._expanded=!1!==this.section.expanded,this._determinePeriodType(),this._checkAndExpandFirstSection(),document.addEventListener("click",()=>this._closeColumnMenu()),this.addEventListener("field-blur",this._boundFieldBlur)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",()=>this._closeColumnMenu()),this.removeEventListener("field-blur",this._boundFieldBlur)}willUpdate(e){var t;super.willUpdate(e),(e.has("section")||e.has("calculationEnabled"))&&(this._balanceCheckTotals=this.calculationEnabled&&(null==(t=this.section)?void 0:t.concepts)?function(e){let t,i;const o=e=>{var r,n;for(const a of e){if(E(a.preferredLabel)){const e=(null==(r=a.conceptMetadata)?void 0:r.conceptName)??a.name;"jenv-bw2-i:Assets"===e?t=a.id:"jenv-bw2-i:EquityAndLiabilities"===e&&(i=a.id)}(null==(n=a.children)?void 0:n.length)&&o(a.children)}};return o(e),t&&i?{assetsConceptId:t,equityConceptId:i}:null}(this.section.concepts):null)}updated(e){var t;super.updated(e),(e.has("isFirstSection")||e.has("section"))&&this._checkAndExpandFirstSection(),(e.has("section")||e.has("calculationEnabled"))&&(this.calculationEnabled&&(null==(t=this.section)?void 0:t.concepts)?this._buildTotalMaps(this.section.concepts):this._clearCalculationState()),e.has("totalManuallyEditedData")&&this._sessionManuallyEditedTotals.clear()}_checkAndExpandFirstSection(){this.isFirstSection&&this.section&&this.section.concepts&&(this._expanded=!0,setTimeout(()=>{this._expandAllTrees()},0))}_determinePeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return this._sectionPeriodType="duration",void this.section.id;const t=new Set(e.map(e=>e.periodType).filter(Boolean));if(0===t.size)this._sectionPeriodType="duration";else if(1===t.size){const e=Array.from(t)[0];this._sectionPeriodType="instant"===e?"instant":"duration"}else this._sectionPeriodType="mixed"}_getAllNonAbstractConcepts(e){const t=[];for(const i of e)i.abstract||t.push(i),i.children&&t.push(...this._getAllNonAbstractConcepts(i.children));return t}_toggleExpanded(){this.collapsible&&(this._expanded=!this._expanded,this._expanded&&this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:this._expanded},bubbles:!0})))}async revealConcept(e){var t;const i=this._findAncestorIds((null==(t=this.section)?void 0:t.concepts)??[],e);if(!i)return!1;this._expanded||(this._expanded=!0,this._expandAllTrees(),this.dispatchEvent(new CustomEvent("section-expand",{detail:{sectionId:this.section.id,expanded:!0},bubbles:!0})));const o=new Set([...this._expandedConcepts,...i]);if(o.size!==this._expandedConcepts.size){this._expandedConcepts=o;const e=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=e.length>0&&e.every(e=>o.has(e))}return await this.updateComplete,!0}_findAncestorIds(e,t,i=[]){var o;for(const r of e){if(r.id===t)return i;if(null==(o=r.children)?void 0:o.length){const e=this._findAncestorIds(r.children,t,[...i,r.id]);if(e)return e}}return null}_handleRemoveColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleHideColumn(e){this._openMenuColumnId=null,this.dispatchEvent(new CustomEvent("column-hide",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_handleShowColumn(e){this.dispatchEvent(new CustomEvent("column-show",{detail:{columnId:e,sectionId:this.section.id},bubbles:!0}))}_toggleColumnMenu(e,t){t.stopPropagation(),this._openMenuColumnId=this._openMenuColumnId===e?null:e}_closeColumnMenu(){this._openMenuColumnId=null}_handleAddColumnFromMenu(e,t){t.stopPropagation(),this._openMenuColumnId=null,this._insertAfterColumnId=e,this._handleAddColumn()}_handleAddColumn(){const e=this._determineButtonPeriodType();this._sectionPeriodType=e,this._showAddColumnDialog=!0}_determineButtonPeriodType(){const e=this._getAllNonAbstractConcepts(this.section.concepts);if(0===e.length)return"duration";const t=new Set(e.map(e=>e.periodType).filter(e=>null!=e));if(0===t.size)return"duration";if(1===t.size){return"instant"===Array.from(t)[0]?"instant":"duration"}return"mixed"}_getConceptsWithFields(e){const t=[];for(const i of e)!i.abstract&&i.fields&&i.fields.length>0&&t.push(i),i.children&&t.push(...this._getConceptsWithFields(i.children));return t}_handleDialogCancel(){this._showAddColumnDialog=!1}_handleColumnAdd(e){e.stopPropagation(),this._showAddColumnDialog=!1,this.dispatchEvent(new CustomEvent("column-add-request",{detail:{sectionId:this.section.id,columnRequest:e.detail,insertAfterColumnId:this._insertAfterColumnId},bubbles:!0})),this._insertAfterColumnId=null}_handleFieldChange(e){e.stopPropagation();const{conceptId:t,columnId:i}=e.detail||{};t&&i&&this._totalConceptMap.has(t)&&(this._sessionManuallyEditedTotals.add(`${t}__${i}`),this.dispatchEvent(new CustomEvent("total-manually-edited",{detail:{conceptId:t,columnId:i},bubbles:!0,composed:!0}))),this.dispatchEvent(new CustomEvent("field-change",{detail:e.detail,bubbles:!0,composed:!0}))}_handlePeriodChange(e){e.detail,e.stopPropagation(),this.dispatchEvent(new CustomEvent("period-change",{detail:e.detail,bubbles:!0,composed:!0}))}_flattenConcepts(e,t=new Set){const i=[];for(const o of e)if(i.push(o),o.children&&o.children.length>0&&t.has(o.id)){const e=this._flattenConcepts(o.children,t);i.push(...e)}return i}_isTotalManuallyEdited(e,t){var i,o;const r=`${e}__${t}`;return!!this._sessionManuallyEditedTotals.has(r)||!0===(null==(o=null==(i=this.totalManuallyEditedData)?void 0:i[e])?void 0:o[t])}_isConceptRowBlank(e){var t;for(const i of this.columns){const o=null==(t=this.formData[e.id])?void 0:t[i.id];if(null!=o&&""!==o)return!1}return!0}_getAllConceptIds(e){const t=[];for(const i of e)i.children&&i.children.length>0&&(t.push(i.id),t.push(...this._getAllConceptIds(i.children)));return t}_expandAllTrees(){const e=this._getAllConceptIds(this.section.concepts||[]);this._expandedConcepts=new Set([...this._expandedConcepts,...e]),this._allTreeExpanded=!0}_collapseAllTrees(){this._expandedConcepts=new Set,this._allTreeExpanded=!1}_handleConceptExpand(e){e.stopPropagation();const{conceptId:t,expanded:i}=e.detail,o=new Set(this._expandedConcepts);i?o.add(t):o.delete(t),this._expandedConcepts=o;const r=this._getAllConceptIds(this.section.concepts||[]);this._allTreeExpanded=r.length>0&&r.every(e=>o.has(e)),this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_buildTotalMaps(e){this._totalChildrenMap.clear(),this._memberParentMap.clear(),this._totalConceptMap.clear(),this._totalChildConceptsMap.clear(),this._traverseTotalGroups(e)}_clearCalculationState(){this._totalChildrenMap.clear(),this._memberParentMap.clear(),this._totalConceptMap.clear(),this._totalChildConceptsMap.clear();for(const e of Array.from(this._calculationMismatches.keys()))this._clearCalculationMismatch(e)}static _isTotalLabel(e){return E(e)}static _isNegatedTotalLabel(e){return!!(null==e?void 0:e.toLowerCase().includes("negatedtotallabel"))}static _resolveValueConcept(e,t=0){var i;if(!e.abstract)return e;if(t>5||!(null==(i=e.children)?void 0:i.length))return null;const o=e.children.find(e=>exports.JupiterFormSection._isTotalLabel(e.preferredLabel));return o?exports.JupiterFormSection._resolveValueConcept(o,t+1):null}_registerTotalGroup(e,t){const i=t.map(e=>exports.JupiterFormSection._resolveValueConcept(e)).filter(e=>null!==e);if(0===i.length)return;const o=i.map(e=>e.id);this._totalChildrenMap.set(e.id,o),this._totalConceptMap.set(e.id,e),this._totalChildConceptsMap.set(e.id,i);for(const r of o)this._memberParentMap.set(r,e.id)}_resolveTotalGroupMembers(e,t,i,o){if(i<0)return o;const r=e[t];if(exports.JupiterFormSection._isNegatedTotalLabel(r.preferredLabel))return o.length>0?o:[e[i]];if(o.length>0)return[e[i],...o];if(exports.JupiterFormSection._isNegatedTotalLabel(e[i].preferredLabel)){let t=-1;for(let o=i-1;o>=0;o--)if(exports.JupiterFormSection._isTotalLabel(e[o].preferredLabel)){t=o;break}return t>=0?[e[t],e[i]]:[e[i]]}return[e[i]]}_traverseTotalGroups(e){var t,i;for(let o=0;o<e.length;o++){const r=e[o];if(exports.JupiterFormSection._isTotalLabel(r.preferredLabel))if(null==(t=r.children)?void 0:t.length)this._registerTotalGroup(r,r.children);else{let t=-1;for(let r=o-1;r>=0;r--)if(exports.JupiterFormSection._isTotalLabel(e[r].preferredLabel)){t=r;break}const i=e.slice(t+1,o),n=this._resolveTotalGroupMembers(e,o,t,i);n.length>0&&this._registerTotalGroup(r,n)}(null==(i=r.children)?void 0:i.length)&&this._traverseTotalGroups(r.children)}}_runCalculationCheck(e,t){const i=new Set;this._totalConceptMap.has(e)&&i.add(e);const o=this._memberParentMap.get(e);o&&i.add(o);for(const r of i)this._evaluateTotal(r,t)}_evaluateTotal(e,t){var i,o;const r=this._totalConceptMap.get(e),n=`${e}__${t}`,a=this._totalChildConceptsMap.get(e)||[],{calculatedSum:s,hasAnyValue:l,breakdown:d}=this._buildCalculationBreakdown(a,this.formData,t,r.balance);if(!this._isTotalManuallyEdited(e,t)){if(l){const o=null==(i=this.formData[e])?void 0:i[t],r=parseFloat(o);(null==o||""===o||isNaN(r)||!exports.JupiterFormSection._checkTotal(r,s))&&this._dispatchCalculationTotalAutoPopulated(e,t,s)}return void this._clearCalculationMismatch(n)}const c=null==(o=this.formData[e])?void 0:o[t];if(null==c||""===c)return void this._clearCalculationMismatch(n);const p=parseFloat(c);if(isNaN(p))return void this._clearCalculationMismatch(n);if(!l||exports.JupiterFormSection._checkTotal(p,s))return void this._clearCalculationMismatch(n);const u={totalConceptId:e,totalLabel:r.label,columnId:t,sectionId:this.section.id,enteredTotal:p,calculatedSum:s,children:d},h={...u,message:exports.JupiterFormSection._buildMismatchMessage(u)},m=new Map(this._calculationMismatches);m.set(n,h),this._calculationMismatches=m,this._dispatchCalculationMismatchChanged(n,h)}_dispatchCalculationTotalAutoPopulated(e,t,i){this.dispatchEvent(new CustomEvent("calculation-total-auto-populated",{detail:{conceptId:e,columnId:t,value:i,sectionId:this.section.id},bubbles:!0,composed:!0}))}_clearCalculationMismatch(e){if(!this._calculationMismatches.has(e))return;const t=new Map(this._calculationMismatches);t.delete(e),this._calculationMismatches=t,this._dispatchCalculationMismatchChanged(e,null)}_dispatchCalculationMismatchChanged(e,t){this.dispatchEvent(new CustomEvent("calculation-mismatch-changed",{detail:{key:e,mismatch:t},bubbles:!0,composed:!0}))}static _resolveWeight(e,t){return e&&t&&e!==t?-1:1}_resolveMemberContributions(e,t,i,o,r,n=0){var a;const s=parseFloat(null==(a=i[e.id])?void 0:a[o]);if(!isNaN(s))return[{conceptId:e.id,label:e.label,value:s,balance:e.balance,weight:t}];if(n>=5||r.has(e.id))return[];const l=this._totalChildConceptsMap.get(e.id);if(!l)return[];const d=new Set(r).add(e.id),c=[];for(const p of l){const r=t*exports.JupiterFormSection._resolveWeight(e.balance,p.balance);c.push(...this._resolveMemberContributions(p,r,i,o,d,n+1))}return c}_buildCalculationBreakdown(e,t,i,o){let r=0,n=!1;const a=[];for(const s of e){const e=exports.JupiterFormSection._resolveWeight(o,s.balance),l=this._resolveMemberContributions(s,e,t,i,new Set);for(const t of l)r+=t.weight*t.value,n=!0,a.push(t)}return{calculatedSum:r,hasAnyValue:n,breakdown:a}}static _checkTotal(e,t){return Math.abs(t-e)<M}static _formatNumber(e){return Number.isInteger(e)?String(e):e.toFixed(2)}static _buildMismatchMessage(e){const t=F.t("calculationWarning.summaryLine",{label:e.totalLabel,calculated:exports.JupiterFormSection._formatNumber(e.calculatedSum),entered:exports.JupiterFormSection._formatNumber(e.enteredTotal)});if(0===e.children.length)return t;const i=e.children.map(e=>F.t(1===e.weight?"calculationWarning.childAdded":"calculationWarning.childSubtracted",{label:e.label,value:exports.JupiterFormSection._formatNumber(e.value)}));return`${t} ${F.t("calculationWarning.childrenPrefix")} ${i.join("; ")}`}_handleFieldFocusForHighlight(e){var t,i;const o=null==(t=e.detail)?void 0:t.conceptId,r=null==(i=e.detail)?void 0:i.columnId;if(!o||!r)return;this._focusedConceptId=o;const n=new Map;if(this._totalChildrenMap.has(o)){n.set(o,{type:"total",columnId:r});for(const e of this._totalChildrenMap.get(o))n.set(e,{type:"member",columnId:r})}else{const e=this._memberParentMap.get(o);if(e){n.set(e,{type:"total",columnId:r});for(const t of this._totalChildrenMap.get(e))n.set(t,{type:"member",columnId:r})}}this._highlightMap=n}_clearHighlights(){this._highlightMap.size>0&&(this._highlightMap=new Map)}_handleBalanceCheckClick(e){var t,i,o;if(!this._balanceCheckTotals)return;const{assetsConceptId:r,equityConceptId:n}=this._balanceCheckTotals,a=new Map(this._highlightMap);a.set(r,{type:"total",columnId:e}),a.set(n,{type:"total",columnId:e}),this._highlightMap=a;const s=Array.from((null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-concept-tree"))??[]);let l=null;for(const c of s){if(l=Array.from((null==(i=c.shadowRoot)?void 0:i.querySelectorAll("jupiter-form-field"))??[]).find(t=>t.conceptId===r&&t.columnId===e),l)break}if(!l)return;l.scrollIntoView({behavior:"smooth",block:"center"});const d=null==(o=this.shadowRoot)?void 0:o.querySelector(".table-container");if(d&&d.scrollWidth>d.clientWidth){const e=l.getBoundingClientRect(),t=d.getBoundingClientRect(),i=Math.max(0,e.left-t.left+d.scrollLeft-d.clientWidth/2+e.width/2);d.scrollTo({left:i,behavior:"smooth"})}}_formatBalanceDifferenceAmount(e){try{return new Intl.NumberFormat(this.locale,{maximumFractionDigits:2}).format(Math.abs(e))}catch{return exports.JupiterFormSection._formatNumber(Math.abs(e))}}_renderBalanceCheckStrip(){if(!this.calculationEnabled||!this._balanceCheckTotals)return"";const t=function(e,t,i){var o,r;const n=[];for(const a of t){if(a.hidden)continue;const t=parseFloat(null==(o=e[i.assetsConceptId])?void 0:o[a.id]),s=parseFloat(null==(r=e[i.equityConceptId])?void 0:r[a.id]);if(isNaN(t)||isNaN(s))continue;const l=t-s,d=a.description&&a.description!==a.title?`${a.title} ${a.description}`:a.title;n.push({columnId:a.id,columnLabel:d,assetsValue:t,equityValue:s,difference:l,balanced:Math.abs(l)<M})}return n}(this.formData,this.columns,this._balanceCheckTotals);return 0===t.length?"":e.html`
|
|
1777
1819
|
<div class="balance-check-strip">
|
|
1778
1820
|
${t.map(t=>t.balanced?e.html`
|
|
1779
1821
|
<span class="balance-check-chip balanced" title="${t.columnLabel}">
|
|
1780
|
-
✓ ${
|
|
1822
|
+
✓ ${F.t("balanceCheck.balanced",{column:t.columnLabel})}
|
|
1781
1823
|
</span>
|
|
1782
1824
|
`:e.html`
|
|
1783
1825
|
<button
|
|
@@ -1786,15 +1828,15 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1786
1828
|
title="${t.columnLabel}"
|
|
1787
1829
|
@click="${()=>this._handleBalanceCheckClick(t.columnId)}"
|
|
1788
1830
|
>
|
|
1789
|
-
${
|
|
1831
|
+
${F.t("balanceCheck.difference",{column:t.columnLabel,amount:this._formatBalanceDifferenceAmount(t.difference)})}
|
|
1790
1832
|
</button>
|
|
1791
1833
|
`)}
|
|
1792
1834
|
</div>
|
|
1793
|
-
`}_scopedColumnKey(e){return`${this.section.id}__${e}`}_getTypedMemberHeaderValue(e,t){var i,o;const r=null==(i=this.typedMemberData[this._scopedColumnKey(e)])?void 0:i[t];return void 0!==r?r:(null==(o=this.typedMemberData[e])?void 0:o[t])||""}_columnHasAnyValue(e){return Object.keys(this.formData).some(t=>{var i;const o=null==(i=this.formData[t])?void 0:i[e];return null!=o&&""!==o})}_getTypedMemberInputConfig(e){return
|
|
1835
|
+
`}_scopedColumnKey(e){return`${this.section.id}__${e}`}_getTypedMemberHeaderValue(e,t){var i,o;const r=null==(i=this.typedMemberData[this._scopedColumnKey(e)])?void 0:i[t];return void 0!==r?r:(null==(o=this.typedMemberData[e])?void 0:o[t])||""}_columnHasAnyValue(e){return Object.keys(this.formData).some(t=>{var i;const o=null==(i=this.formData[t])?void 0:i[e];return null!=o&&""!==o})}_getTypedMemberInputConfig(e){return Pe(e.type,this.datatypes)}_typedMemberErrorKey(e,t){return`${e}::${t}`}_validateTypedMemberValue(e,t,i){const o=this._typedMemberErrorKey(e,t.axisId),r=o in this._typedMemberErrors;if(!i){if(r){const e={...this._typedMemberErrors};delete e[o],this._typedMemberErrors=e}return}const n=t.validation?Be.validateAgainstRules(i,t.validation):Be.validateConceptValue(t.type,i,this.datatypes);if(n.valid){if(r){const e={...this._typedMemberErrors};delete e[o],this._typedMemberErrors=e}}else this._typedMemberErrors={...this._typedMemberErrors,[o]:n.errors}}_handleTypedMemberHeaderBlur(e,t,i){const o=e.target,r=o instanceof HTMLInputElement&&"checkbox"===o.type?String(o.checked):o.value;this._validateTypedMemberValue(t,i,r)}_renderTypedMemberHeaderErrors(t,i){const o=this._typedMemberErrors[this._typedMemberErrorKey(t,i)];return o&&0!==o.length?e.html`
|
|
1794
1836
|
<div class="typed-member-header-errors">
|
|
1795
1837
|
${o.map(t=>e.html`<span class="typed-member-header-error">${t.message}</span>`)}
|
|
1796
1838
|
</div>
|
|
1797
|
-
`:""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target,r=o instanceof HTMLInputElement&&"checkbox"===o.type?String(o.checked):o.value;this.section.id,this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{sectionId:this.section.id,columnId:t,axisId:i,value:r},bubbles:!0}))}_renderTypedMemberHeaderInput(t,i,o){var r;const n=this._getTypedMemberInputConfig(i),a=this._getTypedMemberHeaderValue(t,i.axisId),s=`typed-member-header-field ${o?"required-field":""} ${!!(null==(r=this._typedMemberErrors[this._typedMemberErrorKey(t,i.axisId)])?void 0:r.length)?"has-error":""}`,l=o?
|
|
1839
|
+
`:""}_handleTypedMemberHeaderChange(e,t,i){const o=e.target,r=o instanceof HTMLInputElement&&"checkbox"===o.type?String(o.checked):o.value;this.section.id,this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{sectionId:this.section.id,columnId:t,axisId:i,value:r},bubbles:!0}))}_renderTypedMemberHeaderInput(t,i,o){var r;const n=this._getTypedMemberInputConfig(i),a=this._getTypedMemberHeaderValue(t,i.axisId),s=`typed-member-header-field ${o?"required-field":""} ${!!(null==(r=this._typedMemberErrors[this._typedMemberErrorKey(t,i.axisId)])?void 0:r.length)?"has-error":""}`,l=o?F.t("validation.typedMemberRequired"):"",d=[i.axisLabel,l].filter(Boolean).join(" — "),c=e=>this._handleTypedMemberHeaderChange(e,t,i.axisId),p=e=>this._handleTypedMemberHeaderBlur(e,t,i);if("select"===n.fieldType||Ve(n.fieldType)){const t=n.enumerations||[];return e.html`
|
|
1798
1840
|
<select
|
|
1799
1841
|
class="${s}"
|
|
1800
1842
|
.value="${a}"
|
|
@@ -1802,14 +1844,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1802
1844
|
@change="${c}"
|
|
1803
1845
|
@blur="${p}"
|
|
1804
1846
|
>
|
|
1805
|
-
<option value="">${n.placeholder||
|
|
1847
|
+
<option value="">${n.placeholder||F.t("field.select")}</option>
|
|
1806
1848
|
${t.map(t=>e.html`
|
|
1807
1849
|
<option value="${t.value}" ?selected="${a===t.value}">
|
|
1808
1850
|
${t.label||t.value}
|
|
1809
1851
|
</option>
|
|
1810
1852
|
`)}
|
|
1811
1853
|
</select>
|
|
1812
|
-
`}if("boolean"===n.fieldType||
|
|
1854
|
+
`}if("boolean"===n.fieldType||Le(n.fieldType))return e.html`
|
|
1813
1855
|
<input
|
|
1814
1856
|
type="checkbox"
|
|
1815
1857
|
class="${s}"
|
|
@@ -1818,7 +1860,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1818
1860
|
@change="${c}"
|
|
1819
1861
|
@blur="${p}"
|
|
1820
1862
|
/>
|
|
1821
|
-
`;const u=n.htmlInputType||"text",h=`${n.placeholder||
|
|
1863
|
+
`;const u=n.htmlInputType||"text",h=`${n.placeholder||F.t("section.enterPlaceholder")} ${i.axisLabel}`;return e.html`
|
|
1822
1864
|
<input
|
|
1823
1865
|
type="${u}"
|
|
1824
1866
|
inputmode="${n.inputMode||""}"
|
|
@@ -1859,6 +1901,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1859
1901
|
.highlightColumnId="${null==(r=this._highlightMap.get(t.id))?void 0:r.columnId}"
|
|
1860
1902
|
.rowFocused="${this._focusedConceptId===t.id}"
|
|
1861
1903
|
.calculationMismatches="${this._calculationMismatches}"
|
|
1904
|
+
.duplicateFactWarnings="${this.duplicateFactWarnings}"
|
|
1862
1905
|
@field-change="${this._handleFieldChange}"
|
|
1863
1906
|
@field-focus="${this._handleFieldFocusForHighlight}"
|
|
1864
1907
|
@period-change="${this._handlePeriodChange}"
|
|
@@ -1891,7 +1934,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1891
1934
|
No concepts defined for this section.
|
|
1892
1935
|
</div>
|
|
1893
1936
|
</div>
|
|
1894
|
-
`;const{caption:t,perColumnLabel:i}=function(e){const t={},i=new Map;for(const s of e){if("dimension"!==s.type)continue;const e=
|
|
1937
|
+
`;const{caption:t,perColumnLabel:i}=function(e){const t={},i=new Map;for(const s of e){if("dimension"!==s.type)continue;const e=Me(s.dimensionData);e.length>0&&i.set(s.id,e)}const o=e.filter(e=>i.has(e.id));if(o.length<2){for(const i of e)t[i.id]=i.title;return{caption:"",perColumnLabel:t}}const r=i.get(o[0].id),n=new Set(r.filter(e=>o.every(t=>{const o=i.get(t.id).find(t=>t.key===e.key);return(null==o?void 0:o.label)===e.label})).map(e=>e.key)),a=r.filter(e=>n.has(e.key)).map(e=>e.label).join(" · ");for(const s of e){const e=i.get(s.id);t[s.id]=e?e.filter(e=>!n.has(e.key)).map(e=>e.label).join(" · "):s.title}return{caption:a,perColumnLabel:t}}(this.columns);return e.html`
|
|
1895
1938
|
${this.hideHeader?"":e.html`
|
|
1896
1939
|
<div class="section-header ${this.collapsible?"":"not-collapsible"}"
|
|
1897
1940
|
@click="${this._toggleExpanded}">
|
|
@@ -1920,7 +1963,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1920
1963
|
${this.columns.map(t=>{var o,r,n;return t.hidden?e.html`
|
|
1921
1964
|
<th
|
|
1922
1965
|
class="header-cell hidden-column"
|
|
1923
|
-
title="${
|
|
1966
|
+
title="${F.t("column.showColumn")}"
|
|
1924
1967
|
@dblclick="${()=>this._handleShowColumn(t.id)}"
|
|
1925
1968
|
></th>
|
|
1926
1969
|
`:e.html`
|
|
@@ -1943,7 +1986,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1943
1986
|
`:e.html`
|
|
1944
1987
|
<div class="typed-member-input-wrapper">
|
|
1945
1988
|
${this._renderTypedMemberHeaderInput(t.id,i,o)}
|
|
1946
|
-
${o?e.html`<span class="typed-member-required-asterisk" title="${
|
|
1989
|
+
${o?e.html`<span class="typed-member-required-asterisk" title="${F.t("validation.typedMemberRequired")}">*</span>`:""}
|
|
1947
1990
|
</div>
|
|
1948
1991
|
${this._renderTypedMemberHeaderErrors(t.id,i.axisId)}
|
|
1949
1992
|
`}
|
|
@@ -1958,7 +2001,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1958
2001
|
<div
|
|
1959
2002
|
class="column-menu-icon"
|
|
1960
2003
|
@click="${e=>this._toggleColumnMenu(t.id,e)}"
|
|
1961
|
-
title="${
|
|
2004
|
+
title="${F.t("column.columnOptions")}"
|
|
1962
2005
|
>⋮</div>
|
|
1963
2006
|
|
|
1964
2007
|
<!-- Context menu -->
|
|
@@ -1968,14 +2011,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1968
2011
|
class="column-context-menu-item"
|
|
1969
2012
|
@click="${e=>this._handleAddColumnFromMenu(t.id,e)}"
|
|
1970
2013
|
>
|
|
1971
|
-
${
|
|
2014
|
+
${F.t("column.addColumn")}
|
|
1972
2015
|
</button>
|
|
1973
2016
|
${t.removable?e.html`
|
|
1974
2017
|
<button
|
|
1975
2018
|
class="column-context-menu-item remove"
|
|
1976
2019
|
@click="${e=>{e.stopPropagation(),this._handleRemoveColumn(t.id)}}"
|
|
1977
2020
|
>
|
|
1978
|
-
${
|
|
2021
|
+
${F.t("column.removeColumn")}
|
|
1979
2022
|
</button>
|
|
1980
2023
|
`:""}
|
|
1981
2024
|
${!t.removable&&this.columns.filter(e=>!e.hidden).length>1?e.html`
|
|
@@ -1983,7 +2026,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
1983
2026
|
class="column-context-menu-item remove"
|
|
1984
2027
|
@click="${e=>{e.stopPropagation(),this._handleHideColumn(t.id)}}"
|
|
1985
2028
|
>
|
|
1986
|
-
${
|
|
2029
|
+
${F.t("column.hideColumn")}
|
|
1987
2030
|
</button>
|
|
1988
2031
|
`:""}
|
|
1989
2032
|
</div>
|
|
@@ -2367,7 +2410,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2367
2410
|
color: var(--jupiter-text-secondary, #666);
|
|
2368
2411
|
font-style: italic;
|
|
2369
2412
|
}
|
|
2370
|
-
`,
|
|
2413
|
+
`,ot([S({type:Object})],exports.JupiterFormSection.prototype,"section",2),ot([S({type:Array})],exports.JupiterFormSection.prototype,"columns",2),ot([S({type:Array})],exports.JupiterFormSection.prototype,"datatypes",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"formData",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"periodData",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"unitData",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"decimalsData",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"globalDecimals",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"typedMemberData",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"repeatCounts",2),ot([S({type:Array})],exports.JupiterFormSection.prototype,"defaultUnits",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"disabled",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"collapsible",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"locale",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"numberLocale",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"isFirstSection",2),ot([S({type:Array})],exports.JupiterFormSection.prototype,"availableDimensions",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"hideHeader",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"mode",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"showFactsOnly",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"conceptMatchIds",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"masterData",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"prefilledTooltip",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"periodStartDate",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"periodEndDate",2),ot([S({type:String})],exports.JupiterFormSection.prototype,"language",2),ot([S({type:Boolean})],exports.JupiterFormSection.prototype,"calculationEnabled",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"totalManuallyEditedData",2),ot([S({type:Object})],exports.JupiterFormSection.prototype,"duplicateFactWarnings",2),ot([C()],exports.JupiterFormSection.prototype,"_expanded",2),ot([C()],exports.JupiterFormSection.prototype,"_showAddColumnDialog",2),ot([C()],exports.JupiterFormSection.prototype,"_sectionPeriodType",2),ot([C()],exports.JupiterFormSection.prototype,"_openMenuColumnId",2),ot([C()],exports.JupiterFormSection.prototype,"_insertAfterColumnId",2),ot([C()],exports.JupiterFormSection.prototype,"_typedMemberErrors",2),ot([C()],exports.JupiterFormSection.prototype,"_expandedConcepts",2),ot([C()],exports.JupiterFormSection.prototype,"_allTreeExpanded",2),ot([C()],exports.JupiterFormSection.prototype,"_highlightMap",2),ot([C()],exports.JupiterFormSection.prototype,"_focusedConceptId",2),ot([C()],exports.JupiterFormSection.prototype,"_calculationMismatches",2),exports.JupiterFormSection=ot([t("jupiter-form-section")],exports.JupiterFormSection);var nt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,st=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?at(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&nt(t,i,n),n};exports.JupiterAdvancedFilter=class extends e.LitElement{constructor(){super(...arguments),this.showFactsOnly=!1,this.conceptSearchText="",this.availableRoles=[],this._localConceptSearchText="",this._conceptOptions=[],this._suggestions=[],this._showSuggestions=!1,this._activeSuggestionIndex=-1}updated(e){e.has("conceptSearchText")&&this.conceptSearchText!==this._localConceptSearchText&&(this._localConceptSearchText=this.conceptSearchText),e.has("availableRoles")&&(this._conceptOptions=this._buildConceptOptions())}_buildConceptOptions(){const e=new Set,t=[],i=o=>{var r;if(o)for(const n of o){const o=n.originalConceptId||n.id;!o||n.abstract||e.has(o)||(e.add(o),t.push({id:o,name:n.label||n.name||o})),(null==(r=n.children)?void 0:r.length)&&i(n.children)}};for(const o of this.availableRoles)i(o.concepts);return t}_computeSuggestions(e){const t=e.trim();if(!t||0===this._conceptOptions.length)return[];const i=[];for(const o of this._conceptOptions){const e=Math.max(rt(t,o.name),rt(t,o.id));e>=0&&i.push({option:o,score:e})}return i.sort((e,t)=>t.score-e.score),i.slice(0,8).map(e=>e.option)}_selectSuggestion(e){var t;this._localConceptSearchText=e.name,this._showSuggestions=!1,this._activeSuggestionIndex=-1,this.dispatchEvent(new CustomEvent("filter-change",{detail:{showFactsOnly:this.showFactsOnly,conceptSearchText:this._localConceptSearchText},bubbles:!0,composed:!0}));const i=null==(t=this.shadowRoot)?void 0:t.querySelector(".concept-search-input");null==i||i.focus()}_handleConceptSearchFocus(){this._localConceptSearchText.trim()&&(this._suggestions=this._computeSuggestions(this._localConceptSearchText),this._showSuggestions=this._suggestions.length>0)}_handleConceptSearchBlur(){this._showSuggestions=!1,this._activeSuggestionIndex=-1}_renderHighlighted(t,i){const o=i.trim().toLowerCase();if(!o)return t;const r=t.toLowerCase().indexOf(o);return-1===r?t:e.html`${t.slice(0,r)}<mark>${t.slice(r,r+o.length)}</mark>${t.slice(r+o.length)}`}_handleShowFactsOnlyChange(e){const t=e.target.checked;this.dispatchEvent(new CustomEvent("filter-change",{detail:{showFactsOnly:t,conceptSearchText:this._localConceptSearchText},bubbles:!0,composed:!0}))}_sanitizeSearchText(e){return e.replace(/[''‚‛′‵]/g,"'").replace(/[""„‟″‶]/g,'"').replace(/[]/g,"").replace(/\s+/g," ").trim()}_handleConceptSearchInput(e){this._localConceptSearchText=this._sanitizeSearchText(e.target.value),this._suggestions=this._computeSuggestions(this._localConceptSearchText),this._showSuggestions=this._suggestions.length>0,this._activeSuggestionIndex=-1,this.dispatchEvent(new CustomEvent("filter-change",{detail:{showFactsOnly:this.showFactsOnly,conceptSearchText:this._localConceptSearchText},bubbles:!0,composed:!0}))}_handleConceptSearchKeydown(e){if(this._showSuggestions&&this._suggestions.length>0){if("ArrowDown"===e.key)return e.preventDefault(),void(this._activeSuggestionIndex=(this._activeSuggestionIndex+1)%this._suggestions.length);if("ArrowUp"===e.key)return e.preventDefault(),void(this._activeSuggestionIndex=this._activeSuggestionIndex<=0?this._suggestions.length-1:this._activeSuggestionIndex-1);if("Escape"===e.key)return this._showSuggestions=!1,void(this._activeSuggestionIndex=-1);if("Enter"===e.key&&this._activeSuggestionIndex>=0)return e.preventDefault(),void this._selectSuggestion(this._suggestions[this._activeSuggestionIndex])}"Enter"===e.key&&(e.preventDefault(),this._showSuggestions=!1,this.dispatchEvent(new CustomEvent("filter-apply",{bubbles:!0,composed:!0})))}_clearConceptSearch(){var e;this._localConceptSearchText="",this._suggestions=[],this._showSuggestions=!1,this._activeSuggestionIndex=-1;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".concept-search-input");t&&(t.value="",t.focus()),this.dispatchEvent(new CustomEvent("filter-change",{detail:{showFactsOnly:this.showFactsOnly,conceptSearchText:""},bubbles:!0,composed:!0}))}render(){return e.html`
|
|
2371
2414
|
<div class="filter-options">
|
|
2372
2415
|
<label class="filter-option clickable">
|
|
2373
2416
|
<input
|
|
@@ -2376,20 +2419,20 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2376
2419
|
@change="${this._handleShowFactsOnlyChange}"
|
|
2377
2420
|
/>
|
|
2378
2421
|
<div class="filter-option-body">
|
|
2379
|
-
<div class="filter-option-label">${
|
|
2380
|
-
<p class="filter-option-description">${
|
|
2422
|
+
<div class="filter-option-label">${F.t("filter.showFactsOnly")}</div>
|
|
2423
|
+
<p class="filter-option-description">${F.t("filter.showFactsOnlyDescription")}</p>
|
|
2381
2424
|
</div>
|
|
2382
2425
|
</label>
|
|
2383
2426
|
|
|
2384
2427
|
<div class="filter-option">
|
|
2385
2428
|
<div class="filter-option-body">
|
|
2386
|
-
<div class="filter-option-label">${
|
|
2387
|
-
<p class="filter-option-description">${
|
|
2429
|
+
<div class="filter-option-label">${F.t("filter.searchByConcept")}</div>
|
|
2430
|
+
<p class="filter-option-description">${F.t("filter.searchByConceptDescription")}</p>
|
|
2388
2431
|
<div class="concept-search-input-wrapper">
|
|
2389
2432
|
<input
|
|
2390
2433
|
type="text"
|
|
2391
2434
|
class="concept-search-input"
|
|
2392
|
-
placeholder="${
|
|
2435
|
+
placeholder="${F.t("filter.searchByConceptPlaceholder")}"
|
|
2393
2436
|
.value="${this._localConceptSearchText}"
|
|
2394
2437
|
autocomplete="off"
|
|
2395
2438
|
role="combobox"
|
|
@@ -2404,7 +2447,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2404
2447
|
<button
|
|
2405
2448
|
class="concept-search-clear"
|
|
2406
2449
|
@click="${this._clearConceptSearch}"
|
|
2407
|
-
title="${
|
|
2450
|
+
title="${F.t("filter.clearSearch")}"
|
|
2408
2451
|
>×</button>
|
|
2409
2452
|
`:""}
|
|
2410
2453
|
${this._showSuggestions?e.html`
|
|
@@ -2576,14 +2619,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2576
2619
|
color: var(--primaryTextColor, var(--jupiter-text-secondary, #999));
|
|
2577
2620
|
word-break: break-all;
|
|
2578
2621
|
}
|
|
2579
|
-
`,at([S({type:Boolean})],exports.JupiterAdvancedFilter.prototype,"showFactsOnly",2),at([S({type:String})],exports.JupiterAdvancedFilter.prototype,"conceptSearchText",2),at([S({type:Array})],exports.JupiterAdvancedFilter.prototype,"availableRoles",2),at([C()],exports.JupiterAdvancedFilter.prototype,"_localConceptSearchText",2),at([C()],exports.JupiterAdvancedFilter.prototype,"_conceptOptions",2),at([C()],exports.JupiterAdvancedFilter.prototype,"_suggestions",2),at([C()],exports.JupiterAdvancedFilter.prototype,"_showSuggestions",2),at([C()],exports.JupiterAdvancedFilter.prototype,"_activeSuggestionIndex",2),exports.JupiterAdvancedFilter=at([t("jupiter-advanced-filter")],exports.JupiterAdvancedFilter);var st=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,dt=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?lt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&st(t,i,n),n};let ct=!1;exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this.periodPreferences={},this.mode="inputForm",this.hypercubeData=null,this.showFactsOnly=!1,this.conceptSearchText="",this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[],this._tempPeriodPreferences={},this._selectedAvailableRole=null,this._selectedChosenRole=null,this._chosenSearchQuery="",this._draggedRoleId=null,this._dragOverRoleId=null,this._chosenRoleOrder=[],this._showAdvancedFilter=!1,this._showFactsOnly=!1,this._conceptSearchText="",this._collapsedRoles=new Set}connectedCallback(){super.connectedCallback(),this._initializeTempSelection(),this._initializePeriodPreferences()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles(),(e.has("availableRoles")||e.has("periodPreferences")||e.has("open"))&&this._initializePeriodPreferences(),e.has("open")&&this.open&&(this._showAdvancedFilter=ct,this._showFactsOnly=this.showFactsOnly,this._conceptSearchText=this.conceptSearchText)}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim(),t=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),n=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,a=this._searchInRoleURI(t,e);return o||r||n||a});this._filteredRoles=t}_searchInRoleURI(e,t){var i;if(null==(i=e.metadata)?void 0:i.roleURI)return e.metadata.roleURI.toLowerCase().includes(t);const o=/https?:\/\/[^\s]+/i,r=o.test(e.title),n=o.test(e.id);return r||n?e.title.toLowerCase().includes(t)||e.id.toLowerCase().includes(t):!!(e.id.includes(".")||e.id.includes("/")||e.id.includes(":"))&&e.id.toLowerCase().includes(t)}_handleSearchInput(e){const t=e.target;this._searchQuery=t.value}_clearSearch(){var e;this._searchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".search-input");t&&(t.value="",t.focus())}_handleChosenSearchInput(e){const t=e.target;this._chosenSearchQuery=t.value}_clearChosenSearch(){var e;this._chosenSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".chosen-search-input");t&&(t.value="",t.focus())}_highlightSearchTerm(e){if(!this._searchQuery.trim())return e;const t=this._searchQuery.trim(),i=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(i,"<mark>$1</mark>")}_renderHighlightedText(e){return e}_getSelectedFilteredCount(){return this._filteredRoles.filter(e=>this._tempSelectedRoles.has(e.id)).length}_initializeTempSelection(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this._chosenRoleOrder=[...this.selectedRoleIds]}_initializePeriodPreferences(){const e={};this.availableRoles.forEach(t=>{const i=this.periodPreferences[t.id];if(i)e[t.id]={...i};else{const i=!0===t.showPeriodControl;let o,r;void 0!==t.duration||void 0!==t.instant?(o=!0===t.duration,r=!0===t.instant):(o=i||this._hasConceptsWithPeriodType(t,"duration"),r=i||this._hasConceptsWithPeriodType(t,"instant")),e[t.id]={showDuration:o,showInstant:r,showPreviousYear:!0===t.showPreviousYear}}const o=this._getDimensionsForRole(t.id);o.length>0&&!(null==i?void 0:i.dimensionSelections)&&(e[t.id].dimensionSelections||(e[t.id].dimensionSelections=[]),o.forEach(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(n.length>0){const a=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,s=n.map(e=>e.id),l={dimensionId:i.id,dimensionLabel:a,selectedMemberIds:s};e[t.id].dimensionSelections.push(l),s.length}}))}),this._tempPeriodPreferences=e}_hasConceptsWithPeriodType(e,t){const i=e=>e.some(e=>!e.abstract&&e.periodType===t||!!e.children&&i(e.children));return i(e.concepts)}_handlePeriodCheckboxChange(e,t,i){e.stopPropagation();const o=e.target,r={...this._tempPeriodPreferences};r[t]||(r[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1}),"duration"===i?r[t].showDuration=o.checked:"instant"===i?r[t].showInstant=o.checked:"previousYear"===i&&(r[t].showPreviousYear=o.checked),this._tempPeriodPreferences=r,this.requestUpdate()}_enforceSingleMemberSelectionsForRole(e,t){const i=this._getDimensionsForRole(e);if(0===i.length)return t;const o={...t},r=o[e]?{...o[e]}:{showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]},n=r.dimensionSelections?[...r.dimensionSelections]:[];return i.forEach(e=>{var t,i;if(!this._isSingleMemberDimension(e))return;const o=this._getAllDimensionMembers(e.members);if(1!==o.length)return;const r=o[0].id,a=(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id,s=n.findIndex(t=>t.dimensionId===e.id);-1!==s?n[s]={...n[s],dimensionLabel:a,selectedMemberIds:[r]}:n.push({dimensionId:e.id,dimensionLabel:a,selectedMemberIds:[r]})}),r.dimensionSelections=n,o[e]=r,o}_enforceSingleMemberSelectionsForSelectedRoles(e,t=this._tempSelectedRoles){let i={...e};for(const o of t)i=this._enforceSingleMemberSelectionsForRole(o,i);return i}_handleCheckboxChange(e,t){const i=e.target,o=new Set(this._tempSelectedRoles);let r={...this._tempPeriodPreferences};i.checked?(o.add(t),r=this._enforceSingleMemberSelectionsForRole(t,r)):o.delete(t),this._tempSelectedRoles=o,this._tempPeriodPreferences=r,this.requestUpdate()}_selectAll(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.add(t.id)),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this.requestUpdate()}_selectNone(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.delete(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectAllGlobal(){const e=new Set(this.availableRoles.map(e=>e.id));this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this.requestUpdate()}_selectNoneGlobal(){this._tempSelectedRoles=new Set,this.requestUpdate()}_resetToOriginal(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,this._tempSelectedRoles),this.requestUpdate()}_handleCancel(){this._initializeTempSelection(),this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleApply(){const e=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,this._tempSelectedRoles);this._tempPeriodPreferences=e;const t=this._chosenRoleOrder.filter(e=>this._tempSelectedRoles.has(e)),i=Array.from(this._tempSelectedRoles).filter(e=>!this._chosenRoleOrder.includes(e));this._chosenRoleOrder=[...t,...i];const o=this._chosenRoleOrder.map((e,t)=>{var i;const o=this.availableRoles.find(t=>t.id===e);return{roleId:e,roleURI:(null==(i=null==o?void 0:o.metadata)?void 0:i.roleURI)||"",order:t}});this._chosenRoleOrder,this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:o,periodPreferences:e},bubbles:!0}))}_getDimensionsForRole(e){var t,i;if(this.hypercubeData,this.hypercubeData,this.hypercubeData,!this.hypercubeData)return console.error("❌ [getDimensionsForRole] CRITICAL: hypercubeData is null/undefined/false"),console.error("❌ Parent component must pass hypercubeData property to filter dialog!"),console.error('❌ Example: <jupiter-filter-roles-dialog .hypercubeData="${hypercubeData}">'),[];let o=this.hypercubeData;if(Array.isArray(this.hypercubeData)&&this.hypercubeData.length>0&&(o=this.hypercubeData[0]),null==o||o.roles,!(null==o?void 0:o.roles))return console.warn("⚠️ [getDimensionsForRole] No roles found in hypercube data structure"),console.warn("⚠️ Expected structure: { roles: [...] } or [{ roles: [...] }]"),[];o.roles.map(e=>e.roleId);const r=o.roles.find(t=>t.roleId===e);if(!(null==(t=null==r?void 0:r.items)?void 0:t.length))return console.warn("⚠️ [getDimensionsForRole] No items found in hypercube role for:",e),[];r.items.length;const n=(null==(i=r.items[0])?void 0:i.dimensions)||[];n.length,n.map(e=>{var t;return{id:e.id,type:e.dimensionType,hasMembers:!!(e.members&&e.members.length>0),membersCount:(null==(t=e.members)?void 0:t.length)||0}});const a=n.filter(e=>"explicit"===e.dimensionType&&e.members&&Array.isArray(e.members)&&e.members.length>0);return a.length,a.map(e=>e.id),a}_getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this._getAllDimensionMembers(e.children))}),t}_isSingleMemberDimension(e){return 1===this._getAllDimensionMembers(e.members).length}_handleDimensionMemberChange(e,t,i,o){var r,n;e.stopPropagation();const a=e.target,s={...this._tempPeriodPreferences};s[t]||(s[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),s[t].dimensionSelections||(s[t].dimensionSelections=[]);let l=s[t].dimensionSelections.find(e=>e.dimensionId===i);if(!l){const e=this._getDimensionsForRole(t).find(e=>e.id===i),o=(null==(n=null==(r=null==e?void 0:e.labels)?void 0:r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i;l={dimensionId:i,dimensionLabel:o,selectedMemberIds:[]},s[t].dimensionSelections.push(l)}a.checked?l.selectedMemberIds.includes(o)||l.selectedMemberIds.push(o):l.selectedMemberIds=l.selectedMemberIds.filter(e=>e!==o);const d=this._getDimensionsForRole(t).find(e=>e.id===i);if(d&&this._tempSelectedRoles.has(t)&&this._isSingleMemberDimension(d)){const e=this._getAllDimensionMembers(d.members);1===e.length&&(l.selectedMemberIds=[e[0].id],a.checked=!0)}this._tempPeriodPreferences=s,s[t].dimensionSelections,this.requestUpdate()}_isDimensionMemberSelected(e,t,i){const o=this._tempPeriodPreferences[e];if(!(null==o?void 0:o.dimensionSelections))return!1;const r=o.dimensionSelections.find(e=>e.dimensionId===t);return(null==r?void 0:r.selectedMemberIds.includes(i))||!1}_selectAllDimensionMembers(e,t){var i,o;const r=this._getDimensionsForRole(e).find(e=>e.id===t);if(!r)return;const n=this._getAllDimensionMembers(r.members).map(e=>e.id),a={...this._tempPeriodPreferences};a[e]||(a[e]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),a[e].dimensionSelections||(a[e].dimensionSelections=[]);let s=a[e].dimensionSelections.find(e=>e.dimensionId===t);if(!s){const n=(null==(o=null==(i=r.labels)?void 0:i.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:o.label)||t;s={dimensionId:t,dimensionLabel:n,selectedMemberIds:[]},a[e].dimensionSelections.push(s)}s.selectedMemberIds=n,this._tempPeriodPreferences=a,this.requestUpdate()}_deselectAllDimensionMembers(e,t){var i;const o={...this._tempPeriodPreferences};if(!(null==(i=o[e])?void 0:i.dimensionSelections))return;const r=o[e].dimensionSelections.find(e=>e.dimensionId===t);r&&(r.selectedMemberIds=[]),this._tempPeriodPreferences=o,this.requestUpdate()}_toggleRoleCollapse(e){const t=new Set(this._collapsedRoles);t.has(e)?t.delete(e):t.add(e),this._collapsedRoles=t}_switchToAdvancedFilter(){ct=!0,this._showAdvancedFilter=!0,this._searchQuery=""}_switchToFilterRoles(){ct=!1,this._showAdvancedFilter=!1}_handleFilterChange(e){this._showFactsOnly=e.detail.showFactsOnly,this._conceptSearchText=e.detail.conceptSearchText??""}_handleAdvancedFilterApply(){this.dispatchEvent(new CustomEvent("advanced-filter-apply",{detail:{showFactsOnly:this._showFactsOnly,conceptSearchText:this._conceptSearchText},bubbles:!0}))}_handleAdvancedFilterReset(){this._showFactsOnly=!1,this._conceptSearchText="",this.dispatchEvent(new CustomEvent("advanced-filter-apply",{detail:{showFactsOnly:!1,conceptSearchText:""},bubbles:!0}))}_handleBackdropClick(e){e.target===this&&this._handleCancel()}_handleAvailableRoleClick(e){this._selectedAvailableRole=e,this._selectedChosenRole=null,this.requestUpdate()}_handleChosenRoleClick(e){this._selectedChosenRole=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveToChosen(){if(!this._selectedAvailableRole)return;const e=new Set(this._tempSelectedRoles);e.add(this._selectedAvailableRole),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForRole(this._selectedAvailableRole,this._tempPeriodPreferences),this._chosenRoleOrder.includes(this._selectedAvailableRole)||(this._chosenRoleOrder=[...this._chosenRoleOrder,this._selectedAvailableRole]),this._selectedAvailableRole=null,this.requestUpdate()}_moveToAvailable(){if(!this._selectedChosenRole)return;const e=new Set(this._tempSelectedRoles);e.delete(this._selectedChosenRole),this._tempSelectedRoles=e,this._chosenRoleOrder=this._chosenRoleOrder.filter(e=>e!==this._selectedChosenRole),this._selectedChosenRole=null,this.requestUpdate()}_moveAllToChosen(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>{e.add(t.id),this._chosenRoleOrder.includes(t.id)||this._chosenRoleOrder.push(t.id)}),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this._selectedAvailableRole=null,this.requestUpdate()}_moveAllToAvailable(){this._tempSelectedRoles=new Set,this._chosenRoleOrder=[],this._selectedChosenRole=null,this.requestUpdate()}_getAvailableRoles(){return this._filteredRoles.filter(e=>!this._tempSelectedRoles.has(e.id))}_getChosenRoles(){const e=this.availableRoles.filter(e=>this._tempSelectedRoles.has(e.id)),t=[...this._chosenRoleOrder.map(t=>e.find(e=>e.id===t)).filter(e=>void 0!==e),...e.filter(e=>!this._chosenRoleOrder.includes(e.id))];if(!this._chosenSearchQuery.trim())return t;const i=this._chosenSearchQuery.toLowerCase().trim();return t.filter(e=>{var t;const o=e.title.toLowerCase().includes(i),r=e.id.toLowerCase().includes(i),n=(null==(t=e.description)?void 0:t.toLowerCase().includes(i))||!1,a=this._searchInRoleURI(e,i);return o||r||n||a})}_handleDragStart(e,t){this._draggedRoleId=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}_handleDragOver(e,t){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._draggedRoleId&&this._draggedRoleId!==t&&(this._dragOverRoleId=t,this.requestUpdate())}_handleDragLeave(e){this._dragOverRoleId=null,this.requestUpdate()}_handleDrop(e,t){if(e.preventDefault(),!this._draggedRoleId||this._draggedRoleId===t)return this._draggedRoleId=null,this._dragOverRoleId=null,void this.requestUpdate();const i=[...this._chosenRoleOrder],o=i.indexOf(this._draggedRoleId),r=i.indexOf(t);if(-1!==o&&-1!==r){i.splice(o,1);const e=o<r?r-1:r;i.splice(e,0,this._draggedRoleId),this._chosenRoleOrder=i,this._chosenRoleOrder}this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}_handleDragEnd(e){this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
|
|
2622
|
+
`,st([S({type:Boolean})],exports.JupiterAdvancedFilter.prototype,"showFactsOnly",2),st([S({type:String})],exports.JupiterAdvancedFilter.prototype,"conceptSearchText",2),st([S({type:Array})],exports.JupiterAdvancedFilter.prototype,"availableRoles",2),st([C()],exports.JupiterAdvancedFilter.prototype,"_localConceptSearchText",2),st([C()],exports.JupiterAdvancedFilter.prototype,"_conceptOptions",2),st([C()],exports.JupiterAdvancedFilter.prototype,"_suggestions",2),st([C()],exports.JupiterAdvancedFilter.prototype,"_showSuggestions",2),st([C()],exports.JupiterAdvancedFilter.prototype,"_activeSuggestionIndex",2),exports.JupiterAdvancedFilter=st([t("jupiter-advanced-filter")],exports.JupiterAdvancedFilter);var lt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,ct=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?dt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&<(t,i,n),n};let pt=!1;exports.JupiterFilterRolesDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.availableRoles=[],this.selectedRoleIds=[],this.periodPreferences={},this.mode="inputForm",this.hypercubeData=null,this.showFactsOnly=!1,this.conceptSearchText="",this._tempSelectedRoles=new Set,this._searchQuery="",this._filteredRoles=[],this._tempPeriodPreferences={},this._selectedAvailableRole=null,this._selectedChosenRole=null,this._chosenSearchQuery="",this._draggedRoleId=null,this._dragOverRoleId=null,this._chosenRoleOrder=[],this._showAdvancedFilter=!1,this._showFactsOnly=!1,this._conceptSearchText="",this._collapsedRoles=new Set}connectedCallback(){super.connectedCallback(),this._initializeTempSelection(),this._initializePeriodPreferences()}updated(e){(e.has("selectedRoleIds")||e.has("open"))&&this._initializeTempSelection(),(e.has("availableRoles")||e.has("_searchQuery"))&&this._updateFilteredRoles(),(e.has("availableRoles")||e.has("periodPreferences")||e.has("open"))&&this._initializePeriodPreferences(),e.has("open")&&this.open&&(this._showAdvancedFilter=pt,this._showFactsOnly=this.showFactsOnly,this._conceptSearchText=this.conceptSearchText)}_updateFilteredRoles(){if(!this._searchQuery.trim())return void(this._filteredRoles=[...this.availableRoles]);const e=this._searchQuery.toLowerCase().trim(),t=this.availableRoles.filter(t=>{var i;const o=t.title.toLowerCase().includes(e),r=t.id.toLowerCase().includes(e),n=(null==(i=t.description)?void 0:i.toLowerCase().includes(e))||!1,a=this._searchInRoleURI(t,e);return o||r||n||a});this._filteredRoles=t}_searchInRoleURI(e,t){var i;if(null==(i=e.metadata)?void 0:i.roleURI)return e.metadata.roleURI.toLowerCase().includes(t);const o=/https?:\/\/[^\s]+/i,r=o.test(e.title),n=o.test(e.id);return r||n?e.title.toLowerCase().includes(t)||e.id.toLowerCase().includes(t):!!(e.id.includes(".")||e.id.includes("/")||e.id.includes(":"))&&e.id.toLowerCase().includes(t)}_handleSearchInput(e){const t=e.target;this._searchQuery=t.value}_clearSearch(){var e;this._searchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".search-input");t&&(t.value="",t.focus())}_handleChosenSearchInput(e){const t=e.target;this._chosenSearchQuery=t.value}_clearChosenSearch(){var e;this._chosenSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".chosen-search-input");t&&(t.value="",t.focus())}_highlightSearchTerm(e){if(!this._searchQuery.trim())return e;const t=this._searchQuery.trim(),i=new RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return e.replace(i,"<mark>$1</mark>")}_renderHighlightedText(e){return e}_getSelectedFilteredCount(){return this._filteredRoles.filter(e=>this._tempSelectedRoles.has(e.id)).length}_initializeTempSelection(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this._chosenRoleOrder=[...this.selectedRoleIds]}_initializePeriodPreferences(){const e={};this.availableRoles.forEach(t=>{const i=this.periodPreferences[t.id];if(i)e[t.id]={...i};else{const i=!0===t.showPeriodControl;let o,r;void 0!==t.duration||void 0!==t.instant?(o=!0===t.duration,r=!0===t.instant):(o=i||this._hasConceptsWithPeriodType(t,"duration"),r=i||this._hasConceptsWithPeriodType(t,"instant")),e[t.id]={showDuration:o,showInstant:r,showPreviousYear:!0===t.showPreviousYear}}const o=this._getDimensionsForRole(t.id);o.length>0&&!(null==i?void 0:i.dimensionSelections)&&(e[t.id].dimensionSelections||(e[t.id].dimensionSelections=[]),o.forEach(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(n.length>0){const a=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,s=n.map(e=>e.id),l={dimensionId:i.id,dimensionLabel:a,selectedMemberIds:s};e[t.id].dimensionSelections.push(l),s.length}}))}),this._tempPeriodPreferences=e}_hasConceptsWithPeriodType(e,t){const i=e=>e.some(e=>!e.abstract&&e.periodType===t||!!e.children&&i(e.children));return i(e.concepts)}_handlePeriodCheckboxChange(e,t,i){e.stopPropagation();const o=e.target,r={...this._tempPeriodPreferences};r[t]||(r[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1}),"duration"===i?r[t].showDuration=o.checked:"instant"===i?r[t].showInstant=o.checked:"previousYear"===i&&(r[t].showPreviousYear=o.checked),this._tempPeriodPreferences=r,this.requestUpdate()}_enforceSingleMemberSelectionsForRole(e,t){const i=this._getDimensionsForRole(e);if(0===i.length)return t;const o={...t},r=o[e]?{...o[e]}:{showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]},n=r.dimensionSelections?[...r.dimensionSelections]:[];return i.forEach(e=>{var t,i;if(!this._isSingleMemberDimension(e))return;const o=this._getAllDimensionMembers(e.members);if(1!==o.length)return;const r=o[0].id,a=(null==(i=null==(t=e.labels)?void 0:t.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:i.label)||e.conceptName||e.id,s=n.findIndex(t=>t.dimensionId===e.id);-1!==s?n[s]={...n[s],dimensionLabel:a,selectedMemberIds:[r]}:n.push({dimensionId:e.id,dimensionLabel:a,selectedMemberIds:[r]})}),r.dimensionSelections=n,o[e]=r,o}_enforceSingleMemberSelectionsForSelectedRoles(e,t=this._tempSelectedRoles){let i={...e};for(const o of t)i=this._enforceSingleMemberSelectionsForRole(o,i);return i}_handleCheckboxChange(e,t){const i=e.target,o=new Set(this._tempSelectedRoles);let r={...this._tempPeriodPreferences};i.checked?(o.add(t),r=this._enforceSingleMemberSelectionsForRole(t,r)):o.delete(t),this._tempSelectedRoles=o,this._tempPeriodPreferences=r,this.requestUpdate()}_selectAll(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.add(t.id)),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this.requestUpdate()}_selectNone(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>e.delete(t.id)),this._tempSelectedRoles=e,this.requestUpdate()}_selectAllGlobal(){const e=new Set(this.availableRoles.map(e=>e.id));this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this.requestUpdate()}_selectNoneGlobal(){this._tempSelectedRoles=new Set,this.requestUpdate()}_resetToOriginal(){this._tempSelectedRoles=new Set(this.selectedRoleIds),this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,this._tempSelectedRoles),this.requestUpdate()}_handleCancel(){this._initializeTempSelection(),this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_handleApply(){const e=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,this._tempSelectedRoles);this._tempPeriodPreferences=e;const t=this._chosenRoleOrder.filter(e=>this._tempSelectedRoles.has(e)),i=Array.from(this._tempSelectedRoles).filter(e=>!this._chosenRoleOrder.includes(e));this._chosenRoleOrder=[...t,...i];const o=this._chosenRoleOrder.map((e,t)=>{var i;const o=this.availableRoles.find(t=>t.id===e);return{roleId:e,roleURI:(null==(i=null==o?void 0:o.metadata)?void 0:i.roleURI)||"",order:t}});this._chosenRoleOrder,this.dispatchEvent(new CustomEvent("roles-filter-apply",{detail:{selectedRoleIds:o,periodPreferences:e},bubbles:!0}))}_getDimensionsForRole(e){var t,i;if(this.hypercubeData,this.hypercubeData,this.hypercubeData,!this.hypercubeData)return console.error("❌ [getDimensionsForRole] CRITICAL: hypercubeData is null/undefined/false"),console.error("❌ Parent component must pass hypercubeData property to filter dialog!"),console.error('❌ Example: <jupiter-filter-roles-dialog .hypercubeData="${hypercubeData}">'),[];let o=this.hypercubeData;if(Array.isArray(this.hypercubeData)&&this.hypercubeData.length>0&&(o=this.hypercubeData[0]),null==o||o.roles,!(null==o?void 0:o.roles))return console.warn("⚠️ [getDimensionsForRole] No roles found in hypercube data structure"),console.warn("⚠️ Expected structure: { roles: [...] } or [{ roles: [...] }]"),[];o.roles.map(e=>e.roleId);const r=o.roles.find(t=>t.roleId===e);if(!(null==(t=null==r?void 0:r.items)?void 0:t.length))return console.warn("⚠️ [getDimensionsForRole] No items found in hypercube role for:",e),[];r.items.length;const n=(null==(i=r.items[0])?void 0:i.dimensions)||[];n.length,n.map(e=>{var t;return{id:e.id,type:e.dimensionType,hasMembers:!!(e.members&&e.members.length>0),membersCount:(null==(t=e.members)?void 0:t.length)||0}});const a=n.filter(e=>"explicit"===e.dimensionType&&e.members&&Array.isArray(e.members)&&e.members.length>0);return a.length,a.map(e=>e.id),a}_getAllDimensionMembers(e){if(!e||!Array.isArray(e))return[];const t=[];return e.forEach(e=>{t.push(e),e.children&&e.children.length>0&&t.push(...this._getAllDimensionMembers(e.children))}),t}_isSingleMemberDimension(e){return 1===this._getAllDimensionMembers(e.members).length}_handleDimensionMemberChange(e,t,i,o){var r,n;e.stopPropagation();const a=e.target,s={...this._tempPeriodPreferences};s[t]||(s[t]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),s[t].dimensionSelections||(s[t].dimensionSelections=[]);let l=s[t].dimensionSelections.find(e=>e.dimensionId===i);if(!l){const e=this._getDimensionsForRole(t).find(e=>e.id===i),o=(null==(n=null==(r=null==e?void 0:e.labels)?void 0:r.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:n.label)||i;l={dimensionId:i,dimensionLabel:o,selectedMemberIds:[]},s[t].dimensionSelections.push(l)}a.checked?l.selectedMemberIds.includes(o)||l.selectedMemberIds.push(o):l.selectedMemberIds=l.selectedMemberIds.filter(e=>e!==o);const d=this._getDimensionsForRole(t).find(e=>e.id===i);if(d&&this._tempSelectedRoles.has(t)&&this._isSingleMemberDimension(d)){const e=this._getAllDimensionMembers(d.members);1===e.length&&(l.selectedMemberIds=[e[0].id],a.checked=!0)}this._tempPeriodPreferences=s,s[t].dimensionSelections,this.requestUpdate()}_isDimensionMemberSelected(e,t,i){const o=this._tempPeriodPreferences[e];if(!(null==o?void 0:o.dimensionSelections))return!1;const r=o.dimensionSelections.find(e=>e.dimensionId===t);return(null==r?void 0:r.selectedMemberIds.includes(i))||!1}_selectAllDimensionMembers(e,t){var i,o;const r=this._getDimensionsForRole(e).find(e=>e.id===t);if(!r)return;const n=this._getAllDimensionMembers(r.members).map(e=>e.id),a={...this._tempPeriodPreferences};a[e]||(a[e]={showDuration:!0,showInstant:!0,showPreviousYear:!1,dimensionSelections:[]}),a[e].dimensionSelections||(a[e].dimensionSelections=[]);let s=a[e].dimensionSelections.find(e=>e.dimensionId===t);if(!s){const n=(null==(o=null==(i=r.labels)?void 0:i.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:o.label)||t;s={dimensionId:t,dimensionLabel:n,selectedMemberIds:[]},a[e].dimensionSelections.push(s)}s.selectedMemberIds=n,this._tempPeriodPreferences=a,this.requestUpdate()}_deselectAllDimensionMembers(e,t){var i;const o={...this._tempPeriodPreferences};if(!(null==(i=o[e])?void 0:i.dimensionSelections))return;const r=o[e].dimensionSelections.find(e=>e.dimensionId===t);r&&(r.selectedMemberIds=[]),this._tempPeriodPreferences=o,this.requestUpdate()}_toggleRoleCollapse(e){const t=new Set(this._collapsedRoles);t.has(e)?t.delete(e):t.add(e),this._collapsedRoles=t}_switchToAdvancedFilter(){pt=!0,this._showAdvancedFilter=!0,this._searchQuery=""}_switchToFilterRoles(){pt=!1,this._showAdvancedFilter=!1}_handleFilterChange(e){this._showFactsOnly=e.detail.showFactsOnly,this._conceptSearchText=e.detail.conceptSearchText??""}_handleAdvancedFilterApply(){this.dispatchEvent(new CustomEvent("advanced-filter-apply",{detail:{showFactsOnly:this._showFactsOnly,conceptSearchText:this._conceptSearchText},bubbles:!0}))}_handleAdvancedFilterReset(){this._showFactsOnly=!1,this._conceptSearchText="",this.dispatchEvent(new CustomEvent("advanced-filter-apply",{detail:{showFactsOnly:!1,conceptSearchText:""},bubbles:!0}))}_handleBackdropClick(e){e.target===this&&this._handleCancel()}_handleAvailableRoleClick(e){this._selectedAvailableRole=e,this._selectedChosenRole=null,this.requestUpdate()}_handleChosenRoleClick(e){this._selectedChosenRole=e,this._selectedAvailableRole=null,this.requestUpdate()}_moveToChosen(){if(!this._selectedAvailableRole)return;const e=new Set(this._tempSelectedRoles);e.add(this._selectedAvailableRole),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForRole(this._selectedAvailableRole,this._tempPeriodPreferences),this._chosenRoleOrder.includes(this._selectedAvailableRole)||(this._chosenRoleOrder=[...this._chosenRoleOrder,this._selectedAvailableRole]),this._selectedAvailableRole=null,this.requestUpdate()}_moveToAvailable(){if(!this._selectedChosenRole)return;const e=new Set(this._tempSelectedRoles);e.delete(this._selectedChosenRole),this._tempSelectedRoles=e,this._chosenRoleOrder=this._chosenRoleOrder.filter(e=>e!==this._selectedChosenRole),this._selectedChosenRole=null,this.requestUpdate()}_moveAllToChosen(){const e=new Set(this._tempSelectedRoles);this._filteredRoles.forEach(t=>{e.add(t.id),this._chosenRoleOrder.includes(t.id)||this._chosenRoleOrder.push(t.id)}),this._tempSelectedRoles=e,this._tempPeriodPreferences=this._enforceSingleMemberSelectionsForSelectedRoles(this._tempPeriodPreferences,e),this._selectedAvailableRole=null,this.requestUpdate()}_moveAllToAvailable(){this._tempSelectedRoles=new Set,this._chosenRoleOrder=[],this._selectedChosenRole=null,this.requestUpdate()}_getAvailableRoles(){return this._filteredRoles.filter(e=>!this._tempSelectedRoles.has(e.id))}_getChosenRoles(){const e=this.availableRoles.filter(e=>this._tempSelectedRoles.has(e.id)),t=[...this._chosenRoleOrder.map(t=>e.find(e=>e.id===t)).filter(e=>void 0!==e),...e.filter(e=>!this._chosenRoleOrder.includes(e.id))];if(!this._chosenSearchQuery.trim())return t;const i=this._chosenSearchQuery.toLowerCase().trim();return t.filter(e=>{var t;const o=e.title.toLowerCase().includes(i),r=e.id.toLowerCase().includes(i),n=(null==(t=e.description)?void 0:t.toLowerCase().includes(i))||!1,a=this._searchInRoleURI(e,i);return o||r||n||a})}_handleDragStart(e,t){this._draggedRoleId=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)),this.requestUpdate()}_handleDragOver(e,t){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this._draggedRoleId&&this._draggedRoleId!==t&&(this._dragOverRoleId=t,this.requestUpdate())}_handleDragLeave(e){this._dragOverRoleId=null,this.requestUpdate()}_handleDrop(e,t){if(e.preventDefault(),!this._draggedRoleId||this._draggedRoleId===t)return this._draggedRoleId=null,this._dragOverRoleId=null,void this.requestUpdate();const i=[...this._chosenRoleOrder],o=i.indexOf(this._draggedRoleId),r=i.indexOf(t);if(-1!==o&&-1!==r){i.splice(o,1);const e=o<r?r-1:r;i.splice(e,0,this._draggedRoleId),this._chosenRoleOrder=i,this._chosenRoleOrder}this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}_handleDragEnd(e){this._draggedRoleId=null,this._dragOverRoleId=null,this.requestUpdate()}render(){const t=this._tempSelectedRoles.size,i=this.availableRoles.length,o=this._filteredRoles.length,r=this._searchQuery.trim().length>0;return e.html`
|
|
2580
2623
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
2581
2624
|
<!-- Dialog Header -->
|
|
2582
2625
|
<div class="dialog-header">
|
|
2583
2626
|
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
2584
2627
|
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
2585
2628
|
</svg>
|
|
2586
|
-
<h2 class="dialog-title">${
|
|
2629
|
+
<h2 class="dialog-title">${F.t("filter.title")}</h2>
|
|
2587
2630
|
<button class="close-button" @click="${this._handleCancel}">×</button>
|
|
2588
2631
|
</div>
|
|
2589
2632
|
|
|
@@ -2595,19 +2638,19 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2595
2638
|
<!-- Available Roles Panel -->
|
|
2596
2639
|
<div class="picklist-panel">
|
|
2597
2640
|
<div class="picklist-header">
|
|
2598
|
-
${
|
|
2641
|
+
${F.t("filter.availableRoles")} (${this._getAvailableRoles().length})
|
|
2599
2642
|
</div>
|
|
2600
2643
|
<div class="picklist-search">
|
|
2601
2644
|
<div class="search-container">
|
|
2602
2645
|
<input
|
|
2603
2646
|
type="text"
|
|
2604
2647
|
class="search-input"
|
|
2605
|
-
placeholder="${
|
|
2648
|
+
placeholder="${F.t("filter.searchPlaceholder")}"
|
|
2606
2649
|
.value="${this._searchQuery}"
|
|
2607
2650
|
@input="${this._handleSearchInput}"
|
|
2608
2651
|
/>
|
|
2609
2652
|
${this._searchQuery?e.html`
|
|
2610
|
-
<button class="clear-search" @click="${this._clearSearch}" title="${
|
|
2653
|
+
<button class="clear-search" @click="${this._clearSearch}" title="${F.t("filter.clearSearch")}">
|
|
2611
2654
|
×
|
|
2612
2655
|
</button>
|
|
2613
2656
|
`:e.html`
|
|
@@ -2632,7 +2675,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2632
2675
|
`})}
|
|
2633
2676
|
</div>
|
|
2634
2677
|
<div class="picklist-count">
|
|
2635
|
-
${this._getAvailableRoles().length} ${
|
|
2678
|
+
${this._getAvailableRoles().length} ${F.t("filter.roleCount")}
|
|
2636
2679
|
</div>
|
|
2637
2680
|
</div>
|
|
2638
2681
|
|
|
@@ -2642,7 +2685,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2642
2685
|
class="picklist-button"
|
|
2643
2686
|
@click="${this._moveToChosen}"
|
|
2644
2687
|
?disabled="${!this._selectedAvailableRole}"
|
|
2645
|
-
title="${
|
|
2688
|
+
title="${F.t("filter.addSelectedRole")}"
|
|
2646
2689
|
>
|
|
2647
2690
|
›
|
|
2648
2691
|
</button>
|
|
@@ -2650,7 +2693,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2650
2693
|
class="picklist-button"
|
|
2651
2694
|
@click="${this._moveAllToChosen}"
|
|
2652
2695
|
?disabled="${0===this._getAvailableRoles().length}"
|
|
2653
|
-
title="${
|
|
2696
|
+
title="${F.t("filter.addAllRoles")}"
|
|
2654
2697
|
>
|
|
2655
2698
|
»
|
|
2656
2699
|
</button>
|
|
@@ -2658,7 +2701,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2658
2701
|
class="picklist-button"
|
|
2659
2702
|
@click="${this._moveToAvailable}"
|
|
2660
2703
|
?disabled="${!this._selectedChosenRole}"
|
|
2661
|
-
title="${
|
|
2704
|
+
title="${F.t("filter.removeSelectedRole")}"
|
|
2662
2705
|
>
|
|
2663
2706
|
‹
|
|
2664
2707
|
</button>
|
|
@@ -2666,7 +2709,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2666
2709
|
class="picklist-button"
|
|
2667
2710
|
@click="${this._moveAllToAvailable}"
|
|
2668
2711
|
?disabled="${0===this._tempSelectedRoles.size}"
|
|
2669
|
-
title="${
|
|
2712
|
+
title="${F.t("filter.removeAllRoles")}"
|
|
2670
2713
|
>
|
|
2671
2714
|
«
|
|
2672
2715
|
</button>
|
|
@@ -2675,19 +2718,19 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2675
2718
|
<!-- Chosen Roles Panel -->
|
|
2676
2719
|
<div class="picklist-panel">
|
|
2677
2720
|
<div class="picklist-header">
|
|
2678
|
-
${
|
|
2721
|
+
${F.t("filter.chosenRoles")} (${this._tempSelectedRoles.size})
|
|
2679
2722
|
</div>
|
|
2680
2723
|
<div class="picklist-search">
|
|
2681
2724
|
<div class="search-container">
|
|
2682
2725
|
<input
|
|
2683
2726
|
type="text"
|
|
2684
2727
|
class="search-input chosen-search-input"
|
|
2685
|
-
placeholder="${
|
|
2728
|
+
placeholder="${F.t("filter.searchPlaceholder")}"
|
|
2686
2729
|
.value="${this._chosenSearchQuery}"
|
|
2687
2730
|
@input="${this._handleChosenSearchInput}"
|
|
2688
2731
|
/>
|
|
2689
2732
|
${this._chosenSearchQuery?e.html`
|
|
2690
|
-
<button class="clear-search" @click="${this._clearChosenSearch}" title="${
|
|
2733
|
+
<button class="clear-search" @click="${this._clearChosenSearch}" title="${F.t("filter.clearSearch")}">
|
|
2691
2734
|
×
|
|
2692
2735
|
</button>
|
|
2693
2736
|
`:e.html`
|
|
@@ -2718,7 +2761,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2718
2761
|
`})}
|
|
2719
2762
|
</div>
|
|
2720
2763
|
<div class="picklist-count">
|
|
2721
|
-
${this._tempSelectedRoles.size} ${
|
|
2764
|
+
${this._tempSelectedRoles.size} ${F.t("filter.rolesSelected")}
|
|
2722
2765
|
</div>
|
|
2723
2766
|
</div>
|
|
2724
2767
|
</div>
|
|
@@ -2732,7 +2775,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2732
2775
|
></jupiter-advanced-filter>
|
|
2733
2776
|
`:e.html`
|
|
2734
2777
|
<p class="description">
|
|
2735
|
-
${
|
|
2778
|
+
${F.t("filter.description")}
|
|
2736
2779
|
</p>
|
|
2737
2780
|
|
|
2738
2781
|
<!-- Search Input -->
|
|
@@ -2740,12 +2783,12 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2740
2783
|
<input
|
|
2741
2784
|
type="text"
|
|
2742
2785
|
class="search-input"
|
|
2743
|
-
placeholder="${
|
|
2786
|
+
placeholder="${F.t("filter.searchPlaceholder")}"
|
|
2744
2787
|
.value="${this._searchQuery}"
|
|
2745
2788
|
@input="${this._handleSearchInput}"
|
|
2746
2789
|
/>
|
|
2747
2790
|
${this._searchQuery?e.html`
|
|
2748
|
-
<button class="clear-search" @click="${this._clearSearch}" title="${
|
|
2791
|
+
<button class="clear-search" @click="${this._clearSearch}" title="${F.t("filter.clearSearch")}">
|
|
2749
2792
|
×
|
|
2750
2793
|
</button>
|
|
2751
2794
|
`:e.html`
|
|
@@ -2758,8 +2801,8 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2758
2801
|
<!-- Search Results Info -->
|
|
2759
2802
|
${r?e.html`
|
|
2760
2803
|
<div class="search-results-info">
|
|
2761
|
-
${
|
|
2762
|
-
${o!==i?e.html`${
|
|
2804
|
+
${F.t("filter.showingResults")} ${o} ${F.t("filter.of")} ${i} ${F.t("filter.roles")}
|
|
2805
|
+
${o!==i?e.html`${F.t("filter.matching")} "${this._searchQuery}"`:""}
|
|
2763
2806
|
</div>
|
|
2764
2807
|
`:""}
|
|
2765
2808
|
|
|
@@ -2767,27 +2810,27 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2767
2810
|
<div class="selection-controls">
|
|
2768
2811
|
${r?e.html`
|
|
2769
2812
|
<button class="selection-control" @click="${this._selectAll}">
|
|
2770
|
-
${
|
|
2813
|
+
${F.t("filter.selectFiltered")} (${o})
|
|
2771
2814
|
</button>
|
|
2772
2815
|
<button class="selection-control" @click="${this._selectNone}">
|
|
2773
|
-
${
|
|
2816
|
+
${F.t("filter.deselectFiltered")}
|
|
2774
2817
|
</button>
|
|
2775
2818
|
<button class="selection-control" @click="${this._selectAllGlobal}">
|
|
2776
|
-
${
|
|
2819
|
+
${F.t("filter.selectAll")} (${i})
|
|
2777
2820
|
</button>
|
|
2778
2821
|
<button class="selection-control" @click="${this._selectNoneGlobal}">
|
|
2779
|
-
${
|
|
2822
|
+
${F.t("filter.deselectAll")}
|
|
2780
2823
|
</button>
|
|
2781
2824
|
`:e.html`
|
|
2782
2825
|
<button class="selection-control" @click="${this._selectAll}">
|
|
2783
|
-
${
|
|
2826
|
+
${F.t("filter.selectAll")}
|
|
2784
2827
|
</button>
|
|
2785
2828
|
<button class="selection-control" @click="${this._selectNone}">
|
|
2786
|
-
${
|
|
2829
|
+
${F.t("filter.selectNone")}
|
|
2787
2830
|
</button>
|
|
2788
2831
|
`}
|
|
2789
2832
|
<button class="selection-control" @click="${this._resetToOriginal}">
|
|
2790
|
-
${
|
|
2833
|
+
${F.t("filter.reset")}
|
|
2791
2834
|
</button>
|
|
2792
2835
|
</div>
|
|
2793
2836
|
|
|
@@ -2796,10 +2839,10 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2796
2839
|
${0===this._filteredRoles.length?e.html`
|
|
2797
2840
|
<div class="no-results">
|
|
2798
2841
|
${r?e.html`
|
|
2799
|
-
${
|
|
2800
|
-
${
|
|
2842
|
+
${F.t("filter.noRolesFound")} "${this._searchQuery}".<br>
|
|
2843
|
+
${F.t("filter.tryDifferentSearch")}
|
|
2801
2844
|
`:e.html`
|
|
2802
|
-
${
|
|
2845
|
+
${F.t("filter.noRolesAvailable")}
|
|
2803
2846
|
`}
|
|
2804
2847
|
</div>
|
|
2805
2848
|
`:e.html`
|
|
@@ -2824,7 +2867,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2824
2867
|
${a?"":e.html`
|
|
2825
2868
|
<div class="role-item-body">
|
|
2826
2869
|
<div class="period-controls">
|
|
2827
|
-
<p class="period-controls-label">${
|
|
2870
|
+
<p class="period-controls-label">${F.t("filter.additionalOptions")}</p>
|
|
2828
2871
|
<div class="period-checkboxes">
|
|
2829
2872
|
<label class="period-checkbox-item">
|
|
2830
2873
|
<input
|
|
@@ -2833,14 +2876,14 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2833
2876
|
.checked="${o.showPreviousYear}"
|
|
2834
2877
|
@change="${e=>this._handlePeriodCheckboxChange(e,t.id,"previousYear")}"
|
|
2835
2878
|
/>
|
|
2836
|
-
<span class="period-checkbox-label">${
|
|
2879
|
+
<span class="period-checkbox-label">${F.t("filter.showPreviousYear")}</span>
|
|
2837
2880
|
</label>
|
|
2838
2881
|
</div>
|
|
2839
2882
|
</div>
|
|
2840
2883
|
|
|
2841
2884
|
${n?e.html`
|
|
2842
2885
|
<div class="dimension-section">
|
|
2843
|
-
<div class="dimension-header">📊 ${
|
|
2886
|
+
<div class="dimension-header">📊 ${F.t("filter.dimensionMemberSelection")}</div>
|
|
2844
2887
|
${r.map(i=>{var o,r;const n=this._getAllDimensionMembers(i.members);if(0===n.length)return e.html``;const a=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName;return e.html`
|
|
2845
2888
|
<div class="dimension-group">
|
|
2846
2889
|
<div class="dimension-label">${a}</div>
|
|
@@ -2862,13 +2905,13 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2862
2905
|
class="member-select-btn"
|
|
2863
2906
|
@click="${()=>this._selectAllDimensionMembers(t.id,i.id)}"
|
|
2864
2907
|
>
|
|
2865
|
-
${
|
|
2908
|
+
${F.t("filter.selectAllMembers")}
|
|
2866
2909
|
</button>
|
|
2867
2910
|
<button
|
|
2868
2911
|
class="member-select-btn"
|
|
2869
2912
|
@click="${()=>this._deselectAllDimensionMembers(t.id,i.id)}"
|
|
2870
2913
|
>
|
|
2871
|
-
${
|
|
2914
|
+
${F.t("filter.clearMembers")}
|
|
2872
2915
|
</button>
|
|
2873
2916
|
</div>
|
|
2874
2917
|
</div>
|
|
@@ -2889,25 +2932,25 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2889
2932
|
${"admin"!==this.mode&&"readonly"!==this.mode?e.html`
|
|
2890
2933
|
${this._showAdvancedFilter?e.html`
|
|
2891
2934
|
<button class="btn-text" @click="${this._switchToFilterRoles}">
|
|
2892
|
-
${
|
|
2935
|
+
${F.t("filter.backToFilterRoles")}
|
|
2893
2936
|
</button>
|
|
2894
2937
|
${this._showFactsOnly||this._conceptSearchText.trim().length>0?e.html`
|
|
2895
2938
|
<button class="btn-text" @click="${this._handleAdvancedFilterReset}">
|
|
2896
|
-
${
|
|
2939
|
+
${F.t("filter.resetFilter")}
|
|
2897
2940
|
</button>
|
|
2898
2941
|
`:""}
|
|
2899
2942
|
`:e.html`
|
|
2900
2943
|
<button class="btn-text" @click="${this._switchToAdvancedFilter}">
|
|
2901
|
-
${
|
|
2944
|
+
${F.t("filter.advancedFilter")}
|
|
2902
2945
|
</button>
|
|
2903
2946
|
`}
|
|
2904
2947
|
`:""}
|
|
2905
2948
|
<button class="btn-secondary" @click="${this._handleCancel}">
|
|
2906
|
-
${
|
|
2949
|
+
${F.t("filter.cancel")}
|
|
2907
2950
|
</button>
|
|
2908
2951
|
${this._showAdvancedFilter?e.html`
|
|
2909
2952
|
<button class="btn-primary" @click="${this._handleAdvancedFilterApply}">
|
|
2910
|
-
${
|
|
2953
|
+
${F.t("filter.applyFilter")}
|
|
2911
2954
|
</button>
|
|
2912
2955
|
`:e.html`
|
|
2913
2956
|
<button
|
|
@@ -2915,7 +2958,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
2915
2958
|
@click="${this._handleApply}"
|
|
2916
2959
|
?disabled="${0===t}"
|
|
2917
2960
|
>
|
|
2918
|
-
${
|
|
2961
|
+
${F.t("filter.applyFilter")} (${t})
|
|
2919
2962
|
</button>
|
|
2920
2963
|
`}
|
|
2921
2964
|
</div>
|
|
@@ -3521,14 +3564,28 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3521
3564
|
.btn-text:hover {
|
|
3522
3565
|
background: var(--menuBgColorLighter, var(--jupiter-hover-background, #f5f5f5));
|
|
3523
3566
|
}
|
|
3524
|
-
`,
|
|
3567
|
+
`,ct([S({type:Boolean,reflect:!0})],exports.JupiterFilterRolesDialog.prototype,"open",2),ct([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"availableRoles",2),ct([S({type:Array})],exports.JupiterFilterRolesDialog.prototype,"selectedRoleIds",2),ct([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"periodPreferences",2),ct([S({type:String})],exports.JupiterFilterRolesDialog.prototype,"mode",2),ct([S({type:Object})],exports.JupiterFilterRolesDialog.prototype,"hypercubeData",2),ct([S({type:Boolean})],exports.JupiterFilterRolesDialog.prototype,"showFactsOnly",2),ct([S({type:String})],exports.JupiterFilterRolesDialog.prototype,"conceptSearchText",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_tempSelectedRoles",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_searchQuery",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_filteredRoles",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_tempPeriodPreferences",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_selectedAvailableRole",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_selectedChosenRole",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_chosenSearchQuery",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_draggedRoleId",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_dragOverRoleId",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_chosenRoleOrder",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_showAdvancedFilter",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_showFactsOnly",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_conceptSearchText",2),ct([C()],exports.JupiterFilterRolesDialog.prototype,"_collapsedRoles",2),exports.JupiterFilterRolesDialog=ct([t("jupiter-filter-roles-dialog")],exports.JupiterFilterRolesDialog);var ut=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,mt=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?ht(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&ut(t,i,n),n};exports.JupiterFormulaValidationDialog=class extends e.LitElement{constructor(){super(...arguments),this.results=[],this.open=!1,this._collapsedGroups=new Set,this._boundHandleKeydown=this._handleKeydown.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._boundHandleKeydown)}disconnectedCallback(){window.removeEventListener("keydown",this._boundHandleKeydown),super.disconnectedCallback()}_handleKeydown(e){this.open&&"Escape"===e.key&&this._handleClose()}_handleClose(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}_toggleGroup(e){this._collapsedGroups.has(e)?this._collapsedGroups.delete(e):this._collapsedGroups.add(e),this.requestUpdate()}_handleConceptLinkClick(e){this.dispatchEvent(new CustomEvent("formula-concept-click",{detail:{conceptId:e.conceptId,conceptQName:e.conceptQName,columnId:e.columnId},bubbles:!0,composed:!0}))}_handleBreakdownCandidateClick(e){this.dispatchEvent(new CustomEvent("formula-concept-click",{detail:{conceptId:e.conceptId,conceptQName:e.conceptQName,columnId:e.columnId},bubbles:!0,composed:!0}))}_breakdownCandidateLabel(e){return e.conceptQName.includes(":")?e.conceptQName.split(":").pop():e.conceptQName}_renderBreakdown(t){const i=t.variableBreakdown;return i&&0!==i.length?e.html`
|
|
3568
|
+
<div class="assertion-breakdown">
|
|
3569
|
+
<span class="assertion-breakdown-label">${F.t("formulaValidation.breakdownLabel")}</span>
|
|
3570
|
+
<ul class="assertion-breakdown-list">
|
|
3571
|
+
${i.flatMap(t=>t.candidates.map(t=>e.html`
|
|
3572
|
+
<li class="assertion-breakdown-item">
|
|
3573
|
+
<button type="button" class="concept-link" @click="${()=>this._handleBreakdownCandidateClick(t)}">
|
|
3574
|
+
${this._breakdownCandidateLabel(t)}
|
|
3575
|
+
</button>
|
|
3576
|
+
<span class="assertion-breakdown-value">${t.value}</span>
|
|
3577
|
+
</li>
|
|
3578
|
+
`))}
|
|
3579
|
+
</ul>
|
|
3580
|
+
</div>
|
|
3581
|
+
`:""}_renderMessage(t){const i=t.message??"",o=new Map((t.conceptLinks??[]).map(e=>[e.label,e])),r=i.split(/(`[^`]+`)/g);return e.html`${r.map(t=>{const i=/^`([^`]+)`$/.exec(t);if(!i)return t;const r=o.get(i[1]);return r?e.html`<button type="button" class="concept-link" @click="${()=>this._handleConceptLinkClick(r)}">${i[1]}</button>`:i[1]})}`}_groupByRole(e){const t=e.reduce((e,t)=>{var i;return(e[i=t.roleLabel]??(e[i]=[])).push(t),e},{});return Object.entries(t)}render(){if(!this.open)return e.html``;const t=this.results.filter(e=>!e.skipped&&!e.satisfied),i=this._groupByRole(t),o=this.summary;return e.html`
|
|
3525
3582
|
<div class="dialog" @click="${e=>e.stopPropagation()}">
|
|
3526
3583
|
<div class="dialog-header">
|
|
3527
|
-
<h2 class="dialog-title">${
|
|
3584
|
+
<h2 class="dialog-title">${F.t("formulaValidation.dialogTitle")}</h2>
|
|
3528
3585
|
${o?e.html`
|
|
3529
3586
|
<p class="dialog-summary">
|
|
3530
|
-
${
|
|
3531
|
-
${o.failed>0?e.html`— ${
|
|
3587
|
+
${F.t("formulaValidation.summaryCount",{failed:o.failed,total:o.totalAssertions})}
|
|
3588
|
+
${o.failed>0?e.html`— ${F.t("formulaValidation.summaryCountBreakdown",{warnings:o.failedWarnings,errors:o.failedErrors})}`:""}
|
|
3532
3589
|
</p>
|
|
3533
3590
|
`:""}
|
|
3534
3591
|
</div>
|
|
@@ -3537,7 +3594,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3537
3594
|
${0===t.length?e.html`
|
|
3538
3595
|
<div class="all-passed">
|
|
3539
3596
|
<div class="all-passed-icon">✓</div>
|
|
3540
|
-
<div class="all-passed-text">${
|
|
3597
|
+
<div class="all-passed-text">${F.t("formulaValidation.allPassed")}</div>
|
|
3541
3598
|
</div>
|
|
3542
3599
|
`:i.map(([t,i])=>{const o=this._collapsedGroups.has(t);return e.html`
|
|
3543
3600
|
<div class="role-group">
|
|
@@ -3551,9 +3608,12 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3551
3608
|
${i.map(t=>e.html`
|
|
3552
3609
|
<div class="assertion-row">
|
|
3553
3610
|
<span class="severity-badge ${"ERROR"===t.severity?"error":"warning"}">
|
|
3554
|
-
${"ERROR"===t.severity?
|
|
3611
|
+
${"ERROR"===t.severity?F.t("formulaValidation.severityError"):F.t("formulaValidation.severityWarning")}
|
|
3555
3612
|
</span>
|
|
3556
|
-
<
|
|
3613
|
+
<div class="assertion-row-body">
|
|
3614
|
+
<span class="assertion-message">${this._renderMessage(t)}</span>
|
|
3615
|
+
${this._renderBreakdown(t)}
|
|
3616
|
+
</div>
|
|
3557
3617
|
</div>
|
|
3558
3618
|
`)}
|
|
3559
3619
|
</div>
|
|
@@ -3564,7 +3624,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3564
3624
|
|
|
3565
3625
|
<div class="dialog-actions">
|
|
3566
3626
|
<button class="btn btn-primary" @click="${this._handleClose}">
|
|
3567
|
-
${
|
|
3627
|
+
${F.t("formulaValidation.close")}
|
|
3568
3628
|
</button>
|
|
3569
3629
|
</div>
|
|
3570
3630
|
</div>
|
|
@@ -3738,12 +3798,53 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3738
3798
|
background: var(--jupiter-error-color, #d32f2f);
|
|
3739
3799
|
}
|
|
3740
3800
|
|
|
3801
|
+
.assertion-row-body {
|
|
3802
|
+
display: flex;
|
|
3803
|
+
flex-direction: column;
|
|
3804
|
+
gap: 4px;
|
|
3805
|
+
min-width: 0;
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3741
3808
|
.assertion-message {
|
|
3742
3809
|
font-size: 13px;
|
|
3743
3810
|
color: var(--primaryTextColor, var(--jupiter-text-primary, #333));
|
|
3744
3811
|
line-height: 1.4;
|
|
3745
3812
|
}
|
|
3746
3813
|
|
|
3814
|
+
.assertion-breakdown {
|
|
3815
|
+
display: flex;
|
|
3816
|
+
flex-direction: column;
|
|
3817
|
+
gap: 2px;
|
|
3818
|
+
}
|
|
3819
|
+
|
|
3820
|
+
.assertion-breakdown-label {
|
|
3821
|
+
font-size: 11px;
|
|
3822
|
+
font-weight: 600;
|
|
3823
|
+
color: var(--jupiter-text-secondary, #666);
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
.assertion-breakdown-list {
|
|
3827
|
+
list-style: none;
|
|
3828
|
+
margin: 0;
|
|
3829
|
+
padding: 0;
|
|
3830
|
+
display: flex;
|
|
3831
|
+
flex-direction: column;
|
|
3832
|
+
gap: 2px;
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
.assertion-breakdown-item {
|
|
3836
|
+
display: flex;
|
|
3837
|
+
align-items: baseline;
|
|
3838
|
+
justify-content: space-between;
|
|
3839
|
+
gap: 8px;
|
|
3840
|
+
font-size: 12px;
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
.assertion-breakdown-value {
|
|
3844
|
+
color: var(--jupiter-text-secondary, #666);
|
|
3845
|
+
white-space: nowrap;
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3747
3848
|
.concept-link {
|
|
3748
3849
|
font: inherit;
|
|
3749
3850
|
font-weight: 600;
|
|
@@ -3789,7 +3890,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3789
3890
|
.btn-primary:hover {
|
|
3790
3891
|
opacity: 0.9;
|
|
3791
3892
|
}
|
|
3792
|
-
`,
|
|
3893
|
+
`,mt([S({type:Array})],exports.JupiterFormulaValidationDialog.prototype,"results",2),mt([S({type:Object})],exports.JupiterFormulaValidationDialog.prototype,"summary",2),mt([S({type:Boolean,reflect:!0})],exports.JupiterFormulaValidationDialog.prototype,"open",2),mt([C()],exports.JupiterFormulaValidationDialog.prototype,"_collapsedGroups",2),exports.JupiterFormulaValidationDialog=mt([t("jupiter-formula-validation-dialog")],exports.JupiterFormulaValidationDialog);var ft=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,gt=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?bt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&ft(t,i,n),n};exports.JupiterConfirmDialog=class extends e.LitElement{constructor(){super(...arguments),this.open=!1,this.heading="",this.message="",this.confirmLabel="OK",this.cancelLabel="Cancel",this._boundHandleKeydown=this._handleKeydown.bind(this)}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._boundHandleKeydown)}disconnectedCallback(){window.removeEventListener("keydown",this._boundHandleKeydown),super.disconnectedCallback()}updated(e){var t,i;e.has("open")&&this.open&&(null==(i=null==(t=this.shadowRoot)?void 0:t.querySelector(".btn-primary"))||i.focus())}_handleKeydown(e){this.open&&"Escape"===e.key&&this._handleCancel()}_handleConfirm(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-confirm",{bubbles:!0}))}_handleCancel(){this.open=!1,this.dispatchEvent(new CustomEvent("dialog-cancel",{bubbles:!0}))}render(){return this.open?e.html`
|
|
3793
3894
|
<div class="dialog" role="alertdialog" aria-modal="true" aria-labelledby="title" aria-describedby="message"
|
|
3794
3895
|
@click="${e=>e.stopPropagation()}">
|
|
3795
3896
|
<h2 class="dialog-title" id="title">${this.heading}</h2>
|
|
@@ -3889,16 +3990,16 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3889
3990
|
.btn-secondary:hover {
|
|
3890
3991
|
background: var(--jupiter-hover-background, #f5f5f5);
|
|
3891
3992
|
}
|
|
3892
|
-
`,bt([S({type:Boolean,reflect:!0})],exports.JupiterConfirmDialog.prototype,"open",2),bt([S({type:String})],exports.JupiterConfirmDialog.prototype,"heading",2),bt([S({type:String})],exports.JupiterConfirmDialog.prototype,"message",2),bt([S({type:String})],exports.JupiterConfirmDialog.prototype,"confirmLabel",2),bt([S({type:String})],exports.JupiterConfirmDialog.prototype,"cancelLabel",2),exports.JupiterConfirmDialog=bt([t("jupiter-confirm-dialog")],exports.JupiterConfirmDialog);var gt=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,yt=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?vt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&>(t,i,n),n};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.calculationEnabled=!1,this.formulaEnabled=!1,this.tableLayoutEnabled=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this.language="en",this.reportingLanguage="en",this.numberLocale="",this.display="accordion",this.mode="inputForm",this.roleFilterAxes=[],this.showLastValidationResultBtn=!1,this.isDraftSaving=!1,this.hasUnsavedChanges=!1,this.defaultUnits=[],this.decimals="INF",this._formData={},this._draftLoaded=!1,this._preservedFormData={},this._periodData={},this._preservedPeriodData={},this._unitData={},this._preservedUnitData={},this._decimalsData={},this._totalManuallyEditedData={},this._effectiveMasterData=void 0,this._typedMemberData={},this._preservedTypedMemberData={},this._repeatCounts={},this._hiddenColumnIds=new Map,this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._xbrlFormErrors=[],this._calculationWarnings=new Map,this._showErrorPopup=!1,this._showTypedDimensionWarning=!1,this._typedDimensionWarningFacts=[],this._submitDisabled=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1,this._revealRolePrompt=null,this._showFactsOnly=!1,this._conceptSearchText="",this._lastFocusedFieldIdentity=null,this._periodPreferences={},this._activeSidePanelRoleId=null,this._sidePanelSearchQuery="",this._sidePanelCollapsed=!1,this._adminRoleConfigs={},this._roleBorderStatuses=new Map,this._roleCompletedStates=new Map,this._showRoleContextMenu=!1,this._contextMenuX=0,this._contextMenuY=0,this._contextMenuRoleId=null,this._validationStatus="idle",this._validationDotCount=1,this._validationDotIntervalId=null,this._formulaValidationResults=[],this._showFormulaValidationDialog=!1,this._formulaValidationService=new _e,this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,this._autoSaveTimer=null,this._lastAutoSaveSnapshot="",this._autoSaveBaselineSeeded=!1,this._lastSavedDraftSnapshot=""}connectedCallback(){super.connectedCallback(),this.addEventListener("period-change",e=>{const t=e;t.detail,this._handlePeriodChange(t)}),this.addEventListener("unit-change",e=>{const t=e;t.detail,this._handleUnitChange(t)}),this.addEventListener("decimals-change",e=>{this._handleDecimalsChange(e)}),this.addEventListener("field-blur",e=>{const t=e;this._handleFieldBlur(t)}),this.addEventListener("calculation-mismatch-changed",e=>{this._handleCalculationMismatchChanged(e)}),this.addEventListener("total-manually-edited",e=>{const{conceptId:t,columnId:i}=e.detail,o={...this._totalManuallyEditedData};o[t]={...o[t],[i]:!0},this._totalManuallyEditedData=o}),this.addEventListener("calculation-total-auto-populated",e=>{const{conceptId:t,columnId:i,value:o}=e.detail,r=this._writeFormDataValue(t,i,o);this._touched.add(`${t}-${i}`),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:t,columnId:i,value:o,oldValue:r,source:"auto-calculated"},bubbles:!0}))}),this.addEventListener("focusin",e=>{var t;const i=e.composedPath().find(e=>e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement);if(!i)return;let o=i;for(;o&&"jupiter-form-field"!==(null==(t=o.tagName)?void 0:t.toLowerCase());){const e=o.getRootNode();o=e instanceof ShadowRoot?e.host:null}const r=o;(null==r?void 0:r.conceptId)&&(null==r?void 0:r.columnId)&&(this._lastFocusedFieldIdentity={conceptId:r.conceptId,columnId:r.columnId})}),document.addEventListener("click",()=>{this._showRoleContextMenu&&(this._showRoleContextMenu=!1,this.requestUpdate())}),this._autoSaveTimer=setInterval(()=>{const e=JSON.stringify(this._formData);if(!this._autoSaveBaselineSeeded)return this._lastAutoSaveSnapshot=e,void(this._autoSaveBaselineSeeded=!0);e!==this._lastAutoSaveSnapshot&&(this._lastAutoSaveSnapshot=e,this._handleSaveDraft("auto"))},3e4),this._initializeForm()}disconnectedCallback(){super.disconnectedCallback(),null!==this._autoSaveTimer&&(clearInterval(this._autoSaveTimer),this._autoSaveTimer=null),null!==this._validationDotIntervalId&&(clearInterval(this._validationDotIntervalId),this._validationDotIntervalId=null),this._settleRevealRolePrompt(!1)}_seedAutoSaveBaseline(){this._lastAutoSaveSnapshot=JSON.stringify(this._formData),this._autoSaveBaselineSeeded=!0}updated(e){e.has("hasUnsavedChanges")&&this.dispatchEvent(new CustomEvent("has-unsaved-changes-change",{detail:{hasUnsavedChanges:this.hasUnsavedChanges},bubbles:!0})),(e.has("decimals")||e.has("masterData"))&&this._computeEffectiveMasterData(),e.has("language")&&E.setLanguage(this.language),(e.has("xbrlInput")||e.has("defaultUnits"))&&this.xbrlInput&&this.defaultUnits&&this.defaultUnits.length>0&&this._applyDefaultUnitsToDatatypes(),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("roleFilterAxes"))&&this._initializeForm()}_applyDefaultUnitsToDatatypes(){var e;if(!(null==(e=this.xbrlInput)?void 0:e.datatypes)||!this.defaultUnits||0===this.defaultUnits.length)return;this.defaultUnits;const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts;t&&0!==t.length?this.defaultUnits.forEach(e=>{Object.entries(e).forEach(([e,i])=>{const o=t.find(t=>t.type===e||t.id===e);if(o&&o.units&&o.units.length>0){const t=o.units.find(e=>e.id===i);t?(o.units.forEach(e=>e.isDefault=!1),t.isDefault=!0):console.warn(`⚠️ [DynamicForm] Unit "${i}" not found in datatype "${e}"`)}else console.warn(`⚠️ [DynamicForm] Datatype "${e}" not found or has no units`)})}):console.warn("⚠️ [DynamicForm] No datatypes found to apply defaults to")}_initializeForm(){var e;if(this._draftStorageService||(this._draftStorageService=new R(!1)),this.xbrlInput)try{if(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._initializePeriodPreferencesFromData(),this._applyAxisFilterToPeriodPreferences(),this._applyDimensionShowPreviousYear(),this._periodPreferences,this._currentSchema=k.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._currentSchema.sections.length,this._allSections=[...this._currentSchema.sections],Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const e=this._selectedRoleIds,t=new Map;e.forEach(e=>{t.set(e.roleId,e.order)}),this._allSections=[...this._allSections].sort((e,i)=>(t.get(e.id)??999)-(t.get(i.id)??999)),this._allSections.map(e=>e.title)}if(0===this._selectedRoleIds.length){const e=this.roleFilterAxes&&this.roleFilterAxes.length>0?this._filterRolesByAxisConfig(this._allSections):this._allSections;this._selectedRoleIds=e.map(e=>e.id),this._selectedRoleIds.length,this._allSections.length}this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._initializeGlobalDecimalsFromRoundingData(),this._extractTypedMembersFromFacts(),this._skipDraftLoading?(this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()):this._loadDraftIfExists().then(()=>{this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()}).catch(()=>{this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()}),this._validateForm()}_extractTypedMembersFromFacts(){var e;(null==(e=this._currentSchema)?void 0:e.sections)&&(this._currentSchema.sections.forEach(e=>{this._extractTypedMembersFromConcepts(e.concepts||[],e)}),this._typedMemberData)}_extractTypedMembersFromConcepts(e,t){e.forEach(e=>{e.facts&&e.facts.length>0&&(e.id,e.facts.length,e.facts.forEach(i=>{if(i.dimensions&&Array.isArray(i.dimensions)){const o=i.dimensions.filter(e=>"typed"===e.dimensionType&&e.typedMemberValue);if(o.length>0){o.length,i.name,o.map(e=>({dimension:e.dimension,typedMemberValue:e.typedMemberValue}));const r=this._findColumnWithTypedMembers(i,e,t);r?(r.id,o.forEach(i=>{var o,n;const a=this._normalizeAxisId(i.dimension),s=null==(n=null==(o=r.dimensionData)?void 0:o.typedMembers)?void 0:n.find(e=>e.axisId===a||this._normalizeAxisId(e.axisId)===a);if(s){const o=this._scopedColumnKey(t.id,r.id);this._typedMemberData[o]||(this._typedMemberData[o]={});const n=s.axisId;this._typedMemberData[o][n]=i.typedMemberValue,t.id,e.id,r.id,i.typedMemberValue}else console.warn(`⚠️ [DynamicForm] Typed member not found for axis: ${a}`)})):console.warn("⚠️ [DynamicForm] No matching column found for fact with typed dimensions")}}})),e.children&&e.children.length>0&&this._extractTypedMembersFromConcepts(e.children,t)})}_findColumnWithTypedMembers(e,t,i){var o;if(!t.fields||0===t.fields.length)return null;const r=i.columns||[];if(0===r.length)return null;for(const n of t.fields){const t=r.find(e=>e.id===n.columnId);if(t&&(null==(o=t.dimensionData)?void 0:o.hasTypedMembers)){const i=(e.dimensions||[]).filter(e=>"explicit"===e.dimensionType),o=t.dimensionData.combinations||[];if(0===i.length||i.length===o.length&&i.every(e=>o.some(t=>this._normalizeAxisId(e.dimension)===this._normalizeAxisId(t.axisId)&&this._normalizeMemberId(e.member)===this._normalizeMemberId(t.memberId))))return t}}return null}_findColumnForFactDimensions(e,t,i){if(!t.fields||0===t.fields.length)return t.id,null;const o=i.columns||[];if(0===o.length)return i.id,null;for(const r of t.fields){const t=o.find(e=>e.id===r.columnId);if(t&&t.dimensionData){const i=e.dimensions||[],o=t.dimensionData.combinations||[];t.id,i.map(e=>({axis:e.dimension,member:e.member,type:e.dimensionType})),o.map(e=>({axis:e.axisId,member:e.memberId}));if(o.every(e=>i.some(t=>{const i=this._normalizeAxisId(t.dimension)===this._normalizeAxisId(e.axisId);if("explicit"===t.dimensionType){const o=this._normalizeMemberId(t.member)===this._normalizeMemberId(e.memberId);return i&&o}return"typed"===t.dimensionType&&i})))return t}}return null}_normalizeAxisId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_normalizeMemberId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const o={...this._periodPreferences};this.xbrlInput.presentation[0].roles.forEach(e=>{if(!o[e.id]){const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,r=void 0===e.duration||!0===e.duration;o[e.id]={showDuration:r,showInstant:i,showPreviousYear:t}}}),this._periodPreferences=o}_applyAxisFilterToPeriodPreferences(){var e,t,i,o;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.hypercubes)?void 0:t[0])?void 0:i.roles))return;const r=this.xbrlInput.hypercubes[0].roles,n={...this._periodPreferences};for(const a of r){const e=a.roleId,t=n[e];if((null==t?void 0:t.dimensionSelections)&&t.dimensionSelections.length>0)continue;const i=[];for(const r of this.roleFilterAxes)for(const e of a.items||[]){if(null==(o=e.dimensions)?void 0:o.find(e=>e.id===r.id||r.conceptName&&e.conceptName===r.conceptName)){i.push({dimensionId:r.id,dimensionLabel:r.conceptName||r.id,selectedMemberIds:r.members.filter(e=>!0===e.available).map(e=>e.id)});break}}i.length>0&&(n[e]={showDuration:(null==t?void 0:t.showDuration)??!0,showInstant:(null==t?void 0:t.showInstant)??!0,showPreviousYear:(null==t?void 0:t.showPreviousYear)??!1,dimensionSelections:i})}this._periodPreferences=n}_applyDimensionShowPreviousYear(){var e,t,i,o,r,n;if("admin"!==this.mode)return;const a=!(!this.dynaformsFacts||!this.dynaformsMetadata),s=(null==(e=this._draftStorageService)?void 0:e.hasDraft())??!1;if(a||s)return;const l=new Set;null==(r=null==(o=null==(i=null==(t=this.xbrlInput)?void 0:t.presentation)?void 0:i[0])?void 0:o.roles)||r.forEach(e=>{!1===e.showPreviousYear&&l.add(e.id)});const d={...this._periodPreferences};let c=!1;for(const p of Object.keys(d)){if(l.has(p))continue;const e=d[p];if(e.showPreviousYear)continue;((null==(n=e.dimensionSelections)?void 0:n.some(e=>e.selectedMemberIds&&e.selectedMemberIds.length>0))??!1)&&(d[p]={...e,showPreviousYear:!0},c=!0)}c&&(this._periodPreferences=d)}_getRoleIdsArray(){return Array.isArray(this._selectedRoleIds)&&0!==this._selectedRoleIds.length?"string"==typeof this._selectedRoleIds[0]?this._selectedRoleIds:this._selectedRoleIds.map(e=>e.roleId):[]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;const e=this._getRoleIdsArray();if(e.length,this._allSections.length,0===e.length)return this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const t=this._allSections.filter(t=>e.includes(t.id)),i=this._sortSectionsByCustomOrder(t);i.length,i.map(e=>e.title),this._restoreDataForVisibleSections(i),this._currentSchema={...this._currentSchema,sections:i},this._currentSchema.sections.length,this.requestUpdate()}_sortSectionsByCustomOrder(e){if(Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const t=this._selectedRoleIds,i=new Map;return t.forEach(e=>{i.set(e.roleId,e.order)}),[...e].sort((e,t)=>(i.get(e.id)??999)-(i.get(t.id)??999))}return e}_filterRolesByAxisConfig(e){var t;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return e.filter(e=>{var t;const o=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!o||!o.items||0===o.items.length)return!0;for(const i of this.roleFilterAxes){const e=new Set(i.members.filter(e=>!0===e.available).map(e=>e.id));let t=!1,r=!1;for(const n of o.items){if(!n.dimensions||0===n.dimensions.length)continue;const o=n.dimensions.find(e=>e.id===i.id||i.conceptName&&e.conceptName===i.conceptName);if(o){if(t=!0,o.members)for(const t of o.members)if(e.has(t.id)){r=!0;break}if(r)break}}if(t&&!r)return!1}return!0})}_preserveDataForHiddenSections(){var e;const t=(null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[],i=this._getRoleIdsArray();t.filter(e=>!i.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)})}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),e.length}_preserveSectionData(e){e.concepts.forEach(t=>{this._preserveConceptData(t,e.id)})}_preserveConceptData(e,t){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]}),e.fields.forEach(i=>{const o=this._scopedColumnKey(t,i.columnId);this._typedMemberData[o]&&(this._preservedTypedMemberData[o]={...this._typedMemberData[o]});const r=`${e.id}__${i.columnId}`;this._typedMemberData[r]&&(this._preservedTypedMemberData[r]={...this._typedMemberData[r]})}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e,t)})}_restoreSectionData(e){e.concepts.forEach(t=>{this._restoreConceptData(t,e.id)})}_restoreConceptData(e,t){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]}),e.fields.forEach(i=>{const o=this._scopedColumnKey(t,i.columnId);this._preservedTypedMemberData[o]&&(this._typedMemberData[o]={...this._preservedTypedMemberData[o]});const r=`${e.id}__${i.columnId}`;this._preservedTypedMemberData[r]&&(this._typedMemberData[r]={...this._preservedTypedMemberData[r]})}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e,t)})}_shouldShowFilterButton(){return!0}get _hasActiveAdvancedFilters(){return this._showFactsOnly||this._conceptSearchText.trim().length>0}get _footerVisibleRoleCount(){return this._hasActiveAdvancedFilters&&this._currentSchema?this._getSidePanelVisibleSections(this._currentSchema).length:this._selectedRoleIds.length}_analyzeConceptFilterMatches(e,t){const i=e=>(e.includes(":")?e.split(":").pop():e).toLowerCase(),o=this._conceptSearchText.trim().toLowerCase();let r=0,n="",a="",s="",l="";const d=e=>{var c;for(const p of e){if(t.has(p.originalConceptId)){r++;const e=i(p.name)===o;e&&p.abstract&&!a?a=p.label:!e||p.abstract||n?p.abstract&&!l?l=p.label:p.abstract||s||(s=p.label):n=p.label}(null==(c=p.children)?void 0:c.length)&&d(p.children)}};for(const c of e)d(c.concepts);return{count:r,label:n||a||s||l||this._conceptSearchText}}_renderActiveFilterBanner(t){if(!this._hasActiveAdvancedFilters)return"";const i=this._conceptSearchText.trim().length>0?(()=>{const e=this._getConceptSearchMatchIds(this._conceptSearchText),{count:i,label:o}=this._analyzeConceptFilterMatches(t,e);return E.t("filter.bannerConcept",{concept:o,count:i})})():E.t("filter.bannerFactsOnly");return e.html`
|
|
3993
|
+
`,gt([S({type:Boolean,reflect:!0})],exports.JupiterConfirmDialog.prototype,"open",2),gt([S({type:String})],exports.JupiterConfirmDialog.prototype,"heading",2),gt([S({type:String})],exports.JupiterConfirmDialog.prototype,"message",2),gt([S({type:String})],exports.JupiterConfirmDialog.prototype,"confirmLabel",2),gt([S({type:String})],exports.JupiterConfirmDialog.prototype,"cancelLabel",2),exports.JupiterConfirmDialog=gt([t("jupiter-confirm-dialog")],exports.JupiterConfirmDialog);var vt=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,xt=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?yt(t,i):t,a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&vt(t,i,n),n};exports.JupiterDynamicForm=class extends e.LitElement{constructor(){super(...arguments),this.config={},this.initialData={},this.disabled=!1,this.readonly=!1,this.calculationEnabled=!1,this.formulaEnabled=!1,this.tableLayoutEnabled=!1,this.periodStartDate="2025-01-01",this.periodEndDate="2025-12-31",this.language="en",this.reportingLanguage="en",this.numberLocale="",this.display="accordion",this.mode="inputForm",this.roleFilterAxes=[],this.showLastValidationResultBtn=!1,this.isDraftSaving=!1,this.hasUnsavedChanges=!1,this.defaultUnits=[],this.decimals="INF",this._formData={},this._draftLoaded=!1,this._preservedFormData={},this._periodData={},this._preservedPeriodData={},this._unitData={},this._preservedUnitData={},this._decimalsData={},this._totalManuallyEditedData={},this._effectiveMasterData=void 0,this._typedMemberData={},this._preservedTypedMemberData={},this._repeatCounts={},this._hiddenColumnIds=new Map,this._columns=[],this._errors=[],this._touched=new Set,this._dirty=!1,this._valid=!0,this._submitted=!1,this._xbrlFormErrors=[],this._calculationWarnings=new Map,this._showErrorPopup=!1,this._showValidateWarningPopup=!1,this._typedDimensionWarningFacts=[],this._duplicateFactMismatches=[],this._duplicateFactWarnings=new Map,this._duplicateWarningPopupMode="validate",this._submitDisabled=!1,this._allSections=[],this._selectedRoleIds=[],this._showFilterDialog=!1,this._revealRolePrompt=null,this._showFactsOnly=!1,this._conceptSearchText="",this._lastFocusedFieldIdentity=null,this._periodPreferences={},this._activeSidePanelRoleId=null,this._sidePanelSearchQuery="",this._sidePanelCollapsed=!1,this._adminRoleConfigs={},this._roleBorderStatuses=new Map,this._roleCompletedStates=new Map,this._showRoleContextMenu=!1,this._contextMenuX=0,this._contextMenuY=0,this._contextMenuRoleId=null,this._validationStatus="idle",this._validationDotCount=1,this._validationDotIntervalId=null,this._formulaValidationResults=[],this._showFormulaValidationDialog=!1,this._formulaValidationService=new De,this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,this._autoSaveTimer=null,this._lastAutoSaveSnapshot="",this._autoSaveBaselineSeeded=!1,this._lastSavedDraftSnapshot=""}connectedCallback(){super.connectedCallback(),this.addEventListener("period-change",e=>{const t=e;t.detail,this._handlePeriodChange(t)}),this.addEventListener("unit-change",e=>{const t=e;t.detail,this._handleUnitChange(t)}),this.addEventListener("decimals-change",e=>{this._handleDecimalsChange(e)}),this.addEventListener("field-blur",e=>{const t=e;this._handleFieldBlur(t)}),this.addEventListener("calculation-mismatch-changed",e=>{this._handleCalculationMismatchChanged(e)}),this.addEventListener("duplicate-fact-warning-click",e=>{const{mismatch:t}=e.detail||{};t&&(this._typedDimensionWarningFacts=[],this._duplicateFactMismatches=[t],this._duplicateWarningPopupMode="cellInfo",this._showValidateWarningPopup=!0)}),this.addEventListener("total-manually-edited",e=>{const{conceptId:t,columnId:i}=e.detail,o={...this._totalManuallyEditedData};o[t]={...o[t],[i]:!0},this._totalManuallyEditedData=o}),this.addEventListener("calculation-total-auto-populated",e=>{const{conceptId:t,columnId:i,value:o}=e.detail,r=this._writeFormDataValue(t,i,o);this._touched.add(`${t}-${i}`),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:t,columnId:i,value:o,oldValue:r,source:"auto-calculated"},bubbles:!0}))}),this.addEventListener("focusin",e=>{var t;const i=e.composedPath().find(e=>e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement);if(!i)return;let o=i;for(;o&&"jupiter-form-field"!==(null==(t=o.tagName)?void 0:t.toLowerCase());){const e=o.getRootNode();o=e instanceof ShadowRoot?e.host:null}const r=o;(null==r?void 0:r.conceptId)&&(null==r?void 0:r.columnId)&&(this._lastFocusedFieldIdentity={conceptId:r.conceptId,columnId:r.columnId})}),document.addEventListener("click",()=>{this._showRoleContextMenu&&(this._showRoleContextMenu=!1,this.requestUpdate())}),this._autoSaveTimer=setInterval(()=>{const e=JSON.stringify(this._formData);if(!this._autoSaveBaselineSeeded)return this._lastAutoSaveSnapshot=e,void(this._autoSaveBaselineSeeded=!0);e!==this._lastAutoSaveSnapshot&&(this._lastAutoSaveSnapshot=e,this._handleSaveDraft("auto"))},3e4),this._initializeForm()}disconnectedCallback(){super.disconnectedCallback(),null!==this._autoSaveTimer&&(clearInterval(this._autoSaveTimer),this._autoSaveTimer=null),null!==this._validationDotIntervalId&&(clearInterval(this._validationDotIntervalId),this._validationDotIntervalId=null),this._settleRevealRolePrompt(!1)}_seedAutoSaveBaseline(){this._lastAutoSaveSnapshot=JSON.stringify(this._formData),this._autoSaveBaselineSeeded=!0}updated(e){e.has("hasUnsavedChanges")&&this.dispatchEvent(new CustomEvent("has-unsaved-changes-change",{detail:{hasUnsavedChanges:this.hasUnsavedChanges},bubbles:!0})),(e.has("decimals")||e.has("masterData"))&&this._computeEffectiveMasterData(),e.has("language")&&F.setLanguage(this.language),(e.has("xbrlInput")||e.has("defaultUnits"))&&this.xbrlInput&&this.defaultUnits&&this.defaultUnits.length>0&&this._applyDefaultUnitsToDatatypes(),(e.has("xbrlInput")||e.has("schema")||e.has("language")||e.has("periodStartDate")||e.has("periodEndDate")||e.has("roleFilterAxes"))&&this._initializeForm()}_applyDefaultUnitsToDatatypes(){var e;if(!(null==(e=this.xbrlInput)?void 0:e.datatypes)||!this.defaultUnits||0===this.defaultUnits.length)return;this.defaultUnits;const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts;t&&0!==t.length?this.defaultUnits.forEach(e=>{Object.entries(e).forEach(([e,i])=>{const o=t.find(t=>t.type===e||t.id===e);if(o&&o.units&&o.units.length>0){const t=o.units.find(e=>e.id===i);t?(o.units.forEach(e=>e.isDefault=!1),t.isDefault=!0):console.warn(`⚠️ [DynamicForm] Unit "${i}" not found in datatype "${e}"`)}else console.warn(`⚠️ [DynamicForm] Datatype "${e}" not found or has no units`)})}):console.warn("⚠️ [DynamicForm] No datatypes found to apply defaults to")}_initializeForm(){var e;if(this._draftStorageService||(this._draftStorageService=new R(!1)),this.xbrlInput)try{if(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._initializePeriodPreferencesFromData(),this._applyAxisFilterToPeriodPreferences(),this._applyDimensionShowPreviousYear(),this._periodPreferences,this._currentSchema=k.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._currentSchema.sections.length,this._allSections=[...this._currentSchema.sections],Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const e=this._selectedRoleIds,t=new Map;e.forEach(e=>{t.set(e.roleId,e.order)}),this._allSections=[...this._allSections].sort((e,i)=>(t.get(e.id)??999)-(t.get(i.id)??999)),this._allSections.map(e=>e.title)}if(0===this._selectedRoleIds.length){const e=this.roleFilterAxes&&this.roleFilterAxes.length>0?this._filterRolesByAxisConfig(this._allSections):this._allSections;this._selectedRoleIds=e.map(e=>e.id),this._selectedRoleIds.length,this._allSections.length}this._applyRoleFilter(),this._columns=[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}catch(t){console.error("❌ Error building form from XBRL input:",t),this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns()}else this.schema?(this._currentSchema=this.schema,this._allSections=[...this.schema.sections],this._selectedRoleIds=this._allSections.map(e=>e.id),this._columns=this._getDefaultColumns()):(this._currentSchema=this._getDefaultSchema(),this._allSections=[],this._selectedRoleIds=[],this._columns=this._getDefaultColumns());this._formData={...this.initialData},(null==(e=this.xbrlInput)?void 0:e.initialData)&&(this._formData={...this._formData,...this.xbrlInput.initialData}),this._formData=this._stripPriorYearExcludedFacts(this._formData),this._initializeGlobalDecimalsFromRoundingData(),this._extractTypedMembersFromFacts(),this._skipDraftLoading?(this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()):this._loadDraftIfExists().then(()=>{this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()}).catch(()=>{this._seedAutoSaveBaseline(),this._analyzeAllVisibleRoles()}),this._validateForm()}_extractTypedMembersFromFacts(){var e;(null==(e=this._currentSchema)?void 0:e.sections)&&(this._currentSchema.sections.forEach(e=>{this._extractTypedMembersFromConcepts(e.concepts||[],e)}),this._typedMemberData)}_extractTypedMembersFromConcepts(e,t){e.forEach(e=>{e.facts&&e.facts.length>0&&(e.id,e.facts.length,e.facts.forEach(i=>{if(i.dimensions&&Array.isArray(i.dimensions)){const o=i.dimensions.filter(e=>"typed"===e.dimensionType&&e.typedMemberValue);if(o.length>0){o.length,i.name,o.map(e=>({dimension:e.dimension,typedMemberValue:e.typedMemberValue}));const r=this._findColumnWithTypedMembers(i,e,t);r?(r.id,o.forEach(i=>{var o,n;const a=this._normalizeAxisId(i.dimension),s=null==(n=null==(o=r.dimensionData)?void 0:o.typedMembers)?void 0:n.find(e=>e.axisId===a||this._normalizeAxisId(e.axisId)===a);if(s){const o=this._scopedColumnKey(t.id,r.id);this._typedMemberData[o]||(this._typedMemberData[o]={});const n=s.axisId;this._typedMemberData[o][n]=i.typedMemberValue,t.id,e.id,r.id,i.typedMemberValue}else console.warn(`⚠️ [DynamicForm] Typed member not found for axis: ${a}`)})):console.warn("⚠️ [DynamicForm] No matching column found for fact with typed dimensions")}}})),e.children&&e.children.length>0&&this._extractTypedMembersFromConcepts(e.children,t)})}_findColumnWithTypedMembers(e,t,i){var o;if(!t.fields||0===t.fields.length)return null;const r=i.columns||[];if(0===r.length)return null;for(const n of t.fields){const t=r.find(e=>e.id===n.columnId);if(t&&(null==(o=t.dimensionData)?void 0:o.hasTypedMembers)){const i=(e.dimensions||[]).filter(e=>"explicit"===e.dimensionType),o=t.dimensionData.combinations||[];if(0===i.length||i.length===o.length&&i.every(e=>o.some(t=>this._normalizeAxisId(e.dimension)===this._normalizeAxisId(t.axisId)&&this._normalizeMemberId(e.member)===this._normalizeMemberId(t.memberId))))return t}}return null}_findColumnForFactDimensions(e,t,i){if(!t.fields||0===t.fields.length)return t.id,null;const o=i.columns||[];if(0===o.length)return i.id,null;for(const r of t.fields){const t=o.find(e=>e.id===r.columnId);if(t&&t.dimensionData){const i=e.dimensions||[],o=t.dimensionData.combinations||[];t.id,i.map(e=>({axis:e.dimension,member:e.member,type:e.dimensionType})),o.map(e=>({axis:e.axisId,member:e.memberId}));if(o.every(e=>i.some(t=>{const i=this._normalizeAxisId(t.dimension)===this._normalizeAxisId(e.axisId);if("explicit"===t.dimensionType){const o=this._normalizeMemberId(t.member)===this._normalizeMemberId(e.memberId);return i&&o}return"typed"===t.dimensionType&&i})))return t}}return null}_normalizeAxisId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_normalizeMemberId(e){return e?e.includes(":")?e.split(":").pop()||e:e.includes("_")&&e.split("_").pop()||e:""}_getDefaultSchema(){return{version:"1.0",formId:"default-form",title:"Dynamic Form",description:"Please provide form schema or XBRL input data",sections:[]}}_getDefaultColumns(){return[{id:"base",title:"Value",description:"Base values for concepts",type:"base",order:0,removable:!1}]}_initializePeriodPreferencesFromData(){var e,t,i;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.presentation)?void 0:t[0])?void 0:i.roles))return;const o={...this._periodPreferences};this.xbrlInput.presentation[0].roles.forEach(e=>{if(!o[e.id]){const t=!0===e.showPreviousYear,i=void 0===e.instant||!0===e.instant,r=void 0===e.duration||!0===e.duration;o[e.id]={showDuration:r,showInstant:i,showPreviousYear:t}}}),this._periodPreferences=o}_applyAxisFilterToPeriodPreferences(){var e,t,i,o;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return;if(!(null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.hypercubes)?void 0:t[0])?void 0:i.roles))return;const r=this.xbrlInput.hypercubes[0].roles,n={...this._periodPreferences};for(const a of r){const e=a.roleId,t=n[e];if((null==t?void 0:t.dimensionSelections)&&t.dimensionSelections.length>0)continue;const i=[];for(const r of this.roleFilterAxes)for(const e of a.items||[]){if(null==(o=e.dimensions)?void 0:o.find(e=>e.id===r.id||r.conceptName&&e.conceptName===r.conceptName)){i.push({dimensionId:r.id,dimensionLabel:r.conceptName||r.id,selectedMemberIds:r.members.filter(e=>!0===e.available).map(e=>e.id)});break}}i.length>0&&(n[e]={showDuration:(null==t?void 0:t.showDuration)??!0,showInstant:(null==t?void 0:t.showInstant)??!0,showPreviousYear:(null==t?void 0:t.showPreviousYear)??!1,dimensionSelections:i})}this._periodPreferences=n}_applyDimensionShowPreviousYear(){var e,t,i,o,r,n;if("admin"!==this.mode)return;const a=!(!this.dynaformsFacts||!this.dynaformsMetadata),s=(null==(e=this._draftStorageService)?void 0:e.hasDraft())??!1;if(a||s)return;const l=new Set;null==(r=null==(o=null==(i=null==(t=this.xbrlInput)?void 0:t.presentation)?void 0:i[0])?void 0:o.roles)||r.forEach(e=>{!1===e.showPreviousYear&&l.add(e.id)});const d={...this._periodPreferences};let c=!1;for(const p of Object.keys(d)){if(l.has(p))continue;const e=d[p];if(e.showPreviousYear)continue;((null==(n=e.dimensionSelections)?void 0:n.some(e=>e.selectedMemberIds&&e.selectedMemberIds.length>0))??!1)&&(d[p]={...e,showPreviousYear:!0},c=!0)}c&&(this._periodPreferences=d)}_getRoleIdsArray(){return Array.isArray(this._selectedRoleIds)&&0!==this._selectedRoleIds.length?"string"==typeof this._selectedRoleIds[0]?this._selectedRoleIds:this._selectedRoleIds.map(e=>e.roleId):[]}_applyRoleFilter(){if(!this._currentSchema||!this._allSections.length)return;const e=this._getRoleIdsArray();if(e.length,this._allSections.length,0===e.length)return this._currentSchema={...this._currentSchema,sections:[]},void this.requestUpdate();this._preserveDataForHiddenSections();const t=this._allSections.filter(t=>e.includes(t.id)),i=this._sortSectionsByCustomOrder(t);i.length,i.map(e=>e.title),this._restoreDataForVisibleSections(i),this._currentSchema={...this._currentSchema,sections:i},this._currentSchema.sections.length,this.requestUpdate()}_sortSectionsByCustomOrder(e){if(Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]){const t=this._selectedRoleIds,i=new Map;return t.forEach(e=>{i.set(e.roleId,e.order)}),[...e].sort((e,t)=>(i.get(e.id)??999)-(i.get(t.id)??999))}return e}_filterRolesByAxisConfig(e){var t;if(!this.roleFilterAxes||0===this.roleFilterAxes.length)return e;if(!(null==(t=this.xbrlInput)?void 0:t.hypercubes)||0===this.xbrlInput.hypercubes.length)return e;const i=this.xbrlInput.hypercubes[0];return e.filter(e=>{var t;const o=null==(t=i.roles)?void 0:t.find(t=>t.roleId===e.id);if(!o||!o.items||0===o.items.length)return!0;for(const i of this.roleFilterAxes){const e=new Set(i.members.filter(e=>!0===e.available).map(e=>e.id));let t=!1,r=!1;for(const n of o.items){if(!n.dimensions||0===n.dimensions.length)continue;const o=n.dimensions.find(e=>e.id===i.id||i.conceptName&&e.conceptName===i.conceptName);if(o){if(t=!0,o.members)for(const t of o.members)if(e.has(t.id)){r=!0;break}if(r)break}}if(t&&!r)return!1}return!0})}_preserveDataForHiddenSections(){var e;const t=(null==(e=this._currentSchema)?void 0:e.sections.map(e=>e.id))||[],i=this._getRoleIdsArray();t.filter(e=>!i.includes(e)).forEach(e=>{const t=this._allSections.find(t=>t.id===e);t&&this._preserveSectionData(t)})}_restoreDataForVisibleSections(e){e.forEach(e=>{this._restoreSectionData(e)}),e.length}_preserveSectionData(e){e.concepts.forEach(t=>{this._preserveConceptData(t,e.id)})}_preserveConceptData(e,t){this._formData[e.id]&&(this._preservedFormData[e.id]={...this._formData[e.id]}),e.fields.forEach(i=>{const o=this._scopedColumnKey(t,i.columnId);this._typedMemberData[o]&&(this._preservedTypedMemberData[o]={...this._typedMemberData[o]});const r=`${e.id}__${i.columnId}`;this._typedMemberData[r]&&(this._preservedTypedMemberData[r]={...this._typedMemberData[r]})}),e.children&&e.children.forEach(e=>{this._preserveConceptData(e,t)})}_restoreSectionData(e){e.concepts.forEach(t=>{this._restoreConceptData(t,e.id)})}_restoreConceptData(e,t){this._preservedFormData[e.id]&&(this._formData[e.id]={...this._preservedFormData[e.id]}),e.fields.forEach(i=>{const o=this._scopedColumnKey(t,i.columnId);this._preservedTypedMemberData[o]&&(this._typedMemberData[o]={...this._preservedTypedMemberData[o]});const r=`${e.id}__${i.columnId}`;this._preservedTypedMemberData[r]&&(this._typedMemberData[r]={...this._preservedTypedMemberData[r]})}),e.children&&e.children.forEach(e=>{this._restoreConceptData(e,t)})}_shouldShowFilterButton(){return!0}get _hasActiveAdvancedFilters(){return this._showFactsOnly||this._conceptSearchText.trim().length>0}get _footerVisibleRoleCount(){return this._hasActiveAdvancedFilters&&this._currentSchema?this._getSidePanelVisibleSections(this._currentSchema).length:this._selectedRoleIds.length}_analyzeConceptFilterMatches(e,t){const i=e=>(e.includes(":")?e.split(":").pop():e).toLowerCase(),o=this._conceptSearchText.trim().toLowerCase();let r=0,n="",a="",s="",l="";const d=e=>{var c;for(const p of e){if(t.has(p.originalConceptId)){r++;const e=i(p.name)===o;e&&p.abstract&&!a?a=p.label:!e||p.abstract||n?p.abstract&&!l?l=p.label:p.abstract||s||(s=p.label):n=p.label}(null==(c=p.children)?void 0:c.length)&&d(p.children)}};for(const c of e)d(c.concepts);return{count:r,label:n||a||s||l||this._conceptSearchText}}_renderActiveFilterBanner(t){if(!this._hasActiveAdvancedFilters)return"";const i=this._conceptSearchText.trim().length>0?(()=>{const e=this._getConceptSearchMatchIds(this._conceptSearchText),{count:i,label:o}=this._analyzeConceptFilterMatches(t,e);return F.t("filter.bannerConcept",{concept:o,count:i})})():F.t("filter.bannerFactsOnly");return e.html`
|
|
3893
3994
|
<div class="active-filter-banner">
|
|
3894
3995
|
<span class="active-filter-banner-text">${i}</span>
|
|
3895
3996
|
<button
|
|
3896
3997
|
type="button"
|
|
3897
3998
|
class="active-filter-banner-clear"
|
|
3898
3999
|
@click="${this._handleClearAdvancedFilters}"
|
|
3899
|
-
>${
|
|
4000
|
+
>${F.t("filter.showAll")}</button>
|
|
3900
4001
|
</div>
|
|
3901
|
-
`}_handleClearAdvancedFilters(){const e=this._lastFocusedFieldIdentity;this._showFactsOnly=!1,this._conceptSearchText="",this.updateComplete.then(async()=>{var t;const i=Array.from((null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-section"))??[]);await Promise.all(i.map(e=>e.updateComplete));const o=i.flatMap(e=>{var t;return Array.from((null==(t=e.shadowRoot)?void 0:t.querySelectorAll("jupiter-concept-tree"))??[])});await Promise.all(o.map(e=>e.updateComplete)),this._scrollActiveRoleIntoView(),e&&this._restoreFieldFocus(e)})}_effectiveNumberLocale(){return this.numberLocale||("nl"===this.language?"nl-NL":"en-US")}_amountScaleFactor(){if("INF"===this.decimals||void 0===this.decimals||null===this.decimals)return null;const e=parseFloat(this.decimals);return isNaN(e)||e<=0?null:Math.pow(10,e)}_amountScaleCaption(){const e=this._amountScaleFactor();if(null===e)return E.t("section.amountScaleBase");const t=new Intl.NumberFormat(this._effectiveNumberLocale()).format(e);return E.t("section.amountScaleFactor",{factor:t})}_sectionHasMonetaryConcepts(e){return e.some(e=>{var t;return(null==(t=e.type)?void 0:t.toLowerCase().includes("monetary"))||e.children&&this._sectionHasMonetaryConcepts(e.children)})}_scrollActiveRoleIntoView(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-roles-list .side-panel-role-item.active");null==t||t.scrollIntoView({block:"center"})}_restoreFieldFocus(e){var t,i,o,r;const n=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-section"))??[];for(const a of Array.from(n)){const t=(null==(i=a.shadowRoot)?void 0:i.querySelectorAll("jupiter-concept-tree"))??[];for(const i of Array.from(t)){const t=(null==(o=i.shadowRoot)?void 0:o.querySelectorAll("jupiter-form-field"))??[];for(const i of Array.from(t))if(i.conceptId===e.conceptId&&i.columnId===e.columnId){const e=null==(r=i.shadowRoot)?void 0:r.querySelector('input:not([type="hidden"]), select, textarea');return void(null==e||e.focus({preventScroll:!0}))}}}}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleAdvancedFilterApply(e){this._showFactsOnly=e.detail.showFactsOnly,this._conceptSearchText=e.detail.conceptSearchText??"",this._showFilterDialog=!1}_handleFilterDialogCancel(){this._showFilterDialog=!1;this._getRoleIdsArray().length;this._allSections.length}_handleFormulaValidationDialogCancel(){this._showFormulaValidationDialog=!1}_handleFormulaConceptClick(e){this._showFormulaValidationDialog=!1,this.scrollToConcept(e.detail.conceptQName,void 0,void 0,e.detail.columnId,e.detail.conceptId)}_handleRoleFilterApply(e){const{selectedRoleIds:t,periodPreferences:i}=e.detail;this._applyRoleSelection(t,i,"filterDialog")}_applyRoleSelection(e,t,i){var o,r;this._selectedRoleIds,this._selectedRoleIds=e,this._periodPreferences=t,this._selectedRoleIds,this._periodPreferences;const n=this._generateSubmissionData(),a=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts,this._decimalsData,void 0,this._getHiddenColumnsForMetadata(),this._totalManuallyEditedData);this._draftStorageService.saveDraft(n,a),this.dynaformsFacts=n,this.dynaformsMetadata=a,this._skipPeriodPreferencesRestore=!0,this._skipDraftLoading=!0,this._initializeForm(),this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,null==(o=this._currentSchema)||o.sections.length,null==(r=this._currentSchema)||r.sections.map(e=>e.id);const s=this._loadDraftIfExists().then(()=>{this._seedAutoSaveBaseline()}).catch(e=>{console.error("❌ Error restoring form data after reinitialization:",e)});this._showFilterDialog=!1;const l=Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0?(this._selectedRoleIds[0],this._selectedRoleIds.length):0;return this._allSections.length,this._selectedRoleIds,this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:e,totalRoles:this._allSections.length,visibleRoles:l,periodPreferences:t,source:i},bubbles:!0})),s}_confirmRevealHiddenRole(e){var t;return null==(t=this._revealRolePrompt)||t.resolve(!1),new Promise(t=>{this._revealRolePrompt={section:e,resolve:t}})}_settleRevealRolePrompt(e){const t=this._revealRolePrompt;this._revealRolePrompt=null,null==t||t.resolve(e)}_revealRole(e){var t;const i=this._selectedRoleIds;let o;if(i.length>0&&"object"==typeof i[0]){const r=i,n=Math.max(-1,...r.map(e=>e.order))+1;o=[...r,{roleId:e.id,roleURI:(null==(t=e.metadata)?void 0:t.roleURI)||"",order:n}]}else o=[...i,e.id];return this._applyRoleSelection(o,this._periodPreferences,"scrollToConcept")}_haveDimensionSelectionsChanged(e){var t;const i=new Set([...Object.keys(this._periodPreferences||{}),...Object.keys(e||{})]);for(const o of i){const i=null==(t=this._periodPreferences)?void 0:t[o],r=null==e?void 0:e[o],n=(null==i?void 0:i.dimensionSelections)||[],a=(null==r?void 0:r.dimensionSelections)||[];if(JSON.stringify(n.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId)))!==JSON.stringify(a.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId))))return!0}return!1}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],n=$.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...n)}t.push(...Array.from(this._calculationWarnings.values())),this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleCalculationMismatchChanged(e){const{key:t,mismatch:i}=e.detail,o=new Map(this._calculationWarnings);i?o.set(t,{fieldId:`${i.totalConceptId}__${i.columnId}`,conceptId:i.totalConceptId,columnId:i.columnId,message:i.message,severity:"warning",rule:{type:"custom",message:i.message,severity:"warning"},details:i}):o.delete(t),this._calculationWarnings=o,this._validateForm()}_writeFormDataValue(e,t,i){const o={...this._formData};o[e]||(o[e]={});const r=o[e][t];return o[e]={...o[e],[t]:i},this._formData=o,r}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,n=this._writeFormDataValue(i,o,r);this._formData[i],this._touched.add(`${i}-${o}`),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_handlePeriodChange(e){e.detail;const{conceptId:t,columnId:i,periodType:o,periodStartDate:r,periodEndDate:n,periodInstantDate:a,unit:s}=e.detail,l={...this._periodData};l[t]||(l[t]={}),l[t]={...l[t],[i]:{startDate:r,endDate:n,instantDate:a}},this._periodData=l,this._periodData[t][i],JSON.stringify(this._periodData,null,2),s&&this._storeUnit(t,i,s),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate()}_handleUnitChange(e){e.detail;const{conceptId:t,columnId:i,unit:o}=e.detail;this._storeUnit(t,i,o),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate()}_storeUnit(e,t,i){JSON.stringify(this._unitData,null,2);const o={...this._unitData};o[e]||(o[e]={}),o[e]={...o[e],[t]:i},this._unitData=o,this._unitData[e][t],JSON.stringify(this._unitData,null,2)}_handleDecimalsChange(e){const{conceptId:t,columnId:i,decimals:o}=e.detail;t&&i&&(this._storeDecimals(t,i,o),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate())}_computeEffectiveMasterData(){const e="rj-i_DocumentIntendedRoundingLevel";if("INF"!==this.decimals){const t=parseFloat(this.decimals);if(!isNaN(t))return void(this._effectiveMasterData={...this.masterData||{},[e]:String(-t)})}this._effectiveMasterData=this.masterData?{...this.masterData}:void 0}_initializeGlobalDecimalsFromRoundingData(){if(this._hasValidGlobalDecimals())return;const e=this._findRoundingLevelFactValue(this._allSections)??this._findRoundingLevelValueInFormData(this._formData);if(null==e||""===e)return;const t=parseFloat(String(e));isNaN(t)||(this.decimals=String(Math.abs(t)))}_findRoundingLevelValueInFormData(e){if(e)for(const t of Object.keys(e)){if(!this._isRoundingLevelConcept(t))continue;const i=e[t]||{};for(const e of Object.keys(i)){const t=i[e];if(null!=t&&""!==t)return t}}}_findRoundingLevelFactValue(e){for(const t of e){const e=this._findRoundingLevelFactValueInConcepts(t.concepts||[]);if(null!=e&&""!==e)return e}}_findRoundingLevelFactValueInConcepts(e){for(const t of e){const e=t.originalConceptId||t.id;if(this._isRoundingLevelConcept(e)){const e=t.facts||[];for(const t of e)if(void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)&&""!==(null==t?void 0:t.value))return t.value}if(t.children&&t.children.length>0){const e=this._findRoundingLevelFactValueInConcepts(t.children);if(null!=e&&""!==e)return e}}}_hasValidGlobalDecimals(){if(void 0===this.decimals||null===this.decimals)return!1;if("INF"===this.decimals)return!1;const e=parseFloat(this.decimals);return!isNaN(e)}_isRoundingLevelConcept(e){return!!e&&("rj-i_DocumentIntendedRoundingLevel"===e||e.includes("DocumentIntendedRoundingLevel"))}_findFactValueForField(e,t,i){var o,r;if(!e.facts||0===e.facts.length)return;const n=this._findColumnByIdInSection(t.columnId,i),a=null==(o=this._periodData[e.id])?void 0:o[t.columnId],s=(null==a?void 0:a.startDate)||(null==n?void 0:n.periodStartDate)||t.periodStartDate||this.periodStartDate,l=(null==a?void 0:a.endDate)||(null==n?void 0:n.periodEndDate)||t.periodEndDate||this.periodEndDate,d=(null==a?void 0:a.instantDate)||t.periodInstantDate||l||s,c=null==(r=this._unitData[e.id])?void 0:r[t.columnId],p={conceptId:e.originalConceptId||t.conceptId||e.id,columnId:t.columnId,periodStartDate:s,periodEndDate:l,periodInstantDate:d,periodType:t.periodType,unit:c,dimensionData:null==n?void 0:n.dimensionData},u=De.findMatchingFact(e.facts,p);return null==u?void 0:u.value}_storeDecimals(e,t,i){const o={...this._decimalsData};o[e]||(o[e]={}),o[e]={...o[e],[t]:i??""},this._decimalsData=o}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleAddConceptRepeat(e){const{conceptId:t}=e.detail;this._repeatCounts={...this._repeatCounts,[t]:(this._repeatCounts[t]||0)+1},this._dirty=!0,this.hasUnsavedChanges=!0}_handleRemoveConceptRepeat(e){const{conceptId:t}=e.detail,i=t.match(/^(.+)__repeat_(\d+)$/),o=i?i[1]:t,r=i?parseInt(i[2]):this._repeatCounts[t]||0,n=this._repeatCounts[o]||0;if(n<=0||r<1||r>n)return;const a={...this._formData},s={...this._typedMemberData},l={...this._unitData},d={...this._periodData};for(let u=r;u<n;u++){const e=`${o}__repeat_${u+1}`,t=`${o}__repeat_${u}`;void 0!==a[e]?a[t]=a[e]:delete a[t];const i=`${t}__`,r=`${e}__`,n=Object.keys(s).filter(e=>e.startsWith(r));Object.keys(s).filter(e=>e.startsWith(i)).forEach(e=>delete s[e]),n.forEach(e=>{s[`${t}__${e.slice(r.length)}`]=s[e]}),n.forEach(e=>delete s[e]),void 0!==l[e]?l[t]=l[e]:delete l[t],void 0!==d[e]?d[t]=d[e]:delete d[t]}const c=`${o}__repeat_${n}`;delete a[c],delete l[c],delete d[c];const p=`${c}__`;Object.keys(s).filter(e=>e.startsWith(p)).forEach(e=>delete s[e]),this._formData=a,this._typedMemberData=s,this._unitData=l,this._periodData=d,this._repeatCounts={...this._repeatCounts,[o]:n-1},this._dirty=!0,this.hasUnsavedChanges=!0}_scopedColumnKey(e,t){return`${e}__${t}`}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o,conceptId:r,sectionId:n}=e.detail,a=r?`${r}__${t}`:n?this._scopedColumnKey(n,t):t,s={...this._typedMemberData};s[a]||(s[a]={}),s[a]={...s[a],[i]:o},this._typedMemberData=s,this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleFieldBlur(e){var t;e.detail;const{fieldId:i,conceptId:o,columnId:r,xbrlValidationErrors:n}=e.detail;let a="";const s=e.composedPath();s.length;for(const l of s){const e=l;if("JUPITER-FORM-SECTION"===e.tagName){a=e.getAttribute("section-id")||"";break}}if(n&&n.length,n&&n.length>0){const e=(null==(t=this._formData[o])?void 0:t[r])||"",s=this._xbrlFormErrors.findIndex(e=>e.fieldId===i&&e.sectionId===a),l={sectionId:a,fieldId:i,conceptId:o,columnId:r,value:e,errors:n};this._xbrlFormErrors=s>=0?[...this._xbrlFormErrors.slice(0,s),l,...this._xbrlFormErrors.slice(s+1)]:[...this._xbrlFormErrors,l]}else{this._xbrlFormErrors.length;this._xbrlFormErrors=this._xbrlFormErrors.filter(e=>!(e.fieldId===i&&e.sectionId===a)),this._xbrlFormErrors.length}this._xbrlFormErrors.length,this._xbrlFormErrors}_getSectionTitle(e){this._allSections.map(e=>({id:e.id,title:e.title}));const t=this._allSections.find(t=>t.id===e),i=(null==t?void 0:t.title)||e||"(Unknown Section)";return i}_roleHasErrors(e){return this._xbrlFormErrors.some(t=>t.sectionId===e)}async _handleErrorFieldClick(e,t,i){this._showErrorPopup=!1,this.requestUpdate(),await this._focusFormField(e,t,i)}async _handleTypedDimensionFactClick(e,t,i){this._showTypedDimensionWarning=!1,this.requestUpdate(),await this._focusFormField(e,t,i)}async _focusFormField(e,t,i){var o,r,n,a,s,l,d;if(await this.updateComplete,!(null==(o=this._currentSchema)?void 0:o.sections.some(e=>e.id===i))){const e=this._allSections.find(e=>e.id===i);if(!e||!(await this._confirmRevealHiddenRole(e)))return;await this._revealRole(e)}(null==(r=this._hiddenColumnIds.get(i))?void 0:r.has(t))&&(this._showColumn(i,t),await this.updateComplete),"sidePanel"===this.display&&this._activeSidePanelRoleId!==i&&(this._activeSidePanelRoleId,this._activeSidePanelRoleId=i,this.requestUpdate(),await this.updateComplete,this._scrollActiveRoleIntoView(),await new Promise(e=>setTimeout(e,500)));const c=null==(n=this.shadowRoot)?void 0:n.querySelectorAll("jupiter-form-section");let p=null;if(null==c||c.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===i&&(p=e)}),!p)return void console.warn(`⚠️ Section not found: ${i}`);if(await p.updateComplete,await(null==(a=p.revealConcept)?void 0:a.call(p,e))&&await Promise.all(Array.from((null==(s=p.shadowRoot)?void 0:s.querySelectorAll("jupiter-concept-tree"))??[]).map(e=>e.updateComplete)),await new Promise(e=>setTimeout(e,100)),p.shadowRoot,p.shadowRoot){null==(l=p.shadowRoot.innerHTML)||l.length;const e=p.shadowRoot.querySelectorAll("*");e.length;Array.from(e).filter(e=>{const t=e;return!(!t.tagName||!t.tagName.includes("-"))}).map(e=>e.tagName).join(", ")}const u=`${e}_${t}_field`,h=null==(d=p.shadowRoot)?void 0:d.querySelectorAll("jupiter-concept-tree");let m=null;if(null==h||h.length,h&&h.forEach((i,o)=>{var r;if(m)return;const n=null==(r=i.shadowRoot)?void 0:r.querySelectorAll("jupiter-form-field");null==n||n.length,null==n||n.forEach((i,o)=>{var r;if(!m&&(i.conceptId,i.columnId,i.conceptId===e&&i.columnId===t)){const e=null==(r=i.shadowRoot)?void 0:r.querySelector("input, textarea");e&&(m=e)}})}),!m)return void console.warn(`⚠️ Input field not found for: ${u}`);const f=m;p.scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(e=>setTimeout(e,300)),f.focus(),"INPUT"!==f.tagName&&"TEXTAREA"!==f.tagName||f.select(),f.style.boxShadow="0 0 0 3px rgba(220, 38, 38, 0.5)",setTimeout(()=>{f.style.boxShadow=""},2e3)}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnHide(e){const{columnId:t,sectionId:i}=e.detail;i&&t&&(this._hiddenColumnIds.has(i)||this._hiddenColumnIds.set(i,new Set),this._hiddenColumnIds.get(i).add(t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-hide",{detail:{columnId:t,sectionId:i},bubbles:!0})))}_handleColumnShow(e){const{columnId:t,sectionId:i}=e.detail;i&&t&&this._showColumn(i,t)}_showColumn(e,t){var i;null==(i=this._hiddenColumnIds.get(e))||i.delete(t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-show",{detail:{columnId:t,sectionId:e},bubbles:!0}))}_getColumnsWithHiddenFlags(e){const t=e.columns||this._columns,i=this._hiddenColumnIds.get(e.id);return i&&0!==i.size?t.map(e=>i.has(e.id)?{...e,hidden:!0}:e):t}_getHiddenColumnsForMetadata(){if(0===this._hiddenColumnIds.size)return;const e={};return this._hiddenColumnIds.forEach((t,i)=>{t.size>0&&(e[i]=Array.from(t))}),Object.keys(e).length>0?e:void 0}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i,insertAfterColumnId:o}=e.detail;this._addColumnFromRequest(i,t,o)}_getAvailableDimensionsForSection(e){var t,i,o;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return[];const n=[],a=this.language||"en",s=(e,t)=>{var i;return(null==(i=(null==e?void 0:e.find(e=>e.lang===a&&"http://www.xbrl.org/2003/role/label"===e.role))||(null==e?void 0:e.find(e=>"en"===e.lang&&"http://www.xbrl.org/2003/role/label"===e.role))||(null==e?void 0:e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role)))?void 0:i.label)||t};return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{if(!n.find(t=>t.id===e.id)){const t=s(e.labels,e.conceptName),i={id:e.id,conceptName:e.conceptName,axisLabel:t};e.members&&e.members.length>0&&(i.members=e.members.map(e=>({id:e.id,label:s(e.labels,e.conceptName||e.id)}))),e.typedMember&&(i.typedMember={id:e.typedMember.id,dataType:e.typedMember.type||"string",validation:e.typedMember.validation}),n.push(i)}})}),n}_formatPeriodDisplay(e,t){if(!e||!t)return`${e||""} / ${t||""}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}_resolveSubmissionInstantDate(e,t,i,o){const r=this._getEffectivePeriodRole(e);if(null==r?void 0:r.includes("periodStartLabel")){const e=(null==i?void 0:i.startDate)||(null==o?void 0:o.periodStartDate)||t.periodStartDate||this.periodStartDate,n=(null==i?void 0:i.endDate)||(null==o?void 0:o.periodEndDate)||t.periodEndDate||this.periodEndDate;return this._resolveInstantDate(r,void 0,e,n)}return(null==i?void 0:i.instantDate)||(null==i?void 0:i.endDate)||t.periodInstantDate||(null==o?void 0:o.periodEndDate)||t.periodEndDate||t.periodStartDate||this.periodStartDate}_getEffectivePeriodRole(e){return e.effectivePeriodRole??e.preferredLabel}_resolveInstantDate(e,t,i,o){if(null==e?void 0:e.includes("periodStartLabel")){const e=i||"2025-01-01";try{const t=new Date(e);return t.setDate(t.getDate()-1),t.toISOString().split("T")[0]}catch{return e}}return t||o||i||"2025-01-01"}_correctLegacyPeriodStartInstantDates(){this._allSections.forEach(e=>{this._correctPeriodStartInstantDatesInConcepts(e.concepts,e)})}_correctPeriodStartInstantDatesInConcepts(e,t){e.forEach(e=>{var i,o;(null==(i=this._getEffectivePeriodRole(e))?void 0:i.includes("periodStartLabel"))&&"instant"===e.periodType&&(null==(o=e.fields)?void 0:o.length)&&e.fields.forEach(i=>{this._correctFieldPeriodStartInstantDate(e,i,e.id,t);const o=this._repeatCounts[e.id]||0;for(let r=1;r<=o;r++)this._correctFieldPeriodStartInstantDate(e,i,`${e.id}__repeat_${r}`,t)}),e.children&&this._correctPeriodStartInstantDatesInConcepts(e.children,t)})}_correctFieldPeriodStartInstantDate(e,t,i,o){var r;const n=this._findColumnByIdInSection(t.columnId,o),a=null==(r=this._periodData[i])?void 0:r[t.columnId],s=(null==a?void 0:a.startDate)||(null==n?void 0:n.periodStartDate)||t.periodStartDate||this.periodStartDate,l=(null==a?void 0:a.endDate)||(null==n?void 0:n.periodEndDate)||t.periodEndDate||this.periodEndDate,d=this._resolveInstantDate(this._getEffectivePeriodRole(e),void 0,s,l);a&&a.instantDate!==d&&(t.columnId,a.instantDate,a.instantDate=d),t.periodInstantDate!==d&&(e.id,t.columnId,t.periodInstantDate,t.periodInstantDate=d)}_addColumnFromRequest(e,t,i){var o,r,n,a,s;const l=`col-${Date.now()}`;let d="",c="";"instant"===e.periodType?(d=e.instantDate||"",c=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(d=this._formatPeriodDisplay(e.startDate,e.endDate),c="");let p={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:d};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const o of e.selectedDimensions)o.isTyped?(t.push(o.axisLabel),i.push(`${o.axisId}|${o.typedValue||""}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));t.length>0&&(d=t.join(" | "),c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={dimensionId:l,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},p.memberKey)}else if(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(n=null==i?void 0:i.items)?void 0:n.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(a=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||i.conceptName,o=i.members[0],r=(null==(s=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||o.conceptName;d=r,c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={dimensionId:l,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},p.memberKey}}}}const u={id:l,title:d,description:c,type:(p.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:p,periodStartDate:"instant"===e.periodType?e.instantDate:e.startDate,periodEndDate:"instant"===e.periodType?e.instantDate:e.endDate};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0);i&&(this._typedMemberData[l]=t,u.dimensionData&&(u.dimensionData.hasTypedMembers=!0,u.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel,type:e.dataType,validation:e.validation}))))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);if(e)if(e.columns||(e.columns=[...this._columns]),i){const t=e.columns.findIndex(e=>e.id===i);e.columns=-1!==t?[...e.columns.slice(0,t+1),u,...e.columns.slice(t+1)]:[...e.columns,u]}else e.columns=[...e.columns,u]}this._replicateFieldsForNewColumn(l,e,t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:u},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(!(t.selectedDimensions&&t.selectedDimensions.length>0)&&e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new k,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let n;const a="instant"===i.periodType?i.instantDate:i.startDate,s="instant"===i.periodType?i.instantDate:i.endDate,l=this._resolveInstantDate(this._getEffectivePeriodRole(e),i.instantDate,a,s);n=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodType:e.periodType,conceptType:e.type,periodStartDate:a,periodEndDate:s,periodInstantDate:"instant"===e.periodType?l:void 0}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodType:e.periodType,conceptType:e.type,periodStartDate:a,periodEndDate:s,periodInstantDate:"instant"===e.periodType?l:void 0},e.fields||(e.fields=[]),e.fields.push(n)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_findMissingTypedDimensionFacts(){var e;const t=[];if(!this._currentSchema)return t;for(const i of this._currentSchema.sections)for(const o of i.columns||[]){const r=null==(e=o.dimensionData)?void 0:e.typedMembers;if(!r||0===r.length)continue;const n=this._typedMemberData[this._scopedColumnKey(i.id,o.id)],a=this._typedMemberData[o.id];r.some(e=>{const t=(null==n?void 0:n[e.axisId])??(null==a?void 0:a[e.axisId]);return!(null==t?void 0:t.trim())})&&this._collectEnteredFactsForColumn(i.concepts,o,i,t)}return t}_collectEnteredFactsForColumn(e,t,i,o){var r,n;for(const a of e){const e=null==(r=this._formData[a.id])?void 0:r[t.id];null!=e&&""!==String(e).trim()&&o.push({conceptId:a.id,conceptLabel:a.label,columnId:t.id,columnTitle:t.title,sectionId:i.id,sectionTitle:i.title,value:e}),(null==(n=a.children)?void 0:n.length)&&this._collectEnteredFactsForColumn(a.children,t,i,o)}}_groupTypedDimensionWarningFactsByRole(){const e=[],t=new Map;for(const i of this._typedDimensionWarningFacts){let o=t.get(i.sectionId);o||(o={sectionId:i.sectionId,sectionTitle:i.sectionTitle,facts:[]},t.set(i.sectionId,o),e.push(o)),o.facts.push(i)}return e}_handleSubmit(){if(this._submitted=!0,this._submitDisabled=!0,"admin"===this.mode)return this._handleSaveDraft(),this._handleAdminModeSubmit(),void(this._submitDisabled=!1);const e=this._findMissingTypedDimensionFacts();if(e.length>0)return this._typedDimensionWarningFacts=e,this._showTypedDimensionWarning=!0,this._submitDisabled=!1,void this.requestUpdate();this._continueSubmit()}_continueSubmit(){if(this._submitted=!0,this._submitDisabled=!0,this._xbrlFormErrors.length,this._xbrlFormErrors,this._xbrlFormErrors.length>0)return this._xbrlFormErrors,this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();if(this._validateForm(),!this._valid)return this._errors,this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();this._correctLegacyPeriodStartInstantDates();const e=this._generateSubmissionData();JSON.stringify(e,null,2),e.forEach((e,t)=>{e.conceptId,e.columnId,e.value,e.unit}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors,reportingLanguage:this.reportingLanguage},bubbles:!0})),setTimeout(()=>{this._submitDisabled=!1},1e3)}_handleQuickValidate(){"admin"!==this.mode&&this._runFormulaValidationPreflight()}_runFormulaValidationPreflight(){var e,t,i,o,r,n,a,s;if(!this.formulaEnabled)return;const l=null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.formula)?void 0:t[0])?void 0:i.roles;if(!l||0===l.length)return;const d=(null==(r=null==(o=this._currentSchema)?void 0:o.sections)?void 0:r.length)?this._currentSchema.sections:this._allSections;if(!d||0===d.length)return;const c=new Set(d.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.roleURI)||e.id})),p=l.filter(e=>c.has(e.roleURI));if(0===p.length)return;const u=d.map(e=>{var t;return{roleURI:(null==(t=e.metadata)?void 0:t.roleURI)||e.id,concepts:e.concepts,columns:e.columns}}),h=X(this._formData,this._mergeAllSectionColumns(),u,null==(s=null==(a=null==(n=this.xbrlInput)?void 0:n.hypercubes)?void 0:a[0])?void 0:s.roles,this.periodStartDate,this.periodEndDate,this._typedMemberData),m={...this.xbrlInput,formula:[{...this.xbrlInput.formula[0],roles:p}]},f=this._formulaValidationService.evaluate(m,h,this.language),b=this._formulaValidationService.summarize(f);this._formulaValidationResults=f,this._formulaValidationSummary=b;f.some(e=>!e.skipped&&!e.satisfied)&&(this._showFormulaValidationDialog=!0),this.dispatchEvent(new CustomEvent("formula-validation-complete",{detail:{results:f,summary:b},bubbles:!0,composed:!0}))}_mergeAllSectionColumns(){const e=new Map;return this._columns.forEach(t=>e.set(t.id,t)),this._allSections.forEach(t=>{(t.columns||[]).forEach(t=>e.set(t.id,t))}),Array.from(e.values())}_handleSaveDraft(e="manual"){if(this._xbrlFormErrors.length,this._xbrlFormErrors,this._xbrlFormErrors.length>0)return this._xbrlFormErrors,this._showErrorPopup=!0,void this.requestUpdate();this._formData,this._unitData,this._selectedRoleIds,this._correctLegacyPeriodStartInstantDates();const t=this._generateSubmissionData();t.forEach((e,t)=>{e.conceptId,e.columnId,e.value,e.unit});const i=this._roleCompletedStates.size>0?Object.fromEntries(this._roleCompletedStates):void 0,o=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts,this._decimalsData,i,this._getHiddenColumnsForMetadata(),this._totalManuallyEditedData),r=JSON.stringify({draftData:t,metadata:o});if(r===this._lastSavedDraftSnapshot)return void(this.hasUnsavedChanges=!1);this._lastSavedDraftSnapshot=r,this.hasUnsavedChanges=!1;const n=this._draftStorageService.saveDraft(t,o);o.selectedRoleIds,this.dynaformsFacts=t,this.dynaformsMetadata=o,this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:t,metadata:o,saved:n,valid:this._valid,errors:this._errors,dynaformsFacts:t,dynaformsMetadata:o,reportingLanguage:this.reportingLanguage,source:"auto"==e?"auto":"manual"},bubbles:!0,composed:!0}));this._getRoleIdsArray().length;t.length,o.customColumns.length,Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&this._selectedRoleIds[0]}async _loadDraftIfExists(){if(this.dynaformsFacts&&this.dynaformsMetadata){const e={formData:this.dynaformsFacts,metadata:this.dynaformsMetadata};return await this._restoreFromDraft(e),this._draftLoaded=!0,this._draftLoadedAt=this.dynaformsMetadata.savedAt||(new Date).toISOString(),void this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,source:"external",compatible:!0,warnings:[]},bubbles:!0,composed:!0}))}if(!this._draftStorageService.hasDraft())return;const e=this._draftStorageService.loadDraft();if(!e)return void console.warn("⚠️ Failed to load draft");const{compatible:t,warnings:i}=this._draftStorageService.validateDraftCompatibility(e,this.periodStartDate,this.periodEndDate);i.length>0&&console.warn("⚠️ Draft compatibility warnings:",i),await this._restoreFromDraft(e),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,compatible:t,warnings:i},bubbles:!0,composed:!0})),e.formData.length,e.metadata.savedAt,this._draftStorageService.getDraftAge()}async _restoreFromDraft(e){var t;const{formData:i,metadata:o}=e;o.selectedRoleIds&&o.selectedRoleIds.length>0&&(this._selectedRoleIds=o.selectedRoleIds,this._selectedRoleIds.length),o.typedMemberData&&(this._typedMemberData=o.typedMemberData,this._preservedTypedMemberData={}),o.repeatCounts&&(this._repeatCounts=o.repeatCounts,this._repeatCounts),o.periodData&&(this._periodData=o.periodData,Object.keys(this._periodData).length),o.unitData&&(this._unitData=o.unitData,Object.keys(this._unitData).length),o.decimalsData&&(this._decimalsData=o.decimalsData,Object.keys(this._decimalsData).length),o.roleCompletedStates&&(this._roleCompletedStates=new Map(Object.entries(o.roleCompletedStates)),Object.keys(o.roleCompletedStates).length),o.hiddenColumns&&(this._hiddenColumnIds=new Map(Object.entries(o.hiddenColumns).map(([e,t])=>[e,new Set(t)])),this._hiddenColumnIds.size),o.totalManuallyEditedData&&(this._totalManuallyEditedData=o.totalManuallyEditedData,Object.keys(this._totalManuallyEditedData).length),o.periodPreferences?this._skipPeriodPreferencesRestore||(this._periodPreferences=o.periodPreferences,this._periodPreferences,this.xbrlInput&&(this._currentSchema=k.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._allSections=[...this._currentSchema.sections],this._applyCustomPeriodDataToFields(),o.customColumns&&o.customColumns.length>0&&(this._mergeAdditionalCustomColumns(o.customColumns),o.customColumns.length))):o.customColumns&&o.customColumns.length>0&&(this._restoreCustomColumns(o.customColumns),o.customColumns.length);const r={},n={},a={};i.forEach(e=>{let{conceptId:t,draftInstanceId:i,value:o,columnId:s,period:l,unit:d}=e;if(!s&&l&&(s=this._inferColumnIdFromPeriod(l,t),!s))return void console.warn(`⚠️ Could not infer columnId for concept ${t}, skipping...`);const c=i||t,p=c.includes("__repeat_")?c.split("__repeat_")[0]:c,u=this._findActualConceptId(p),h=c.includes("__repeat_")?`${u||p}__repeat_${c.split("__repeat_")[1]}`:u||c;r[h]||(r[h]={}),r[h][s]=o,l&&(n[h]||(n[h]={}),"instant"===l.type?(n[h][s]={instantDate:l.date},l.date):"duration"===l.type&&(n[h][s]={startDate:l.startDate,endDate:l.endDate},l.startDate,l.endDate)),d&&(a[h]||(a[h]={}),a[h][s]=d)}),this._formData={...this._formData,...r},Object.keys(r).length,this._seedLegacyManuallyEditedTotals(r),this._initializeGlobalDecimalsFromRoundingData(),this._periodData={...this._periodData,...o.periodData||{},...n},Object.keys(this._periodData).length,JSON.stringify(this._periodData,null,2),this._unitData={...this._unitData,...o.unitData||{},...a},Object.keys(this._unitData).length,JSON.stringify(this._unitData,null,2),this._correctLegacyPeriodStartInstantDates(),this._selectedRoleIds.length>0&&this._applyRoleFilter(),this._dirty=!0,this._touched.clear(),this._validateForm(),this._allSections=[...this._allSections],this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,100));const s=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("input, textarea, select").length)||0;s>0?this._populateFieldValues(r):console.error("❌ No fields found in DOM even after updateComplete")}_findActualConceptId(e){for(const t of this._allSections){const i=this._findActualConceptIdInTree(t.concepts,e);if(i)return i}return null}_findActualConceptIdInTree(e,t){for(const i of e){if(i.originalConceptId===t||i.id===t)return i.id;if(i.children){const e=this._findActualConceptIdInTree(i.children,t);if(e)return e}}return null}_inferColumnIdFromPeriod(e,t){for(const i of this._allSections){if(this._findConceptInSection(i.concepts,t)&&i.columns){for(const t of i.columns){const i="instant"===e.type,o="duration"===e.type;if(i&&e.date){if(t.periodStartDate===e.date||t.periodStartDate===t.periodEndDate&&t.periodStartDate===e.date)return t.id,t.id}else if(o&&e.startDate&&e.endDate&&t.periodStartDate===e.startDate&&t.periodEndDate===e.endDate)return t.id,t.id}if("instant"===e.type){const e=i.columns.find(e=>"instant"===e.id);if(e)return e.id}else{const e=i.columns.find(e=>"duration"===e.id);if(e)return e.id}}}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t||i.originalConceptId===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_populateFieldValues(e){Object.keys(e).forEach(t=>{const i=e[t];Object.keys(i).forEach(e=>{var o,r;const n=i[e],a=`${t}__${e}`,s=null==(o=this.shadowRoot)?void 0:o.querySelector(`#${CSS.escape(a)}`);s?(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)&&("checkbox"===s.type?s.checked=Boolean(n):s.value=null!=n?String(n):""):(console.warn(` ❌ Field element NOT FOUND: ${a}`),console.warn(" Available fields in DOM:",Array.from((null==(r=this.shadowRoot)?void 0:r.querySelectorAll("input, textarea, select"))||[]).map(e=>e.id).filter(e=>e.includes(t.split("__")[0]))))})})}_seedLegacyManuallyEditedTotals(e){const t={...this._totalManuallyEditedData};let i=!1;const o=r=>{var n;for(const a of r){if(F(a.preferredLabel)){const o=e[a.id];if(o)for(const e of Object.keys(o)){const r=o[e];null==r||""===r||void 0!==(null==(n=t[a.id])?void 0:n[e])||(t[a.id]={...t[a.id]||{},[e]:!0},i=!0)}}a.children&&a.children.length>0&&o(a.children)}};for(const r of this._allSections)o(r.concepts||[]);i&&(this._totalManuallyEditedData=t)}_restoreCustomColumns(e){const t=new Map;e.forEach(e=>{t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e)}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o){if(e.columns=o.map(e=>{const t={id:e.columnId,title:e.label,description:e.description,type:e.dimensionData?"dimension":"base",periodStartDate:e.startDate||e.date,periodEndDate:e.endDate||e.date,dimensionData:e.dimensionData,order:0,removable:"duration"!==e.columnId&&"instant"!==e.columnId,periodType:e.periodType};return e.columnId,t}),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,t.length,e.id}else e.datatypes?(e.id,e.datatypes.length):console.warn(`⚠️ [Draft Restore] No datatypes available for section ${e.id}`);this._regenerateFieldsForSection(e),o.length,e.id}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_mergeAdditionalCustomColumns(e){const t=new Map;e.forEach(e=>{e.columnId.startsWith("col-")&&(t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e))}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o&&o.length>0){if(e.columns||(e.columns=[]),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,t.length,e.id}else e.datatypes?(e.id,e.datatypes.length):console.warn(`⚠️ [Merge Custom] No datatypes available for section ${e.id}`);o.forEach(t=>{t.columnId,t.startDate,t.endDate,t.date,t.periodType;if(!e.columns.find(e=>e.id===t.columnId)){const i={id:t.columnId,title:t.label,description:t.description,type:t.dimensionData?"dimension":"base",periodStartDate:t.startDate||t.date,periodEndDate:t.endDate||t.date,dimensionData:t.dimensionData,order:e.columns.length,removable:!0,periodType:t.periodType};i.id,i.title,i.description,i.periodStartDate,i.periodEndDate,i.periodType,e.columns.push(i),t.columnId,e.id}}),this._regenerateFieldsForSection(e)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_applyCustomPeriodDataToFields(){if(!this._periodData||0===Object.keys(this._periodData).length)return;const e=t=>{t.forEach(t=>{if(this._periodData[t.id]){const e=this._periodData[t.id];t.fields&&t.fields.forEach(i=>{const o=e[i.columnId];o&&(o.startDate&&(i.periodStartDate=o.startDate),o.endDate&&(i.periodEndDate=o.endDate),o.instantDate&&(i.periodInstantDate=o.instantDate),t.id,i.columnId,i.periodStartDate,i.periodEndDate,i.periodInstantDate)})}t.children&&t.children.length>0&&e(t.children)})};this._allSections.forEach(t=>{t.concepts&&t.concepts.length>0&&e(t.concepts)})}_regenerateFieldsForSection(e){if(!e.columns)return;const t=this._periodPreferences[e.id]||{showDuration:!0,showInstant:!0,showPreviousYear:!1},i=o=>{o.forEach(o=>{o.fields=[];this._shouldShowConceptBasedOnPeriodPreferences(o,t)&&e.columns.forEach(t=>{var i;const r=o.periodType,n=this._inferColumnPeriodType(t);if(o.abstract)return;const a=t.id.startsWith("col-"),s=t.id.startsWith("duration_")||t.id.startsWith("instant_")||t.id.startsWith("typed-"),l=!0===e.showPeriodControl;if(!(!n||"duration"===t.id||"default"===t.id||a&&l||s)&&r&&n&&r!==n)return o.id,void t.id;const d={id:`${o.id}_${t.id}`,conceptId:o.id,columnId:t.id,type:this._mapConceptTypeToFieldType(o.type),label:o.label,periodType:r,conceptType:o.type,periodStartDate:t.periodStartDate,periodEndDate:t.periodEndDate,periodInstantDate:"instant"===r?this._resolveInstantDate(this._getEffectivePeriodRole(o),void 0,t.periodStartDate,t.periodEndDate):void 0};if(null==(i=this._periodData[o.id])?void 0:i[t.id]){const e=this._periodData[o.id][t.id];e.startDate&&(d.periodStartDate=e.startDate),e.endDate&&(d.periodEndDate=e.endDate),e.instantDate&&(d.periodInstantDate=e.instantDate),o.id,t.id,d.periodStartDate,d.periodEndDate,d.periodInstantDate}else o.id,t.id,this._periodData[o.id];(o.id.includes("DescriptionLocationNL")||t.id.startsWith("col-"))&&(o.id,t.id,d.periodStartDate,d.periodEndDate,t.periodStartDate),o.fields.push(d)}),o.children&&i(o.children)})};i(e.concepts)}_shouldShowConceptBasedOnPeriodPreferences(e,t){return!!e.abstract||(!e.periodType||!("duration"===e.periodType&&!t.showDuration)&&!("instant"===e.periodType&&!t.showInstant))}_inferColumnPeriodType(e){return e.periodType?e.periodType:e.periodStartDate&&e.periodEndDate?e.periodStartDate===e.periodEndDate?"instant":"duration":e.periodStartDate&&!e.periodEndDate?"instant":void 0}_mapConceptTypeToFieldType(e){return e?e.includes("monetary")||e.includes("Monetary")?"number":e.includes("date")||e.includes("Date")?"date":e.includes("boolean")||e.includes("Boolean")?"boolean":e.includes("integer")||e.includes("Integer")||e.includes("decimal")||e.includes("Decimal")?"number":"text":"text"}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,n||void 0)}}})}),e.length}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var n,a,s,l,d;const c=e.fields.find(e=>e.columnId===t);if(!c)return;const p="instant"===e.periodType,u=null==(n=this._periodData[e.id])?void 0:n[t],h=null==(a=this._unitData[e.id])?void 0:a[t],m=this._findColumnByIdInAllSections(t);e.id,u&&JSON.stringify(u),null==m||m.periodStartDate,null==m||m.periodEndDate;const f=(null==u?void 0:u.startDate)||(null==m?void 0:m.periodStartDate)||c.periodStartDate||this.periodStartDate,b=(null==u?void 0:u.endDate)||(null==m?void 0:m.periodEndDate)||c.periodEndDate||this.periodEndDate,g=(null==u?void 0:u.instantDate)||c.periodInstantDate||b||f,v={conceptId:e.originalConceptId||e.id,columnId:t,value:i,period:{type:e.periodType||"duration",...p?{date:g}:{startDate:f,endDate:b}}};h&&(v.unit=h,e.id);const y=null==(s=e.type)?void 0:s.toLowerCase().includes("monetary"),x=(null==(l=this._decimalsData[e.id])?void 0:l[t])||("INF"!==this.decimals?this.decimals:void 0);if(y&&x){const e=parseFloat(x);v.decimals=isNaN(e)?x:String(-Math.abs(e))}(null==(d=null==m?void 0:m.dimensionData)?void 0:d.memberLabel)&&(v.dimension=m.dimensionData.memberLabel),JSON.stringify(v,null,2),o.push(v)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,o=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(o)||t.set(o,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,n;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const a=null==t?void 0:t.id;if(!a)return null;const s=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===a);if(!(null==s?void 0:s.items))return null;for(const l of s.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,n;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const a=null==t?void 0:t.id;if(!a)return!1;const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===a);if(!(null==(n=null==s?void 0:s.items)?void 0:n.length))return!1;for(const l of s.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return e}}return e.originalConceptId||e.id,!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==n?void 0:n.items)?void 0:r.length))return[];const a=e.originalConceptId||e.id;for(const s of n.items)if(s.conceptIds&&s.conceptIds.includes(a)){const e=s.dimensions.filter(e=>e.typedMember).map(e=>e.id);return e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - Financiële vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{if(r===o&&(e.originalConceptId||e.id,e.fields&&(e.fields.length,e.fields.forEach((t,i)=>{var o;t.columnId,null==(o=this._formData[e.id])||o[t.columnId]}))),e.fields&&e.fields.length>1&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0){e.fields.forEach(o=>{var r,n,a,s,l,d,c,p;const u=this._formData[e.id];let h=null==u?void 0:u[o.columnId];const m=o.conceptId||e.id.split("__").slice(0,-1).join("__")||e.id;if((null==h||""===h)&&this._isRoundingLevelConcept(m)&&!this._hasValidGlobalDecimals()){const t=this._findFactValueForField(e,o,i);null!=t&&""!==t&&(h=t)}if((null==h||""===h)&&this._effectiveMasterData){const e=null==(r=this._effectiveMasterData)?void 0:r[m];null!=e&&""!==e&&(h=e,o.columnId,JSON.stringify(h))}if(null!=h&&""!==h){const r=this._findColumnByIdInSection(o.columnId,i),u=null==(n=this._periodData[e.id])?void 0:n[o.columnId],m={conceptId:e.id,draftInstanceId:e.id,columnId:o.columnId,value:h,period:{type:e.periodType||"duration"}};if("instant"===e.periodType){const t=this._resolveSubmissionInstantDate(e,o,u,r);m.period.date=t}else{const e=(null==u?void 0:u.startDate)||(null==r?void 0:r.periodStartDate)||o.periodStartDate||this.periodStartDate,t=(null==u?void 0:u.endDate)||(null==r?void 0:r.periodEndDate)||o.periodEndDate||this.periodEndDate;m.period.startDate=e,m.period.endDate=t}e.id,o.columnId,u&&JSON.stringify(u),null==r||r.periodStartDate,null==r||r.periodEndDate,"instant"===m.period.type?m.period.date:(m.period.startDate,m.period.endDate);const f=null==(a=this._unitData[e.id])?void 0:a[o.columnId];f?(m.unit=f,e.id,o.columnId):(e.id,o.columnId,JSON.stringify(this._unitData,null,2));const b=null==(s=e.type)?void 0:s.toLowerCase().includes("monetary"),g=(null==(l=this._decimalsData[e.id])?void 0:l[o.columnId])||("INF"!==this.decimals?this.decimals:void 0);if(b&&g){const e=parseFloat(g);m.decimals=isNaN(e)?g:String(-Math.abs(e))}"dimension"===(null==r?void 0:r.type)&&(null==(d=r.dimensionData)?void 0:d.dimensionIdKey)?(m.dimension=r.dimensionData.dimensionIdKey,o.columnId,r.dimensionData.dimensionIdKey):(o.columnId,null==r||r.type,null==r||r.dimensionData);const v=i?this._scopedColumnKey(i.id,o.columnId):o.columnId,y=this._typedMemberData[v],x=this._typedMemberData[o.columnId];if(y||x){const t=this._getApplicableTypedDimensions(e,i);if(e.id,t.length>0){const e={};t.forEach(t=>{const o=(null==y?void 0:y[t])??(null==x?void 0:x[t]);if(o){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o,memberName:r||"Unknown"}}}),Object.keys(e).length>0&&(m.typedMembers=e)}else e.id}else o.columnId,Object.keys(this._typedMemberData),r&&(r.id,r.type,null==(c=r.dimensionData)||c.hasTypedMembers,r.dimensionData);if(!m.typedMembers&&(null==(p=o.crossRoleTypedMembers)?void 0:p.length)){const t=`${e.id}__${o.columnId}`,i=this._typedMemberData[t];if(i){const t={};o.crossRoleTypedMembers.forEach(e=>{const o=i[e.axisId];null!=o&&""!==o&&(t[e.axisId]={value:o,memberName:e.typedMemberId})}),Object.keys(t).length>0&&(m.typedMembers=t,e.id,o.columnId)}}t.push(m)}});const o=this._repeatCounts[e.id]||0;if(o>0&&e.fields.some(e=>{var t;return null==(t=e.crossRoleTypedMembers)?void 0:t.length}))for(let r=1;r<=o;r++){const o=`${e.id}__repeat_${r}`;e.fields.forEach(r=>{var n,a,s,l,d;const c=null==(n=this._formData[o])?void 0:n[r.columnId];if(null==c||""===c)return;const p=this._findColumnByIdInSection(r.columnId,i),u=null==(a=this._periodData[o])?void 0:a[r.columnId],h={conceptId:e.id,draftInstanceId:o,columnId:r.columnId,value:c,period:{type:e.periodType||"duration"}};"instant"===e.periodType?h.period.date=this._resolveSubmissionInstantDate(e,r,u,p):(h.period.startDate=(null==u?void 0:u.startDate)||(null==p?void 0:p.periodStartDate)||r.periodStartDate||this.periodStartDate,h.period.endDate=(null==u?void 0:u.endDate)||(null==p?void 0:p.periodEndDate)||r.periodEndDate||this.periodEndDate);const m=null==(s=this._unitData[o])?void 0:s[r.columnId];if(m&&(h.unit=m),"dimension"===(null==p?void 0:p.type)&&(null==(l=p.dimensionData)?void 0:l.dimensionIdKey)&&(h.dimension=p.dimensionData.dimensionIdKey),null==(d=r.crossRoleTypedMembers)?void 0:d.length){const e=`${o}__${r.columnId}`,t=this._typedMemberData[e];if(t){const e={};r.crossRoleTypedMembers.forEach(i=>{const o=t[i.axisId];null!=o&&""!==o&&(e[i.axisId]={value:o,memberName:i.typedMemberId})}),Object.keys(e).length>0&&(h.typedMembers=e)}}t.push(h)})}}e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData={...this.initialData},this._touched.clear(),this._dirty=!1,this.hasUnsavedChanges=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}_analyzeAllVisibleRoles(){if(this._currentSchema&&this._currentSchema.sections&&0!==this._currentSchema.sections.length){this._currentSchema.sections.length;for(const e of this._currentSchema.sections)this._analyzeAndLogRole(e.id)}}_handleRoleContextMenu(e,t,i){e.preventDefault(),e.stopPropagation(),this._contextMenuX=e.clientX,this._contextMenuY=e.clientY,this._contextMenuRoleId=t,this._showRoleContextMenu=!0,this.requestUpdate()}_closeRoleContextMenu(){this._showRoleContextMenu=!1,this._contextMenuRoleId=null,this.requestUpdate()}_handleRemoveRole(){if(!this._contextMenuRoleId)return void this._closeRoleContextMenu();const e=this._allSections.find(e=>e.id===this._contextMenuRoleId),t=(null==e?void 0:e.title)||"Unknown";if(this._contextMenuRoleId,Array.isArray(this._selectedRoleIds)&&(this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]?this._selectedRoleIds=this._selectedRoleIds.filter(e=>e.roleId!==this._contextMenuRoleId):this._selectedRoleIds=this._selectedRoleIds.filter(e=>e!==this._contextMenuRoleId)),this._selectedRoleIds.length,this._activeSidePanelRoleId===this._contextMenuRoleId){const e=this._getRoleIdsArray();this._activeSidePanelRoleId=e.length>0?e[0]:null,this._activeSidePanelRoleId}this._applyRoleFilter(),this.dispatchEvent(new CustomEvent("role-removed",{detail:{roleId:this._contextMenuRoleId,roleTitle:t,remainingRolesCount:this._selectedRoleIds.length},bubbles:!0,composed:!0})),this._closeRoleContextMenu()}_handleRoleCompletedChange(e,t){t?this._roleCompletedStates.set(e,!0):this._roleCompletedStates.delete(e),this._roleCompletedStates=new Map(this._roleCompletedStates),this._handleSaveDraft("auto")}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId&&this._activeSidePanelRoleId!==e&&this._analyzeAndLogRole(this._activeSidePanelRoleId),this._activeSidePanelRoleId=e}_analyzeAndLogRole(e){const t=this._allSections.find(t=>t.id===e);if(!t)return void console.warn(`⚠️ Section not found for roleId: ${e}`);t.title,this.masterData&&Object.keys(this.masterData);const i=[];this._collectAllFields(t.concepts||[],new Set((t.columns||[]).map(e=>e.id)),t.columns||[],i);const o=this._roleHasErrors(e),r=i.filter(e=>e.isEmpty).length,n=i.filter(e=>!e.isEmpty).length;let a;i.length,a=o?"INVALID":0===n?"UNTOUCHED":r>0?"INCOMPLETE":"COMPLETE","INVALID"===a||("UNTOUCHED"===a?(this._roleBorderStatuses.set(e,"untouched"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):"INCOMPLETE"===a?(this._roleBorderStatuses.set(e,"incomplete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):(this._roleBorderStatuses.set(e,"complete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)))}_collectAllFields(e,t,i,o){var r,n,a;for(const s of e)if(s.abstract)s.children&&s.children.length>0&&this._collectAllFields(s.children,t,i,o);else{if(s.fields&&s.fields.length>0){const e=s.fields.filter(e=>t.has(e.columnId));for(const t of e){const e=s.id,l=t.conceptId;let d=null==(r=this._formData[e])?void 0:r[t.columnId];void 0===d&&e!==l&&(d=null==(n=this._formData[l])?void 0:n[t.columnId]);const c=null==(a=this._effectiveMasterData)?void 0:a[l];(null==d||"string"==typeof d&&""===d.trim())&&void 0!==c&&(d=c,t.columnId,JSON.stringify(d));let p=null==d||"string"==typeof d&&""===d.trim();if(p&&s.facts&&s.facts.length>0){const e=i.find(e=>e.id===t.columnId),o={conceptId:l,columnId:t.columnId,periodStartDate:t.periodStartDate||(null==e?void 0:e.periodStartDate),periodEndDate:t.periodEndDate||(null==e?void 0:e.periodEndDate),periodInstantDate:t.periodInstantDate||("instant"===t.periodType?t.periodEndDate||t.periodStartDate:void 0),periodType:t.periodType,dimensionData:null==e?void 0:e.dimensionData},r=De.findMatchingFact(s.facts,o);r&&null!==r.value&&void 0!==r.value&&""!==r.value&&(d=r.value,p=!1)}o.push({conceptId:l,columnId:t.columnId,value:d,isEmpty:p})}}s.children&&s.children.length>0&&this._collectAllFields(s.children,t,i,o)}}_handleSidePanelSearchInput(e){const t=e.target;this._sidePanelSearchQuery=t.value}_clearSidePanelSearch(){var e;this._sidePanelSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-search-input");t&&(t.value="",t.focus()),this.updateComplete.then(()=>this._scrollActiveRoleIntoView())}_toggleSidePanelCollapse(){this._sidePanelCollapsed=!this._sidePanelCollapsed}_isSectionBlank(e){const t=e.columns||this._columns,i=e=>{var o;for(const r of e){if(!r.abstract)for(const e of t){const t=null==(o=this._formData[r.id])?void 0:o[e.id];if(null!=t&&""!==t)return!0}if(r.children&&r.children.length>0&&i(r.children))return!0}return!1};return!i(e.concepts)}_getConceptSearchMatchIds(e){var t,i,o;const r=new Set;if(!e.trim()||!(null==(i=null==(t=this.xbrlInput)?void 0:t.presentation)?void 0:i.length))return r;const n=e.toLowerCase().trim(),a=e=>{var t;for(const i of e)r.add(i.id),(null==(t=i.children)?void 0:t.length)&&a(i.children)},s=e=>{var t,i,o,l;for(const d of e){let e=(null==(t=d.conceptName)?void 0:t.toLowerCase().includes(n))||(null==(i=d.id)?void 0:i.toLowerCase().includes(n));!e&&Array.isArray(d.labels)&&(e=d.labels.some(e=>{var t;return null==(t=e.label)?void 0:t.toLowerCase().includes(n)})),e?(r.add(d.id),(null==(o=d.children)?void 0:o.length)&&a(d.children)):(null==(l=d.children)?void 0:l.length)&&s(d.children)}};for(const l of this.xbrlInput.presentation)for(const e of l.roles||[])s((null==(o=e.presentationLinkbase)?void 0:o.concepts)||[]);return r}_isSectionConceptSearchMatch(e,t){if(0===t.size)return!1;const i=e=>{var o;for(const r of e){if(t.has(r.originalConceptId))return!0;if((null==(o=r.children)?void 0:o.length)&&i(r.children))return!0}return!1};return i(e.concepts)}_filterSidePanelSections(e){if(!this._sidePanelSearchQuery.trim())return e;const t=this._sidePanelSearchQuery.toLowerCase().trim();return e.filter(e=>{var i,o,r;const n=e.title.toLowerCase().includes(t),a=e.id.toLowerCase().includes(t),s=(null==(i=e.description)?void 0:i.toLowerCase().includes(t))||!1,l=(null==(r=null==(o=e.metadata)?void 0:o.roleURI)?void 0:r.toLowerCase().includes(t))||!1;return n||a||s||l})}_renderAdminModeContent(t){var i,o;if(!t)return e.html`
|
|
4002
|
+
`}_handleClearAdvancedFilters(){const e=this._lastFocusedFieldIdentity;this._showFactsOnly=!1,this._conceptSearchText="",this.updateComplete.then(async()=>{var t;const i=Array.from((null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-section"))??[]);await Promise.all(i.map(e=>e.updateComplete));const o=i.flatMap(e=>{var t;return Array.from((null==(t=e.shadowRoot)?void 0:t.querySelectorAll("jupiter-concept-tree"))??[])});await Promise.all(o.map(e=>e.updateComplete)),this._scrollActiveRoleIntoView(),e&&this._restoreFieldFocus(e)})}_effectiveNumberLocale(){return this.numberLocale||("nl"===this.language?"nl-NL":"en-US")}_amountScaleFactor(){if("INF"===this.decimals||void 0===this.decimals||null===this.decimals)return null;const e=parseFloat(this.decimals);return isNaN(e)||e<=0?null:Math.pow(10,e)}_amountScaleCaption(){const e=this._amountScaleFactor();if(null===e)return F.t("section.amountScaleBase");const t=new Intl.NumberFormat(this._effectiveNumberLocale()).format(e);return F.t("section.amountScaleFactor",{factor:t})}_sectionHasMonetaryConcepts(e){return e.some(e=>{var t;return(null==(t=e.type)?void 0:t.toLowerCase().includes("monetary"))||e.children&&this._sectionHasMonetaryConcepts(e.children)})}_scrollActiveRoleIntoView(){var e;const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-roles-list"),i=null==t?void 0:t.querySelector(".side-panel-role-item.active");if(!t||!i)return;const o=t.getBoundingClientRect(),r=i.getBoundingClientRect(),n=r.top+r.height/2,a=o.top+o.height/2;t.scrollTop+=n-a}_restoreFieldFocus(e){var t,i,o,r;const n=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-section"))??[];for(const a of Array.from(n)){const t=(null==(i=a.shadowRoot)?void 0:i.querySelectorAll("jupiter-concept-tree"))??[];for(const i of Array.from(t)){const t=(null==(o=i.shadowRoot)?void 0:o.querySelectorAll("jupiter-form-field"))??[];for(const i of Array.from(t))if(i.conceptId===e.conceptId&&i.columnId===e.columnId){const e=null==(r=i.shadowRoot)?void 0:r.querySelector('input:not([type="hidden"]), select, textarea');return void(null==e||e.focus({preventScroll:!0}))}}}}_handleFilterRolesClick(){this._showFilterDialog=!0}_handleAdvancedFilterApply(e){this._showFactsOnly=e.detail.showFactsOnly,this._conceptSearchText=e.detail.conceptSearchText??"",this._showFilterDialog=!1}_handleFilterDialogCancel(){this._showFilterDialog=!1;this._getRoleIdsArray().length;this._allSections.length}_handleFormulaValidationDialogCancel(){this._showFormulaValidationDialog=!1}_handleFormulaConceptClick(e){this._showFormulaValidationDialog=!1,this.scrollToConcept(e.detail.conceptQName,void 0,void 0,e.detail.columnId,e.detail.conceptId)}_handleRoleFilterApply(e){const{selectedRoleIds:t,periodPreferences:i}=e.detail;this._applyRoleSelection(t,i,"filterDialog")}_applyRoleSelection(e,t,i){var o,r;this._selectedRoleIds,this._selectedRoleIds=e,this._periodPreferences=t,this._selectedRoleIds,this._periodPreferences;const n=this._generateSubmissionData(),a=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts,this._decimalsData,void 0,this._getHiddenColumnsForMetadata(),this._totalManuallyEditedData);this._draftStorageService.saveDraft(n,a),this.dynaformsFacts=n,this.dynaformsMetadata=a,this._skipPeriodPreferencesRestore=!0,this._skipDraftLoading=!0,this._initializeForm(),this._skipDraftLoading=!1,this._skipPeriodPreferencesRestore=!1,null==(o=this._currentSchema)||o.sections.length,null==(r=this._currentSchema)||r.sections.map(e=>e.id);const s=this._loadDraftIfExists().then(()=>{this._seedAutoSaveBaseline()}).catch(e=>{console.error("❌ Error restoring form data after reinitialization:",e)});this._showFilterDialog=!1;const l=Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0?(this._selectedRoleIds[0],this._selectedRoleIds.length):0;return this._allSections.length,this._selectedRoleIds,this.dispatchEvent(new CustomEvent("roles-filter-changed",{detail:{selectedRoleIds:e,totalRoles:this._allSections.length,visibleRoles:l,periodPreferences:t,source:i},bubbles:!0})),s}_confirmRevealHiddenRole(e){var t;return null==(t=this._revealRolePrompt)||t.resolve(!1),new Promise(t=>{this._revealRolePrompt={section:e,resolve:t}})}_settleRevealRolePrompt(e){const t=this._revealRolePrompt;this._revealRolePrompt=null,null==t||t.resolve(e)}_revealRole(e){var t;const i=this._selectedRoleIds;let o;if(i.length>0&&"object"==typeof i[0]){const r=i,n=Math.max(-1,...r.map(e=>e.order))+1;o=[...r,{roleId:e.id,roleURI:(null==(t=e.metadata)?void 0:t.roleURI)||"",order:n}]}else o=[...i,e.id];return this._applyRoleSelection(o,this._periodPreferences,"scrollToConcept")}_haveDimensionSelectionsChanged(e){var t;const i=new Set([...Object.keys(this._periodPreferences||{}),...Object.keys(e||{})]);for(const o of i){const i=null==(t=this._periodPreferences)?void 0:t[o],r=null==e?void 0:e[o],n=(null==i?void 0:i.dimensionSelections)||[],a=(null==r?void 0:r.dimensionSelections)||[];if(JSON.stringify(n.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId)))!==JSON.stringify(a.sort((e,t)=>e.dimensionId.localeCompare(t.dimensionId))))return!0}return!1}_validateForm(){var e;const t=[],i=this._currentSchema;if(i){for(const o of i.sections)for(const i of o.concepts)for(const o of i.fields){const r=null==(e=this._formData[i.id])?void 0:e[o.columnId],n=$.validateField(o.id,i.id,o.columnId,r,o.type,o.validation||[]);t.push(...n)}t.push(...Array.from(this._calculationWarnings.values())),this._errors=t,this._valid=0===t.filter(e=>"error"===e.severity).length}}_handleCalculationMismatchChanged(e){const{key:t,mismatch:i}=e.detail,o=new Map(this._calculationWarnings);i?o.set(t,{fieldId:`${i.totalConceptId}__${i.columnId}`,conceptId:i.totalConceptId,columnId:i.columnId,message:i.message,severity:"warning",rule:{type:"custom",message:i.message,severity:"warning"},details:i}):o.delete(t),this._calculationWarnings=o,this._validateForm()}_isPriorYearExcludedFact(e,t){return!!e&&!!t&&e.includes("BalanceSheetBeforeAfterAppropriationResults")&&t.includes("_prev")}_stripPriorYearExcludedFacts(e){const t={};return Object.keys(e).forEach(i=>{const o=e[i]||{},r={};Object.keys(o).forEach(e=>{this._isPriorYearExcludedFact(i,e)||(r[e]=o[e])}),t[i]=r}),t}_writeFormDataValue(e,t,i){var o;if(this._isPriorYearExcludedFact(e,t))return null==(o=this._formData[e])?void 0:o[t];const r={...this._formData};r[e]||(r[e]={});const n=r[e][t];return r[e]={...r[e],[t]:i},this._formData=r,n}_handleFieldChange(e){const{fieldId:t,conceptId:i,columnId:o,value:r}=e.detail,n=this._writeFormDataValue(i,o,r);this._formData[i],this._touched.add(`${i}-${o}`),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("field-change",{detail:{fieldId:t,conceptId:i,columnId:o,value:r,oldValue:n},bubbles:!0}))}_handlePeriodChange(e){e.detail;const{conceptId:t,columnId:i,periodType:o,periodStartDate:r,periodEndDate:n,periodInstantDate:a,unit:s}=e.detail,l={...this._periodData};l[t]||(l[t]={}),l[t]={...l[t],[i]:{startDate:r,endDate:n,instantDate:a}},this._periodData=l,this._periodData[t][i],JSON.stringify(this._periodData,null,2),s&&this._storeUnit(t,i,s),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate()}_handleUnitChange(e){var t;e.detail;const{conceptId:i,columnId:o,unit:r}=e.detail,n=(null==(t=this._unitData[i])?void 0:t[o])===r;this._storeUnit(i,o,r),n||(this._dirty=!0,this.hasUnsavedChanges=!0),this.requestUpdate()}_storeUnit(e,t,i){JSON.stringify(this._unitData,null,2);const o={...this._unitData};o[e]||(o[e]={}),o[e]={...o[e],[t]:i},this._unitData=o,this._unitData[e][t],JSON.stringify(this._unitData,null,2)}_handleDecimalsChange(e){const{conceptId:t,columnId:i,decimals:o}=e.detail;t&&i&&(this._storeDecimals(t,i,o),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate())}_computeEffectiveMasterData(){const e="rj-i_DocumentIntendedRoundingLevel";if("INF"!==this.decimals){const t=parseFloat(this.decimals);if(!isNaN(t))return void(this._effectiveMasterData={...this.masterData||{},[e]:String(-t)})}this._effectiveMasterData=this.masterData?{...this.masterData}:void 0}_initializeGlobalDecimalsFromRoundingData(){if(this._hasValidGlobalDecimals())return;const e=this._findRoundingLevelFactValue(this._allSections)??this._findRoundingLevelValueInFormData(this._formData);if(null==e||""===e)return;const t=parseFloat(String(e));isNaN(t)||(this.decimals=String(Math.abs(t)))}_findRoundingLevelValueInFormData(e){if(e)for(const t of Object.keys(e)){if(!this._isRoundingLevelConcept(t))continue;const i=e[t]||{};for(const e of Object.keys(i)){const t=i[e];if(null!=t&&""!==t)return t}}}_findRoundingLevelFactValue(e){for(const t of e){const e=this._findRoundingLevelFactValueInConcepts(t.concepts||[]);if(null!=e&&""!==e)return e}}_findRoundingLevelFactValueInConcepts(e){for(const t of e){const e=t.originalConceptId||t.id;if(this._isRoundingLevelConcept(e)){const e=t.facts||[];for(const t of e)if(void 0!==(null==t?void 0:t.value)&&null!==(null==t?void 0:t.value)&&""!==(null==t?void 0:t.value))return t.value}if(t.children&&t.children.length>0){const e=this._findRoundingLevelFactValueInConcepts(t.children);if(null!=e&&""!==e)return e}}}_hasValidGlobalDecimals(){if(void 0===this.decimals||null===this.decimals)return!1;if("INF"===this.decimals)return!1;const e=parseFloat(this.decimals);return!isNaN(e)}_isRoundingLevelConcept(e){return!!e&&("rj-i_DocumentIntendedRoundingLevel"===e||e.includes("DocumentIntendedRoundingLevel"))}_findFactValueForField(e,t,i){var o,r;if(!e.facts||0===e.facts.length)return;const n=this._findColumnByIdInSection(t.columnId,i),a=null==(o=this._periodData[e.id])?void 0:o[t.columnId],s=(null==a?void 0:a.startDate)||(null==n?void 0:n.periodStartDate)||t.periodStartDate||this.periodStartDate,l=(null==a?void 0:a.endDate)||(null==n?void 0:n.periodEndDate)||t.periodEndDate||this.periodEndDate,d=(null==a?void 0:a.instantDate)||t.periodInstantDate||l||s,c=null==(r=this._unitData[e.id])?void 0:r[t.columnId],p={conceptId:e.originalConceptId||t.conceptId||e.id,columnId:t.columnId,periodStartDate:s,periodEndDate:l,periodInstantDate:d,periodType:t.periodType,unit:c,dimensionData:null==n?void 0:n.dimensionData},u=we.findMatchingFact(e.facts,p);return null==u?void 0:u.value}_storeDecimals(e,t,i){const o={...this._decimalsData};o[e]||(o[e]={}),o[e]={...o[e],[t]:i??""},this._decimalsData=o}_generateUniqueConceptKey(e,t){return`${e}::${t}`}_extractOriginalConceptId(e){const t=e.split("::");return t.length>1?t[1]:e}_handleAddConceptRepeat(e){const{conceptId:t}=e.detail;this._repeatCounts={...this._repeatCounts,[t]:(this._repeatCounts[t]||0)+1},this._dirty=!0,this.hasUnsavedChanges=!0}_handleRemoveConceptRepeat(e){const{conceptId:t}=e.detail,i=t.match(/^(.+)__repeat_(\d+)$/),o=i?i[1]:t,r=i?parseInt(i[2]):this._repeatCounts[t]||0,n=this._repeatCounts[o]||0;if(n<=0||r<1||r>n)return;const a={...this._formData},s={...this._typedMemberData},l={...this._unitData},d={...this._periodData};for(let u=r;u<n;u++){const e=`${o}__repeat_${u+1}`,t=`${o}__repeat_${u}`;void 0!==a[e]?a[t]=a[e]:delete a[t];const i=`${t}__`,r=`${e}__`,n=Object.keys(s).filter(e=>e.startsWith(r));Object.keys(s).filter(e=>e.startsWith(i)).forEach(e=>delete s[e]),n.forEach(e=>{s[`${t}__${e.slice(r.length)}`]=s[e]}),n.forEach(e=>delete s[e]),void 0!==l[e]?l[t]=l[e]:delete l[t],void 0!==d[e]?d[t]=d[e]:delete d[t]}const c=`${o}__repeat_${n}`;delete a[c],delete l[c],delete d[c];const p=`${c}__`;Object.keys(s).filter(e=>e.startsWith(p)).forEach(e=>delete s[e]),this._formData=a,this._typedMemberData=s,this._unitData=l,this._periodData=d,this._repeatCounts={...this._repeatCounts,[o]:n-1},this._dirty=!0,this.hasUnsavedChanges=!0}_scopedColumnKey(e,t){return`${e}__${t}`}_handleTypedMemberChange(e){const{columnId:t,axisId:i,value:o,conceptId:r,sectionId:n}=e.detail,a=r?`${r}__${t}`:n?this._scopedColumnKey(n,t):t,s={...this._typedMemberData};s[a]||(s[a]={}),s[a]={...s[a],[i]:o},this._typedMemberData=s,this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("typed-member-change",{detail:{columnId:t,axisId:i,value:o},bubbles:!0}))}_handleFieldBlur(e){var t;e.detail;const{fieldId:i,conceptId:o,columnId:r,xbrlValidationErrors:n}=e.detail;let a="";const s=e.composedPath();s.length;for(const l of s){const e=l;if("JUPITER-FORM-SECTION"===e.tagName){a=e.getAttribute("section-id")||"";break}}if(n&&n.length,n&&n.length>0){const e=(null==(t=this._formData[o])?void 0:t[r])||"",s=this._xbrlFormErrors.findIndex(e=>e.fieldId===i&&e.sectionId===a),l={sectionId:a,fieldId:i,conceptId:o,columnId:r,value:e,errors:n};this._xbrlFormErrors=s>=0?[...this._xbrlFormErrors.slice(0,s),l,...this._xbrlFormErrors.slice(s+1)]:[...this._xbrlFormErrors,l]}else{this._xbrlFormErrors.length;this._xbrlFormErrors=this._xbrlFormErrors.filter(e=>!(e.fieldId===i&&e.sectionId===a)),this._xbrlFormErrors.length}this._xbrlFormErrors.length,this._xbrlFormErrors,this._updateDuplicateFactWarnings(o,r)}_getSectionTitle(e){this._allSections.map(e=>({id:e.id,title:e.title}));const t=this._allSections.find(t=>t.id===e),i=(null==t?void 0:t.title)||e||"(Unknown Section)";return i}_roleHasErrors(e){return this._xbrlFormErrors.some(t=>t.sectionId===e)}async _handleErrorFieldClick(e,t,i){this._showErrorPopup=!1,this.requestUpdate(),await this._focusFormField(e,t,i)}async _handleTypedDimensionFactClick(e,t,i){this._showValidateWarningPopup=!1,this.requestUpdate(),await this._focusFormField(e,t,i)}async _handleDuplicateFactClick(e,t,i){this._showValidateWarningPopup=!1,this.requestUpdate(),await this._focusFormField(e,t,i)}async _focusFormField(e,t,i){var o,r,n,a,s,l,d;if(await this.updateComplete,!(null==(o=this._currentSchema)?void 0:o.sections.some(e=>e.id===i))){const e=this._allSections.find(e=>e.id===i);if(!e||!(await this._confirmRevealHiddenRole(e)))return;await this._revealRole(e)}(null==(r=this._hiddenColumnIds.get(i))?void 0:r.has(t))&&(this._showColumn(i,t),await this.updateComplete),"sidePanel"===this.display&&this._activeSidePanelRoleId!==i&&(this._activeSidePanelRoleId,this._activeSidePanelRoleId=i,this.requestUpdate(),await this.updateComplete,this._scrollActiveRoleIntoView(),await new Promise(e=>setTimeout(e,500)));const c=null==(n=this.shadowRoot)?void 0:n.querySelectorAll("jupiter-form-section");let p=null;if(null==c||c.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===i&&(p=e)}),!p)return void console.warn(`⚠️ Section not found: ${i}`);if(await p.updateComplete,await(null==(a=p.revealConcept)?void 0:a.call(p,e))&&await Promise.all(Array.from((null==(s=p.shadowRoot)?void 0:s.querySelectorAll("jupiter-concept-tree"))??[]).map(e=>e.updateComplete)),await new Promise(e=>setTimeout(e,100)),p.shadowRoot,p.shadowRoot){null==(l=p.shadowRoot.innerHTML)||l.length;const e=p.shadowRoot.querySelectorAll("*");e.length;Array.from(e).filter(e=>{const t=e;return!(!t.tagName||!t.tagName.includes("-"))}).map(e=>e.tagName).join(", ")}const u=`${e}_${t}_field`,h=null==(d=p.shadowRoot)?void 0:d.querySelectorAll("jupiter-concept-tree");let m=null;if(null==h||h.length,h&&h.forEach((i,o)=>{var r;if(m)return;const n=null==(r=i.shadowRoot)?void 0:r.querySelectorAll("jupiter-form-field");null==n||n.length,null==n||n.forEach((i,o)=>{var r;if(!m&&(i.conceptId,i.columnId,i.conceptId===e&&i.columnId===t)){const e=null==(r=i.shadowRoot)?void 0:r.querySelector("input, textarea");e&&(m=e)}})}),!m)return void console.warn(`⚠️ Input field not found for: ${u}`);const f=m;p.scrollIntoView({behavior:"smooth",block:"start"}),await new Promise(e=>setTimeout(e,300)),f.focus(),"INPUT"!==f.tagName&&"TEXTAREA"!==f.tagName||f.select(),f.style.boxShadow="0 0 0 3px rgba(220, 38, 38, 0.5)",setTimeout(()=>{f.style.boxShadow=""},2e3)}_handleSectionExpand(e){this.dispatchEvent(new CustomEvent("section-expand",{detail:e.detail,bubbles:!0}))}_handleConceptExpand(e){this.dispatchEvent(new CustomEvent("concept-expand",{detail:e.detail,bubbles:!0}))}_handleColumnRemove(e){const{columnId:t,sectionId:i}=e.detail;if(this._currentSchema&&i){const e=this._currentSchema.sections.find(e=>e.id===i);e&&e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))}else this._columns=this._columns.filter(e=>e.id!==t),this._currentSchema&&this._currentSchema.sections.forEach(e=>{e.columns&&(e.columns=e.columns.filter(e=>e.id!==t))});this._removeColumnData(t,i),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-remove",{detail:{columnId:t,sectionId:i},bubbles:!0}))}_handleColumnHide(e){const{columnId:t,sectionId:i}=e.detail;i&&t&&(this._hiddenColumnIds.has(i)||this._hiddenColumnIds.set(i,new Set),this._hiddenColumnIds.get(i).add(t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-hide",{detail:{columnId:t,sectionId:i},bubbles:!0})))}_handleColumnShow(e){const{columnId:t,sectionId:i}=e.detail;i&&t&&this._showColumn(i,t)}_showColumn(e,t){var i;null==(i=this._hiddenColumnIds.get(e))||i.delete(t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-show",{detail:{columnId:t,sectionId:e},bubbles:!0}))}_getColumnsWithHiddenFlags(e){const t=e.columns||this._columns,i=this._hiddenColumnIds.get(e.id);return i&&0!==i.size?t.map(e=>i.has(e.id)?{...e,hidden:!0}:e):t}_getHiddenColumnsForMetadata(){if(0===this._hiddenColumnIds.size)return;const e={};return this._hiddenColumnIds.forEach((t,i)=>{t.size>0&&(e[i]=Array.from(t))}),Object.keys(e).length>0?e:void 0}_handleColumnAddRequest(e){const{sectionId:t,columnRequest:i,insertAfterColumnId:o}=e.detail;this._addColumnFromRequest(i,t,o)}_getAvailableDimensionsForSection(e){var t,i,o;if(!(null==(i=null==(t=this.xbrlInput)?void 0:t.hypercubes)?void 0:i[0]))return[];const r=this.xbrlInput.hypercubes[0].roles.find(t=>t.roleId===e);if(!(null==(o=null==r?void 0:r.items)?void 0:o.length))return[];const n=[],a=this.language||"en",s=(e,t)=>{var i;return(null==(i=(null==e?void 0:e.find(e=>e.lang===a&&"http://www.xbrl.org/2003/role/label"===e.role))||(null==e?void 0:e.find(e=>"en"===e.lang&&"http://www.xbrl.org/2003/role/label"===e.role))||(null==e?void 0:e.find(e=>"http://www.xbrl.org/2003/role/label"===e.role)))?void 0:i.label)||t};return r.items.forEach(e=>{e.dimensions&&e.dimensions.length>0&&e.dimensions.forEach(e=>{if(!n.find(t=>t.id===e.id)){const t=s(e.labels,e.conceptName),i={id:e.id,conceptName:e.conceptName,axisLabel:t};e.members&&e.members.length>0&&(i.members=e.members.map(e=>({id:e.id,label:s(e.labels,e.conceptName||e.id)}))),e.typedMember&&(i.typedMember={id:e.typedMember.id,dataType:e.typedMember.type||"string",validation:e.typedMember.validation}),n.push(i)}})}),n}_formatPeriodDisplay(e,t){if(!e||!t)return`${e||""} / ${t||""}`;const i=e.substring(0,4);return i===t.substring(0,4)?i:`${e} / ${t}`}_resolveSubmissionInstantDate(e,t,i,o){const r=this._getEffectivePeriodRole(e);if(null==r?void 0:r.includes("periodStartLabel")){const e=(null==i?void 0:i.startDate)||(null==o?void 0:o.periodStartDate)||t.periodStartDate||this.periodStartDate,n=(null==i?void 0:i.endDate)||(null==o?void 0:o.periodEndDate)||t.periodEndDate||this.periodEndDate;return this._resolveInstantDate(r,void 0,e,n)}return(null==i?void 0:i.instantDate)||(null==i?void 0:i.endDate)||t.periodInstantDate||(null==o?void 0:o.periodEndDate)||t.periodEndDate||t.periodStartDate||this.periodStartDate}_getEffectivePeriodRole(e){return e.effectivePeriodRole??e.preferredLabel}_resolveInstantDate(e,t,i,o){if(null==e?void 0:e.includes("periodStartLabel")){const e=i||"2025-01-01";try{const t=new Date(e);return t.setDate(t.getDate()-1),t.toISOString().split("T")[0]}catch{return e}}return t||o||i||"2025-01-01"}_correctLegacyPeriodStartInstantDates(){this._allSections.forEach(e=>{this._correctPeriodStartInstantDatesInConcepts(e.concepts,e)})}_correctPeriodStartInstantDatesInConcepts(e,t){e.forEach(e=>{var i,o;(null==(i=this._getEffectivePeriodRole(e))?void 0:i.includes("periodStartLabel"))&&"instant"===e.periodType&&(null==(o=e.fields)?void 0:o.length)&&e.fields.forEach(i=>{this._correctFieldPeriodStartInstantDate(e,i,e.id,t);const o=this._repeatCounts[e.id]||0;for(let r=1;r<=o;r++)this._correctFieldPeriodStartInstantDate(e,i,`${e.id}__repeat_${r}`,t)}),e.children&&this._correctPeriodStartInstantDatesInConcepts(e.children,t)})}_correctFieldPeriodStartInstantDate(e,t,i,o){var r;const n=this._findColumnByIdInSection(t.columnId,o),a=null==(r=this._periodData[i])?void 0:r[t.columnId],s=(null==a?void 0:a.startDate)||(null==n?void 0:n.periodStartDate)||t.periodStartDate||this.periodStartDate,l=(null==a?void 0:a.endDate)||(null==n?void 0:n.periodEndDate)||t.periodEndDate||this.periodEndDate,d=this._resolveInstantDate(this._getEffectivePeriodRole(e),void 0,s,l);a&&a.instantDate!==d&&(t.columnId,a.instantDate,a.instantDate=d),t.periodInstantDate!==d&&(e.id,t.columnId,t.periodInstantDate,t.periodInstantDate=d)}_addColumnFromRequest(e,t,i){var o,r,n,a,s;const l=`col-${Date.now()}`;let d="",c="";"instant"===e.periodType?(d=e.instantDate||"",c=""):"duration"!==e.periodType&&"mixed"!==e.periodType||(d=this._formatPeriodDisplay(e.startDate,e.endDate),c="");let p={dimensionId:"period",memberValue:"instant"===e.periodType?`instant-${e.instantDate}`:`duration-${e.startDate}-${e.endDate}`,memberLabel:d};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t=[],i=[];for(const o of e.selectedDimensions)o.isTyped?(t.push(o.axisLabel),i.push(`${o.axisId}|${o.typedValue||""}`)):o.memberId&&o.memberLabel&&(t.push(o.memberLabel),i.push(`${o.axisId}|${o.memberId}`));t.length>0&&(d=t.join(" | "),c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={dimensionId:l,memberValue:t.join(" | "),memberLabel:t.join(" | "),memberKey:t.join(" | "),dimensionIdKey:i.join("::"),selectedDimensions:e.selectedDimensions},p.memberKey)}else if(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]){const i=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t);if(1===(null==(n=null==i?void 0:i.items)?void 0:n.length)){const t=i.items[0];if(1===t.dimensions.length){const i=t.dimensions[0];if(i.members&&i.members.length>0){const t=(null==(a=i.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:a.label)||i.conceptName,o=i.members[0],r=(null==(s=o.labels.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:s.label)||o.conceptName;d=r,c="instant"===e.periodType?e.instantDate||"":this._formatPeriodDisplay(e.startDate,e.endDate),p={dimensionId:l,axisId:i.id,memberId:o.id,memberValue:r,memberLabel:r,axis:t,axisLabel:t,memberKey:`${t} | ${r}`,dimensionIdKey:`${i.id} | ${o.id}`},p.memberKey}}}}const u={id:l,title:d,description:c,type:(p.memberKey,"dimension"),order:this._columns.length,removable:!0,dimensionData:p,periodStartDate:"instant"===e.periodType?e.instantDate:e.startDate,periodEndDate:"instant"===e.periodType?e.instantDate:e.endDate};if(e.selectedDimensions&&e.selectedDimensions.length>0){const t={};let i=!1;for(const o of e.selectedDimensions)o.isTyped&&(t[o.axisId]=o.typedValue||"",i=!0);i&&(this._typedMemberData[l]=t,u.dimensionData&&(u.dimensionData.hasTypedMembers=!0,u.dimensionData.typedMembers=e.selectedDimensions.filter(e=>e.isTyped).map(e=>({axisId:e.axisId,axisLabel:e.axisLabel,typedMemberId:e.axisId,memberLabel:e.axisLabel,type:e.dataType,validation:e.validation}))))}if(this._currentSchema){const e=this._currentSchema.sections.find(e=>e.id===t);if(e)if(e.columns||(e.columns=[...this._columns]),i){const t=e.columns.findIndex(e=>e.id===i);e.columns=-1!==t?[...e.columns.slice(0,t+1),u,...e.columns.slice(t+1)]:[...e.columns,u]}else e.columns=[...e.columns,u]}this._replicateFieldsForNewColumn(l,e,t),this._dirty=!0,this.hasUnsavedChanges=!0,this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:u},bubbles:!0}))}_removeColumnData(e,t){if(this._currentSchema)if(t){const i=this._currentSchema.sections.find(e=>e.id===t);i&&this._removeColumnDataFromConcepts(i.concepts,e)}else for(const i in this._formData)void 0!==this._formData[i][e]&&delete this._formData[i][e]}_removeColumnDataFromConcepts(e,t){e.forEach(e=>{this._formData[e.id]&&void 0!==this._formData[e.id][t]&&delete this._formData[e.id][t],e.fields&&(e.fields=e.fields.filter(e=>e.columnId!==t)),e.children&&this._removeColumnDataFromConcepts(e.children,t)})}_shouldCreateFieldForConcept(e,t){if(e.abstract)return!1;if(!(t.selectedDimensions&&t.selectedDimensions.length>0)&&e.periodType){if("instant"===t.periodType&&"instant"!==e.periodType)return!1;if("duration"===t.periodType&&"duration"!==e.periodType)return!1}return!0}_replicateFieldsForNewColumn(e,t,i){if(!this._currentSchema)return;const o=new k,r=this._currentSchema.sections.find(e=>e.id===i);r&&this._replicateFieldsForSection(r.concepts,e,t,o)}_replicateFieldsForSection(e,t,i,o){e.forEach(e=>{var r;if(this._shouldCreateFieldForConcept(e,i)){const o=null==(r=e.fields)?void 0:r[0];let n;const a="instant"===i.periodType?i.instantDate:i.startDate,s="instant"===i.periodType?i.instantDate:i.endDate,l=this._resolveInstantDate(this._getEffectivePeriodRole(e),i.instantDate,a,s);n=o?{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:o.type,label:o.label,placeholder:o.placeholder,required:o.required,disabled:o.disabled,validation:o.validation,defaultValue:o.defaultValue,periodType:e.periodType,conceptType:e.type,periodStartDate:a,periodEndDate:s,periodInstantDate:"instant"===e.periodType?l:void 0}:{id:`${e.id}_${t}`,conceptId:e.id,columnId:t,type:"text",label:e.label||e.name,placeholder:`Enter ${e.name}`,required:!1,disabled:!1,validation:[],defaultValue:"",periodType:e.periodType,conceptType:e.type,periodStartDate:a,periodEndDate:s,periodInstantDate:"instant"===e.periodType?l:void 0},e.fields||(e.fields=[]),e.fields.push(n)}e.children&&this._replicateFieldsForSection(e.children,t,i,o)})}_addColumn(){const e={id:`dim-${Date.now()}`,title:`Dimension ${this._columns.length}`,description:"Additional dimension column",type:"dimension",order:this._columns.length,removable:!0,dimensionData:{dimensionId:"custom",memberValue:"default",memberLabel:"Default Member"}};this._columns=[...this._columns,e],this.requestUpdate(),this.dispatchEvent(new CustomEvent("column-add",{detail:{column:e},bubbles:!0}))}_findMissingTypedDimensionFacts(){var e;const t=[];if(!this._currentSchema)return t;for(const i of this._currentSchema.sections)for(const o of i.columns||[]){const r=null==(e=o.dimensionData)?void 0:e.typedMembers;if(!r||0===r.length)continue;const n=this._typedMemberData[this._scopedColumnKey(i.id,o.id)],a=this._typedMemberData[o.id];r.some(e=>{const t=(null==n?void 0:n[e.axisId])??(null==a?void 0:a[e.axisId]);return!(null==t?void 0:t.trim())})&&this._collectEnteredFactsForColumn(i.concepts,o,i,t)}return t}_collectEnteredFactsForColumn(e,t,i,o){var r,n;for(const a of e){const e=null==(r=this._formData[a.id])?void 0:r[t.id];null!=e&&""!==String(e).trim()&&o.push({conceptId:a.id,conceptLabel:a.label,columnId:t.id,columnTitle:t.title,sectionId:i.id,sectionTitle:i.title,value:e}),(null==(n=a.children)?void 0:n.length)&&this._collectEnteredFactsForColumn(a.children,t,i,o)}}_groupTypedDimensionWarningFactsByRole(){const e=[],t=new Map;for(const i of this._typedDimensionWarningFacts){let o=t.get(i.sectionId);o||(o={sectionId:i.sectionId,sectionTitle:i.sectionTitle,facts:[]},t.set(i.sectionId,o),e.push(o)),o.facts.push(i)}return e}_findDuplicateFactMismatches(){const e=[];if(!this._currentSchema)return e;const t=new Map;for(const i of this._currentSchema.sections){const e=new Map((i.columns||[]).map(e=>[e.id,e]));this._collectDuplicateFactCandidates(i.concepts,e,i,t)}return t.forEach(t=>{if(t.entries.length<2)return;new Set(t.entries.map(e=>this._normalizeFactValueForCompare(e.value))).size<2||e.push({conceptId:t.conceptId,conceptLabel:t.conceptLabel,facts:t.entries})}),e}_collectDuplicateFactCandidates(e,t,i,o){var r;for(const n of e){const e=this._formData[n.id];if(e)for(const r of n.fields){const a=e[r.columnId];if(null==a||""===String(a).trim())continue;const s=t.get(r.columnId);if(!s)continue;const l=this._buildFactContextKey(n,r,s,i);if(!l)continue;const d={conceptId:n.id,conceptLabel:n.label,columnId:s.id,columnTitle:s.title,sectionId:i.id,sectionTitle:i.title,value:a};let c=o.get(l);c||(c={conceptId:n.originalConceptId||n.id,conceptLabel:n.label,entries:[]},o.set(l,c)),c.entries.push(d)}(null==(r=n.children)?void 0:r.length)&&this._collectDuplicateFactCandidates(n.children,t,i,o)}}_buildFactContextKey(e,t,i,o){var r,n,a;const s=e.originalConceptId||e.id,l="instant"===e.periodType,d=null==(r=this._periodData[e.id])?void 0:r[i.id],c=(null==d?void 0:d.startDate)||i.periodStartDate||t.periodStartDate||this.periodStartDate,p=(null==d?void 0:d.endDate)||i.periodEndDate||t.periodEndDate||this.periodEndDate,u=(null==d?void 0:d.instantDate)||t.periodInstantDate||p||c,h=l?`instant:${u}`:`duration:${c}_${p}`,m=i.dimensionData;let f="base";if(m){const e=m.typedMembers;if(e&&e.length>0){const t=this._typedMemberData[this._scopedColumnKey(o.id,i.id)],r=this._typedMemberData[i.id],a=[];for(const i of e){const e=null==(n=(null==t?void 0:t[i.axisId])??(null==r?void 0:r[i.axisId]))?void 0:n.trim();if(!e)return null;a.push(`${i.axisId}=${e}`)}f=a.sort().join("|")}else(null==(a=m.combinations)?void 0:a.length)?f=m.combinations.map(e=>`${e.axisId}=${e.memberId}`).sort().join("|"):m.dimensionIdKey?f=m.dimensionIdKey:m.axisId&&m.memberId&&(f=`${m.axisId}=${m.memberId}`)}return`${s}||${h}||${f}`}_normalizeFactValueForCompare(e){if("number"==typeof e)return String(e);if("string"==typeof e){const t=e.trim(),i=Number(t);return""===t||isNaN(i)?t:String(i)}return String(e)}_updateDuplicateFactWarnings(e,t){var i;const o=null==(i=this._formData[e])?void 0:i[t],r=`${e}__${t}`;if(!(null!=o&&""!==String(o).trim())&&!this._duplicateFactWarnings.has(r))return;const n=this._findDuplicateFactMismatches(),a=new Map;for(const s of n)for(const e of s.facts)a.set(`${e.conceptId}__${e.columnId}`,s);this._duplicateFactWarnings=a}_validateWarningPopupTitle(){const e=this._typedDimensionWarningFacts.length>0,t=this._duplicateFactMismatches.length>0;return e&&t?F.t("validateWarningPopup.title"):t?F.t("duplicateFactWarning.title"):F.t("typedDimensionWarning.title")}_handleSubmit(){if(this._submitted=!0,this._submitDisabled=!0,"admin"===this.mode)return this._handleSaveDraft(),this._handleAdminModeSubmit(),void(this._submitDisabled=!1);const e=this._findMissingTypedDimensionFacts(),t=this._findDuplicateFactMismatches();if(e.length>0||t.length>0)return this._typedDimensionWarningFacts=e,this._duplicateFactMismatches=t,this._duplicateWarningPopupMode="validate",this._showValidateWarningPopup=!0,this._submitDisabled=!1,void this.requestUpdate();this._continueSubmit()}_continueSubmit(){if(this._submitted=!0,this._submitDisabled=!0,this._xbrlFormErrors.length,this._xbrlFormErrors,this._xbrlFormErrors.length>0)return this._xbrlFormErrors,this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();if(this._validateForm(),!this._valid)return this._errors,this._showErrorPopup=!0,this._submitDisabled=!1,void this.requestUpdate();this._correctLegacyPeriodStartInstantDates();const e=this._generateSubmissionData();JSON.stringify(e,null,2),e.forEach((e,t)=>{e.conceptId,e.columnId,e.value,e.unit}),this.dispatchEvent(new CustomEvent("form-submit",{detail:{data:this._formData,submissionData:e,valid:this._valid,errors:this._errors,reportingLanguage:this.reportingLanguage},bubbles:!0})),setTimeout(()=>{this._submitDisabled=!1},1e3)}_handleQuickValidate(){"admin"!==this.mode&&this._runFormulaValidationPreflight()}_runFormulaValidationPreflight(){var e,t,i,o,r,n,a,s;if(!this.formulaEnabled)return;const l=null==(i=null==(t=null==(e=this.xbrlInput)?void 0:e.formula)?void 0:t[0])?void 0:i.roles;if(!l||0===l.length)return;const d=(null==(r=null==(o=this._currentSchema)?void 0:o.sections)?void 0:r.length)?this._currentSchema.sections:this._allSections;if(!d||0===d.length)return;const c=new Set(d.map(e=>{var t;return(null==(t=e.metadata)?void 0:t.roleURI)||e.id})),p=l.filter(e=>c.has(e.roleURI));if(0===p.length)return;const u=d.map(e=>{var t;return{roleURI:(null==(t=e.metadata)?void 0:t.roleURI)||e.id,concepts:e.concepts,columns:e.columns}}),h=X(this._formData,this._mergeAllSectionColumns(),u,null==(s=null==(a=null==(n=this.xbrlInput)?void 0:n.hypercubes)?void 0:a[0])?void 0:s.roles,this.periodStartDate,this.periodEndDate,this._typedMemberData),m={...this.xbrlInput,formula:[{...this.xbrlInput.formula[0],roles:p}]},f=this._formulaValidationService.evaluate(m,h,this.language),b=this._formulaValidationService.summarize(f);this._formulaValidationResults=f,this._formulaValidationSummary=b;f.some(e=>!e.skipped&&!e.satisfied)&&(this._showFormulaValidationDialog=!0),this.dispatchEvent(new CustomEvent("formula-validation-complete",{detail:{results:f,summary:b},bubbles:!0,composed:!0}))}_mergeAllSectionColumns(){const e=new Map;return this._columns.forEach(t=>e.set(t.id,t)),this._allSections.forEach(t=>{(t.columns||[]).forEach(t=>e.set(t.id,t))}),Array.from(e.values())}_handleSaveDraft(e="manual"){if(this._xbrlFormErrors.length,this._xbrlFormErrors,this._xbrlFormErrors.length>0)return this._xbrlFormErrors,this._showErrorPopup=!0,void this.requestUpdate();this._formData,this._unitData,this._selectedRoleIds,this._correctLegacyPeriodStartInstantDates();const t=this._generateSubmissionData();t.forEach((e,t)=>{e.conceptId,e.columnId,e.value,e.unit});const i=this._roleCompletedStates.size>0?Object.fromEntries(this._roleCompletedStates):void 0,o=this._draftStorageService.createMetadataSnapshot(this.periodStartDate,this.periodEndDate,this.language,this._selectedRoleIds,this._allSections,this._typedMemberData,this._periodPreferences,this._periodData,this._unitData,this.reportingLanguage,this._repeatCounts,this._decimalsData,i,this._getHiddenColumnsForMetadata(),this._totalManuallyEditedData),r=JSON.stringify({draftData:t,metadata:o});if(r===this._lastSavedDraftSnapshot)return void(this.hasUnsavedChanges=!1);this._lastSavedDraftSnapshot=r,this.hasUnsavedChanges=!1;const n=this._draftStorageService.saveDraft(t,o);o.selectedRoleIds,this.dynaformsFacts=t,this.dynaformsMetadata=o,this.dispatchEvent(new CustomEvent("form-save-draft",{detail:{data:this._formData,draftData:t,metadata:o,saved:n,valid:this._valid,errors:this._errors,dynaformsFacts:t,dynaformsMetadata:o,reportingLanguage:this.reportingLanguage,source:"auto"==e?"auto":"manual"},bubbles:!0,composed:!0}));this._getRoleIdsArray().length;t.length,o.customColumns.length,Array.isArray(this._selectedRoleIds)&&this._selectedRoleIds.length>0&&this._selectedRoleIds[0]}async _loadDraftIfExists(){if(this.dynaformsFacts&&this.dynaformsMetadata){const e={formData:this.dynaformsFacts,metadata:this.dynaformsMetadata};return await this._restoreFromDraft(e),this._draftLoaded=!0,this._draftLoadedAt=this.dynaformsMetadata.savedAt||(new Date).toISOString(),void this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,source:"external",compatible:!0,warnings:[]},bubbles:!0,composed:!0}))}if(!this._draftStorageService.hasDraft())return;const e=this._draftStorageService.loadDraft();if(!e)return void console.warn("⚠️ Failed to load draft");const{compatible:t,warnings:i}=this._draftStorageService.validateDraftCompatibility(e,this.periodStartDate,this.periodEndDate);i.length>0&&console.warn("⚠️ Draft compatibility warnings:",i),await this._restoreFromDraft(e),this.dispatchEvent(new CustomEvent("form-draft-loaded",{detail:{draft:e,compatible:t,warnings:i},bubbles:!0,composed:!0})),e.formData.length,e.metadata.savedAt,this._draftStorageService.getDraftAge()}async _restoreFromDraft(e){var t;const{formData:i,metadata:o}=e;o.selectedRoleIds&&o.selectedRoleIds.length>0&&(this._selectedRoleIds=o.selectedRoleIds,this._selectedRoleIds.length),o.typedMemberData&&(this._typedMemberData=o.typedMemberData,this._preservedTypedMemberData={}),o.repeatCounts&&(this._repeatCounts=o.repeatCounts,this._repeatCounts),o.periodData&&(this._periodData=o.periodData,Object.keys(this._periodData).length),o.unitData&&(this._unitData=o.unitData,Object.keys(this._unitData).length),o.decimalsData&&(this._decimalsData=o.decimalsData,Object.keys(this._decimalsData).length),o.roleCompletedStates&&(this._roleCompletedStates=new Map(Object.entries(o.roleCompletedStates)),Object.keys(o.roleCompletedStates).length),o.hiddenColumns&&(this._hiddenColumnIds=new Map(Object.entries(o.hiddenColumns).map(([e,t])=>[e,new Set(t)])),this._hiddenColumnIds.size),o.totalManuallyEditedData&&(this._totalManuallyEditedData=o.totalManuallyEditedData,Object.keys(this._totalManuallyEditedData).length),o.periodPreferences?this._skipPeriodPreferencesRestore||(this._periodPreferences=o.periodPreferences,this._periodPreferences,this.xbrlInput&&(this._currentSchema=k.buildFormSchema(this.xbrlInput,this.periodStartDate,this.periodEndDate,this.language,this._periodPreferences),this._allSections=[...this._currentSchema.sections],this._applyCustomPeriodDataToFields(),o.customColumns&&o.customColumns.length>0&&(this._mergeAdditionalCustomColumns(o.customColumns),o.customColumns.length))):o.customColumns&&o.customColumns.length>0&&(this._restoreCustomColumns(o.customColumns),o.customColumns.length);const r={},n={},a={};i.forEach(e=>{let{conceptId:t,draftInstanceId:i,value:o,columnId:s,period:l,unit:d}=e;if(!s&&l&&(s=this._inferColumnIdFromPeriod(l,t),!s))return void console.warn(`⚠️ Could not infer columnId for concept ${t}, skipping...`);if(this._isPriorYearExcludedFact(t,s))return;const c=i||t,p=c.includes("__repeat_")?c.split("__repeat_")[0]:c,u=this._findActualConceptId(p),h=c.includes("__repeat_")?`${u||p}__repeat_${c.split("__repeat_")[1]}`:u||c;r[h]||(r[h]={}),r[h][s]=o,l&&(n[h]||(n[h]={}),"instant"===l.type?(n[h][s]={instantDate:l.date},l.date):"duration"===l.type&&(n[h][s]={startDate:l.startDate,endDate:l.endDate},l.startDate,l.endDate)),d&&(a[h]||(a[h]={}),a[h][s]=d)}),this._formData={...this._formData,...r},Object.keys(r).length,this._seedLegacyManuallyEditedTotals(r),this._initializeGlobalDecimalsFromRoundingData(),this._periodData={...this._periodData,...o.periodData||{},...n},Object.keys(this._periodData).length,JSON.stringify(this._periodData,null,2),this._unitData={...this._unitData,...o.unitData||{},...a},Object.keys(this._unitData).length,JSON.stringify(this._unitData,null,2),this._correctLegacyPeriodStartInstantDates(),this._selectedRoleIds.length>0&&this._applyRoleFilter(),this._dirty=!0,this._touched.clear(),this._validateForm(),this._allSections=[...this._allSections],this.requestUpdate(),await this.updateComplete,await new Promise(e=>setTimeout(e,100));const s=(null==(t=this.shadowRoot)?void 0:t.querySelectorAll("input, textarea, select").length)||0;s>0?this._populateFieldValues(r):console.error("❌ No fields found in DOM even after updateComplete")}_findActualConceptId(e){for(const t of this._allSections){const i=this._findActualConceptIdInTree(t.concepts,e);if(i)return i}return null}_findActualConceptIdInTree(e,t){for(const i of e){if(i.originalConceptId===t||i.id===t)return i.id;if(i.children){const e=this._findActualConceptIdInTree(i.children,t);if(e)return e}}return null}_inferColumnIdFromPeriod(e,t){for(const i of this._allSections){if(this._findConceptInSection(i.concepts,t)&&i.columns){for(const t of i.columns){const i="instant"===e.type,o="duration"===e.type;if(i&&e.date){if(t.periodStartDate===e.date||t.periodStartDate===t.periodEndDate&&t.periodStartDate===e.date)return t.id,t.id}else if(o&&e.startDate&&e.endDate&&t.periodStartDate===e.startDate&&t.periodEndDate===e.endDate)return t.id,t.id}if("instant"===e.type){const e=i.columns.find(e=>"instant"===e.id);if(e)return e.id}else{const e=i.columns.find(e=>"duration"===e.id);if(e)return e.id}}}return null}_findConceptInSection(e,t){for(const i of e){if(i.id===t||i.originalConceptId===t)return i;if(i.children){const e=this._findConceptInSection(i.children,t);if(e)return e}}return null}_populateFieldValues(e){Object.keys(e).forEach(t=>{const i=e[t];Object.keys(i).forEach(e=>{var o,r;const n=i[e],a=`${t}__${e}`,s=null==(o=this.shadowRoot)?void 0:o.querySelector(`#${CSS.escape(a)}`);s?(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)&&("checkbox"===s.type?s.checked=Boolean(n):s.value=null!=n?String(n):""):(console.warn(` ❌ Field element NOT FOUND: ${a}`),console.warn(" Available fields in DOM:",Array.from((null==(r=this.shadowRoot)?void 0:r.querySelectorAll("input, textarea, select"))||[]).map(e=>e.id).filter(e=>e.includes(t.split("__")[0]))))})})}_seedLegacyManuallyEditedTotals(e){const t={...this._totalManuallyEditedData};let i=!1;const o=r=>{var n;for(const a of r){if(E(a.preferredLabel)){const o=e[a.id];if(o)for(const e of Object.keys(o)){const r=o[e];null==r||""===r||void 0!==(null==(n=t[a.id])?void 0:n[e])||(t[a.id]={...t[a.id]||{},[e]:!0},i=!0)}}a.children&&a.children.length>0&&o(a.children)}};for(const r of this._allSections)o(r.concepts||[]);i&&(this._totalManuallyEditedData=t)}_restoreCustomColumns(e){const t=new Map;e.forEach(e=>{t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e)}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o){if(e.columns=o.map(e=>{const t={id:e.columnId,title:e.label,description:e.description,type:e.dimensionData?"dimension":"base",periodStartDate:e.startDate||e.date,periodEndDate:e.endDate||e.date,dimensionData:e.dimensionData,order:0,removable:"duration"!==e.columnId&&"instant"!==e.columnId,periodType:e.periodType};return e.columnId,t}),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,t.length,e.id}else e.datatypes?(e.id,e.datatypes.length):console.warn(`⚠️ [Draft Restore] No datatypes available for section ${e.id}`);this._regenerateFieldsForSection(e),o.length,e.id}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_mergeAdditionalCustomColumns(e){const t=new Map;e.forEach(e=>{e.columnId.startsWith("col-")&&(t.has(e.sectionId)||t.set(e.sectionId,[]),t.get(e.sectionId).push(e))}),this._allSections.forEach(e=>{var i;const o=t.get(e.id);if(o&&o.length>0){if(e.columns||(e.columns=[]),(null==(i=this.xbrlInput)?void 0:i.datatypes)&&!e.datatypes){const t=Array.isArray(this.xbrlInput.datatypes)?this.xbrlInput.datatypes:this.xbrlInput.datatypes.concepts||[];e.datatypes=t,t.length,e.id}else e.datatypes?(e.id,e.datatypes.length):console.warn(`⚠️ [Merge Custom] No datatypes available for section ${e.id}`);o.forEach(t=>{t.columnId,t.startDate,t.endDate,t.date,t.periodType;if(!e.columns.find(e=>e.id===t.columnId)){const i={id:t.columnId,title:t.label,description:t.description,type:t.dimensionData?"dimension":"base",periodStartDate:t.startDate||t.date,periodEndDate:t.endDate||t.date,dimensionData:t.dimensionData,order:e.columns.length,removable:!0,periodType:t.periodType};i.id,i.title,i.description,i.periodStartDate,i.periodEndDate,i.periodType,e.columns.push(i),t.columnId,e.id}}),this._regenerateFieldsForSection(e)}}),this._currentSchema&&(this._currentSchema={...this._currentSchema,sections:this._allSections})}_applyCustomPeriodDataToFields(){if(!this._periodData||0===Object.keys(this._periodData).length)return;const e=t=>{t.forEach(t=>{if(this._periodData[t.id]){const e=this._periodData[t.id];t.fields&&t.fields.forEach(i=>{const o=e[i.columnId];o&&(o.startDate&&(i.periodStartDate=o.startDate),o.endDate&&(i.periodEndDate=o.endDate),o.instantDate&&(i.periodInstantDate=o.instantDate),t.id,i.columnId,i.periodStartDate,i.periodEndDate,i.periodInstantDate)})}t.children&&t.children.length>0&&e(t.children)})};this._allSections.forEach(t=>{t.concepts&&t.concepts.length>0&&e(t.concepts)})}_regenerateFieldsForSection(e){if(!e.columns)return;const t=this._periodPreferences[e.id]||{showDuration:!0,showInstant:!0,showPreviousYear:!1},i=o=>{o.forEach(o=>{o.fields=[];this._shouldShowConceptBasedOnPeriodPreferences(o,t)&&e.columns.forEach(t=>{var i;const r=o.periodType,n=this._inferColumnPeriodType(t);if(o.abstract)return;const a=t.id.startsWith("col-"),s=t.id.startsWith("duration_")||t.id.startsWith("instant_")||t.id.startsWith("typed-"),l=!0===e.showPeriodControl;if(!(!n||"duration"===t.id||"default"===t.id||a&&l||s)&&r&&n&&r!==n)return o.id,void t.id;const d={id:`${o.id}_${t.id}`,conceptId:o.id,columnId:t.id,type:this._mapConceptTypeToFieldType(o.type),label:o.label,periodType:r,conceptType:o.type,periodStartDate:t.periodStartDate,periodEndDate:t.periodEndDate,periodInstantDate:"instant"===r?this._resolveInstantDate(this._getEffectivePeriodRole(o),void 0,t.periodStartDate,t.periodEndDate):void 0};if(null==(i=this._periodData[o.id])?void 0:i[t.id]){const e=this._periodData[o.id][t.id];e.startDate&&(d.periodStartDate=e.startDate),e.endDate&&(d.periodEndDate=e.endDate),e.instantDate&&(d.periodInstantDate=e.instantDate),o.id,t.id,d.periodStartDate,d.periodEndDate,d.periodInstantDate}else o.id,t.id,this._periodData[o.id];(o.id.includes("DescriptionLocationNL")||t.id.startsWith("col-"))&&(o.id,t.id,d.periodStartDate,d.periodEndDate,t.periodStartDate),o.fields.push(d)}),o.children&&i(o.children)})};i(e.concepts)}_shouldShowConceptBasedOnPeriodPreferences(e,t){return!!e.abstract||(!e.periodType||!("duration"===e.periodType&&!t.showDuration)&&!("instant"===e.periodType&&!t.showInstant))}_inferColumnPeriodType(e){return e.periodType?e.periodType:e.periodStartDate&&e.periodEndDate?e.periodStartDate===e.periodEndDate?"instant":"duration":e.periodStartDate&&!e.periodEndDate?"instant":void 0}_mapConceptTypeToFieldType(e){return e?e.includes("monetary")||e.includes("Monetary")?"number":e.includes("date")||e.includes("Date")?"date":e.includes("boolean")||e.includes("Boolean")?"boolean":e.includes("integer")||e.includes("Integer")||e.includes("decimal")||e.includes("Decimal")?"number":"text":"text"}_generateSubmissionData(){const e=[];if(!this._currentSchema)return e;this._currentSchema.sections.forEach(t=>{this._processConceptsForSubmission(t.concepts,e,t)}),this._includePreservedDataInSubmission(e);return this._removeDuplicateSubmissions(e)}_includePreservedDataInSubmission(e){Object.keys(this._preservedFormData).forEach(t=>{const i=this._preservedFormData[t];i&&Object.keys(i).forEach(o=>{const r=i[o];if(null!=r&&""!==r){const i=this._findConceptInAllSections(t);if(i){const n=this._findSectionForConcept(t);this._addConceptDataToSubmission(i,o,r,e,n||void 0)}}})}),e.length}_findConceptInAllSections(e){for(const t of this._allSections){const i=this._findConceptInSection(t.concepts,e);if(i)return i}return null}_findSectionForConcept(e){for(const t of this._allSections){if(this._findConceptInSection(t.concepts,e))return t}return null}_addConceptDataToSubmission(e,t,i,o,r){var n,a,s,l,d;if(this._isPriorYearExcludedFact(e.id,t))return;const c=e.fields.find(e=>e.columnId===t);if(!c)return;const p="instant"===e.periodType,u=null==(n=this._periodData[e.id])?void 0:n[t],h=null==(a=this._unitData[e.id])?void 0:a[t],m=this._findColumnByIdInAllSections(t);e.id,u&&JSON.stringify(u),null==m||m.periodStartDate,null==m||m.periodEndDate;const f=(null==u?void 0:u.startDate)||(null==m?void 0:m.periodStartDate)||c.periodStartDate||this.periodStartDate,b=(null==u?void 0:u.endDate)||(null==m?void 0:m.periodEndDate)||c.periodEndDate||this.periodEndDate,g=(null==u?void 0:u.instantDate)||c.periodInstantDate||b||f,v={conceptId:e.originalConceptId||e.id,columnId:t,value:i,period:{type:e.periodType||"duration",...p?{date:g}:{startDate:f,endDate:b}}};h&&(v.unit=h,e.id);const y=null==(s=e.type)?void 0:s.toLowerCase().includes("monetary"),x=(null==(l=this._decimalsData[e.id])?void 0:l[t])||("INF"!==this.decimals?this.decimals:void 0);if(y&&x){const e=parseFloat(x);v.decimals=isNaN(e)?x:String(-Math.abs(e))}(null==(d=null==m?void 0:m.dimensionData)?void 0:d.memberLabel)&&(v.dimension=m.dimensionData.memberLabel),JSON.stringify(v,null,2),o.push(v)}_findColumnByIdInAllSections(e){for(const t of this._allSections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_removeDuplicateSubmissions(e){const t=new Map;return e.forEach(e=>{const i="instant"===e.period.type?e.period.date:`${e.period.startDate}_${e.period.endDate}`,o=`${e.conceptId}_${e.value}_${e.dimension||"no-dimension"}_${i}`;t.has(o)||t.set(o,e)}),Array.from(t.values())}_findColumnById(e){if(this._currentSchema)for(const t of this._currentSchema.sections)if(t.columns){const i=t.columns.find(t=>t.id===e);if(i)return i}}_findColumnByIdInSection(e,t){if(null==t?void 0:t.columns)return t.columns.find(t=>t.id===e)}_getTypedMemberNameForAxis(e,t){var i,o,r,n;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0]))return null;const a=null==t?void 0:t.id;if(!a)return null;const s=null==(r=this.xbrlInput.hypercubes[0].roles)?void 0:r.find(e=>e.roleId===a);if(!(null==s?void 0:s.items))return null;for(const l of s.items)if(l.dimensions){const t=l.dimensions.find(t=>t.id===e);if(null==(n=null==t?void 0:t.typedMember)?void 0:n.id)return t.typedMember.id}return null}_doesConceptApplyToTypedDimension(e,t,i){var o,r,n;if(!(null==(r=null==(o=this.xbrlInput)?void 0:o.hypercubes)?void 0:r[0]))return!1;const a=null==t?void 0:t.id;if(!a)return!1;const s=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===a);if(!(null==(n=null==s?void 0:s.items)?void 0:n.length))return!1;for(const l of s.items){const t=e.originalConceptId||e.id;if(l.conceptIds&&l.conceptIds.includes(t)){const e=l.dimensions.some(e=>e.typedMember);return e}}return e.originalConceptId||e.id,!1}_getApplicableTypedDimensions(e,t){var i,o,r;if(!(null==(o=null==(i=this.xbrlInput)?void 0:i.hypercubes)?void 0:o[0])||!(null==t?void 0:t.id))return[];const n=this.xbrlInput.hypercubes[0].roles.find(e=>e.roleId===t.id);if(!(null==(r=null==n?void 0:n.items)?void 0:r.length))return[];const a=e.originalConceptId||e.id;for(const s of n.items)if(s.conceptIds&&s.conceptIds.includes(a)){const e=s.dimensions.filter(e=>e.typedMember).map(e=>e.id);return e}return[]}_processConceptsForSubmission(e,t,i){const o="Toelichting op de geconsolideerde jaarrekening - Financiële vaste activa: Deelnemingen: Volledig geconsolideerd: Specificatie",r=(null==i?void 0:i.title)||"Unknown";e.forEach(e=>{if(r===o&&(e.originalConceptId||e.id,e.fields&&(e.fields.length,e.fields.forEach((t,i)=>{var o;t.columnId,null==(o=this._formData[e.id])||o[t.columnId]}))),e.fields&&e.fields.length>1&&e.fields.forEach((e,t)=>{}),e.fields&&e.fields.length>0){e.fields.forEach(o=>{var r,n,a,s,l,d,c;if(this._isPriorYearExcludedFact(e.id,o.columnId))return;const p=this._formData[e.id],u=o.conceptId||e.id.split("__").slice(0,-1).join("__")||e.id,h="admin"!==this.mode&&!!this._effectiveMasterData&&u in this._effectiveMasterData;let m=h?this._effectiveMasterData[u]:null==p?void 0:p[o.columnId];if(h)o.columnId,JSON.stringify(m);else if((null==m||""===m)&&this._isRoundingLevelConcept(u)&&!this._hasValidGlobalDecimals()){const t=this._findFactValueForField(e,o,i);null!=t&&""!==t&&(m=t)}if(null!=m&&""!==m){const p=this._findColumnByIdInSection(o.columnId,i),u=null==(r=this._periodData[e.id])?void 0:r[o.columnId],h={conceptId:e.id,draftInstanceId:e.id,columnId:o.columnId,value:m,period:{type:e.periodType||"duration"}};if("instant"===e.periodType){const t=this._resolveSubmissionInstantDate(e,o,u,p);h.period.date=t}else{const e=(null==u?void 0:u.startDate)||(null==p?void 0:p.periodStartDate)||o.periodStartDate||this.periodStartDate,t=(null==u?void 0:u.endDate)||(null==p?void 0:p.periodEndDate)||o.periodEndDate||this.periodEndDate;h.period.startDate=e,h.period.endDate=t}e.id,o.columnId,u&&JSON.stringify(u),null==p||p.periodStartDate,null==p||p.periodEndDate,"instant"===h.period.type?h.period.date:(h.period.startDate,h.period.endDate);const f=null==(n=this._unitData[e.id])?void 0:n[o.columnId];f?(h.unit=f,e.id,o.columnId):(e.id,o.columnId,JSON.stringify(this._unitData,null,2));const b=null==(a=e.type)?void 0:a.toLowerCase().includes("monetary"),g=(null==(s=this._decimalsData[e.id])?void 0:s[o.columnId])||("INF"!==this.decimals?this.decimals:void 0);if(b&&g){const e=parseFloat(g);h.decimals=isNaN(e)?g:String(-Math.abs(e))}"dimension"===(null==p?void 0:p.type)&&(null==(l=p.dimensionData)?void 0:l.dimensionIdKey)?(h.dimension=p.dimensionData.dimensionIdKey,o.columnId,p.dimensionData.dimensionIdKey):(o.columnId,null==p||p.type,null==p||p.dimensionData);const v=i?this._scopedColumnKey(i.id,o.columnId):o.columnId,y=this._typedMemberData[v],x=this._typedMemberData[o.columnId];if(y||x){const t=this._getApplicableTypedDimensions(e,i);if(e.id,t.length>0){const e={};t.forEach(t=>{const o=(null==y?void 0:y[t])??(null==x?void 0:x[t]);if(o){const r=this._getTypedMemberNameForAxis(t,i);e[t]={value:o,memberName:r||"Unknown"}}}),Object.keys(e).length>0&&(h.typedMembers=e)}else e.id}else o.columnId,Object.keys(this._typedMemberData),p&&(p.id,p.type,null==(d=p.dimensionData)||d.hasTypedMembers,p.dimensionData);if(!h.typedMembers&&(null==(c=o.crossRoleTypedMembers)?void 0:c.length)){const t=`${e.id}__${o.columnId}`,i=this._typedMemberData[t];if(i){const t={};o.crossRoleTypedMembers.forEach(e=>{const o=i[e.axisId];null!=o&&""!==o&&(t[e.axisId]={value:o,memberName:e.typedMemberId})}),Object.keys(t).length>0&&(h.typedMembers=t,e.id,o.columnId)}}t.push(h)}});const o=this._repeatCounts[e.id]||0;if(o>0&&e.fields.some(e=>{var t;return null==(t=e.crossRoleTypedMembers)?void 0:t.length}))for(let r=1;r<=o;r++){const o=`${e.id}__repeat_${r}`;e.fields.forEach(r=>{var n,a,s,l,d;const c=null==(n=this._formData[o])?void 0:n[r.columnId];if(null==c||""===c)return;const p=this._findColumnByIdInSection(r.columnId,i),u=null==(a=this._periodData[o])?void 0:a[r.columnId],h={conceptId:e.id,draftInstanceId:o,columnId:r.columnId,value:c,period:{type:e.periodType||"duration"}};"instant"===e.periodType?h.period.date=this._resolveSubmissionInstantDate(e,r,u,p):(h.period.startDate=(null==u?void 0:u.startDate)||(null==p?void 0:p.periodStartDate)||r.periodStartDate||this.periodStartDate,h.period.endDate=(null==u?void 0:u.endDate)||(null==p?void 0:p.periodEndDate)||r.periodEndDate||this.periodEndDate);const m=null==(s=this._unitData[o])?void 0:s[r.columnId];if(m&&(h.unit=m),"dimension"===(null==p?void 0:p.type)&&(null==(l=p.dimensionData)?void 0:l.dimensionIdKey)&&(h.dimension=p.dimensionData.dimensionIdKey),null==(d=r.crossRoleTypedMembers)?void 0:d.length){const e=`${o}__${r.columnId}`,t=this._typedMemberData[e];if(t){const e={};r.crossRoleTypedMembers.forEach(i=>{const o=t[i.axisId];null!=o&&""!==o&&(e[i.axisId]={value:o,memberName:i.typedMemberId})}),Object.keys(e).length>0&&(h.typedMembers=e)}}t.push(h)})}}e.children&&this._processConceptsForSubmission(e.children,t,i)})}_handleReset(){this._formData=this._stripPriorYearExcludedFacts(this.initialData),this._touched.clear(),this._dirty=!1,this.hasUnsavedChanges=!1,this._submitted=!1,this._preservedFormData={},this._preservedTypedMemberData={},this._validateForm(),this.requestUpdate(),this.dispatchEvent(new CustomEvent("form-reset",{detail:{},bubbles:!0}))}_getFormState(){return{data:this._formData,errors:this._errors,touched:this._touched,dirty:this._dirty,valid:this._valid,submitted:this._submitted}}_analyzeAllVisibleRoles(){if(this._currentSchema&&this._currentSchema.sections&&0!==this._currentSchema.sections.length){this._currentSchema.sections.length;for(const e of this._currentSchema.sections)this._analyzeAndLogRole(e.id)}}_handleRoleContextMenu(e,t,i){e.preventDefault(),e.stopPropagation(),this._contextMenuX=e.clientX,this._contextMenuY=e.clientY,this._contextMenuRoleId=t,this._showRoleContextMenu=!0,this.requestUpdate()}_closeRoleContextMenu(){this._showRoleContextMenu=!1,this._contextMenuRoleId=null,this.requestUpdate()}_handleRemoveRole(){if(!this._contextMenuRoleId)return void this._closeRoleContextMenu();const e=this._allSections.find(e=>e.id===this._contextMenuRoleId),t=(null==e?void 0:e.title)||"Unknown";if(this._contextMenuRoleId,Array.isArray(this._selectedRoleIds)&&(this._selectedRoleIds.length>0&&"object"==typeof this._selectedRoleIds[0]?this._selectedRoleIds=this._selectedRoleIds.filter(e=>e.roleId!==this._contextMenuRoleId):this._selectedRoleIds=this._selectedRoleIds.filter(e=>e!==this._contextMenuRoleId)),this._selectedRoleIds.length,this._activeSidePanelRoleId===this._contextMenuRoleId){const e=this._getRoleIdsArray();this._activeSidePanelRoleId=e.length>0?e[0]:null,this._activeSidePanelRoleId}this._applyRoleFilter(),this.dispatchEvent(new CustomEvent("role-removed",{detail:{roleId:this._contextMenuRoleId,roleTitle:t,remainingRolesCount:this._selectedRoleIds.length},bubbles:!0,composed:!0})),this._closeRoleContextMenu()}_handleRoleCompletedChange(e,t){t?this._roleCompletedStates.set(e,!0):this._roleCompletedStates.delete(e),this._roleCompletedStates=new Map(this._roleCompletedStates),this._handleSaveDraft("auto")}_handleSidePanelRoleClick(e){this._activeSidePanelRoleId&&this._activeSidePanelRoleId!==e&&this._analyzeAndLogRole(this._activeSidePanelRoleId),this._activeSidePanelRoleId=e}_analyzeAndLogRole(e){const t=this._allSections.find(t=>t.id===e);if(!t)return void console.warn(`⚠️ Section not found for roleId: ${e}`);t.title,this.masterData&&Object.keys(this.masterData);const i=[];this._collectAllFields(t.concepts||[],new Set((t.columns||[]).map(e=>e.id)),t.columns||[],i);const o=this._roleHasErrors(e),r=i.filter(e=>e.isEmpty).length,n=i.filter(e=>!e.isEmpty).length;let a;i.length,a=o?"INVALID":0===n?"UNTOUCHED":r>0?"INCOMPLETE":"COMPLETE","INVALID"===a||("UNTOUCHED"===a?(this._roleBorderStatuses.set(e,"untouched"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):"INCOMPLETE"===a?(this._roleBorderStatuses.set(e,"incomplete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)):(this._roleBorderStatuses.set(e,"complete"),this._roleBorderStatuses=new Map(this._roleBorderStatuses)))}_collectAllFields(e,t,i,o){var r,n,a;for(const s of e)if(s.abstract)s.children&&s.children.length>0&&this._collectAllFields(s.children,t,i,o);else{if(s.fields&&s.fields.length>0){const e=s.fields.filter(e=>t.has(e.columnId));for(const t of e){const e=s.id,l=t.conceptId;let d=null==(r=this._formData[e])?void 0:r[t.columnId];void 0===d&&e!==l&&(d=null==(n=this._formData[l])?void 0:n[t.columnId]);const c=null==(a=this._effectiveMasterData)?void 0:a[l];(null==d||"string"==typeof d&&""===d.trim())&&void 0!==c&&(d=c,t.columnId,JSON.stringify(d));let p=null==d||"string"==typeof d&&""===d.trim();if(p&&s.facts&&s.facts.length>0){const e=i.find(e=>e.id===t.columnId),o={conceptId:l,columnId:t.columnId,periodStartDate:t.periodStartDate||(null==e?void 0:e.periodStartDate),periodEndDate:t.periodEndDate||(null==e?void 0:e.periodEndDate),periodInstantDate:t.periodInstantDate||("instant"===t.periodType?t.periodEndDate||t.periodStartDate:void 0),periodType:t.periodType,dimensionData:null==e?void 0:e.dimensionData},r=we.findMatchingFact(s.facts,o);r&&null!==r.value&&void 0!==r.value&&""!==r.value&&(d=r.value,p=!1)}o.push({conceptId:l,columnId:t.columnId,value:d,isEmpty:p})}}s.children&&s.children.length>0&&this._collectAllFields(s.children,t,i,o)}}_handleSidePanelSearchInput(e){const t=e.target;this._sidePanelSearchQuery=t.value}_clearSidePanelSearch(){var e;this._sidePanelSearchQuery="";const t=null==(e=this.shadowRoot)?void 0:e.querySelector(".side-panel-search-input");t&&(t.value="",t.focus()),this.updateComplete.then(()=>this._scrollActiveRoleIntoView())}_toggleSidePanelCollapse(){this._sidePanelCollapsed=!this._sidePanelCollapsed}_isSectionBlank(e){const t=e.columns||this._columns,i=e=>{var o;for(const r of e){if(!r.abstract)for(const e of t){const t=null==(o=this._formData[r.id])?void 0:o[e.id];if(null!=t&&""!==t)return!0}if(r.children&&r.children.length>0&&i(r.children))return!0}return!1};return!i(e.concepts)}_getConceptSearchMatchIds(e){var t,i,o;const r=new Set;if(!e.trim()||!(null==(i=null==(t=this.xbrlInput)?void 0:t.presentation)?void 0:i.length))return r;const n=e.toLowerCase().trim(),a=e=>{var t;for(const i of e)r.add(i.id),(null==(t=i.children)?void 0:t.length)&&a(i.children)},s=e=>{var t,i,o,l;for(const d of e){let e=(null==(t=d.conceptName)?void 0:t.toLowerCase().includes(n))||(null==(i=d.id)?void 0:i.toLowerCase().includes(n));!e&&Array.isArray(d.labels)&&(e=d.labels.some(e=>{var t;return null==(t=e.label)?void 0:t.toLowerCase().includes(n)})),e?(r.add(d.id),(null==(o=d.children)?void 0:o.length)&&a(d.children)):(null==(l=d.children)?void 0:l.length)&&s(d.children)}};for(const l of this.xbrlInput.presentation)for(const e of l.roles||[])s((null==(o=e.presentationLinkbase)?void 0:o.concepts)||[]);return r}_isSectionConceptSearchMatch(e,t){if(0===t.size)return!1;const i=e=>{var o;for(const r of e){if(t.has(r.originalConceptId))return!0;if((null==(o=r.children)?void 0:o.length)&&i(r.children))return!0}return!1};return i(e.concepts)}_filterSidePanelSections(e){if(!this._sidePanelSearchQuery.trim())return e;const t=this._sidePanelSearchQuery.toLowerCase().trim();return e.filter(e=>{var i,o,r;const n=e.title.toLowerCase().includes(t),a=e.id.toLowerCase().includes(t),s=(null==(i=e.description)?void 0:i.toLowerCase().includes(t))||!1,l=(null==(r=null==(o=e.metadata)?void 0:o.roleURI)?void 0:r.toLowerCase().includes(t))||!1;return n||a||s||l})}_renderAdminModeContent(t){var i,o;if(!t)return e.html`
|
|
3902
4003
|
<div class="admin-mode-container">
|
|
3903
4004
|
<p>No role selected</p>
|
|
3904
4005
|
</div>
|
|
@@ -3920,7 +4021,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3920
4021
|
|
|
3921
4022
|
${a?e.html`
|
|
3922
4023
|
<div class="admin-dimension-section">
|
|
3923
|
-
<div class="admin-dimension-header">📊 ${
|
|
4024
|
+
<div class="admin-dimension-header">📊 ${F.t("filter.dimensionMemberSelection")}</div>
|
|
3924
4025
|
${n.map(i=>{var o,r;const n=this._getAllDimensionMembers(i.members),a=(null==(r=null==(o=i.labels)?void 0:o.find(e=>"http://www.xbrl.org/2003/role/label"===e.role))?void 0:r.label)||i.conceptName,s=this._isSingleMemberDimension(i);return e.html`
|
|
3925
4026
|
<div class="admin-dimension-group">
|
|
3926
4027
|
<div class="admin-dimension-label">${a}${s?" (Mandatory)":""}</div>
|
|
@@ -3944,13 +4045,13 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3944
4045
|
class="admin-member-select-btn"
|
|
3945
4046
|
@click="${()=>this._selectAllAdminDimensionMembers(t.id,i.id)}"
|
|
3946
4047
|
>
|
|
3947
|
-
${
|
|
4048
|
+
${F.t("filter.selectAllMembers")}
|
|
3948
4049
|
</button>
|
|
3949
4050
|
<button
|
|
3950
4051
|
class="admin-member-select-btn"
|
|
3951
4052
|
@click="${()=>this._deselectAllAdminDimensionMembers(t.id,i.id)}"
|
|
3952
4053
|
>
|
|
3953
|
-
${
|
|
4054
|
+
${F.t("filter.clearMembers")}
|
|
3954
4055
|
</button>
|
|
3955
4056
|
</div>
|
|
3956
4057
|
`}
|
|
@@ -3968,7 +4069,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3968
4069
|
<!-- Validation Summary -->
|
|
3969
4070
|
${o?e.html`
|
|
3970
4071
|
<div class="validation-summary ${0===r?"warnings-only":""}">
|
|
3971
|
-
<h4 class="validation-summary-title">${r>0?
|
|
4072
|
+
<h4 class="validation-summary-title">${r>0?F.t("validation.summary"):F.t("calculationWarning.title")}</h4>
|
|
3972
4073
|
<ul class="validation-summary-list">
|
|
3973
4074
|
${this._errors.filter(e=>"error"===e.severity||"warning"===e.severity&&"readonly"!==this.mode).map(t=>e.html`
|
|
3974
4075
|
<li class="validation-summary-item ${t.severity}">${"warning"===t.severity?"⚠️ ":""}${t.message}</li>
|
|
@@ -3984,9 +4085,9 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
3984
4085
|
</div>
|
|
3985
4086
|
`):0===t.sections.length?e.html`
|
|
3986
4087
|
<div class="no-roles-message">
|
|
3987
|
-
<h3>${
|
|
3988
|
-
<p>${
|
|
3989
|
-
<p>${
|
|
4088
|
+
<h3>${F.t("form.noRoleSelected")}</h3>
|
|
4089
|
+
<p>${F.t("filter.selectRoles")}</p>
|
|
4090
|
+
<p>${F.t("filter.roles")}: ${this._allSections.length}</p>
|
|
3990
4091
|
</div>
|
|
3991
4092
|
`:(()=>s.map((t,o)=>{var r;return e.html`
|
|
3992
4093
|
<jupiter-form-section
|
|
@@ -4018,6 +4119,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4018
4119
|
.periodEndDate="${this.periodEndDate}"
|
|
4019
4120
|
.calculationEnabled="${this.calculationEnabled}"
|
|
4020
4121
|
.totalManuallyEditedData="${this._totalManuallyEditedData}"
|
|
4122
|
+
.duplicateFactWarnings="${this._duplicateFactWarnings}"
|
|
4021
4123
|
@field-change="${this._handleFieldChange}"
|
|
4022
4124
|
@period-change="${this._handlePeriodChange}"
|
|
4023
4125
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
@@ -4040,7 +4142,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4040
4142
|
<button
|
|
4041
4143
|
class="side-panel-toggle-btn ${this._sidePanelCollapsed?"collapsed":""}"
|
|
4042
4144
|
@click="${this._toggleSidePanelCollapse}"
|
|
4043
|
-
title="${this._sidePanelCollapsed?
|
|
4145
|
+
title="${this._sidePanelCollapsed?F.t("form.expandPanel"):F.t("form.collapsePanel")}"
|
|
4044
4146
|
>
|
|
4045
4147
|
<svg viewBox="0 0 24 24">
|
|
4046
4148
|
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
|
@@ -4053,12 +4155,12 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4053
4155
|
<input
|
|
4054
4156
|
type="text"
|
|
4055
4157
|
class="side-panel-search-input"
|
|
4056
|
-
placeholder="${
|
|
4158
|
+
placeholder="${F.t("filter.searchPlaceholder")}"
|
|
4057
4159
|
.value="${this._sidePanelSearchQuery}"
|
|
4058
4160
|
@input="${this._handleSidePanelSearchInput}"
|
|
4059
4161
|
/>
|
|
4060
4162
|
${this._sidePanelSearchQuery?e.html`
|
|
4061
|
-
<button class="side-panel-clear-search" @click="${this._clearSidePanelSearch}" title="${
|
|
4163
|
+
<button class="side-panel-clear-search" @click="${this._clearSidePanelSearch}" title="${F.t("filter.clearSearch")}">
|
|
4062
4164
|
×
|
|
4063
4165
|
</button>
|
|
4064
4166
|
`:e.html`
|
|
@@ -4071,15 +4173,15 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4071
4173
|
<!-- Search Results Info -->
|
|
4072
4174
|
${this._sidePanelSearchQuery.trim()&&d.length!==l.length?e.html`
|
|
4073
4175
|
<div class="side-panel-search-results-info">
|
|
4074
|
-
${d.length} ${
|
|
4176
|
+
${d.length} ${F.t("filter.of")} ${l.length} ${F.t("filter.roles")}
|
|
4075
4177
|
</div>
|
|
4076
4178
|
`:""}
|
|
4077
4179
|
|
|
4078
4180
|
<!-- Roles List -->
|
|
4079
4181
|
${0===d.length?e.html`
|
|
4080
4182
|
<div class="side-panel-no-results">
|
|
4081
|
-
${
|
|
4082
|
-
${
|
|
4183
|
+
${F.t("filter.noRolesFound")} "${this._sidePanelSearchQuery}"<br>
|
|
4184
|
+
${F.t("filter.tryDifferentSearch")}
|
|
4083
4185
|
</div>
|
|
4084
4186
|
`:e.html`
|
|
4085
4187
|
${d.map(t=>{const i=this._roleHasErrors(t.id),o=this._roleBorderStatuses.get(t.id),r=!0===this._roleCompletedStates.get(t.id)?"has-complete-data":i?"has-errors":"untouched"===o?"has-no-data":"incomplete"===o?"has-empty-fields":"complete"===o?"has-complete-data":"";return e.html`
|
|
@@ -4104,7 +4206,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4104
4206
|
<!-- Validation Summary -->
|
|
4105
4207
|
${o?e.html`
|
|
4106
4208
|
<div class="validation-summary ${0===r?"warnings-only":""}">
|
|
4107
|
-
<h4 class="validation-summary-title">${r>0?
|
|
4209
|
+
<h4 class="validation-summary-title">${r>0?F.t("validation.summary"):F.t("calculationWarning.title")}</h4>
|
|
4108
4210
|
<ul class="validation-summary-list">
|
|
4109
4211
|
${this._errors.filter(e=>"error"===e.severity||"warning"===e.severity&&"readonly"!==this.mode).map(t=>e.html`
|
|
4110
4212
|
<li class="validation-summary-item ${t.severity}">${"warning"===t.severity?"⚠️ ":""}${t.message}</li>
|
|
@@ -4123,11 +4225,11 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4123
4225
|
class="side-panel-content-header"
|
|
4124
4226
|
role="button"
|
|
4125
4227
|
tabindex="0"
|
|
4126
|
-
title="${
|
|
4228
|
+
title="${F.t("section.locateInList")}"
|
|
4127
4229
|
@click="${()=>this._scrollActiveRoleIntoView()}"
|
|
4128
4230
|
@keydown="${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._scrollActiveRoleIntoView())}}"
|
|
4129
4231
|
>
|
|
4130
|
-
<div class="side-panel-content-position">${
|
|
4232
|
+
<div class="side-panel-content-position">${F.t("section.position",{current:p+1,total:d.length})}</div>
|
|
4131
4233
|
<h2 class="side-panel-content-title">${c.title}</h2>
|
|
4132
4234
|
${this._sectionHasMonetaryConcepts(c.concepts)?e.html`
|
|
4133
4235
|
<div class="side-panel-content-amount-scale">${this._amountScaleCaption()}</div>
|
|
@@ -4163,6 +4265,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4163
4265
|
.periodEndDate="${this.periodEndDate}"
|
|
4164
4266
|
.calculationEnabled="${this.calculationEnabled}"
|
|
4165
4267
|
.totalManuallyEditedData="${this._totalManuallyEditedData}"
|
|
4268
|
+
.duplicateFactWarnings="${this._duplicateFactWarnings}"
|
|
4166
4269
|
@field-change="${this._handleFieldChange}"
|
|
4167
4270
|
@typed-member-change="${this._handleTypedMemberChange}"
|
|
4168
4271
|
@add-concept-repeat="${this._handleAddConceptRepeat}"
|
|
@@ -4181,7 +4284,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4181
4284
|
.checked="${!0===this._roleCompletedStates.get(c.id)}"
|
|
4182
4285
|
@change="${e=>this._handleRoleCompletedChange(c.id,e.target.checked)}"
|
|
4183
4286
|
>
|
|
4184
|
-
<label for="role-complete-${c.id}">${
|
|
4287
|
+
<label for="role-complete-${c.id}">${F.t("form.markAsComplete")}</label>
|
|
4185
4288
|
</div>
|
|
4186
4289
|
<div class="side-panel-nav-row">
|
|
4187
4290
|
${p>0?e.html`
|
|
@@ -4189,26 +4292,26 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4189
4292
|
type="button"
|
|
4190
4293
|
class="side-panel-nav-btn side-panel-nav-prev"
|
|
4191
4294
|
@click="${()=>this._handleSidePanelPrevNext("prev")}"
|
|
4192
|
-
>${
|
|
4295
|
+
>${F.t("section.previous")}</button>
|
|
4193
4296
|
`:e.html`<span></span>`}
|
|
4194
4297
|
${u?e.html`
|
|
4195
4298
|
<button
|
|
4196
4299
|
type="button"
|
|
4197
4300
|
class="side-panel-nav-btn side-panel-nav-next"
|
|
4198
4301
|
@click="${()=>this._handleSidePanelPrevNext("next")}"
|
|
4199
|
-
>${
|
|
4302
|
+
>${F.t("section.next",{title:u.title})}</button>
|
|
4200
4303
|
`:""}
|
|
4201
4304
|
</div>
|
|
4202
4305
|
`:e.html`
|
|
4203
4306
|
<div class="no-roles-message">
|
|
4204
|
-
<h3>${
|
|
4205
|
-
<p>${
|
|
4307
|
+
<h3>${F.t("form.noRoleSelected")}</h3>
|
|
4308
|
+
<p>${F.t("form.pleaseSelectRole")}</p>
|
|
4206
4309
|
</div>
|
|
4207
4310
|
`}
|
|
4208
4311
|
</div>
|
|
4209
4312
|
</div>
|
|
4210
4313
|
</div>
|
|
4211
|
-
`}getData(){return{...this._formData}}setData(e){this._formData={...e},this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}setValidation(e){this._validationStatus="cancel"===e?"idle":e,this._syncValidationDotAnimation(),this.requestUpdate()}_syncValidationDotAnimation(){"inProgress"===this._validationStatus?null===this._validationDotIntervalId&&(this._validationDotCount=1,this._validationDotIntervalId=setInterval(()=>{this._validationDotCount=this._validationDotCount%3+1},500)):null!==this._validationDotIntervalId&&(clearInterval(this._validationDotIntervalId),this._validationDotIntervalId=null)}reset(){this._handleReset()}getState(){return this._getFormState()}_findConceptByName(e,t){var i;const o=t.includes(":")?t.split(":").pop():t;for(const r of e){if(r.name===t)return r;if((r.name.includes(":")?r.name.split(":").pop():r.name)===o)return r;if(null==(i=r.children)?void 0:i.length){const e=this._findConceptByName(r.children,t);if(e)return e}}return null}_findAllConceptsByName(e,t){var i;const o=t.includes(":")?t.split(":").pop():t,r=[];for(const n of e){const e=n.name.includes(":")?n.name.split(":").pop():n.name;n.name!==t&&e!==o||r.push(n),(null==(i=n.children)?void 0:i.length)&&r.push(...this._findAllConceptsByName(n.children,t))}return r}_findConceptById(e,t){var i;for(const o of e){if(o.id===t)return o;if(null==(i=o.children)?void 0:i.length){const e=this._findConceptById(o.children,t);if(e)return e}}return null}_valueLooselyMatches(e,t){const i=String(e??"");if(i===t)return!0;const o=Number(i),r=Number(t);if(isNaN(o)||isNaN(r))return!1;if(o===r)return!0;if(0!==o&&0!==r){const e=Math.abs(r/o),t=Math.log10(e);if(Math.abs(t-Math.round(t))<1e-4)return!0}return!1}_findColumnsByDimensions(e,t){return e.filter(e=>{if("dimension"!==e.type||!e.dimensionData)return!1;const i=e.dimensionData.combinations;return(null==i?void 0:i.length)?t.every(e=>i.some(t=>this._normalizeAxisId(t.axisId)===this._normalizeAxisId(e.axis)&&this._normalizeMemberId(t.memberId)===this._normalizeMemberId(e.member))):1===t.length&&this._normalizeAxisId(e.dimensionData.axisId??"")===this._normalizeAxisId(t[0].axis)&&this._normalizeMemberId(e.dimensionData.memberId??"")===this._normalizeMemberId(t[0].member)})}_pickColumn(e,t,i,o,r,n){var a;let s=i;if(r&&s.length>1){const i=s.filter(i=>this._periodMatches(this._cellPeriod(e,t,i.id),r));i.length&&(s=i)}const l=this._formData[t.id];if(s.length>1&&null!==o&&l){const e=s.filter(e=>void 0!==l[e.id]&&null!==l[e.id]&&""!==l[e.id]),t=e.filter(e=>String(l[e.id])===o||Number(l[e.id])===Number(o)),i=t.length?t:e.filter(e=>this._valueLooselyMatches(l[e.id],o)),r=i.find(e=>!(null==n?void 0:n.has(e.id)))??i[0];if(r)return r.id}return null==(a=s[0])?void 0:a.id}_cellPeriod(e,t,i){var o,r;const n=this._findColumnByIdInSection(i,e),a=(null==(o=t.fields)?void 0:o.find(e=>e.columnId===i))??{columnId:i},s=null==(r=this._periodData[t.id])?void 0:r[i];return"instant"===t.periodType?{instant:this._resolveSubmissionInstantDate(t,a,s,n)}:{startDate:(null==s?void 0:s.startDate)||(null==n?void 0:n.periodStartDate)||a.periodStartDate||this.periodStartDate,endDate:(null==s?void 0:s.endDate)||(null==n?void 0:n.periodEndDate)||a.periodEndDate||this.periodEndDate}}_periodMatches(e,t){const i=e=>null==e?void 0:e.slice(0,10),o=t.instant??t.date;return o?i(e.instant)===i(o):!(e.instant||t.startDate&&i(e.startDate)!==i(t.startDate)||t.endDate&&i(e.endDate)!==i(t.endDate))}_resolveScrollTarget(e,t,i,o,r,n,a){var s;const l=[...(null==(s=this._currentSchema)?void 0:s.sections)??[],...this._allSections.filter(e=>{var t;return!(null==(t=this._currentSchema)?void 0:t.sections.find(t=>t.id===e.id))})];if(o)for(const u of l){const e=this._findConceptById(u.concepts,o);if(e)return u.id,{section:u,concept:e,viaRole:!1}}if(r){const o=function(e,t){const i=ke(e);return i?t.map((e,t)=>({section:e,index:t,score:Fe(i,e)})).filter(e=>null!==e.score).sort((e,t)=>e.score.tier-t.score.tier||e.score.looseness-t.score.looseness||e.index-t.index).map(({section:e,score:t})=>({section:e,tier:t.tier})):[]}(r,l);o.length,o.slice(0,5).map(e=>`${e.section.id} (tier ${e.tier})`).join(", ");for(const{section:s,tier:l}of o){const o=this._resolveConceptInSection(s,e,t,i,n,a);if(o)return l>=Ce&&console.warn(`[scrollToConcept] role="${r}" only fuzzily matched "${s.id}" (tier ${l}) — pass the role's id or local name for an exact match`),{section:s,concept:o.concept,viaRole:!0}}console.warn(`[scrollToConcept] "${e}" not found in any section matching role="${r}" — falling back to whole-form search`)}let d=null,c=null;for(const u of l){const o=this._resolveConceptInSection(u,e,t,i,n,a);if(o){if(o.strong&&o.inPeriod)return{section:u,concept:o.concept,viaRole:!1};o.strong?d??(d={section:u,concept:o.concept}):c??(c={section:u,concept:o.concept})}}const p=d??c;return p?{...p,viaRole:!1}:null}_resolveConceptInSection(e,t,i,o,r,n){const a=this._findAllConceptsByName(e.concepts,t);if(!a.length)return null;const s=null!==r,l=e.columns??this._columns,d=o?[o]:(null==i?void 0:i.length)?this._findColumnsByDimensions(l,i).map(e=>e.id):[],c=(t,i,o)=>{var a;const l=null==(a=this._formData[t.id])?void 0:a[i];return null!=l&&""!==l&&(!(s&&!this._valueLooselyMatches(l,r))&&(!o||this._periodMatches(this._cellPeriod(e,t,i),n)))},p=(e,t)=>d.length?d.some(i=>c(e,i,t)):!(!s&&!t)&&Object.keys(this._formData[e.id]??{}).some(i=>c(e,i,t));let u;a.length>1&&(u=(n?a.find(e=>p(e,!0)):void 0)??a.find(e=>p(e,!1)),e.id,a.length,null==u||u.id);const h=u??a[0],m=t=>!n||t.some(t=>this._periodMatches(this._cellPeriod(e,h,t),n));if(o){const t=l.some(e=>e.id===o);return e.id,h.id,{concept:h,strong:t,inPeriod:m(t?[o]:[])}}return(null==i?void 0:i.length)?(e.id,h.id,d.join(","),l.map(e=>e.id).join(","),{concept:h,strong:d.length>0,inPeriod:m(d)}):(e.id,h.id,{concept:h,strong:!0,inPeriod:m(l.map(e=>e.id))})}async scrollToConcept(e,t,i,o,r,n,a){var s,l,d,c,p,u,h,m,f,b,g,v,y,x,_;null==i||i.value,JSON.stringify(null==i?void 0:i.period),JSON.stringify(t);const D=void 0!==(null==i?void 0:i.value)&&null!==(null==i?void 0:i.value),I=D?String(i.value):null,w=(null==i?void 0:i.period)&&(i.period.instant||i.period.date||i.period.startDate||i.period.endDate)?i.period:void 0,S=this._resolveScrollTarget(e,t,o,r,n,I,w);if(!S)return void console.warn(`[scrollToConcept] Concept not found: ${e}`);let{section:C,concept:$}=S;const{viaRole:k}=S;if(C.id,$.id,!(null==(s=this._currentSchema)?void 0:s.sections.some(e=>e.id===C.id))){if(C.id,!(await this._confirmRevealHiddenRole(C)))return;await this._revealRole(C);const e=null==(l=this._currentSchema)?void 0:l.sections.find(e=>e.id===C.id),t=e&&this._findConceptById(e.concepts,$.id);if(!e||!t)return void console.warn(`[scrollToConcept] Revealed role "${C.id}" but could not find row "${$.id}" in it`);C=e,$=t}C.expanded=!0,"sidePanel"===this.display&&this._activeSidePanelRoleId!==C.id&&(this._activeSidePanelRoleId=C.id);const T=C.columns??this._columns,E=this._hiddenColumnIds.get(C.id);let F=null;if(o?F=o:(null==t?void 0:t.length)?F=this._pickColumn(C,$,this._findColumnsByDimensions(T,t),I,w,E)??null:w&&T.some(e=>this._periodMatches(this._cellPeriod(C,$,e.id),w))?F=this._pickColumn(C,$,T,I,w,E)??null:D||(F=(null==(d=T.find(e=>!(null==E?void 0:E.has(e.id)))??T[0])?void 0:d.id)??null),null==E?void 0:E.size){let e;if(F)E.has(F)&&(e=F);else if(D){const t=this._formData[$.id]??{},i=T.filter(e=>{const i=t[e.id];return null!=i&&""!==i&&this._valueLooselyMatches(i,I)});i.length&&i.every(e=>E.has(e.id))&&(e=i[0].id,F=e)}e&&(C.id,this._showColumn(C.id,e))}const R=!!w&&!!F&&this._periodMatches(this._cellPeriod(C,$,F),w);!1!==(null==a?void 0:a.filterToConcept)&&(this._conceptSearchText=e.includes(":")?e.split(":").pop():e),this.requestUpdate(),await this.updateComplete,"sidePanel"===this.display&&this._scrollActiveRoleIntoView(),await new Promise(e=>setTimeout(e,300));const M=null==(c=this.shadowRoot)?void 0:c.querySelectorAll("jupiter-form-section");null==M||M.length;let j=null;if(null==M||M.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===C.id&&(j=e)}),!j)return void console.warn(`[scrollToConcept] Section element not found: ${C.id}`);await j.updateComplete,await(null==(p=j.revealConcept)?void 0:p.call(j,$.id))&&await Promise.all(Array.from((null==(u=j.shadowRoot)?void 0:u.querySelectorAll("jupiter-concept-tree"))??[]).map(e=>e.updateComplete));const A=null==(h=j.shadowRoot)?void 0:h.querySelectorAll("jupiter-concept-tree");null==A||A.length;let P=null;const L=$.id,N=L.includes("__")?L.split("__")[0]:L,V=e=>e===L||e.includes("__")&&e.split("__")[0]===N,O=e=>{const t=e.decimals||(void 0!==e.globalDecimals&&"INF"!==e.globalDecimals?e.globalDecimals:null);if(!t)return 1;const i=parseFloat(String(t));return isNaN(i)||i<=0?1:Math.pow(10,i)},z=(e,t)=>{if(String(e.value??"")===t)return!0;const i=Number(t),o=Number(e.value);if(!isNaN(i)&&!isNaN(o)&&0!==o){const t=O(e);if(1!==t&&Math.abs(o*t-i)<1e-4)return!0}return!1};if(null==A||A.forEach(e=>{var t;if(P)return;const i=null==(t=e.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-field");null==i||i.forEach(e=>{if(P)return;const t=F?e.conceptId===L&&e.columnId===F:e.conceptId===L,i=!D||R||z(e,I);t&&(e.conceptId,e.columnId,e.value,O(e)),t&&i&&(P=e)})}),!P&&k){const e=[];null==A||A.forEach(t=>{var i;null==(i=t.shadowRoot)||i.querySelectorAll("jupiter-form-field").forEach(t=>{t.conceptId===L&&e.push(t)})}),P=F&&e.find(e=>e.columnId===F)||e[0]||null,P&&F&&P.columnId!==F&&console.warn(`[scrollToConcept] Phase1b: column "${F}" not rendered in row "${L}" — using column "${P.columnId}"`),e.length}if(!P&&D){const e=(null==(m=this.shadowRoot)?void 0:m.querySelectorAll("jupiter-form-section"))??[];for(const t of Array.from(e)){if(P)break;const e=(null==(f=t.shadowRoot)?void 0:f.querySelectorAll("jupiter-concept-tree"))??[];for(const t of Array.from(e)){if(P)break;((null==(b=t.shadowRoot)?void 0:b.querySelectorAll("jupiter-form-field"))??[]).forEach(e=>{if(P)return;const t=V(e.conceptId),i=z(e,I);t&&(e.conceptId,e.value,O(e)),t&&i&&(e.conceptId,e.columnId,e.value,P=e)})}}}if(!P){const e=(null==(g=this.shadowRoot)?void 0:g.querySelectorAll("jupiter-form-section"))??[];for(const t of Array.from(e)){if(P)break;const e=(null==(v=t.shadowRoot)?void 0:v.querySelectorAll("jupiter-concept-tree"))??[];for(const t of Array.from(e)){if(P)break;((null==(y=t.shadowRoot)?void 0:y.querySelectorAll("jupiter-form-field"))??[]).forEach(e=>{if(P)return;(F?V(e.conceptId)&&e.columnId===F:V(e.conceptId))&&(e.conceptId,e.columnId,e.value,P=e)})}}}if(!P)return void console.warn(`[scrollToConcept] Field element not found for concept: ${e}`);P.conceptId,P.columnId,P.value;const J=P.getBoundingClientRect(),B=this.shadowRoot,U=B?B.querySelector(".side-panel-content")??B.querySelector(".form-container"):null,q=U&&U.scrollHeight>U.clientHeight?U:null;if(q){const e=q.getBoundingClientRect(),t=Math.max(0,J.top-e.top+q.scrollTop-q.clientHeight/2+J.height/2);q.scrollTo({top:t,behavior:"smooth"})}else P.scrollIntoView({behavior:"smooth",block:"center"});const H=null==(x=null==j?void 0:j.shadowRoot)?void 0:x.querySelector(".table-container");if(H&&H.scrollWidth>H.clientWidth){const e=H.getBoundingClientRect(),t=Math.max(0,J.left-e.left+H.scrollLeft-H.clientWidth/2+J.width/2);H.scrollTo({left:t,behavior:"smooth"})}const W=P.getRootNode(),K=(W instanceof ShadowRoot?W.host:null)??P;K.classList.add("concept-highlight");const Y=null==(_=P.shadowRoot)?void 0:_.querySelector('input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])');Y&&setTimeout(()=>Y.focus({preventScroll:!0}),450),setTimeout(()=>K.classList.remove("concept-highlight"),1e4)}render(){var t;const i=this._errors.filter(e=>"error"===e.severity).length,o="readonly"===this.mode?0:this._errors.filter(e=>"warning"===e.severity).length,r=this.config||{},n=!1!==r.showValidationSummary&&(i>0&&this._submitted||o>0),a=this._currentSchema;return a?e.html`
|
|
4314
|
+
`}getData(){return{...this._formData}}setData(e){this._formData=this._stripPriorYearExcludedFacts(e),this._dirty=!0,this.hasUnsavedChanges=!0,this._validateForm(),this.requestUpdate()}validate(){return this._validateForm(),this._valid}setValidation(e){this._validationStatus="cancel"===e?"idle":e,this._syncValidationDotAnimation(),this.requestUpdate()}_syncValidationDotAnimation(){"inProgress"===this._validationStatus?null===this._validationDotIntervalId&&(this._validationDotCount=1,this._validationDotIntervalId=setInterval(()=>{this._validationDotCount=this._validationDotCount%3+1},500)):null!==this._validationDotIntervalId&&(clearInterval(this._validationDotIntervalId),this._validationDotIntervalId=null)}reset(){this._handleReset()}getState(){return this._getFormState()}_findConceptByName(e,t){var i;const o=t.includes(":")?t.split(":").pop():t;for(const r of e){if(r.name===t)return r;if((r.name.includes(":")?r.name.split(":").pop():r.name)===o)return r;if(null==(i=r.children)?void 0:i.length){const e=this._findConceptByName(r.children,t);if(e)return e}}return null}_findAllConceptsByName(e,t){var i;const o=t.includes(":")?t.split(":").pop():t,r=[];for(const n of e){const e=n.name.includes(":")?n.name.split(":").pop():n.name;n.name!==t&&e!==o||r.push(n),(null==(i=n.children)?void 0:i.length)&&r.push(...this._findAllConceptsByName(n.children,t))}return r}_findConceptById(e,t){var i;for(const o of e){if(o.id===t)return o;if(null==(i=o.children)?void 0:i.length){const e=this._findConceptById(o.children,t);if(e)return e}}return null}_valueLooselyMatches(e,t){const i=String(e??"");if(i===t)return!0;const o=Number(i),r=Number(t);if(isNaN(o)||isNaN(r))return!1;if(o===r)return!0;if(0!==o&&0!==r){const e=Math.abs(r/o),t=Math.log10(e);if(Math.abs(t-Math.round(t))<1e-4)return!0}return!1}_findColumnsByDimensions(e,t){return e.filter(e=>{if("dimension"!==e.type||!e.dimensionData)return!1;const i=e.dimensionData.combinations;return(null==i?void 0:i.length)?t.every(e=>i.some(t=>this._normalizeAxisId(t.axisId)===this._normalizeAxisId(e.axis)&&this._normalizeMemberId(t.memberId)===this._normalizeMemberId(e.member))):1===t.length&&this._normalizeAxisId(e.dimensionData.axisId??"")===this._normalizeAxisId(t[0].axis)&&this._normalizeMemberId(e.dimensionData.memberId??"")===this._normalizeMemberId(t[0].member)})}_pickColumn(e,t,i,o,r,n){var a;let s=i;if(r&&s.length>1){const i=s.filter(i=>this._periodMatches(this._cellPeriod(e,t,i.id),r));i.length&&(s=i)}const l=this._formData[t.id];if(s.length>1&&null!==o&&l){const e=s.filter(e=>void 0!==l[e.id]&&null!==l[e.id]&&""!==l[e.id]),t=e.filter(e=>String(l[e.id])===o||Number(l[e.id])===Number(o)),i=t.length?t:e.filter(e=>this._valueLooselyMatches(l[e.id],o)),r=i.find(e=>!(null==n?void 0:n.has(e.id)))??i[0];if(r)return r.id}return null==(a=s[0])?void 0:a.id}_cellPeriod(e,t,i){var o,r;const n=this._findColumnByIdInSection(i,e),a=(null==(o=t.fields)?void 0:o.find(e=>e.columnId===i))??{columnId:i},s=null==(r=this._periodData[t.id])?void 0:r[i];return"instant"===t.periodType?{instant:this._resolveSubmissionInstantDate(t,a,s,n)}:{startDate:(null==s?void 0:s.startDate)||(null==n?void 0:n.periodStartDate)||a.periodStartDate||this.periodStartDate,endDate:(null==s?void 0:s.endDate)||(null==n?void 0:n.periodEndDate)||a.periodEndDate||this.periodEndDate}}_periodMatches(e,t){const i=e=>null==e?void 0:e.slice(0,10),o=t.instant??t.date;return o?i(e.instant)===i(o):!(e.instant||t.startDate&&i(e.startDate)!==i(t.startDate)||t.endDate&&i(e.endDate)!==i(t.endDate))}_resolveScrollTarget(e,t,i,o,r,n,a){var s;const l=[...(null==(s=this._currentSchema)?void 0:s.sections)??[],...this._allSections.filter(e=>{var t;return!(null==(t=this._currentSchema)?void 0:t.sections.find(t=>t.id===e.id))})];if(o)for(const u of l){const e=this._findConceptById(u.concepts,o);if(e)return u.id,{section:u,concept:e,viaRole:!1}}if(r){const o=function(e,t){const i=Te(e);return i?t.map((e,t)=>({section:e,index:t,score:Re(i,e)})).filter(e=>null!==e.score).sort((e,t)=>e.score.tier-t.score.tier||e.score.looseness-t.score.looseness||e.index-t.index).map(({section:e,score:t})=>({section:e,tier:t.tier})):[]}(r,l);o.length,o.slice(0,5).map(e=>`${e.section.id} (tier ${e.tier})`).join(", ");for(const{section:s,tier:l}of o){const o=this._resolveConceptInSection(s,e,t,i,n,a);if(o)return l>=$e&&console.warn(`[scrollToConcept] role="${r}" only fuzzily matched "${s.id}" (tier ${l}) — pass the role's id or local name for an exact match`),{section:s,concept:o.concept,viaRole:!0}}console.warn(`[scrollToConcept] "${e}" not found in any section matching role="${r}" — falling back to whole-form search`)}let d=null,c=null;for(const u of l){const o=this._resolveConceptInSection(u,e,t,i,n,a);if(o){if(o.strong&&o.inPeriod)return{section:u,concept:o.concept,viaRole:!1};o.strong?d??(d={section:u,concept:o.concept}):c??(c={section:u,concept:o.concept})}}const p=d??c;return p?{...p,viaRole:!1}:null}_resolveConceptInSection(e,t,i,o,r,n){const a=this._findAllConceptsByName(e.concepts,t);if(!a.length)return null;const s=null!==r,l=e.columns??this._columns,d=o?[o]:(null==i?void 0:i.length)?this._findColumnsByDimensions(l,i).map(e=>e.id):[],c=(t,i,o)=>{var a;const l=null==(a=this._formData[t.id])?void 0:a[i];return null!=l&&""!==l&&(!(s&&!this._valueLooselyMatches(l,r))&&(!o||this._periodMatches(this._cellPeriod(e,t,i),n)))},p=(e,t)=>d.length?d.some(i=>c(e,i,t)):!(!s&&!t)&&Object.keys(this._formData[e.id]??{}).some(i=>c(e,i,t));let u;a.length>1&&(u=(n?a.find(e=>p(e,!0)):void 0)??a.find(e=>p(e,!1)),e.id,a.length,null==u||u.id);const h=u??a[0],m=t=>!n||t.some(t=>this._periodMatches(this._cellPeriod(e,h,t),n));if(o){const t=l.some(e=>e.id===o);return e.id,h.id,{concept:h,strong:t,inPeriod:m(t?[o]:[])}}return(null==i?void 0:i.length)?(e.id,h.id,d.join(","),l.map(e=>e.id).join(","),{concept:h,strong:d.length>0,inPeriod:m(d)}):(e.id,h.id,{concept:h,strong:!0,inPeriod:m(l.map(e=>e.id))})}async scrollToConcept(e,t,i,o,r,n,a){var s,l,d,c,p,u,h,m,f,b,g,v,y,x,_;null==i||i.value,JSON.stringify(null==i?void 0:i.period),JSON.stringify(t);const D=void 0!==(null==i?void 0:i.value)&&null!==(null==i?void 0:i.value),w=D?String(i.value):null,I=(null==i?void 0:i.period)&&(i.period.instant||i.period.date||i.period.startDate||i.period.endDate)?i.period:void 0,S=this._resolveScrollTarget(e,t,o,r,n,w,I);if(!S)return void console.warn(`[scrollToConcept] Concept not found: ${e}`);let{section:C,concept:$}=S;const{viaRole:k}=S;if(C.id,$.id,!(null==(s=this._currentSchema)?void 0:s.sections.some(e=>e.id===C.id))){if(C.id,!(await this._confirmRevealHiddenRole(C)))return;await this._revealRole(C);const e=null==(l=this._currentSchema)?void 0:l.sections.find(e=>e.id===C.id),t=e&&this._findConceptById(e.concepts,$.id);if(!e||!t)return void console.warn(`[scrollToConcept] Revealed role "${C.id}" but could not find row "${$.id}" in it`);C=e,$=t}C.expanded=!0,"sidePanel"===this.display&&this._activeSidePanelRoleId!==C.id&&(this._activeSidePanelRoleId=C.id);const T=C.columns??this._columns,F=this._hiddenColumnIds.get(C.id);let E=null;if(o?E=o:(null==t?void 0:t.length)?E=this._pickColumn(C,$,this._findColumnsByDimensions(T,t),w,I,F)??null:I&&T.some(e=>this._periodMatches(this._cellPeriod(C,$,e.id),I))?E=this._pickColumn(C,$,T,w,I,F)??null:D||(E=(null==(d=T.find(e=>!(null==F?void 0:F.has(e.id)))??T[0])?void 0:d.id)??null),null==F?void 0:F.size){let e;if(E)F.has(E)&&(e=E);else if(D){const t=this._formData[$.id]??{},i=T.filter(e=>{const i=t[e.id];return null!=i&&""!==i&&this._valueLooselyMatches(i,w)});i.length&&i.every(e=>F.has(e.id))&&(e=i[0].id,E=e)}e&&(C.id,this._showColumn(C.id,e))}const R=!!I&&!!E&&this._periodMatches(this._cellPeriod(C,$,E),I);!1!==(null==a?void 0:a.filterToConcept)&&(this._conceptSearchText=e.includes(":")?e.split(":").pop():e),this.requestUpdate(),await this.updateComplete,"sidePanel"===this.display&&this._scrollActiveRoleIntoView(),await new Promise(e=>setTimeout(e,300));const M=null==(c=this.shadowRoot)?void 0:c.querySelectorAll("jupiter-form-section");null==M||M.length;let j=null;if(null==M||M.forEach(e=>{var t;(null==(t=e.section)?void 0:t.id)===C.id&&(j=e)}),!j)return void console.warn(`[scrollToConcept] Section element not found: ${C.id}`);await j.updateComplete,await(null==(p=j.revealConcept)?void 0:p.call(j,$.id))&&await Promise.all(Array.from((null==(u=j.shadowRoot)?void 0:u.querySelectorAll("jupiter-concept-tree"))??[]).map(e=>e.updateComplete));const P=null==(h=j.shadowRoot)?void 0:h.querySelectorAll("jupiter-concept-tree");null==P||P.length;let A=null;const L=$.id,N=L.includes("__")?L.split("__")[0]:L,V=e=>e===L||e.includes("__")&&e.split("__")[0]===N,O=e=>{const t=e.decimals||(void 0!==e.globalDecimals&&"INF"!==e.globalDecimals?e.globalDecimals:null);if(!t)return 1;const i=parseFloat(String(t));return isNaN(i)||i<=0?1:Math.pow(10,i)},z=(e,t)=>{if(String(e.value??"")===t)return!0;const i=Number(t),o=Number(e.value);if(!isNaN(i)&&!isNaN(o)&&0!==o){const t=O(e);if(1!==t&&Math.abs(o*t-i)<1e-4)return!0}return!1};if(null==P||P.forEach(e=>{var t;if(A)return;const i=null==(t=e.shadowRoot)?void 0:t.querySelectorAll("jupiter-form-field");null==i||i.forEach(e=>{if(A)return;const t=E?e.conceptId===L&&e.columnId===E:e.conceptId===L,i=!D||R||z(e,w);t&&(e.conceptId,e.columnId,e.value,O(e)),t&&i&&(A=e)})}),!A&&k){const e=[];null==P||P.forEach(t=>{var i;null==(i=t.shadowRoot)||i.querySelectorAll("jupiter-form-field").forEach(t=>{t.conceptId===L&&e.push(t)})}),A=E&&e.find(e=>e.columnId===E)||e[0]||null,A&&E&&A.columnId!==E&&console.warn(`[scrollToConcept] Phase1b: column "${E}" not rendered in row "${L}" — using column "${A.columnId}"`),e.length}if(!A&&D){const e=(null==(m=this.shadowRoot)?void 0:m.querySelectorAll("jupiter-form-section"))??[];for(const t of Array.from(e)){if(A)break;const e=(null==(f=t.shadowRoot)?void 0:f.querySelectorAll("jupiter-concept-tree"))??[];for(const t of Array.from(e)){if(A)break;((null==(b=t.shadowRoot)?void 0:b.querySelectorAll("jupiter-form-field"))??[]).forEach(e=>{if(A)return;const t=V(e.conceptId),i=z(e,w);t&&(e.conceptId,e.value,O(e)),t&&i&&(e.conceptId,e.columnId,e.value,A=e)})}}}if(!A){const e=(null==(g=this.shadowRoot)?void 0:g.querySelectorAll("jupiter-form-section"))??[];for(const t of Array.from(e)){if(A)break;const e=(null==(v=t.shadowRoot)?void 0:v.querySelectorAll("jupiter-concept-tree"))??[];for(const t of Array.from(e)){if(A)break;((null==(y=t.shadowRoot)?void 0:y.querySelectorAll("jupiter-form-field"))??[]).forEach(e=>{if(A)return;(E?V(e.conceptId)&&e.columnId===E:V(e.conceptId))&&(e.conceptId,e.columnId,e.value,A=e)})}}}if(!A)return void console.warn(`[scrollToConcept] Field element not found for concept: ${e}`);A.conceptId,A.columnId,A.value;const J=A.getBoundingClientRect(),B=this.shadowRoot,U=B?B.querySelector(".side-panel-content")??B.querySelector(".form-container"):null,q=U&&U.scrollHeight>U.clientHeight?U:null;if(q){const e=q.getBoundingClientRect(),t=Math.max(0,J.top-e.top+q.scrollTop-q.clientHeight/2+J.height/2);q.scrollTo({top:t,behavior:"smooth"})}else A.scrollIntoView({behavior:"smooth",block:"center"});const H=null==(x=null==j?void 0:j.shadowRoot)?void 0:x.querySelector(".table-container");if(H&&H.scrollWidth>H.clientWidth){const e=H.getBoundingClientRect(),t=Math.max(0,J.left-e.left+H.scrollLeft-H.clientWidth/2+J.width/2);H.scrollTo({left:t,behavior:"smooth"})}const W=A.getRootNode(),K=(W instanceof ShadowRoot?W.host:null)??A;K.classList.add("concept-highlight");const Y=null==(_=A.shadowRoot)?void 0:_.querySelector('input:not([type="hidden"]), select, textarea, button, [tabindex]:not([tabindex="-1"])');Y&&setTimeout(()=>Y.focus({preventScroll:!0}),450),setTimeout(()=>K.classList.remove("concept-highlight"),1e4)}render(){var t;const i=this._errors.filter(e=>"error"===e.severity).length,o="readonly"===this.mode?0:this._errors.filter(e=>"warning"===e.severity).length,r=this.config||{},n=!1!==r.showValidationSummary&&(i>0&&this._submitted||o>0),a=this._currentSchema;return a?e.html`
|
|
4212
4315
|
<div class="form-container">
|
|
4213
4316
|
<!-- Form Header - Hidden in side panel mode -->
|
|
4214
4317
|
${"sidePanel"!==this.display?e.html`
|
|
@@ -4236,7 +4339,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4236
4339
|
<svg class="filter-icon" viewBox="0 0 24 24">
|
|
4237
4340
|
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
|
4238
4341
|
</svg>
|
|
4239
|
-
${0===this._selectedRoleIds.length?
|
|
4342
|
+
${0===this._selectedRoleIds.length?F.t("filter.selectRoles"):F.t("filter.filterRoles")}
|
|
4240
4343
|
<span class="roles-count">
|
|
4241
4344
|
${this._hasActiveAdvancedFilters?e.html`
|
|
4242
4345
|
<svg class="roles-count-filter-icon" viewBox="0 0 24 24">
|
|
@@ -4252,7 +4355,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4252
4355
|
@click="${this._handleClearAdvancedFilters}"
|
|
4253
4356
|
?disabled="${this.disabled||this.readonly}"
|
|
4254
4357
|
>
|
|
4255
|
-
× ${
|
|
4358
|
+
× ${F.t("filter.clearFilters")}
|
|
4256
4359
|
</button>
|
|
4257
4360
|
`:""}
|
|
4258
4361
|
`:""}
|
|
@@ -4263,7 +4366,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4263
4366
|
@click="${this._handleSaveDraft}"
|
|
4264
4367
|
?disabled="${this.disabled||this.readonly||this.isDraftSaving||!this.hasUnsavedChanges}"
|
|
4265
4368
|
>
|
|
4266
|
-
${this.isDraftSaving?
|
|
4369
|
+
${this.isDraftSaving?F.t("form.savingDraft"):F.t("form.saveDraft")}
|
|
4267
4370
|
</button>
|
|
4268
4371
|
`:""}
|
|
4269
4372
|
|
|
@@ -4275,7 +4378,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4275
4378
|
@click="${()=>this.dispatchEvent(new CustomEvent("show-validation-results",{bubbles:!0,composed:!0}))}"
|
|
4276
4379
|
?disabled="${this.disabled||this.readonly}"
|
|
4277
4380
|
>
|
|
4278
|
-
${
|
|
4381
|
+
${F.t("form.lastValidationResults")}
|
|
4279
4382
|
</button>
|
|
4280
4383
|
`:""}
|
|
4281
4384
|
|
|
@@ -4285,7 +4388,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4285
4388
|
@click="${this._handleQuickValidate}"
|
|
4286
4389
|
?disabled="${this.disabled||this.readonly||"inProgress"===this._validationStatus}"
|
|
4287
4390
|
>
|
|
4288
|
-
${
|
|
4391
|
+
${F.t("form.quickValidate")}
|
|
4289
4392
|
</button>
|
|
4290
4393
|
`:""}
|
|
4291
4394
|
|
|
@@ -4294,11 +4397,11 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4294
4397
|
@click="${"inProgress"===this._validationStatus?()=>this.dispatchEvent(new CustomEvent("resume-validation-progress",{bubbles:!0,composed:!0})):this._handleSubmit}"
|
|
4295
4398
|
?disabled="${this.disabled||this.readonly||this._submitDisabled}"
|
|
4296
4399
|
>
|
|
4297
|
-
${"inProgress"===this._validationStatus?e.html`${
|
|
4400
|
+
${"inProgress"===this._validationStatus?e.html`${F.t("form.validationInProgress")}<span class="validation-dots"
|
|
4298
4401
|
><span style="visibility:${this._validationDotCount>=1?"visible":"hidden"}">.</span
|
|
4299
4402
|
><span style="visibility:${this._validationDotCount>=2?"visible":"hidden"}">.</span
|
|
4300
4403
|
><span style="visibility:${this._validationDotCount>=3?"visible":"hidden"}">.</span
|
|
4301
|
-
></span>`:this.submitButtonLabel||("admin"===this.mode?
|
|
4404
|
+
></span>`:this.submitButtonLabel||("admin"===this.mode?F.t("form.save"):F.t("form.submit"))}
|
|
4302
4405
|
</button>
|
|
4303
4406
|
|
|
4304
4407
|
</div>
|
|
@@ -4338,10 +4441,10 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4338
4441
|
${this._revealRolePrompt?e.html`
|
|
4339
4442
|
<jupiter-confirm-dialog
|
|
4340
4443
|
open
|
|
4341
|
-
.heading="${
|
|
4342
|
-
.message="${
|
|
4343
|
-
.confirmLabel="${
|
|
4344
|
-
.cancelLabel="${
|
|
4444
|
+
.heading="${F.t("scrollToConcept.revealRole.title")}"
|
|
4445
|
+
.message="${F.t("scrollToConcept.revealRole.message",{role:this._revealRolePrompt.section.title})}"
|
|
4446
|
+
.confirmLabel="${F.t("scrollToConcept.revealRole.confirm")}"
|
|
4447
|
+
.cancelLabel="${F.t("scrollToConcept.revealRole.cancel")}"
|
|
4345
4448
|
@dialog-confirm="${()=>this._settleRevealRolePrompt(!0)}"
|
|
4346
4449
|
@dialog-cancel="${()=>this._settleRevealRolePrompt(!1)}"
|
|
4347
4450
|
@click="${()=>this._settleRevealRolePrompt(!1)}"
|
|
@@ -4353,25 +4456,25 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4353
4456
|
<div class="error-popup-overlay" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">
|
|
4354
4457
|
<div class="error-popup" @click="${e=>e.stopPropagation()}">
|
|
4355
4458
|
<div class="error-popup-header">
|
|
4356
|
-
<h3>⚠️ ${
|
|
4459
|
+
<h3>⚠️ ${F.t("error.popup.title")}</h3>
|
|
4357
4460
|
<button class="error-popup-close" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">×</button>
|
|
4358
4461
|
</div>
|
|
4359
4462
|
<div class="error-popup-content">
|
|
4360
|
-
<p>${
|
|
4463
|
+
<p>${F.t("error.popup.message")}</p>
|
|
4361
4464
|
<ul class="error-list">
|
|
4362
4465
|
${this._xbrlFormErrors.map(t=>{const i=this._findConceptInAllSections(t.conceptId),o=this._findColumnById(t.columnId),r=(null==i?void 0:i.label)||t.conceptId,n=(null==o?void 0:o.title)||t.columnId;return e.html`
|
|
4363
4466
|
<li>
|
|
4364
|
-
<strong>${
|
|
4467
|
+
<strong>${F.t("error.popup.field")}</strong>
|
|
4365
4468
|
<a
|
|
4366
4469
|
href="javascript:void(0)"
|
|
4367
4470
|
class="error-field-link"
|
|
4368
4471
|
@click="${()=>this._handleErrorFieldClick(t.conceptId,t.columnId,t.sectionId)}"
|
|
4369
|
-
title="${
|
|
4472
|
+
title="${F.t("error.popup.clickToFocus")}"
|
|
4370
4473
|
>
|
|
4371
4474
|
${r} (${n})
|
|
4372
4475
|
</a><br>
|
|
4373
|
-
<strong>${
|
|
4374
|
-
<strong>${
|
|
4476
|
+
<strong>${F.t("error.popup.value")}</strong> ${t.value}<br>
|
|
4477
|
+
<strong>${F.t("error.popup.errors")}</strong>
|
|
4375
4478
|
<ul>
|
|
4376
4479
|
${t.errors.map(t=>e.html`<li>${t.message}</li>`)}
|
|
4377
4480
|
</ul>
|
|
@@ -4380,49 +4483,87 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4380
4483
|
</ul>
|
|
4381
4484
|
</div>
|
|
4382
4485
|
<div class="error-popup-footer">
|
|
4383
|
-
<button class="btn-primary" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">${
|
|
4486
|
+
<button class="btn-primary" @click="${()=>{this._showErrorPopup=!1,this.requestUpdate()}}">${F.t("error.popup.ok")}</button>
|
|
4384
4487
|
</div>
|
|
4385
4488
|
</div>
|
|
4386
4489
|
</div>
|
|
4387
4490
|
`:""}
|
|
4388
4491
|
|
|
4389
|
-
<!--
|
|
4390
|
-
${this.
|
|
4391
|
-
<div class="error-popup-overlay" @click="${()=>{this.
|
|
4492
|
+
<!-- Validate Pre-flight Warning Popup: typed-dimension-missing facts and/or duplicate-fact value mismatches -->
|
|
4493
|
+
${this._showValidateWarningPopup?e.html`
|
|
4494
|
+
<div class="error-popup-overlay" @click="${()=>{this._showValidateWarningPopup=!1,this.requestUpdate()}}">
|
|
4392
4495
|
<div class="error-popup" @click="${e=>e.stopPropagation()}">
|
|
4393
4496
|
<div class="error-popup-header">
|
|
4394
|
-
<h3>⚠️ ${
|
|
4395
|
-
<button class="error-popup-close" @click="${()=>{this.
|
|
4497
|
+
<h3>⚠️ ${this._validateWarningPopupTitle()}</h3>
|
|
4498
|
+
<button class="error-popup-close" @click="${()=>{this._showValidateWarningPopup=!1,this.requestUpdate()}}">×</button>
|
|
4396
4499
|
</div>
|
|
4397
4500
|
<div class="error-popup-content">
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
<
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
<
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4501
|
+
${this._typedDimensionWarningFacts.length>0?e.html`
|
|
4502
|
+
<div class="validate-warning-section">
|
|
4503
|
+
${this._duplicateFactMismatches.length>0?e.html`<h4>${F.t("typedDimensionWarning.title")}</h4>`:""}
|
|
4504
|
+
<p>${F.t("typedDimensionWarning.message")}</p>
|
|
4505
|
+
<ul class="error-list">
|
|
4506
|
+
${this._groupTypedDimensionWarningFactsByRole().map(t=>e.html`
|
|
4507
|
+
<li>
|
|
4508
|
+
<strong>${F.t("typedDimensionWarning.role")}</strong> ${t.sectionTitle}
|
|
4509
|
+
<ul>
|
|
4510
|
+
${t.facts.map(t=>e.html`
|
|
4511
|
+
<li>
|
|
4512
|
+
<strong>${F.t("typedDimensionWarning.field")}</strong>
|
|
4513
|
+
<a
|
|
4514
|
+
href="javascript:void(0)"
|
|
4515
|
+
class="error-field-link"
|
|
4516
|
+
@click="${()=>this._handleTypedDimensionFactClick(t.conceptId,t.columnId,t.sectionId)}"
|
|
4517
|
+
title="${F.t("typedDimensionWarning.clickToFocus")}"
|
|
4518
|
+
>
|
|
4519
|
+
${t.conceptLabel} (${t.columnTitle})
|
|
4520
|
+
</a>
|
|
4521
|
+
— <strong>${F.t("typedDimensionWarning.value")}</strong> ${t.value}
|
|
4522
|
+
</li>
|
|
4523
|
+
`)}
|
|
4524
|
+
</ul>
|
|
4525
|
+
</li>
|
|
4526
|
+
`)}
|
|
4527
|
+
</ul>
|
|
4528
|
+
</div>
|
|
4529
|
+
`:""}
|
|
4530
|
+
${this._duplicateFactMismatches.length>0?e.html`
|
|
4531
|
+
<div class="validate-warning-section">
|
|
4532
|
+
${this._typedDimensionWarningFacts.length>0?e.html`<h4>${F.t("duplicateFactWarning.title")}</h4>`:""}
|
|
4533
|
+
<p>${F.t("duplicateFactWarning.message")}</p>
|
|
4534
|
+
<ul class="error-list">
|
|
4535
|
+
${this._duplicateFactMismatches.map(t=>e.html`
|
|
4536
|
+
<li>
|
|
4537
|
+
<strong>${t.conceptLabel}</strong>
|
|
4538
|
+
<ul>
|
|
4539
|
+
${t.facts.map(t=>e.html`
|
|
4540
|
+
<li>
|
|
4541
|
+
<strong>${F.t("duplicateFactWarning.role")}</strong> ${t.sectionTitle} —
|
|
4542
|
+
<a
|
|
4543
|
+
href="javascript:void(0)"
|
|
4544
|
+
class="error-field-link"
|
|
4545
|
+
@click="${()=>this._handleDuplicateFactClick(t.conceptId,t.columnId,t.sectionId)}"
|
|
4546
|
+
title="${F.t("duplicateFactWarning.clickToFocus")}"
|
|
4547
|
+
>
|
|
4548
|
+
${t.columnTitle}
|
|
4549
|
+
</a>
|
|
4550
|
+
— <strong>${F.t("duplicateFactWarning.value")}</strong> ${t.value}
|
|
4551
|
+
</li>
|
|
4552
|
+
`)}
|
|
4553
|
+
</ul>
|
|
4554
|
+
</li>
|
|
4555
|
+
`)}
|
|
4556
|
+
</ul>
|
|
4557
|
+
</div>
|
|
4558
|
+
`:""}
|
|
4422
4559
|
</div>
|
|
4423
4560
|
<div class="error-popup-footer">
|
|
4424
|
-
|
|
4425
|
-
|
|
4561
|
+
${"validate"===this._duplicateWarningPopupMode?e.html`
|
|
4562
|
+
<button class="btn-secondary" @click="${()=>{this._showValidateWarningPopup=!1,this.requestUpdate()}}">${F.t("typedDimensionWarning.cancel")}</button>
|
|
4563
|
+
<button class="btn-primary" @click="${()=>{this._showValidateWarningPopup=!1,this._continueSubmit()}}">${F.t("typedDimensionWarning.continue")}</button>
|
|
4564
|
+
`:e.html`
|
|
4565
|
+
<button class="btn-primary" @click="${()=>{this._showValidateWarningPopup=!1,this.requestUpdate()}}">${F.t("duplicateFactWarning.close")}</button>
|
|
4566
|
+
`}
|
|
4426
4567
|
</div>
|
|
4427
4568
|
</div>
|
|
4428
4569
|
</div>
|
|
@@ -4447,7 +4588,7 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
4447
4588
|
</div>
|
|
4448
4589
|
`:""}
|
|
4449
4590
|
</div>
|
|
4450
|
-
`:e.html`<div>${
|
|
4591
|
+
`:e.html`<div>${F.t("form.loading")}</div>`}},exports.JupiterDynamicForm.styles=e.css`
|
|
4451
4592
|
:host {
|
|
4452
4593
|
display: block;
|
|
4453
4594
|
font-family: var(--jupiter-font-family, system-ui, -apple-system, sans-serif);
|
|
@@ -5294,6 +5435,17 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
5294
5435
|
color: var(--jupiter-text-primary, #333);
|
|
5295
5436
|
}
|
|
5296
5437
|
|
|
5438
|
+
.validate-warning-section + .validate-warning-section {
|
|
5439
|
+
margin-top: 24px;
|
|
5440
|
+
padding-top: 20px;
|
|
5441
|
+
border-top: 1px solid var(--jupiter-border-color, #ddd);
|
|
5442
|
+
}
|
|
5443
|
+
|
|
5444
|
+
.validate-warning-section h4 {
|
|
5445
|
+
margin: 0 0 8px 0;
|
|
5446
|
+
color: var(--jupiter-text-primary, #333);
|
|
5447
|
+
}
|
|
5448
|
+
|
|
5297
5449
|
.error-list {
|
|
5298
5450
|
list-style: none;
|
|
5299
5451
|
padding: 0;
|
|
@@ -5377,5 +5529,5 @@ const I={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},w=(e=I,t,
|
|
|
5377
5529
|
.context-menu-item.danger:hover {
|
|
5378
5530
|
background: #ffebee;
|
|
5379
5531
|
}
|
|
5380
|
-
`,
|
|
5532
|
+
`,xt([S({type:Object})],exports.JupiterDynamicForm.prototype,"schema",2),xt([S({type:Object})],exports.JupiterDynamicForm.prototype,"xbrlInput",2),xt([S({type:Object})],exports.JupiterDynamicForm.prototype,"config",2),xt([S({type:Object})],exports.JupiterDynamicForm.prototype,"initialData",2),xt([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"disabled",2),xt([S({type:Boolean})],exports.JupiterDynamicForm.prototype,"readonly",2),xt([S({type:Boolean,attribute:"calculation-enabled"})],exports.JupiterDynamicForm.prototype,"calculationEnabled",2),xt([S({type:Boolean,attribute:"formula-enabled"})],exports.JupiterDynamicForm.prototype,"formulaEnabled",2),xt([S({type:Boolean,attribute:"table-layout-enabled"})],exports.JupiterDynamicForm.prototype,"tableLayoutEnabled",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"periodStartDate",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"periodEndDate",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"language",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"reportingLanguage",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"numberLocale",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"display",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"mode",2),xt([S({type:String,attribute:"submit-button-label"})],exports.JupiterDynamicForm.prototype,"submitButtonLabel",2),xt([S({type:Array})],exports.JupiterDynamicForm.prototype,"roleFilterAxes",2),xt([S({type:Boolean,attribute:"show-last-validation-result-btn"})],exports.JupiterDynamicForm.prototype,"showLastValidationResultBtn",2),xt([S({type:Boolean,attribute:"is-draft-saving"})],exports.JupiterDynamicForm.prototype,"isDraftSaving",2),xt([S({type:Boolean,attribute:"has-unsaved-changes",reflect:!0})],exports.JupiterDynamicForm.prototype,"hasUnsavedChanges",2),xt([S({type:Array})],exports.JupiterDynamicForm.prototype,"defaultUnits",2),xt([S({type:String})],exports.JupiterDynamicForm.prototype,"decimals",2),xt([S({type:Object,attribute:"master-data"})],exports.JupiterDynamicForm.prototype,"masterData",2),xt([S({type:String,attribute:"prefilled-tooltip"})],exports.JupiterDynamicForm.prototype,"prefilledTooltip",2),xt([S({type:Object,attribute:"dynaforms-metadata"})],exports.JupiterDynamicForm.prototype,"dynaformsMetadata",2),xt([S({type:Object,attribute:"dynaforms-facts"})],exports.JupiterDynamicForm.prototype,"dynaformsFacts",2),xt([C()],exports.JupiterDynamicForm.prototype,"_formData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_draftLoaded",2),xt([C()],exports.JupiterDynamicForm.prototype,"_draftLoadedAt",2),xt([C()],exports.JupiterDynamicForm.prototype,"_preservedFormData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_periodData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_preservedPeriodData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_unitData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_preservedUnitData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_decimalsData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_totalManuallyEditedData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_effectiveMasterData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_typedMemberData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_preservedTypedMemberData",2),xt([C()],exports.JupiterDynamicForm.prototype,"_repeatCounts",2),xt([C()],exports.JupiterDynamicForm.prototype,"_hiddenColumnIds",2),xt([C()],exports.JupiterDynamicForm.prototype,"_columns",2),xt([C()],exports.JupiterDynamicForm.prototype,"_errors",2),xt([C()],exports.JupiterDynamicForm.prototype,"_touched",2),xt([C()],exports.JupiterDynamicForm.prototype,"_dirty",2),xt([C()],exports.JupiterDynamicForm.prototype,"_valid",2),xt([C()],exports.JupiterDynamicForm.prototype,"_submitted",2),xt([C()],exports.JupiterDynamicForm.prototype,"_xbrlFormErrors",2),xt([C()],exports.JupiterDynamicForm.prototype,"_calculationWarnings",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showErrorPopup",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showValidateWarningPopup",2),xt([C()],exports.JupiterDynamicForm.prototype,"_typedDimensionWarningFacts",2),xt([C()],exports.JupiterDynamicForm.prototype,"_duplicateFactMismatches",2),xt([C()],exports.JupiterDynamicForm.prototype,"_duplicateFactWarnings",2),xt([C()],exports.JupiterDynamicForm.prototype,"_duplicateWarningPopupMode",2),xt([C()],exports.JupiterDynamicForm.prototype,"_submitDisabled",2),xt([C()],exports.JupiterDynamicForm.prototype,"_currentSchema",2),xt([C()],exports.JupiterDynamicForm.prototype,"_allSections",2),xt([C()],exports.JupiterDynamicForm.prototype,"_selectedRoleIds",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showFilterDialog",2),xt([C()],exports.JupiterDynamicForm.prototype,"_revealRolePrompt",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showFactsOnly",2),xt([C()],exports.JupiterDynamicForm.prototype,"_conceptSearchText",2),xt([C()],exports.JupiterDynamicForm.prototype,"_periodPreferences",2),xt([C()],exports.JupiterDynamicForm.prototype,"_activeSidePanelRoleId",2),xt([C()],exports.JupiterDynamicForm.prototype,"_sidePanelSearchQuery",2),xt([C()],exports.JupiterDynamicForm.prototype,"_sidePanelCollapsed",2),xt([C()],exports.JupiterDynamicForm.prototype,"_adminRoleConfigs",2),xt([C()],exports.JupiterDynamicForm.prototype,"_roleBorderStatuses",2),xt([C()],exports.JupiterDynamicForm.prototype,"_roleCompletedStates",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showRoleContextMenu",2),xt([C()],exports.JupiterDynamicForm.prototype,"_contextMenuX",2),xt([C()],exports.JupiterDynamicForm.prototype,"_contextMenuY",2),xt([C()],exports.JupiterDynamicForm.prototype,"_contextMenuRoleId",2),xt([C()],exports.JupiterDynamicForm.prototype,"_validationStatus",2),xt([C()],exports.JupiterDynamicForm.prototype,"_validationDotCount",2),xt([C()],exports.JupiterDynamicForm.prototype,"_formulaValidationResults",2),xt([C()],exports.JupiterDynamicForm.prototype,"_formulaValidationSummary",2),xt([C()],exports.JupiterDynamicForm.prototype,"_showFormulaValidationDialog",2),exports.JupiterDynamicForm=xt([t("jupiter-dynamic-form")],exports.JupiterDynamicForm);exports.FactMatcher=we,exports.FormValidator=$,exports.TYPE_INPUT_MAP=je,exports.XBRLValidator=Be,exports.collectEnumerationsFromChain=ze,exports.determineInputTypeFromBaseChain=Je,exports.getInputTypeForConceptType=Pe,exports.isCheckboxType=Le,exports.isNumericType=Ne,exports.isSelectType=Ve,exports.isTextareaType=Ae,exports.resolveBaseTypeChain=Oe,exports.version="1.5.0";
|
|
5381
5533
|
//# sourceMappingURL=index.js.map
|