@odoo/o-spreadsheet 17.1.23 → 17.1.25

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 17.1.23
6
- * @date 2024-07-11T06:37:01.931Z
7
- * @hash 31e8450
5
+ * @version 17.1.25
6
+ * @date 2024-07-24T10:26:01.576Z
7
+ * @hash 0edff47
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2573,7 +2573,7 @@ function getPredicate(descr, isQuery, locale) {
2573
2573
  operand = descr;
2574
2574
  }
2575
2575
  }
2576
- if (isNumber(operand, locale)) {
2576
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2577
2577
  operand = toNumber(operand, locale);
2578
2578
  }
2579
2579
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -28871,10 +28871,13 @@ function useCellHovered(env, gridRef, callback) {
28871
28871
  row: undefined,
28872
28872
  };
28873
28873
  const { Date } = window;
28874
- let x = 0;
28875
- let y = 0;
28874
+ let x = undefined;
28875
+ let y = undefined;
28876
28876
  let lastMoved = 0;
28877
28877
  function getPosition() {
28878
+ if (x === undefined || y === undefined) {
28879
+ return { col: -1, row: -1 };
28880
+ }
28878
28881
  const col = env.model.getters.getColIndex(x);
28879
28882
  const row = env.model.getters.getRowIndex(y);
28880
28883
  return { col, row };
@@ -57879,6 +57882,6 @@ exports.setTranslationMethod = setTranslationMethod;
57879
57882
  exports.tokenize = tokenize;
57880
57883
 
57881
57884
 
57882
- __info__.version = "17.1.23";
57883
- __info__.date = "2024-07-11T06:37:01.931Z";
57884
- __info__.hash = "31e8450";
57885
+ __info__.version = "17.1.25";
57886
+ __info__.date = "2024-07-24T10:26:01.576Z";
57887
+ __info__.hash = "0edff47";
@@ -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 17.1.23
6
- * @date 2024-07-11T06:37:01.931Z
7
- * @hash 31e8450
5
+ * @version 17.1.25
6
+ * @date 2024-07-24T10:26:01.576Z
7
+ * @hash 0edff47
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, onWillUnmount, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -2571,7 +2571,7 @@ function getPredicate(descr, isQuery, locale) {
2571
2571
  operand = descr;
2572
2572
  }
2573
2573
  }
2574
- if (isNumber(operand, locale)) {
2574
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2575
2575
  operand = toNumber(operand, locale);
2576
2576
  }
2577
2577
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -28869,10 +28869,13 @@ function useCellHovered(env, gridRef, callback) {
28869
28869
  row: undefined,
28870
28870
  };
28871
28871
  const { Date } = window;
28872
- let x = 0;
28873
- let y = 0;
28872
+ let x = undefined;
28873
+ let y = undefined;
28874
28874
  let lastMoved = 0;
28875
28875
  function getPosition() {
28876
+ if (x === undefined || y === undefined) {
28877
+ return { col: -1, row: -1 };
28878
+ }
28876
28879
  const col = env.model.getters.getColIndex(x);
28877
28880
  const row = env.model.getters.getRowIndex(y);
28878
28881
  return { col, row };
@@ -57841,6 +57844,6 @@ const constants = {
57841
57844
  export { AbstractChart, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57842
57845
 
57843
57846
 
57844
- __info__.version = "17.1.23";
57845
- __info__.date = "2024-07-11T06:37:01.931Z";
57846
- __info__.hash = "31e8450";
57847
+ __info__.version = "17.1.25";
57848
+ __info__.date = "2024-07-24T10:26:01.576Z";
57849
+ __info__.hash = "0edff47";
@@ -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 17.1.23
6
- * @date 2024-07-11T06:37:01.931Z
7
- * @hash 31e8450
5
+ * @version 17.1.25
6
+ * @date 2024-07-24T10:26:01.576Z
7
+ * @hash 0edff47
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -2572,7 +2572,7 @@
2572
2572
  operand = descr;
2573
2573
  }
2574
2574
  }
2575
- if (isNumber(operand, locale)) {
2575
+ if (isNumber(operand, locale) || isDateTime(operand, locale)) {
2576
2576
  operand = toNumber(operand, locale);
2577
2577
  }
2578
2578
  else if (operand === "TRUE" || operand === "FALSE") {
@@ -28870,10 +28870,13 @@
28870
28870
  row: undefined,
28871
28871
  };
28872
28872
  const { Date } = window;
28873
- let x = 0;
28874
- let y = 0;
28873
+ let x = undefined;
28874
+ let y = undefined;
28875
28875
  let lastMoved = 0;
28876
28876
  function getPosition() {
28877
+ if (x === undefined || y === undefined) {
28878
+ return { col: -1, row: -1 };
28879
+ }
28877
28880
  const col = env.model.getters.getColIndex(x);
28878
28881
  const row = env.model.getters.getRowIndex(y);
28879
28882
  return { col, row };
@@ -57878,9 +57881,9 @@
57878
57881
  exports.tokenize = tokenize;
57879
57882
 
57880
57883
 
57881
- __info__.version = "17.1.23";
57882
- __info__.date = "2024-07-11T06:37:01.931Z";
57883
- __info__.hash = "31e8450";
57884
+ __info__.version = "17.1.25";
57885
+ __info__.date = "2024-07-24T10:26:01.576Z";
57886
+ __info__.hash = "0edff47";
57884
57887
 
57885
57888
 
57886
57889
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1,4 +1,4 @@
1
- !function(e,t){"use strict";const o=.5,s="#f5f5f5",n="#F8F9FA",i="#E8EAED",r="#595959",a="#666666",l="#c9ccd2",c="#3266ca",h="#FFFFFF",d="#EBEBEB",u="#CACACA",g=11982760,p="#01666b",m="#188038",f="#E6F4EA",v="#CEEAD6",b="#E0E2E4",S="#4A4F59",C="#999",E="#E2E3E3",w="#BCBCBC",y="#9B359B",x=["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF","#980000","#FF0000","#FF9900","#FFFF00","#00FF00","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF","#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#741B47","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"],I=26,R=48,T=96,A=23,O=15,_=4,M=_,N=21,F=17,D=2*A,L=250,P={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},k=P.verticalAlign,V=P.wrapping,U="400",B=P.fontSize,H="'Roboto', arial",z="thin",G="#000000",W={style:"thin",color:m},$="START_REVISION",q=1,Z=20,Y="??",j="difference",X="#00A04A",K="#DC6965",Q=["'","*","?","/","\\","[","]"],J=/'|\*|\?|\/|\\|\[|\]/,ee="|";var te;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(te||(te={}));let oe=0;function se(){return oe}const ne="\n",ie=[6,7,8,9,10,11,12,14,18,24,36];function re(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function le(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=le(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function ce(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function he(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function de(e,t,o){return e<t?t:e>o?o:e}function ue(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function ge(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*pe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const me=/^\[(.+)\]\((.+)\)$/,fe=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function ve(e){return me.test(e)}function be(e){return fe.test(e)}function Se(e,t){return`[${e}](${t})`}function Ce(e){const t=e.match(me)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Ee="o-spreadsheet://";function we(e){return e.startsWith(Ee)}function ye(e){return`${Ee}${e}`}function xe(e){if(e.startsWith(Ee))return e.substr(Ee.length);throw new Error(`${e} is not a valid sheet link`)}function Ie(e){return void 0!==e}function Re(e){return null!==e}function Te(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?Te(e):!e))}function Ae(e,t){for(const o in t)if(Fe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:$e(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Oe(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function _e(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>_e((()=>e(s()))),s}function Me(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ne(e,t){return"after"===e?t+1:t}function Fe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Fe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function De(e,t){return t.every((t=>e.includes(t)))}function Le(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const Pe=["\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ke=new RegExp(Pe.join("|")+"|(\r\n|\r|\n)","g");function Ve(e){return e?ke.test(e)?e.replace(ke,((e,t)=>t?ne:" ")):e:""}function Ue(e){const t=Array.from(e).sort(((e,t)=>e-t));for(let e=1;e<t.length;e++)if(t[e]-t[e-1]!=1)return!1;return!0}class Be extends Set{addMany(e){for(const t of e)super.add(t);return this}deleteMany(e){for(const t of e)super.delete(t)}}function He(e){const t=new Map,o=e.name?e.name+" (memoized)":"memoized";return{[o]:(...o)=>(t.has(o[0])||t.set(o[0],e(...o)),t.get(o[0]))}[o]}function ze(e,t){return e.filter(((e,o)=>!t.includes(o)))}function Ge(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function We(e,t,o){return t>o?We(e,o,t):e>=t&&e<=o}function $e(e){let t=e.length;if(t<1e5)return Math.max(...e);let o=-1/0;for(;t--;)o=e[t]>o?e[t]:o;return o}function qe(e){let t=e.length;if(t<1e5)return Math.min(...e);let o=1/0;for(;t--;)o=e[t]<o?e[t]:o;return o}const Ze=/rgba?\(|\s+|\)/gi,Ye=/^#([A-F\d]{2}){3,4}$/,je=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function Xe(e){return Ke(e.toString(16).padStart(6,"0"))}function Ke(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(Ze,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Oe(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!Ye.test(t))throw new Error(`invalid color input: ${e}`);return t}function Qe(e){try{return Ke(e),!0}catch(e){return!1}}const Je=e=>e>=0&&e<=255;function et(e,t,o,s=1){if(!Je(e)||!Je(t)||!Je(o)||s<0||s>1)throw new Error(`Invalid RGBA values ${[e,t,o,s]}`);return{a:s,b:o,g:t,r:e}}function tt(e){let{r:t,g:o,b:s}=st(e);t/=255,o/=255,s/=255;const n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*n(t)+.7152*n(o)+.0722*n(s)}function ot(e){let t=e.r.toString(16),o=e.g.toString(16),s=e.b.toString(16),n=Math.round(255*e.a).toString(16);return 1===t.length&&(t="0"+t),1===o.length&&(o="0"+o),1===s.length&&(s="0"+s),1===n.length&&(n="0"+n),"ff"===n&&(n=""),("#"+t+o+s+n).toUpperCase()}function st(e){let t,o,s,n;if(7===(e=Ke(e)).length)t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=255;else{if(9!==e.length)throw new Error("Invalid color");t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=parseInt(e[7]+e[8],16)}return n=+(n/255).toFixed(3),{a:n,r:t,g:o,b:s}}function nt(e){(e={...e}).s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,o=t*(1-Math.abs(e.h/60%2-1)),s=e.l-t/2,n=0,i=0,r=0;return 0<=e.h&&e.h<60?(n=t,i=o,r=0):60<=e.h&&e.h<120?(n=o,i=t,r=0):120<=e.h&&e.h<180?(n=0,i=t,r=o):180<=e.h&&e.h<240?(n=0,i=o,r=t):240<=e.h&&e.h<300?(n=o,i=0,r=t):300<=e.h&&e.h<360&&(n=t,i=0,r=o),n=Math.round(255*(n+s)),i=Math.round(255*(i+s)),r=Math.round(255*(r+s)),{a:e.a,r:n,g:i,b:r}}function it(e){const t=e.r/255,o=e.g/255,s=e.b/255;let n=Math.min(t,o,s),i=Math.max(t,o,s),r=i-n,a=0,l=0,c=0;return a=0===r?0:i===t?(o-s)/r%6:i===o?(s-t)/r+2:(t-o)/r+4,a=Math.round(60*a),a<0&&(a+=360),c=(i+n)/2,l=0===r?0:r/(1-Math.abs(2*c-1)),l=+(100*l).toFixed(1),c=+(100*c).toFixed(1),{a:e.a,h:a,s:l,l:c}}function rt(e){return ot(nt(e))}function at(e){return it(st(e))}function lt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):lt(Math.floor(e/26)-1)+lt(e%26)}const ct={};for(const CA of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const EA=CA.charCodeAt(0)-64;ct[CA]=EA,ct[CA.toLowerCase()]=EA}function ht(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=ct[e[s]]*o,o*=26}return t}function dt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function ut(e){return e>="0"&&e<="9"}function gt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||dt(s))continue;t=o}if(!ut(s)){if("$"===s&&o===t)continue;throw new Error(`Invalid cell description: ${e}`)}}if(!t||t===e.length)throw new Error(`Invalid cell description: ${e}`);const o="$"===e[0]?e.slice(1,t):e.slice(0,t),s="$"===e[t]?e.slice(t+1):e.slice(t);if(o.length<1||o.length>3||s.length<1||s.length>7)throw new Error(`Invalid cell description: ${e}`);const n=ht(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function pt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+lt(e)+(o.rowFixed?"$":"")+String(t+1)}class mt{jsDate;constructor(e,t,o,s=0,n=0,i=0){this.jsDate=new Date(Date.UTC(e,t,o,s,n,i,0))}static fromTimestamp(e){const t=new Date(e);return new mt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new mt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds())}toString(){return this.jsDate.toString()}toLocaleDateString(){return this.jsDate.toLocaleDateString()}getTime(){return this.jsDate.getTime()}getFullYear(){return this.jsDate.getUTCFullYear()}getMonth(){return this.jsDate.getUTCMonth()}getDate(){return this.jsDate.getUTCDate()}getDay(){return this.jsDate.getUTCDay()}getHours(){return this.jsDate.getUTCHours()}getMinutes(){return this.jsDate.getUTCMinutes()}getSeconds(){return this.jsDate.getUTCSeconds()}setFullYear(e){return this.jsDate.setUTCFullYear(e)}setMonth(e){return this.jsDate.setUTCMonth(e)}setDate(e){return this.jsDate.setUTCDate(e)}setHours(e){return this.jsDate.setUTCHours(e)}setMinutes(e){return this.jsDate.setUTCMinutes(e)}setSeconds(e){return this.jsDate.setUTCSeconds(e)}}const ft=new mt(1899,11,30),vt=864e5,bt=2e3,St=mt.now().getFullYear(),Ct=mt.now().getMonth(),Et=mt.fromTimestamp(0).getTime()-ft.getTime(),wt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,yt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,xt=/\/|-|\s/,It=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Rt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Tt(e,t){switch(typeof e){case"number":return e;case"string":return At(e,t)?_t(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function At(e,t){return null!==_t(e,t)}const Ot=new Map;function _t(e,t){return Ot.has(t)||Ot.set(t,new Map),Ot.get(t).has(e)||Ot.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Rt);if(s){if(o=function(e){if(e=e.trim(),Rt.test(e)){const t=/AM/i.test(e),o=/PM/i.test(e),s=(t||o?e.substring(0,e.length-2).trim():e).split(/:/),n=s.length>=2,i=3===s.length;let r=Number(s[0]),a=n?Number(s[1]):0,l=i?Number(s[2]):0,c=i?"hh:mm:ss":"hh:mm";if(t||o)c+=" a";else if(!n)return null;r>=12&&t?r-=12:r<12&&o&&(r+=12),a+=Math.floor(l/60),l%=60,r+=Math.floor(a/60),a%=60,r>=24&&(c="hhhh:mm:ss");return{value:r/24+a/1440+l/86400,format:c,jsDate:new mt(1899,11,30,r,a,l)}}return null}(s[0]),null===o)return null;e=e.replace(s[0],"").trim()}let n=null;const i=function(e,t){const o=e.match(It);if(!o)return null;const[,s,n,,i]=o;if(s.length>2&&i&&i.length>2)return null;if(s.length>2)return{year:s,month:n,day:i,dateString:e,type:"ymd"};const r=function(e){switch(e.dateFormat[0]){case"d":return"dmy";case"m":return"mdy";case"y":return"ymd"}throw new Error("Invalid date format in locale")}(t);if(!i)return n.length>2?{month:s,year:n,day:void 0,dateString:e,type:r}:"dmy"===r?{day:s,month:n,year:i,dateString:e,type:"dmy"}:{month:s,day:n,year:i,dateString:e,type:"mdy"};if(i.length>2)return"mdy"===r?{month:s,day:n,year:i,dateString:e,type:"mdy"}:{day:s,month:n,year:i,dateString:e,type:"dmy"};if("mdy"===r)return{month:s,day:n,year:i,dateString:e,type:"mdy"};if("ymd"===r)return{year:s,month:n,day:i,dateString:e,type:"ymd"};if("dmy"===r)return{day:s,month:n,year:i,dateString:e,type:"dmy"};return null}(e,t);if(i){const t=i.dateString.match(xt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ct;const t=Number(e);if(t>=1&&t<=12)return t-1;return null}(s),r=function(e){if(!e)return 1;const t=Number(e);if(t>=0&&t<=31)return t;return null}(n),a=function(e){if(!e)return St;const t=Number(e);switch(e.length){case 1:return bt+t;case 2:return bt+(bt+t>St+10?-100:0)+t;case 3:case 4:return t}return null}(o);if(null===a||null===i||null===r)return null;const l=2===s?.length&&i+1<10||2===n?.length&&r<10,c=2!==o?.length,h=new mt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-ft.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter(Ie).join(t);case"ymd":return[n,i,r].filter(Ie).join(t);case"dmy":return[r,i,n].filter(Ie).join(t)}}(e,t,l,c);return{value:Math.round(d/vt),format:u,jsDate:h}}(i,t),null===n)return null;e=e.replace(i.dateString,"").trim()}if(""!==e||!n&&!o)return null;if(n&&n.jsDate&&o&&o.jsDate)return{value:n.value+o.value,format:n.format+" "+("hhhh:mm:ss"===o.format?"hh:mm:ss":o.format),jsDate:new mt(n.jsDate.getFullYear()+o.jsDate.getFullYear()-1899,n.jsDate.getMonth()+o.jsDate.getMonth()-11,n.jsDate.getDate()+o.jsDate.getDate()-30,n.jsDate.getHours()+o.jsDate.getHours(),n.jsDate.getMinutes()+o.jsDate.getMinutes(),n.jsDate.getSeconds()+o.jsDate.getSeconds())};return n||o}(e,t)),Ot.get(t).get(e)}function Mt(e){const t=Math.trunc(e);let o=mt.fromTimestamp(t*vt-Et),s=e-t;s=s<0?1+s:s;const n=Math.round(24*s),i=Math.round(24*(s-n/24)*60),r=Math.round(24*(s-n/24-i/24/60)*60*60);return o.setHours(n),o.setMinutes(i),o.setSeconds(r),o}function Nt(e){return Math.round(Ft(e))}function Ft(e){return(e.getTime()-ft.getTime())/vt}function Dt(e){return new mt(e.getFullYear(),e.getMonth()+1,0).getDate()}function Lt(e){return Dt(e)===e.getDate()}function Pt(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new mt(s,n+t,1);return o&&i===Dt(e)||i>Dt(r)?r.setDate(Dt(r)):r.setDate(i),r}function kt(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function Vt(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Mt(e),n=Mt(t);let i=s.getDate(),r=n.getDate();const a=s.getMonth(),l=n.getMonth(),c=s.getFullYear(),h=n.getFullYear();let d=0,u=0;switch(o){case 0:31===i&&(i=30),30===i&&31===r&&(r=30),1===a&&i===(kt(c)?29:28)&&(i=30,1===l&&r===(kt(h)?29:28)&&(r=30)),d=c+(30*a+i)/360,u=h+(30*l+r)/360;break;case 1:let o=365;const s=c===h;if(!s&&!(c+1===h)||!s&&a<l||!s&&a===l&&i<r){let e=0,t=0;for(let o=c;o<=h;o++)e++,t+=kt(o)?366:365;o=t/e}else s?kt(c)&&(o=366):(kt(c)&&a<2&&(o=366),kt(h)&&(l>1||1===l&&29===r)&&(o=366));d=e/o,u=t/o;break;case 2:d=e/360,u=t/360;break;case 3:d=e/365,u=t/365;break;case 4:31===i&&(i=30),31===r&&(r=30),d=c+(30*a+i)/360,u=h+(30*l+r)/360}return u-d}function Ut(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function Bt(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/vt)}function Ht(e,t){const o=t.getFullYear()-e.getFullYear(),s=e.getMonth(),n=t.getMonth(),i=e.getDate(),r=t.getDate();return n>s||n===s&&r>=i?o:o-1}function zt(e,t,o){return t>o?zt(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const Gt=He((function(e){return e=ae(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),Wt=He((function(e){const t=ae(e.decimalSeparator),o="(\\s*"+`(\\d+(${ae(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function $t(e,t){return!!e&&Wt(t).test(e.trim())}const qt=He((function(e){return new RegExp(`[$€${ae(e.thousandsSeparator||"")}]`,"g")}));function Zt(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(qt(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function Yt(e,t,o){const s=[...e].sort(((e,t)=>e-t));let n=(s.length+(o?-1:1))*t;if(o||n--,Number.isInteger(n))return s[n];const i=Math.ceil(n),r=Math.floor(n);return s[i]*(n-r)+s[r]*(i-n)}const jt=e=>e,Xt=()=>!1;let Kt=jt,Qt=Xt;function Jt(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const eo=function(e,...t){return Qt()?Jt(Kt(e),...t):new to(e,t)};class to extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return Qt()?Jt(Kt(e),...this.values):Jt(e,...this.values)}toString(){return this.valueOf()}}var oo,so;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(oo||(oo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(so||(so={}));const no=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),io=new Set(["MOVE_RANGES"]),ro=new Set(["DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),ao=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),lo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE","GROUP_HEADERS","UNGROUP_HEADERS","UNFOLD_HEADER_GROUP","FOLD_HEADER_GROUP","FOLD_ALL_HEADER_GROUPS","UNFOLD_ALL_HEADER_GROUPS","UNFOLD_HEADER_GROUPS_IN_ZONE","FOLD_HEADER_GROUPS_IN_ZONE","ADD_DATA_VALIDATION_RULE","REMOVE_DATA_VALIDATION_RULE","UPDATE_LOCALE"]);function co(e){return lo.has(e.type)}class ho{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return uo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const uo=new ho;var go;e.CommandResult=void 0,(go=e.CommandResult||(e.CommandResult={})).Success="Success",go.CancelledForUnknownReason="CancelledForUnknownReason",go.WillRemoveExistingMerge="WillRemoveExistingMerge",go.MergeIsDestructive="MergeIsDestructive",go.CellIsMerged="CellIsMerged",go.InvalidTarget="InvalidTarget",go.EmptyUndoStack="EmptyUndoStack",go.EmptyRedoStack="EmptyRedoStack",go.NotEnoughElements="NotEnoughElements",go.NotEnoughSheets="NotEnoughSheets",go.MissingSheetName="MissingSheetName",go.UnchangedSheetName="UnchangedSheetName",go.DuplicatedSheetName="DuplicatedSheetName",go.DuplicatedSheetId="DuplicatedSheetId",go.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",go.WrongSheetMove="WrongSheetMove",go.WrongSheetPosition="WrongSheetPosition",go.InvalidAnchorZone="InvalidAnchorZone",go.SelectionOutOfBound="SelectionOutOfBound",go.TargetOutOfSheet="TargetOutOfSheet",go.WrongCutSelection="WrongCutSelection",go.WrongPasteSelection="WrongPasteSelection",go.WrongPasteOption="WrongPasteOption",go.WrongFigurePasteOption="WrongFigurePasteOption",go.EmptyClipboard="EmptyClipboard",go.EmptyRange="EmptyRange",go.InvalidRange="InvalidRange",go.InvalidZones="InvalidZones",go.InvalidSheetId="InvalidSheetId",go.InvalidFigureId="InvalidFigureId",go.InputAlreadyFocused="InputAlreadyFocused",go.MaximumRangesReached="MaximumRangesReached",go.MinimumRangesReached="MinimumRangesReached",go.InvalidChartDefinition="InvalidChartDefinition",go.InvalidDataSet="InvalidDataSet",go.InvalidLabelRange="InvalidLabelRange",go.InvalidScorecardKeyValue="InvalidScorecardKeyValue",go.InvalidScorecardBaseline="InvalidScorecardBaseline",go.InvalidGaugeDataRange="InvalidGaugeDataRange",go.EmptyGaugeRangeMin="EmptyGaugeRangeMin",go.GaugeRangeMinNaN="GaugeRangeMinNaN",go.EmptyGaugeRangeMax="EmptyGaugeRangeMax",go.GaugeRangeMaxNaN="GaugeRangeMaxNaN",go.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",go.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",go.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",go.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",go.InvalidAutofillSelection="InvalidAutofillSelection",go.WrongComposerSelection="WrongComposerSelection",go.MinBiggerThanMax="MinBiggerThanMax",go.LowerBiggerThanUpper="LowerBiggerThanUpper",go.MidBiggerThanMax="MidBiggerThanMax",go.MinBiggerThanMid="MinBiggerThanMid",go.FirstArgMissing="FirstArgMissing",go.SecondArgMissing="SecondArgMissing",go.MinNaN="MinNaN",go.MidNaN="MidNaN",go.MaxNaN="MaxNaN",go.ValueUpperInflectionNaN="ValueUpperInflectionNaN",go.ValueLowerInflectionNaN="ValueLowerInflectionNaN",go.MinInvalidFormula="MinInvalidFormula",go.MidInvalidFormula="MidInvalidFormula",go.MaxInvalidFormula="MaxInvalidFormula",go.ValueUpperInvalidFormula="ValueUpperInvalidFormula",go.ValueLowerInvalidFormula="ValueLowerInvalidFormula",go.InvalidSortZone="InvalidSortZone",go.WaitingSessionConfirmation="WaitingSessionConfirmation",go.MergeOverlap="MergeOverlap",go.TooManyHiddenElements="TooManyHiddenElements",go.Readonly="Readonly",go.InvalidViewportSize="InvalidViewportSize",go.InvalidScrollingDirection="InvalidScrollingDirection",go.FigureDoesNotExist="FigureDoesNotExist",go.InvalidConditionalFormatId="InvalidConditionalFormatId",go.InvalidCellPopover="InvalidCellPopover",go.EmptyTarget="EmptyTarget",go.InvalidFreezeQuantity="InvalidFreezeQuantity",go.FrozenPaneOverlap="FrozenPaneOverlap",go.ValuesNotChanged="ValuesNotChanged",go.InvalidFilterZone="InvalidFilterZone",go.FilterOverlap="FilterOverlap",go.FilterNotFound="FilterNotFound",go.MergeInFilter="MergeInFilter",go.NonContinuousTargets="NonContinuousTargets",go.DuplicatedFigureId="DuplicatedFigureId",go.InvalidSelectionStep="InvalidSelectionStep",go.DuplicatedChartId="DuplicatedChartId",go.ChartDoesNotExist="ChartDoesNotExist",go.InvalidHeaderIndex="InvalidHeaderIndex",go.InvalidQuantity="InvalidQuantity",go.MoreThanOneColumnSelected="MoreThanOneColumnSelected",go.EmptySplitSeparator="EmptySplitSeparator",go.SplitWillOverwriteContent="SplitWillOverwriteContent",go.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",go.NoActiveSheet="NoActiveSheet",go.InvalidLocale="InvalidLocale",go.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",go.MoreThanOneRangeSelected="MoreThanOneRangeSelected",go.NoColumnsProvided="NoColumnsProvided",go.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",go.DuplicatesColumnsSelected="DuplicatesColumnsSelected",go.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",go.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",go.UnknownHeaderGroup="UnknownHeaderGroup",go.UnknownDataValidationRule="UnknownDataValidationRule",go.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",go.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",go.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",go.BlockingValidationRule="BlockingValidationRule",go.InvalidCopyPasteSelection="InvalidCopyPasteSelection",go.NoChanges="NoChanges",go.InvalidInputId="InvalidInputId";const po="@",mo=[{name:"English (US)",code:"en_US",thousandsSeparator:",",decimalSeparator:".",dateFormat:"m/d/yyyy",timeFormat:"hh:mm:ss a",formulaArgSeparator:","},{name:"French",code:"fr_FR",thousandsSeparator:" ",decimalSeparator:",",dateFormat:"dd/mm/yyyy",timeFormat:"hh:mm:ss",formulaArgSeparator:";"}],fo=mo[0],vo=["thin","medium","thick","dashed","dotted"];function bo(e){return Array.isArray(e)&&Array.isArray(e[0])}var So,Co;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(So||(So={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Co||(Co={}));const Eo={NotAvailable:"#N/A",InvalidReference:"#REF",BadExpression:"#BAD_EXPR",CircularDependency:"#CYCLE",UnknownFunction:"#NAME?",GenericError:"#ERROR"},wo=new Set(Object.values(Eo));class yo extends Error{value;constructor(e=eo("Error"),t=Eo.GenericError){super(e),this.value=t}}class xo extends yo{constructor(e=eo("Invalid expression")){super(e,Eo.BadExpression)}}class Io extends yo{constructor(e=eo("Invalid reference")){super(e,Eo.InvalidReference)}}class Ro extends yo{constructor(e=eo("Data not available")){super(e,Eo.NotAvailable)}}class To extends yo{constructor(e=eo("Unknown function")){super(e,Eo.UnknownFunction)}}const Ao=["number","string","boolean","undefined"];function Oo(e,t){if(!e())throw new yo(t)}function _o(e){if(void 0!==e)return bo(e)?e[0][0]?.format:e.format}function Mo(e){return"string"==typeof e&&wo.has(e)}const No=e=>eo("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Fo(e,t){const o=$o(e);switch(typeof o){case"number":return o;case"boolean":return o?1:0;case"string":if($t(o,t)||""===o)return Zt(o,t);const e=_t(o,t);if(e)return e.value;throw new yo(No(o));default:return 0}}function Do(e,t){try{return Fo(e,t)}catch(e){return}}function Lo(e,t){return hs(e).map((e=>e.map((e=>{if("number"!=typeof e.value)throw new yo(eo("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",t,typeof e.value));return e.value}))))}function Po(e,t){const o=$o(e);if(""===o)throw new yo(No(o));return Fo(o,t)}function ko(e,t){return Math.trunc(Fo(e,t))}function Vo(e,t){return Math.trunc(Po(e,t))}function Uo(e){Oo((()=>e>=1),eo("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function Bo(e){const t=$o(e);switch(typeof t){case"string":return t;case"number":return t.toString();case"boolean":return t?"TRUE":"FALSE";default:return""}}const Ho=He((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),zo=e=>eo("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Go(e){const t=$o(e);switch(typeof t){case"boolean":return t;case"string":if(t){let e=t.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1;throw new yo(zo(t))}return!1;case"number":return!!t;default:return!1}}function Wo(e,t){return Mt(Fo($o(e),t))}function $o(e){if("object"==typeof e&&null!==e&&"value"in e){if(Mo(e.value))throw e;return e.value}if(Mo(e))throw new yo("",e);return e}function qo(e,t,o){for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)t(s[o][n])}else o(s)}function Zo(e,t){qo(e,(e=>{if(Mo(e.value))throw e;t(e)}),(e=>{if(Mo(e?.value))throw e;t(e)}))}function Yo(e,t,o){qo(e,(e=>{const o=e?.value;if("number"==typeof o&&t(o),Mo(o))throw e}),(e=>{t(Po(e,o))}))}function jo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;if("rowFirst"===n)for(let n=0;n<o;n++)for(let o=0;o<e;o++)i=t(i,s[o][n]);else for(let n=0;n<e;n++)for(let e=0;e<o;e++)i=t(i,s[n][e])}else i=o(i,s);return i}function Xo(e,t,o,s="rowFirst"){return jo(e,t,t,o,s)}function Ko(e,t,o,s){return jo(e,((e,o)=>{const s=o?.value;if("number"==typeof s)return t(e,s);if(Mo(s))throw o;return e}),((e,o)=>t(e,Po(o,s))),o)}function Qo(e,t,o,s){return jo(e,((e,o)=>{const n=o?.value;if(null!=n){if("number"==typeof n)return t(e,n);if("boolean"==typeof n)return t(e,Fo(n,s));if(Mo(n))throw o;return t(e,0)}return e}),((e,o)=>t(e,Fo(o,s))),o)}function Jo(e,t,o){const s=Array(e);for(let n=0;n<e;n++){s[n]=Array(t);for(let e=0;e<t;e++)s[n][e]=o(n,e)}return s}function es(e,t){return 0===e.length?[]:Jo(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ts(e){return e.length?Jo(e[0].length,e.length,((t,o)=>e[o][t])):[]}function os(e,t){return function(e,t,o){for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)if(!t(s[o][n]??void 0))return}else if(!o(s))return}(e,(e=>{const o=e?.value;if("boolean"==typeof o)return t(o);if("number"==typeof o)return t(!!o);if(Mo(o))throw e;return!0}),(e=>void 0===e||null===e.value||t(function(e){const t=$o(e);if(""===t)throw new yo(zo(t));return Go(t)}(e))))}function ss(e,t,o){let s,n,i=e.substring(0,2);"<="===i||">="===i||"<>"===i?(s=i,n=e.substring(2)):(i=e.substring(0,1),"<"===i||">"===i||"="===i?(s=i,n=e.substring(1)):(s="=",n=e)),$t(n,o)?n=Fo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Go(n));const r={operator:s,operand:n};return"string"==typeof n&&(t&&(n+="*"),r.regexp=function(e){if("*"===e)return/.+/;let t="",o="";for(let s of e)"?"===s&&"~"!==o?t+=".":"*"===s&&"~"!==o?t+=".*":("*"!==s&&"?"!==s||(t=t.slice(0,-1)),["^",".","[","]","$","(",")","*","+","?","|","{","}","\\"].includes(s)&&(t+="\\"),t+=s),o=s;return new RegExp("^"+t+"$","i")}(n)),r}function ns(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return e.toString()===s.toString();if("<>"===o||"="===o){let n;return n=typeof e==typeof s&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===s),"="===o?n:!n}if(typeof e==typeof s)switch(o){case"<":return e<s;case">":return e>s;case"<=":return e<=s;case">=":return e>=s}return!1}function is(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new yo(eo("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=hs(e[0]),r=i.length,a=i[0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=hs(e[t]);if(n.length!==r||n[0].length!==a)throw new yo(eo("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const i=Bo(e[t+1]);l.push(ss(i,s,o))}for(let o=0;o<r;o++)for(let s=0;s<a;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=ns(hs(e[t])[o][s].value??void 0,l[t/2]),!i)break}i&&t(o,s)}}function rs(e,t,o,s,n,i){if(void 0===t||null===t.value)return-1;if(Mo(t.value))throw t;const r=ls(t.value),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=ls(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=ls(i(e,d)),g=typeof u;g===a&&null!=u?("strict"===o&&u===r?(l=u,c=d):"nextSmaller"===o&&u<=r?(null==l||l<u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d),"asc"===s&&u>r||"desc"===s&&u<=r?m=d-1:p=h+1):p=h+1}return void 0!==c?c:-1}function as(e,t,o,s,n,i=!1){if(void 0===t||null===t.value)return-1;if(Mo(t.value))throw t;const r=ls(t.value),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=ls(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&cs(r,n)>=0||cs(r,n)>=0&&cs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&cs(r,n)<=0||cs(r,n)<=0&&cs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function ls(e){return"string"==typeof e?Ho(e):e}function cs(e,t){let o=Ao.indexOf(typeof e)-Ao.indexOf(typeof t);return 0===o&&("string"==typeof e&&"string"==typeof t?o=e.localeCompare(t):"number"==typeof e&&"number"==typeof t?o=e-t:"boolean"==typeof e&&"boolean"==typeof t&&(o=Number(e)-Number(t))),o}function hs(e){return void 0===e?[[]]:bo(e)?e:[[e]]}function ds(e,t){return Xo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function us(e){const t=mt.now();switch(e){case"today":return Ft(t);case"yesterday":return Ft(mt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Ft(mt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Ft(mt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Ft(mt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Ft(mt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function gs(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[us(e.dateValue)]:e.values.map((e=>Tt(e,t)))}function ps(e,t){return e.values.map((e=>Do(e,t)))}function ms(e){return 20+120*Math.exp(-.035*(e-1))}const fs=20,vs=11,bs=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Ss=/0/g,Cs={0:eo("January"),1:eo("February"),2:eo("March"),3:eo("April"),4:eo("May"),5:eo("June"),6:eo("July"),7:eo("August"),8:eo("September"),9:eo("October"),10:eo("November"),11:eo("December")},Es={0:eo("Sunday"),1:eo("Monday"),2:eo("Tuesday"),3:eo("Wednesday"),4:eo("Thursday"),5:eo("Friday"),6:eo("Saturday")},ws={};function ys(e){let t=ws[e];return void 0===t&&(t=function(e){if(""===e)throw new Error("A format cannot be empty");let t=0,o=[];for(;t<e.length;){let s;if("["===e.charAt(t)){if("$"!==e.charAt(t+1))throw new Error(`Currency formats have to be prefixed by a $: ${e}`);if(s=e.substring(t+1).indexOf("]")+t+2,0===s)throw new Error(`Invalid currency brackets format: ${e}`);const n=e.substring(t+2,s-1);if(n.includes("["))throw new Error(`Invalid currency format: ${e}`);o.push({type:"STRING",format:n})}else{const n=e.substring(t).indexOf("[");s=n>-1?n+t:e.length;const i=e.substring(t,s);Ms(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:qs(i)})}t=s}return o}(e),ws[e]=t),t}function xs(e,{format:t,locale:o}){if(t===po)return Bo(e)||"";switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=ks(e));return function(e,t,o){if("DATE"===t[0].type)return Fs(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Is(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,ys(t),o);case"object":return"0"}}function Is(e,t,o){t.isPercent&&(e*=100),e/=t.magnitude;let s=0;void 0!==t.decimalPart&&(s=t.decimalPart.length);const{integerDigits:n,decimalDigits:i}=Ts(e,s);let r=function(e,t,o){const s="0"===e?"":e;let n=s;const i=t.length-s.length;if(i>0){const e=(t.substring(0,i).match(Ss)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(bs)?.join(o)||n);return n}(n,t.integerPart,t.thousandsSeparator?o.thousandsSeparator:void 0);return void 0!==t.decimalPart&&(r+=o.decimalSeparator+function(e,t){let o=e;if(t.length-e.length>0){const s=(t.substring(e.length,t.length+1).match(Ss)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Rs=[];function Ts(e,t=fs){const o=e.toString();if(o.includes("e"))return function(e,t=fs){let o=Rs[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Rs[t]=o);const[s,n]=o.format(e).split(".");return{integerDigits:s,decimalDigits:n}}(e,t);if(Number.isInteger(e))return{integerDigits:o,decimalDigits:void 0};const s=o.indexOf(".");let n=o.substring(0,s),i=o.substring(s+1);if(0===t)return Number(i[0])>=5&&(n=(Number(n)+1).toString()),{integerDigits:n,decimalDigits:void 0};if(i.length>t){const{integerDigits:e,decimalDigits:o}=function(e,t){let o="0",s=e,n=e.slice(0,t);const i=t;if(Number(e[i])<5)return{integerDigits:o,decimalDigits:n};const r=n.match(Os)?.[0]||"",a=(Number(n)+1).toString(),l=n.slice(r.length),c=a.length>l.length;c&&!r?(o="1",s=void 0):s=c?r.slice(0,-1)+a:r+a;return{integerDigits:o,decimalDigits:s}}(i,t);i=o,"0"!==e&&(n=(Number(n)+Number(e)).toString())}return{integerDigits:n,decimalDigits:As(i||"")}}function As(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Os=/^0+/;function _s(e,t){const{integerDigits:o,decimalDigits:s}=Ts(e,20);return s?o+t+s:o}function Ms(e){if(!Ns.has(e[0]))return!1;try{return Fs(1,e),!0}catch(e){return!1}}const Ns=new Set(["h","m","y","d"]);function Fs(e,t){const o=Mt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ds(o,t.substring(0,s-1)),i=Ls(o,t.substring(s))):0===s?i=Ls(o,t):s<0&&(n=Ds(o,t)),n+(n&&i?" ":"")+i}function Ds(e,t){const o=t.match(/\/|-|\s/)?.[0];return(o?t.split(o):[t]).map((o=>{switch(o){case"d":return e.getDate();case"dd":return e.getDate().toString().padStart(2,"0");case"ddd":return Es[e.getDay()].slice(0,3);case"dddd":return Es[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Cs[e.getMonth()].slice(0,3);case"mmmm":return Cs[e.getMonth()];case"mmmmm":return Cs[e.getMonth()].slice(0,1);case"yy":const o=String(e.getFullYear()).replace("-","").padStart(2,"0");return o.slice(o.length-2);case"yyyy":return e.getFullYear();default:throw new Error(`invalid format: ${t}`)}})).join(o)}function Ls(e,t){let o=t.split(/:|\s/);const s=e.getHours(),n="a"===o[o.length-1];let i=s,r="";return n&&(i=0===i?12:i>12?i-12:i,r=s>=12?" PM":" AM",o.pop()),o.map((o=>{switch(o){case"hhhh":return Math.floor((e.getTime()-ft.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const Ps=He((function(e){return new RegExp(`[0-9]+${ae(e.decimalSeparator)}[0-9]`)}));function ks(e){let{integerDigits:t,decimalDigits:o}=Ts(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=Ts(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Vs(e,t){if(!At(e,t))return;return _t(e,t).format}function Us(e){if(!$t(e,fo))return;const t=e.includes(".")?"0.00":"0",o=e.match(/[\$€]/);if(o){const s=e.match(/[\d]/),n="[$"+o.values().next().value+"]";return s.index<o.index?"#,##"+t+n:n+"#,##"+t}return e.includes("%")?t+"%":void 0}function Bs(e){const t=e.decimalPlaces??2,o=e.position??"before",s=e.code??"",n=e.symbol??"",i="#,##0"+(t?"."+"0".repeat(t):"");let r=`${s} ${n}`.trim();return"after"===o&&s&&(r=" "+r),function(e,t,o){const s=`[$${e}]`;return"before"===t?s+o:o+s}(r,o,i)}function Hs(e){return Ys(ys(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function zs(e,t,o,s){const n=ys(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return Ys(i)}function Gs(e,t,o){const s=ys(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=Ys(s);return ws[n]=s,n}function Ws(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),fs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const $s=/,*?$/;function qs(e){if(function(e){return Boolean(e.replace(Zs,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match($s)?.[0]||"",s=o?1e3**o.length:1;let n=e.slice(0,e.length-(o.length||0));const i=n.includes(",");if(/\..*,/.test(n))throw new Error("A format can't contain ',' symbol in the decimal part");n=n.replace("%","").replace(",","");const r=n.match(/[\%|,]/);if(r)throw new Error(`A format can only contain a single '${r[0]}' symbol`);const[a,l]=n.split(".");if(l&&l.length>20)throw new Error("A format can't contain more than 20 decimal places");return void 0!==l?{integerPart:a,isPercent:t,thousandsSeparator:i,decimalPart:l,magnitude:s}:{integerPart:a,isPercent:t,thousandsSeparator:i,magnitude:s}}const Zs=/[,#0.%]/g;function Ys(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const js=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Xs=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Qs=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),Js=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[js.source,/(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*:\s*(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*/i.source,/\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*:\s*\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*/i.source].join("|")+")"+/$/.source,"i");function on(e){return Js.test(e)}function sn(e){return en.test(e)}function nn(e){return Ks.test(e)}function rn(e){return Qs.test(e)}function an(e){return Xs.test(e)}function ln(e){if(!e.includes("!"))return{xc:e};const t=e.split("!"),o=t.pop();return{sheetName:ce(t.join("!"))||void 0,xc:o}}function cn(e,t){return void 0!==e?`${he(e)}!${t}`:t}function hn(e){const t=function(e){e.includes("!")&&(e=e.split("!").at(-1)),e.includes("$")&&(e=e.replaceAll("$",""));let t,o,s,n,i,r="";e.includes(":")?([r,t]=e.split(":"),r=r.trim(),t=t.trim()):r=e.trim();let a=!1,l=!1,c=!1;if(on(r))n=i=ht(r),o=s=0,a=!0;else if(sn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=gt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(on(t))i=ht(t),a=!0;else if(sn(t))s=parseInt(t,10)-1,l=!0;else{const e=gt(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function dn(e){const t=hn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function un(e){const{bottom:t,top:o,left:s,right:n}=e;return!(void 0!==t&&isNaN(t)||isNaN(o)||isNaN(s)||void 0!==n&&isNaN(n))&&(gn(e)&&e.top>=0&&e.left>=0)}function gn(e){return(void 0===e.bottom||e.bottom>=e.top&&e.bottom>=0)&&(void 0===e.right||e.right>=e.left&&e.right>=0)}function pn(e){const{top:t,bottom:o,left:s,right:n}=e,i="hasHeader"in e&&e.hasHeader,r=t===o&&s===n;if(void 0===o&&void 0!==n)return 0!==t||i?`${pt(s,t)}:${lt(n)}`:`${lt(s)}:${lt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${pt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?pt(s,t):`${pt(s,t)}:${pt(n,o)}`;throw new Error(eo("Bad zone format"))}function mn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a=e["left"===t?"right":"bottom"];return e[t]<=r&&a&&a>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function fn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a="left"===t?"right":"bottom";return e[t]<=r&&e[a]>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function vn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];for(let r of o.sort(((e,t)=>t-e)))e[t]>r&&(n--,i--),e[t]<r&&e[s]>=r&&i--;return{...e,[t]:n,[s]:i}}function bn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];const r=e[s];for(let s of o.sort(((e,t)=>t-e)))e[t]>s&&(n--,void 0!==i&&i--),void 0!==r&&void 0!==i&&e[t]<=s&&r>=s&&i--;if(!(void 0!==i&&n>i))return{...e,[t]:n,[s]:i}}function Sn(...e){return{top:Math.min(...e.map((e=>e.top))),left:Math.min(...e.map((e=>e.left))),bottom:Math.max(...e.map((e=>e.bottom))),right:Math.max(...e.map((e=>e.right)))}}function Cn(e,t){if(wn(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:Math.min(e.bottom,t.bottom),right:Math.min(e.right,t.right)}}function En(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function wn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function yn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function xn(e,t){return En(Sn(t,e),t)}function In(e,t){const o=e.map(hn),s=t.map(hn),n=Math.max(...o.concat(s).map((e=>e.bottom||0))),i=Math.max(...o.concat(s).map((e=>e.right||0))),r=o.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),a=s.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),l=function(e,t){const o=new Set(t.map((({col:e,row:t})=>`${e}-${t}`)));return e.filter((({col:e,row:t})=>!o.has(`${e}-${t}`)))}(r.map(On).flat(),a.map(On).flat()),c=function(e){if(0===e.length)return[];const[t,...o]=[...e].sort(((e,t)=>e.row-t.row)).sort(((e,t)=>e.col-t.col)),s=[];let n=Fn(t);for(const{col:e,row:t}of o)if(!yn(e,t,n))if(e===n.left&&t===n.bottom+1){const e=n.bottom+1;n={...n,bottom:e}}else s.push(n),n=Fn({col:e,row:t});return[...s,n]}(l);return function(e){if(0===e.length)return[];if(e.some((e=>e.left!==e.right)))throw new Error("only columns can be merged");const t=[],o=Rn(e),s=(e,t)=>e.top===t.top&&e.bottom===t.bottom&&e.right+1===t.left;for(;o.length;){const e=o.reduce(((e,t)=>s(e,t)?Sn(e,t):e),o.shift());t.push(e)}return Rn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(pn)}function Rn(e){const t=[...e].sort(((e,t)=>t.right-e.right)).sort(((e,t)=>t.bottom-e.bottom)).sort(((e,t)=>e.top-t.top)).sort(((e,t)=>e.left-t.left)).reverse(),o=[];for(;0!==t.length;){const e=t.shift();t.some((t=>xn(e,t)))||o.push(e)}return o.reverse()}function Tn(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function An(e){const{numberOfCols:t,numberOfRows:o}=Tn(e);return 1===t||1===o}function On(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of ue(o,s+1))for(const o of ue(n,i+1))t.push({col:e,row:o});return t}function _n(e,t,o,s){const n="both"===t?s[0]:"columns"===t?s:0,i="both"===t?s[1]:"rows"===t?s:0,r="hasHeader"in e&&e.hasHeader;let a;a=!function(e){return void 0===e.bottom}(e)||r?!(Dn(e)&&!r)||"columns"!==t:"rows"!==t;const l={...e};return a&&"MOVE"===o&&(l.left+=n,l.top+=i),void 0!==l.right&&(l.right+=n),void 0!==l.bottom&&(l.bottom+=i),l}function Mn(e,t){let o,s;const{left:n,right:i,top:r,bottom:a}=e,{left:l,right:c,top:h,bottom:d}=t;return o=l!=n?l:c!=i?c:l,s=h!=r?h:d!=a?d:h,{col:o,row:s}}function Nn(e){return{top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom),left:Math.min(e.left,e.right),right:Math.max(e.left,e.right)}}function Fn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Dn(e){return void 0===e.right}function Ln(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Pn(...e){return e.length<2||1===In(e.map(pn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Ln(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Ln(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(eo("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=sn(e);return{colFixed:!t&&e.startsWith("$"),rowFixed:t?e.startsWith("$"):e.includes("$",1)}})),s=void 0===t.bottom,n=void 0===t.right;return s&&(o[0].rowFixed=o[0].rowFixed||o[1].rowFixed,o[1].rowFixed=o[0].rowFixed||o[1].rowFixed),n&&(o[0].colFixed=o[0].colFixed||o[1].colFixed,o[1].colFixed=o[0].colFixed||o[1].colFixed),o}get isFullCol(){return void 0===this._zone.bottom}get isFullRow(){return void 0===this._zone.right}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(gn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Vn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Un(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Bn(e){const t=[];for(const o of e)for(const e of On(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Hn(e,t,o){const s=[];return t.forEach((t=>{const n=function(e,t){e=e.toLocaleLowerCase();let o=0,s=0,n=(t=t.toLocaleLowerCase()).length,i=0;for(let r=0;r<n;r++)t[r]===e[i]?(i++,s+=100+s-r/200):s=0,o+=s;return i===e.length?o:0}(e,o(t));n>0&&s.push({score:n,elem:t})})),s.sort(((e,t)=>t.score-e.score)),s.map((e=>e.elem))}function zn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Gn(e,t,o){return o.map((o=>o>=e?o+t:o))}function Wn(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter(Ie)}function $n(e,t=1){return t*(e+_)-_}const qn={};function Zn(e,t,o){const s=jn(o);if(qn[s]||(qn[s]={}),void 0===qn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),qn[s][t]=o}return qn[s][t]}function Yn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":U} ${Xn(e)}px ${H}`}function Xn(e){return Yn(e?.fontSize||B)}function Kn(e,t,o,s){if(Zn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Zn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Qn(e,t,o,s){o||(o={});const n=[],i=t.includes(ne)?t.split(ne):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Kn(e,t,s,o),l=i.pop(),c=Zn(e,l,o);if(i.length)""!==r&&(n.push(r),r="",a=s),i.forEach((e=>{n.push(e)})),r=l,a=s-c;else{const t=""===r?l:" "+l,i=Zn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function Jn(e){return e?e.toLowerCase():""}const ei=/([0-9\.]*)px/;function ti(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ei)?.[1])}(e.font)/10){if(e.fillText(t,o.x,o.y),!s&&!n)return;const r=e.measureText(t),a=r.width,l=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent,c=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;let{x:h,y:d}=o,u=d,g=d;switch(e.textAlign){case"center":h-=a/2;break;case"right":h-=a}switch(e.textBaseline){case"top":g+=c-2*i,u+=c/2-i;break;case"middle":g+=c/2-i;break;case"alphabetic":g+=2*i,u-=3*i;break;case"bottom":g=d,u-=l/2-i/2}s&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,g),e.lineTo(h+a,g),e.stroke()),n&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,u),e.lineTo(h+a,u),e.stroke())}class oi{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function si(e){return e.map(ii).sort(((e,t)=>e.sequence-t.sequence))}const ni=new oi;function ii(e){const t=e.name,o=e.children,s=e.description,n=e.icon,i=e.secondaryIcon;return{id:e.id||ni.uuidv4(),name:"function"==typeof t?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:e.isEnabled?e.isEnabled:()=>!0,isActive:e.isActive,execute:e.execute,children:o?e=>o.map((t=>"function"==typeof t?t(e):t)).flat().map(ii):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:"function"==typeof n?n:()=>n||"",secondaryIcon:"function"==typeof i?i:()=>i||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?bn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?mn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function ai(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ri(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class li extends t.Component{static template="o-spreadsheet-ChartJsComponent";static props={figure:Object};canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(le(e.chartJsConfig))})),t.onWillUnmount((()=>this.chart?.destroy())),t.useEffect((()=>this.updateChartJs(le(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}class ci{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=gi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=gi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===Eo.InvalidReference?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=gi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter(Ie),labelRange:r}}function di(e,t,o){return o.map((o=>({dataRange:Vn(e,t,o.dataRange),labelCell:o.labelCell?Vn(e,t,o.labelCell):void 0})))}function ui(e,t,o){return o?Vn(e,t,o):void 0}function gi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function pi(e,t,o,s){const n=[];for(const i of t){const t=e.getRangeFromSheetXC(o,i),{unboundedZone:r,sheetId:a,invalidSheetName:l,invalidXc:c}=t;if(!l&&!c)if(r.left!==r.right&&r.top!==r.bottom){if(void 0===r.right)continue;for(let t=r.left;t<=r.right;t++){const o={...r,left:t,right:t};n.push(mi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(mi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function mi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${pn(o)}`);if(s){const n=pn(o),i=pn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,pn(o))}}function fi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=Tn(s);1===e?s={...s,left:s.left+1}:1===t&&(s={...s,top:s.top+1})}const n=t.dataRange.clone({zone:s});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference",{useFixedReference:!0}):void 0,range:e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}}function vi(e,t,o){if(!t)return;let s={...t.zone};o&&t.zone.bottom>t.zone.top&&(s.top=s.top+1);const n=t.clone({zone:s});return e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}function bi(e,t){let o;if(e.labelRange){const s=ri(hn(e.labelRange),t);o=s?pn(s):void 0}const s=e.dataSets.map(hn).map((e=>ri(e,t))).filter(Ie).map(pn);return{...e,labelRange:o,dataSets:s}}const Si=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ci{graphColorIndex=0;next(){return Si[this.graphColorIndex++%Si.length]}}function Ei(e){return e&&tt(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!tn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(hn).some((e=>e.top!==e.bottom&&Dn(e))))return"InvalidDataSet"}return"Success"}function yi(e){if(e.labelRange){if(!tn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function xi(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Ln(t.dataRange.zone);return!(Ln(e.zone)<s)}function Ii(e,t,o,s){if(e){if("text"===o||t?.type!==oo.number||e.type!==oo.number)return e.formattedValue;{let n=t.value-e.value;if("percentage"===o&&0!==n&&(n=n/e.value*100),"percentage"!==o&&e.format)return xs(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ri(e,t,o,s,n){if("text"===t||e?.type!==oo.number||o?.type!==oo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ti(e,t,o){if("text"===o||e?.type!==oo.number||t?.type!==oo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!tn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!tn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const _i=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Mi=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ni=class e extends ci{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Un(o,t,e.keyValue),this.baseline=Un(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,Ai,Oi)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:j,baselineColorUp:X,baselineColorDown:K,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ri(hn(e.baseline),t)),e.keyValue&&(s=ri(hn(e.keyValue),t)),{...e,baseline:o?pn(o):void 0,keyValue:s?pn(s):void 0}}copyForSheetId(t){const o=ui(this.sheetId,t,this.baseline),s=ui(this.sheetId,t,this.keyValue),n=this.getDefinitionWithSpecificRanges(o,s,t);return new e(n,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(t){const o=gi(this.baseline,t),s=gi(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const n=this.getDefinitionWithSpecificRanges(o,s);return new e(n,this.sheetId,this.getters)}};function Fi(e,t){const o=t.getContext("2d");if(t.width=e.canvas.width,t.height=e.canvas.height,o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title&&(o.font=e.title.style.font,o.fillStyle=e.title.style.color,o.fillText(e.title.text,e.title.position.x,e.title.position.y)),e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,ti(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(_i);break;case"up":o.fill(Mi)}o.restore()}e.baselineDescr&&(o.font=e.baselineDescr.style.font,o.fillStyle=e.baselineDescr.style.color,o.fillText(e.baselineDescr.text,e.baselineDescr.position.x,e.baselineDescr.position.y)),e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,ti(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Di(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${H}`}function Li({width:e,height:t},o){return new Pi({width:e,height:t},o).computeDesign()}class Pi{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),{height:o}=this.getTextDimensions(this.title,t.title.font);this.title&&(e.title={text:this.title,style:t.title,position:{x:this.chartPadding,y:this.chartPadding+o}});const s=t.baselineArrow?.size??0,{height:n,width:i}=this.getTextDimensions(this.baseline,t.baselineValue.font),{width:r}=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font);e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-i-r+s)/2,y:this.keyValue?this.height-2*this.chartPadding:this.height-(this.height-o-n)/2-this.chartPadding}},t.baselineArrow&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(n+s)/2}}),this.baselineDescr&&(e.baselineDescr={text:this.baselineDescr,style:t.baselineDescr,position:{x:e.baseline.position.x+i,y:e.baseline.position.y}});const{height:a,width:l}=this.getTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:(this.width-l)/2,y:(this.height-n+o+a)/2-this.chartPadding}}),e}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return tt(this.backgroundColor)>.3?"#525252":"#C8C8C8"}get chartPadding(){return.02*this.width}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getTextStyles(){const e=.96*this.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let s=function(e,t,o,s=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let i=(n+t)/2,r=o(i),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(n+t)/2:n=(n+t)/2,i=(n+t)/2,r=o(i),a++;return i}(e,o,(e=>t.getElementWidth(e,this.context,this)))/o;const n=new Ui(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Vi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Di(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Di(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Di(i,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Di(.9*i),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow?void 0:{size:this.keyValue?.8*i:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}getDrawableHeight(){const e=2*this.chartPadding;let t=this.height-e;return t-=this.title?18*1.2:0,t}getWidestElement(){const e=new Vi(this.runtime.baselineStyle),t=new Ui(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Di(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Vi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Bi extends t.Component{static template="o-spreadsheet-ScorecardChart";static props={figure:Object};canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el]}))}createChart(){const e=this.canvas.el;Fi(Li(e.getBoundingClientRect(),this.runtime),e)}}class Hi{content={};add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}function zi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const Gi=new Hi;function Wi(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>we(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=xe(e);return t.tryGetSheetName(o)||eo("Invalid sheet")},open(e,t){const o=xe(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const $i={createLink:Wi,match:e=>be(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function qi(e){return Gi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||$i}function Zi(e,t){return qi(e.url).urlRepresentation(e.url,t)}function Yi(e,t){qi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(ve(e)){const{label:t,url:o}=Ce(e);return qi(o).createLink(o,t)}return be(e)?Wi(e):void 0}}function Xi(e,t){return t.format===po?er(e||"",t):Qi(Ki(e||"",t.locale),t)}function Ki(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return $t(e,fo)?Fo(e,fo):At(e,t)?Fo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t,o){const s=ji(e);return s?{...Ji(Ki(s.label,t.locale),{format:t.format||Vs(s.label,t.locale)||Us(s.label),locale:t.locale},o),link:s}:Ji(e,t,o)}function Ji(e,t,o){return Mo(e)?function(e,t){return{type:oo.error,value:e,message:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:e}}(e,o):t.format===po?er(Bo(e),t):""===e?function(e){if(void 0===e.format)return or;return{type:oo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t):"number"==typeof e?Ms(t.format||"")?function(e,t){const o=xs(e,t);return{type:oo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t):tr(e,t):null===e?tr(0,t):"boolean"==typeof e?function(e,t){const o=e?"TRUE":"FALSE";return{type:oo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t):er((e||"").toString(),t)}function er(e,t){return{type:oo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:xs(e,t)}}function tr(e,t){return{type:oo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:xs(e,t)}}const or={type:oo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};const sr=new Hi;sr.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${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:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),n=o.getLocale(),i=xs(e.current,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:i}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",n={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:Xi(t.cell?.content,n).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let n=0,i=0;switch(s){case"up":n=0,i=-e.current;break;case"down":n=0,i=e.current;break;case"left":n=-e.current,i=0;break;case"right":n=e.current,i=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,n,i,r.compiledFormula);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const nr=new Hi,ir=/(\d+)$/,rr=/^(.*\D+)/,ar=/^(.*\D+)(\d+)$/;function lr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Xi(i?.content,{locale:fo});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function cr(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const n=e[s];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}nr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ms(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.text&&ar.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(ir)[0]),s=e.content.match(rr)[0],n=e.content.length-s.length,i=lr(e,t,(e=>e.type===oo.text&&ar.test(e.value))).filter((e=>s===e.value.toString().match(rr)[0])).map((e=>parseInt(e.value.toString().match(ir)[0]))),r=cr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.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_number",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.number,generateRule:(e,t)=>{const o=cr(lr(e,t,(e=>e.type===oo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:fo});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===oo.number?s.value:0}},sequence:40});const hr={};let dr=0;function ur(e,...t){const o="__sheet__"+dr++;return function(e,t){const o=document.createElement("style");o.textContent=function(e){const t=e.split(/(\{|\}|;)/).map((e=>e.trim())),o=[],s=[];let n=[];function i(e,t){const s=[];for(const n of o[e]){let r=t&&t+" "+n||n;r.includes("&")&&(r=n.replace(/&/g,t||"")),e<o.length-1&&(r=i(e+1,r)),s.push(r)}return s.join(", ")}function r(){n.length&&(s.push(i(0)+" {"),s.push(...n),s.push("}"),n=[])}for(;t.length;){let e=t.shift();"}"===e?(r(),o.pop()):("{"===t[0]&&(r(),o.push(e.split(/\s*,\s*/)),t.shift()),";"===t[0]&&n.push(" "+e+";"))}return s.join("\n")}(t),hr[e]=o}(o,String.raw(e,...t)),function(e){const t=hr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function gr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function pr(e){const t=function(e){const t={};if(!e)return t;e.bold&&(t["font-weight"]="bold");e.italic&&(t["font-style"]="italic");if(e.strikethrough||e.underline){let o=e.strikethrough?"line-through":"";o=e.underline?o+" underline":o,t["text-decoration"]=o}e.textColor&&(t.color=e.textColor);return t}(e);return e?(e.fillColor&&(t.background=e.fillColor),t):t}function mr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}ur`
1
+ !function(e,t){"use strict";const o=.5,s="#f5f5f5",n="#F8F9FA",i="#E8EAED",r="#595959",a="#666666",l="#c9ccd2",c="#3266ca",h="#FFFFFF",d="#EBEBEB",u="#CACACA",g=11982760,p="#01666b",m="#188038",f="#E6F4EA",v="#CEEAD6",b="#E0E2E4",S="#4A4F59",C="#999",E="#E2E3E3",w="#BCBCBC",y="#9B359B",x=["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF","#980000","#FF0000","#FF9900","#FFFF00","#00FF00","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF","#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#741B47","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"],I=26,R=48,T=96,A=23,O=15,_=4,M=_,N=21,F=17,D=2*A,L=250,P={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},k=P.verticalAlign,V=P.wrapping,U="400",B=P.fontSize,H="'Roboto', arial",z="thin",G="#000000",W={style:"thin",color:m},$="START_REVISION",q=1,Z=20,Y="??",j="difference",X="#00A04A",K="#DC6965",Q=["'","*","?","/","\\","[","]"],J=/'|\*|\?|\/|\\|\[|\]/,ee="|";var te;!function(e){e[e.Grid=0]="Grid",e[e.Highlight=5]="Highlight",e[e.HeaderGroupingButton=6]="HeaderGroupingButton",e[e.Figure=10]="Figure",e[e.ScrollBar=15]="ScrollBar",e[e.GridPopover=19]="GridPopover",e[e.GridComposer=20]="GridComposer",e[e.Dropdown=21]="Dropdown",e[e.IconPicker=25]="IconPicker",e[e.TopBarComposer=30]="TopBarComposer",e[e.Popover=35]="Popover",e[e.FigureAnchor=1e3]="FigureAnchor",e[e.FigureSnapLine=1001]="FigureSnapLine"}(te||(te={}));let oe=0;function se(){return oe}const ne="\n",ie=[6,7,8,9,10,11,12,14,18,24,36];function re(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function le(e){const t=Array.isArray(e)?[]:{};switch(typeof e){case"object":if(null===e)return e;if(function(e){return"clone"in e&&e.clone instanceof Function}(e))return e.clone();if(!(function(e){return"object"==typeof e&&null!==e&&(e?.constructor===Object||void 0===e?.constructor)}(e)||e instanceof Array))throw new Error("Unsupported type: only objects and arrays are supported");for(const o in e)t[o]=le(e[o]);return t;case"number":case"string":case"boolean":case"function":case"undefined":return e;default:throw new Error("Unsupported type: "+typeof e)}}function ce(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function he(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function de(e,t,o){return e<t?t:e>o?o:e}function ue(e,t,o=1){if(t<=e&&o>0)return[];if(0===o)throw new Error("range() step must not be zero");const s=Math.ceil(Math.abs((t-e)/o)),n=Array(s);for(let t=0;t<s;t++)n[t]=e+t*o;return n}function ge(e){return e.reduce(((e,t,o,s)=>{if(1===Math.abs(t-s[o-1])){e[e.length-1].push(t)}else e.push([t]);return e}),[])}function*pe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const me=/^\[(.+)\]\((.+)\)$/,fe=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function ve(e){return me.test(e)}function be(e){return fe.test(e)}function Se(e,t){return`[${e}](${t})`}function Ce(e){const t=e.match(me)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Ee="o-spreadsheet://";function we(e){return e.startsWith(Ee)}function ye(e){return`${Ee}${e}`}function xe(e){if(e.startsWith(Ee))return e.substr(Ee.length);throw new Error(`${e} is not a valid sheet link`)}function Ie(e){return void 0!==e}function Re(e){return null!==e}function Te(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?Te(e):!e))}function Ae(e,t){for(const o in t)if(Fe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:$e(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Oe(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function _e(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>_e((()=>e(s()))),s}function Me(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ne(e,t){return"after"===e?t+1:t}function Fe(e,t){if(e===t)return!0;if(e&&!t||t&&!e)return!1;if(typeof e!=typeof t)return!1;if("object"!=typeof e)return!1;for(const o in t)if(!(o in e)&&void 0!==t[o])return!1;for(const o in e){if(typeof e[o]!=typeof t[o])return!1;if("object"==typeof e[o]){if(!Fe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function De(e,t){return t.every((t=>e.includes(t)))}function Le(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const Pe=["\t","\f","\v",String.fromCharCode(parseInt("00a0",16)),String.fromCharCode(parseInt("1680",16)),String.fromCharCode(parseInt("2000",16)),String.fromCharCode(parseInt("200a",16)),String.fromCharCode(parseInt("2028",16)),String.fromCharCode(parseInt("2029",16)),String.fromCharCode(parseInt("202f",16)),String.fromCharCode(parseInt("205f",16)),String.fromCharCode(parseInt("3000",16)),String.fromCharCode(parseInt("feff",16))],ke=new RegExp(Pe.join("|")+"|(\r\n|\r|\n)","g");function Ve(e){return e?ke.test(e)?e.replace(ke,((e,t)=>t?ne:" ")):e:""}function Ue(e){const t=Array.from(e).sort(((e,t)=>e-t));for(let e=1;e<t.length;e++)if(t[e]-t[e-1]!=1)return!1;return!0}class Be extends Set{addMany(e){for(const t of e)super.add(t);return this}deleteMany(e){for(const t of e)super.delete(t)}}function He(e){const t=new Map,o=e.name?e.name+" (memoized)":"memoized";return{[o]:(...o)=>(t.has(o[0])||t.set(o[0],e(...o)),t.get(o[0]))}[o]}function ze(e,t){return e.filter(((e,o)=>!t.includes(o)))}function Ge(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function We(e,t,o){return t>o?We(e,o,t):e>=t&&e<=o}function $e(e){let t=e.length;if(t<1e5)return Math.max(...e);let o=-1/0;for(;t--;)o=e[t]>o?e[t]:o;return o}function qe(e){let t=e.length;if(t<1e5)return Math.min(...e);let o=1/0;for(;t--;)o=e[t]<o?e[t]:o;return o}const Ze=/rgba?\(|\s+|\)/gi,Ye=/^#([A-F\d]{2}){3,4}$/,je=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function Xe(e){return Ke(e.toString(16).padStart(6,"0"))}function Ke(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(Ze,"").split(",");let o=255;if(3!==t.length&&4!==t.length)throw new Error("invalid color");if(4===t.length){const e=parseFloat(t.pop()||"1");o=Math.round(255*(e||1))}const s=t.map((e=>parseInt(e,10)));255!==o&&s.push(o);return"#"+Oe(s.map((e=>e.toString(16).padStart(2,"0")))).toUpperCase()}(e):(t=e.replace("#","").toUpperCase(),3!==t.length&&4!==t.length||(t=t.split("").reduce(((e,t)=>e+t+t),"")),t=`#${t}`),!Ye.test(t))throw new Error(`invalid color input: ${e}`);return t}function Qe(e){try{return Ke(e),!0}catch(e){return!1}}const Je=e=>e>=0&&e<=255;function et(e,t,o,s=1){if(!Je(e)||!Je(t)||!Je(o)||s<0||s>1)throw new Error(`Invalid RGBA values ${[e,t,o,s]}`);return{a:s,b:o,g:t,r:e}}function tt(e){let{r:t,g:o,b:s}=st(e);t/=255,o/=255,s/=255;const n=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return.2126*n(t)+.7152*n(o)+.0722*n(s)}function ot(e){let t=e.r.toString(16),o=e.g.toString(16),s=e.b.toString(16),n=Math.round(255*e.a).toString(16);return 1===t.length&&(t="0"+t),1===o.length&&(o="0"+o),1===s.length&&(s="0"+s),1===n.length&&(n="0"+n),"ff"===n&&(n=""),("#"+t+o+s+n).toUpperCase()}function st(e){let t,o,s,n;if(7===(e=Ke(e)).length)t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=255;else{if(9!==e.length)throw new Error("Invalid color");t=parseInt(e[1]+e[2],16),o=parseInt(e[3]+e[4],16),s=parseInt(e[5]+e[6],16),n=parseInt(e[7]+e[8],16)}return n=+(n/255).toFixed(3),{a:n,r:t,g:o,b:s}}function nt(e){(e={...e}).s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,o=t*(1-Math.abs(e.h/60%2-1)),s=e.l-t/2,n=0,i=0,r=0;return 0<=e.h&&e.h<60?(n=t,i=o,r=0):60<=e.h&&e.h<120?(n=o,i=t,r=0):120<=e.h&&e.h<180?(n=0,i=t,r=o):180<=e.h&&e.h<240?(n=0,i=o,r=t):240<=e.h&&e.h<300?(n=o,i=0,r=t):300<=e.h&&e.h<360&&(n=t,i=0,r=o),n=Math.round(255*(n+s)),i=Math.round(255*(i+s)),r=Math.round(255*(r+s)),{a:e.a,r:n,g:i,b:r}}function it(e){const t=e.r/255,o=e.g/255,s=e.b/255;let n=Math.min(t,o,s),i=Math.max(t,o,s),r=i-n,a=0,l=0,c=0;return a=0===r?0:i===t?(o-s)/r%6:i===o?(s-t)/r+2:(t-o)/r+4,a=Math.round(60*a),a<0&&(a+=360),c=(i+n)/2,l=0===r?0:r/(1-Math.abs(2*c-1)),l=+(100*l).toFixed(1),c=+(100*c).toFixed(1),{a:e.a,h:a,s:l,l:c}}function rt(e){return ot(nt(e))}function at(e){return it(st(e))}function lt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):lt(Math.floor(e/26)-1)+lt(e%26)}const ct={};for(const CA of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const EA=CA.charCodeAt(0)-64;ct[CA]=EA,ct[CA.toLowerCase()]=EA}function ht(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=ct[e[s]]*o,o*=26}return t}function dt(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function ut(e){return e>="0"&&e<="9"}function gt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||dt(s))continue;t=o}if(!ut(s)){if("$"===s&&o===t)continue;throw new Error(`Invalid cell description: ${e}`)}}if(!t||t===e.length)throw new Error(`Invalid cell description: ${e}`);const o="$"===e[0]?e.slice(1,t):e.slice(0,t),s="$"===e[t]?e.slice(t+1):e.slice(t);if(o.length<1||o.length>3||s.length<1||s.length>7)throw new Error(`Invalid cell description: ${e}`);const n=ht(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function pt(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+lt(e)+(o.rowFixed?"$":"")+String(t+1)}class mt{jsDate;constructor(e,t,o,s=0,n=0,i=0){this.jsDate=new Date(Date.UTC(e,t,o,s,n,i,0))}static fromTimestamp(e){const t=new Date(e);return new mt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new mt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds())}toString(){return this.jsDate.toString()}toLocaleDateString(){return this.jsDate.toLocaleDateString()}getTime(){return this.jsDate.getTime()}getFullYear(){return this.jsDate.getUTCFullYear()}getMonth(){return this.jsDate.getUTCMonth()}getDate(){return this.jsDate.getUTCDate()}getDay(){return this.jsDate.getUTCDay()}getHours(){return this.jsDate.getUTCHours()}getMinutes(){return this.jsDate.getUTCMinutes()}getSeconds(){return this.jsDate.getUTCSeconds()}setFullYear(e){return this.jsDate.setUTCFullYear(e)}setMonth(e){return this.jsDate.setUTCMonth(e)}setDate(e){return this.jsDate.setUTCDate(e)}setHours(e){return this.jsDate.setUTCHours(e)}setMinutes(e){return this.jsDate.setUTCMinutes(e)}setSeconds(e){return this.jsDate.setUTCSeconds(e)}}const ft=new mt(1899,11,30),vt=864e5,bt=2e3,St=mt.now().getFullYear(),Ct=mt.now().getMonth(),Et=mt.fromTimestamp(0).getTime()-ft.getTime(),wt=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,yt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,xt=/\/|-|\s/,It=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Rt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Tt(e,t){switch(typeof e){case"number":return e;case"string":return At(e,t)?_t(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function At(e,t){return null!==_t(e,t)}const Ot=new Map;function _t(e,t){return Ot.has(t)||Ot.set(t,new Map),Ot.get(t).has(e)||Ot.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Rt);if(s){if(o=function(e){if(e=e.trim(),Rt.test(e)){const t=/AM/i.test(e),o=/PM/i.test(e),s=(t||o?e.substring(0,e.length-2).trim():e).split(/:/),n=s.length>=2,i=3===s.length;let r=Number(s[0]),a=n?Number(s[1]):0,l=i?Number(s[2]):0,c=i?"hh:mm:ss":"hh:mm";if(t||o)c+=" a";else if(!n)return null;r>=12&&t?r-=12:r<12&&o&&(r+=12),a+=Math.floor(l/60),l%=60,r+=Math.floor(a/60),a%=60,r>=24&&(c="hhhh:mm:ss");return{value:r/24+a/1440+l/86400,format:c,jsDate:new mt(1899,11,30,r,a,l)}}return null}(s[0]),null===o)return null;e=e.replace(s[0],"").trim()}let n=null;const i=function(e,t){const o=e.match(It);if(!o)return null;const[,s,n,,i]=o;if(s.length>2&&i&&i.length>2)return null;if(s.length>2)return{year:s,month:n,day:i,dateString:e,type:"ymd"};const r=function(e){switch(e.dateFormat[0]){case"d":return"dmy";case"m":return"mdy";case"y":return"ymd"}throw new Error("Invalid date format in locale")}(t);if(!i)return n.length>2?{month:s,year:n,day:void 0,dateString:e,type:r}:"dmy"===r?{day:s,month:n,year:i,dateString:e,type:"dmy"}:{month:s,day:n,year:i,dateString:e,type:"mdy"};if(i.length>2)return"mdy"===r?{month:s,day:n,year:i,dateString:e,type:"mdy"}:{day:s,month:n,year:i,dateString:e,type:"dmy"};if("mdy"===r)return{month:s,day:n,year:i,dateString:e,type:"mdy"};if("ymd"===r)return{year:s,month:n,day:i,dateString:e,type:"ymd"};if("dmy"===r)return{day:s,month:n,year:i,dateString:e,type:"dmy"};return null}(e,t);if(i){const t=i.dateString.match(xt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ct;const t=Number(e);if(t>=1&&t<=12)return t-1;return null}(s),r=function(e){if(!e)return 1;const t=Number(e);if(t>=0&&t<=31)return t;return null}(n),a=function(e){if(!e)return St;const t=Number(e);switch(e.length){case 1:return bt+t;case 2:return bt+(bt+t>St+10?-100:0)+t;case 3:case 4:return t}return null}(o);if(null===a||null===i||null===r)return null;const l=2===s?.length&&i+1<10||2===n?.length&&r<10,c=2!==o?.length,h=new mt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-ft.getTime(),u=function(e,t,o,s){const n=e.year?s?"yyyy":"yy":void 0,i=e.month?o?"mm":"m":void 0,r=e.day?o?"dd":"d":void 0;switch(e.type){case"mdy":return[i,r,n].filter(Ie).join(t);case"ymd":return[n,i,r].filter(Ie).join(t);case"dmy":return[r,i,n].filter(Ie).join(t)}}(e,t,l,c);return{value:Math.round(d/vt),format:u,jsDate:h}}(i,t),null===n)return null;e=e.replace(i.dateString,"").trim()}if(""!==e||!n&&!o)return null;if(n&&n.jsDate&&o&&o.jsDate)return{value:n.value+o.value,format:n.format+" "+("hhhh:mm:ss"===o.format?"hh:mm:ss":o.format),jsDate:new mt(n.jsDate.getFullYear()+o.jsDate.getFullYear()-1899,n.jsDate.getMonth()+o.jsDate.getMonth()-11,n.jsDate.getDate()+o.jsDate.getDate()-30,n.jsDate.getHours()+o.jsDate.getHours(),n.jsDate.getMinutes()+o.jsDate.getMinutes(),n.jsDate.getSeconds()+o.jsDate.getSeconds())};return n||o}(e,t)),Ot.get(t).get(e)}function Mt(e){const t=Math.trunc(e);let o=mt.fromTimestamp(t*vt-Et),s=e-t;s=s<0?1+s:s;const n=Math.round(24*s),i=Math.round(24*(s-n/24)*60),r=Math.round(24*(s-n/24-i/24/60)*60*60);return o.setHours(n),o.setMinutes(i),o.setSeconds(r),o}function Nt(e){return Math.round(Ft(e))}function Ft(e){return(e.getTime()-ft.getTime())/vt}function Dt(e){return new mt(e.getFullYear(),e.getMonth()+1,0).getDate()}function Lt(e){return Dt(e)===e.getDate()}function Pt(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new mt(s,n+t,1);return o&&i===Dt(e)||i>Dt(r)?r.setDate(Dt(r)):r.setDate(i),r}function kt(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function Vt(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Mt(e),n=Mt(t);let i=s.getDate(),r=n.getDate();const a=s.getMonth(),l=n.getMonth(),c=s.getFullYear(),h=n.getFullYear();let d=0,u=0;switch(o){case 0:31===i&&(i=30),30===i&&31===r&&(r=30),1===a&&i===(kt(c)?29:28)&&(i=30,1===l&&r===(kt(h)?29:28)&&(r=30)),d=c+(30*a+i)/360,u=h+(30*l+r)/360;break;case 1:let o=365;const s=c===h;if(!s&&!(c+1===h)||!s&&a<l||!s&&a===l&&i<r){let e=0,t=0;for(let o=c;o<=h;o++)e++,t+=kt(o)?366:365;o=t/e}else s?kt(c)&&(o=366):(kt(c)&&a<2&&(o=366),kt(h)&&(l>1||1===l&&29===r)&&(o=366));d=e/o,u=t/o;break;case 2:d=e/360,u=t/360;break;case 3:d=e/365,u=t/365;break;case 4:31===i&&(i=30),31===r&&(r=30),d=c+(30*a+i)/360,u=h+(30*l+r)/360}return u-d}function Ut(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function Bt(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/vt)}function Ht(e,t){const o=t.getFullYear()-e.getFullYear(),s=e.getMonth(),n=t.getMonth(),i=e.getDate(),r=t.getDate();return n>s||n===s&&r>=i?o:o-1}function zt(e,t,o){return t>o?zt(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const Gt=He((function(e){return e=ae(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),Wt=He((function(e){const t=ae(e.decimalSeparator),o="(\\s*"+`(\\d+(${ae(e.thousandsSeparator||"")}\\d{3,})*(${t}\\d*)?)`+"|"+`(${t}\\d+)`+")(e(\\+|-)?\\d+)?(\\s*%)?",s="(\\s*-)?",n="(\\s*[\\$€])?",i="^(("+[s+n+o,s+o+n,n+s+o].join(")|(")+"))$";return new RegExp(i,"i")}));function $t(e,t){return!!e&&Wt(t).test(e.trim())}const qt=He((function(e){return new RegExp(`[$€${ae(e.thousandsSeparator||"")}]`,"g")}));function Zt(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(qt(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function Yt(e,t,o){const s=[...e].sort(((e,t)=>e-t));let n=(s.length+(o?-1:1))*t;if(o||n--,Number.isInteger(n))return s[n];const i=Math.ceil(n),r=Math.floor(n);return s[i]*(n-r)+s[r]*(i-n)}const jt=e=>e,Xt=()=>!1;let Kt=jt,Qt=Xt;function Jt(e,...t){if(1!==t.length||"object"!=typeof t[0]||t[0]instanceof String)t.length>0&&(e=e.replace(/\%s/g,(()=>t.shift())));else{const o=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,((e,t)=>o[t]))}return e}const eo=function(e,...t){return Qt()?Jt(Kt(e),...t):new to(e,t)};class to extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return Qt()?Jt(Kt(e),...this.values):Jt(e,...this.values)}toString(){return this.valueOf()}}var oo,so;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(oo||(oo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(so||(so={}));const no=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),io=new Set(["MOVE_RANGES"]),ro=new Set(["DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),ao=new Set(["START","ACTIVATE_SHEET","COPY","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),lo=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","SET_ZONE_BORDERS","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE","GROUP_HEADERS","UNGROUP_HEADERS","UNFOLD_HEADER_GROUP","FOLD_HEADER_GROUP","FOLD_ALL_HEADER_GROUPS","UNFOLD_ALL_HEADER_GROUPS","UNFOLD_HEADER_GROUPS_IN_ZONE","FOLD_HEADER_GROUPS_IN_ZONE","ADD_DATA_VALIDATION_RULE","REMOVE_DATA_VALIDATION_RULE","UPDATE_LOCALE"]);function co(e){return lo.has(e.type)}class ho{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return uo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const uo=new ho;var go;e.CommandResult=void 0,(go=e.CommandResult||(e.CommandResult={})).Success="Success",go.CancelledForUnknownReason="CancelledForUnknownReason",go.WillRemoveExistingMerge="WillRemoveExistingMerge",go.MergeIsDestructive="MergeIsDestructive",go.CellIsMerged="CellIsMerged",go.InvalidTarget="InvalidTarget",go.EmptyUndoStack="EmptyUndoStack",go.EmptyRedoStack="EmptyRedoStack",go.NotEnoughElements="NotEnoughElements",go.NotEnoughSheets="NotEnoughSheets",go.MissingSheetName="MissingSheetName",go.UnchangedSheetName="UnchangedSheetName",go.DuplicatedSheetName="DuplicatedSheetName",go.DuplicatedSheetId="DuplicatedSheetId",go.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",go.WrongSheetMove="WrongSheetMove",go.WrongSheetPosition="WrongSheetPosition",go.InvalidAnchorZone="InvalidAnchorZone",go.SelectionOutOfBound="SelectionOutOfBound",go.TargetOutOfSheet="TargetOutOfSheet",go.WrongCutSelection="WrongCutSelection",go.WrongPasteSelection="WrongPasteSelection",go.WrongPasteOption="WrongPasteOption",go.WrongFigurePasteOption="WrongFigurePasteOption",go.EmptyClipboard="EmptyClipboard",go.EmptyRange="EmptyRange",go.InvalidRange="InvalidRange",go.InvalidZones="InvalidZones",go.InvalidSheetId="InvalidSheetId",go.InvalidFigureId="InvalidFigureId",go.InputAlreadyFocused="InputAlreadyFocused",go.MaximumRangesReached="MaximumRangesReached",go.MinimumRangesReached="MinimumRangesReached",go.InvalidChartDefinition="InvalidChartDefinition",go.InvalidDataSet="InvalidDataSet",go.InvalidLabelRange="InvalidLabelRange",go.InvalidScorecardKeyValue="InvalidScorecardKeyValue",go.InvalidScorecardBaseline="InvalidScorecardBaseline",go.InvalidGaugeDataRange="InvalidGaugeDataRange",go.EmptyGaugeRangeMin="EmptyGaugeRangeMin",go.GaugeRangeMinNaN="GaugeRangeMinNaN",go.EmptyGaugeRangeMax="EmptyGaugeRangeMax",go.GaugeRangeMaxNaN="GaugeRangeMaxNaN",go.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",go.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",go.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",go.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",go.InvalidAutofillSelection="InvalidAutofillSelection",go.WrongComposerSelection="WrongComposerSelection",go.MinBiggerThanMax="MinBiggerThanMax",go.LowerBiggerThanUpper="LowerBiggerThanUpper",go.MidBiggerThanMax="MidBiggerThanMax",go.MinBiggerThanMid="MinBiggerThanMid",go.FirstArgMissing="FirstArgMissing",go.SecondArgMissing="SecondArgMissing",go.MinNaN="MinNaN",go.MidNaN="MidNaN",go.MaxNaN="MaxNaN",go.ValueUpperInflectionNaN="ValueUpperInflectionNaN",go.ValueLowerInflectionNaN="ValueLowerInflectionNaN",go.MinInvalidFormula="MinInvalidFormula",go.MidInvalidFormula="MidInvalidFormula",go.MaxInvalidFormula="MaxInvalidFormula",go.ValueUpperInvalidFormula="ValueUpperInvalidFormula",go.ValueLowerInvalidFormula="ValueLowerInvalidFormula",go.InvalidSortZone="InvalidSortZone",go.WaitingSessionConfirmation="WaitingSessionConfirmation",go.MergeOverlap="MergeOverlap",go.TooManyHiddenElements="TooManyHiddenElements",go.Readonly="Readonly",go.InvalidViewportSize="InvalidViewportSize",go.InvalidScrollingDirection="InvalidScrollingDirection",go.FigureDoesNotExist="FigureDoesNotExist",go.InvalidConditionalFormatId="InvalidConditionalFormatId",go.InvalidCellPopover="InvalidCellPopover",go.EmptyTarget="EmptyTarget",go.InvalidFreezeQuantity="InvalidFreezeQuantity",go.FrozenPaneOverlap="FrozenPaneOverlap",go.ValuesNotChanged="ValuesNotChanged",go.InvalidFilterZone="InvalidFilterZone",go.FilterOverlap="FilterOverlap",go.FilterNotFound="FilterNotFound",go.MergeInFilter="MergeInFilter",go.NonContinuousTargets="NonContinuousTargets",go.DuplicatedFigureId="DuplicatedFigureId",go.InvalidSelectionStep="InvalidSelectionStep",go.DuplicatedChartId="DuplicatedChartId",go.ChartDoesNotExist="ChartDoesNotExist",go.InvalidHeaderIndex="InvalidHeaderIndex",go.InvalidQuantity="InvalidQuantity",go.MoreThanOneColumnSelected="MoreThanOneColumnSelected",go.EmptySplitSeparator="EmptySplitSeparator",go.SplitWillOverwriteContent="SplitWillOverwriteContent",go.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",go.NoActiveSheet="NoActiveSheet",go.InvalidLocale="InvalidLocale",go.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",go.MoreThanOneRangeSelected="MoreThanOneRangeSelected",go.NoColumnsProvided="NoColumnsProvided",go.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",go.DuplicatesColumnsSelected="DuplicatesColumnsSelected",go.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",go.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",go.UnknownHeaderGroup="UnknownHeaderGroup",go.UnknownDataValidationRule="UnknownDataValidationRule",go.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",go.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",go.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",go.BlockingValidationRule="BlockingValidationRule",go.InvalidCopyPasteSelection="InvalidCopyPasteSelection",go.NoChanges="NoChanges",go.InvalidInputId="InvalidInputId";const po="@",mo=[{name:"English (US)",code:"en_US",thousandsSeparator:",",decimalSeparator:".",dateFormat:"m/d/yyyy",timeFormat:"hh:mm:ss a",formulaArgSeparator:","},{name:"French",code:"fr_FR",thousandsSeparator:" ",decimalSeparator:",",dateFormat:"dd/mm/yyyy",timeFormat:"hh:mm:ss",formulaArgSeparator:";"}],fo=mo[0],vo=["thin","medium","thick","dashed","dotted"];function bo(e){return Array.isArray(e)&&Array.isArray(e[0])}var So,Co;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(So||(So={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Co||(Co={}));const Eo={NotAvailable:"#N/A",InvalidReference:"#REF",BadExpression:"#BAD_EXPR",CircularDependency:"#CYCLE",UnknownFunction:"#NAME?",GenericError:"#ERROR"},wo=new Set(Object.values(Eo));class yo extends Error{value;constructor(e=eo("Error"),t=Eo.GenericError){super(e),this.value=t}}class xo extends yo{constructor(e=eo("Invalid expression")){super(e,Eo.BadExpression)}}class Io extends yo{constructor(e=eo("Invalid reference")){super(e,Eo.InvalidReference)}}class Ro extends yo{constructor(e=eo("Data not available")){super(e,Eo.NotAvailable)}}class To extends yo{constructor(e=eo("Unknown function")){super(e,Eo.UnknownFunction)}}const Ao=["number","string","boolean","undefined"];function Oo(e,t){if(!e())throw new yo(t)}function _o(e){if(void 0!==e)return bo(e)?e[0][0]?.format:e.format}function Mo(e){return"string"==typeof e&&wo.has(e)}const No=e=>eo("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Fo(e,t){const o=$o(e);switch(typeof o){case"number":return o;case"boolean":return o?1:0;case"string":if($t(o,t)||""===o)return Zt(o,t);const e=_t(o,t);if(e)return e.value;throw new yo(No(o));default:return 0}}function Do(e,t){try{return Fo(e,t)}catch(e){return}}function Lo(e,t){return hs(e).map((e=>e.map((e=>{if("number"!=typeof e.value)throw new yo(eo("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",t,typeof e.value));return e.value}))))}function Po(e,t){const o=$o(e);if(""===o)throw new yo(No(o));return Fo(o,t)}function ko(e,t){return Math.trunc(Fo(e,t))}function Vo(e,t){return Math.trunc(Po(e,t))}function Uo(e){Oo((()=>e>=1),eo("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function Bo(e){const t=$o(e);switch(typeof t){case"string":return t;case"number":return t.toString();case"boolean":return t?"TRUE":"FALSE";default:return""}}const Ho=He((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),zo=e=>eo("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Go(e){const t=$o(e);switch(typeof t){case"boolean":return t;case"string":if(t){let e=t.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1;throw new yo(zo(t))}return!1;case"number":return!!t;default:return!1}}function Wo(e,t){return Mt(Fo($o(e),t))}function $o(e){if("object"==typeof e&&null!==e&&"value"in e){if(Mo(e.value))throw e;return e.value}if(Mo(e))throw new yo("",e);return e}function qo(e,t,o){for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)t(s[o][n])}else o(s)}function Zo(e,t){qo(e,(e=>{if(Mo(e.value))throw e;t(e)}),(e=>{if(Mo(e?.value))throw e;t(e)}))}function Yo(e,t,o){qo(e,(e=>{const o=e?.value;if("number"==typeof o&&t(o),Mo(o))throw e}),(e=>{t(Po(e,o))}))}function jo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;if("rowFirst"===n)for(let n=0;n<o;n++)for(let o=0;o<e;o++)i=t(i,s[o][n]);else for(let n=0;n<e;n++)for(let e=0;e<o;e++)i=t(i,s[n][e])}else i=o(i,s);return i}function Xo(e,t,o,s="rowFirst"){return jo(e,t,t,o,s)}function Ko(e,t,o,s){return jo(e,((e,o)=>{const s=o?.value;if("number"==typeof s)return t(e,s);if(Mo(s))throw o;return e}),((e,o)=>t(e,Po(o,s))),o)}function Qo(e,t,o,s){return jo(e,((e,o)=>{const n=o?.value;if(null!=n){if("number"==typeof n)return t(e,n);if("boolean"==typeof n)return t(e,Fo(n,s));if(Mo(n))throw o;return t(e,0)}return e}),((e,o)=>t(e,Fo(o,s))),o)}function Jo(e,t,o){const s=Array(e);for(let n=0;n<e;n++){s[n]=Array(t);for(let e=0;e<t;e++)s[n][e]=o(n,e)}return s}function es(e,t){return 0===e.length?[]:Jo(e.length,e[0].length,((o,s)=>t(e[o][s])))}function ts(e){return e.length?Jo(e[0].length,e.length,((t,o)=>e[o][t])):[]}function os(e,t){return function(e,t,o){for(let s of e)if(bo(s)){const e=s.length,o=s[0].length;for(let n=0;n<o;n++)for(let o=0;o<e;o++)if(!t(s[o][n]??void 0))return}else if(!o(s))return}(e,(e=>{const o=e?.value;if("boolean"==typeof o)return t(o);if("number"==typeof o)return t(!!o);if(Mo(o))throw e;return!0}),(e=>void 0===e||null===e.value||t(function(e){const t=$o(e);if(""===t)throw new yo(zo(t));return Go(t)}(e))))}function ss(e,t,o){let s,n,i=e.substring(0,2);"<="===i||">="===i||"<>"===i?(s=i,n=e.substring(2)):(i=e.substring(0,1),"<"===i||">"===i||"="===i?(s=i,n=e.substring(1)):(s="=",n=e)),$t(n,o)||At(n,o)?n=Fo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Go(n));const r={operator:s,operand:n};return"string"==typeof n&&(t&&(n+="*"),r.regexp=function(e){if("*"===e)return/.+/;let t="",o="";for(let s of e)"?"===s&&"~"!==o?t+=".":"*"===s&&"~"!==o?t+=".*":("*"!==s&&"?"!==s||(t=t.slice(0,-1)),["^",".","[","]","$","(",")","*","+","?","|","{","}","\\"].includes(s)&&(t+="\\"),t+=s),o=s;return new RegExp("^"+t+"$","i")}(n)),r}function ns(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return e.toString()===s.toString();if("<>"===o||"="===o){let n;return n=typeof e==typeof s&&("string"==typeof e&&t.regexp?t.regexp.test(e):e===s),"="===o?n:!n}if(typeof e==typeof s)switch(o){case"<":return e<s;case">":return e>s;case"<=":return e<=s;case">=":return e>=s}return!1}function is(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new yo(eo("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=hs(e[0]),r=i.length,a=i[0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=hs(e[t]);if(n.length!==r||n[0].length!==a)throw new yo(eo("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const i=Bo(e[t+1]);l.push(ss(i,s,o))}for(let o=0;o<r;o++)for(let s=0;s<a;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=ns(hs(e[t])[o][s].value??void 0,l[t/2]),!i)break}i&&t(o,s)}}function rs(e,t,o,s,n,i){if(void 0===t||null===t.value)return-1;if(Mo(t.value))throw t;const r=ls(t.value),a=typeof r;let l,c,h,d,u,g,p=0,m=n-1;for(;m-p>=0;){for(h=Math.floor((p+m)/2),d=h,u=ls(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=ls(i(e,d)),g=typeof u;g===a&&null!=u?("strict"===o&&u===r?(l=u,c=d):"nextSmaller"===o&&u<=r?(null==l||l<u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d):"nextGreater"===o&&u>=r&&(void 0===l||l>u||l===u&&"asc"===s&&c<d||l===u&&"desc"===s&&c>d)&&(l=u,c=d),"asc"===s&&u>r||"desc"===s&&u<=r?m=d-1:p=h+1):p=h+1}return void 0!==c?c:-1}function as(e,t,o,s,n,i=!1){if(void 0===t||null===t.value)return-1;if(Mo(t.value))throw t;const r=ls(t.value),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=ls(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&cs(r,n)>=0||cs(r,n)>=0&&cs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&cs(r,n)<=0||cs(r,n)<=0&&cs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function ls(e){return"string"==typeof e?Ho(e):e}function cs(e,t){let o=Ao.indexOf(typeof e)-Ao.indexOf(typeof t);return 0===o&&("string"==typeof e&&"string"==typeof t?o=e.localeCompare(t):"number"==typeof e&&"number"==typeof t?o=e-t:"boolean"==typeof e&&"boolean"==typeof t&&(o=Number(e)-Number(t))),o}function hs(e){return void 0===e?[[]]:bo(e)?e:[[e]]}function ds(e,t){return Xo(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function us(e){const t=mt.now();switch(e){case"today":return Ft(t);case"yesterday":return Ft(mt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Ft(mt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Ft(mt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Ft(mt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Ft(mt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function gs(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[us(e.dateValue)]:e.values.map((e=>Tt(e,t)))}function ps(e,t){return e.values.map((e=>Do(e,t)))}function ms(e){return 20+120*Math.exp(-.035*(e-1))}const fs=20,vs=11,bs=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Ss=/0/g,Cs={0:eo("January"),1:eo("February"),2:eo("March"),3:eo("April"),4:eo("May"),5:eo("June"),6:eo("July"),7:eo("August"),8:eo("September"),9:eo("October"),10:eo("November"),11:eo("December")},Es={0:eo("Sunday"),1:eo("Monday"),2:eo("Tuesday"),3:eo("Wednesday"),4:eo("Thursday"),5:eo("Friday"),6:eo("Saturday")},ws={};function ys(e){let t=ws[e];return void 0===t&&(t=function(e){if(""===e)throw new Error("A format cannot be empty");let t=0,o=[];for(;t<e.length;){let s;if("["===e.charAt(t)){if("$"!==e.charAt(t+1))throw new Error(`Currency formats have to be prefixed by a $: ${e}`);if(s=e.substring(t+1).indexOf("]")+t+2,0===s)throw new Error(`Invalid currency brackets format: ${e}`);const n=e.substring(t+2,s-1);if(n.includes("["))throw new Error(`Invalid currency format: ${e}`);o.push({type:"STRING",format:n})}else{const n=e.substring(t).indexOf("[");s=n>-1?n+t:e.length;const i=e.substring(t,s);Ms(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:qs(i)})}t=s}return o}(e),ws[e]=t),t}function xs(e,{format:t,locale:o}){if(t===po)return Bo(e)||"";switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=ks(e));return function(e,t,o){if("DATE"===t[0].type)return Fs(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Is(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,ys(t),o);case"object":return"0"}}function Is(e,t,o){t.isPercent&&(e*=100),e/=t.magnitude;let s=0;void 0!==t.decimalPart&&(s=t.decimalPart.length);const{integerDigits:n,decimalDigits:i}=Ts(e,s);let r=function(e,t,o){const s="0"===e?"":e;let n=s;const i=t.length-s.length;if(i>0){const e=(t.substring(0,i).match(Ss)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(bs)?.join(o)||n);return n}(n,t.integerPart,t.thousandsSeparator?o.thousandsSeparator:void 0);return void 0!==t.decimalPart&&(r+=o.decimalSeparator+function(e,t){let o=e;if(t.length-e.length>0){const s=(t.substring(e.length,t.length+1).match(Ss)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Rs=[];function Ts(e,t=fs){const o=e.toString();if(o.includes("e"))return function(e,t=fs){let o=Rs[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Rs[t]=o);const[s,n]=o.format(e).split(".");return{integerDigits:s,decimalDigits:n}}(e,t);if(Number.isInteger(e))return{integerDigits:o,decimalDigits:void 0};const s=o.indexOf(".");let n=o.substring(0,s),i=o.substring(s+1);if(0===t)return Number(i[0])>=5&&(n=(Number(n)+1).toString()),{integerDigits:n,decimalDigits:void 0};if(i.length>t){const{integerDigits:e,decimalDigits:o}=function(e,t){let o="0",s=e,n=e.slice(0,t);const i=t;if(Number(e[i])<5)return{integerDigits:o,decimalDigits:n};const r=n.match(Os)?.[0]||"",a=(Number(n)+1).toString(),l=n.slice(r.length),c=a.length>l.length;c&&!r?(o="1",s=void 0):s=c?r.slice(0,-1)+a:r+a;return{integerDigits:o,decimalDigits:s}}(i,t);i=o,"0"!==e&&(n=(Number(n)+Number(e)).toString())}return{integerDigits:n,decimalDigits:As(i||"")}}function As(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const Os=/^0+/;function _s(e,t){const{integerDigits:o,decimalDigits:s}=Ts(e,20);return s?o+t+s:o}function Ms(e){if(!Ns.has(e[0]))return!1;try{return Fs(1,e),!0}catch(e){return!1}}const Ns=new Set(["h","m","y","d"]);function Fs(e,t){const o=Mt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ds(o,t.substring(0,s-1)),i=Ls(o,t.substring(s))):0===s?i=Ls(o,t):s<0&&(n=Ds(o,t)),n+(n&&i?" ":"")+i}function Ds(e,t){const o=t.match(/\/|-|\s/)?.[0];return(o?t.split(o):[t]).map((o=>{switch(o){case"d":return e.getDate();case"dd":return e.getDate().toString().padStart(2,"0");case"ddd":return Es[e.getDay()].slice(0,3);case"dddd":return Es[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Cs[e.getMonth()].slice(0,3);case"mmmm":return Cs[e.getMonth()];case"mmmmm":return Cs[e.getMonth()].slice(0,1);case"yy":const o=String(e.getFullYear()).replace("-","").padStart(2,"0");return o.slice(o.length-2);case"yyyy":return e.getFullYear();default:throw new Error(`invalid format: ${t}`)}})).join(o)}function Ls(e,t){let o=t.split(/:|\s/);const s=e.getHours(),n="a"===o[o.length-1];let i=s,r="";return n&&(i=0===i?12:i>12?i-12:i,r=s>=12?" PM":" AM",o.pop()),o.map((o=>{switch(o){case"hhhh":return Math.floor((e.getTime()-ft.getTime())/36e5).toString();case"hh":return i.toString().padStart(2,"0");case"mm":return e.getMinutes().toString().padStart(2,"0");case"ss":return e.getSeconds().toString().padStart(2,"0");default:throw new Error(`invalid format: ${t}`)}})).join(":")+r}const Ps=He((function(e){return new RegExp(`[0-9]+${ae(e.decimalSeparator)}[0-9]`)}));function ks(e){let{integerDigits:t,decimalDigits:o}=Ts(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=Ts(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Vs(e,t){if(!At(e,t))return;return _t(e,t).format}function Us(e){if(!$t(e,fo))return;const t=e.includes(".")?"0.00":"0",o=e.match(/[\$€]/);if(o){const s=e.match(/[\d]/),n="[$"+o.values().next().value+"]";return s.index<o.index?"#,##"+t+n:n+"#,##"+t}return e.includes("%")?t+"%":void 0}function Bs(e){const t=e.decimalPlaces??2,o=e.position??"before",s=e.code??"",n=e.symbol??"",i="#,##0"+(t?"."+"0".repeat(t):"");let r=`${s} ${n}`.trim();return"after"===o&&s&&(r=" "+r),function(e,t,o){const s=`[$${e}]`;return"before"===t?s+o:o+s}(r,o,i)}function Hs(e){return Ys(ys(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function zs(e,t,o,s){const n=ys(e||"#,##0"),i=[];for(let e=0;e<n.length;e++){const s=n[e];if("NUMBER"!==s.type){i.push(s);continue}i.push({...s,format:{...s.format,magnitude:t,decimalPart:void 0}}),i.push({type:"STRING",format:o});const r=n[e+1];"STRING"===r?.type&&["k","m","b"].includes(r.format)&&e++}return Ys(i)}function Gs(e,t,o){const s=ys(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=Ys(s);return ws[n]=s,n}function Ws(e,t){const o={...e},s=Math.sign(t),n=o.decimalPart?.length||0,i=Math.min(Math.max(0,n+s),fs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const $s=/,*?$/;function qs(e){if(function(e){return Boolean(e.replace(Zs,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match($s)?.[0]||"",s=o?1e3**o.length:1;let n=e.slice(0,e.length-(o.length||0));const i=n.includes(",");if(/\..*,/.test(n))throw new Error("A format can't contain ',' symbol in the decimal part");n=n.replace("%","").replace(",","");const r=n.match(/[\%|,]/);if(r)throw new Error(`A format can only contain a single '${r[0]}' symbol`);const[a,l]=n.split(".");if(l&&l.length>20)throw new Error("A format can't contain more than 20 decimal places");return void 0!==l?{integerPart:a,isPercent:t,thousandsSeparator:i,decimalPart:l,magnitude:s}:{integerPart:a,isPercent:t,thousandsSeparator:i,magnitude:s}}const Zs=/[,#0.%]/g;function Ys(e){let t="";for(let o of e){let e;switch(o.type){case"NUMBER":const t=o.format;e=t.integerPart,t.thousandsSeparator&&(e=e.slice(0,-3)+","+e.slice(-3)),void 0!==t.decimalPart&&(e+="."+t.decimalPart),t.isPercent&&(e+="%"),t.magnitude&&(e+=",".repeat(Math.log10(t.magnitude)/3));break;case"STRING":e=`[$${o.format}]`;break;case"DATE":e=o.format}t+=e}return t}const js=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Xs=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Qs=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),Js=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[js.source,/(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*:\s*(\$?[A-Z]{1,3})?\$?[0-9]{1,7}\s*/i.source,/\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*:\s*\$?[A-Z]{1,3}(\$?[0-9]{1,7})?\s*/i.source].join("|")+")"+/$/.source,"i");function on(e){return Js.test(e)}function sn(e){return en.test(e)}function nn(e){return Ks.test(e)}function rn(e){return Qs.test(e)}function an(e){return Xs.test(e)}function ln(e){if(!e.includes("!"))return{xc:e};const t=e.split("!"),o=t.pop();return{sheetName:ce(t.join("!"))||void 0,xc:o}}function cn(e,t){return void 0!==e?`${he(e)}!${t}`:t}function hn(e){const t=function(e){e.includes("!")&&(e=e.split("!").at(-1)),e.includes("$")&&(e=e.replaceAll("$",""));let t,o,s,n,i,r="";e.includes(":")?([r,t]=e.split(":"),r=r.trim(),t=t.trim()):r=e.trim();let a=!1,l=!1,c=!1;if(on(r))n=i=ht(r),o=s=0,a=!0;else if(sn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=gt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(on(t))i=ht(t),a=!0;else if(sn(t))s=parseInt(t,10)-1,l=!0;else{const e=gt(t);i=e.col,s=e.row,o=a?s:o,n=l?i:n,c=!0}if(a&&l)throw new Error("Wrong zone xc. The zone cannot be at the same time a full column and a full row");const h={top:o,left:n,bottom:a?void 0:s,right:l?void 0:i};return c=c&&(l||a),c&&(h.hasHeader=c),h}(e);if(void 0!==t.right&&t.right<t.left){const e=t.left;t.left=t.right,t.right=e}if(void 0!==t.bottom&&t.bottom<t.top){const e=t.top;t.top=t.bottom,t.bottom=e}return t}function dn(e){const t=hn(e);if(void 0===t.bottom||void 0===t.right)throw new Error("This does not support unbounded ranges");return t}function un(e){const{bottom:t,top:o,left:s,right:n}=e;return!(void 0!==t&&isNaN(t)||isNaN(o)||isNaN(s)||void 0!==n&&isNaN(n))&&(gn(e)&&e.top>=0&&e.left>=0)}function gn(e){return(void 0===e.bottom||e.bottom>=e.top&&e.bottom>=0)&&(void 0===e.right||e.right>=e.left&&e.right>=0)}function pn(e){const{top:t,bottom:o,left:s,right:n}=e,i="hasHeader"in e&&e.hasHeader,r=t===o&&s===n;if(void 0===o&&void 0!==n)return 0!==t||i?`${pt(s,t)}:${lt(n)}`:`${lt(s)}:${lt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${pt(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?pt(s,t):`${pt(s,t)}:${pt(n,o)}`;throw new Error(eo("Bad zone format"))}function mn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a=e["left"===t?"right":"bottom"];return e[t]<=r&&a&&a>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function fn(e,t,o,s,n){const i="left"===t?"columns":"rows",r="before"===s?o-1:o,a="left"===t?"right":"bottom";return e[t]<=r&&e[a]>r?_n(e,i,"RESIZE",n):r<e[t]?_n(e,i,"MOVE",n):{...e}}function vn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];for(let r of o.sort(((e,t)=>t-e)))e[t]>r&&(n--,i--),e[t]<r&&e[s]>=r&&i--;return{...e,[t]:n,[s]:i}}function bn(e,t,o){const s="left"===t?"right":"bottom";let n=e[t],i=e[s];const r=e[s];for(let s of o.sort(((e,t)=>t-e)))e[t]>s&&(n--,void 0!==i&&i--),void 0!==r&&void 0!==i&&e[t]<=s&&r>=s&&i--;if(!(void 0!==i&&n>i))return{...e,[t]:n,[s]:i}}function Sn(...e){return{top:Math.min(...e.map((e=>e.top))),left:Math.min(...e.map((e=>e.left))),bottom:Math.max(...e.map((e=>e.bottom))),right:Math.max(...e.map((e=>e.right)))}}function Cn(e,t){if(wn(e,t))return{top:Math.max(e.top,t.top),left:Math.max(e.left,t.left),bottom:Math.min(e.bottom,t.bottom),right:Math.min(e.right,t.right)}}function En(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function wn(e,t){return!(e.bottom<t.top||t.bottom<e.top)&&!(e.right<t.left||t.right<e.left)}function yn(e,t,o){const{left:s,right:n,top:i,bottom:r}=o;return e>=s&&e<=n&&t>=i&&t<=r}function xn(e,t){return En(Sn(t,e),t)}function In(e,t){const o=e.map(hn),s=t.map(hn),n=Math.max(...o.concat(s).map((e=>e.bottom||0))),i=Math.max(...o.concat(s).map((e=>e.right||0))),r=o.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),a=s.map((e=>({...e,bottom:void 0===e.bottom?n+1:e.bottom,right:void 0===e.right?i+1:e.right}))),l=function(e,t){const o=new Set(t.map((({col:e,row:t})=>`${e}-${t}`)));return e.filter((({col:e,row:t})=>!o.has(`${e}-${t}`)))}(r.map(On).flat(),a.map(On).flat()),c=function(e){if(0===e.length)return[];const[t,...o]=[...e].sort(((e,t)=>e.row-t.row)).sort(((e,t)=>e.col-t.col)),s=[];let n=Fn(t);for(const{col:e,row:t}of o)if(!yn(e,t,n))if(e===n.left&&t===n.bottom+1){const e=n.bottom+1;n={...n,bottom:e}}else s.push(n),n=Fn({col:e,row:t});return[...s,n]}(l);return function(e){if(0===e.length)return[];if(e.some((e=>e.left!==e.right)))throw new Error("only columns can be merged");const t=[],o=Rn(e),s=(e,t)=>e.top===t.top&&e.bottom===t.bottom&&e.right+1===t.left;for(;o.length;){const e=o.reduce(((e,t)=>s(e,t)?Sn(e,t):e),o.shift());t.push(e)}return Rn(t)}(c).map((e=>({...e,bottom:e.bottom===n+1?void 0:e.bottom,right:e.right===i+1?void 0:e.right}))).map(pn)}function Rn(e){const t=[...e].sort(((e,t)=>t.right-e.right)).sort(((e,t)=>t.bottom-e.bottom)).sort(((e,t)=>e.top-t.top)).sort(((e,t)=>e.left-t.left)).reverse(),o=[];for(;0!==t.length;){const e=t.shift();t.some((t=>xn(e,t)))||o.push(e)}return o.reverse()}function Tn(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function An(e){const{numberOfCols:t,numberOfRows:o}=Tn(e);return 1===t||1===o}function On(e){const t=[],[o,s]=[e.right,e.left].sort(((e,t)=>e-t)),[n,i]=[e.top,e.bottom].sort(((e,t)=>e-t));for(const e of ue(o,s+1))for(const o of ue(n,i+1))t.push({col:e,row:o});return t}function _n(e,t,o,s){const n="both"===t?s[0]:"columns"===t?s:0,i="both"===t?s[1]:"rows"===t?s:0,r="hasHeader"in e&&e.hasHeader;let a;a=!function(e){return void 0===e.bottom}(e)||r?!(Dn(e)&&!r)||"columns"!==t:"rows"!==t;const l={...e};return a&&"MOVE"===o&&(l.left+=n,l.top+=i),void 0!==l.right&&(l.right+=n),void 0!==l.bottom&&(l.bottom+=i),l}function Mn(e,t){let o,s;const{left:n,right:i,top:r,bottom:a}=e,{left:l,right:c,top:h,bottom:d}=t;return o=l!=n?l:c!=i?c:l,s=h!=r?h:d!=a?d:h,{col:o,row:s}}function Nn(e){return{top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom),left:Math.min(e.left,e.right),right:Math.max(e.left,e.right)}}function Fn(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Dn(e){return void 0===e.right}function Ln(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Pn(...e){return e.length<2||1===In(e.map(pn),[]).length}class kn{getSheetSize;_zone;parts;invalidXc;prefixSheet=!1;sheetId;invalidSheetName;constructor(e,t){this.getSheetSize=t,this._zone=e.zone,this.prefixSheet=e.prefixSheet,this.invalidXc=e.invalidXc,this.sheetId=e.sheetId,this.invalidSheetName=e.invalidSheetName;let o=[...e.parts];1===e.parts.length&&Ln(this.zone)>1?o.push({...e.parts[0]}):2===e.parts.length&&1===Ln(this.zone)&&o.pop(),this.parts=o}static fromRange(e,t){return e instanceof kn?e:new kn(e,t.getSheetSize)}get unboundedZone(){return this._zone}get zone(){const{left:e,top:t,bottom:o,right:s}=this._zone;if(void 0!==s&&void 0!==o)return this._zone;if(void 0===o&&void 0!==s)return{right:s,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(void 0===s&&void 0!==o)return{bottom:o,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw new Error(eo("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=sn(e);return{colFixed:!t&&e.startsWith("$"),rowFixed:t?e.startsWith("$"):e.includes("$",1)}})),s=void 0===t.bottom,n=void 0===t.right;return s&&(o[0].rowFixed=o[0].rowFixed||o[1].rowFixed,o[1].rowFixed=o[0].rowFixed||o[1].rowFixed),n&&(o[0].colFixed=o[0].colFixed||o[1].colFixed,o[1].colFixed=o[0].colFixed||o[1].colFixed),o}get isFullCol(){return void 0===this._zone.bottom}get isFullRow(){return void 0===this._zone.right}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(gn(this._zone))return this;const e={...this._zone};let t=this.parts;if(void 0!==e.right&&e.right<e.left){let o=e.right;e.right=e.left,e.left=o,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(void 0!==e.bottom&&e.bottom<e.top){let o=e.bottom;e.bottom=e.top,e.top=o,t=[{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1},{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1}]}return this.clone({zone:e,parts:t})}clone(e){return new kn({zone:e?.zone?e.zone:{...this._zone},sheetId:e?.sheetId?e.sheetId:this.sheetId,invalidSheetName:e&&"invalidSheetName"in e?e.invalidSheetName:this.invalidSheetName,invalidXc:e&&"invalidXc"in e?e.invalidXc:this.invalidXc,parts:e?.parts?e.parts:this.parts.map((e=>({rowFixed:e.rowFixed,colFixed:e.colFixed}))),prefixSheet:e?.prefixSheet?e.prefixSheet:this.prefixSheet},this.getSheetSize)}}function Vn(e,t,o){const s=o.sheetId===e?t:o.sheetId;return o.clone({sheetId:s})}function Un(e,t,o){if(!o)return;const s=e.getRangeFromSheetXC(t,o);return s.invalidSheetName||s.invalidXc?void 0:s}function Bn(e){const t=[];for(const o of e)for(const e of On(o.zone))t.push({...e,sheetId:o.sheetId});return t}function Hn(e,t,o){const s=[];return t.forEach((t=>{const n=function(e,t){e=e.toLocaleLowerCase();let o=0,s=0,n=(t=t.toLocaleLowerCase()).length,i=0;for(let r=0;r<n;r++)t[r]===e[i]?(i++,s+=100+s-r/200):s=0,o+=s;return i===e.length?o:0}(e,o(t));n>0&&s.push({score:n,elem:t})})),s.sort(((e,t)=>t.score-e.score)),s.map((e=>e.elem))}function zn(e){const t=[];for(let o=0;o<e;o++){const e={cells:{}};t.push(e)}return t}function Gn(e,t,o){return o.map((o=>o>=e?o+t:o))}function Wn(e,t){return e=[...e].sort(((e,t)=>t-e)),t.map((t=>{for(const o of e)if(t>o)t--;else if(t===o)return;return t})).filter(Ie)}function $n(e,t=1){return t*(e+_)-_}const qn={};function Zn(e,t,o){const s=jn(o);if(qn[s]||(qn[s]={}),void 0===qn[s][t]){e.save(),e.font=s;const o=e.measureText(t).width;e.restore(),qn[s][t]=o}return qn[s][t]}function Yn(e){return Math.round(96*e/72)}function jn(e){return`${e.italic?"italic ":""}${e.bold?"bold":U} ${Xn(e)}px ${H}`}function Xn(e){return Yn(e?.fontSize||B)}function Kn(e,t,o,s){if(Zn(e,t,s)<=o)return[t];const n=[];let i="";for(let r of t){Zn(e,i+r,s)>o?(n.push(i),i=r):i+=r}return n.push(i),n}function Qn(e,t,o,s){o||(o={});const n=[],i=t.includes(ne)?t.split(ne):[t];for(const t of i){const i=t.includes(" ")?t.split(" "):[t];if(!s){n.push(t);continue}let r="",a=s;for(let t of i){const i=Kn(e,t,s,o),l=i.pop(),c=Zn(e,l,o);if(i.length)""!==r&&(n.push(r),r="",a=s),i.forEach((e=>{n.push(e)})),r=l,a=s-c;else{const t=""===r?l:" "+l,i=Zn(e,t,o);i<=a?(r+=t,a-=i):(n.push(r),r=l,a=s-c)}}""!==r&&n.push(r)}return n}function Jn(e){return e?e.toLowerCase():""}const ei=/([0-9\.]*)px/;function ti(e,t,o,s=!1,n=!1,i=function(e){return Number(e.match(ei)?.[1])}(e.font)/10){if(e.fillText(t,o.x,o.y),!s&&!n)return;const r=e.measureText(t),a=r.width,l=r.actualBoundingBoxAscent+r.actualBoundingBoxDescent,c=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;let{x:h,y:d}=o,u=d,g=d;switch(e.textAlign){case"center":h-=a/2;break;case"right":h-=a}switch(e.textBaseline){case"top":g+=c-2*i,u+=c/2-i;break;case"middle":g+=c/2-i;break;case"alphabetic":g+=2*i,u-=3*i;break;case"bottom":g=d,u-=l/2-i/2}s&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,g),e.lineTo(h+a,g),e.stroke()),n&&(e.lineWidth=i,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(h,u),e.lineTo(h+a,u),e.stroke())}class oi{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto&&window.crypto.getRandomValues?([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}}function si(e){return e.map(ii).sort(((e,t)=>e.sequence-t.sequence))}const ni=new oi;function ii(e){const t=e.name,o=e.children,s=e.description,n=e.icon,i=e.secondaryIcon;return{id:e.id||ni.uuidv4(),name:"function"==typeof t?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:e.isEnabled?e.isEnabled:()=>!0,isActive:e.isActive,execute:e.execute,children:o?e=>o.map((t=>"function"==typeof t?t(e):t)).flat().map(ii):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:"function"==typeof n?n:()=>n||"",secondaryIcon:"function"==typeof i?i:()=>i||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?bn(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?mn(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}function ai(e,t){const o="DELETE_SHEET"===t.type&&t.sheetId;if("sheetId"in t&&e._sheetId!==t.sheetId)return e;{const s=ri(e._zone,t);if(s&&o!==e._sheetId)return{...e,_zone:s}}}class li extends t.Component{static template="o-spreadsheet-ChartJsComponent";static props={figure:Object};canvas=t.useRef("graphContainer");chart;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){const e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!("chartJsConfig"in e))throw new Error("Unsupported chart runtime");return e}setup(){t.onMounted((()=>{const e=this.chartRuntime;this.createChart(le(e.chartJsConfig))})),t.onWillUnmount((()=>this.chart?.destroy())),t.useEffect((()=>this.updateChartJs(le(this.chartRuntime))),(()=>[this.chartRuntime]))}createChart(e){const t=this.canvas.el.getContext("2d");this.chart=new window.Chart(t,e)}updateChartJs(e){const t=e.chartJsConfig;t.data&&t.data.datasets?(this.chart.data=t.data,t.options?.plugins?.title&&(this.chart.config.options.plugins.title=t.options.plugins.title),t.options&&"valueLabel"in t.options&&t.options?.valueLabel&&(this.chart.config.options.valueLabel=t.options.valueLabel)):this.chart.data.datasets=[],this.chart.config.options.plugins.tooltip=t.options.plugins.tooltip,this.chart.config.options.plugins.legend=t.options.plugins.legend,this.chart.config.options.scales=t.options?.scales,this.chart.update()}}class ci{sheetId;title;getters;constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t,o,s){let n=!1;const i=[];for(let s in o){let r=o[s];if(r.labelCell){const e=gi(r.labelCell,t);r.labelCell!==e&&(n=!0,r={...r,labelCell:e})}const a=gi(r.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===Eo.InvalidReference?(n=!0,r=void 0):a!==r.dataRange&&(n=!0,r={...r,dataRange:a}),i[s]=r}let r=s;const a=gi(r,t);a!==r&&(n=!0,r=a);return{isStale:n,dataSets:i.filter(Ie),labelRange:r}}function di(e,t,o){return o.map((o=>({dataRange:Vn(e,t,o.dataRange),labelCell:o.labelCell?Vn(e,t,o.labelCell):void 0})))}function ui(e,t,o){return o?Vn(e,t,o):void 0}function gi(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function pi(e,t,o,s){const n=[];for(const i of t){const t=e.getRangeFromSheetXC(o,i),{unboundedZone:r,sheetId:a,invalidSheetName:l,invalidXc:c}=t;if(!l&&!c)if(r.left!==r.right&&r.top!==r.bottom){if(void 0===r.right)continue;for(let t=r.left;t<=r.right;t++){const o={...r,left:t,right:t};n.push(mi(e,a,o,s?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else n.push(mi(e,a,r,s?{top:r.top,bottom:r.top,left:r.left,right:r.left}:void 0))}return n}function mi(e,t,o,s){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${pn(o)}`);if(s){const n=pn(o),i=pn(s);return{labelCell:e.getRangeFromSheetXC(t,i),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,pn(o))}}function fi(e,t){const o=t.labelCell?.zone;let s=t.dataRange.zone;if(o){const{numberOfRows:e,numberOfCols:t}=Tn(s);1===e?s={...s,left:s.left+1}:1===t&&(s={...s,top:s.top+1})}const n=t.dataRange.clone({zone:s});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference",{useFixedReference:!0}):void 0,range:e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}}function vi(e,t,o){if(!t)return;let s={...t.zone};o&&t.zone.bottom>t.zone.top&&(s.top=s.top+1);const n=t.clone({zone:s});return e.getRangeString(n,"forceSheetReference",{useFixedReference:!0})}function bi(e,t){let o;if(e.labelRange){const s=ri(hn(e.labelRange),t);o=s?pn(s):void 0}const s=e.dataSets.map(hn).map((e=>ri(e,t))).filter(Ie).map(pn);return{...e,labelRange:o,dataSets:s}}const Si=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ci{graphColorIndex=0;next(){return Si[this.graphColorIndex++%Si.length]}}function Ei(e){return e&&tt(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!tn.test(e)));if(t)return"InvalidDataSet";if(e.dataSets.map(hn).some((e=>e.top!==e.bottom&&Dn(e))))return"InvalidDataSet"}return"Success"}function yi(e){if(e.labelRange){if(!tn.test(e.labelRange||""))return"InvalidLabelRange"}return"Success"}function xi(e,t,o){if(!o)return!1;if(!e)return!1;if(!t)return!0;const s=Ln(t.dataRange.zone);return!(Ln(e.zone)<s)}function Ii(e,t,o,s){if(e){if("text"===o||t?.type!==oo.number||e.type!==oo.number)return e.formattedValue;{let n=t.value-e.value;if("percentage"===o&&0!==n&&(n=n/e.value*100),"percentage"!==o&&e.format)return xs(n,{format:e.format,locale:s});const i=Math.abs(parseFloat(n.toFixed(2))).toLocaleString();return"percentage"===o?i+"%":i}}return""}function Ri(e,t,o,s,n){if("text"===t||e?.type!==oo.number||o?.type!==oo.number)return;const i=o.value-e.value;return i>0?s:i<0?n:void 0}function Ti(e,t,o){if("text"===o||e?.type!==oo.number||t?.type!==oo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!tn.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!tn.test(e.baseline)?"InvalidScorecardBaseline":"Success"}const _i=new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z"),Mi=new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");let Ni=class e extends ci{keyValue;baseline;baselineMode;baselineDescr;background;baselineColorUp;baselineColorDown;fontColor;type="scorecard";constructor(e,t,o){super(e,t,o),this.keyValue=Un(o,t,e.keyValue),this.baseline=Un(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,Ai,Oi)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:j,baselineColorUp:X,baselineColorDown:K,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,s;return e.baseline&&(o=ri(hn(e.baseline),t)),e.keyValue&&(s=ri(hn(e.keyValue),t)),{...e,baseline:o?pn(o):void 0,keyValue:s?pn(s):void 0}}copyForSheetId(t){const o=ui(this.sheetId,t,this.baseline),s=ui(this.sheetId,t,this.keyValue),n=this.getDefinitionWithSpecificRanges(o,s,t);return new e(n,t,this.getters)}copyInSheetId(t){const o=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t);return new e(o,t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(t){const o=gi(this.baseline,t),s=gi(this.keyValue,t);if(this.baseline===o&&this.keyValue===s)return this;const n=this.getDefinitionWithSpecificRanges(o,s);return new e(n,this.sheetId,this.getters)}};function Fi(e,t){const o=t.getContext("2d");if(t.width=e.canvas.width,t.height=e.canvas.height,o.fillStyle=e.canvas.backgroundColor,o.fillRect(0,0,e.canvas.width,e.canvas.height),e.title&&(o.font=e.title.style.font,o.fillStyle=e.title.style.color,o.fillText(e.title.text,e.title.position.x,e.title.position.y)),e.baseline&&(o.font=e.baseline.style.font,o.fillStyle=e.baseline.style.color,ti(o,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){o.save(),o.fillStyle=e.baselineArrow.style.color,o.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);const t=e.baselineArrow.style.size/10;switch(o.scale(t,t),e.baselineArrow.direction){case"down":o.fill(_i);break;case"up":o.fill(Mi)}o.restore()}e.baselineDescr&&(o.font=e.baselineDescr.style.font,o.fillStyle=e.baselineDescr.style.color,o.fillText(e.baselineDescr.text,e.baselineDescr.position.x,e.baselineDescr.position.y)),e.key&&(o.font=e.key.style.font,o.fillStyle=e.key.style.color,ti(o,e.key.text,e.key.position,e.key.style.underline,e.key.style.strikethrough))}function Di(e,t=!1,o=!1){return`${o?"italic":""} ${t?"bold":""} ${e}px ${H}`}function Li({width:e,height:t},o){return new Pi({width:e,height:t},o).computeDesign()}class Pi{runtime;context;width;height;constructor({width:e,height:t},o){this.runtime=o;const s=document.createElement("canvas");this.width=s.width=e,this.height=s.height=t,this.context=s.getContext("2d")}computeDesign(){const e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),{height:o}=this.getTextDimensions(this.title,t.title.font);this.title&&(e.title={text:this.title,style:t.title,position:{x:this.chartPadding,y:this.chartPadding+o}});const s=t.baselineArrow?.size??0,{height:n,width:i}=this.getTextDimensions(this.baseline,t.baselineValue.font),{width:r}=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font);e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-i-r+s)/2,y:this.keyValue?this.height-2*this.chartPadding:this.height-(this.height-o-n)/2-this.chartPadding}},t.baselineArrow&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-s,y:e.baseline.position.y-(n+s)/2}}),this.baselineDescr&&(e.baselineDescr={text:this.baselineDescr,style:t.baselineDescr,position:{x:e.baseline.position.x+i,y:e.baseline.position.y}});const{height:a,width:l}=this.getTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:(this.width-l)/2,y:(this.height-n+o+a)/2-this.chartPadding}}),e}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return function(e,t){const o=e||"";return t&&o?" "+o:o}(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return tt(this.backgroundColor)>.3?"#525252":"#C8C8C8"}get chartPadding(){return.02*this.width}getTextDimensions(e,t){this.context.font=t;const o=this.context.measureText(e);return{width:o.width,height:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}getTextStyles(){const e=.96*this.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let s=function(e,t,o,s=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let i=(n+t)/2,r=o(i),a=0;for(;Math.abs(r-e)>s&&a<20;)r>=e?t=(n+t)/2:n=(n+t)/2,i=(n+t)/2,r=o(i),a++;return i}(e,o,(e=>t.getElementWidth(e,this.context,this)))/o;const n=new Ui(this.runtime.keyValueStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s,i=new Vi(this.runtime.baselineStyle).getElementMaxFontSize(this.getDrawableHeight(),this)*s;return{title:{font:Di(18),color:this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:Di(n,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:Di(i,this.runtime.baselineStyle?.bold,this.runtime.baselineStyle?.italic),strikethrough:this.runtime.baselineStyle?.strikethrough,underline:this.runtime.baselineStyle?.underline,color:this.runtime.baselineStyle?.textColor||this.runtime.baselineColor||this.secondaryFontColor},baselineDescr:{font:Di(.9*i),color:this.secondaryFontColor},baselineArrow:"neutral"===this.baselineArrow?void 0:{size:this.keyValue?.8*i:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}getDrawableHeight(){const e=2*this.chartPadding;let t=this.height-e;return t-=this.title?18*1.2:0,t}getWidestElement(){const e=new Vi(this.runtime.baselineStyle),t=new Ui(this.runtime.keyValueStyle);return e.getElementWidth(.35,this.context,this)>t.getElementWidth(.65,this.context,this)?e:t}}class ki{style;constructor(e={}){this.style=e}measureTextWidth(e,t,o){return e.font=Di(o,this.style.bold,this.style.italic),e.measureText(t).width}}class Vi extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.baseline,n="neutral"!==o.baselineArrow?"A "+s:s;let i=this.measureTextWidth(t,n,e);return i+=this.measureTextWidth(t,o.baselineDescr,.9*e),i}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/1.2}}class Ui extends ki{getElementWidth(e,t,o){if(!o.runtime)return 0;const s=o.keyValue||"";return this.measureTextWidth(t,s,e)}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/1.2}}class Bi extends t.Component{static template="o-spreadsheet-ScorecardChart";static props={figure:Object};canvas=t.useRef("chartContainer");get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}setup(){t.useEffect(this.createChart.bind(this),(()=>{const e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el]}))}createChart(){const e=this.canvas.el;Fi(Li(e.getBoundingClientRect(),this.runtime),e)}}class Hi{content={};add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}function zi(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}const Gi=new Hi;function Wi(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>we(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=xe(e);return t.tryGetSheetName(o)||eo("Invalid sheet")},open(e,t){const o=xe(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const $i={createLink:Wi,match:e=>be(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function qi(e){return Gi.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||$i}function Zi(e,t){return qi(e.url).urlRepresentation(e.url,t)}function Yi(e,t){qi(e.url).open(e.url,t)}function ji(e){if("string"==typeof e){if(ve(e)){const{label:t,url:o}=Ce(e);return qi(o).createLink(o,t)}return be(e)?Wi(e):void 0}}function Xi(e,t){return t.format===po?er(e||"",t):Qi(Ki(e||"",t.locale),t)}function Ki(e,t){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return $t(e,fo)?Fo(e,fo):At(e,t)?Fo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t,o){const s=ji(e);return s?{...Ji(Ki(s.label,t.locale),{format:t.format||Vs(s.label,t.locale)||Us(s.label),locale:t.locale},o),link:s}:Ji(e,t,o)}function Ji(e,t,o){return Mo(e)?function(e,t){return{type:oo.error,value:e,message:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:e}}(e,o):t.format===po?er(Bo(e),t):""===e?function(e){if(void 0===e.format)return or;return{type:oo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t):"number"==typeof e?Ms(t.format||"")?function(e,t){const o=xs(e,t);return{type:oo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t):tr(e,t):null===e?tr(0,t):"boolean"==typeof e?function(e,t){const o=e?"TRUE":"FALSE";return{type:oo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t):er((e||"").toString(),t)}function er(e,t){return{type:oo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:xs(e,t)}}function tr(e,t){return{type:oo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:xs(e,t)}}const or={type:oo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};const sr=new Hi;sr.add("ALPHANUMERIC_INCREMENT_MODIFIER",{apply:(e,t)=>{e.current+=e.increment;const o=`${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:o},tooltip:{props:{content:o}}}}}).add("INCREMENT_MODIFIER",{apply:(e,t,o)=>{e.current+=e.increment;const s=e.current.toString(),n=o.getLocale(),i=xs(e.current,{format:t.cell?.format,locale:n});return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:i}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{const s=t.cell?.content||"",n={locale:o.getLocale(),format:t.cell?.format};return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:Xi(t.cell?.content,n).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,s)=>{e.current+=e.increment;let n=0,i=0;switch(s){case"up":n=0,i=-e.current;break;case"down":n=0,i=e.current;break;case"left":n=-e.current,i=0;break;case"right":n=e.current,i=0}const r=t.cell;if(!r||!r.isFormula)return{cellData:{}};const a=t.sheetId,l=o.getTranslatedCellFormula(a,n,i,r.compiledFormula);return{cellData:{border:t.border,style:r.style,format:r.format,content:l},tooltip:l?{props:{content:l}}:void 0}}});const nr=new Hi,ir=/(\d+)$/,rr=/^(.*\D+)/,ar=/^(.*\D+)(\d+)$/;function lr(e,t,o){let s=[],n=!1;for(let i of t){i===e&&(n=!0);const t=i?.isFormula?void 0:Xi(i?.content,{locale:fo});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function cr(e){let t=1;return e.length>=2&&(t=function(e){const t=[];let o=e[0];for(let s=1;s<e.length;s++){const n=e[s];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(e)*e.length),t}nr.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ms(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.text&&ar.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(ir)[0]),s=e.content.match(rr)[0],n=e.content.length-s.length,i=lr(e,t,(e=>e.type===oo.text&&ar.test(e.value))).filter((e=>s===e.value.toString().match(rr)[0])).map((e=>parseInt(e.value.toString().match(ir)[0]))),r=cr(i);return{type:"ALPHANUMERIC_INCREMENT_MODIFIER",prefix:s,current:o,increment:r,numberPostfixLength:n}},sequence:15}).add("copy_text",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.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_number",{condition:e=>!e.isFormula&&Xi(e.content,{locale:fo}).type===oo.number,generateRule:(e,t)=>{const o=cr(lr(e,t,(e=>e.type===oo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:fo});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===oo.number?s.value:0}},sequence:40});const hr={};let dr=0;function ur(e,...t){const o="__sheet__"+dr++;return function(e,t){const o=document.createElement("style");o.textContent=function(e){const t=e.split(/(\{|\}|;)/).map((e=>e.trim())),o=[],s=[];let n=[];function i(e,t){const s=[];for(const n of o[e]){let r=t&&t+" "+n||n;r.includes("&")&&(r=n.replace(/&/g,t||"")),e<o.length-1&&(r=i(e+1,r)),s.push(r)}return s.join(", ")}function r(){n.length&&(s.push(i(0)+" {"),s.push(...n),s.push("}"),n=[])}for(;t.length;){let e=t.shift();"}"===e?(r(),o.pop()):("{"===t[0]&&(r(),o.push(e.split(/\s*,\s*/)),t.shift()),";"===t[0]&&n.push(" "+e+";"))}return s.join("\n")}(t),hr[e]=o}(o,String.raw(e,...t)),function(e){const t=hr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function gr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function pr(e){const t=function(e){const t={};if(!e)return t;e.bold&&(t["font-weight"]="bold");e.italic&&(t["font-style"]="italic");if(e.strikethrough||e.underline){let o=e.strikethrough?"line-through":"";o=e.underline?o+" underline":o,t["text-decoration"]=o}e.textColor&&(t.color=e.textColor);return t}(e);return e?(e.fillColor&&(t.background=e.fillColor),t):t}function mr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}ur`
2
2
  .o-error-tooltip {
3
3
  font-size: 13px;
4
4
  background-color: white;
@@ -1254,7 +1254,7 @@
1254
1254
  margin-left: 8px;
1255
1255
  }
1256
1256
  }
1257
- `;class EE extends t.Component{static template="o-spreadsheet-GridAddRowsFooter";static props={focusGrid:Function};static components={ValidationMessages:IS};inputRef=t.useRef("inputRef");state=t.useState({inputValue:"100",errorFlag:!1});setup(){t.useExternalListener(window,"click",this.onExternalClick,{capture:!0})}get addRowsPosition(){const e=this.env.model.getters.getActiveSheetId(),{numberOfRows:t}=this.env.model.getters.getSheetSize(e),{scrollY:o}=this.env.model.getters.getActiveSheetScrollInfo();return mr({top:`${this.env.model.getters.getRowDimensions(e,t-1).end-o}px`})}get errorMessages(){return[eo("Please enter a number between 0 and 10000.")]}onKeydown(e){"ESCAPE"===e.key.toUpperCase()?this.props.focusGrid():"ENTER"===e.key.toUpperCase()&&this.onConfirm()}onInput(e){const t=e.target.value;this.state.inputValue=t;const o=Number(t);this.state.errorFlag=Number.isNaN(o)||o<=0||o>1e4}onConfirm(){if(this.state.errorFlag)return;const e=Number(this.state.inputValue),t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getNumberRows(t);this.env.model.dispatch("ADD_COLUMNS_ROWS",{sheetId:t,position:"after",base:o-1,quantity:e,dimension:"ROW"}),this.props.focusGrid();const{scrollX:s}=this.env.model.getters.getActiveSheetDOMScrollInfo(),{end:n}=this.env.model.getters.getRowDimensions(t,o+e-1);this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:s,offsetY:n})}onExternalClick(e){this.inputRef.el===document.activeElement&&e.target!==this.inputRef.el&&this.props.focusGrid()}}function wE(e,...o){t.useEffect((e=>(e?.addEventListener(...o),()=>e?.removeEventListener(...o))),(()=>[e.el]))}function yE(e,o,s){let n={col:void 0,row:void 0};const{Date:i}=window;let r=0,a=0,l=0;function c(){return{col:e.model.getters.getColIndex(r),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let s;const{setInterval:n,clearInterval:i}=window;return t.useEffect((()=>(s=n(e,o),()=>i(s))),(()=>[o])),{pause:()=>{i(s),s=void 0},resume:()=>{void 0===s&&(s=n(e,o))}}}((function(){const{col:e,row:t}=c(),o=i.now()-l;o>300&&(e!==n.col||t!==n.row)&&g(void 0,void 0);if(o>300){if(e<0||t<0)return;g(e,t)}}),200);function u(e){o.el===e.target&&(r=e.offsetX,a=e.offsetY,l=i.now())}function g(e,t){e===n.col&&t===n.row||(n.col=e,n.row=t,s({col:e,row:t}))}return wE(o,"mousemove",u),wE(o,"mouseleave",(function(e){const t=e.offsetX,s=e.offsetY,n=Rr(o.el);return s<0||s>n.height||t<0||t>n.width?u(e):h()})),wE(o,"mouseenter",d),wE(o,"mousedown",(function(){const{col:e,row:t}=c();e===n.col&&t===n.row||g(void 0,void 0)})),t.useExternalListener(window,"click",(function(e){const t=e.target;o.el.contains(t)||g(void 0,void 0)})),n}ur`
1257
+ `;class EE extends t.Component{static template="o-spreadsheet-GridAddRowsFooter";static props={focusGrid:Function};static components={ValidationMessages:IS};inputRef=t.useRef("inputRef");state=t.useState({inputValue:"100",errorFlag:!1});setup(){t.useExternalListener(window,"click",this.onExternalClick,{capture:!0})}get addRowsPosition(){const e=this.env.model.getters.getActiveSheetId(),{numberOfRows:t}=this.env.model.getters.getSheetSize(e),{scrollY:o}=this.env.model.getters.getActiveSheetScrollInfo();return mr({top:`${this.env.model.getters.getRowDimensions(e,t-1).end-o}px`})}get errorMessages(){return[eo("Please enter a number between 0 and 10000.")]}onKeydown(e){"ESCAPE"===e.key.toUpperCase()?this.props.focusGrid():"ENTER"===e.key.toUpperCase()&&this.onConfirm()}onInput(e){const t=e.target.value;this.state.inputValue=t;const o=Number(t);this.state.errorFlag=Number.isNaN(o)||o<=0||o>1e4}onConfirm(){if(this.state.errorFlag)return;const e=Number(this.state.inputValue),t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getNumberRows(t);this.env.model.dispatch("ADD_COLUMNS_ROWS",{sheetId:t,position:"after",base:o-1,quantity:e,dimension:"ROW"}),this.props.focusGrid();const{scrollX:s}=this.env.model.getters.getActiveSheetDOMScrollInfo(),{end:n}=this.env.model.getters.getRowDimensions(t,o+e-1);this.env.model.dispatch("SET_VIEWPORT_OFFSET",{offsetX:s,offsetY:n})}onExternalClick(e){this.inputRef.el===document.activeElement&&e.target!==this.inputRef.el&&this.props.focusGrid()}}function wE(e,...o){t.useEffect((e=>(e?.addEventListener(...o),()=>e?.removeEventListener(...o))),(()=>[e.el]))}function yE(e,o,s){let n={col:void 0,row:void 0};const{Date:i}=window;let r,a,l=0;function c(){if(void 0===r||void 0===a)return{col:-1,row:-1};return{col:e.model.getters.getColIndex(r),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let s;const{setInterval:n,clearInterval:i}=window;return t.useEffect((()=>(s=n(e,o),()=>i(s))),(()=>[o])),{pause:()=>{i(s),s=void 0},resume:()=>{void 0===s&&(s=n(e,o))}}}((function(){const{col:e,row:t}=c(),o=i.now()-l;o>300&&(e!==n.col||t!==n.row)&&g(void 0,void 0);if(o>300){if(e<0||t<0)return;g(e,t)}}),200);function u(e){o.el===e.target&&(r=e.offsetX,a=e.offsetY,l=i.now())}function g(e,t){e===n.col&&t===n.row||(n.col=e,n.row=t,s({col:e,row:t}))}return wE(o,"mousemove",u),wE(o,"mouseleave",(function(e){const t=e.offsetX,s=e.offsetY,n=Rr(o.el);return s<0||s>n.height||t<0||t>n.width?u(e):h()})),wE(o,"mouseenter",d),wE(o,"mousedown",(function(){const{col:e,row:t}=c();e===n.col&&t===n.row||g(void 0,void 0)})),t.useExternalListener(window,"click",(function(e){const t=e.target;o.el.contains(t)||g(void 0,void 0)})),n}ur`
1258
1258
  .o-paint-format-cursor {
1259
1259
  cursor: url("data:image/svg+xml,${encodeURIComponent('\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="16"><path d="M6.5.4c1.3-.8 2.9-.1 3.8 1.4l2.9 5.1c.2.4.9 1.6-.4 2.3l-1.6.9 1.8 3.1c.2.4.1 1-.2 1.2l-1.6 1c-.3.1-.9 0-1.1-.4l-1.8-3.1-1.6 1c-.6.4-1.7 0-2.2-.8L0 4.3"/><path fill="#fff" d="M9.1 2a1.4 1.1 60 0 0-1.7-.6L5.5 2.5l.9 1.6-1 .6-.9-1.6-.6.4 1.8 3.1-1.3.7-1.8-3.1-1 .6 3.8 6.6 6.8-3.98M3.9 8.8 10.82 5l.795 1.4-6.81 3.96"/></svg>\n')}"), auto;
1260
1260
  }
@@ -2599,4 +2599,4 @@
2599
2599
  <tableParts count="${e.filterTables.length}">
2600
2600
  ${Py(a)}
2601
2601
  </tableParts>
2602
- `}var hA;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(hA||(hA={}));function dA(e,t={}){const o=le(t);return o.type=e,o}const uA={},gA={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:I,HEADER_WIDTH:R,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:T,DEFAULT_CELL_HEIGHT:A,SCROLLBAR_WIDTH:O},pA={autofillModifiersRegistry:sr,autofillRulesRegistry:nr,cellMenuRegistry:Ov,colMenuRegistry:mS,errorTypes:wo,linkMenuRegistry:Ta,functionRegistry:Jf,featurePluginRegistry:DR,statefulUIPluginRegistry:LR,coreViewsPluginRegistry:PR,corePluginRegistry:FR,rowMenuRegistry:bS,sidePanelRegistry:PC,figureRegistry:Rl,chartSidePanelComponentRegistry:ZS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:SS,topbarComponentRegistry:kC,clickableCellRegistry:kR,otRegistry:CS,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:fS,repeatLocalCommandTransformRegistry:ER,repeatCommandTransformRegistry:CR},mA={arg:Sc,isEvaluationError:Mo,toBoolean:Go,toJsDate:Wo,toNumber:Fo,toString:Bo,toXC:pt,toZone:dn,toUnboundedZone:hn,toCartesian:gt,numberToLetters:lt,lettersToNumber:ht,UuidGenerator:oi,formatValue:xs,createCurrencyFormat:Bs,computeTextWidth:Zn,createEmptyWorkbookData:vx,createEmptySheet:fx,createEmptyExcelSheet:bx,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,getFillingMode:Qa,rgbaToHex:ot,colorToRGBA:st,positionToZone:Fn,isDefined:Ie,isMatrix:bo,lazy:_e,genericRepeat:wR,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Fe},fA={isMarkdownLink:ve,parseMarkdownLink:Ce,markdownLink:Se,openLink:Yi,urlRepresentation:Zi},vA={Checkbox:RS,Section:TS,ChartColor:US,ChartDataSeries:AS,ChartErrorSection:OS,ChartLabelRange:_S,ChartTitle:BS,ChartPanel:YS,ChartFigure:yl,ChartJsComponent:li,Grid:UE,GridOverlay:xE,ScorecardChart:Bi,LineConfigPanel:WS,LineBarPieDesignPanel:HS,BarConfigPanel:NS,LineBarPieConfigPanel:MS,GaugeChartConfigPanel:zS,GaugeChartDesignPanel:GS,ScorecardChartConfigPanel:$S,ScorecardChartDesignPanel:qS,FigureComponent:VC,Menu:Hr,SelectionInput:xS,ValidationMessages:IS},bA={useDragAndDropListItems:JS};const SA={DEFAULT_LOCALE:fo};e.AbstractChart=ci,e.CellErrorType=Eo,e.CorePlugin=Cx,e.DispatchResult=ho,e.EvaluationError=yo,e.Model=class extends YI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],n=new oi,i=!0){super(),Kt===jt&&Qt===Xt&&(Qt=()=>!0),s=gx(e,s);const r=dx(e,i);this.state=new wT,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new iI(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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ET(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of FR.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of PR.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of LR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of DR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave(this.exportData())}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new iR(bT({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(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){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:eo("Anonymous").toString()},o=e.transportService||new cT;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(mo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=co(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new ho(t.flat()):ho.Success}checkDispatchAllowedCoreCommand(e){const 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(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(dA(e,t));dispatch=(e,t)=>{const o=dA(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!ao.has(n.type)))return new ho("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new ho("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{co(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(co(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(co(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return ho.Success};dispatchFromCorePlugin=(e,t)=>{const o=dA(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,ho.Success};dispatchToHandlers(e,t){const o=co(t);for(const s of e)!o&&s instanceof Cx||s.beforeHandle(t);for(const s of e)!o&&s instanceof Cx||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=vx();for(let t of this.handlers)t instanceof Cx&&t.export(e);return e.revisionId=this.session.getRevisionId()||$,e=le(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...vx(),sheets:[bx(hx,"Sheet1")]};for(let t of this.handlers)t instanceof Sx&&t.exportForExcel(e);return e=le(e),lA(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=sR,e.SPREADSHEET_DIMENSIONS=gA,e.Spreadsheet=lT,e.UIPlugin=rI,e.__info__=uA,e.addFunction=function e(t,o){return Jf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=Bx,e.compile=Zx,e.compileTokens=Yx,e.components=vA,e.constants=SA,e.convertAstNodes=Px,e.coreTypes=lo,e.findCellInNewZone=Mn,e.functionCache=qx,e.helpers=mA,e.hooks=bA,e.invalidateCFEvaluationCommands=ro,e.invalidateDependenciesCommands=io,e.invalidateEvaluationCommands=no,e.iterateAstNodes=kx,e.links=fA,e.load=dx,e.parse=Dx,e.parseTokens=Lx,e.readonlyAllowedCommands=ao,e.registries=pA,e.setDefaultSheetViewSize=function(e){oe=e},e.setTranslationMethod=function(e,t=(()=>!0)){Kt=e,Qt=t},e.tokenize=qr,uA.version="17.1.23",uA.date="2024-07-11T06:37:01.931Z",uA.hash="31e8450"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2602
+ `}var hA;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(hA||(hA={}));function dA(e,t={}){const o=le(t);return o.type=e,o}const uA={},gA={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:I,HEADER_WIDTH:R,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:T,DEFAULT_CELL_HEIGHT:A,SCROLLBAR_WIDTH:O},pA={autofillModifiersRegistry:sr,autofillRulesRegistry:nr,cellMenuRegistry:Ov,colMenuRegistry:mS,errorTypes:wo,linkMenuRegistry:Ta,functionRegistry:Jf,featurePluginRegistry:DR,statefulUIPluginRegistry:LR,coreViewsPluginRegistry:PR,corePluginRegistry:FR,rowMenuRegistry:bS,sidePanelRegistry:PC,figureRegistry:Rl,chartSidePanelComponentRegistry:ZS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:SS,topbarComponentRegistry:kC,clickableCellRegistry:kR,otRegistry:CS,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:fS,repeatLocalCommandTransformRegistry:ER,repeatCommandTransformRegistry:CR},mA={arg:Sc,isEvaluationError:Mo,toBoolean:Go,toJsDate:Wo,toNumber:Fo,toString:Bo,toXC:pt,toZone:dn,toUnboundedZone:hn,toCartesian:gt,numberToLetters:lt,lettersToNumber:ht,UuidGenerator:oi,formatValue:xs,createCurrencyFormat:Bs,computeTextWidth:Zn,createEmptyWorkbookData:vx,createEmptySheet:fx,createEmptyExcelSheet:bx,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,getFillingMode:Qa,rgbaToHex:ot,colorToRGBA:st,positionToZone:Fn,isDefined:Ie,isMatrix:bo,lazy:_e,genericRepeat:wR,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Fe},fA={isMarkdownLink:ve,parseMarkdownLink:Ce,markdownLink:Se,openLink:Yi,urlRepresentation:Zi},vA={Checkbox:RS,Section:TS,ChartColor:US,ChartDataSeries:AS,ChartErrorSection:OS,ChartLabelRange:_S,ChartTitle:BS,ChartPanel:YS,ChartFigure:yl,ChartJsComponent:li,Grid:UE,GridOverlay:xE,ScorecardChart:Bi,LineConfigPanel:WS,LineBarPieDesignPanel:HS,BarConfigPanel:NS,LineBarPieConfigPanel:MS,GaugeChartConfigPanel:zS,GaugeChartDesignPanel:GS,ScorecardChartConfigPanel:$S,ScorecardChartDesignPanel:qS,FigureComponent:VC,Menu:Hr,SelectionInput:xS,ValidationMessages:IS},bA={useDragAndDropListItems:JS};const SA={DEFAULT_LOCALE:fo};e.AbstractChart=ci,e.CellErrorType=Eo,e.CorePlugin=Cx,e.DispatchResult=ho,e.EvaluationError=yo,e.Model=class extends YI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},s=[],n=new oi,i=!0){super(),Kt===jt&&Qt===Xt&&(Qt=()=>!0),s=gx(e,s);const r=dx(e,i);this.state=new wT,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new iI(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.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ET(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of FR.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of PR.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of LR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of DR.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave(this.exportData())}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new iR(bT({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(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){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:eo("Anonymous").toString()},o=e.transportService||new cT;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e})}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(mo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat}}checkDispatchAllowed(e){const t=co(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new ho(t.flat()):ho.Success}checkDispatchAllowedCoreCommand(e){const 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(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(dA(e,t));dispatch=(e,t)=>{const o=dA(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!ao.has(n.type)))return new ho("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new ho("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:n}=this.state.recordChanges((()=>{co(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,n,s),this.status=0,this.trigger("update");break;case 1:if(co(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(co(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return ho.Success};dispatchFromCorePlugin=(e,t)=>{const o=dA(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,ho.Success};dispatchToHandlers(e,t){const o=co(t);for(const s of e)!o&&s instanceof Cx||s.beforeHandle(t);for(const s of e)!o&&s instanceof Cx||s.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=vx();for(let t of this.handlers)t instanceof Cx&&t.export(e);return e.revisionId=this.session.getRevisionId()||$,e=le(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...vx(),sheets:[bx(hx,"Sheet1")]};for(let t of this.handlers)t instanceof Sx&&t.exportForExcel(e);return e=le(e),lA(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=sR,e.SPREADSHEET_DIMENSIONS=gA,e.Spreadsheet=lT,e.UIPlugin=rI,e.__info__=uA,e.addFunction=function e(t,o){return Jf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=Bx,e.compile=Zx,e.compileTokens=Yx,e.components=vA,e.constants=SA,e.convertAstNodes=Px,e.coreTypes=lo,e.findCellInNewZone=Mn,e.functionCache=qx,e.helpers=mA,e.hooks=bA,e.invalidateCFEvaluationCommands=ro,e.invalidateDependenciesCommands=io,e.invalidateEvaluationCommands=no,e.iterateAstNodes=kx,e.links=fA,e.load=dx,e.parse=Dx,e.parseTokens=Lx,e.readonlyAllowedCommands=ao,e.registries=pA,e.setDefaultSheetViewSize=function(e){oe=e},e.setTranslationMethod=function(e,t=(()=>!0)){Kt=e,Qt=t},e.tokenize=qr,uA.version="17.1.25",uA.date="2024-07-24T10:26:01.576Z",uA.hash="0edff47"}(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 17.1.23
5
- @date 2024-07-11T06:37:35.608Z
6
- @hash 31e8450
4
+ @version 17.1.25
5
+ @date 2024-07-24T10:26:35.452Z
6
+ @hash 0edff47
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": "17.1.23",
3
+ "version": "17.1.25",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",