@odoo/o-spreadsheet 17.0.30 → 17.0.31
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.0.
|
|
6
|
-
* @date 2024-07-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.31
|
|
6
|
+
* @date 2024-07-18T14:22:00.324Z
|
|
7
|
+
* @hash c64db0d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -2524,7 +2524,7 @@ function getPredicate(descr, isQuery, locale) {
|
|
|
2524
2524
|
operand = descr;
|
|
2525
2525
|
}
|
|
2526
2526
|
}
|
|
2527
|
-
if (isNumber(operand, locale)) {
|
|
2527
|
+
if (isNumber(operand, locale) || isDateTime(operand, locale)) {
|
|
2528
2528
|
operand = toNumber(operand, locale);
|
|
2529
2529
|
}
|
|
2530
2530
|
else if (operand === "TRUE" || operand === "FALSE") {
|
|
@@ -57578,6 +57578,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57578
57578
|
exports.tokenize = tokenize;
|
|
57579
57579
|
|
|
57580
57580
|
|
|
57581
|
-
__info__.version = "17.0.
|
|
57582
|
-
__info__.date = "2024-07-
|
|
57583
|
-
__info__.hash = "
|
|
57581
|
+
__info__.version = "17.0.31";
|
|
57582
|
+
__info__.date = "2024-07-18T14:22:00.324Z";
|
|
57583
|
+
__info__.hash = "c64db0d";
|
|
@@ -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.0.
|
|
6
|
-
* @date 2024-07-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.31
|
|
6
|
+
* @date 2024-07-18T14:22:00.324Z
|
|
7
|
+
* @hash c64db0d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -2522,7 +2522,7 @@ function getPredicate(descr, isQuery, locale) {
|
|
|
2522
2522
|
operand = descr;
|
|
2523
2523
|
}
|
|
2524
2524
|
}
|
|
2525
|
-
if (isNumber(operand, locale)) {
|
|
2525
|
+
if (isNumber(operand, locale) || isDateTime(operand, locale)) {
|
|
2526
2526
|
operand = toNumber(operand, locale);
|
|
2527
2527
|
}
|
|
2528
2528
|
else if (operand === "TRUE" || operand === "FALSE") {
|
|
@@ -57541,6 +57541,6 @@ const constants = {
|
|
|
57541
57541
|
export { AbstractChart, 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 };
|
|
57542
57542
|
|
|
57543
57543
|
|
|
57544
|
-
__info__.version = "17.0.
|
|
57545
|
-
__info__.date = "2024-07-
|
|
57546
|
-
__info__.hash = "
|
|
57544
|
+
__info__.version = "17.0.31";
|
|
57545
|
+
__info__.date = "2024-07-18T14:22:00.324Z";
|
|
57546
|
+
__info__.hash = "c64db0d";
|
|
@@ -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.0.
|
|
6
|
-
* @date 2024-07-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.31
|
|
6
|
+
* @date 2024-07-18T14:22:00.324Z
|
|
7
|
+
* @hash c64db0d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -2523,7 +2523,7 @@
|
|
|
2523
2523
|
operand = descr;
|
|
2524
2524
|
}
|
|
2525
2525
|
}
|
|
2526
|
-
if (isNumber(operand, locale)) {
|
|
2526
|
+
if (isNumber(operand, locale) || isDateTime(operand, locale)) {
|
|
2527
2527
|
operand = toNumber(operand, locale);
|
|
2528
2528
|
}
|
|
2529
2529
|
else if (operand === "TRUE" || operand === "FALSE") {
|
|
@@ -57577,9 +57577,9 @@
|
|
|
57577
57577
|
exports.tokenize = tokenize;
|
|
57578
57578
|
|
|
57579
57579
|
|
|
57580
|
-
__info__.version = "17.0.
|
|
57581
|
-
__info__.date = "2024-07-
|
|
57582
|
-
__info__.hash = "
|
|
57580
|
+
__info__.version = "17.0.31";
|
|
57581
|
+
__info__.date = "2024-07-18T14:22:00.324Z";
|
|
57582
|
+
__info__.hash = "c64db0d";
|
|
57583
57583
|
|
|
57584
57584
|
|
|
57585
57585
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(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 a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",k="#BCBCBC",V="#9B359B",U=["#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"],B=26,H=48,z=96,G=23,$=15,W=18,q=14,Z=4,Y=Z,j=21,X=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!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"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(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]=Te(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 Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(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 Ne(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*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function ke(e){return Le.test(e)}function Ve(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ht(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function je(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>je((()=>e(s()))),s}function Xe(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(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(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){return t.every((t=>e.includes(t)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=["\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))],ot=new RegExp(tt.join("|")+"|(\r\n|\r|\n)","g");function st(e){return e?ot.test(e)?e.replace(ot,((e,t)=>t?ye:" ")):e:""}function nt(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 it 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 rt(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 at(e,t){return e.filter(((e,o)=>!t.includes(o)))}function lt(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ct(e,t,o){return t>o?ct(e,o,t):e>=t&&e<=o}function ht(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 dt(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 ut=/rgba?\(|\s+|\)/gi,gt=/^#([A-F\d]{2}){3,4}$/,pt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function mt(e){return ft(e.toString(16).padStart(6,"0"))}function ft(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(ut,"").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"#"+Ye(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}`),!gt.test(t))throw new Error(`invalid color input: ${e}`);return t}function bt(e){try{return ft(e),!0}catch(e){return!1}}const vt=e=>e>=0&&e<=255;function St(e,t,o,s=1){if(!vt(e)||!vt(t)||!vt(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 Ct(e){let{r:t,g:o,b:s}=wt(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 Et(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 wt(e){let t,o,s,n;if(7===(e=ft(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 yt(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 xt(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 It(e){return Et(yt(e))}function Rt(e){return xt(wt(e))}function Tt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tt(Math.floor(e/26)-1)+Tt(e%26)}const At={};for(const BT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const HT=BT.charCodeAt(0)-64;At[BT]=HT,At[BT.toLowerCase()]=HT}function Ot(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=At[e[s]]*o,o*=26}return t}function _t(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Mt(e){return e>="0"&&e<="9"}function Nt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||_t(s))continue;t=o}if(!Mt(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=Ot(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Ft(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Tt(e)+(o.rowFixed?"$":"")+String(t+1)}class Dt{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 Dt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Dt(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 Lt=new Dt(1899,11,30),Pt=864e5,kt=2e3,Vt=Dt.now().getFullYear(),Ut=Dt.now().getMonth(),Bt=Dt.fromTimestamp(0).getTime()-Lt.getTime(),Ht=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,zt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gt=/\/|-|\s/,$t=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Wt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function qt(e,t){switch(typeof e){case"number":return e;case"string":return Zt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Zt(e,t){return null!==jt(e,t)}const Yt=new Map;function jt(e,t){return Yt.has(t)||Yt.set(t,new Map),Yt.get(t).has(e)||Yt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Wt);if(s){if(o=function(e){if(e=e.trim(),Wt.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 Dt(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($t);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(Gt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ut;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 Vt;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Vt+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 Dt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Lt.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($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Pt),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 Dt(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)),Yt.get(t).get(e)}function Xt(e){const t=Math.trunc(e);let o=Dt.fromTimestamp(t*Pt-Bt),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 Kt(e){return Math.round(Qt(e))}function Qt(e){return(e.getTime()-Lt.getTime())/Pt}function Jt(e){return new Dt(e.getFullYear(),e.getMonth()+1,0).getDate()}function eo(e){return Jt(e)===e.getDate()}function to(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Dt(s,n+t,1);return o&&i===Jt(e)||i>Jt(r)?r.setDate(Jt(r)):r.setDate(i),r}function oo(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function so(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Xt(e),n=Xt(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===(oo(c)?29:28)&&(i=30,1===l&&r===(oo(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+=oo(o)?366:365;o=t/e}else s?oo(c)&&(o=366):(oo(c)&&a<2&&(o=366),oo(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 no(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function io(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Pt)}function ro(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 ao(e,t,o){return t>o?ao(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const lo=rt((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),co=rt((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(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 ho(e,t){return!!e&&co(t).test(e.trim())}const uo=rt((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function go(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(uo(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function po(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)}var mo,fo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(mo||(mo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(fo||(fo={}));const bo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),vo=new Set([...bo,"MOVE_RANGES"]),So=new Set([...bo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Co=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"]),Eo=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 wo(e){return Eo.has(e.type)}class yo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return xo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const xo=new yo;var Io;e.CommandResult=void 0,(Io=e.CommandResult||(e.CommandResult={})).Success="Success",Io.CancelledForUnknownReason="CancelledForUnknownReason",Io.WillRemoveExistingMerge="WillRemoveExistingMerge",Io.MergeIsDestructive="MergeIsDestructive",Io.CellIsMerged="CellIsMerged",Io.InvalidTarget="InvalidTarget",Io.EmptyUndoStack="EmptyUndoStack",Io.EmptyRedoStack="EmptyRedoStack",Io.NotEnoughElements="NotEnoughElements",Io.NotEnoughSheets="NotEnoughSheets",Io.MissingSheetName="MissingSheetName",Io.UnchangedSheetName="UnchangedSheetName",Io.DuplicatedSheetName="DuplicatedSheetName",Io.DuplicatedSheetId="DuplicatedSheetId",Io.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Io.WrongSheetMove="WrongSheetMove",Io.WrongSheetPosition="WrongSheetPosition",Io.InvalidAnchorZone="InvalidAnchorZone",Io.SelectionOutOfBound="SelectionOutOfBound",Io.TargetOutOfSheet="TargetOutOfSheet",Io.WrongCutSelection="WrongCutSelection",Io.WrongPasteSelection="WrongPasteSelection",Io.WrongPasteOption="WrongPasteOption",Io.WrongFigurePasteOption="WrongFigurePasteOption",Io.EmptyClipboard="EmptyClipboard",Io.EmptyRange="EmptyRange",Io.InvalidRange="InvalidRange",Io.InvalidZones="InvalidZones",Io.InvalidSheetId="InvalidSheetId",Io.InvalidFigureId="InvalidFigureId",Io.InputAlreadyFocused="InputAlreadyFocused",Io.MaximumRangesReached="MaximumRangesReached",Io.MinimumRangesReached="MinimumRangesReached",Io.InvalidChartDefinition="InvalidChartDefinition",Io.InvalidDataSet="InvalidDataSet",Io.InvalidLabelRange="InvalidLabelRange",Io.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Io.InvalidScorecardBaseline="InvalidScorecardBaseline",Io.InvalidGaugeDataRange="InvalidGaugeDataRange",Io.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Io.GaugeRangeMinNaN="GaugeRangeMinNaN",Io.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Io.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Io.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Io.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Io.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Io.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Io.InvalidAutofillSelection="InvalidAutofillSelection",Io.WrongComposerSelection="WrongComposerSelection",Io.MinBiggerThanMax="MinBiggerThanMax",Io.LowerBiggerThanUpper="LowerBiggerThanUpper",Io.MidBiggerThanMax="MidBiggerThanMax",Io.MinBiggerThanMid="MinBiggerThanMid",Io.FirstArgMissing="FirstArgMissing",Io.SecondArgMissing="SecondArgMissing",Io.MinNaN="MinNaN",Io.MidNaN="MidNaN",Io.MaxNaN="MaxNaN",Io.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Io.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Io.MinInvalidFormula="MinInvalidFormula",Io.MidInvalidFormula="MidInvalidFormula",Io.MaxInvalidFormula="MaxInvalidFormula",Io.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Io.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Io.InvalidSortZone="InvalidSortZone",Io.WaitingSessionConfirmation="WaitingSessionConfirmation",Io.MergeOverlap="MergeOverlap",Io.TooManyHiddenElements="TooManyHiddenElements",Io.Readonly="Readonly",Io.InvalidViewportSize="InvalidViewportSize",Io.InvalidScrollingDirection="InvalidScrollingDirection",Io.FigureDoesNotExist="FigureDoesNotExist",Io.InvalidConditionalFormatId="InvalidConditionalFormatId",Io.InvalidCellPopover="InvalidCellPopover",Io.EmptyTarget="EmptyTarget",Io.InvalidFreezeQuantity="InvalidFreezeQuantity",Io.FrozenPaneOverlap="FrozenPaneOverlap",Io.ValuesNotChanged="ValuesNotChanged",Io.InvalidFilterZone="InvalidFilterZone",Io.FilterOverlap="FilterOverlap",Io.FilterNotFound="FilterNotFound",Io.MergeInFilter="MergeInFilter",Io.NonContinuousTargets="NonContinuousTargets",Io.DuplicatedFigureId="DuplicatedFigureId",Io.InvalidSelectionStep="InvalidSelectionStep",Io.DuplicatedChartId="DuplicatedChartId",Io.ChartDoesNotExist="ChartDoesNotExist",Io.InvalidHeaderIndex="InvalidHeaderIndex",Io.InvalidQuantity="InvalidQuantity",Io.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Io.EmptySplitSeparator="EmptySplitSeparator",Io.SplitWillOverwriteContent="SplitWillOverwriteContent",Io.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Io.NoActiveSheet="NoActiveSheet",Io.InvalidLocale="InvalidLocale",Io.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Io.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Io.NoColumnsProvided="NoColumnsProvided",Io.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Io.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Io.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Io.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Io.UnknownHeaderGroup="UnknownHeaderGroup",Io.UnknownDataValidationRule="UnknownDataValidationRule",Io.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Io.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Io.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Io.BlockingValidationRule="BlockingValidationRule",Io.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Io.NoChanges="NoChanges",Io.InvalidInputId="InvalidInputId";const Ro=[{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:";"}],To=Ro[0],Ao=["thin","medium","thick","dashed","dotted"];function Oo(e){return Array.isArray(e)&&Array.isArray(e[0])}var _o,Mo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(_o||(_o={})),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"}(Mo||(Mo={}));const No=["number","string","boolean","undefined"];function Fo(e,t){if(!e())throw new d(c.GenericError,t)}const Do=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Lo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(ho(e,t)||""===e)return go(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Do(e));default:return 0}}function Po(e,t){try{return Lo(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Vo(e,t){if(""===e)throw new Error(Do(e));return Lo(e,t)}function Uo(e,t){return Math.trunc(Lo(e,t))}function Bo(e,t){return Math.trunc(Vo(e,t))}function Ho(e){Fo((()=>e>=1),a("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function zo(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Go=rt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),$o=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Wo(e){switch(typeof e){case"boolean":return e;case"string":if(e){let t=e.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1;throw new Error($o(e))}return!1;case"number":return!!e;default:return!1}}function qo(e,t){return Xt(Lo(e,t))}function Zo(e,t,o){for(let s of e)if(Oo(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 Yo(e,t){Zo(e,t,t)}function jo(e,t,o){Zo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Vo(e,o))}))}function Xo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Oo(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 Ko(e,t,o,s="rowFirst"){return Xo(e,t,t,o,s)}function Qo(e,t,o,s){return Xo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Vo(o,s))),o)}function Jo(e,t,o,s){return Xo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Lo(o,s):0):e),((e,o)=>t(e,Lo(o,s))),o)}function es(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 ts(e,t){return 0===e.length?[]:es(e.length,e[0].length,((o,s)=>t(e[o][s])))}function os(e){return e.length?es(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ss(e,t){return function(e,t,o){for(let s of e)if(Oo(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=>"boolean"==typeof e?t(e):"number"!=typeof e||t(!!e)),(e=>null==e||t(function(e){if(""===e)throw new Error($o(e));return Wo(e)}(e))))}function ns(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)),ho(n,o)?n=Lo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Wo(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 is(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return zo(e)===zo(s);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 rs(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=e[0].length,r=e[0][0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=e[t];if(!Oo(n)||n.length!==i||n[0].length!==r)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const c=zo(e[t+1]);l.push(ns(c,s,o))}for(let o=0;o<i;o++)for(let s=0;s<r;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=is(e[t][o][s]??void 0,l[t/2]),!i)break}i&&t(o,s)}}function as(e,t,o,s,n,i){if(null==t)return-1;const r=cs(t),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=cs(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=cs(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 ls(e,t,o,s,n,i=!1){if(null==t)return-1;const r=cs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=cs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&hs(r,n)>=0||hs(r,n)>=0&&hs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&hs(r,n)<=0||hs(r,n)<=0&&hs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function cs(e){return"string"==typeof e?Go(e):e}function hs(e,t){let o=No.indexOf(typeof e)-No.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 ds(e){return void 0===e?[[]]:Oo(e)?e:[[e]]}function us(e,t){return Ko(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function gs(e){const t=Dt.now();switch(e){case"today":return Qt(t);case"yesterday":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Qt(Dt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Qt(Dt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ps(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[gs(e.dateValue)]:e.values.map((e=>qt(e,t)))}function ms(e,t){return e.values.map((e=>Po(e,t)))}function fs(e){return 20+120*Math.exp(-.035*(e-1))}const bs=20,vs=11,Ss=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Cs=/0/g,Es={0:a("January"),1:a("February"),2:a("March"),3:a("April"),4:a("May"),5:a("June"),6:a("July"),7:a("August"),8:a("September"),9:a("October"),10:a("November"),11:a("December")},ws={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},ys={};function xs(e){let t=ys[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);Ns(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Zs(i)})}t=s}return o}(e),ys[e]=t),t}function Is(e,{format:t,locale:o}){switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=Vs(e));return function(e,t,o){if("DATE"===t[0].type)return Ds(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Rs(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,xs(t),o);case"object":return"0"}}function Rs(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}=As(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(Cs)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Ss)?.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(Cs)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Ts=[];function As(e,t=bs){const o=e.toString();if(o.includes("e"))return function(e,t=bs){let o=Ts[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Ts[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(_s)?.[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:Os(i||"")}}function Os(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const _s=/^0+/;function Ms(e,t){const{integerDigits:o,decimalDigits:s}=As(e,20);return s?o+t+s:o}function Ns(e){if(!Fs.has(e[0]))return!1;try{return Ds(1,e),!0}catch(e){return!1}}const Fs=new Set(["h","m","y","d"]);function Ds(e,t){const o=Xt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ls(o,t.substring(0,s-1)),i=Ps(o,t.substring(s))):0===s?i=Ps(o,t):s<0&&(n=Ls(o,t)),n+(n&&i?" ":"")+i}function Ls(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 ws[e.getDay()].slice(0,3);case"dddd":return ws[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Es[e.getMonth()].slice(0,3);case"mmmm":return Es[e.getMonth()];case"mmmmm":return Es[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 Ps(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()-Lt.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 ks=rt((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Vs(e){let{integerDigits:t,decimalDigits:o}=As(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=As(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Us(e,t){if(!Zt(e,t))return;return jt(e,t).format}function Bs(e){if(!ho(e,To))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 Hs(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 zs(e){return js(xs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Gs(e,t,o,s){const n=xs(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 js(i)}function $s(e,t,o){const s=xs(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=js(s);return ys[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),bs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const qs=/,*?$/;function Zs(e){if(function(e){return Boolean(e.replace(Ys,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(qs)?.[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 Ys=/[,#0.%]/g;function js(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 Xs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Js=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Xs.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 sn(e){return en.test(e)}function nn(e){return tn.test(e)}function rn(e){return Qs.test(e)}function an(e){return Js.test(e)}function ln(e){return Ks.test(e)}function cn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}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(sn(r))n=i=Ot(r),o=s=0,a=!0;else if(nn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Nt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(sn(t))i=Ot(t),a=!0;else if(nn(t))s=parseInt(t,10)-1,l=!0;else{const e=Nt(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?`${Ft(s,t)}:${Tt(n)}`:`${Tt(s)}:${Tt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Ft(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Ft(s,t):`${Ft(s,t)}:${Ft(n,o)}`;throw new Error(a("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 bn(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 vn(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 Me(o,s+1))for(const o of Me(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(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=nn(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 $n(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($e)}function Wn(e,t=1){return t*(e+Z)-Z}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":oe} ${Xn(e)}px ${ne}`}function Xn(e){return Yn(e?.fontSize||se)}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(ye)?t.split(ye):[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;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||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?vn(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";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(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(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()}}li.props={figure:Object};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)===le?(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($e),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 bi(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 vi(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($e).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&&Ct(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!on.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(!on.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!==mo.number||e.type!==mo.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 Is(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!==mo.number||o?.type!==mo.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!==mo.number||t?.type!==mo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!on.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!on.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:ge,baselineColorUp:pe,baselineColorDown:me,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 ${ne}`}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 Ct(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";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)}}Bi.props={figure:Object};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 $i(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Wi={createLink:$i,match:e=>ke(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)))||Wi}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(Pe(e)){const{label:t,url:o}=Ue(e);return qi(o).createLink(o,t)}return ke(e)?$i(e):void 0}}function Xi(e,t){return 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 ho(e,To)?Lo(e,To):Zt(e,t)?Lo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t){const o=ji(e);return o?{...Ji(Ki(o.label,t.locale),{format:t.format||Us(o.label,t.locale)||Bs(o.label),locale:t.locale}),link:o}:Ji(e,t)}function Ji(e,t){try{for(const o of sr){const s=o(e,t);if(s)return s}return function(e,t){return{type:mo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Is(e,t)}}((e||"").toString(),t)}catch(e){return or(new d(c.GenericError,e.message||Se))}}function er(e,t){return{type:mo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Is(e,t)}}const tr={type:mo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function or(e){return{type:mo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const sr=[function(e,t){if(""===e)return function(e){return void 0===e.format?tr:{type:mo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ns(t.format))return function(e,t){const o=Is(e,t);return{type:mo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?er(e,t):null===e?er(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:mo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],nr=new Hi;nr.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=Is(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 ir=new Hi,rr=/(\d+)$/,ar=/^(.*\D+)/,lr=/^(.*\D+)(\d+)$/;function cr(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:To});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function hr(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}ir.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ns(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text&&lr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(rr)[0]),s=e.content.match(ar)[0],n=e.content.length-s.length,i=cr(e,t,(e=>e.type===mo.text&&lr.test(e.value))).filter((e=>s===e.value.toString().match(ar)[0])).map((e=>parseInt(e.value.toString().match(rr)[0]))),r=hr(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:To}).type===mo.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:To}).type===mo.number,generateRule:(e,t)=>{const o=hr(cr(e,t,(e=>e.type===mo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:To});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===mo.number?s.value:0}},sequence:40});const dr={};let ur=0;function gr(e,...t){const o="__sheet__"+ur++;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),dr[e]=o}(o,String.raw(e,...t)),function(e){const t=dr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function pr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function mr(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 fr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}gr`
|
|
1
|
+
!function(e,t){"use strict";const o=e=>e,s=()=>!1;let n=o,i=s;function r(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 a=function(e,...t){return i()?r(n(e),...t):new l(e,t)};class l extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){const e=super.valueOf();return i()?r(n(e),...this.values):r(e,...this.values)}toString(){return this.valueOf()}}var c,h;!function(e){e.NotAvailable="#N/A",e.InvalidReference="#REF",e.BadExpression="#BAD_EXPR",e.CircularDependency="#CYCLE",e.UnknownFunction="#NAME?",e.GenericError="#ERROR"}(c||(c={})),function(e){e[e.silent=0]="silent",e[e.error=1]="error"}(h||(h={}));class d extends Error{errorType;logLevel;constructor(e,t,o=h.error){super(t),this.errorType=e,this.logLevel=o}get isVerbose(){return this.logLevel>h.silent}}class u extends d{constructor(e){super(c.BadExpression,e)}}class g extends d{constructor(){super(c.CircularDependency,a("Circular reference"))}}class p extends d{constructor(){super(c.InvalidReference,a("Invalid reference"))}}class m extends d{constructor(e=void 0){super(c.NotAvailable,e||a("Data not available"),e?h.error:h.silent)}}class f extends d{constructor(e){super(c.UnknownFunction,a('Unknown function: "%s"',e))}}const b=.5,v="#f5f5f5",S="#F8F9FA",C="#E8EAED",E="#595959",w="#666666",y="#c9ccd2",x="#3266ca",I="#FFFFFF",R="#EBEBEB",T="#CACACA",A=11982760,O="#01666b",_="#188038",M="#E6F4EA",N="#CEEAD6",F="#E0E2E4",D="#4A4F59",L="#999",P="#E2E3E3",k="#BCBCBC",V="#9B359B",U=["#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"],B=26,H=48,z=96,G=23,$=15,W=18,q=14,Z=4,Y=Z,j=21,X=17,K=2*G,Q=250,J={align:"left",verticalAlign:"bottom",wrapping:"overflow",bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:"",textColor:"#000000"},ee=J.verticalAlign,te=J.wrapping,oe="400",se=J.fontSize,ne="'Roboto', arial",ie="thin",re="#000000",ae={style:"thin",color:_},le=c.InvalidReference,ce="START_REVISION",he=1,de=20,ue="??",ge="difference",pe="#00A04A",me="#DC6965",fe=["'","*","?","/","\\","[","]"],be=/'|\*|\?|\/|\\|\[|\]/,ve="|",Se=a("Invalid expression");var Ce;!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"}(Ce||(Ce={}));let Ee=0;function we(){return Ee}const ye="\n",xe=[6,7,8,9,10,11,12,14,18,24,36];function Ie(e){return'"'===e[0]&&(e=e.slice(1)),'"'===e[e.length-1]&&"\\"!==e[e.length-2]?e.slice(0,e.length-1):e}function Re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(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]=Te(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 Ae(e){return e.startsWith("'")&&(e=e.slice(1,-1).replace(/''/g,"'")),e}function Oe(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function _e(e,t,o){return e<t?t:e>o?o:e}function Me(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 Ne(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*Fe(e,t){t.next();for(const o of e){const e=t.next();yield{...o,next:e.done?void 0:e.value}}}const De=/^\[(.+)\]\((.+)\)$/,Le=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function Pe(e){return De.test(e)}function ke(e){return Le.test(e)}function Ve(e,t){return`[${e}](${t})`}function Ue(e){const t=e.match(De)||[],o=t[1],s=t[2];if(!o||!s)throw new Error(`Could not parse markdown link ${e}.`);return{label:o,url:s}}const Be="o-spreadsheet://";function He(e){return e.startsWith(Be)}function ze(e){return`${Be}${e}`}function Ge(e){if(e.startsWith(Be))return e.substr(Be.length);throw new Error(`${e} is not a valid sheet link`)}function $e(e){return void 0!==e}function We(e){return null!==e}function qe(e){return void 0===e||Object.values(e).every((e=>"object"==typeof e?qe(e):!e))}function Ze(e,t){for(const o in t)if(Qe(t[o],e))return parseInt(o,10);const o=Object.keys(t),s=0===o.length?0:ht(o.map((e=>parseInt(e,10))));return t[s+1]=e,s+1}function Ye(e){let t="";for(let o=0,s=e.length;o<s;o++)t+=e[o];return t}function je(e){let t,o=!1;const s=()=>(o||(t=e instanceof Function?e():e,o=!0),t);return s.map=e=>je((()=>e(s()))),s}function Xe(e,t){let o=e.slice(t).find((e=>e));return o||(o=e.slice(0,t).reverse().find((e=>e))),o||""}function Ke(e,t){return"after"===e?t+1:t}function Qe(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(!Qe(e[o],t[o]))return!1}else if(e[o]!==t[o])return!1}return!0}function Je(e,t){return t.every((t=>e.includes(t)))}function et(e){const t={...e};return Object.keys(t).forEach((e=>!t[e]&&delete t[e])),t}const tt=["\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))],ot=new RegExp(tt.join("|")+"|(\r\n|\r|\n)","g");function st(e){return e?ot.test(e)?e.replace(ot,((e,t)=>t?ye:" ")):e:""}function nt(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 it 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 rt(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 at(e,t){return e.filter(((e,o)=>!t.includes(o)))}function lt(e){return e.split("\n").map((e=>e.replace(/\s+/g," ").trim())).join("\n")}function ct(e,t,o){return t>o?ct(e,o,t):e>=t&&e<=o}function ht(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 dt(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 ut=/rgba?\(|\s+|\)/gi,gt=/^#([A-F\d]{2}){3,4}$/,pt=["#eb6d00","#0074d9","#ad8e00","#169ed4","#b10dc9","#00a82d","#00a3a3","#f012be","#3d9970","#111111","#62A300","#ff4136","#949494","#85144b","#001f3f"];function mt(e){return ft(e.toString(16).padStart(6,"0"))}function ft(e){let t=e;if(e.startsWith("rgb")?t=function(e){const t=e.replace(ut,"").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"#"+Ye(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}`),!gt.test(t))throw new Error(`invalid color input: ${e}`);return t}function bt(e){try{return ft(e),!0}catch(e){return!1}}const vt=e=>e>=0&&e<=255;function St(e,t,o,s=1){if(!vt(e)||!vt(t)||!vt(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 Ct(e){let{r:t,g:o,b:s}=wt(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 Et(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 wt(e){let t,o,s,n;if(7===(e=ft(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 yt(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 xt(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 It(e){return Et(yt(e))}function Rt(e){return xt(wt(e))}function Tt(e){if(e<0)throw new Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tt(Math.floor(e/26)-1)+Tt(e%26)}const At={};for(const BT of"ABCDEFGHIJKLMNOPQRSTUVWXYZ"){const HT=BT.charCodeAt(0)-64;At[BT]=HT,At[BT.toLowerCase()]=HT}function Ot(e){let t=-1;let o=1;for(let s=e.length-1;s>=0;s--){t+=At[e[s]]*o,o*=26}return t}function _t(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function Mt(e){return e>="0"&&e<="9"}function Nt(e){let t;e=e.trim();for(let o=0;o<e.length;o++){const s=e[o];if(!t){if("$"===s&&0===o||_t(s))continue;t=o}if(!Mt(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=Ot(o),i=Number(s)-1;if(isNaN(i))throw new Error(`Invalid cell description: ${e}`);return{col:n,row:i}}function Ft(e,t,o={colFixed:!1,rowFixed:!1}){return(o.colFixed?"$":"")+Tt(e)+(o.rowFixed?"$":"")+String(t+1)}class Dt{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 Dt(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds())}static now(){const e=new Date;return new Dt(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 Lt=new Dt(1899,11,30),Pt=864e5,kt=2e3,Vt=Dt.now().getFullYear(),Ut=Dt.now().getMonth(),Bt=Dt.fromTimestamp(0).getTime()-Lt.getTime(),Ht=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,zt=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gt=/\/|-|\s/,$t=/^(\d{1,4})[\/-\s](\d{1,4})([\/-\s](\d{1,4}))?$/,Wt=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function qt(e,t){switch(typeof e){case"number":return e;case"string":return Zt(e,t)?jt(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Zt(e,t){return null!==jt(e,t)}const Yt=new Map;function jt(e,t){return Yt.has(t)||Yt.set(t,new Map),Yt.get(t).has(e)||Yt.get(t).set(e,function(e,t){e=e.trim();let o=null;const s=e.match(Wt);if(s){if(o=function(e){if(e=e.trim(),Wt.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 Dt(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($t);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(Gt)[0];if(n=function(e,t){let{year:o,month:s,day:n}=e;const i=function(e){if(!e)return Ut;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 Vt;const t=Number(e);switch(e.length){case 1:return kt+t;case 2:return kt+(kt+t>Vt+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 Dt(a,i,r);if(h.getMonth()!==i||h.getDate()!==r)return null;const d=h.getTime()-Lt.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($e).join(t);case"ymd":return[n,i,r].filter($e).join(t);case"dmy":return[r,i,n].filter($e).join(t)}}(e,t,l,c);return{value:Math.round(d/Pt),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 Dt(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)),Yt.get(t).get(e)}function Xt(e){const t=Math.trunc(e);let o=Dt.fromTimestamp(t*Pt-Bt),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 Kt(e){return Math.round(Qt(e))}function Qt(e){return(e.getTime()-Lt.getTime())/Pt}function Jt(e){return new Dt(e.getFullYear(),e.getMonth()+1,0).getDate()}function eo(e){return Jt(e)===e.getDate()}function to(e,t,o){const s=e.getFullYear(),n=e.getMonth(),i=e.getDate(),r=new Dt(s,n+t,1);return o&&i===Jt(e)||i>Jt(r)?r.setDate(Jt(r)):r.setDate(i),r}function oo(e){const t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function so(e,t,o){if(e===t)return 0;if(e>t){const o=t;t=e,e=o}const s=Xt(e),n=Xt(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===(oo(c)?29:28)&&(i=30,1===l&&r===(oo(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+=oo(o)?366:365;o=t/e}else s?oo(c)&&(o=366):(oo(c)&&a<2&&(o=366),oo(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 no(e,t){const o=12*(t.getFullYear()-e.getFullYear())+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?o-1:o}function io(e,t){const o=e.getTime(),s=t.getTime();return Math.floor((s-o)/Pt)}function ro(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 ao(e,t,o){return t>o?ao(e,o,t):(e=Math.trunc(e),t=Math.trunc(t),o=Math.trunc(o),e>=t&&e<=o)}const lo=rt((function(e){return e=Re(e),new RegExp(`(^-?\\d+(${e}?\\d*(e\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)})),co=rt((function(e){const t=Re(e.decimalSeparator),o="(\\s*"+`(\\d+(${Re(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 ho(e,t){return!!e&&co(t).test(e.trim())}const uo=rt((function(e){return new RegExp(`[$€${Re(e.thousandsSeparator||"")}]`,"g")}));function go(e,t){"."!==t.decimalSeparator&&(e=e.replace(t.decimalSeparator,".")),e=e.replace(uo(t),"");let o=Number(e);return isNaN(o)&&e.includes("%")&&(o=Number(e.split("%")[0]),!isNaN(o))?o/100:o}function po(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)}var mo,fo;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(mo||(mo={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(fo||(fo={}));const bo=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","UNDO","REDO","ADD_MERGE","UPDATE_LOCALE"]),vo=new Set([...bo,"MOVE_RANGES"]),So=new Set([...bo,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","CHANGE_CONDITIONAL_FORMAT_PRIORITY"]),Co=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"]),Eo=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 wo(e){return Eo.has(e.type)}class yo{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>"Success"!==e))}static get Success(){return xo}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}const xo=new yo;var Io;e.CommandResult=void 0,(Io=e.CommandResult||(e.CommandResult={})).Success="Success",Io.CancelledForUnknownReason="CancelledForUnknownReason",Io.WillRemoveExistingMerge="WillRemoveExistingMerge",Io.MergeIsDestructive="MergeIsDestructive",Io.CellIsMerged="CellIsMerged",Io.InvalidTarget="InvalidTarget",Io.EmptyUndoStack="EmptyUndoStack",Io.EmptyRedoStack="EmptyRedoStack",Io.NotEnoughElements="NotEnoughElements",Io.NotEnoughSheets="NotEnoughSheets",Io.MissingSheetName="MissingSheetName",Io.UnchangedSheetName="UnchangedSheetName",Io.DuplicatedSheetName="DuplicatedSheetName",Io.DuplicatedSheetId="DuplicatedSheetId",Io.ForbiddenCharactersInSheetName="ForbiddenCharactersInSheetName",Io.WrongSheetMove="WrongSheetMove",Io.WrongSheetPosition="WrongSheetPosition",Io.InvalidAnchorZone="InvalidAnchorZone",Io.SelectionOutOfBound="SelectionOutOfBound",Io.TargetOutOfSheet="TargetOutOfSheet",Io.WrongCutSelection="WrongCutSelection",Io.WrongPasteSelection="WrongPasteSelection",Io.WrongPasteOption="WrongPasteOption",Io.WrongFigurePasteOption="WrongFigurePasteOption",Io.EmptyClipboard="EmptyClipboard",Io.EmptyRange="EmptyRange",Io.InvalidRange="InvalidRange",Io.InvalidZones="InvalidZones",Io.InvalidSheetId="InvalidSheetId",Io.InvalidFigureId="InvalidFigureId",Io.InputAlreadyFocused="InputAlreadyFocused",Io.MaximumRangesReached="MaximumRangesReached",Io.MinimumRangesReached="MinimumRangesReached",Io.InvalidChartDefinition="InvalidChartDefinition",Io.InvalidDataSet="InvalidDataSet",Io.InvalidLabelRange="InvalidLabelRange",Io.InvalidScorecardKeyValue="InvalidScorecardKeyValue",Io.InvalidScorecardBaseline="InvalidScorecardBaseline",Io.InvalidGaugeDataRange="InvalidGaugeDataRange",Io.EmptyGaugeRangeMin="EmptyGaugeRangeMin",Io.GaugeRangeMinNaN="GaugeRangeMinNaN",Io.EmptyGaugeRangeMax="EmptyGaugeRangeMax",Io.GaugeRangeMaxNaN="GaugeRangeMaxNaN",Io.GaugeRangeMinBiggerThanRangeMax="GaugeRangeMinBiggerThanRangeMax",Io.GaugeLowerInflectionPointNaN="GaugeLowerInflectionPointNaN",Io.GaugeUpperInflectionPointNaN="GaugeUpperInflectionPointNaN",Io.GaugeLowerBiggerThanUpper="GaugeLowerBiggerThanUpper",Io.InvalidAutofillSelection="InvalidAutofillSelection",Io.WrongComposerSelection="WrongComposerSelection",Io.MinBiggerThanMax="MinBiggerThanMax",Io.LowerBiggerThanUpper="LowerBiggerThanUpper",Io.MidBiggerThanMax="MidBiggerThanMax",Io.MinBiggerThanMid="MinBiggerThanMid",Io.FirstArgMissing="FirstArgMissing",Io.SecondArgMissing="SecondArgMissing",Io.MinNaN="MinNaN",Io.MidNaN="MidNaN",Io.MaxNaN="MaxNaN",Io.ValueUpperInflectionNaN="ValueUpperInflectionNaN",Io.ValueLowerInflectionNaN="ValueLowerInflectionNaN",Io.MinInvalidFormula="MinInvalidFormula",Io.MidInvalidFormula="MidInvalidFormula",Io.MaxInvalidFormula="MaxInvalidFormula",Io.ValueUpperInvalidFormula="ValueUpperInvalidFormula",Io.ValueLowerInvalidFormula="ValueLowerInvalidFormula",Io.InvalidSortZone="InvalidSortZone",Io.WaitingSessionConfirmation="WaitingSessionConfirmation",Io.MergeOverlap="MergeOverlap",Io.TooManyHiddenElements="TooManyHiddenElements",Io.Readonly="Readonly",Io.InvalidViewportSize="InvalidViewportSize",Io.InvalidScrollingDirection="InvalidScrollingDirection",Io.FigureDoesNotExist="FigureDoesNotExist",Io.InvalidConditionalFormatId="InvalidConditionalFormatId",Io.InvalidCellPopover="InvalidCellPopover",Io.EmptyTarget="EmptyTarget",Io.InvalidFreezeQuantity="InvalidFreezeQuantity",Io.FrozenPaneOverlap="FrozenPaneOverlap",Io.ValuesNotChanged="ValuesNotChanged",Io.InvalidFilterZone="InvalidFilterZone",Io.FilterOverlap="FilterOverlap",Io.FilterNotFound="FilterNotFound",Io.MergeInFilter="MergeInFilter",Io.NonContinuousTargets="NonContinuousTargets",Io.DuplicatedFigureId="DuplicatedFigureId",Io.InvalidSelectionStep="InvalidSelectionStep",Io.DuplicatedChartId="DuplicatedChartId",Io.ChartDoesNotExist="ChartDoesNotExist",Io.InvalidHeaderIndex="InvalidHeaderIndex",Io.InvalidQuantity="InvalidQuantity",Io.MoreThanOneColumnSelected="MoreThanOneColumnSelected",Io.EmptySplitSeparator="EmptySplitSeparator",Io.SplitWillOverwriteContent="SplitWillOverwriteContent",Io.NoSplitSeparatorInSelection="NoSplitSeparatorInSelection",Io.NoActiveSheet="NoActiveSheet",Io.InvalidLocale="InvalidLocale",Io.AlreadyInPaintingFormatMode="AlreadyInPaintingFormatMode",Io.MoreThanOneRangeSelected="MoreThanOneRangeSelected",Io.NoColumnsProvided="NoColumnsProvided",Io.ColumnsNotIncludedInZone="ColumnsNotIncludedInZone",Io.DuplicatesColumnsSelected="DuplicatesColumnsSelected",Io.InvalidHeaderGroupStartEnd="InvalidHeaderGroupStartEnd",Io.HeaderGroupAlreadyExists="HeaderGroupAlreadyExists",Io.UnknownHeaderGroup="UnknownHeaderGroup",Io.UnknownDataValidationRule="UnknownDataValidationRule",Io.UnknownDataValidationCriterionType="UnknownDataValidationCriterionType",Io.InvalidDataValidationCriterionValue="InvalidDataValidationCriterionValue",Io.InvalidNumberOfCriterionValues="InvalidNumberOfCriterionValues",Io.BlockingValidationRule="BlockingValidationRule",Io.InvalidCopyPasteSelection="InvalidCopyPasteSelection",Io.NoChanges="NoChanges",Io.InvalidInputId="InvalidInputId";const Ro=[{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:";"}],To=Ro[0],Ao=["thin","medium","thick","dashed","dotted"];function Oo(e){return Array.isArray(e)&&Array.isArray(e[0])}var _o,Mo;!function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(_o||(_o={})),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"}(Mo||(Mo={}));const No=["number","string","boolean","undefined"];function Fo(e,t){if(!e())throw new d(c.GenericError,t)}const Do=e=>a("The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.",e);function Lo(e,t){switch(typeof e){case"number":return e;case"boolean":return e?1:0;case"string":if(ho(e,t)||""===e)return go(e,t);const o=jt(e,t);if(o)return o.value;throw new Error(Do(e));default:return 0}}function Po(e,t){try{return Lo(e,t)}catch(e){return}}function ko(e,t){return e.forEach((e=>{e.forEach((e=>{if("number"!=typeof e)throw new Error(a("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.",typeof e,t))}))})),e}function Vo(e,t){if(""===e)throw new Error(Do(e));return Lo(e,t)}function Uo(e,t){return Math.trunc(Lo(e,t))}function Bo(e,t){return Math.trunc(Vo(e,t))}function Ho(e){Fo((()=>e>=1),a("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.",e.toString()))}function zo(e){switch(typeof e){case"string":return e;case"number":return e.toString();case"boolean":return e?"TRUE":"FALSE";default:return""}}const Go=rt((function(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"")})),$o=e=>a("The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a number.",e);function Wo(e){switch(typeof e){case"boolean":return e;case"string":if(e){let t=e.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1;throw new Error($o(e))}return!1;case"number":return!!e;default:return!1}}function qo(e,t){return Xt(Lo(e,t))}function Zo(e,t,o){for(let s of e)if(Oo(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 Yo(e,t){Zo(e,t,t)}function jo(e,t,o){Zo(e,(e=>{"number"==typeof e&&t(e)}),(e=>{t(Vo(e,o))}))}function Xo(e,t,o,s,n="rowFirst"){let i=s;for(let s of e)if(Oo(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 Ko(e,t,o,s="rowFirst"){return Xo(e,t,t,o,s)}function Qo(e,t,o,s){return Xo(e,((e,o)=>"number"==typeof o?t(e,o):e),((e,o)=>t(e,Vo(o,s))),o)}function Jo(e,t,o,s){return Xo(e,((e,o)=>null!=o?t(e,"number"==typeof o?o:"boolean"==typeof o?Lo(o,s):0):e),((e,o)=>t(e,Lo(o,s))),o)}function es(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 ts(e,t){return 0===e.length?[]:es(e.length,e[0].length,((o,s)=>t(e[o][s])))}function os(e){return e.length?es(e[0].length,e.length,((t,o)=>e[o][t])):[]}function ss(e,t){return function(e,t,o){for(let s of e)if(Oo(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=>"boolean"==typeof e?t(e):"number"!=typeof e||t(!!e)),(e=>null==e||t(function(e){if(""===e)throw new Error($o(e));return Wo(e)}(e))))}function ns(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)),ho(n,o)||Zt(n,o)?n=Lo(n,o):"TRUE"!==n&&"FALSE"!==n||(n=Wo(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 is(e="",t){const{operator:o,operand:s}=t;if(void 0===s||null===e||null===s)return!1;if("number"==typeof s&&"="===o)return zo(e)===zo(s);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 rs(e,t,o,s=!1){const n=e.length;if(n%2==1)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs."));const i=e[0].length,r=e[0][0].length;let l=[];for(let t=0;t<n-1;t+=2){const n=e[t];if(!Oo(n)||n.length!==i||n[0].length!==r)throw new Error(a("Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension"));const c=zo(e[t+1]);l.push(ns(c,s,o))}for(let o=0;o<i;o++)for(let s=0;s<r;s++){let i=!0;for(let t=0;t<n-1;t+=2){if(i=is(e[t][o][s]??void 0,l[t/2]),!i)break}i&&t(o,s)}}function as(e,t,o,s,n,i){if(null==t)return-1;const r=cs(t),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=cs(i(e,d)),g=typeof u;p<d&&a!==g;)d--,u=cs(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 ls(e,t,o,s,n,i=!1){if(null==t)return-1;const r=cs(t),a=i?(e,t)=>n(e,s-t-1):n;let l,c=-1;for(let t=0;t<s;t++){const n=cs(a(e,t));if(n===r)return i?s-t-1:t;"nextSmaller"===o?(!l&&hs(r,n)>=0||hs(r,n)>=0&&hs(n,l)>0)&&(l=n,c=t):"nextGreater"===o&&(!l&&hs(r,n)<=0||hs(r,n)<=0&&hs(n,l)<0)&&(l=n,c=t)}return i?s-c-1:c}function cs(e){return"string"==typeof e?Go(e):e}function hs(e,t){let o=No.indexOf(typeof e)-No.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 ds(e){return void 0===e?[[]]:Oo(e)?e:[[e]]}function us(e,t){return Ko(e,((e,o)=>(e.push(t(o)),e)),[],"rowFirst")}function gs(e){const t=Dt.now();switch(e){case"today":return Qt(t);case"yesterday":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-1)));case"tomorrow":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()+1)));case"lastWeek":return Qt(Dt.fromTimestamp(t.setDate(t.getDate()-7)));case"lastMonth":return Qt(Dt.fromTimestamp(t.setMonth(t.getMonth()-1)));case"lastYear":return Qt(Dt.fromTimestamp(t.setFullYear(t.getFullYear()-1)))}}function ps(e,t){return"dateValue"in e&&"exactDate"!==e.dateValue?[gs(e.dateValue)]:e.values.map((e=>qt(e,t)))}function ms(e,t){return e.values.map((e=>Po(e,t)))}function fs(e){return 20+120*Math.exp(-.035*(e-1))}const bs=20,vs=11,Ss=/(\d+?)(?=(\d{3})+(?!\d)|$)/g,Cs=/0/g,Es={0:a("January"),1:a("February"),2:a("March"),3:a("April"),4:a("May"),5:a("June"),6:a("July"),7:a("August"),8:a("September"),9:a("October"),10:a("November"),11:a("December")},ws={0:a("Sunday"),1:a("Monday"),2:a("Tuesday"),3:a("Wednesday"),4:a("Thursday"),5:a("Friday"),6:a("Saturday")},ys={};function xs(e){let t=ys[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);Ns(i)?o.push({type:"DATE",format:i}):o.push({type:"NUMBER",format:Zs(i)})}t=s}return o}(e),ys[e]=t),t}function Is(e,{format:t,locale:o}){switch(typeof e){case"string":return e.includes('\\"')?e.replace(/\\"/g,'"'):e;case"boolean":return e?"TRUE":"FALSE";case"number":t||(t=Vs(e));return function(e,t,o){if("DATE"===t[0].type)return Ds(e,t[0].format);let s=e<0?"-":"";for(let n of t)switch(n.type){case"NUMBER":s+=Rs(Math.abs(e),n.format,o);break;case"STRING":s+=n.format}return s}(e,xs(t),o);case"object":return"0"}}function Rs(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}=As(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(Cs)||[]).length;n="0".repeat(e)+n}o&&(n=n.match(Ss)?.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(Cs)||[]).length;o+="0".repeat(s)}return o}(i||"",t.decimalPart)),t.isPercent&&(r+="%"),r}const Ts=[];function As(e,t=bs){const o=e.toString();if(o.includes("e"))return function(e,t=bs){let o=Ts[t];o||(o=new Intl.NumberFormat("en-US",{maximumFractionDigits:t,useGrouping:!1}),Ts[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(_s)?.[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:Os(i||"")}}function Os(e){let t=e.length-1;for(;t>=0&&"0"===e[t];)t--;return e.slice(0,t+1)||void 0}const _s=/^0+/;function Ms(e,t){const{integerDigits:o,decimalDigits:s}=As(e,20);return s?o+t+s:o}function Ns(e){if(!Fs.has(e[0]))return!1;try{return Ds(1,e),!0}catch(e){return!1}}const Fs=new Set(["h","m","y","d"]);function Ds(e,t){const o=Xt(e),s=t.indexOf("h");let n="",i="";return s>0?(n=Ls(o,t.substring(0,s-1)),i=Ps(o,t.substring(s))):0===s?i=Ps(o,t):s<0&&(n=Ls(o,t)),n+(n&&i?" ":"")+i}function Ls(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 ws[e.getDay()].slice(0,3);case"dddd":return ws[e.getDay()];case"m":return e.getMonth()+1;case"mm":return String(e.getMonth()+1).padStart(2,"0");case"mmm":return Es[e.getMonth()].slice(0,3);case"mmmm":return Es[e.getMonth()];case"mmmmm":return Es[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 Ps(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()-Lt.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 ks=rt((function(e){return new RegExp(`[0-9]+${Re(e.decimalSeparator)}[0-9]`)}));function Vs(e){let{integerDigits:t,decimalDigits:o}=As(e);if(!o)return"0";const s=t.replace("-","").length;if(s+2>vs)return"0";const n=vs-s-1;return({decimalDigits:o}=As(e,Math.min(n,o.length))),o?"0."+"0".repeat(o.length):"0"}function Us(e,t){if(!Zt(e,t))return;return jt(e,t).format}function Bs(e){if(!ho(e,To))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 Hs(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 zs(e){return js(xs(e).map((e=>"NUMBER"===e.type?{type:e.type,format:{...e.format,decimalPart:void 0}}:e)))}function Gs(e,t,o,s){const n=xs(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 js(i)}function $s(e,t,o){const s=xs(e).map((e=>"NUMBER"===e.type?{...e,format:Ws(e.format,t)}:e)),n=js(s);return ys[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),bs);return o.decimalPart="0".repeat(i),""===o.decimalPart&&delete o.decimalPart,o}const qs=/,*?$/;function Zs(e){if(function(e){return Boolean(e.replace(Ys,""))}(e=e.trim()))throw new Error(`Invalid number format: ${e}`);const t=e.includes("%"),o=e.match(qs)?.[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 Ys=/[,#0.%]/g;function js(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 Xs=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,"i"),Ks=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,"i"),Qs=new RegExp(/^\$?([A-Z]{1,3})+$/,"i"),Js=new RegExp(/^\$?([0-9]{1,7})+$/,"i"),en=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,"i"),tn=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,"i"),on=new RegExp(/^\s*('.+'!|[^']+!)?/.source+"("+[Xs.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 sn(e){return en.test(e)}function nn(e){return tn.test(e)}function rn(e){return Qs.test(e)}function an(e){return Js.test(e)}function ln(e){return Ks.test(e)}function cn(e){const t=e.split("!"),o=t.pop();return{sheetName:Ae(t.join("!"))||void 0,xc:o}}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(sn(r))n=i=Ot(r),o=s=0,a=!0;else if(nn(r))o=s=parseInt(r,10)-1,n=i=0,l=!0;else{const e=Nt(r);n=i=e.col,o=s=e.row,c=!0}if(t)if(sn(t))i=Ot(t),a=!0;else if(nn(t))s=parseInt(t,10)-1,l=!0;else{const e=Nt(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?`${Ft(s,t)}:${Tt(n)}`:`${Tt(s)}:${Tt(n)}`;if(void 0===n&&void 0!==o)return 0!==s||i?`${Ft(s,t)}:${o+1}`:`${t+1}:${o+1}`;if(void 0!==o&&void 0!==n)return r?Ft(s,t):`${Ft(s,t)}:${Ft(n,o)}`;throw new Error(a("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 bn(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 vn(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 Me(o,s+1))for(const o of Me(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(a("Bad zone format"))}static getRangeParts(e,t){const o=e.split(":").map((e=>{const t=nn(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 $n(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($e)}function Wn(e,t=1){return t*(e+Z)-Z}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":oe} ${Xn(e)}px ${ne}`}function Xn(e){return Yn(e?.fontSize||se)}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(ye)?t.split(ye):[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;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||"",description:"function"==typeof s?s:()=>s||"",textColor:e.textColor,sequence:e.sequence||0}}function ri(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?vn(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";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(Te(e.chartJsConfig))})),t.useEffect((()=>this.updateChartJs(Te(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()}}li.props={figure:Object};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)===le?(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($e),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 bi(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 vi(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($e).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&&Ct(e)<.3?"#FFFFFF":"#000000"}function wi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!on.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(!on.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!==mo.number||e.type!==mo.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 Is(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!==mo.number||o?.type!==mo.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!==mo.number||t?.type!==mo.number)return"neutral";const s=t.value-e.value;return s>0?"up":s<0?"down":"neutral"}function Ai(e){return e.keyValue&&!on.test(e.keyValue)?"InvalidScorecardKeyValue":"Success"}function Oi(e){return e.baseline&&!on.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:ge,baselineColorUp:pe,baselineColorDown:me,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 ${ne}`}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 Ct(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";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)}}Bi.props={figure:Object};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 $i(e,t){return{url:e=zi(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Gi.add("sheet_URL",{match:e=>He(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=Ge(e);return t.tryGetSheetName(o)||a("Invalid sheet")},open(e,t){const o=Ge(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Wi={createLink:$i,match:e=>ke(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)))||Wi}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(Pe(e)){const{label:t,url:o}=Ue(e);return qi(o).createLink(o,t)}return ke(e)?$i(e):void 0}}function Xi(e,t){return 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 ho(e,To)?Lo(e,To):Zt(e,t)?Lo(e,t):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Qi(e,t){const o=ji(e);return o?{...Ji(Ki(o.label,t.locale),{format:t.format||Us(o.label,t.locale)||Bs(o.label),locale:t.locale}),link:o}:Ji(e,t)}function Ji(e,t){try{for(const o of sr){const s=o(e,t);if(s)return s}return function(e,t){return{type:mo.text,value:e,format:t.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:Is(e,t)}}((e||"").toString(),t)}catch(e){return or(new d(c.GenericError,e.message||Se))}}function er(e,t){return{type:mo.number,value:e||0,format:t.format,isAutoSummable:!0,defaultAlign:"right",formattedValue:Is(e,t)}}const tr={type:mo.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function or(e){return{type:mo.error,value:e.errorType,error:e,isAutoSummable:!1,defaultAlign:"center",formattedValue:e.errorType}}const sr=[function(e,t){if(""===e)return function(e){return void 0===e.format?tr:{type:mo.empty,value:"",format:e.format,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t.format&&"number"==typeof e&&Ns(t.format))return function(e,t){const o=Is(e,t);return{type:mo.number,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?er(e,t):null===e?er(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:mo.boolean,value:e,format:t.format,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],nr=new Hi;nr.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=Is(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 ir=new Hi,rr=/(\d+)$/,ar=/^(.*\D+)/,lr=/^(.*\D+)(\d+)$/;function cr(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:To});if(t&&o(t))s.push(t);else{if(n)return s;s=[]}}return s}function hr(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}ir.add("simple_value_copy",{condition:(e,t)=>!(1!==t.length||e.isFormula||e.format&&Ns(e.format)),generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("increment_alphanumeric_value",{condition:e=>!e.isFormula&&Xi(e.content,{locale:To}).type===mo.text&&lr.test(e.content),generateRule:(e,t)=>{const o=parseInt(e.content.match(rr)[0]),s=e.content.match(ar)[0],n=e.content.length-s.length,i=cr(e,t,(e=>e.type===mo.text&&lr.test(e.value))).filter((e=>s===e.value.toString().match(ar)[0])).map((e=>parseInt(e.value.toString().match(rr)[0]))),r=hr(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:To}).type===mo.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:To}).type===mo.number,generateRule:(e,t)=>{const o=hr(cr(e,t,(e=>e.type===mo.number)).map((e=>Number(e.value)))),s=Xi(e.content,{locale:To});return{type:"INCREMENT_MODIFIER",increment:o,current:s.type===mo.number?s.value:0}},sequence:40});const dr={};let ur=0;function gr(e,...t){const o="__sheet__"+ur++;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),dr[e]=o}(o,String.raw(e,...t)),function(e){const t=dr[e];t.setAttribute("component",e),document.head.appendChild(t)}(o),o}function pr({strikethrough:e,underline:t}){return e||t?`${e?"line-through":""} ${t?"underline":""}`:"none"}function mr(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 fr(e){let t="";for(const o in e)e[o]&&(t+=`${o}:${e[o]}; `);return t}gr`
|
|
2
2
|
.o-error-tooltip {
|
|
3
3
|
font-size: 13px;
|
|
4
4
|
background-color: white;
|
|
@@ -2628,4 +2628,4 @@
|
|
|
2628
2628
|
<tableParts count="${e.filterTables.length}">
|
|
2629
2629
|
${sy(a)}
|
|
2630
2630
|
</tableParts>
|
|
2631
|
-
`}var _T;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(_T||(_T={}));function MT(e,t={}){const o=Te(t);return o.type=e,o}const NT={},FT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},DT={autofillModifiersRegistry:nr,autofillRulesRegistry:ir,cellMenuRegistry:sb,colMenuRegistry:Hv,linkMenuRegistry:Ta,functionRegistry:Tf,featurePluginRegistry:eR,statefulUIPluginRegistry:tR,coreViewsPluginRegistry:oR,corePluginRegistry:JI,rowMenuRegistry:$v,sidePanelRegistry:tC,figureRegistry:Rl,chartSidePanelComponentRegistry:uS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:Wv,topbarComponentRegistry:oC,clickableCellRegistry:sR,otRegistry:qv,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:zv,repeatLocalCommandTransformRegistry:VI,repeatCommandTransformRegistry:kI},LT={arg:Sc,toBoolean:Wo,toJsDate:qo,toNumber:Lo,toString:zo,toXC:Ft,toZone:dn,toUnboundedZone:hn,toCartesian:Nt,numberToLetters:Tt,lettersToNumber:Ot,UuidGenerator:oi,formatValue:Is,createCurrencyFormat:Hs,computeTextWidth:Zn,createEmptyWorkbookData:Py,createEmptySheet:Ly,createEmptyExcelSheet:ky,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,EvaluationError:d,CellErrorLevel:h,getFillingMode:Qa,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Fn,isDefined:$e,isMatrix:Oo,lazy:je,genericRepeat:UI,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Qe},PT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:Ve,openLink:Yi,urlRepresentation:Zi},kT={ChartPanel:gS,ChartFigure:yl,ChartJsComponent:li,Grid:aE,GridOverlay:WC,ScorecardChart:Bi,LineConfigPanel:cS,LineBarPieDesignPanel:rS,BarConfigPanel:Jv,LineBarPieConfigPanel:Qv,GaugeChartConfigPanel:aS,GaugeChartDesignPanel:lS,ScorecardChartConfigPanel:hS,ScorecardChartDesignPanel:dS,FigureComponent:sC,Menu:Hr,SelectionInput:Xv},VT={useDragAndDropListItems:vS};const UT={DEFAULT_LOCALE:To};e.AbstractChart=ci,e.CorePlugin=Uy,e.DispatchResult=yo,e.EvaluationError=d,e.Model=class extends uI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new oi,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Ny(e,a);const h=_y(e,c);this.state=new zR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Rx(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 HR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of JI.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of oR.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 tR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eR.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(),r.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 yI(VR({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:a("Anonymous").toString()},o=e.transportService||new OR;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(Ro));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=wo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new yo(t.flat()):yo.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(MT(e,t));dispatch=(e,t)=>{const o=MT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Co.has(n.type)))return new yo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new yo("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((()=>{wo(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(wo(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(wo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return yo.Success};dispatchFromCorePlugin=(e,t)=>{const o=MT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,yo.Success};dispatchToHandlers(e,t){const o=wo(t);for(const s of e)!o&&s instanceof Uy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Uy||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=Py();for(let t of this.handlers)t instanceof Uy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Py(),sheets:[ky(Oy,"Sheet1")]};for(let t of this.handlers)t instanceof Vy&&t.exportForExcel(e);return e=Te(e),AT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=EI,e.SPREADSHEET_DIMENSIONS=FT,e.Spreadsheet=AR,e.UIPlugin=Tx,e.__info__=NT,e.addFunction=function e(t,o){return Tf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=ix,e.compile=ux,e.compileTokens=gx,e.components=kT,e.constants=UT,e.convertAstNodes=tx,e.coreTypes=Eo,e.findCellInNewZone=Mn,e.functionCache=dx,e.helpers=LT,e.hooks=VT,e.invalidateCFEvaluationCommands=So,e.invalidateDependenciesCommands=vo,e.invalidateEvaluationCommands=bo,e.iterateAstNodes=ox,e.links=PT,e.load=_y,e.parse=Jy,e.parseTokens=ex,e.readonlyAllowedCommands=Co,e.registries=DT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=qr,NT.version="17.0.30",NT.date="2024-07-11T06:34:04.932Z",NT.hash="a8eacf4"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
2631
|
+
`}var _T;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(_T||(_T={}));function MT(e,t={}){const o=Te(t);return o.type=e,o}const NT={},FT={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:B,HEADER_WIDTH:H,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:z,DEFAULT_CELL_HEIGHT:G,SCROLLBAR_WIDTH:$},DT={autofillModifiersRegistry:nr,autofillRulesRegistry:ir,cellMenuRegistry:sb,colMenuRegistry:Hv,linkMenuRegistry:Ta,functionRegistry:Tf,featurePluginRegistry:eR,statefulUIPluginRegistry:tR,coreViewsPluginRegistry:oR,corePluginRegistry:JI,rowMenuRegistry:$v,sidePanelRegistry:tC,figureRegistry:Rl,chartSidePanelComponentRegistry:uS,chartComponentRegistry:El,chartRegistry:Cl,topbarMenuRegistry:Wv,topbarComponentRegistry:oC,clickableCellRegistry:sR,otRegistry:qv,inverseCommandRegistry:_l,urlRegistry:Gi,cellPopoverRegistry:_a,numberFormatMenuRegistry:zv,repeatLocalCommandTransformRegistry:VI,repeatCommandTransformRegistry:kI},LT={arg:Sc,toBoolean:Wo,toJsDate:qo,toNumber:Lo,toString:zo,toXC:Ft,toZone:dn,toUnboundedZone:hn,toCartesian:Nt,numberToLetters:Tt,lettersToNumber:Ot,UuidGenerator:oi,formatValue:Is,createCurrencyFormat:Hs,computeTextWidth:Zn,createEmptyWorkbookData:Py,createEmptySheet:Ly,createEmptyExcelSheet:ky,getDefaultChartJsRuntime:Ya,chartFontColor:Ei,ChartColors:Ci,EvaluationError:d,CellErrorLevel:h,getFillingMode:Qa,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Fn,isDefined:$e,isMatrix:Oo,lazy:je,genericRepeat:UI,createAction:ii,createActions:si,transformRangeData:ai,deepEquals:Qe},PT={isMarkdownLink:Pe,parseMarkdownLink:Ue,markdownLink:Ve,openLink:Yi,urlRepresentation:Zi},kT={ChartPanel:gS,ChartFigure:yl,ChartJsComponent:li,Grid:aE,GridOverlay:WC,ScorecardChart:Bi,LineConfigPanel:cS,LineBarPieDesignPanel:rS,BarConfigPanel:Jv,LineBarPieConfigPanel:Qv,GaugeChartConfigPanel:aS,GaugeChartDesignPanel:lS,ScorecardChartConfigPanel:hS,ScorecardChartDesignPanel:dS,FigureComponent:sC,Menu:Hr,SelectionInput:Xv},VT={useDragAndDropListItems:vS};const UT={DEFAULT_LOCALE:To};e.AbstractChart=ci,e.CorePlugin=Uy,e.DispatchResult=yo,e.EvaluationError=d,e.Model=class extends uI{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},r={},a=[],l=new oi,c=!0){super(),n===o&&i===s&&(i=()=>!0),a=Ny(e,a);const h=_y(e,c);this.state=new zR,this.uuidGenerator=l,this.config=this.setupConfig(r),this.session=this.setupSession(h.revisionId),this.coreGetters={},this.range=new Rx(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 HR(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of JI.getAll())this.setupCorePlugin(e,h);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(a);for(let e of oR.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 tR.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eR.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(),r.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 yI(VR({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:a("Anonymous").toString()},o=e.transportService||new OR;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(Ro));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=wo(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new yo(t.flat()):yo.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(MT(e,t));dispatch=(e,t)=>{const o=MT(e,t);let s=this.status;if(this.getters.isReadonly()&&(n=o,!Co.has(n.type)))return new yo("Readonly");var n;if(!this.session.canApplyOptimisticUpdate())return new yo("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((()=>{wo(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(wo(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(wo(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return yo.Success};dispatchFromCorePlugin=(e,t)=>{const o=MT(e,t),s=this.status;this.status=2;const n=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(n,o),this.status=s,yo.Success};dispatchToHandlers(e,t){const o=wo(t);for(const s of e)!o&&s instanceof Uy||s.beforeHandle(t);for(const s of e)!o&&s instanceof Uy||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=Py();for(let t of this.handlers)t instanceof Uy&&t.export(e);return e.revisionId=this.session.getRevisionId()||ce,e=Te(e),e}updateMode(e){"normal"!==e&&this.dispatch("CANCEL_EDITION"),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...Py(),sheets:[ky(Oy,"Sheet1")]};for(let t of this.handlers)t instanceof Vy&&t.exportForExcel(e);return e=Te(e),AT(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Hi,e.Revision=EI,e.SPREADSHEET_DIMENSIONS=FT,e.Spreadsheet=AR,e.UIPlugin=Tx,e.__info__=NT,e.addFunction=function e(t,o){return Tf.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.astToFormula=ix,e.compile=ux,e.compileTokens=gx,e.components=kT,e.constants=UT,e.convertAstNodes=tx,e.coreTypes=Eo,e.findCellInNewZone=Mn,e.functionCache=dx,e.helpers=LT,e.hooks=VT,e.invalidateCFEvaluationCommands=So,e.invalidateDependenciesCommands=vo,e.invalidateEvaluationCommands=bo,e.iterateAstNodes=ox,e.links=PT,e.load=_y,e.parse=Jy,e.parseTokens=ex,e.readonlyAllowedCommands=Co,e.registries=DT,e.setDefaultSheetViewSize=function(e){Ee=e},e.setTranslationMethod=function(e,t=(()=>!0)){n=e,i=t},e.tokenize=qr,NT.version="17.0.31",NT.date="2024-07-18T14:22:00.324Z",NT.hash="c64db0d"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
package/dist/o_spreadsheet.xml
CHANGED
|
@@ -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.0.
|
|
5
|
-
@date 2024-07-
|
|
6
|
-
@hash
|
|
4
|
+
@version 17.0.31
|
|
5
|
+
@date 2024-07-18T14:22:34.937Z
|
|
6
|
+
@hash c64db0d
|
|
7
7
|
-->
|
|
8
8
|
<odoo>
|
|
9
9
|
<t t-name="o-spreadsheet-ActionButton">
|