@odoo/o-spreadsheet 18.0.81 → 18.0.82

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.81
6
- * @date 2026-09-04T07:02:59.688Z
7
- * @hash a952c0c
5
+ * @version 18.0.82
6
+ * @date 2026-09-10T05:35:40.438Z
7
+ * @hash d0329aa
8
8
  */
9
9
 
10
10
  import { Component, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, xml } from "@odoo/owl";
@@ -8763,6 +8763,7 @@ const chartShowValuesPlugin = {
8763
8763
  case "doughnut":
8764
8764
  drawPieChartValues(chart, options, ctx);
8765
8765
  break;
8766
+ case "combo":
8766
8767
  case "bar":
8767
8768
  case "line":
8768
8769
  options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx) : drawLineOrBarChartValues(chart, options, ctx);
@@ -8786,7 +8787,7 @@ function drawLineOrBarChartValues(chart, options, ctx) {
8786
8787
  const point = dataset.data[i];
8787
8788
  const xPosition = point.x;
8788
8789
  let yPosition = 0;
8789
- if (chart.config.type === "line") yPosition = point.y - 10;
8790
+ if (dataset.type === "line") yPosition = point.y - 10;
8790
8791
  else yPosition = value < 0 ? point.y - point.height / 2 : point.y + point.height / 2;
8791
8792
  if (!textsPositions[xPosition]) textsPositions[xPosition] = [];
8792
8793
  for (const otherPosition of textsPositions[xPosition] || []) if (Math.abs(otherPosition - yPosition) < 13) yPosition = otherPosition - 13;
@@ -13928,7 +13929,7 @@ function createEmptyExcelWorkbookData() {
13928
13929
  //#region src/helpers/ui/paste_interactive.ts
13929
13930
  const PasteInteractiveContent = {
13930
13931
  wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
13931
- willRemoveExistingMerge: _t("This operation is not possible due to a merge. Please remove the merges first than try again."),
13932
+ willRemoveExistingMerge: _t("Cannot perform this action on merged cells. Unmerge the cells and try again."),
13932
13933
  wrongFigurePasteOption: _t("Cannot do a special paste of a figure."),
13933
13934
  frozenPaneOverlap: _t("This operation is not allowed due to an overlapping frozen pane.")
13934
13935
  };
@@ -25904,6 +25905,7 @@ function createComboChartRuntime(chart, getters) {
25904
25905
  };
25905
25906
  const fontColor = chartFontColor(chart.background);
25906
25907
  const config = getDefaultChartJsRuntime(chart, labels, fontColor, localeFormat);
25908
+ config.type = "bar";
25907
25909
  const legend = getChartJsLegend(fontColor);
25908
25910
  if (chart.legendPosition === "none") legend.display = false;
25909
25911
  else legend.position = chart.legendPosition;
@@ -37675,7 +37677,7 @@ var FindAndReplacePanel = class extends Component {
37675
37677
  }
37676
37678
  get specificRangeMatchesCount() {
37677
37679
  const range = this.searchOptions.specificRange;
37678
- if (!range) return "";
37680
+ if (!range || range.invalidSheetName || range.invalidXc) return "";
37679
37681
  const { sheetId, zone } = range;
37680
37682
  return _t("%(matches)s matches in range %(range)s of %(sheetName)s", {
37681
37683
  matches: this.store.specificRangeMatchesCount,
@@ -66450,6 +66452,6 @@ const constants = {
66450
66452
  //#endregion
66451
66453
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
66452
66454
 
66453
- __info__.version = "18.0.81";
66454
- __info__.date = "2026-09-04T07:02:59.688Z";
66455
- __info__.hash = "a952c0c";
66455
+ __info__.version = "18.0.82";
66456
+ __info__.date = "2026-09-10T05:35:40.438Z";
66457
+ __info__.hash = "d0329aa";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.0.81
6
- * @date 2026-09-04T07:02:59.688Z
7
- * @hash a952c0c
5
+ * @version 18.0.82
6
+ * @date 2026-09-10T05:35:40.438Z
7
+ * @hash d0329aa
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -8765,6 +8765,7 @@ stores.inject(MyMetaStore, storeInstance);
8765
8765
  case "doughnut":
8766
8766
  drawPieChartValues(chart, options, ctx);
8767
8767
  break;
8768
+ case "combo":
8768
8769
  case "bar":
8769
8770
  case "line":
8770
8771
  options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx) : drawLineOrBarChartValues(chart, options, ctx);
@@ -8788,7 +8789,7 @@ stores.inject(MyMetaStore, storeInstance);
8788
8789
  const point = dataset.data[i];
8789
8790
  const xPosition = point.x;
8790
8791
  let yPosition = 0;
8791
- if (chart.config.type === "line") yPosition = point.y - 10;
8792
+ if (dataset.type === "line") yPosition = point.y - 10;
8792
8793
  else yPosition = value < 0 ? point.y - point.height / 2 : point.y + point.height / 2;
8793
8794
  if (!textsPositions[xPosition]) textsPositions[xPosition] = [];
8794
8795
  for (const otherPosition of textsPositions[xPosition] || []) if (Math.abs(otherPosition - yPosition) < 13) yPosition = otherPosition - 13;
@@ -13930,7 +13931,7 @@ stores.inject(MyMetaStore, storeInstance);
13930
13931
  //#region src/helpers/ui/paste_interactive.ts
13931
13932
  const PasteInteractiveContent = {
13932
13933
  wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
13933
- willRemoveExistingMerge: _t("This operation is not possible due to a merge. Please remove the merges first than try again."),
13934
+ willRemoveExistingMerge: _t("Cannot perform this action on merged cells. Unmerge the cells and try again."),
13934
13935
  wrongFigurePasteOption: _t("Cannot do a special paste of a figure."),
13935
13936
  frozenPaneOverlap: _t("This operation is not allowed due to an overlapping frozen pane.")
13936
13937
  };
@@ -25906,6 +25907,7 @@ stores.inject(MyMetaStore, storeInstance);
25906
25907
  };
25907
25908
  const fontColor = chartFontColor(chart.background);
25908
25909
  const config = getDefaultChartJsRuntime(chart, labels, fontColor, localeFormat);
25910
+ config.type = "bar";
25909
25911
  const legend = getChartJsLegend(fontColor);
25910
25912
  if (chart.legendPosition === "none") legend.display = false;
25911
25913
  else legend.position = chart.legendPosition;
@@ -37677,7 +37679,7 @@ stores.inject(MyMetaStore, storeInstance);
37677
37679
  }
37678
37680
  get specificRangeMatchesCount() {
37679
37681
  const range = this.searchOptions.specificRange;
37680
- if (!range) return "";
37682
+ if (!range || range.invalidSheetName || range.invalidXc) return "";
37681
37683
  const { sheetId, zone } = range;
37682
37684
  return _t("%(matches)s matches in range %(range)s of %(sheetName)s", {
37683
37685
  matches: this.store.specificRangeMatchesCount,
@@ -66496,8 +66498,8 @@ exports.stores = stores;
66496
66498
  exports.tokenColors = tokenColors;
66497
66499
  exports.tokenize = tokenize;
66498
66500
 
66499
- __info__.version = "18.0.81";
66500
- __info__.date = "2026-09-04T07:02:59.688Z";
66501
- __info__.hash = "a952c0c";
66501
+ __info__.version = "18.0.82";
66502
+ __info__.date = "2026-09-10T05:35:40.438Z";
66503
+ __info__.hash = "d0329aa";
66502
66504
 
66503
66505
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -11,7 +11,7 @@ Did you forget to inject your store instance?
11
11
 
12
12
  const stores = useStoreProvider();
13
13
  stores.inject(MyMetaStore, storeInstance);
14
- `)}}return t}var cd=class{get;disposeCallbacks=[];constructor(e){this.get=e}onDispose(e){this.disposeCallbacks.push(e)}dispose(){this.disposeCallbacks.forEach(e=>e())}};function ld(){let e=(0,t.useEnv)();if(e.__spreadsheet_stores__ instanceof ad)return e.__spreadsheet_stores__;let n=new ad;return(0,t.useSubEnv)({__spreadsheet_stores__:n,getStore:e=>fd(n.get(e),()=>n.trigger(`store-updated`))}),n}function V(e){let n=pd((0,t.useEnv)());return dd(n,n.get(e))}function ud(e,...n){let r=pd((0,t.useEnv)()),i=r.instantiate(e,...n);return(0,t.onWillUnmount)(()=>i.dispose()),dd(r,i)}function dd(e,n){let r=(0,t.useComponent)();return fd(n,()=>{(0,t.status)(r)===`mounted`&&e.trigger(`store-updated`)})}function fd(e,t){return new Proxy(e,{get(n,r,i){let a=n,o=Reflect.get(n,r,a);return e.mutators?.includes(r)?new Proxy(o,{apply(e,n,r){Reflect.apply(e,a,r)!==`noStateChange`&&t()}}):o}})}function pd(e){let t=e.__spreadsheet_stores__;if(!(t instanceof ad))throw Error(`No store provider found. Did you forget to call useStoreProvider()?`);return t}let md=sd(`Model`);var hd=class{mutators=[`register`,`unRegister`,`drawLayer`];renderers={};register(e){if(e.renderingLayers.length)for(let t of e.renderingLayers)this.renderers[t]||(this.renderers[t]=[]),this.renderers[t].push(e)}unRegister(e){for(let t of Object.keys(this.renderers))this.renderers[t]=this.renderers[t].filter(t=>t!==e)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore();return`noStateChange`}},gd=class extends cd{model=this.get(md);getters=this.model.getters;renderer=this.get(hd);constructor(e){super(e),this.model.on(`command-dispatched`,this,this.handle),this.model.on(`command-finalized`,this,this.finalize),this.renderer.register(this),this.onDispose(()=>{this.model.off(`command-dispatched`,this),this.model.off(`command-finalized`,this),this.renderer.unRegister(this)})}get renderingLayers(){return[]}handle(e){}finalize(){}drawLayer(e,t){}};let _d={id:`void-composer`,get editionMode(){return`inactive`},startEdition:()=>{throw Error(`No composer is registered`)},stopEdition:()=>{throw Error(`No composer is registered`)},setCurrentContent:()=>{throw Error(`No composer is registered`)}};var vd=class extends gd{mutators=[`focusComposer`,`focusActiveComposer`];activeComposer=_d;_focusMode=`inactive`;get focusMode(){return this.activeComposer.editionMode===`inactive`?`inactive`:this._focusMode}focusComposer(e,t){if(this.activeComposer=e,this.getters.isReadonly())return`noStateChange`;this._focusMode=t.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(t)}focusActiveComposer(e){if(this.getters.isReadonly())return`noStateChange`;if(!this.activeComposer)throw Error(`No composer is registered`);this._focusMode=e.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(e)}setComposerContent({content:e,selection:t}){this.activeComposer.editionMode===`inactive`?this.activeComposer.startEdition(e,t):e&&this.activeComposer.setCurrentContent(e,t)}};function yd(e,t,n,r){let i=!1,a=[];for(let r in n){let o=n[r];if(o.labelCell){let e=Sd(o.labelCell,t);o.labelCell!==e&&(i=!0,o={...o,labelCell:e})}let s=Sd(o.dataRange,t);s===void 0||e.getRangeString(s,s.sheetId)===A.InvalidReference?(i=!0,o=void 0):s!==o.dataRange&&(i=!0,o={...o,dataRange:s}),a[r]=o}let o=r,s=Sd(o,t);s!==o&&(i=!0,o=s);let c=a.filter(S);return{isStale:i,dataSets:c,labelRange:o}}function bd(e,t,n){return n.map(n=>({dataRange:Gs(e,t,n.dataRange),labelCell:n.labelCell?Gs(e,t,n.labelCell):void 0}))}function xd(e,t,n){return n?Gs(e,t,n):void 0}function Sd(e,t){if(!e)return;let n=t(e);switch(n.changeType){case`NONE`:return e;case`REMOVE`:return;default:return n.range}}function Cd(e,t,n,r){let i=[];for(let a of t){let{unboundedZone:t,sheetId:o,invalidSheetName:s,invalidXc:c}=e.getRangeFromSheetXC(n,a.dataRange);if(!(s||c))if(t.left!==t.right&&t.top!==t.bottom){if(t.right===void 0)continue;for(let n=t.left;n<=t.right;n++){let s={...t,left:n,right:n};i.push({...wd(e,o,s,r?{top:s.top,bottom:s.top,left:s.left,right:s.left}:void 0),backgroundColor:a.backgroundColor,rightYAxis:a.yAxisId===`y1`,customLabel:a.label})}}else i.push({...wd(e,o,t,r?{top:t.top,bottom:t.top,left:t.left,right:t.left}:void 0),backgroundColor:a.backgroundColor,rightYAxis:a.yAxisId===`y1`,customLabel:a.label})}return i}function wd(e,t,n,r){if(n.left!==n.right&&n.top!==n.bottom)throw Error(`Zone should be a single column or row: ${nr(n)}`);if(r){let i=nr(n),a=nr(r);return{labelCell:e.getRangeFromSheetXC(t,a),dataRange:e.getRangeFromSheetXC(t,i)}}else return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,nr(n))}}function Td(e,t){let n=t.labelCell?.zone,r=t.dataRange.zone;if(n){let{numberOfRows:e,numberOfCols:t}=mr(r);e===1?r={...r,left:r.left+1}:t===1&&(r={...r,top:r.top+1})}let i=t.dataRange.clone({zone:r}),a={};return t.customLabel?a={text:t.customLabel}:t.labelCell&&(a={reference:e.getRangeString(t.labelCell,`forceSheetReference`,{useBoundedReference:!0})}),{label:a,range:e.getRangeString(i,`forceSheetReference`,{useBoundedReference:!0}),backgroundColor:t.backgroundColor,rightYAxis:t.rightYAxis}}function Ed(e,t,n){if(!t)return;let r={...t.zone};n&&t.zone.bottom>t.zone.top&&(r.top+=1);let i=t.clone({zone:r});return e.getRangeString(i,`forceSheetReference`,{useBoundedReference:!0})}function Dd(e,t){let n;if(e.labelRange){let r=nd(Qn(e.labelRange),t);n=r?nr(r):void 0}let r=e.dataSets.map(e=>Qn(e.dataRange)).map(e=>nd(e,t)).filter(S).map(e=>({dataRange:nr(e)}));return{...e,labelRange:n,dataSets:r}}function Od(e){return e&&on(e)<.3?`#FFFFFF`:`#000000`}function kd(e){return e.dataSets&&(e.dataSets.find(e=>!Is.test(e.dataRange))!==void 0||e.dataSets.map(e=>Qn(e.dataRange)).some(e=>e.top!==e.bottom&&Tr(e)))?`InvalidDataSet`:`Success`}function Ad(e){return e.labelRange&&!Is.test(e.labelRange||``)?`InvalidLabelRange`:`Success`}function jd(e,t,n){if(!n||!e)return!1;if(!t)return!0;let r=Dr(t.dataRange.zone);return!(Dr(e.zone)<r)}function Md(e,t){let{x:n,y:r}=e.getMainViewportCoordinates(),{scrollX:i,scrollY:a}=e.getActiveSheetScrollInfo(),{width:o,height:s}=e.getVisibleRect(e.getActiveMainViewport());return{x:n+i+Math.max(0,(o-t.width)/2),y:r+a+Math.max(0,(s-t.height)/2)}}function Nd(e){if(e?.title?.text){let{text:t,color:n,align:r,italic:i,bold:a}=e.title;return{display:!0,text:t,color:n,font:{style:i?`italic`:`normal`,weight:a?`bold`:`normal`},align:r===`left`?`start`:r===`right`?`end`:`center`}}}function Pd(e){let t=!1,n=!1;if(`horizontal`in e&&e.horizontal)return{useLeftAxis:!0,useRightAxis:!1};for(let r of e.dataSets||[])r.yAxisId===`y1`?n=!0:t=!0;return t||=!n,{useLeftAxis:t,useRightAxis:n}}function Fd({displayTitle:e,displayLegend:t}){let n=25;return e?n=0:t&&(n=10),{left:20,right:20,top:n,bottom:10}}function Id(e,t){let n=[],r=[],i=[];if(t.hidden)return;for(let e=0;e<t.data.length;e++)typeof t.data[e]==`number`&&(n.push(t.data[e]),r.push(e+1)),i.push(e+1);let a=x(.5,i.length+.55,.2),o=Rd(e,n,r,a);if(o.length)return Ld(t,e,o,a)}function Ld(e,t,n,r){let i=ln(e.backgroundColor);i.a=1;let a=t.color||gn(cn(i),.5);return{type:`line`,xAxisID:`x1`,yAxisID:e.yAxisID,label:e.label?T(`Trend line for %s`,e.label):``,data:n.map((e,t)=>({x:r[t],y:e})),order:-1,showLine:!0,pointRadius:0,backgroundColor:a,borderColor:a,borderDash:[5,5],borderWidth:void 0,fill:!1,pointBackgroundColor:a}}function Rd(e,t,n,r){if(t.length<2||n.length<2||r.length===0)return[];let{normalizedLabels:i,normalizedNewLabels:a}=zd(n,r,e);try{switch(e.type){case`polynomial`:{let n=e.order;if(!n)return Array.from({length:r.length},()=>NaN);if(n===1)return Ul([t],[i],[a],!0)[0];let o=Rl(t,i,n,!0).flat();return a.map(e=>Bl(o,e,n))}case`exponential`:{let e=[],n=[];for(let r=0;r<t.length;r++)t[r]>0&&(e.push(Math.log(t[r])),n.push(i[r]));return n.length?Vl(Ul([e],[n],[a],!0))[0]:Array.from({length:r.length},()=>NaN)}case`logarithmic`:return Ul([t],Hl([i]),Hl([a]),!0)[0];default:return[]}}catch{return Array.from({length:r.length},()=>NaN)}}function zd(e,t,n){let r=[],i=[];if(n.type===`logarithmic`){let n=Math.max(...e.map(Math.abs));r=e.map(e=>e/n),i=t.map(e=>e/n)}else{let n=Math.max(...e),a=n-Math.min(...e);r=e.map(e=>(e-n)/a),i=t.map(e=>(e-n)/a)}return{normalizedLabels:r,normalizedNewLabels:i}}function Bd(e){return t=>{if(t=Number(t),isNaN(t))return t;let{locale:n,format:r}=e;return B(t,{locale:n,format:!r&&Math.abs(t)>=1e3?`#,##`:r})}}function Vd(e,t){return new wn(t,e.dataSets.map(e=>e.backgroundColor))}let Hd=[{value:`left`,label:T(`Left`)},{value:`right`,label:T(`Right`)}],Ud={id:`chartShowValuesPlugin`,afterDatasetsDraw(e,t,n){if(!n.showValues||!e._metasets?.[0]?.data)return;let r=e.ctx;switch(r.save(),r.textAlign=`center`,r.textBaseline=`middle`,r.miterLimit=1,e.config.type){case`pie`:case`doughnut`:qd(e,n,r);break;case`bar`:case`line`:n.horizontal?Kd(e,n,r):Gd(e,n,r);break}r.restore()}};function Wd(e,t,n,r){r.lineWidth=3,r.strokeText(e,t,n),r.lineWidth=1,r.fillText(e,t,n)}function Gd(e,t,n){let r={};for(let i of e._metasets){if(i.xAxisID===`x1`)return;for(let a=0;a<i._parsed.length;a++){let o=i._parsed[a].y,s=i.data[a],c=s.x,l=0;l=e.config.type===`line`?s.y-10:o<0?s.y-s.height/2:s.y+s.height/2,r[c]||(r[c]=[]);for(let e of r[c]||[])Math.abs(e-l)<13&&(l=e-13);r[c].push(l),n.fillStyle=s.options.backgroundColor,n.strokeStyle=t.background||`#ffffff`,Wd(t.callback(Number(o),i,a),c,l,n)}}}function Kd(e,t,n){let r={};for(let i of e._metasets){if(i.xAxisID===`x1`)return;for(let e=0;e<i._parsed.length;e++){let a=i._parsed[e].x,o=t.callback(a,i,e),s=i.data[e],c=s.y,l=a<0?s.x+s.width/2:s.x-s.width/2;r[c]||(r[c]=[]);let u=cc(n,o,{fontSize:12},`px`);for(let e of r[c])Math.abs(e-l)<u&&(l=e+u+3);r[c].push(l),n.fillStyle=s.options.backgroundColor,n.strokeStyle=t.background||`#ffffff`,Wd(o,l,c,n)}}}function qd(e,t,n){for(let r of e._metasets)for(let e=0;e<r._parsed.length;e++){let i=Number(r._parsed[e]);if(isNaN(i)||i===0)continue;let a=r.data[e],{startAngle:o,endAngle:s,innerRadius:c,outerRadius:l}=a,u=(o+s)/2,d=(c+l)/2,f=a.x+d*Math.cos(u),p=a.y+d*Math.sin(u),m=t.callback(i,r,e),h=cc(n,m,{fontSize:12},`px`),g=l-c;if(h>=g||g<12)continue;let _=s-o,v=2*d*Math.tan(_/2);_<Math.PI/2&&(h>=v||v<12)||(n.fillStyle=Od(t.background),n.strokeStyle=t.background||`#ffffff`,Wd(m,f,p,n))}}let Jd={id:`waterfallLinesPlugin`,beforeDraw(e,t,n){if(!n.showConnectorLines)return;let r=e._metasets?.[0]?.data;if(!r)return;let i=e.ctx;i.save(),i.setLineDash([3,2]);for(let e=0;e<r.length;e++){let t=r[e];if(t.height===0)continue;let n=Xd(r,e);if(!n)break;let a=Yd(t),o=Yd(n),s=t.$context.raw,c=s[1]-s[0],l=Math.round(c<0?a.bottom-1:a.top),u=Math.round(a.right),d=Math.round(o.left);i.strokeStyle=`#999`,i.beginPath(),i.moveTo(u+1,l+.5),i.lineTo(d,l+.5),i.stroke()}i.restore()}};function Yd(e){let t=e.base<e.y;return{left:e.x-e.width/2,right:e.x+e.width/2,bottom:t?e.base+e.height:e.y+e.height,top:t?e.base:e.y}}function Xd(e,t){return e.find((e,n)=>n>t&&e.height!==0)}var Zd=class{xmlString;constructor(e){this.xmlString=e}toString(){return this.xmlString}};let Qd=[`areaChart`,`area3DChart`,`lineChart`,`line3DChart`,`stockChart`,`radarChart`,`scatterChart`,`pieChart`,`pie3DChart`,`doughnutChart`,`barChart`,`bar3DChart`,`ofPieChart`,`surfaceChart`,`surface3DChart`,`bubbleChart`,`comboChart`],$d=`000000`,ef={arrows:`3Arrows`,smiley:`3Symbols`,dots:`3TrafficLights1`},tf={styleSheet:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,sst:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,Relationships:`http://schemas.openxmlformats.org/package/2006/relationships`,Types:`http://schemas.openxmlformats.org/package/2006/content-types`,worksheet:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,workbook:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,drawing:`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,table:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,revision:`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,revision3:`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`,markupCompatibility:`http://schemas.openxmlformats.org/markup-compatibility/2006`},nf=`http://schemas.openxmlformats.org/drawingml/2006/main`,rf=`http://schemas.openxmlformats.org/drawingml/2006/chart`,af={workbook:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`,sheet:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`,metadata:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml`,sharedStrings:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`,styles:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`,drawing:`application/vnd.openxmlformats-officedocument.drawing+xml`,chart:`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`,themes:`application/vnd.openxmlformats-officedocument.theme+xml`,table:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`,pivot:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`,externalLink:`application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml`},of={document:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,sheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,metadata:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata`,sharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,drawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,chart:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart`,theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`},sf=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,cf=.75,lf=.143,uf=8.43,df=12.75,ff={FLOOR:[{type:`NUMBER`,value:1}],CEILING:[{type:`NUMBER`,value:1}],ROUND:[{type:`NUMBER`,value:0}],ROUNDUP:[{type:`NUMBER`,value:0}],ROUNDDOWN:[{type:`NUMBER`,value:0}],IFERROR:[{type:`NUMBER`,value:0}]},pf=`ACOT,ACOTH,AGGREGATE,ARABIC,BASE,BETA.DIST,BETA.INV,BINOM.DIST,BINOM.DIST.RANGE,BINOM.INV,BITAND,BITLSHIFT,BITOR,BITRSHIFT,BITXOR,BYCOL,BYROW,CEILING.MATH,CEILING.PRECISE,CHISQ.DIST,CHISQ.DIST.RT,CHISQ.INV,CHISQ.INV.RT,CHISQ.TEST,CHOOSECOLS,CHOOSEROWS,COMBINA,CONCAT,CONFIDENCE.NORM,CONFIDENCE.T,COT,COTH,COVARIANCE.P,COVARIANCE.S,CSC,CSCH,DAYS,DECIMAL,DROP,ERF.PRECISE,ERFC.PRECISE,EXPAND,EXPON.DIST,F.DIST,F.DIST.RT,F.INV,F.INV.RT,F.TEST,FIELDVALUE,FILTERXML,FLOOR.MATH,FLOOR.PRECISE,FORECAST.ETS,FORECAST.ETS.CONFINT,FORECAST.ETS.SEASONALITY,FORECAST.ETS.STAT,FORECAST.LINEAR,FORMULATEXT,GAMMA,GAMMA.DIST,GAMMA.INV,GAMMALN.PRECISE,GAUSS,HSTACK,HYPGEOM.DIST,IFNA,IFS,IMCOSH,IMCOT,IMCSC,IMCSCH,IMSEC,IMSECH,IMSINH,IMTAN,ISFORMULA,ISOMITTED,ISOWEEKNUM,LAMBDA,LET,LOGNORM.DIST,LOGNORM.INV,MAKEARRAY,MAP,MAXIFS,MINIFS,MODE.MULT,MODE.SNGL,MUNIT,NEGBINOM.DIST,NORM.DIST,NORM.INV,NORM.S.DIST,NORM.S.INV,NUMBERVALUE,PDURATION,PERCENTILE.EXC,PERCENTILE.INC,PERCENTRANK.EXC,PERCENTRANK.INC,PERMUTATIONA,PHI,POISSON.DIST,PQSOURCE,PYTHON_STR,PYTHON_TYPE,PYTHON_TYPENAME,QUARTILE.EXC,QUARTILE.INC,QUERYSTRING,RANDARRAY,RANK.AVG,RANK.EQ,REDUCE,RRI,SCAN,SEC,SECH,SEQUENCE,SHEET,SHEETS,SKEW.P,SORTBY,STDEV.P,STDEV.S,SWITCH,T.DIST,T.DIST.2T,T.DIST.RT,T.INV,T.INV.2T,T.TEST,TAKE,TEXTAFTER,TEXTBEFORE,TEXTJOIN,TEXTSPLIT,TOCOL,TOROW,UNICHAR,UNICODE,UNIQUE,VAR.P,VAR.S,VSTACK,WEBSERVICE,WEIBULL.DIST,WRAPCOLS,WRAPROWS,XLOOKUP,XOR,Z.TEST`.split(`,`),mf=new h,hf={},gf=0;function H(e,...t){let n=`__sheet__${gf++}`;return vf(n,String.raw(e,...t)),yf(n),n}function _f(e){let t=e.split(/(\{|\}|;)/).map(e=>e.trim()),n=[],r=[],i=[];function a(e,t){let r=[];for(let i of n[e]){let o=t&&t+` `+i||i;o.includes(`&`)&&(o=i.replace(/&/g,t||``)),e<n.length-1&&(o=a(e+1,o)),r.push(o)}return r.join(`, `)}function o(){i.length&&(r.push(a(0)+` {`),r.push(...i),r.push(`}`),i=[])}for(;t.length;){let e=t.shift();e===`}`?(o(),n.pop()):(t[0]===`{`&&(o(),n.push(e.split(/\s*,\s*/)),t.shift()),t[0]===`;`&&i.push(` `+e+`;`))}return r.join(`
14
+ `)}}return t}var cd=class{get;disposeCallbacks=[];constructor(e){this.get=e}onDispose(e){this.disposeCallbacks.push(e)}dispose(){this.disposeCallbacks.forEach(e=>e())}};function ld(){let e=(0,t.useEnv)();if(e.__spreadsheet_stores__ instanceof ad)return e.__spreadsheet_stores__;let n=new ad;return(0,t.useSubEnv)({__spreadsheet_stores__:n,getStore:e=>fd(n.get(e),()=>n.trigger(`store-updated`))}),n}function V(e){let n=pd((0,t.useEnv)());return dd(n,n.get(e))}function ud(e,...n){let r=pd((0,t.useEnv)()),i=r.instantiate(e,...n);return(0,t.onWillUnmount)(()=>i.dispose()),dd(r,i)}function dd(e,n){let r=(0,t.useComponent)();return fd(n,()=>{(0,t.status)(r)===`mounted`&&e.trigger(`store-updated`)})}function fd(e,t){return new Proxy(e,{get(n,r,i){let a=n,o=Reflect.get(n,r,a);return e.mutators?.includes(r)?new Proxy(o,{apply(e,n,r){Reflect.apply(e,a,r)!==`noStateChange`&&t()}}):o}})}function pd(e){let t=e.__spreadsheet_stores__;if(!(t instanceof ad))throw Error(`No store provider found. Did you forget to call useStoreProvider()?`);return t}let md=sd(`Model`);var hd=class{mutators=[`register`,`unRegister`,`drawLayer`];renderers={};register(e){if(e.renderingLayers.length)for(let t of e.renderingLayers)this.renderers[t]||(this.renderers[t]=[]),this.renderers[t].push(e)}unRegister(e){for(let t of Object.keys(this.renderers))this.renderers[t]=this.renderers[t].filter(t=>t!==e)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore();return`noStateChange`}},gd=class extends cd{model=this.get(md);getters=this.model.getters;renderer=this.get(hd);constructor(e){super(e),this.model.on(`command-dispatched`,this,this.handle),this.model.on(`command-finalized`,this,this.finalize),this.renderer.register(this),this.onDispose(()=>{this.model.off(`command-dispatched`,this),this.model.off(`command-finalized`,this),this.renderer.unRegister(this)})}get renderingLayers(){return[]}handle(e){}finalize(){}drawLayer(e,t){}};let _d={id:`void-composer`,get editionMode(){return`inactive`},startEdition:()=>{throw Error(`No composer is registered`)},stopEdition:()=>{throw Error(`No composer is registered`)},setCurrentContent:()=>{throw Error(`No composer is registered`)}};var vd=class extends gd{mutators=[`focusComposer`,`focusActiveComposer`];activeComposer=_d;_focusMode=`inactive`;get focusMode(){return this.activeComposer.editionMode===`inactive`?`inactive`:this._focusMode}focusComposer(e,t){if(this.activeComposer=e,this.getters.isReadonly())return`noStateChange`;this._focusMode=t.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(t)}focusActiveComposer(e){if(this.getters.isReadonly())return`noStateChange`;if(!this.activeComposer)throw Error(`No composer is registered`);this._focusMode=e.focusMode||`contentFocus`,this._focusMode!==`inactive`&&this.setComposerContent(e)}setComposerContent({content:e,selection:t}){this.activeComposer.editionMode===`inactive`?this.activeComposer.startEdition(e,t):e&&this.activeComposer.setCurrentContent(e,t)}};function yd(e,t,n,r){let i=!1,a=[];for(let r in n){let o=n[r];if(o.labelCell){let e=Sd(o.labelCell,t);o.labelCell!==e&&(i=!0,o={...o,labelCell:e})}let s=Sd(o.dataRange,t);s===void 0||e.getRangeString(s,s.sheetId)===A.InvalidReference?(i=!0,o=void 0):s!==o.dataRange&&(i=!0,o={...o,dataRange:s}),a[r]=o}let o=r,s=Sd(o,t);s!==o&&(i=!0,o=s);let c=a.filter(S);return{isStale:i,dataSets:c,labelRange:o}}function bd(e,t,n){return n.map(n=>({dataRange:Gs(e,t,n.dataRange),labelCell:n.labelCell?Gs(e,t,n.labelCell):void 0}))}function xd(e,t,n){return n?Gs(e,t,n):void 0}function Sd(e,t){if(!e)return;let n=t(e);switch(n.changeType){case`NONE`:return e;case`REMOVE`:return;default:return n.range}}function Cd(e,t,n,r){let i=[];for(let a of t){let{unboundedZone:t,sheetId:o,invalidSheetName:s,invalidXc:c}=e.getRangeFromSheetXC(n,a.dataRange);if(!(s||c))if(t.left!==t.right&&t.top!==t.bottom){if(t.right===void 0)continue;for(let n=t.left;n<=t.right;n++){let s={...t,left:n,right:n};i.push({...wd(e,o,s,r?{top:s.top,bottom:s.top,left:s.left,right:s.left}:void 0),backgroundColor:a.backgroundColor,rightYAxis:a.yAxisId===`y1`,customLabel:a.label})}}else i.push({...wd(e,o,t,r?{top:t.top,bottom:t.top,left:t.left,right:t.left}:void 0),backgroundColor:a.backgroundColor,rightYAxis:a.yAxisId===`y1`,customLabel:a.label})}return i}function wd(e,t,n,r){if(n.left!==n.right&&n.top!==n.bottom)throw Error(`Zone should be a single column or row: ${nr(n)}`);if(r){let i=nr(n),a=nr(r);return{labelCell:e.getRangeFromSheetXC(t,a),dataRange:e.getRangeFromSheetXC(t,i)}}else return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,nr(n))}}function Td(e,t){let n=t.labelCell?.zone,r=t.dataRange.zone;if(n){let{numberOfRows:e,numberOfCols:t}=mr(r);e===1?r={...r,left:r.left+1}:t===1&&(r={...r,top:r.top+1})}let i=t.dataRange.clone({zone:r}),a={};return t.customLabel?a={text:t.customLabel}:t.labelCell&&(a={reference:e.getRangeString(t.labelCell,`forceSheetReference`,{useBoundedReference:!0})}),{label:a,range:e.getRangeString(i,`forceSheetReference`,{useBoundedReference:!0}),backgroundColor:t.backgroundColor,rightYAxis:t.rightYAxis}}function Ed(e,t,n){if(!t)return;let r={...t.zone};n&&t.zone.bottom>t.zone.top&&(r.top+=1);let i=t.clone({zone:r});return e.getRangeString(i,`forceSheetReference`,{useBoundedReference:!0})}function Dd(e,t){let n;if(e.labelRange){let r=nd(Qn(e.labelRange),t);n=r?nr(r):void 0}let r=e.dataSets.map(e=>Qn(e.dataRange)).map(e=>nd(e,t)).filter(S).map(e=>({dataRange:nr(e)}));return{...e,labelRange:n,dataSets:r}}function Od(e){return e&&on(e)<.3?`#FFFFFF`:`#000000`}function kd(e){return e.dataSets&&(e.dataSets.find(e=>!Is.test(e.dataRange))!==void 0||e.dataSets.map(e=>Qn(e.dataRange)).some(e=>e.top!==e.bottom&&Tr(e)))?`InvalidDataSet`:`Success`}function Ad(e){return e.labelRange&&!Is.test(e.labelRange||``)?`InvalidLabelRange`:`Success`}function jd(e,t,n){if(!n||!e)return!1;if(!t)return!0;let r=Dr(t.dataRange.zone);return!(Dr(e.zone)<r)}function Md(e,t){let{x:n,y:r}=e.getMainViewportCoordinates(),{scrollX:i,scrollY:a}=e.getActiveSheetScrollInfo(),{width:o,height:s}=e.getVisibleRect(e.getActiveMainViewport());return{x:n+i+Math.max(0,(o-t.width)/2),y:r+a+Math.max(0,(s-t.height)/2)}}function Nd(e){if(e?.title?.text){let{text:t,color:n,align:r,italic:i,bold:a}=e.title;return{display:!0,text:t,color:n,font:{style:i?`italic`:`normal`,weight:a?`bold`:`normal`},align:r===`left`?`start`:r===`right`?`end`:`center`}}}function Pd(e){let t=!1,n=!1;if(`horizontal`in e&&e.horizontal)return{useLeftAxis:!0,useRightAxis:!1};for(let r of e.dataSets||[])r.yAxisId===`y1`?n=!0:t=!0;return t||=!n,{useLeftAxis:t,useRightAxis:n}}function Fd({displayTitle:e,displayLegend:t}){let n=25;return e?n=0:t&&(n=10),{left:20,right:20,top:n,bottom:10}}function Id(e,t){let n=[],r=[],i=[];if(t.hidden)return;for(let e=0;e<t.data.length;e++)typeof t.data[e]==`number`&&(n.push(t.data[e]),r.push(e+1)),i.push(e+1);let a=x(.5,i.length+.55,.2),o=Rd(e,n,r,a);if(o.length)return Ld(t,e,o,a)}function Ld(e,t,n,r){let i=ln(e.backgroundColor);i.a=1;let a=t.color||gn(cn(i),.5);return{type:`line`,xAxisID:`x1`,yAxisID:e.yAxisID,label:e.label?T(`Trend line for %s`,e.label):``,data:n.map((e,t)=>({x:r[t],y:e})),order:-1,showLine:!0,pointRadius:0,backgroundColor:a,borderColor:a,borderDash:[5,5],borderWidth:void 0,fill:!1,pointBackgroundColor:a}}function Rd(e,t,n,r){if(t.length<2||n.length<2||r.length===0)return[];let{normalizedLabels:i,normalizedNewLabels:a}=zd(n,r,e);try{switch(e.type){case`polynomial`:{let n=e.order;if(!n)return Array.from({length:r.length},()=>NaN);if(n===1)return Ul([t],[i],[a],!0)[0];let o=Rl(t,i,n,!0).flat();return a.map(e=>Bl(o,e,n))}case`exponential`:{let e=[],n=[];for(let r=0;r<t.length;r++)t[r]>0&&(e.push(Math.log(t[r])),n.push(i[r]));return n.length?Vl(Ul([e],[n],[a],!0))[0]:Array.from({length:r.length},()=>NaN)}case`logarithmic`:return Ul([t],Hl([i]),Hl([a]),!0)[0];default:return[]}}catch{return Array.from({length:r.length},()=>NaN)}}function zd(e,t,n){let r=[],i=[];if(n.type===`logarithmic`){let n=Math.max(...e.map(Math.abs));r=e.map(e=>e/n),i=t.map(e=>e/n)}else{let n=Math.max(...e),a=n-Math.min(...e);r=e.map(e=>(e-n)/a),i=t.map(e=>(e-n)/a)}return{normalizedLabels:r,normalizedNewLabels:i}}function Bd(e){return t=>{if(t=Number(t),isNaN(t))return t;let{locale:n,format:r}=e;return B(t,{locale:n,format:!r&&Math.abs(t)>=1e3?`#,##`:r})}}function Vd(e,t){return new wn(t,e.dataSets.map(e=>e.backgroundColor))}let Hd=[{value:`left`,label:T(`Left`)},{value:`right`,label:T(`Right`)}],Ud={id:`chartShowValuesPlugin`,afterDatasetsDraw(e,t,n){if(!n.showValues||!e._metasets?.[0]?.data)return;let r=e.ctx;switch(r.save(),r.textAlign=`center`,r.textBaseline=`middle`,r.miterLimit=1,e.config.type){case`pie`:case`doughnut`:qd(e,n,r);break;case`combo`:case`bar`:case`line`:n.horizontal?Kd(e,n,r):Gd(e,n,r);break}r.restore()}};function Wd(e,t,n,r){r.lineWidth=3,r.strokeText(e,t,n),r.lineWidth=1,r.fillText(e,t,n)}function Gd(e,t,n){let r={};for(let i of e._metasets){if(i.xAxisID===`x1`)return;for(let e=0;e<i._parsed.length;e++){let a=i._parsed[e].y,o=i.data[e],s=o.x,c=0;c=i.type===`line`?o.y-10:a<0?o.y-o.height/2:o.y+o.height/2,r[s]||(r[s]=[]);for(let e of r[s]||[])Math.abs(e-c)<13&&(c=e-13);r[s].push(c),n.fillStyle=o.options.backgroundColor,n.strokeStyle=t.background||`#ffffff`,Wd(t.callback(Number(a),i,e),s,c,n)}}}function Kd(e,t,n){let r={};for(let i of e._metasets){if(i.xAxisID===`x1`)return;for(let e=0;e<i._parsed.length;e++){let a=i._parsed[e].x,o=t.callback(a,i,e),s=i.data[e],c=s.y,l=a<0?s.x+s.width/2:s.x-s.width/2;r[c]||(r[c]=[]);let u=cc(n,o,{fontSize:12},`px`);for(let e of r[c])Math.abs(e-l)<u&&(l=e+u+3);r[c].push(l),n.fillStyle=s.options.backgroundColor,n.strokeStyle=t.background||`#ffffff`,Wd(o,l,c,n)}}}function qd(e,t,n){for(let r of e._metasets)for(let e=0;e<r._parsed.length;e++){let i=Number(r._parsed[e]);if(isNaN(i)||i===0)continue;let a=r.data[e],{startAngle:o,endAngle:s,innerRadius:c,outerRadius:l}=a,u=(o+s)/2,d=(c+l)/2,f=a.x+d*Math.cos(u),p=a.y+d*Math.sin(u),m=t.callback(i,r,e),h=cc(n,m,{fontSize:12},`px`),g=l-c;if(h>=g||g<12)continue;let _=s-o,v=2*d*Math.tan(_/2);_<Math.PI/2&&(h>=v||v<12)||(n.fillStyle=Od(t.background),n.strokeStyle=t.background||`#ffffff`,Wd(m,f,p,n))}}let Jd={id:`waterfallLinesPlugin`,beforeDraw(e,t,n){if(!n.showConnectorLines)return;let r=e._metasets?.[0]?.data;if(!r)return;let i=e.ctx;i.save(),i.setLineDash([3,2]);for(let e=0;e<r.length;e++){let t=r[e];if(t.height===0)continue;let n=Xd(r,e);if(!n)break;let a=Yd(t),o=Yd(n),s=t.$context.raw,c=s[1]-s[0],l=Math.round(c<0?a.bottom-1:a.top),u=Math.round(a.right),d=Math.round(o.left);i.strokeStyle=`#999`,i.beginPath(),i.moveTo(u+1,l+.5),i.lineTo(d,l+.5),i.stroke()}i.restore()}};function Yd(e){let t=e.base<e.y;return{left:e.x-e.width/2,right:e.x+e.width/2,bottom:t?e.base+e.height:e.y+e.height,top:t?e.base:e.y}}function Xd(e,t){return e.find((e,n)=>n>t&&e.height!==0)}var Zd=class{xmlString;constructor(e){this.xmlString=e}toString(){return this.xmlString}};let Qd=[`areaChart`,`area3DChart`,`lineChart`,`line3DChart`,`stockChart`,`radarChart`,`scatterChart`,`pieChart`,`pie3DChart`,`doughnutChart`,`barChart`,`bar3DChart`,`ofPieChart`,`surfaceChart`,`surface3DChart`,`bubbleChart`,`comboChart`],$d=`000000`,ef={arrows:`3Arrows`,smiley:`3Symbols`,dots:`3TrafficLights1`},tf={styleSheet:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,sst:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,Relationships:`http://schemas.openxmlformats.org/package/2006/relationships`,Types:`http://schemas.openxmlformats.org/package/2006/content-types`,worksheet:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,workbook:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,drawing:`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,table:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,revision:`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,revision3:`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`,markupCompatibility:`http://schemas.openxmlformats.org/markup-compatibility/2006`},nf=`http://schemas.openxmlformats.org/drawingml/2006/main`,rf=`http://schemas.openxmlformats.org/drawingml/2006/chart`,af={workbook:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`,sheet:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`,metadata:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml`,sharedStrings:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`,styles:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`,drawing:`application/vnd.openxmlformats-officedocument.drawing+xml`,chart:`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`,themes:`application/vnd.openxmlformats-officedocument.theme+xml`,table:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`,pivot:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`,externalLink:`application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml`},of={document:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,sheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,metadata:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata`,sharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,drawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,chart:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart`,theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`},sf=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,cf=.75,lf=.143,uf=8.43,df=12.75,ff={FLOOR:[{type:`NUMBER`,value:1}],CEILING:[{type:`NUMBER`,value:1}],ROUND:[{type:`NUMBER`,value:0}],ROUNDUP:[{type:`NUMBER`,value:0}],ROUNDDOWN:[{type:`NUMBER`,value:0}],IFERROR:[{type:`NUMBER`,value:0}]},pf=`ACOT,ACOTH,AGGREGATE,ARABIC,BASE,BETA.DIST,BETA.INV,BINOM.DIST,BINOM.DIST.RANGE,BINOM.INV,BITAND,BITLSHIFT,BITOR,BITRSHIFT,BITXOR,BYCOL,BYROW,CEILING.MATH,CEILING.PRECISE,CHISQ.DIST,CHISQ.DIST.RT,CHISQ.INV,CHISQ.INV.RT,CHISQ.TEST,CHOOSECOLS,CHOOSEROWS,COMBINA,CONCAT,CONFIDENCE.NORM,CONFIDENCE.T,COT,COTH,COVARIANCE.P,COVARIANCE.S,CSC,CSCH,DAYS,DECIMAL,DROP,ERF.PRECISE,ERFC.PRECISE,EXPAND,EXPON.DIST,F.DIST,F.DIST.RT,F.INV,F.INV.RT,F.TEST,FIELDVALUE,FILTERXML,FLOOR.MATH,FLOOR.PRECISE,FORECAST.ETS,FORECAST.ETS.CONFINT,FORECAST.ETS.SEASONALITY,FORECAST.ETS.STAT,FORECAST.LINEAR,FORMULATEXT,GAMMA,GAMMA.DIST,GAMMA.INV,GAMMALN.PRECISE,GAUSS,HSTACK,HYPGEOM.DIST,IFNA,IFS,IMCOSH,IMCOT,IMCSC,IMCSCH,IMSEC,IMSECH,IMSINH,IMTAN,ISFORMULA,ISOMITTED,ISOWEEKNUM,LAMBDA,LET,LOGNORM.DIST,LOGNORM.INV,MAKEARRAY,MAP,MAXIFS,MINIFS,MODE.MULT,MODE.SNGL,MUNIT,NEGBINOM.DIST,NORM.DIST,NORM.INV,NORM.S.DIST,NORM.S.INV,NUMBERVALUE,PDURATION,PERCENTILE.EXC,PERCENTILE.INC,PERCENTRANK.EXC,PERCENTRANK.INC,PERMUTATIONA,PHI,POISSON.DIST,PQSOURCE,PYTHON_STR,PYTHON_TYPE,PYTHON_TYPENAME,QUARTILE.EXC,QUARTILE.INC,QUERYSTRING,RANDARRAY,RANK.AVG,RANK.EQ,REDUCE,RRI,SCAN,SEC,SECH,SEQUENCE,SHEET,SHEETS,SKEW.P,SORTBY,STDEV.P,STDEV.S,SWITCH,T.DIST,T.DIST.2T,T.DIST.RT,T.INV,T.INV.2T,T.TEST,TAKE,TEXTAFTER,TEXTBEFORE,TEXTJOIN,TEXTSPLIT,TOCOL,TOROW,UNICHAR,UNICODE,UNIQUE,VAR.P,VAR.S,VSTACK,WEBSERVICE,WEIBULL.DIST,WRAPCOLS,WRAPROWS,XLOOKUP,XOR,Z.TEST`.split(`,`),mf=new h,hf={},gf=0;function H(e,...t){let n=`__sheet__${gf++}`;return vf(n,String.raw(e,...t)),yf(n),n}function _f(e){let t=e.split(/(\{|\}|;)/).map(e=>e.trim()),n=[],r=[],i=[];function a(e,t){let r=[];for(let i of n[e]){let o=t&&t+` `+i||i;o.includes(`&`)&&(o=i.replace(/&/g,t||``)),e<n.length-1&&(o=a(e+1,o)),r.push(o)}return r.join(`, `)}function o(){i.length&&(r.push(a(0)+` {`),r.push(...i),r.push(`}`),i=[])}for(;t.length;){let e=t.shift();e===`}`?(o(),n.pop()):(t[0]===`{`&&(o(),n.push(e.split(/\s*,\s*/)),t.shift()),t[0]===`;`&&i.push(` `+e+`;`))}return r.join(`
15
15
  `)}function vf(e,t){let n=document.createElement(`style`);n.textContent=_f(t),hf[e]=n}function yf(e){let t=hf[e];t.setAttribute(`component`,e),document.head.appendChild(t)}function bf({strikethrough:e,underline:t}){return!e&&!t?`none`:`${e?`line-through`:``} ${t?`underline`:``}`}function xf(e){let t=Sf(e);return e&&e.fillColor&&(t.background=e.fillColor),t}function Sf(e){let t={};if(!e)return t;if(e.bold&&(t[`font-weight`]=`bold`),e.italic&&(t[`font-style`]=`italic`),e.strikethrough||e.underline){let n=e.strikethrough?`line-through`:``;n=e.underline?n+` underline`:n,t[`text-decoration`]=n}return e.textColor&&(t.color=e.textColor),t}function U(e){let t=``;for(let n in e)e[n]&&(t+=`${n}:${e[n]}; `);return t}function Cf(e){let t=window.getComputedStyle(e);return{top:parseInt(t.marginTop,10)||0,bottom:parseInt(t.marginBottom,10)||0,left:parseInt(t.marginLeft,10)||0,right:parseInt(t.marginRight,10)||0}}H`
16
16
  .o-spreadsheet {
17
17
  .o-icon {
@@ -43,7 +43,7 @@ stores.inject(MyMetaStore, storeInstance);
43
43
  <Default Extension="${e}" ContentType="${t}" />
44
44
  `}function q(e){return new Zd(e.join(`
45
45
  `))}function J(e,...t){let n=[e[0]];for(let r=0;r<t.length;r++){let i=t[r]instanceof Zd?t[r]:th(t[r]);n.push(i+e[r+1])}return new Zd(Tt(n))}function sh(e){return e.replace(/NAMESPACE.*NAMESPACE(.*)/,`$1`)}function ch(e){return e.replaceAll(/(<\/?)([a-zA-Z0-9]+):([a-zA-Z0-9]+)/g,`$1NAMESPACE$2NAMESPACE$3`)}function lh(e){return e.replaceAll(/([a-zA-Z0-9]+):([a-zA-Z0-9]+)/g,`NAMESPACE$1NAMESPACE$2`)}var uh=class{value;constructor(e){this.value=e}asString(){return kf(String(this.value))}asBool(){return this.value===`true`?!0:this.value===`false`?!1:!!Number(this.value)}asNum(){return Number(this.value)}},dh=class{rootFile;xlsxFileStructure;warningManager;relationships;currentFile=void 0;constructor(e,t,n){this.rootFile=e,this.currentFile=e.file.fileName,this.xlsxFileStructure=t,this.warningManager=n,this.relationships={},e.rels&&this.extractRelationships(e.rels).map(e=>{this.relationships[e.id]=e})}extractRelationships(e){return this.mapOnElements({parent:e.xml,query:`Relationship`},e=>({id:this.extractAttr(e,`Id`,{required:!0}).asString(),target:this.extractAttr(e,`Target`,{required:!0}).asString(),type:this.extractAttr(e,`Type`,{required:!0}).asString()}))}getListOfXMLFiles(){return Object.entries(this.xlsxFileStructure).filter(([e])=>e!==`images`).map(([e,t])=>t).flat().filter(S)}mapOnElements(e,t){let n=[],r=this.currentFile,i;if(i=e.children?this.querySelector(e.parent,e.query)?.children||[]:this.querySelectorAll(e.parent,e.query),i)for(let e of i)try{n.push(t(e))}catch(t){this.catchErrorOnElement(t,e)}return this.currentFile=r,n}catchErrorOnElement(e,t){let n=t?`Error when parsing an element <${t.tagName}> of file ${this.currentFile}, skip this element. \n${e.stack}`:`Error when parsing file ${this.currentFile}.`;this.warningManager.addParsingWarning([n,e.message].join(`
46
- `))}extractAttr(e,t,n){let r=e.attributes[t];r||this.handleMissingValue(e,`attribute "${t}"`,n);let i=r?.value?r.value:n?.default;return i===void 0?void 0:new uh(i)}extractTextContent(e,t){if(t?.default!==void 0&&typeof t.default!=`string`)throw Error(`extractTextContent default value should be a string`);let n=e?.attributes[`xml:space`]?.value===`preserve`,r=e?.textContent;return(!e||r===null)&&this.handleMissingValue(e,`text content`,t),r&&=n?r:r.trim(),r?kf(r):t?.default}extractChildAttr(e,t,n,r){let i;i=typeof t==`number`?e.children[t]:this.querySelector(e,t),i||this.handleMissingValue(e,typeof t==`number`?`child at index ${t}`:`child <${t}>`,r);let a=i?this.extractAttr(i,n,r)?.asString():r?.default;return a===void 0?void 0:new uh(a)}extractChildTextContent(e,t,n){if(n?.default!==void 0&&typeof n.default!=`string`)throw Error(`extractTextContent default value should be a string`);let r=this.querySelector(e,t);return r||this.handleMissingValue(e,`child <${t}>`,n),r?this.extractTextContent(r,n):n?.default}handleMissingValue(e,t,n){if(n?.required)if(n?.default!==void 0)this.warningManager.addParsingWarning(`Missing required ${t} in element <${e.tagName}> of ${this.currentFile}, replacing it by the default value ${n.default}`);else throw Error(`Missing required ${t} in element <${e.tagName}> of ${this.currentFile}, and no default value was set`)}extractColor(e,t,n){if(!e)return n?{rgb:n}:void 0;let r=this.extractAttr(e,`theme`)?.asString(),i;if(r!==void 0){if(!t||!t.clrScheme)throw Error(`Color referencing a theme but no theme was provided`);i=this.getThemeColor(r,t.clrScheme)}else i=this.extractAttr(e,`rgb`)?.asString(),i=i===`FF000000`?void 0:i;return{rgb:i||n,auto:this.extractAttr(e,`auto`)?.asBool(),indexed:this.extractAttr(e,`indexed`)?.asNum(),tint:this.extractAttr(e,`tint`)?.asNum()}}getTargetXmlFile(e){if(!e)throw Error(`Undefined target file`);let t=this.processRelationshipTargetName(e.target),n=this.getListOfXMLFiles().find(e=>e.file.fileName.endsWith(t));if(!n||!n.file)throw Error(`Cannot find target file`);return n}getTargetImageFile(e){if(!e)throw Error(`Undefined target file`);let t=this.processRelationshipTargetName(e.target),n=this.xlsxFileStructure.images.find(e=>e.fileName.endsWith(t));if(!n)throw Error(`Cannot find target file`);return n}querySelector(e,t){let n=lh(t);return e.querySelector(n)}querySelectorAll(e,t){let n=lh(t);return e.querySelectorAll(n)}getThemeColor(e,t){switch(e){case`0`:return`FFFFFF`;case`1`:return`000000`;case`2`:return t[3].value;case`3`:return t[2].value;default:return t[e].value}}processRelationshipTargetName(e){return e.replace(/\.+\//,``)}},fh=class extends dh{getTheme(){return{clrScheme:this.mapOnElements({query:`a:clrScheme`,parent:this.rootFile.file.xml,children:!0},e=>({name:e.tagName,value:this.extractChildAttr(e,0,`val`,{required:!0,default:$d}).asString(),lastClr:this.extractChildAttr(e,0,`lastClr`,{default:$d}).asString()}))}}getSharedStrings(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`si`},e=>this.mapOnElements({parent:e,query:`t`},e=>this.extractTextContent(e)||``).join(``))}},ph=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}extractConditionalFormattings(){let e=this.mapOnElements({parent:this.rootFile.file.xml,query:`worksheet > conditionalFormatting`},e=>({sqref:this.extractAttr(e,`sqref`,{required:!0}).asString().split(` `),pivot:this.extractAttr(e,`pivot`)?.asBool(),cfRules:this.extractCFRules(e,this.theme)}));return e.push(...this.mapOnElements({parent:this.rootFile.file.xml,query:`extLst x14:conditionalFormatting`},e=>({sqref:this.extractChildTextContent(e,`xm:sqref`,{required:!0}).split(` `),pivot:this.extractAttr(e,`xm:pivot`)?.asBool(),cfRules:this.extractCFRules(e,this.theme)}))),e}extractCFRules(e,t){return this.mapOnElements({parent:e,query:`cfRule, x14:cfRule`},e=>{let n=this.extractAttr(e,`type`,{required:!0}).asString();if(n===`dataBar`)throw Error(`Databars conditional formats are not supported.`);return{type:n,priority:this.extractAttr(e,`priority`,{required:!0}).asNum(),colorScale:this.extractCfColorScale(e,t),formula:this.extractCfFormula(e),iconSet:this.extractCfIconSet(e),dxfId:this.extractAttr(e,`dxfId`)?.asNum(),stopIfTrue:this.extractAttr(e,`stopIfTrue`)?.asBool(),aboveAverage:this.extractAttr(e,`aboveAverage`)?.asBool(),percent:this.extractAttr(e,`percent`)?.asBool(),bottom:this.extractAttr(e,`bottom`)?.asBool(),operator:this.extractAttr(e,`operator`)?.asString(),text:this.extractAttr(e,`text`)?.asString(),timePeriod:this.extractAttr(e,`timePeriod`)?.asString(),rank:this.extractAttr(e,`rank`)?.asNum(),stdDev:this.extractAttr(e,`stdDev`)?.asNum(),equalAverage:this.extractAttr(e,`equalAverage`)?.asBool()}})}extractCfFormula(e){return this.mapOnElements({parent:e,query:`formula`},e=>this.extractTextContent(e,{required:!0}))}extractCfColorScale(e,t){let n=this.querySelector(e,`colorScale`);if(n)return{colors:this.mapOnElements({parent:n,query:`color`},e=>this.extractColor(e,t,`ffffff`)),cfvos:this.extractCFVos(n)}}extractCfIconSet(e){let t=this.querySelector(e,`iconSet, x14:iconSet`);if(t)return{iconSet:this.extractAttr(t,`iconSet`,{default:`3TrafficLights1`}).asString(),showValue:this.extractAttr(t,`showValue`,{default:!0}).asBool(),percent:this.extractAttr(t,`percent`,{default:!0}).asBool(),reverse:this.extractAttr(t,`reverse`)?.asBool(),custom:this.extractAttr(t,`custom`)?.asBool(),cfvos:this.extractCFVos(t),cfIcons:this.extractCfIcons(t)}}extractCfIcons(e){let t=this.mapOnElements({parent:e,query:`cfIcon, x14:cfIcon`},e=>({iconSet:this.extractAttr(e,`iconSet`,{required:!0}).asString(),iconId:this.extractAttr(e,`iconId`,{required:!0}).asNum()}));return t.length===0?void 0:t}extractCFVos(e){return this.mapOnElements({parent:e,query:`cfvo, x14:cfvo`},e=>({type:this.extractAttr(e,`type`,{required:!0}).asString(),gte:this.extractAttr(e,`gte`,{default:!0})?.asBool(),value:e.attributes.val?this.extractAttr(e,`val`)?.asString():this.extractChildTextContent(e,`f, xm:f`)}))}},mh=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}extractDataValidations(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`worksheet > dataValidations > dataValidation`},e=>({type:this.extractAttr(e,`type`,{required:!0}).asString(),operator:this.extractAttr(e,`operator`,{default:`between`})?.asString(),sqref:this.extractAttr(e,`sqref`,{required:!0}).asString().split(` `),errorStyle:this.extractAttr(e,`errorStyle`)?.asString(),formula1:this.extractDataValidationFormula(e,1)[0],formula2:this.extractDataValidationFormula(e,2)[0],showErrorMessage:this.extractAttr(e,`showErrorMessage`)?.asBool(),errorTitle:this.extractAttr(e,`errorTitle`)?.asString(),error:this.extractAttr(e,`error`)?.asString(),showInputMessage:this.extractAttr(e,`showInputMessage`)?.asBool(),promptTitle:this.extractAttr(e,`promptTitle`)?.asString(),prompt:this.extractAttr(e,`prompt`)?.asString(),allowBlank:this.extractAttr(e,`allowBlank`)?.asBool()}))}extractDataValidationFormula(e,t){return this.mapOnElements({parent:e,query:`formula${t}`},e=>this.extractTextContent(e,{required:!0}))}},hh=class extends dh{extractChart(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`c:chartSpace`},e=>{let t=this.getChartType(e);if(!Yf[t])throw Error(`Unsupported chart type ${t}`);if(Yf[t]===`combo`)return this.extractComboChart(e);let n=this.mapOnElements({parent:e,query:`c:chart > c:title a:t`},e=>e.textContent||``).join(``),r=this.extractChildAttr(e,`c:grouping`,`val`,{default:`clustered`}).asString();return{title:{text:n},type:Yf[t],dataSets:this.extractChartDatasets(this.querySelectorAll(e,`c:${t}`),t),labelRange:this.extractLabelRange(t,e),backgroundColor:this.extractChildAttr(e,`c:chartSpace > c:spPr a:srgbClr`,`val`,{default:`ffffff`}).asString(),legendPosition:Jf[this.extractChildAttr(e,`c:legendPos`,`val`,{default:`none`}).asString()],stacked:r===`stacked`,fontColor:`000000`}})[0]}extractLabelRange(e,t){return e===`scatterChart`?this.extractChildTextContent(t,`c:ser c:strRef c:f`)||this.extractChildTextContent(t,`c:ser c:numRef c:f`):this.extractChildTextContent(t,`c:ser c:cat c:f`)}extractComboChart(e){let t=this.mapOnElements({parent:e,query:`c:title a:t`},e=>e.textContent||``).join(``),n=this.extractChildAttr(e,`c:grouping`,`val`,{default:`clustered`}).asString();return{title:{text:t},type:`combo`,dataSets:[...this.extractChartDatasets(this.querySelectorAll(e,`c:barChart`),`comboChart`),...this.extractChartDatasets(this.querySelectorAll(e,`c:lineChart`),`comboChart`)],labelRange:this.extractChildTextContent(e,`c:ser c:cat c:f`),backgroundColor:this.extractChildAttr(e,`c:chartSpace > c:spPr a:srgbClr`,`val`,{default:`ffffff`}).asString(),legendPosition:Jf[this.extractChildAttr(e,`c:legendPos`,`val`,{default:`none`}).asString()],stacked:n===`stacked`,fontColor:`000000`}}extractChartDatasets(e,t){return Array.from(e).map(e=>t===`scatterChart`?this.extractScatterChartDatasets(e):this.mapOnElements({parent:e,query:`c:ser`},e=>{let t={},n=this.extractChildTextContent(e,`c:tx c:f`);if(n)t={reference:n};else{let n=this.extractChildTextContent(e,`c:tx c:v`);n&&(t={text:n})}let r=this.extractChildAttr(e,`c:spPr a:solidFill a:srgbClr`,`val`);return{label:t,range:this.extractChildTextContent(e,`c:val c:f`,{required:!0}),backgroundColor:r?`${en(r.asString())}`:void 0}})).flat()}extractScatterChartDatasets(e){return this.mapOnElements({parent:e,query:`c:ser`},e=>{let t={},n=this.extractChildTextContent(e,`c:tx c:f`);if(n)t={reference:n};else{let n=this.extractChildTextContent(e,`c:tx c:v`);n&&(t={text:n})}return{label:t,range:this.extractChildTextContent(e,`c:yVal c:f`,{required:!0})}})}getChartType(e){let t=this.querySelector(e,`c:plotArea`);if(!t)throw Error(`Missing plot area in the chart definition.`);let n;for(let e of t.children){let t=sh(e.tagName);Qd.some(e=>e===t)&&(n?n!==t&&(n=`comboChart`):n=t)}if(n)return n;throw Error(`Unknown chart type`)}};let gh=`oneCellAnchor`,_h=`twoCellAnchor`;var vh=class extends dh{extractFigures(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`xdr:wsDr`,children:!0},e=>{let t=sh(e.tagName),n=this.extractFigureAnchorsByType(e,t),r=this.querySelector(e,`c:chart`),i=this.querySelector(e,`a:blip`);if(!r&&!i)throw Error(`Only chart and image figures are currently supported.`);return{anchors:n,data:r?this.extractChart(r):this.extractImage(e),figureSize:t===gh?this.extractFigureSizeFromSizeTag(e,`xdr:ext`):void 0}})}extractFigureAnchorsByType(e,t){switch(t){case gh:return[this.extractFigureAnchor(`xdr:from`,e)];case _h:return[this.extractFigureAnchor(`xdr:from`,e),this.extractFigureAnchor(`xdr:to`,e)];default:throw Error(`${t} is not supported for xlsx drawings. `)}}extractFigureSizeFromSizeTag(e,t){let n=this.querySelector(e,t);if(!n)throw Error(`Missing size element '${t}'`);return{cx:this.extractAttr(n,`cx`,{required:!0}).asNum(),cy:this.extractAttr(n,`cy`,{required:!0}).asNum()}}extractFigureAnchor(e,t){let n=this.querySelector(t,e);if(!n)throw Error(`Missing anchor element ${e}`);return{col:Number(this.extractChildTextContent(n,`xdr:col`,{required:!0})),colOffset:Number(this.extractChildTextContent(n,`xdr:colOff`,{required:!0})),row:Number(this.extractChildTextContent(n,`xdr:row`,{required:!0})),rowOffset:Number(this.extractChildTextContent(n,`xdr:rowOff`,{required:!0}))}}extractChart(e){let t=this.extractAttr(e,`r:id`,{required:!0}).asString(),n=new hh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).extractChart();if(!n)throw Error(`Unable to extract chart definition`);return n}extractImage(e){let t=this.querySelector(e,`a:blip`),n=this.extractAttr(t,`r:embed`,{required:!0}).asString(),r=this.getTargetImageFile(this.relationships[n]);if(!r)throw Error(`Unable to extract image`);let i=r.fileName.split(`.`).at(-1),a=sh(e.tagName),o=a===_h?this.querySelector(e,`a:xfrm`):e,s=a===_h?`a:ext`:`xdr:ext`,c=this.extractFigureSizeFromSizeTag(o,s);return{imageSrc:r.imageSrc,mimetype:i?tp[i]:void 0,size:c}}},yh=class extends dh{getPivotTable(){return this.mapOnElements({query:`:root`,parent:this.rootFile.file.xml},e=>({name:this.extractAttr(e,`name`,{required:!0}).asString(),rowGrandTotals:this.extractAttr(e,`rowGrandTotals`,{default:!0}).asBool(),location:this.extractPivotLocation(e),style:this.extractPivotStyleInfo(e)}))[0]}extractPivotLocation(e){return this.mapOnElements({query:`location`,parent:e},e=>({ref:this.extractAttr(e,`ref`,{required:!0}).asString(),firstHeaderRow:this.extractAttr(e,`firstHeaderRow`,{required:!0}).asNum(),firstDataRow:this.extractAttr(e,`firstDataRow`,{required:!0}).asNum(),firstDataCol:this.extractAttr(e,`firstDataCol`,{required:!0}).asNum()}))[0]}extractPivotStyleInfo(e){return this.mapOnElements({query:`pivotTableStyleInfo`,parent:e},e=>({name:this.extractAttr(e,`name`,{required:!0}).asString(),showRowHeaders:this.extractAttr(e,`showRowHeaders`,{required:!0}).asBool(),showColHeaders:this.extractAttr(e,`showColHeaders`,{required:!0}).asBool(),showRowStripes:this.extractAttr(e,`showRowStripes`,{required:!0}).asBool(),showColStripes:this.extractAttr(e,`showColStripes`,{required:!0}).asBool(),showLastColumn:this.extractAttr(e,`showLastColumn`)?.asBool()}))[0]}},bh=class extends dh{getTable(){return this.mapOnElements({query:`table`,parent:this.rootFile.file.xml},e=>({displayName:this.extractAttr(e,`displayName`,{required:!0}).asString(),name:this.extractAttr(e,`name`)?.asString(),id:this.extractAttr(e,`id`,{required:!0}).asString(),ref:this.extractAttr(e,`ref`,{required:!0}).asString(),headerRowCount:this.extractAttr(e,`headerRowCount`,{default:1}).asNum(),totalsRowCount:this.extractAttr(e,`totalsRowCount`,{default:0}).asNum(),cols:this.extractTableCols(e),style:this.extractTableStyleInfo(e),autoFilter:this.extractTableAutoFilter(e)}))[0]}extractTableCols(e){return this.mapOnElements({query:`tableColumn`,parent:e},e=>({id:this.extractAttr(e,`id`,{required:!0}).asString(),name:this.extractAttr(e,`name`,{required:!0}).asString(),colFormula:this.extractChildTextContent(e,`calculatedColumnFormula`)}))}extractTableStyleInfo(e){return this.mapOnElements({query:`tableStyleInfo`,parent:e},e=>({name:this.extractAttr(e,`name`)?.asString(),showFirstColumn:this.extractAttr(e,`showFirstColumn`)?.asBool(),showLastColumn:this.extractAttr(e,`showLastColumn`)?.asBool(),showRowStripes:this.extractAttr(e,`showRowStripes`)?.asBool(),showColumnStripes:this.extractAttr(e,`showColumnStripes`)?.asBool()}))[0]}extractTableAutoFilter(e){return this.mapOnElements({query:`autoFilter`,parent:e},e=>({columns:this.extractFilterColumns(e),zone:this.extractAttr(e,`ref`,{required:!0}).asString()}))[0]}extractFilterColumns(e){return this.mapOnElements({query:`tableColumn`,parent:e},t=>({colId:this.extractAttr(e,`colId`,{required:!0}).asNum(),hiddenButton:this.extractAttr(e,`hiddenButton`,{default:!1}).asBool(),filters:this.extractSimpleFilter(t)}))}extractSimpleFilter(e){return this.mapOnElements({query:`filter`,parent:e},e=>({val:this.extractAttr(e,`val`,{required:!0}).asString()}))}},xh=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}getSheet(){return this.mapOnElements({query:`worksheet`,parent:this.rootFile.file.xml},e=>{let t=this.getSheetWorkbookInfo();return{sheetName:this.extractSheetName(),sheetViews:this.extractSheetViews(e),sheetFormat:this.extractSheetFormat(e),sheetProperties:this.extractSheetProperties(e),cols:this.extractCols(e),rows:this.extractRows(e),sharedFormulas:this.extractSharedFormulas(e),merges:this.extractMerges(e),cfs:this.extractConditionalFormats(),dataValidations:this.extractDataValidations(),figures:this.extractFigures(e),hyperlinks:this.extractHyperLinks(e),tables:this.extractTables(e),pivotTables:this.extractPivotTables(),isVisible:t.state===`visible`}})[0]}extractSheetViews(e){return this.mapOnElements({parent:e,query:`sheetView`},e=>{let t=this.querySelector(e,`pane`);return{tabSelected:this.extractAttr(e,`tabSelected`,{default:!1}).asBool(),showFormulas:this.extractAttr(e,`showFormulas`,{default:!1}).asBool(),showGridLines:this.extractAttr(e,`showGridLines`,{default:!0}).asBool(),showRowColHeaders:this.extractAttr(e,`showRowColHeaders`,{default:!0}).asBool(),pane:{xSplit:t?this.extractAttr(t,`xSplit`,{default:0}).asNum():0,ySplit:t?this.extractAttr(t,`ySplit`,{default:0}).asNum():0}}})}extractSheetName(){let e=Df(this.xlsxFileStructure.workbook.file.fileName,this.rootFile.file.fileName),t=this.extractRelationships(this.xlsxFileStructure.workbook.rels).find(t=>t.target===e).id;for(let e of this.querySelectorAll(this.xlsxFileStructure.workbook.file.xml,`sheet`))if(e.attributes[`r:id`].value===t)return e.attributes.name.value;throw Error(`Missing sheet name`)}getSheetWorkbookInfo(){let e=Df(this.xlsxFileStructure.workbook.file.fileName,this.rootFile.file.fileName),t=this.extractRelationships(this.xlsxFileStructure.workbook.rels).find(t=>t.target===e).id,n=this.mapOnElements({parent:this.xlsxFileStructure.workbook.file.xml,query:`sheet`},e=>({relationshipId:this.extractAttr(e,`r:id`,{required:!0}).asString(),sheetId:this.extractAttr(e,`sheetId`,{required:!0}).asString(),sheetName:this.extractAttr(e,`name`,{required:!0}).asString(),state:this.extractAttr(e,`state`,{default:`visible`}).asString()})).find(e=>e.relationshipId===t);if(!n)throw Error(`Cannot find corresponding workbook sheet`);return n}extractConditionalFormats(){return new ph(this.rootFile,this.xlsxFileStructure,this.warningManager,this.theme).extractConditionalFormattings()}extractDataValidations(){return new mh(this.rootFile,this.xlsxFileStructure,this.warningManager,this.theme).extractDataValidations()}extractFigures(e){return this.mapOnElements({parent:e,query:`drawing`},e=>{let t=this.extractAttr(e,`r:id`,{required:!0}).asString();return new vh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).extractFigures()})[0]||[]}extractTables(e){return this.mapOnElements({query:`tablePart`,parent:e},e=>{let t=this.extractAttr(e,`r:id`,{required:!0}).asString();return new bh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).getTable()})}extractPivotTables(){try{return Object.values(this.relationships).filter(e=>e.type.endsWith(`pivotTable`)).map(e=>new yh(this.getTargetXmlFile(e),this.xlsxFileStructure,this.warningManager).getPivotTable())}catch(e){return this.catchErrorOnElement(e),[]}}extractMerges(e){return this.mapOnElements({parent:e,query:`mergeCell`},e=>this.extractAttr(e,`ref`,{required:!0}).asString())}extractSheetFormat(e){let t=this.querySelector(e,`sheetFormatPr`);if(t)return{defaultColWidth:this.extractAttr(t,`defaultColWidth`,{default:`8.43`}).asNum(),defaultRowHeight:this.extractAttr(t,`defaultRowHeight`,{default:`12.75`}).asNum()}}extractSheetProperties(e){let t=this.querySelector(e,`sheetPr`);if(t)return{outlinePr:this.extractSheetOutlineProperties(t),tabColor:this.extractColor(this.querySelector(t,`tabColor`),this.theme)}}extractSheetOutlineProperties(e){let t=this.querySelector(e,`outlinePr`);if(t)return{summaryBelow:this.extractAttr(t,`summaryBelow`,{default:!0}).asBool(),summaryRight:this.extractAttr(t,`summaryRight`,{default:!0}).asBool()}}extractCols(e){return this.mapOnElements({parent:e,query:`cols col`},e=>({width:this.extractAttr(e,`width`)?.asNum(),customWidth:this.extractAttr(e,`customWidth`)?.asBool(),bestFit:this.extractAttr(e,`bestFit`)?.asBool(),hidden:this.extractAttr(e,`hidden`)?.asBool(),min:this.extractAttr(e,`min`,{required:!0}).asNum(),max:this.extractAttr(e,`max`,{required:!0}).asNum(),styleIndex:this.extractAttr(e,`style`)?.asNum(),outlineLevel:this.extractAttr(e,`outlineLevel`)?.asNum(),collapsed:this.extractAttr(e,`collapsed`)?.asBool()}))}extractRows(e){let t=new Set;return this.mapOnElements({parent:e,query:`sheetData row`},e=>({index:this.extractAttr(e,`r`,{required:!0}).asNum(),cells:this.extractCells(e,t),height:this.extractAttr(e,`ht`)?.asNum(),customHeight:this.extractAttr(e,`customHeight`)?.asBool(),hidden:this.extractAttr(e,`hidden`)?.asBool(),styleIndex:this.extractAttr(e,`s`)?.asNum(),outlineLevel:this.extractAttr(e,`outlineLevel`)?.asNum(),collapsed:this.extractAttr(e,`collapsed`)?.asBool()}))}extractCells(e,t){return this.mapOnElements({parent:e,query:`c`},e=>{let n=this.extractAttr(e,`r`,{required:!0}).asString(),r=this.extractCellFormula(e);if(r?.ref&&r.sharedIndex===void 0){let e=$n(r.ref);for(let{col:r,row:i}of vr(e)){let e=w(r,i);e!==n&&t.add(e)}}let i=t.has(n);return{xc:n,styleIndex:this.extractAttr(e,`s`)?.asNum(),type:zf[this.extractAttr(e,`t`,{default:`n`}).asString()],value:i?void 0:this.extractChildTextContent(e,`v`)??void 0,formula:i?void 0:r}})}extractCellFormula(e){let t=this.querySelector(e,`f`);if(!t)return;let n=this.extractTextContent(t),r=this.extractAttr(t,`si`)?.asNum(),i=this.extractAttr(t,`ref`)?.asString();if(!((n===void 0||n.trim()===``)&&r===void 0))return{content:n,sharedIndex:r,ref:i}}extractHyperLinks(e){return this.mapOnElements({parent:e,query:`hyperlink`},e=>{let t=this.extractAttr(e,`r:id`)?.asString();return{xc:this.extractAttr(e,`ref`,{required:!0})?.asString(),location:this.extractAttr(e,`location`)?.asString(),display:this.extractAttr(e,`display`)?.asString(),relTarget:t?this.relationships[t].target:void 0}})}extractSharedFormulas(e){let t=this.querySelectorAll(e,`f[si][ref]`),n={};for(let e of t){let t=this.extractAttr(e,`si`,{required:!0}).asNum();n[t]=this.extractTextContent(e,{required:!0})}let r=[];for(let e=0;e<Object.keys(n).length;e++)n[e]?r.push(n[e]):(this.warningManager.addParsingWarning(`Missing shared formula ${e}, replacing it by empty formula`),r.push(``));return r}},Sh=class extends dh{theme;constructor(e,t,n){super(e.styles,e,t),this.theme=n}getNumFormats(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`numFmt`},e=>this.extractNumFormats(e))}extractNumFormats(e){return{id:this.extractAttr(e,`numFmtId`,{required:!0}).asNum(),format:this.extractAttr(e,`formatCode`,{required:!0,default:``}).asString()}}getFonts(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`font`},e=>this.extractFont(e))}extractFont(e){let t=this.extractChildAttr(e,`name`,`val`,{default:`Arial`}).asString(),n=this.extractChildAttr(e,`sz`,`val`,{default:Re.toString()}).asNum(),r=this.extractColor(this.querySelector(e,`color`),this.theme),i=this.querySelector(e,`i`)||void 0,a=i&&i.attributes.val?.value!==`0`,o=this.querySelector(e,`b`)||void 0,s=o&&o.attributes.val?.value!==`0`,c=this.querySelector(e,`strike`)||void 0,l=c&&c.attributes.val?.value!==`0`,u=this.querySelector(e,`u`)||void 0;return{name:t,size:n,color:r,italic:a,bold:s,underline:u&&u.attributes.val?.value!==`none`,strike:l}}getFills(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`fill`},e=>this.extractFill(e))}extractFill(e){let t=e.children[0];return t.tagName===`patternFill`?{patternType:t.attributes.patternType?.value,bgColor:this.extractColor(this.querySelector(t,`bgColor`),this.theme),fgColor:this.extractColor(this.querySelector(t,`fgColor`),this.theme)}:{patternType:`solid`,fgColor:this.extractColor(this.querySelectorAll(t,`color`)[1],this.theme)}}getBorders(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`border`},e=>this.extractBorder(e))}extractBorder(e){let t={left:this.extractSingleBorder(e,`left`,this.theme),right:this.extractSingleBorder(e,`right`,this.theme),top:this.extractSingleBorder(e,`top`,this.theme),bottom:this.extractSingleBorder(e,`bottom`,this.theme),diagonal:this.extractSingleBorder(e,`diagonal`,this.theme)};return t.diagonal&&(t.diagonalUp=this.extractAttr(e,`diagonalUp`)?.asBool(),t.diagonalDown=this.extractAttr(e,`diagonalDown`)?.asBool()),t}extractSingleBorder(e,t,n){let r=this.querySelector(e,t);if(!(!r||!r.attributes.style))return{style:this.extractAttr(r,`style`,{required:!0,default:`thin`}).asString(),color:this.extractColor(r.children[0],n,`000000`)}}extractAlignment(e){return{horizontal:this.extractAttr(e,`horizontal`,{default:`general`}).asString(),vertical:this.extractAttr(e,`vertical`,{default:`bottom`}).asString(),textRotation:this.extractAttr(e,`textRotation`)?.asNum(),wrapText:this.extractAttr(e,`wrapText`)?.asBool(),indent:this.extractAttr(e,`indent`)?.asNum(),relativeIndent:this.extractAttr(e,`relativeIndent`)?.asNum(),justifyLastLine:this.extractAttr(e,`justifyLastLine`)?.asBool(),shrinkToFit:this.extractAttr(e,`shrinkToFit`)?.asBool(),readingOrder:this.extractAttr(e,`readingOrder`)?.asNum()}}getDxfs(){return this.mapOnElements({query:`dxf`,parent:this.rootFile.file.xml},e=>{let t=this.querySelector(e,`font`),n=this.querySelector(e,`fill`),r=this.querySelector(e,`border`),i=this.querySelector(e,`numFmt`),a=this.querySelector(e,`alignment`);return{font:t?this.extractFont(t):void 0,fill:n?this.extractFill(n):void 0,numFmt:i?this.extractNumFormats(i):void 0,alignment:a?this.extractAlignment(a):void 0,border:r?this.extractBorder(r):void 0}})}getStyles(){return this.mapOnElements({query:`cellXfs xf`,parent:this.rootFile.file.xml},e=>{let t=this.querySelector(e,`alignment`);return{fontId:this.extractAttr(e,`fontId`,{required:!0,default:0}).asNum(),fillId:this.extractAttr(e,`fillId`,{required:!0,default:0}).asNum(),borderId:this.extractAttr(e,`borderId`,{required:!0,default:0}).asNum(),numFmtId:this.extractAttr(e,`numFmtId`,{required:!0,default:0}).asNum(),alignment:t?this.extractAlignment(t):void 0}})}},Ch=class extends dh{getExternalBook(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`externalBook`},e=>({rId:this.extractAttr(e,`r:id`,{required:!0}).asString(),sheetNames:this.mapOnElements({parent:e,query:`sheetName`},e=>this.extractAttr(e,`val`,{required:!0}).asString()),datasets:this.extractExternalSheetData(e)}))[0]}extractExternalSheetData(e){return this.mapOnElements({parent:e,query:`sheetData`},e=>{let t=this.mapOnElements({parent:e,query:`cell`},e=>({xc:this.extractAttr(e,`r`,{required:!0}).asString(),value:this.extractChildTextContent(e,`v`,{required:!0})})),n={};for(let e of t)n[e.xc]=e.value;return{sheetId:this.extractAttr(e,`sheetId`,{required:!0}).asNum(),data:n}})}};function wh(e,t){return Th(Eh(e,t),t)}function Th(e,t){let n=[];for(let r of e){let e=Dh(r,t);n.push({file:{fileName:r,xml:t[r]},rels:e?{fileName:e,xml:t[e]}:void 0})}return n}function Eh(e,t){let n=t[`[Content_Types].xml`].querySelectorAll(`Override[ContentType="${e}"]`),r=[];for(let e of n){let t=e?.attributes.PartName.value;r.push(t.substring(1))}return r}function Dh(e,t){if(e===`[Content_Types].xml`)return`_rels/.rels`;let n=``,r=e.split(`/`);for(let e=0;e<r.length-1;e++)n+=r[e]+`/`;return n+=`_rels/`,n+=r[r.length-1]+`.rels`,t[n]||(n=void 0),n}var Oh=class{warningManager;xmls;images;constructor(e){this.warningManager=new Mf,this.xmls={},this.images=[];for(let t of Object.keys(e))if(t.endsWith(`.xml`)||t.endsWith(`.rels`)){let n=ch(e[t]);this.xmls[t]=nh(new Zd(n))}else t.includes(`media/image`)&&this.images.push({fileName:t,imageSrc:e[t].imageSrc})}convertXlsx(){let e=this.getXlsxData();return this.convertImportedData(e)}getXlsxData(){let e=this.buildXlsxFileStructure(),t=e.theme?new fh(e.theme,e,this.warningManager).getTheme():void 0,n=e.sharedStrings?new fh(e.sharedStrings,e,this.warningManager).getSharedStrings():[],r=e.sheets.sort((e,t)=>e.file.fileName.localeCompare(t.file.fileName,void 0,{numeric:!0})).map(n=>new xh(n,e,this.warningManager,t).getSheet()),i=e.externalLinks.map(t=>new Ch(t,e,this.warningManager).getExternalBook()),a=new Sh(e,this.warningManager,t);return{fonts:a.getFonts(),fills:a.getFills(),borders:a.getBorders(),dxfs:a.getDxfs(),numFmts:a.getNumFormats(),styles:a.getStyles(),sheets:r,sharedStrings:n,externalBooks:i}}buildXlsxFileStructure(){let e={sheets:wh(af.sheet,this.xmls),workbook:wh(af.workbook,this.xmls)[0],styles:wh(af.styles,this.xmls)[0],sharedStrings:wh(af.sharedStrings,this.xmls)[0],theme:wh(af.themes,this.xmls)[0],charts:wh(af.chart,this.xmls),figures:wh(af.drawing,this.xmls),tables:wh(af.table,this.xmls),pivots:wh(af.pivot,this.xmls),externalLinks:wh(af.externalLink,this.xmls),images:this.images};if(!e.workbook.rels)throw Error(T(`Cannot find workbook relations file`));return e}convertImportedData(e){let t={version:21,sheets:_m(e,this.warningManager),styles:hp(e,this.warningManager),formats:_p(e,this.warningManager),borders:pp(e,this.warningManager),revisionId:Ve};return Km(t,e),Object.keys(e.styles).map(t=>{e.styles[t]=jt(e.styles[t])}),t}};let kh=(e,t=()=>!0)=>[{goTo:e,guard:t}],Ah=(e,t=()=>!0)=>({goTo:e,guard:t}),jh={0:{REFERENCE:kh(2),NUMBER:kh(4),SYMBOL:[Ah(3,e=>Ls(e.value)),Ah(4,e=>Rs(e.value))]},3:{SPACE:kh(3),OPERATOR:kh(5,e=>e.value===`:`)},4:{SPACE:kh(4),OPERATOR:kh(6,e=>e.value===`:`)},2:{SPACE:kh(2),OPERATOR:kh(1,e=>e.value===`:`)},1:{SPACE:kh(1),NUMBER:kh(7),REFERENCE:kh(7,e=>Vs(e.value)),SYMBOL:kh(7,e=>zs(e.value)||Bs(e.value))},5:{SPACE:kh(5),SYMBOL:kh(7,e=>zs(e.value)),REFERENCE:kh(7,e=>Vs(e.value))},6:{SPACE:kh(6),NUMBER:kh(7),REFERENCE:kh(7,e=>Vs(e.value)),SYMBOL:kh(7,e=>Bs(e.value))},7:{}};function Mh(e){let t=0,n=jh[0],r=``;for(;n!==void 0;){let i=e[t++];if(!i)return null;let a=n[i.type]?.find(e=>e.guard(i)),o=a?a.goTo:void 0;switch(o){case void 0:return null;case 7:return r+=i.value,e.splice(0,t),{type:`REFERENCE`,value:r};default:n=jh[o],r+=i.value;break}}return null}function Nh(e,t=O){let n=zc(e,t),r=[];for(;n.length;)r.push(Mh(n)||n.shift());return r}function Ph(e){let t=Nh(e),n=[];return{text:``.concat(...t.map(e=>{if(e.type===`REFERENCE`&&As.test(e.value)){let t=e.value.trim();return n.includes(t)||n.push(t),`|${n.indexOf(t)}|`}else return e.value})),dependencies:n}}let Fh={am_ET:7,ar_001:6,ar_SY:6,az_AZ:1,eu_ES:1,be_BY:1,bn_IN:1,bs_BA:1,bg_BG:1,ca_ES:1,zh_CN:7,zh_HK:7,zh_TW:7,hr_HR:1,cs_CZ:1,da_DK:1,nl_BE:1,nl_NL:1,en_AU:7,en_CA:7,en_GB:1,en_IN:7,en_NZ:7,et_EE:1,fi_FI:1,fr_BE:1,fr_CA:7,fr_CH:1,fr_FR:1,gl_ES:1,ka_GE:1,de_DE:1,de_CH:1,el_GR:1,gu_IN:7,he_IL:7,hi_IN:7,hu_HU:1,id_ID:7,it_IT:1,ja_JP:7,kab_DZ:6,km_KH:7,ko_KP:1,ko_KR:7,lo_LA:7,lv_LV:1,lt_LT:1,lb_LU:1,mk_MK:1,ml_IN:1,mn_MN:7,ms_MY:1,nb_NO:1,fa_IR:6,pl_PL:1,pt_AO:1,pt_BR:7,pt_PT:1,ro_RO:1,ru_RU:1,sr_RS:7,"sr@latin":7,sk_SK:1,sl_SI:1,es_AR:7,es_BO:1,es_CL:1,es_CO:7,es_CR:1,es_DO:1,es_EC:1,es_GT:7,es_MX:7,es_PA:7,es_PE:7,es_PY:7,es_UY:1,es_VE:7,sw:1,sv_SE:1,th_TH:7,tl_PH:1,tr_TR:1,uk_UA:1,vi_VN:1,sq_AL:1,te_IN:7,en_US:7,my_MM:7,es_ES:1,es_419:1},Ih=new h;Ih.add(`migration_1`,{versionFrom:`1`,migrate(e){return e.sheets&&e.sheets[0]&&(e.activeSheet=e.sheets[0].name),e}}).add(`migration_2`,{versionFrom:`2`,migrate(e){if(e.sheets&&e.sheets.length)for(let t of e.sheets)t.id=t.id||t.name;return e}}).add(`migration_3`,{versionFrom:`3`,migrate(e){return e.sheets&&e.activeSheet&&(e.activeSheet=e.sheets.find(t=>t.name===e.activeSheet).id),e}}).add(`migration_4`,{versionFrom:`4`,migrate(e){for(let t of e.sheets||[])t.figures=t.figures||[];return e}}).add(`migration_5`,{versionFrom:`5`,migrate(e){for(let t of e.sheets||[])for(let e in t.cells||[]){let n=t.cells[e];n.content&&n.content.startsWith(`=`)&&(n.formula=Ph(n.content))}return e}}).add(`migration_6`,{versionFrom:`6`,migrate(e){for(let t of e.sheets||[])for(let e in t.figures||[]){let{dataSets:n,...r}=t.figures[e].data,i=[];for(let e of n)if(e.labelCell){let t=$n(e.dataRange),n=e.labelCell+`:`+w(t.right,t.bottom);i.push(n)}else i.push(e.dataRange);r.dataSetsHaveTitle=!!n[0].labelCell,r.dataSets=i,t.figures[e].data=r}return e}}).add(`migration_7`,{versionFrom:`7`,migrate(e){let t=[];for(let n of e.sheets||[]){if(!n.name)continue;let e=n.name,r=st(e,`_`),i=1,a=r;for(;t.includes(a);)a=`${r}${i}`,i++;n.name=a,t.push(a);let o=t=>{if(t===void 0)return t;let n=t.replace(e,a),r=t;for(;r!==n;)r=n,n=r.replace(e,a);return r};for(let e in n.cells){let t=n.cells[e];t.formula&&(t.formula.dependencies=t.formula.dependencies.map(o))}for(let e of n.figures||[])if(e.type===`chart`){let t=e.data.dataSets.map(o),n=o(e.data.labelRange);e.data={...e.data,dataSets:t,labelRange:n}}for(let e of n.conditionalFormats||[]){e.ranges=e.ranges.map(o);for(let t of[`minimum`,`maximum`,`midpoint`,`upperInflectionPoint`,`lowerInflectionPoint`])e.rule[t]?.type===`formula`&&(e.rule[t].value=o(e.rule[t].value))}}return e}}).add(`migration_8`,{versionFrom:`8`,migrate(e){for(let t of e.sheets||[])for(let e of t.figures||[])e.data.background=oe,e.data.verticalAxisPosition=`left`,e.data.legendPosition=`top`,e.data.stacked=!1;return e}}).add(`migration_9`,{versionFrom:`9`,migrate(e){for(let t of e.sheets||[])for(let e in t.cells||[]){let n=t.cells[e];if(n.formula){let{text:e,dependencies:t}=n.formula;for(let[n,r]of Object.entries(t)){let t=`\\|${n}\\|`;e=e.replace(new RegExp(t,`g`),r)}n.content=e,delete n.formula}}return e}}).add(`migration_10`,{versionFrom:`10`,migrate(e){let t={};for(let n of e.sheets||[])for(let e in n.cells||[]){let r=n.cells[e];r.format&&=Fr(r.format,t)}return e.formats=t,e}}).add(`migration_11`,{versionFrom:`11`,migrate(e){for(let t of e.sheets||[])t.isVisible=!0;return e}}).add(`migration_12`,{versionFrom:`12`,migrate(e){return Lh(e)}}).add(`migration_12_5`,{versionFrom:`12.5`,migrate(e){for(let t in e.borders){let n=e.borders[t];for(let e in n)Array.isArray(n[e])&&(n[e]={style:n[e][0],color:n[e][1]})}return e}}).add(`migration_13`,{versionFrom:`13`,migrate(e){return e.settings||={},e.settings.locale||(e.settings.locale=O),e}}).add(`migration_14`,{versionFrom:`14`,migrate(e){return Lh(e)}}).add(`migration_14_5`,{versionFrom:`14.5`,migrate(e){for(let t of e.sheets||[])t.tables=t.tables||t.filterTables||[],delete t.filterTables;return e}}).add(`migration_15`,{versionFrom:`15`,migrate(e){return e.pivots||={},e.pivotNextId||=ku(e.pivots)+1,e}}).add(`migration_16`,{versionFrom:`16`,migrate(e){for(let t of e.sheets||[])for(let e in t.figures||[]){let n=t.figures[e];`title`in n.data&&typeof n.data.title==`string`&&(n.data.title={text:n.data.title});let r=n.data.type;if(![`line`,`bar`,`pie`,`scatter`,`waterfall`,`combo`].includes(r))continue;let{dataSets:i,...a}=t.figures[e].data;a.dataSets=i.map(e=>({dataRange:e})),t.figures[e].data=a}return e}}).add(`migration_17`,{versionFrom:`17`,migrate(e){return e}}).add(`migration_18`,{versionFrom:`18`,migrate(e){for(let t of Object.values(e.pivots||{}))t.measures=t.measures.map(e=>({id:e.name,fieldName:e.name,aggregator:e.aggregator})),t.columns=t.columns.map(e=>({fieldName:e.name,order:e.order,granularity:e.granularity})),t.rows=t.rows.map(e=>({fieldName:e.name,order:e.order,granularity:e.granularity}));return e}}).add(`migration_19`,{versionFrom:`19`,migrate(e){let t=e.settings?.locale;return t&&(t.weekStart=Fh[t.code]||1),e}}).add(`migration_20`,{versionFrom:`20`,migrate(e){for(let t of e.sheets||[]){t.styles={},t.formats={},t.borders={};for(let e in t.cells)t.styles[e]=t.cells[e].style,t.formats[e]=t.cells[e].format,t.borders[e]=t.cells[e].border,delete t.cells[e].style,delete t.cells[e].format,delete t.cells[e].border}return e}}).add(`migration_21`,{versionFrom:`21`,migrate(e){for(let t of e.sheets||[])for(let e of t.figures||[]){if(e.tag!==`chart`||e.data.type!==`gauge`)continue;let t=e.data;t?.sectionRule?.lowerInflectionPoint&&(t.sectionRule.lowerInflectionPoint.operator=`<=`),t?.sectionRule?.upperInflectionPoint&&(t.sectionRule.upperInflectionPoint.operator=`<=`)}return e}});function Lh(e){for(let t of e.sheets||[]){let e=[];for(let n of t.filterTables||[]){let t=$n(n.range),r=e.findIndex(e=>dr(e,t));r===-1?e.push(t):e[r]=t}t.filterTables=e.map(e=>({range:nr(e)}))}return e}let Rh=`Sheet1`;function zh(e,t){if(!e)return Zh();console.debug(`### Loading data ###`);let n=performance.now();if(e[`[Content_Types].xml`]){let n=new Oh(e);if(e=n.convertXlsx(),t)for(let e of n.warningManager.warnings.sort())console.warn(e)}return`version`in e&&e.version<22&&(console.debug(`Migrating data from version`,e.version),e=Vh(e)),e=Hh(e),console.debug(`Data loaded in`,performance.now()-n,`ms`),console.debug(`###`),e}function Bh(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]||0,i=r[e]||0;if(t>i)return 1;if(t<i)return-1}return 0}function Vh(e){let t=performance.now(),n=Ih.getAll().sort((e,t)=>Bh(e.versionFrom,t.versionFrom)),r=n.findIndex(t=>t.versionFrom===e.version.toString());for(let t=r;t<n.length;t++)e=n[t].migrate(e);return console.debug(`Data migrated in`,performance.now()-t,`ms`),e}function Hh(e){return e=Uh(e),e=Wh(e),e}function Uh(e){if(e.uniqueFigureIds)return e;let t=new Set,n=new Tc;for(let r of e.sheets||[])for(let e of r.figures||[])t.has(e.id)&&(e.id+=n.uuidv4()),t.add(e.id);return e.uniqueFigureIds=!0,e}function Wh(e){let t=Object.assign(Zh(),e,{version:22});return t.sheets=t.sheets?t.sheets.map((e,t)=>Object.assign(Xh(`Sheet${t+1}`,`Sheet${t+1}`),e)):[],t.sheets.length===0&&t.sheets.push(Xh(Rh,`Sheet1`)),tl(t.settings.locale)||(t.settings.locale=O),t}function Gh(e,t){return t=Kh(e,t),t=qh(t,`SORT_CELLS`),t=qh(t,`SET_DECIMAL`),t=Jh(e,t),t=Yh(e,t),t}function Kh(e,t){if(Object.keys(e).length!==0)return t;let n=[],r=[],i=e=>{if(e.type===`CREATE_SHEET`)n.push(e.sheetId);else if(`sheetId`in e&&!n.includes(e.sheetId))return{...e,sheetId:Rh};return e};for(let e of t)e.type===`REMOTE_REVISION`?r.push({...e,commands:e.commands.map(i)}):r.push(e);return r}function qh(e,t){let n=[];for(let r of e)r.type===`REMOTE_REVISION`?n.push({...r,commands:r.commands.filter(e=>e.type!==t)}):n.push(r);return n}function Jh(e,t){let n=[],r={};for(let t of e.sheets||[])t.figures?.forEach(e=>{e.tag===`chart`&&(r[e.id]=e.data)});for(let e of t)if(e.type===`REMOTE_REVISION`){let t=[];for(let n of e.commands){let e=n;switch(n.type){case`CREATE_CHART`:r[n.id]=n.definition;break;case`UPDATE_CHART`:if(!r[n.id]){console.log(`Fix chart definition: chart with id ${n.id} not found.`);continue}let t={...r[n.id],...n.definition};e={...n,definition:t},r[n.id]=t;break}t.push(e)}n.push({...e,commands:t})}else n.push(e);return n}function Yh(e,t){let n={};for(let t of e.sheets||[])n[t.id]=t.name;let r=[];for(let e of t)if(e.type===`REMOTE_REVISION`){let t=[];for(let r of e.commands){switch(r.type){case`DUPLICATE_SHEET`:r.sheetNameTo=r.sheetNameTo??tc(n[r.sheetId],Object.values(n));break;case`CREATE_SHEET`:case`RENAME_SHEET`:n[r.sheetId]=r.name||ec(Object.values(n));break}t.push(r)}r.push({...e,commands:t})}else r.push(e);return t}function Xh(e,t){return{id:e,name:t,colNumber:26,rowNumber:100,cells:{},styles:{},formats:{},borders:{},cols:{},rows:{},merges:[],conditionalFormats:[],dataValidationRules:[],figures:[],tables:[],isVisible:!0}}function Zh(e=`Sheet1`){return{version:22,sheets:[Xh(Rh,e)],styles:{},formats:{},borders:{},revisionId:Ve,uniqueFigureIds:!0,settings:{locale:O},pivots:{},pivotNextId:1,customTableStyles:{}}}function Qh(e,t){return{...Xh(e,t),charts:[],images:[]}}function $h(){return{...Zh(),sheets:[Qh(Rh,`Sheet1`)]}}let eg={wrongPasteSelection:T(`This operation is not allowed with multiple selections.`),willRemoveExistingMerge:T(`This operation is not possible due to a merge. Please remove the merges first than try again.`),wrongFigurePasteOption:T(`Cannot do a special paste of a figure.`),frozenPaneOverlap:T(`This operation is not allowed due to an overlapping frozen pane.`)};function tg(e,t){t.isSuccessful||(t.reasons.includes(`WrongPasteSelection`)?e.raiseError(eg.wrongPasteSelection):t.reasons.includes(`WillRemoveExistingMerge`)?e.raiseError(eg.willRemoveExistingMerge):t.reasons.includes(`WrongFigurePasteOption`)?e.raiseError(eg.wrongFigurePasteOption):t.reasons.includes(`FrozenPaneOverlap`)&&e.raiseError(eg.frozenPaneOverlap))}function ng(e,t,n){tg(e,e.model.dispatch(`PASTE`,{target:t,pasteOption:n}))}function rg(e,t,n,r){n.data&&n.data.version!==22&&e.notifyUser({type:`warning`,text:T(`You copied content from a different version of the application. Only text content will be pasted.`),sticky:!1}),tg(e,e.model.dispatch(`PASTE_FROM_OS_CLIPBOARD`,{target:t,clipboardContent:n,pasteOption:r}))}let ig={Errors:{InvalidRange:T(`The range is invalid`),FirstArgMissing:T(`The argument is missing. Please provide a value`),SecondArgMissing:T(`The second argument is missing. Please provide a value`),MinNaN:T(`The minpoint must be a number`),MidNaN:T(`The midpoint must be a number`),MaxNaN:T(`The maxpoint must be a number`),ValueUpperInflectionNaN:T(`The first value must be a number`),ValueLowerInflectionNaN:T(`The second value must be a number`),MinBiggerThanMax:T(`Minimum must be smaller then Maximum`),MinBiggerThanMid:T(`Minimum must be smaller then Midpoint`),MidBiggerThanMax:T(`Midpoint must be smaller then Maximum`),LowerBiggerThanUpper:T(`Lower inflection point must be smaller than upper inflection point`),MinInvalidFormula:T(`Invalid Minpoint formula`),MaxInvalidFormula:T(`Invalid Maxpoint formula`),MidInvalidFormula:T(`Invalid Midpoint formula`),ValueUpperInvalidFormula:T(`Invalid upper inflection point formula`),ValueLowerInvalidFormula:T(`Invalid lower inflection point formula`),EmptyRange:T(`A range needs to be defined`),ValueCellIsInvalidFormula:T(`At least one of the provided values is an invalid formula`),Unexpected:T(`The rule is invalid for an unknown reason`)},ColorScale:T(`Color scale`),IconSet:T(`Icon set`),DataBar:T(`Data bar`)},ag={IsEmpty:T(`Is empty`),IsNotEmpty:T(`Is not empty`),ContainsText:T(`Contains`),NotContains:T(`Does not contain`),BeginsWith:T(`Starts with`),EndsWith:T(`Ends with`),Equal:T(`Is equal to`),NotEqual:T(`Is not equal to`),GreaterThan:T(`Is greater than`),GreaterThanOrEqual:T(`Is greater than or equal to`),LessThan:T(`Is less than`),LessThanOrEqual:T(`Is less than or equal to`),Between:T(`Is between`),NotBetween:T(`Is not between`)},og={Series:T(`Series`),BackgroundColor:T(`Background color`),StackedBarChart:T(`Stacked bar chart`),StackedLineChart:T(`Stacked line chart`),StackedAreaChart:T(`Stacked area chart`),StackedColumnChart:T(`Stacked column chart`),CumulativeData:T(`Cumulative data`),TreatLabelsAsText:T(`Treat labels as text`),AggregatedChart:T(`Aggregate`),Errors:{Unexpected:T(`The chart definition is invalid for an unknown reason`),InvalidDataSet:T(`The dataset is invalid`),InvalidLabelRange:T(`Labels are invalid`),InvalidScorecardKeyValue:T(`The key value is invalid`),InvalidScorecardBaseline:T(`The baseline value is invalid`),InvalidGaugeDataRange:T(`The data range is invalid`),EmptyGaugeRangeMin:T(`A minimum range limit value is needed`),GaugeRangeMinNaN:T(`The minimum range limit value must be a number`),EmptyGaugeRangeMax:T(`A maximum range limit value is needed`),GaugeRangeMaxNaN:T(`The maximum range limit value must be a number`),GaugeRangeMinBiggerThanRangeMax:T(`Minimum range limit must be smaller than maximum range limit`),GaugeLowerInflectionPointNaN:T(`The lower inflection point value must be a number`),GaugeUpperInflectionPointNaN:T(`The upper inflection point value must be a number`)}},sg={Custom:T(`Custom`)},cg=T(`Merged cells are preventing this operation. Unmerge those cells and try again.`),lg=T(`The header row of a table can't be moved.`),ug={Errors:{Unexpected:T(`Cannot split the selection for an unknown reason`),NoSplitSeparatorInSelection:T(`There is no match for the selected separator in the selection`),MoreThanOneColumnSelected:T(`Only a selection from a single column can be split`),SplitWillOverwriteContent:T(`Splitting will overwrite existing content`)}},dg={Errors:{Unexpected:T(`Cannot remove duplicates for an unknown reason`),MoreThanOneRangeSelected:T(`Please select only one range of cells`),EmptyTarget:T(`Please select a range of cells containing values.`),NoColumnsProvided:T(`Please select at latest one column to analyze.`),WillRemoveExistingMerge:eg.willRemoveExistingMerge}},fg={DateIs:{today:T(`today`),yesterday:T(`yesterday`),tomorrow:T(`tomorrow`),lastWeek:T(`in the past week`),lastMonth:T(`in the past month`),lastYear:T(`in the past year`)},DateIsBefore:{today:T(`today`),yesterday:T(`yesterday`),tomorrow:T(`tomorrow`),lastWeek:T(`one week ago`),lastMonth:T(`one month ago`),lastYear:T(`one year ago`)},CriterionError:{notEmptyValue:T(`The value must not be empty`),numberValue:T(`The value must be a number`),dateValue:T(`The value must be a date`),validRange:T(`The value must be a valid range`)}},pg={Errors:{Unexpected:T(`The table zone is invalid for an unknown reason`),TableOverlap:T(`You cannot create overlapping tables.`),NonContinuousTargets:T(`A table can only be created on a continuous selection.`),InvalidRange:T(`The range is invalid`),TargetOutOfSheet:T(`The range is out of the sheet`)},Checkboxes:{hasFilters:T(`Filter button`),headerRow:T(`Header row(s)`),bandedRows:T(`Banded rows`),firstColumn:T(`First column`),lastColumn:T(`Last column`),bandedColumns:T(`Banded columns`),automaticAutofill:T(`Automatically autofill formulas`),totalRow:T(`Total row`),isDynamic:T(`Auto-adjust to formula result`)},Tooltips:{filterWithoutHeader:T(`Cannot have filters without a header row`),isDynamic:T(`For tables based on array formulas only`)}},mg={labels:{no_calculations:T(`No calculations`),"%_of_grand_total":T(`% of grand total`),"%_of_col_total":T(`% of column total`),"%_of_row_total":T(`% of row total`),"%_of":T(`% of`),"%_of_parent_row_total":T(`% of parent row total`),"%_of_parent_col_total":T(`% of parent column total`),"%_of_parent_total":T(`% of parent total`),difference_from:T(`Difference from`),"%_difference_from":T(`% difference from`),running_total:T(`Running total`),"%_running_total":T(`% Running total`),rank_asc:T(`Rank smallest to largest`),rank_desc:T(`Rank largest to smallest`),index:T(`Index`)},descriptions:{"%_of_grand_total":()=>T(`Displayed as % of grand total`),"%_of_col_total":()=>T(`Displayed as % of column total`),"%_of_row_total":()=>T(`Displayed as % of row total`),"%_of":e=>T(`Displayed as % of "%s"`,e),"%_of_parent_row_total":e=>T(`Displayed as % of parent row total of "%s"`,e),"%_of_parent_col_total":()=>T(`Displayed as % of parent column total`),"%_of_parent_total":e=>T(`Displayed as % of parent "%s" total`,e),difference_from:e=>T(`Displayed as difference from "%s"`,e),"%_difference_from":e=>T(`Displayed as % difference from "%s"`,e),running_total:e=>T(`Displayed as running total based on "%s"`,e),"%_running_total":e=>T(`Displayed as % running total based on "%s"`,e),rank_asc:e=>T(`Displayed as rank from smallest to largest based on "%s"`,e),rank_desc:e=>T(`Displayed as rank largest to smallest based on "%s"`,e),index:()=>T(`Displayed as index`)},documentation:{no_calculations:T(`Displays the value that is entered in the field.`),"%_of_grand_total":T(`Displays values as a percentage of the grand total of all the values or data points in the report.`),"%_of_col_total":T(`Displays all the values in each column or series as a percentage of the total for the column or series.`),"%_of_row_total":T(`Displays the value in each row or category as a percentage of the total for the row or category.`),"%_of":T(`Displays values as a percentage of the value of the Base item in the Base field.`),"%_of_parent_row_total":T(`Calculates values as follows:
46
+ `))}extractAttr(e,t,n){let r=e.attributes[t];r||this.handleMissingValue(e,`attribute "${t}"`,n);let i=r?.value?r.value:n?.default;return i===void 0?void 0:new uh(i)}extractTextContent(e,t){if(t?.default!==void 0&&typeof t.default!=`string`)throw Error(`extractTextContent default value should be a string`);let n=e?.attributes[`xml:space`]?.value===`preserve`,r=e?.textContent;return(!e||r===null)&&this.handleMissingValue(e,`text content`,t),r&&=n?r:r.trim(),r?kf(r):t?.default}extractChildAttr(e,t,n,r){let i;i=typeof t==`number`?e.children[t]:this.querySelector(e,t),i||this.handleMissingValue(e,typeof t==`number`?`child at index ${t}`:`child <${t}>`,r);let a=i?this.extractAttr(i,n,r)?.asString():r?.default;return a===void 0?void 0:new uh(a)}extractChildTextContent(e,t,n){if(n?.default!==void 0&&typeof n.default!=`string`)throw Error(`extractTextContent default value should be a string`);let r=this.querySelector(e,t);return r||this.handleMissingValue(e,`child <${t}>`,n),r?this.extractTextContent(r,n):n?.default}handleMissingValue(e,t,n){if(n?.required)if(n?.default!==void 0)this.warningManager.addParsingWarning(`Missing required ${t} in element <${e.tagName}> of ${this.currentFile}, replacing it by the default value ${n.default}`);else throw Error(`Missing required ${t} in element <${e.tagName}> of ${this.currentFile}, and no default value was set`)}extractColor(e,t,n){if(!e)return n?{rgb:n}:void 0;let r=this.extractAttr(e,`theme`)?.asString(),i;if(r!==void 0){if(!t||!t.clrScheme)throw Error(`Color referencing a theme but no theme was provided`);i=this.getThemeColor(r,t.clrScheme)}else i=this.extractAttr(e,`rgb`)?.asString(),i=i===`FF000000`?void 0:i;return{rgb:i||n,auto:this.extractAttr(e,`auto`)?.asBool(),indexed:this.extractAttr(e,`indexed`)?.asNum(),tint:this.extractAttr(e,`tint`)?.asNum()}}getTargetXmlFile(e){if(!e)throw Error(`Undefined target file`);let t=this.processRelationshipTargetName(e.target),n=this.getListOfXMLFiles().find(e=>e.file.fileName.endsWith(t));if(!n||!n.file)throw Error(`Cannot find target file`);return n}getTargetImageFile(e){if(!e)throw Error(`Undefined target file`);let t=this.processRelationshipTargetName(e.target),n=this.xlsxFileStructure.images.find(e=>e.fileName.endsWith(t));if(!n)throw Error(`Cannot find target file`);return n}querySelector(e,t){let n=lh(t);return e.querySelector(n)}querySelectorAll(e,t){let n=lh(t);return e.querySelectorAll(n)}getThemeColor(e,t){switch(e){case`0`:return`FFFFFF`;case`1`:return`000000`;case`2`:return t[3].value;case`3`:return t[2].value;default:return t[e].value}}processRelationshipTargetName(e){return e.replace(/\.+\//,``)}},fh=class extends dh{getTheme(){return{clrScheme:this.mapOnElements({query:`a:clrScheme`,parent:this.rootFile.file.xml,children:!0},e=>({name:e.tagName,value:this.extractChildAttr(e,0,`val`,{required:!0,default:$d}).asString(),lastClr:this.extractChildAttr(e,0,`lastClr`,{default:$d}).asString()}))}}getSharedStrings(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`si`},e=>this.mapOnElements({parent:e,query:`t`},e=>this.extractTextContent(e)||``).join(``))}},ph=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}extractConditionalFormattings(){let e=this.mapOnElements({parent:this.rootFile.file.xml,query:`worksheet > conditionalFormatting`},e=>({sqref:this.extractAttr(e,`sqref`,{required:!0}).asString().split(` `),pivot:this.extractAttr(e,`pivot`)?.asBool(),cfRules:this.extractCFRules(e,this.theme)}));return e.push(...this.mapOnElements({parent:this.rootFile.file.xml,query:`extLst x14:conditionalFormatting`},e=>({sqref:this.extractChildTextContent(e,`xm:sqref`,{required:!0}).split(` `),pivot:this.extractAttr(e,`xm:pivot`)?.asBool(),cfRules:this.extractCFRules(e,this.theme)}))),e}extractCFRules(e,t){return this.mapOnElements({parent:e,query:`cfRule, x14:cfRule`},e=>{let n=this.extractAttr(e,`type`,{required:!0}).asString();if(n===`dataBar`)throw Error(`Databars conditional formats are not supported.`);return{type:n,priority:this.extractAttr(e,`priority`,{required:!0}).asNum(),colorScale:this.extractCfColorScale(e,t),formula:this.extractCfFormula(e),iconSet:this.extractCfIconSet(e),dxfId:this.extractAttr(e,`dxfId`)?.asNum(),stopIfTrue:this.extractAttr(e,`stopIfTrue`)?.asBool(),aboveAverage:this.extractAttr(e,`aboveAverage`)?.asBool(),percent:this.extractAttr(e,`percent`)?.asBool(),bottom:this.extractAttr(e,`bottom`)?.asBool(),operator:this.extractAttr(e,`operator`)?.asString(),text:this.extractAttr(e,`text`)?.asString(),timePeriod:this.extractAttr(e,`timePeriod`)?.asString(),rank:this.extractAttr(e,`rank`)?.asNum(),stdDev:this.extractAttr(e,`stdDev`)?.asNum(),equalAverage:this.extractAttr(e,`equalAverage`)?.asBool()}})}extractCfFormula(e){return this.mapOnElements({parent:e,query:`formula`},e=>this.extractTextContent(e,{required:!0}))}extractCfColorScale(e,t){let n=this.querySelector(e,`colorScale`);if(n)return{colors:this.mapOnElements({parent:n,query:`color`},e=>this.extractColor(e,t,`ffffff`)),cfvos:this.extractCFVos(n)}}extractCfIconSet(e){let t=this.querySelector(e,`iconSet, x14:iconSet`);if(t)return{iconSet:this.extractAttr(t,`iconSet`,{default:`3TrafficLights1`}).asString(),showValue:this.extractAttr(t,`showValue`,{default:!0}).asBool(),percent:this.extractAttr(t,`percent`,{default:!0}).asBool(),reverse:this.extractAttr(t,`reverse`)?.asBool(),custom:this.extractAttr(t,`custom`)?.asBool(),cfvos:this.extractCFVos(t),cfIcons:this.extractCfIcons(t)}}extractCfIcons(e){let t=this.mapOnElements({parent:e,query:`cfIcon, x14:cfIcon`},e=>({iconSet:this.extractAttr(e,`iconSet`,{required:!0}).asString(),iconId:this.extractAttr(e,`iconId`,{required:!0}).asNum()}));return t.length===0?void 0:t}extractCFVos(e){return this.mapOnElements({parent:e,query:`cfvo, x14:cfvo`},e=>({type:this.extractAttr(e,`type`,{required:!0}).asString(),gte:this.extractAttr(e,`gte`,{default:!0})?.asBool(),value:e.attributes.val?this.extractAttr(e,`val`)?.asString():this.extractChildTextContent(e,`f, xm:f`)}))}},mh=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}extractDataValidations(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`worksheet > dataValidations > dataValidation`},e=>({type:this.extractAttr(e,`type`,{required:!0}).asString(),operator:this.extractAttr(e,`operator`,{default:`between`})?.asString(),sqref:this.extractAttr(e,`sqref`,{required:!0}).asString().split(` `),errorStyle:this.extractAttr(e,`errorStyle`)?.asString(),formula1:this.extractDataValidationFormula(e,1)[0],formula2:this.extractDataValidationFormula(e,2)[0],showErrorMessage:this.extractAttr(e,`showErrorMessage`)?.asBool(),errorTitle:this.extractAttr(e,`errorTitle`)?.asString(),error:this.extractAttr(e,`error`)?.asString(),showInputMessage:this.extractAttr(e,`showInputMessage`)?.asBool(),promptTitle:this.extractAttr(e,`promptTitle`)?.asString(),prompt:this.extractAttr(e,`prompt`)?.asString(),allowBlank:this.extractAttr(e,`allowBlank`)?.asBool()}))}extractDataValidationFormula(e,t){return this.mapOnElements({parent:e,query:`formula${t}`},e=>this.extractTextContent(e,{required:!0}))}},hh=class extends dh{extractChart(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`c:chartSpace`},e=>{let t=this.getChartType(e);if(!Yf[t])throw Error(`Unsupported chart type ${t}`);if(Yf[t]===`combo`)return this.extractComboChart(e);let n=this.mapOnElements({parent:e,query:`c:chart > c:title a:t`},e=>e.textContent||``).join(``),r=this.extractChildAttr(e,`c:grouping`,`val`,{default:`clustered`}).asString();return{title:{text:n},type:Yf[t],dataSets:this.extractChartDatasets(this.querySelectorAll(e,`c:${t}`),t),labelRange:this.extractLabelRange(t,e),backgroundColor:this.extractChildAttr(e,`c:chartSpace > c:spPr a:srgbClr`,`val`,{default:`ffffff`}).asString(),legendPosition:Jf[this.extractChildAttr(e,`c:legendPos`,`val`,{default:`none`}).asString()],stacked:r===`stacked`,fontColor:`000000`}})[0]}extractLabelRange(e,t){return e===`scatterChart`?this.extractChildTextContent(t,`c:ser c:strRef c:f`)||this.extractChildTextContent(t,`c:ser c:numRef c:f`):this.extractChildTextContent(t,`c:ser c:cat c:f`)}extractComboChart(e){let t=this.mapOnElements({parent:e,query:`c:title a:t`},e=>e.textContent||``).join(``),n=this.extractChildAttr(e,`c:grouping`,`val`,{default:`clustered`}).asString();return{title:{text:t},type:`combo`,dataSets:[...this.extractChartDatasets(this.querySelectorAll(e,`c:barChart`),`comboChart`),...this.extractChartDatasets(this.querySelectorAll(e,`c:lineChart`),`comboChart`)],labelRange:this.extractChildTextContent(e,`c:ser c:cat c:f`),backgroundColor:this.extractChildAttr(e,`c:chartSpace > c:spPr a:srgbClr`,`val`,{default:`ffffff`}).asString(),legendPosition:Jf[this.extractChildAttr(e,`c:legendPos`,`val`,{default:`none`}).asString()],stacked:n===`stacked`,fontColor:`000000`}}extractChartDatasets(e,t){return Array.from(e).map(e=>t===`scatterChart`?this.extractScatterChartDatasets(e):this.mapOnElements({parent:e,query:`c:ser`},e=>{let t={},n=this.extractChildTextContent(e,`c:tx c:f`);if(n)t={reference:n};else{let n=this.extractChildTextContent(e,`c:tx c:v`);n&&(t={text:n})}let r=this.extractChildAttr(e,`c:spPr a:solidFill a:srgbClr`,`val`);return{label:t,range:this.extractChildTextContent(e,`c:val c:f`,{required:!0}),backgroundColor:r?`${en(r.asString())}`:void 0}})).flat()}extractScatterChartDatasets(e){return this.mapOnElements({parent:e,query:`c:ser`},e=>{let t={},n=this.extractChildTextContent(e,`c:tx c:f`);if(n)t={reference:n};else{let n=this.extractChildTextContent(e,`c:tx c:v`);n&&(t={text:n})}return{label:t,range:this.extractChildTextContent(e,`c:yVal c:f`,{required:!0})}})}getChartType(e){let t=this.querySelector(e,`c:plotArea`);if(!t)throw Error(`Missing plot area in the chart definition.`);let n;for(let e of t.children){let t=sh(e.tagName);Qd.some(e=>e===t)&&(n?n!==t&&(n=`comboChart`):n=t)}if(n)return n;throw Error(`Unknown chart type`)}};let gh=`oneCellAnchor`,_h=`twoCellAnchor`;var vh=class extends dh{extractFigures(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`xdr:wsDr`,children:!0},e=>{let t=sh(e.tagName),n=this.extractFigureAnchorsByType(e,t),r=this.querySelector(e,`c:chart`),i=this.querySelector(e,`a:blip`);if(!r&&!i)throw Error(`Only chart and image figures are currently supported.`);return{anchors:n,data:r?this.extractChart(r):this.extractImage(e),figureSize:t===gh?this.extractFigureSizeFromSizeTag(e,`xdr:ext`):void 0}})}extractFigureAnchorsByType(e,t){switch(t){case gh:return[this.extractFigureAnchor(`xdr:from`,e)];case _h:return[this.extractFigureAnchor(`xdr:from`,e),this.extractFigureAnchor(`xdr:to`,e)];default:throw Error(`${t} is not supported for xlsx drawings. `)}}extractFigureSizeFromSizeTag(e,t){let n=this.querySelector(e,t);if(!n)throw Error(`Missing size element '${t}'`);return{cx:this.extractAttr(n,`cx`,{required:!0}).asNum(),cy:this.extractAttr(n,`cy`,{required:!0}).asNum()}}extractFigureAnchor(e,t){let n=this.querySelector(t,e);if(!n)throw Error(`Missing anchor element ${e}`);return{col:Number(this.extractChildTextContent(n,`xdr:col`,{required:!0})),colOffset:Number(this.extractChildTextContent(n,`xdr:colOff`,{required:!0})),row:Number(this.extractChildTextContent(n,`xdr:row`,{required:!0})),rowOffset:Number(this.extractChildTextContent(n,`xdr:rowOff`,{required:!0}))}}extractChart(e){let t=this.extractAttr(e,`r:id`,{required:!0}).asString(),n=new hh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).extractChart();if(!n)throw Error(`Unable to extract chart definition`);return n}extractImage(e){let t=this.querySelector(e,`a:blip`),n=this.extractAttr(t,`r:embed`,{required:!0}).asString(),r=this.getTargetImageFile(this.relationships[n]);if(!r)throw Error(`Unable to extract image`);let i=r.fileName.split(`.`).at(-1),a=sh(e.tagName),o=a===_h?this.querySelector(e,`a:xfrm`):e,s=a===_h?`a:ext`:`xdr:ext`,c=this.extractFigureSizeFromSizeTag(o,s);return{imageSrc:r.imageSrc,mimetype:i?tp[i]:void 0,size:c}}},yh=class extends dh{getPivotTable(){return this.mapOnElements({query:`:root`,parent:this.rootFile.file.xml},e=>({name:this.extractAttr(e,`name`,{required:!0}).asString(),rowGrandTotals:this.extractAttr(e,`rowGrandTotals`,{default:!0}).asBool(),location:this.extractPivotLocation(e),style:this.extractPivotStyleInfo(e)}))[0]}extractPivotLocation(e){return this.mapOnElements({query:`location`,parent:e},e=>({ref:this.extractAttr(e,`ref`,{required:!0}).asString(),firstHeaderRow:this.extractAttr(e,`firstHeaderRow`,{required:!0}).asNum(),firstDataRow:this.extractAttr(e,`firstDataRow`,{required:!0}).asNum(),firstDataCol:this.extractAttr(e,`firstDataCol`,{required:!0}).asNum()}))[0]}extractPivotStyleInfo(e){return this.mapOnElements({query:`pivotTableStyleInfo`,parent:e},e=>({name:this.extractAttr(e,`name`,{required:!0}).asString(),showRowHeaders:this.extractAttr(e,`showRowHeaders`,{required:!0}).asBool(),showColHeaders:this.extractAttr(e,`showColHeaders`,{required:!0}).asBool(),showRowStripes:this.extractAttr(e,`showRowStripes`,{required:!0}).asBool(),showColStripes:this.extractAttr(e,`showColStripes`,{required:!0}).asBool(),showLastColumn:this.extractAttr(e,`showLastColumn`)?.asBool()}))[0]}},bh=class extends dh{getTable(){return this.mapOnElements({query:`table`,parent:this.rootFile.file.xml},e=>({displayName:this.extractAttr(e,`displayName`,{required:!0}).asString(),name:this.extractAttr(e,`name`)?.asString(),id:this.extractAttr(e,`id`,{required:!0}).asString(),ref:this.extractAttr(e,`ref`,{required:!0}).asString(),headerRowCount:this.extractAttr(e,`headerRowCount`,{default:1}).asNum(),totalsRowCount:this.extractAttr(e,`totalsRowCount`,{default:0}).asNum(),cols:this.extractTableCols(e),style:this.extractTableStyleInfo(e),autoFilter:this.extractTableAutoFilter(e)}))[0]}extractTableCols(e){return this.mapOnElements({query:`tableColumn`,parent:e},e=>({id:this.extractAttr(e,`id`,{required:!0}).asString(),name:this.extractAttr(e,`name`,{required:!0}).asString(),colFormula:this.extractChildTextContent(e,`calculatedColumnFormula`)}))}extractTableStyleInfo(e){return this.mapOnElements({query:`tableStyleInfo`,parent:e},e=>({name:this.extractAttr(e,`name`)?.asString(),showFirstColumn:this.extractAttr(e,`showFirstColumn`)?.asBool(),showLastColumn:this.extractAttr(e,`showLastColumn`)?.asBool(),showRowStripes:this.extractAttr(e,`showRowStripes`)?.asBool(),showColumnStripes:this.extractAttr(e,`showColumnStripes`)?.asBool()}))[0]}extractTableAutoFilter(e){return this.mapOnElements({query:`autoFilter`,parent:e},e=>({columns:this.extractFilterColumns(e),zone:this.extractAttr(e,`ref`,{required:!0}).asString()}))[0]}extractFilterColumns(e){return this.mapOnElements({query:`tableColumn`,parent:e},t=>({colId:this.extractAttr(e,`colId`,{required:!0}).asNum(),hiddenButton:this.extractAttr(e,`hiddenButton`,{default:!1}).asBool(),filters:this.extractSimpleFilter(t)}))}extractSimpleFilter(e){return this.mapOnElements({query:`filter`,parent:e},e=>({val:this.extractAttr(e,`val`,{required:!0}).asString()}))}},xh=class extends dh{theme;constructor(e,t,n,r){super(e,t,n),this.theme=r}getSheet(){return this.mapOnElements({query:`worksheet`,parent:this.rootFile.file.xml},e=>{let t=this.getSheetWorkbookInfo();return{sheetName:this.extractSheetName(),sheetViews:this.extractSheetViews(e),sheetFormat:this.extractSheetFormat(e),sheetProperties:this.extractSheetProperties(e),cols:this.extractCols(e),rows:this.extractRows(e),sharedFormulas:this.extractSharedFormulas(e),merges:this.extractMerges(e),cfs:this.extractConditionalFormats(),dataValidations:this.extractDataValidations(),figures:this.extractFigures(e),hyperlinks:this.extractHyperLinks(e),tables:this.extractTables(e),pivotTables:this.extractPivotTables(),isVisible:t.state===`visible`}})[0]}extractSheetViews(e){return this.mapOnElements({parent:e,query:`sheetView`},e=>{let t=this.querySelector(e,`pane`);return{tabSelected:this.extractAttr(e,`tabSelected`,{default:!1}).asBool(),showFormulas:this.extractAttr(e,`showFormulas`,{default:!1}).asBool(),showGridLines:this.extractAttr(e,`showGridLines`,{default:!0}).asBool(),showRowColHeaders:this.extractAttr(e,`showRowColHeaders`,{default:!0}).asBool(),pane:{xSplit:t?this.extractAttr(t,`xSplit`,{default:0}).asNum():0,ySplit:t?this.extractAttr(t,`ySplit`,{default:0}).asNum():0}}})}extractSheetName(){let e=Df(this.xlsxFileStructure.workbook.file.fileName,this.rootFile.file.fileName),t=this.extractRelationships(this.xlsxFileStructure.workbook.rels).find(t=>t.target===e).id;for(let e of this.querySelectorAll(this.xlsxFileStructure.workbook.file.xml,`sheet`))if(e.attributes[`r:id`].value===t)return e.attributes.name.value;throw Error(`Missing sheet name`)}getSheetWorkbookInfo(){let e=Df(this.xlsxFileStructure.workbook.file.fileName,this.rootFile.file.fileName),t=this.extractRelationships(this.xlsxFileStructure.workbook.rels).find(t=>t.target===e).id,n=this.mapOnElements({parent:this.xlsxFileStructure.workbook.file.xml,query:`sheet`},e=>({relationshipId:this.extractAttr(e,`r:id`,{required:!0}).asString(),sheetId:this.extractAttr(e,`sheetId`,{required:!0}).asString(),sheetName:this.extractAttr(e,`name`,{required:!0}).asString(),state:this.extractAttr(e,`state`,{default:`visible`}).asString()})).find(e=>e.relationshipId===t);if(!n)throw Error(`Cannot find corresponding workbook sheet`);return n}extractConditionalFormats(){return new ph(this.rootFile,this.xlsxFileStructure,this.warningManager,this.theme).extractConditionalFormattings()}extractDataValidations(){return new mh(this.rootFile,this.xlsxFileStructure,this.warningManager,this.theme).extractDataValidations()}extractFigures(e){return this.mapOnElements({parent:e,query:`drawing`},e=>{let t=this.extractAttr(e,`r:id`,{required:!0}).asString();return new vh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).extractFigures()})[0]||[]}extractTables(e){return this.mapOnElements({query:`tablePart`,parent:e},e=>{let t=this.extractAttr(e,`r:id`,{required:!0}).asString();return new bh(this.getTargetXmlFile(this.relationships[t]),this.xlsxFileStructure,this.warningManager).getTable()})}extractPivotTables(){try{return Object.values(this.relationships).filter(e=>e.type.endsWith(`pivotTable`)).map(e=>new yh(this.getTargetXmlFile(e),this.xlsxFileStructure,this.warningManager).getPivotTable())}catch(e){return this.catchErrorOnElement(e),[]}}extractMerges(e){return this.mapOnElements({parent:e,query:`mergeCell`},e=>this.extractAttr(e,`ref`,{required:!0}).asString())}extractSheetFormat(e){let t=this.querySelector(e,`sheetFormatPr`);if(t)return{defaultColWidth:this.extractAttr(t,`defaultColWidth`,{default:`8.43`}).asNum(),defaultRowHeight:this.extractAttr(t,`defaultRowHeight`,{default:`12.75`}).asNum()}}extractSheetProperties(e){let t=this.querySelector(e,`sheetPr`);if(t)return{outlinePr:this.extractSheetOutlineProperties(t),tabColor:this.extractColor(this.querySelector(t,`tabColor`),this.theme)}}extractSheetOutlineProperties(e){let t=this.querySelector(e,`outlinePr`);if(t)return{summaryBelow:this.extractAttr(t,`summaryBelow`,{default:!0}).asBool(),summaryRight:this.extractAttr(t,`summaryRight`,{default:!0}).asBool()}}extractCols(e){return this.mapOnElements({parent:e,query:`cols col`},e=>({width:this.extractAttr(e,`width`)?.asNum(),customWidth:this.extractAttr(e,`customWidth`)?.asBool(),bestFit:this.extractAttr(e,`bestFit`)?.asBool(),hidden:this.extractAttr(e,`hidden`)?.asBool(),min:this.extractAttr(e,`min`,{required:!0}).asNum(),max:this.extractAttr(e,`max`,{required:!0}).asNum(),styleIndex:this.extractAttr(e,`style`)?.asNum(),outlineLevel:this.extractAttr(e,`outlineLevel`)?.asNum(),collapsed:this.extractAttr(e,`collapsed`)?.asBool()}))}extractRows(e){let t=new Set;return this.mapOnElements({parent:e,query:`sheetData row`},e=>({index:this.extractAttr(e,`r`,{required:!0}).asNum(),cells:this.extractCells(e,t),height:this.extractAttr(e,`ht`)?.asNum(),customHeight:this.extractAttr(e,`customHeight`)?.asBool(),hidden:this.extractAttr(e,`hidden`)?.asBool(),styleIndex:this.extractAttr(e,`s`)?.asNum(),outlineLevel:this.extractAttr(e,`outlineLevel`)?.asNum(),collapsed:this.extractAttr(e,`collapsed`)?.asBool()}))}extractCells(e,t){return this.mapOnElements({parent:e,query:`c`},e=>{let n=this.extractAttr(e,`r`,{required:!0}).asString(),r=this.extractCellFormula(e);if(r?.ref&&r.sharedIndex===void 0){let e=$n(r.ref);for(let{col:r,row:i}of vr(e)){let e=w(r,i);e!==n&&t.add(e)}}let i=t.has(n);return{xc:n,styleIndex:this.extractAttr(e,`s`)?.asNum(),type:zf[this.extractAttr(e,`t`,{default:`n`}).asString()],value:i?void 0:this.extractChildTextContent(e,`v`)??void 0,formula:i?void 0:r}})}extractCellFormula(e){let t=this.querySelector(e,`f`);if(!t)return;let n=this.extractTextContent(t),r=this.extractAttr(t,`si`)?.asNum(),i=this.extractAttr(t,`ref`)?.asString();if(!((n===void 0||n.trim()===``)&&r===void 0))return{content:n,sharedIndex:r,ref:i}}extractHyperLinks(e){return this.mapOnElements({parent:e,query:`hyperlink`},e=>{let t=this.extractAttr(e,`r:id`)?.asString();return{xc:this.extractAttr(e,`ref`,{required:!0})?.asString(),location:this.extractAttr(e,`location`)?.asString(),display:this.extractAttr(e,`display`)?.asString(),relTarget:t?this.relationships[t].target:void 0}})}extractSharedFormulas(e){let t=this.querySelectorAll(e,`f[si][ref]`),n={};for(let e of t){let t=this.extractAttr(e,`si`,{required:!0}).asNum();n[t]=this.extractTextContent(e,{required:!0})}let r=[];for(let e=0;e<Object.keys(n).length;e++)n[e]?r.push(n[e]):(this.warningManager.addParsingWarning(`Missing shared formula ${e}, replacing it by empty formula`),r.push(``));return r}},Sh=class extends dh{theme;constructor(e,t,n){super(e.styles,e,t),this.theme=n}getNumFormats(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`numFmt`},e=>this.extractNumFormats(e))}extractNumFormats(e){return{id:this.extractAttr(e,`numFmtId`,{required:!0}).asNum(),format:this.extractAttr(e,`formatCode`,{required:!0,default:``}).asString()}}getFonts(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`font`},e=>this.extractFont(e))}extractFont(e){let t=this.extractChildAttr(e,`name`,`val`,{default:`Arial`}).asString(),n=this.extractChildAttr(e,`sz`,`val`,{default:Re.toString()}).asNum(),r=this.extractColor(this.querySelector(e,`color`),this.theme),i=this.querySelector(e,`i`)||void 0,a=i&&i.attributes.val?.value!==`0`,o=this.querySelector(e,`b`)||void 0,s=o&&o.attributes.val?.value!==`0`,c=this.querySelector(e,`strike`)||void 0,l=c&&c.attributes.val?.value!==`0`,u=this.querySelector(e,`u`)||void 0;return{name:t,size:n,color:r,italic:a,bold:s,underline:u&&u.attributes.val?.value!==`none`,strike:l}}getFills(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`fill`},e=>this.extractFill(e))}extractFill(e){let t=e.children[0];return t.tagName===`patternFill`?{patternType:t.attributes.patternType?.value,bgColor:this.extractColor(this.querySelector(t,`bgColor`),this.theme),fgColor:this.extractColor(this.querySelector(t,`fgColor`),this.theme)}:{patternType:`solid`,fgColor:this.extractColor(this.querySelectorAll(t,`color`)[1],this.theme)}}getBorders(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`border`},e=>this.extractBorder(e))}extractBorder(e){let t={left:this.extractSingleBorder(e,`left`,this.theme),right:this.extractSingleBorder(e,`right`,this.theme),top:this.extractSingleBorder(e,`top`,this.theme),bottom:this.extractSingleBorder(e,`bottom`,this.theme),diagonal:this.extractSingleBorder(e,`diagonal`,this.theme)};return t.diagonal&&(t.diagonalUp=this.extractAttr(e,`diagonalUp`)?.asBool(),t.diagonalDown=this.extractAttr(e,`diagonalDown`)?.asBool()),t}extractSingleBorder(e,t,n){let r=this.querySelector(e,t);if(!(!r||!r.attributes.style))return{style:this.extractAttr(r,`style`,{required:!0,default:`thin`}).asString(),color:this.extractColor(r.children[0],n,`000000`)}}extractAlignment(e){return{horizontal:this.extractAttr(e,`horizontal`,{default:`general`}).asString(),vertical:this.extractAttr(e,`vertical`,{default:`bottom`}).asString(),textRotation:this.extractAttr(e,`textRotation`)?.asNum(),wrapText:this.extractAttr(e,`wrapText`)?.asBool(),indent:this.extractAttr(e,`indent`)?.asNum(),relativeIndent:this.extractAttr(e,`relativeIndent`)?.asNum(),justifyLastLine:this.extractAttr(e,`justifyLastLine`)?.asBool(),shrinkToFit:this.extractAttr(e,`shrinkToFit`)?.asBool(),readingOrder:this.extractAttr(e,`readingOrder`)?.asNum()}}getDxfs(){return this.mapOnElements({query:`dxf`,parent:this.rootFile.file.xml},e=>{let t=this.querySelector(e,`font`),n=this.querySelector(e,`fill`),r=this.querySelector(e,`border`),i=this.querySelector(e,`numFmt`),a=this.querySelector(e,`alignment`);return{font:t?this.extractFont(t):void 0,fill:n?this.extractFill(n):void 0,numFmt:i?this.extractNumFormats(i):void 0,alignment:a?this.extractAlignment(a):void 0,border:r?this.extractBorder(r):void 0}})}getStyles(){return this.mapOnElements({query:`cellXfs xf`,parent:this.rootFile.file.xml},e=>{let t=this.querySelector(e,`alignment`);return{fontId:this.extractAttr(e,`fontId`,{required:!0,default:0}).asNum(),fillId:this.extractAttr(e,`fillId`,{required:!0,default:0}).asNum(),borderId:this.extractAttr(e,`borderId`,{required:!0,default:0}).asNum(),numFmtId:this.extractAttr(e,`numFmtId`,{required:!0,default:0}).asNum(),alignment:t?this.extractAlignment(t):void 0}})}},Ch=class extends dh{getExternalBook(){return this.mapOnElements({parent:this.rootFile.file.xml,query:`externalBook`},e=>({rId:this.extractAttr(e,`r:id`,{required:!0}).asString(),sheetNames:this.mapOnElements({parent:e,query:`sheetName`},e=>this.extractAttr(e,`val`,{required:!0}).asString()),datasets:this.extractExternalSheetData(e)}))[0]}extractExternalSheetData(e){return this.mapOnElements({parent:e,query:`sheetData`},e=>{let t=this.mapOnElements({parent:e,query:`cell`},e=>({xc:this.extractAttr(e,`r`,{required:!0}).asString(),value:this.extractChildTextContent(e,`v`,{required:!0})})),n={};for(let e of t)n[e.xc]=e.value;return{sheetId:this.extractAttr(e,`sheetId`,{required:!0}).asNum(),data:n}})}};function wh(e,t){return Th(Eh(e,t),t)}function Th(e,t){let n=[];for(let r of e){let e=Dh(r,t);n.push({file:{fileName:r,xml:t[r]},rels:e?{fileName:e,xml:t[e]}:void 0})}return n}function Eh(e,t){let n=t[`[Content_Types].xml`].querySelectorAll(`Override[ContentType="${e}"]`),r=[];for(let e of n){let t=e?.attributes.PartName.value;r.push(t.substring(1))}return r}function Dh(e,t){if(e===`[Content_Types].xml`)return`_rels/.rels`;let n=``,r=e.split(`/`);for(let e=0;e<r.length-1;e++)n+=r[e]+`/`;return n+=`_rels/`,n+=r[r.length-1]+`.rels`,t[n]||(n=void 0),n}var Oh=class{warningManager;xmls;images;constructor(e){this.warningManager=new Mf,this.xmls={},this.images=[];for(let t of Object.keys(e))if(t.endsWith(`.xml`)||t.endsWith(`.rels`)){let n=ch(e[t]);this.xmls[t]=nh(new Zd(n))}else t.includes(`media/image`)&&this.images.push({fileName:t,imageSrc:e[t].imageSrc})}convertXlsx(){let e=this.getXlsxData();return this.convertImportedData(e)}getXlsxData(){let e=this.buildXlsxFileStructure(),t=e.theme?new fh(e.theme,e,this.warningManager).getTheme():void 0,n=e.sharedStrings?new fh(e.sharedStrings,e,this.warningManager).getSharedStrings():[],r=e.sheets.sort((e,t)=>e.file.fileName.localeCompare(t.file.fileName,void 0,{numeric:!0})).map(n=>new xh(n,e,this.warningManager,t).getSheet()),i=e.externalLinks.map(t=>new Ch(t,e,this.warningManager).getExternalBook()),a=new Sh(e,this.warningManager,t);return{fonts:a.getFonts(),fills:a.getFills(),borders:a.getBorders(),dxfs:a.getDxfs(),numFmts:a.getNumFormats(),styles:a.getStyles(),sheets:r,sharedStrings:n,externalBooks:i}}buildXlsxFileStructure(){let e={sheets:wh(af.sheet,this.xmls),workbook:wh(af.workbook,this.xmls)[0],styles:wh(af.styles,this.xmls)[0],sharedStrings:wh(af.sharedStrings,this.xmls)[0],theme:wh(af.themes,this.xmls)[0],charts:wh(af.chart,this.xmls),figures:wh(af.drawing,this.xmls),tables:wh(af.table,this.xmls),pivots:wh(af.pivot,this.xmls),externalLinks:wh(af.externalLink,this.xmls),images:this.images};if(!e.workbook.rels)throw Error(T(`Cannot find workbook relations file`));return e}convertImportedData(e){let t={version:21,sheets:_m(e,this.warningManager),styles:hp(e,this.warningManager),formats:_p(e,this.warningManager),borders:pp(e,this.warningManager),revisionId:Ve};return Km(t,e),Object.keys(e.styles).map(t=>{e.styles[t]=jt(e.styles[t])}),t}};let kh=(e,t=()=>!0)=>[{goTo:e,guard:t}],Ah=(e,t=()=>!0)=>({goTo:e,guard:t}),jh={0:{REFERENCE:kh(2),NUMBER:kh(4),SYMBOL:[Ah(3,e=>Ls(e.value)),Ah(4,e=>Rs(e.value))]},3:{SPACE:kh(3),OPERATOR:kh(5,e=>e.value===`:`)},4:{SPACE:kh(4),OPERATOR:kh(6,e=>e.value===`:`)},2:{SPACE:kh(2),OPERATOR:kh(1,e=>e.value===`:`)},1:{SPACE:kh(1),NUMBER:kh(7),REFERENCE:kh(7,e=>Vs(e.value)),SYMBOL:kh(7,e=>zs(e.value)||Bs(e.value))},5:{SPACE:kh(5),SYMBOL:kh(7,e=>zs(e.value)),REFERENCE:kh(7,e=>Vs(e.value))},6:{SPACE:kh(6),NUMBER:kh(7),REFERENCE:kh(7,e=>Vs(e.value)),SYMBOL:kh(7,e=>Bs(e.value))},7:{}};function Mh(e){let t=0,n=jh[0],r=``;for(;n!==void 0;){let i=e[t++];if(!i)return null;let a=n[i.type]?.find(e=>e.guard(i)),o=a?a.goTo:void 0;switch(o){case void 0:return null;case 7:return r+=i.value,e.splice(0,t),{type:`REFERENCE`,value:r};default:n=jh[o],r+=i.value;break}}return null}function Nh(e,t=O){let n=zc(e,t),r=[];for(;n.length;)r.push(Mh(n)||n.shift());return r}function Ph(e){let t=Nh(e),n=[];return{text:``.concat(...t.map(e=>{if(e.type===`REFERENCE`&&As.test(e.value)){let t=e.value.trim();return n.includes(t)||n.push(t),`|${n.indexOf(t)}|`}else return e.value})),dependencies:n}}let Fh={am_ET:7,ar_001:6,ar_SY:6,az_AZ:1,eu_ES:1,be_BY:1,bn_IN:1,bs_BA:1,bg_BG:1,ca_ES:1,zh_CN:7,zh_HK:7,zh_TW:7,hr_HR:1,cs_CZ:1,da_DK:1,nl_BE:1,nl_NL:1,en_AU:7,en_CA:7,en_GB:1,en_IN:7,en_NZ:7,et_EE:1,fi_FI:1,fr_BE:1,fr_CA:7,fr_CH:1,fr_FR:1,gl_ES:1,ka_GE:1,de_DE:1,de_CH:1,el_GR:1,gu_IN:7,he_IL:7,hi_IN:7,hu_HU:1,id_ID:7,it_IT:1,ja_JP:7,kab_DZ:6,km_KH:7,ko_KP:1,ko_KR:7,lo_LA:7,lv_LV:1,lt_LT:1,lb_LU:1,mk_MK:1,ml_IN:1,mn_MN:7,ms_MY:1,nb_NO:1,fa_IR:6,pl_PL:1,pt_AO:1,pt_BR:7,pt_PT:1,ro_RO:1,ru_RU:1,sr_RS:7,"sr@latin":7,sk_SK:1,sl_SI:1,es_AR:7,es_BO:1,es_CL:1,es_CO:7,es_CR:1,es_DO:1,es_EC:1,es_GT:7,es_MX:7,es_PA:7,es_PE:7,es_PY:7,es_UY:1,es_VE:7,sw:1,sv_SE:1,th_TH:7,tl_PH:1,tr_TR:1,uk_UA:1,vi_VN:1,sq_AL:1,te_IN:7,en_US:7,my_MM:7,es_ES:1,es_419:1},Ih=new h;Ih.add(`migration_1`,{versionFrom:`1`,migrate(e){return e.sheets&&e.sheets[0]&&(e.activeSheet=e.sheets[0].name),e}}).add(`migration_2`,{versionFrom:`2`,migrate(e){if(e.sheets&&e.sheets.length)for(let t of e.sheets)t.id=t.id||t.name;return e}}).add(`migration_3`,{versionFrom:`3`,migrate(e){return e.sheets&&e.activeSheet&&(e.activeSheet=e.sheets.find(t=>t.name===e.activeSheet).id),e}}).add(`migration_4`,{versionFrom:`4`,migrate(e){for(let t of e.sheets||[])t.figures=t.figures||[];return e}}).add(`migration_5`,{versionFrom:`5`,migrate(e){for(let t of e.sheets||[])for(let e in t.cells||[]){let n=t.cells[e];n.content&&n.content.startsWith(`=`)&&(n.formula=Ph(n.content))}return e}}).add(`migration_6`,{versionFrom:`6`,migrate(e){for(let t of e.sheets||[])for(let e in t.figures||[]){let{dataSets:n,...r}=t.figures[e].data,i=[];for(let e of n)if(e.labelCell){let t=$n(e.dataRange),n=e.labelCell+`:`+w(t.right,t.bottom);i.push(n)}else i.push(e.dataRange);r.dataSetsHaveTitle=!!n[0].labelCell,r.dataSets=i,t.figures[e].data=r}return e}}).add(`migration_7`,{versionFrom:`7`,migrate(e){let t=[];for(let n of e.sheets||[]){if(!n.name)continue;let e=n.name,r=st(e,`_`),i=1,a=r;for(;t.includes(a);)a=`${r}${i}`,i++;n.name=a,t.push(a);let o=t=>{if(t===void 0)return t;let n=t.replace(e,a),r=t;for(;r!==n;)r=n,n=r.replace(e,a);return r};for(let e in n.cells){let t=n.cells[e];t.formula&&(t.formula.dependencies=t.formula.dependencies.map(o))}for(let e of n.figures||[])if(e.type===`chart`){let t=e.data.dataSets.map(o),n=o(e.data.labelRange);e.data={...e.data,dataSets:t,labelRange:n}}for(let e of n.conditionalFormats||[]){e.ranges=e.ranges.map(o);for(let t of[`minimum`,`maximum`,`midpoint`,`upperInflectionPoint`,`lowerInflectionPoint`])e.rule[t]?.type===`formula`&&(e.rule[t].value=o(e.rule[t].value))}}return e}}).add(`migration_8`,{versionFrom:`8`,migrate(e){for(let t of e.sheets||[])for(let e of t.figures||[])e.data.background=oe,e.data.verticalAxisPosition=`left`,e.data.legendPosition=`top`,e.data.stacked=!1;return e}}).add(`migration_9`,{versionFrom:`9`,migrate(e){for(let t of e.sheets||[])for(let e in t.cells||[]){let n=t.cells[e];if(n.formula){let{text:e,dependencies:t}=n.formula;for(let[n,r]of Object.entries(t)){let t=`\\|${n}\\|`;e=e.replace(new RegExp(t,`g`),r)}n.content=e,delete n.formula}}return e}}).add(`migration_10`,{versionFrom:`10`,migrate(e){let t={};for(let n of e.sheets||[])for(let e in n.cells||[]){let r=n.cells[e];r.format&&=Fr(r.format,t)}return e.formats=t,e}}).add(`migration_11`,{versionFrom:`11`,migrate(e){for(let t of e.sheets||[])t.isVisible=!0;return e}}).add(`migration_12`,{versionFrom:`12`,migrate(e){return Lh(e)}}).add(`migration_12_5`,{versionFrom:`12.5`,migrate(e){for(let t in e.borders){let n=e.borders[t];for(let e in n)Array.isArray(n[e])&&(n[e]={style:n[e][0],color:n[e][1]})}return e}}).add(`migration_13`,{versionFrom:`13`,migrate(e){return e.settings||={},e.settings.locale||(e.settings.locale=O),e}}).add(`migration_14`,{versionFrom:`14`,migrate(e){return Lh(e)}}).add(`migration_14_5`,{versionFrom:`14.5`,migrate(e){for(let t of e.sheets||[])t.tables=t.tables||t.filterTables||[],delete t.filterTables;return e}}).add(`migration_15`,{versionFrom:`15`,migrate(e){return e.pivots||={},e.pivotNextId||=ku(e.pivots)+1,e}}).add(`migration_16`,{versionFrom:`16`,migrate(e){for(let t of e.sheets||[])for(let e in t.figures||[]){let n=t.figures[e];`title`in n.data&&typeof n.data.title==`string`&&(n.data.title={text:n.data.title});let r=n.data.type;if(![`line`,`bar`,`pie`,`scatter`,`waterfall`,`combo`].includes(r))continue;let{dataSets:i,...a}=t.figures[e].data;a.dataSets=i.map(e=>({dataRange:e})),t.figures[e].data=a}return e}}).add(`migration_17`,{versionFrom:`17`,migrate(e){return e}}).add(`migration_18`,{versionFrom:`18`,migrate(e){for(let t of Object.values(e.pivots||{}))t.measures=t.measures.map(e=>({id:e.name,fieldName:e.name,aggregator:e.aggregator})),t.columns=t.columns.map(e=>({fieldName:e.name,order:e.order,granularity:e.granularity})),t.rows=t.rows.map(e=>({fieldName:e.name,order:e.order,granularity:e.granularity}));return e}}).add(`migration_19`,{versionFrom:`19`,migrate(e){let t=e.settings?.locale;return t&&(t.weekStart=Fh[t.code]||1),e}}).add(`migration_20`,{versionFrom:`20`,migrate(e){for(let t of e.sheets||[]){t.styles={},t.formats={},t.borders={};for(let e in t.cells)t.styles[e]=t.cells[e].style,t.formats[e]=t.cells[e].format,t.borders[e]=t.cells[e].border,delete t.cells[e].style,delete t.cells[e].format,delete t.cells[e].border}return e}}).add(`migration_21`,{versionFrom:`21`,migrate(e){for(let t of e.sheets||[])for(let e of t.figures||[]){if(e.tag!==`chart`||e.data.type!==`gauge`)continue;let t=e.data;t?.sectionRule?.lowerInflectionPoint&&(t.sectionRule.lowerInflectionPoint.operator=`<=`),t?.sectionRule?.upperInflectionPoint&&(t.sectionRule.upperInflectionPoint.operator=`<=`)}return e}});function Lh(e){for(let t of e.sheets||[]){let e=[];for(let n of t.filterTables||[]){let t=$n(n.range),r=e.findIndex(e=>dr(e,t));r===-1?e.push(t):e[r]=t}t.filterTables=e.map(e=>({range:nr(e)}))}return e}let Rh=`Sheet1`;function zh(e,t){if(!e)return Zh();console.debug(`### Loading data ###`);let n=performance.now();if(e[`[Content_Types].xml`]){let n=new Oh(e);if(e=n.convertXlsx(),t)for(let e of n.warningManager.warnings.sort())console.warn(e)}return`version`in e&&e.version<22&&(console.debug(`Migrating data from version`,e.version),e=Vh(e)),e=Hh(e),console.debug(`Data loaded in`,performance.now()-n,`ms`),console.debug(`###`),e}function Bh(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]||0,i=r[e]||0;if(t>i)return 1;if(t<i)return-1}return 0}function Vh(e){let t=performance.now(),n=Ih.getAll().sort((e,t)=>Bh(e.versionFrom,t.versionFrom)),r=n.findIndex(t=>t.versionFrom===e.version.toString());for(let t=r;t<n.length;t++)e=n[t].migrate(e);return console.debug(`Data migrated in`,performance.now()-t,`ms`),e}function Hh(e){return e=Uh(e),e=Wh(e),e}function Uh(e){if(e.uniqueFigureIds)return e;let t=new Set,n=new Tc;for(let r of e.sheets||[])for(let e of r.figures||[])t.has(e.id)&&(e.id+=n.uuidv4()),t.add(e.id);return e.uniqueFigureIds=!0,e}function Wh(e){let t=Object.assign(Zh(),e,{version:22});return t.sheets=t.sheets?t.sheets.map((e,t)=>Object.assign(Xh(`Sheet${t+1}`,`Sheet${t+1}`),e)):[],t.sheets.length===0&&t.sheets.push(Xh(Rh,`Sheet1`)),tl(t.settings.locale)||(t.settings.locale=O),t}function Gh(e,t){return t=Kh(e,t),t=qh(t,`SORT_CELLS`),t=qh(t,`SET_DECIMAL`),t=Jh(e,t),t=Yh(e,t),t}function Kh(e,t){if(Object.keys(e).length!==0)return t;let n=[],r=[],i=e=>{if(e.type===`CREATE_SHEET`)n.push(e.sheetId);else if(`sheetId`in e&&!n.includes(e.sheetId))return{...e,sheetId:Rh};return e};for(let e of t)e.type===`REMOTE_REVISION`?r.push({...e,commands:e.commands.map(i)}):r.push(e);return r}function qh(e,t){let n=[];for(let r of e)r.type===`REMOTE_REVISION`?n.push({...r,commands:r.commands.filter(e=>e.type!==t)}):n.push(r);return n}function Jh(e,t){let n=[],r={};for(let t of e.sheets||[])t.figures?.forEach(e=>{e.tag===`chart`&&(r[e.id]=e.data)});for(let e of t)if(e.type===`REMOTE_REVISION`){let t=[];for(let n of e.commands){let e=n;switch(n.type){case`CREATE_CHART`:r[n.id]=n.definition;break;case`UPDATE_CHART`:if(!r[n.id]){console.log(`Fix chart definition: chart with id ${n.id} not found.`);continue}let t={...r[n.id],...n.definition};e={...n,definition:t},r[n.id]=t;break}t.push(e)}n.push({...e,commands:t})}else n.push(e);return n}function Yh(e,t){let n={};for(let t of e.sheets||[])n[t.id]=t.name;let r=[];for(let e of t)if(e.type===`REMOTE_REVISION`){let t=[];for(let r of e.commands){switch(r.type){case`DUPLICATE_SHEET`:r.sheetNameTo=r.sheetNameTo??tc(n[r.sheetId],Object.values(n));break;case`CREATE_SHEET`:case`RENAME_SHEET`:n[r.sheetId]=r.name||ec(Object.values(n));break}t.push(r)}r.push({...e,commands:t})}else r.push(e);return t}function Xh(e,t){return{id:e,name:t,colNumber:26,rowNumber:100,cells:{},styles:{},formats:{},borders:{},cols:{},rows:{},merges:[],conditionalFormats:[],dataValidationRules:[],figures:[],tables:[],isVisible:!0}}function Zh(e=`Sheet1`){return{version:22,sheets:[Xh(Rh,e)],styles:{},formats:{},borders:{},revisionId:Ve,uniqueFigureIds:!0,settings:{locale:O},pivots:{},pivotNextId:1,customTableStyles:{}}}function Qh(e,t){return{...Xh(e,t),charts:[],images:[]}}function $h(){return{...Zh(),sheets:[Qh(Rh,`Sheet1`)]}}let eg={wrongPasteSelection:T(`This operation is not allowed with multiple selections.`),willRemoveExistingMerge:T(`Cannot perform this action on merged cells. Unmerge the cells and try again.`),wrongFigurePasteOption:T(`Cannot do a special paste of a figure.`),frozenPaneOverlap:T(`This operation is not allowed due to an overlapping frozen pane.`)};function tg(e,t){t.isSuccessful||(t.reasons.includes(`WrongPasteSelection`)?e.raiseError(eg.wrongPasteSelection):t.reasons.includes(`WillRemoveExistingMerge`)?e.raiseError(eg.willRemoveExistingMerge):t.reasons.includes(`WrongFigurePasteOption`)?e.raiseError(eg.wrongFigurePasteOption):t.reasons.includes(`FrozenPaneOverlap`)&&e.raiseError(eg.frozenPaneOverlap))}function ng(e,t,n){tg(e,e.model.dispatch(`PASTE`,{target:t,pasteOption:n}))}function rg(e,t,n,r){n.data&&n.data.version!==22&&e.notifyUser({type:`warning`,text:T(`You copied content from a different version of the application. Only text content will be pasted.`),sticky:!1}),tg(e,e.model.dispatch(`PASTE_FROM_OS_CLIPBOARD`,{target:t,clipboardContent:n,pasteOption:r}))}let ig={Errors:{InvalidRange:T(`The range is invalid`),FirstArgMissing:T(`The argument is missing. Please provide a value`),SecondArgMissing:T(`The second argument is missing. Please provide a value`),MinNaN:T(`The minpoint must be a number`),MidNaN:T(`The midpoint must be a number`),MaxNaN:T(`The maxpoint must be a number`),ValueUpperInflectionNaN:T(`The first value must be a number`),ValueLowerInflectionNaN:T(`The second value must be a number`),MinBiggerThanMax:T(`Minimum must be smaller then Maximum`),MinBiggerThanMid:T(`Minimum must be smaller then Midpoint`),MidBiggerThanMax:T(`Midpoint must be smaller then Maximum`),LowerBiggerThanUpper:T(`Lower inflection point must be smaller than upper inflection point`),MinInvalidFormula:T(`Invalid Minpoint formula`),MaxInvalidFormula:T(`Invalid Maxpoint formula`),MidInvalidFormula:T(`Invalid Midpoint formula`),ValueUpperInvalidFormula:T(`Invalid upper inflection point formula`),ValueLowerInvalidFormula:T(`Invalid lower inflection point formula`),EmptyRange:T(`A range needs to be defined`),ValueCellIsInvalidFormula:T(`At least one of the provided values is an invalid formula`),Unexpected:T(`The rule is invalid for an unknown reason`)},ColorScale:T(`Color scale`),IconSet:T(`Icon set`),DataBar:T(`Data bar`)},ag={IsEmpty:T(`Is empty`),IsNotEmpty:T(`Is not empty`),ContainsText:T(`Contains`),NotContains:T(`Does not contain`),BeginsWith:T(`Starts with`),EndsWith:T(`Ends with`),Equal:T(`Is equal to`),NotEqual:T(`Is not equal to`),GreaterThan:T(`Is greater than`),GreaterThanOrEqual:T(`Is greater than or equal to`),LessThan:T(`Is less than`),LessThanOrEqual:T(`Is less than or equal to`),Between:T(`Is between`),NotBetween:T(`Is not between`)},og={Series:T(`Series`),BackgroundColor:T(`Background color`),StackedBarChart:T(`Stacked bar chart`),StackedLineChart:T(`Stacked line chart`),StackedAreaChart:T(`Stacked area chart`),StackedColumnChart:T(`Stacked column chart`),CumulativeData:T(`Cumulative data`),TreatLabelsAsText:T(`Treat labels as text`),AggregatedChart:T(`Aggregate`),Errors:{Unexpected:T(`The chart definition is invalid for an unknown reason`),InvalidDataSet:T(`The dataset is invalid`),InvalidLabelRange:T(`Labels are invalid`),InvalidScorecardKeyValue:T(`The key value is invalid`),InvalidScorecardBaseline:T(`The baseline value is invalid`),InvalidGaugeDataRange:T(`The data range is invalid`),EmptyGaugeRangeMin:T(`A minimum range limit value is needed`),GaugeRangeMinNaN:T(`The minimum range limit value must be a number`),EmptyGaugeRangeMax:T(`A maximum range limit value is needed`),GaugeRangeMaxNaN:T(`The maximum range limit value must be a number`),GaugeRangeMinBiggerThanRangeMax:T(`Minimum range limit must be smaller than maximum range limit`),GaugeLowerInflectionPointNaN:T(`The lower inflection point value must be a number`),GaugeUpperInflectionPointNaN:T(`The upper inflection point value must be a number`)}},sg={Custom:T(`Custom`)},cg=T(`Merged cells are preventing this operation. Unmerge those cells and try again.`),lg=T(`The header row of a table can't be moved.`),ug={Errors:{Unexpected:T(`Cannot split the selection for an unknown reason`),NoSplitSeparatorInSelection:T(`There is no match for the selected separator in the selection`),MoreThanOneColumnSelected:T(`Only a selection from a single column can be split`),SplitWillOverwriteContent:T(`Splitting will overwrite existing content`)}},dg={Errors:{Unexpected:T(`Cannot remove duplicates for an unknown reason`),MoreThanOneRangeSelected:T(`Please select only one range of cells`),EmptyTarget:T(`Please select a range of cells containing values.`),NoColumnsProvided:T(`Please select at latest one column to analyze.`),WillRemoveExistingMerge:eg.willRemoveExistingMerge}},fg={DateIs:{today:T(`today`),yesterday:T(`yesterday`),tomorrow:T(`tomorrow`),lastWeek:T(`in the past week`),lastMonth:T(`in the past month`),lastYear:T(`in the past year`)},DateIsBefore:{today:T(`today`),yesterday:T(`yesterday`),tomorrow:T(`tomorrow`),lastWeek:T(`one week ago`),lastMonth:T(`one month ago`),lastYear:T(`one year ago`)},CriterionError:{notEmptyValue:T(`The value must not be empty`),numberValue:T(`The value must be a number`),dateValue:T(`The value must be a date`),validRange:T(`The value must be a valid range`)}},pg={Errors:{Unexpected:T(`The table zone is invalid for an unknown reason`),TableOverlap:T(`You cannot create overlapping tables.`),NonContinuousTargets:T(`A table can only be created on a continuous selection.`),InvalidRange:T(`The range is invalid`),TargetOutOfSheet:T(`The range is out of the sheet`)},Checkboxes:{hasFilters:T(`Filter button`),headerRow:T(`Header row(s)`),bandedRows:T(`Banded rows`),firstColumn:T(`First column`),lastColumn:T(`Last column`),bandedColumns:T(`Banded columns`),automaticAutofill:T(`Automatically autofill formulas`),totalRow:T(`Total row`),isDynamic:T(`Auto-adjust to formula result`)},Tooltips:{filterWithoutHeader:T(`Cannot have filters without a header row`),isDynamic:T(`For tables based on array formulas only`)}},mg={labels:{no_calculations:T(`No calculations`),"%_of_grand_total":T(`% of grand total`),"%_of_col_total":T(`% of column total`),"%_of_row_total":T(`% of row total`),"%_of":T(`% of`),"%_of_parent_row_total":T(`% of parent row total`),"%_of_parent_col_total":T(`% of parent column total`),"%_of_parent_total":T(`% of parent total`),difference_from:T(`Difference from`),"%_difference_from":T(`% difference from`),running_total:T(`Running total`),"%_running_total":T(`% Running total`),rank_asc:T(`Rank smallest to largest`),rank_desc:T(`Rank largest to smallest`),index:T(`Index`)},descriptions:{"%_of_grand_total":()=>T(`Displayed as % of grand total`),"%_of_col_total":()=>T(`Displayed as % of column total`),"%_of_row_total":()=>T(`Displayed as % of row total`),"%_of":e=>T(`Displayed as % of "%s"`,e),"%_of_parent_row_total":e=>T(`Displayed as % of parent row total of "%s"`,e),"%_of_parent_col_total":()=>T(`Displayed as % of parent column total`),"%_of_parent_total":e=>T(`Displayed as % of parent "%s" total`,e),difference_from:e=>T(`Displayed as difference from "%s"`,e),"%_difference_from":e=>T(`Displayed as % difference from "%s"`,e),running_total:e=>T(`Displayed as running total based on "%s"`,e),"%_running_total":e=>T(`Displayed as % running total based on "%s"`,e),rank_asc:e=>T(`Displayed as rank from smallest to largest based on "%s"`,e),rank_desc:e=>T(`Displayed as rank largest to smallest based on "%s"`,e),index:()=>T(`Displayed as index`)},documentation:{no_calculations:T(`Displays the value that is entered in the field.`),"%_of_grand_total":T(`Displays values as a percentage of the grand total of all the values or data points in the report.`),"%_of_col_total":T(`Displays all the values in each column or series as a percentage of the total for the column or series.`),"%_of_row_total":T(`Displays the value in each row or category as a percentage of the total for the row or category.`),"%_of":T(`Displays values as a percentage of the value of the Base item in the Base field.`),"%_of_parent_row_total":T(`Calculates values as follows:
47
47
  (value for the item) / (value for the parent item on rows)`),"%_of_parent_col_total":T(`Calculates values as follows:
48
48
  (value for the item) / (value for the parent item on columns)`),"%_of_parent_total":T(`Calculates values as follows:
49
49
  (value for the item) / (value for the parent item of the selected Base field)`),difference_from:T(`Displays values as the difference from the value of the Base item in the Base field.`),"%_difference_from":T(`Displays values as the percentage difference from the value of the Base item in the Base field.`),running_total:T(`Displays the value for successive items in the Base field as a running total.`),"%_running_total":T(`Calculates the value as a percentage for successive items in the Base field that are displayed as a running total.`),rank_asc:T(`Displays the rank of selected values in a specific field, listing the smallest item in the field as 1, and each larger value with a higher rank value.`),rank_desc:T(`Displays the rank of selected values in a specific field, listing the largest item in the field as 1, and each smaller value with a higher rank value.`),index:T(`Calculates values as follows:
@@ -167,7 +167,7 @@ stores.inject(MyMetaStore, storeInstance);
167
167
  `)+`
168
168
  `}return(e){return new xE(this.scope,this.code,e)}toString(){return wE(this.code)}},xE=class{scope;returnExpression;code;constructor(e,t,n){this.scope=e,this.returnExpression=n,this.code=wE(t)}toString(){return this.code}assignResultToVariable(){if(this.scope.isAlreadyDeclared(this.returnExpression))return this;let e=this.scope.nextVariableName(),t=new bE(this.scope);return t.append(this.code),t.append(`const ${e} = ${this.returnExpression};`),t.return(e)}},SE=class{nextId=1;declaredVariables=new Set;nextVariableName(){let e=`_${this.nextId++}`;return this.declaredVariables.add(e),e}isAlreadyDeclared(e){return this.declaredVariables.has(e)}};function CE(e){return e.split(`
169
169
  `).map(e=>e.trim()).filter(e=>e!==``)}function wE(e){let t=``,n=0,r=CE(e);for(let e of r)e.startsWith(`}`)&&n--,t+=` `.repeat(n)+e+`
170
- `,e.endsWith(`{`)&&n++;return t.trim()}let TE=zT.content,EE={"=":`EQ`,"+":`ADD`,"-":`MINUS`,"*":`MULTIPLY`,"/":`DIVIDE`,">=":`GTE`,"<>":`NE`,">":`GT`,"<=":`LTE`,"<":`LT`,"^":`POWER`,"&":`CONCATENATE`},DE={"-":`UMINUS`,"+":`UPLUS`,"%":`UNARY.PERCENT`},OE={};function kE(e){return AE(Nh(e))}function AE(e){try{return jE(e)}catch(t){return{tokens:e,dependencies:[],execute:function(){return t},isBadExpression:!0}}}function jE(e){let{dependencies:t,literalValues:n,symbols:r}=NE(e),i=ME(e);if(!OE[i]){let t=gC([...e]),n=new SE,s=0,c=0,l=0;if(t.type===`BIN_OPERATION`&&t.value===`:`||t.type===`EMPTY`)throw new ra(T(`Invalid formula`));let u=o(t),d=new bE;d.append(u),d.append(`return ${u.returnExpression};`),OE[i]=Function(`deps`,`ref`,`range`,`getSymbolValue`,`ctx`,d.toString());function a(e){let{args:t}=e,n=TE[e.value.toUpperCase()];if(!n)throw new sa(T(`Unknown function: "%s"`,e.value));PE(e);let r=[];for(let e=0;e<t.length;e++){let i=n.getArgToFocus(e+1)-1,a=n.args[i],s=t[e],c=a.type||[],l=c.includes(`META`),u=c.some(e=>FE(e));r.push(o(s,l,u))}return r}function o(e,t=!1,i=!1){let u=new bE(n);if(e.type!==`REFERENCE`&&!(e.type===`BIN_OPERATION`&&e.value===`:`)&&t)throw new ra(T(`Argument must be a reference to a cell or range.`));switch(e.debug&&u.append(`debugger;`),e.type){case`BOOLEAN`:return u.return(`{ value: ${e.value} }`);case`NUMBER`:return u.return(`this.literalValues.numbers[${c++}]`);case`STRING`:return u.return(`this.literalValues.strings[${s++}]`);case`REFERENCE`:return!t&&e.value.includes(`:`)||i?u.return(`range(deps[${l++}])`):u.return(`ref(deps[${l++}], ${t?`true`:`false`})`);case`FUNCALL`:let n=a(e).map(e=>e.assignResultToVariable());u.append(...n);let d=e.value.toUpperCase();return u.return(`ctx['${d}'](${n.map(e=>e.returnExpression)})`);case`UNARY_OPERATION`:{let t=DE[e.value],n=o(e.operand,!1,!1).assignResultToVariable();return u.append(n),u.return(`ctx['${t}'](${n.returnExpression})`)}case`BIN_OPERATION`:{let t=EE[e.value],n=o(e.left,!1,!1).assignResultToVariable(),r=o(e.right,!1,!1).assignResultToVariable();return u.append(n),u.append(r),u.return(`ctx['${t}'](${n.returnExpression}, ${r.returnExpression})`)}case`SYMBOL`:let f=r.indexOf(e.value);return u.return(`getSymbolValue(this.symbols[${f}])`);case`EMPTY`:return u.return(`undefined`)}}}return{execute:OE[i],dependencies:t,literalValues:n,symbols:r,tokens:e,isBadExpression:!1}}function ME(e){let t=``;for(let n of e)switch(n.type){case`STRING`:t+=`|S|`;break;case`NUMBER`:t+=`|N|`;break;case`REFERENCE`:case`INVALID_REFERENCE`:n.value.includes(`:`)?t+=`|R|`:t+=`|C|`;break;case`SPACE`:break;default:t+=n.value;break}return t}function NE(e){let t={numbers:[],strings:[]},n=[],r=[];for(let i of e)switch(i.type){case`INVALID_REFERENCE`:case`REFERENCE`:n.push(i.value);break;case`STRING`:let e=et(i.value);t.strings.push({value:e});break;case`NUMBER`:{let e=ji(i.value,O);t.numbers.push({value:e});break}case`SYMBOL`:r.push(at(i.value,`'`))}return{dependencies:n,literalValues:t,symbols:r}}function PE(e){let t=e.args.length,n=e.value.toUpperCase(),r=TE[n];if(t<r.minArgRequired)throw new ra(T(`Invalid number of arguments for the %s function. Expected %s minimum, but got %s instead.`,n,r.minArgRequired.toString(),t.toString()));if(t>r.maxArgPossible)throw new ra(T(`Invalid number of arguments for the %s function. Expected %s maximum, but got %s instead.`,n,r.maxArgPossible.toString(),t.toString()));let i=r.nbrArgRepeating;if(i>1){let e=r.args.length-i;if((t-e)%i!==0)throw new ra(T(`Invalid number of arguments for the %s function. Expected all arguments after position %s to be supplied by groups of %s arguments`,n,e.toString(),i.toString()))}}function FE(e){return e.startsWith(`RANGE`)}let IE=zT.content;function LE(e){try{return vC(gC(e)).filter(e=>e.type===`FUNCALL`&&!IE[e.value.toUpperCase()]?.isExported).length===0}catch{return!1}}function RE(e,t){if(!e.some(e=>e.type===`SYMBOL`&&t.includes(e.value.toUpperCase())))return[];let n;try{n=gC(e)}catch{return[]}return zE(n,t)}function zE(e,t){return vC(e).filter(e=>e.type===`FUNCALL`&&t.includes(e.value.toUpperCase())).map(e=>({functionName:e.value.toUpperCase(),args:e.args}))}let BE=[`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`];function VE(e,t){let n=`"${t?`${e.name}:${t}`:e.name}"`,r=e.string===e.name?n:e.string+n;return{text:n,description:e.string+(e.help?` (${e.help})`:``),htmlContent:[{value:n,color:vE.STRING}],fuzzySearchKey:r}}function HE(e){let t=`"${e.id}"`,n=e.displayName+e.fieldName+t;return{text:t,description:e.displayName,htmlContent:[{value:t,color:vE.STRING}],fuzzySearchKey:n}}function UE(e,t){let n=e.end,r=e.end;e.type!==`ARG_SEPARATOR`&&(n=e.start),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}function WE(e,t){let n=e.end,r=e.end;e.type!==`LEFT_PAREN`&&(n=e.start),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}function GE(e){let t=e.functionContext?.args[0];if(!(!t||![`STRING`,`NUMBER`].includes(t.type)))return t.value}function KE(e){return RE(e,BE)[0]}function qE(e){return RE(e,BE)}function JE(e){return RE(e,BE).length}let YE=new h;YE.add(`SPREADSHEET`,!1),l_.add(`pivot_ids`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||![`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`].includes(t.parent.toUpperCase())||t.argPosition!==0)return;let n=this.getters.getPivotIds();if(!n.includes(e.value))return n.map(e=>{let t=this.getters.getPivotCoreDefinition(e),n=`${this.getters.getPivotFormulaId(e)}`;return{text:n,description:t.name,htmlContent:[{value:n,color:vE.NUMBER}],fuzzySearchKey:n+t.name}}).filter(S)},selectProposal:WE}),l_.add(`pivot_measures`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(t?.parent.toUpperCase()!==`PIVOT.VALUE`||t.argPosition!==1)return[];let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return[];let i=this.getters.getPivot(r);return i.init(),i.isValid()?i.definition.measures.map(e=>{if(e.fieldName===`__count`){let e=`"__count"`;return{text:e,description:T(`Count`),htmlContent:[{value:e,color:vE.STRING}],fuzzySearchKey:T(`Count`)+e}}return HE(e)}).filter(S):[]},selectProposal:UE}),l_.add(`pivot_group_fields`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!XE(e)&&!ZE(e))return;let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);i.init();let a=i.getFields(),{columns:o,rows:s}=i.definition,c=t.args;t?.parent.toUpperCase()===`PIVOT.VALUE`?(c=c.filter((e,t)=>t%2==0),c=c.slice(1,t.argPosition)):c=c.filter((e,t)=>t%2==1);let l=c.map(e=>e?.value).filter(S),u=o.map(e=>e.nameWithGranularity),d=s.map(e=>e.nameWithGranularity),f=[],p=[`ARG_SEPARATOR`,`SPACE`].includes(e.type)?l.at(-1):l.at(-2),m=YE.get(i.type);if(m&&p?.startsWith(`#`)&&(p=p.slice(1)),p===void 0&&(f.push(u[0]),f.push(d[0])),d.includes(p)){let e=d[d.indexOf(p)+1];f.push(e),f.push(u[0])}if(u.includes(p)){let e=u[u.indexOf(p)+1];f.push(e)}let h=f.filter(S);return h.map(e=>{let[t,n]=e.split(`:`),r=a[t];return r?VE(r,n):void 0}).concat(h.map(e=>{if(!m)return;let t=a[e.split(`:`)[0]];if(!t)return;let n=`"#${e}"`;return{text:n,description:T(`%s (positional)`,t.string)+(t.help?` (${t.help})`:``),htmlContent:[{value:n,color:vE.STRING}],fuzzySearchKey:t.string+n}})).filter(S)},selectProposal:UE});function XE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==0}function ZE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==1}l_.add(`pivot_group_values`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!e||!QE(e)&&!$E(e))return;let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);if(!i.isValid())return;let a=t.argPosition,o=e.functionContext?.args[a-1]?.value;if(!o)return;let s;try{s=i.definition.getDimension(o)}catch{return}return s.granularity===`month_number`?Object.values(Mo).map((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:vE.NUMBER}]})):s.granularity===`quarter_number`?[1,2,3,4].map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:T(`Quarter %s`,e),htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`day_of_month`?x(1,32).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`iso_week_number`?x(0,54).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`day_of_week`?x(1,8).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`hour_number`?x(0,24).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`minute_number`?x(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`second_number`?x(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):i.getPossibleFieldValues(s).map(({value:e,label:t})=>{let n=typeof e==`string`,r=n?`"${e}"`:e.toString(),i=n?vE.STRING:vE.NUMBER,a=t===e?``:t;return{text:r,description:a,htmlContent:[{value:r,color:i}],fuzzySearchKey:r+a}})},selectProposal:UE});function QE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==1}function $E(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==0}l_.add(`sheet_names`,{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return e.type===`SYMBOL`||e.type===`UNKNOWN`&&e.value.startsWith(`'`)?this.getters.getSheetIds().map(e=>{let t=ot(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith(`'`)?t:`'`+t}}):[]},selectProposal(e,t){let n=e.start,r=e.end;this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t+`!`)}});let eD=new h;eD.add(`ALPHANUMERIC_INCREMENT_MODIFIER`,{apply:(e,t)=>{e.current+=e.increment;let n=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,`0`)}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:n},tooltip:{props:{content:n}}}}}).add(`INCREMENT_MODIFIER`,{apply:(e,t,n)=>{e.current+=e.increment;let r=e.current.toString(),i=n.getLocale(),a=B(e.current,{format:t.cell?.format,locale:i});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:r},tooltip:r?{props:{content:a}}:void 0}}}).add(`DATE_INCREMENT_MODIFIER`,{apply:(e,t,n)=>{let r=R(e.current,n.getLocale());r.setFullYear(r.getFullYear()+e.increment.years||0),r.setMonth(r.getMonth()+e.increment.months||0),r.setDate(r.getDate()+e.increment.days||0);let i=di(r);e.current=i;let a=n.getLocale(),o=B(i,{format:t.cell?.format,locale:a});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i.toString()},tooltip:i?{props:{content:o}}:void 0}}}).add(`COPY_MODIFIER`,{apply:(e,t,n)=>{let r=t.cell?.content||``,i={locale:n.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:r},tooltip:r?{props:{content:t.cell?hs(t.cell,i).formattedValue:``}}:void 0}}}).add(`FORMULA_MODIFIER`,{apply:(e,t,n,r)=>{e.current+=e.increment;let i=0,a=0;switch(r){case`up`:i=0,a=-e.current;break;case`down`:i=0,a=e.current;break;case`left`:i=-e.current,a=0;break;case`right`:i=e.current,a=0;break}let o=t.cell;if(!o||!o.isFormula)return{cellData:{}};let s=t.sheetId,c=n.getTranslatedCellFormula(s,i,a,o.compiledFormula.tokens);return{cellData:{border:t.border,style:o.style,format:o.format,content:c},tooltip:c?{props:{content:c}}:void 0}}});let tD=new h,nD=/(\d+)$/,rD=/^(.*\D+)/,iD=/^(.*\D+)(\d+)$/;function aD(e,t,n){let r=[],i=!1;for(let a of t){a===e&&(i=!0);let t=a===void 0||a.isFormula?void 0:hs(a,{locale:O,format:a.format});if(t&&n(t))r.push(t);else{if(i)return r;r=[]}}return r}function oD(e){let t=[],n=e[0];for(let r=1;r<e.length;r++){let i=e[r];t.push(i-n),n=i}return t.reduce((e,t)=>e+t,0)/t.length}function sD(e){let t=1;return e.length>=2&&(t=oD(e)*e.length),t}function cD(e){return e.length<2?e[0]||{years:0,months:0,days:0}:e.every(t=>t.years===e[0].years&&t.months===e[0].months&&t.days===e[0].days)?e[0]:void 0}function lD(e){if(e.length<2)return 1;let t=e.map(e=>R(e,O)),n=cD(uD(t));if(n===void 0)return;let r=Object.values(n).filter(e=>e!==0).length===1,i=Object.values(n).every(e=>e===0);if(!r||i){let n=t.map((e,n)=>{if(n===0)return 0;let r=t[n-1];return Math.floor(e.getTime())-Math.floor(r.getTime())}).slice(1);if(n.every(e=>e===n[0]))return e.length*(e[1]-e[0])}return{years:n.years*e.length,months:n.months*e.length,days:n.days*e.length}}tD.add(`simple_value_copy`,{condition:(e,t)=>t.length===1&&!e.isFormula&&!(e.format&&Ko(e.format)),generateRule:()=>({type:`COPY_MODIFIER`}),sequence:10}).add(`increment_alphanumeric_value`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`text`&&iD.test(e.content),generateRule:(e,t,n)=>{let r=parseInt(e.content.match(nD)[0]),i=e.content.match(rD)[0],a=e.content.length-i.length,o=aD(e,t,e=>e.type===`text`&&iD.test(e.value)).filter(e=>i===(e.value??``).toString().match(rD)[0]).map(e=>parseInt((e.value??``).toString().match(nD)[0])),s=sD(o);return[`up`,`left`].includes(n)&&o.length===1&&(s=-s),{type:`ALPHANUMERIC_INCREMENT_MODIFIER`,prefix:i,current:r,increment:s,numberPostfixLength:a}},sequence:15}).add(`copy_text`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`text`,generateRule:()=>({type:`COPY_MODIFIER`}),sequence:20}).add(`update_formula`,{condition:e=>e.isFormula,generateRule:(e,t)=>({type:`FORMULA_MODIFIER`,increment:t.length,current:0}),sequence:30}).add(`increment_dates`,{condition:(e,t)=>!e.isFormula&&hs(e,{locale:O}).type===`number`&&!!e.format&&Ko(e.format),generateRule:(e,t)=>{let n=lD(aD(e,t,e=>e.type===`number`&&!!e.format&&Ko(e.format)).map(e=>Number(e.value)));if(n===void 0)return{type:`COPY_MODIFIER`};let r=hs(e,{locale:O});return typeof n==`object`?{type:`DATE_INCREMENT_MODIFIER`,increment:n,current:r.type===`number`?r.value:0}:{type:`INCREMENT_MODIFIER`,increment:n,current:r.type===`number`?r.value:0}},sequence:25}).add(`increment_number`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`number`,generateRule:(e,t,n)=>{let r=aD(e,t,e=>e.type===`number`&&!Ko(e.format||``)).map(e=>Number(e.value)),i=sD(r);[`up`,`left`].includes(n)&&r.length===1&&(i=-i);let a=hs(e,{locale:O});return{type:`INCREMENT_MODIFIER`,increment:i,current:a.type===`number`?a.value:0}},sequence:40});function uD(e){return e.length<2?[{years:0,months:0,days:0}]:e.map((t,n)=>{if(n===0)return{years:0,months:0,days:0};let r=D.fromTimestamp(e[n-1].getTime()),i=yi(r,t),a=_i(r,t)%12;return r.setFullYear(r.getFullYear()+i),r.setMonth(r.getMonth()+a),{years:i,months:a,days:vi(r,t)}}).slice(1)}let dD=new h;var fD=class extends t.Component{static template=`o-spreadsheet-GaugeChartComponent`;canvas=(0,t.useRef)(`chartContainer`);get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){(0,t.useEffect)(()=>gg(this.canvas.el,this.runtime),()=>{let e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]})}};fD.props={figure:Object};function pD(e){return e=en(e).replace(`#`,``),e.length===8?e.slice(6)+e.slice(0,6):e}var mD=class e extends jg{dataSets;labelRange;background;legendPosition;stacked;aggregated;type=`bar`;dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.horizontal=e.horizontal,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`bar`,labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`bar`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:this.horizontal,showValues:this.showValues}}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function hD(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r));let i={format:e_(t,e.dataSets),locale:t.getLocale()},a=Od(e.background),o=Zg(e,n,a,{...i,horizontalChart:e.horizontal}),s=a_(a);e.legendPosition===`none`?s.display=!1:s.position=e.legendPosition,o.options.plugins.legend={...o.options.plugins?.legend,...s},o.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})},o.options.indexAxis=e.horizontal?`y`:`x`,o.options.scales={};let c={ticks:{padding:5,color:a}},l={beginAtZero:!0,ticks:{color:a,callback:Bd(i)}},u=e.horizontal?l:c,d=e.horizontal?c:l,{useLeftAxis:f,useRightAxis:p}=Pd(e.getDefinition());o.options.scales.x={...u,title:Nd(e.axesDesign?.x)},f&&(o.options.scales.y={...d,position:`left`,title:Nd(e.axesDesign?.y)}),p&&(o.options.scales.y1={...d,position:`right`,title:Nd(e.axesDesign?.y1)}),e.stacked&&(o.options.scales.x.stacked=!0,f&&(o.options.scales.y.stacked=!0),p&&(o.options.scales.y1.stacked=!0)),o.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,horizontal:e.horizontal,callback:Bd(i)};let m=e.getDefinition(),h=Vd(m,r.length),g=[];for(let t in r){let{label:n,data:i,hidden:a}=r[t],s=h.next(),c={label:n,data:i,hidden:a,borderColor:m.background||`#FFFFFF`,borderWidth:+!!m.stacked,backgroundColor:s};o.data.datasets.push(c),m.dataSets?.[t]?.label&&(c.label=m.dataSets[t].label),m.dataSets?.[t]?.yAxisId&&!e.horizontal&&(c.yAxisID=m.dataSets[t].yAxisId);let l=m.dataSets?.[t].trend;if(!l?.display||e.horizontal)continue;let u=Id(l,c);u&&g.push(u)}if(g.length){let e=Math.max(...g.map(e=>e.data.length));o.options.scales.x1={...u,labels:Array(e).fill(``),offset:!1,display:!1},g.forEach(e=>o.data.datasets.push(e)),o.options.plugins.tooltip.callbacks.title=function(e){return e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``}}return{chartJsConfig:o,background:e.background||`#FFFFFF`}}let gD={second:1e3,minute:1e3*60,hour:1e3*3600,day:1e3*3600*24,month:1e3*3600*24*30,year:1e3*3600*24*365},_D={inSeconds:function(e){return Math.floor(e/gD.second)},inMinutes:function(e){return Math.floor(e/gD.minute)},inHours:function(e){return Math.floor(e/gD.hour)},inDays:function(e){return Math.floor(e/gD.day)},inMonths:function(e){return Math.floor(e/gD.month)},inYears:function(e){return Math.floor(e/gD.year)}},vD=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function yD(e,t,n){let r=bD(t),i=SD(e,r,n),a={};return i&&(a[i]=r),{parser:r,displayFormats:a,unit:i??!1,tooltipFormat:r}}function bD(e){let t=e.indexOf(`h`);return e=t>=0?e.slice(0,t).replace(/m/g,`M`)+e.slice(t):e.replace(/m/g,`M`),e.includes(`a`)||(e=e.replace(/h/g,`H`)),e}function xD(e){return e.includes(`s`)?`second`:e.includes(`m`)?`minute`:e.includes(`h`)||e.includes(`H`)?`hour`:e.includes(`d`)?`day`:e.includes(`M`)?`month`:`year`}function SD(e,t,n){let r=e.map(e=>$r(e,n)?.jsDate);if(r.some(e=>e===void 0)||e.length<2)return;let i=r.map(e=>e.getTime()),a=Gt(i)-Kt(i),o=xD(t);return gD.second>=gD[o]&&_D.inSeconds(a)<180?`second`:gD.minute>=gD[o]&&_D.inMinutes(a)<180?`minute`:gD.hour>=gD[o]&&_D.inHours(a)<96?`hour`:gD.day>=gD[o]&&_D.inDays(a)<90?`day`:gD.month>=gD[o]&&_D.inMonths(a)<36?`month`:`year`}function CD(e,t){if(e.length===0||e.every(e=>!e))return{labels:e,dataSetsValues:t};let n=[...e],r=y(t);for(let e=0;e<n.length;e++)if(!n[e]){n[e]=Dt(n,e);for(let t of r)t.data[e]=void 0}return{labels:n,dataSetsValues:r}}function wD(e,t){return OD(e,t)||kD(e,t)}function TD(e,t){return ED(e,t)&&jD()?`time`:DD(e,t)?`linear`:`category`}function ED(e,t){return!e.labelsAsText&&OD(e,t)}function DD(e,t){return!e.labelsAsText&&kD(e,t)}function OD(e,t){if(!e.labelRange||!kD(e,t))return!1;let n=Qg(t,e.labelRange,jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle));return!!(n&&vD.test(n))}function kD(e,t){if(!e.labelRange)return!1;let n=t.getRangeValues(e.labelRange);return jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),!(n.some(e=>isNaN(Number(e))&&e)||n.every(e=>!e))}let AD=!1;function jD(){let e=o_();if(!e)return!1;let t=new e._adapters._date({})._id===`luxon`;return!t&&!AD&&(AD=!0,console.warn(`'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled.`)),t}function MD(e,t,n,r){let i=[],a=[],o=[],s=t.data.length;if(t.hidden||s<2)return;switch(n){case`category`:for(let e=0;e<s;e++)typeof t.data[e]==`number`&&(i.push(t.data[e]),a.push(e+1)),o.push(e+1);break;case`linear`:for(let e of t.data){let t=Number(e.x);isNaN(t)||(typeof e.y==`number`&&(i.push(e.y),a.push(t)),o.push(t))}break;case`time`:for(let e of t.data){let t=P({value:e.x},r);e.y!==null&&(i.push(e.y),a.push(t)),o.push(t)}break}let c=Math.min(...o),l=Math.max(...o);if(l===c)return;let u=5*o.length,d=(l-c)/u,f=x(c,l+d/2,d),p=Rd(e,i,a,f);if(p.length)return Ld(t,e,p,f)}function ND(e,t){let n=TD(e,t),r=$g(t,e.dataSets,e.labelRange),i=n===`linear`?r.values:r.formattedValues,a=t_(t,e.dataSets),o=jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle);o&&i.shift(),{labels:i,dataSetsValues:a}=Jg(i,a),n===`time`&&({labels:i,dataSetsValues:a}=CD(i,a)),e.aggregated&&({labels:i,dataSetsValues:a}=Yg(i,a));let s=t.getLocale(),c=n===`category`,l=e_(t,e.dataSets),u={format:l,locale:s,truncateLabels:c},d=Od(e.background),f=Zg(e,i,d,u),p=a_(d,{labels:{generateLabels(e){let{data:t}=e,n=o_().defaults.plugins.legend.labels.generateLabels(e);for(let[e,r]of n.entries())r.fillStyle=t.datasets[e].borderColor;return n}}});e.legendPosition===`none`?p.display=!1:p.position=e.legendPosition,Object.assign(f.options.plugins.legend||{},p),f.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})};let m={ticks:{padding:5,color:d},title:Nd(e.axesDesign?.x)};f.options.scales={x:m};let h={beginAtZero:!0,ticks:{color:d,callback:Bd(u)}},{useLeftAxis:g,useRightAxis:_}=Pd(e.getDefinition());g&&(f.options.scales.y={...h,position:`left`,title:Nd(e.axesDesign?.y)}),_&&(f.options.scales.y1={...h,position:`right`,title:Nd(e.axesDesign?.y1)}),`stacked`in e&&e.stacked&&(g&&(f.options.scales.y.stacked=!0),_&&(f.options.scales.y1.stacked=!0)),f.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:Bd(u)};let v=Qg(t,e.labelRange,o);if(n===`time`){let e={type:`time`,time:yD(i,v,s)};Object.assign(f.options.scales.x,e),f.options.scales.x.ticks.maxTicksLimit=15}else n===`linear`&&(f.options.scales.x.type=`linear`,f.options.scales.x.ticks.callback=e=>B(e,{format:v,locale:s}),f.options.plugins.tooltip.callbacks.label=e=>{let t,n;e.dataset.xAxisID===`x1`?(t=a[e.datasetIndex].data[e.dataIndex].y,n=``):(t=a[e.datasetIndex].data[e.dataIndex],n=r.values[e.dataIndex]),ki(n,s)&&(n=P(n,s));let i=B(n,{locale:s,format:v}),o=B(t,{locale:s,format:l}),c=e.dataset.label;return i?`${c}: (${i}, ${o})`:`${c}: ${o}`});let ee=`fillArea`in e?e.fillArea:!1,te=`stacked`in e?e.stacked:!1,ne=`cumulative`in e?e.cumulative:!1,re=e.getDefinition(),ie=Vd(re,a.length);for(let[e,{label:t,data:r,hidden:o}]of a.entries()){let a=ie.next(),s=ln(a);if(ee&&(s.a=.4),ne){let e=0;r=r.map(t=>isNaN(t)?t:(e+=parseFloat(t),e))}[`linear`,`time`].includes(n)&&(r=r.map((e,t)=>({x:i[t]||void 0,y:e})));let c=cn(s),l={label:t,data:r,hidden:o,tension:0,borderColor:a,backgroundColor:c,pointBackgroundColor:a,fill:ee?n_(e,te):!1};f.data.datasets.push(l)}let ae=0,oe=[];for(let[e,t]of f.data.datasets.entries()){re.dataSets?.[e]?.label&&(t.label=re.dataSets[e].label),re.dataSets?.[e]?.yAxisId&&(t.yAxisID=re.dataSets[e].yAxisId);let r=re.dataSets?.[e].trend;if(!r?.display)continue;let i=MD(r,t,n,s);i&&(ae=Math.max(ae,i.data.length),oe.push(i),a.push(i))}return oe.length&&(f.options.scales.x1={...m,display:!1},(n===`category`||n===`time`)&&(f.options.scales.x1.type=`category`,f.options.scales.x1.labels=x(0,ae).map(e=>e.toString()),f.options.scales.x1.offset=!1),oe.forEach(e=>f.data.datasets.push(e))),f.options.plugins.tooltip.callbacks.title=function(e){return n!==`linear`&&e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``},{chartJsConfig:f,background:e.background||`#FFFFFF`}}var PD=class e extends jg{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type=`combo`;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId),type:this.dataSetDesign?.[t]?.type??(t?`line`:`bar`)});return{type:`combo`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}static getDefinitionFromContextCreation(e){let t=(e.range??[]).map((e,t)=>({...e,type:t?`line`:`bar`}));return{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},labelRange:e.auxiliaryRange||void 0,type:`combo`,axesDesign:e.axesDesign,showValues:e.showValues}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}};function FD(e,t){let n=e.dataSets.length?e_(t,[e.dataSets[0]]):void 0,r=e_(t,e.dataSets.slice(1)),i=t.getLocale(),a=$g(t,e.dataSets,e.labelRange).formattedValues,o=t_(t,e.dataSets);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&a.shift(),{labels:a,dataSetsValues:o}=Jg(a,o),e.aggregated&&({labels:a,dataSetsValues:o}=Yg(a,o));let s={format:n,locale:i},c=Od(e.background),l=Zg(e,a,c,s),u=a_(c);e.legendPosition===`none`?u.display=!1:u.position=e.legendPosition,l.options.plugins.legend={...l.options.plugins?.legend,...u},l.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})},l.options.scales={x:{ticks:{padding:5,color:c},title:Nd(e.axesDesign?.x)}};let d={beginAtZero:!0,ticks:{color:c,callback:Bd({format:n,locale:i})}},f={beginAtZero:!0,ticks:{color:c,callback:Bd({format:r,locale:i})}},p=e.getDefinition(),{useLeftAxis:m,useRightAxis:h}=Pd(p);m&&(l.options.scales.y={...d,position:`left`,title:Nd(e.axesDesign?.y)}),h&&(l.options.scales.y1={...f,position:`right`,grid:{display:!1},title:Nd(e.axesDesign?.y1)}),l.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:Bd({format:n,locale:i})};let g=Vd(p,o.length),_=0,v=[];for(let[e,{label:t,data:n,hidden:r}]of o.entries()){let i=p.dataSets[e],a=g.next(),s=i?.type??`line`,c={label:i?.label??t,data:n,hidden:r,borderColor:a,backgroundColor:a,yAxisID:i?.yAxisId??`y`,type:s,order:s===`bar`?o.length+e:e};l.data.datasets.push(c);let u=p.dataSets?.[e].trend;if(!u?.display)continue;_=Math.max(_,n.length);let d=Id(u,c);d&&v.push(d)}if(v.length){let e=Math.max(...v.map(e=>e.data.length));l.options.scales.x1={labels:Array(Math.round(e)).fill(``),offset:!1,display:!1},v.forEach(e=>l.data.datasets.push(e)),l.options.plugins.tooltip.callbacks.title=function(e){return e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``}}return{chartJsConfig:l,background:e.background||`#FFFFFF`}}function ID(e){return e.dataRange&&!Is.test(e.dataRange)?`InvalidGaugeDataRange`:`Success`}function LD(e,t){return t(t=>t.sectionRule?e(t.sectionRule.rangeMin,`rangeMin`):`Success`,t=>t.sectionRule?e(t.sectionRule.rangeMax,`rangeMax`):`Success`)}function RD(e,t){return t(t=>t.sectionRule?e(t.sectionRule.lowerInflectionPoint.value,`lowerInflectionPointValue`):`Success`,t=>t.sectionRule?e(t.sectionRule.upperInflectionPoint.value,`upperInflectionPointValue`):`Success`)}function zD(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?`GaugeRangeMinBiggerThanRangeMax`:`Success`}function BD(e,t){if(e===``)switch(t){case`rangeMin`:return`EmptyGaugeRangeMin`;case`rangeMax`:return`EmptyGaugeRangeMax`}return`Success`}function VD(e,t){if(isNaN(e))switch(t){case`rangeMin`:return`GaugeRangeMinNaN`;case`rangeMax`:return`GaugeRangeMaxNaN`;case`lowerInflectionPointValue`:return`GaugeLowerInflectionPointNaN`;case`upperInflectionPointValue`:return`GaugeUpperInflectionPointNaN`}return`Success`}var HD=class e extends jg{dataRange;sectionRule;background;type=`gauge`;constructor(e,t,n){super(e,t,n),this.dataRange=Ks(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,ID,e.chainValidations(LD(BD,e.batchValidations),LD(VD,e.batchValidations),zD),e.chainValidations(RD(VD,e.batchValidations)))}static transformDefinition(e,t){let n;return e.dataRange&&(n=nd(Qn(e.dataRange),t)),{...e,dataRange:n?nr(n):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||{text:``},type:`gauge`,dataRange:e.range?.[0]?.dataRange,sectionRule:{colors:{lowerColor:`#EA6175`,middleColor:`#FFD86D`,upperColor:`#43C5B1`},rangeMin:`0`,rangeMax:`100`,lowerInflectionPoint:{type:`percentage`,value:`15`,operator:`<=`},upperInflectionPoint:{type:`percentage`,value:`40`,operator:`<=`}}}}copyForSheetId(t){let n=xd(this.sheetId,t,this.dataRange);return new e(this.getDefinitionWithSpecificRanges(n,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificRanges(this.dataRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:`gauge`,dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(t){let n=Sd(this.dataRange,t);return this.dataRange===n?this:new e(this.getDefinitionWithSpecificRanges(n),this.sheetId,this.getters)}};function UD(e,t){let n=t.getLocale(),r=e.sectionRule.colors,i,a,o,s=e.dataRange;if(s!==void 0){let e=t.getEvaluatedCell({sheetId:s.sheetId,col:s.zone.left,row:s.zone.top});e.type===`number`&&(i=e.value,a=e.formattedValue,o=e.format)}let c=Number(e.sectionRule.rangeMin),l=Number(e.sectionRule.rangeMax),u=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,f=WD(u,c,l),p=WD(d,c,l),m=[],h=[];return f!==void 0&&(m.push({value:f,label:B(f,{locale:n,format:o}),operator:u.operator}),h.push(r.lowerColor)),p!==void 0&&p!==f&&(m.push({value:p,label:B(p,{locale:n,format:o}),operator:d.operator}),h.push(r.middleColor)),p!==void 0&&f!==void 0&&f>p&&(m.reverse(),h.reverse()),h.push(r.upperColor),{background:t.getStyleOfSingleCellChart(e.background,s).background,title:{...e.title,text:T(e.title.text??``)},minValue:{value:c,label:B(c,{locale:n,format:o})},maxValue:{value:l,label:B(l,{locale:n,format:o})},gaugeValue:i!==void 0&&a?{value:i,label:a}:void 0,inflectionValues:m,colors:h}}function WD(e,t,n){if(e.value===``||isNaN(Number(e.value)))return;let r=Number(e.value);return b(e.type===`number`?r:t+(n-t)*r/100,t,n)}var GD=class e extends jg{dataSets;labelRange;background;legendPosition;labelsAsText;stacked;aggregated;type=`line`;dataSetsHaveTitle;cumulative;dataSetDesign;axesDesign;fillArea;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.fillArea=e.fillArea,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static transformDefinition(e,t){return Dd(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`line`,labelRange:e.auxiliaryRange||void 0,stacked:e.stacked??!1,aggregated:e.aggregated??!1,cumulative:e.cumulative??!1,axesDesign:e.axesDesign,fillArea:e.fillArea,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`line`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative,axesDesign:this.axesDesign,fillArea:this.fillArea,showValues:this.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}},KD=class e extends jg{dataSets;labelRange;background;legendPosition;type=`pie`;aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.isDoughnut=e.isDoughnut,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pie`,labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,isDoughnut:!1,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{...this,range:this.dataSets.map(e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,n){return{type:`pie`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:e.map(e=>({dataRange:this.getters.getRangeString(e.dataRange,n||this.sheetId)})),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,isDoughnut:this.isDoughnut,showValues:this.showValues}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function qD(e,t,n){let r=Od(e.background),i=Zg(e,t,r,n),a={labels:{color:r}};return!e.labelRange&&e.dataSets.length===1||e.legendPosition===`none`?a.display=!1:a.position=e.legendPosition,Object.assign(i.options.plugins.legend||{},a),i.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},i.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},i.options.plugins.tooltip.callbacks.label=function(e){let{format:t,locale:r}=n,i=e.dataset.data,a=e.dataIndex,o=YD(i,a),s=e.label||e.dataset.label,c=e.parsed.y??e.parsed,l=B(c,{format:!t&&c>=1e3?`#,##`:t,locale:r});return s?`${s}: ${l} (${o}%)`:`${l} (${o}%)`},i.options.plugins.chartShowValuesPlugin={showValues:e.showValues,callback:Bd(n)},i}function JD(e,t){let n=[],r=Gt(t.map(e=>e.data.length));for(let t=0;t<=r;t++)n.push(e.next());return n}function YD(e,t){let n=e.filter(e=>typeof e==`number`).reduce((e,t)=>e+t,0);return n?(e[t]/n*100).toFixed(2):``}function XD(e,t){let n=e.reduce((e,n,r)=>(t.some(e=>{let t=e.data[r];return typeof t!=`number`||t>=0})&&e.push(r),e),[]);return{labels:n.map(t=>e[t]||``),dataSetsValues:t.map(e=>({...e,data:n.map(t=>{let n=e.data[t];return typeof n!=`number`||n>=0?n:0})}))}}function ZD(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets).filter(e=>!e.hidden);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r)),{dataSetsValues:r,labels:n}=XD(n,r);let i=e_(t,e.dataSets),a=t.getLocale(),o=qD(e,n,{format:i,locale:a}),s=JD(new wn(Math.max(0,...r.map(e=>e?.data?.length??0))),r);for(let{label:t,data:n}of r){let r={label:t,data:n,borderColor:e.background||`#FFFFFF`,backgroundColor:s,hoverOffset:30};o.data.datasets.push(r)}return e.isDoughnut&&(o.type=`doughnut`),{chartJsConfig:o,background:e.background||`#FFFFFF`}}var QD=class e extends jg{dataSets;labelRange;background;legendPosition;aggregated;type=`pyramid`;dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;stacked=!0;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pyramid`,labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`pyramid`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:!0,stacked:!0,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function $D(e,t){let n=hD(new mD({...e.getDefinition(),type:`bar`},e.sheetId,t),t).chartJsConfig,r=n.data?.datasets.filter(e=>!e.hidden);r&&r[0]&&(r[0].data=r[0].data.map(e=>e>0?e:0)),r&&r[1]&&(r[1].data=r[1].data.map(e=>e>0?-e:0));let i=Math.max(...n.data.datasets.map(e=>Math.max(...e.data.map(Math.abs)))),a=n.options.scales,o=a.x.ticks.callback;a.x.ticks.callback=e=>o(Math.abs(e)),a.x.suggestedMin=-i,a.x.suggestedMax=i;let s=n.options.plugins.tooltip.callbacks.label;n.options.plugins.tooltip.callbacks.label=e=>s({...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}});let c=n.options.plugins.chartShowValuesPlugin.callback;return n.options.plugins.chartShowValuesPlugin.callback=(e,t,n)=>c(Math.abs(e),t,n),{chartJsConfig:n,background:e.background||`#FFFFFF`}}var eO=class e extends jg{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type=`scatter`;dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static transformDefinition(e,t){return Dd(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`scatter`,labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`scatter`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}};function tO(e,t){let{chartJsConfig:n,background:r}=ND(e,t);n.type=`line`;for(let e of n.data.datasets)e.showLine=`showLine`in e?e.showLine:!1;return{chartJsConfig:n,background:r}}var nO=class e extends jg{dataSets;labelRange;background;verticalAxisPosition;legendPosition;aggregated;type=`waterfall`;dataSetsHaveTitle;showSubTotals;firstValueAsSubtotal;showConnectorLines;positiveValuesColor;negativeValuesColor;subTotalValuesColor;dataSetDesign;axesDesign;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showSubTotals=e.showSubTotals,this.showConnectorLines=e.showConnectorLines,this.positiveValuesColor=e.positiveValuesColor,this.negativeValuesColor=e.negativeValuesColor,this.subTotalValuesColor=e.subTotalValuesColor,this.firstValueAsSubtotal=e.firstValueAsSubtotal,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`waterfall`,verticalAxisPosition:`left`,labelRange:e.auxiliaryRange||void 0,showSubTotals:e.showSubTotals??!1,showConnectorLines:e.showConnectorLines??!0,firstValueAsSubtotal:e.firstValueAsSubtotal??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`waterfall`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,showSubTotals:this.showSubTotals,showConnectorLines:this.showConnectorLines,positiveValuesColor:this.positiveValuesColor,negativeValuesColor:this.negativeValuesColor,subTotalValuesColor:this.subTotalValuesColor,firstValueAsSubtotal:this.firstValueAsSubtotal,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function rO(e,t,n,r,i){let{locale:a,format:o}=r,s=Od(e.background),c=Zg(e,t,s,r),l=e.negativeValuesColor||`#EA6175`,u=e.positiveValuesColor||`#4EA7F2`,d=e.subTotalValuesColor||`#AAAAAA`,f={labels:{generateLabels:()=>{let t=[{text:T(`Positive values`),fontColor:s,fillStyle:u,strokeStyle:u},{text:T(`Negative values`),fontColor:s,fillStyle:l,strokeStyle:l}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:T(`Subtotals`),fontColor:s,fillStyle:d,strokeStyle:d}),t}}};e.legendPosition===`none`?f.display=!1:f.position=e.legendPosition,c.options.plugins.legend={...c.options.plugins?.legend,...f},c.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},c.options.scales={x:{ticks:{padding:5,color:s},grid:{display:!1},title:Nd(e.axesDesign?.x)},y:{position:e.verticalAxisPosition,ticks:{color:s,callback:e=>(e=Number(e),isNaN(e)?e:B(e,{locale:a,format:!o&&Math.abs(e)>1e3?`#,##`:o}))},grid:{lineWidth:e=>e.tick.value===0?2:1},title:Nd(e.axesDesign?.y)}},c.options.plugins.tooltip={callbacks:{label:function(e){let[r,i]=e.raw,s=i-r,c=n[Math.floor(e.dataIndex/t.length)],l=B(s,{format:!o&&Math.abs(s)>1e3?`#,##`:o,locale:a});return c?`${c}: ${l}`:l}}},c.options.plugins.waterfallLinesPlugin={showConnectorLines:e.showConnectorLines};let p=i.reduce((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e),[]);return c.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:(t,n,i)=>{let a=n._dataset.data[i],o=a[1]-a[0],s=o>=0?`+`:``;return e.showSubTotals&&p.includes(i)&&s===`+`&&(s=``),`${s}${Bd(r)(o)}`}},c}function iO(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets).filter(e=>!e.hidden);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r)),e.showSubTotals&&n.push(T(`Subtotal`));let i=e_(t,e.dataSets),a=t.getLocale(),o=r.map(e=>e.label),s=rO(e,n,o,{format:i,locale:a},r);s.type=`bar`;let c=e.negativeValuesColor||`#EA6175`,l=e.positiveValuesColor||`#4EA7F2`,u=e.subTotalValuesColor||`#AAAAAA`,d=[],f=[],p={label:``,data:f,backgroundColor:d},m=[],h=0;for(let t of r){for(let i=0;i<t.data.length;i++){let a=t.data[i];if(m.push(n[i]),isNaN(Number(a))){f.push([h,h]),d.push(``);continue}f.push([h,a+h]);let o=a>=0?l:c;i===0&&t===r[0]&&e.firstValueAsSubtotal&&(o=u),d.push(o),h+=a}e.showSubTotals&&(m.push(T(`Subtotal`)),f.push([0,h]),d.push(u))}return s.data.datasets.push(p),s.data.labels=m.map(Xg),{chartJsConfig:s,background:e.background||`#FFFFFF`}}let aO=new h;aO.add(`bar`,{match:e=>e===`bar`,createChart:(e,t,n)=>new mD(e,t,n),getChartRuntime:hD,validateChartDefinition:mD.validateChartDefinition,transformDefinition:mD.transformDefinition,getChartDefinitionFromContextCreation:mD.getDefinitionFromContextCreation,sequence:10}),aO.add(`combo`,{match:e=>e===`combo`,createChart:(e,t,n)=>new PD(e,t,n),getChartRuntime:FD,validateChartDefinition:PD.validateChartDefinition,transformDefinition:PD.transformDefinition,getChartDefinitionFromContextCreation:PD.getDefinitionFromContextCreation,sequence:15}),aO.add(`line`,{match:e=>e===`line`,createChart:(e,t,n)=>new GD(e,t,n),getChartRuntime:ND,validateChartDefinition:GD.validateChartDefinition,transformDefinition:GD.transformDefinition,getChartDefinitionFromContextCreation:GD.getDefinitionFromContextCreation,sequence:20}),aO.add(`pie`,{match:e=>e===`pie`,createChart:(e,t,n)=>new KD(e,t,n),getChartRuntime:ZD,validateChartDefinition:KD.validateChartDefinition,transformDefinition:KD.transformDefinition,getChartDefinitionFromContextCreation:KD.getDefinitionFromContextCreation,sequence:30}),aO.add(`scorecard`,{match:e=>e===`scorecard`,createChart:(e,t,n)=>new Bg(e,t,n),getChartRuntime:Hg,validateChartDefinition:Bg.validateChartDefinition,transformDefinition:Bg.transformDefinition,getChartDefinitionFromContextCreation:Bg.getDefinitionFromContextCreation,sequence:40}),aO.add(`gauge`,{match:e=>e===`gauge`,createChart:(e,t,n)=>new HD(e,t,n),getChartRuntime:UD,validateChartDefinition:HD.validateChartDefinition,transformDefinition:HD.transformDefinition,getChartDefinitionFromContextCreation:HD.getDefinitionFromContextCreation,sequence:50}),aO.add(`scatter`,{match:e=>e===`scatter`,createChart:(e,t,n)=>new eO(e,t,n),getChartRuntime:tO,validateChartDefinition:eO.validateChartDefinition,transformDefinition:eO.transformDefinition,getChartDefinitionFromContextCreation:eO.getDefinitionFromContextCreation,sequence:60}),aO.add(`waterfall`,{match:e=>e===`waterfall`,createChart:(e,t,n)=>new nO(e,t,n),getChartRuntime:iO,validateChartDefinition:nO.validateChartDefinition,transformDefinition:nO.transformDefinition,getChartDefinitionFromContextCreation:nO.getDefinitionFromContextCreation,sequence:70}),aO.add(`pyramid`,{match:e=>e===`pyramid`,createChart:(e,t,n)=>new QD(e,t,n),getChartRuntime:$D,validateChartDefinition:QD.validateChartDefinition,transformDefinition:QD.transformDefinition,getChartDefinitionFromContextCreation:QD.getDefinitionFromContextCreation,sequence:80});let oO=new h;oO.add(`line`,s_),oO.add(`bar`,s_),oO.add(`combo`,s_),oO.add(`pie`,s_),oO.add(`gauge`,fD),oO.add(`scatter`,s_),oO.add(`scorecard`,c_),oO.add(`waterfall`,s_),oO.add(`pyramid`,s_);let sO={line:T(`Line`),column:T(`Column`),bar:T(`Bar`),area:T(`Area`),pie:T(`Pie`),misc:T(`Miscellaneous`)},cO=new h;cO.add(`line`,{matcher:e=>e.type===`line`&&!e.stacked&&!e.fillArea,displayName:T(`Line`),chartType:`line`,chartSubtype:`line`,subtypeDefinition:{stacked:!1,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.LINE_CHART`}).add(`stacked_line`,{matcher:e=>e.type===`line`&&!e.fillArea&&!!e.stacked,displayName:T(`Stacked Line`),chartType:`line`,chartSubtype:`stacked_line`,subtypeDefinition:{stacked:!0,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.STACKED_LINE_CHART`}).add(`area`,{matcher:e=>e.type===`line`&&!e.stacked&&!!e.fillArea,displayName:T(`Area`),chartType:`line`,chartSubtype:`area`,subtypeDefinition:{stacked:!1,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.AREA_CHART`}).add(`stacked_area`,{matcher:e=>e.type===`line`&&e.stacked&&!!e.fillArea,displayName:T(`Stacked Area`),chartType:`line`,chartSubtype:`stacked_area`,subtypeDefinition:{stacked:!0,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.STACKED_AREA_CHART`}).add(`scatter`,{displayName:T(`Scatter`),chartType:`scatter`,chartSubtype:`scatter`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCATTER_CHART`}).add(`column`,{matcher:e=>e.type===`bar`&&!e.stacked&&!e.horizontal,displayName:T(`Column`),chartType:`bar`,chartSubtype:`column`,subtypeDefinition:{stacked:!1,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.COLUMN_CHART`}).add(`stacked_column`,{matcher:e=>e.type===`bar`&&e.stacked&&!e.horizontal,displayName:T(`Stacked Column`),chartType:`bar`,chartSubtype:`stacked_column`,subtypeDefinition:{stacked:!0,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART`}).add(`bar`,{matcher:e=>e.type===`bar`&&!e.stacked&&!!e.horizontal,displayName:T(`Bar`),chartType:`bar`,chartSubtype:`bar`,subtypeDefinition:{horizontal:!0,stacked:!1},category:`bar`,preview:`o-spreadsheet-ChartPreview.BAR_CHART`}).add(`stacked_bar`,{matcher:e=>e.type===`bar`&&e.stacked&&!!e.horizontal,displayName:T(`Stacked Bar`),chartType:`bar`,chartSubtype:`stacked_bar`,subtypeDefinition:{horizontal:!0,stacked:!0},category:`bar`,preview:`o-spreadsheet-ChartPreview.STACKED_BAR_CHART`}).add(`combo`,{displayName:T(`Combo`),chartSubtype:`combo`,chartType:`combo`,category:`line`,preview:`o-spreadsheet-ChartPreview.COMBO_CHART`}).add(`pie`,{matcher:e=>e.type===`pie`&&!e.isDoughnut,displayName:T(`Pie`),chartSubtype:`pie`,chartType:`pie`,subtypeDefinition:{isDoughnut:!1},category:`pie`,preview:`o-spreadsheet-ChartPreview.PIE_CHART`}).add(`doughnut`,{matcher:e=>e.type===`pie`&&!!e.isDoughnut,displayName:T(`Doughnut`),chartSubtype:`doughnut`,chartType:`pie`,subtypeDefinition:{isDoughnut:!0},category:`pie`,preview:`o-spreadsheet-ChartPreview.DOUGHNUT_CHART`}).add(`gauge`,{displayName:T(`Gauge`),chartSubtype:`gauge`,chartType:`gauge`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GAUGE_CHART`}).add(`scorecard`,{displayName:T(`Scorecard`),chartSubtype:`scorecard`,chartType:`scorecard`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCORECARD_CHART`}).add(`waterfall`,{displayName:T(`Waterfall`),chartSubtype:`waterfall`,chartType:`waterfall`,category:`misc`,preview:`o-spreadsheet-ChartPreview.WATERFALL_CHART`}).add(`pyramid`,{displayName:T(`Population Pyramid`),chartSubtype:`pyramid`,chartType:`pyramid`,category:`misc`,preview:`o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART`});let lO=new h;H`
170
+ `,e.endsWith(`{`)&&n++;return t.trim()}let TE=zT.content,EE={"=":`EQ`,"+":`ADD`,"-":`MINUS`,"*":`MULTIPLY`,"/":`DIVIDE`,">=":`GTE`,"<>":`NE`,">":`GT`,"<=":`LTE`,"<":`LT`,"^":`POWER`,"&":`CONCATENATE`},DE={"-":`UMINUS`,"+":`UPLUS`,"%":`UNARY.PERCENT`},OE={};function kE(e){return AE(Nh(e))}function AE(e){try{return jE(e)}catch(t){return{tokens:e,dependencies:[],execute:function(){return t},isBadExpression:!0}}}function jE(e){let{dependencies:t,literalValues:n,symbols:r}=NE(e),i=ME(e);if(!OE[i]){let t=gC([...e]),n=new SE,s=0,c=0,l=0;if(t.type===`BIN_OPERATION`&&t.value===`:`||t.type===`EMPTY`)throw new ra(T(`Invalid formula`));let u=o(t),d=new bE;d.append(u),d.append(`return ${u.returnExpression};`),OE[i]=Function(`deps`,`ref`,`range`,`getSymbolValue`,`ctx`,d.toString());function a(e){let{args:t}=e,n=TE[e.value.toUpperCase()];if(!n)throw new sa(T(`Unknown function: "%s"`,e.value));PE(e);let r=[];for(let e=0;e<t.length;e++){let i=n.getArgToFocus(e+1)-1,a=n.args[i],s=t[e],c=a.type||[],l=c.includes(`META`),u=c.some(e=>FE(e));r.push(o(s,l,u))}return r}function o(e,t=!1,i=!1){let u=new bE(n);if(e.type!==`REFERENCE`&&!(e.type===`BIN_OPERATION`&&e.value===`:`)&&t)throw new ra(T(`Argument must be a reference to a cell or range.`));switch(e.debug&&u.append(`debugger;`),e.type){case`BOOLEAN`:return u.return(`{ value: ${e.value} }`);case`NUMBER`:return u.return(`this.literalValues.numbers[${c++}]`);case`STRING`:return u.return(`this.literalValues.strings[${s++}]`);case`REFERENCE`:return!t&&e.value.includes(`:`)||i?u.return(`range(deps[${l++}])`):u.return(`ref(deps[${l++}], ${t?`true`:`false`})`);case`FUNCALL`:let n=a(e).map(e=>e.assignResultToVariable());u.append(...n);let d=e.value.toUpperCase();return u.return(`ctx['${d}'](${n.map(e=>e.returnExpression)})`);case`UNARY_OPERATION`:{let t=DE[e.value],n=o(e.operand,!1,!1).assignResultToVariable();return u.append(n),u.return(`ctx['${t}'](${n.returnExpression})`)}case`BIN_OPERATION`:{let t=EE[e.value],n=o(e.left,!1,!1).assignResultToVariable(),r=o(e.right,!1,!1).assignResultToVariable();return u.append(n),u.append(r),u.return(`ctx['${t}'](${n.returnExpression}, ${r.returnExpression})`)}case`SYMBOL`:let f=r.indexOf(e.value);return u.return(`getSymbolValue(this.symbols[${f}])`);case`EMPTY`:return u.return(`undefined`)}}}return{execute:OE[i],dependencies:t,literalValues:n,symbols:r,tokens:e,isBadExpression:!1}}function ME(e){let t=``;for(let n of e)switch(n.type){case`STRING`:t+=`|S|`;break;case`NUMBER`:t+=`|N|`;break;case`REFERENCE`:case`INVALID_REFERENCE`:n.value.includes(`:`)?t+=`|R|`:t+=`|C|`;break;case`SPACE`:break;default:t+=n.value;break}return t}function NE(e){let t={numbers:[],strings:[]},n=[],r=[];for(let i of e)switch(i.type){case`INVALID_REFERENCE`:case`REFERENCE`:n.push(i.value);break;case`STRING`:let e=et(i.value);t.strings.push({value:e});break;case`NUMBER`:{let e=ji(i.value,O);t.numbers.push({value:e});break}case`SYMBOL`:r.push(at(i.value,`'`))}return{dependencies:n,literalValues:t,symbols:r}}function PE(e){let t=e.args.length,n=e.value.toUpperCase(),r=TE[n];if(t<r.minArgRequired)throw new ra(T(`Invalid number of arguments for the %s function. Expected %s minimum, but got %s instead.`,n,r.minArgRequired.toString(),t.toString()));if(t>r.maxArgPossible)throw new ra(T(`Invalid number of arguments for the %s function. Expected %s maximum, but got %s instead.`,n,r.maxArgPossible.toString(),t.toString()));let i=r.nbrArgRepeating;if(i>1){let e=r.args.length-i;if((t-e)%i!==0)throw new ra(T(`Invalid number of arguments for the %s function. Expected all arguments after position %s to be supplied by groups of %s arguments`,n,e.toString(),i.toString()))}}function FE(e){return e.startsWith(`RANGE`)}let IE=zT.content;function LE(e){try{return vC(gC(e)).filter(e=>e.type===`FUNCALL`&&!IE[e.value.toUpperCase()]?.isExported).length===0}catch{return!1}}function RE(e,t){if(!e.some(e=>e.type===`SYMBOL`&&t.includes(e.value.toUpperCase())))return[];let n;try{n=gC(e)}catch{return[]}return zE(n,t)}function zE(e,t){return vC(e).filter(e=>e.type===`FUNCALL`&&t.includes(e.value.toUpperCase())).map(e=>({functionName:e.value.toUpperCase(),args:e.args}))}let BE=[`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`];function VE(e,t){let n=`"${t?`${e.name}:${t}`:e.name}"`,r=e.string===e.name?n:e.string+n;return{text:n,description:e.string+(e.help?` (${e.help})`:``),htmlContent:[{value:n,color:vE.STRING}],fuzzySearchKey:r}}function HE(e){let t=`"${e.id}"`,n=e.displayName+e.fieldName+t;return{text:t,description:e.displayName,htmlContent:[{value:t,color:vE.STRING}],fuzzySearchKey:n}}function UE(e,t){let n=e.end,r=e.end;e.type!==`ARG_SEPARATOR`&&(n=e.start),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}function WE(e,t){let n=e.end,r=e.end;e.type!==`LEFT_PAREN`&&(n=e.start),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}function GE(e){let t=e.functionContext?.args[0];if(!(!t||![`STRING`,`NUMBER`].includes(t.type)))return t.value}function KE(e){return RE(e,BE)[0]}function qE(e){return RE(e,BE)}function JE(e){return RE(e,BE).length}let YE=new h;YE.add(`SPREADSHEET`,!1),l_.add(`pivot_ids`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||![`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`].includes(t.parent.toUpperCase())||t.argPosition!==0)return;let n=this.getters.getPivotIds();if(!n.includes(e.value))return n.map(e=>{let t=this.getters.getPivotCoreDefinition(e),n=`${this.getters.getPivotFormulaId(e)}`;return{text:n,description:t.name,htmlContent:[{value:n,color:vE.NUMBER}],fuzzySearchKey:n+t.name}}).filter(S)},selectProposal:WE}),l_.add(`pivot_measures`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(t?.parent.toUpperCase()!==`PIVOT.VALUE`||t.argPosition!==1)return[];let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return[];let i=this.getters.getPivot(r);return i.init(),i.isValid()?i.definition.measures.map(e=>{if(e.fieldName===`__count`){let e=`"__count"`;return{text:e,description:T(`Count`),htmlContent:[{value:e,color:vE.STRING}],fuzzySearchKey:T(`Count`)+e}}return HE(e)}).filter(S):[]},selectProposal:UE}),l_.add(`pivot_group_fields`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!XE(e)&&!ZE(e))return;let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);i.init();let a=i.getFields(),{columns:o,rows:s}=i.definition,c=t.args;t?.parent.toUpperCase()===`PIVOT.VALUE`?(c=c.filter((e,t)=>t%2==0),c=c.slice(1,t.argPosition)):c=c.filter((e,t)=>t%2==1);let l=c.map(e=>e?.value).filter(S),u=o.map(e=>e.nameWithGranularity),d=s.map(e=>e.nameWithGranularity),f=[],p=[`ARG_SEPARATOR`,`SPACE`].includes(e.type)?l.at(-1):l.at(-2),m=YE.get(i.type);if(m&&p?.startsWith(`#`)&&(p=p.slice(1)),p===void 0&&(f.push(u[0]),f.push(d[0])),d.includes(p)){let e=d[d.indexOf(p)+1];f.push(e),f.push(u[0])}if(u.includes(p)){let e=u[u.indexOf(p)+1];f.push(e)}let h=f.filter(S);return h.map(e=>{let[t,n]=e.split(`:`),r=a[t];return r?VE(r,n):void 0}).concat(h.map(e=>{if(!m)return;let t=a[e.split(`:`)[0]];if(!t)return;let n=`"#${e}"`;return{text:n,description:T(`%s (positional)`,t.string)+(t.help?` (${t.help})`:``),htmlContent:[{value:n,color:vE.STRING}],fuzzySearchKey:t.string+n}})).filter(S)},selectProposal:UE});function XE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==0}function ZE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==1}l_.add(`pivot_group_values`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!e||!QE(e)&&!$E(e))return;let n=GE(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);if(!i.isValid())return;let a=t.argPosition,o=e.functionContext?.args[a-1]?.value;if(!o)return;let s;try{s=i.definition.getDimension(o)}catch{return}return s.granularity===`month_number`?Object.values(Mo).map((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:vE.NUMBER}]})):s.granularity===`quarter_number`?[1,2,3,4].map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:T(`Quarter %s`,e),htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`day_of_month`?x(1,32).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`iso_week_number`?x(0,54).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`day_of_week`?x(1,8).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`hour_number`?x(0,24).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`minute_number`?x(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):s.granularity===`second_number`?x(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:vE.NUMBER}]})):i.getPossibleFieldValues(s).map(({value:e,label:t})=>{let n=typeof e==`string`,r=n?`"${e}"`:e.toString(),i=n?vE.STRING:vE.NUMBER,a=t===e?``:t;return{text:r,description:a,htmlContent:[{value:r,color:i}],fuzzySearchKey:r+a}})},selectProposal:UE});function QE(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==1}function $E(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==0}l_.add(`sheet_names`,{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return e.type===`SYMBOL`||e.type===`UNKNOWN`&&e.value.startsWith(`'`)?this.getters.getSheetIds().map(e=>{let t=ot(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith(`'`)?t:`'`+t}}):[]},selectProposal(e,t){let n=e.start,r=e.end;this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t+`!`)}});let eD=new h;eD.add(`ALPHANUMERIC_INCREMENT_MODIFIER`,{apply:(e,t)=>{e.current+=e.increment;let n=`${e.prefix}${e.current.toString().padStart(e.numberPostfixLength||0,`0`)}`;return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:n},tooltip:{props:{content:n}}}}}).add(`INCREMENT_MODIFIER`,{apply:(e,t,n)=>{e.current+=e.increment;let r=e.current.toString(),i=n.getLocale(),a=B(e.current,{format:t.cell?.format,locale:i});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:r},tooltip:r?{props:{content:a}}:void 0}}}).add(`DATE_INCREMENT_MODIFIER`,{apply:(e,t,n)=>{let r=R(e.current,n.getLocale());r.setFullYear(r.getFullYear()+e.increment.years||0),r.setMonth(r.getMonth()+e.increment.months||0),r.setDate(r.getDate()+e.increment.days||0);let i=di(r);e.current=i;let a=n.getLocale(),o=B(i,{format:t.cell?.format,locale:a});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i.toString()},tooltip:i?{props:{content:o}}:void 0}}}).add(`COPY_MODIFIER`,{apply:(e,t,n)=>{let r=t.cell?.content||``,i={locale:n.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:r},tooltip:r?{props:{content:t.cell?hs(t.cell,i).formattedValue:``}}:void 0}}}).add(`FORMULA_MODIFIER`,{apply:(e,t,n,r)=>{e.current+=e.increment;let i=0,a=0;switch(r){case`up`:i=0,a=-e.current;break;case`down`:i=0,a=e.current;break;case`left`:i=-e.current,a=0;break;case`right`:i=e.current,a=0;break}let o=t.cell;if(!o||!o.isFormula)return{cellData:{}};let s=t.sheetId,c=n.getTranslatedCellFormula(s,i,a,o.compiledFormula.tokens);return{cellData:{border:t.border,style:o.style,format:o.format,content:c},tooltip:c?{props:{content:c}}:void 0}}});let tD=new h,nD=/(\d+)$/,rD=/^(.*\D+)/,iD=/^(.*\D+)(\d+)$/;function aD(e,t,n){let r=[],i=!1;for(let a of t){a===e&&(i=!0);let t=a===void 0||a.isFormula?void 0:hs(a,{locale:O,format:a.format});if(t&&n(t))r.push(t);else{if(i)return r;r=[]}}return r}function oD(e){let t=[],n=e[0];for(let r=1;r<e.length;r++){let i=e[r];t.push(i-n),n=i}return t.reduce((e,t)=>e+t,0)/t.length}function sD(e){let t=1;return e.length>=2&&(t=oD(e)*e.length),t}function cD(e){return e.length<2?e[0]||{years:0,months:0,days:0}:e.every(t=>t.years===e[0].years&&t.months===e[0].months&&t.days===e[0].days)?e[0]:void 0}function lD(e){if(e.length<2)return 1;let t=e.map(e=>R(e,O)),n=cD(uD(t));if(n===void 0)return;let r=Object.values(n).filter(e=>e!==0).length===1,i=Object.values(n).every(e=>e===0);if(!r||i){let n=t.map((e,n)=>{if(n===0)return 0;let r=t[n-1];return Math.floor(e.getTime())-Math.floor(r.getTime())}).slice(1);if(n.every(e=>e===n[0]))return e.length*(e[1]-e[0])}return{years:n.years*e.length,months:n.months*e.length,days:n.days*e.length}}tD.add(`simple_value_copy`,{condition:(e,t)=>t.length===1&&!e.isFormula&&!(e.format&&Ko(e.format)),generateRule:()=>({type:`COPY_MODIFIER`}),sequence:10}).add(`increment_alphanumeric_value`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`text`&&iD.test(e.content),generateRule:(e,t,n)=>{let r=parseInt(e.content.match(nD)[0]),i=e.content.match(rD)[0],a=e.content.length-i.length,o=aD(e,t,e=>e.type===`text`&&iD.test(e.value)).filter(e=>i===(e.value??``).toString().match(rD)[0]).map(e=>parseInt((e.value??``).toString().match(nD)[0])),s=sD(o);return[`up`,`left`].includes(n)&&o.length===1&&(s=-s),{type:`ALPHANUMERIC_INCREMENT_MODIFIER`,prefix:i,current:r,increment:s,numberPostfixLength:a}},sequence:15}).add(`copy_text`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`text`,generateRule:()=>({type:`COPY_MODIFIER`}),sequence:20}).add(`update_formula`,{condition:e=>e.isFormula,generateRule:(e,t)=>({type:`FORMULA_MODIFIER`,increment:t.length,current:0}),sequence:30}).add(`increment_dates`,{condition:(e,t)=>!e.isFormula&&hs(e,{locale:O}).type===`number`&&!!e.format&&Ko(e.format),generateRule:(e,t)=>{let n=lD(aD(e,t,e=>e.type===`number`&&!!e.format&&Ko(e.format)).map(e=>Number(e.value)));if(n===void 0)return{type:`COPY_MODIFIER`};let r=hs(e,{locale:O});return typeof n==`object`?{type:`DATE_INCREMENT_MODIFIER`,increment:n,current:r.type===`number`?r.value:0}:{type:`INCREMENT_MODIFIER`,increment:n,current:r.type===`number`?r.value:0}},sequence:25}).add(`increment_number`,{condition:e=>!e.isFormula&&hs(e,{locale:O}).type===`number`,generateRule:(e,t,n)=>{let r=aD(e,t,e=>e.type===`number`&&!Ko(e.format||``)).map(e=>Number(e.value)),i=sD(r);[`up`,`left`].includes(n)&&r.length===1&&(i=-i);let a=hs(e,{locale:O});return{type:`INCREMENT_MODIFIER`,increment:i,current:a.type===`number`?a.value:0}},sequence:40});function uD(e){return e.length<2?[{years:0,months:0,days:0}]:e.map((t,n)=>{if(n===0)return{years:0,months:0,days:0};let r=D.fromTimestamp(e[n-1].getTime()),i=yi(r,t),a=_i(r,t)%12;return r.setFullYear(r.getFullYear()+i),r.setMonth(r.getMonth()+a),{years:i,months:a,days:vi(r,t)}}).slice(1)}let dD=new h;var fD=class extends t.Component{static template=`o-spreadsheet-GaugeChartComponent`;canvas=(0,t.useRef)(`chartContainer`);get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){(0,t.useEffect)(()=>gg(this.canvas.el,this.runtime),()=>{let e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]})}};fD.props={figure:Object};function pD(e){return e=en(e).replace(`#`,``),e.length===8?e.slice(6)+e.slice(0,6):e}var mD=class e extends jg{dataSets;labelRange;background;legendPosition;stacked;aggregated;type=`bar`;dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.horizontal=e.horizontal,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`bar`,labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`bar`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:this.horizontal,showValues:this.showValues}}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function hD(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r));let i={format:e_(t,e.dataSets),locale:t.getLocale()},a=Od(e.background),o=Zg(e,n,a,{...i,horizontalChart:e.horizontal}),s=a_(a);e.legendPosition===`none`?s.display=!1:s.position=e.legendPosition,o.options.plugins.legend={...o.options.plugins?.legend,...s},o.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})},o.options.indexAxis=e.horizontal?`y`:`x`,o.options.scales={};let c={ticks:{padding:5,color:a}},l={beginAtZero:!0,ticks:{color:a,callback:Bd(i)}},u=e.horizontal?l:c,d=e.horizontal?c:l,{useLeftAxis:f,useRightAxis:p}=Pd(e.getDefinition());o.options.scales.x={...u,title:Nd(e.axesDesign?.x)},f&&(o.options.scales.y={...d,position:`left`,title:Nd(e.axesDesign?.y)}),p&&(o.options.scales.y1={...d,position:`right`,title:Nd(e.axesDesign?.y1)}),e.stacked&&(o.options.scales.x.stacked=!0,f&&(o.options.scales.y.stacked=!0),p&&(o.options.scales.y1.stacked=!0)),o.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,horizontal:e.horizontal,callback:Bd(i)};let m=e.getDefinition(),h=Vd(m,r.length),g=[];for(let t in r){let{label:n,data:i,hidden:a}=r[t],s=h.next(),c={label:n,data:i,hidden:a,borderColor:m.background||`#FFFFFF`,borderWidth:+!!m.stacked,backgroundColor:s};o.data.datasets.push(c),m.dataSets?.[t]?.label&&(c.label=m.dataSets[t].label),m.dataSets?.[t]?.yAxisId&&!e.horizontal&&(c.yAxisID=m.dataSets[t].yAxisId);let l=m.dataSets?.[t].trend;if(!l?.display||e.horizontal)continue;let u=Id(l,c);u&&g.push(u)}if(g.length){let e=Math.max(...g.map(e=>e.data.length));o.options.scales.x1={...u,labels:Array(e).fill(``),offset:!1,display:!1},g.forEach(e=>o.data.datasets.push(e)),o.options.plugins.tooltip.callbacks.title=function(e){return e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``}}return{chartJsConfig:o,background:e.background||`#FFFFFF`}}let gD={second:1e3,minute:1e3*60,hour:1e3*3600,day:1e3*3600*24,month:1e3*3600*24*30,year:1e3*3600*24*365},_D={inSeconds:function(e){return Math.floor(e/gD.second)},inMinutes:function(e){return Math.floor(e/gD.minute)},inHours:function(e){return Math.floor(e/gD.hour)},inDays:function(e){return Math.floor(e/gD.day)},inMonths:function(e){return Math.floor(e/gD.month)},inYears:function(e){return Math.floor(e/gD.year)}},vD=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function yD(e,t,n){let r=bD(t),i=SD(e,r,n),a={};return i&&(a[i]=r),{parser:r,displayFormats:a,unit:i??!1,tooltipFormat:r}}function bD(e){let t=e.indexOf(`h`);return e=t>=0?e.slice(0,t).replace(/m/g,`M`)+e.slice(t):e.replace(/m/g,`M`),e.includes(`a`)||(e=e.replace(/h/g,`H`)),e}function xD(e){return e.includes(`s`)?`second`:e.includes(`m`)?`minute`:e.includes(`h`)||e.includes(`H`)?`hour`:e.includes(`d`)?`day`:e.includes(`M`)?`month`:`year`}function SD(e,t,n){let r=e.map(e=>$r(e,n)?.jsDate);if(r.some(e=>e===void 0)||e.length<2)return;let i=r.map(e=>e.getTime()),a=Gt(i)-Kt(i),o=xD(t);return gD.second>=gD[o]&&_D.inSeconds(a)<180?`second`:gD.minute>=gD[o]&&_D.inMinutes(a)<180?`minute`:gD.hour>=gD[o]&&_D.inHours(a)<96?`hour`:gD.day>=gD[o]&&_D.inDays(a)<90?`day`:gD.month>=gD[o]&&_D.inMonths(a)<36?`month`:`year`}function CD(e,t){if(e.length===0||e.every(e=>!e))return{labels:e,dataSetsValues:t};let n=[...e],r=y(t);for(let e=0;e<n.length;e++)if(!n[e]){n[e]=Dt(n,e);for(let t of r)t.data[e]=void 0}return{labels:n,dataSetsValues:r}}function wD(e,t){return OD(e,t)||kD(e,t)}function TD(e,t){return ED(e,t)&&jD()?`time`:DD(e,t)?`linear`:`category`}function ED(e,t){return!e.labelsAsText&&OD(e,t)}function DD(e,t){return!e.labelsAsText&&kD(e,t)}function OD(e,t){if(!e.labelRange||!kD(e,t))return!1;let n=Qg(t,e.labelRange,jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle));return!!(n&&vD.test(n))}function kD(e,t){if(!e.labelRange)return!1;let n=t.getRangeValues(e.labelRange);return jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),!(n.some(e=>isNaN(Number(e))&&e)||n.every(e=>!e))}let AD=!1;function jD(){let e=o_();if(!e)return!1;let t=new e._adapters._date({})._id===`luxon`;return!t&&!AD&&(AD=!0,console.warn(`'chartjs-adapter-luxon' time adapter is not installed. Time scale axes are disabled.`)),t}function MD(e,t,n,r){let i=[],a=[],o=[],s=t.data.length;if(t.hidden||s<2)return;switch(n){case`category`:for(let e=0;e<s;e++)typeof t.data[e]==`number`&&(i.push(t.data[e]),a.push(e+1)),o.push(e+1);break;case`linear`:for(let e of t.data){let t=Number(e.x);isNaN(t)||(typeof e.y==`number`&&(i.push(e.y),a.push(t)),o.push(t))}break;case`time`:for(let e of t.data){let t=P({value:e.x},r);e.y!==null&&(i.push(e.y),a.push(t)),o.push(t)}break}let c=Math.min(...o),l=Math.max(...o);if(l===c)return;let u=5*o.length,d=(l-c)/u,f=x(c,l+d/2,d),p=Rd(e,i,a,f);if(p.length)return Ld(t,e,p,f)}function ND(e,t){let n=TD(e,t),r=$g(t,e.dataSets,e.labelRange),i=n===`linear`?r.values:r.formattedValues,a=t_(t,e.dataSets),o=jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle);o&&i.shift(),{labels:i,dataSetsValues:a}=Jg(i,a),n===`time`&&({labels:i,dataSetsValues:a}=CD(i,a)),e.aggregated&&({labels:i,dataSetsValues:a}=Yg(i,a));let s=t.getLocale(),c=n===`category`,l=e_(t,e.dataSets),u={format:l,locale:s,truncateLabels:c},d=Od(e.background),f=Zg(e,i,d,u),p=a_(d,{labels:{generateLabels(e){let{data:t}=e,n=o_().defaults.plugins.legend.labels.generateLabels(e);for(let[e,r]of n.entries())r.fillStyle=t.datasets[e].borderColor;return n}}});e.legendPosition===`none`?p.display=!1:p.position=e.legendPosition,Object.assign(f.options.plugins.legend||{},p),f.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})};let m={ticks:{padding:5,color:d},title:Nd(e.axesDesign?.x)};f.options.scales={x:m};let h={beginAtZero:!0,ticks:{color:d,callback:Bd(u)}},{useLeftAxis:g,useRightAxis:_}=Pd(e.getDefinition());g&&(f.options.scales.y={...h,position:`left`,title:Nd(e.axesDesign?.y)}),_&&(f.options.scales.y1={...h,position:`right`,title:Nd(e.axesDesign?.y1)}),`stacked`in e&&e.stacked&&(g&&(f.options.scales.y.stacked=!0),_&&(f.options.scales.y1.stacked=!0)),f.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:Bd(u)};let v=Qg(t,e.labelRange,o);if(n===`time`){let e={type:`time`,time:yD(i,v,s)};Object.assign(f.options.scales.x,e),f.options.scales.x.ticks.maxTicksLimit=15}else n===`linear`&&(f.options.scales.x.type=`linear`,f.options.scales.x.ticks.callback=e=>B(e,{format:v,locale:s}),f.options.plugins.tooltip.callbacks.label=e=>{let t,n;e.dataset.xAxisID===`x1`?(t=a[e.datasetIndex].data[e.dataIndex].y,n=``):(t=a[e.datasetIndex].data[e.dataIndex],n=r.values[e.dataIndex]),ki(n,s)&&(n=P(n,s));let i=B(n,{locale:s,format:v}),o=B(t,{locale:s,format:l}),c=e.dataset.label;return i?`${c}: (${i}, ${o})`:`${c}: ${o}`});let ee=`fillArea`in e?e.fillArea:!1,te=`stacked`in e?e.stacked:!1,ne=`cumulative`in e?e.cumulative:!1,re=e.getDefinition(),ie=Vd(re,a.length);for(let[e,{label:t,data:r,hidden:o}]of a.entries()){let a=ie.next(),s=ln(a);if(ee&&(s.a=.4),ne){let e=0;r=r.map(t=>isNaN(t)?t:(e+=parseFloat(t),e))}[`linear`,`time`].includes(n)&&(r=r.map((e,t)=>({x:i[t]||void 0,y:e})));let c=cn(s),l={label:t,data:r,hidden:o,tension:0,borderColor:a,backgroundColor:c,pointBackgroundColor:a,fill:ee?n_(e,te):!1};f.data.datasets.push(l)}let ae=0,oe=[];for(let[e,t]of f.data.datasets.entries()){re.dataSets?.[e]?.label&&(t.label=re.dataSets[e].label),re.dataSets?.[e]?.yAxisId&&(t.yAxisID=re.dataSets[e].yAxisId);let r=re.dataSets?.[e].trend;if(!r?.display)continue;let i=MD(r,t,n,s);i&&(ae=Math.max(ae,i.data.length),oe.push(i),a.push(i))}return oe.length&&(f.options.scales.x1={...m,display:!1},(n===`category`||n===`time`)&&(f.options.scales.x1.type=`category`,f.options.scales.x1.labels=x(0,ae).map(e=>e.toString()),f.options.scales.x1.offset=!1),oe.forEach(e=>f.data.datasets.push(e))),f.options.plugins.tooltip.callbacks.title=function(e){return n!==`linear`&&e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``},{chartJsConfig:f,background:e.background||`#FFFFFF`}}var PD=class e extends jg{dataSets;labelRange;background;legendPosition;aggregated;dataSetsHaveTitle;dataSetDesign;axesDesign;type=`combo`;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId),type:this.dataSetDesign?.[t]?.type??(t?`line`:`bar`)});return{type:`combo`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}static getDefinitionFromContextCreation(e){let t=(e.range??[]).map((e,t)=>({...e,type:t?`line`:`bar`}));return{background:e.background,dataSets:t,dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},labelRange:e.auxiliaryRange||void 0,type:`combo`,axesDesign:e.axesDesign,showValues:e.showValues}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}};function FD(e,t){let n=e.dataSets.length?e_(t,[e.dataSets[0]]):void 0,r=e_(t,e.dataSets.slice(1)),i=t.getLocale(),a=$g(t,e.dataSets,e.labelRange).formattedValues,o=t_(t,e.dataSets);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&a.shift(),{labels:a,dataSetsValues:o}=Jg(a,o),e.aggregated&&({labels:a,dataSetsValues:o}=Yg(a,o));let s={format:n,locale:i},c=Od(e.background),l=Zg(e,a,c,s);l.type=`bar`;let u=a_(c);e.legendPosition===`none`?u.display=!1:u.position=e.legendPosition,l.options.plugins.legend={...l.options.plugins?.legend,...u},l.options.layout={padding:Fd({displayTitle:!!e.title.text,displayLegend:e.legendPosition===`top`})},l.options.scales={x:{ticks:{padding:5,color:c},title:Nd(e.axesDesign?.x)}};let d={beginAtZero:!0,ticks:{color:c,callback:Bd({format:n,locale:i})}},f={beginAtZero:!0,ticks:{color:c,callback:Bd({format:r,locale:i})}},p=e.getDefinition(),{useLeftAxis:m,useRightAxis:h}=Pd(p);m&&(l.options.scales.y={...d,position:`left`,title:Nd(e.axesDesign?.y)}),h&&(l.options.scales.y1={...f,position:`right`,grid:{display:!1},title:Nd(e.axesDesign?.y1)}),l.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:Bd({format:n,locale:i})};let g=Vd(p,o.length),_=0,v=[];for(let[e,{label:t,data:n,hidden:r}]of o.entries()){let i=p.dataSets[e],a=g.next(),s=i?.type??`line`,c={label:i?.label??t,data:n,hidden:r,borderColor:a,backgroundColor:a,yAxisID:i?.yAxisId??`y`,type:s,order:s===`bar`?o.length+e:e};l.data.datasets.push(c);let u=p.dataSets?.[e].trend;if(!u?.display)continue;_=Math.max(_,n.length);let d=Id(u,c);d&&v.push(d)}if(v.length){let e=Math.max(...v.map(e=>e.data.length));l.options.scales.x1={labels:Array(Math.round(e)).fill(``),offset:!1,display:!1},v.forEach(e=>l.data.datasets.push(e)),l.options.plugins.tooltip.callbacks.title=function(e){return e.some(e=>e.dataset.xAxisID!==`x1`)?void 0:``}}return{chartJsConfig:l,background:e.background||`#FFFFFF`}}function ID(e){return e.dataRange&&!Is.test(e.dataRange)?`InvalidGaugeDataRange`:`Success`}function LD(e,t){return t(t=>t.sectionRule?e(t.sectionRule.rangeMin,`rangeMin`):`Success`,t=>t.sectionRule?e(t.sectionRule.rangeMax,`rangeMax`):`Success`)}function RD(e,t){return t(t=>t.sectionRule?e(t.sectionRule.lowerInflectionPoint.value,`lowerInflectionPointValue`):`Success`,t=>t.sectionRule?e(t.sectionRule.upperInflectionPoint.value,`upperInflectionPointValue`):`Success`)}function zD(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?`GaugeRangeMinBiggerThanRangeMax`:`Success`}function BD(e,t){if(e===``)switch(t){case`rangeMin`:return`EmptyGaugeRangeMin`;case`rangeMax`:return`EmptyGaugeRangeMax`}return`Success`}function VD(e,t){if(isNaN(e))switch(t){case`rangeMin`:return`GaugeRangeMinNaN`;case`rangeMax`:return`GaugeRangeMaxNaN`;case`lowerInflectionPointValue`:return`GaugeLowerInflectionPointNaN`;case`upperInflectionPointValue`:return`GaugeUpperInflectionPointNaN`}return`Success`}var HD=class e extends jg{dataRange;sectionRule;background;type=`gauge`;constructor(e,t,n){super(e,t,n),this.dataRange=Ks(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,ID,e.chainValidations(LD(BD,e.batchValidations),LD(VD,e.batchValidations),zD),e.chainValidations(RD(VD,e.batchValidations)))}static transformDefinition(e,t){let n;return e.dataRange&&(n=nd(Qn(e.dataRange),t)),{...e,dataRange:n?nr(n):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||{text:``},type:`gauge`,dataRange:e.range?.[0]?.dataRange,sectionRule:{colors:{lowerColor:`#EA6175`,middleColor:`#FFD86D`,upperColor:`#43C5B1`},rangeMin:`0`,rangeMax:`100`,lowerInflectionPoint:{type:`percentage`,value:`15`,operator:`<=`},upperInflectionPoint:{type:`percentage`,value:`40`,operator:`<=`}}}}copyForSheetId(t){let n=xd(this.sheetId,t,this.dataRange);return new e(this.getDefinitionWithSpecificRanges(n,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificRanges(this.dataRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:`gauge`,dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{...this,range:this.dataRange?[{dataRange:this.getters.getRangeString(this.dataRange,this.sheetId)}]:void 0}}updateRanges(t){let n=Sd(this.dataRange,t);return this.dataRange===n?this:new e(this.getDefinitionWithSpecificRanges(n),this.sheetId,this.getters)}};function UD(e,t){let n=t.getLocale(),r=e.sectionRule.colors,i,a,o,s=e.dataRange;if(s!==void 0){let e=t.getEvaluatedCell({sheetId:s.sheetId,col:s.zone.left,row:s.zone.top});e.type===`number`&&(i=e.value,a=e.formattedValue,o=e.format)}let c=Number(e.sectionRule.rangeMin),l=Number(e.sectionRule.rangeMax),u=e.sectionRule.lowerInflectionPoint,d=e.sectionRule.upperInflectionPoint,f=WD(u,c,l),p=WD(d,c,l),m=[],h=[];return f!==void 0&&(m.push({value:f,label:B(f,{locale:n,format:o}),operator:u.operator}),h.push(r.lowerColor)),p!==void 0&&p!==f&&(m.push({value:p,label:B(p,{locale:n,format:o}),operator:d.operator}),h.push(r.middleColor)),p!==void 0&&f!==void 0&&f>p&&(m.reverse(),h.reverse()),h.push(r.upperColor),{background:t.getStyleOfSingleCellChart(e.background,s).background,title:{...e.title,text:T(e.title.text??``)},minValue:{value:c,label:B(c,{locale:n,format:o})},maxValue:{value:l,label:B(l,{locale:n,format:o})},gaugeValue:i!==void 0&&a?{value:i,label:a}:void 0,inflectionValues:m,colors:h}}function WD(e,t,n){if(e.value===``||isNaN(Number(e.value)))return;let r=Number(e.value);return b(e.type===`number`?r:t+(n-t)*r/100,t,n)}var GD=class e extends jg{dataSets;labelRange;background;legendPosition;labelsAsText;stacked;aggregated;type=`line`;dataSetsHaveTitle;cumulative;dataSetDesign;axesDesign;fillArea;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.cumulative=e.cumulative,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.fillArea=e.fillArea,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static transformDefinition(e,t){return Dd(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`line`,labelRange:e.auxiliaryRange||void 0,stacked:e.stacked??!1,aggregated:e.aggregated??!1,cumulative:e.cumulative??!1,axesDesign:e.axesDesign,fillArea:e.fillArea,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`line`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated,cumulative:this.cumulative,axesDesign:this.axesDesign,fillArea:this.fillArea,showValues:this.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}},KD=class e extends jg{dataSets;labelRange;background;legendPosition;type=`pie`;aggregated;dataSetsHaveTitle;isDoughnut;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.isDoughnut=e.isDoughnut,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pie`,labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,isDoughnut:!1,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{...this,range:this.dataSets.map(e=>({dataRange:this.getters.getRangeString(e.dataRange,this.sheetId)})),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,n){return{type:`pie`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:e.map(e=>({dataRange:this.getters.getRangeString(e.dataRange,n||this.sheetId)})),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,isDoughnut:this.isDoughnut,showValues:this.showValues}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``&&e.range!==A.InvalidReference),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle));return{...this.getDefinition(),backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function qD(e,t,n){let r=Od(e.background),i=Zg(e,t,r,n),a={labels:{color:r}};return!e.labelRange&&e.dataSets.length===1||e.legendPosition===`none`?a.display=!1:a.position=e.legendPosition,Object.assign(i.options.plugins.legend||{},a),i.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},i.options.plugins.tooltip.callbacks.title=function(e){return e[0].dataset.label},i.options.plugins.tooltip.callbacks.label=function(e){let{format:t,locale:r}=n,i=e.dataset.data,a=e.dataIndex,o=YD(i,a),s=e.label||e.dataset.label,c=e.parsed.y??e.parsed,l=B(c,{format:!t&&c>=1e3?`#,##`:t,locale:r});return s?`${s}: ${l} (${o}%)`:`${l} (${o}%)`},i.options.plugins.chartShowValuesPlugin={showValues:e.showValues,callback:Bd(n)},i}function JD(e,t){let n=[],r=Gt(t.map(e=>e.data.length));for(let t=0;t<=r;t++)n.push(e.next());return n}function YD(e,t){let n=e.filter(e=>typeof e==`number`).reduce((e,t)=>e+t,0);return n?(e[t]/n*100).toFixed(2):``}function XD(e,t){let n=e.reduce((e,n,r)=>(t.some(e=>{let t=e.data[r];return typeof t!=`number`||t>=0})&&e.push(r),e),[]);return{labels:n.map(t=>e[t]||``),dataSetsValues:t.map(e=>({...e,data:n.map(t=>{let n=e.data[t];return typeof n!=`number`||n>=0?n:0})}))}}function ZD(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets).filter(e=>!e.hidden);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r)),{dataSetsValues:r,labels:n}=XD(n,r);let i=e_(t,e.dataSets),a=t.getLocale(),o=qD(e,n,{format:i,locale:a}),s=JD(new wn(Math.max(0,...r.map(e=>e?.data?.length??0))),r);for(let{label:t,data:n}of r){let r={label:t,data:n,borderColor:e.background||`#FFFFFF`,backgroundColor:s,hoverOffset:30};o.data.datasets.push(r)}return e.isDoughnut&&(o.type=`doughnut`),{chartJsConfig:o,background:e.background||`#FFFFFF`}}var QD=class e extends jg{dataSets;labelRange;background;legendPosition;aggregated;type=`pyramid`;dataSetsHaveTitle;dataSetDesign;axesDesign;horizontal=!0;stacked=!0;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle).slice(0,2),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pyramid`,labelRange:e.auxiliaryRange||void 0,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`pyramid`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,axesDesign:this.axesDesign,horizontal:!0,stacked:!0,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function $D(e,t){let n=hD(new mD({...e.getDefinition(),type:`bar`},e.sheetId,t),t).chartJsConfig,r=n.data?.datasets.filter(e=>!e.hidden);r&&r[0]&&(r[0].data=r[0].data.map(e=>e>0?e:0)),r&&r[1]&&(r[1].data=r[1].data.map(e=>e>0?-e:0));let i=Math.max(...n.data.datasets.map(e=>Math.max(...e.data.map(Math.abs)))),a=n.options.scales,o=a.x.ticks.callback;a.x.ticks.callback=e=>o(Math.abs(e)),a.x.suggestedMin=-i,a.x.suggestedMax=i;let s=n.options.plugins.tooltip.callbacks.label;n.options.plugins.tooltip.callbacks.label=e=>s({...e,parsed:{y:e.parsed.y,x:Math.abs(e.parsed.x)}});let c=n.options.plugins.chartShowValuesPlugin.callback;return n.options.plugins.chartShowValuesPlugin.callback=(e,t,n)=>c(Math.abs(e),t,n),{chartJsConfig:n,background:e.background||`#FFFFFF`}}var eO=class e extends jg{dataSets;labelRange;background;legendPosition;labelsAsText;aggregated;type=`scatter`;dataSetsHaveTitle;dataSetDesign;axesDesign;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(this.getters,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static transformDefinition(e,t){return Dd(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range??[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`scatter`,labelRange:e.auxiliaryRange||void 0,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`scatter`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,aggregated:this.aggregated,axesDesign:this.axesDesign,showValues:this.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}getDefinitionForExcel(){let e=this.dataSets.map(e=>Td(this.getters,e)).filter(e=>e.range!==``),t=Ed(this.getters,this.labelRange,jd(this.labelRange,this.dataSets[0],this.dataSetsHaveTitle)),n=this.getDefinition();return{...n,backgroundColor:pD(this.background||`#FFFFFF`),fontColor:pD(Od(this.background)),dataSets:e,labelRange:t,verticalAxis:Pd(n)}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}};function tO(e,t){let{chartJsConfig:n,background:r}=ND(e,t);n.type=`line`;for(let e of n.data.datasets)e.showLine=`showLine`in e?e.showLine:!1;return{chartJsConfig:n,background:r}}var nO=class e extends jg{dataSets;labelRange;background;verticalAxisPosition;legendPosition;aggregated;type=`waterfall`;dataSetsHaveTitle;showSubTotals;firstValueAsSubtotal;showConnectorLines;positiveValuesColor;negativeValuesColor;subTotalValuesColor;dataSetDesign;axesDesign;showValues;constructor(e,t,n){super(e,t,n),this.dataSets=Cd(n,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Ks(n,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated,this.dataSetsHaveTitle=e.dataSetsHaveTitle,this.showSubTotals=e.showSubTotals,this.showConnectorLines=e.showConnectorLines,this.positiveValuesColor=e.positiveValuesColor,this.negativeValuesColor=e.negativeValuesColor,this.subTotalValuesColor=e.subTotalValuesColor,this.firstValueAsSubtotal=e.firstValueAsSubtotal,this.dataSetDesign=e.dataSets,this.axesDesign=e.axesDesign,this.showValues=e.showValues}static transformDefinition(e,t){return Dd(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,kd,Ad)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:e.dataSetsHaveTitle??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`waterfall`,verticalAxisPosition:`left`,labelRange:e.auxiliaryRange||void 0,showSubTotals:e.showSubTotals??!1,showConnectorLines:e.showConnectorLines??!0,firstValueAsSubtotal:e.firstValueAsSubtotal??!1,axesDesign:e.axesDesign,showValues:e.showValues}}getContextCreation(){let e=[];for(let[t,n]of this.dataSets.entries())e.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(n.dataRange,this.sheetId)});return{...this,range:e,auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.dataSets),r=xd(this.sheetId,t,this.labelRange);return new e(this.getDefinitionWithSpecificDataSets(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,n){let r=[];for(let[t,i]of e.entries())r.push({...this.dataSetDesign?.[t],dataRange:this.getters.getRangeString(i.dataRange,n||this.sheetId)});return{type:`waterfall`,dataSetsHaveTitle:e.length?!!e[0].labelCell:!1,background:this.background,dataSets:r,legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,n||this.sheetId):void 0,title:this.title,aggregated:this.aggregated,showSubTotals:this.showSubTotals,showConnectorLines:this.showConnectorLines,positiveValuesColor:this.positiveValuesColor,negativeValuesColor:this.negativeValuesColor,subTotalValuesColor:this.subTotalValuesColor,firstValueAsSubtotal:this.firstValueAsSubtotal,axesDesign:this.axesDesign,showValues:this.showValues}}getDefinitionForExcel(){}updateRanges(t){let{dataSets:n,labelRange:r,isStale:i}=yd(this.getters,t,this.dataSets,this.labelRange);return i?new e(this.getDefinitionWithSpecificDataSets(n,r),this.sheetId,this.getters):this}};function rO(e,t,n,r,i){let{locale:a,format:o}=r,s=Od(e.background),c=Zg(e,t,s,r),l=e.negativeValuesColor||`#EA6175`,u=e.positiveValuesColor||`#4EA7F2`,d=e.subTotalValuesColor||`#AAAAAA`,f={labels:{generateLabels:()=>{let t=[{text:T(`Positive values`),fontColor:s,fillStyle:u,strokeStyle:u},{text:T(`Negative values`),fontColor:s,fillStyle:l,strokeStyle:l}];return(e.showSubTotals||e.firstValueAsSubtotal)&&t.push({text:T(`Subtotals`),fontColor:s,fillStyle:d,strokeStyle:d}),t}}};e.legendPosition===`none`?f.display=!1:f.position=e.legendPosition,c.options.plugins.legend={...c.options.plugins?.legend,...f},c.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},c.options.scales={x:{ticks:{padding:5,color:s},grid:{display:!1},title:Nd(e.axesDesign?.x)},y:{position:e.verticalAxisPosition,ticks:{color:s,callback:e=>(e=Number(e),isNaN(e)?e:B(e,{locale:a,format:!o&&Math.abs(e)>1e3?`#,##`:o}))},grid:{lineWidth:e=>e.tick.value===0?2:1},title:Nd(e.axesDesign?.y)}},c.options.plugins.tooltip={callbacks:{label:function(e){let[r,i]=e.raw,s=i-r,c=n[Math.floor(e.dataIndex/t.length)],l=B(s,{format:!o&&Math.abs(s)>1e3?`#,##`:o,locale:a});return c?`${c}: ${l}`:l}}},c.options.plugins.waterfallLinesPlugin={showConnectorLines:e.showConnectorLines};let p=i.reduce((e,t)=>(e.push((e.at(-1)||-1)+t.data.length+1),e),[]);return c.options.plugins.chartShowValuesPlugin={showValues:e.showValues,background:e.background,callback:(t,n,i)=>{let a=n._dataset.data[i],o=a[1]-a[0],s=o>=0?`+`:``;return e.showSubTotals&&p.includes(i)&&s===`+`&&(s=``),`${s}${Bd(r)(o)}`}},c}function iO(e,t){let n=$g(t,e.dataSets,e.labelRange).formattedValues,r=t_(t,e.dataSets).filter(e=>!e.hidden);jd(e.labelRange,e.dataSets[0],e.dataSetsHaveTitle)&&n.shift(),{labels:n,dataSetsValues:r}=Jg(n,r),e.aggregated&&({labels:n,dataSetsValues:r}=Yg(n,r)),e.showSubTotals&&n.push(T(`Subtotal`));let i=e_(t,e.dataSets),a=t.getLocale(),o=r.map(e=>e.label),s=rO(e,n,o,{format:i,locale:a},r);s.type=`bar`;let c=e.negativeValuesColor||`#EA6175`,l=e.positiveValuesColor||`#4EA7F2`,u=e.subTotalValuesColor||`#AAAAAA`,d=[],f=[],p={label:``,data:f,backgroundColor:d},m=[],h=0;for(let t of r){for(let i=0;i<t.data.length;i++){let a=t.data[i];if(m.push(n[i]),isNaN(Number(a))){f.push([h,h]),d.push(``);continue}f.push([h,a+h]);let o=a>=0?l:c;i===0&&t===r[0]&&e.firstValueAsSubtotal&&(o=u),d.push(o),h+=a}e.showSubTotals&&(m.push(T(`Subtotal`)),f.push([0,h]),d.push(u))}return s.data.datasets.push(p),s.data.labels=m.map(Xg),{chartJsConfig:s,background:e.background||`#FFFFFF`}}let aO=new h;aO.add(`bar`,{match:e=>e===`bar`,createChart:(e,t,n)=>new mD(e,t,n),getChartRuntime:hD,validateChartDefinition:mD.validateChartDefinition,transformDefinition:mD.transformDefinition,getChartDefinitionFromContextCreation:mD.getDefinitionFromContextCreation,sequence:10}),aO.add(`combo`,{match:e=>e===`combo`,createChart:(e,t,n)=>new PD(e,t,n),getChartRuntime:FD,validateChartDefinition:PD.validateChartDefinition,transformDefinition:PD.transformDefinition,getChartDefinitionFromContextCreation:PD.getDefinitionFromContextCreation,sequence:15}),aO.add(`line`,{match:e=>e===`line`,createChart:(e,t,n)=>new GD(e,t,n),getChartRuntime:ND,validateChartDefinition:GD.validateChartDefinition,transformDefinition:GD.transformDefinition,getChartDefinitionFromContextCreation:GD.getDefinitionFromContextCreation,sequence:20}),aO.add(`pie`,{match:e=>e===`pie`,createChart:(e,t,n)=>new KD(e,t,n),getChartRuntime:ZD,validateChartDefinition:KD.validateChartDefinition,transformDefinition:KD.transformDefinition,getChartDefinitionFromContextCreation:KD.getDefinitionFromContextCreation,sequence:30}),aO.add(`scorecard`,{match:e=>e===`scorecard`,createChart:(e,t,n)=>new Bg(e,t,n),getChartRuntime:Hg,validateChartDefinition:Bg.validateChartDefinition,transformDefinition:Bg.transformDefinition,getChartDefinitionFromContextCreation:Bg.getDefinitionFromContextCreation,sequence:40}),aO.add(`gauge`,{match:e=>e===`gauge`,createChart:(e,t,n)=>new HD(e,t,n),getChartRuntime:UD,validateChartDefinition:HD.validateChartDefinition,transformDefinition:HD.transformDefinition,getChartDefinitionFromContextCreation:HD.getDefinitionFromContextCreation,sequence:50}),aO.add(`scatter`,{match:e=>e===`scatter`,createChart:(e,t,n)=>new eO(e,t,n),getChartRuntime:tO,validateChartDefinition:eO.validateChartDefinition,transformDefinition:eO.transformDefinition,getChartDefinitionFromContextCreation:eO.getDefinitionFromContextCreation,sequence:60}),aO.add(`waterfall`,{match:e=>e===`waterfall`,createChart:(e,t,n)=>new nO(e,t,n),getChartRuntime:iO,validateChartDefinition:nO.validateChartDefinition,transformDefinition:nO.transformDefinition,getChartDefinitionFromContextCreation:nO.getDefinitionFromContextCreation,sequence:70}),aO.add(`pyramid`,{match:e=>e===`pyramid`,createChart:(e,t,n)=>new QD(e,t,n),getChartRuntime:$D,validateChartDefinition:QD.validateChartDefinition,transformDefinition:QD.transformDefinition,getChartDefinitionFromContextCreation:QD.getDefinitionFromContextCreation,sequence:80});let oO=new h;oO.add(`line`,s_),oO.add(`bar`,s_),oO.add(`combo`,s_),oO.add(`pie`,s_),oO.add(`gauge`,fD),oO.add(`scatter`,s_),oO.add(`scorecard`,c_),oO.add(`waterfall`,s_),oO.add(`pyramid`,s_);let sO={line:T(`Line`),column:T(`Column`),bar:T(`Bar`),area:T(`Area`),pie:T(`Pie`),misc:T(`Miscellaneous`)},cO=new h;cO.add(`line`,{matcher:e=>e.type===`line`&&!e.stacked&&!e.fillArea,displayName:T(`Line`),chartType:`line`,chartSubtype:`line`,subtypeDefinition:{stacked:!1,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.LINE_CHART`}).add(`stacked_line`,{matcher:e=>e.type===`line`&&!e.fillArea&&!!e.stacked,displayName:T(`Stacked Line`),chartType:`line`,chartSubtype:`stacked_line`,subtypeDefinition:{stacked:!0,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.STACKED_LINE_CHART`}).add(`area`,{matcher:e=>e.type===`line`&&!e.stacked&&!!e.fillArea,displayName:T(`Area`),chartType:`line`,chartSubtype:`area`,subtypeDefinition:{stacked:!1,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.AREA_CHART`}).add(`stacked_area`,{matcher:e=>e.type===`line`&&e.stacked&&!!e.fillArea,displayName:T(`Stacked Area`),chartType:`line`,chartSubtype:`stacked_area`,subtypeDefinition:{stacked:!0,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.STACKED_AREA_CHART`}).add(`scatter`,{displayName:T(`Scatter`),chartType:`scatter`,chartSubtype:`scatter`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCATTER_CHART`}).add(`column`,{matcher:e=>e.type===`bar`&&!e.stacked&&!e.horizontal,displayName:T(`Column`),chartType:`bar`,chartSubtype:`column`,subtypeDefinition:{stacked:!1,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.COLUMN_CHART`}).add(`stacked_column`,{matcher:e=>e.type===`bar`&&e.stacked&&!e.horizontal,displayName:T(`Stacked Column`),chartType:`bar`,chartSubtype:`stacked_column`,subtypeDefinition:{stacked:!0,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART`}).add(`bar`,{matcher:e=>e.type===`bar`&&!e.stacked&&!!e.horizontal,displayName:T(`Bar`),chartType:`bar`,chartSubtype:`bar`,subtypeDefinition:{horizontal:!0,stacked:!1},category:`bar`,preview:`o-spreadsheet-ChartPreview.BAR_CHART`}).add(`stacked_bar`,{matcher:e=>e.type===`bar`&&e.stacked&&!!e.horizontal,displayName:T(`Stacked Bar`),chartType:`bar`,chartSubtype:`stacked_bar`,subtypeDefinition:{horizontal:!0,stacked:!0},category:`bar`,preview:`o-spreadsheet-ChartPreview.STACKED_BAR_CHART`}).add(`combo`,{displayName:T(`Combo`),chartSubtype:`combo`,chartType:`combo`,category:`line`,preview:`o-spreadsheet-ChartPreview.COMBO_CHART`}).add(`pie`,{matcher:e=>e.type===`pie`&&!e.isDoughnut,displayName:T(`Pie`),chartSubtype:`pie`,chartType:`pie`,subtypeDefinition:{isDoughnut:!1},category:`pie`,preview:`o-spreadsheet-ChartPreview.PIE_CHART`}).add(`doughnut`,{matcher:e=>e.type===`pie`&&!!e.isDoughnut,displayName:T(`Doughnut`),chartSubtype:`doughnut`,chartType:`pie`,subtypeDefinition:{isDoughnut:!0},category:`pie`,preview:`o-spreadsheet-ChartPreview.DOUGHNUT_CHART`}).add(`gauge`,{displayName:T(`Gauge`),chartSubtype:`gauge`,chartType:`gauge`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GAUGE_CHART`}).add(`scorecard`,{displayName:T(`Scorecard`),chartSubtype:`scorecard`,chartType:`scorecard`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCORECARD_CHART`}).add(`waterfall`,{displayName:T(`Waterfall`),chartSubtype:`waterfall`,chartType:`waterfall`,category:`misc`,preview:`o-spreadsheet-ChartPreview.WATERFALL_CHART`}).add(`pyramid`,{displayName:T(`Population Pyramid`),chartSubtype:`pyramid`,chartType:`pyramid`,category:`misc`,preview:`o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART`});let lO=new h;H`
171
171
  .o-chart-container {
172
172
  width: 100%;
173
173
  height: 100%;
@@ -1207,7 +1207,7 @@ stores.inject(MyMetaStore, storeInstance);
1207
1207
  }
1208
1208
  }
1209
1209
  }
1210
- `;var YP=class extends t.Component{static template=`o-spreadsheet-FindAndReplacePanel`;static components={SelectionInput:kN,Section:Z,Checkbox:EN,ValidationMessages:jN};static props={onCloseSidePanel:Function};searchInput=(0,t.useRef)(`searchInput`);store;state;updateSearchContent;get hasSearchResult(){return this.store.selectedMatchIndex!==null}get searchOptions(){return this.store.searchOptions}get allSheetsMatchesCount(){return T(`%s matches in all sheets`,this.store.allSheetMatchesCount)}get currentSheetMatchesCount(){return T(`%(matches)s matches in %(sheetName)s`,{matches:this.store.activeSheetMatchesCount,sheetName:this.env.model.getters.getSheetName(this.env.model.getters.getActiveSheetId())})}get specificRangeMatchesCount(){let e=this.searchOptions.specificRange;if(!e)return``;let{sheetId:t,zone:n}=e;return T(`%(matches)s matches in range %(range)s of %(sheetName)s`,{matches:this.store.specificRangeMatchesCount,range:nr(n),sheetName:this.env.model.getters.getSheetName(t)})}get searchInfo(){return this.store.toSearch?[this.specificRangeMatchesCount,this.currentSheetMatchesCount,this.allSheetsMatchesCount]:[]}setup(){this.store=ud(JP),this.state=(0,t.useState)({dataRange:``}),(0,t.onMounted)(()=>this.searchInput.el?.focus()),(0,t.onWillUnmount)(()=>this.updateSearchContent.stopDebounce()),this.updateSearchContent=Ct(this.store.updateSearchContent,200)}onFocusSearch(){this.updateDataRange()}onSearchInput(e){this.updateSearchContent(e.target.value)}onKeydownSearch(e){e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?this.store.selectPreviousMatch():this.store.selectNextMatch())}onKeydownReplace(e){e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.store.replace())}searchFormulas(e){this.store.searchFormulas(e)}searchExactMatch(e){this.store.updateSearchOptions({exactMatch:e})}searchMatchCase(e){this.store.updateSearchOptions({matchCase:e})}changeSearchScope(e){let t=e.target.value;this.store.updateSearchOptions({searchScope:t})}onSearchRangeChanged(e){this.state.dataRange=e[0]}updateDataRange(){if(!this.state.dataRange||this.searchOptions.searchScope!==`specificRange`)return;let e=this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(),this.state.dataRange);this.store.updateSearchOptions({specificRange:e})}get specificRange(){let e=this.store.searchOptions.specificRange;return e?this.env.model.getters.getRangeString(e,`forceSheetReference`):``}get pendingSearch(){return this.updateSearchContent.isDebouncePending()}get selectionInputKey(){return this.env.model.getters.getActiveSheetId()}};H`
1210
+ `;var YP=class extends t.Component{static template=`o-spreadsheet-FindAndReplacePanel`;static components={SelectionInput:kN,Section:Z,Checkbox:EN,ValidationMessages:jN};static props={onCloseSidePanel:Function};searchInput=(0,t.useRef)(`searchInput`);store;state;updateSearchContent;get hasSearchResult(){return this.store.selectedMatchIndex!==null}get searchOptions(){return this.store.searchOptions}get allSheetsMatchesCount(){return T(`%s matches in all sheets`,this.store.allSheetMatchesCount)}get currentSheetMatchesCount(){return T(`%(matches)s matches in %(sheetName)s`,{matches:this.store.activeSheetMatchesCount,sheetName:this.env.model.getters.getSheetName(this.env.model.getters.getActiveSheetId())})}get specificRangeMatchesCount(){let e=this.searchOptions.specificRange;if(!e||e.invalidSheetName||e.invalidXc)return``;let{sheetId:t,zone:n}=e;return T(`%(matches)s matches in range %(range)s of %(sheetName)s`,{matches:this.store.specificRangeMatchesCount,range:nr(n),sheetName:this.env.model.getters.getSheetName(t)})}get searchInfo(){return this.store.toSearch?[this.specificRangeMatchesCount,this.currentSheetMatchesCount,this.allSheetsMatchesCount]:[]}setup(){this.store=ud(JP),this.state=(0,t.useState)({dataRange:``}),(0,t.onMounted)(()=>this.searchInput.el?.focus()),(0,t.onWillUnmount)(()=>this.updateSearchContent.stopDebounce()),this.updateSearchContent=Ct(this.store.updateSearchContent,200)}onFocusSearch(){this.updateDataRange()}onSearchInput(e){this.updateSearchContent(e.target.value)}onKeydownSearch(e){e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?this.store.selectPreviousMatch():this.store.selectNextMatch())}onKeydownReplace(e){e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),this.store.replace())}searchFormulas(e){this.store.searchFormulas(e)}searchExactMatch(e){this.store.updateSearchOptions({exactMatch:e})}searchMatchCase(e){this.store.updateSearchOptions({matchCase:e})}changeSearchScope(e){let t=e.target.value;this.store.updateSearchOptions({searchScope:t})}onSearchRangeChanged(e){this.state.dataRange=e[0]}updateDataRange(){if(!this.state.dataRange||this.searchOptions.searchScope!==`specificRange`)return;let e=this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(),this.state.dataRange);this.store.updateSearchOptions({specificRange:e})}get specificRange(){let e=this.store.searchOptions.specificRange;return e?this.env.model.getters.getRangeString(e,`forceSheetReference`):``}get pendingSearch(){return this.updateSearchContent.isDebouncePending()}get selectionInputKey(){return this.env.model.getters.getActiveSheetId()}};H`
1211
1211
  .o-more-formats-panel {
1212
1212
  .format-preview {
1213
1213
  height: 48px;
@@ -3312,4 +3312,4 @@ stores.inject(MyMetaStore, storeInstance);
3312
3312
  <Relationships xmlns="${tf.Relationships}">
3313
3313
  <Relationship ${K(e)} />
3314
3314
  </Relationships>
3315
- `),`_rels/.rels`)}function NH(e){let t={},n=new Set;for(let r of e.sheets){let e=r.name.slice(0,31),i=1;for(;n.has(e);)e=e.slice(0,31-String(i).length)+i++;n.add(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${nt(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function PH(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>mr($n(e.range)).numberOfRows>1);return e}var FH=class extends id{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},n={},r=[],i=new Tc,a=!1){let o=performance.now();console.debug(`##### Model creation #####`),super(),Yn(),r=Gh(e,r);let s=zh(e,a);this.state=new nV,this.uuidGenerator=i,this.config=this.setupConfig(n),this.session=this.setupSession(s.revisionId),this.coreGetters={},this.range=new WL(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.selection=new eV(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of cB.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(r);for(let e of dB.getAll()){let t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of uB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of lB.getAll()){let t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),n.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly()){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}(0,t.markRaw)(this),console.debug(`Model created in`,performance.now()-o,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:Et(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new lz(XB({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowed(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e)}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:T(`Anonymous`).toString()},n=e.transportService||new HB;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(Zi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){let t=Ki(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some(e=>e!==`Success`)?new Ji(t.flat()):Ji.Success}checkDispatchAllowedCoreCommand(e){let t=this.corePlugins.map(t=>t.allowDispatch(e));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=3;for(let e of this.handlers)e.finalize();this.status=0,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(IH(e,t));dispatch=(e,t)=>{let n=IH(e,t),r=this.status;if(this.getters.isReadonly()&&!qi(n))return new Ji(`Readonly`);if(!this.session.canApplyOptimisticUpdate())return new Ji(`WaitingSessionConfirmation`);switch(r){case 0:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),t;this.status=1;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Ki(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=0,this.trigger(`update`);break;case 1:if(Ki(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case 3:throw Error(`Cannot dispatch commands in the finalize state`);case 2:if(Ki(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return Ji.Success};dispatchFromCorePlugin=(e,t)=>{let n=IH(e,t),r=this.status;this.status=2;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,Ji.Success};dispatchToHandlers(e,t){let n=Ki(t);for(let r of e)!n&&r instanceof DL||r.beforeHandle(t);for(let r of e)!n&&r instanceof DL||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let e=Zh();for(let t of this.handlers)t instanceof DL&&t.export(e);return e.revisionId=this.session.getRevisionId()||`START_REVISION`,e=y(e),e}updateMode(e){this.config.mode=e,this.trigger(`update`)}exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=$h();for(let t of this.handlers)t instanceof EL&&t.exportForExcel(e);return e=y(e),wH(e)}garbageCollectExternalResources(){for(let e of this.corePlugins)e.garbageCollectExternalResources()}};function IH(e,t={}){let n=y(t);return n.type=e,n}let LH={},RH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},zH={autoCompleteProviders:l_,autofillModifiersRegistry:eD,autofillRulesRegistry:tD,cellMenuRegistry:bj,colMenuRegistry:fN,errorTypes:na,linkMenuRegistry:rk,functionRegistry:zT,featurePluginRegistry:lB,iconsOnCellRegistry:mf,statefulUIPluginRegistry:uB,coreViewsPluginRegistry:dB,corePluginRegistry:cB,rowMenuRegistry:_N,sidePanelRegistry:pI,figureRegistry:mO,chartSidePanelComponentRegistry:iP,chartComponentRegistry:oO,chartRegistry:aO,chartSubtypeRegistry:cO,topbarMenuRegistry:CN,topbarComponentRegistry:TN,clickableCellRegistry:fB,otRegistry:wN,inverseCommandRegistry:bO,urlRegistry:Za,cellPopoverRegistry:dD,numberFormatMenuRegistry:pN,repeatLocalCommandTransformRegistry:Wz,repeatCommandTransformRegistry:Uz,clipboardHandlersRegistries:td,pivotRegistry:jF,pivotTimeAdapterRegistry:uu,pivotSidePanelRegistry:LF,pivotNormalizationValueRegistry:Vu,supportedPivotPositionalFormulaRegistry:YE,pivotToFunctionValueRegistry:Hu,migrationStepRegistry:Ih},BH={arg:Y,isEvaluationError:N,toBoolean:L,toJsDate:R,toNumber:P,toString:F,toNormalizedPivotValue:Lu,toXC:w,toZone:$n,toUnboundedZone:Qn,toCartesian:Pn,numberToLetters:Tn,lettersToNumber:En,UuidGenerator:Tc,formatValue:B,createCurrencyFormat:$o,ColorGenerator:wn,computeTextWidth:cc,createEmptyWorkbookData:Zh,createEmptySheet:Xh,createEmptyExcelSheet:Qh,getDefaultChartJsRuntime:Zg,chartFontColor:Od,getChartAxisTitleRuntime:Nd,getChartAxisType:TD,getTrendDatasetForBarChart:Id,getTrendDatasetForLineChart:MD,getFillingMode:n_,rgbaToHex:cn,colorToRGBA:ln,positionToZone:E,isDefined:S,isMatrix:k,lazy:Et,genericRepeat:Gz,createAction:m,createActions:f,transformRangeData:rd,deepEquals:C,overlap:dr,union:sr,isInside:fr,deepCopy:y,expandZoneOnInsertion:rr,reduceZoneOnDeletion:or,unquote:at,getMaxObjectId:ku,getFunctionsFromTokens:RE,getFirstPivotFunction:KE,getNumberOfPivotFunctions:JE,parseDimension:Mu,isDateOrDatetimeField:Nu,makeFieldProposal:VE,insertTokenAfterArgSeparator:UE,insertTokenAfterLeftParenthesis:WE,mergeContiguousZones:Mr,getPivotHighlights:yN,pivotTimeAdapter:du,UNDO_REDO_PIVOT_COMMANDS:AR,createPivotFormula:Iu,areDomainArgsFieldsValid:Fu,splitReference:Hs,formatTickValue:Bd,sanitizeSheetName:st,isNumber:ki,isDateTime:Zr},VH={isMarkdownLink:pt,parseMarkdownLink:gt,markdownLink:ht,openLink:no,urlRepresentation:to},HH={Checkbox:EN,Section:Z,RoundColorPicker:UN,ChartDataSeries:AN,ChartErrorSection:MN,ChartLabelRange:NN,ChartTitle:GN,ChartPanel:sP,ChartFigure:uO,ChartJsComponent:s_,Grid:CL,GridOverlay:eL,ScorecardChart:c_,LineConfigPanel:QN,BarConfigPanel:FN,PieChartDesignPanel:$N,GenericChartConfigPanel:PN,ChartWithAxisDesignPanel:JN,GaugeChartConfigPanel:XN,GaugeChartDesignPanel:ZN,ScorecardChartConfigPanel:tP,ScorecardChartDesignPanel:nP,ChartTypePicker:aP,FigureComponent:mI,Menu:mk,Popover:uk,SelectionInput:kN,ValidationMessages:jN,AddDimensionButton:nF,PivotDimensionGranularity:oF,PivotDimensionOrder:sF,PivotDimension:aF,PivotLayoutConfigurator:uF,PivotHTMLRenderer:TL,EditableName:wL,PivotDeferUpdate:eF,PivotTitleSection:dF,CogWheelMenu:iF,TextInput:rF,SidePanelCollapsible:LN},UH={useDragAndDropListItems:pP,useHighlights:xP,useHighlightsOnHover:bP},WH={useStoreProvider:ld,DependencyContainer:ad,CellPopoverStore:KO,ComposerFocusStore:vd,CellComposerStore:EI,FindAndReplaceStore:JP,HighlightStore:SN,HoveredCellStore:GO,ModelStore:md,NotificationStore:cP,RendererStore:hd,SelectionInputStore:ON,SpreadsheetStore:gd,useStore:V,useLocalStore:ud,SidePanelStore:yL,PivotSidePanelStore:FF,PivotMeasureDisplayPanelStore:QP};function GH(e,t){return zT.add(e,t),{addFunction:(e,t)=>GH(e,t)}}let KH={DEFAULT_LOCALE:O,HIGHLIGHT_COLOR:_,PIVOT_TABLE_CONFIG:Ze,TREND_LINE_XAXIS_ID:`x1`,CHART_AXIS_CHOICES:Hd,ChartTerms:og};e.AbstractCellClipboardHandler=Fc,e.AbstractChart=jg,e.AbstractFigureClipboardHandler=Ku,e.CellErrorType=A,e.CommandResult=Xi,e.CorePlugin=DL,e.DispatchResult=Ji,e.EvaluationError=j,e.Model=FH,e.PivotRuntimeDefinition=fF,e.Registry=h,e.Revision=sz,e.SPREADSHEET_DIMENSIONS=RH,e.Spreadsheet=VB,e.SpreadsheetPivotTable=hF,e.UIPlugin=$,e.__info__=LH,e.addFunction=GH,e.addRenderingLayer=ta,e.astToFormula=xC,e.compile=kE,e.compileTokens=AE,e.components=HH,e.constants=KH,e.convertAstNodes=_C,e.coreTypes=Gi,e.findCellInNewZone=Cr,e.functionCache=OE,e.helpers=BH,e.hooks=UH,e.invalidateCFEvaluationCommands=Hi,e.invalidateDependenciesCommands=Vi,e.invalidateEvaluationCommands=zi,e.iterateAstNodes=vC,e.links=VH,e.load=zh,e.parse=hC,e.parseTokens=gC,e.readonlyAllowedCommands=Wi,e.registries=zH,e.setDefaultSheetViewSize=Ye,e.setTranslationMethod=Jn,e.stores=WH,e.tokenColors=vE,e.tokenize=zc,LH.version=`18.0.81`,LH.date=`2026-09-04T07:02:59.688Z`,LH.hash=`a952c0c`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
3315
+ `),`_rels/.rels`)}function NH(e){let t={},n=new Set;for(let r of e.sheets){let e=r.name.slice(0,31),i=1;for(;n.has(e);)e=e.slice(0,31-String(i).length)+i++;n.add(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${nt(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function PH(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>mr($n(e.range)).numberOfRows>1);return e}var FH=class extends id{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},n={},r=[],i=new Tc,a=!1){let o=performance.now();console.debug(`##### Model creation #####`),super(),Yn(),r=Gh(e,r);let s=zh(e,a);this.state=new nV,this.uuidGenerator=i,this.config=this.setupConfig(n),this.session=this.setupSession(s.revisionId),this.coreGetters={},this.range=new WL(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.selection=new eV(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of cB.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(r);for(let e of dB.getAll()){let t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of uB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of lB.getAll()){let t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),n.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly()){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}(0,t.markRaw)(this),console.debug(`Model created in`,performance.now()-o,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:Et(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new lz(XB({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowed(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e)}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:T(`Anonymous`).toString()},n=e.transportService||new HB;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(Zi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){let t=Ki(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some(e=>e!==`Success`)?new Ji(t.flat()):Ji.Success}checkDispatchAllowedCoreCommand(e){let t=this.corePlugins.map(t=>t.allowDispatch(e));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=3;for(let e of this.handlers)e.finalize();this.status=0,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(IH(e,t));dispatch=(e,t)=>{let n=IH(e,t),r=this.status;if(this.getters.isReadonly()&&!qi(n))return new Ji(`Readonly`);if(!this.session.canApplyOptimisticUpdate())return new Ji(`WaitingSessionConfirmation`);switch(r){case 0:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),t;this.status=1;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Ki(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=0,this.trigger(`update`);break;case 1:if(Ki(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case 3:throw Error(`Cannot dispatch commands in the finalize state`);case 2:if(Ki(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return Ji.Success};dispatchFromCorePlugin=(e,t)=>{let n=IH(e,t),r=this.status;this.status=2;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,Ji.Success};dispatchToHandlers(e,t){let n=Ki(t);for(let r of e)!n&&r instanceof DL||r.beforeHandle(t);for(let r of e)!n&&r instanceof DL||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let e=Zh();for(let t of this.handlers)t instanceof DL&&t.export(e);return e.revisionId=this.session.getRevisionId()||`START_REVISION`,e=y(e),e}updateMode(e){this.config.mode=e,this.trigger(`update`)}exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=$h();for(let t of this.handlers)t instanceof EL&&t.exportForExcel(e);return e=y(e),wH(e)}garbageCollectExternalResources(){for(let e of this.corePlugins)e.garbageCollectExternalResources()}};function IH(e,t={}){let n=y(t);return n.type=e,n}let LH={},RH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},zH={autoCompleteProviders:l_,autofillModifiersRegistry:eD,autofillRulesRegistry:tD,cellMenuRegistry:bj,colMenuRegistry:fN,errorTypes:na,linkMenuRegistry:rk,functionRegistry:zT,featurePluginRegistry:lB,iconsOnCellRegistry:mf,statefulUIPluginRegistry:uB,coreViewsPluginRegistry:dB,corePluginRegistry:cB,rowMenuRegistry:_N,sidePanelRegistry:pI,figureRegistry:mO,chartSidePanelComponentRegistry:iP,chartComponentRegistry:oO,chartRegistry:aO,chartSubtypeRegistry:cO,topbarMenuRegistry:CN,topbarComponentRegistry:TN,clickableCellRegistry:fB,otRegistry:wN,inverseCommandRegistry:bO,urlRegistry:Za,cellPopoverRegistry:dD,numberFormatMenuRegistry:pN,repeatLocalCommandTransformRegistry:Wz,repeatCommandTransformRegistry:Uz,clipboardHandlersRegistries:td,pivotRegistry:jF,pivotTimeAdapterRegistry:uu,pivotSidePanelRegistry:LF,pivotNormalizationValueRegistry:Vu,supportedPivotPositionalFormulaRegistry:YE,pivotToFunctionValueRegistry:Hu,migrationStepRegistry:Ih},BH={arg:Y,isEvaluationError:N,toBoolean:L,toJsDate:R,toNumber:P,toString:F,toNormalizedPivotValue:Lu,toXC:w,toZone:$n,toUnboundedZone:Qn,toCartesian:Pn,numberToLetters:Tn,lettersToNumber:En,UuidGenerator:Tc,formatValue:B,createCurrencyFormat:$o,ColorGenerator:wn,computeTextWidth:cc,createEmptyWorkbookData:Zh,createEmptySheet:Xh,createEmptyExcelSheet:Qh,getDefaultChartJsRuntime:Zg,chartFontColor:Od,getChartAxisTitleRuntime:Nd,getChartAxisType:TD,getTrendDatasetForBarChart:Id,getTrendDatasetForLineChart:MD,getFillingMode:n_,rgbaToHex:cn,colorToRGBA:ln,positionToZone:E,isDefined:S,isMatrix:k,lazy:Et,genericRepeat:Gz,createAction:m,createActions:f,transformRangeData:rd,deepEquals:C,overlap:dr,union:sr,isInside:fr,deepCopy:y,expandZoneOnInsertion:rr,reduceZoneOnDeletion:or,unquote:at,getMaxObjectId:ku,getFunctionsFromTokens:RE,getFirstPivotFunction:KE,getNumberOfPivotFunctions:JE,parseDimension:Mu,isDateOrDatetimeField:Nu,makeFieldProposal:VE,insertTokenAfterArgSeparator:UE,insertTokenAfterLeftParenthesis:WE,mergeContiguousZones:Mr,getPivotHighlights:yN,pivotTimeAdapter:du,UNDO_REDO_PIVOT_COMMANDS:AR,createPivotFormula:Iu,areDomainArgsFieldsValid:Fu,splitReference:Hs,formatTickValue:Bd,sanitizeSheetName:st,isNumber:ki,isDateTime:Zr},VH={isMarkdownLink:pt,parseMarkdownLink:gt,markdownLink:ht,openLink:no,urlRepresentation:to},HH={Checkbox:EN,Section:Z,RoundColorPicker:UN,ChartDataSeries:AN,ChartErrorSection:MN,ChartLabelRange:NN,ChartTitle:GN,ChartPanel:sP,ChartFigure:uO,ChartJsComponent:s_,Grid:CL,GridOverlay:eL,ScorecardChart:c_,LineConfigPanel:QN,BarConfigPanel:FN,PieChartDesignPanel:$N,GenericChartConfigPanel:PN,ChartWithAxisDesignPanel:JN,GaugeChartConfigPanel:XN,GaugeChartDesignPanel:ZN,ScorecardChartConfigPanel:tP,ScorecardChartDesignPanel:nP,ChartTypePicker:aP,FigureComponent:mI,Menu:mk,Popover:uk,SelectionInput:kN,ValidationMessages:jN,AddDimensionButton:nF,PivotDimensionGranularity:oF,PivotDimensionOrder:sF,PivotDimension:aF,PivotLayoutConfigurator:uF,PivotHTMLRenderer:TL,EditableName:wL,PivotDeferUpdate:eF,PivotTitleSection:dF,CogWheelMenu:iF,TextInput:rF,SidePanelCollapsible:LN},UH={useDragAndDropListItems:pP,useHighlights:xP,useHighlightsOnHover:bP},WH={useStoreProvider:ld,DependencyContainer:ad,CellPopoverStore:KO,ComposerFocusStore:vd,CellComposerStore:EI,FindAndReplaceStore:JP,HighlightStore:SN,HoveredCellStore:GO,ModelStore:md,NotificationStore:cP,RendererStore:hd,SelectionInputStore:ON,SpreadsheetStore:gd,useStore:V,useLocalStore:ud,SidePanelStore:yL,PivotSidePanelStore:FF,PivotMeasureDisplayPanelStore:QP};function GH(e,t){return zT.add(e,t),{addFunction:(e,t)=>GH(e,t)}}let KH={DEFAULT_LOCALE:O,HIGHLIGHT_COLOR:_,PIVOT_TABLE_CONFIG:Ze,TREND_LINE_XAXIS_ID:`x1`,CHART_AXIS_CHOICES:Hd,ChartTerms:og};e.AbstractCellClipboardHandler=Fc,e.AbstractChart=jg,e.AbstractFigureClipboardHandler=Ku,e.CellErrorType=A,e.CommandResult=Xi,e.CorePlugin=DL,e.DispatchResult=Ji,e.EvaluationError=j,e.Model=FH,e.PivotRuntimeDefinition=fF,e.Registry=h,e.Revision=sz,e.SPREADSHEET_DIMENSIONS=RH,e.Spreadsheet=VB,e.SpreadsheetPivotTable=hF,e.UIPlugin=$,e.__info__=LH,e.addFunction=GH,e.addRenderingLayer=ta,e.astToFormula=xC,e.compile=kE,e.compileTokens=AE,e.components=HH,e.constants=KH,e.convertAstNodes=_C,e.coreTypes=Gi,e.findCellInNewZone=Cr,e.functionCache=OE,e.helpers=BH,e.hooks=UH,e.invalidateCFEvaluationCommands=Hi,e.invalidateDependenciesCommands=Vi,e.invalidateEvaluationCommands=zi,e.iterateAstNodes=vC,e.links=VH,e.load=zh,e.parse=hC,e.parseTokens=gC,e.readonlyAllowedCommands=Wi,e.registries=zH,e.setDefaultSheetViewSize=Ye,e.setTranslationMethod=Jn,e.stores=WH,e.tokenColors=vE,e.tokenize=zc,LH.version=`18.0.82`,LH.date=`2026-09-10T05:35:40.438Z`,LH.hash=`d0329aa`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -1,9 +1,9 @@
1
1
  <!--
2
2
  This file is generated by o-spreadsheet build tools. Do not edit it.
3
3
  @see https://github.com/odoo/o-spreadsheet
4
- @version 18.0.81
5
- @date 2026-09-04T07:03:00.345Z
6
- @hash a952c0c
4
+ @version 18.0.82
5
+ @date 2026-09-10T05:35:40.922Z
6
+ @hash d0329aa
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "18.0.81",
3
+ "version": "18.0.82",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",