@odoo/o-spreadsheet 18.0.77 → 18.0.78

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.
@@ -1,7 +1,7 @@
1
1
  (function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t)=>{let n={};for(var i in e)r(n,i,{get:e[i],enumerable:!0});return t||r(n,Symbol.toStringTag,{value:`Module`}),n},u=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},d=(e,t,i)=>(i=e==null?{}:n(o(e)),u(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e));function f(e){return e.map(m).sort((e,t)=>e.sequence-t.sequence)}let p=1;function m(e){let t=e.name,n=e.children,r=e.description,i=e.icon,a=e.secondaryIcon;return{id:(e.id||p++).toString(),name:typeof t==`function`?t:()=>t,isVisible:e.isVisible?e.isVisible:()=>!0,isEnabled:e.isEnabled?e.isEnabled:()=>!0,isActive:e.isActive,execute:e.execute,children:n?e=>n.map(t=>typeof t==`function`?t(e):t).flat().map(m).sort((e,t)=>e.sequence-t.sequence):()=>[],isReadonlyAllowed:e.isReadonlyAllowed||!1,separator:e.separator||!1,icon:typeof i==`function`?i:()=>i||``,iconColor:e.iconColor,secondaryIcon:typeof a==`function`?a:()=>a||``,description:typeof r==`function`?r:()=>r||``,textColor:e.textColor,sequence:e.sequence||0,onStartHover:e.onStartHover,onStopHover:e.onStopHover}}var h=class{content={};add(e,t){return this.content[e]=t,this}get(e){let t=this.content[e];if(!t&&!(e in this.content))throw 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]}};let g=.5,_=`#37A850`,v=`#f5f5f5`,ee=`#F8F9FA`,te=`#E8EAED`,ne=`#595959`,re=`#666666`,ie=`#c9ccd2`,ae=`#3266ca`,oe=`#FFFFFF`,se=`#CACACA`,ce=11982760,le=`#017E84`,ue=`#188038`,de=`#E0E2E4`,fe=`#4A4F59`,pe=`#999`,me=`#E2E3E3`,he=`#BCBCBC`,ge=`#9B359B`,_e=`#111827`,ve=`#D8DADD`,ye=`#E7E9ED`,be=`#F9FAFB`,xe=`#374151`,Se=`#374151C2`,Ce=`#111827`,we=`#714B67`,Te=ve,Ee=`#111827`,De=`#e6f2f3`,Oe=`#111827`,ke=`#017E84`,Ae=`#D44C591A`,je=`#C34A41`,Me=`#E6F2F3`,Ne=`#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`.split(`.`),Pe={align:`left`,verticalAlign:`bottom`,wrapping:`overflow`,bold:!1,italic:!1,strikethrough:!1,underline:!1,fontSize:10,fillColor:``,textColor:``},Fe={...Pe,align:`right`},Ie=Pe.verticalAlign,Le=Pe.wrapping,Re=Pe.fontSize,ze=`'Roboto', arial, 'Liberation Sans'`,Be={style:`thin`,color:`#000000`},Ve=`START_REVISION`,He=`difference`,Ue=`#43C5B1`,We=`#EA6175`,Ge=[`'`,`*`,`?`,`/`,`\\`,`[`,`]`],Ke=/'|\*|\?|\/|\\|\[|\]/,qe=0;function Je(){return qe}function Ye(e){qe=e}let Xe=[6,7,8,9,10,11,12,14,18,24,36],Ze={hasFilters:!1,totalRow:!1,firstColumn:!0,lastColumn:!1,numberOfHeaders:1,bandedRows:!0,bandedColumns:!1,styleId:`TableStyleMedium5`,automaticAutofill:!1},Qe={symbol:`$`,position:`before`,decimalPlaces:2,code:``,name:`Dollar`},$e=new RegExp(Ke,`g`);function et(e){return e[0]===`"`&&(e=e.slice(1)),e[e.length-1]===`"`&&e[e.length-2]!==`\\`?e.slice(0,e.length-1):e}function tt(e){return`clone`in e&&e.clone instanceof Function}function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function y(e){switch(typeof e){case`object`:{if(e===null)return e;if(tt(e))return e.clone();if(!(rt(e)||e instanceof Array))throw Error(`Unsupported type: only objects and arrays are supported`);let t=Array.isArray(e)?Array(e.length):{};if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)n in e&&(t[n]=y(e[n]));else for(let n in e)t[n]=y(e[n]);return t}case`number`:case`string`:case`boolean`:case`function`:case`undefined`:return e;default:throw Error(`Unsupported type: ${typeof e}`)}}function rt(e){return typeof e==`object`&&!!e&&(e?.constructor===Object||e?.constructor===void 0)}function it(e){return at(e,`'`)}function at(e,t=`"`){return e.startsWith(t)&&(e=e.slice(1)),e.endsWith(t)&&(e=e.slice(0,-1)),e}function ot(e){return e.match(/\w/g)?.length!==e.length&&(e=`'${e}'`),e}function st(e,t=` `){return e.replace($e,t)}function b(e,t,n){return e<t?t:e>n?n:e}function x(e,t,n=1){if(t<=e&&n>0)return[];if(n===0)throw Error(`range() step must not be zero`);let r=Math.ceil(Math.abs((t-e)/n)),i=Array(r);for(let t=0;t<r;t++)i[t]=e+t*n;return i}function ct(e){return e.reduce((e,t,n,r)=>(Math.abs(t-r[n-1])===1?e[e.length-1].push(t):e.push([t]),e),[])}function*lt(e,t){t.next();for(let n of e){let e=t.next();yield{...n,next:e.done?void 0:e.value}}}function ut(e){let t=e.toUpperCase();return t===`TRUE`||t===`FALSE`}let dt=/^\[(.+)\]\((.+)\)$/,ft=/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;function pt(e){return dt.test(e)}function mt(e){return ft.test(e)}function ht(e,t){return`[${e}](${t})`}function gt(e){let t=e.match(dt)||[],n=t[1],r=t[2];if(!n||!r)throw Error(`Could not parse markdown link ${e}.`);return{label:n,url:r}}let _t=`o-spreadsheet://`;function vt(e){return e.startsWith(_t)}function yt(e){return`${_t}${e}`}function bt(e){if(e.startsWith(_t))return e.substr(16);throw Error(`${e} is not a valid sheet link`)}function S(e){return e!==void 0}function xt(e){return e!==null}function St(e){return e===void 0?!0:Object.values(e).every(e=>typeof e==`object`?St(e):!e)}function Ct(e,t,n){let r,i=function(){let i=this,a=Array.from(arguments);function o(){r=void 0,n||e.apply(i,a)}let s=n&&!r;clearTimeout(r),r=setTimeout(o,t),s&&e.apply(i,a)};return i.isDebouncePending=()=>r!==void 0,i.stopDebounce=()=>{clearTimeout(r)},i}function wt(e){let t=!1;return async(...n)=>{t||(t=!0,await Promise.resolve(),t=!1,e(...n))}}function Tt(e){let t=``;for(let n=0,r=e.length;n<r;n++)t+=e[n];return t}function Et(e){let t=!1,n,r=()=>(t||=(n=e instanceof Function?e():e,!0),n);return r.map=e=>Et(()=>e(r())),r}function Dt(e,t){let n=e.slice(t).find(e=>e);return n||=e.slice(0,t).reverse().find(e=>e),n||``}function Ot(e,t){return e===`after`?t+1:t}function C(e,t){if(e===t)return!0;if(e&&!t||t&&!e||typeof e!=typeof t||typeof e!=`object`)return!1;for(let n in t)if(!(n in e)&&t[n]!==void 0)return!1;for(let n in e){if(typeof e[n]!=typeof t[n])return!1;if(typeof e[n]==`object`){if(!C(e[n],t[n]))return!1}else if(e[n]!==t[n])return!1}return!0}function kt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!C(e[n],t[n]))return!1;return!0}function At(e,t){if(e.length<t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}function jt(e){if(!e)return e;let t={...e};return Object.keys(t).forEach(e=>!t[e]&&delete t[e]),t}let Mt=[` `,`\f`,`\v`,`\xA0`,` `,` `,` `,`\u2028`,`\u2029`,` `,` `,` `,``],Nt=new RegExp(Mt.join(`|`),`g`),Pt=/(\r\n|\r)/g,Ft=Mt.concat([` `]);function It(e){return e?e.replace(Pt,`
2
2
  `):``}function Lt(e){let 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}function Rt(e){let t=new Map,n=e.name?e.name+` (memoized)`:`memoized`;return{[n](...n){return t.has(n[0])||t.set(n[0],e(...n)),t.get(n[0])}}[n]}function zt(e,t){let n=new Set(t),r=[];for(let t=0;t<e.length;t++)n.has(t)||r.push(e[t]);return r}function Bt(e,t,n){return e.slice(0,n).concat(t).concat(e.slice(n))}function Vt(e,t,n){let r=[...e];return r.splice(n,1,t),r}function Ht(e){return e.split(`
3
3
  `).map(e=>e.replace(/\s+/g,` `).trim()).join(`
4
- `)}function Ut(e,t,n){return t>n?Ut(e,n,t):e>=t&&e<=n}function Wt(e,t){let n=nt(e),r=t.matchCase?``:`i`;return t.exactMatch&&(n=`^${n}$`),RegExp(n,r)}function Gt(e){let t=e.length;if(t<1e5)return Math.max(...e);let n=-1/0;for(;t--;)n=e[t]>n?e[t]:n;return n}function Kt(e){let t=e.length;if(t<1e5)return Math.min(...e);let n=1/0;for(;t--;)n=e[t]<n?e[t]:n;return n}var qt=class{text;currentIndex=0;current;constructor(e){this.text=e,this.current=e[0]}shift(){let e=this.current,t=this.text[++this.currentIndex];return this.current=t,e}advanceBy(e){this.currentIndex+=e,this.current=this.text[this.currentIndex]}isOver(){return this.currentIndex>=this.text.length}remaining(){return this.text.substring(this.currentIndex)}currentStartsWith(e){if(this.current!==e[0])return!1;for(let t=1;t<e.length;t++)if(this.text[this.currentIndex+t]!==e[t])return!1;return!0}};function Jt(e,t=e=>e){let n=new Set;return e.filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function Yt(e){let t={};for(let n in e)for(let r in e[n])t[r]||(t[r]={}),t[r][n]=e[n][r];return t}let Xt=/rgba?\(|\s+|\)/gi,Zt=/^#([A-F\d]{2}){3,4}$/,Qt=[`#eb6d00`,`#0074d9`,`#ad8e00`,`#169ed4`,`#b10dc9`,`#00a82d`,`#00a3a3`,`#f012be`,`#3d9970`,`#111111`,`#62A300`,`#ff4136`,`#949494`,`#85144b`,`#001f3f`];function $t(e){return en(e.toString(16).padStart(6,`0`))}function en(e){let t=e;if(e.startsWith(`rgb`)?t=sn(e):(t=e.replace(`#`,``).toUpperCase(),(t.length===3||t.length===4)&&(t=t.split(``).reduce((e,t)=>e+t+t,``)),t=`#${t}`),!Zt.test(t))throw Error(`invalid color input: ${e}`);return t}function tn(e){try{return en(e),!0}catch{return!1}}function nn(e){try{return fn(e),!0}catch{return!1}}let rn=e=>e>=0&&e<=255;function an(e,t,n,r=1){if(!rn(e)||!rn(t)||!rn(n)||r<0||r>1)throw Error(`Invalid RGBA values ${[e,t,n,r]}`);return{a:r,b:n,g:t,r:e}}function on(e){let{r:t,g:n,b:r}=ln(e);t/=255,n/=255,r/=255;let i=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4,a=i(t),o=i(n),s=i(r);return .2126*a+.7152*o+.0722*s}function sn(e){let t=e.replace(Xt,``).split(`,`),n=255;if(t.length!==3&&t.length!==4)throw Error(`invalid color`);if(t.length===4){let e=parseFloat(t.pop()||`1`);if(isNaN(e))throw Error(`invalid alpha value`);n=Math.round(e*255)}let r=t.map(e=>parseInt(e,10));return n!==255&&r.push(n),`#`+Tt(r.map(e=>e.toString(16).padStart(2,`0`))).toUpperCase()}function cn(e){let t=e.r.toString(16),n=e.g.toString(16),r=e.b.toString(16),i=Math.round(e.a*255).toString(16);return t.length===1&&(t=`0`+t),n.length===1&&(n=`0`+n),r.length===1&&(r=`0`+r),i.length===1&&(i=`0`+i),i===`ff`&&(i=``),(`#`+t+n+r+i).toUpperCase()}function ln(e){e=en(e);let t,n,r,i;if(e.length===7)t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16),i=255;else if(e.length===9)t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16),i=parseInt(e[7]+e[8],16);else throw Error(`Invalid color`);return i=+(i/255).toFixed(3),{a:i,r:t,g:n,b:r}}function un(e){e={...e},e.s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,n=t*(1-Math.abs(e.h/60%2-1)),r=e.l-t/2,i=0,a=0,o=0;return 0<=e.h&&e.h<60?(i=t,a=n,o=0):60<=e.h&&e.h<120?(i=n,a=t,o=0):120<=e.h&&e.h<180?(i=0,a=t,o=n):180<=e.h&&e.h<240?(i=0,a=n,o=t):240<=e.h&&e.h<300?(i=n,a=0,o=t):300<=e.h&&e.h<360&&(i=t,a=0,o=n),i=Math.round((i+r)*255),a=Math.round((a+r)*255),o=Math.round((o+r)*255),{a:e.a,r:i,g:a,b:o}}function dn(e){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=0,c=0,l=0;return s=o===0?0:a===t?(n-r)/o%6:a===n?(r-t)/o+2:(t-n)/o+4,s=Math.round(s*60),s<0&&(s+=360),l=(a+i)/2,c=o===0?0:o/(1-Math.abs(2*l-1)),c=+(c*100).toFixed(1),l=+(l*100).toFixed(1),{a:e.a,h:s,s:c,l}}function fn(e){return cn(un(e))}function pn(e){return dn(ln(e))}function mn(e,t,n=0){if(!(tn(e)&&tn(t)))return!1;let r=ln(e),i=ln(t);return r.a===i.a?Math.sqrt(((r.r-i.r)/255)**2+((r.g-i.g)/255)**2+((r.b-i.b)/255)**2)<=n:!1}function hn(e,t){return t===1?en(e).slice(0,7):cn({...ln(e),a:t})}function gn(e,t){let n=pn(e);return t===1?`#fff`:(n.l=t*(100-n.l)+n.l,fn(n))}function _n(e,t){let n=pn(e);return t===1?`#000`:(n.l-=t*n.l,fn(n))}let vn=[`#4EA7F2`,`#EA6175`,`#43C5B1`,`#F4A261`,`#8481DD`,`#FFD86D`],yn=[`#4EA7F2`,`#3188E6`,`#43C5B1`,`#00A78D`,`#EA6175`,`#CE4257`,`#F4A261`,`#F48935`,`#8481DD`,`#5752D1`,`#FFD86D`,`#FFBC2C`],bn=[`#4EA7F2`,`#3188E6`,`#056BD9`,`#A76DBC`,`#7F4295`,`#6D2387`,`#EA6175`,`#CE4257`,`#982738`,`#43C5B1`,`#00A78D`,`#0E8270`,`#F4A261`,`#F48935`,`#BE5D10`,`#8481DD`,`#5752D1`,`#3A3580`,`#A4A8B6`,`#7E8290`,`#545B70`,`#FFD86D`,`#FFBC2C`,`#C08A16`],xn=`#4EA7F2.#3188E6.#056BD9.#155193.#A76DBC.#7F4295.#6D2387.#4F1565.#EA6175.#CE4257.#982738.#791B29.#43C5B1.#00A78D.#0E8270.#105F53.#F4A261.#F48935.#BE5D10.#7D380D.#8481DD.#5752D1.#3A3580.#26235F.#A4A8B6.#7E8290.#545B70.#3F4250.#FFD86D.#FFBC2C.#C08A16.#936A12`.split(`.`);function Sn(e,t){return t[e%t.length]}function Cn(e){return e<=6?vn:e<=12?yn:e<=24?bn:xn}var wn=class{preferredColors;currentColorIndex=0;palette;constructor(e,t=[]){this.preferredColors=t,this.palette=Cn(e).filter(e=>!t.includes(e))}next(){return this.preferredColors?.[this.currentColorIndex]?this.preferredColors[this.currentColorIndex++]:Sn(this.currentColorIndex++,this.palette)}};function Tn(e){if(e<0)throw Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tn(Math.floor(e/26)-1)+Tn(e%26)}function En(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=Dn(e[r]);t=t*26+n}return t-1}function Dn(e){let t=e.charCodeAt(0);return t>=65&&t<=90?t-64:t-96}function On(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`}function kn(e){return e>=`0`&&e<=`9`}let An=En(`ZZZ`);function jn(e){for(;e.current===` `;)e.advanceBy(1)}function Mn(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!On(e.current))return-1;let t=0;for(;e.current&&On(e.current);)t=t*26+Dn(e.shift());return t}function Nn(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!kn(e.current))return-1;let t=0;for(;e.current&&kn(e.current);)t=t*10+Number(e.shift());return t}function Pn(e){let t=new qt(e);jn(t);let n=Mn(t);if(n===-1||!t.current)throw Error(`Invalid cell description: ${e}`);let r=Nn(t);jn(t);let i=n-1,a=r-1;if(!t.isOver()||i>An||a>9999998)throw Error(`Invalid cell description: ${e}`);return{col:i,row:a}}function w(e,t,n={colFixed:!1,rowFixed:!1}){return(n.colFixed?`$`:``)+Tn(e)+(n.rowFixed?`$`:``)+String(t+1)}function T(e,t=[]){if(e.length<=1&&t.length===0)return e;let n=[0],r=new Map([[0,[]]]);return Fn(n,r,e,!1),Fn(n,r,t,!0),zn(n,r)}function Fn(e,t,n,r=!1){for(let i of n){let n=i.left,a=i.right===void 0?void 0:i.right+1,o=In(e,t,n,!0,0),s=In(e,t,a,!1,o);for(let n=o;n<=s;n++)Ln(t.get(e[n]),i,r);Rn(e,t,o,s)}}function In(e,t,n,r,i){if(n===void 0)return e.length-1;let a=Bn(e,n,i);return n===e[a]?r?a:a-1:(e.splice(a+1,0,n),t.set(n,[...t.get(e[a])]),r?a+1:a)}function Ln(e,t,n=!1){let r=t.top,i=t.bottom===void 0?void 0:t.bottom+1,a=[],o=Bn(e,r,0,!1);if((o%2!=0&&!n||o%2==0&&n)&&a.push(r),i===void 0){e.splice(o+1),e.push(...a);return}let s=Vn(e,i,0,!1);(s%2==0&&!n||s%2!=0&&n)&&a.push(i),e.splice(o+1,s-o-1,...a)}function Rn(e,t,n,r){let i=n-1==-1?0:n-1,a=r===e.length-1?r:r+1;for(let n=a;n>i;n--)kt(t.get(e[n]),t.get(e[n-1]))&&(t.delete(e[n]),e.splice(n,1))}function zn(e,t){let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=t.get(a);if(!o||o.length===0){n.push(...r),r=[];continue}let s=e[i+1];s!==void 0&&s--;let c=[];for(let e=0;e<o.length;e+=2){let t=o[e],n=o[e+1];n!==void 0&&n--;let i={top:t,left:a,bottom:n,right:s,hasHeader:n===void 0&&t!==0||s===void 0&&a!==0},l=!1;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.top===i.top&&t.bottom===i.bottom){t.right=i.right,r.splice(e,1),c.push(t),l=!0;break}}l||c.push(i)}n.push(...r),r=c}return n.push(...r),n}function Bn(e,t,n=0,r=!0){let i=e.length-1,a=-1;for(;n<=i;){let o=Math.floor((n+i)/2);if(e[o]===t&&r)return o;e[o]<t?(a=o,n=o+1):i=o-1}return a}function Vn(e,t,n=0,r=!0){let i=e.length-1,a=e.length;for(;n<=i;){let o=Math.floor((n+i)/2);if(e[o]===t&&r)return o;e[o]>t?(a=o,i=o-1):n=o+1}return a}let Hn=e=>e,Un=()=>!1,Wn=Hn,Gn=Un;function Kn(e,...t){if(t.length===1&&typeof t[0]==`object`&&!(t[0]instanceof String)){let n=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,(e,t)=>n[t])}else t.length>0&&(e=e.replace(/\%s/g,()=>t.shift()));return e}function qn(e,t=()=>!0){Wn=e,Gn=t}function Jn(){Wn===Hn&&Gn===Un&&(Gn=()=>!0)}let E=function(e,...t){return Gn()?Kn(Wn(e),...t):new Yn(e,t)};var Yn=class extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){let e=super.valueOf();return Gn()?Kn(Wn(e),...this.values):Kn(e,...this.values)}toString(){return this.valueOf()}};function Xn(e){let t=new qt(e);jn(t);let n=e.indexOf(`!`);n!==-1&&t.advanceBy(n+1);let r=Mn(t),i=Nn(t),a,o,s,c,l=!1,u=!1,d=!1;if(i===-1?(s=c=r-1,a=o=0,l=!0):r===-1?(a=o=i-1,s=c=0,u=!0):(s=c=r-1,a=o=i-1,d=!0),jn(t),t.current===`:`){t.advanceBy(1),jn(t);let e=Mn(t),n=Nn(t);n===-1?(c=e-1,l=!0):e===-1?(o=n-1,u=!0):(c=e-1,o=n-1,a=l?o:a,s=u?c:s,d=!0)}let f={top:a,left:s,bottom:l?void 0:o,right:u?void 0:c};return d&&=u||l,d&&(f.hasHeader=d),f}function Zn(e){let t=vr(Xn(e)),n=t.bottom,r=t.right;if(n!==void 0&&n>9999998||r!==void 0&&r>An)throw Error(`Range string out of bounds: ${e}`);if(n===void 0&&r===void 0)throw Error(`Wrong zone xc. The zone cannot be at the same time a full column and a full row`);return t}function Qn(e){let t=Zn(e);if(t.bottom===void 0||t.right===void 0)throw Error(`This does not support unbounded ranges`);return t}function $n(e){let{bottom:t,top:n,left:r,right:i}=e;return t!==void 0&&isNaN(t)||isNaN(n)||isNaN(r)||i!==void 0&&isNaN(i)?!1:er(e)&&e.top>=0&&e.left>=0}function er(e){return(e.bottom===void 0||e.bottom>=e.top&&e.bottom>=0)&&(e.right===void 0||e.right>=e.left&&e.right>=0)}function tr(e){let{top:t,bottom:n,left:r,right:i}=e,a=`hasHeader`in e?e.hasHeader:!1,o=t===n&&r===i;if(n===void 0&&i!==void 0)return t===0&&!a?`${Tn(r)}:${Tn(i)}`:`${w(r,t)}:${Tn(i)}`;if(i===void 0&&n!==void 0)return r===0&&!a?`${t+1}:${n+1}`:`${w(r,t)}:${n+1}`;if(n!==void 0&&i!==void 0)return o?w(r,t):`${w(r,t)}:${w(i,n)}`;throw Error(E(`Bad zone format`))}function nr(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=e[t===`left`?`right`:`bottom`];return e[t]<=o&&s&&s>o?yr(e,a,`RESIZE`,i):o<e[t]?yr(e,a,`MOVE`,i):{...e}}function rr(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=t===`left`?`right`:`bottom`;return e[t]<=o&&e[s]>o?yr(e,a,`RESIZE`,i):o<e[t]?yr(e,a,`MOVE`,i):{...e}}function ir(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r];for(let o of n.sort((e,t)=>t-e))e[t]>o&&(i--,a--),e[t]<o&&e[r]>=o&&a--;return{...e,[t]:i,[r]:a}}function ar(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r],o=e[r];for(let r of n.sort((e,t)=>t-e))e[t]>r&&(i--,a!==void 0&&a--),o!==void 0&&a!==void 0&&e[t]<=r&&o>=r&&a--;if(!(a!==void 0&&i>a))return{...e,[t]:i,[r]:a}}function or(...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 sr(...e){return{top:Math.min(...e.map(e=>e.top)),left:Math.min(...e.map(e=>e.left)),bottom:e.some(e=>e.bottom===void 0)?void 0:Math.max(...e.map(e=>e.bottom)),right:e.some(e=>e.right===void 0)?void 0:Math.max(...e.map(e=>e.right))}}function cr(e,t){if(ur(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 lr(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function ur(e,t){return!(e.bottom<t.top||t.bottom<e.top||e.right<t.left||t.right<e.left)}function dr(e,t,n){let{left:r,right:i,top:a,bottom:o}=n;return e>=r&&e<=i&&t>=a&&t<=o}function fr(e,t){return lr(or(t,e),t)}function pr(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function mr(e){let{numberOfCols:t,numberOfRows:n}=pr(e);return t===1||n===1}function hr(e){let{top:t,left:n,bottom:r,right:i}=e;if(Er(e)===1)return[];let a={top:t+1,bottom:r,left:n,right:n};if(i===n)return[a];let o={top:t,bottom:r,left:n+1,right:i};return t===r?[o]:[a,o]}function gr(e){let t={};for(let n of e)t[n.sheetId]??=[],t[n.sheetId].push(D(n));for(let e in t)t[e]=T(t[e]);return t}function _r(e){let t=[],{left:n,right:r,top:i,bottom:a}=vr(e);for(let e of x(n,r+1))for(let n of x(i,a+1))t.push({col:e,row:n});return t}function vr(e){return e.right!==void 0&&e.left>e.right&&(e={...e,left:e.right,right:e.left}),e.bottom!==void 0&&e.top>e.bottom&&(e={...e,top:e.bottom,bottom:e.top}),e}function yr(e,t,n,r){let i=t===`both`?r[0]:t===`columns`?r:0,a=t===`both`?r[1]:t===`rows`?r:0,o=`hasHeader`in e?e.hasHeader:!1,s;s=Tr(e)&&!o?t!==`rows`:wr(e)&&!o?t!==`columns`:!0;let c={...e};return s&&n===`MOVE`&&(c.left+=i,c.top+=a),c.right!==void 0&&(c.right+=i),c.bottom!==void 0&&(c.bottom+=a),c}function br(e){return e.reverse().filter((e,t,n)=>t===n.findIndex(t=>t.top===e.top&&t.bottom===e.bottom&&t.left===e.left&&t.right===e.right)).reverse()}function xr(e){return e.reduce((e,t)=>{let n=e.length;for(let r=0;r<n;r++)if(ur(e[r],t))return e[r]=or(e[r],t),e;return e[n]=t,e},[])}function Sr(e,t){let n,r,{left:i,right:a,top:o,bottom:s}=e,{left:c,right:l,top:u,bottom:d}=t;return n=c===i?l===a?c:l:c,r=u===o?d===s?u:d:u,{col:n,row:r}}function D(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Cr(e){return{...e,right:e.left,bottom:e.top}}function wr(e){return e.right===void 0}function Tr(e){return e.bottom===void 0}function Er(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Dr(e){return e.length<2?!0:T(e).length===1}function Or(e){let t=new Set;for(let n of T(e))for(let e of x(n.left,n.right+1))t.add(e);return t}function kr(e){let t=new Set;for(let n of T(e))for(let e of x(n.top,n.bottom+1))t.add(e);return t}function Ar(e,t){return e.right+1===t.left||e.left===t.right+1?e.top<=t.bottom&&e.top>=t.top||t.top<=e.bottom&&t.top>=e.top:e.bottom+1===t.top||e.top===t.bottom+1?e.left<=t.right&&e.left>=t.left||t.left<=e.right&&t.left>=e.left:!1}function jr(e){let t=[...e],n=!0;for(;n;){n=!1;for(let e=0;e<t.length;e++){let r=t[e],i=t.findIndex((t,n)=>e!==n&&(Ar(t,r)||ur(t,r)));if(i!==-1){t[e]=or(t[i],r),t.splice(i,1),n=!0;break}}}return t}let Mr=new WeakMap,Nr=new WeakMap;function Pr(e,t){Mr.has(t)||(Mr.set(t,new Map),Nr.set(t,0));let n=Mr.get(t),r=Ir(e);if(n.has(r)){let i=n.get(r);return t[i]=e,i}let i=Nr.get(t)+1;return n.set(r,i),Nr.set(t,i),t[i]=e,i}function Fr(e){let t={};for(let n in e){let r=T(e[n].map(D));for(let e of r)t[tr(e)]=Number(n)}return t}function Ir(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e!=`object`)return String(e);if(Array.isArray(e)){let t=e.length,n=`[`;for(let r=0;r<t;r++)r>0&&(n+=`,`),n+=Ir(e[r]);return n+`]`}let t=Object.keys(e).sort(),n=`{`;for(let r of t)e[r]!==void 0&&(n+=`"${r}":${Ir(e[r])},`);return n+=`}`,n}var O=class e{jsDate;constructor(e,t,n,r=0,i=0,a=0){this.jsDate=new Date(Date.UTC(e,t,n,r,i,a,0))}static fromTimestamp(t){let n=new Date(t);return new e(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())}static now(){let t=new Date;return new e(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.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()}getQuarter(){return Math.floor(this.getMonth()/3)+1}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()}getIsoWeek(){let e=new Date(this.jsDate.getTime()),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);let n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-n.getTime())/864e5+1)/7)}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)}};let Lr=new O(1899,11,30),Rr=1440*60*1e3,zr=2e3,Br=O.now().getFullYear(),Vr=O.now().getMonth(),Hr=O.fromTimestamp(0).getTime()-Lr.getTime(),Ur=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Wr=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gr=Ft.join(``),Kr=RegExp(`\/|-|${Ft.join(`|`)}`),qr=RegExp(`^(\\d{1,4})[\/${Gr}\-](\\d{1,4})([\/${Gr}\-](\\d{1,4}))?$`),Jr=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Yr(e,t){switch(typeof e){case`number`:return e;case`string`:return Xr(e,t)?Qr(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Xr(e,t){return Qr(e,t)!==null}let Zr=new Map;function Qr(e,t){return Zr.has(t)||Zr.set(t,new Map),Zr.get(t).has(e)||Zr.get(t).set(e,$r(e,t)),Zr.get(t).get(e)}function $r(e,t){e=e.trim();let n=null,r=e.match(Jr);if(r){if(n=si(r[0]),n===null)return null;e=e.replace(r[0],``).trim()}let i=null,a=ei(e,t);if(a){let t=a.dateString.match(Kr)[0];if(i=ni(a,t),i===null)return null;e=e.replace(a.dateString,``).trim()}return e!==``||!(i||n)?null:i&&i.jsDate&&n&&n.jsDate?{value:i.value+n.value,format:i.format+` `+(n.format===`hhhh:mm:ss`?`hh:mm:ss`:n.format),jsDate:new O(i.jsDate.getFullYear()+n.jsDate.getFullYear()-1899,i.jsDate.getMonth()+n.jsDate.getMonth()-11,i.jsDate.getDate()+n.jsDate.getDate()-30,i.jsDate.getHours()+n.jsDate.getHours(),i.jsDate.getMinutes()+n.jsDate.getMinutes(),i.jsDate.getSeconds()+n.jsDate.getSeconds())}:i||n}function ei(e,t){let n=e.match(qr);if(!n)return null;let[,r,i,,a]=n;if(r.length>2&&a&&a.length>2)return null;if(r.length>2)return{year:r,month:i,day:a,dateString:e,type:`ymd`};let o=ti(t);return a?a.length>2?o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:{day:r,month:i,year:a,dateString:e,type:`dmy`}:o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:o===`ymd`?{year:r,month:i,day:a,dateString:e,type:`ymd`}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:null:i.length>2?{month:r,year:i,day:void 0,dateString:e,type:o}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:{month:r,day:i,year:a,dateString:e,type:`mdy`}}function ti(e){switch(e.dateFormat[0]){case`d`:return`dmy`;case`m`:return`mdy`;case`y`:return`ymd`}throw Error(`Invalid date format in locale`)}function ni(e,t){let{year:n,month:r,day:i}=e,a=ai(r),o=oi(i),s=ii(n);if(s===null||a===null||o===null)return null;let c=r?.length===2&&a+1<10||i?.length===2&&o<10,l=n?.length!==2,u=new O(s,a,o);if(u.getMonth()!==a||u.getDate()!==o)return null;let d=u.getTime()-Lr.getTime(),f=ri(e,t,c,l);return{value:Math.round(d/Rr),format:f,jsDate:u}}function ri(e,t,n,r){let i=e.year?r?`yyyy`:`yy`:void 0,a=e.month?n?`mm`:`m`:void 0,o=e.day?n?`dd`:`d`:void 0;switch(e.type){case`mdy`:return[a,o,i].filter(S).join(t);case`ymd`:return[i,a,o].filter(S).join(t);case`dmy`:return[o,a,i].filter(S).join(t)}}function ii(e){if(!e)return Br;let t=Number(e);switch(e.length){case 1:return zr+t;case 2:return zr+(zr+t>Br+10?-100:0)+t;case 3:case 4:return t}return null}function ai(e){if(!e)return Vr;let t=Number(e);return t>=1&&t<=12?t-1:null}function oi(e){if(!e)return 1;let t=Number(e);return t>=0&&t<=31?t:null}function si(e){if(e=e.trim(),Jr.test(e)){let t=/AM/i.test(e),n=/PM/i.test(e),r=(t||n?e.substring(0,e.length-2).trim():e).split(/:/),i=r.length>=2,a=r.length===3,o=Number(r[0]),s=i?Number(r[1]):0,c=a?Number(r[2]):0,l=a?`hh:mm:ss`:`hh:mm`;if(t||n)l+=` a`;else if(!i)return null;o>=12&&t?o-=12:o<12&&n&&(o+=12),s+=Math.floor(c/60),c%=60,o+=Math.floor(s/60),s%=60,o>=24&&(l=`hhhh:mm:ss`);let u=new O(1899,11,30,o,s,c);return{value:o/24+s/1440+c/86400,format:l,jsDate:u}}return null}function ci(e){let t=Math.trunc(e),n=O.fromTimestamp(t*Rr-Hr),r=e-t;r=r<0?1+r:r;let i=Math.round(r*24),a=Math.round((r-i/24)*24*60),o=Math.round((r-i/24-a/24/60)*24*60*60);return n.setHours(i),n.setMinutes(a),n.setSeconds(o),n}function li(e){return Math.round(ui(e))}function ui(e){return(e.getTime()-Lr.getTime())/Rr}function di(e){return new O(e.getFullYear(),e.getMonth()+1,0).getDate()}function fi(e){return di(e)===e.getDate()}function pi(e,t,n){let r=e.getFullYear(),i=e.getMonth(),a=e.getDate(),o=new O(r,i+t,1);return n&&a===di(e)||a>di(o)?o.setDate(di(o)):o.setDate(a),o}function mi(e){let t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function hi(e,t,n){if(e===t)return 0;if(e>t){let n=t;t=e,e=n}let r=ci(e),i=ci(t),a=r.getDate(),o=i.getDate(),s=r.getMonth(),c=i.getMonth(),l=r.getFullYear(),u=i.getFullYear(),d=0,f=0;switch(n){case 0:a===31&&(a=30),a===30&&o===31&&(o=30),s===1&&a===(mi(l)?29:28)&&(a=30,c===1&&o===(mi(u)?29:28)&&(o=30)),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break;case 1:let n=365,r=l===u,i=l+1===u;if(!r&&!i||!r&&s<c||!r&&s===c&&a<o){let e=0,t=0;for(let n=l;n<=u;n++)e++,t+=mi(n)?366:365;n=t/e}else r?mi(l)&&(n=366):(mi(l)&&s<2&&(n=366),mi(u)&&(c>1||c===1&&o===29)&&(n=366));d=e/n,f=t/n;break;case 2:d=e/360,f=t/360;break;case 3:d=e/365,f=t/365;break;case 4:a===31&&(a=30),o===31&&(o=30),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break}return f-d}function gi(e,t){let n=(t.getFullYear()-e.getFullYear())*12+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?n-1:n}function _i(e,t){let n=e.getTime(),r=t.getTime();return Math.floor((r-n)/Rr)}function vi(e,t){let n=t.getFullYear()-e.getFullYear(),r=e.getMonth(),i=t.getMonth(),a=e.getDate(),o=t.getDate();return i>r||i===r&&o>=a?n:n-1}function yi(e,t){return hi(e,t,1)<1}function bi(e,t){return Math.trunc(e)===Math.trunc(t)}function xi(e,t,n){return t>n?xi(e,n,t):(e=Math.trunc(e),t=Math.trunc(t),n=Math.trunc(n),e>=t&&e<=n)}function Si(e,t){return Math.trunc(e)<Math.trunc(t)}function Ci(e,t){return Math.trunc(e)<=Math.trunc(t)}function wi(e,t){return Math.trunc(e)>Math.trunc(t)}function Ti(e,t){return Math.trunc(e)>=Math.trunc(t)}let Ei=Rt(function(e){return e=nt(e),RegExp(`(?:^-?\\d+(?:${e}?\\d*(?:e(\\+|-)?\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)}),Di=Rt(function(e){let t=nt(e.decimalSeparator),n=`(?:\\d+(?:${nt(e.thousandsSeparator||``)}\\d{3,})*(?:${t}\\d*)?)`,r=`(?:${t}\\d+)`,i=`(?:\\s*`+n+`|`+r+`)(?:e(?:\\+|-)?\\d+)?(?:\\s*%)?`,a=`^(?:(?:`+[`(?:\\s*-)?(?:\\s*[\\$€])?`+i,`(?:\\s*-)?`+i+`(?:\\s*[\\$€])?`,`(?:\\s*[\\$€])?(?:\\s*-)?`+i].join(`)|(?:`)+`))$`;return new RegExp(a,`i`)});function Oi(e,t){return e?Di(t).test(e.trim()):!1}let ki=Rt(function(e){return RegExp(`[\$€${nt(e.thousandsSeparator||``)}]`,`g`)});function Ai(e,t){e=e.replace(ki(t),``),t.decimalSeparator!==`.`&&(e=e.replace(t.decimalSeparator,`.`));let n=Number(e);return isNaN(n)&&e.includes(`%`)&&(n=Number(e.split(`%`)[0]),!isNaN(n))?n/100:n}function ji(e,t,n){let r=[...e].sort((e,t)=>e-t),i=(r.length+(n?-1:1))*t;if(n||i--,Number.isInteger(i))return r[i];let a=Math.ceil(i),o=Math.floor(i);return r[a]*(i-o)+r[o]*(a-i)}function Mi(e){return`sheetId`in e}function Ni(e){return`dimension`in e&&`sheetId`in e&&`elements`in e}function Pi(e){return`target`in e&&`sheetId`in e}function Fi(e){return`ranges`in e}function Ii(e){return`col`in e&&`row`in e&&`sheetId`in e}function Li(e){return`sheetId`in e&&`zone`in e}let Ri=new Set([`RENAME_SHEET`,`DELETE_SHEET`,`CREATE_SHEET`,`DUPLICATE_SHEET`,`ADD_COLUMNS_ROWS`,`REMOVE_COLUMNS_ROWS`,`UNDO`,`REDO`,`ADD_MERGE`,`REMOVE_MERGE`,`UPDATE_LOCALE`,`ADD_PIVOT`,`UPDATE_PIVOT`,`INSERT_PIVOT`,`RENAME_PIVOT`,`REMOVE_PIVOT`,`DUPLICATE_PIVOT`]),zi=new Set([`EVALUATE_CELLS`,`UPDATE_CELL`,`UNHIDE_COLUMNS_ROWS`,`HIDE_COLUMNS_ROWS`,`GROUP_HEADERS`,`UNGROUP_HEADERS`,`FOLD_ALL_HEADER_GROUPS`,`FOLD_HEADER_GROUP`,`FOLD_HEADER_GROUPS_IN_ZONE`,`UNFOLD_ALL_HEADER_GROUPS`,`UNFOLD_HEADER_GROUP`,`UNFOLD_HEADER_GROUPS_IN_ZONE`,`UPDATE_TABLE`,`UPDATE_FILTER`,`UNDO`,`REDO`]),Bi=new Set([`MOVE_RANGES`]),Vi=new Set([`EVALUATE_CELLS`,`ADD_CONDITIONAL_FORMAT`,`REMOVE_CONDITIONAL_FORMAT`,`CHANGE_CONDITIONAL_FORMAT_PRIORITY`]),Hi=new Set([`AUTOFILL_CELL`,`SET_BORDER`,`SET_ZONE_BORDERS`,`SET_BORDERS_ON_TARGET`]),Ui=new Set([`START`,`ACTIVATE_SHEET`,`COPY`,`RESIZE_SHEETVIEW`,`SET_VIEWPORT_OFFSET`,`EVALUATE_CELLS`,`SET_FORMULA_VISIBILITY`,`UPDATE_FILTER`]),Wi=new Set(`UPDATE_CELL.UPDATE_CELL_POSITION.CLEAR_CELL.CLEAR_CELLS.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.COLOR_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.SET_BORDERS_ON_TARGET.CREATE_CHART.UPDATE_CHART.CREATE_TABLE.REMOVE_TABLE.UPDATE_TABLE.CREATE_TABLE_STYLE.REMOVE_TABLE_STYLE.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.ADD_PIVOT.UPDATE_PIVOT.INSERT_PIVOT.RENAME_PIVOT.REMOVE_PIVOT.DUPLICATE_PIVOT`.split(`.`));function Gi(e){return Wi.has(e.type)}function Ki(e){return Ui.has(e.type)}var qi=class{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter(e=>e!==`Success`)}static get Success(){return Ji}get isSuccessful(){return this.reasons.length===0}isCancelledBecause(e){return this.reasons.includes(e)}};let Ji=new qi,Yi=function(e){return e.Success=`Success`,e.CancelledForUnknownReason=`CancelledForUnknownReason`,e.WillRemoveExistingMerge=`WillRemoveExistingMerge`,e.CannotMoveTableHeader=`CannotMoveTableHeader`,e.MergeIsDestructive=`MergeIsDestructive`,e.CellIsMerged=`CellIsMerged`,e.InvalidTarget=`InvalidTarget`,e.EmptyUndoStack=`EmptyUndoStack`,e.EmptyRedoStack=`EmptyRedoStack`,e.NotEnoughElements=`NotEnoughElements`,e.NotEnoughSheets=`NotEnoughSheets`,e.MissingSheetName=`MissingSheetName`,e.UnchangedSheetName=`UnchangedSheetName`,e.DuplicatedSheetName=`DuplicatedSheetName`,e.DuplicatedSheetId=`DuplicatedSheetId`,e.ForbiddenCharactersInSheetName=`ForbiddenCharactersInSheetName`,e.WrongSheetMove=`WrongSheetMove`,e.WrongSheetPosition=`WrongSheetPosition`,e.InvalidAnchorZone=`InvalidAnchorZone`,e.SelectionOutOfBound=`SelectionOutOfBound`,e.TargetOutOfSheet=`TargetOutOfSheet`,e.WrongCutSelection=`WrongCutSelection`,e.WrongPasteSelection=`WrongPasteSelection`,e.WrongPasteOption=`WrongPasteOption`,e.WrongFigurePasteOption=`WrongFigurePasteOption`,e.EmptyClipboard=`EmptyClipboard`,e.EmptyRange=`EmptyRange`,e.InvalidRange=`InvalidRange`,e.InvalidZones=`InvalidZones`,e.InvalidSheetId=`InvalidSheetId`,e.InvalidCellId=`InvalidCellId`,e.InvalidFigureId=`InvalidFigureId`,e.InputAlreadyFocused=`InputAlreadyFocused`,e.MaximumRangesReached=`MaximumRangesReached`,e.MinimumRangesReached=`MinimumRangesReached`,e.InvalidChartDefinition=`InvalidChartDefinition`,e.InvalidDataSet=`InvalidDataSet`,e.InvalidLabelRange=`InvalidLabelRange`,e.InvalidScorecardKeyValue=`InvalidScorecardKeyValue`,e.InvalidScorecardBaseline=`InvalidScorecardBaseline`,e.InvalidGaugeDataRange=`InvalidGaugeDataRange`,e.EmptyGaugeRangeMin=`EmptyGaugeRangeMin`,e.GaugeRangeMinNaN=`GaugeRangeMinNaN`,e.EmptyGaugeRangeMax=`EmptyGaugeRangeMax`,e.GaugeRangeMaxNaN=`GaugeRangeMaxNaN`,e.GaugeRangeMinBiggerThanRangeMax=`GaugeRangeMinBiggerThanRangeMax`,e.GaugeLowerInflectionPointNaN=`GaugeLowerInflectionPointNaN`,e.GaugeUpperInflectionPointNaN=`GaugeUpperInflectionPointNaN`,e.GaugeLowerBiggerThanUpper=`GaugeLowerBiggerThanUpper`,e.InvalidAutofillSelection=`InvalidAutofillSelection`,e.MinBiggerThanMax=`MinBiggerThanMax`,e.LowerBiggerThanUpper=`LowerBiggerThanUpper`,e.MidBiggerThanMax=`MidBiggerThanMax`,e.MinBiggerThanMid=`MinBiggerThanMid`,e.FirstArgMissing=`FirstArgMissing`,e.SecondArgMissing=`SecondArgMissing`,e.MinNaN=`MinNaN`,e.MidNaN=`MidNaN`,e.MaxNaN=`MaxNaN`,e.ValueUpperInflectionNaN=`ValueUpperInflectionNaN`,e.ValueLowerInflectionNaN=`ValueLowerInflectionNaN`,e.MinInvalidFormula=`MinInvalidFormula`,e.MidInvalidFormula=`MidInvalidFormula`,e.MaxInvalidFormula=`MaxInvalidFormula`,e.ValueUpperInvalidFormula=`ValueUpperInvalidFormula`,e.ValueLowerInvalidFormula=`ValueLowerInvalidFormula`,e.InvalidSortZone=`InvalidSortZone`,e.WaitingSessionConfirmation=`WaitingSessionConfirmation`,e.MergeOverlap=`MergeOverlap`,e.TooManyHiddenElements=`TooManyHiddenElements`,e.Readonly=`Readonly`,e.InvalidViewportSize=`InvalidViewportSize`,e.InvalidScrollingDirection=`InvalidScrollingDirection`,e.ViewportScrollLimitsReached=`ViewportScrollLimitsReached`,e.FigureDoesNotExist=`FigureDoesNotExist`,e.InvalidConditionalFormatId=`InvalidConditionalFormatId`,e.InvalidConditionalFormatType=`InvalidConditionalFormatType`,e.InvalidCellPopover=`InvalidCellPopover`,e.EmptyTarget=`EmptyTarget`,e.InvalidFreezeQuantity=`InvalidFreezeQuantity`,e.FrozenPaneOverlap=`FrozenPaneOverlap`,e.ValuesNotChanged=`ValuesNotChanged`,e.InvalidFilterZone=`InvalidFilterZone`,e.TableNotFound=`TableNotFound`,e.TableOverlap=`TableOverlap`,e.InvalidTableConfig=`InvalidTableConfig`,e.InvalidTableStyle=`InvalidTableStyle`,e.FilterNotFound=`FilterNotFound`,e.MergeInTable=`MergeInTable`,e.NonContinuousTargets=`NonContinuousTargets`,e.DuplicatedFigureId=`DuplicatedFigureId`,e.InvalidSelectionStep=`InvalidSelectionStep`,e.DuplicatedChartId=`DuplicatedChartId`,e.ChartDoesNotExist=`ChartDoesNotExist`,e.InvalidHeaderIndex=`InvalidHeaderIndex`,e.InvalidQuantity=`InvalidQuantity`,e.MoreThanOneColumnSelected=`MoreThanOneColumnSelected`,e.EmptySplitSeparator=`EmptySplitSeparator`,e.SplitWillOverwriteContent=`SplitWillOverwriteContent`,e.NoSplitSeparatorInSelection=`NoSplitSeparatorInSelection`,e.NoActiveSheet=`NoActiveSheet`,e.InvalidLocale=`InvalidLocale`,e.MoreThanOneRangeSelected=`MoreThanOneRangeSelected`,e.NoColumnsProvided=`NoColumnsProvided`,e.ColumnsNotIncludedInZone=`ColumnsNotIncludedInZone`,e.DuplicatesColumnsSelected=`DuplicatesColumnsSelected`,e.InvalidHeaderGroupStartEnd=`InvalidHeaderGroupStartEnd`,e.HeaderGroupAlreadyExists=`HeaderGroupAlreadyExists`,e.UnknownHeaderGroup=`UnknownHeaderGroup`,e.UnknownDataValidationRule=`UnknownDataValidationRule`,e.UnknownDataValidationCriterionType=`UnknownDataValidationCriterionType`,e.InvalidDataValidationCriterionValue=`InvalidDataValidationCriterionValue`,e.InvalidNumberOfCriterionValues=`InvalidNumberOfCriterionValues`,e.InvalidCopyPasteSelection=`InvalidCopyPasteSelection`,e.NoChanges=`NoChanges`,e.InvalidInputId=`InvalidInputId`,e.SheetIsHidden=`SheetIsHidden`,e.InvalidTableResize=`InvalidTableResize`,e.PivotIdNotFound=`PivotIdNotFound`,e.PivotInError=`PivotInError`,e.EmptyName=`EmptyName`,e.ValueCellIsInvalidFormula=`ValueCellIsInvalidFormula`,e.InvalidDefinition=`InvalidDefinition`,e.InvalidColor=`InvalidColor`,e.InvalidPivotDataSet=`InvalidPivotDataSet`,e}({}),Xi=[{name:`English (US)`,code:`en_US`,thousandsSeparator:`,`,decimalSeparator:`.`,weekStart:7,dateFormat:`m/d/yyyy`,timeFormat:`hh:mm:ss a`,formulaArgSeparator:`,`},{name:`French`,code:`fr_FR`,thousandsSeparator:` `,decimalSeparator:`,`,weekStart:1,dateFormat:`dd/mm/yyyy`,timeFormat:`hh:mm:ss`,formulaArgSeparator:`;`}],k=Xi[0],Zi=[`thin`,`medium`,`thick`,`dashed`,`dotted`];function A(e){return Array.isArray(e)&&Array.isArray(e[0])}let Qi={Background:0,Highlights:1,Clipboard:2,Chart:4,Autofill:5,Selection:6,Headers:100},$i=Rt(()=>Object.keys(Qi).sort((e,t)=>Qi[e]-Qi[t]));function ea(e,t){if(Qi[e])throw Error(`Layer ${e} already exists`);Qi[e]=t}let j={NotAvailable:`#N/A`,InvalidReference:`#REF`,BadExpression:`#BAD_EXPR`,CircularDependency:`#CYCLE`,UnknownFunction:`#NAME?`,DivisionByZero:`#DIV/0!`,SpilledBlocked:`#SPILL!`,GenericError:`#ERROR`,NullError:`#NULL!`},ta=new Set(Object.values(j));var M=class{message;value;constructor(e=E(`Error`),t=j.GenericError){this.message=e,this.value=t,this.message=e.toString()}},na=class extends M{constructor(e=E(`Invalid expression`)){super(e,j.BadExpression)}},ra=class extends M{constructor(e=E(`Circular reference`)){super(e,j.CircularDependency)}},ia=class extends M{constructor(e=E(`Invalid reference`)){super(e,j.InvalidReference)}},aa=class extends M{constructor(e=E(`Data not available`)){super(e,j.NotAvailable)}},oa=class extends M{constructor(e=E(`Unknown function`)){super(e,j.UnknownFunction)}},sa=class extends M{constructor(e=E(`Spill range is not empty`)){super(e,j.SpilledBlocked)}};let ca=[`number`,`string`,`boolean`,`undefined`];function N(e,t,n){if(!e())throw new M(t,n)}function la(e){if(e!==void 0)return A(e)?e[0][0]?.format:e.format}function P(e){return typeof e==`string`&&ta.has(e)}let ua=e=>E(`The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.`,e),da=(e,t,n)=>E(`The function [[FUNCTION_NAME]] expects a number value between %s and %s inclusive, but receives %s.`,e.toString(),t.toString(),n.toString()),fa=(e,t)=>E(`The function [[FUNCTION_NAME]] has an argument with value '%s'. It should be one of: %s.`,t,e.map(e=>`'${e}'`).join(`, `));function F(e,t){let n=Ca(e);switch(typeof n){case`number`:return n;case`boolean`:return+!!n;case`string`:if(Oi(n,t)||n===``)return Ai(n,t);let e=Qr(n,t);if(e)return e.value;throw new M(ua(n));default:return 0}}function pa(e,t){try{return F(e,t)}catch{return}}function ma(e,t){return z(e).map(e=>e.map(e=>{if(typeof e.value!=`number`){let n=``;throw typeof e==`object`?n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got an empty value.`,t):typeof e==`string`?n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got a string.`,t):typeof e==`boolean`&&(n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got a boolean.`,t)),new M(n)}return e.value}))}function ha(e,t){let n=Ca(e);if(n===``)throw new M(ua(n));return F(n,t)}function ga(e,t){return Math.trunc(F(e,t))}function _a(e,t){return Math.trunc(ha(e,t))}function va(e){N(()=>e>=1,E(`The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.`,e.toString()))}function ya(e){N(()=>e!==0,E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero)}function I(e){let t=Ca(e);switch(typeof t){case`string`:return t;case`number`:return t.toString();case`boolean`:return t?`TRUE`:`FALSE`;default:return``}}let ba=Rt(function(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}),xa=e=>E(`The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a boolean.`,e);function L(e){let t=Ca(e);switch(typeof t){case`boolean`:return t;case`string`:if(t){let e=t.toUpperCase();if(e===`TRUE`)return!0;if(e===`FALSE`)return!1;throw new M(xa(t))}else return!1;case`number`:return!!t;default:return!1}}function Sa(e){let t=Ca(e);if(t===``)throw new M(xa(t));return L(t)}function R(e,t){return ci(F(Ca(e),t))}function Ca(e){if(typeof e==`object`&&e&&`value`in e){if(P(e.value))throw e;return e.value}if(P(e))throw new M(``,e);return e}function wa(e,t,n){for(let r of e)if(A(r)){let e=r.length,n=r[0].length;for(let i=0;i<n;i++)for(let n=0;n<e;n++)t(r[n][i])}else n(r)}function Ta(e,t){wa(e,e=>{if(P(e.value))throw e;t(e)},e=>{if(P(e?.value))throw e;t(e)})}function Ea(e,t,n){wa(e,e=>{if(typeof e?.value==`number`&&t(e),P(e?.value))throw e},e=>{t({value:ha(e,n),format:e?.format})})}function Da(e,t,n,r,i=`rowFirst`){let a=r;for(let r of e)if(A(r)){let e=r.length,n=r[0].length;if(i===`rowFirst`)for(let i=0;i<n;i++)for(let n=0;n<e;n++)a=t(a,r[n][i]);else for(let i=0;i<e;i++)for(let e=0;e<n;e++)a=t(a,r[i][e])}else a=n(a,r);return a}function Oa(e,t,n,r=`rowFirst`){return Da(e,t,t,n,r)}function ka(e,t,n,r){return Da(e,(e,n)=>{let r=n?.value;if(typeof r==`number`)return t(e,r);if(P(r))throw n;return e},(e,n)=>t(e,ha(n,r)),n)}function Aa(e,t,n,r){return Da(e,(e,n)=>{let i=n?.value;if(i!=null){if(typeof i==`number`)return t(e,i);if(typeof i==`boolean`)return t(e,F(i,r));if(P(i))throw n;return t(e,0)}return e},(e,n)=>t(e,F(n,r)),n)}function ja(e,t,n){let r=Array(e);for(let i=0;i<e;i++){r[i]=Array(t);for(let e=0;e<t;e++)r[i][e]=n(i,e)}return r}function Ma(e,t){return e.length===0?[]:ja(e.length,e[0].length,(n,r)=>t(e[n][r]))}function Na(e,t){let n=e.length,r=e[0]?.length??0;for(let i=0;i<n;i++)for(let n=0;n<r;n++)t(e[i][n])}function Pa(e){return e.length?ja(e[0].length,e.length,(t,n)=>e[n][t]):[]}function Fa(e,t,n=void 0){let r=1,i=1,a=1/0,o=1/0,s;for(let e=0;e<t.length;e++){let c=t[e];if(A(c)&&(n===void 0||n[e])){let n=c.length,l=c[0].length;n!==1||l!==1?(s??=Array(t.length),n!==1&&l!==1?(s[e]=`matrix`,r=Math.max(r,n),i=Math.max(i,l),a=Math.min(a,n),o=Math.min(o,l)):n===1?l!==1&&(s[e]=`vertical`,i=Math.max(i,l),o=Math.min(o,l)):(s[e]=`horizontal`,r=Math.max(r,n),a=Math.min(a,n))):t[e]=c[0][0]}}if(r===1&&i===1)return e(...t);let c=(e,n)=>t.map((t,r)=>{switch(s?.[r]){case`matrix`:return t[e][n];case`horizontal`:return t[e][0];case`vertical`:return t[0][n];case void 0:return t}});return ja(r,i,(t,n)=>{if(t>a-1||n>o-1)return new aa(E(`Array arguments to [[FUNCTION_NAME]] are of different size.`));let r=e(...c(t,n));return A(r)?r[0][0]:r})}function Ia(e,t,n){for(let r of e)if(A(r)){let e=r.length,n=r[0].length;for(let i=0;i<n;i++)for(let n=0;n<e;n++)if(!t(r[n][i]??void 0))return}else if(!n(r))return}function La(e,t){return Ia(e,e=>{let n=e?.value;if(typeof n==`boolean`)return t(n);if(typeof n==`number`)return t(!!n);if(P(n))throw e;return!0},e=>e!==void 0&&e.value!==null?t(Sa(e)):!0)}function Ra(e,t){let n,r,i=e.substring(0,2);return i===`<=`||i===`>=`||i===`<>`?(n=i,r=e.substring(2)):(i=e.substring(0,1),i===`<`||i===`>`||i===`=`?(n=i,r=e.substring(1)):(n=`=`,r=e)),Oi(r,t)||Xr(r,t)?r=F(r,t):(r===`TRUE`||r===`FALSE`)&&(r=L(r)),{operator:n,operand:r}}let za=Rt(function(e){if(e===`*`)return/.+/;let t=``,n=``;for(let r of e)r===`?`&&n!==`~`?t+=`.`:r===`*`&&n!==`~`?t+=`.*`:((r===`*`||r===`?`)&&(t=t.slice(0,-1)),[`^`,`.`,`[`,`]`,`$`,`(`,`)`,`*`,`+`,`?`,`|`,`{`,`}`,`\\`].includes(r)&&(t+=`\\`),t+=r),n=r;return RegExp(`^`+t+`$`,`i`)});function Ba(e=``,t,n){let{operator:r,operand:i}=t;if(i===void 0||e===null||i===null)return!1;if(typeof i==`number`&&r===`=`)return typeof e==`string`&&(Oi(e,n)||Xr(e,n))?F(e,n)===i:e===i;if(r===`<>`||r===`=`){let t;return t=typeof e==typeof i?typeof e==`string`&&typeof i==`string`?za(i).test(e):e===i:!1,r===`=`?t:!t}if(typeof e==typeof i)switch(r){case`<`:return e<i;case`>`:return e>i;case`<=`:return e<=i;case`>=`:return e>=i}return!1}function Va(e,t,n,r=!1){let i=e.length;if(i%2==1)throw new M(E(`Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs.`));let a=z(e[0]),o=a.length,s=a[0].length,c=[];for(let t=0;t<i-1;t+=2){let i=z(e[t]);if(i.length!==o||i[0].length!==s)throw new M(E(`Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension`));let a=Ra(I(e[t+1]),n);r&&typeof a.operand==`string`&&(a.operand+=`*`),c.push(a)}for(let r=0;r<o;r++)for(let a=0;a<s;a++){let o=!0;for(let t=0;t<i-1;t+=2){let i=z(e[t])[r][a].value,s=c[t/2];if(o=Ba(i??void 0,s,n),!o)break}o&&t(r,a)}}function Ha(e,t,n,r,i,a){if(t===void 0||t.value===null)return-1;if(P(t.value))throw t;let o=Ga(t.value),s=typeof o,c,l,u=0,d=i-1,f,p,m,h,g=r===`desc`?t=>Ga(a(e,i-t-1)):t=>Ga(a(e,t));for(;d-u>=0;){for(f=Math.floor((u+d)/2),p=f,m=g(p),h=typeof m;u<p&&s!==h;)p--,m=g(p),h=typeof m;if(h!==s||m==null){u=f+1;continue}n===`strict`&&m===o?(c=m,l=p):n===`nextSmaller`&&m<=o?(c==null||c<m||c===m&&l<p)&&(c=m,l=p):n===`nextGreater`&&m>=o&&(c===void 0||c>m||c===m&&l<p)&&(c=m,l=p),m>o||n===`strict`&&m===o?d=p-1:u=f+1}return l===void 0?-1:r===`desc`?i-l-1:l}function Ua(e,t,n,r,i,a,o=!1){if(t===void 0||t.value===null)return-1;if(P(t.value))throw t;let s=Ga(t.value),c=o?(e,t)=>Ga(i(e,r-t-1)):(e,t)=>Ga(i(e,t)),l=n!==`wildcard`||typeof s!=`string`||!(s.includes(`*`)||s.includes(`?`));if(a&&l){let t=o?`reverseSearch`:`forwardSearch`,i=a[t].get(e);if(i===void 0){i=new Map;for(let t=0;t<r;t++){let n=c(e,t)??null;i.has(n)||i.set(n,t)}a[t].set(e,i)}if(i.has(s)){let e=i.get(s);return o?r-e-1:e}if(n===`strict`)return-1}let u=Wa(e,s,n,r,c);return o&&u!==-1?r-u-1:u}function Wa(e,t,n,r,i){let a=n=>i(e,n)===t;if(n===`wildcard`&&typeof t==`string`&&(t.includes(`*`)||t.includes(`?`))){let n=za(t);a=t=>{let r=i(e,t);return typeof r==`string`?n.test(r):!1}}let o,s=-1;n===`nextSmaller`&&(a=n=>{let r=i(e,n);return(!o&&Ka(t,r)>=0||Ka(t,r)>=0&&Ka(r,o)>0)&&(o=r,s=n),r===t}),n===`nextGreater`&&(a=n=>{let r=i(e,n);return(!o&&Ka(t,r)<=0||Ka(t,r)<=0&&Ka(r,o)<0)&&(o=r,s=n),r===t});for(let e=0;e<r;e++)if(a(e))return e;return s}function Ga(e){return typeof e==`string`?ba(e):e}function Ka(e,t){let n=ca.indexOf(typeof e)-ca.indexOf(typeof t);return n===0&&(typeof e==`string`&&typeof t==`string`?n=e.localeCompare(t):typeof e==`number`&&typeof t==`number`?n=e-t:typeof e==`boolean`&&typeof t==`boolean`&&(n=Number(e)-Number(t))),n}function z(e){return e===void 0?[[]]:A(e)?e:[[e]]}function qa(e,t){return Oa(e,(e,n)=>(e.push(t(n)),e),[],`rowFirst`)}function Ja(e){if(e===void 0)return!1;let{value:t}=e;return!(t===null||t===``)}function Ya(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}let Xa=new h;function Za(e,t){return e=Ya(e),{url:e,label:t||e,isExternal:!0,isUrlEditable:!0}}Xa.add(`sheet_URL`,{match:e=>vt(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){let n=bt(e);return t.tryGetSheetName(n)||E(`Invalid sheet`)},open(e,t){let n=bt(e);t.model.dispatch(`ACTIVATE_SHEET`,{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:n}).isCancelledBecause(`SheetIsHidden`)&&t.notifyUser({type:`warning`,sticky:!1,text:E(`Cannot open the link because the linked sheet is hidden.`)})},sequence:0});let Qa={createLink:Za,match:e=>mt(e),open:e=>window.open(e,`_blank`),urlRepresentation:e=>e,sequence:0};function $a(e){return Xa.getAll().sort((e,t)=>e.sequence-t.sequence).find(t=>t.match(e))||Qa}function eo(e,t){return $a(e.url).urlRepresentation(e.url,t)}function to(e,t){$a(e.url).open(e.url,t)}function no(e){if(typeof e==`string`){if(pt(e)){let{label:t,url:n}=gt(e);return $a(n).createLink(n,t)}else if(mt(e))return Za(e)}}function ro(e){e=e.replace(/\s/g,` `);let t=new qt(e),n=[],r=[];for(n.push(r);!t.isOver();){if(t.current===`;`){r=[],n.push(r),t.shift();continue}let e=fo(t)||io(t)||oo(t)||so(t)||lo(t)||uo(t)||mo(t)||co(t)||ho(t);if(!e)throw Error(`Unknown token at `+t.remaining());r.push(e)}return n}function io(e){let t;if(e.current===`"`?(e.shift(),t=`"`):e.currentStartsWith(`[$`)&&(e.advanceBy(2),t=`]`),!t)return null;let n=``;for(;e.current&&e.current!==t;)n+=e.shift();if(e.current===t)e.shift();else throw Error(`Unterminated string in format`);return{type:`STRING`,value:n}}let ao=new Set(`$+-/():!^&~{}<>= `);function oo(e){if(e.current===`\\`){e.shift();let t=e.shift();if(!t)throw Error(`Unexpected end of format string`);return{type:`CHAR`,value:t}}return ao.has(e.current)?{type:`CHAR`,value:e.shift()}:null}function so(e){return e.current===`,`?(e.shift(),{type:`THOUSANDS_SEPARATOR`,value:`,`}):null}function co(e){return e.current===`@`?(e.shift(),{type:`TEXT_PLACEHOLDER`,value:`@`}):null}function lo(e){return e.current===`.`?(e.shift(),{type:`DECIMAL_POINT`,value:`.`}):null}function uo(e){return e.current===`%`?(e.shift(),{type:`PERCENT`,value:`%`}):null}function fo(e){if(e.current===`0`||e.current===`#`){let t=e.current;return e.shift(),{type:`DIGIT`,value:t}}return null}let po=new Set(`dmqyhsa`);function mo(e){if(!po.has(e.current))return null;let t=e.current,n=``;for(;e.current===t;)n+=e.shift();return{type:`DATE_PART`,value:n}}function ho(e){if(e.current!==`*`)return null;e.shift();let t=e.shift();if(!t)throw Error(`Unexpected end of format string`);return{type:`REPEATED_CHAR`,value:t}}let go={};function _o(e){let t=go[e];return t===void 0&&(t=vo(e),go[e]=t),t}function vo(e){let t=ro(e);for(let e of t){let t=e.filter(e=>e.type===`REPEATED_CHAR`);for(let e of t.slice(1))e.type=`CHAR`}let n=Co(t[0])||So(t[0])||wo(t[0]);if(!n)throw Error(`Invalid first format part of: `+e);if(t.length>1&&n.type===`text`)throw Error(`The first format in a multi-part format must be a number format: `+e);let r=Co(t[1])||So(t[1]);if(t[1]?.length&&!r)throw Error(`Invalid second format part of: `+e);let i=Co(t[2])||So(t[2]);if(t[2]?.length&&!i)throw Error(`Invalid third format part of: `+e);let a=wo(t[3]);if(t[3]?.length&&!a)throw Error(`Invalid fourth format part of: `+e);return{positive:n,negative:r,zero:i,text:a}}function yo(e){return e.every(e=>e.type===`DATE_PART`||e.type===`DECIMAL_POINT`||e.type===`THOUSANDS_SEPARATOR`||e.type===`STRING`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function bo(e){return e.every(e=>e.type===`DIGIT`||e.type===`DECIMAL_POINT`||e.type===`THOUSANDS_SEPARATOR`||e.type===`PERCENT`||e.type===`STRING`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function xo(e){return e.every(e=>e.type===`STRING`||e.type===`TEXT_PLACEHOLDER`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function So(e){if(!e||!bo(e))return;let t=[],n,r=t,i=0,a=0,o=e.findLastIndex(e=>e.type===`DIGIT`),s=!1,c=0;for(let l=0;l<e.length;l++){let u=e[l];switch(u.type){case`DIGIT`:r===t?r.push(u):c<20&&(r.push(u),c++);break;case`DECIMAL_POINT`:if(r===t)n=[],r=n;else throw Error(`Multiple decimal points in a number format`);break;case`REPEATED_CHAR`:case`CHAR`:case`STRING`:r.push(u);break;case`PERCENT`:i++,r.push(u);break;case`THOUSANDS_SEPARATOR`:l-1===o?(a+=1,o++,r.push(u)):e[l+1]?.type===`DIGIT`&&e[l-1]?.type===`DIGIT`?(r===t&&(s=!0),r.push(u)):r.push({type:`CHAR`,value:`,`});break}}return{type:`number`,integerPart:t,decimalPart:n,percentSymbols:i,thousandsSeparator:s,magnitude:a}}function Co(e){let t=e&&yo(e)?{type:`date`,tokens:e}:void 0;if(t){if(t.tokens.length&&t.tokens.every(e=>e.type===`DATE_PART`&&e.value===`a`))throw Error(`Invalid date format`);return{type:`date`,tokens:To(t.tokens.map(e=>e.type===`THOUSANDS_SEPARATOR`||e.type===`DECIMAL_POINT`?{type:`CHAR`,value:e.value}:e))}}}function wo(e){return e&&xo(e)?{type:`text`,tokens:e}:void 0}function To(e){let t=e.filter(e=>e.type===`DATE_PART`);for(let e=0;e<t.length;e++)!t[e].value.startsWith(`m`)||t[e].value.length>2||(t[e-1]?.value.startsWith(`h`)||t[e+1]?.value.startsWith(`s`))&&(t[e].value=t[e].value.replaceAll(`m`,`M`));return e}function Eo(e){return[Do(e.positive),Do(e.negative),Do(e.zero),Do(e.text)].filter(S).join(`;`)}function Do(e){if(!e)return;let t=``,n=e.type===`number`?Oo(e):e.tokens;for(let e of n)switch(e.type){case`STRING`:t+=`[$${e.value}]`;break;case`CHAR`:t+=ko(e.value)?`\\${e.value}`:e.value;break;case`REPEATED_CHAR`:t+=`*`+e.value;break;case`DATE_PART`:t+=e.value===`MM`?`mm`:e.value;break;default:t+=e.value}return t}function Oo(e){let t=[...e.integerPart];return e.decimalPart&&(t.push({type:`DECIMAL_POINT`,value:`.`}),t.push(...e.decimalPart)),t}function ko(e){return!ao.has(e)}let Ao=`REPEATED_CHAR_PLACEHOLDER_`,jo={0:E(`January`),1:E(`February`),2:E(`March`),3:E(`April`),4:E(`May`),5:E(`June`),6:E(`July`),7:E(`August`),8:E(`September`),9:E(`October`),10:E(`November`),11:E(`December`)},Mo={0:E(`Sunday`),1:E(`Monday`),2:E(`Tuesday`),3:E(`Wednesday`),4:E(`Thursday`),5:E(`Friday`),6:E(`Saturday`)};function B(e,{format:t,locale:n,formatWidth:r}){switch(typeof e==`boolean`&&(e=e?`TRUE`:`FALSE`),typeof e){case`string`:{if(e.includes(`\\"`)&&(e=e.replaceAll(/\\"/g,`"`)),!t)return e;let n=_o(t),i=n.text||n.positive;return!i||i.type!==`text`?e:No(e,i,r)}case`number`:t||=Yo(e);let i=_o(t);if(i.positive.type===`text`)return No(e.toString(),i.positive,r);let a=i.positive;if(e<0&&i.negative?(a=i.negative,e=-e):e===0&&i.zero&&(a=i.zero),a.type===`date`)return Po(Ko(e,a),r);let o=e<0,s=Po(Fo(Math.abs(e),a,n),r);return o?`-`+s:s;case`object`:return``}}function No(e,t,n){let r=``;for(let n of t.tokens)switch(n.type){case`TEXT_PLACEHOLDER`:r+=e;break;case`CHAR`:case`STRING`:r+=n.value;break;case`REPEATED_CHAR`:r+=Ao+n.value;break}return Po(r,n)}function Po(e,t){let n=e.indexOf(Ao);if(n===-1)return e;let r=e.slice(0,n),i=e.slice(n+26+1),a=e[n+26];function o(){if(!t)return{timesToRepeat:0,padding:``};let e=t.measureText(r+i),n=t.measureText(a),o=t.availableWidth-e;if(o<=0)return{timesToRepeat:0,padding:``};let s=Math.floor(o/n),c=o-s*n,l=t.measureText(` `);return{timesToRepeat:s,padding:` `.repeat(Math.floor(c/l))}}let{timesToRepeat:s,padding:c}=o();return r+a.repeat(s)+c+i}function Fo(e,t,n){if(e===1/0)return`∞`+(t.percentSymbols?`%`:``);let r=t.percentSymbols*2-t.magnitude*3;e*=10**r;let i=0;t.decimalPart!==void 0&&(i=t.decimalPart.filter(e=>e.type===`DIGIT`).length);let{integerDigits:a,decimalDigits:o}=zo(Math.abs(e),i),s=Io(a,t,t.thousandsSeparator?n.thousandsSeparator:void 0);return t.decimalPart!==void 0&&(s+=n.decimalSeparator+Lo(o||``,t)),s}function Io(e,t,n){let r=t.integerPart;r.some(e=>e.type===`DIGIT`)||(r=[...r,{type:`DIGIT`,value:`#`}]),e===`0`&&(e=``);let i=``,a=r.findIndex(e=>e.type===`DIGIT`),o=e.length-1;function s(t,r){if(r===`0`&&(t||=`0`),!t)return;let a=e.length-1-o;i=n&&a>0&&a%3==0?t+n+i:t+i}for(let t=r.length-1;t>=0;t--){let n=r[t];switch(n.type){case`DIGIT`:let r=e[o];if(s(r,n.value),o--,a===t)for(;o>=0;)s(e[o],`0`),o--;break;case`THOUSANDS_SEPARATOR`:break;case`REPEATED_CHAR`:i=Ao+n.value+i;break;default:i=n.value+i;break}}return i}function Lo(e,t){if(!t.decimalPart)return``;let n=``,r=0;for(let i of t.decimalPart)switch(i.type){case`DIGIT`:let t=i.value===`#`?e[r]||``:e[r]||`0`;n+=t,r++;break;case`THOUSANDS_SEPARATOR`:break;case`REPEATED_CHAR`:n+=Ao+i.value;break;default:n+=i.value;break}return n}let Ro=[];function zo(e,t=20){let n=e.toString();if(n.includes(`e`))return Uo(e,t);if(Number.isInteger(e))return{integerDigits:n,decimalDigits:void 0};let r=n.indexOf(`.`),i=n.substring(0,r),a=n.substring(r+1);if(t===0)return Number(a[0])>=5&&(i=(Number(i)+1).toString()),{integerDigits:i,decimalDigits:void 0};if(a.length>t){let{integerDigits:e,decimalDigits:n}=Ho(a,t);a=n,e!==`0`&&(i=(Number(i)+Number(e)).toString())}return{integerDigits:i,decimalDigits:Bo(a||``)}}function Bo(e){let t=e.length-1;for(;t>=0&&e[t]===`0`;)t--;return e.slice(0,t+1)||void 0}let Vo=/^0+/;function Ho(e,t){let n=`0`,r=e,i=e.slice(0,t);if(Number(e[t])<5)return{integerDigits:n,decimalDigits:i};let a=i.match(Vo)?.[0]||``,o=(Number(i)+1).toString(),s=i.slice(a.length),c=o.length>s.length;return c&&!a?(n=`1`,r=void 0):r=c?a.slice(0,-1)+o:a+o,{integerDigits:n,decimalDigits:r}}function Uo(e,t=20){let n=Ro[t];n||(n=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:t,useGrouping:!1}),Ro[t]=n);let[r,i]=n.format(e).split(`.`);return{integerDigits:r,decimalDigits:i}}function Wo(e,t){let{integerDigits:n,decimalDigits:r}=zo(e,20);return r?n+t+r:n}let Go=Rt(function(e){if(!e)return!1;try{return _o(e).positive.type===`date`}catch{return!1}});function Ko(e,t){let n=ci(e);if(isNaN(n.getTime()))return e.toString();let r=t.tokens.some(e=>e.type===`DATE_PART`&&e.value===`a`),i=``;for(let e of t.tokens)switch(e.type){case`DATE_PART`:i+=qo(n,e.value,r);break;case`REPEATED_CHAR`:i+=Ao+e.value;break;default:i+=e.value;break}return i}function qo(e,t,n){switch(t){case`d`:return e.getDate();case`dd`:return e.getDate().toString().padStart(2,`0`);case`ddd`:return Mo[e.getDay()].slice(0,3);case`dddd`:return Mo[e.getDay()].toString();case`m`:return e.getMonth()+1;case`mm`:return String(e.getMonth()+1).padStart(2,`0`);case`mmm`:return jo[e.getMonth()].slice(0,3);case`mmmm`:return jo[e.getMonth()].toString();case`mmmmm`:return jo[e.getMonth()].slice(0,1);case`qq`:return E(`Q%(quarter)s`,{quarter:e.getQuarter()}).toString();case`qqqq`:return E(`Quarter %(quarter)s`,{quarter:e.getQuarter()}).toString();case`yy`:let r=String(e.getFullYear()).replace(`-`,``).padStart(2,`0`);return r.slice(r.length-2);case`yyyy`:return String(e.getFullYear()).replace(`-`,``).padStart(4,`0`);case`hhhh`:return Math.floor((e.getTime()-Lr.getTime())/(3600*1e3)).toString();case`hh`:let i=e.getHours();return n&&(i=i===0?12:i>12?i-12:i),i.toString().padStart(2,`0`);case`MM`:return e.getMinutes().toString().padStart(2,`0`);case`ss`:return e.getSeconds().toString().padStart(2,`0`);case`a`:return e.getHours()>=12?`PM`:`AM`;default:throw Error(`invalid date format token: ${t}`)}}let Jo=Rt(function(e){return RegExp(`[0-9]+${nt(e.decimalSeparator)}[0-9]`)});function Yo(e){let{integerDigits:t,decimalDigits:n}=zo(e);if(!n)return`0`;let r=t.replace(`-`,``).length;if(r+2>11)return`0`;let i=11-r-1;return{decimalDigits:n}=zo(e,Math.min(i,n.length)),n?`0.`+`0`.repeat(n.length):`0`}function Xo(e,t){if(Xr(e,t))return Qr(e,t).format}function Zo(e){let t=e.includes(`.`)?`0.00`:`0`,n=e.match(/[\$€]/);if(n){let r=e.match(/[\d]/),i=`[$`+n.values().next().value+`]`;return r.index<n.index?`#,##`+t+i:i+`#,##`+t}if(e.includes(`%`))return t+`%`}function Qo(e){let t=e.decimalPlaces??2,n=e.position??`before`,r=e.code??``,i=e.symbol??``,a=`#,##0`+(t?`.`+`0`.repeat(t):``),o=`${r} ${i}`.trim();return n===`after`&&r&&(o=` `+o),ts(o,n,a)}function $o(e){let t=e.decimalPlaces??2,n=e.position??`before`,r=e.code??``,i=e.symbol??``,a=`#,##0`+(t?`.`+`0`.repeat(t):``),o=`${r} ${i}`.trim();return n===`after`&&r&&(o=` `+o),[es(o,n,` ${a} `),es(o,n,`(${a})`),es(o,n,` - `)].join(`;`)}function es(e,t,n){let r=`[$${e}]`;return t===`before`?r+`* `+n:n+`* `+r}function ts(e,t,n){let r=`[$${e}]`;return t===`before`?r+n:n+r}function ns(e){let t=_o(e);return Eo({positive:rs(t.positive),negative:t.negative?rs(t.negative):void 0,zero:t.zero?rs(t.zero):void 0,text:t.text})}function rs(e){if(e.type!==`number`||!e.decimalPart)return e;let t=e.decimalPart.filter(e=>e.type!==`DIGIT`);return{...e,decimalPart:void 0,integerPart:[...e.integerPart,...t]}}function is({value:e,format:t},n){return B(e,{format:as({value:e,format:t},void 0,n),locale:n})}function as(e,t,n){let r=0;try{r=Math.abs(F(e?.value,n))}catch{return``}let i=e?.format;if(t!==void 0)switch(t?.value){case`k`:return os(i,1,`k`,n);case`m`:return os(i,2,`m`,n);case`b`:return os(i,3,`b`,n);default:throw new M(E(`The formatting unit should be 'k', 'm' or 'b'.`))}return r<1e5?os(i,0,``,n):r<1e8?os(i,1,`k`,n):r<1e11?os(i,2,`m`,n):os(i,3,`b`,n)}function os(e,t,n,r){let i=_o(e||`#,##0`);return Eo({positive:ss(i.positive,t,n),negative:i.negative?ss(i.negative,t,n):void 0,zero:i.zero?ss(i.zero,t,n):void 0,text:i.text})}function ss(e,t,n){if(e.type!==`number`)return e;let r=rs(e),i={type:`STRING`,value:n},a=[...r.integerPart],o=a.findLastIndex(e=>e.type===`DIGIT`);if(o===-1)throw Error(`Cannot create a large number format from a format with no digit.`);for(;a[o+1]?.type===`THOUSANDS_SEPARATOR`;)a=zt(a,[o+1]);let s=a[o+1];a=s?.type===`STRING`&&[`m`,`k`,`b`].includes(s.value)?Vt(a,i,o+1):Bt(a,[i],o+1),t>0&&(a=Bt(a,Array(t).fill({type:`THOUSANDS_SEPARATOR`,value:`,`}),o+1));let c=r.percentSymbols-a.filter(e=>e.type===`PERCENT`).length;return a.push(...Array(c).fill({type:`PERCENT`,value:`%`})),{...r,integerPart:a,magnitude:t}}function cs(e,t){let n=_o(e);return Eo(_o(Eo({positive:ls(n.positive,t),negative:n.negative?ls(n.negative,t):void 0,zero:n.zero?ls(n.zero,t):void 0,text:n.text})))}function ls(e,t){return e.type===`number`?t>0?ds(e,t):us(e,Math.abs(t)):e}function us(e,t){let n=e.decimalPart;if(!n)return e;let r=[],i=0;for(let e=n.length-1;e>=0&&!(i>=Math.abs(t));e--)n[e].type===`DIGIT`&&(i++,r.push(e));return n=zt(n,r),n.some(e=>e.type===`DIGIT`)?{...e,decimalPart:n}:{...e,decimalPart:void 0,integerPart:[...e.integerPart,...n]}}function ds(e,t){let n=e.integerPart,r=e.decimalPart;if(!r){let e=n.findLastIndex(e=>e.type===`DIGIT`);r=n.slice(e+1),n=n.slice(0,e+1)}let i=x(0,t).map(()=>({type:`DIGIT`,value:`0`})),a=r.findLastIndex(e=>e.type===`DIGIT`);return r=a===-1?[...i,...r]:Bt(r,i,a+1),{...e,decimalPart:r,integerPart:n}}function fs(e){let t=_o(e);for(let e of[t.positive,t.negative,t.zero])if(e&&e.type===`date`&&e.tokens.some(e=>e.type===`DATE_PART`&&e.value.includes(`q`)))return!1;return!0}function ps(e){if(!e)return!1;try{return _o(e).positive.type===`text`}catch{return!1}}function ms(e,t){return gs({value:ps(t.format)&&e.parsedValue!==null?e.content:e.parsedValue,format:t.format},t.locale)}function hs(e,t){if(e.startsWith(`=`))throw Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);if(e===``)return null;if(Oi(e,k))return Ai(e,k);let n=Qr(e,t);return n?n.value:ut(e)?e.toUpperCase()===`TRUE`:e}function gs(e,t=k,n){let r=no(e.value);if(!r)return _s(e,t,n);let i=hs(r.label,t);return{..._s({value:i,format:e.format||(typeof i==`number`?Xo(r.label,t)||Zo(r.label):void 0)},t,n),link:r}}function _s(e,t,n){let{value:r,format:i,message:a}=e;i=n?.format||i;let o=B(r,{format:i,locale:t});return P(r)?Cs(r,a):r===null?bs(i):ps(i)?vs(I(r),i,o):typeof r==`number`?Go(i||``)?xs(r,i,o):ys(r,i,o):typeof r==`boolean`?Ss(r,i,o):vs(r,i,o)}function vs(e,t,n){return{value:e,format:t,formattedValue:n,type:`text`,isAutoSummable:!0,defaultAlign:`left`}}function ys(e,t,n){return{value:e||0,format:t,formattedValue:n,type:`number`,isAutoSummable:!0,defaultAlign:`right`}}let bs=Rt(function(e){return{value:null,format:e,formattedValue:``,type:`empty`,isAutoSummable:!0,defaultAlign:`left`}});function xs(e,t,n){return{value:e,format:t,formattedValue:n,type:`number`,isAutoSummable:!1,defaultAlign:`right`}}function Ss(e,t,n){return{value:e,format:t,formattedValue:n,type:`boolean`,isAutoSummable:!1,defaultAlign:`center`}}function Cs(e,t){return{value:e,formattedValue:e,message:t,type:`error`,isAutoSummable:!1,defaultAlign:`center`}}function ws(e){let t=O.now();switch(e){case`today`:return Math.floor(ui(t));case`yesterday`:return t.setDate(t.getDate()-1),Math.floor(ui(t));case`tomorrow`:return t.setDate(t.getDate()+1),Math.floor(ui(t));case`lastWeek`:return t.setDate(t.getDate()-6),Math.floor(ui(t));case`lastMonth`:{let e=t.getMonth()===0?11:t.getMonth()-1,n=new O(t.getFullYear(),e,1);return t.getDate()>di(n)?t.setDate(1):(t.setDate(t.getDate()+1),t.setMonth(t.getMonth()-1)),Math.floor(ui(t))}case`lastYear`:return t.getMonth()===1&&t.getDate()===29?(t.setDate(28),t.setFullYear(t.getFullYear()-1)):(t.setDate(t.getDate()+1),t.setFullYear(t.getFullYear()-1)),Math.floor(ui(t))}}function Ts(e,t){return`dateValue`in e&&e.dateValue!==`exactDate`?[ws(e.dateValue)]:e.values.map(e=>Yr(e,t))}function Es(e,t){return e.values.map(e=>pa(e,t))}function Ds(e,t){return e.map(e=>{if(e.startsWith(`=`))return e;let n=hs(e,t);return typeof n==`number`?B(n,{format:t.dateFormat,locale:t}):``})}function Os(e){return 20+120*Math.exp(-.035*(e-1))}let ks=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,`i`),As=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,`i`),js=new RegExp(/^\$?([A-Z]{1,3})+$/,`i`),Ms=new RegExp(/^\$?([0-9]{1,7})+$/,`i`),Ns=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,`i`),Ps=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,`i`),Fs=RegExp(`^\\s*('.+'!|[^']+!)?(`+[ks.source,`(\\$?[A-Z]{1,3})?\\$?[0-9]{1,7}\\s*:\\s*(\\$?[A-Z]{1,3})?\\$?[0-9]{1,7}\\s*`,`\\$?[A-Z]{1,3}(\\$?[0-9]{1,7})?\\s*:\\s*\\$?[A-Z]{1,3}(\\$?[0-9]{1,7})?\\s*`].join(`|`)+`)$`,`i`);function Is(e){return Ns.test(e)}function Ls(e){return Ps.test(e)}function Rs(e){return js.test(e)}function zs(e){return Ms.test(e)}function Bs(e){return As.test(e)}function Vs(e){if(!e.includes(`!`))return{xc:e};let t=e.split(`!`),n=t.pop();return{sheetName:it(t.join(`!`))||void 0,xc:n}}function Hs(e,t){return e===void 0?t:`${ot(e)}!${t}`}var Us=class e{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 n=[...e.parts];e.parts.length===1&&Er(this.zone)>1?n.push({...e.parts[0]}):e.parts.length===2&&Er(this.zone)===1&&n.pop(),this.parts=n}static fromRange(t,n){return t instanceof e?t:new e(t,n.getSheetSize)}get unboundedZone(){return this._zone}get zone(){let{left:e,top:t,bottom:n,right:r}=this._zone;if(r!==void 0&&n!==void 0)return this._zone;if(n===void 0&&r!==void 0)return{right:r,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(r===void 0&&n!==void 0)return{bottom:n,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw Error(E(`Bad zone format`))}static getRangeParts(e,t){let n=e.split(`:`).map(e=>{let t=Ls(e);return{colFixed:t?!1:e.startsWith(`$`),rowFixed:t?e.startsWith(`$`):e.includes(`$`,1)}}),r=t.bottom===void 0,i=t.right===void 0;return r&&(n[0].rowFixed=n[0].rowFixed||n[1].rowFixed,n[1].rowFixed=n[0].rowFixed||n[1].rowFixed),i&&(n[0].colFixed=n[0].colFixed||n[1].colFixed,n[1].colFixed=n[0].colFixed||n[1].colFixed),n}get isFullCol(){return this._zone.bottom===void 0}get isFullRow(){return this._zone.right===void 0}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(er(this._zone))return this;let e={...this._zone},t=this.parts;if(e.right!==void 0&&e.right<e.left){let n=e.right;e.right=e.left,e.left=n,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(e.bottom!==void 0&&e.bottom<e.top){let n=e.bottom;e.bottom=e.top,e.top=n,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(t){return new e({zone:t?.zone?t.zone:{...this._zone},sheetId:t?.sheetId?t.sheetId:this.sheetId,invalidSheetName:t&&`invalidSheetName`in t?t.invalidSheetName:this.invalidSheetName,invalidXc:t&&`invalidXc`in t?t.invalidXc:this.invalidXc,parts:t?.parts?t.parts:this.parts.map(e=>({rowFixed:e.rowFixed,colFixed:e.colFixed})),prefixSheet:t?.prefixSheet===void 0?this.prefixSheet:t.prefixSheet},this.getSheetSize)}};function Ws(e,t,n){let r=n.sheetId===e?t:n.sheetId;return n.clone({sheetId:r})}function Gs(e,t,n){if(!n)return;let r=e.getRangeFromSheetXC(t,n);return r.invalidSheetName||r.invalidXc?void 0:r}function Ks(e,t){let n=[];for(let r of t){let t=r.dataRange;if(!e.isRangeValid(t)){n.push(r);continue}let{sheetName:i}=Vs(t),a=i?`${i}!`:``,o=Zn(t);if(o.bottom!==o.top&&o.left!==o.right)if(o.right)for(let e=o.left;e<=o.right;++e){let t=e===o.left?r:{yAxisId:r.yAxisId};n.push({...t,dataRange:`${a}${tr({left:e,right:e,top:o.top,bottom:o.bottom})}`})}else for(let e=o.top;e<=o.bottom;++e){let t=e===o.top?r:{yAxisId:r.yAxisId};n.push({...t,dataRange:`${a}${tr({left:o.left,right:o.right,top:e,bottom:e})}`})}else n.push(r)}return n}function qs(e){let t=[];for(let n of e)for(let e of _r(n.zone))t.push({...e,sheetId:n.sheetId});return t}function Js(e,t){e=e.toLocaleLowerCase(),t=t.toLocaleLowerCase();let n=0,r=0,i=t.length,a=0;for(let o=0;o<i;o++)t[o]===e[a]?(a++,r+=100+r-o/200):r=0,n+=r;return a===e.length?n:0}function Ys(e,t,n){let r=[];return t.forEach(t=>{let i=Js(e,n(t));i>0&&r.push({score:i,elem:t})}),r.sort((e,t)=>t.score-e.score),r.map(e=>e.elem)}function Xs(e){let t=[];for(let n=0;n<e;n++)t.push({cells:{}});return t}function Zs(e,t,n){return n.map(n=>n>=e?n+t:n)}function Qs(e,t){return e=[...e].sort((e,t)=>t-e),t.map(t=>{for(let n of e)if(t>n)t--;else if(t===n)return;return t}).filter(S)}function $s(e,t=`Sheet`){let n=1,r=`${t}${n}`;for(;e.includes(r);)r=`${t}${n}`,n++;return r}function ec(e,t){let n=1,r=E(`Copy of %s`,e),i=r.toString();for(;t.includes(i);)i=`${r} (${n})`,n++;return i}function tc(e,t){return e===void 0||t===void 0?!1:it(e.trim().toUpperCase())===it(t.trim().toUpperCase())}function nc(e,t=1){return t*(e+4)-4}function rc(e,t,n,r){if(!t||!t.isFormula&&!t.content)return 23;let i=``;try{if(!t.isFormula){let e={format:t.format,locale:n};i=B(hs(t.content,n),e)}}catch{i=j.GenericError}return ic(e,i,t.style,r)}function ic(e,t,n,r){let i=gc(e,t,n,n?.wrapping===`wrap`?r-8:void 0).length;return nc(mc(n),i)+6}function ac(e,t=!1,n=!1){return`${n?`italic`:``} ${t?`bold`:``} ${e}px ${ze}`}let oc={};function sc(e,t,n,r=`pt`){let i=pc(n,r);e.save(),e.font=i;let a=cc(e,t);return e.restore(),a}function cc(e,t){let n=e.font;if(oc[n]||(oc[n]={}),oc[n][t]===void 0){let r=e.measureText(t).width;oc[n][t]=r}return oc[n][t]}let lc={};function uc(e,t,n,r=`pt`){let i=pc(n,r);e.save(),e.font=i;let a=dc(e,t);return e.restore(),a}function dc(e,t){let n=e.font;if(lc[n]||(lc[n]={}),lc[n][t]===void 0){let r=e.measureText(t),i=r.width,a=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;lc[n][t]={width:i,height:a}}return lc[n][t]}function fc(e){return Math.round(e*96/72)}function pc(e,t=`pt`){return`${e.italic?`italic `:``}${e.bold?`bold`:`400`} ${(t===`pt`?mc(e):e.fontSize)??Re}px ${ze}`}function mc(e){return fc(e?.fontSize||Re)}function hc(e,t,n,r){if(sc(e,t,r)<=n)return[t];let i=[],a=``;for(let o of t)sc(e,a+o,r)>n?(i.push(a),a=o):a+=o;return i.push(a),i}function gc(e,t,n,r){n||={},pt(t)&&(t=gt(t).label);let i=[],a=t.includes(`
4
+ `)}function Ut(e,t,n){return t>n?Ut(e,n,t):e>=t&&e<=n}function Wt(e,t){let n=nt(e),r=t.matchCase?``:`i`;return t.exactMatch&&(n=`^${n}$`),RegExp(n,r)}function Gt(e){let t=e.length;if(t<1e5)return Math.max(...e);let n=-1/0;for(;t--;)n=e[t]>n?e[t]:n;return n}function Kt(e){let t=e.length;if(t<1e5)return Math.min(...e);let n=1/0;for(;t--;)n=e[t]<n?e[t]:n;return n}var qt=class{text;currentIndex=0;current;constructor(e){this.text=e,this.current=e[0]}shift(){let e=this.current,t=this.text[++this.currentIndex];return this.current=t,e}advanceBy(e){this.currentIndex+=e,this.current=this.text[this.currentIndex]}isOver(){return this.currentIndex>=this.text.length}remaining(){return this.text.substring(this.currentIndex)}currentStartsWith(e){if(this.current!==e[0])return!1;for(let t=1;t<e.length;t++)if(this.text[this.currentIndex+t]!==e[t])return!1;return!0}};function Jt(e,t=e=>e){let n=new Set;return e.filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function Yt(e){let t={};for(let n in e)for(let r in e[n])t[r]||(t[r]={}),t[r][n]=e[n][r];return t}let Xt=/rgba?\(|\s+|\)/gi,Zt=/^#([A-F\d]{2}){3,4}$/,Qt=[`#eb6d00`,`#0074d9`,`#ad8e00`,`#169ed4`,`#b10dc9`,`#00a82d`,`#00a3a3`,`#f012be`,`#3d9970`,`#111111`,`#62A300`,`#ff4136`,`#949494`,`#85144b`,`#001f3f`];function $t(e){return en(e.toString(16).padStart(6,`0`))}function en(e){let t=e;if(e.startsWith(`rgb`)?t=sn(e):(t=e.replace(`#`,``).toUpperCase(),(t.length===3||t.length===4)&&(t=t.split(``).reduce((e,t)=>e+t+t,``)),t=`#${t}`),!Zt.test(t))throw Error(`invalid color input: ${e}`);return t}function tn(e){try{return en(e),!0}catch{return!1}}function nn(e){try{return fn(e),!0}catch{return!1}}let rn=e=>e>=0&&e<=255;function an(e,t,n,r=1){if(!rn(e)||!rn(t)||!rn(n)||r<0||r>1)throw Error(`Invalid RGBA values ${[e,t,n,r]}`);return{a:r,b:n,g:t,r:e}}function on(e){let{r:t,g:n,b:r}=ln(e);t/=255,n/=255,r/=255;let i=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4,a=i(t),o=i(n),s=i(r);return .2126*a+.7152*o+.0722*s}function sn(e){let t=e.replace(Xt,``).split(`,`),n=255;if(t.length!==3&&t.length!==4)throw Error(`invalid color`);if(t.length===4){let e=parseFloat(t.pop()||`1`);if(isNaN(e))throw Error(`invalid alpha value`);n=Math.round(e*255)}let r=t.map(e=>parseInt(e,10));return n!==255&&r.push(n),`#`+Tt(r.map(e=>e.toString(16).padStart(2,`0`))).toUpperCase()}function cn(e){let t=e.r.toString(16),n=e.g.toString(16),r=e.b.toString(16),i=Math.round(e.a*255).toString(16);return t.length===1&&(t=`0`+t),n.length===1&&(n=`0`+n),r.length===1&&(r=`0`+r),i.length===1&&(i=`0`+i),i===`ff`&&(i=``),(`#`+t+n+r+i).toUpperCase()}function ln(e){e=en(e);let t,n,r,i;if(e.length===7)t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16),i=255;else if(e.length===9)t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16),i=parseInt(e[7]+e[8],16);else throw Error(`Invalid color`);return i=+(i/255).toFixed(3),{a:i,r:t,g:n,b:r}}function un(e){e={...e},e.s/=100,e.l/=100;let t=(1-Math.abs(2*e.l-1))*e.s,n=t*(1-Math.abs(e.h/60%2-1)),r=e.l-t/2,i=0,a=0,o=0;return 0<=e.h&&e.h<60?(i=t,a=n,o=0):60<=e.h&&e.h<120?(i=n,a=t,o=0):120<=e.h&&e.h<180?(i=0,a=t,o=n):180<=e.h&&e.h<240?(i=0,a=n,o=t):240<=e.h&&e.h<300?(i=n,a=0,o=t):300<=e.h&&e.h<360&&(i=t,a=0,o=n),i=Math.round((i+r)*255),a=Math.round((a+r)*255),o=Math.round((o+r)*255),{a:e.a,r:i,g:a,b:o}}function dn(e){let t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s=0,c=0,l=0;return s=o===0?0:a===t?(n-r)/o%6:a===n?(r-t)/o+2:(t-n)/o+4,s=Math.round(s*60),s<0&&(s+=360),l=(a+i)/2,c=o===0?0:o/(1-Math.abs(2*l-1)),c=+(c*100).toFixed(1),l=+(l*100).toFixed(1),{a:e.a,h:s,s:c,l}}function fn(e){return cn(un(e))}function pn(e){return dn(ln(e))}function mn(e,t,n=0){if(!(tn(e)&&tn(t)))return!1;let r=ln(e),i=ln(t);return r.a===i.a?Math.sqrt(((r.r-i.r)/255)**2+((r.g-i.g)/255)**2+((r.b-i.b)/255)**2)<=n:!1}function hn(e,t){return t===1?en(e).slice(0,7):cn({...ln(e),a:t})}function gn(e,t){let n=pn(e);return t===1?`#fff`:(n.l=t*(100-n.l)+n.l,fn(n))}function _n(e,t){let n=pn(e);return t===1?`#000`:(n.l-=t*n.l,fn(n))}let vn=[`#4EA7F2`,`#EA6175`,`#43C5B1`,`#F4A261`,`#8481DD`,`#FFD86D`],yn=[`#4EA7F2`,`#3188E6`,`#43C5B1`,`#00A78D`,`#EA6175`,`#CE4257`,`#F4A261`,`#F48935`,`#8481DD`,`#5752D1`,`#FFD86D`,`#FFBC2C`],bn=[`#4EA7F2`,`#3188E6`,`#056BD9`,`#A76DBC`,`#7F4295`,`#6D2387`,`#EA6175`,`#CE4257`,`#982738`,`#43C5B1`,`#00A78D`,`#0E8270`,`#F4A261`,`#F48935`,`#BE5D10`,`#8481DD`,`#5752D1`,`#3A3580`,`#A4A8B6`,`#7E8290`,`#545B70`,`#FFD86D`,`#FFBC2C`,`#C08A16`],xn=`#4EA7F2.#3188E6.#056BD9.#155193.#A76DBC.#7F4295.#6D2387.#4F1565.#EA6175.#CE4257.#982738.#791B29.#43C5B1.#00A78D.#0E8270.#105F53.#F4A261.#F48935.#BE5D10.#7D380D.#8481DD.#5752D1.#3A3580.#26235F.#A4A8B6.#7E8290.#545B70.#3F4250.#FFD86D.#FFBC2C.#C08A16.#936A12`.split(`.`);function Sn(e,t){return t[e%t.length]}function Cn(e){return e<=6?vn:e<=12?yn:e<=24?bn:xn}var wn=class{preferredColors;currentColorIndex=0;palette;constructor(e,t=[]){this.preferredColors=t,this.palette=Cn(e).filter(e=>!t.includes(e))}next(){return this.preferredColors?.[this.currentColorIndex]?this.preferredColors[this.currentColorIndex++]:Sn(this.currentColorIndex++,this.palette)}};function Tn(e){if(e<0)throw Error(`number must be positive. Got ${e}`);return e<26?String.fromCharCode(65+e):Tn(Math.floor(e/26)-1)+Tn(e%26)}function En(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=Dn(e[r]);t=t*26+n}return t-1}function Dn(e){let t=e.charCodeAt(0);return t>=65&&t<=90?t-64:t-96}function On(e){return e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`}function kn(e){return e>=`0`&&e<=`9`}let An=En(`ZZZ`);function jn(e){for(;e.current===` `;)e.advanceBy(1)}function Mn(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!On(e.current))return-1;let t=0;for(;e.current&&On(e.current);)t=t*26+Dn(e.shift());return t}function Nn(e){if(e.current===`$`&&e.advanceBy(1),!e.current||!kn(e.current))return-1;let t=0;for(;e.current&&kn(e.current);)t=t*10+Number(e.shift());return t}function Pn(e){let t=new qt(e);jn(t);let n=Mn(t);if(n===-1||!t.current)throw Error(`Invalid cell description: ${e}`);let r=Nn(t);jn(t);let i=n-1,a=r-1;if(!t.isOver()||i>An||a>9999998)throw Error(`Invalid cell description: ${e}`);return{col:i,row:a}}function w(e,t,n={colFixed:!1,rowFixed:!1}){return(n.colFixed?`$`:``)+Tn(e)+(n.rowFixed?`$`:``)+String(t+1)}function T(e,t=[]){if(e.length<=1&&t.length===0)return e;let n=[0],r=new Map([[0,[]]]);return Fn(n,r,e,!1),Fn(n,r,t,!0),zn(n,r)}function Fn(e,t,n,r=!1){for(let i of n){let n=i.left,a=i.right===void 0?void 0:i.right+1,o=In(e,t,n,!0,0),s=In(e,t,a,!1,o);for(let n=o;n<=s;n++)Ln(t.get(e[n]),i,r);Rn(e,t,o,s)}}function In(e,t,n,r,i){if(n===void 0)return e.length-1;let a=Bn(e,n,i);return n===e[a]?r?a:a-1:(e.splice(a+1,0,n),t.set(n,[...t.get(e[a])]),r?a+1:a)}function Ln(e,t,n=!1){let r=t.top,i=t.bottom===void 0?void 0:t.bottom+1,a=[],o=Bn(e,r,0,!1);if((o%2!=0&&!n||o%2==0&&n)&&a.push(r),i===void 0){e.splice(o+1),e.push(...a);return}let s=Vn(e,i,0,!1);(s%2==0&&!n||s%2!=0&&n)&&a.push(i),e.splice(o+1,s-o-1,...a)}function Rn(e,t,n,r){let i=n-1==-1?0:n-1,a=r===e.length-1?r:r+1;for(let n=a;n>i;n--)kt(t.get(e[n]),t.get(e[n-1]))&&(t.delete(e[n]),e.splice(n,1))}function zn(e,t){let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=t.get(a);if(!o||o.length===0){n.push(...r),r=[];continue}let s=e[i+1];s!==void 0&&s--;let c=[];for(let e=0;e<o.length;e+=2){let t=o[e],n=o[e+1];n!==void 0&&n--;let i={top:t,left:a,bottom:n,right:s,hasHeader:n===void 0&&t!==0||s===void 0&&a!==0},l=!1;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.top===i.top&&t.bottom===i.bottom){t.right=i.right,r.splice(e,1),c.push(t),l=!0;break}}l||c.push(i)}n.push(...r),r=c}return n.push(...r),n}function Bn(e,t,n=0,r=!0){let i=e.length-1,a=-1;for(;n<=i;){let o=Math.floor((n+i)/2);if(e[o]===t&&r)return o;e[o]<t?(a=o,n=o+1):i=o-1}return a}function Vn(e,t,n=0,r=!0){let i=e.length-1,a=e.length;for(;n<=i;){let o=Math.floor((n+i)/2);if(e[o]===t&&r)return o;e[o]>t?(a=o,i=o-1):n=o+1}return a}let Hn=e=>e,Un=()=>!1,Wn=Hn,Gn=Un;function Kn(e,...t){if(t.length===1&&typeof t[0]==`object`&&!(t[0]instanceof String)){let n=t[0];e=e.replace(/\%\(([^\)]+)\)s/g,(e,t)=>n[t])}else t.length>0&&(e=e.replace(/\%s/g,()=>t.shift()));return e}function qn(e,t=()=>!0){Wn=e,Gn=t}function Jn(){Wn===Hn&&Gn===Un&&(Gn=()=>!0)}let E=function(e,...t){return Gn()?Kn(Wn(e),...t):new Yn(e,t)};var Yn=class extends String{values;constructor(e,t){super(e),this.values=t}valueOf(){let e=super.valueOf();return Gn()?Kn(Wn(e),...this.values):Kn(e,...this.values)}toString(){return this.valueOf()}};function Xn(e){let t=new qt(e);jn(t);let n=e.indexOf(`!`);n!==-1&&t.advanceBy(n+1);let r=Mn(t),i=Nn(t),a,o,s,c,l=!1,u=!1,d=!1;if(i===-1?(s=c=r-1,a=o=0,l=!0):r===-1?(a=o=i-1,s=c=0,u=!0):(s=c=r-1,a=o=i-1,d=!0),jn(t),t.current===`:`){t.advanceBy(1),jn(t);let e=Mn(t),n=Nn(t);n===-1?(c=e-1,l=!0):e===-1?(o=n-1,u=!0):(c=e-1,o=n-1,a=l?o:a,s=u?c:s,d=!0)}let f={top:a,left:s,bottom:l?void 0:o,right:u?void 0:c};return d&&=u||l,d&&(f.hasHeader=d),f}function Zn(e){let t=vr(Xn(e)),n=t.bottom,r=t.right;if(n!==void 0&&n>9999998||r!==void 0&&r>An)throw Error(`Range string out of bounds: ${e}`);if(n===void 0&&r===void 0)throw Error(`Wrong zone xc. The zone cannot be at the same time a full column and a full row`);return t}function Qn(e){let t=Zn(e);if(t.bottom===void 0||t.right===void 0)throw Error(`This does not support unbounded ranges`);return t}function $n(e){let{bottom:t,top:n,left:r,right:i}=e;return t!==void 0&&isNaN(t)||isNaN(n)||isNaN(r)||i!==void 0&&isNaN(i)?!1:er(e)&&e.top>=0&&e.left>=0}function er(e){return(e.bottom===void 0||e.bottom>=e.top&&e.bottom>=0)&&(e.right===void 0||e.right>=e.left&&e.right>=0)}function tr(e){let{top:t,bottom:n,left:r,right:i}=e,a=`hasHeader`in e?e.hasHeader:!1,o=t===n&&r===i;if(n===void 0&&i!==void 0)return t===0&&!a?`${Tn(r)}:${Tn(i)}`:`${w(r,t)}:${Tn(i)}`;if(i===void 0&&n!==void 0)return r===0&&!a?`${t+1}:${n+1}`:`${w(r,t)}:${n+1}`;if(n!==void 0&&i!==void 0)return o?w(r,t):`${w(r,t)}:${w(i,n)}`;throw Error(E(`Bad zone format`))}function nr(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=e[t===`left`?`right`:`bottom`];return e[t]<=o&&s&&s>o?yr(e,a,`RESIZE`,i):o<e[t]?yr(e,a,`MOVE`,i):{...e}}function rr(e,t,n,r,i){let a=t===`left`?`columns`:`rows`,o=r===`before`?n-1:n,s=t===`left`?`right`:`bottom`;return e[t]<=o&&e[s]>o?yr(e,a,`RESIZE`,i):o<e[t]?yr(e,a,`MOVE`,i):{...e}}function ir(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r];for(let o of n.sort((e,t)=>t-e))e[t]>o&&(i--,a--),e[t]<o&&e[r]>=o&&a--;return{...e,[t]:i,[r]:a}}function ar(e,t,n){let r=t===`left`?`right`:`bottom`,i=e[t],a=e[r],o=e[r];for(let r of n.sort((e,t)=>t-e))e[t]>r&&(i--,a!==void 0&&a--),o!==void 0&&a!==void 0&&e[t]<=r&&o>=r&&a--;if(!(a!==void 0&&i>a))return{...e,[t]:i,[r]:a}}function or(...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 sr(...e){return{top:Math.min(...e.map(e=>e.top)),left:Math.min(...e.map(e=>e.left)),bottom:e.some(e=>e.bottom===void 0)?void 0:Math.max(...e.map(e=>e.bottom)),right:e.some(e=>e.right===void 0)?void 0:Math.max(...e.map(e=>e.right))}}function cr(e,t){if(ur(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 lr(e,t){return e.left===t.left&&e.right===t.right&&e.top===t.top&&e.bottom===t.bottom}function ur(e,t){return!(e.bottom<t.top||t.bottom<e.top||e.right<t.left||t.right<e.left)}function dr(e,t,n){let{left:r,right:i,top:a,bottom:o}=n;return e>=r&&e<=i&&t>=a&&t<=o}function fr(e,t){return lr(or(t,e),t)}function pr(e){return{numberOfRows:e.bottom-e.top+1,numberOfCols:e.right-e.left+1}}function mr(e){let{numberOfCols:t,numberOfRows:n}=pr(e);return t===1||n===1}function hr(e){let{top:t,left:n,bottom:r,right:i}=e;if(Er(e)===1)return[];let a={top:t+1,bottom:r,left:n,right:n};if(i===n)return[a];let o={top:t,bottom:r,left:n+1,right:i};return t===r?[o]:[a,o]}function gr(e){let t={};for(let n of e)t[n.sheetId]??=[],t[n.sheetId].push(D(n));for(let e in t)t[e]=T(t[e]);return t}function _r(e){let t=[],{left:n,right:r,top:i,bottom:a}=vr(e);for(let e of x(n,r+1))for(let n of x(i,a+1))t.push({col:e,row:n});return t}function vr(e){return e.right!==void 0&&e.left>e.right&&(e={...e,left:e.right,right:e.left}),e.bottom!==void 0&&e.top>e.bottom&&(e={...e,top:e.bottom,bottom:e.top}),e}function yr(e,t,n,r){let i=t===`both`?r[0]:t===`columns`?r:0,a=t===`both`?r[1]:t===`rows`?r:0,o=`hasHeader`in e?e.hasHeader:!1,s;s=Tr(e)&&!o?t!==`rows`:wr(e)&&!o?t!==`columns`:!0;let c={...e};return s&&n===`MOVE`&&(c.left+=i,c.top+=a),c.right!==void 0&&(c.right+=i),c.bottom!==void 0&&(c.bottom+=a),c}function br(e){return e.reverse().filter((e,t,n)=>t===n.findIndex(t=>t.top===e.top&&t.bottom===e.bottom&&t.left===e.left&&t.right===e.right)).reverse()}function xr(e){return e.reduce((e,t)=>{let n=e.length;for(let r=0;r<n;r++)if(ur(e[r],t))return e[r]=or(e[r],t),e;return e[n]=t,e},[])}function Sr(e,t){let n,r,{left:i,right:a,top:o,bottom:s}=e,{left:c,right:l,top:u,bottom:d}=t;return n=c===i?l===a?c:l:c,r=u===o?d===s?u:d:u,{col:n,row:r}}function D(e){return{left:e.col,right:e.col,top:e.row,bottom:e.row}}function Cr(e){return{...e,right:e.left,bottom:e.top}}function wr(e){return e.right===void 0}function Tr(e){return e.bottom===void 0}function Er(e){return(e.bottom-e.top+1)*(e.right-e.left+1)}function Dr(e){return e.length<2?!0:T(e).length===1}function Or(e){let t=new Set;for(let n of T(e))for(let e of x(n.left,n.right+1))t.add(e);return t}function kr(e){let t=new Set;for(let n of T(e))for(let e of x(n.top,n.bottom+1))t.add(e);return t}function Ar(e,t){return e.right+1===t.left||e.left===t.right+1?e.top<=t.bottom&&e.top>=t.top||t.top<=e.bottom&&t.top>=e.top:e.bottom+1===t.top||e.top===t.bottom+1?e.left<=t.right&&e.left>=t.left||t.left<=e.right&&t.left>=e.left:!1}function jr(e){let t=[...e],n=!0;for(;n;){n=!1;for(let e=0;e<t.length;e++){let r=t[e],i=t.findIndex((t,n)=>e!==n&&(Ar(t,r)||ur(t,r)));if(i!==-1){t[e]=or(t[i],r),t.splice(i,1),n=!0;break}}}return t}let Mr=new WeakMap,Nr=new WeakMap;function Pr(e,t){Mr.has(t)||(Mr.set(t,new Map),Nr.set(t,0));let n=Mr.get(t),r=Ir(e);if(n.has(r)){let i=n.get(r);return t[i]=e,i}let i=Nr.get(t)+1;return n.set(r,i),Nr.set(t,i),t[i]=e,i}function Fr(e){let t={};for(let n in e){let r=T(e[n].map(D));for(let e of r)t[tr(e)]=Number(n)}return t}function Ir(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(typeof e!=`object`)return String(e);if(Array.isArray(e)){let t=e.length,n=`[`;for(let r=0;r<t;r++)r>0&&(n+=`,`),n+=Ir(e[r]);return n+`]`}let t=Object.keys(e).sort(),n=`{`;for(let r of t)e[r]!==void 0&&(n+=`"${r}":${Ir(e[r])},`);return n+=`}`,n}var O=class e{jsDate;constructor(e,t,n,r=0,i=0,a=0){this.jsDate=new Date(Date.UTC(e,t,n,r,i,a,0))}static fromTimestamp(t){let n=new Date(t);return new e(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())}static now(){let t=new Date;return new e(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.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()}getQuarter(){return Math.floor(this.getMonth()/3)+1}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()}getIsoWeek(){let e=new Date(this.jsDate.getTime()),t=e.getUTCDay()||7;e.setUTCDate(e.getUTCDate()+4-t);let n=new Date(Date.UTC(e.getUTCFullYear(),0,1));return Math.ceil(((e.getTime()-n.getTime())/864e5+1)/7)}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)}};let Lr=new O(1899,11,30),Rr=1440*60*1e3,zr=2e3,Br=O.now().getFullYear(),Vr=O.now().getMonth(),Hr=O.fromTimestamp(0).getTime()-Lr.getTime(),Ur=/^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/,Wr=/^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/,Gr=Ft.join(``),Kr=RegExp(`\/|-|${Ft.join(`|`)}`),qr=RegExp(`^(\\d{1,4})[\/${Gr}\-](\\d{1,4})([\/${Gr}\-](\\d{1,4}))?$`),Jr=/((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;function Yr(e,t){switch(typeof e){case`number`:return e;case`string`:return Xr(e,t)?Qr(e,t)?.value:!e||isNaN(Number(e))?void 0:Number(e);default:return}}function Xr(e,t){return Qr(e,t)!==null}let Zr=new Map;function Qr(e,t){return Zr.has(t)||Zr.set(t,new Map),Zr.get(t).has(e)||Zr.get(t).set(e,$r(e,t)),Zr.get(t).get(e)}function $r(e,t){e=e.trim();let n=null,r=e.match(Jr);if(r){if(n=si(r[0]),n===null)return null;e=e.replace(r[0],``).trim()}let i=null,a=ei(e,t);if(a){let t=a.dateString.match(Kr)[0];if(i=ni(a,t),i===null)return null;e=e.replace(a.dateString,``).trim()}return e!==``||!(i||n)?null:i&&i.jsDate&&n&&n.jsDate?{value:i.value+n.value,format:i.format+` `+(n.format===`hhhh:mm:ss`?`hh:mm:ss`:n.format),jsDate:new O(i.jsDate.getFullYear()+n.jsDate.getFullYear()-1899,i.jsDate.getMonth()+n.jsDate.getMonth()-11,i.jsDate.getDate()+n.jsDate.getDate()-30,i.jsDate.getHours()+n.jsDate.getHours(),i.jsDate.getMinutes()+n.jsDate.getMinutes(),i.jsDate.getSeconds()+n.jsDate.getSeconds())}:i||n}function ei(e,t){let n=e.match(qr);if(!n)return null;let[,r,i,,a]=n;if(r.length>2&&a&&a.length>2)return null;if(r.length>2)return{year:r,month:i,day:a,dateString:e,type:`ymd`};let o=ti(t);return a?a.length>2?o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:{day:r,month:i,year:a,dateString:e,type:`dmy`}:o===`mdy`?{month:r,day:i,year:a,dateString:e,type:`mdy`}:o===`ymd`?{year:r,month:i,day:a,dateString:e,type:`ymd`}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:null:i.length>2?{month:r,year:i,day:void 0,dateString:e,type:o}:o===`dmy`?{day:r,month:i,year:a,dateString:e,type:`dmy`}:{month:r,day:i,year:a,dateString:e,type:`mdy`}}function ti(e){switch(e.dateFormat[0]){case`d`:return`dmy`;case`m`:return`mdy`;case`y`:return`ymd`}throw Error(`Invalid date format in locale`)}function ni(e,t){let{year:n,month:r,day:i}=e,a=ai(r),o=oi(i),s=ii(n);if(s===null||a===null||o===null)return null;let c=r?.length===2&&a+1<10||i?.length===2&&o<10,l=n?.length!==2,u=new O(s,a,o);if(u.getMonth()!==a||u.getDate()!==o)return null;let d=u.getTime()-Lr.getTime(),f=ri(e,t,c,l);return{value:Math.round(d/Rr),format:f,jsDate:u}}function ri(e,t,n,r){let i=e.year?r?`yyyy`:`yy`:void 0,a=e.month?n?`mm`:`m`:void 0,o=e.day?n?`dd`:`d`:void 0;switch(e.type){case`mdy`:return[a,o,i].filter(S).join(t);case`ymd`:return[i,a,o].filter(S).join(t);case`dmy`:return[o,a,i].filter(S).join(t)}}function ii(e){if(!e)return Br;let t=Number(e);switch(e.length){case 1:return zr+t;case 2:return zr+(zr+t>Br+10?-100:0)+t;case 3:case 4:return t}return null}function ai(e){if(!e)return Vr;let t=Number(e);return t>=1&&t<=12?t-1:null}function oi(e){if(!e)return 1;let t=Number(e);return t>=0&&t<=31?t:null}function si(e){if(e=e.trim(),Jr.test(e)){let t=/AM/i.test(e),n=/PM/i.test(e),r=(t||n?e.substring(0,e.length-2).trim():e).split(/:/),i=r.length>=2,a=r.length===3,o=Number(r[0]),s=i?Number(r[1]):0,c=a?Number(r[2]):0,l=a?`hh:mm:ss`:`hh:mm`;if(t||n)l+=` a`;else if(!i)return null;o>=12&&t?o-=12:o<12&&n&&(o+=12),s+=Math.floor(c/60),c%=60,o+=Math.floor(s/60),s%=60,o>=24&&(l=`hhhh:mm:ss`);let u=new O(1899,11,30,o,s,c);return{value:o/24+s/1440+c/86400,format:l,jsDate:u}}return null}function ci(e){let t=Math.trunc(e),n=O.fromTimestamp(t*Rr-Hr),r=e-t;r=r<0?1+r:r;let i=Math.round(r*24),a=Math.round((r-i/24)*24*60),o=Math.round((r-i/24-a/24/60)*24*60*60);return n.setHours(i),n.setMinutes(a),n.setSeconds(o),n}function li(e){return Math.round(ui(e))}function ui(e){return(e.getTime()-Lr.getTime())/Rr}function di(e){return new O(e.getFullYear(),e.getMonth()+1,0).getDate()}function fi(e){return di(e)===e.getDate()}function pi(e,t,n){let r=e.getFullYear(),i=e.getMonth(),a=e.getDate(),o=new O(r,i+t,1);return n&&a===di(e)||a>di(o)?o.setDate(di(o)):o.setDate(a),o}function mi(e){let t=Math.trunc(e);return t%4==0&&t%100!=0||t%400==0}function hi(e,t,n){if(e===t)return 0;if(e>t){let n=t;t=e,e=n}let r=ci(e),i=ci(t),a=r.getDate(),o=i.getDate(),s=r.getMonth(),c=i.getMonth(),l=r.getFullYear(),u=i.getFullYear(),d=0,f=0;switch(n){case 0:a===31&&(a=30),a===30&&o===31&&(o=30),s===1&&a===(mi(l)?29:28)&&(a=30,c===1&&o===(mi(u)?29:28)&&(o=30)),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break;case 1:let n=365,r=l===u,i=l+1===u;if(!r&&!i||!r&&s<c||!r&&s===c&&a<o){let e=0,t=0;for(let n=l;n<=u;n++)e++,t+=mi(n)?366:365;n=t/e}else r?mi(l)&&(n=366):(mi(l)&&s<2&&(n=366),mi(u)&&(c>1||c===1&&o===29)&&(n=366));d=e/n,f=t/n;break;case 2:d=e/360,f=t/360;break;case 3:d=e/365,f=t/365;break;case 4:a===31&&(a=30),o===31&&(o=30),d=l+(s*30+a)/360,f=u+(c*30+o)/360;break}return f-d}function gi(e,t){let n=(t.getFullYear()-e.getFullYear())*12+t.getMonth()-e.getMonth();return e.getDate()>t.getDate()?n-1:n}function _i(e,t){let n=e.getTime(),r=t.getTime();return Math.floor((r-n)/Rr)}function vi(e,t){let n=t.getFullYear()-e.getFullYear(),r=e.getMonth(),i=t.getMonth(),a=e.getDate(),o=t.getDate();return i>r||i===r&&o>=a?n:n-1}function yi(e,t){return hi(e,t,1)<1}function bi(e,t){return Math.trunc(e)===Math.trunc(t)}function xi(e,t,n){return t>n?xi(e,n,t):(e=Math.trunc(e),t=Math.trunc(t),n=Math.trunc(n),e>=t&&e<=n)}function Si(e,t){return Math.trunc(e)<Math.trunc(t)}function Ci(e,t){return Math.trunc(e)<=Math.trunc(t)}function wi(e,t){return Math.trunc(e)>Math.trunc(t)}function Ti(e,t){return Math.trunc(e)>=Math.trunc(t)}let Ei=Rt(function(e){return e=nt(e),RegExp(`(?:^-?\\d+(?:${e}?\\d*(?:e(\\+|-)?\\d+)?)?|^-?${e}\\d+)(?!\\w|!)`)}),Di=Rt(function(e){let t=nt(e.decimalSeparator),n=`(?:\\d+(?:${nt(e.thousandsSeparator||``)}\\d{3,})*(?:${t}\\d*)?)`,r=`(?:${t}\\d+)`,i=`(?:\\s*`+n+`|`+r+`)(?:e(?:\\+|-)?\\d+)?(?:\\s*%)?`,a=`^(?:(?:`+[`(?:\\s*-)?(?:\\s*[\\$€])?`+i,`(?:\\s*-)?`+i+`(?:\\s*[\\$€])?`,`(?:\\s*[\\$€])?(?:\\s*-)?`+i].join(`)|(?:`)+`))$`;return new RegExp(a,`i`)});function Oi(e,t){return e?Di(t).test(e.trim()):!1}let ki=Rt(function(e){return RegExp(`[\$€${nt(e.thousandsSeparator||``)}]`,`g`)});function Ai(e,t){e=e.replace(ki(t),``),t.decimalSeparator!==`.`&&(e=e.replace(t.decimalSeparator,`.`));let n=Number(e);return isNaN(n)&&e.includes(`%`)&&(n=Number(e.split(`%`)[0]),!isNaN(n))?n/100:n}function ji(e,t,n){let r=[...e].sort((e,t)=>e-t),i=(r.length+(n?-1:1))*t;if(n||i--,Number.isInteger(i))return r[i];let a=Math.ceil(i),o=Math.floor(i);return r[a]*(i-o)+r[o]*(a-i)}function Mi(e){return`sheetId`in e}function Ni(e){return`dimension`in e&&`sheetId`in e&&`elements`in e}function Pi(e){return`target`in e&&`sheetId`in e}function Fi(e){return`ranges`in e}function Ii(e){return`col`in e&&`row`in e&&`sheetId`in e}function Li(e){return`sheetId`in e&&`zone`in e}let Ri=new Set([`RENAME_SHEET`,`DELETE_SHEET`,`CREATE_SHEET`,`DUPLICATE_SHEET`,`ADD_COLUMNS_ROWS`,`REMOVE_COLUMNS_ROWS`,`UNDO`,`REDO`,`ADD_MERGE`,`REMOVE_MERGE`,`UPDATE_LOCALE`,`ADD_PIVOT`,`UPDATE_PIVOT`,`INSERT_PIVOT`,`RENAME_PIVOT`,`REMOVE_PIVOT`,`DUPLICATE_PIVOT`]),zi=new Set([`EVALUATE_CELLS`,`UPDATE_CELL`,`UNHIDE_COLUMNS_ROWS`,`HIDE_COLUMNS_ROWS`,`GROUP_HEADERS`,`UNGROUP_HEADERS`,`FOLD_ALL_HEADER_GROUPS`,`FOLD_HEADER_GROUP`,`FOLD_HEADER_GROUPS_IN_ZONE`,`UNFOLD_ALL_HEADER_GROUPS`,`UNFOLD_HEADER_GROUP`,`UNFOLD_HEADER_GROUPS_IN_ZONE`,`UPDATE_TABLE`,`UPDATE_FILTER`,`UNDO`,`REDO`]),Bi=new Set([`MOVE_RANGES`]),Vi=new Set([`EVALUATE_CELLS`,`ADD_CONDITIONAL_FORMAT`,`REMOVE_CONDITIONAL_FORMAT`,`CHANGE_CONDITIONAL_FORMAT_PRIORITY`]),Hi=new Set([`AUTOFILL_CELL`,`SET_BORDER`,`SET_ZONE_BORDERS`,`SET_BORDERS_ON_TARGET`]),Ui=new Set([`START`,`ACTIVATE_SHEET`,`COPY`,`RESIZE_SHEETVIEW`,`SET_VIEWPORT_OFFSET`,`EVALUATE_CELLS`,`SET_FORMULA_VISIBILITY`,`UPDATE_FILTER`]),Wi=new Set(`UPDATE_CELL.UPDATE_CELL_POSITION.CLEAR_CELL.CLEAR_CELLS.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.COLOR_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.SET_BORDERS_ON_TARGET.CREATE_CHART.UPDATE_CHART.CREATE_TABLE.REMOVE_TABLE.UPDATE_TABLE.CREATE_TABLE_STYLE.REMOVE_TABLE_STYLE.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.ADD_PIVOT.UPDATE_PIVOT.INSERT_PIVOT.RENAME_PIVOT.REMOVE_PIVOT.DUPLICATE_PIVOT`.split(`.`));function Gi(e){return Wi.has(e.type)}function Ki(e){return Ui.has(e.type)}var qi=class{reasons;constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter(e=>e!==`Success`)}static get Success(){return Ji}get isSuccessful(){return this.reasons.length===0}isCancelledBecause(e){return this.reasons.includes(e)}};let Ji=new qi,Yi=function(e){return e.Success=`Success`,e.CancelledForUnknownReason=`CancelledForUnknownReason`,e.WillRemoveExistingMerge=`WillRemoveExistingMerge`,e.CannotMoveTableHeader=`CannotMoveTableHeader`,e.MergeIsDestructive=`MergeIsDestructive`,e.CellIsMerged=`CellIsMerged`,e.InvalidTarget=`InvalidTarget`,e.EmptyUndoStack=`EmptyUndoStack`,e.EmptyRedoStack=`EmptyRedoStack`,e.NotEnoughElements=`NotEnoughElements`,e.NotEnoughSheets=`NotEnoughSheets`,e.MissingSheetName=`MissingSheetName`,e.UnchangedSheetName=`UnchangedSheetName`,e.DuplicatedSheetName=`DuplicatedSheetName`,e.DuplicatedSheetId=`DuplicatedSheetId`,e.ForbiddenCharactersInSheetName=`ForbiddenCharactersInSheetName`,e.WrongSheetMove=`WrongSheetMove`,e.WrongSheetPosition=`WrongSheetPosition`,e.InvalidAnchorZone=`InvalidAnchorZone`,e.SelectionOutOfBound=`SelectionOutOfBound`,e.TargetOutOfSheet=`TargetOutOfSheet`,e.WrongCutSelection=`WrongCutSelection`,e.WrongPasteSelection=`WrongPasteSelection`,e.WrongPasteOption=`WrongPasteOption`,e.WrongFigurePasteOption=`WrongFigurePasteOption`,e.EmptyClipboard=`EmptyClipboard`,e.EmptyRange=`EmptyRange`,e.InvalidRange=`InvalidRange`,e.InvalidZones=`InvalidZones`,e.InvalidSheetId=`InvalidSheetId`,e.InvalidCellId=`InvalidCellId`,e.InvalidFigureId=`InvalidFigureId`,e.InputAlreadyFocused=`InputAlreadyFocused`,e.MaximumRangesReached=`MaximumRangesReached`,e.MinimumRangesReached=`MinimumRangesReached`,e.InvalidChartDefinition=`InvalidChartDefinition`,e.InvalidDataSet=`InvalidDataSet`,e.InvalidLabelRange=`InvalidLabelRange`,e.InvalidScorecardKeyValue=`InvalidScorecardKeyValue`,e.InvalidScorecardBaseline=`InvalidScorecardBaseline`,e.InvalidGaugeDataRange=`InvalidGaugeDataRange`,e.EmptyGaugeRangeMin=`EmptyGaugeRangeMin`,e.GaugeRangeMinNaN=`GaugeRangeMinNaN`,e.EmptyGaugeRangeMax=`EmptyGaugeRangeMax`,e.GaugeRangeMaxNaN=`GaugeRangeMaxNaN`,e.GaugeRangeMinBiggerThanRangeMax=`GaugeRangeMinBiggerThanRangeMax`,e.GaugeLowerInflectionPointNaN=`GaugeLowerInflectionPointNaN`,e.GaugeUpperInflectionPointNaN=`GaugeUpperInflectionPointNaN`,e.GaugeLowerBiggerThanUpper=`GaugeLowerBiggerThanUpper`,e.InvalidAutofillSelection=`InvalidAutofillSelection`,e.MinBiggerThanMax=`MinBiggerThanMax`,e.LowerBiggerThanUpper=`LowerBiggerThanUpper`,e.MidBiggerThanMax=`MidBiggerThanMax`,e.MinBiggerThanMid=`MinBiggerThanMid`,e.FirstArgMissing=`FirstArgMissing`,e.SecondArgMissing=`SecondArgMissing`,e.MinNaN=`MinNaN`,e.MidNaN=`MidNaN`,e.MaxNaN=`MaxNaN`,e.ValueUpperInflectionNaN=`ValueUpperInflectionNaN`,e.ValueLowerInflectionNaN=`ValueLowerInflectionNaN`,e.MinInvalidFormula=`MinInvalidFormula`,e.MidInvalidFormula=`MidInvalidFormula`,e.MaxInvalidFormula=`MaxInvalidFormula`,e.ValueUpperInvalidFormula=`ValueUpperInvalidFormula`,e.ValueLowerInvalidFormula=`ValueLowerInvalidFormula`,e.InvalidSortZone=`InvalidSortZone`,e.WaitingSessionConfirmation=`WaitingSessionConfirmation`,e.MergeOverlap=`MergeOverlap`,e.TooManyHiddenElements=`TooManyHiddenElements`,e.Readonly=`Readonly`,e.InvalidViewportSize=`InvalidViewportSize`,e.InvalidScrollingDirection=`InvalidScrollingDirection`,e.ViewportScrollLimitsReached=`ViewportScrollLimitsReached`,e.FigureDoesNotExist=`FigureDoesNotExist`,e.InvalidConditionalFormatId=`InvalidConditionalFormatId`,e.InvalidConditionalFormatType=`InvalidConditionalFormatType`,e.InvalidCellPopover=`InvalidCellPopover`,e.EmptyTarget=`EmptyTarget`,e.InvalidFreezeQuantity=`InvalidFreezeQuantity`,e.FrozenPaneOverlap=`FrozenPaneOverlap`,e.ValuesNotChanged=`ValuesNotChanged`,e.InvalidFilterZone=`InvalidFilterZone`,e.TableNotFound=`TableNotFound`,e.TableOverlap=`TableOverlap`,e.InvalidTableConfig=`InvalidTableConfig`,e.InvalidTableStyle=`InvalidTableStyle`,e.FilterNotFound=`FilterNotFound`,e.MergeInTable=`MergeInTable`,e.NonContinuousTargets=`NonContinuousTargets`,e.DuplicatedFigureId=`DuplicatedFigureId`,e.InvalidSelectionStep=`InvalidSelectionStep`,e.DuplicatedChartId=`DuplicatedChartId`,e.ChartDoesNotExist=`ChartDoesNotExist`,e.InvalidHeaderIndex=`InvalidHeaderIndex`,e.InvalidQuantity=`InvalidQuantity`,e.MoreThanOneColumnSelected=`MoreThanOneColumnSelected`,e.EmptySplitSeparator=`EmptySplitSeparator`,e.SplitWillOverwriteContent=`SplitWillOverwriteContent`,e.NoSplitSeparatorInSelection=`NoSplitSeparatorInSelection`,e.NoActiveSheet=`NoActiveSheet`,e.InvalidLocale=`InvalidLocale`,e.MoreThanOneRangeSelected=`MoreThanOneRangeSelected`,e.NoColumnsProvided=`NoColumnsProvided`,e.ColumnsNotIncludedInZone=`ColumnsNotIncludedInZone`,e.DuplicatesColumnsSelected=`DuplicatesColumnsSelected`,e.InvalidHeaderGroupStartEnd=`InvalidHeaderGroupStartEnd`,e.HeaderGroupAlreadyExists=`HeaderGroupAlreadyExists`,e.UnknownHeaderGroup=`UnknownHeaderGroup`,e.UnknownDataValidationRule=`UnknownDataValidationRule`,e.UnknownDataValidationCriterionType=`UnknownDataValidationCriterionType`,e.InvalidDataValidationCriterionValue=`InvalidDataValidationCriterionValue`,e.InvalidNumberOfCriterionValues=`InvalidNumberOfCriterionValues`,e.InvalidCopyPasteSelection=`InvalidCopyPasteSelection`,e.NoChanges=`NoChanges`,e.InvalidInputId=`InvalidInputId`,e.SheetIsHidden=`SheetIsHidden`,e.InvalidTableResize=`InvalidTableResize`,e.PivotIdNotFound=`PivotIdNotFound`,e.PivotInError=`PivotInError`,e.EmptyName=`EmptyName`,e.ValueCellIsInvalidFormula=`ValueCellIsInvalidFormula`,e.InvalidDefinition=`InvalidDefinition`,e.InvalidColor=`InvalidColor`,e.InvalidPivotDataSet=`InvalidPivotDataSet`,e}({}),Xi=[{name:`English (US)`,code:`en_US`,thousandsSeparator:`,`,decimalSeparator:`.`,weekStart:7,dateFormat:`m/d/yyyy`,timeFormat:`hh:mm:ss a`,formulaArgSeparator:`,`},{name:`French`,code:`fr_FR`,thousandsSeparator:` `,decimalSeparator:`,`,weekStart:1,dateFormat:`dd/mm/yyyy`,timeFormat:`hh:mm:ss`,formulaArgSeparator:`;`}],k=Xi[0],Zi=[`thin`,`medium`,`thick`,`dashed`,`dotted`];function A(e){return Array.isArray(e)&&Array.isArray(e[0])}let Qi={Background:0,Highlights:1,Clipboard:2,Chart:4,Autofill:5,Selection:6,Headers:100},$i=Rt(()=>Object.keys(Qi).sort((e,t)=>Qi[e]-Qi[t]));function ea(e,t){if(Qi[e])throw Error(`Layer ${e} already exists`);Qi[e]=t}let j={NotAvailable:`#N/A`,InvalidReference:`#REF`,BadExpression:`#BAD_EXPR`,CircularDependency:`#CYCLE`,UnknownFunction:`#NAME?`,DivisionByZero:`#DIV/0!`,SpilledBlocked:`#SPILL!`,GenericError:`#ERROR`,NullError:`#NULL!`},ta=new Set(Object.values(j));var M=class{message;value;constructor(e=E(`Error`),t=j.GenericError){this.message=e,this.value=t,this.message=e.toString()}},na=class extends M{constructor(e=E(`Invalid expression`)){super(e,j.BadExpression)}},ra=class extends M{constructor(e=E(`Circular reference`)){super(e,j.CircularDependency)}},ia=class extends M{constructor(e=E(`Invalid reference`)){super(e,j.InvalidReference)}},aa=class extends M{constructor(e=E(`Data not available`)){super(e,j.NotAvailable)}},oa=class extends M{constructor(e=E(`Unknown function`)){super(e,j.UnknownFunction)}},sa=class extends M{constructor(e=E(`Spill range is not empty`)){super(e,j.SpilledBlocked)}};let ca=[`number`,`string`,`boolean`,`undefined`];function N(e,t,n){if(!e())throw new M(t,n)}function la(e){if(e!==void 0)return A(e)?e[0][0]?.format:e.format}function P(e){return typeof e==`string`&&ta.has(e)}let ua=e=>E(`The function [[FUNCTION_NAME]] expects a number value, but '%s' is a string, and cannot be coerced to a number.`,e),da=(e,t,n)=>E(`The function [[FUNCTION_NAME]] expects a number value between %s and %s inclusive, but receives %s.`,e.toString(),t.toString(),n.toString()),fa=(e,t)=>E(`The function [[FUNCTION_NAME]] has an argument with value '%s'. It should be one of: %s.`,t,e.map(e=>`'${e}'`).join(`, `));function F(e,t){let n=Ca(e);switch(typeof n){case`number`:return n;case`boolean`:return+!!n;case`string`:if(Oi(n,t)||n===``)return Ai(n,t);let e=Qr(n,t);if(e)return e.value;throw new M(ua(n));default:return 0}}function pa(e,t){try{return F(e,t)}catch{return}}function ma(e,t){return z(e).map(e=>e.map(e=>{if(typeof e.value!=`number`){let n=``;throw typeof e==`object`?n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got an empty value.`,t):typeof e==`string`?n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got a string.`,t):typeof e==`boolean`&&(n=E(`Function [[FUNCTION_NAME]] expects number values for %s, but got a boolean.`,t)),new M(n)}return e.value}))}function ha(e,t){let n=Ca(e);if(n===``)throw new M(ua(n));return F(n,t)}function ga(e,t){return Math.trunc(F(e,t))}function _a(e,t){return Math.trunc(ha(e,t))}function va(e){N(()=>e>=1,E(`The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.`,e.toString()))}function ya(e){N(()=>e!==0,E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero)}function I(e){let t=Ca(e);switch(typeof t){case`string`:return t;case`number`:return t.toString();case`boolean`:return t?`TRUE`:`FALSE`;default:return``}}let ba=Rt(function(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``)}),xa=e=>E(`The function [[FUNCTION_NAME]] expects a boolean value, but '%s' is a text, and cannot be coerced to a boolean.`,e);function L(e){let t=Ca(e);switch(typeof t){case`boolean`:return t;case`string`:if(t){let e=t.toUpperCase();if(e===`TRUE`)return!0;if(e===`FALSE`)return!1;throw new M(xa(t))}else return!1;case`number`:return!!t;default:return!1}}function Sa(e){let t=Ca(e);if(t===``)throw new M(xa(t));return L(t)}function R(e,t){return ci(F(Ca(e),t))}function Ca(e){if(typeof e==`object`&&e&&`value`in e){if(P(e.value))throw e;return e.value}if(P(e))throw new M(``,e);return e}function wa(e,t,n){for(let r of e)if(A(r)){let e=r.length,n=r[0].length;for(let i=0;i<n;i++)for(let n=0;n<e;n++)t(r[n][i])}else n(r)}function Ta(e,t){wa(e,e=>{if(P(e.value))throw e;t(e)},e=>{if(P(e?.value))throw e;t(e)})}function Ea(e,t,n){wa(e,e=>{if(typeof e?.value==`number`&&t(e),P(e?.value))throw e},e=>{t({value:ha(e,n),format:e?.format})})}function Da(e,t,n,r,i=`rowFirst`){let a=r;for(let r of e)if(A(r)){let e=r.length,n=r[0].length;if(i===`rowFirst`)for(let i=0;i<n;i++)for(let n=0;n<e;n++)a=t(a,r[n][i]);else for(let i=0;i<e;i++)for(let e=0;e<n;e++)a=t(a,r[i][e])}else a=n(a,r);return a}function Oa(e,t,n,r=`rowFirst`){return Da(e,t,t,n,r)}function ka(e,t,n,r){return Da(e,(e,n)=>{let r=n?.value;if(typeof r==`number`)return t(e,r);if(P(r))throw n;return e},(e,n)=>t(e,ha(n,r)),n)}function Aa(e,t,n,r){return Da(e,(e,n)=>{let i=n?.value;if(i!=null){if(typeof i==`number`)return t(e,i);if(typeof i==`boolean`)return t(e,F(i,r));if(P(i))throw n;return t(e,0)}return e},(e,n)=>t(e,F(n,r)),n)}function ja(e,t,n){let r=Array(e);for(let i=0;i<e;i++){r[i]=Array(t);for(let e=0;e<t;e++)r[i][e]=n(i,e)}return r}function Ma(e,t){return e.length===0?[]:ja(e.length,e[0].length,(n,r)=>t(e[n][r]))}function Na(e,t){let n=e.length,r=e[0]?.length??0;for(let i=0;i<n;i++)for(let n=0;n<r;n++)t(e[i][n])}function Pa(e){return e.length?ja(e[0].length,e.length,(t,n)=>e[n][t]):[]}function Fa(e,t,n=void 0){let r=1,i=1,a=1/0,o=1/0,s;for(let e=0;e<t.length;e++){let c=t[e];if(A(c)&&(n===void 0||n[e])){let n=c.length,l=c[0].length;n!==1||l!==1?(s??=Array(t.length),n!==1&&l!==1?(s[e]=`matrix`,r=Math.max(r,n),i=Math.max(i,l),a=Math.min(a,n),o=Math.min(o,l)):n===1?l!==1&&(s[e]=`vertical`,i=Math.max(i,l),o=Math.min(o,l)):(s[e]=`horizontal`,r=Math.max(r,n),a=Math.min(a,n))):t[e]=c[0][0]}}if(r===1&&i===1)return e(...t);let c=Array(t.length),l=[],u=[];for(let e=0;e<t.length;e++){let n=t[e];switch(s?.[e]){case`matrix`:l.push((e,t)=>n[e][t]),u.push(e);break;case`horizontal`:l.push(e=>n[e][0]),u.push(e);break;case`vertical`:l.push((e,t)=>n[0][t]),u.push(e);break;case void 0:c[e]=n;break}}let d=u.length,f;switch(c.length){case 1:f=()=>e(c[0]);break;case 2:f=()=>e(c[0],c[1]);break;case 3:f=()=>e(c[0],c[1],c[2]);break;default:f=()=>e(...c)}let p=Array(r);for(let e=0;e<r;e++){let t=Array(i);p[e]=t;for(let n=0;n<i;n++){if(e>a-1||n>o-1){t[n]=new aa(E(`Array arguments to [[FUNCTION_NAME]] are of different size.`));continue}for(let t=0;t<d;t++)c[u[t]]=l[t](e,n);let r=f();t[n]=A(r)?r[0][0]:r}}return p}function Ia(e,t,n){for(let r of e)if(A(r)){let e=r.length,n=r[0].length;for(let i=0;i<n;i++)for(let n=0;n<e;n++)if(!t(r[n][i]??void 0))return}else if(!n(r))return}function La(e,t){return Ia(e,e=>{let n=e?.value;if(typeof n==`boolean`)return t(n);if(typeof n==`number`)return t(!!n);if(P(n))throw e;return!0},e=>e!==void 0&&e.value!==null?t(Sa(e)):!0)}function Ra(e,t){let n,r,i=e.substring(0,2);return i===`<=`||i===`>=`||i===`<>`?(n=i,r=e.substring(2)):(i=e.substring(0,1),i===`<`||i===`>`||i===`=`?(n=i,r=e.substring(1)):(n=`=`,r=e)),Oi(r,t)||Xr(r,t)?r=F(r,t):(r===`TRUE`||r===`FALSE`)&&(r=L(r)),{operator:n,operand:r}}let za=Rt(function(e){if(e===`*`)return/.+/;let t=``,n=``;for(let r of e)r===`?`&&n!==`~`?t+=`.`:r===`*`&&n!==`~`?t+=`.*`:((r===`*`||r===`?`)&&(t=t.slice(0,-1)),[`^`,`.`,`[`,`]`,`$`,`(`,`)`,`*`,`+`,`?`,`|`,`{`,`}`,`\\`].includes(r)&&(t+=`\\`),t+=r),n=r;return RegExp(`^`+t+`$`,`i`)});function Ba(e=``,t,n){let{operator:r,operand:i}=t;if(i===void 0||e===null||i===null)return!1;if(typeof i==`number`&&r===`=`)return typeof e==`string`&&(Oi(e,n)||Xr(e,n))?F(e,n)===i:e===i;if(r===`<>`||r===`=`){let t;return t=typeof e==typeof i?typeof e==`string`&&typeof i==`string`?za(i).test(e):e===i:!1,r===`=`?t:!t}if(typeof e==typeof i)switch(r){case`<`:return e<i;case`>`:return e>i;case`<=`:return e<=i;case`>=`:return e>=i}return!1}function Va(e,t,n,r=!1){let i=e.length;if(i%2==1)throw new M(E(`Function [[FUNCTION_NAME]] expects criteria_range and criterion to be in pairs.`));let a=z(e[0]),o=a.length,s=a[0].length,c=[];for(let t=0;t<i-1;t+=2){let i=z(e[t]);if(i.length!==o||i[0].length!==s)throw new M(E(`Function [[FUNCTION_NAME]] expects criteria_range to have the same dimension`));let a=Ra(I(e[t+1]),n);r&&typeof a.operand==`string`&&(a.operand+=`*`),c.push(a)}for(let r=0;r<o;r++)for(let a=0;a<s;a++){let o=!0;for(let t=0;t<i-1;t+=2){let i=z(e[t])[r][a].value,s=c[t/2];if(o=Ba(i??void 0,s,n),!o)break}o&&t(r,a)}}function Ha(e,t,n,r,i,a){if(t===void 0||t.value===null)return-1;if(P(t.value))throw t;let o=Ga(t.value),s=typeof o,c,l,u=0,d=i-1,f,p,m,h,g=r===`desc`?t=>Ga(a(e,i-t-1)):t=>Ga(a(e,t));for(;d-u>=0;){for(f=Math.floor((u+d)/2),p=f,m=g(p),h=typeof m;u<p&&s!==h;)p--,m=g(p),h=typeof m;if(h!==s||m==null){u=f+1;continue}n===`strict`&&m===o?(c=m,l=p):n===`nextSmaller`&&m<=o?(c==null||c<m||c===m&&l<p)&&(c=m,l=p):n===`nextGreater`&&m>=o&&(c===void 0||c>m||c===m&&l<p)&&(c=m,l=p),m>o||n===`strict`&&m===o?d=p-1:u=f+1}return l===void 0?-1:r===`desc`?i-l-1:l}function Ua(e,t,n,r,i,a,o=!1){if(t===void 0||t.value===null)return-1;if(P(t.value))throw t;let s=Ga(t.value),c=o?(e,t)=>Ga(i(e,r-t-1)):(e,t)=>Ga(i(e,t)),l=n!==`wildcard`||typeof s!=`string`||!(s.includes(`*`)||s.includes(`?`));if(a&&l){let t=o?`reverseSearch`:`forwardSearch`,i=a[t].get(e);if(i===void 0){i=new Map;for(let t=0;t<r;t++){let n=c(e,t)??null;i.has(n)||i.set(n,t)}a[t].set(e,i)}if(i.has(s)){let e=i.get(s);return o?r-e-1:e}if(n===`strict`)return-1}let u=Wa(e,s,n,r,c);return o&&u!==-1?r-u-1:u}function Wa(e,t,n,r,i){let a=n=>i(e,n)===t;if(n===`wildcard`&&typeof t==`string`&&(t.includes(`*`)||t.includes(`?`))){let n=za(t);a=t=>{let r=i(e,t);return typeof r==`string`?n.test(r):!1}}let o,s=-1;n===`nextSmaller`&&(a=n=>{let r=i(e,n);return(!o&&Ka(t,r)>=0||Ka(t,r)>=0&&Ka(r,o)>0)&&(o=r,s=n),r===t}),n===`nextGreater`&&(a=n=>{let r=i(e,n);return(!o&&Ka(t,r)<=0||Ka(t,r)<=0&&Ka(r,o)<0)&&(o=r,s=n),r===t});for(let e=0;e<r;e++)if(a(e))return e;return s}function Ga(e){return typeof e==`string`?ba(e):e}function Ka(e,t){let n=ca.indexOf(typeof e)-ca.indexOf(typeof t);return n===0&&(typeof e==`string`&&typeof t==`string`?n=e.localeCompare(t):typeof e==`number`&&typeof t==`number`?n=e-t:typeof e==`boolean`&&typeof t==`boolean`&&(n=Number(e)-Number(t))),n}function z(e){return e===void 0?[[]]:A(e)?e:[[e]]}function qa(e,t){return Oa(e,(e,n)=>(e.push(t(n)),e),[],`rowFirst`)}function Ja(e){if(e===void 0)return!1;let{value:t}=e;return!(t===null||t===``)}function Ya(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}let Xa=new h;function Za(e,t){return e=Ya(e),{url:e,label:t||e,isExternal:!0,isUrlEditable:!0}}Xa.add(`sheet_URL`,{match:e=>vt(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){let n=bt(e);return t.tryGetSheetName(n)||E(`Invalid sheet`)},open(e,t){let n=bt(e);t.model.dispatch(`ACTIVATE_SHEET`,{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:n}).isCancelledBecause(`SheetIsHidden`)&&t.notifyUser({type:`warning`,sticky:!1,text:E(`Cannot open the link because the linked sheet is hidden.`)})},sequence:0});let Qa={createLink:Za,match:e=>mt(e),open:e=>window.open(e,`_blank`),urlRepresentation:e=>e,sequence:0};function $a(e){return Xa.getAll().sort((e,t)=>e.sequence-t.sequence).find(t=>t.match(e))||Qa}function eo(e,t){return $a(e.url).urlRepresentation(e.url,t)}function to(e,t){$a(e.url).open(e.url,t)}function no(e){if(typeof e==`string`){if(pt(e)){let{label:t,url:n}=gt(e);return $a(n).createLink(n,t)}else if(mt(e))return Za(e)}}function ro(e){e=e.replace(/\s/g,` `);let t=new qt(e),n=[],r=[];for(n.push(r);!t.isOver();){if(t.current===`;`){r=[],n.push(r),t.shift();continue}let e=fo(t)||io(t)||oo(t)||so(t)||lo(t)||uo(t)||mo(t)||co(t)||ho(t);if(!e)throw Error(`Unknown token at `+t.remaining());r.push(e)}return n}function io(e){let t;if(e.current===`"`?(e.shift(),t=`"`):e.currentStartsWith(`[$`)&&(e.advanceBy(2),t=`]`),!t)return null;let n=``;for(;e.current&&e.current!==t;)n+=e.shift();if(e.current===t)e.shift();else throw Error(`Unterminated string in format`);return{type:`STRING`,value:n}}let ao=new Set(`$+-/():!^&~{}<>= `);function oo(e){if(e.current===`\\`){e.shift();let t=e.shift();if(!t)throw Error(`Unexpected end of format string`);return{type:`CHAR`,value:t}}return ao.has(e.current)?{type:`CHAR`,value:e.shift()}:null}function so(e){return e.current===`,`?(e.shift(),{type:`THOUSANDS_SEPARATOR`,value:`,`}):null}function co(e){return e.current===`@`?(e.shift(),{type:`TEXT_PLACEHOLDER`,value:`@`}):null}function lo(e){return e.current===`.`?(e.shift(),{type:`DECIMAL_POINT`,value:`.`}):null}function uo(e){return e.current===`%`?(e.shift(),{type:`PERCENT`,value:`%`}):null}function fo(e){if(e.current===`0`||e.current===`#`){let t=e.current;return e.shift(),{type:`DIGIT`,value:t}}return null}let po=new Set(`dmqyhsa`);function mo(e){if(!po.has(e.current))return null;let t=e.current,n=``;for(;e.current===t;)n+=e.shift();return{type:`DATE_PART`,value:n}}function ho(e){if(e.current!==`*`)return null;e.shift();let t=e.shift();if(!t)throw Error(`Unexpected end of format string`);return{type:`REPEATED_CHAR`,value:t}}let go={};function _o(e){let t=go[e];return t===void 0&&(t=vo(e),go[e]=t),t}function vo(e){let t=ro(e);for(let e of t){let t=e.filter(e=>e.type===`REPEATED_CHAR`);for(let e of t.slice(1))e.type=`CHAR`}let n=Co(t[0])||So(t[0])||wo(t[0]);if(!n)throw Error(`Invalid first format part of: `+e);if(t.length>1&&n.type===`text`)throw Error(`The first format in a multi-part format must be a number format: `+e);let r=Co(t[1])||So(t[1]);if(t[1]?.length&&!r)throw Error(`Invalid second format part of: `+e);let i=Co(t[2])||So(t[2]);if(t[2]?.length&&!i)throw Error(`Invalid third format part of: `+e);let a=wo(t[3]);if(t[3]?.length&&!a)throw Error(`Invalid fourth format part of: `+e);return{positive:n,negative:r,zero:i,text:a}}function yo(e){return e.every(e=>e.type===`DATE_PART`||e.type===`DECIMAL_POINT`||e.type===`THOUSANDS_SEPARATOR`||e.type===`STRING`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function bo(e){return e.every(e=>e.type===`DIGIT`||e.type===`DECIMAL_POINT`||e.type===`THOUSANDS_SEPARATOR`||e.type===`PERCENT`||e.type===`STRING`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function xo(e){return e.every(e=>e.type===`STRING`||e.type===`TEXT_PLACEHOLDER`||e.type===`CHAR`||e.type===`REPEATED_CHAR`)}function So(e){if(!e||!bo(e))return;let t=[],n,r=t,i=0,a=0,o=e.findLastIndex(e=>e.type===`DIGIT`),s=!1,c=0;for(let l=0;l<e.length;l++){let u=e[l];switch(u.type){case`DIGIT`:r===t?r.push(u):c<20&&(r.push(u),c++);break;case`DECIMAL_POINT`:if(r===t)n=[],r=n;else throw Error(`Multiple decimal points in a number format`);break;case`REPEATED_CHAR`:case`CHAR`:case`STRING`:r.push(u);break;case`PERCENT`:i++,r.push(u);break;case`THOUSANDS_SEPARATOR`:l-1===o?(a+=1,o++,r.push(u)):e[l+1]?.type===`DIGIT`&&e[l-1]?.type===`DIGIT`?(r===t&&(s=!0),r.push(u)):r.push({type:`CHAR`,value:`,`});break}}return{type:`number`,integerPart:t,decimalPart:n,percentSymbols:i,thousandsSeparator:s,magnitude:a}}function Co(e){let t=e&&yo(e)?{type:`date`,tokens:e}:void 0;if(t){if(t.tokens.length&&t.tokens.every(e=>e.type===`DATE_PART`&&e.value===`a`))throw Error(`Invalid date format`);return{type:`date`,tokens:To(t.tokens.map(e=>e.type===`THOUSANDS_SEPARATOR`||e.type===`DECIMAL_POINT`?{type:`CHAR`,value:e.value}:e))}}}function wo(e){return e&&xo(e)?{type:`text`,tokens:e}:void 0}function To(e){let t=e.filter(e=>e.type===`DATE_PART`);for(let e=0;e<t.length;e++)!t[e].value.startsWith(`m`)||t[e].value.length>2||(t[e-1]?.value.startsWith(`h`)||t[e+1]?.value.startsWith(`s`))&&(t[e].value=t[e].value.replaceAll(`m`,`M`));return e}function Eo(e){return[Do(e.positive),Do(e.negative),Do(e.zero),Do(e.text)].filter(S).join(`;`)}function Do(e){if(!e)return;let t=``,n=e.type===`number`?Oo(e):e.tokens;for(let e of n)switch(e.type){case`STRING`:t+=`[$${e.value}]`;break;case`CHAR`:t+=ko(e.value)?`\\${e.value}`:e.value;break;case`REPEATED_CHAR`:t+=`*`+e.value;break;case`DATE_PART`:t+=e.value===`MM`?`mm`:e.value;break;default:t+=e.value}return t}function Oo(e){let t=[...e.integerPart];return e.decimalPart&&(t.push({type:`DECIMAL_POINT`,value:`.`}),t.push(...e.decimalPart)),t}function ko(e){return!ao.has(e)}let Ao=`REPEATED_CHAR_PLACEHOLDER_`,jo={0:E(`January`),1:E(`February`),2:E(`March`),3:E(`April`),4:E(`May`),5:E(`June`),6:E(`July`),7:E(`August`),8:E(`September`),9:E(`October`),10:E(`November`),11:E(`December`)},Mo={0:E(`Sunday`),1:E(`Monday`),2:E(`Tuesday`),3:E(`Wednesday`),4:E(`Thursday`),5:E(`Friday`),6:E(`Saturday`)};function B(e,{format:t,locale:n,formatWidth:r}){switch(typeof e==`boolean`&&(e=e?`TRUE`:`FALSE`),typeof e){case`string`:{if(e.includes(`\\"`)&&(e=e.replaceAll(/\\"/g,`"`)),!t)return e;let n=_o(t),i=n.text||n.positive;return!i||i.type!==`text`?e:No(e,i,r)}case`number`:t||=Yo(e);let i=_o(t);if(i.positive.type===`text`)return No(e.toString(),i.positive,r);let a=i.positive;if(e<0&&i.negative?(a=i.negative,e=-e):e===0&&i.zero&&(a=i.zero),a.type===`date`)return Po(Ko(e,a),r);let o=e<0,s=Po(Fo(Math.abs(e),a,n),r);return o?`-`+s:s;case`object`:return``}}function No(e,t,n){let r=``;for(let n of t.tokens)switch(n.type){case`TEXT_PLACEHOLDER`:r+=e;break;case`CHAR`:case`STRING`:r+=n.value;break;case`REPEATED_CHAR`:r+=Ao+n.value;break}return Po(r,n)}function Po(e,t){let n=e.indexOf(Ao);if(n===-1)return e;let r=e.slice(0,n),i=e.slice(n+26+1),a=e[n+26];function o(){if(!t)return{timesToRepeat:0,padding:``};let e=t.measureText(r+i),n=t.measureText(a),o=t.availableWidth-e;if(o<=0)return{timesToRepeat:0,padding:``};let s=Math.floor(o/n),c=o-s*n,l=t.measureText(` `);return{timesToRepeat:s,padding:` `.repeat(Math.floor(c/l))}}let{timesToRepeat:s,padding:c}=o();return r+a.repeat(s)+c+i}function Fo(e,t,n){if(e===1/0)return`∞`+(t.percentSymbols?`%`:``);let r=t.percentSymbols*2-t.magnitude*3;e*=10**r;let i=0;t.decimalPart!==void 0&&(i=t.decimalPart.filter(e=>e.type===`DIGIT`).length);let{integerDigits:a,decimalDigits:o}=zo(Math.abs(e),i),s=Io(a,t,t.thousandsSeparator?n.thousandsSeparator:void 0);return t.decimalPart!==void 0&&(s+=n.decimalSeparator+Lo(o||``,t)),s}function Io(e,t,n){let r=t.integerPart;r.some(e=>e.type===`DIGIT`)||(r=[...r,{type:`DIGIT`,value:`#`}]),e===`0`&&(e=``);let i=``,a=r.findIndex(e=>e.type===`DIGIT`),o=e.length-1;function s(t,r){if(r===`0`&&(t||=`0`),!t)return;let a=e.length-1-o;i=n&&a>0&&a%3==0?t+n+i:t+i}for(let t=r.length-1;t>=0;t--){let n=r[t];switch(n.type){case`DIGIT`:let r=e[o];if(s(r,n.value),o--,a===t)for(;o>=0;)s(e[o],`0`),o--;break;case`THOUSANDS_SEPARATOR`:break;case`REPEATED_CHAR`:i=Ao+n.value+i;break;default:i=n.value+i;break}}return i}function Lo(e,t){if(!t.decimalPart)return``;let n=``,r=0;for(let i of t.decimalPart)switch(i.type){case`DIGIT`:let t=i.value===`#`?e[r]||``:e[r]||`0`;n+=t,r++;break;case`THOUSANDS_SEPARATOR`:break;case`REPEATED_CHAR`:n+=Ao+i.value;break;default:n+=i.value;break}return n}let Ro=[];function zo(e,t=20){let n=e.toString();if(n.includes(`e`))return Uo(e,t);if(Number.isInteger(e))return{integerDigits:n,decimalDigits:void 0};let r=n.indexOf(`.`),i=n.substring(0,r),a=n.substring(r+1);if(t===0)return Number(a[0])>=5&&(i=(Number(i)+1).toString()),{integerDigits:i,decimalDigits:void 0};if(a.length>t){let{integerDigits:e,decimalDigits:n}=Ho(a,t);a=n,e!==`0`&&(i=(Number(i)+Number(e)).toString())}return{integerDigits:i,decimalDigits:Bo(a||``)}}function Bo(e){let t=e.length-1;for(;t>=0&&e[t]===`0`;)t--;return e.slice(0,t+1)||void 0}let Vo=/^0+/;function Ho(e,t){let n=`0`,r=e,i=e.slice(0,t);if(Number(e[t])<5)return{integerDigits:n,decimalDigits:i};let a=i.match(Vo)?.[0]||``,o=(Number(i)+1).toString(),s=i.slice(a.length),c=o.length>s.length;return c&&!a?(n=`1`,r=void 0):r=c?a.slice(0,-1)+o:a+o,{integerDigits:n,decimalDigits:r}}function Uo(e,t=20){let n=Ro[t];n||(n=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:t,useGrouping:!1}),Ro[t]=n);let[r,i]=n.format(e).split(`.`);return{integerDigits:r,decimalDigits:i}}function Wo(e,t){let{integerDigits:n,decimalDigits:r}=zo(e,20);return r?n+t+r:n}let Go=Rt(function(e){if(!e)return!1;try{return _o(e).positive.type===`date`}catch{return!1}});function Ko(e,t){let n=ci(e);if(isNaN(n.getTime()))return e.toString();let r=t.tokens.some(e=>e.type===`DATE_PART`&&e.value===`a`),i=``;for(let e of t.tokens)switch(e.type){case`DATE_PART`:i+=qo(n,e.value,r);break;case`REPEATED_CHAR`:i+=Ao+e.value;break;default:i+=e.value;break}return i}function qo(e,t,n){switch(t){case`d`:return e.getDate();case`dd`:return e.getDate().toString().padStart(2,`0`);case`ddd`:return Mo[e.getDay()].slice(0,3);case`dddd`:return Mo[e.getDay()].toString();case`m`:return e.getMonth()+1;case`mm`:return String(e.getMonth()+1).padStart(2,`0`);case`mmm`:return jo[e.getMonth()].slice(0,3);case`mmmm`:return jo[e.getMonth()].toString();case`mmmmm`:return jo[e.getMonth()].slice(0,1);case`qq`:return E(`Q%(quarter)s`,{quarter:e.getQuarter()}).toString();case`qqqq`:return E(`Quarter %(quarter)s`,{quarter:e.getQuarter()}).toString();case`yy`:let r=String(e.getFullYear()).replace(`-`,``).padStart(2,`0`);return r.slice(r.length-2);case`yyyy`:return String(e.getFullYear()).replace(`-`,``).padStart(4,`0`);case`hhhh`:return Math.floor((e.getTime()-Lr.getTime())/(3600*1e3)).toString();case`hh`:let i=e.getHours();return n&&(i=i===0?12:i>12?i-12:i),i.toString().padStart(2,`0`);case`MM`:return e.getMinutes().toString().padStart(2,`0`);case`ss`:return e.getSeconds().toString().padStart(2,`0`);case`a`:return e.getHours()>=12?`PM`:`AM`;default:throw Error(`invalid date format token: ${t}`)}}let Jo=Rt(function(e){return RegExp(`[0-9]+${nt(e.decimalSeparator)}[0-9]`)});function Yo(e){let{integerDigits:t,decimalDigits:n}=zo(e);if(!n)return`0`;let r=t.replace(`-`,``).length;if(r+2>11)return`0`;let i=11-r-1;return{decimalDigits:n}=zo(e,Math.min(i,n.length)),n?`0.`+`0`.repeat(n.length):`0`}function Xo(e,t){if(Xr(e,t))return Qr(e,t).format}function Zo(e){let t=e.includes(`.`)?`0.00`:`0`,n=e.match(/[\$€]/);if(n){let r=e.match(/[\d]/),i=`[$`+n.values().next().value+`]`;return r.index<n.index?`#,##`+t+i:i+`#,##`+t}if(e.includes(`%`))return t+`%`}function Qo(e){let t=e.decimalPlaces??2,n=e.position??`before`,r=e.code??``,i=e.symbol??``,a=`#,##0`+(t?`.`+`0`.repeat(t):``),o=`${r} ${i}`.trim();return n===`after`&&r&&(o=` `+o),ts(o,n,a)}function $o(e){let t=e.decimalPlaces??2,n=e.position??`before`,r=e.code??``,i=e.symbol??``,a=`#,##0`+(t?`.`+`0`.repeat(t):``),o=`${r} ${i}`.trim();return n===`after`&&r&&(o=` `+o),[es(o,n,` ${a} `),es(o,n,`(${a})`),es(o,n,` - `)].join(`;`)}function es(e,t,n){let r=`[$${e}]`;return t===`before`?r+`* `+n:n+`* `+r}function ts(e,t,n){let r=`[$${e}]`;return t===`before`?r+n:n+r}function ns(e){let t=_o(e);return Eo({positive:rs(t.positive),negative:t.negative?rs(t.negative):void 0,zero:t.zero?rs(t.zero):void 0,text:t.text})}function rs(e){if(e.type!==`number`||!e.decimalPart)return e;let t=e.decimalPart.filter(e=>e.type!==`DIGIT`);return{...e,decimalPart:void 0,integerPart:[...e.integerPart,...t]}}function is({value:e,format:t},n){return B(e,{format:as({value:e,format:t},void 0,n),locale:n})}function as(e,t,n){let r=0;try{r=Math.abs(F(e?.value,n))}catch{return``}let i=e?.format;if(t!==void 0)switch(t?.value){case`k`:return os(i,1,`k`,n);case`m`:return os(i,2,`m`,n);case`b`:return os(i,3,`b`,n);default:throw new M(E(`The formatting unit should be 'k', 'm' or 'b'.`))}return r<1e5?os(i,0,``,n):r<1e8?os(i,1,`k`,n):r<1e11?os(i,2,`m`,n):os(i,3,`b`,n)}function os(e,t,n,r){let i=_o(e||`#,##0`);return Eo({positive:ss(i.positive,t,n),negative:i.negative?ss(i.negative,t,n):void 0,zero:i.zero?ss(i.zero,t,n):void 0,text:i.text})}function ss(e,t,n){if(e.type!==`number`)return e;let r=rs(e),i={type:`STRING`,value:n},a=[...r.integerPart],o=a.findLastIndex(e=>e.type===`DIGIT`);if(o===-1)throw Error(`Cannot create a large number format from a format with no digit.`);for(;a[o+1]?.type===`THOUSANDS_SEPARATOR`;)a=zt(a,[o+1]);let s=a[o+1];a=s?.type===`STRING`&&[`m`,`k`,`b`].includes(s.value)?Vt(a,i,o+1):Bt(a,[i],o+1),t>0&&(a=Bt(a,Array(t).fill({type:`THOUSANDS_SEPARATOR`,value:`,`}),o+1));let c=r.percentSymbols-a.filter(e=>e.type===`PERCENT`).length;return a.push(...Array(c).fill({type:`PERCENT`,value:`%`})),{...r,integerPart:a,magnitude:t}}function cs(e,t){let n=_o(e);return Eo(_o(Eo({positive:ls(n.positive,t),negative:n.negative?ls(n.negative,t):void 0,zero:n.zero?ls(n.zero,t):void 0,text:n.text})))}function ls(e,t){return e.type===`number`?t>0?ds(e,t):us(e,Math.abs(t)):e}function us(e,t){let n=e.decimalPart;if(!n)return e;let r=[],i=0;for(let e=n.length-1;e>=0&&!(i>=Math.abs(t));e--)n[e].type===`DIGIT`&&(i++,r.push(e));return n=zt(n,r),n.some(e=>e.type===`DIGIT`)?{...e,decimalPart:n}:{...e,decimalPart:void 0,integerPart:[...e.integerPart,...n]}}function ds(e,t){let n=e.integerPart,r=e.decimalPart;if(!r){let e=n.findLastIndex(e=>e.type===`DIGIT`);r=n.slice(e+1),n=n.slice(0,e+1)}let i=x(0,t).map(()=>({type:`DIGIT`,value:`0`})),a=r.findLastIndex(e=>e.type===`DIGIT`);return r=a===-1?[...i,...r]:Bt(r,i,a+1),{...e,decimalPart:r,integerPart:n}}function fs(e){let t=_o(e);for(let e of[t.positive,t.negative,t.zero])if(e&&e.type===`date`&&e.tokens.some(e=>e.type===`DATE_PART`&&e.value.includes(`q`)))return!1;return!0}function ps(e){if(!e)return!1;try{return _o(e).positive.type===`text`}catch{return!1}}function ms(e,t){return gs({value:ps(t.format)&&e.parsedValue!==null?e.content:e.parsedValue,format:t.format},t.locale)}function hs(e,t){if(e.startsWith(`=`))throw Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);if(e===``)return null;if(Oi(e,k))return Ai(e,k);let n=Qr(e,t);return n?n.value:ut(e)?e.toUpperCase()===`TRUE`:e}function gs(e,t=k,n){let r=no(e.value);if(!r)return _s(e,t,n);let i=hs(r.label,t);return{..._s({value:i,format:e.format||(typeof i==`number`?Xo(r.label,t)||Zo(r.label):void 0)},t,n),link:r}}function _s(e,t,n){let{value:r,format:i,message:a}=e;i=n?.format||i;let o=B(r,{format:i,locale:t});return P(r)?Cs(r,a):r===null?bs(i):ps(i)?vs(I(r),i,o):typeof r==`number`?Go(i||``)?xs(r,i,o):ys(r,i,o):typeof r==`boolean`?Ss(r,i,o):vs(r,i,o)}function vs(e,t,n){return{value:e,format:t,formattedValue:n,type:`text`,isAutoSummable:!0,defaultAlign:`left`}}function ys(e,t,n){return{value:e||0,format:t,formattedValue:n,type:`number`,isAutoSummable:!0,defaultAlign:`right`}}let bs=Rt(function(e){return{value:null,format:e,formattedValue:``,type:`empty`,isAutoSummable:!0,defaultAlign:`left`}});function xs(e,t,n){return{value:e,format:t,formattedValue:n,type:`number`,isAutoSummable:!1,defaultAlign:`right`}}function Ss(e,t,n){return{value:e,format:t,formattedValue:n,type:`boolean`,isAutoSummable:!1,defaultAlign:`center`}}function Cs(e,t){return{value:e,formattedValue:e,message:t,type:`error`,isAutoSummable:!1,defaultAlign:`center`}}function ws(e){let t=O.now();switch(e){case`today`:return Math.floor(ui(t));case`yesterday`:return t.setDate(t.getDate()-1),Math.floor(ui(t));case`tomorrow`:return t.setDate(t.getDate()+1),Math.floor(ui(t));case`lastWeek`:return t.setDate(t.getDate()-6),Math.floor(ui(t));case`lastMonth`:{let e=t.getMonth()===0?11:t.getMonth()-1,n=new O(t.getFullYear(),e,1);return t.getDate()>di(n)?t.setDate(1):(t.setDate(t.getDate()+1),t.setMonth(t.getMonth()-1)),Math.floor(ui(t))}case`lastYear`:return t.getMonth()===1&&t.getDate()===29?(t.setDate(28),t.setFullYear(t.getFullYear()-1)):(t.setDate(t.getDate()+1),t.setFullYear(t.getFullYear()-1)),Math.floor(ui(t))}}function Ts(e,t){return`dateValue`in e&&e.dateValue!==`exactDate`?[ws(e.dateValue)]:e.values.map(e=>Yr(e,t))}function Es(e,t){return e.values.map(e=>pa(e,t))}function Ds(e,t){return e.map(e=>{if(e.startsWith(`=`))return e;let n=hs(e,t);return typeof n==`number`?B(n,{format:t.dateFormat,locale:t}):``})}function Os(e){return 20+120*Math.exp(-.035*(e-1))}let ks=new RegExp(/\$?([A-Z]{1,3})\$?([0-9]{1,7})/,`i`),As=new RegExp(/^\$?([A-Z]{1,3})\$?([0-9]{1,7})$/,`i`),js=new RegExp(/^\$?([A-Z]{1,3})+$/,`i`),Ms=new RegExp(/^\$?([0-9]{1,7})+$/,`i`),Ns=new RegExp(/^\s*('.+'!|[^']+!)?\$?([A-Z]{1,3})$/,`i`),Ps=new RegExp(/^\s*('.+'!|[^']+!)?\$?([0-9]{1,7})$/,`i`),Fs=RegExp(`^\\s*('.+'!|[^']+!)?(`+[ks.source,`(\\$?[A-Z]{1,3})?\\$?[0-9]{1,7}\\s*:\\s*(\\$?[A-Z]{1,3})?\\$?[0-9]{1,7}\\s*`,`\\$?[A-Z]{1,3}(\\$?[0-9]{1,7})?\\s*:\\s*\\$?[A-Z]{1,3}(\\$?[0-9]{1,7})?\\s*`].join(`|`)+`)$`,`i`);function Is(e){return Ns.test(e)}function Ls(e){return Ps.test(e)}function Rs(e){return js.test(e)}function zs(e){return Ms.test(e)}function Bs(e){return As.test(e)}function Vs(e){if(!e.includes(`!`))return{xc:e};let t=e.split(`!`),n=t.pop();return{sheetName:it(t.join(`!`))||void 0,xc:n}}function Hs(e,t){return e===void 0?t:`${ot(e)}!${t}`}var Us=class e{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 n=[...e.parts];e.parts.length===1&&Er(this.zone)>1?n.push({...e.parts[0]}):e.parts.length===2&&Er(this.zone)===1&&n.pop(),this.parts=n}static fromRange(t,n){return t instanceof e?t:new e(t,n.getSheetSize)}get unboundedZone(){return this._zone}get zone(){let{left:e,top:t,bottom:n,right:r}=this._zone;if(r!==void 0&&n!==void 0)return this._zone;if(n===void 0&&r!==void 0)return{right:r,top:t,left:e,bottom:this.getSheetSize(this.sheetId).numberOfRows-1};if(r===void 0&&n!==void 0)return{bottom:n,left:e,top:t,right:this.getSheetSize(this.sheetId).numberOfCols-1};throw Error(E(`Bad zone format`))}static getRangeParts(e,t){let n=e.split(`:`).map(e=>{let t=Ls(e);return{colFixed:t?!1:e.startsWith(`$`),rowFixed:t?e.startsWith(`$`):e.includes(`$`,1)}}),r=t.bottom===void 0,i=t.right===void 0;return r&&(n[0].rowFixed=n[0].rowFixed||n[1].rowFixed,n[1].rowFixed=n[0].rowFixed||n[1].rowFixed),i&&(n[0].colFixed=n[0].colFixed||n[1].colFixed,n[1].colFixed=n[0].colFixed||n[1].colFixed),n}get isFullCol(){return this._zone.bottom===void 0}get isFullRow(){return this._zone.right===void 0}get rangeData(){return{_zone:this._zone,_sheetId:this.sheetId}}orderZone(){if(er(this._zone))return this;let e={...this._zone},t=this.parts;if(e.right!==void 0&&e.right<e.left){let n=e.right;e.right=e.left,e.left=n,t=[{colFixed:t[1]?.colFixed||!1,rowFixed:t[0]?.rowFixed||!1},{colFixed:t[0]?.colFixed||!1,rowFixed:t[1]?.rowFixed||!1}]}if(e.bottom!==void 0&&e.bottom<e.top){let n=e.bottom;e.bottom=e.top,e.top=n,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(t){return new e({zone:t?.zone?t.zone:{...this._zone},sheetId:t?.sheetId?t.sheetId:this.sheetId,invalidSheetName:t&&`invalidSheetName`in t?t.invalidSheetName:this.invalidSheetName,invalidXc:t&&`invalidXc`in t?t.invalidXc:this.invalidXc,parts:t?.parts?t.parts:this.parts.map(e=>({rowFixed:e.rowFixed,colFixed:e.colFixed})),prefixSheet:t?.prefixSheet===void 0?this.prefixSheet:t.prefixSheet},this.getSheetSize)}};function Ws(e,t,n){let r=n.sheetId===e?t:n.sheetId;return n.clone({sheetId:r})}function Gs(e,t,n){if(!n)return;let r=e.getRangeFromSheetXC(t,n);return r.invalidSheetName||r.invalidXc?void 0:r}function Ks(e,t){let n=[];for(let r of t){let t=r.dataRange;if(!e.isRangeValid(t)){n.push(r);continue}let{sheetName:i}=Vs(t),a=i?`${i}!`:``,o=Zn(t);if(o.bottom!==o.top&&o.left!==o.right)if(o.right)for(let e=o.left;e<=o.right;++e){let t=e===o.left?r:{yAxisId:r.yAxisId};n.push({...t,dataRange:`${a}${tr({left:e,right:e,top:o.top,bottom:o.bottom})}`})}else for(let e=o.top;e<=o.bottom;++e){let t=e===o.top?r:{yAxisId:r.yAxisId};n.push({...t,dataRange:`${a}${tr({left:o.left,right:o.right,top:e,bottom:e})}`})}else n.push(r)}return n}function qs(e){let t=[];for(let n of e)for(let e of _r(n.zone))t.push({...e,sheetId:n.sheetId});return t}function Js(e,t){e=e.toLocaleLowerCase(),t=t.toLocaleLowerCase();let n=0,r=0,i=t.length,a=0;for(let o=0;o<i;o++)t[o]===e[a]?(a++,r+=100+r-o/200):r=0,n+=r;return a===e.length?n:0}function Ys(e,t,n){let r=[];return t.forEach(t=>{let i=Js(e,n(t));i>0&&r.push({score:i,elem:t})}),r.sort((e,t)=>t.score-e.score),r.map(e=>e.elem)}function Xs(e){let t=[];for(let n=0;n<e;n++)t.push({cells:{}});return t}function Zs(e,t,n){return n.map(n=>n>=e?n+t:n)}function Qs(e,t){return e=[...e].sort((e,t)=>t-e),t.map(t=>{for(let n of e)if(t>n)t--;else if(t===n)return;return t}).filter(S)}function $s(e,t=`Sheet`){let n=1,r=`${t}${n}`;for(;e.includes(r);)r=`${t}${n}`,n++;return r}function ec(e,t){let n=1,r=E(`Copy of %s`,e),i=r.toString();for(;t.includes(i);)i=`${r} (${n})`,n++;return i}function tc(e,t){return e===void 0||t===void 0?!1:it(e.trim().toUpperCase())===it(t.trim().toUpperCase())}function nc(e,t=1){return t*(e+4)-4}function rc(e,t,n,r){if(!t||!t.isFormula&&!t.content)return 23;let i=``;try{if(!t.isFormula){let e={format:t.format,locale:n};i=B(hs(t.content,n),e)}}catch{i=j.GenericError}return ic(e,i,t.style,r)}function ic(e,t,n,r){let i=gc(e,t,n,n?.wrapping===`wrap`?r-8:void 0).length;return nc(mc(n),i)+6}function ac(e,t=!1,n=!1){return`${n?`italic`:``} ${t?`bold`:``} ${e}px ${ze}`}let oc={};function sc(e,t,n,r=`pt`){let i=pc(n,r);e.save(),e.font=i;let a=cc(e,t);return e.restore(),a}function cc(e,t){let n=e.font;if(oc[n]||(oc[n]={}),oc[n][t]===void 0){let r=e.measureText(t).width;oc[n][t]=r}return oc[n][t]}let lc={};function uc(e,t,n,r=`pt`){let i=pc(n,r);e.save(),e.font=i;let a=dc(e,t);return e.restore(),a}function dc(e,t){let n=e.font;if(lc[n]||(lc[n]={}),lc[n][t]===void 0){let r=e.measureText(t),i=r.width,a=r.fontBoundingBoxAscent+r.fontBoundingBoxDescent;lc[n][t]={width:i,height:a}}return lc[n][t]}function fc(e){return Math.round(e*96/72)}function pc(e,t=`pt`){return`${e.italic?`italic `:``}${e.bold?`bold`:`400`} ${(t===`pt`?mc(e):e.fontSize)??Re}px ${ze}`}function mc(e){return fc(e?.fontSize||Re)}function hc(e,t,n,r){if(sc(e,t,r)<=n)return[t];let i=[],a=``;for(let o of t)sc(e,a+o,r)>n?(i.push(a),a=o):a+=o;return i.push(a),i}function gc(e,t,n,r){n||={},pt(t)&&(t=gt(t).label);let i=[],a=t.includes(`
5
5
  `)?t.split(`
6
6
  `):[t];for(let t of a){let a=t.includes(` `)?t.split(` `):[t];if(!r){i.push(t);continue}let o=``,s=r;for(let t of a){let a=hc(e,t,r,n),c=a.pop(),l=sc(e,c,n);if(a.length)o!==``&&(i.push(o),o=``,s=r),a.forEach(e=>{i.push(e)}),o=c,s=r-l;else{let t=o===``?c:` `+c,a=sc(e,t,n);a<=s?(o+=t,s-=a):(i.push(o),o=c,s=r-l)}}o!==``&&i.push(o)}return i}function _c(e,t,n,r=.25){let i=1;if(n(i)>e)return i;if(n(t)<e)return t;let a=(i+t)/2,o=n(a),s=0;for(;Math.abs(o-e)>r&&s<20;)o>=e?t=(i+t)/2:i=(i+t)/2,a=(i+t)/2,o=n(a),s++;return a}function vc(e){return mc(e)+8}function yc(e){return e?e.toLowerCase():``}let bc=/([0-9\.]*)px/;function xc(e){return Number(e.match(bc)?.[1])}function Sc(e,t,n){let r=cc(e,t);if(r<=n)return t;let i=cc(e,`…`);if(r<=i)return t;let a=t.length;for(;r>=n-i&&a-->0;)t=t.substring(0,a),r=cc(e,t);return t+`…`}function Cc(e,t,n,r=!1,i=!1,a=xc(e.font)/10){if(e.fillText(t,n.x,n.y),!r&&!i)return;let o=e.measureText(t),s=o.width,c=o.actualBoundingBoxAscent+o.actualBoundingBoxDescent,l=o.fontBoundingBoxAscent+o.fontBoundingBoxDescent,{x:u,y:d}=n,f=d,p=d;switch(e.textAlign){case`center`:u-=s/2;break;case`right`:u-=s;break}switch(e.textBaseline){case`top`:p+=l-2*a,f+=l/2-a;break;case`middle`:p+=l/2-a;break;case`alphabetic`:p+=2*a,f-=3*a;break;case`bottom`:p=d,f-=c/2-a/2;break}r&&(e.lineWidth=a,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(u,p),e.lineTo(u+s,p),e.stroke()),i&&(e.lineWidth=a,e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(u,f),e.lineTo(u+s,f),e.stroke())}var wc=class{isFastIdStrategy=!1;fastIdStart=0;setIsFastStrategy(e){this.isFastIdStrategy=e}smallUuid(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?`10000000-1000`.replace(/[01]/g,e=>{let t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}):`xxxxxxxx-xxxx`.replace(/[xy]/g,function(e){var t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}uuidv4(){return this.isFastIdStrategy?(this.fastIdStart++,String(this.fastIdStart)):window.crypto?`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>{let t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}):`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}};function Tc(e,t){let n=new Set(t.map(e=>e.left)),r=new Set(t.map(e=>e.right)),i=new Set(t.map(e=>e.top)),a=new Set(t.map(e=>e.bottom)),o=i.size===1&&a.size===1||n.size===1&&r.size===1?xr(t):[t[t.length-1]],s=o.map(e=>_r(e)).flat();return{sheetId:e,zones:t,clippedZones:o,columnsIndexes:[...new Set(s.map(e=>e.col))].sort((e,t)=>e-t),rowsIndexes:[...new Set(s.map(e=>e.row))].sort((e,t)=>e-t)}}function Ec(e,t,n){let r=Math.max(e.right-t+1,e.left),i=Math.max(e.bottom-n+1,e.top),a=[];for(let o=e.left;o<=r;o+=t)for(let r=e.top;r<=i;r+=n)a.push({left:o,top:r,bottom:r+n-1,right:o+t-1});return a}function Dc(e,t){if(!t.length||!t[0].length)return e;let n=t[0].length,r=t.length;return e.map(e=>Ec(e,n,r)).flat()}function Oc(e){if(!e[`text/html`])return{text:e[`text/plain`]};let t=new DOMParser().parseFromString(e[`text/html`],`text/html`);return{text:e[`text/plain`],data:kc(t)}}function kc(e){if([...e.documentElement.attributes].some(e=>e.value.includes(`microsoft`)))return;let t=e.querySelector(`div`)?.getAttribute(`data-osheet-clipboard`);return t&&JSON.parse(t)}let Ac=(e,t,n,r)=>{e.forEach(({handlerName:e,handler:i})=>{let a=t[e];a&&i.paste(n,a,r)})};function jc(e,t,n,r,i){let a,o=[],s={sheetId:e,zones:t};for(let{handlerName:c,handler:l}of r){let r=n[c];if(!r)continue;let u=l.getPasteTarget(e,t,r,i);u.figureId&&(s.figureId=u.figureId);for(let e of u.zones){if(o.push(e),a===void 0){a=e;continue}a=or(a,e)}}return{target:s,zone:a,selectedZones:o}}let Mc=(e,t,n)=>{let r={col:t[0].left,row:t[0].top};e.getBackToDefault(),e.selectZone({cell:r,zone:or(...n)},{scrollIntoView:!1})};var Nc=class{getters;dispatch;constructor(e,t){this.getters=e,this.dispatch=t}copy(e,t=`copyPaste`){}paste(e,t,n){}isPasteAllowed(e,t,n,r){return`Success`}isCutAllowed(e){return`Success`}getPasteTarget(e,t,n,r){return{zones:[],sheetId:e}}convertTextToClipboardData(e){}},Pc=class extends Nc{copy(e,t=`copyPaste`){}pasteFromCopy(e,t,n,r){if(t.length===1)for(let i of Dc(t,n))this.pasteZone(e,i.left,i.top,n,r);else for(let i of T(t))for(let t=i.left;t<=i.right;t++)for(let a=i.top;a<=i.bottom;a++)this.pasteZone(e,t,a,n,r)}pasteZone(e,t,n,r,i){}},Fc=class extends Pc{queuedBordersToAdd={};copy(e){let t=e.sheetId;if(e.zones.length===0)return;let{rowsIndexes:n,columnsIndexes:r}=e,i=[];for(let e of n){let n=[];for(let i of r){let r={col:i,row:e,sheetId:t};n.push(this.getters.getCellBorder(r))}i.push(n)}return{borders:i}}paste(e,t,n){let r=e.sheetId;if(n.pasteOption===`asValue`)return;let i=e.zones;if(!n.isCutOperation)this.pasteFromCopy(r,i,t.borders);else{let{left:e,top:n}=i[0];this.pasteZone(r,e,n,t.borders)}this.executeQueuedChanges(r)}pasteZone(e,t,n,r){for(let[i,a]of r.entries())for(let[r,o]of a.entries()){let a={col:t+r,row:n+i,sheetId:e};this.pasteBorder(o,a)}}pasteBorder(e,t){let n={...this.getters.getCellBorder(t),...e},r=JSON.stringify(n);this.queuedBordersToAdd[r]||(this.queuedBordersToAdd[r]=[]),this.queuedBordersToAdd[r].push(D(t))}executeQueuedChanges(e){for(let t in this.queuedBordersToAdd){let n=this.queuedBordersToAdd[t],r=JSON.parse(t),i=T(n,[]);this.dispatch(`SET_BORDERS_ON_TARGET`,{sheetId:e,target:i,border:r})}this.queuedBordersToAdd={}}};let Ic=[`%`],Lc=`+,-,*,/,:,=,<>,>=,>,<=,<,^,&`.split(`,`).concat(Ic);function Rc(e,t=k){e=It(e);let n=new qt(e),r=[],i=Nt.test(e)?Xc:Zc;for(;!n.isOver();){let e=Qc(n)||i(n)||Hc(n,t)||Vc(n)||Uc(n)||Kc(n)||zc(n)||$c(n)||Gc(n,t)||Yc(n);e||={type:`UNKNOWN`,value:n.shift()},r.push(e)}return r}function zc(e){return e.current===`?`?(e.shift(),{type:`DEBUGGER`,value:`?`}):null}let Bc={"(":{type:`LEFT_PAREN`,value:`(`},")":{type:`RIGHT_PAREN`,value:`)`}};function Vc(e){return e.current===`(`||e.current===`)`?Bc[e.shift()]:null}function Hc(e,t){return e.current===t.formulaArgSeparator?{type:`ARG_SEPARATOR`,value:e.shift()}:null}function Uc(e){for(let t of Lc)if(e.currentStartsWith(t))return e.advanceBy(t.length),{type:`OPERATOR`,value:t};return null}let Wc=new Set(`0123456789`);function Gc(e,t){if(!Wc.has(e.current)&&e.current!==t.decimalSeparator)return null;let n=e.remaining().match(Ei(t.decimalSeparator));return n?(e.advanceBy(n[0].length),{type:`NUMBER`,value:n[0]}):null}function Kc(e){if(e.current===`"`){let t=e.shift(),n=t;for(;e.current&&(e.current!==t||n[n.length-1]===`\\`);)n+=e.shift();return e.current===`"`&&(n+=e.shift()),{type:`STRING`,value:n}}return null}let qc=/\p{L}|\p{N}|_|\.|!|\$/u,Jc=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$`);function Yc(e){let t=``;if(e.current===`'`){let n=e.shift();for(t+=n;e.current;)if(n=e.shift(),t+=n,n===`'`)if(e.current&&e.current===`'`)n=e.shift(),t+=n;else break;if(n!==`'`)return{type:`UNKNOWN`,value:t}}for(;e.current&&(Jc.has(e.current)||e.current.match(qc));)t+=e.shift();if(t.length){let e=t;return Fs.test(e)?{type:`REFERENCE`,value:e}:{type:`SYMBOL`,value:e}}return null}function Xc(e){let t=``;for(;e.current===` `||e.current&&e.current.match(Nt);)t+=e.shift();return t?{type:`SPACE`,value:t}:null}function Zc(e){let t=``;for(;e.current===` `;)t+=e.shift();return t?{type:`SPACE`,value:t}:null}function Qc(e){let t=0;for(;e.current===`
7
7
  `;)t++,e.shift();return t?{type:`SPACE`,value:`
@@ -47,7 +47,7 @@ stores.inject(MyMetaStore, storeInstance);
47
47
  (value for the item) / (value for the parent item on rows)`),"%_of_parent_col_total":E(`Calculates values as follows:
48
48
  (value for the item) / (value for the parent item on columns)`),"%_of_parent_total":E(`Calculates values as follows:
49
49
  (value for the item) / (value for the parent item of the selected Base field)`),difference_from:E(`Displays values as the difference from the value of the Base item in the Base field.`),"%_difference_from":E(`Displays values as the percentage difference from the value of the Base item in the Base field.`),running_total:E(`Displays the value for successive items in the Base field as a running total.`),"%_running_total":E(`Calculates the value as a percentage for successive items in the Base field that are displayed as a running total.`),rank_asc:E(`Displays the rank of selected values in a specific field, listing the smallest item in the field as 1, and each larger value with a higher rank value.`),rank_desc:E(`Displays the rank of selected values in a specific field, listing the largest item in the field as 1, and each smaller value with a higher rank value.`),index:E(`Calculates values as follows:
50
- ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))`)}},mg=`#F3F2F1`;function hg(e,t){let n=e.getBoundingClientRect(),r=window.devicePixelRatio||1;e.width=r*n.width,e.height=r*n.height;let i=e.getContext(`2d`);i.scale(r,r);let a=xg(n,t,i);_g(i,a),gg(i,a),yg(i,a),vg(i,a),bg(i,a)}function gg(e,t){e.save();let n=t.gauge,r=n.rect.x+n.rect.width/2,i=n.rect.y+n.rect.height,a=n.rect.height-n.arcWidth/2;if(a<0)return;let o=n.percentage===1?0:Math.PI*(1+n.percentage);e.strokeStyle=mg,e.beginPath(),e.lineWidth=n.arcWidth,e.arc(r,i,a,o,0),e.stroke(),e.strokeStyle=n.color,e.beginPath(),e.arc(r,i,a,Math.PI,o),e.stroke(),e.restore()}function _g(e,t){e.save(),e.fillStyle=t.backgroundColor,e.fillRect(0,0,t.width,t.height),e.restore()}function vg(e,t){for(let n of[t.minLabel,t.maxLabel,t.gaugeValue])e.save(),e.textAlign=`center`,e.fillStyle=n.color,e.font=`${n.fontSize}px ${ze}`,e.fillText(n.label,n.textPosition.x,n.textPosition.y),e.restore()}function yg(e,t){let{x:n,y:r,width:i,height:a}=t.gauge.rect;for(let o of t.inflectionValues){e.save(),e.translate(n+i/2-.5,r+a-.5),e.rotate(Math.PI/2-o.rotation),e.lineWidth=2,e.strokeStyle=`#666666aa`,e.beginPath(),e.moveTo(0,-(a-t.gauge.arcWidth)),e.lineTo(0,-a-3),e.stroke(),e.textAlign=`center`,e.font=`${o.fontSize}px ${ze}`,e.fillStyle=o.color;let s=-a-6-o.offset;e.fillText(o.label,0,s),e.restore()}}function bg(e,t){e.save();let n=t.title;e.font=ac(n.fontSize,n.bold,n.italic),e.textBaseline=`middle`,e.fillStyle=n.color,e.fillText(n.label,n.textPosition.x,n.textPosition.y),e.restore()}function xg(e,t,n){let r=t.maxValue,i=t.minValue,a=t.gaugeValue,o=Sg(e,t.title.text),s=o.width/6,c=a?(a.value-i.value)/(r.value-i.value):0,l={x:e.width/2,y:o.y+o.height-o.height/12},u=80;o.height<300&&(u*=o.height/300);let d=o.width/2,f=a?.label||`-`;sc(n,f,{fontSize:u},`px`)>d&&(u=_c(d,u,e=>sc(n,f,{fontSize:e},`px`)));let p={x:o.x+s/2,y:o.y+o.height+12},m={x:o.x+o.width-s/2,y:o.y+o.height+12},h=Tg(t.background),g=Cg(t,o,h,n),_=0,v=0,ee=0;switch(t.title.text&&({width:v,height:ee}=uc(n,t.title.text,{...t.title,fontSize:14},`px`)),t.title.align){case`right`:_=e.width-v-10;break;case`center`:_=(e.width-v)/2;break;default:_=10;break}return{width:e.width,height:e.height,title:{label:t.title.text??``,fontSize:14,textPosition:{x:_,y:10+ee/2},color:t.title.color??h,bold:t.title.bold,italic:t.title.italic},backgroundColor:t.background,gauge:{rect:o,arcWidth:s,percentage:b(c,0,1),color:wg(t)},inflectionValues:g,gaugeValue:{label:f,textPosition:l,fontSize:u,color:h},minLabel:{label:t.minValue.label,textPosition:p,fontSize:12,color:h},maxLabel:{label:t.maxValue.label,textPosition:m,fontSize:12,color:h}}}function Sg(e,t){let n=t?25:0,r=e.height-20-n-10,i=e.width-60,a,o;return i>2*r?(a=2*r,o=r):(a=i,o=i/2),{x:30+(i-a)/2,y:n+10+(r-o)/2,width:a,height:o}}function Cg(e,t,n,r){let i=e.maxValue,a=e.minValue,o={x:t.x+t.width/2,y:t.y+t.height},s={fontSize:12},c=[],l=[];for(let u of e.inflectionValues){let e=(u.value-a.value)/(i.value-a.value),d=sc(r,u.label,s,`px`),f=Math.PI-Math.PI*e,p=kg(f,t.height+6,o.x,o.y,d+2,12),m=l.some(e=>Og(e,p))?12:0;l.push(p),c.push({rotation:f,label:u.label,fontSize:12,color:n,offset:m})}return c}function wg(e){let t=e.gaugeValue?.value;if(t===void 0)return mg;for(let n=0;n<e.inflectionValues.length;n++){let r=e.inflectionValues[n];if(r.operator===`<`&&t<r.value||r.operator===`<=`&&t<=r.value)return e.colors[n]}return e.colors.at(-1)}function Tg(e){return on(e)>.3?`#666666`:`#C8C8C8`}function Eg(e){return[{start:e.topLeft,end:e.topRight},{start:e.topRight,end:e.bottomRight},{start:e.bottomRight,end:e.bottomLeft},{start:e.bottomLeft,end:e.topLeft}]}function Dg(e,t){let n=e.start,r=e.end,i=t.start,a=t.end;function o(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return o(n,i,a)!==o(r,i,a)&&o(n,r,i)!==o(n,r,a)}function Og(e,t){let n=Eg(e),r=Eg(t);for(let e of n)for(let t of r)if(Dg(e,t))return!0;return!1}function kg(e,t,n,r,i,a){let o=Math.cos(e),s=Math.sin(e),c=o*t,l=s*t,u=i/2*s,d=i/2*o,f={x:c+u+n,y:r-(l-d)},p={x:c-u+n,y:r-(l+d)},m=o*(t+a),h=s*(t+a),g={x:m-u+n,y:r-(h+d)};return{bottomLeft:p,bottomRight:f,topRight:{x:m+u+n,y:r-(h-d)},topLeft:g}}var Ag=class{sheetId;title;getters;constructor(e,t,n){this.title=e.title,this.sheetId=t,this.getters=n}static validateChartDefinition(e,t){throw Error(`This method should be implemented by sub class`)}static transformDefinition(e,t){throw Error(`This method should be implemented by sub class`)}static getDefinitionFromContextCreation(e){throw Error(`This method should be implemented by sub class`)}};function jg(e,t,n,r,i){if(!e)return``;if(n===`text`||t?.type!==`number`||e.type!==`number`)return r?is(e,i):e.formattedValue;let{value:a,format:o}=e;return n===`progress`?(a=t.value/a,o=`0.0%`):(a=Math.abs(t.value-a),n===`percentage`&&a!==0&&(a/=e.value),n===`percentage`&&(o=`0.0%`),o||(a=Math.round(a*100)/100)),r?is({value:a,format:o},i):B(a,{format:o,locale:i})}function Mg(e,t,n){return e?t?is(e,n):e.formattedValue??String(e.value??``):``}function Ng(e,t,n,r,i){if(t===`text`||t===`progress`||e?.type!==`number`||n?.type!==`number`)return;let a=n.value-e.value;if(a>0)return r;if(a<0)return i}function Pg(e,t,n){if(n===`text`||e?.type!==`number`||t?.type!==`number`)return`neutral`;let r=t.value-e.value;return r>0?`up`:r<0?`down`:`neutral`}function Fg(e){return e.keyValue&&!Fs.test(e.keyValue)?`InvalidScorecardKeyValue`:`Success`}function Ig(e){return e.baseline&&!Fs.test(e.baseline)?`InvalidScorecardBaseline`:`Success`}let Lg=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`),Rg=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`);var zg=class e extends Ag{keyValue;baseline;baselineMode;baselineDescr;progressBar=!1;background;baselineColorUp;baselineColorDown;fontColor;humanize;type=`scorecard`;constructor(e,t,n){super(e,t,n),this.keyValue=Gs(n,t,e.keyValue),this.baseline=Gs(n,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp??`#43C5B1`,this.baselineColorDown=e.baselineColorDown??`#EA6175`,this.humanize=e.humanize??!1}static validateChartDefinition(e,t){return e.checkValidations(t,Fg,Ig)}static getDefinitionFromContextCreation(e){return{background:e.background,type:`scorecard`,keyValue:e.range?.[0]?.dataRange,title:e.title||{text:``},baselineMode:He,baselineColorUp:Ue,baselineColorDown:We,baseline:e.auxiliaryRange||``}}static transformDefinition(e,t){let n,r;return e.baseline&&(n=td(Zn(e.baseline),t)),e.keyValue&&(r=td(Zn(e.keyValue),t)),{...e,baseline:n?tr(n):void 0,keyValue:r?tr(r):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.baseline),r=bd(this.sheetId,t,this.keyValue);return new e(this.getDefinitionWithSpecificRanges(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{...this,range:this.keyValue?[{dataRange:this.getters.getRangeString(this.keyValue,this.sheetId)}]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,n){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:`scorecard`,background:this.background,baseline:e?this.getters.getRangeString(e,n||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,n||this.sheetId):void 0,humanize:this.humanize}}getDefinitionForExcel(){}updateRanges(t){let n=xd(this.baseline,t),r=xd(this.keyValue,t);return this.baseline===n&&this.keyValue===r?this:new e(this.getDefinitionWithSpecificRanges(n,r),this.sheetId,this.getters)}};function Bg(e,t){let n=t.getContext(`2d`),r=window.devicePixelRatio||1;t.width=r*e.canvas.width,t.height=r*e.canvas.height,n.scale(r,r);let i=e.canvas.width-20;if(n.fillStyle=e.canvas.backgroundColor,n.fillRect(0,0,e.canvas.width,e.canvas.height),e.title){n.font=e.title.style.font,n.fillStyle=e.title.style.color;let t=n.textBaseline;n.textBaseline=`middle`,n.fillText(Sc(n,e.title.text,i-e.title.position.x),e.title.position.x,e.title.position.y),n.textBaseline=t}if(e.baseline&&(n.font=e.baseline.style.font,n.fillStyle=e.baseline.style.color,Cc(n,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){n.save(),n.fillStyle=e.baselineArrow.style.color,n.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);let t=e.baselineArrow.style.size/10;switch(n.scale(t,t),e.baselineArrow.direction){case`down`:n.fill(Lg);break;case`up`:n.fill(Rg);break}n.restore()}if(e.baselineDescr){let t=e.baselineDescr[0];n.font=t.style.font,n.fillStyle=t.style.color;for(let t of e.baselineDescr)n.fillText(Sc(n,t.text,i-t.position.x),t.position.x,t.position.y)}if(e.key&&(n.font=e.key.style.font,n.fillStyle=e.key.style.color,Cc(n,Sc(n,e.key.text,i-e.key.position.x),e.key.position,e.key.style.underline,e.key.style.strikethrough)),e.progressBar){if(n.fillStyle=e.progressBar.style.backgroundColor,n.beginPath(),n.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width,e.progressBar.dimension.height,e.progressBar.dimension.height/2),n.fill(),n.fillStyle=e.progressBar.style.color,n.beginPath(),e.progressBar.value>0)n.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width*Math.max(0,Math.min(1,e.progressBar.value)),e.progressBar.dimension.height,e.progressBar.dimension.height/2);else{let t=e.progressBar.dimension.width*Math.max(0,Math.min(1,-e.progressBar.value));n.roundRect(e.progressBar.position.x+e.progressBar.dimension.width-t,e.progressBar.position.y,t,e.progressBar.dimension.height,e.progressBar.dimension.height/2)}n.fill()}}function Vg(e,t){let n=``,r,i=t.getLocale();if(e.keyValue){let a={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};r=t.getEvaluatedCell(a),n=Mg(r,e.humanize??!1,i)}let a,o=e.baseline;if(o){let e={sheetId:o.sheetId,col:o.zone.left,row:o.zone.top};a=t.getEvaluatedCell(e)}let{background:s,fontColor:c}=t.getStyleOfSingleCellChart(e.background,e.keyValue),l=jg(a,r,e.baselineMode,e.humanize??!1,i),u=e.baselineMode===`progress`&&Oi(l,i)?F(l,i):0;return{title:{...e.title,text:e.title.text?E(e.title.text):``},keyValue:n,baselineDisplay:l,baselineArrow:Pg(a,r,e.baselineMode),baselineColor:Ng(a,e.baselineMode,r,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineMode!==`progress`&&e.baselineDescr?E(e.baselineDescr):``,fontColor:c,background:s,baselineStyle:e.baselineMode!==`percentage`&&e.baselineMode!==`progress`&&o?t.getCellStyle({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0,progressBar:e.baselineMode===`progress`?{value:u,color:u>0?e.baselineColorUp:e.baselineColorDown}:void 0}}let Hg=.05;function Ug(e,t){let n=e||``;return t&&n?` `+n:n}function Wg({width:e,height:t},n){return new Gg({width:e,height:t},n).computeDesign()}var Gg=class{runtime;context;width;height;constructor({width:e,height:t},n){this.runtime=n;let r=document.createElement(`canvas`);this.width=r.width=e,this.height=r.height=t,this.context=r.getContext(`2d`)}computeDesign(){let e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),n=0;if(this.title){let r,i;switch({height:n,width:i}=this.getFullTextDimensions(this.title,t.title.font),this.runtime.title.align){case`center`:r=(this.width-i)/2;break;case`right`:r=this.width-i-10;break;default:r=10}e.title={text:this.title,style:t.title,position:{x:r,y:10+n/2}}}let r=t.baselineArrow?.size??0,{height:i,width:a}=this.getTextDimensions(this.baseline,t.baselineValue.font);this.baseline||(i=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).height);let o=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).width;e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-a-o+r)/2,y:this.keyValue?this.height*(1-Hg*(this.runtime.progressBar?1:2)):this.height-(this.height-n-i)/2-10}};let s=r+20;if(e.baseline.position.x<s&&(e.baseline.position.x=s),t.baselineArrow&&!this.runtime.progressBar&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-r,y:e.baseline.position.y-(i+r)/2}}),this.baselineDescr){let n={x:e.baseline.position.x+a,y:e.baseline.position.y};e.baselineDescr=[{text:this.baselineDescr,style:t.baselineDescr,position:n}]}let c=0;this.runtime.progressBar&&(c=this.height*.05,e.progressBar={position:{x:20,y:this.height*(1-2*Hg)-i-c},dimension:{height:c,width:this.width-40},value:this.runtime.progressBar.value,style:{color:this.runtime.progressBar.color,backgroundColor:this.secondaryFontColor}});let{width:l,height:u}=this.getFullTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:Math.max(10,(this.width-l)/2),y:this.height*(.5-Hg*2)+10/2+(n+u/2)/2}}),e}get title(){return this.runtime.title.text??``}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return Ug(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return on(this.backgroundColor)>.3?`#525252`:`#C8C8C8`}getTextDimensions(e,t){this.context.font=t;let n=this.context.measureText(e);return{width:n.width,height:n.actualBoundingBoxAscent+n.actualBoundingBoxDescent}}getFullTextDimensions(e,t){this.context.font=t;let n=this.context.measureText(e);return{width:n.width,height:n.fontBoundingBoxAscent+n.fontBoundingBoxDescent}}getTextStyles(){let e=16,t=Math.floor(.9*e);return this.runtime.progressBar&&(e/=1.5),{title:{font:ac(14,this.runtime.title.bold,this.runtime.title.italic),color:this.runtime.title.color??this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:ac(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:ac(e,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:ac(t),color:this.secondaryFontColor},baselineArrow:this.baselineArrow===`neutral`||this.runtime.progressBar?void 0:{size:this.keyValue?.8*e:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}};function Kg(e,t){if(t.dataRange){let n=t.labelCell?[t.labelCell.zone]:[],r=T([t.dataRange.zone],n)[0];if(r===void 0)return[];let i=e.getRangeFromZone(t.dataRange.sheetId,r);return e.getRangeValues(i).map(e=>e===``?void 0:e)}return[]}function qg(e,t){let n=x(0,Math.max(e.length,...t.map(e=>e.data?.length||0))).filter(n=>{let r=e[n],i=t.map(e=>e.data?.[n]);return r||i.some(e=>e===0||!!e)});return{labels:n.map(t=>e[t]||``),dataSetsValues:t.map(e=>({...e,data:n.map(t=>e.data[t])}))}}function Jg(e,t){let n=e=>typeof e==`number`?e:0,r=new Set(e),i={};r.forEach(e=>{i[e]=Array(t.length).fill(0)});for(let r of x(0,e.length)){let a=e[r];for(let e of x(0,t.length))i[a][e]+=n(t[e].data[r])}return{labels:Array.from(r),dataSetsValues:t.map((e,t)=>({...e,data:Array.from(r).map(e=>i[e][t])}))}}function Yg(e){return e?e.length>20?e.substring(0,20)+`…`:e:``}function Xg(e,t,n,{format:r,locale:i,truncateLabels:a=!0,horizontalChart:o}){let s=e.title.text?e.title:{...e.title,content:``},c={responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:s.text?20/2:25,bottom:20}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,plugins:{title:{display:!!s.text,text:E(s.text),color:s?.color??n,align:s.align===`center`?`center`:s.align===`right`?`end`:`start`,font:{size:22,weight:s.bold?`bold`:`normal`,style:s.italic?`italic`:`normal`}},legend:{onClick:()=>{}},tooltip:{callbacks:{label:function(e){let t=e.dataset?.label||e.label,n=o?e.parsed.x:e.parsed.y;n??=e.parsed;let a=B(n,{format:!r&&Math.abs(n)>=1e3?`#,##`:r,locale:i});return t?`${t}: ${a}`:a}}}}};return{type:e.type,options:c,data:{labels:a?t.map(Yg):t,datasets:[]},platform:void 0,plugins:[]}}function Zg(e,t,n){if(!t)return;let{sheetId:r,zone:i}=t,a=_r(i).map(t=>e.getEvaluatedCell({sheetId:r,...t}).format);return n&&a.shift(),a.find(e=>e!==void 0)}function Qg(e,t,n){let r={values:[],formattedValues:[]};if(n){let{left:i}=n.zone;!n.invalidXc&&!n.invalidSheetName&&!e.isColHidden(n.sheetId,i)?r={formattedValues:e.getRangeFormattedValues(n),values:e.getRangeValues(n).map(e=>String(e??``))}:t[0]&&(r={formattedValues:x(0,Kg(e,t[0]).length).map(e=>e.toString()),values:r.formattedValues})}else if(t.length===1){let n=Kg(e,t[0]).length;for(let e=0;e<n;e++)r.formattedValues.push(``),r.values.push(``)}else t[0]&&(r={formattedValues:x(0,Kg(e,t[0]).length).map(e=>e.toString()),values:r.formattedValues});return r}function $g(e,t){for(let n of t){let t=e.getRangeFormats(n.dataRange).find(e=>e!==void 0&&!Go(e));if(t)return t}}function e_(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t,a=e.isColHidden(i.dataRange.sheetId,i.dataRange.zone.left);if(i.labelCell){let n=i.labelCell,a=n?e.getEvaluatedCell({sheetId:n.sheetId,col:n.zone.left,row:n.zone.top}):void 0;t=a&&n?Yg(a.formattedValue):t=`${ag.Series} ${parseInt(r)+1}`}else t=`${ag.Series} ${parseInt(r)+1}`;let o=i.dataRange?Kg(e,i):[];o.every(e=>typeof e==`string`&&!P(e))&&o.some(e=>e!==``)?o.fill(1):o.every(e=>e==null||!Oi(e.toString(),k))&&(a=!0),n.push({data:o,label:t,hidden:a})}return n}function t_(e,t){return t?e===0?`origin`:`-1`:`origin`}function n_(e,t,n){let r=document.createElement(`div`);r.style.width=`${t.width}px`,r.style.height=`${t.height}px`;let i=document.createElement(`canvas`);if(r.append(i),i.setAttribute(`width`,t.width.toString()),i.setAttribute(`height`,t.height.toString()),document.body.append(r),`chartJsConfig`in e){let t=y(e.chartJsConfig);t.plugins=[r_];let n=new(a_())(i,t),a=n.toBase64Image();return n.destroy(),r.remove(),a}else if(n===`scorecard`){Bg(Wg(t,e),i);let n=i.toDataURL();return r.remove(),n}else if(n===`gauge`){hg(i,e);let t=i.toDataURL();return r.remove(),t}}let r_={id:`customCanvasBackgroundColor`,beforeDraw:e=>{let{ctx:t}=e;t.save(),t.globalCompositeOperation=`destination-over`,t.fillStyle=`#ffffff`,t.fillRect(0,0,e.width,e.height),t.restore()}};function i_(e,t={}){return{...t,labels:{color:e,filter:(e,t)=>`datasetIndex`in e?!t.datasets[e.datasetIndex].hidden:!0,...t.labels}}}function a_(){return window.Chart&&!window.Chart?.registry.plugins.get(`chartShowValuesPlugin`)&&(window.Chart.register(Hd),window.Chart.register(qd)),window.Chart}var o_=class extends t.Component{static template=`o-spreadsheet-ChartJsComponent`;static props={figure:Object};canvas=(0,t.useRef)(`graphContainer`);chart;currentRuntime;currentDevicePixelRatio=window.devicePixelRatio;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){let e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!(`chartJsConfig`in e))throw Error(`Unsupported chart runtime`);return e}setup(){(0,t.onMounted)(()=>{let e=this.chartRuntime;this.currentRuntime=e,this.createChart(y(e.chartJsConfig))}),(0,t.onWillUnmount)(()=>this.chart?.destroy()),(0,t.useEffect)(()=>{let e=this.chartRuntime;e===this.currentRuntime?this.currentDevicePixelRatio!==window.devicePixelRatio&&(this.currentDevicePixelRatio=window.devicePixelRatio,this.updateChartJs(y(this.currentRuntime))):(e.chartJsConfig.type===this.currentRuntime.chartJsConfig.type?this.updateChartJs(y(e)):(this.chart?.destroy(),this.createChart(y(e.chartJsConfig))),this.currentRuntime=e)})}createChart(e){let t=this.canvas.el.getContext(`2d`),n=a_();this.chart=new n(t,e)}updateChartJs(e){let 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)):this.chart.data.datasets=[],this.chart.config.options=t.options,this.chart.update()}},s_=class extends t.Component{static template=`o-spreadsheet-ScorecardChart`;static props={figure:Object};canvas=(0,t.useRef)(`chartContainer`);get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}get title(){return E(this.env.model.getters.getChartDefinition(this.props.figure.id).title.text??``)}setup(){(0,t.useEffect)(this.createChart.bind(this),()=>{let e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]})}createChart(){let e=this.canvas.el;Bg(Wg(e.getBoundingClientRect(),this.runtime),e)}};let c_=new h;c_.add(`dataValidation`,{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){return t.startsWith(`=`)||!this.composer.currentEditedCell?[]:l_(this.getters,this.composer.currentEditedCell).map(e=>({text:e.value?.toString()||``,htmlContent:[{value:e.label}],fuzzySearchKey:e.label}))},selectProposal(e,t){this.composer.setCurrentContent(t),this.composer.stopEdition()}});function l_(e,t){let n=e.getValidationRuleForCell(t);if(!n||n.criterion.type!==`isValueInList`&&n.criterion.type!==`isValueInRange`)return[];let r=[];if(n.criterion.type===`isValueInList`)r=n.criterion.values.map(e=>({label:e,value:e}));else{let i=new Set,a=e.getRangeFromSheetXC(t.sheetId,n.criterion.values[0]);for(let t of _r(a.zone)){let n=e.getEvaluatedCell({...t,sheetId:a.sheetId});n.formattedValue&&!i.has(n.formattedValue)&&(i.add(n.formattedValue),r.push({label:n.formattedValue,value:n.value}))}}return r}function u_(e,t,n,r){let i=[];e=e.toLowerCase();for(let a of e){let e=t.toLocaleLowerCase().indexOf(a);e!==-1&&(i.push({value:t.slice(0,e),color:``},{value:t[e],color:n,class:r}),t=t.slice(e+1))}return i.push({value:t}),i.filter(e=>e.value)}let d_=/(.*?)\((.*?)\)(.*)/,f_=[`ANY`,`BOOLEAN`,`DATE`,`NUMBER`,`STRING`,`RANGE`,`RANGE<BOOLEAN>`,`RANGE<DATE>`,`RANGE<NUMBER>`,`RANGE<STRING>`,`META`];function Y(e,t=``){return p_(e,t)}function p_(e,t){let n=e.match(d_),r=n[1].trim();if(!r)throw Error(`Function argument definition is missing a name: '${e}'.`);let i=[],a=!1,o=!1,s;for(let e of n[2].split(`,`)){let t=e.trim().toUpperCase(),n=f_.find(e=>t===e);n?i.push(n):t===`RANGE<ANY>`?i.push(`RANGE`):t===`OPTIONAL`?a=!0:t===`REPEATING`?o=!0:t.startsWith(`DEFAULT=`)&&(s=e.trim().slice(8))}let c={name:r,description:t,type:i};return(i.includes(`ANY`)||i.includes(`RANGE`))&&(c.acceptErrors=!0),a&&(c.optional=!0),o&&(c.repeating=!0),s!==void 0&&(c.default=!0,c.defaultValue=s),i.some(e=>e.startsWith(`RANGE`))&&(c.acceptMatrix=!0),i.every(e=>e.startsWith(`RANGE`))&&(c.acceptMatrixOnly=!0),c}function m_(e){let t=0,n=0,r=0;for(let i of e.args)t++,!i.optional&&!i.repeating&&!i.default&&n++,i.repeating&&r++;let i=e;return i.minArgRequired=n,i.maxArgPossible=r?1/0:t,i.nbrArgRepeating=r,i.getArgToFocus=h_(t,r),i.hidden=e.hidden||!1,i}function h_(e,t){if(!t)return e=>e;if(t===1)return t=>Math.min(t,e);let n=e-t;return e=>e<=n?e:n+((e-n)%t||t)}function g_(e){let t=!1,n=!1,r=!1;for(let i of e){if(i.type.includes(`META`)&&i.type.length>1)throw Error(E("Function ${name} has an argument that has been declared with more than one type whose type 'META'. The 'META' type can only be declared alone."));if(t&&!i.repeating)throw Error(E("Function ${name} has no-repeatable arguments declared after repeatable ones. All repeatable arguments must be declared last."));let e=n||t||r,a=!(i.optional||i.repeating||i.default);if(e&&a)throw Error(E("Function ${name} has at mandatory arguments declared after optional ones. All optional arguments must be after all mandatory arguments."));t=i.repeating,n=i.optional,r=i.default}}function __(e,t){N(()=>t.length===1||t[0].length===1,e)}function v_(e,...t){if(t.every(A)){let n=t[0].length,r=t[0][0].length;for(let i of t)N(()=>i.length===n&&i[0].length===r,e);return}if(t.some(e=>Array.isArray(e)&&(e.length!==1||e[0].length!==1)))throw new M(e)}function y_(e,t){N(()=>t>0,e)}function b_(e,t){N(()=>t.length===t[0].length,e)}var x_=l({ARRAY_CONSTRAIN:()=>S_,CHOOSECOLS:()=>C_,CHOOSEROWS:()=>w_,EXPAND:()=>T_,FLATTEN:()=>E_,FREQUENCY:()=>D_,HSTACK:()=>O_,MDETERM:()=>k_,MINVERSE:()=>A_,MMULT:()=>j_,SUMPRODUCT:()=>M_,SUMX2MY2:()=>P_,SUMX2PY2:()=>F_,SUMXMY2:()=>I_,TOCOL:()=>z_,TOROW:()=>B_,TRANSPOSE:()=>V_,VSTACK:()=>H_,WRAPCOLS:()=>U_,WRAPROWS:()=>W_});let S_={description:E(`Returns a result array constrained to a specific width and height.`),args:[Y(`input_range (any, range<any>)`,E(`The range to constrain.`)),Y(`rows (number)`,E(`The number of rows in the constrained array.`)),Y(`columns (number)`,E(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=z(e),i=ga(t?.value,this.locale),a=ga(n?.value,this.locale);y_(E(`The rows argument (%s) must be strictly positive.`,i.toString()),i),y_(E(`The columns argument (%s) must be strictly positive.`,i.toString()),a);let o=Math.min(i,r[0].length);return ja(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},C_={description:E(`Creates a new array from the selected columns in the existing range.`),args:[Y(`array (any, range<any>)`,E(`The array that contains the columns to be returned.`)),Y(`col_num (number, range<number>)`,E(`The first column index of the columns to be returned.`)),Y(`col_num2 (number, range<number>, repeating)`,E(`The columns indexes of the columns to be returned.`))],compute:function(e,...t){let n=z(e),r=qa(t,e=>ga(e?.value,this.locale)),i=r.filter(e=>e===0||n.length<Math.abs(e));N(()=>i.length===0,E(`The columns arguments must be between -%s and %s (got %s), excluding 0.`,n.length.toString(),n.length.toString(),i.join(`,`)));let a=Array(r.length);for(let e=0;e<r.length;e++)r[e]>0?a[e]=n[r[e]-1]:a[e]=n[n.length+r[e]];return a},isExported:!0},w_={description:E(`Creates a new array from the selected rows in the existing range.`),args:[Y(`array (any, range<any>)`,E(`The array that contains the rows to be returned.`)),Y(`row_num (number, range<number>)`,E(`The first row index of the rows to be returned.`)),Y(`row_num2 (number, range<number>, repeating)`,E(`The rows indexes of the rows to be returned.`))],compute:function(e,...t){let n=z(e),r=qa(t,e=>ga(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return N(()=>a.length===0,E(`The rows arguments must be between -%s and %s (got %s), excluding 0.`,n[0].length.toString(),n[0].length.toString(),a.join(`,`))),ja(i,r.length,(e,t)=>r[t]>0?n[e][r[t]-1]:n[e][n[e].length+r[t]])},isExported:!0},T_={description:E(`Expands or pads an array to specified row and column dimensions.`),args:[Y(`array (any, range<any>)`,E(`The array to expand.`)),Y(`rows (number)`,E(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),Y(`columns (number, optional)`,E(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),Y(`pad_with (any, default=0)`,E(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=z(e),a=ga(t?.value,this.locale),o=n===void 0?i.length:ga(n.value,this.locale);return N(()=>a>=i[0].length,E(`The rows arguments (%s) must be greater or equal than the number of rows of the array.`,a.toString())),N(()=>o>=i.length,E(`The columns arguments (%s) must be greater or equal than the number of columns of the array.`,o.toString())),ja(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},E_={description:E(`Flattens all the values from one or more ranges into a single column.`),args:[Y(`range (any, range<any>)`,E(`The first range to flatten.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to flatten.`))],compute:function(...e){return[qa(e,e=>e===void 0?{value:``}:e)]},isExported:!1},D_={description:E(`Calculates the frequency distribution of a range.`),args:[Y(`data (range<number>)`,E(`The array of ranges containing the values to be counted.`)),Y(`classes (number, range<number>)`,E(`The range containing the set of classes.`))],compute:function(e,t){let n=qa([e],e=>e.value).filter(e=>typeof e==`number`),r=qa([t],e=>e.value).filter(e=>typeof e==`number`).map((e,t)=>({initialIndex:t,value:e,count:0})).sort((e,t)=>e.value-t.value);r.push({initialIndex:r.length,value:1/0,count:0});let i=n.sort((e,t)=>e-t),a=0;for(let e of i){for(;e>r[a].value&&a<r.length-1;)a++;r[a].count++}return[r.sort((e,t)=>e.initialIndex-t.initialIndex).map(e=>e.count)]},isExported:!0},O_={description:E(`Appends ranges horizontally and in sequence to return a larger array.`),args:[Y(`range1 (any, range<any>)`,E(`The first range to be appended.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to add to range1.`))],compute:function(...e){let t=Math.max(...e.map(e=>e?.[0]?.length??0)),n=[];for(let r of e){let e=z(r);for(let r=0;r<e.length;r++){let i=Array(t).fill({value:null});for(let t=0;t<e[r].length;t++)i[t]=e[r][t];n.push(i)}}return n},isExported:!0},k_={description:E(`Returns the matrix determinant of a square matrix.`),args:[Y(`square_matrix (number, range<number>)`,E(`An range with an equal number of rows and columns representing a matrix whose determinant will be calculated.`))],compute:function(e){let t=ma(e,`square_matrix`);return b_(E(`The argument square_matrix must have the same number of columns and rows.`),t),Cl(t).determinant},isExported:!0},A_={description:E(`Returns the multiplicative inverse of a square matrix.`),args:[Y(`square_matrix (number, range<number>)`,E(`An range with an equal number of rows and columns representing a matrix whose multiplicative inverse will be calculated.`))],compute:function(e){let t=ma(e,`square_matrix`);b_(E(`The argument square_matrix must have the same number of columns and rows.`),t);let{inverted:n}=Cl(t);return n||new M(E(`The matrix is not invertible.`))},isExported:!0},j_={description:E(`Calculates the matrix product of two matrices.`),args:[Y(`matrix1 (number, range<number>)`,E(`The first matrix in the matrix multiplication operation.`)),Y(`matrix2 (number, range<number>)`,E(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=ma(e,`matrix1`),r=ma(t,`matrix2`);return N(()=>n.length>0&&r.length>0,E(`The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices.`)),N(()=>n.length===r[0].length,E(`In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the number of rows of the second matrix (%s).`,n.length.toString(),r[0].length.toString())),Tl(n,r)},isExported:!0},M_={description:E(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[Y(`range1 (number, range<number>)`,E(`The first range whose entries will be multiplied with corresponding entries in the other ranges.`)),Y(`range2 (number, range<number>, repeating)`,E(`The other range whose entries will be multiplied with corresponding entries in the other ranges.`))],compute:function(...e){v_(E(`All the ranges must have the same dimensions.`),...e);let t=e.map(z),n=0;for(let e=0;e<t[0].length;e++)for(let r=0;r<t[0][e].length;r++){if(!t.every(t=>typeof t[e][r].value==`number`))continue;let i=1;for(let n of t)i*=F(n[e][r],this.locale);n+=i}return n},isExported:!0};function N_(e,t,n){v_(`The arguments array_x and array_y must have the same dimensions.`,e,t);let r=z(e),i=z(t),a=!1,o=0;for(let e in r)for(let t in r[e]){let s=r[e][t].value,c=i[e][t].value;typeof s!=`number`||typeof c!=`number`||(a=!0,o+=n(s,c))}if(!a)throw new M(E(`The arguments array_x and array_y must contain at least one pair of numbers.`));return o}let P_={description:E(`Calculates the sum of the difference of the squares of the values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values whose squares will be reduced by the squares of corresponding entries in array_y and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values whose squares will be subtracted from the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>e**2-t**2)},isExported:!0},F_={description:E(`Calculates the sum of the sum of the squares of the values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values whose squares will be added to the squares of corresponding entries in array_y and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values whose squares will be added to the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>e**2+t**2)},isExported:!0},I_={description:E(`Calculates the sum of squares of the differences of values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values that will be reduced by corresponding entries in array_y, squared, and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values that will be subtracted from corresponding entries in array_x, the result squared, and all such results added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>(e-t)**2)},isExported:!0},L_=[Y(`array (any, range<any>)`,E(`The array which will be transformed.`)),Y(`ignore (number, default=0)`,E(`The control to ignore blanks and errors. 0 (default) is to keep all values, 1 is to ignore blanks, 2 is to ignore errors, and 3 is to ignore blanks and errors.`)),Y(`scan_by_column (number, default=false)`,E(`Whether the array should be scanned by column. True scans the array by column and false (default) scans the array by row.`))];function R_(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!P(e.value);if(t===3)return e=>e.value!==null&&!P(e.value);throw new M(E(`Argument ignore must be between 0 and 3`))}let z_={description:E(`Transforms a range of cells into a single column.`),args:L_,compute:function(e,t={value:0},n={value:!1}){let r=z(e),i=F(t.value,this.locale),a=(L(n.value)?r:Pa(r)).flat().filter(R_(i));return a.length===0?new aa(E(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},B_={description:E(`Transforms a range of cells into a single row.`),args:L_,compute:function(e,t={value:0},n={value:!1}){let r=z(e),i=F(t.value,this.locale),a=(L(n.value)?r:Pa(r)).flat().filter(R_(i)).map(e=>[e]);return a.length===0||a[0].length===0?new aa(E(`No results for the given arguments of TOROW.`)):a},isExported:!0},V_={description:E(`Transposes the rows and columns of a range.`),args:[Y(`range (any, range<any>)`,E(`The range to be transposed.`))],compute:function(e){let t=z(e),n=t[0].length,r=t.length;return ja(n,r,(e,n)=>t[n][e])},isExported:!0},H_={description:E(`Appends ranges vertically and in sequence to return a larger array.`),args:[Y(`range1 (any, range<any>)`,E(`The first range to be appended.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to add to range1.`))],compute:function(...e){let t=Math.max(...e.map(e=>z(e).length)),n=e.reduce((e,t)=>e+z(t)[0].length,0),r=Array(t).fill([]).map(()=>Array(n).fill({value:0})),i=0;for(let t of e){let e=z(t);for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)r[t][i+n]=e[t][n];i+=e[0].length}return r},isExported:!0},U_={description:E(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[Y(`range (any, range<any>)`,E(`The range to wrap.`)),Y(`wrap_count (number)`,E(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),Y(`pad_with (any, default=0)`,E(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=z(e),i=ga(t?.value,this.locale);__(E(`Argument range must be a single row or column.`),r);let a=r.flat();return ja(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},W_={description:E(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[Y(`range (any, range<any>)`,E(`The range to wrap.`)),Y(`wrap_count (number)`,E(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),Y(`pad_with (any, default=0)`,E(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=z(e),i=ga(t?.value,this.locale);__(E(`Argument range must be a single row or column.`),r);let a=r.flat();return ja(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0};var G_=l({FORMAT_LARGE_NUMBER:()=>K_});let K_={description:E(`Apply a large number format`),args:[Y(`value (number)`,E(`The number.`)),Y(`unit (string, optional)`,E(`The formatting unit. Use 'k', 'm', or 'b' to force the unit`))],compute:function(e,t){return{value:F(e,this.locale),format:as(e,t,this.locale)}}};var q_=l({ABS:()=>Y_,ACOS:()=>X_,ACOSH:()=>Z_,ACOT:()=>Q_,ACOTH:()=>$_,ASIN:()=>ev,ASINH:()=>tv,ATAN:()=>nv,ATAN2:()=>rv,ATANH:()=>iv,CEILING:()=>av,CEILING_MATH:()=>sv,CEILING_PRECISE:()=>cv,COS:()=>lv,COSH:()=>uv,COT:()=>dv,COTH:()=>fv,COUNTBLANK:()=>pv,COUNTIF:()=>mv,COUNTIFS:()=>hv,COUNTUNIQUE:()=>gv,COUNTUNIQUEIFS:()=>_v,CSC:()=>vv,CSCH:()=>yv,DECIMAL:()=>bv,DEGREES:()=>xv,EXP:()=>Sv,FLOOR:()=>Cv,FLOOR_MATH:()=>Tv,FLOOR_PRECISE:()=>Ev,INT:()=>iy,ISEVEN:()=>Dv,ISODD:()=>kv,ISO_CEILING:()=>Ov,LN:()=>Av,LOG:()=>jv,MOD:()=>Nv,MUNIT:()=>Pv,ODD:()=>Fv,PI:()=>Iv,POWER:()=>Lv,PRODUCT:()=>Rv,RAND:()=>zv,RANDARRAY:()=>Bv,RANDBETWEEN:()=>Vv,ROUND:()=>Hv,ROUNDDOWN:()=>Uv,ROUNDUP:()=>Wv,SEC:()=>Gv,SECH:()=>Kv,SEQUENCE:()=>qv,SIN:()=>Jv,SINH:()=>Yv,SQRT:()=>Xv,SUM:()=>Zv,SUMIF:()=>Qv,SUMIFS:()=>$v,TAN:()=>ey,TANH:()=>ty,TRUNC:()=>ry});let J_=/^-?[a-z0-9]+$/i,Y_={description:E(`Absolute value of a number.`),args:[Y(`value (number)`,E(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(F(e,this.locale))},isExported:!0},X_={description:E(`Inverse cosine of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<=1,E(`The value (%s) must be between -1 and 1 inclusive.`,t.toString())),Math.acos(t)},isExported:!0},Z_={description:E(`Inverse hyperbolic cosine of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to 1.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>=1,E(`The value (%s) must be greater than or equal to 1.`,t.toString())),Math.acosh(t)},isExported:!0},Q_={description:E(`Inverse cotangent of a value.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=F(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},$_={description:E(`Inverse hyperbolic cotangent of a value.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic cotangent. Must not be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)>1,E(`The value (%s) cannot be between -1 and 1 inclusive.`,t.toString())),Math.log((t+1)/(t-1))/2},isExported:!0},ev={description:E(`Inverse sine of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<=1,E(`The value (%s) must be between -1 and 1 inclusive.`,t.toString())),Math.asin(t)},isExported:!0},tv={description:E(`Inverse hyperbolic sine of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(F(e,this.locale))},isExported:!0},nv={description:E(`Inverse tangent of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(F(e,this.locale))},isExported:!0},rv={description:E(`Angle from the X axis to a point (x,y), in radians.`),args:[Y(`x (number)`,E(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),Y(`y (number)`,E(`The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n!==0||r!==0,E(`Function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero),Math.atan2(r,n)},isExported:!0},iv={description:E(`Inverse hyperbolic tangent of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<1,E(`The value (%s) must be between -1 and 1 exclusive.`,t.toString())),Math.atanh(t)},isExported:!0},av={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`value (number)`,E(`The value to round up to the nearest integer multiple of factor.`)),Y(`factor (number, default=1)`,E(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>r>=0||n<=0,E(`The factor (%s) must be positive when the value (%s) is positive.`,r.toString(),n.toString())),{value:r?Math.ceil(n/r)*r:0,format:e?.format}},isExported:!0};function ov(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.ceil(e/t)*t:n===0?-Math.floor(Math.abs(e)/t)*t:-Math.ceil(Math.abs(e)/t)*t)}let sv={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),Y(`mode (number, default=0)`,E(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded towards zero. Otherwise, it is rounded away from zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:ov(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},cv={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:ov(F(e,this.locale),n),format:e?.format}},isExported:!0},lv={description:E(`Cosine of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(F(e,this.locale))},isExported:!0},uv={description:E(`Hyperbolic cosine of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(F(e,this.locale))},isExported:!0},dv={description:E(`Cotangent of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.tan(t)},isExported:!0},fv={description:E(`Hyperbolic cotangent of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.tanh(t)},isExported:!0},pv={description:E(`Number of empty values.`),args:[Y(`value1 (any, range)`,E(`The first value or range in which to count the number of blanks.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges in which to count the number of blanks.`))],compute:function(...e){return Oa(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},mv={description:E(`A conditional count across a range.`),args:[Y(`range (range)`,E(`The range that is tested against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return Va(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},hv={description:E(`Count values depending on multiple criteria.`),args:[Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`Additional criteria to check.`))],compute:function(...e){let t=0;return Va(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},gv={description:E(`Counts number of unique values in a range.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider for uniqueness.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider for uniqueness.`))],compute:function(...e){return xl(e)}},_v={description:E(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the number of unique values will be counted.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=new Set;return Va(t,(t,r)=>{let i=e[t]?.[r];Ja(i)&&n.add(i.value)},this.locale),n.size}},vv={description:E(`Cosecant of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.sin(t)},isExported:!0},yv={description:E(`Hyperbolic cosecant of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.sinh(t)},isExported:!0},bv={description:E(`Converts from another base to decimal.`),args:[Y(`value (string)`,E(`The number to convert.`)),Y(`base (number)`,E(`The base to convert the value from.`))],compute:function(e,t){let n=F(t,this.locale);n=Math.floor(n),N(()=>2<=n&&n<=36,E(`The base (%s) must be between 2 and 36 inclusive.`,n.toString()));let r=I(e);if(r===``)return 0;N(()=>!!J_.test(r),E(`The value (%s) must be a valid base %s representation.`,r,n.toString()));let i=parseInt(r,n);return N(()=>!isNaN(i),E(`The value (%s) must be a valid base %s representation.`,r,n.toString())),i},isExported:!0},xv={description:E(`Converts an angle value in radians to degrees.`),args:[Y(`angle (number)`,E(`The angle to convert from radians to degrees.`))],compute:function(e){return F(e,this.locale)*180/Math.PI},isExported:!0},Sv={description:E(`Euler's number, e (~2.718) raised to a power.`),args:[Y(`value (number)`,E(`The exponent to raise e.`))],compute:function(e){return Math.exp(F(e,this.locale))},isExported:!0},Cv={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`value (number)`,E(`The value to round down to the nearest integer multiple of factor.`)),Y(`factor (number, default=1)`,E(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>r>=0||n<=0,E(`The factor (%s) must be positive when the value (%s) is positive.`,r.toString(),n.toString())),{value:r?Math.floor(n/r)*r:0,format:e?.format}},isExported:!0};function wv(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:n===0?-Math.ceil(Math.abs(e)/t)*t:-Math.floor(Math.abs(e)/t)*t)}let Tv={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round down to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),Y(`mode (number, default=0)`,E(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded away from zero. Otherwise, it is rounded towards zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:wv(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},Ev={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round down to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:wv(F(e,this.locale),n),format:e?.format}},isExported:!0},Dv={description:E(`Whether the provided value is even.`),args:[Y(`value (number)`,E(`The value to be verified as even.`))],compute:function(e){let t=ha(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},Ov={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:ov(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},kv={description:E(`Whether the provided value is even.`),args:[Y(`value (number)`,E(`The value to be verified as even.`))],compute:function(e){let t=ha(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},Av={description:E(`The logarithm of a number, base e (euler's number).`),args:[Y(`value (number)`,E(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>0,E(`The value (%s) must be strictly positive.`,t.toString())),Math.log(t)},isExported:!0},jv={description:E(`The logarithm of a number, for a given base.`),args:[Y(`value (number)`,E(`The value for which to calculate the logarithm.`)),Y(`base (number, default=10)`,E(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n>0,E(`The value (%s) must be strictly positive.`,n.toString())),N(()=>r>0,E(`The base (%s) must be strictly positive.`,r.toString())),N(()=>r!==1,E(`The base must be different from 1.`)),Math.log10(n)/Math.log10(r)},isExported:!0};function Mv(e,t){N(()=>t!==0,E(`The divisor must be different from 0.`),j.DivisionByZero);let n=e%t;return n>0&&t<0||n<0&&t>0?n+t:n}let Nv={description:E(`Modulo (remainder) operator.`),args:[Y(`dividend (number)`,E(`The number to be divided to find the remainder.`)),Y(`divisor (number)`,E(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return{value:Mv(F(e,this.locale),n),format:e?.format}},isExported:!0},Pv={description:E(`Returns a n x n unit matrix, where n is the input dimension.`),args:[Y(`dimension (number)`,E(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=ga(e,this.locale);return y_(E(`The argument dimension must be positive`),t),Sl(t)},isExported:!0},Fv={description:E(`Rounds a number up to the nearest odd integer.`),args:[Y(`value (number)`,E(`The value to round to the next greatest odd number.`))],compute:function(e){let t=F(e,this.locale),n=Math.ceil(Math.abs(t));return n=n&1?n:n+1,{value:t<0?-n:n,format:e?.format}},isExported:!0},Iv={description:E(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},Lv={description:E(`A number raised to a power.`),args:[Y(`base (number)`,E(`The number to raise to the exponent power.`)),Y(`exponent (number)`,E(`The exponent to raise base to.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n>=0||Number.isInteger(r),E(`The exponent (%s) must be an integer when the base is negative.`,r.toString())),{value:n**+r,format:e?.format}},isExported:!0},Rv={description:E(`Result of multiplying a series of numbers together.`),args:[Y(`factor1 (number, range<number>)`,E(`The first number or range to calculate for the product.`)),Y(`factor2 (number, range<number>, repeating)`,E(`More numbers or ranges to calculate for the product.`))],compute:function(...e){let t=0,n=1;for(let r of e)if(A(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),P(e))return r}else r!==void 0&&r.value!==null&&(n*=ha(r,this.locale),t+=1);return{value:t===0?0:n,format:la(e[0])}},isExported:!0},zv={description:E(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},Bv={description:E(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[Y(`rows (number, default=1)`,E(`The number of rows to be returned.`)),Y(`columns (number, default=1)`,E(`The number of columns to be returned.`)),Y(`min (number, default=0)`,E(`The minimum number you would like returned.`)),Y(`max (number, default=1)`,E(`The maximum number you would like returned.`)),Y(`whole_number (number, default=FALSE)`,E(`Return a whole number or a decimal value.`))],compute:function(e={value:1},t={value:1},n={value:0},r={value:1},i={value:!1}){let a=ga(t,this.locale),o=ga(e,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=L(i);y_(E(`The number of columns (%s) must be positive.`,a.toString()),a),y_(E(`The number of rows (%s) must be positive.`,o.toString()),o),N(()=>s<=c,E(`The maximum (%s) must be greater than or equal to the minimum (%s).`,c.toString(),s.toString())),l&&N(()=>Number.isInteger(s)&&Number.isInteger(c),E(`The maximum (%s) and minimum (%s) must be integers when whole_number is TRUE.`,c.toString(),s.toString()));let u=Array(a);for(let e=0;e<a;e++){u[e]=Array(o);for(let t=0;t<o;t++)l?u[e][t]=Math.floor(Math.random()*(c-s+1)+s):u[e][t]=s+Math.random()*(c-s)}return u},isExported:!0},Vv={description:E(`Random integer between two values, inclusive.`),args:[Y(`low (number)`,E(`The low end of the random range.`)),Y(`high (number)`,E(`The high end of the random range.`))],compute:function(e,t){let n=F(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=F(t,this.locale);return Number.isInteger(r)||(r=Math.floor(r)),N(()=>n<=r,E(`The high (%s) must be greater than or equal to the low (%s).`,r.toString(),n.toString())),{value:n+Math.ceil((r-n+1)*Math.random())-1,format:e?.format}},isExported:!0},Hv={description:E(`Rounds a number according to standard rules.`),args:[Y(`value (number)`,E(`The value to round to places number of places.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.round(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.round(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Uv={description:E(`Rounds down a number.`),args:[Y(`value (number)`,E(`The value to round to places number of places, always rounding down.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.floor(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.floor(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Wv={description:E(`Rounds up a number.`),args:[Y(`value (number)`,E(`The value to round to places number of places, always rounding up.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.ceil(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.ceil(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Gv={description:E(`Secant of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(F(e,this.locale))},isExported:!0},Kv={description:E(`Hyperbolic secant of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(F(e,this.locale))},isExported:!0},qv={description:E(`Returns a sequence of numbers.`),args:[Y(`rows (number)`,E(`The number of rows to return`)),Y(`columns (number, optional, default=1)`,E(`The number of columns to return`)),Y(`start (number, optional, default=1)`,E(`The first number in the sequence`)),Y(`step (number, optional, default=1)`,E(`The amount to increment each value in the sequence`))],compute:function(e,t={value:1},n={value:1},r={value:1}){let i=F(n,this.locale),a=F(r,this.locale),o=ga(e,this.locale),s=ga(t,this.locale);return y_(E(`The number of columns (%s) must be positive.`,s),s),y_(E(`The number of rows (%s) must be positive.`,o),o),ja(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},Jv={description:E(`Sine of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(F(e,this.locale))},isExported:!0},Yv={description:E(`Hyperbolic sine of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(F(e,this.locale))},isExported:!0},Xv={description:E(`Positive square root of a positive number.`),args:[Y(`value (number)`,E(`The number for which to calculate the positive square root.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>=0,E(`The value (%s) must be positive or null.`,t.toString())),{value:Math.sqrt(t),format:e?.format}},isExported:!0},Zv={description:E(`Sum of a series of numbers and/or cells.`),args:[Y(`value1 (number, range<number>)`,E(`The first number or range to add together.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional numbers or ranges to add to value1.`))],compute:function(...e){let t=e[0];return{value:bl(e,this.locale),format:la(t)}},isExported:!0},Qv={description:E(`A conditional sum across a range.`),args:[Y(`criteria_range (range)`,E(`The range which is tested against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to range.`)),Y(`sum_range (range, default=criteria_range)`,E(`The range to be summed, if different from range.`))],compute:function(e,t,n){n===void 0&&(n=e);let r=0;return Va([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},$v={description:E(`Sums a range depending on multiple criteria.`),args:[Y(`sum_range (range)`,E(`The range to sum.`)),Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges to check.`)),Y(`criterion2 (string, repeating)`,E(`Additional criteria to check.`))],compute:function(e,...t){let n=0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},ey={description:E(`Tangent of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(F(e,this.locale))},isExported:!0},ty={description:E(`Hyperbolic tangent of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(F(e,this.locale))},isExported:!0};function ny(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let ry={description:E(`Truncates a number.`),args:[Y(`value (number)`,E(`The value to be truncated.`)),Y(`places (number, default=0)`,E(`The number of significant digits to the right of the decimal point to retain.`))],compute:function(e,t={value:0}){return{value:ny(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},iy={description:E(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[Y(`value (number)`,E(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(F(e,this.locale))},isExported:!0};var ay=l({AVEDEV:()=>uy,AVERAGE:()=>dy,AVERAGEA:()=>hy,AVERAGEIF:()=>gy,AVERAGEIFS:()=>_y,AVERAGE_WEIGHTED:()=>my,CORREL:()=>zy,COUNT:()=>vy,COUNTA:()=>yy,COVAR:()=>by,COVARIANCE_P:()=>xy,COVARIANCE_S:()=>Sy,FORECAST:()=>Cy,GROWTH:()=>wy,INTERCEPT:()=>Ty,LARGE:()=>Ey,LINEST:()=>Dy,LOGEST:()=>Oy,MATTHEWS:()=>ky,MAX:()=>Ay,MAXA:()=>jy,MAXIFS:()=>My,MEDIAN:()=>Ny,MIN:()=>Py,MINA:()=>Fy,MINIFS:()=>Iy,PEARSON:()=>Ry,PERCENTILE:()=>By,PERCENTILE_EXC:()=>Vy,PERCENTILE_INC:()=>Hy,POLYFIT_COEFFS:()=>Uy,POLYFIT_FORECAST:()=>Wy,QUARTILE:()=>Gy,QUARTILE_EXC:()=>Ky,QUARTILE_INC:()=>qy,RANK:()=>Jy,RSQ:()=>Yy,SLOPE:()=>Xy,SMALL:()=>Zy,SPEARMAN:()=>Qy,STDEV:()=>$y,STDEVA:()=>nb,STDEVP:()=>rb,STDEVPA:()=>ib,STDEV_P:()=>eb,STDEV_S:()=>tb,STEYX:()=>ab,TREND:()=>ob,VAR:()=>sb,VARA:()=>ub,VARP:()=>db,VARPA:()=>fb,VAR_P:()=>cb,VAR_S:()=>lb});function oy(e,t){let n=[],r=[],i=0,a=0;Ta([e],e=>{n.push(e),i+=1}),Ta([t],e=>{r.push(e),a+=1}),N(()=>i===a,E(`[[FUNCTION_NAME]] has mismatched argument count %s vs %s.`,i,a));let o=[],s=[];for(let e=0;e<i;e++){let t=n[e]?.value,i=r[e]?.value;typeof t==`number`&&typeof i==`number`&&(s.push(t),o.push(i))}return{flatDataX:o,flatDataY:s}}function sy(e,t,n){let{flatDataX:r,flatDataY:i}=oy(e,t),a=i.length;N(()=>a!==0&&(!n||a!==1),E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero);let o=0,s=0;for(let e=0;e<a;e++)o+=i[e],s+=r[e];let c=o/a,l=s/a,u=0;for(let e=0;e<a;e++)u+=(i[e]-c)*(r[e]-l);return u/(a-+!!n)}function cy(e,t,n,r){let i=0,a=0,o=n?Aa:ka;a=o(e,(e,t)=>(i+=1,e+t),0,r),N(()=>i!==0&&(!t||i!==1),E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero);let s=a/i;return o(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function ly(e,t,n,r){let i=F(t,r);N(()=>n?0<=i&&i<=1:0<i&&i<1,E(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`));let a=[],o,s=0;return Ta(e,e=>{let t=e?.value;typeof t==`number`&&(o=Ha(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),N(()=>s!==0,E(`[[FUNCTION_NAME]] has no valid input data.`)),n||N(()=>1/(s+1)<=i&&i<=s/(s+1),E(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),ji(a,i,n)}let uy={description:E(`Average magnitude of deviations from mean.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){let t=0,n=ka(e,(e,n)=>(t+=1,e+n),0,this.locale);ya(t);let r=n/t;return ka(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},dy={description:E(`Numerical average value in a dataset, ignoring text.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the average value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the average value.`))],compute:function(...e){return{value:Al(e,this.locale),format:la(e[0])}},isExported:!0},fy=E(`[[FUNCTION_NAME]] has mismatched range sizes.`),py=E(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),my={description:E(`Weighted average.`),args:[Y(`values (number, range<number>)`,E(`Values to average.`)),Y(`weights (number, range<number>)`,E(`Weights for each corresponding value.`)),Y(`additional_values (number, range<number>, repeating)`,E(`Additional values to average.`)),Y(`additional_weights (number, range<number>, repeating)`,E(`Additional weights.`))],compute:function(...e){let t=0,n=0;for(let r=0;r<e.length-1;r+=2){let i=e[r],a=e[r+1];if(v_(fy,i,a),A(i))for(let e=0;e<i.length;e++)for(let r=0;r<i[0].length;r++){let o=i[e][r].value,s=A(a)?a?.[e][r].value:F(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){N(()=>s>=0,py),t+=o*s,n+=s;continue}N(()=>c===l,E(`[[FUNCTION_NAME]] expects number values.`))}else{let e=F(i,this.locale),r=A(a)?a?.[0][0].value:F(a,this.locale);typeof r==`number`&&(N(()=>r>=0,py),t+=e*r,n+=r)}}return ya(n),{value:t/n,format:la(e[0])}}},hy={description:E(`Numerical average value in a dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the average value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the average value.`))],compute:function(...e){let t=0,n=Aa(e,(e,n)=>(t+=1,e+n),0,this.locale);return ya(t),{value:n/t,format:la(e[0])}},isExported:!0},gy={description:E(`Average of values depending on criteria.`),args:[Y(`criteria_range (number, range<number>)`,E(`The range to check against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to criteria_range.`)),Y(`average_range (number, range<number>, default=criteria_range)`,E(`The range to average. If not included, criteria_range is used for the average instead.`))],compute:function(e,t,n){let r=z(n===void 0?e:n),i=0,a=0;return Va([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),ya(i),a/i},isExported:!0},_y={description:E(`Average of values depending on multiple criteria.`),args:[Y(`average_range (range)`,E(`The range to average.`)),Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional criteria_range and criterion to check.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=z(e),r=0,i=0;return Va(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),ya(r),i/r},isExported:!0},vy={description:E(`The number of numeric values in dataset.`),args:[Y(`value1 (number, any, range<number>)`,E(`The first value or range to consider when counting.`)),Y(`value2 (number, any, range<number>, repeating)`,E(`Additional values or ranges to consider when counting.`))],compute:function(...e){return jl(e,this.locale)},isExported:!0},yy={description:E(`The number of values in a dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when counting.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when counting.`))],compute:function(...e){return Ml(e)},isExported:!0},by={description:E(`The covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!1)},isExported:!0},xy={description:E(`The covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!1)},isExported:!0},Sy={description:E(`The sample covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!0)},isExported:!0},Cy={description:E(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[Y(`x (number, range<number>)`,E(`The value(s) on the x-axis to forecast.`)),Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t,n){let{flatDataX:r,flatDataY:i}=oy(t,n);return Wl(r,i),Hl([i],[r],Ma(z(e),e=>F(e,this.locale)),!0)},isExported:!0},wy={description:E(`Fits points to exponential growth trend.`),args:[Y(`known_data_y (range<number>)`,E(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal exponential growth curve.`)),Y(`known_data_x (range<number>, default={1;2;3;...})`,E(`The values of the independent variable(s) corresponding with known_data_y.`)),Y(`new_data_x (any, range, default=known_data_x)`,E(`The data points to return the y values for on the ideal curve fit.`)),Y(`b (boolean, default=TRUE)`,E(`Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.`))],compute:function(e,t=[[]],n=[[]],r={value:!0}){return Ul(e,`known_data_y`),Bl(Hl(Vl(ma(e,`known_data_y`)),ma(t,`known_data_x`),ma(n,`new_data_y`),L(r)))}},Ty={description:E(`Compute the intercept of the linear regression.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let[[],[i]]=Il([n],[r]);return i},isExported:!0},Ey={description:E(`Nth largest element from a data set.`),args:[Y(`data (any, range)`,E(`Array or range containing the dataset to consider.`)),Y(`n (number)`,E(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;Ta([e],e=>{typeof e?.value==`number`&&(i=Ha(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.shift(),a--))});let o=r.shift();return N(()=>o!==void 0,E(`[[FUNCTION_NAME]] has no valid input data.`)),N(()=>a>=n,E(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)),o},isExported:!0},Dy={description:E(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>, default={1;2;3;...})`,E(`The range representing the array or matrix of independent data.`)),Y(`calculate_b (boolean, default=TRUE)`,E(`A flag specifying wheter to compute the slope or not`)),Y(`verbose (boolean, default=FALSE)`,E(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`))],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return Ul(e,`data_y`),Il(ma(t,`data_x`),ma(e,`data_y`),L(n),L(r))},isExported:!0},Oy={description:E(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>, optional, default={1;2;3;...})`,E(`The range representing the array or matrix of independent data.`)),Y(`calculate_b (boolean, default=TRUE)`,E(`A flag specifying wheter to compute the slope or not`)),Y(`verbose (boolean, default=FALSE)`,E(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`))],compute:function(e,t=[[]],n={value:!0},r={value:!1}){Ul(e,`data_y`);let i=Il(ma(t,`data_x`),Vl(ma(e,`data_y`)),L(n),L(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},ky={description:E(`Compute the Matthews correlation coefficient of a dataset.`),args:[Y(`data_x (range)`,E(`The range representing the array or matrix of observed data.`)),Y(`data_y (range)`,E(`The range representing the array or matrix of predicted data.`))],compute:function(e,t){let n=e.flat(),r=t.flat();kl(n,r),Wl(n,r);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=L(n[e]);t===L(r[e])?t?o++:a++:t?c++:s++}return(o*a-s*c)/Math.sqrt((o+s)*(o+c)*(a+s)*(a+c))},isExported:!1},Ay={description:E(`Maximum value in a numeric dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the maximum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the maximum value.`))],compute:function(...e){return Nl(e,this.locale)},isExported:!0},jy={description:E(`Maximum numeric value in a dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when calculating the maximum value.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when calculating the maximum value.`))],compute:function(...e){let t=Aa(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:la(e[0])}},isExported:!0},My={description:E(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the maximum will be determined.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=-1/0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n<i?i:n)},this.locale),n===-1/0?0:n},isExported:!0},Ny={description:E(`Median value in a numeric dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when calculating the median value.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when calculating the median value.`))],compute:function(...e){let t=[];return Ea(e,e=>{t.push(e)},this.locale),{value:ly(t,{value:.5},!0,this.locale),format:la(t[0])}},isExported:!0},Py={description:E(`Minimum value in a numeric dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the minimum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the minimum value.`))],compute:function(...e){return Pl(e,this.locale)},isExported:!0},Fy={description:E(`Minimum numeric value in a dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the minimum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the minimum value.`))],compute:function(...e){let t=Aa(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:la(e[0])}},isExported:!0},Iy={description:E(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the minimum will be determined.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=1/0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n>i?i:n)},this.locale),n===1/0?0:n},isExported:!0};function Ly(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let i=n.length,a=0,o=0,s=0,c=0,l=0;for(let e=0;e<i;e++){let t=n[e],i=r[e];a+=t,o+=i,s+=t*i,c+=t*t,l+=i*i}return(i*s-a*o)/Math.sqrt((i*c-a*a)*(i*l-o*o))}let Ry={description:E(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return Ly(e,t)},isExported:!0},zy=Ry,By={description:E(`Value at a given percentile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return Hy.compute.bind(this)(e,t)},isExported:!0},Vy={description:E(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile, exclusive of 0 and 1, whose value within 'data' will be calculated and returned.`))],compute:function(e,t){return{value:ly([e],t,!1,this.locale),format:la(e)}},isExported:!0},Hy={description:E(`Value at a given percentile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:ly([e],t,!0,this.locale),format:la(e)}},isExported:!0},Uy={description:E(`Compute the coefficients of polynomial regression of the dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`)),Y(`order (number)`,E(`The order of the polynomial to fit the data, between 1 and 6.`)),Y(`intercept (boolean, default=TRUE)`,E(`A flag specifying whether to compute the intercept or not.`))],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=oy(e,t);return Wl(i,a),Ll(a,i,F(n,this.locale),L(r))},isExported:!1},Wy={description:E(`Predict value by computing a polynomial regression of the dataset.`),args:[Y(`x (number, range<number>)`,E(`The value(s) on the x-axis to forecast.`)),Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`)),Y(`order (number)`,E(`The order of the polynomial to fit the data, between 1 and 6.`)),Y(`intercept (boolean, default=TRUE)`,E(`A flag specifying whether to compute the intercept or not.`))],compute:function(e,t,n,r,i={value:!0}){let a=F(r,this.locale),{flatDataX:o,flatDataY:s}=oy(t,n);Wl(o,s);let c=Ll(s,o,a,L(i)).flat();return Ma(z(e),e=>zl(c,F(e,this.locale),a))},isExported:!1},Gy={description:E(`Value nearest to a specific quartile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value to return.`))],compute:function(e,t){return qy.compute.bind(this)(e,t)},isExported:!0},Ky={description:E(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value, exclusive of 0 and 4, to return.`))],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:ly([e],n,!1,this.locale),format:la(e)}},isExported:!0},qy={description:E(`Value nearest to a specific quartile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value to return.`))],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:ly([e],n,!0,this.locale),format:la(e)}},isExported:!0},Jy={description:E(`Returns the rank of a specified value in a dataset.`),args:[Y(`value (number)`,E(`The value whose rank will be determined.`)),Y(`data (range)`,E(`The range containing the dataset to consider.`)),Y(`is_ascending (boolean, default=FALSE)`,E(`Whether to consider the values in data in descending or ascending order.`))],compute:function(e,t,n={value:!1}){let r=L(n),i=F(e,this.locale),a=1,o=!1;for(let e of t)for(let t of e){if(typeof t.value!=`number`)continue;let e=F(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new aa(E(`Value not found in the given data.`))},isExported:!0},Yy={description:E(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return Ly(t,e)**2},isExported:!0},Xy={description:E(`Compute the slope of the linear regression.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let[[i]]=Il([n],[r]);return i},isExported:!0},Zy={description:E(`Nth smallest element in a data set.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`n (number)`,E(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;Ta([e],e=>{typeof e?.value==`number`&&(i=Ha(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.pop(),a--))});let o=r.pop();return N(()=>o!==void 0,E(`[[FUNCTION_NAME]] has no valid input data.`)),N(()=>a>=n,E(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)),o},isExported:!0},Qy={description:E(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(t,e);Wl(n,r);let i=n.length,a=n.map((e,t)=>[e,r[t]]);a.sort((e,t)=>e[0]-t[0]);for(let e=0;e<i;++e)a[e][0]=e;a.sort((e,t)=>e[1]-t[1]);let o=0;for(let e=0;e<i;++e)o+=(a[e][0]-e)**2;return 1-6*o/(i**3-i)},isExported:!1},$y={description:E(`Standard deviation.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(sb.compute.bind(this)(...e))},isExported:!0},eb={description:E(`Standard deviation of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(cb.compute.bind(this)(...e))},isExported:!0},tb={description:E(`Standard deviation.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(lb.compute.bind(this)(...e))},isExported:!0},nb={description:E(`Standard deviation of sample (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(ub.compute.bind(this)(...e))},isExported:!0},rb={description:E(`Standard deviation of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(db.compute.bind(this)(...e))},isExported:!0},ib={description:E(`Standard deviation of entire population (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(fb.compute.bind(this)(...e))},isExported:!0},ab={description:E(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);return Wl(n,r),Il([n],[r],!0,!0)[1][2]},isExported:!0},ob={description:E(`Fits points to linear trend derived via least-squares.`),args:[Y(`known_data_y (number, range<number>)`,E(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal linear trend.`)),Y(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,E(`The values of the independent variable(s) corresponding with known_data_y.`)),Y(`new_data_x (number, range<number>, optional, default=known_data_x)`,E(`The data points to return the y values for on the ideal curve fit.`)),Y(`b (boolean, optional, default=TRUE)`,E(`Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.`))],compute:function(e,t=[[]],n=[[]],r={value:!0}){return Ul(e,`known_data_y`),Hl(ma(e,`known_data_y`),ma(t,`known_data_x`),ma(n,`new_data_y`),L(r))}},sb={description:E(`Variance.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!1,this.locale)},isExported:!0},cb={description:E(`Variance of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!1,this.locale)},isExported:!0},lb={description:E(`Variance.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!1,this.locale)},isExported:!0},ub={description:E(`Variance of sample (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!0,this.locale)},isExported:!0},db={description:E(`Variance of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!1,this.locale)},isExported:!0},fb={description:E(`Variance of entire population (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!0,this.locale)},isExported:!0};var pb=l({DAVERAGE:()=>gb,DCOUNT:()=>_b,DCOUNTA:()=>vb,DGET:()=>yb,DMAX:()=>bb,DMIN:()=>xb,DPRODUCT:()=>Sb,DSTDEV:()=>Cb,DSTDEVP:()=>wb,DSUM:()=>Tb,DVAR:()=>Eb,DVARP:()=>Db});function mb(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(I(e[t][0]).toUpperCase(),t);let o=t?.value;if(typeof o!=`number`&&typeof o!=`string`)throw new M(E(`The field must be a number or a string`));let s;if(typeof o==`number`){if(s=Math.trunc(o)-1,s<0||a-1<s)throw new M(E(`The field (%(fieldValue)s) must be one of %(dimRowDB)s or must be a number between 1 and %s inclusive.`,{fieldValue:o.toString(),dimRowDB:a.toString()}))}else{let e=I(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(E(`The field (%s) must be one of %s.`,I(t),[...i.keys()].toString()))}let c=n[0].length;if(c<2)throw new M(E(`The criteria range contains %s row, it must be at least 2 rows.`,c.toString()));let l=new Set,u=e[0].length;for(let t=1;t<c;t++){let a=[],o=!0;for(let r=0;r<n.length;r++){let s=I(n[r][0]).toUpperCase(),c=i.get(s),l=n[r][t];if(l.value!==null)if(c!==void 0)a.push([e[c].slice(1,u)]),a.push(l);else{o=!1;break}}if(o)if(a.length>0)Va(a,(e,t)=>{l.add(t)},r,!0);else{l=new Set(Array(u-1).keys());break}}let d=e[s];return[...l].map(e=>d[e+1])}let hb=[Y(`database (range)`,E(`The array or range containing the data to consider, structured in such a way that the first row contains the labels for each column's values.`)),Y(`field (number, string)`,E(`Indicates which column in database contains the values to be extracted and operated on.`)),Y(`criteria (range)`,E(`An array or range containing zero or more criteria to filter the database values by before operating.`))],gb={description:E(`Average of a set of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return dy.compute.bind(this)([r])},isExported:!0},_b={description:E(`Counts values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return vy.compute.bind(this)([r])},isExported:!0},vb={description:E(`Counts values and text from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return yy.compute.bind(this)([r])},isExported:!0},yb={description:E(`Single value from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return N(()=>r.length===1,E(`More than one match found in DGET evaluation.`)),r[0]},isExported:!0},bb={description:E(`Maximum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Ay.compute.bind(this)([r])},isExported:!0},xb={description:E(`Minimum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Py.compute.bind(this)([r])},isExported:!0},Sb={description:E(`Product of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Rv.compute.bind(this)([r])},isExported:!0},Cb={description:E(`Standard deviation of population sample from table.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return $y.compute.bind(this)([r])},isExported:!0},wb={description:E(`Standard deviation of entire population from table.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return rb.compute.bind(this)([r])},isExported:!0},Tb={description:E(`Sum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Zv.compute.bind(this)([r])},isExported:!0},Eb={description:E(`Variance of population sample from table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return sb.compute.bind(this)([r])},isExported:!0},Db={description:E(`Variance of a population from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return db.compute.bind(this)([r])},isExported:!0};var Ob=l({DATE:()=>Ab,DATEDIF:()=>jb,DATEVALUE:()=>Mb,DAY:()=>Nb,DAYS:()=>Pb,DAYS360:()=>Fb,EDATE:()=>Ib,EOMONTH:()=>Lb,HOUR:()=>Rb,ISOWEEKNUM:()=>zb,MINUTE:()=>Bb,MONTH:()=>Vb,MONTH_END:()=>rx,MONTH_START:()=>nx,NETWORKDAYS:()=>Hb,NETWORKDAYS_INTL:()=>Wb,NOW:()=>Gb,QUARTER:()=>ix,QUARTER_END:()=>ox,QUARTER_START:()=>ax,SECOND:()=>Kb,TIME:()=>qb,TIMEVALUE:()=>Jb,TODAY:()=>Yb,WEEKDAY:()=>Xb,WEEKNUM:()=>Zb,WORKDAY:()=>Qb,WORKDAY_INTL:()=>$b,YEAR:()=>ex,YEARFRAC:()=>tx,YEAR_END:()=>cx,YEAR_START:()=>sx}),kb=function(e){return e.WHOLE_YEARS=`Y`,e.WHOLE_MONTHS=`M`,e.WHOLE_DAYS=`D`,e.DAYS_WITHOUT_WHOLE_MONTHS=`MD`,e.MONTH_WITHOUT_WHOLE_YEARS=`YM`,e.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR=`YD`,e}(kb||{});let Ab={description:E(`Converts year/month/day into a date.`),args:[Y(`year (number)`,E(`The year component of the date.`)),Y(`month (number)`,E(`The month component of the date.`)),Y(`day (number)`,E(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));N(()=>0<=r&&r<=9999,E(`The year (%s) must be between 0 and 9999 inclusive.`,r.toString())),r<1900&&(r+=1900);let o=li(new O(r,i-1,a));return N(()=>o>=0,E(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`)),{value:o,format:this.locale.dateFormat}},isExported:!0},jb={description:E(`Calculates the number of days, months, or years between two dates.`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),Y(`unit (string)`,E(`A text abbreviation for unit of time. Accepted values are "Y" (the number of whole years between start_date and end_date), "M" (the number of whole months between start_date and end_date), "D" (the number of days between start_date and end_date), "MD" (the number of days between start_date and end_date after subtracting whole months), "YM" (the number of whole months between start_date and end_date after subtracting whole years), "YD" (the number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart).`))],compute:function(e,t,n){let r=I(n).toUpperCase();N(()=>Object.values(kb).includes(r),fa(Object.values(kb),I(n)));let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=ci(i),s=ci(a);switch(N(()=>a>=i,E(`start_date (%s) should be on or before end_date (%s).`,o.toLocaleDateString(),s.toLocaleDateString())),r){case`Y`:return vi(o,s);case`M`:return gi(o,s);case`D`:return _i(o,s);case`YM`:return gi(o,s)-vi(o,s)*12;case`MD`:let e=s.getDate()-o.getDate();return e<0&&(e=di(new O(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case`YD`:{if(yi(i,a))return _i(o,s);let e=new O(o.getFullYear(),s.getMonth(),s.getDate()),t=_i(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=_i(o,e)),t}}},isExported:!0},Mb={description:E(`Converts a date string to a date value.`),args:[Y(`date_string (string)`,E(`The string representing the date.`))],compute:function(e){let t=I(e),n=Qr(t,this.locale);return N(()=>n!==null,E(`The date_string (%s) cannot be parsed to date/time.`,t.toString())),Math.trunc(n.value)},isExported:!0},Nb={description:E(`Day of the month that a specific date falls on.`),args:[Y(`date (string)`,E(`The date from which to extract the day.`))],compute:function(e){return R(e,this.locale).getDate()},isExported:!0},Pb={description:E(`Number of days between two dates.`),args:[Y(`end_date (date)`,E(`The end of the date range.`)),Y(`start_date (date)`,E(`The start of the date range.`))],compute:function(e,t){let n=R(e,this.locale),r=R(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Rr)},isExported:!0},Fb={description:E(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation.`)),Y(`method (number, default=0)`,E(`An indicator of what day count method to use. (0) US NASD method (1) European method`))],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=hi(r,i,L(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},Ib={description:E(`Date a number of months before/after another date.`),args:[Y(`start_date (date)`,E(`The date from which to calculate the result.`)),Y(`months (number)`,E(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:li(pi(R(e,this.locale),Math.trunc(F(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},Lb={description:E(`Last day of a month before or after a date.`),args:[Y(`start_date (date)`,E(`The date from which to calculate the result.`)),Y(`months (number)`,E(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=R(e,this.locale),r=Math.trunc(F(t,this.locale));return{value:li(new O(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},Rb={description:E(`Hour component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the hour component.`))],compute:function(e){return R(e,this.locale).getHours()},isExported:!0},zb={description:E(`ISO week number of the year.`),args:[Y(`date (date)`,E(`The date for which to determine the ISO week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`))],compute:function(e){let t=R(e,this.locale),n=t.getFullYear(),r=1;for(;new O(n,0,r).getDay()!==4;)r+=1;let i=new O(n,0,r-3),a=31;for(;new O(n,11,a).getDay()!==4;)--a;let o=new O(n,11,a+3),s;s=i.getTime()<=t.getTime()?t.getTime()<=o.getTime()?0:1:-1;let c;switch(s){case 0:c=i;break;case 1:c=new O(n,11,a+3+1);break;case-1:let e=1;for(;new O(n-1,0,e).getDay()!==4;)e+=1;c=new O(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Rr;return Math.floor(l/7)+1},isExported:!0},Bb={description:E(`Minute component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the minute component.`))],compute:function(e){return R(e,this.locale).getMinutes()},isExported:!0},Vb={description:E(`Month of the year a specific date falls in`),args:[Y(`date (date)`,E(`The date from which to extract the month.`))],compute:function(e){return R(e,this.locale).getMonth()+1},isExported:!0},Hb={description:E(`Net working days between two provided days.`),args:[Y(`start_date (date)`,E(`The start date of the period from which to calculate the number of net working days.`)),Y(`end_date (date)`,E(`The end date of the period from which to calculate the number of net working days.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the date serial numbers to consider holidays.`))],compute:function(e,t,n){return Wb.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function Ub(e){let t=e?.value;if(typeof t==`string`){N(()=>{if(t.length!==7)return!1;for(let e of t)if(e!==`0`&&e!==`1`)return!1;return!0},E(`When weekend is a string (%s) it must be composed of "0" or "1".`,t));let e=[];for(let n=0;n<7;n++)t[n]===`1`&&e.push((n+1)%7);return e}if(typeof t==`number`)return N(()=>1<=t&&t<=7||11<=t&&t<=17,E(`The weekend (%s) must be a string or a number in the range 1-7 or 11-17.`,t.toString())),t<=7?[t-2==-1?6:t-2,t-1]:[t-11];throw new M(E(`The weekend must be a number or a string.`))}let Wb={description:E(`Net working days between two dates (specifying weekends).`),args:[Y(`start_date (date)`,E(`The start date of the period from which to calculate the number of net working days.`)),Y(`end_date (date)`,E(`The end date of the period from which to calculate the number of net working days.`)),Y(`weekend (any, default=1)`,E(`A number or string representing which days of the week are considered weekends.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider as holidays.`))],compute:function(e,t,n={value:1},r){let i=R(e,this.locale),a=R(t,this.locale),o=Ub(n),s=new Set;r!==void 0&&Ta([r],e=>{let t=R(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=O.fromTimestamp((c?i:a).getTime()),u=O.fromTimestamp((c?a:i).getTime()),d=l.getTime(),f=u.getTime(),p=0;for(;f<=d;)!o.includes(u.getDay())&&!s.has(f)&&(p+=1),u.setDate(u.getDate()+1),f=u.getTime();return c?-p:p},isExported:!0},Gb={description:E(`Current date and time as a date value.`),args:[],compute:function(){let e=O.now(),t=e.getTime()-Lr.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Rr)+n,format:_l(this.locale)}},isExported:!0},Kb={description:E(`Minute component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the second component.`))],compute:function(e){return R(e,this.locale).getSeconds()},isExported:!0},qb={description:E(`Converts hour/minute/second into a time.`),args:[Y(`hour (number)`,E(`The hour component of the time.`)),Y(`minute (number)`,E(`The minute component of the time.`)),Y(`second (number)`,E(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return i+=Math.floor(a/60),a=a%60+(a<0?60:0),r+=Math.floor(i/60),i=i%60+(i<0?60:0),r%=24,N(()=>r>=0,E(`The function [[FUNCTION_NAME]] result cannot be negative`)),{value:r/24+i/1440+a/(1440*60),format:this.locale.timeFormat}},isExported:!0},Jb={description:E(`Converts a time string into its serial number representation.`),args:[Y(`time_string (string)`,E(`The string that holds the time representation.`))],compute:function(e){let t=I(e),n=Qr(t,this.locale);N(()=>n!==null,E(`The time_string (%s) cannot be parsed to date/time.`,t));let r=n.value-Math.trunc(n.value);return r<0?1+r:r},isExported:!0},Yb={description:E(`Current date as a date value.`),args:[],compute:function(){let e=O.now();return{value:li(new O(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},Xb={description:E(`Day of the week of the date provided (as number).`),args:[Y(`date (date)`,E(`The date for which to determine the day of the week. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`type (number, default=1)`,E(`A number indicating which numbering system to use to represent weekdays. By default, counts starting with Sunday = 1.`))],compute:function(e,t={value:1}){let n=R(e,this.locale),r=Math.round(F(t,this.locale)),i=n.getDay();return N(()=>[1,2,3].includes(r),E(`The type (%s) must be 1, 2 or 3.`,r.toString())),r===1?i+1:r===2?i===0?7:i:i===0?6:i-1},isExported:!0},Zb={description:E(`Week number of the year.`),args:[Y(`date (date)`,E(`The date for which to determine the week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`type (number, default=1)`,E(`A number representing the day that a week starts on. Sunday = 1.`))],compute:function(e,t={value:1}){let n=R(e,this.locale),r=Math.round(F(t,this.locale));if(N(()=>r===1||r===2||11<=r&&r<=17||r===21,E(`The type (%s) is out of range.`,r.toString())),r===21)return zb.compute.bind(this)(e);let i;i=r===1||r===2?r-1:r-10==7?0:r-10;let a=n.getFullYear(),o=1,s=new O(a,0,o);for(;s.getDay()!==i;)o+=1,s=new O(a,0,o);let c=(n.getTime()-s.getTime())/Rr;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},Qb={description:E(`Date after a number of workdays.`),args:[Y(`start_date (date)`,E(`The date from which to begin counting.`)),Y(`num_days (number)`,E(`The number of working days to advance from start_date. If negative, counts backwards.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:null}){return $b.compute.bind(this)(e,t,{value:1},n)},isExported:!0},$b={description:E(`Date after a number of workdays (specifying weekends).`),args:[Y(`start_date (date)`,E(`The date from which to begin counting.`)),Y(`num_days (number)`,E(`The number of working days to advance from start_date. If negative, counts backwards.`)),Y(`weekend (any, default=1)`,E(`A number or string representing which days of the week are considered weekends.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:1},r){let i=R(e,this.locale),a=Math.trunc(F(t,this.locale));typeof n.value==`string`&&N(()=>n.value!==`1111111`,E(`The weekend must be different from '1111111'.`));let o=Ub(n),s=new Set;r!==void 0&&Ta([r],e=>{let t=R(e,this.locale);s.add(t.getTime())});let c=O.fromTimestamp(i.getTime()),l=c.getTime(),u=Math.sign(a),d=Math.abs(a);for(;d>0;)c.setDate(c.getDate()+u),l=c.getTime(),!o.includes(c.getDay())&&!s.has(l)&&--d;let f=l-Lr.getTime();return{value:Math.round(f/Rr),format:this.locale.dateFormat}},isExported:!0},ex={description:E(`Year specified by a given date.`),args:[Y(`date (date)`,E(`The date from which to extract the year.`))],compute:function(e){return R(e,this.locale).getFullYear()},isExported:!0},tx={description:E(`Exact number of years between two dates.`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`day_count_convention (number, default=0)`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return N(()=>r>=0,E(`The start_date (%s) must be positive or null.`,r.toString())),N(()=>i>=0,E(`The end_date (%s) must be positive or null.`,i.toString())),N(()=>0<=a&&a<=4,E(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,a.toString())),hi(r,i,a)}},nx={description:E(`First day of the month preceding a date.`),args:[Y(`date (date)`,E(`The date from which to calculate the result.`))],compute:function(e){let t=R(e,this.locale);return{value:li(new O(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},rx={description:E(`Last day of the month following a date.`),args:[Y(`date (date)`,E(`The date from which to calculate the result.`))],compute:function(e){return Lb.compute.bind(this)(e,{value:0})}},ix={description:E(`Quarter of the year a specific date falls in`),args:[Y(`date (date)`,E(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((R(e,this.locale).getMonth()+1)/3)}},ax={description:E(`First day of the quarter of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=ix.compute.bind(this)(e);return{value:li(new O(ex.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},ox={description:E(`Last day of the quarter of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=ix.compute.bind(this)(e);return{value:li(new O(ex.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},sx={description:E(`First day of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:li(new O(ex.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},cx={description:E(`Last day of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:li(new O(ex.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var lx=l({DELTA:()=>ux});let ux={description:E(`Compare two numeric values, returning 1 if they're equal.`),args:[Y(`number1 (number)`,E(`The first number to compare.`)),Y(`number2 (number, default=0)`,E(`The second number to compare.`))],compute:function(e,t={value:0}){return+(F(e,this.locale)===F(t,this.locale))},isExported:!0},dx=[`number`,`error`,`text`,`boolean`];function fx(e){let t=e===`ascending`?1:-1;return(e,n)=>{if(e.type===`empty`)return n.type===`empty`?0:1;if(n.type===`empty`)return-1;let r=dx.indexOf(e.type)-dx.indexOf(n.type);return r===0&&(r=e.type===`text`||e.type===`error`?e.value.localeCompare(n.value):e.value-n.value),t*r}}function px(e,t,n){let r=e.map((e,t)=>({index:t,type:e.type,value:e.value}));return(n?r.map(e=>e.type===`empty`?{...e,type:`number`,value:0}:e):r).sort(fx(t))}function mx(e,t,n,r,i){let a=qi.Success,o=r.right>r.left;if(e.model.getters.doesIntersectMerge(t,r)){o=!1;let n;for(let i=r.top;i<=r.bottom;i++){n=[];for(let a=r.left;a<=r.right;a++){let r=e.model.getters.getMerge({sheetId:t,col:a,row:i});r&&!n.includes(r.id.toString())&&n.push(r.id.toString())}if(n.length>=2){o=!0;break}}}let{col:s,row:c}=n;if(o)a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i});else{let n=e.model.getters.getContiguousZone(t,r);lr(n,r)?a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i}):e.askConfirmation(E(`We found data next to your selection. Since this data was not selected, it will not be sorted. Do you want to extend your selection?`),()=>{r=n,a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i})},()=>{a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i})})}if(a.isCancelledBecause(`InvalidSortZone`)){let{col:t,row:i}=n;e.model.selection.selectZone({cell:{col:t,row:i},zone:r}),e.raiseError(E(`Cannot sort. To sort, select only cells or only merges that have the same size.`))}}var hx=l({FILTER:()=>_x,SORT:()=>vx,SORTN:()=>yx,UNIQUE:()=>bx});function gx(e,t,...n){for(let e=0;e<n.length;e++)N(()=>n[e]!==void 0,E(`Value for parameter %s is missing in [[FUNCTION_NAME]].`,e%2==0?`sort_column`:`is_ascending`));let r=[],i=[],a=e.length;for(let o=0;o<n.length;o+=2){r.push(L(El(n[o+1])?.value)?`ascending`:`descending`);let s=n[o];if(A(s)&&(s.length>1||s[0].length>1))N(()=>s.length===1&&s[0].length===a,E(`Wrong size for %s. Expected a range of size 1x%s. Got %sx%s.`,`sort_column${o+1}`,a,s.length,s[0].length)),i.push(s.flat().map(e=>e.value));else{let n=F(El(s)?.value,t);if(n<1||n>e[0].length)return e;i.push(e.map(e=>e[n-1].value))}}if(i.length===0)for(let t=0;t<e[0].length;t++)i.push(e.map(e=>e[t].value)),r.push(`ascending`);let o={descending:fx(`descending`),ascending:fx(`ascending`)},s=x(0,e.length);return s.sort((e,t)=>{for(let[n,a]of i.entries()){let i=a[e],s=a[t],c={value:i,type:i===null?`empty`:typeof i==`string`?`text`:typeof i},l={value:s,type:s===null?`empty`:typeof s==`string`?`text`:typeof s},u=o[r[n]](c,l);if(u!==0)return u}return 0}),s.map(t=>e[t])}let _x={description:E(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[Y(`range (any, range<any>)`,E(`The data to be filtered.`)),Y(`condition1 (boolean, range<boolean>)`,E(`A column or row containing true or false values corresponding to the first column or row of range.`)),Y(`condition2 (boolean, range<boolean>, repeating)`,E(`Additional column or row containing true or false values.`))],compute:function(e,...t){let n=z(e),r=t.map(e=>Ma(z(e),e=>e.value));r.map(e=>__(E(`The arguments condition must be a single column or row.`),e)),v_(E(`The arguments conditions must have the same dimensions.`),...t);let i=r.map(e=>e.flat()),a=r[0].length===1?`row`:`col`;n=a===`row`?Pa(n):n,N(()=>i.every(e=>e.length===n.length),E(`FILTER has mismatched sizes on the range and conditions.`));let o=[];for(let e=0;e<n.length;e++){let t=n[e];i.every(t=>(typeof t[e]==`boolean`||typeof t[e]==`number`)&&t[e])&&o.push(t)}return o.length?a===`row`?Pa(o):o:new aa(E(`No match found in FILTER evaluation`))},isExported:!1},vx={description:E(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[Y(`range (range)`,E(`The data to be sorted.`)),Y(`sort_column (any, range<number>, repeating)`,E(`The index of the column in range or a range outside of range containing the values by which to sort.`)),Y(`is_ascending (boolean, repeating)`,E(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`))],compute:function(e,...t){return Pa(gx(Pa(e),this.locale,...t))},isExported:!0},yx={description:E(`Returns the first n items in a data set after performing a sort.`),args:[Y(`range (range)`,E(`The data to be sorted.`)),Y(`n (number, default=1)`,E(`The number of items to return.`)),Y(`display_ties_mode (number, default=0)`,E(`A number representing the way to display ties.`)),Y(`sort_column (number, range<number>, repeating)`,E(`The index of the column in range or a range outside of range containing the values by which to sort.`)),Y(`is_ascending (boolean, repeating)`,E(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`))],compute:function(e,t,n,...r){let i=F(t?.value??1,this.locale);N(()=>i>=0,E(`Wrong value of 'n'. Expected a positive number. Got %s.`,i));let a=F(n?.value??0,this.locale);N(()=>a>=0&&a<=3,E(`Wrong value of 'display_ties_mode'. Expected a positive number between 0 and 3. Got %s.`,a));let o=gx(Pa(e),this.locale,...r),s=(e,t)=>JSON.stringify(o[e].map(e=>e.value))===JSON.stringify(o[t].map(e=>e.value));switch(a){case 0:return Pa(o.slice(0,i));case 1:for(let e=i;e<o.length;e++)if(!s(e,i-1))return Pa(o.slice(0,e));return Pa(o);case 2:{let e=[o[0]];for(let t=1;t<o.length;t++)for(let n=0;n<t&&!s(t,n);n++)n===t-1&&e.push(o[t]);return Pa(e.slice(0,i))}case 3:{let e=[o[0]],t=1;for(let n=1;n<o.length&&(s(n,n-1)||t++,!(t>i));n++)e.push(o[n]);return Pa(e)}}},isExported:!1},bx={description:E(`Unique rows in the provided source range.`),args:[Y(`range (any, range<any>)`,E(`The data to filter by unique entries.`)),Y(`by_column (boolean, default=FALSE)`,E(`Whether to filter the data by columns or by rows.`)),Y(`exactly_once (boolean, default=FALSE)`,E(`Whether to return only entries with no duplicates.`))],compute:function(e={value:``},t,n){if(!A(e))return[[e]];let r=L(t?.value)||!1,i=L(n?.value)||!1;r||(e=Pa(e));let a=new Map;for(let t of e){let e=JSON.stringify(t.map(e=>e.value)),n=a.get(e);n?n.count++:a.set(e,{data:t,count:1})}let o=[];for(let e of a.values())i&&e.count>1||o.push(e.data);return o.length?r?o:Pa(o):new M(E(`No unique values found`))},isExported:!0};function xx(e,t){N(()=>e<t,E(`The maturity (%s) must be strictly greater than the settlement (%s).`,t.toString(),e.toString()))}function Sx(e,t){N(()=>t<e,E(`The settlement date (%s) must be strictly greater than the issue date (%s).`,e.toString(),t.toString()))}function Cx(e){N(()=>[1,2,4].includes(e),E(`The frequency (%s) must be one of %s`,e.toString(),[1,2,4].toString()))}function wx(e){N(()=>0<=e&&e<=4,E(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e.toString()))}function Tx(e){N(()=>e>0,E(`The redemption (%s) must be strictly positive.`,e.toString()))}function Ex(e){N(()=>e>0,E(`The price (%s) must be strictly positive.`,e.toString()))}function Dx(e){N(()=>e>0,E(`The number_of_periods (%s) must be greater than 0.`,e.toString()))}function Ox(e){N(()=>e>0,E(`The rate (%s) must be strictly positive.`,e.toString()))}function kx(e){N(()=>e>0,E(`The life (%s) must be strictly positive.`,e.toString()))}function Ax(e){N(()=>e>0,E(`The cost (%s) must be strictly positive.`,e.toString()))}function jx(e){N(()=>e>=0,E(`The purchase_date (%s) must be positive or null.`,e.toString()))}function Mx(e){N(()=>e>=0,E(`The issue (%s) must be positive or null.`,e.toString()))}function Nx(e){N(()=>e>=0,E(`The cost (%s) must be positive or null.`,e.toString()))}function Px(e){N(()=>e>0,E(`The period (%s) must be strictly positive.`,e.toString()))}function Fx(e){N(()=>e>=0,E(`The period (%s) must be positive or null.`,e.toString()))}function Ix(e){N(()=>e>=0,E(`The salvage (%s) must be positive or null.`,e.toString()))}function Lx(e,t){N(()=>e<=t,E(`The salvage (%s) must be smaller or equal than the cost (%s).`,e.toString(),t.toString()))}function Rx(e){N(()=>e>0,E(`The present value (%s) must be strictly positive.`,e.toString()))}function zx(e,t){N(()=>e<=t,E(`The period (%s) must be less than or equal life (%s).`,e.toString(),t.toString()))}function Bx(e){N(()=>e>0,E(`The investment (%s) must be strictly positive.`,e.toString()))}function Vx(e){N(()=>e>0,E(`The discount (%s) must be strictly positive.`,e.toString()))}function Hx(e){N(()=>e<1,E(`The discount (%s) must be smaller than 1.`,e.toString()))}function Ux(e){N(()=>e>0,E(`The depreciation factor (%s) must be strictly positive.`,e.toString()))}function Wx(e,t,n){let r=R(e,n),i=R(t,n),a=R(e,n);a.setFullYear(r.getFullYear()+1),N(()=>i.getTime()<=a.getTime(),E(`The settlement date (%s) must at most one year after the maturity date (%s).`,e.toString(),t.toString()))}function Gx(e,t,n){Dx(n),N(()=>e>0,E(`The first_period (%s) must be strictly positive.`,e.toString())),N(()=>t>0,E(`The last_period (%s) must be strictly positive.`,t.toString())),N(()=>e<=t,E(`The first_period (%s) must be smaller or equal to the last_period (%s).`,e.toString(),t.toString())),N(()=>t<=n,E(`The last_period (%s) must be smaller or equal to the number_of_periods (%s).`,e.toString(),n.toString()))}function Kx(e,t,n){kx(n),N(()=>e>=0,E(`The start_period (%s) must be greater or equal than 0.`,e.toString())),N(()=>t>=0,E(`The end_period (%s) must be greater or equal than 0.`,t.toString())),N(()=>e<=t,E(`The start_period (%s) must be smaller or equal to the end_period (%s).`,e.toString(),t.toString())),N(()=>t<=n,E(`The end_period (%s) must be smaller or equal to the life (%s).`,e.toString(),n.toString()))}function qx(e){N(()=>e>-1,E(`The rate_guess (%s) must be strictly greater than -1.`,e.toString()))}function Jx(e,t){N(()=>e.length===t.length&&e[0].length===t[0].length,E(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`))}function Yx(e){N(()=>e.some(e=>e>0)&&e.some(e=>e<0),E(`There must be both positive and negative values in cashflow_amounts.`))}function Xx(e){N(()=>e.every(t=>t>=e[0]),E(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e[0].toString()))}var Zx=l({ACCRINTM:()=>eS,AMORLINC:()=>tS,COUPDAYBS:()=>rS,COUPDAYS:()=>nS,COUPDAYSNC:()=>iS,COUPNCD:()=>aS,COUPNUM:()=>oS,COUPPCD:()=>sS,CUMIPMT:()=>cS,CUMPRINC:()=>lS,DB:()=>uS,DDB:()=>fS,DISC:()=>pS,DOLLARDE:()=>mS,DOLLARFR:()=>hS,DURATION:()=>gS,EFFECT:()=>_S,FV:()=>yS,FVSCHEDULE:()=>bS,INTRATE:()=>xS,IPMT:()=>CS,IRR:()=>TS,ISPMT:()=>ES,MDURATION:()=>DS,MIRR:()=>OS,NOMINAL:()=>kS,NPER:()=>AS,NPV:()=>MS,PDURATION:()=>NS,PMT:()=>FS,PPMT:()=>LS,PRICE:()=>zS,PRICEDISC:()=>BS,PRICEMAT:()=>VS,PV:()=>RS,RATE:()=>US,RECEIVED:()=>WS,RRI:()=>GS,SLN:()=>KS,SYD:()=>qS,TBILLEQ:()=>XS,TBILLPRICE:()=>YS,TBILLYIELD:()=>ZS,VDB:()=>QS,XIRR:()=>$S,XNPV:()=>eC,YIELD:()=>tC,YIELDDISC:()=>nC,YIELDMAT:()=>rC});let Qx=[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))];function $x(e,t,n,r,i=1e-10,a){let o=n,s,c,l,u=!1,d=0,f;do{if(l=e(o),isNaN(l)){N(()=>d<r&&a!==void 0,E(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++,o=a(f),f=o;continue}s=o-l/t(o),c=Math.abs(s-o),o=s,u=c<i||Math.abs(l)<i,N(()=>d<r,E(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let eS={description:E(`Accrued interest of security paying at maturity.`),args:[Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`maturity (date)`,E(`The maturity date of the security.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));Mx(a),Sx(o,a),wx(l),Tx(s),Ox(c);let u=hi(a,o,l);return s*c*u},isExported:!0},tS={description:E(`Depreciation for an accounting period.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`purchase_date (date)`,E(`The date the asset was purchased.`)),Y(`first_period_end (date)`,E(`The date the first period ended.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`rate (number)`,E(`The deprecation rate.`)),Y(`day_count_convention (number, optional)`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=F(e,this.locale),c=Math.trunc(F(t,this.locale)),l=Math.trunc(F(n,this.locale)),u=F(r,this.locale),d=F(i,this.locale),f=F(a,this.locale),p=Math.trunc(F(o,this.locale));Ax(s),jx(c),Ix(u),Lx(u,s),Fx(d),Ox(f),wx(p),N(()=>c<=l,E(`The purchase_date (%s) must be before the first_period_end (%s).`,c.toString(),l.toString()));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=hi(c,l,p),_=c===l?h:h*g,v=s-_-h*m;return v>=u?m===0?_:h:u-v<h?h-(u-v):0},isExported:!0},nS={description:E(`Days in coupon period containing settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(xx(i,a),Cx(o),wx(s),s===1){let i=sS.compute.bind(this)(e,t,n,r).value;return aS.compute.bind(this)(e,t,n,r).value-i}return(s===3?365:360)/o},isExported:!0},rS={description:E(`Days from settlement until next coupon.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=sS.compute.bind(this)(e,t,n,r).value;if([1,2,3].includes(s))return i-c;if(s===4){let e=hi(c,i,s);return Math.round(e*360)}let l=R(i,this.locale),u=R(c,this.locale),d=u.getFullYear(),f=l.getFullYear(),p=u.getMonth()+1,m=l.getMonth()+1,h=u.getDate(),g=l.getDate();return p===2&&m===2&&fi(u)&&fi(l)&&(g=30),g===31&&(h===30||h===31)&&(g=30),p===2&&fi(u)&&(h=30),h===31&&(h=30),(f-d)*360+(m-p)*30+(g-h)},isExported:!0},iS={description:E(`Days from settlement until next coupon.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=aS.compute.bind(this)(e,t,n,r).value;if([1,2,3].includes(s))return c-i;if(s===4){let e=hi(i,c,s);return Math.round(e*360)}let l=rS.compute.bind(this)(e,t,n,r);return nS.compute.bind(this)(e,t,n,r)-l},isExported:!0},aS={description:E(`Next coupon date after the settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=12/o,l=oS.compute.bind(this)(e,t,n,r);return{value:li(pi(R(a,this.locale),-(l-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},oS={description:E(`Number of coupons between settlement and maturity.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=1,l=a,u=12/o;for(;l>i;)l=li(pi(R(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},sS={description:E(`Last coupon date prior to or on the settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=12/o,l=oS.compute.bind(this)(e,t,n,r);return{value:li(pi(R(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},cS={description:E(`Cumulative interest paid over a set of periods.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`first_period (number)`,E(`The number of the payment period to begin the cumulative calculation.`)),Y(`last_period (number)`,E(`The number of the payment period to end the cumulative calculation.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);Gx(o,s,u),Ox(c),Rx(l);let f=0;for(let e=o;e<=s;e++)f+=SS(c,e,u,l,0,d);return f},isExported:!0},lS={description:E(`Cumulative principal paid over a set of periods.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`first_period (number)`,E(`The number of the payment period to begin the cumulative calculation.`)),Y(`last_period (number)`,E(`The number of the payment period to end the cumulative calculation.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);Gx(o,s,u),Ox(c),Rx(l);let f=0;for(let e=o;e<=s;e++)f+=IS(c,e,u,l,0,d);return f},isExported:!0},uS={description:E(`Depreciation via declining balance method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`month (number, optional)`,E(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=Math.trunc(F(r,this.locale)),l=i.length?Math.trunc(F(i[0],this.locale)):12,u=s+(l===12?0:1);Nx(a),Ix(o),Px(c),kx(s),N(()=>1<=l&&l<=12,E(`The month (%s) must be between 1 and 12 inclusive.`,l.toString())),N(()=>c<=u,E(`The period (%s) must be less than or equal to %s.`,c.toString(),u.toString()));let d=l/12,f=1-(o/a)**(1/s);f=Math.round(f*1e3)/1e3;let p=a,m=a*(1-f*d);for(let e=1;e<c;e++)p=m,m=p*(1-f),e===s&&(m=p*(1-f*(1-d)));return{value:p-m,format:`#,##0.00`}},isExported:!0};function dS(e,t,n,r,i){if(Nx(e),Ix(t),Px(r),kx(n),zx(r,n),Ux(i),e===0||t>=e)return 0;let a=i/n;if(a>1)return r===1?e-t:0;if(r<=1)return e*a;let o=e*(1-a)**(r-1),s=e*(1-a)**r,c=s<t?o-t:o-s;return Math.max(c,0)}let fS={description:E(`Depreciation via double-declining balance method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`factor (number, default=2)`,E(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){return{value:dS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale)),format:`#,##0.00`}},isExported:!0},pS={description:E(`Discount rate of a security based on price.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Ex(s),Tx(c);let u=hi(a,o,l);return(c-s)/c/u},isExported:!0},mS={description:E(`Convert a decimal fraction to decimal value.`),args:[Y(`fractional_price (number)`,E(`The price quotation given using fractional decimal conventions.`)),Y(`unit (number)`,E(`The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));N(()=>r>0,E(`The unit (%s) must be strictly positive.`,r.toString()));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},hS={description:E(`Convert a decimal value to decimal fraction.`),args:[Y(`decimal_price (number)`,E(`The price quotation given as a decimal value.`)),Y(`unit (number)`,E(`The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));N(()=>r>0,E(`The unit (%s) must be strictly positive.`,r.toString()));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},gS={description:E(`Number of periods for an investment to reach a value.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=F(n,this.locale),l=F(r,this.locale),u=Math.trunc(F(i,this.locale)),d=Math.trunc(F(a,this.locale));xx(o,s),Cx(u),wx(d),N(()=>c>=0,E(`The rate (%s) must be positive or null.`,c.toString())),N(()=>l>=0,E(`The yield (%s) must be positive or null.`,l.toString()));let f=hi(o,s,d),p=f-Math.trunc(f)||1/u,m=Math.ceil(f*u),h=c/u,g=l/u,_=0,v=0;for(let e=1;e<=m;e++){let t=(h+ +(e===m))/(1+g)**e;v+=(p+(e-1)/u)*t,_+=t}return _===0?0:v/_},isExported:!0},_S={description:E(`Annual effective interest rate.`),args:[Y(`nominal_rate (number)`,E(`The nominal interest rate per year.`)),Y(`periods_per_year (number)`,E(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return N(()=>n>0,E(`The nominal rate (%s) must be strictly greater than 0.`,n.toString())),N(()=>r>0,E(`The number of periods by year (%s) must strictly greater than 0.`,r.toString())),(1+n/r)**+r-1},isExported:!0};function vS(e,t,n,r,i){return e===0?-(r+n*t):-r*(1+e)**t-n*(1+e*i)*((1+e)**t-1)/e}let yS={description:E(`Future value of an annuity investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_amount (number)`,E(`The amount per period to be paid.`)),Y(`present_value (number, default=0)`,E(`The current value of the annuity.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:vS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),+!!L(i)),format:`#,##0.00`}},isExported:!0},bS={description:E(`Future value of principal from series of rates.`),args:[Y(`principal (number)`,E(`The amount of initial capital or value to compound against.`)),Y(`rate_schedule (number, range<number>)`,E(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=F(e,this.locale);return Oa([t],(e,t)=>e*(1+F(t,this.locale)),n)},isExported:!0},xS={description:E(`Calculates effective interest rate.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`investment (number)`,E(`The amount invested in the security.`)),Y(`redemption (number)`,E(`The amount to be received at maturity.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),Bx(c),Tx(s),wx(l);let u=hi(a,o,l);return(s-c)/c/u},isExported:!0};function SS(e,t,n,r,i,a){return PS(e,n,r,i,a)-IS(e,t,n,r,i,a)}let CS={description:E(`Payment on the principal of an investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`period (number)`,E(`The amortization period, in terms of number of periods.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:SS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale),+!!L(a)),format:`#,##0.00`}},isExported:!0},wS=.1,TS={description:E(`Internal rate of return given periodic cashflows.`),args:[Y(`cashflow_amounts (number, range<number>)`,E(`An array or range containing the income or payments associated with the investment.`)),Y(`rate_guess (number, default=${wS})`,E(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:wS}){let n=F(t,this.locale);qx(n);let r=!1,i=!1,a=[];Ea([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),N(()=>r&&i,E(`The cashflow_amounts must include negative and positive values.`));let o=a.shift();function s(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*e**(r-i)),t*e**r)}function c(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*(r-i)*e**(r-i-1)),t*r*e**(r-1))}function l(e){return s(e,o,a)}function u(e){return c(e,o,a)}return{value:$x(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},ES={description:E(`Returns the interest paid at a particular period of an investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`period (number)`,E(`The period for which you want to view the interest payment.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);return N(()=>o!==0,E(`The number of periods must be different than 0.`,o.toString())),-1*(s-a/o*s)*i},isExported:!0},DS={description:E(`Modified Macaulay duration.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){return gS.compute.bind(this)(e,t,n,r,i,a)/(1+F(r,this.locale)/Math.trunc(F(i,this.locale)))},isExported:!0},OS={description:E(`Modified internal rate of return.`),args:[Y(`cashflow_amounts (range<number>)`,E(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),Y(`financing_rate (number)`,E(`The interest rate paid on funds invested.`)),Y(`reinvestment_return_rate (number)`,E(`The return (as a percentage) earned on reinvestment of income received from the investment.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=Pa(e).flat().filter(e=>e.value!==null).map(e=>F(e,this.locale)),o=a.length,s=0,c=0;for(let e of x(0,o)){let t=a[e];t>=0?s+=t*(i+1)**(o-e-1):c+=t/(r+1)**e}N(()=>c!==0&&s!==0,E(`There must be both positive and negative values in cashflow_amounts.`));let l=1/(o-1);return(-s/c)**l-1},isExported:!0},kS={description:E(`Annual nominal interest rate.`),args:[Y(`effective_rate (number)`,E(`The effective interest rate per year.`)),Y(`periods_per_year (number)`,E(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return N(()=>n>0,E(`The effective rate (%s) must must strictly greater than 0.`,n.toString())),N(()=>r>0,E(`The number of periods by year (%s) must strictly greater than 0.`,r.toString())),((n+1)**(1/r)-1)*r},isExported:!0},AS={description:E(`Number of payment periods for an investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`payment_amount (number)`,E(`The amount of each payment made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);if(a===0)return-(c+s)/o;let u=o*(1+a*l)/a;return Math.log((u-c)/(s+u))/Math.log(1+a)},isExported:!0};function jS(e,t,n,r){let i=0;return ka(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let MS={description:E(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[Y(`discount (number)`,E(`The discount rate of the investment over one period.`)),Y(`cashflow1 (number, range<number>)`,E(`The first future cash flow.`)),Y(`cashflow2 (number, range<number>, repeating)`,E(`Additional future cash flows.`))],compute:function(e,...t){let n=F(e,this.locale);return N(()=>n!==-1,E(`The discount (%s) must be different from -1.`,n.toString())),{value:jS(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},NS={description:E(`Computes the number of periods needed for an investment to reach a value.`),args:[Y(`rate (number)`,E(`The rate at which the investment grows each period.`)),Y(`present_value (number)`,E(`The investment's current value.`)),Y(`future_value (number)`,E(`The investment's desired future value.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return Ox(r),N(()=>i>0,E(`The present_value (%s) must be strictly positive.`,i.toString())),N(()=>a>0,E(`The future_value (%s) must be strictly positive.`,a.toString())),(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function PS(e,t,n,r,i){if(Dx(t),e===0)return-(r+n)/t;let a=-(n*(1+e)**t+r);return a=a*e/((1+e*i)*((1+e)**t-1)),a}let FS={description:E(`Periodic payment for an annuity investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){let a=F(t,this.locale),o=F(e,this.locale),s=+!!L(i),c=F(r,this.locale);return{value:PS(o,a,F(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function IS(e,t,n,r,i,a){Dx(n),N(()=>t>0&&t<=n,E(`The period must be between 1 and number_of_periods (%s)`,n));let o=PS(e,n,r,i,a);return a===1&&t===1?o:o+-vS(e,a===0?t-1:t-2,o,r+o*a,0)*e}let LS={description:E(`Payment on the principal of an investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`period (number)`,E(`The amortization period, in terms of number of periods.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=F(n,this.locale),s=F(e,this.locale),c=F(t,this.locale),l=+!!L(a),u=F(i,this.locale);return{value:IS(s,c,o,F(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},RS={description:E(`Present value of an annuity investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_amount (number)`,E(`The amount per period to be paid.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);return{value:a?-(s*(1+a*l)*((1+a)**o-1)/a+c)/(1+a)**o:-(c+s*o),format:`#,##0.00`}},isExported:!0},zS={description:E(`Price of a security paying periodic interest.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));xx(s,c),Cx(f),wx(p),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),N(()=>u>=0,E(`The yield (%s) must be positive or null.`,u.toString())),Tx(d);let m=hi(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=1+u/f,v=100*l/f;if(h===1)return(v+d)/(g*u/f+1)-v*(1-g);let ee=0;for(let e=1;e<=h;e++)ee+=v/_**(e-1+g);return d/_**(h-1+g)+ee-v*(1-g)},isExported:!0},BS={description:E(`Price of a discount security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the security at time of purchase.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Vx(s),Tx(c);let u=hi(a,o,l);return c-s*c*u},isExported:!0},VS={description:E(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));Sx(o,c),xx(o,s),wx(d),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),N(()=>u>=0,E(`The yield (%s) must be positive or null.`,u.toString()));let f=hi(o,s,d),p=hi(o,c,d),m=100+hi(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},HS=.1,US={description:E(`Interest rate of an annuity investment.`),args:[Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_per_period (number)`,E(`The amount per period to be paid.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`)),Y(`rate_guess (number, default=${HS})`,E(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:HS}){let o=F(e,this.locale),s=F(t,this.locale),c=+!!L(i),l=F(a,this.locale)||HS,u=F(r,this.locale),d=F(n,this.locale);return Dx(o),N(()=>[s,d,u].some(e=>e>0)&&[s,d,u].some(e=>e<0),E(`There must be both positive and negative values in [payment_amount, present_value, future_value].`,o.toString())),qx(l),u-=s*c,d+=s*c,{value:$x(e=>{let t=(1+e)**+o,n=(t-1)/e;return u+d*t+s*n},e=>{let t=(1+e)**(o-1),n=((1+e)**+o-1)/e,r=o*t/e-n/e;return d*o*t+s*r},l,40,1e-5),format:`0%`}},isExported:!0},WS={description:E(`Amount received at maturity for a security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`investment (number)`,E(`The amount invested (irrespective of face value of each security).`)),Y(`discount (number)`,E(`The discount rate of the security invested in.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));return xx(a,o),wx(l),Bx(s),Vx(c),s/(1-c*hi(a,o,l))},isExported:!0},GS={description:E(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[Y(`number_of_periods (number)`,E(`The number of periods.`)),Y(`present_value (number)`,E(`The present value of the investment.`)),Y(`future_value (number)`,E(`The future value of the investment.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return Dx(r),(a/i)**(1/r)-1},isExported:!0},KS={description:E(`Depreciation of an asset using the straight-line method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},qS={description:E(`Depreciation via sum of years digit method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);Px(s),kx(o),zx(s,o);let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function JS(e,t,n){return 100*(1-n*hi(e,t,2))}let YS={description:E(`Price of a US Treasury bill.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);return xx(r,i),Wx(r,i,this.locale),Vx(a),Hx(a),JS(r,i,a)},isExported:!0},XS={description:E(`Equivalent rate of return for a US Treasury bill.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);xx(r,i),Wx(r,i,this.locale),Vx(a),Hx(a);let o=Pb.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=JS(r,i,a)/100,c=o/(o===366?366:365);return(-2*c+2*Math.sqrt(c**2-(2*c-1)*(1-1/s)))/(2*c-1)},isExported:!0},ZS={description:E(`The yield of a US Treasury bill based on price.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);xx(r,i),Wx(r,i,this.locale),Ex(a);let o=hi(r,i,2);return(100-a)/a*(1/o)},isExported:!0},QS={description:E(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`start (number)`,E(`Starting period to calculate depreciation.`)),Y(`end (number)`,E(`Ending period to calculate depreciation.`)),Y(`factor (number, default=2)`,E(`The number of months in the first year of depreciation.`)),Y(`no_switch (number, default=false)`,E(`Whether to switch to straight-line depreciation when the depreciation is greater than the declining balance calculation.`))],compute:function(e,t,n,r,i,a={value:2},o={value:!1}){a||=0;let s=F(e,this.locale),c=F(t,this.locale),l=F(n,this.locale),u=Math.trunc(F(r,this.locale)),d=Math.trunc(F(i,this.locale)),f=F(a,this.locale),p=L(o);if(Nx(s),Ix(c),Kx(u,d,l),Ux(f),s===0)return 0;if(c>=s)return u<1?s-c:0;let m=f/l;if(m>=1)return u<1?s-c:0;let h=s,g=0,_=0,v=!1;for(let e=0;e<d;e++){if(!v||p){let t=h*m,n=l-e,r=(h-c)/n;!p&&r>t?(v=!0,g=r):g=t}let t=Math.max(h-g,c);e>=u&&(_+=h-t),h=t}return _},isExported:!0},$S={description:E(`Internal rate of return given non-periodic cash flows.`),args:[Y(`cashflow_amounts (range<number>)`,E(`An range containing the income or payments associated with the investment.`)),Y(`cashflow_dates (range<number>)`,E(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),Y(`rate_guess (number, default=${HS})`,E(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:HS}){let r=F(n,this.locale),i=e.flat().map(e=>F(e,this.locale)),a=t.flat().map(e=>F(e,this.locale));Jx(e,t),Yx(i),Xx(a),qx(r);let o=new Map;for(let e of x(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e));return $x(e=>{let t=c[0];for(let n of x(1,c.length)){let r=(s[0]-s[n])/365;t+=c[n]*(1+e)**r}return t},e=>{let t=0;for(let n of x(1,c.length)){let r=(s[0]-s[n])/365;t+=r*c[n]*(1+e)**(r-1)}return t},r,40,1e-5,e=>e?e/10-.9:-.9)},isExported:!0},eC={description:E(`Net present value given to non-periodic cash flows..`),args:[Y(`discount (number)`,E(`The discount rate of the investment over one period.`)),Y(`cashflow_amounts (number, range<number>)`,E(`An range containing the income or payments associated with the investment.`)),Y(`cashflow_dates (number, range<number>)`,E(`An range with dates corresponding to the cash flows in cashflow_amounts.`))],compute:function(e,t,n){let r=F(e,this.locale),i=A(t)?t.flat().map(e=>ha(e,this.locale)):[ha(t,this.locale)],a=A(n)?n.flat().map(e=>ha(e,this.locale)):[ha(n,this.locale)];if(A(n)&&A(t)?Jx(t,n):N(()=>i.length===a.length,E(`There must be the same number of values in cashflow_amounts and cashflow_dates.`)),Xx(a),Ox(r),i.length===1)return i[0];let o=new Map;for(let e of x(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e)),l=c[0];for(let e of x(1,c.length)){let t=(s[0]-s[e])/365;l+=c[e]*(1+r)**t}return l},isExported:!0},tC={description:E(`Annual yield of a security paying periodic interest.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));xx(s,c),Cx(f),wx(p),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),Ex(u),Tx(d);let m=hi(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=100*l/f;if(h===1){let e=u+_*(1-g);return(d+_-e)*f*(1/g)/e}function v(e,t,n,r,i,a){let o=a-(e+i*(1-t))*r**(n-1+t);for(let e=1;e<=n;e++)o+=i*r**(e-1);return o}function ee(e,t,n,r,i){let a=-(e+i*(1-t))*(n-1+t)*r**(n-2+t);for(let e=1;e<=n;e++)a+=i*(e-1)*r**(e-2);return a}function te(e){return v(u,g,h,e,_,d)}function ne(e){return ee(u,g,h,e,_)}return($x(te,ne,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},nC={description:E(`Annual yield of a discount security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Ex(s),Tx(c);let u=hi(a,o,l);return(c/s-1)/u},isExported:!0},rC={description:E(`Annual yield of a security paying interest at maturity.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`price (number)`,E(`The price at which the security is bought.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));xx(o,s),wx(d),N(()=>o>=c,E(`The settlement (%s) must be greater than or equal to the issue (%s).`,o.toString(),c.toString())),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),Ex(u);let f=hi(c,s,d),p=hi(c,o,d),m=hi(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0},iC=/[a-zA-Z0-9\_]+(\.[a-zA-Z0-9\_]+)*/,aC=[`-`,`+`],oC=[`%`],sC=[`*`,`+`,`&`],cC={"^":30,"%":30,"*":20,"/":20,"+":15,"-":15,"&":13,">":10,"<>":10,">=":10,"<":10,"<=":10,"=":10};function lC(e){let t=e.shift();if(!t)throw new na;switch(t.type){case`DEBUGGER`:let n=pC(e,1e3);return n.debug=!0,n;case`NUMBER`:return{type:`NUMBER`,value:Ai(t.value,k)};case`STRING`:return{type:`STRING`,value:et(t.value)};case`INVALID_REFERENCE`:return{type:`REFERENCE`,value:j.InvalidReference};case`REFERENCE`:if(e[0]?.value===`:`&&e[1]?.type===`REFERENCE`){e.shift();let n=e.shift();return{type:`REFERENCE`,value:`${t.value}:${n?.value}`}}return{type:`REFERENCE`,value:t.value};case`SYMBOL`:let r=t.value;if(e[0]?.type===`LEFT_PAREN`&&iC.test(t.value)&&r===at(r,`'`))return{type:`FUNCALL`,value:r,args:uC(e)};let i=r.toUpperCase();return i===`TRUE`||i===`FALSE`?{type:`BOOLEAN`,value:i===`TRUE`}:{type:`SYMBOL`,value:at(t.value,`'`)};case`LEFT_PAREN`:let a=pC(e);return fC(e,`RIGHT_PAREN`,E(`Missing closing parenthesis`)),a;case`OPERATOR`:let o=t.value;if(aC.includes(o))return{type:`UNARY_OPERATION`,value:o,operand:pC(e,cC[o])};throw new na(E(`Unexpected token: %s`,t.value));default:throw new na(E(`Unexpected token: %s`,t.value))}}function uC(e){if(fC(e,`LEFT_PAREN`,E(`Missing opening parenthesis`)),e[0]?.type===`RIGHT_PAREN`)return fC(e,`RIGHT_PAREN`),[];let t=[];for(t.push(dC(e));e[0]?.type!==`RIGHT_PAREN`;)fC(e,`ARG_SEPARATOR`,E(`Wrong function call`)),t.push(dC(e));return fC(e,`RIGHT_PAREN`),t}function dC(e){let t=e[0];return t?.type===`ARG_SEPARATOR`||t?.type===`RIGHT_PAREN`?{type:`EMPTY`,value:``}:pC(e)}function fC(e,t,n){let r=e.shift();if(!r||r.type!==t)throw new na(n)}function pC(e,t=0){if(e.length===0)throw new na;let n=lC(e);for(;e[0]?.type===`OPERATOR`&&cC[e[0].value]>t;){let t=e.shift().value;if(oC.includes(t))n={type:`UNARY_OPERATION`,value:t,operand:n,postfix:!0};else{let r=pC(e,cC[t]);n={type:`BIN_OPERATION`,value:t,left:n,right:r}}}return n}function mC(e){return hC(Mh(e))}function hC(e){e=e.filter(e=>e.type!==`SPACE`),e[0]?.value===`=`&&e.splice(0,1);let t=pC(e);if(e.length)throw new na;return t}function gC(e,t,n){return yC(e,e=>e.type===t?n(e):e)}function _C(e){return Array.from(vC(e))}function*vC(e){switch(yield e,e.type){case`FUNCALL`:for(let t of e.args)yield*vC(t);break;case`UNARY_OPERATION`:yield*vC(e.operand);break;case`BIN_OPERATION`:yield*vC(e.left),yield*vC(e.right);break}}function yC(e,t){switch(e=t(e),e.type){case`FUNCALL`:return{...e,args:e.args.map(e=>yC(e,t))};case`UNARY_OPERATION`:return{...e,operand:yC(e.operand,t)};case`BIN_OPERATION`:return{...e,right:yC(e.right,t),left:yC(e.left,t)};default:return e}}function bC(e){switch(e.type){case`FUNCALL`:let t=e.args.map(e=>bC(e));return`${e.value}(${t.join(`,`)})`;case`NUMBER`:return e.value.toString();case`REFERENCE`:return e.value;case`STRING`:return`"${e.value}"`;case`BOOLEAN`:return e.value?`TRUE`:`FALSE`;case`UNARY_OPERATION`:return e.postfix?xC(e)+e.value:e.value+SC(e);case`BIN_OPERATION`:return xC(e)+e.value+SC(e);default:return e.value}}function xC(e){let t=e.value,n=`left`in e?e.left:e.operand,r=n.value;return n.type===`BIN_OPERATION`&&cC[r]<cC[t]?`(${bC(n)})`:bC(n)}function SC(e){let t=e.value,n=`right`in e?e.right:e.operand,r=cC[n.value],i=cC[t],a=!1;return n.type===`BIN_OPERATION`?(r<i||r===i&&!sC.includes(t))&&(a=!0):a=!1,a?`(${bC(n)})`:bC(n)}function CC(e){let t=0;return e.map(e=>{let n=e.value.toString().length,r=Object.assign({},e,{start:t,end:t+n,length:n});return t=r.end,r})}function wC(e){let t=1,n=[];return e.map(e=>(e.type===`LEFT_PAREN`?(n.push(t),e.parenIndex=t,t++):e.type===`RIGHT_PAREN`&&(e.parenIndex=n.pop()),e))}function TC(e){let t=[],n=``;function r(e){if(t.length===0)return;let n=t.at(-1);if(n&&n.argsTokens){let{argsTokens:t,argPosition:r}=n;t[r]||(t[r]=[]),t[r].push({value:e.value,type:e.type})}}return e.map((e,i)=>{switch([`SPACE`,`LEFT_PAREN`].includes(e.type)||(n=``),e.type){case`SYMBOL`:r(e),n=e.value;break;case`LEFT_PAREN`:t.push({parent:n,argPosition:0,argsTokens:[],args:[]}),r(e),n=``;break;case`RIGHT_PAREN`:t.pop()?.argsTokens?.flat().forEach(r),r(e);break;case`ARG_SEPARATOR`:r(e),t.length&&t[t.length-1].argPosition++;break;default:r(e);break}if(t.length){let n=t[t.length-1];n.parent&&(e.functionContext=Object.assign({},n))}return e})}function EC(e){for(let t of e)if(t.functionContext){let{argsTokens:e,args:n}=t.functionContext;if(delete t.functionContext.argsTokens,n.length||!e)continue;e[0]?.[0]?.type===`LEFT_PAREN`&&(e[0]=e[0].slice(1));for(let t of e){let e=t;e.at(-1)?.type===`ARG_SEPARATOR`&&(e=e.slice(0,-1));try{n.push(hC(e))}catch{n.push(void 0)}}}return e}function DC(e,t){return EC(TC(wC(CC(Mh(e,t)))))}function OC(e){if(e.type!==`REFERENCE`)return e;let{xc:t,sheetName:n}=Vs(e.value),[r,i]=t.split(`:`),a=kC(r),o=i?`:${kC(i)}`:``;return{...e,value:Hs(n,a+o)}}function kC(e){switch(jC(e)){case`none`:e=AC(e,`colrow`);break;case`colrow`:e=AC(e,`row`);break;case`row`:e=AC(e,`col`);break;case`col`:e=AC(e,`none`);break}return e}function AC(e,t){if(e.includes(`!`))throw Error(`The given XC should not contain a sheet name`);e=e.replace(/\$/g,``);let n;switch(t){case`col`:return`$`+e;case`row`:return n=e.search(/[0-9]/),e.slice(0,n)+`$`+e.slice(n);case`colrow`:return n=e.search(/[0-9]/),n===-1||n===0||(e=e.slice(0,n)+`$`+e.slice(n)),`$`+e;case`none`:return e}}function jC(e){return PC(e)?`colrow`:MC(e)?`col`:NC(e)?`row`:`none`}function MC(e){return e.startsWith(`$`)}function NC(e){return e.includes(`$`,1)}function PC(e){return e.startsWith(`$`)&&e.length>1&&e.slice(1).includes(`$`)}function FC(e,t,n){let r=(t.startsWith(`=`)?DC(t,n):[]).filter(t=>t.start<=e.start&&t.end>=e.start||t.start>=e.start&&t.start<e.end),i=r.filter(e=>e.type===`REFERENCE`);if(i.length===0)return;let a=r.map(OC).map(e=>e.value).join(``),o=r[0].start,s=r[r.length-1].end,c=t.slice(0,o)+a+t.slice(s),l=c.length-t.length,u={start:i[0].start,end:i[i.length-1].end+l};return i.length===1&&e.start===e.end&&(u.start=u.end),{content:c,selection:u}}var IC=l({CELL:()=>RC,ISBLANK:()=>KC,ISERR:()=>zC,ISERROR:()=>BC,ISLOGICAL:()=>VC,ISNA:()=>HC,ISNONTEXT:()=>UC,ISNUMBER:()=>WC,ISTEXT:()=>GC,NA:()=>qC});let LC=[`address`,`col`,`contents`,`format`,`row`,`type`],RC={description:E(`Gets information about a cell.`),args:[Y(`info_type (string)`,E(`The type of information requested. Can be one of %s`,LC.join(`, `))),Y(`reference (meta)`,E(`The reference to the cell.`))],compute:function(e,t){let n=I(e).toLowerCase();N(()=>LC.includes(n),E(`The info_type should be one of %s.`,LC.join(`, `)));let r=this.__originSheetId,i=I(t),{sheetName:a,xc:o}=Vs(i.includes(`:`)?i.split(`:`)[0]:i);a=a===this.getters.getSheetName(r)?void 0:a;let s=Hs(a,AC(o,`colrow`)),c=this.getters.getRangeFromSheetXC(r,s);switch(n){case`address`:return this.getters.getRangeString(c,r);case`col`:return c.zone.left+1;case`contents`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top};return this.getters.getEvaluatedCell(e).value}case`format`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top};return this.getters.getEvaluatedCell(e).format||``}case`row`:return c.zone.top+1;case`type`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top},t=this.getters.getEvaluatedCell(e).type;return t===`empty`?`b`:t===`text`?`l`:`v`}}return``},isExported:!0},zC={description:E(`Whether a value is an error other than #N/A.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)&&t!==j.NotAvailable},isExported:!0},BC={description:E(`Whether a value is an error.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)},isExported:!0},VC={description:E("Whether a value is `true` or `false`."),args:[Y(`value (any)`,E(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},HC={description:E(`Whether a value is the error #N/A.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},UC={description:E(`Whether a value is non-textual.`),args:[Y(`value (any)`,E(`The value to be checked.`))],compute:function(e){return!GC.compute.bind(this)(e)},isExported:!0},WC={description:E(`Whether a value is a number.`),args:[Y(`value (any)`,E(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},GC={description:E(`Whether a value is text.`),args:[Y(`value (any)`,E(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&P(e?.value)===!1},isExported:!0},KC={description:E(`Whether the referenced cell is empty`),args:[Y(`value (any)`,E(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},qC={description:E(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0};var JC=l({AND:()=>YC,FALSE:()=>XC,IF:()=>ZC,IFERROR:()=>QC,IFNA:()=>$C,IFS:()=>ew,NOT:()=>tw,OR:()=>nw,TRUE:()=>rw,XOR:()=>iw});let YC={description:E("Logical `and` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that represent logical values.`))],compute:function(...e){let{result:t,foundBoolean:n}=vl(e);return N(()=>n,E(`[[FUNCTION_NAME]] has no valid input data.`)),t},isExported:!0},XC={description:E("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},ZC={description:E(`Returns value depending on logical expression.`),args:[Y(`logical_expression (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.`)),Y(`value_if_true (any, range)`,E(`The value the function returns if logical_expression is TRUE.`)),Y(`value_if_false (any, range, default=FALSE)`,E(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){if(Ol(e))return Fa(ZC.compute,[e,t,n]);let r=L(El(e))?t:n;return Ol(r)||(r=El(r)),r===void 0?{value:``}:!A(r)&&r.value===null?{...r,value:``}:r},isExported:!0},QC={description:E(`Value if it is not an error, otherwise 2nd argument.`),args:[Y(`value (any, range)`,E(`The value to return if value itself is not an error.`)),Y(`value_if_error (any, range, default="empty")`,E(`The value the function returns if value is an error.`))],compute:function(e,t){if(Ol(e))return Fa(QC.compute,[e,t]);let n=P(El(e)?.value)?t:e;return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n},isExported:!0},$C={description:E(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[Y(`value (any, range)`,E(`The value to return if value itself is not #N/A an error.`)),Y(`value_if_error (any, range, default="empty")`,E(`The value the function returns if value is an #N/A error.`))],compute:function(e,t){if(Ol(e))return Fa($C.compute,[e,t]);let n=El(e)?.value===j.NotAvailable?t:e;return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n},isExported:!0},ew={description:E(`Returns a value depending on multiple logical expressions.`),args:[Y(`condition1 (boolean, range<boolean>)`,E(`The first condition to be evaluated. This can be a boolean, a number, an array, or a reference to any of those.`)),Y(`value1 (any, range)`,E(`The returned value if condition1 is TRUE.`)),Y(`condition2 (boolean, any, range, repeating)`,E(`Additional conditions to be evaluated if the previous ones are FALSE.`)),Y(`value2 (any, range, repeating)`,E(`Additional values to be returned if their corresponding conditions are TRUE.`))],compute:function(...e){for(N(()=>e.length%2==0,E(`Wrong number of arguments. Expected an even number of arguments.`));e.length>0;){if(Ol(e[0]))return Fa(ew.compute,e);let t=L(El(e.shift())),n=e.shift();if(t)return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n}return new M(E(`No match.`))},isExported:!0},tw={description:E(`Returns opposite of provided logical value.`),args:[Y(`logical_expression (boolean)`,E(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!L(e)},isExported:!0},nw={description:E("Logical `or` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that evaluate to logical values.`))],compute:function(...e){let{result:t,foundBoolean:n}=yl(e);return N(()=>n,E(`[[FUNCTION_NAME]] has no valid input data.`)),t},isExported:!0},rw={description:E("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},iw={description:E("Logical `xor` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that evaluate to logical values.`))],compute:function(...e){let t=!1,n=!1;return La(e,e=>(t=!0,n=n?!e:e,!0)),N(()=>t,E(`[[FUNCTION_NAME]] has no valid input data.`)),n},isExported:!0};function aw(e,t){let n=t.getPivotId(e);if(!n)throw new M(E(`There is no pivot with id "%s"`,e));return n}function ow(e,t,n){let{measures:r}=n.getPivotCoreDefinition(e);if(!r.find(e=>e.id===t))throw new M(E(`The argument %s is not a valid measure. Here are the measures: %s`,t,`(${r.map(e=>e.id).join(`, `)})`))}function sw(e){if(e.length%2!=0)throw new M(E(`Function PIVOT takes an even number of arguments.`))}function cw(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=tr(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new ia;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&fr(D(e.__originCellPosition),n))throw new ra;r.push(o)}for(let i of n)i.computedBy&&r.push(...e.getters.getMeasureFullDependencies(t,i));let a=e.__originCellPosition;a&&r.length&&(e.updateDependencies?.(a),e.addDependencies?.(a,r))}var lw=l({ADDRESS:()=>dw,COLUMN:()=>fw,COLUMNS:()=>pw,HLOOKUP:()=>mw,INDEX:()=>hw,INDIRECT:()=>gw,LOOKUP:()=>_w,MATCH:()=>vw,OFFSET:()=>Dw,PIVOT:()=>Ew,PIVOT_HEADER:()=>Tw,PIVOT_VALUE:()=>ww,ROW:()=>yw,ROWS:()=>bw,VLOOKUP:()=>xw,XLOOKUP:()=>Cw});function uw(e){return{value:j.NotAvailable,message:E(`Did not find value '%s' in [[FUNCTION_NAME]] evaluation.`,I(e))}}let dw={description:E(`Returns a cell reference as a string. `),args:[Y(`row (number)`,E(`The row number of the cell reference. `)),Y(`column (number)`,E(`The column number (not name) of the cell reference. A is column number 1. `)),Y(`absolute_relative_mode (number, default=1)`,E(`An indicator of whether the reference is row/column absolute. 1 is row and column absolute (e.g. $A$1), 2 is row absolute and column relative (e.g. A$1), 3 is row relative and column absolute (e.g. $A1), and 4 is row and column relative (e.g. A1).`)),Y(`use_a1_notation (boolean, default=TRUE)`,E(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`)),Y(`sheet (string, optional)`,E(`A string indicating the name of the sheet into which the address points.`))],compute:function(e,t,n={value:1},r={value:!0},i){let a=_a(e,this.locale),o=_a(t,this.locale);va(a),va(o);let s=_a(n,this.locale);N(()=>[1,2,3,4].includes(s),da(1,4,s));let c=L(r),l;if(c){let e={rowFixed:!![1,2].includes(s),colFixed:!![1,3].includes(s)};l=w(o-1,a-1,e)}else l=([1,2].includes(s)?`R${a}`:`R[${a}]`)+([1,3].includes(s)?`C${o}`:`C[${o}]`);return i===void 0?l:Hs(I(i),l)},isExported:!0},fw={description:E(`Column number of a specified cell.`),args:[Y(`cell_reference (meta, default='this cell')`,E(`The cell whose column number will be returned. Column A corresponds to 1. By default, the function use the cell in which the formula is entered.`))],compute:function(e){if(P(e?.value))return e;if(e===void 0)return N(()=>this.__originCellPosition?.col!==void 0,`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`),this.__originCellPosition.col+1;let t=this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(),e.value).zone;return t.left===t.right?t.left+1:ja(t.right-t.left+1,1,(e,n)=>({value:t.left+e+1}))},isExported:!0},pw={description:E(`Number of columns in a specified array or range.`),args:[Y(`range (meta)`,E(`The range whose column count will be returned.`))],compute:function(e){if(P(e?.value))return e;let t=Qn(e.value);return t.right-t.left+1},isExported:!0},mw={description:E(`Horizontal lookup`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The range to consider for the search. The first row in the range is searched for the key specified in search_key.`)),Y(`index (number)`,E(`The row index of the value to be returned, where the first row in range is numbered 1.`)),Y(`is_sorted (boolean, default=true)`,E(`Indicates whether the row to be searched (the first row of the specified range) is sorted, in which case the closest match for search_key will be returned.`))],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=z(t);N(()=>1<=i&&i<=a[0].length,E(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[t][0].value,s=a[L(r.value)?Ha(a,e,`nextSmaller`,`asc`,a.length,o):Ua(t,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?uw(e):s[i-1]},isExported:!0},hw={description:E(`Returns the content of a cell, specified by row and column offset.`),args:[Y(`reference (any, range)`,E(`The range of cells from which the values are returned.`)),Y(`row (number, default=0)`,E(`The index of the row to be returned from within the reference range of cells.`)),Y(`column (number, default=0)`,E(`The index of the column to be returned from within the reference range of cells.`))],compute:function(e,t={value:0},n={value:0}){let r=z(e),i=F(t.value,this.locale),a=F(n.value,this.locale);return N(()=>a>=0&&a-1<r.length&&i>=0&&i-1<r[0].length,E(`Index out of range.`)),i===0&&a===0?r:i===0?[r[a-1]]:a===0?r.map(e=>[e[i-1]]):r[a-1][i-1]},isExported:!0},gw={description:E(`Returns the content of a cell, specified by a string.`),args:[Y(`reference (string)`,E(`The range of cells from which the values are returned.`)),Y(`use_a1_notation (boolean, default=TRUE)`,E(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`))],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new ia(E(`Reference should be defined.`));if(!L(t))return new M(E(`R1C1 notation is not supported.`));let r=this.__originSheetId,i=this.__originCellPosition;i&&this.updateDependencies?.(i);let a=this.getters.getRangeFromSheetXC(r,n);if(a===void 0||a.invalidXc||a.invalidSheetName)return new ia;i&&this.addDependencies?.(i,[a]);let o=[];for(let e=a.zone.left;e<=a.zone.right;e++){let t=[];for(let n=a.zone.top;n<=a.zone.bottom;n++){let r={sheetId:a.sheetId,col:e,row:n};t.push(this.getters.getEvaluatedCell(r))}o.push(t)}return o.length===1&&o[0].length===1?o[0][0]:o},isExported:!0},_w={description:E(`Look up a value.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`search_array (any, range)`,E(`One method of using this function is to provide a single sorted row or column search_array to look through for the search_key with a second argument result_range. The other way is to combine these two arguments into one search_array where the first row or column is searched and a value is returned from the last row or column in the array. If search_key is not found, a non-exact match may be returned.`)),Y(`result_range (any, range, optional)`,E(`The range from which to return a result. The value returned corresponds to the location where search_key is found in search_range. This range must be only a single row or column and should not be used if using the search_result_array method.`))],compute:function(e,t,n){let r=z(t),i=z(n),a=r.length,o=r[0].length,s=o>=a,c=Ha(r,e,`nextSmaller`,`asc`,s?o:a,s?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value);return c===-1||s&&r[0][c]===void 0||!s&&r[c][o-1]===void 0?uw(e):i[0].length===0?s?r[a-1][c]:r[c][o-1]:(a=i.length,o=i[0].length,N(()=>a===1||o===1,E(`The result_range must be a single row or a single column.`)),a>1?(N(()=>c<=a-1,E(`[[FUNCTION_NAME]] evaluates to an out of range row value %s.`,(c+1).toString())),i[c][0]):(N(()=>c<=o-1,E(`[[FUNCTION_NAME]] evaluates to an out of range column value %s.`,(c+1).toString())),i[0][c]))},isExported:!0},vw={description:E(`Position of item in range that matches value.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The one-dimensional array to be searched.`)),Y(`search_type (number, default=1)`,E(`The search method. 1 (default) finds the largest value less than or equal to search_key when range is sorted in ascending order. 0 finds the exact value when range is unsorted. -1 finds the smallest value greater than or equal to search_key when range is sorted in descending order.`))],compute:function(e,t,n={value:1}){let r=F(n,this.locale),i=z(t),a=i.length,o=i[0].length;N(()=>a===1||o===1,E(`The range must be a single row or a single column.`));let s=-1,c=a===1?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,l=a===1?i[0].length:i.length;switch(r=Math.sign(r),r){case 1:s=Ha(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Ua(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=Ha(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?uw(e):s+1},isExported:!0},yw={description:E(`Row number of a specified cell.`),args:[Y(`cell_reference (meta, default='this cell')`,E(`The cell whose row number will be returned. By default, this function uses the cell in which the formula is entered.`))],compute:function(e){if(P(e?.value))return e;if(e===void 0)return N(()=>this.__originCellPosition?.row!==void 0,`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`),this.__originCellPosition.row+1;let t=this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(),e.value).zone;return t.top===t.bottom?t.top+1:ja(1,t.bottom-t.top+1,(e,n)=>({value:t.top+n+1}))},isExported:!0},bw={description:E(`Number of rows in a specified array or range.`),args:[Y(`range (meta)`,E(`The range whose row count will be returned.`))],compute:function(e){if(P(e?.value))return e;let t=Qn(e.value);return t.bottom-t.top+1},isExported:!0},xw={description:E(`Vertical lookup.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The range to consider for the search. The first column in the range is searched for the key specified in search_key.`)),Y(`index (number)`,E(`The column index of the value to be returned, where the first column in range is numbered 1.`)),Y(`is_sorted (boolean, default=true)`,E(`Indicates whether the column to be searched (the first column of the specified range) is sorted, in which case the closest match for search_key will be returned.`))],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=z(t);N(()=>1<=i&&i<=a.length,E(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[0][t].value,s=L(r.value)?Ha(a,e,`nextSmaller`,`asc`,a[0].length,o):Ua(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?uw(e):c},isExported:!0},Sw={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},Cw={description:E(`Search a range for a match and return the corresponding item from a second range.`),args:[Y(`search_key (string,number,boolean)`,E(`The value to search for.`)),Y(`lookup_range (any, range)`,E(`The range to consider for the search. Should be a single column or a single row.`)),Y(`return_range (any, range)`,E(`The range containing the return value. Should have the same dimensions as lookup_range.`)),Y(`if_not_found (any, optional)`,E(`If a valid match is not found, return this value.`)),Y(`match_mode (any, default=0)`,E(`(0) Exact match. (-1) Return next smaller item if no match. (1) Return next greater item if no match. (2) Wildcard match.`)),Y(`search_mode (any, default=1)`,E(`(1) Search starting at first item. (-1) Search starting at last item. (2) Perform a binary search that relies on lookup_array being sorted in ascending order. If not sorted, invalid results will be returned. (-2) Perform a binary search that relies on lookup_array being sorted in descending order. If not sorted, invalid results will be returned. `))],compute:function(e,t,n,r,i={value:0},a={value:1}){let o=Math.trunc(F(i.value,this.locale)),s=Math.trunc(F(a.value,this.locale)),c=z(t),l=z(n);N(()=>c.length===1||c[0].length===1,E(`lookup_range should be either a single row or single column.`)),N(()=>[-1,1,-2,2].includes(s),E(`search_mode should be a value in [-1, 1, -2, 2].`)),N(()=>[-1,0,1,2].includes(o),E(`match_mode should be a value in [-1, 0, 1, 2].`));let u=c.length===1?`col`:`row`;N(()=>!(o===2&&[-2,2].includes(s)),E(`the search and match mode combination is not supported for XLOOKUP evaluation.`)),N(()=>u===`col`?l[0].length===c[0].length:l.length===c.length,E(`return_range should have the same dimensions as lookup_range.`));let d=u===`col`?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,f=u===`col`?c[0].length:c.length,p=Sw[o],m=s===-1,h=s===2||s===-2?Ha(c,e,p,s===2?`asc`:`desc`,f,d):Ua(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?uw(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},ww={description:E(`Get the value from a pivot.`),args:[Y(`pivot_id (number,string)`,E(`ID of the pivot.`)),Y(`measure_name (string)`,E(`Name of the measure.`)),Y(`domain_field_name (string,optional,repeating)`,E(`Field name.`)),Y(`domain_value (number,string,boolean,optional,repeating)`,E(`Value.`))],compute:function(e,t,...n){let r=I(e),i=I(t),a=aw(r,this.getters);ow(a,i,this.getters),sw(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);cw(this,a,s.measures.filter(e=>e.id===i)),o.init({reload:o.needsReevaluation});let c=o.assertIsValid({throwOnError:!1});if(c)return c;if(!o.areDomainArgsFieldsValid(n)){let e=E(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${r})`);return{value:j.GenericError,message:E(`Dimensions don't match the pivot definition`)+`. `+e}}let l=o.parseArgsToPivotDomain(n);return this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(a)?.trackValue(i,l),o.getPivotCellValueAndFormat(i,l)}},Tw={description:E(`Get the header of a pivot.`),args:[Y(`pivot_id (number,string)`,E(`ID of the pivot.`)),Y(`domain_field_name (string,optional,repeating)`,E(`Field name.`)),Y(`domain_value (number,string,value,optional,repeating)`,E(`Value.`))],compute:function(e,...t){let n=I(e),r=aw(n,this.getters);sw(t);let i=this.getters.getPivot(r);cw(this,r,[]),i.init({reload:i.needsReevaluation});let a=i.assertIsValid({throwOnError:!1});if(a)return a;if(!i.areDomainArgsFieldsValid(t)){let e=E(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${n})`);return{value:j.GenericError,message:E(`Dimensions don't match the pivot definition`)+`. `+e}}let o=i.parseArgsToPivotDomain(t);this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(r)?.trackHeader(o);let s=o.at(-1);if(s?.field===`measure`)return i.getPivotMeasureValue(I(s.value),o);let{value:c,format:l}=i.getPivotHeaderValueAndFormat(o);return{value:c,format:!s||s.field===`measure`||s.value===`false`?void 0:l}}},Ew={description:E(`Get a pivot table.`),args:[Y(`pivot_id (string)`,E(`ID of the pivot.`)),Y(`row_count (number, optional)`,E(`number of rows`)),Y(`include_total (boolean, default=TRUE)`,E(`Whether to include total/sub-totals or not.`)),Y(`include_column_titles (boolean, default=TRUE)`,E(`Whether to include the column titles or not.`)),Y(`column_count (number, optional)`,E(`number of columns`))],compute:function(e,t={value:1e4},n={value:!0},r={value:!0},i={value:Number.MAX_VALUE}){let a=I(e),o=F(t,this.locale);if(o<0)return new M(E(`The number of rows must be positive.`));let s=F(i,this.locale);if(s<0)return new M(E(`The number of columns must be positive.`));let c=L(r),l=L(n),u=aw(a,this.getters),d=this.getters.getPivot(u),f=this.getters.getPivotCoreDefinition(u);cw(this,u,f.measures),d.init({reload:d.needsReevaluation});let p=d.assertIsValid({throwOnError:!1});if(p)return p;let m=d.getTableStructure(),h=m.getPivotCells(l,c),g=c?m.columns.length:0,_=this.getters.getPivotDisplayName(u),v=Math.min(g+o,h[0].length);if(v===0)return[[{value:_}]];let ee=Math.min(1+s,h.length),te=[];for(let e of x(0,ee)){te[e]=[];for(let t of x(0,v)){let n=h[e][t];switch(n.type){case`EMPTY`:te[e].push({value:``});break;case`HEADER`:let t=d.getPivotHeaderValueAndFormat(n.domain);te[e].push(Uu(d,n.domain,t));break;case`MEASURE_HEADER`:te[e].push(d.getPivotMeasureValue(n.measure,n.domain));break;case`VALUE`:te[e].push(d.getPivotCellValueAndFormat(n.measure,n.domain));break}}}return c&&(te[0][0]={value:_}),te}},Dw={description:E(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[Y(`cell_reference (meta)`,E(`The starting point from which to count the offset rows and columns.`)),Y(`offset_rows (number)`,E(`The number of rows to offset by.`)),Y(`offset_columns (number)`,E(`The number of columns to offset by.`)),Y(`height (number, default='height of cell_reference')`,E(`The number of rows of the range to return starting at the offset target.`)),Y(`width (number, default='width of cell_reference')`,E(`The number of columns of the range to return starting at the offset target.`))],compute:function(e,t,n,r,i){if(P(e?.value))return e;let a=e?.value;if(!a)return new M(`In this context, the function OFFSET needs to have a cell or range in parameter.`);let o=Qn(a),s=o.bottom-o.top+1,c=o.right-o.left+1;if(r){let e=F(r,this.locale);y_(E(`Height value is %(_height)s. It should be greater than or equal to 1.`,{_height:e}),e),s=e}if(i){let e=F(i,this.locale);y_(E(`Width value is %(_width)s. It should be greater than or equal to 1.`,{_width:e}),e),c=e}let{sheetName:l}=Vs(a),u=l&&this.getters.getSheetIdByName(l)||this.getters.getActiveSheetId(),d=F(t,this.locale),f=F(n,this.locale),p=this.__originCellPosition;p&&this.updateDependencies?.(p);let m=o.left+f,h=o.top+d;if(m<0||h<0)return new ia(E(`OFFSET evaluates to an out of bounds range.`));let g={left:m,top:h,right:m+c-1,bottom:h+s-1},_=this.getters.getRangeFromZone(u,g);return _.invalidXc||_.invalidSheetName?new ia:(p&&this.addDependencies?.(p,[_]),ja(c,s,(e,t)=>this.getters.getEvaluatedCell({sheetId:u,col:m+e,row:h+t})))}};var Ow=l({ADD:()=>kw,CONCAT:()=>Aw,DIVIDE:()=>jw,EQ:()=>Fw,GT:()=>Lw,GTE:()=>Rw,LT:()=>zw,LTE:()=>Bw,MINUS:()=>Vw,MULTIPLY:()=>Hw,NE:()=>Uw,POW:()=>Ww,UMINUS:()=>Gw,UNARY_PERCENT:()=>Kw,UPLUS:()=>qw});let kw={description:E(`Sum of two numbers.`),args:[Y(`value1 (number)`,E(`The first addend.`)),Y(`value2 (number)`,E(`The second addend.`))],compute:function(e,t){return{value:F(e,this.locale)+F(t,this.locale),format:e?.format||t?.format}}},Aw={description:E(`Concatenation of two values.`),args:[Y(`value1 (string)`,E(`The value to which value2 will be appended.`)),Y(`value2 (string)`,E(`The value to append to value1.`))],compute:function(e,t){return I(e)+I(t)},isExported:!0},jw={description:E(`One number divided by another.`),args:[Y(`dividend (number)`,E(`The number to be divided.`)),Y(`divisor (number)`,E(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return N(()=>n!==0,E(`The divisor must be different from zero.`),j.DivisionByZero),{value:F(e,this.locale)/n,format:e?.format||t?.format}}};function Mw(e){return e===void 0||e.value===null}let Nw={number:0,string:``,boolean:!1};function Pw(e,t,n=2e-16){return Math.abs(e-t)<n}let Fw={description:E(`Equal.`),args:[Y(`value1 (string, number, boolean)`,E(`The first value.`)),Y(`value2 (string, number, boolean)`,E(`The value to test against value1 for equality.`))],compute:function(e,t){let n=Mw(e)?Nw[typeof t?.value]:e?.value,r=Mw(t)?Nw[typeof e?.value]:t?.value;return typeof n==`string`&&(n=n.toUpperCase()),typeof r==`string`&&(r=r.toUpperCase()),typeof n==`number`&&typeof r==`number`?Pw(n,r):n===r}};function Iw(e,t,n){let r=Mw(e)?Nw[typeof t?.value]:e?.value,i=Mw(t)?Nw[typeof e?.value]:t?.value;if(P(r))throw e;if(P(i))throw t;typeof r!=`number`&&(r=I(r).toUpperCase()),typeof i!=`number`&&(i=I(i).toUpperCase());let a=typeof r,o=typeof i;return a===`string`&&o===`number`?!0:o===`string`&&a===`number`?!1:n(r,i)}let Lw={description:E(`Strictly greater than.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being greater than value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return Iw(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!Pw(e,t)&&e>t:e>t)}},Rw={description:E(`Greater than or equal to.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being greater than or equal to value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return Iw(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?Pw(e,t)||e>t:e>=t)}},zw={description:E(`Less than.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being less than value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return!Rw.compute.bind(this)(e,t)}},Bw={description:E(`Less than or equal to.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being less than or equal to value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return!Lw.compute.bind(this)(e,t)}},Vw={description:E(`Difference of two numbers.`),args:[Y(`value1 (number)`,E(`The minuend, or number to be subtracted from.`)),Y(`value2 (number)`,E(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:F(e,this.locale)-F(t,this.locale),format:e?.format||t?.format}}},Hw={description:E(`Product of two numbers`),args:[Y(`factor1 (number)`,E(`The first multiplicand.`)),Y(`factor2 (number)`,E(`The second multiplicand.`))],compute:function(e,t){return{value:F(e,this.locale)*F(t,this.locale),format:e?.format||t?.format}}},Uw={description:E(`Not equal.`),args:[Y(`value1 (string, number, boolean)`,E(`The first value.`)),Y(`value2 (string, number, boolean)`,E(`The value to test against value1 for inequality.`))],compute:function(e,t){return!Fw.compute.bind(this)(e,t)}},Ww={description:E(`A number raised to a power.`),args:[Y(`base (number)`,E(`The number to raise to the exponent power.`)),Y(`exponent (number)`,E(`The exponent to raise base to.`))],compute:function(e,t){return Lv.compute.bind(this)(e,t)}},Gw={description:E(`A number with the sign reversed.`),args:[Y(`value (number)`,E(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-F(e,this.locale),format:e?.format}}},Kw={description:E(`Value interpreted as a percentage.`),args:[Y(`percentage (number)`,E(`The value to interpret as a percentage.`))],compute:function(e){return F(e,this.locale)/100}},qw={description:E(`A specified number, unchanged.`),args:[Y(`value (any)`,E(`The number to return.`))],compute:function(e={value:null}){return e}},X=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),Jw={transform:e=>e,inverseTransform:e=>e},Yw=1e-10,Xw=.0254,Zw=Xw/72,Qw=.3048,$w=.9144,eT=1609.34,tT=1852,nT=946073047258e4,rT={g:{...Jw,category:`weight`},u:{...X(166053e-29),category:`weight`},grain:{...X(.0647989),category:`weight`},ozm:{...X(28.3495),category:`weight`},lbm:{...X(453.592),category:`weight`},stone:{...X(6350.29),category:`weight`},sg:{...X(14593.90294),category:`weight`},cwt:{...X(45359.237),category:`weight`},uk_cwt:{...X(50802.3),category:`weight`},ton:{...X(907184.74),category:`weight`},uk_ton:{...X(1016046.9),category:`weight`},m:{...Jw,category:`distance`},km:{...X(1e3),category:`distance`},ang:{...X(Yw),category:`distance`},Picapt:{...X(Zw),category:`distance`},pica:{...X(Xw/6),category:`distance`},in:{...X(Xw),category:`distance`},ft:{...X(Qw),category:`distance`},yd:{...X($w),category:`distance`},ell:{...X(1.143),category:`distance`},mi:{...X(eT),category:`distance`},survey_mi:{...X(1609.34),category:`distance`},Nmi:{...X(tT),category:`distance`},ly:{...X(nT),category:`distance`},parsec:{...X(0x6da012f95c9fd0),category:`distance`},sec:{...Jw,category:`time`},min:{...X(60),category:`time`},hr:{...X(3600),category:`time`},day:{...X(86400),category:`time`},yr:{...X(31556952),category:`time`},Pa:{...Jw,category:`pressure`},bar:{...X(1e5),category:`pressure`},mmHg:{...X(133.322),category:`pressure`},Torr:{...X(133.322),category:`pressure`},psi:{...X(6894.76),category:`pressure`},atm:{...X(101325),category:`pressure`},N:{...Jw,category:`force`},dyn:{...X(1e-5),category:`force`},pond:{...X(.00980665),category:`force`},lbf:{...X(4.44822),category:`force`},J:{...Jw,category:`energy`},eV:{...X(160218e-24),category:`energy`},e:{...X(1e-7),category:`energy`},flb:{...X(1.3558179483),category:`energy`},c:{...X(4.184),category:`energy`},cal:{...X(4.1868),category:`energy`},BTU:{...X(1055.06),category:`energy`},Wh:{...X(3600),category:`energy`},HPh:{...X(2684520),category:`energy`},W:{...Jw,category:`power`},PS:{...X(735.499),category:`power`},HP:{...X(745.7),category:`power`},T:{...Jw,category:`magnetism`},ga:{...X(1e-4),category:`magnetism`},K:{...Jw,category:`temperature`},C:{transform:e=>e+273.15,inverseTransform:e=>e-273.15,category:`temperature`},F:{transform:e=>(e-32)*5/9+273.15,inverseTransform:e=>(e-273.15)*9/5+32,category:`temperature`},Rank:{...X(5/9),category:`temperature`},Reau:{transform:e=>e*1.25+273.15,inverseTransform:e=>(e-273.15)/1.25,category:`temperature`},"m^3":{...Jw,category:`volume`,order:3},"ang^3":{...X(Yw**3),category:`volume`,order:3},"Picapt^3":{...X(Zw**3),category:`volume`,order:3},tsp:{...X(492892e-11),category:`volume`},tspm:{...X(5e-6),category:`volume`},tbs:{...X(14786764825785619e-21),category:`volume`},"in^3":{...X(Xw**3),category:`volume`,order:3},oz:{...X(295735295625e-16),category:`volume`},cup:{...X(237e-6),category:`volume`},pt:{...X(.0004731765),category:`volume`},uk_pt:{...X(568261e-9),category:`volume`},qt:{...X(.0009463529),category:`volume`},l:{...X(.001),category:`volume`},uk_qt:{...X(.0011365225),category:`volume`},gal:{...X(.0037854118),category:`volume`},uk_gal:{...X(.00454609),category:`volume`},"ft^3":{...X(Qw**3),category:`volume`,order:3},bushel:{...X(.0352390704),category:`volume`},barrel:{...X(.158987295),category:`volume`},"yd^3":{...X($w**3),category:`volume`,order:3},MTON:{...X(1.13267386368),category:`volume`},GRT:{...X(2.83168),category:`volume`},"mi^3":{...X(eT**3),category:`volume`,order:3},"Nmi^3":{...X(tT**3),category:`volume`,order:3},"ly^3":{...X(nT**3),category:`volume`,order:3},"m^2":{...Jw,category:`area`,order:2},"ang^2":{...X(Yw**2),category:`area`,order:2},"Picapt^2":{...X(Zw**2),category:`area`,order:2},"in^2":{...X(Xw**2),category:`area`,order:2},"ft^2":{...X(Qw**2),category:`area`,order:2},"yd^2":{...X($w**2),category:`area`,order:2},ar:{...X(100),category:`area`},Morgen:{...X(2500),category:`area`},uk_acre:{...X(4046.8564224),category:`area`},us_acre:{...X(4046.8726098743),category:`area`},ha:{...X(1e4),category:`area`},"mi^2":{...X(eT**2),category:`area`,order:2},"Nmi^2":{...X(tT**2),category:`area`,order:2},"ly^2":{...X(nT**2),category:`area`,order:2},bit:{...Jw,category:`information`},byte:{...X(8),category:`information`},"m/s":{...Jw,category:`speed`},"m/hr":{...X(1/3600),category:`speed`},"km/hr":{...X(1/3.6),category:`speed`},mph:{...X(.44704),category:`speed`},kn:{...X(.5144444444),category:`speed`},admkn:{...X(.5147733333),category:`speed`}},iT={shweight:`cwt`,lcwt:`uk_cwt`,hweight:`uk_cwt`,LTON:`uk_ton`,brton:`uk_ton`,pc:`parsec`,Pica:`Picapt`,d:`day`,mn:`min`,s:`sec`,p:`Pa`,at:`atm`,dy:`dyn`,ev:`eV`,hh:`HPh`,wh:`Wh`,btu:`BTU`,h:`HP`,cel:`C`,fah:`F`,kel:`K`,us_pt:`pt`,L:`l`,lt:`l`,ang3:`ang^3`,ft3:`ft^3`,in3:`in^3`,ly3:`ly^3`,m3:`m^3`,mi3:`mi^3`,yd3:`yd^3`,Nmi3:`Nmi^3`,Picapt3:`Picapt^3`,"Pica^3":`Picapt^3`,Pica3:`Picapt^3`,regton:`GRT`,ang2:`ang^2`,ft2:`ft^2`,in2:`in^2`,ly2:`ly^2`,m2:`m^2`,mi2:`mi^2`,Nmi2:`Nmi^2`,Picapt2:`Picapt^2`,"Pica^2":`Picapt^2`,Pica2:`Picapt^2`,yd2:`yd^2`,"m/h":`m/hr`,"m/sec":`m/s`},aT={"":1,Y:1e24,Z:1e21,E:0xde0b6b3a7640000,P:0x38d7ea4c68000,T:0xe8d4a51000,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-21,Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},oT={weight:E(`Weight`),distance:E(`Distance`),time:E(`Time`),pressure:E(`Pressure`),force:E(`Force`),energy:E(`Energy`),power:E(`Power`),magnetism:E(`Magnetism`),temperature:E(`Temperature`),volume:E(`Volume`),area:E(`Area`),information:E(`Information`),speed:E(`Speed`)};function sT(e){return oT[e]??``}function cT(e){for(let[t,n]of Object.entries(aT)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=rT[r];if(!i&&iT[r]&&(i=rT[iT[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var lT=l({CONVERT:()=>uT});let uT={description:E(`Converts a numeric value to a different unit of measure.`),args:[Y(`value (number)`,E(`the numeric value in start_unit to convert to end_unit`)),Y(`start_unit (string)`,E(`The starting unit, the unit currently assigned to value`)),Y(`end_unit (string)`,E(`The unit of measure into which to convert value`))],compute:function(e,t,n){let r=F(e,this.locale),i=I(t),a=I(n),o=cT(i),s=cT(a);return o?s?o.category===s.category?{value:s.inverseTransform(o.factor*o.transform(r))/s.factor,format:e?.format}:{value:j.GenericError,message:E(`Incompatible units of measure ('%s' vs '%s')`,sT(o.category),sT(s.category))}:{value:j.GenericError,message:E(`Invalid units of measure ('%s')`,a)}:{value:j.GenericError,message:E(`Invalid units of measure ('%s')`,i)}},isExported:!0};var dT=l({CHAR:()=>pT,CLEAN:()=>mT,CONCATENATE:()=>hT,EXACT:()=>gT,FIND:()=>_T,JOIN:()=>vT,LEFT:()=>yT,LEN:()=>bT,LOWER:()=>xT,MID:()=>ST,PROPER:()=>CT,REPLACE:()=>wT,RIGHT:()=>TT,SEARCH:()=>ET,SPLIT:()=>DT,SUBSTITUTE:()=>OT,TEXT:()=>MT,TEXTJOIN:()=>kT,TRIM:()=>AT,UPPER:()=>jT,VALUE:()=>NT});let fT=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,pT={description:E(`Gets character associated with number.`),args:[Y(`table_number (number)`,E(`The number of the character to look up from the current Unicode table in decimal format.`))],compute:function(e){let t=Math.trunc(F(e,this.locale));return N(()=>t>=1,E(`The table_number (%s) is out of range.`,t.toString())),String.fromCharCode(t)},isExported:!0},mT={description:E(`Remove non-printable characters from a piece of text.`),args:[Y(`text (string)`,E(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=I(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},hT={description:E(`Appends strings to one another.`),args:[Y(`string1 (string, range<string>)`,E(`The initial string.`)),Y(`string2 (string, range<string>, repeating)`,E(`More strings to append in sequence.`))],compute:function(...e){return Oa(e,(e,t)=>e+I(t),``)},isExported:!0},gT={description:E(`Tests whether two strings are identical.`),args:[Y(`string1 (string)`,E(`The first string to compare.`)),Y(`string2 (string)`,E(`The second string to compare.`))],compute:function(e,t){return I(e)===I(t)},isExported:!0},_T={description:E(`First position of string found in text, case-sensitive.`),args:[Y(`search_for (string)`,E(`The string to look for within text_to_search.`)),Y(`text_to_search (string)`,E(`The text to search for the first occurrence of search_for.`)),Y(`starting_at (number, default=1)`,E(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e),i=I(t),a=F(n,this.locale);N(()=>i!==``,E(`The text_to_search must be non-empty.`)),N(()=>a>=1,E(`The starting_at (%s) must be greater than or equal to 1.`,a.toString()));let o=i.indexOf(r,a-1);return N(()=>o>=0,E(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r.toString(),i)),o+1},isExported:!0},vT={description:E(`Concatenates elements of arrays with delimiter.`),args:[Y(`delimiter (string)`,E(`The character or string to place between each concatenated value.`)),Y(`value_or_array1 (string, range<string>)`,E(`The value or values to be appended using delimiter.`)),Y(`value_or_array2 (string, range<string>, repeating)`,E(`More values to be appended using delimiter.`))],compute:function(e,...t){let n=I(e);return Oa(t,(e,t)=>(e?e+n:``)+I(t),``)}},yT={description:E(`Substring from beginning of specified string.`),args:[Y(`text (string)`,E(`The string from which the left portion will be returned.`)),Y(`number_of_characters (number, optional)`,E(`The number of characters to return from the left side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;return N(()=>n>=0,E(`The number_of_characters (%s) must be positive or null.`,n.toString())),I(e).substring(0,n)},isExported:!0},bT={description:E(`Length of a string.`),args:[Y(`text (string)`,E(`The string whose length will be returned.`))],compute:function(e){return I(e).length},isExported:!0},xT={description:E(`Converts a specified string to lowercase.`),args:[Y(`text (string)`,E(`The string to convert to lowercase.`))],compute:function(e){return I(e).toLowerCase()},isExported:!0},ST={description:E(`A segment of a string.`),args:[Y(`text (string)`,E(`The string to extract a segment from.`)),Y(`starting_at (number)`,E(`The index from the left of string from which to begin extracting. The first character in string has the index 1.`)),Y(`extract_length (number)`,E(`The length of the segment to extract.`))],compute:function(e,t,n){let r=I(e),i=F(t,this.locale),a=F(n,this.locale);return N(()=>i>=1,E(`The starting_at argument (%s) must be positive greater than one.`,i.toString())),N(()=>a>=0,E(`The extract_length argument (%s) must be positive or null.`,a.toString())),r.slice(i-1,i+a-1)},isExported:!0},CT={description:E(`Capitalizes each word in a specified string.`),args:[Y(`text_to_capitalize (string)`,E(`The text which will be returned with the first letter of each word in uppercase and all other letters in lowercase.`))],compute:function(e){return I(e).replace(fT,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},wT={description:E(`Replaces part of a text string with different text.`),args:[Y(`text (string)`,E(`The text, a part of which will be replaced.`)),Y(`position (number)`,E(`The position where the replacement will begin (starting from 1).`)),Y(`length (number)`,E(`The number of characters in the text to be replaced.`)),Y(`new_text (string)`,E(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=F(t,this.locale);N(()=>i>=1,E(`The position (%s) must be greater than or equal to 1.`,i.toString()));let a=I(e),o=F(n,this.locale),s=I(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},TT={description:E(`A substring from the end of a specified string.`),args:[Y(`text (string)`,E(`The string from which the right portion will be returned.`)),Y(`number_of_characters (number, optional)`,E(`The number of characters to return from the right side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;N(()=>n>=0,E(`The number_of_characters (%s) must be positive or null.`,n.toString()));let r=I(e),i=r.length;return r.substring(i-n,i)},isExported:!0},ET={description:E(`First position of string found in text, ignoring case.`),args:[Y(`search_for (string)`,E(`The string to look for within text_to_search.`)),Y(`text_to_search (string)`,E(`The text to search for the first occurrence of search_for.`)),Y(`starting_at (number, default=1)`,E(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e).toLowerCase(),i=I(t).toLowerCase(),a=F(n,this.locale);if(i===``)return{value:j.GenericError,message:E(`The text_to_search must be non-empty.`)};if(a<1)return{value:j.GenericError,message:E(`The starting_at (%s) must be greater than or equal to 1.`,a)};let o=i.indexOf(r,a-1);return o===-1?{value:j.GenericError,message:E(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)}:{value:o+1}},isExported:!0},DT={description:E(`Split text by specific character delimiter(s).`),args:[Y(`text (string)`,E(`The text to divide.`)),Y(`delimiter (string)`,E(`The character or characters to use to split text.`)),Y(`split_by_each (boolean, default=true})`,E(`Whether or not to divide text around each character contained in delimiter.`)),Y(`remove_empty_text (boolean, default=true)`,E(`Whether or not to remove empty text messages from the split results. The default behavior is to treat consecutive delimiters as one (if TRUE). If FALSE, empty cells values are added between consecutive delimiters.`))],compute:function(e,t,n={value:!0},r={value:!0}){let i=I(e),a=nt(I(t)),o=L(n),s=L(r);N(()=>a.length>0,E(`The _delimiter (%s) must be not be empty.`,a));let c=o?RegExp(`[${a}]`,`g`):new RegExp(a,`g`),l=i.split(c);return s&&(l=l.filter(e=>e!==``)),Pa([l])},isExported:!1},OT={description:E(`Replaces existing text with new text in a string.`),args:[Y(`text_to_search (string)`,E(`The text within which to search and replace.`)),Y(`search_for (string)`,E(`The string to search for within text_to_search.`)),Y(`replace_with (string)`,E(`The string that will replace search_for.`)),Y(`occurrence_number (number, optional)`,E(`The instance of search_for within text_to_search to replace with replace_with. By default, all occurrences of search_for are replaced; however, if occurrence_number is specified, only the indicated instance of search_for is replaced.`))],compute:function(e,t,n,r){let i=F(r,this.locale);N(()=>i>=0,E(`The occurrenceNumber (%s) must be positive or null.`,i.toString()));let a=I(e),o=I(t);if(o===``)return a;let s=I(n),c=new RegExp(nt(o),`g`);if(i===0)return a.replace(c,s);let l=0;return a.replace(c,e=>++l===i?s:e)},isExported:!0},kT={description:E(`Combines text from multiple strings and/or arrays.`),args:[Y(`delimiter (string)`,E(` A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),Y(`ignore_empty (boolean)`,E(`A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result.`)),Y(`text1 (string, range<string>)`,E(`Any text item. This could be a string, or an array of strings in a range.`)),Y(`text2 (string, range<string>, repeating)`,E(`Additional text item(s).`))],compute:function(e,t,...n){let r=I(e),i=L(t),a=0;return Oa(n,(e,t)=>i&&I(t)===``?e:(a++?e+r:``)+I(t),``)},isExported:!0},AT={description:E(`Removes space characters.`),args:[Y(`text (string)`,E(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return Ht(I(e))},isExported:!0},jT={description:E(`Converts a specified string to uppercase.`),args:[Y(`text (string)`,E(`The string to convert to uppercase.`))],compute:function(e){return I(e).toUpperCase()},isExported:!0},MT={description:E(`Converts a number to text according to a specified format.`),args:[Y(`number (number)`,E(`The number, date or time to format.`)),Y(`format (string)`,E(`The pattern by which to format the number, enclosed in quotation marks.`))],compute:function(e,t){return B(F(e,this.locale),{format:I(t),locale:this.locale})},isExported:!0},NT={description:E(`Converts a string to a numeric value.`),args:[Y(`value (number)`,E(`the string to be converted`))],compute:function(e){return F(e,this.locale)},isExported:!0};var PT=l({HYPERLINK:()=>FT});let FT={description:E(`Creates a hyperlink in a cell.`),args:[Y(`url (string)`,E(`The full URL of the link enclosed in quotation marks.`)),Y(`link_label (string, optional)`,E(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=I(e).trim(),r=I(t)||n;return n===``?r:ht(r,n)},isExported:!0},IT=[{name:E(`Array`),functions:x_},{name:E(`Database`),functions:pb},{name:E(`Date`),functions:Ob},{name:E(`Filter`),functions:hx},{name:E(`Financial`),functions:Zx},{name:E(`Info`),functions:IC},{name:E(`Lookup`),functions:lw},{name:E(`Logical`),functions:JC},{name:E(`Math`),functions:q_},{name:E(`Misc`),functions:G_},{name:E(`Operator`),functions:Ow},{name:E(`Statistical`),functions:ay},{name:E(`Text`),functions:dT},{name:E(`Engineering`),functions:lx},{name:E(`Web`),functions:PT},{name:E(`Parser`),functions:lT}],LT=/^[A-Z0-9\_\.]+$/,RT=new class extends h{mapping={};add(e,t){if(e=e.toUpperCase(),!LT.test(e))throw Error(E(`Invalid function name %s. Function names can exclusively contain alphanumerical values separated by dots (.) or underscore (_)`,e));let n=m_(t);return g_(n.args),this.mapping[e]=zT(n,e),super.add(e,n),this}};for(let e of IT){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),RT.add(n,{isExported:!1,...r})}}function zT(e,t){function n(...n){let a=[];for(let r=0;r<n.length;r++){let i=e.args[e.getArgToFocus(r+1)-1],o=n[r];if(!A(o)&&i.acceptMatrixOnly)throw new na(E(`Function %s expects the parameter '%s' to be reference to a cell or range.`,t,(r+1).toString()));a.push(!i.acceptMatrix)}return r(Fa(i.bind(this),n,a))}function r(e){return A(e)?Na(e,e=>HT(e,t)):HT(e,t),e}function i(...n){for(let t=0;t<n.length;t++){let r=n[t];if(!e.args[e.getArgToFocus(t+1)-1].acceptErrors&&!A(r)&&P(r?.value))return r}try{return a.apply(this,n)}catch(e){return BT(e,t)}}function a(...t){let n=e.compute.apply(this,t);return A(n)?typeof n[0][0]==`object`&&n[0][0]!==null&&`value`in n[0][0]?n:Ma(n,e=>({value:e})):typeof n==`object`&&n&&`value`in n?n:{value:n}}return n}function BT(e,t){return VT(e)&&P(e.value)?(WT(e)&&HT(e,t),e):(console.error(e),new M(UT+(WT(e)?` `+e.message:``)))}function VT(e){return e?.value!==void 0&&typeof e.value==`string`}function HT(e,t){e.message?.includes(`[[FUNCTION_NAME]]`)&&(e.message=e.message.replace(`[[FUNCTION_NAME]]`,t))}let UT=E(`An unexpected error occurred. Submit a support ticket at odoo.com/help.`);function WT(e){return e?.message!==void 0&&typeof e.message==`string`}c_.add(`functions`,{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if(e.type!==`SYMBOL`)return[];let t=e.value;return this.composer.currentContent.startsWith(`=`)?Object.entries(RT.content).filter(([e,{hidden:t}])=>!t).map(([e,{description:n}])=>({text:e,description:n,htmlContent:u_(t,e,ge,`o-semi-bold`)})).sort((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)):[]},selectProposal(e,t){let n=e.end,r=e.end;[`SYMBOL`,`FUNCTION`].includes(e.type)&&(n=e.start);let i=this.composer.currentTokens;t+=`(`;let a=i.map(e=>e.start).indexOf(e.start);a+1<i.length&&i[a+1]?.type===`LEFT_PAREN`&&r++,this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}});var GT=class{mutators=[`setFocusableElement`,`focus`];focusableElement=void 0;setFocusableElement(e){return this.focusableElement=e,`noStateChange`}focus(){if(this.focusableElement===document.activeElement)return`noStateChange`;this.focusableElement?.focus()}};let KT=/Mac/i,qT=[`Shift`,`Control`,`Alt`,`Meta`];function JT(e,t){return e?!!t.target&&e.contains(t.target):!1}function YT(){let e=document.querySelector(`.o-grid-overlay`);if(e){let{top:t,left:n}=e.getBoundingClientRect();return{top:t,left:n}}throw Error(`Can't find spreadsheet position`)}function XT(e){let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}function*ZT(e){if(yield e,e.hasChildNodes())for(let t of e.childNodes)yield*ZT(t)}function QT(){return Array.from(document.querySelectorAll(`.o-spreadsheet .o-menu`))}let $T=/^[a-zA-Z]$/;function eE(e,t=`key`){let n=``;qT.includes(e.key)||(nE(e)&&(n+=`Ctrl+`),e.altKey&&(n+=`Alt+`),e.shiftKey&&(n+=`Shift+`));let r=t===`key`?e.key:e.code;return n+=$T.test(r)?r.toUpperCase():r,n}function tE(){return!!KT.test(navigator.userAgent)}function nE(e){return tE()?e.metaKey:e.ctrlKey}function rE(){let e=(0,t.useState)({x:0,y:0,width:0,height:0}),n=null;function r(){if(n||=document.querySelector(`.o-spreadsheet`),n){let{top:t,left:r,width:i,height:a}=n.getBoundingClientRect();e.x=r,e.y=t,e.width=i,e.height=a}}return(0,t.onMounted)(r),(0,t.onPatched)(r),e}function iE(e){let n=(0,t.useState)({x:0,y:0,width:0,height:0});function r(){let t=e.el;if(t===null)return;let{top:r,left:i,width:a,height:o}=t.getBoundingClientRect();n.x=i,n.y=r,n.width=a,n.height=o}return(0,t.onMounted)(r),(0,t.onPatched)(r),n}function aE(){let e=(0,t.useState)({x:0,y:0,width:0,height:0}),n=(0,t.useComponent)(),r=rE();function i(){let t=n.env,i=`getPopoverContainerRect`in t?t.getPopoverContainerRect():r;e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return i(),(0,t.onMounted)(i),(0,t.onPatched)(i),e}let oE={ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`};function sE(e,t){let n=oE[e.key];e.shiftKey?t.resizeAnchorZone(n,nE(e)?`end`:1):t.moveAnchorCell(n,nE(e)?`end`:1)}H`
50
+ ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))`)}},mg=`#F3F2F1`;function hg(e,t){let n=e.getBoundingClientRect(),r=window.devicePixelRatio||1;e.width=r*n.width,e.height=r*n.height;let i=e.getContext(`2d`);i.scale(r,r);let a=xg(n,t,i);_g(i,a),gg(i,a),yg(i,a),vg(i,a),bg(i,a)}function gg(e,t){e.save();let n=t.gauge,r=n.rect.x+n.rect.width/2,i=n.rect.y+n.rect.height,a=n.rect.height-n.arcWidth/2;if(a<0)return;let o=n.percentage===1?0:Math.PI*(1+n.percentage);e.strokeStyle=mg,e.beginPath(),e.lineWidth=n.arcWidth,e.arc(r,i,a,o,0),e.stroke(),e.strokeStyle=n.color,e.beginPath(),e.arc(r,i,a,Math.PI,o),e.stroke(),e.restore()}function _g(e,t){e.save(),e.fillStyle=t.backgroundColor,e.fillRect(0,0,t.width,t.height),e.restore()}function vg(e,t){for(let n of[t.minLabel,t.maxLabel,t.gaugeValue])e.save(),e.textAlign=`center`,e.fillStyle=n.color,e.font=`${n.fontSize}px ${ze}`,e.fillText(n.label,n.textPosition.x,n.textPosition.y),e.restore()}function yg(e,t){let{x:n,y:r,width:i,height:a}=t.gauge.rect;for(let o of t.inflectionValues){e.save(),e.translate(n+i/2-.5,r+a-.5),e.rotate(Math.PI/2-o.rotation),e.lineWidth=2,e.strokeStyle=`#666666aa`,e.beginPath(),e.moveTo(0,-(a-t.gauge.arcWidth)),e.lineTo(0,-a-3),e.stroke(),e.textAlign=`center`,e.font=`${o.fontSize}px ${ze}`,e.fillStyle=o.color;let s=-a-6-o.offset;e.fillText(o.label,0,s),e.restore()}}function bg(e,t){e.save();let n=t.title;e.font=ac(n.fontSize,n.bold,n.italic),e.textBaseline=`middle`,e.fillStyle=n.color,e.fillText(n.label,n.textPosition.x,n.textPosition.y),e.restore()}function xg(e,t,n){let r=t.maxValue,i=t.minValue,a=t.gaugeValue,o=Sg(e,t.title.text),s=o.width/6,c=a?(a.value-i.value)/(r.value-i.value):0,l={x:e.width/2,y:o.y+o.height-o.height/12},u=80;o.height<300&&(u*=o.height/300);let d=o.width/2,f=a?.label||`-`;sc(n,f,{fontSize:u},`px`)>d&&(u=_c(d,u,e=>sc(n,f,{fontSize:e},`px`)));let p={x:o.x+s/2,y:o.y+o.height+12},m={x:o.x+o.width-s/2,y:o.y+o.height+12},h=Tg(t.background),g=Cg(t,o,h,n),_=0,v=0,ee=0;switch(t.title.text&&({width:v,height:ee}=uc(n,t.title.text,{...t.title,fontSize:14},`px`)),t.title.align){case`right`:_=e.width-v-10;break;case`center`:_=(e.width-v)/2;break;default:_=10;break}return{width:e.width,height:e.height,title:{label:t.title.text??``,fontSize:14,textPosition:{x:_,y:10+ee/2},color:t.title.color??h,bold:t.title.bold,italic:t.title.italic},backgroundColor:t.background,gauge:{rect:o,arcWidth:s,percentage:b(c,0,1),color:wg(t)},inflectionValues:g,gaugeValue:{label:f,textPosition:l,fontSize:u,color:h},minLabel:{label:t.minValue.label,textPosition:p,fontSize:12,color:h},maxLabel:{label:t.maxValue.label,textPosition:m,fontSize:12,color:h}}}function Sg(e,t){let n=t?25:0,r=e.height-20-n-10,i=e.width-60,a,o;return i>2*r?(a=2*r,o=r):(a=i,o=i/2),{x:30+(i-a)/2,y:n+10+(r-o)/2,width:a,height:o}}function Cg(e,t,n,r){let i=e.maxValue,a=e.minValue,o={x:t.x+t.width/2,y:t.y+t.height},s={fontSize:12},c=[],l=[];for(let u of e.inflectionValues){let e=(u.value-a.value)/(i.value-a.value),d=sc(r,u.label,s,`px`),f=Math.PI-Math.PI*e,p=kg(f,t.height+6,o.x,o.y,d+2,12),m=l.some(e=>Og(e,p))?12:0;l.push(p),c.push({rotation:f,label:u.label,fontSize:12,color:n,offset:m})}return c}function wg(e){let t=e.gaugeValue?.value;if(t===void 0)return mg;for(let n=0;n<e.inflectionValues.length;n++){let r=e.inflectionValues[n];if(r.operator===`<`&&t<r.value||r.operator===`<=`&&t<=r.value)return e.colors[n]}return e.colors.at(-1)}function Tg(e){return on(e)>.3?`#666666`:`#C8C8C8`}function Eg(e){return[{start:e.topLeft,end:e.topRight},{start:e.topRight,end:e.bottomRight},{start:e.bottomRight,end:e.bottomLeft},{start:e.bottomLeft,end:e.topLeft}]}function Dg(e,t){let n=e.start,r=e.end,i=t.start,a=t.end;function o(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return o(n,i,a)!==o(r,i,a)&&o(n,r,i)!==o(n,r,a)}function Og(e,t){let n=Eg(e),r=Eg(t);for(let e of n)for(let t of r)if(Dg(e,t))return!0;return!1}function kg(e,t,n,r,i,a){let o=Math.cos(e),s=Math.sin(e),c=o*t,l=s*t,u=i/2*s,d=i/2*o,f={x:c+u+n,y:r-(l-d)},p={x:c-u+n,y:r-(l+d)},m=o*(t+a),h=s*(t+a),g={x:m-u+n,y:r-(h+d)};return{bottomLeft:p,bottomRight:f,topRight:{x:m+u+n,y:r-(h-d)},topLeft:g}}var Ag=class{sheetId;title;getters;constructor(e,t,n){this.title=e.title,this.sheetId=t,this.getters=n}static validateChartDefinition(e,t){throw Error(`This method should be implemented by sub class`)}static transformDefinition(e,t){throw Error(`This method should be implemented by sub class`)}static getDefinitionFromContextCreation(e){throw Error(`This method should be implemented by sub class`)}};function jg(e,t,n,r,i){if(!e)return``;if(n===`text`||t?.type!==`number`||e.type!==`number`)return r?is(e,i):e.formattedValue;let{value:a,format:o}=e;return n===`progress`?(a=t.value/a,o=`0.0%`):(a=Math.abs(t.value-a),n===`percentage`&&a!==0&&(a/=e.value),n===`percentage`&&(o=`0.0%`),o||(a=Math.round(a*100)/100)),r?is({value:a,format:o},i):B(a,{format:o,locale:i})}function Mg(e,t,n){return e?t?is(e,n):e.formattedValue??String(e.value??``):``}function Ng(e,t,n,r,i){if(t===`text`||t===`progress`||e?.type!==`number`||n?.type!==`number`)return;let a=n.value-e.value;if(a>0)return r;if(a<0)return i}function Pg(e,t,n){if(n===`text`||e?.type!==`number`||t?.type!==`number`)return`neutral`;let r=t.value-e.value;return r>0?`up`:r<0?`down`:`neutral`}function Fg(e){return e.keyValue&&!Fs.test(e.keyValue)?`InvalidScorecardKeyValue`:`Success`}function Ig(e){return e.baseline&&!Fs.test(e.baseline)?`InvalidScorecardBaseline`:`Success`}let Lg=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`),Rg=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`);var zg=class e extends Ag{keyValue;baseline;baselineMode;baselineDescr;progressBar=!1;background;baselineColorUp;baselineColorDown;fontColor;humanize;type=`scorecard`;constructor(e,t,n){super(e,t,n),this.keyValue=Gs(n,t,e.keyValue),this.baseline=Gs(n,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp??`#43C5B1`,this.baselineColorDown=e.baselineColorDown??`#EA6175`,this.humanize=e.humanize??!1}static validateChartDefinition(e,t){return e.checkValidations(t,Fg,Ig)}static getDefinitionFromContextCreation(e){return{background:e.background,type:`scorecard`,keyValue:e.range?.[0]?.dataRange,title:e.title||{text:``},baselineMode:He,baselineColorUp:Ue,baselineColorDown:We,baseline:e.auxiliaryRange||``}}static transformDefinition(e,t){let n,r;return e.baseline&&(n=td(Zn(e.baseline),t)),e.keyValue&&(r=td(Zn(e.keyValue),t)),{...e,baseline:n?tr(n):void 0,keyValue:r?tr(r):void 0}}copyForSheetId(t){let n=bd(this.sheetId,t,this.baseline),r=bd(this.sheetId,t,this.keyValue);return new e(this.getDefinitionWithSpecificRanges(n,r,t),t,this.getters)}copyInSheetId(t){return new e(this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,t),t,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{...this,range:this.keyValue?[{dataRange:this.getters.getRangeString(this.keyValue,this.sheetId)}]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,n){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:`scorecard`,background:this.background,baseline:e?this.getters.getRangeString(e,n||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,n||this.sheetId):void 0,humanize:this.humanize}}getDefinitionForExcel(){}updateRanges(t){let n=xd(this.baseline,t),r=xd(this.keyValue,t);return this.baseline===n&&this.keyValue===r?this:new e(this.getDefinitionWithSpecificRanges(n,r),this.sheetId,this.getters)}};function Bg(e,t){let n=t.getContext(`2d`),r=window.devicePixelRatio||1;t.width=r*e.canvas.width,t.height=r*e.canvas.height,n.scale(r,r);let i=e.canvas.width-20;if(n.fillStyle=e.canvas.backgroundColor,n.fillRect(0,0,e.canvas.width,e.canvas.height),e.title){n.font=e.title.style.font,n.fillStyle=e.title.style.color;let t=n.textBaseline;n.textBaseline=`middle`,n.fillText(Sc(n,e.title.text,i-e.title.position.x),e.title.position.x,e.title.position.y),n.textBaseline=t}if(e.baseline&&(n.font=e.baseline.style.font,n.fillStyle=e.baseline.style.color,Cc(n,e.baseline.text,e.baseline.position,e.baseline.style.underline,e.baseline.style.strikethrough)),e.baselineArrow&&e.baselineArrow.style.size>0){n.save(),n.fillStyle=e.baselineArrow.style.color,n.translate(e.baselineArrow.position.x,e.baselineArrow.position.y);let t=e.baselineArrow.style.size/10;switch(n.scale(t,t),e.baselineArrow.direction){case`down`:n.fill(Lg);break;case`up`:n.fill(Rg);break}n.restore()}if(e.baselineDescr){let t=e.baselineDescr[0];n.font=t.style.font,n.fillStyle=t.style.color;for(let t of e.baselineDescr)n.fillText(Sc(n,t.text,i-t.position.x),t.position.x,t.position.y)}if(e.key&&(n.font=e.key.style.font,n.fillStyle=e.key.style.color,Cc(n,Sc(n,e.key.text,i-e.key.position.x),e.key.position,e.key.style.underline,e.key.style.strikethrough)),e.progressBar){if(n.fillStyle=e.progressBar.style.backgroundColor,n.beginPath(),n.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width,e.progressBar.dimension.height,e.progressBar.dimension.height/2),n.fill(),n.fillStyle=e.progressBar.style.color,n.beginPath(),e.progressBar.value>0)n.roundRect(e.progressBar.position.x,e.progressBar.position.y,e.progressBar.dimension.width*Math.max(0,Math.min(1,e.progressBar.value)),e.progressBar.dimension.height,e.progressBar.dimension.height/2);else{let t=e.progressBar.dimension.width*Math.max(0,Math.min(1,-e.progressBar.value));n.roundRect(e.progressBar.position.x+e.progressBar.dimension.width-t,e.progressBar.position.y,t,e.progressBar.dimension.height,e.progressBar.dimension.height/2)}n.fill()}}function Vg(e,t){let n=``,r,i=t.getLocale();if(e.keyValue){let a={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};r=t.getEvaluatedCell(a),n=Mg(r,e.humanize??!1,i)}let a,o=e.baseline;if(o){let e={sheetId:o.sheetId,col:o.zone.left,row:o.zone.top};a=t.getEvaluatedCell(e)}let{background:s,fontColor:c}=t.getStyleOfSingleCellChart(e.background,e.keyValue),l=jg(a,r,e.baselineMode,e.humanize??!1,i),u=e.baselineMode===`progress`&&Oi(l,i)?F(l,i):0;return{title:{...e.title,text:e.title.text?E(e.title.text):``},keyValue:n,baselineDisplay:l,baselineArrow:Pg(a,r,e.baselineMode),baselineColor:Ng(a,e.baselineMode,r,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineMode!==`progress`&&e.baselineDescr?E(e.baselineDescr):``,fontColor:c,background:s,baselineStyle:e.baselineMode!==`percentage`&&e.baselineMode!==`progress`&&o?t.getCellStyle({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0,progressBar:e.baselineMode===`progress`?{value:u,color:u>0?e.baselineColorUp:e.baselineColorDown}:void 0}}let Hg=.05;function Ug(e,t){let n=e||``;return t&&n?` `+n:n}function Wg({width:e,height:t},n){return new Gg({width:e,height:t},n).computeDesign()}var Gg=class{runtime;context;width;height;constructor({width:e,height:t},n){this.runtime=n;let r=document.createElement(`canvas`);this.width=r.width=e,this.height=r.height=t,this.context=r.getContext(`2d`)}computeDesign(){let e={canvas:{width:this.width,height:this.height,backgroundColor:this.backgroundColor}},t=this.getTextStyles(),n=0;if(this.title){let r,i;switch({height:n,width:i}=this.getFullTextDimensions(this.title,t.title.font),this.runtime.title.align){case`center`:r=(this.width-i)/2;break;case`right`:r=this.width-i-10;break;default:r=10}e.title={text:this.title,style:t.title,position:{x:r,y:10+n/2}}}let r=t.baselineArrow?.size??0,{height:i,width:a}=this.getTextDimensions(this.baseline,t.baselineValue.font);this.baseline||(i=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).height);let o=this.getTextDimensions(this.baselineDescr,t.baselineDescr.font).width;e.baseline={text:this.baseline,style:t.baselineValue,position:{x:(this.width-a-o+r)/2,y:this.keyValue?this.height*(1-Hg*(this.runtime.progressBar?1:2)):this.height-(this.height-n-i)/2-10}};let s=r+20;if(e.baseline.position.x<s&&(e.baseline.position.x=s),t.baselineArrow&&!this.runtime.progressBar&&(e.baselineArrow={direction:this.baselineArrow,style:t.baselineArrow,position:{x:e.baseline.position.x-r,y:e.baseline.position.y-(i+r)/2}}),this.baselineDescr){let n={x:e.baseline.position.x+a,y:e.baseline.position.y};e.baselineDescr=[{text:this.baselineDescr,style:t.baselineDescr,position:n}]}let c=0;this.runtime.progressBar&&(c=this.height*.05,e.progressBar={position:{x:20,y:this.height*(1-2*Hg)-i-c},dimension:{height:c,width:this.width-40},value:this.runtime.progressBar.value,style:{color:this.runtime.progressBar.color,backgroundColor:this.secondaryFontColor}});let{width:l,height:u}=this.getFullTextDimensions(this.keyValue,t.keyValue.font);return this.keyValue&&(e.key={text:this.keyValue,style:t.keyValue,position:{x:Math.max(10,(this.width-l)/2),y:this.height*(.5-Hg*2)+10/2+(n+u/2)/2}}),e}get title(){return this.runtime.title.text??``}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){return Ug(this.runtime.baselineDescr,this.baseline)}get baselineArrow(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get secondaryFontColor(){return on(this.backgroundColor)>.3?`#525252`:`#C8C8C8`}getTextDimensions(e,t){this.context.font=t;let n=this.context.measureText(e);return{width:n.width,height:n.actualBoundingBoxAscent+n.actualBoundingBoxDescent}}getFullTextDimensions(e,t){this.context.font=t;let n=this.context.measureText(e);return{width:n.width,height:n.fontBoundingBoxAscent+n.fontBoundingBoxDescent}}getTextStyles(){let e=16,t=Math.floor(.9*e);return this.runtime.progressBar&&(e/=1.5),{title:{font:ac(14,this.runtime.title.bold,this.runtime.title.italic),color:this.runtime.title.color??this.secondaryFontColor},keyValue:{color:this.runtime.keyValueStyle?.textColor||this.runtime.fontColor,font:ac(32,this.runtime.keyValueStyle?.bold,this.runtime.keyValueStyle?.italic),strikethrough:this.runtime.keyValueStyle?.strikethrough,underline:this.runtime.keyValueStyle?.underline},baselineValue:{font:ac(e,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:ac(t),color:this.secondaryFontColor},baselineArrow:this.baselineArrow===`neutral`||this.runtime.progressBar?void 0:{size:this.keyValue?.8*e:0,color:this.runtime.baselineColor||this.secondaryFontColor}}}};function Kg(e,t){if(t.dataRange){let n=t.labelCell?[t.labelCell.zone]:[],r=T([t.dataRange.zone],n)[0];if(r===void 0)return[];let i=e.getRangeFromZone(t.dataRange.sheetId,r);return e.getRangeValues(i).map(e=>e===``?void 0:e)}return[]}function qg(e,t){let n=x(0,Math.max(e.length,...t.map(e=>e.data?.length||0))).filter(n=>{let r=e[n],i=t.map(e=>e.data?.[n]);return r||i.some(e=>e===0||!!e)});return{labels:n.map(t=>e[t]||``),dataSetsValues:t.map(e=>({...e,data:n.map(t=>e.data[t])}))}}function Jg(e,t){let n=e=>typeof e==`number`?e:0,r=new Set(e),i={};r.forEach(e=>{i[e]=Array(t.length).fill(0)});for(let r of x(0,e.length)){let a=e[r];for(let e of x(0,t.length))i[a][e]+=n(t[e].data[r])}return{labels:Array.from(r),dataSetsValues:t.map((e,t)=>({...e,data:Array.from(r).map(e=>i[e][t])}))}}function Yg(e){return e?e.length>20?e.substring(0,20)+`…`:e:``}function Xg(e,t,n,{format:r,locale:i,truncateLabels:a=!0,horizontalChart:o}){let s=e.title.text?e.title:{...e.title,content:``},c={responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:s.text?20/2:25,bottom:20}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:!1,plugins:{title:{display:!!s.text,text:E(s.text),color:s?.color??n,align:s.align===`center`?`center`:s.align===`right`?`end`:`start`,font:{size:22,weight:s.bold?`bold`:`normal`,style:s.italic?`italic`:`normal`}},legend:{onClick:()=>{}},tooltip:{callbacks:{label:function(e){let t=e.dataset?.label||e.label,n=o?e.parsed.x:e.parsed.y;n??=e.parsed;let a=B(n,{format:!r&&Math.abs(n)>=1e3?`#,##`:r,locale:i});return t?`${t}: ${a}`:a}}}}};return{type:e.type,options:c,data:{labels:a?t.map(Yg):t,datasets:[]},platform:void 0,plugins:[]}}function Zg(e,t,n){if(!t)return;let{sheetId:r,zone:i}=t,a=_r(i).map(t=>e.getEvaluatedCell({sheetId:r,...t}).format);return n&&a.shift(),a.find(e=>e!==void 0)}function Qg(e,t,n){let r={values:[],formattedValues:[]};if(n){let{left:i}=n.zone;!n.invalidXc&&!n.invalidSheetName&&!e.isColHidden(n.sheetId,i)?r={formattedValues:e.getRangeFormattedValues(n),values:e.getRangeValues(n).map(e=>String(e??``))}:t[0]&&(r={formattedValues:x(0,Kg(e,t[0]).length).map(e=>e.toString()),values:r.formattedValues})}else if(t.length===1){let n=Kg(e,t[0]).length;for(let e=0;e<n;e++)r.formattedValues.push(``),r.values.push(``)}else t[0]&&(r={formattedValues:x(0,Kg(e,t[0]).length).map(e=>e.toString()),values:r.formattedValues});return r}function $g(e,t){for(let n of t){let t=e.getRangeFormats(n.dataRange).find(e=>e!==void 0&&!Go(e));if(t)return t}}function e_(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t,a=e.isColHidden(i.dataRange.sheetId,i.dataRange.zone.left);if(i.labelCell){let n=i.labelCell,a=n?e.getEvaluatedCell({sheetId:n.sheetId,col:n.zone.left,row:n.zone.top}):void 0;t=a&&n?Yg(a.formattedValue):t=`${ag.Series} ${parseInt(r)+1}`}else t=`${ag.Series} ${parseInt(r)+1}`;let o=i.dataRange?Kg(e,i):[];o.every(e=>typeof e==`string`&&!P(e))&&o.some(e=>e!==``)?o.fill(1):o.every(e=>e==null||!Oi(e.toString(),k))&&(a=!0),n.push({data:o,label:t,hidden:a})}return n}function t_(e,t){return t?e===0?`origin`:`-1`:`origin`}function n_(e,t,n){let r=document.createElement(`div`);r.style.width=`${t.width}px`,r.style.height=`${t.height}px`;let i=document.createElement(`canvas`);if(r.append(i),i.setAttribute(`width`,t.width.toString()),i.setAttribute(`height`,t.height.toString()),document.body.append(r),`chartJsConfig`in e){let t=y(e.chartJsConfig);t.plugins=[r_];let n=new(a_())(i,t),a=n.toBase64Image();return n.destroy(),r.remove(),a}else if(n===`scorecard`){Bg(Wg(t,e),i);let n=i.toDataURL();return r.remove(),n}else if(n===`gauge`){hg(i,e);let t=i.toDataURL();return r.remove(),t}}let r_={id:`customCanvasBackgroundColor`,beforeDraw:e=>{let{ctx:t}=e;t.save(),t.globalCompositeOperation=`destination-over`,t.fillStyle=`#ffffff`,t.fillRect(0,0,e.width,e.height),t.restore()}};function i_(e,t={}){return{...t,labels:{color:e,filter:(e,t)=>`datasetIndex`in e?!t.datasets[e.datasetIndex].hidden:!0,...t.labels}}}function a_(){return window.Chart&&!window.Chart?.registry.plugins.get(`chartShowValuesPlugin`)&&(window.Chart.register(Hd),window.Chart.register(qd)),window.Chart}var o_=class extends t.Component{static template=`o-spreadsheet-ChartJsComponent`;static props={figure:Object};canvas=(0,t.useRef)(`graphContainer`);chart;currentRuntime;currentDevicePixelRatio=window.devicePixelRatio;get background(){return this.chartRuntime.background}get canvasStyle(){return`background-color: ${this.background}`}get chartRuntime(){let e=this.env.model.getters.getChartRuntime(this.props.figure.id);if(!(`chartJsConfig`in e))throw Error(`Unsupported chart runtime`);return e}setup(){(0,t.onMounted)(()=>{let e=this.chartRuntime;this.currentRuntime=e,this.createChart(y(e.chartJsConfig))}),(0,t.onWillUnmount)(()=>this.chart?.destroy()),(0,t.useEffect)(()=>{let e=this.chartRuntime;e===this.currentRuntime?this.currentDevicePixelRatio!==window.devicePixelRatio&&(this.currentDevicePixelRatio=window.devicePixelRatio,this.updateChartJs(y(this.currentRuntime))):(e.chartJsConfig.type===this.currentRuntime.chartJsConfig.type?this.updateChartJs(y(e)):(this.chart?.destroy(),this.createChart(y(e.chartJsConfig))),this.currentRuntime=e)})}createChart(e){let t=this.canvas.el.getContext(`2d`),n=a_();this.chart=new n(t,e)}updateChartJs(e){let 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)):this.chart.data.datasets=[],this.chart.config.options=t.options,this.chart.update()}},s_=class extends t.Component{static template=`o-spreadsheet-ScorecardChart`;static props={figure:Object};canvas=(0,t.useRef)(`chartContainer`);get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}get title(){return E(this.env.model.getters.getChartDefinition(this.props.figure.id).title.text??``)}setup(){(0,t.useEffect)(this.createChart.bind(this),()=>{let e=this.canvas.el.getBoundingClientRect();return[e.width,e.height,this.runtime,this.canvas.el,window.devicePixelRatio]})}createChart(){let e=this.canvas.el;Bg(Wg(e.getBoundingClientRect(),this.runtime),e)}};let c_=new h;c_.add(`dataValidation`,{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){return t.startsWith(`=`)||!this.composer.currentEditedCell?[]:l_(this.getters,this.composer.currentEditedCell).map(e=>({text:e.value?.toString()||``,htmlContent:[{value:e.label}],fuzzySearchKey:e.label}))},selectProposal(e,t){this.composer.setCurrentContent(t),this.composer.stopEdition()}});function l_(e,t){let n=e.getValidationRuleForCell(t);if(!n||n.criterion.type!==`isValueInList`&&n.criterion.type!==`isValueInRange`)return[];let r=[];if(n.criterion.type===`isValueInList`)r=n.criterion.values.map(e=>({label:e,value:e}));else{let i=new Set,a=e.getRangeFromSheetXC(t.sheetId,n.criterion.values[0]);for(let t of _r(a.zone)){let n=e.getEvaluatedCell({...t,sheetId:a.sheetId});n.formattedValue&&!i.has(n.formattedValue)&&(i.add(n.formattedValue),r.push({label:n.formattedValue,value:n.value}))}}return r}function u_(e,t,n,r){let i=[];e=e.toLowerCase();for(let a of e){let e=t.toLocaleLowerCase().indexOf(a);e!==-1&&(i.push({value:t.slice(0,e),color:``},{value:t[e],color:n,class:r}),t=t.slice(e+1))}return i.push({value:t}),i.filter(e=>e.value)}let d_=/(.*?)\((.*?)\)(.*)/,f_=[`ANY`,`BOOLEAN`,`DATE`,`NUMBER`,`STRING`,`RANGE`,`RANGE<BOOLEAN>`,`RANGE<DATE>`,`RANGE<NUMBER>`,`RANGE<STRING>`,`META`];function Y(e,t=``){return p_(e,t)}function p_(e,t){let n=e.match(d_),r=n[1].trim();if(!r)throw Error(`Function argument definition is missing a name: '${e}'.`);let i=[],a=!1,o=!1,s;for(let e of n[2].split(`,`)){let t=e.trim().toUpperCase(),n=f_.find(e=>t===e);n?i.push(n):t===`RANGE<ANY>`?i.push(`RANGE`):t===`OPTIONAL`?a=!0:t===`REPEATING`?o=!0:t.startsWith(`DEFAULT=`)&&(s=e.trim().slice(8))}let c={name:r,description:t,type:i};return(i.includes(`ANY`)||i.includes(`RANGE`))&&(c.acceptErrors=!0),a&&(c.optional=!0),o&&(c.repeating=!0),s!==void 0&&(c.default=!0,c.defaultValue=s),i.some(e=>e.startsWith(`RANGE`))&&(c.acceptMatrix=!0),i.every(e=>e.startsWith(`RANGE`))&&(c.acceptMatrixOnly=!0),c}function m_(e){let t=0,n=0,r=0;for(let i of e.args)t++,!i.optional&&!i.repeating&&!i.default&&n++,i.repeating&&r++;let i=e;return i.minArgRequired=n,i.maxArgPossible=r?1/0:t,i.nbrArgRepeating=r,i.getArgToFocus=h_(t,r),i.hidden=e.hidden||!1,i}function h_(e,t){if(!t)return e=>e;if(t===1)return t=>Math.min(t,e);let n=e-t;return e=>e<=n?e:n+((e-n)%t||t)}function g_(e){let t=!1,n=!1,r=!1;for(let i of e){if(i.type.includes(`META`)&&i.type.length>1)throw Error(E("Function ${name} has an argument that has been declared with more than one type whose type 'META'. The 'META' type can only be declared alone."));if(t&&!i.repeating)throw Error(E("Function ${name} has no-repeatable arguments declared after repeatable ones. All repeatable arguments must be declared last."));let e=n||t||r,a=!(i.optional||i.repeating||i.default);if(e&&a)throw Error(E("Function ${name} has at mandatory arguments declared after optional ones. All optional arguments must be after all mandatory arguments."));t=i.repeating,n=i.optional,r=i.default}}function __(e,t){N(()=>t.length===1||t[0].length===1,e)}function v_(e,...t){if(t.every(A)){let n=t[0].length,r=t[0][0].length;for(let i of t)N(()=>i.length===n&&i[0].length===r,e);return}if(t.some(e=>Array.isArray(e)&&(e.length!==1||e[0].length!==1)))throw new M(e)}function y_(e,t){N(()=>t>0,e)}function b_(e,t){N(()=>t.length===t[0].length,e)}var x_=l({ARRAY_CONSTRAIN:()=>S_,CHOOSECOLS:()=>C_,CHOOSEROWS:()=>w_,EXPAND:()=>T_,FLATTEN:()=>E_,FREQUENCY:()=>D_,HSTACK:()=>O_,MDETERM:()=>k_,MINVERSE:()=>A_,MMULT:()=>j_,SUMPRODUCT:()=>M_,SUMX2MY2:()=>P_,SUMX2PY2:()=>F_,SUMXMY2:()=>I_,TOCOL:()=>z_,TOROW:()=>B_,TRANSPOSE:()=>V_,VSTACK:()=>H_,WRAPCOLS:()=>U_,WRAPROWS:()=>W_});let S_={description:E(`Returns a result array constrained to a specific width and height.`),args:[Y(`input_range (any, range<any>)`,E(`The range to constrain.`)),Y(`rows (number)`,E(`The number of rows in the constrained array.`)),Y(`columns (number)`,E(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=z(e),i=ga(t?.value,this.locale),a=ga(n?.value,this.locale);y_(E(`The rows argument (%s) must be strictly positive.`,i.toString()),i),y_(E(`The columns argument (%s) must be strictly positive.`,i.toString()),a);let o=Math.min(i,r[0].length);return ja(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},C_={description:E(`Creates a new array from the selected columns in the existing range.`),args:[Y(`array (any, range<any>)`,E(`The array that contains the columns to be returned.`)),Y(`col_num (number, range<number>)`,E(`The first column index of the columns to be returned.`)),Y(`col_num2 (number, range<number>, repeating)`,E(`The columns indexes of the columns to be returned.`))],compute:function(e,...t){let n=z(e),r=qa(t,e=>ga(e?.value,this.locale)),i=r.filter(e=>e===0||n.length<Math.abs(e));N(()=>i.length===0,E(`The columns arguments must be between -%s and %s (got %s), excluding 0.`,n.length.toString(),n.length.toString(),i.join(`,`)));let a=Array(r.length);for(let e=0;e<r.length;e++)r[e]>0?a[e]=n[r[e]-1]:a[e]=n[n.length+r[e]];return a},isExported:!0},w_={description:E(`Creates a new array from the selected rows in the existing range.`),args:[Y(`array (any, range<any>)`,E(`The array that contains the rows to be returned.`)),Y(`row_num (number, range<number>)`,E(`The first row index of the rows to be returned.`)),Y(`row_num2 (number, range<number>, repeating)`,E(`The rows indexes of the rows to be returned.`))],compute:function(e,...t){let n=z(e),r=qa(t,e=>ga(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return N(()=>a.length===0,E(`The rows arguments must be between -%s and %s (got %s), excluding 0.`,n[0].length.toString(),n[0].length.toString(),a.join(`,`))),ja(i,r.length,(e,t)=>r[t]>0?n[e][r[t]-1]:n[e][n[e].length+r[t]])},isExported:!0},T_={description:E(`Expands or pads an array to specified row and column dimensions.`),args:[Y(`array (any, range<any>)`,E(`The array to expand.`)),Y(`rows (number)`,E(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),Y(`columns (number, optional)`,E(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),Y(`pad_with (any, default=0)`,E(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=z(e),a=ga(t?.value,this.locale),o=n===void 0?i.length:ga(n.value,this.locale);return N(()=>a>=i[0].length,E(`The rows arguments (%s) must be greater or equal than the number of rows of the array.`,a.toString())),N(()=>o>=i.length,E(`The columns arguments (%s) must be greater or equal than the number of columns of the array.`,o.toString())),ja(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},E_={description:E(`Flattens all the values from one or more ranges into a single column.`),args:[Y(`range (any, range<any>)`,E(`The first range to flatten.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to flatten.`))],compute:function(...e){return[qa(e,e=>e===void 0?{value:``}:e)]},isExported:!1},D_={description:E(`Calculates the frequency distribution of a range.`),args:[Y(`data (range<number>)`,E(`The array of ranges containing the values to be counted.`)),Y(`classes (number, range<number>)`,E(`The range containing the set of classes.`))],compute:function(e,t){let n=qa([e],e=>e.value).filter(e=>typeof e==`number`),r=qa([t],e=>e.value).filter(e=>typeof e==`number`).map((e,t)=>({initialIndex:t,value:e,count:0})).sort((e,t)=>e.value-t.value);r.push({initialIndex:r.length,value:1/0,count:0});let i=n.sort((e,t)=>e-t),a=0;for(let e of i){for(;e>r[a].value&&a<r.length-1;)a++;r[a].count++}return[r.sort((e,t)=>e.initialIndex-t.initialIndex).map(e=>e.count)]},isExported:!0},O_={description:E(`Appends ranges horizontally and in sequence to return a larger array.`),args:[Y(`range1 (any, range<any>)`,E(`The first range to be appended.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to add to range1.`))],compute:function(...e){let t=Math.max(...e.map(e=>e?.[0]?.length??0)),n=[];for(let r of e){let e=z(r);for(let r=0;r<e.length;r++){let i=Array(t).fill({value:null});for(let t=0;t<e[r].length;t++)i[t]=e[r][t];n.push(i)}}return n},isExported:!0},k_={description:E(`Returns the matrix determinant of a square matrix.`),args:[Y(`square_matrix (number, range<number>)`,E(`An range with an equal number of rows and columns representing a matrix whose determinant will be calculated.`))],compute:function(e){let t=ma(e,`square_matrix`);return b_(E(`The argument square_matrix must have the same number of columns and rows.`),t),Cl(t).determinant},isExported:!0},A_={description:E(`Returns the multiplicative inverse of a square matrix.`),args:[Y(`square_matrix (number, range<number>)`,E(`An range with an equal number of rows and columns representing a matrix whose multiplicative inverse will be calculated.`))],compute:function(e){let t=ma(e,`square_matrix`);b_(E(`The argument square_matrix must have the same number of columns and rows.`),t);let{inverted:n}=Cl(t);return n||new M(E(`The matrix is not invertible.`))},isExported:!0},j_={description:E(`Calculates the matrix product of two matrices.`),args:[Y(`matrix1 (number, range<number>)`,E(`The first matrix in the matrix multiplication operation.`)),Y(`matrix2 (number, range<number>)`,E(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=ma(e,`matrix1`),r=ma(t,`matrix2`);return N(()=>n.length>0&&r.length>0,E(`The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices.`)),N(()=>n.length===r[0].length,E(`In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the number of rows of the second matrix (%s).`,n.length.toString(),r[0].length.toString())),Tl(n,r)},isExported:!0},M_={description:E(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[Y(`range1 (number, range<number>)`,E(`The first range whose entries will be multiplied with corresponding entries in the other ranges.`)),Y(`range2 (number, range<number>, repeating)`,E(`The other range whose entries will be multiplied with corresponding entries in the other ranges.`))],compute:function(...e){v_(E(`All the ranges must have the same dimensions.`),...e);let t=e.map(z),n=0;for(let e=0;e<t[0].length;e++)for(let r=0;r<t[0][e].length;r++){if(!t.every(t=>typeof t[e][r].value==`number`))continue;let i=1;for(let n of t)i*=F(n[e][r],this.locale);n+=i}return n},isExported:!0};function N_(e,t,n){v_(`The arguments array_x and array_y must have the same dimensions.`,e,t);let r=z(e),i=z(t),a=!1,o=0;for(let e in r)for(let t in r[e]){let s=r[e][t].value,c=i[e][t].value;typeof s!=`number`||typeof c!=`number`||(a=!0,o+=n(s,c))}if(!a)throw new M(E(`The arguments array_x and array_y must contain at least one pair of numbers.`));return o}let P_={description:E(`Calculates the sum of the difference of the squares of the values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values whose squares will be reduced by the squares of corresponding entries in array_y and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values whose squares will be subtracted from the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>e**2-t**2)},isExported:!0},F_={description:E(`Calculates the sum of the sum of the squares of the values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values whose squares will be added to the squares of corresponding entries in array_y and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values whose squares will be added to the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>e**2+t**2)},isExported:!0},I_={description:E(`Calculates the sum of squares of the differences of values in two array.`),args:[Y(`array_x (number, range<number>)`,E(`The array or range of values that will be reduced by corresponding entries in array_y, squared, and added together.`)),Y(`array_y (number, range<number>)`,E(`The array or range of values that will be subtracted from corresponding entries in array_x, the result squared, and all such results added together.`))],compute:function(e,t){return N_(e,t,(e,t)=>(e-t)**2)},isExported:!0},L_=[Y(`array (any, range<any>)`,E(`The array which will be transformed.`)),Y(`ignore (number, default=0)`,E(`The control to ignore blanks and errors. 0 (default) is to keep all values, 1 is to ignore blanks, 2 is to ignore errors, and 3 is to ignore blanks and errors.`)),Y(`scan_by_column (number, default=false)`,E(`Whether the array should be scanned by column. True scans the array by column and false (default) scans the array by row.`))];function R_(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!P(e.value);if(t===3)return e=>e.value!==null&&!P(e.value);throw new M(E(`Argument ignore must be between 0 and 3`))}let z_={description:E(`Transforms a range of cells into a single column.`),args:L_,compute:function(e,t={value:0},n={value:!1}){let r=z(e),i=F(t.value,this.locale),a=(L(n.value)?r:Pa(r)).flat().filter(R_(i));return a.length===0?new aa(E(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},B_={description:E(`Transforms a range of cells into a single row.`),args:L_,compute:function(e,t={value:0},n={value:!1}){let r=z(e),i=F(t.value,this.locale),a=(L(n.value)?r:Pa(r)).flat().filter(R_(i)).map(e=>[e]);return a.length===0||a[0].length===0?new aa(E(`No results for the given arguments of TOROW.`)):a},isExported:!0},V_={description:E(`Transposes the rows and columns of a range.`),args:[Y(`range (any, range<any>)`,E(`The range to be transposed.`))],compute:function(e){let t=z(e),n=t[0].length,r=t.length;return ja(n,r,(e,n)=>t[n][e])},isExported:!0},H_={description:E(`Appends ranges vertically and in sequence to return a larger array.`),args:[Y(`range1 (any, range<any>)`,E(`The first range to be appended.`)),Y(`range2 (any, range<any>, repeating)`,E(`Additional ranges to add to range1.`))],compute:function(...e){let t=Math.max(...e.map(e=>z(e).length)),n=e.reduce((e,t)=>e+z(t)[0].length,0),r=Array(t).fill([]).map(()=>Array(n).fill({value:0})),i=0;for(let t of e){let e=z(t);for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)r[t][i+n]=e[t][n];i+=e[0].length}return r},isExported:!0},U_={description:E(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[Y(`range (any, range<any>)`,E(`The range to wrap.`)),Y(`wrap_count (number)`,E(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),Y(`pad_with (any, default=0)`,E(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=z(e),i=ga(t?.value,this.locale);__(E(`Argument range must be a single row or column.`),r);let a=r.flat();return ja(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},W_={description:E(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[Y(`range (any, range<any>)`,E(`The range to wrap.`)),Y(`wrap_count (number)`,E(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),Y(`pad_with (any, default=0)`,E(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=z(e),i=ga(t?.value,this.locale);__(E(`Argument range must be a single row or column.`),r);let a=r.flat();return ja(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0};var G_=l({FORMAT_LARGE_NUMBER:()=>K_});let K_={description:E(`Apply a large number format`),args:[Y(`value (number)`,E(`The number.`)),Y(`unit (string, optional)`,E(`The formatting unit. Use 'k', 'm', or 'b' to force the unit`))],compute:function(e,t){return{value:F(e,this.locale),format:as(e,t,this.locale)}}};var q_=l({ABS:()=>Y_,ACOS:()=>X_,ACOSH:()=>Z_,ACOT:()=>Q_,ACOTH:()=>$_,ASIN:()=>ev,ASINH:()=>tv,ATAN:()=>nv,ATAN2:()=>rv,ATANH:()=>iv,CEILING:()=>av,CEILING_MATH:()=>sv,CEILING_PRECISE:()=>cv,COS:()=>lv,COSH:()=>uv,COT:()=>dv,COTH:()=>fv,COUNTBLANK:()=>pv,COUNTIF:()=>mv,COUNTIFS:()=>hv,COUNTUNIQUE:()=>gv,COUNTUNIQUEIFS:()=>_v,CSC:()=>vv,CSCH:()=>yv,DECIMAL:()=>bv,DEGREES:()=>xv,EXP:()=>Sv,FLOOR:()=>Cv,FLOOR_MATH:()=>Tv,FLOOR_PRECISE:()=>Ev,INT:()=>iy,ISEVEN:()=>Dv,ISODD:()=>kv,ISO_CEILING:()=>Ov,LN:()=>Av,LOG:()=>jv,MOD:()=>Nv,MUNIT:()=>Pv,ODD:()=>Fv,PI:()=>Iv,POWER:()=>Lv,PRODUCT:()=>Rv,RAND:()=>zv,RANDARRAY:()=>Bv,RANDBETWEEN:()=>Vv,ROUND:()=>Hv,ROUNDDOWN:()=>Uv,ROUNDUP:()=>Wv,SEC:()=>Gv,SECH:()=>Kv,SEQUENCE:()=>qv,SIN:()=>Jv,SINH:()=>Yv,SQRT:()=>Xv,SUM:()=>Zv,SUMIF:()=>Qv,SUMIFS:()=>$v,TAN:()=>ey,TANH:()=>ty,TRUNC:()=>ry});let J_=/^-?[a-z0-9]+$/i,Y_={description:E(`Absolute value of a number.`),args:[Y(`value (number)`,E(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(F(e,this.locale))},isExported:!0},X_={description:E(`Inverse cosine of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<=1,E(`The value (%s) must be between -1 and 1 inclusive.`,t.toString())),Math.acos(t)},isExported:!0},Z_={description:E(`Inverse hyperbolic cosine of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to 1.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>=1,E(`The value (%s) must be greater than or equal to 1.`,t.toString())),Math.acosh(t)},isExported:!0},Q_={description:E(`Inverse cotangent of a value.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=F(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},$_={description:E(`Inverse hyperbolic cotangent of a value.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic cotangent. Must not be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)>1,E(`The value (%s) cannot be between -1 and 1 inclusive.`,t.toString())),Math.log((t+1)/(t-1))/2},isExported:!0},ev={description:E(`Inverse sine of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<=1,E(`The value (%s) must be between -1 and 1 inclusive.`,t.toString())),Math.asin(t)},isExported:!0},tv={description:E(`Inverse hyperbolic sine of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(F(e,this.locale))},isExported:!0},nv={description:E(`Inverse tangent of a value, in radians.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(F(e,this.locale))},isExported:!0},rv={description:E(`Angle from the X axis to a point (x,y), in radians.`),args:[Y(`x (number)`,E(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),Y(`y (number)`,E(`The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n!==0||r!==0,E(`Function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero),Math.atan2(r,n)},isExported:!0},iv={description:E(`Inverse hyperbolic tangent of a number.`),args:[Y(`value (number)`,E(`The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive.`))],compute:function(e){let t=F(e,this.locale);return N(()=>Math.abs(t)<1,E(`The value (%s) must be between -1 and 1 exclusive.`,t.toString())),Math.atanh(t)},isExported:!0},av={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`value (number)`,E(`The value to round up to the nearest integer multiple of factor.`)),Y(`factor (number, default=1)`,E(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>r>=0||n<=0,E(`The factor (%s) must be positive when the value (%s) is positive.`,r.toString(),n.toString())),{value:r?Math.ceil(n/r)*r:0,format:e?.format}},isExported:!0};function ov(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.ceil(e/t)*t:n===0?-Math.floor(Math.abs(e)/t)*t:-Math.ceil(Math.abs(e)/t)*t)}let sv={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),Y(`mode (number, default=0)`,E(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded towards zero. Otherwise, it is rounded away from zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:ov(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},cv={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:ov(F(e,this.locale),n),format:e?.format}},isExported:!0},lv={description:E(`Cosine of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(F(e,this.locale))},isExported:!0},uv={description:E(`Hyperbolic cosine of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(F(e,this.locale))},isExported:!0},dv={description:E(`Cotangent of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.tan(t)},isExported:!0},fv={description:E(`Hyperbolic cotangent of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.tanh(t)},isExported:!0},pv={description:E(`Number of empty values.`),args:[Y(`value1 (any, range)`,E(`The first value or range in which to count the number of blanks.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges in which to count the number of blanks.`))],compute:function(...e){return Oa(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},mv={description:E(`A conditional count across a range.`),args:[Y(`range (range)`,E(`The range that is tested against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return Va(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},hv={description:E(`Count values depending on multiple criteria.`),args:[Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`Additional criteria to check.`))],compute:function(...e){let t=0;return Va(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},gv={description:E(`Counts number of unique values in a range.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider for uniqueness.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider for uniqueness.`))],compute:function(...e){return xl(e)}},_v={description:E(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the number of unique values will be counted.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=new Set;return Va(t,(t,r)=>{let i=e[t]?.[r];Ja(i)&&n.add(i.value)},this.locale),n.size}},vv={description:E(`Cosecant of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.sin(t)},isExported:!0},yv={description:E(`Hyperbolic cosecant of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=F(e,this.locale);return ya(t),1/Math.sinh(t)},isExported:!0},bv={description:E(`Converts from another base to decimal.`),args:[Y(`value (string)`,E(`The number to convert.`)),Y(`base (number)`,E(`The base to convert the value from.`))],compute:function(e,t){let n=F(t,this.locale);n=Math.floor(n),N(()=>2<=n&&n<=36,E(`The base (%s) must be between 2 and 36 inclusive.`,n.toString()));let r=I(e);if(r===``)return 0;N(()=>!!J_.test(r),E(`The value (%s) must be a valid base %s representation.`,r,n.toString()));let i=parseInt(r,n);return N(()=>!isNaN(i),E(`The value (%s) must be a valid base %s representation.`,r,n.toString())),i},isExported:!0},xv={description:E(`Converts an angle value in radians to degrees.`),args:[Y(`angle (number)`,E(`The angle to convert from radians to degrees.`))],compute:function(e){return F(e,this.locale)*180/Math.PI},isExported:!0},Sv={description:E(`Euler's number, e (~2.718) raised to a power.`),args:[Y(`value (number)`,E(`The exponent to raise e.`))],compute:function(e){return Math.exp(F(e,this.locale))},isExported:!0},Cv={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`value (number)`,E(`The value to round down to the nearest integer multiple of factor.`)),Y(`factor (number, default=1)`,E(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>r>=0||n<=0,E(`The factor (%s) must be positive when the value (%s) is positive.`,r.toString(),n.toString())),{value:r?Math.floor(n/r)*r:0,format:e?.format}},isExported:!0};function wv(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:n===0?-Math.ceil(Math.abs(e)/t)*t:-Math.floor(Math.abs(e)/t)*t)}let Tv={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round down to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),Y(`mode (number, default=0)`,E(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded away from zero. Otherwise, it is rounded towards zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:wv(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},Ev={description:E(`Rounds number down to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round down to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:wv(F(e,this.locale),n),format:e?.format}},isExported:!0},Dv={description:E(`Whether the provided value is even.`),args:[Y(`value (number)`,E(`The value to be verified as even.`))],compute:function(e){let t=ha(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},Ov={description:E(`Rounds number up to nearest multiple of factor.`),args:[Y(`number (number)`,E(`The value to round up to the nearest integer multiple of significance.`)),Y(`significance (number, default=1)`,E(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:ov(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},kv={description:E(`Whether the provided value is even.`),args:[Y(`value (number)`,E(`The value to be verified as even.`))],compute:function(e){let t=ha(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},Av={description:E(`The logarithm of a number, base e (euler's number).`),args:[Y(`value (number)`,E(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>0,E(`The value (%s) must be strictly positive.`,t.toString())),Math.log(t)},isExported:!0},jv={description:E(`The logarithm of a number, for a given base.`),args:[Y(`value (number)`,E(`The value for which to calculate the logarithm.`)),Y(`base (number, default=10)`,E(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n>0,E(`The value (%s) must be strictly positive.`,n.toString())),N(()=>r>0,E(`The base (%s) must be strictly positive.`,r.toString())),N(()=>r!==1,E(`The base must be different from 1.`)),Math.log10(n)/Math.log10(r)},isExported:!0};function Mv(e,t){N(()=>t!==0,E(`The divisor must be different from 0.`),j.DivisionByZero);let n=e%t;return n>0&&t<0||n<0&&t>0?n+t:n}let Nv={description:E(`Modulo (remainder) operator.`),args:[Y(`dividend (number)`,E(`The number to be divided to find the remainder.`)),Y(`divisor (number)`,E(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return{value:Mv(F(e,this.locale),n),format:e?.format}},isExported:!0},Pv={description:E(`Returns a n x n unit matrix, where n is the input dimension.`),args:[Y(`dimension (number)`,E(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=ga(e,this.locale);return y_(E(`The argument dimension must be positive`),t),Sl(t)},isExported:!0},Fv={description:E(`Rounds a number up to the nearest odd integer.`),args:[Y(`value (number)`,E(`The value to round to the next greatest odd number.`))],compute:function(e){let t=F(e,this.locale),n=Math.ceil(Math.abs(t));return n=n&1?n:n+1,{value:t<0?-n:n,format:e?.format}},isExported:!0},Iv={description:E(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},Lv={description:E(`A number raised to a power.`),args:[Y(`base (number)`,E(`The number to raise to the exponent power.`)),Y(`exponent (number)`,E(`The exponent to raise base to.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return N(()=>n>=0||Number.isInteger(r),E(`The exponent (%s) must be an integer when the base is negative.`,r.toString())),{value:n**+r,format:e?.format}},isExported:!0},Rv={description:E(`Result of multiplying a series of numbers together.`),args:[Y(`factor1 (number, range<number>)`,E(`The first number or range to calculate for the product.`)),Y(`factor2 (number, range<number>, repeating)`,E(`More numbers or ranges to calculate for the product.`))],compute:function(...e){let t=0,n=1;for(let r of e)if(A(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),P(e))return r}else r!==void 0&&r.value!==null&&(n*=ha(r,this.locale),t+=1);return{value:t===0?0:n,format:la(e[0])}},isExported:!0},zv={description:E(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},Bv={description:E(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[Y(`rows (number, default=1)`,E(`The number of rows to be returned.`)),Y(`columns (number, default=1)`,E(`The number of columns to be returned.`)),Y(`min (number, default=0)`,E(`The minimum number you would like returned.`)),Y(`max (number, default=1)`,E(`The maximum number you would like returned.`)),Y(`whole_number (number, default=FALSE)`,E(`Return a whole number or a decimal value.`))],compute:function(e={value:1},t={value:1},n={value:0},r={value:1},i={value:!1}){let a=ga(t,this.locale),o=ga(e,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=L(i);y_(E(`The number of columns (%s) must be positive.`,a.toString()),a),y_(E(`The number of rows (%s) must be positive.`,o.toString()),o),N(()=>s<=c,E(`The maximum (%s) must be greater than or equal to the minimum (%s).`,c.toString(),s.toString())),l&&N(()=>Number.isInteger(s)&&Number.isInteger(c),E(`The maximum (%s) and minimum (%s) must be integers when whole_number is TRUE.`,c.toString(),s.toString()));let u=Array(a);for(let e=0;e<a;e++){u[e]=Array(o);for(let t=0;t<o;t++)l?u[e][t]=Math.floor(Math.random()*(c-s+1)+s):u[e][t]=s+Math.random()*(c-s)}return u},isExported:!0},Vv={description:E(`Random integer between two values, inclusive.`),args:[Y(`low (number)`,E(`The low end of the random range.`)),Y(`high (number)`,E(`The high end of the random range.`))],compute:function(e,t){let n=F(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=F(t,this.locale);return Number.isInteger(r)||(r=Math.floor(r)),N(()=>n<=r,E(`The high (%s) must be greater than or equal to the low (%s).`,r.toString(),n.toString())),{value:n+Math.ceil((r-n+1)*Math.random())-1,format:e?.format}},isExported:!0},Hv={description:E(`Rounds a number according to standard rules.`),args:[Y(`value (number)`,E(`The value to round to places number of places.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.round(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.round(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Uv={description:E(`Rounds down a number.`),args:[Y(`value (number)`,E(`The value to round to places number of places, always rounding down.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.floor(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.floor(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Wv={description:E(`Rounds up a number.`),args:[Y(`value (number)`,E(`The value to round to places number of places, always rounding up.`)),Y(`places (number, default=0)`,E(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.ceil(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.ceil(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},Gv={description:E(`Secant of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(F(e,this.locale))},isExported:!0},Kv={description:E(`Hyperbolic secant of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(F(e,this.locale))},isExported:!0},qv={description:E(`Returns a sequence of numbers.`),args:[Y(`rows (number)`,E(`The number of rows to return`)),Y(`columns (number, optional, default=1)`,E(`The number of columns to return`)),Y(`start (number, optional, default=1)`,E(`The first number in the sequence`)),Y(`step (number, optional, default=1)`,E(`The amount to increment each value in the sequence`))],compute:function(e,t={value:1},n={value:1},r={value:1}){let i=F(n,this.locale),a=F(r,this.locale),o=ga(e,this.locale),s=ga(t,this.locale);return y_(E(`The number of columns (%s) must be positive.`,s),s),y_(E(`The number of rows (%s) must be positive.`,o),o),ja(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},Jv={description:E(`Sine of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(F(e,this.locale))},isExported:!0},Yv={description:E(`Hyperbolic sine of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(F(e,this.locale))},isExported:!0},Xv={description:E(`Positive square root of a positive number.`),args:[Y(`value (number)`,E(`The number for which to calculate the positive square root.`))],compute:function(e){let t=F(e,this.locale);return N(()=>t>=0,E(`The value (%s) must be positive or null.`,t.toString())),{value:Math.sqrt(t),format:e?.format}},isExported:!0},Zv={description:E(`Sum of a series of numbers and/or cells.`),args:[Y(`value1 (number, range<number>)`,E(`The first number or range to add together.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional numbers or ranges to add to value1.`))],compute:function(...e){let t=e[0];return{value:bl(e,this.locale),format:la(t)}},isExported:!0},Qv={description:E(`A conditional sum across a range.`),args:[Y(`criteria_range (range)`,E(`The range which is tested against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to range.`)),Y(`sum_range (range, default=criteria_range)`,E(`The range to be summed, if different from range.`))],compute:function(e,t,n){n===void 0&&(n=e);let r=0;return Va([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},$v={description:E(`Sums a range depending on multiple criteria.`),args:[Y(`sum_range (range)`,E(`The range to sum.`)),Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges to check.`)),Y(`criterion2 (string, repeating)`,E(`Additional criteria to check.`))],compute:function(e,...t){let n=0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},ey={description:E(`Tangent of an angle provided in radians.`),args:[Y(`angle (number)`,E(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(F(e,this.locale))},isExported:!0},ty={description:E(`Hyperbolic tangent of any real number.`),args:[Y(`value (number)`,E(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(F(e,this.locale))},isExported:!0};function ny(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let ry={description:E(`Truncates a number.`),args:[Y(`value (number)`,E(`The value to be truncated.`)),Y(`places (number, default=0)`,E(`The number of significant digits to the right of the decimal point to retain.`))],compute:function(e,t={value:0}){return{value:ny(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},iy={description:E(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[Y(`value (number)`,E(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(F(e,this.locale))},isExported:!0};var ay=l({AVEDEV:()=>uy,AVERAGE:()=>dy,AVERAGEA:()=>hy,AVERAGEIF:()=>gy,AVERAGEIFS:()=>_y,AVERAGE_WEIGHTED:()=>my,CORREL:()=>zy,COUNT:()=>vy,COUNTA:()=>yy,COVAR:()=>by,COVARIANCE_P:()=>xy,COVARIANCE_S:()=>Sy,FORECAST:()=>Cy,GROWTH:()=>wy,INTERCEPT:()=>Ty,LARGE:()=>Ey,LINEST:()=>Dy,LOGEST:()=>Oy,MATTHEWS:()=>ky,MAX:()=>Ay,MAXA:()=>jy,MAXIFS:()=>My,MEDIAN:()=>Ny,MIN:()=>Py,MINA:()=>Fy,MINIFS:()=>Iy,PEARSON:()=>Ry,PERCENTILE:()=>By,PERCENTILE_EXC:()=>Vy,PERCENTILE_INC:()=>Hy,POLYFIT_COEFFS:()=>Uy,POLYFIT_FORECAST:()=>Wy,QUARTILE:()=>Gy,QUARTILE_EXC:()=>Ky,QUARTILE_INC:()=>qy,RANK:()=>Jy,RSQ:()=>Yy,SLOPE:()=>Xy,SMALL:()=>Zy,SPEARMAN:()=>Qy,STDEV:()=>$y,STDEVA:()=>nb,STDEVP:()=>rb,STDEVPA:()=>ib,STDEV_P:()=>eb,STDEV_S:()=>tb,STEYX:()=>ab,TREND:()=>ob,VAR:()=>sb,VARA:()=>ub,VARP:()=>db,VARPA:()=>fb,VAR_P:()=>cb,VAR_S:()=>lb});function oy(e,t){let n=[],r=[],i=0,a=0;Ta([e],e=>{n.push(e),i+=1}),Ta([t],e=>{r.push(e),a+=1}),N(()=>i===a,E(`[[FUNCTION_NAME]] has mismatched argument count %s vs %s.`,i,a));let o=[],s=[];for(let e=0;e<i;e++){let t=n[e]?.value,i=r[e]?.value;typeof t==`number`&&typeof i==`number`&&(s.push(t),o.push(i))}return{flatDataX:o,flatDataY:s}}function sy(e,t,n){let{flatDataX:r,flatDataY:i}=oy(e,t),a=i.length;N(()=>a!==0&&(!n||a!==1),E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero);let o=0,s=0;for(let e=0;e<a;e++)o+=i[e],s+=r[e];let c=o/a,l=s/a,u=0;for(let e=0;e<a;e++)u+=(i[e]-c)*(r[e]-l);return u/(a-+!!n)}function cy(e,t,n,r){let i=0,a=0,o=n?Aa:ka;a=o(e,(e,t)=>(i+=1,e+t),0,r),N(()=>i!==0&&(!t||i!==1),E(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`),j.DivisionByZero);let s=a/i;return o(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function ly(e,t,n,r){let i=F(t,r);N(()=>n?0<=i&&i<=1:0<i&&i<1,E(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`));let a=[],o,s=0;return Ta(e,e=>{let t=e?.value;typeof t==`number`&&(o=Ha(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),N(()=>s!==0,E(`[[FUNCTION_NAME]] has no valid input data.`)),n||N(()=>1/(s+1)<=i&&i<=s/(s+1),E(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),ji(a,i,n)}let uy={description:E(`Average magnitude of deviations from mean.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){let t=0,n=ka(e,(e,n)=>(t+=1,e+n),0,this.locale);ya(t);let r=n/t;return ka(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},dy={description:E(`Numerical average value in a dataset, ignoring text.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the average value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the average value.`))],compute:function(...e){return{value:Al(e,this.locale),format:la(e[0])}},isExported:!0},fy=E(`[[FUNCTION_NAME]] has mismatched range sizes.`),py=E(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),my={description:E(`Weighted average.`),args:[Y(`values (number, range<number>)`,E(`Values to average.`)),Y(`weights (number, range<number>)`,E(`Weights for each corresponding value.`)),Y(`additional_values (number, range<number>, repeating)`,E(`Additional values to average.`)),Y(`additional_weights (number, range<number>, repeating)`,E(`Additional weights.`))],compute:function(...e){let t=0,n=0;for(let r=0;r<e.length-1;r+=2){let i=e[r],a=e[r+1];if(v_(fy,i,a),A(i))for(let e=0;e<i.length;e++)for(let r=0;r<i[0].length;r++){let o=i[e][r].value,s=A(a)?a?.[e][r].value:F(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){N(()=>s>=0,py),t+=o*s,n+=s;continue}N(()=>c===l,E(`[[FUNCTION_NAME]] expects number values.`))}else{let e=F(i,this.locale),r=A(a)?a?.[0][0].value:F(a,this.locale);typeof r==`number`&&(N(()=>r>=0,py),t+=e*r,n+=r)}}return ya(n),{value:t/n,format:la(e[0])}}},hy={description:E(`Numerical average value in a dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the average value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the average value.`))],compute:function(...e){let t=0,n=Aa(e,(e,n)=>(t+=1,e+n),0,this.locale);return ya(t),{value:n/t,format:la(e[0])}},isExported:!0},gy={description:E(`Average of values depending on criteria.`),args:[Y(`criteria_range (number, range<number>)`,E(`The range to check against criterion.`)),Y(`criterion (string)`,E(`The pattern or test to apply to criteria_range.`)),Y(`average_range (number, range<number>, default=criteria_range)`,E(`The range to average. If not included, criteria_range is used for the average instead.`))],compute:function(e,t,n){let r=z(n===void 0?e:n),i=0,a=0;return Va([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),ya(i),a/i},isExported:!0},_y={description:E(`Average of values depending on multiple criteria.`),args:[Y(`average_range (range)`,E(`The range to average.`)),Y(`criteria_range1 (range)`,E(`The range to check against criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional criteria_range and criterion to check.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=z(e),r=0,i=0;return Va(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),ya(r),i/r},isExported:!0},vy={description:E(`The number of numeric values in dataset.`),args:[Y(`value1 (number, any, range<number>)`,E(`The first value or range to consider when counting.`)),Y(`value2 (number, any, range<number>, repeating)`,E(`Additional values or ranges to consider when counting.`))],compute:function(...e){return jl(e,this.locale)},isExported:!0},yy={description:E(`The number of values in a dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when counting.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when counting.`))],compute:function(...e){return Ml(e)},isExported:!0},by={description:E(`The covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!1)},isExported:!0},xy={description:E(`The covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!1)},isExported:!0},Sy={description:E(`The sample covariance of a dataset.`),args:[Y(`data_y (any, range)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (any, range)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return sy(e,t,!0)},isExported:!0},Cy={description:E(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[Y(`x (number, range<number>)`,E(`The value(s) on the x-axis to forecast.`)),Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t,n){let{flatDataX:r,flatDataY:i}=oy(t,n);return Wl(r,i),Hl([i],[r],Ma(z(e),e=>F(e,this.locale)),!0)},isExported:!0},wy={description:E(`Fits points to exponential growth trend.`),args:[Y(`known_data_y (range<number>)`,E(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal exponential growth curve.`)),Y(`known_data_x (range<number>, default={1;2;3;...})`,E(`The values of the independent variable(s) corresponding with known_data_y.`)),Y(`new_data_x (any, range, default=known_data_x)`,E(`The data points to return the y values for on the ideal curve fit.`)),Y(`b (boolean, default=TRUE)`,E(`Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.`))],compute:function(e,t=[[]],n=[[]],r={value:!0}){return Ul(e,`known_data_y`),Bl(Hl(Vl(ma(e,`known_data_y`)),ma(t,`known_data_x`),ma(n,`new_data_y`),L(r)))}},Ty={description:E(`Compute the intercept of the linear regression.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let[[],[i]]=Il([n],[r]);return i},isExported:!0},Ey={description:E(`Nth largest element from a data set.`),args:[Y(`data (any, range)`,E(`Array or range containing the dataset to consider.`)),Y(`n (number)`,E(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;Ta([e],e=>{typeof e?.value==`number`&&(i=Ha(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.shift(),a--))});let o=r.shift();return N(()=>o!==void 0,E(`[[FUNCTION_NAME]] has no valid input data.`)),N(()=>a>=n,E(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)),o},isExported:!0},Dy={description:E(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>, default={1;2;3;...})`,E(`The range representing the array or matrix of independent data.`)),Y(`calculate_b (boolean, default=TRUE)`,E(`A flag specifying wheter to compute the slope or not`)),Y(`verbose (boolean, default=FALSE)`,E(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`))],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return Ul(e,`data_y`),Il(ma(t,`data_x`),ma(e,`data_y`),L(n),L(r))},isExported:!0},Oy={description:E(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>, optional, default={1;2;3;...})`,E(`The range representing the array or matrix of independent data.`)),Y(`calculate_b (boolean, default=TRUE)`,E(`A flag specifying wheter to compute the slope or not`)),Y(`verbose (boolean, default=FALSE)`,E(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`))],compute:function(e,t=[[]],n={value:!0},r={value:!1}){Ul(e,`data_y`);let i=Il(ma(t,`data_x`),Vl(ma(e,`data_y`)),L(n),L(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},ky={description:E(`Compute the Matthews correlation coefficient of a dataset.`),args:[Y(`data_x (range)`,E(`The range representing the array or matrix of observed data.`)),Y(`data_y (range)`,E(`The range representing the array or matrix of predicted data.`))],compute:function(e,t){let n=e.flat(),r=t.flat();kl(n,r),Wl(n,r);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=L(n[e]);t===L(r[e])?t?o++:a++:t?c++:s++}return(o*a-s*c)/Math.sqrt((o+s)*(o+c)*(a+s)*(a+c))},isExported:!1},Ay={description:E(`Maximum value in a numeric dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the maximum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the maximum value.`))],compute:function(...e){return Nl(e,this.locale)},isExported:!0},jy={description:E(`Maximum numeric value in a dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when calculating the maximum value.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when calculating the maximum value.`))],compute:function(...e){let t=Aa(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:la(e[0])}},isExported:!0},My={description:E(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the maximum will be determined.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=-1/0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n<i?i:n)},this.locale),n===-1/0?0:n},isExported:!0},Ny={description:E(`Median value in a numeric dataset.`),args:[Y(`value1 (any, range)`,E(`The first value or range to consider when calculating the median value.`)),Y(`value2 (any, range, repeating)`,E(`Additional values or ranges to consider when calculating the median value.`))],compute:function(...e){let t=[];return Ea(e,e=>{t.push(e)},this.locale),{value:ly(t,{value:.5},!0,this.locale),format:la(t[0])}},isExported:!0},Py={description:E(`Minimum value in a numeric dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the minimum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the minimum value.`))],compute:function(...e){return Pl(e,this.locale)},isExported:!0},Fy={description:E(`Minimum numeric value in a dataset.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range to consider when calculating the minimum value.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to consider when calculating the minimum value.`))],compute:function(...e){let t=Aa(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:la(e[0])}},isExported:!0},Iy={description:E(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[Y(`range (range)`,E(`The range of cells from which the minimum will be determined.`)),Y(`criteria_range1 (range)`,E(`The range of cells over which to evaluate criterion1.`)),Y(`criterion1 (string)`,E(`The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.`)),Y(`criteria_range2 (any, range, repeating)`,E(`Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.`)),Y(`criterion2 (string, repeating)`,E(`The pattern or test to apply to criteria_range2.`))],compute:function(e,...t){let n=1/0;return Va(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n>i?i:n)},this.locale),n===1/0?0:n},isExported:!0};function Ly(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let i=n.length,a=0,o=0,s=0,c=0,l=0;for(let e=0;e<i;e++){let t=n[e],i=r[e];a+=t,o+=i,s+=t*i,c+=t*t,l+=i*i}return(i*s-a*o)/Math.sqrt((i*c-a*a)*(i*l-o*o))}let Ry={description:E(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return Ly(e,t)},isExported:!0},zy=Ry,By={description:E(`Value at a given percentile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return Hy.compute.bind(this)(e,t)},isExported:!0},Vy={description:E(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile, exclusive of 0 and 1, whose value within 'data' will be calculated and returned.`))],compute:function(e,t){return{value:ly([e],t,!1,this.locale),format:la(e)}},isExported:!0},Hy={description:E(`Value at a given percentile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`percentile (number)`,E(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:ly([e],t,!0,this.locale),format:la(e)}},isExported:!0},Uy={description:E(`Compute the coefficients of polynomial regression of the dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`)),Y(`order (number)`,E(`The order of the polynomial to fit the data, between 1 and 6.`)),Y(`intercept (boolean, default=TRUE)`,E(`A flag specifying whether to compute the intercept or not.`))],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=oy(e,t);return Wl(i,a),Ll(a,i,F(n,this.locale),L(r))},isExported:!1},Wy={description:E(`Predict value by computing a polynomial regression of the dataset.`),args:[Y(`x (number, range<number>)`,E(`The value(s) on the x-axis to forecast.`)),Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`)),Y(`order (number)`,E(`The order of the polynomial to fit the data, between 1 and 6.`)),Y(`intercept (boolean, default=TRUE)`,E(`A flag specifying whether to compute the intercept or not.`))],compute:function(e,t,n,r,i={value:!0}){let a=F(r,this.locale),{flatDataX:o,flatDataY:s}=oy(t,n);Wl(o,s);let c=Ll(s,o,a,L(i)).flat();return Ma(z(e),e=>zl(c,F(e,this.locale),a))},isExported:!1},Gy={description:E(`Value nearest to a specific quartile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value to return.`))],compute:function(e,t){return qy.compute.bind(this)(e,t)},isExported:!0},Ky={description:E(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value, exclusive of 0 and 4, to return.`))],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:ly([e],n,!1,this.locale),format:la(e)}},isExported:!0},qy={description:E(`Value nearest to a specific quartile of a dataset.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`quartile_number (number)`,E(`Which quartile value to return.`))],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:ly([e],n,!0,this.locale),format:la(e)}},isExported:!0},Jy={description:E(`Returns the rank of a specified value in a dataset.`),args:[Y(`value (number)`,E(`The value whose rank will be determined.`)),Y(`data (range)`,E(`The range containing the dataset to consider.`)),Y(`is_ascending (boolean, default=FALSE)`,E(`Whether to consider the values in data in descending or ascending order.`))],compute:function(e,t,n={value:!1}){let r=L(n),i=F(e,this.locale),a=1,o=!1;for(let e of t)for(let t of e){if(typeof t.value!=`number`)continue;let e=F(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new aa(E(`Value not found in the given data.`))},isExported:!0},Yy={description:E(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return Ly(t,e)**2},isExported:!0},Xy={description:E(`Compute the slope of the linear regression.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);Wl(n,r);let[[i]]=Il([n],[r]);return i},isExported:!0},Zy={description:E(`Nth smallest element in a data set.`),args:[Y(`data (any, range)`,E(`The array or range containing the dataset to consider.`)),Y(`n (number)`,E(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;Ta([e],e=>{typeof e?.value==`number`&&(i=Ha(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.pop(),a--))});let o=r.pop();return N(()=>o!==void 0,E(`[[FUNCTION_NAME]] has no valid input data.`)),N(()=>a>=n,E(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)),o},isExported:!0},Qy={description:E(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(t,e);Wl(n,r);let i=n.length,a=n.map((e,t)=>[e,r[t]]);a.sort((e,t)=>e[0]-t[0]);for(let e=0;e<i;++e)a[e][0]=e;a.sort((e,t)=>e[1]-t[1]);let o=0;for(let e=0;e<i;++e)o+=(a[e][0]-e)**2;return 1-6*o/(i**3-i)},isExported:!1},$y={description:E(`Standard deviation.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(sb.compute.bind(this)(...e))},isExported:!0},eb={description:E(`Standard deviation of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(cb.compute.bind(this)(...e))},isExported:!0},tb={description:E(`Standard deviation.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(lb.compute.bind(this)(...e))},isExported:!0},nb={description:E(`Standard deviation of sample (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return Math.sqrt(ub.compute.bind(this)(...e))},isExported:!0},rb={description:E(`Standard deviation of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(db.compute.bind(this)(...e))},isExported:!0},ib={description:E(`Standard deviation of entire population (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return Math.sqrt(fb.compute.bind(this)(...e))},isExported:!0},ab={description:E(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[Y(`data_y (range<number>)`,E(`The range representing the array or matrix of dependent data.`)),Y(`data_x (range<number>)`,E(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=oy(e,t);return Wl(n,r),Il([n],[r],!0,!0)[1][2]},isExported:!0},ob={description:E(`Fits points to linear trend derived via least-squares.`),args:[Y(`known_data_y (number, range<number>)`,E(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal linear trend.`)),Y(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,E(`The values of the independent variable(s) corresponding with known_data_y.`)),Y(`new_data_x (number, range<number>, optional, default=known_data_x)`,E(`The data points to return the y values for on the ideal curve fit.`)),Y(`b (boolean, optional, default=TRUE)`,E(`Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.`))],compute:function(e,t=[[]],n=[[]],r={value:!0}){return Ul(e,`known_data_y`),Hl(ma(e,`known_data_y`),ma(t,`known_data_x`),ma(n,`new_data_y`),L(r))}},sb={description:E(`Variance.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!1,this.locale)},isExported:!0},cb={description:E(`Variance of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!1,this.locale)},isExported:!0},lb={description:E(`Variance.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!1,this.locale)},isExported:!0},ub={description:E(`Variance of sample (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the sample.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the sample.`))],compute:function(...e){return cy(e,!0,!0,this.locale)},isExported:!0},db={description:E(`Variance of entire population.`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!1,this.locale)},isExported:!0},fb={description:E(`Variance of entire population (text as 0).`),args:[Y(`value1 (number, range<number>)`,E(`The first value or range of the population.`)),Y(`value2 (number, range<number>, repeating)`,E(`Additional values or ranges to include in the population.`))],compute:function(...e){return cy(e,!1,!0,this.locale)},isExported:!0};var pb=l({DAVERAGE:()=>gb,DCOUNT:()=>_b,DCOUNTA:()=>vb,DGET:()=>yb,DMAX:()=>bb,DMIN:()=>xb,DPRODUCT:()=>Sb,DSTDEV:()=>Cb,DSTDEVP:()=>wb,DSUM:()=>Tb,DVAR:()=>Eb,DVARP:()=>Db});function mb(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(I(e[t][0]).toUpperCase(),t);let o=t?.value;if(typeof o!=`number`&&typeof o!=`string`)throw new M(E(`The field must be a number or a string`));let s;if(typeof o==`number`){if(s=Math.trunc(o)-1,s<0||a-1<s)throw new M(E(`The field (%(fieldValue)s) must be one of %(dimRowDB)s or must be a number between 1 and %s inclusive.`,{fieldValue:o.toString(),dimRowDB:a.toString()}))}else{let e=I(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(E(`The field (%s) must be one of %s.`,I(t),[...i.keys()].toString()))}let c=n[0].length;if(c<2)throw new M(E(`The criteria range contains %s row, it must be at least 2 rows.`,c.toString()));let l=new Set,u=e[0].length;for(let t=1;t<c;t++){let a=[],o=!0;for(let r=0;r<n.length;r++){let s=I(n[r][0]).toUpperCase(),c=i.get(s),l=n[r][t];if(l.value!==null)if(c!==void 0)a.push([e[c].slice(1,u)]),a.push(l);else{o=!1;break}}if(o)if(a.length>0)Va(a,(e,t)=>{l.add(t)},r,!0);else{l=new Set(Array(u-1).keys());break}}let d=e[s];return[...l].map(e=>d[e+1])}let hb=[Y(`database (range)`,E(`The array or range containing the data to consider, structured in such a way that the first row contains the labels for each column's values.`)),Y(`field (number, string)`,E(`Indicates which column in database contains the values to be extracted and operated on.`)),Y(`criteria (range)`,E(`An array or range containing zero or more criteria to filter the database values by before operating.`))],gb={description:E(`Average of a set of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return dy.compute.bind(this)([r])},isExported:!0},_b={description:E(`Counts values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return vy.compute.bind(this)([r])},isExported:!0},vb={description:E(`Counts values and text from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return yy.compute.bind(this)([r])},isExported:!0},yb={description:E(`Single value from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return N(()=>r.length===1,E(`More than one match found in DGET evaluation.`)),r[0]},isExported:!0},bb={description:E(`Maximum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Ay.compute.bind(this)([r])},isExported:!0},xb={description:E(`Minimum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Py.compute.bind(this)([r])},isExported:!0},Sb={description:E(`Product of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Rv.compute.bind(this)([r])},isExported:!0},Cb={description:E(`Standard deviation of population sample from table.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return $y.compute.bind(this)([r])},isExported:!0},wb={description:E(`Standard deviation of entire population from table.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return rb.compute.bind(this)([r])},isExported:!0},Tb={description:E(`Sum of values from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return Zv.compute.bind(this)([r])},isExported:!0},Eb={description:E(`Variance of population sample from table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return sb.compute.bind(this)([r])},isExported:!0},Db={description:E(`Variance of a population from a table-like range.`),args:hb,compute:function(e,t,n){let r=mb(e,t,n,this.locale);return db.compute.bind(this)([r])},isExported:!0};var Ob=l({DATE:()=>Ab,DATEDIF:()=>jb,DATEVALUE:()=>Mb,DAY:()=>Nb,DAYS:()=>Pb,DAYS360:()=>Fb,EDATE:()=>Ib,EOMONTH:()=>Lb,HOUR:()=>Rb,ISOWEEKNUM:()=>zb,MINUTE:()=>Bb,MONTH:()=>Vb,MONTH_END:()=>rx,MONTH_START:()=>nx,NETWORKDAYS:()=>Hb,NETWORKDAYS_INTL:()=>Wb,NOW:()=>Gb,QUARTER:()=>ix,QUARTER_END:()=>ox,QUARTER_START:()=>ax,SECOND:()=>Kb,TIME:()=>qb,TIMEVALUE:()=>Jb,TODAY:()=>Yb,WEEKDAY:()=>Xb,WEEKNUM:()=>Zb,WORKDAY:()=>Qb,WORKDAY_INTL:()=>$b,YEAR:()=>ex,YEARFRAC:()=>tx,YEAR_END:()=>cx,YEAR_START:()=>sx}),kb=function(e){return e.WHOLE_YEARS=`Y`,e.WHOLE_MONTHS=`M`,e.WHOLE_DAYS=`D`,e.DAYS_WITHOUT_WHOLE_MONTHS=`MD`,e.MONTH_WITHOUT_WHOLE_YEARS=`YM`,e.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR=`YD`,e}(kb||{});let Ab={description:E(`Converts year/month/day into a date.`),args:[Y(`year (number)`,E(`The year component of the date.`)),Y(`month (number)`,E(`The month component of the date.`)),Y(`day (number)`,E(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));N(()=>0<=r&&r<=9999,E(`The year (%s) must be between 0 and 9999 inclusive.`,r.toString())),r<1900&&(r+=1900);let o=li(new O(r,i-1,a));return N(()=>o>=0,E(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`)),{value:o,format:this.locale.dateFormat}},isExported:!0},jb={description:E(`Calculates the number of days, months, or years between two dates.`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),Y(`unit (string)`,E(`A text abbreviation for unit of time. Accepted values are "Y" (the number of whole years between start_date and end_date), "M" (the number of whole months between start_date and end_date), "D" (the number of days between start_date and end_date), "MD" (the number of days between start_date and end_date after subtracting whole months), "YM" (the number of whole months between start_date and end_date after subtracting whole years), "YD" (the number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart).`))],compute:function(e,t,n){let r=I(n).toUpperCase();N(()=>Object.values(kb).includes(r),fa(Object.values(kb),I(n)));let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=ci(i),s=ci(a);switch(N(()=>a>=i,E(`start_date (%s) should be on or before end_date (%s).`,o.toLocaleDateString(),s.toLocaleDateString())),r){case`Y`:return vi(o,s);case`M`:return gi(o,s);case`D`:return _i(o,s);case`YM`:return gi(o,s)-vi(o,s)*12;case`MD`:let e=s.getDate()-o.getDate();return e<0&&(e=di(new O(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case`YD`:{if(yi(i,a))return _i(o,s);let e=new O(o.getFullYear(),s.getMonth(),s.getDate()),t=_i(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=_i(o,e)),t}}},isExported:!0},Mb={description:E(`Converts a date string to a date value.`),args:[Y(`date_string (string)`,E(`The string representing the date.`))],compute:function(e){let t=I(e),n=Qr(t,this.locale);return N(()=>n!==null,E(`The date_string (%s) cannot be parsed to date/time.`,t.toString())),Math.trunc(n.value)},isExported:!0},Nb={description:E(`Day of the month that a specific date falls on.`),args:[Y(`date (string)`,E(`The date from which to extract the day.`))],compute:function(e){return R(e,this.locale).getDate()},isExported:!0},Pb={description:E(`Number of days between two dates.`),args:[Y(`end_date (date)`,E(`The end of the date range.`)),Y(`start_date (date)`,E(`The start of the date range.`))],compute:function(e,t){let n=R(e,this.locale),r=R(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Rr)},isExported:!0},Fb={description:E(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation.`)),Y(`method (number, default=0)`,E(`An indicator of what day count method to use. (0) US NASD method (1) European method`))],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=hi(r,i,L(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},Ib={description:E(`Date a number of months before/after another date.`),args:[Y(`start_date (date)`,E(`The date from which to calculate the result.`)),Y(`months (number)`,E(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:li(pi(R(e,this.locale),Math.trunc(F(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},Lb={description:E(`Last day of a month before or after a date.`),args:[Y(`start_date (date)`,E(`The date from which to calculate the result.`)),Y(`months (number)`,E(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=R(e,this.locale),r=Math.trunc(F(t,this.locale));return{value:li(new O(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},Rb={description:E(`Hour component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the hour component.`))],compute:function(e){return R(e,this.locale).getHours()},isExported:!0},zb={description:E(`ISO week number of the year.`),args:[Y(`date (date)`,E(`The date for which to determine the ISO week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`))],compute:function(e){let t=R(e,this.locale),n=t.getFullYear(),r=1;for(;new O(n,0,r).getDay()!==4;)r+=1;let i=new O(n,0,r-3),a=31;for(;new O(n,11,a).getDay()!==4;)--a;let o=new O(n,11,a+3),s;s=i.getTime()<=t.getTime()?t.getTime()<=o.getTime()?0:1:-1;let c;switch(s){case 0:c=i;break;case 1:c=new O(n,11,a+3+1);break;case-1:let e=1;for(;new O(n-1,0,e).getDay()!==4;)e+=1;c=new O(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Rr;return Math.floor(l/7)+1},isExported:!0},Bb={description:E(`Minute component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the minute component.`))],compute:function(e){return R(e,this.locale).getMinutes()},isExported:!0},Vb={description:E(`Month of the year a specific date falls in`),args:[Y(`date (date)`,E(`The date from which to extract the month.`))],compute:function(e){return R(e,this.locale).getMonth()+1},isExported:!0},Hb={description:E(`Net working days between two provided days.`),args:[Y(`start_date (date)`,E(`The start date of the period from which to calculate the number of net working days.`)),Y(`end_date (date)`,E(`The end date of the period from which to calculate the number of net working days.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the date serial numbers to consider holidays.`))],compute:function(e,t,n){return Wb.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function Ub(e){let t=e?.value;if(typeof t==`string`){N(()=>{if(t.length!==7)return!1;for(let e of t)if(e!==`0`&&e!==`1`)return!1;return!0},E(`When weekend is a string (%s) it must be composed of "0" or "1".`,t));let e=[];for(let n=0;n<7;n++)t[n]===`1`&&e.push((n+1)%7);return e}if(typeof t==`number`)return N(()=>1<=t&&t<=7||11<=t&&t<=17,E(`The weekend (%s) must be a string or a number in the range 1-7 or 11-17.`,t.toString())),t<=7?[t-2==-1?6:t-2,t-1]:[t-11];throw new M(E(`The weekend must be a number or a string.`))}let Wb={description:E(`Net working days between two dates (specifying weekends).`),args:[Y(`start_date (date)`,E(`The start date of the period from which to calculate the number of net working days.`)),Y(`end_date (date)`,E(`The end date of the period from which to calculate the number of net working days.`)),Y(`weekend (any, default=1)`,E(`A number or string representing which days of the week are considered weekends.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider as holidays.`))],compute:function(e,t,n={value:1},r){let i=R(e,this.locale),a=R(t,this.locale),o=Ub(n),s=new Set;r!==void 0&&Ta([r],e=>{let t=R(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=O.fromTimestamp((c?i:a).getTime()),u=O.fromTimestamp((c?a:i).getTime()),d=l.getTime(),f=u.getTime(),p=0;for(;f<=d;)!o.includes(u.getDay())&&!s.has(f)&&(p+=1),u.setDate(u.getDate()+1),f=u.getTime();return c?-p:p},isExported:!0},Gb={description:E(`Current date and time as a date value.`),args:[],compute:function(){let e=O.now(),t=e.getTime()-Lr.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Rr)+n,format:_l(this.locale)}},isExported:!0},Kb={description:E(`Minute component of a specific time.`),args:[Y(`time (date)`,E(`The time from which to calculate the second component.`))],compute:function(e){return R(e,this.locale).getSeconds()},isExported:!0},qb={description:E(`Converts hour/minute/second into a time.`),args:[Y(`hour (number)`,E(`The hour component of the time.`)),Y(`minute (number)`,E(`The minute component of the time.`)),Y(`second (number)`,E(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return i+=Math.floor(a/60),a=a%60+(a<0?60:0),r+=Math.floor(i/60),i=i%60+(i<0?60:0),r%=24,N(()=>r>=0,E(`The function [[FUNCTION_NAME]] result cannot be negative`)),{value:r/24+i/1440+a/(1440*60),format:this.locale.timeFormat}},isExported:!0},Jb={description:E(`Converts a time string into its serial number representation.`),args:[Y(`time_string (string)`,E(`The string that holds the time representation.`))],compute:function(e){let t=I(e),n=Qr(t,this.locale);N(()=>n!==null,E(`The time_string (%s) cannot be parsed to date/time.`,t));let r=n.value-Math.trunc(n.value);return r<0?1+r:r},isExported:!0},Yb={description:E(`Current date as a date value.`),args:[],compute:function(){let e=O.now();return{value:li(new O(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},Xb={description:E(`Day of the week of the date provided (as number).`),args:[Y(`date (date)`,E(`The date for which to determine the day of the week. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`type (number, default=1)`,E(`A number indicating which numbering system to use to represent weekdays. By default, counts starting with Sunday = 1.`))],compute:function(e,t={value:1}){let n=R(e,this.locale),r=Math.round(F(t,this.locale)),i=n.getDay();return N(()=>[1,2,3].includes(r),E(`The type (%s) must be 1, 2 or 3.`,r.toString())),r===1?i+1:r===2?i===0?7:i:i===0?6:i-1},isExported:!0},Zb={description:E(`Week number of the year.`),args:[Y(`date (date)`,E(`The date for which to determine the week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`type (number, default=1)`,E(`A number representing the day that a week starts on. Sunday = 1.`))],compute:function(e,t={value:1}){let n=R(e,this.locale),r=Math.round(F(t,this.locale));if(N(()=>r===1||r===2||11<=r&&r<=17||r===21,E(`The type (%s) is out of range.`,r.toString())),r===21)return zb.compute.bind(this)(e);let i;i=r===1||r===2?r-1:r-10==7?0:r-10;let a=n.getFullYear(),o=1,s=new O(a,0,o);for(;s.getDay()!==i;)o+=1,s=new O(a,0,o);let c=(n.getTime()-s.getTime())/Rr;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},Qb={description:E(`Date after a number of workdays.`),args:[Y(`start_date (date)`,E(`The date from which to begin counting.`)),Y(`num_days (number)`,E(`The number of working days to advance from start_date. If negative, counts backwards.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:null}){return $b.compute.bind(this)(e,t,{value:1},n)},isExported:!0},$b={description:E(`Date after a number of workdays (specifying weekends).`),args:[Y(`start_date (date)`,E(`The date from which to begin counting.`)),Y(`num_days (number)`,E(`The number of working days to advance from start_date. If negative, counts backwards.`)),Y(`weekend (any, default=1)`,E(`A number or string representing which days of the week are considered weekends.`)),Y(`holidays (date, range<date>, optional)`,E(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:1},r){let i=R(e,this.locale),a=Math.trunc(F(t,this.locale));typeof n.value==`string`&&N(()=>n.value!==`1111111`,E(`The weekend must be different from '1111111'.`));let o=Ub(n),s=new Set;r!==void 0&&Ta([r],e=>{let t=R(e,this.locale);s.add(t.getTime())});let c=O.fromTimestamp(i.getTime()),l=c.getTime(),u=Math.sign(a),d=Math.abs(a);for(;d>0;)c.setDate(c.getDate()+u),l=c.getTime(),!o.includes(c.getDay())&&!s.has(l)&&--d;let f=l-Lr.getTime();return{value:Math.round(f/Rr),format:this.locale.dateFormat}},isExported:!0},ex={description:E(`Year specified by a given date.`),args:[Y(`date (date)`,E(`The date from which to extract the year.`))],compute:function(e){return R(e,this.locale).getFullYear()},isExported:!0},tx={description:E(`Exact number of years between two dates.`),args:[Y(`start_date (date)`,E(`The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`end_date (date)`,E(`The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),Y(`day_count_convention (number, default=0)`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return N(()=>r>=0,E(`The start_date (%s) must be positive or null.`,r.toString())),N(()=>i>=0,E(`The end_date (%s) must be positive or null.`,i.toString())),N(()=>0<=a&&a<=4,E(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,a.toString())),hi(r,i,a)}},nx={description:E(`First day of the month preceding a date.`),args:[Y(`date (date)`,E(`The date from which to calculate the result.`))],compute:function(e){let t=R(e,this.locale);return{value:li(new O(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},rx={description:E(`Last day of the month following a date.`),args:[Y(`date (date)`,E(`The date from which to calculate the result.`))],compute:function(e){return Lb.compute.bind(this)(e,{value:0})}},ix={description:E(`Quarter of the year a specific date falls in`),args:[Y(`date (date)`,E(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((R(e,this.locale).getMonth()+1)/3)}},ax={description:E(`First day of the quarter of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=ix.compute.bind(this)(e);return{value:li(new O(ex.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},ox={description:E(`Last day of the quarter of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=ix.compute.bind(this)(e);return{value:li(new O(ex.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},sx={description:E(`First day of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:li(new O(ex.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},cx={description:E(`Last day of the year a specific date falls in.`),args:[Y(`date (date)`,E(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:li(new O(ex.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var lx=l({DELTA:()=>ux});let ux={description:E(`Compare two numeric values, returning 1 if they're equal.`),args:[Y(`number1 (number)`,E(`The first number to compare.`)),Y(`number2 (number, default=0)`,E(`The second number to compare.`))],compute:function(e,t={value:0}){return+(F(e,this.locale)===F(t,this.locale))},isExported:!0},dx=[`number`,`error`,`text`,`boolean`];function fx(e){let t=e===`ascending`?1:-1;return(e,n)=>{if(e.type===`empty`)return n.type===`empty`?0:1;if(n.type===`empty`)return-1;let r=dx.indexOf(e.type)-dx.indexOf(n.type);return r===0&&(r=e.type===`text`||e.type===`error`?e.value.localeCompare(n.value):e.value-n.value),t*r}}function px(e,t,n){let r=e.map((e,t)=>({index:t,type:e.type,value:e.value}));return(n?r.map(e=>e.type===`empty`?{...e,type:`number`,value:0}:e):r).sort(fx(t))}function mx(e,t,n,r,i){let a=qi.Success,o=r.right>r.left;if(e.model.getters.doesIntersectMerge(t,r)){o=!1;let n;for(let i=r.top;i<=r.bottom;i++){n=[];for(let a=r.left;a<=r.right;a++){let r=e.model.getters.getMerge({sheetId:t,col:a,row:i});r&&!n.includes(r.id.toString())&&n.push(r.id.toString())}if(n.length>=2){o=!0;break}}}let{col:s,row:c}=n;if(o)a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i});else{let n=e.model.getters.getContiguousZone(t,r);lr(n,r)?a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i}):e.askConfirmation(E(`We found data next to your selection. Since this data was not selected, it will not be sorted. Do you want to extend your selection?`),()=>{r=n,a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i})},()=>{a=e.model.dispatch(`SORT_CELLS`,{sheetId:t,col:s,row:c,zone:r,sortDirection:i})})}if(a.isCancelledBecause(`InvalidSortZone`)){let{col:t,row:i}=n;e.model.selection.selectZone({cell:{col:t,row:i},zone:r}),e.raiseError(E(`Cannot sort. To sort, select only cells or only merges that have the same size.`))}}var hx=l({FILTER:()=>_x,SORT:()=>vx,SORTN:()=>yx,UNIQUE:()=>bx});function gx(e,t,...n){for(let e=0;e<n.length;e++)N(()=>n[e]!==void 0,E(`Value for parameter %s is missing in [[FUNCTION_NAME]].`,e%2==0?`sort_column`:`is_ascending`));let r=[],i=[],a=e.length;for(let o=0;o<n.length;o+=2){r.push(L(El(n[o+1])?.value)?`ascending`:`descending`);let s=n[o];if(A(s)&&(s.length>1||s[0].length>1))N(()=>s.length===1&&s[0].length===a,E(`Wrong size for %s. Expected a range of size 1x%s. Got %sx%s.`,`sort_column${o+1}`,a,s.length,s[0].length)),i.push(s.flat().map(e=>e.value));else{let n=F(El(s)?.value,t);if(n<1||n>e[0].length)return e;i.push(e.map(e=>e[n-1].value))}}if(i.length===0)for(let t=0;t<e[0].length;t++)i.push(e.map(e=>e[t].value)),r.push(`ascending`);let o={descending:fx(`descending`),ascending:fx(`ascending`)},s=x(0,e.length);return s.sort((e,t)=>{for(let[n,a]of i.entries()){let i=a[e],s=a[t],c={value:i,type:i===null?`empty`:typeof i==`string`?`text`:typeof i},l={value:s,type:s===null?`empty`:typeof s==`string`?`text`:typeof s},u=o[r[n]](c,l);if(u!==0)return u}return 0}),s.map(t=>e[t])}let _x={description:E(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[Y(`range (any, range<any>)`,E(`The data to be filtered.`)),Y(`condition1 (boolean, range<boolean>)`,E(`A column or row containing true or false values corresponding to the first column or row of range.`)),Y(`condition2 (boolean, range<boolean>, repeating)`,E(`Additional column or row containing true or false values.`))],compute:function(e,...t){let n=z(e),r=t.map(e=>Ma(z(e),e=>e.value));r.map(e=>__(E(`The arguments condition must be a single column or row.`),e)),v_(E(`The arguments conditions must have the same dimensions.`),...t);let i=r.map(e=>e.flat()),a=r[0].length===1?`row`:`col`;n=a===`row`?Pa(n):n,N(()=>i.every(e=>e.length===n.length),E(`FILTER has mismatched sizes on the range and conditions.`));let o=[];for(let e=0;e<n.length;e++){let t=n[e];i.every(t=>(typeof t[e]==`boolean`||typeof t[e]==`number`)&&t[e])&&o.push(t)}return o.length?a===`row`?Pa(o):o:new aa(E(`No match found in FILTER evaluation`))},isExported:!1},vx={description:E(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[Y(`range (range)`,E(`The data to be sorted.`)),Y(`sort_column (any, range<number>, repeating)`,E(`The index of the column in range or a range outside of range containing the values by which to sort.`)),Y(`is_ascending (boolean, repeating)`,E(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`))],compute:function(e,...t){return Pa(gx(Pa(e),this.locale,...t))},isExported:!0},yx={description:E(`Returns the first n items in a data set after performing a sort.`),args:[Y(`range (range)`,E(`The data to be sorted.`)),Y(`n (number, default=1)`,E(`The number of items to return.`)),Y(`display_ties_mode (number, default=0)`,E(`A number representing the way to display ties.`)),Y(`sort_column (number, range<number>, repeating)`,E(`The index of the column in range or a range outside of range containing the values by which to sort.`)),Y(`is_ascending (boolean, repeating)`,E(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`))],compute:function(e,t,n,...r){let i=F(t?.value??1,this.locale);N(()=>i>=0,E(`Wrong value of 'n'. Expected a positive number. Got %s.`,i));let a=F(n?.value??0,this.locale);N(()=>a>=0&&a<=3,E(`Wrong value of 'display_ties_mode'. Expected a positive number between 0 and 3. Got %s.`,a));let o=gx(Pa(e),this.locale,...r),s=(e,t)=>JSON.stringify(o[e].map(e=>e.value))===JSON.stringify(o[t].map(e=>e.value));switch(a){case 0:return Pa(o.slice(0,i));case 1:for(let e=i;e<o.length;e++)if(!s(e,i-1))return Pa(o.slice(0,e));return Pa(o);case 2:{let e=[o[0]];for(let t=1;t<o.length;t++)for(let n=0;n<t&&!s(t,n);n++)n===t-1&&e.push(o[t]);return Pa(e.slice(0,i))}case 3:{let e=[o[0]],t=1;for(let n=1;n<o.length&&(s(n,n-1)||t++,!(t>i));n++)e.push(o[n]);return Pa(e)}}},isExported:!1},bx={description:E(`Unique rows in the provided source range.`),args:[Y(`range (any, range<any>)`,E(`The data to filter by unique entries.`)),Y(`by_column (boolean, default=FALSE)`,E(`Whether to filter the data by columns or by rows.`)),Y(`exactly_once (boolean, default=FALSE)`,E(`Whether to return only entries with no duplicates.`))],compute:function(e={value:``},t,n){if(!A(e))return[[e]];let r=L(t?.value)||!1,i=L(n?.value)||!1;r||(e=Pa(e));let a=new Map;for(let t of e){let e=JSON.stringify(t.map(e=>e.value)),n=a.get(e);n?n.count++:a.set(e,{data:t,count:1})}let o=[];for(let e of a.values())i&&e.count>1||o.push(e.data);return o.length?r?o:Pa(o):new M(E(`No unique values found`))},isExported:!0};function xx(e,t){N(()=>e<t,E(`The maturity (%s) must be strictly greater than the settlement (%s).`,t.toString(),e.toString()))}function Sx(e,t){N(()=>t<e,E(`The settlement date (%s) must be strictly greater than the issue date (%s).`,e.toString(),t.toString()))}function Cx(e){N(()=>[1,2,4].includes(e),E(`The frequency (%s) must be one of %s`,e.toString(),[1,2,4].toString()))}function wx(e){N(()=>0<=e&&e<=4,E(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e.toString()))}function Tx(e){N(()=>e>0,E(`The redemption (%s) must be strictly positive.`,e.toString()))}function Ex(e){N(()=>e>0,E(`The price (%s) must be strictly positive.`,e.toString()))}function Dx(e){N(()=>e>0,E(`The number_of_periods (%s) must be greater than 0.`,e.toString()))}function Ox(e){N(()=>e>0,E(`The rate (%s) must be strictly positive.`,e.toString()))}function kx(e){N(()=>e>0,E(`The life (%s) must be strictly positive.`,e.toString()))}function Ax(e){N(()=>e>0,E(`The cost (%s) must be strictly positive.`,e.toString()))}function jx(e){N(()=>e>=0,E(`The purchase_date (%s) must be positive or null.`,e.toString()))}function Mx(e){N(()=>e>=0,E(`The issue (%s) must be positive or null.`,e.toString()))}function Nx(e){N(()=>e>=0,E(`The cost (%s) must be positive or null.`,e.toString()))}function Px(e){N(()=>e>0,E(`The period (%s) must be strictly positive.`,e.toString()))}function Fx(e){N(()=>e>=0,E(`The period (%s) must be positive or null.`,e.toString()))}function Ix(e){N(()=>e>=0,E(`The salvage (%s) must be positive or null.`,e.toString()))}function Lx(e,t){N(()=>e<=t,E(`The salvage (%s) must be smaller or equal than the cost (%s).`,e.toString(),t.toString()))}function Rx(e){N(()=>e>0,E(`The present value (%s) must be strictly positive.`,e.toString()))}function zx(e,t){N(()=>e<=t,E(`The period (%s) must be less than or equal life (%s).`,e.toString(),t.toString()))}function Bx(e){N(()=>e>0,E(`The investment (%s) must be strictly positive.`,e.toString()))}function Vx(e){N(()=>e>0,E(`The discount (%s) must be strictly positive.`,e.toString()))}function Hx(e){N(()=>e<1,E(`The discount (%s) must be smaller than 1.`,e.toString()))}function Ux(e){N(()=>e>0,E(`The depreciation factor (%s) must be strictly positive.`,e.toString()))}function Wx(e,t,n){let r=R(e,n),i=R(t,n),a=R(e,n);a.setFullYear(r.getFullYear()+1),N(()=>i.getTime()<=a.getTime(),E(`The settlement date (%s) must at most one year after the maturity date (%s).`,e.toString(),t.toString()))}function Gx(e,t,n){Dx(n),N(()=>e>0,E(`The first_period (%s) must be strictly positive.`,e.toString())),N(()=>t>0,E(`The last_period (%s) must be strictly positive.`,t.toString())),N(()=>e<=t,E(`The first_period (%s) must be smaller or equal to the last_period (%s).`,e.toString(),t.toString())),N(()=>t<=n,E(`The last_period (%s) must be smaller or equal to the number_of_periods (%s).`,e.toString(),n.toString()))}function Kx(e,t,n){kx(n),N(()=>e>=0,E(`The start_period (%s) must be greater or equal than 0.`,e.toString())),N(()=>t>=0,E(`The end_period (%s) must be greater or equal than 0.`,t.toString())),N(()=>e<=t,E(`The start_period (%s) must be smaller or equal to the end_period (%s).`,e.toString(),t.toString())),N(()=>t<=n,E(`The end_period (%s) must be smaller or equal to the life (%s).`,e.toString(),n.toString()))}function qx(e){N(()=>e>-1,E(`The rate_guess (%s) must be strictly greater than -1.`,e.toString()))}function Jx(e,t){N(()=>e.length===t.length&&e[0].length===t[0].length,E(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`))}function Yx(e){N(()=>e.some(e=>e>0)&&e.some(e=>e<0),E(`There must be both positive and negative values in cashflow_amounts.`))}function Xx(e){N(()=>e.every(t=>t>=e[0]),E(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e[0].toString()))}var Zx=l({ACCRINTM:()=>eS,AMORLINC:()=>tS,COUPDAYBS:()=>rS,COUPDAYS:()=>nS,COUPDAYSNC:()=>iS,COUPNCD:()=>aS,COUPNUM:()=>oS,COUPPCD:()=>sS,CUMIPMT:()=>cS,CUMPRINC:()=>lS,DB:()=>uS,DDB:()=>fS,DISC:()=>pS,DOLLARDE:()=>mS,DOLLARFR:()=>hS,DURATION:()=>gS,EFFECT:()=>_S,FV:()=>yS,FVSCHEDULE:()=>bS,INTRATE:()=>xS,IPMT:()=>CS,IRR:()=>TS,ISPMT:()=>ES,MDURATION:()=>DS,MIRR:()=>OS,NOMINAL:()=>kS,NPER:()=>AS,NPV:()=>MS,PDURATION:()=>NS,PMT:()=>FS,PPMT:()=>LS,PRICE:()=>zS,PRICEDISC:()=>BS,PRICEMAT:()=>VS,PV:()=>RS,RATE:()=>US,RECEIVED:()=>WS,RRI:()=>GS,SLN:()=>KS,SYD:()=>qS,TBILLEQ:()=>XS,TBILLPRICE:()=>YS,TBILLYIELD:()=>ZS,VDB:()=>QS,XIRR:()=>$S,XNPV:()=>eC,YIELD:()=>tC,YIELDDISC:()=>nC,YIELDMAT:()=>rC});let Qx=[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))];function $x(e,t,n,r,i=1e-10,a){let o=n,s,c,l,u=!1,d=0,f;do{if(l=e(o),isNaN(l)){N(()=>d<r&&a!==void 0,E(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++,o=a(f),f=o;continue}s=o-l/t(o),c=Math.abs(s-o),o=s,u=c<i||Math.abs(l)<i,N(()=>d<r,E(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let eS={description:E(`Accrued interest of security paying at maturity.`),args:[Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`maturity (date)`,E(`The maturity date of the security.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));Mx(a),Sx(o,a),wx(l),Tx(s),Ox(c);let u=hi(a,o,l);return s*c*u},isExported:!0},tS={description:E(`Depreciation for an accounting period.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`purchase_date (date)`,E(`The date the asset was purchased.`)),Y(`first_period_end (date)`,E(`The date the first period ended.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`rate (number)`,E(`The deprecation rate.`)),Y(`day_count_convention (number, optional)`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=F(e,this.locale),c=Math.trunc(F(t,this.locale)),l=Math.trunc(F(n,this.locale)),u=F(r,this.locale),d=F(i,this.locale),f=F(a,this.locale),p=Math.trunc(F(o,this.locale));Ax(s),jx(c),Ix(u),Lx(u,s),Fx(d),Ox(f),wx(p),N(()=>c<=l,E(`The purchase_date (%s) must be before the first_period_end (%s).`,c.toString(),l.toString()));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=hi(c,l,p),_=c===l?h:h*g,v=s-_-h*m;return v>=u?m===0?_:h:u-v<h?h-(u-v):0},isExported:!0},nS={description:E(`Days in coupon period containing settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(xx(i,a),Cx(o),wx(s),s===1){let i=sS.compute.bind(this)(e,t,n,r).value;return aS.compute.bind(this)(e,t,n,r).value-i}return(s===3?365:360)/o},isExported:!0},rS={description:E(`Days from settlement until next coupon.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=sS.compute.bind(this)(e,t,n,r).value;if([1,2,3].includes(s))return i-c;if(s===4){let e=hi(c,i,s);return Math.round(e*360)}let l=R(i,this.locale),u=R(c,this.locale),d=u.getFullYear(),f=l.getFullYear(),p=u.getMonth()+1,m=l.getMonth()+1,h=u.getDate(),g=l.getDate();return p===2&&m===2&&fi(u)&&fi(l)&&(g=30),g===31&&(h===30||h===31)&&(g=30),p===2&&fi(u)&&(h=30),h===31&&(h=30),(f-d)*360+(m-p)*30+(g-h)},isExported:!0},iS={description:E(`Days from settlement until next coupon.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=aS.compute.bind(this)(e,t,n,r).value;if([1,2,3].includes(s))return c-i;if(s===4){let e=hi(i,c,s);return Math.round(e*360)}let l=rS.compute.bind(this)(e,t,n,r);return nS.compute.bind(this)(e,t,n,r)-l},isExported:!0},aS={description:E(`Next coupon date after the settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=12/o,l=oS.compute.bind(this)(e,t,n,r);return{value:li(pi(R(a,this.locale),-(l-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},oS={description:E(`Number of coupons between settlement and maturity.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=1,l=a,u=12/o;for(;l>i;)l=li(pi(R(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},sS={description:E(`Last coupon date prior to or on the settlement date.`),args:Qx,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));xx(i,a),Cx(o),wx(s);let c=12/o,l=oS.compute.bind(this)(e,t,n,r);return{value:li(pi(R(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},cS={description:E(`Cumulative interest paid over a set of periods.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`first_period (number)`,E(`The number of the payment period to begin the cumulative calculation.`)),Y(`last_period (number)`,E(`The number of the payment period to end the cumulative calculation.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);Gx(o,s,u),Ox(c),Rx(l);let f=0;for(let e=o;e<=s;e++)f+=SS(c,e,u,l,0,d);return f},isExported:!0},lS={description:E(`Cumulative principal paid over a set of periods.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`first_period (number)`,E(`The number of the payment period to begin the cumulative calculation.`)),Y(`last_period (number)`,E(`The number of the payment period to end the cumulative calculation.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);Gx(o,s,u),Ox(c),Rx(l);let f=0;for(let e=o;e<=s;e++)f+=IS(c,e,u,l,0,d);return f},isExported:!0},uS={description:E(`Depreciation via declining balance method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`month (number, optional)`,E(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=Math.trunc(F(r,this.locale)),l=i.length?Math.trunc(F(i[0],this.locale)):12,u=s+(l===12?0:1);Nx(a),Ix(o),Px(c),kx(s),N(()=>1<=l&&l<=12,E(`The month (%s) must be between 1 and 12 inclusive.`,l.toString())),N(()=>c<=u,E(`The period (%s) must be less than or equal to %s.`,c.toString(),u.toString()));let d=l/12,f=1-(o/a)**(1/s);f=Math.round(f*1e3)/1e3;let p=a,m=a*(1-f*d);for(let e=1;e<c;e++)p=m,m=p*(1-f),e===s&&(m=p*(1-f*(1-d)));return{value:p-m,format:`#,##0.00`}},isExported:!0};function dS(e,t,n,r,i){if(Nx(e),Ix(t),Px(r),kx(n),zx(r,n),Ux(i),e===0||t>=e)return 0;let a=i/n;if(a>1)return r===1?e-t:0;if(r<=1)return e*a;let o=e*(1-a)**(r-1),s=e*(1-a)**r,c=s<t?o-t:o-s;return Math.max(c,0)}let fS={description:E(`Depreciation via double-declining balance method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`)),Y(`factor (number, default=2)`,E(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){return{value:dS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale)),format:`#,##0.00`}},isExported:!0},pS={description:E(`Discount rate of a security based on price.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Ex(s),Tx(c);let u=hi(a,o,l);return(c-s)/c/u},isExported:!0},mS={description:E(`Convert a decimal fraction to decimal value.`),args:[Y(`fractional_price (number)`,E(`The price quotation given using fractional decimal conventions.`)),Y(`unit (number)`,E(`The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));N(()=>r>0,E(`The unit (%s) must be strictly positive.`,r.toString()));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},hS={description:E(`Convert a decimal value to decimal fraction.`),args:[Y(`decimal_price (number)`,E(`The price quotation given as a decimal value.`)),Y(`unit (number)`,E(`The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));N(()=>r>0,E(`The unit (%s) must be strictly positive.`,r.toString()));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},gS={description:E(`Number of periods for an investment to reach a value.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=F(n,this.locale),l=F(r,this.locale),u=Math.trunc(F(i,this.locale)),d=Math.trunc(F(a,this.locale));xx(o,s),Cx(u),wx(d),N(()=>c>=0,E(`The rate (%s) must be positive or null.`,c.toString())),N(()=>l>=0,E(`The yield (%s) must be positive or null.`,l.toString()));let f=hi(o,s,d),p=f-Math.trunc(f)||1/u,m=Math.ceil(f*u),h=c/u,g=l/u,_=0,v=0;for(let e=1;e<=m;e++){let t=(h+ +(e===m))/(1+g)**e;v+=(p+(e-1)/u)*t,_+=t}return _===0?0:v/_},isExported:!0},_S={description:E(`Annual effective interest rate.`),args:[Y(`nominal_rate (number)`,E(`The nominal interest rate per year.`)),Y(`periods_per_year (number)`,E(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return N(()=>n>0,E(`The nominal rate (%s) must be strictly greater than 0.`,n.toString())),N(()=>r>0,E(`The number of periods by year (%s) must strictly greater than 0.`,r.toString())),(1+n/r)**+r-1},isExported:!0};function vS(e,t,n,r,i){return e===0?-(r+n*t):-r*(1+e)**t-n*(1+e*i)*((1+e)**t-1)/e}let yS={description:E(`Future value of an annuity investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_amount (number)`,E(`The amount per period to be paid.`)),Y(`present_value (number, default=0)`,E(`The current value of the annuity.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:vS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),+!!L(i)),format:`#,##0.00`}},isExported:!0},bS={description:E(`Future value of principal from series of rates.`),args:[Y(`principal (number)`,E(`The amount of initial capital or value to compound against.`)),Y(`rate_schedule (number, range<number>)`,E(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=F(e,this.locale);return Oa([t],(e,t)=>e*(1+F(t,this.locale)),n)},isExported:!0},xS={description:E(`Calculates effective interest rate.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`investment (number)`,E(`The amount invested in the security.`)),Y(`redemption (number)`,E(`The amount to be received at maturity.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),Bx(c),Tx(s),wx(l);let u=hi(a,o,l);return(s-c)/c/u},isExported:!0};function SS(e,t,n,r,i,a){return PS(e,n,r,i,a)-IS(e,t,n,r,i,a)}let CS={description:E(`Payment on the principal of an investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`period (number)`,E(`The amortization period, in terms of number of periods.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:SS(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale),+!!L(a)),format:`#,##0.00`}},isExported:!0},wS=.1,TS={description:E(`Internal rate of return given periodic cashflows.`),args:[Y(`cashflow_amounts (number, range<number>)`,E(`An array or range containing the income or payments associated with the investment.`)),Y(`rate_guess (number, default=${wS})`,E(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:wS}){let n=F(t,this.locale);qx(n);let r=!1,i=!1,a=[];Ea([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),N(()=>r&&i,E(`The cashflow_amounts must include negative and positive values.`));let o=a.shift();function s(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*e**(r-i)),t*e**r)}function c(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*(r-i)*e**(r-i-1)),t*r*e**(r-1))}function l(e){return s(e,o,a)}function u(e){return c(e,o,a)}return{value:$x(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},ES={description:E(`Returns the interest paid at a particular period of an investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`period (number)`,E(`The period for which you want to view the interest payment.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);return N(()=>o!==0,E(`The number of periods must be different than 0.`,o.toString())),-1*(s-a/o*s)*i},isExported:!0},DS={description:E(`Modified Macaulay duration.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){return gS.compute.bind(this)(e,t,n,r,i,a)/(1+F(r,this.locale)/Math.trunc(F(i,this.locale)))},isExported:!0},OS={description:E(`Modified internal rate of return.`),args:[Y(`cashflow_amounts (range<number>)`,E(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),Y(`financing_rate (number)`,E(`The interest rate paid on funds invested.`)),Y(`reinvestment_return_rate (number)`,E(`The return (as a percentage) earned on reinvestment of income received from the investment.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=Pa(e).flat().filter(e=>e.value!==null).map(e=>F(e,this.locale)),o=a.length,s=0,c=0;for(let e of x(0,o)){let t=a[e];t>=0?s+=t*(i+1)**(o-e-1):c+=t/(r+1)**e}N(()=>c!==0&&s!==0,E(`There must be both positive and negative values in cashflow_amounts.`));let l=1/(o-1);return(-s/c)**l-1},isExported:!0},kS={description:E(`Annual nominal interest rate.`),args:[Y(`effective_rate (number)`,E(`The effective interest rate per year.`)),Y(`periods_per_year (number)`,E(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return N(()=>n>0,E(`The effective rate (%s) must must strictly greater than 0.`,n.toString())),N(()=>r>0,E(`The number of periods by year (%s) must strictly greater than 0.`,r.toString())),((n+1)**(1/r)-1)*r},isExported:!0},AS={description:E(`Number of payment periods for an investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`payment_amount (number)`,E(`The amount of each payment made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);if(a===0)return-(c+s)/o;let u=o*(1+a*l)/a;return Math.log((u-c)/(s+u))/Math.log(1+a)},isExported:!0};function jS(e,t,n,r){let i=0;return ka(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let MS={description:E(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[Y(`discount (number)`,E(`The discount rate of the investment over one period.`)),Y(`cashflow1 (number, range<number>)`,E(`The first future cash flow.`)),Y(`cashflow2 (number, range<number>, repeating)`,E(`Additional future cash flows.`))],compute:function(e,...t){let n=F(e,this.locale);return N(()=>n!==-1,E(`The discount (%s) must be different from -1.`,n.toString())),{value:jS(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},NS={description:E(`Computes the number of periods needed for an investment to reach a value.`),args:[Y(`rate (number)`,E(`The rate at which the investment grows each period.`)),Y(`present_value (number)`,E(`The investment's current value.`)),Y(`future_value (number)`,E(`The investment's desired future value.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return Ox(r),N(()=>i>0,E(`The present_value (%s) must be strictly positive.`,i.toString())),N(()=>a>0,E(`The future_value (%s) must be strictly positive.`,a.toString())),(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function PS(e,t,n,r,i){if(Dx(t),e===0)return-(r+n)/t;let a=-(n*(1+e)**t+r);return a=a*e/((1+e*i)*((1+e)**t-1)),a}let FS={description:E(`Periodic payment for an annuity investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){let a=F(t,this.locale),o=F(e,this.locale),s=+!!L(i),c=F(r,this.locale);return{value:PS(o,a,F(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function IS(e,t,n,r,i,a){Dx(n),N(()=>t>0&&t<=n,E(`The period must be between 1 and number_of_periods (%s)`,n));let o=PS(e,n,r,i,a);return a===1&&t===1?o:o+-vS(e,a===0?t-1:t-2,o,r+o*a,0)*e}let LS={description:E(`Payment on the principal of an investment.`),args:[Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`period (number)`,E(`The amortization period, in terms of number of periods.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=F(n,this.locale),s=F(e,this.locale),c=F(t,this.locale),l=+!!L(a),u=F(i,this.locale);return{value:IS(s,c,o,F(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},RS={description:E(`Present value of an annuity investment.`),args:[Y(`rate (number)`,E(`The interest rate.`)),Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_amount (number)`,E(`The amount per period to be paid.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`))],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);return{value:a?-(s*(1+a*l)*((1+a)**o-1)/a+c)/(1+a)**o:-(c+s*o),format:`#,##0.00`}},isExported:!0},zS={description:E(`Price of a security paying periodic interest.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));xx(s,c),Cx(f),wx(p),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),N(()=>u>=0,E(`The yield (%s) must be positive or null.`,u.toString())),Tx(d);let m=hi(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=1+u/f,v=100*l/f;if(h===1)return(v+d)/(g*u/f+1)-v*(1-g);let ee=0;for(let e=1;e<=h;e++)ee+=v/_**(e-1+g);return d/_**(h-1+g)+ee-v*(1-g)},isExported:!0},BS={description:E(`Price of a discount security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the security at time of purchase.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Vx(s),Tx(c);let u=hi(a,o,l);return c-s*c*u},isExported:!0},VS={description:E(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`yield (number)`,E(`The expected annual yield of the security.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));Sx(o,c),xx(o,s),wx(d),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),N(()=>u>=0,E(`The yield (%s) must be positive or null.`,u.toString()));let f=hi(o,s,d),p=hi(o,c,d),m=100+hi(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},HS=.1,US={description:E(`Interest rate of an annuity investment.`),args:[Y(`number_of_periods (number)`,E(`The number of payments to be made.`)),Y(`payment_per_period (number)`,E(`The amount per period to be paid.`)),Y(`present_value (number)`,E(`The current value of the annuity.`)),Y(`future_value (number, default=0)`,E(`The future value remaining after the final payment has been made.`)),Y(`end_or_beginning (number, default=0)`,E(`Whether payments are due at the end (0) or beginning (1) of each period.`)),Y(`rate_guess (number, default=${HS})`,E(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:HS}){let o=F(e,this.locale),s=F(t,this.locale),c=+!!L(i),l=F(a,this.locale)||HS,u=F(r,this.locale),d=F(n,this.locale);return Dx(o),N(()=>[s,d,u].some(e=>e>0)&&[s,d,u].some(e=>e<0),E(`There must be both positive and negative values in [payment_amount, present_value, future_value].`,o.toString())),qx(l),u-=s*c,d+=s*c,{value:$x(e=>{let t=(1+e)**+o,n=(t-1)/e;return u+d*t+s*n},e=>{let t=(1+e)**(o-1),n=((1+e)**+o-1)/e,r=o*t/e-n/e;return d*o*t+s*r},l,40,1e-5),format:`0%`}},isExported:!0},WS={description:E(`Amount received at maturity for a security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`investment (number)`,E(`The amount invested (irrespective of face value of each security).`)),Y(`discount (number)`,E(`The discount rate of the security invested in.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));return xx(a,o),wx(l),Bx(s),Vx(c),s/(1-c*hi(a,o,l))},isExported:!0},GS={description:E(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[Y(`number_of_periods (number)`,E(`The number of periods.`)),Y(`present_value (number)`,E(`The present value of the investment.`)),Y(`future_value (number)`,E(`The future value of the investment.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return Dx(r),(a/i)**(1/r)-1},isExported:!0},KS={description:E(`Depreciation of an asset using the straight-line method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},qS={description:E(`Depreciation via sum of years digit method.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`period (number)`,E(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);Px(s),kx(o),zx(s,o);let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function JS(e,t,n){return 100*(1-n*hi(e,t,2))}let YS={description:E(`Price of a US Treasury bill.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);return xx(r,i),Wx(r,i,this.locale),Vx(a),Hx(a),JS(r,i,a)},isExported:!0},XS={description:E(`Equivalent rate of return for a US Treasury bill.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`discount (number)`,E(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);xx(r,i),Wx(r,i,this.locale),Vx(a),Hx(a);let o=Pb.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=JS(r,i,a)/100,c=o/(o===366?366:365);return(-2*c+2*Math.sqrt(c**2-(2*c-1)*(1-1/s)))/(2*c-1)},isExported:!0},ZS={description:E(`The yield of a US Treasury bill based on price.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);xx(r,i),Wx(r,i,this.locale),Ex(a);let o=hi(r,i,2);return(100-a)/a*(1/o)},isExported:!0},QS={description:E(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[Y(`cost (number)`,E(`The initial cost of the asset.`)),Y(`salvage (number)`,E(`The value of the asset at the end of depreciation.`)),Y(`life (number)`,E(`The number of periods over which the asset is depreciated.`)),Y(`start (number)`,E(`Starting period to calculate depreciation.`)),Y(`end (number)`,E(`Ending period to calculate depreciation.`)),Y(`factor (number, default=2)`,E(`The number of months in the first year of depreciation.`)),Y(`no_switch (number, default=false)`,E(`Whether to switch to straight-line depreciation when the depreciation is greater than the declining balance calculation.`))],compute:function(e,t,n,r,i,a={value:2},o={value:!1}){a||=0;let s=F(e,this.locale),c=F(t,this.locale),l=F(n,this.locale),u=Math.trunc(F(r,this.locale)),d=Math.trunc(F(i,this.locale)),f=F(a,this.locale),p=L(o);if(Nx(s),Ix(c),Kx(u,d,l),Ux(f),s===0)return 0;if(c>=s)return u<1?s-c:0;let m=f/l;if(m>=1)return u<1?s-c:0;let h=s,g=0,_=0,v=!1;for(let e=0;e<d;e++){if(!v||p){let t=h*m,n=l-e,r=(h-c)/n;!p&&r>t?(v=!0,g=r):g=t}let t=Math.max(h-g,c);e>=u&&(_+=h-t),h=t}return _},isExported:!0},$S={description:E(`Internal rate of return given non-periodic cash flows.`),args:[Y(`cashflow_amounts (range<number>)`,E(`An range containing the income or payments associated with the investment.`)),Y(`cashflow_dates (range<number>)`,E(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),Y(`rate_guess (number, default=${HS})`,E(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:HS}){let r=F(n,this.locale),i=e.flat().map(e=>F(e,this.locale)),a=t.flat().map(e=>F(e,this.locale));Jx(e,t),Yx(i),Xx(a),qx(r);let o=new Map;for(let e of x(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e));return $x(e=>{let t=c[0];for(let n of x(1,c.length)){let r=(s[0]-s[n])/365;t+=c[n]*(1+e)**r}return t},e=>{let t=0;for(let n of x(1,c.length)){let r=(s[0]-s[n])/365;t+=r*c[n]*(1+e)**(r-1)}return t},r,40,1e-5,e=>e?e/10-.9:-.9)},isExported:!0},eC={description:E(`Net present value given to non-periodic cash flows..`),args:[Y(`discount (number)`,E(`The discount rate of the investment over one period.`)),Y(`cashflow_amounts (number, range<number>)`,E(`An range containing the income or payments associated with the investment.`)),Y(`cashflow_dates (number, range<number>)`,E(`An range with dates corresponding to the cash flows in cashflow_amounts.`))],compute:function(e,t,n){let r=F(e,this.locale),i=A(t)?t.flat().map(e=>ha(e,this.locale)):[ha(t,this.locale)],a=A(n)?n.flat().map(e=>ha(e,this.locale)):[ha(n,this.locale)];if(A(n)&&A(t)?Jx(t,n):N(()=>i.length===a.length,E(`There must be the same number of values in cashflow_amounts and cashflow_dates.`)),Xx(a),Ox(r),i.length===1)return i[0];let o=new Map;for(let e of x(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e)),l=c[0];for(let e of x(1,c.length)){let t=(s[0]-s[e])/365;l+=c[e]*(1+r)**t}return l},isExported:!0},tC={description:E(`Annual yield of a security paying periodic interest.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`frequency (number)`,E(`The number of interest or coupon payments per year (1, 2, or 4).`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));xx(s,c),Cx(f),wx(p),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),Ex(u),Tx(d);let m=hi(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=100*l/f;if(h===1){let e=u+_*(1-g);return(d+_-e)*f*(1/g)/e}function v(e,t,n,r,i,a){let o=a-(e+i*(1-t))*r**(n-1+t);for(let e=1;e<=n;e++)o+=i*r**(e-1);return o}function ee(e,t,n,r,i){let a=-(e+i*(1-t))*(n-1+t)*r**(n-2+t);for(let e=1;e<=n;e++)a+=i*(e-1)*r**(e-2);return a}function te(e){return v(u,g,h,e,_,d)}function ne(e){return ee(u,g,h,e,_)}return($x(te,ne,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},nC={description:E(`Annual yield of a discount security.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`price (number)`,E(`The price at which the security is bought per 100 face value.`)),Y(`redemption (number)`,E(`The redemption amount per 100 face value, or par.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));xx(a,o),wx(l),Ex(s),Tx(c);let u=hi(a,o,l);return(c/s-1)/u},isExported:!0},rC={description:E(`Annual yield of a security paying interest at maturity.`),args:[Y(`settlement (date)`,E(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),Y(`maturity (date)`,E(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),Y(`issue (date)`,E(`The date the security was initially issued.`)),Y(`rate (number)`,E(`The annualized rate of interest.`)),Y(`price (number)`,E(`The price at which the security is bought.`)),Y(`day_count_convention (number, default=0 )`,E(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));xx(o,s),wx(d),N(()=>o>=c,E(`The settlement (%s) must be greater than or equal to the issue (%s).`,o.toString(),c.toString())),N(()=>l>=0,E(`The rate (%s) must be positive or null.`,l.toString())),Ex(u);let f=hi(c,s,d),p=hi(c,o,d),m=hi(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0},iC=/[a-zA-Z0-9\_]+(\.[a-zA-Z0-9\_]+)*/,aC=[`-`,`+`],oC=[`%`],sC=[`*`,`+`,`&`],cC={"^":30,"%":30,"*":20,"/":20,"+":15,"-":15,"&":13,">":10,"<>":10,">=":10,"<":10,"<=":10,"=":10};function lC(e){let t=e.shift();if(!t)throw new na;switch(t.type){case`DEBUGGER`:let n=pC(e,1e3);return n.debug=!0,n;case`NUMBER`:return{type:`NUMBER`,value:Ai(t.value,k)};case`STRING`:return{type:`STRING`,value:et(t.value)};case`INVALID_REFERENCE`:return{type:`REFERENCE`,value:j.InvalidReference};case`REFERENCE`:if(e[0]?.value===`:`&&e[1]?.type===`REFERENCE`){e.shift();let n=e.shift();return{type:`REFERENCE`,value:`${t.value}:${n?.value}`}}return{type:`REFERENCE`,value:t.value};case`SYMBOL`:let r=t.value;if(e[0]?.type===`LEFT_PAREN`&&iC.test(t.value)&&r===at(r,`'`))return{type:`FUNCALL`,value:r,args:uC(e)};let i=r.toUpperCase();return i===`TRUE`||i===`FALSE`?{type:`BOOLEAN`,value:i===`TRUE`}:{type:`SYMBOL`,value:at(t.value,`'`)};case`LEFT_PAREN`:let a=pC(e);return fC(e,`RIGHT_PAREN`,E(`Missing closing parenthesis`)),a;case`OPERATOR`:let o=t.value;if(aC.includes(o))return{type:`UNARY_OPERATION`,value:o,operand:pC(e,cC[o])};throw new na(E(`Unexpected token: %s`,t.value));default:throw new na(E(`Unexpected token: %s`,t.value))}}function uC(e){if(fC(e,`LEFT_PAREN`,E(`Missing opening parenthesis`)),e[0]?.type===`RIGHT_PAREN`)return fC(e,`RIGHT_PAREN`),[];let t=[];for(t.push(dC(e));e[0]?.type!==`RIGHT_PAREN`;)fC(e,`ARG_SEPARATOR`,E(`Wrong function call`)),t.push(dC(e));return fC(e,`RIGHT_PAREN`),t}function dC(e){let t=e[0];return t?.type===`ARG_SEPARATOR`||t?.type===`RIGHT_PAREN`?{type:`EMPTY`,value:``}:pC(e)}function fC(e,t,n){let r=e.shift();if(!r||r.type!==t)throw new na(n)}function pC(e,t=0){if(e.length===0)throw new na;let n=lC(e);for(;e[0]?.type===`OPERATOR`&&cC[e[0].value]>t;){let t=e.shift().value;if(oC.includes(t))n={type:`UNARY_OPERATION`,value:t,operand:n,postfix:!0};else{let r=pC(e,cC[t]);n={type:`BIN_OPERATION`,value:t,left:n,right:r}}}return n}function mC(e){return hC(Mh(e))}function hC(e){e=e.filter(e=>e.type!==`SPACE`),e[0]?.value===`=`&&e.splice(0,1);let t=pC(e);if(e.length)throw new na;return t}function gC(e,t,n){return yC(e,e=>e.type===t?n(e):e)}function _C(e){return Array.from(vC(e))}function*vC(e){switch(yield e,e.type){case`FUNCALL`:for(let t of e.args)yield*vC(t);break;case`UNARY_OPERATION`:yield*vC(e.operand);break;case`BIN_OPERATION`:yield*vC(e.left),yield*vC(e.right);break}}function yC(e,t){switch(e=t(e),e.type){case`FUNCALL`:return{...e,args:e.args.map(e=>yC(e,t))};case`UNARY_OPERATION`:return{...e,operand:yC(e.operand,t)};case`BIN_OPERATION`:return{...e,right:yC(e.right,t),left:yC(e.left,t)};default:return e}}function bC(e){switch(e.type){case`FUNCALL`:let t=e.args.map(e=>bC(e));return`${e.value}(${t.join(`,`)})`;case`NUMBER`:return e.value.toString();case`REFERENCE`:return e.value;case`STRING`:return`"${e.value}"`;case`BOOLEAN`:return e.value?`TRUE`:`FALSE`;case`UNARY_OPERATION`:return e.postfix?xC(e)+e.value:e.value+SC(e);case`BIN_OPERATION`:return xC(e)+e.value+SC(e);default:return e.value}}function xC(e){let t=e.value,n=`left`in e?e.left:e.operand,r=n.value;return n.type===`BIN_OPERATION`&&cC[r]<cC[t]?`(${bC(n)})`:bC(n)}function SC(e){let t=e.value,n=`right`in e?e.right:e.operand,r=cC[n.value],i=cC[t],a=!1;return n.type===`BIN_OPERATION`?(r<i||r===i&&!sC.includes(t))&&(a=!0):a=!1,a?`(${bC(n)})`:bC(n)}function CC(e){let t=0;return e.map(e=>{let n=e.value.toString().length,r=Object.assign({},e,{start:t,end:t+n,length:n});return t=r.end,r})}function wC(e){let t=1,n=[];return e.map(e=>(e.type===`LEFT_PAREN`?(n.push(t),e.parenIndex=t,t++):e.type===`RIGHT_PAREN`&&(e.parenIndex=n.pop()),e))}function TC(e){let t=[],n=``;function r(e){if(t.length===0)return;let n=t.at(-1);if(n&&n.argsTokens){let{argsTokens:t,argPosition:r}=n;t[r]||(t[r]=[]),t[r].push({value:e.value,type:e.type})}}return e.map((e,i)=>{switch([`SPACE`,`LEFT_PAREN`].includes(e.type)||(n=``),e.type){case`SYMBOL`:r(e),n=e.value;break;case`LEFT_PAREN`:t.push({parent:n,argPosition:0,argsTokens:[],args:[]}),r(e),n=``;break;case`RIGHT_PAREN`:t.pop()?.argsTokens?.flat().forEach(r),r(e);break;case`ARG_SEPARATOR`:r(e),t.length&&t[t.length-1].argPosition++;break;default:r(e);break}if(t.length){let n=t[t.length-1];n.parent&&(e.functionContext=Object.assign({},n))}return e})}function EC(e){for(let t of e)if(t.functionContext){let{argsTokens:e,args:n}=t.functionContext;if(delete t.functionContext.argsTokens,n.length||!e)continue;e[0]?.[0]?.type===`LEFT_PAREN`&&(e[0]=e[0].slice(1));for(let t of e){let e=t;e.at(-1)?.type===`ARG_SEPARATOR`&&(e=e.slice(0,-1));try{n.push(hC(e))}catch{n.push(void 0)}}}return e}function DC(e,t){return EC(TC(wC(CC(Mh(e,t)))))}function OC(e){if(e.type!==`REFERENCE`)return e;let{xc:t,sheetName:n}=Vs(e.value),[r,i]=t.split(`:`),a=kC(r),o=i?`:${kC(i)}`:``;return{...e,value:Hs(n,a+o)}}function kC(e){switch(jC(e)){case`none`:e=AC(e,`colrow`);break;case`colrow`:e=AC(e,`row`);break;case`row`:e=AC(e,`col`);break;case`col`:e=AC(e,`none`);break}return e}function AC(e,t){if(e.includes(`!`))throw Error(`The given XC should not contain a sheet name`);e=e.replace(/\$/g,``);let n;switch(t){case`col`:return`$`+e;case`row`:return n=e.search(/[0-9]/),e.slice(0,n)+`$`+e.slice(n);case`colrow`:return n=e.search(/[0-9]/),n===-1||n===0||(e=e.slice(0,n)+`$`+e.slice(n)),`$`+e;case`none`:return e}}function jC(e){return PC(e)?`colrow`:MC(e)?`col`:NC(e)?`row`:`none`}function MC(e){return e.startsWith(`$`)}function NC(e){return e.includes(`$`,1)}function PC(e){return e.startsWith(`$`)&&e.length>1&&e.slice(1).includes(`$`)}function FC(e,t,n){let r=(t.startsWith(`=`)?DC(t,n):[]).filter(t=>t.start<=e.start&&t.end>=e.start||t.start>=e.start&&t.start<e.end),i=r.filter(e=>e.type===`REFERENCE`);if(i.length===0)return;let a=r.map(OC).map(e=>e.value).join(``),o=r[0].start,s=r[r.length-1].end,c=t.slice(0,o)+a+t.slice(s),l=c.length-t.length,u={start:i[0].start,end:i[i.length-1].end+l};return i.length===1&&e.start===e.end&&(u.start=u.end),{content:c,selection:u}}var IC=l({CELL:()=>RC,ISBLANK:()=>KC,ISERR:()=>zC,ISERROR:()=>BC,ISLOGICAL:()=>VC,ISNA:()=>HC,ISNONTEXT:()=>UC,ISNUMBER:()=>WC,ISTEXT:()=>GC,NA:()=>qC});let LC=[`address`,`col`,`contents`,`format`,`row`,`type`],RC={description:E(`Gets information about a cell.`),args:[Y(`info_type (string)`,E(`The type of information requested. Can be one of %s`,LC.join(`, `))),Y(`reference (meta)`,E(`The reference to the cell.`))],compute:function(e,t){let n=I(e).toLowerCase();N(()=>LC.includes(n),E(`The info_type should be one of %s.`,LC.join(`, `)));let r=this.__originSheetId,i=I(t),{sheetName:a,xc:o}=Vs(i.includes(`:`)?i.split(`:`)[0]:i);a=a===this.getters.getSheetName(r)?void 0:a;let s=Hs(a,AC(o,`colrow`)),c=this.getters.getRangeFromSheetXC(r,s);switch(n){case`address`:return this.getters.getRangeString(c,r);case`col`:return c.zone.left+1;case`contents`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top};return this.getters.getEvaluatedCell(e).value}case`format`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top};return this.getters.getEvaluatedCell(e).format||``}case`row`:return c.zone.top+1;case`type`:{let e={sheetId:c.sheetId,col:c.zone.left,row:c.zone.top},t=this.getters.getEvaluatedCell(e).type;return t===`empty`?`b`:t===`text`?`l`:`v`}}return``},isExported:!0},zC={description:E(`Whether a value is an error other than #N/A.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)&&t!==j.NotAvailable},isExported:!0},BC={description:E(`Whether a value is an error.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)},isExported:!0},VC={description:E("Whether a value is `true` or `false`."),args:[Y(`value (any)`,E(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},HC={description:E(`Whether a value is the error #N/A.`),args:[Y(`value (any)`,E(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},UC={description:E(`Whether a value is non-textual.`),args:[Y(`value (any)`,E(`The value to be checked.`))],compute:function(e){return!GC.compute.bind(this)(e)},isExported:!0},WC={description:E(`Whether a value is a number.`),args:[Y(`value (any)`,E(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},GC={description:E(`Whether a value is text.`),args:[Y(`value (any)`,E(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&P(e?.value)===!1},isExported:!0},KC={description:E(`Whether the referenced cell is empty`),args:[Y(`value (any)`,E(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},qC={description:E(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0};var JC=l({AND:()=>YC,FALSE:()=>XC,IF:()=>ZC,IFERROR:()=>QC,IFNA:()=>$C,IFS:()=>ew,NOT:()=>tw,OR:()=>nw,TRUE:()=>rw,XOR:()=>iw});let YC={description:E("Logical `and` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that represent logical values.`))],compute:function(...e){let{result:t,foundBoolean:n}=vl(e);return N(()=>n,E(`[[FUNCTION_NAME]] has no valid input data.`)),t},isExported:!0},XC={description:E("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},ZC={description:E(`Returns value depending on logical expression.`),args:[Y(`logical_expression (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.`)),Y(`value_if_true (any, range)`,E(`The value the function returns if logical_expression is TRUE.`)),Y(`value_if_false (any, range, default=FALSE)`,E(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){if(Ol(e))return Fa(ZC.compute,[e,t,n]);let r=L(El(e))?t:n;return Ol(r)||(r=El(r)),r===void 0?{value:``}:!A(r)&&r.value===null?{...r,value:``}:r},isExported:!0},QC={description:E(`Value if it is not an error, otherwise 2nd argument.`),args:[Y(`value (any, range)`,E(`The value to return if value itself is not an error.`)),Y(`value_if_error (any, range, default="empty")`,E(`The value the function returns if value is an error.`))],compute:function(e,t){if(Ol(e))return Fa(QC.compute,[e,t]);let n=P(El(e)?.value)?t:e;return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n},isExported:!0},$C={description:E(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[Y(`value (any, range)`,E(`The value to return if value itself is not #N/A an error.`)),Y(`value_if_error (any, range, default="empty")`,E(`The value the function returns if value is an #N/A error.`))],compute:function(e,t){if(Ol(e))return Fa($C.compute,[e,t]);let n=El(e)?.value===j.NotAvailable?t:e;return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n},isExported:!0},ew={description:E(`Returns a value depending on multiple logical expressions.`),args:[Y(`condition1 (boolean, range<boolean>)`,E(`The first condition to be evaluated. This can be a boolean, a number, an array, or a reference to any of those.`)),Y(`value1 (any, range)`,E(`The returned value if condition1 is TRUE.`)),Y(`condition2 (boolean, any, range, repeating)`,E(`Additional conditions to be evaluated if the previous ones are FALSE.`)),Y(`value2 (any, range, repeating)`,E(`Additional values to be returned if their corresponding conditions are TRUE.`))],compute:function(...e){for(N(()=>e.length%2==0,E(`Wrong number of arguments. Expected an even number of arguments.`));e.length>0;){if(Ol(e[0]))return Fa(ew.compute,e);let t=L(El(e.shift())),n=e.shift();if(t)return Ol(n)||(n=El(n)),n===void 0?{value:``}:!A(n)&&n.value===null?{...n,value:``}:n}return new M(E(`No match.`))},isExported:!0},tw={description:E(`Returns opposite of provided logical value.`),args:[Y(`logical_expression (boolean)`,E(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!L(e)},isExported:!0},nw={description:E("Logical `or` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that evaluate to logical values.`))],compute:function(...e){let{result:t,foundBoolean:n}=yl(e);return N(()=>n,E(`[[FUNCTION_NAME]] has no valid input data.`)),t},isExported:!0},rw={description:E("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},iw={description:E("Logical `xor` operator."),args:[Y(`logical_expression1 (boolean, range<boolean>)`,E(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.`)),Y(`logical_expression2 (boolean, range<boolean>, repeating)`,E(`More expressions that evaluate to logical values.`))],compute:function(...e){let t=!1,n=!1;return La(e,e=>(t=!0,n=n?!e:e,!0)),N(()=>t,E(`[[FUNCTION_NAME]] has no valid input data.`)),n},isExported:!0};function aw(e,t){let n=t.getPivotId(e);if(!n)throw new M(E(`There is no pivot with id "%s"`,e));return n}function ow(e,t,n){let{measures:r}=n.getPivotCoreDefinition(e);if(!r.find(e=>e.id===t))throw new M(E(`The argument %s is not a valid measure. Here are the measures: %s`,t,`(${r.map(e=>e.id).join(`, `)})`))}function sw(e){if(e.length%2!=0)throw new M(E(`Function PIVOT takes an even number of arguments.`))}function cw(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=tr(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new ia;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&fr(D(e.__originCellPosition),n))throw new ra;r.push(o)}for(let i of n)i.computedBy&&r.push(...e.getters.getMeasureFullDependencies(t,i));let a=e.__originCellPosition;a&&r.length&&(e.updateDependencies?.(a),e.addDependencies?.(a,r))}var lw=l({ADDRESS:()=>dw,COLUMN:()=>fw,COLUMNS:()=>pw,HLOOKUP:()=>mw,INDEX:()=>hw,INDIRECT:()=>gw,LOOKUP:()=>_w,MATCH:()=>vw,OFFSET:()=>Dw,PIVOT:()=>Ew,PIVOT_HEADER:()=>Tw,PIVOT_VALUE:()=>ww,ROW:()=>yw,ROWS:()=>bw,VLOOKUP:()=>xw,XLOOKUP:()=>Cw});function uw(e){return{value:j.NotAvailable,message:E(`Did not find value '%s' in [[FUNCTION_NAME]] evaluation.`,I(e))}}let dw={description:E(`Returns a cell reference as a string. `),args:[Y(`row (number)`,E(`The row number of the cell reference. `)),Y(`column (number)`,E(`The column number (not name) of the cell reference. A is column number 1. `)),Y(`absolute_relative_mode (number, default=1)`,E(`An indicator of whether the reference is row/column absolute. 1 is row and column absolute (e.g. $A$1), 2 is row absolute and column relative (e.g. A$1), 3 is row relative and column absolute (e.g. $A1), and 4 is row and column relative (e.g. A1).`)),Y(`use_a1_notation (boolean, default=TRUE)`,E(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`)),Y(`sheet (string, optional)`,E(`A string indicating the name of the sheet into which the address points.`))],compute:function(e,t,n={value:1},r={value:!0},i){let a=_a(e,this.locale),o=_a(t,this.locale);va(a),va(o);let s=_a(n,this.locale);N(()=>[1,2,3,4].includes(s),da(1,4,s));let c=L(r),l;if(c){let e={rowFixed:!![1,2].includes(s),colFixed:!![1,3].includes(s)};l=w(o-1,a-1,e)}else l=([1,2].includes(s)?`R${a}`:`R[${a}]`)+([1,3].includes(s)?`C${o}`:`C[${o}]`);return i===void 0?l:Hs(I(i),l)},isExported:!0},fw={description:E(`Column number of a specified cell.`),args:[Y(`cell_reference (meta, default='this cell')`,E(`The cell whose column number will be returned. Column A corresponds to 1. By default, the function use the cell in which the formula is entered.`))],compute:function(e){if(P(e?.value))return e;if(e===void 0)return N(()=>this.__originCellPosition?.col!==void 0,`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`),this.__originCellPosition.col+1;let t=this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(),e.value).zone;return t.left===t.right?t.left+1:ja(t.right-t.left+1,1,(e,n)=>({value:t.left+e+1}))},isExported:!0},pw={description:E(`Number of columns in a specified array or range.`),args:[Y(`range (meta)`,E(`The range whose column count will be returned.`))],compute:function(e){if(P(e?.value))return e;let t=Qn(e.value);return t.right-t.left+1},isExported:!0},mw={description:E(`Horizontal lookup`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The range to consider for the search. The first row in the range is searched for the key specified in search_key.`)),Y(`index (number)`,E(`The row index of the value to be returned, where the first row in range is numbered 1.`)),Y(`is_sorted (boolean, default=true)`,E(`Indicates whether the row to be searched (the first row of the specified range) is sorted, in which case the closest match for search_key will be returned.`))],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=z(t);N(()=>1<=i&&i<=a[0].length,E(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[t][0].value,s=a[L(r.value)?Ha(a,e,`nextSmaller`,`asc`,a.length,o):Ua(t,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?uw(e):s[i-1]},isExported:!0},hw={description:E(`Returns the content of a cell, specified by row and column offset.`),args:[Y(`reference (any, range)`,E(`The range of cells from which the values are returned.`)),Y(`row (number, default=0)`,E(`The index of the row to be returned from within the reference range of cells.`)),Y(`column (number, default=0)`,E(`The index of the column to be returned from within the reference range of cells.`))],compute:function(e,t={value:0},n={value:0}){let r=z(e),i=F(t.value,this.locale),a=F(n.value,this.locale);return N(()=>a>=0&&a-1<r.length&&i>=0&&i-1<r[0].length,E(`Index out of range.`)),i===0&&a===0?r:i===0?[r[a-1]]:a===0?r.map(e=>[e[i-1]]):r[a-1][i-1]},isExported:!0},gw={description:E(`Returns the content of a cell, specified by a string.`),args:[Y(`reference (string)`,E(`The range of cells from which the values are returned.`)),Y(`use_a1_notation (boolean, default=TRUE)`,E(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`))],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new ia(E(`Reference should be defined.`));if(!L(t))return new M(E(`R1C1 notation is not supported.`));let r=this.__originSheetId,i=this.__originCellPosition;i&&this.updateDependencies?.(i);let a=this.getters.getRangeFromSheetXC(r,n);if(a===void 0||a.invalidXc||a.invalidSheetName)return new ia;i&&this.addDependencies?.(i,[a]);let o=[];for(let e=a.zone.left;e<=a.zone.right;e++){let t=[];for(let n=a.zone.top;n<=a.zone.bottom;n++){let r={sheetId:a.sheetId,col:e,row:n};t.push(this.getters.getEvaluatedCell(r))}o.push(t)}return o.length===1&&o[0].length===1?o[0][0]:o},isExported:!0},_w={description:E(`Look up a value.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`search_array (any, range)`,E(`One method of using this function is to provide a single sorted row or column search_array to look through for the search_key with a second argument result_range. The other way is to combine these two arguments into one search_array where the first row or column is searched and a value is returned from the last row or column in the array. If search_key is not found, a non-exact match may be returned.`)),Y(`result_range (any, range, optional)`,E(`The range from which to return a result. The value returned corresponds to the location where search_key is found in search_range. This range must be only a single row or column and should not be used if using the search_result_array method.`))],compute:function(e,t,n){let r=z(t),i=z(n),a=r.length,o=r[0].length,s=o>=a,c=Ha(r,e,`nextSmaller`,`asc`,s?o:a,s?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value);return c===-1||s&&r[0][c]===void 0||!s&&r[c][o-1]===void 0?uw(e):i[0].length===0?s?r[a-1][c]:r[c][o-1]:(a=i.length,o=i[0].length,N(()=>a===1||o===1,E(`The result_range must be a single row or a single column.`)),a>1?(N(()=>c<=a-1,E(`[[FUNCTION_NAME]] evaluates to an out of range row value %s.`,(c+1).toString())),i[c][0]):(N(()=>c<=o-1,E(`[[FUNCTION_NAME]] evaluates to an out of range column value %s.`,(c+1).toString())),i[0][c]))},isExported:!0},vw={description:E(`Position of item in range that matches value.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The one-dimensional array to be searched.`)),Y(`search_type (number, default=1)`,E(`The search method. 1 (default) finds the largest value less than or equal to search_key when range is sorted in ascending order. 0 finds the exact value when range is unsorted. -1 finds the smallest value greater than or equal to search_key when range is sorted in descending order.`))],compute:function(e,t,n={value:1}){let r=F(n,this.locale),i=z(t),a=i.length,o=i[0].length;N(()=>a===1||o===1,E(`The range must be a single row or a single column.`));let s=-1,c=a===1?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,l=a===1?i[0].length:i.length;switch(r=Math.sign(r),r){case 1:s=Ha(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Ua(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=Ha(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?uw(e):s+1},isExported:!0},yw={description:E(`Row number of a specified cell.`),args:[Y(`cell_reference (meta, default='this cell')`,E(`The cell whose row number will be returned. By default, this function uses the cell in which the formula is entered.`))],compute:function(e){if(P(e?.value))return e;if(e===void 0)return N(()=>this.__originCellPosition?.row!==void 0,`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`),this.__originCellPosition.row+1;let t=this.getters.getRangeFromSheetXC(this.getters.getActiveSheetId(),e.value).zone;return t.top===t.bottom?t.top+1:ja(1,t.bottom-t.top+1,(e,n)=>({value:t.top+n+1}))},isExported:!0},bw={description:E(`Number of rows in a specified array or range.`),args:[Y(`range (meta)`,E(`The range whose row count will be returned.`))],compute:function(e){if(P(e?.value))return e;let t=Qn(e.value);return t.bottom-t.top+1},isExported:!0},xw={description:E(`Vertical lookup.`),args:[Y(`search_key (string, number, boolean)`,E(`The value to search for. For example, 42, 'Cats', or I24.`)),Y(`range (any, range)`,E(`The range to consider for the search. The first column in the range is searched for the key specified in search_key.`)),Y(`index (number)`,E(`The column index of the value to be returned, where the first column in range is numbered 1.`)),Y(`is_sorted (boolean, default=true)`,E(`Indicates whether the column to be searched (the first column of the specified range) is sorted, in which case the closest match for search_key will be returned.`))],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=z(t);N(()=>1<=i&&i<=a.length,E(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[0][t].value,s=L(r.value)?Ha(a,e,`nextSmaller`,`asc`,a[0].length,o):Ua(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?uw(e):c},isExported:!0},Sw={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},Cw={description:E(`Search a range for a match and return the corresponding item from a second range.`),args:[Y(`search_key (string,number,boolean)`,E(`The value to search for.`)),Y(`lookup_range (any, range)`,E(`The range to consider for the search. Should be a single column or a single row.`)),Y(`return_range (any, range)`,E(`The range containing the return value. Should have the same dimensions as lookup_range.`)),Y(`if_not_found (any, optional)`,E(`If a valid match is not found, return this value.`)),Y(`match_mode (any, default=0)`,E(`(0) Exact match. (-1) Return next smaller item if no match. (1) Return next greater item if no match. (2) Wildcard match.`)),Y(`search_mode (any, default=1)`,E(`(1) Search starting at first item. (-1) Search starting at last item. (2) Perform a binary search that relies on lookup_array being sorted in ascending order. If not sorted, invalid results will be returned. (-2) Perform a binary search that relies on lookup_array being sorted in descending order. If not sorted, invalid results will be returned. `))],compute:function(e,t,n,r,i={value:0},a={value:1}){let o=Math.trunc(F(i.value,this.locale)),s=Math.trunc(F(a.value,this.locale)),c=z(t),l=z(n);N(()=>c.length===1||c[0].length===1,E(`lookup_range should be either a single row or single column.`)),N(()=>[-1,1,-2,2].includes(s),E(`search_mode should be a value in [-1, 1, -2, 2].`)),N(()=>[-1,0,1,2].includes(o),E(`match_mode should be a value in [-1, 0, 1, 2].`));let u=c.length===1?`col`:`row`;N(()=>!(o===2&&[-2,2].includes(s)),E(`the search and match mode combination is not supported for XLOOKUP evaluation.`)),N(()=>u===`col`?l[0].length===c[0].length:l.length===c.length,E(`return_range should have the same dimensions as lookup_range.`));let d=u===`col`?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,f=u===`col`?c[0].length:c.length,p=Sw[o],m=s===-1,h=s===2||s===-2?Ha(c,e,p,s===2?`asc`:`desc`,f,d):Ua(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?uw(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},ww={description:E(`Get the value from a pivot.`),args:[Y(`pivot_id (number,string)`,E(`ID of the pivot.`)),Y(`measure_name (string)`,E(`Name of the measure.`)),Y(`domain_field_name (string,optional,repeating)`,E(`Field name.`)),Y(`domain_value (number,string,boolean,optional,repeating)`,E(`Value.`))],compute:function(e,t,...n){let r=I(e),i=I(t),a=aw(r,this.getters);ow(a,i,this.getters),sw(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);cw(this,a,s.measures.filter(e=>e.id===i)),o.init({reload:o.needsReevaluation});let c=o.assertIsValid({throwOnError:!1});if(c)return c;if(!o.areDomainArgsFieldsValid(n)){let e=E(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${r})`);return{value:j.GenericError,message:E(`Dimensions don't match the pivot definition`)+`. `+e}}let l=o.parseArgsToPivotDomain(n);return this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(a)?.trackValue(i,l),o.getPivotCellValueAndFormat(i,l)}},Tw={description:E(`Get the header of a pivot.`),args:[Y(`pivot_id (number,string)`,E(`ID of the pivot.`)),Y(`domain_field_name (string,optional,repeating)`,E(`Field name.`)),Y(`domain_value (number,string,value,optional,repeating)`,E(`Value.`))],compute:function(e,...t){let n=I(e),r=aw(n,this.getters);sw(t);let i=this.getters.getPivot(r);cw(this,r,[]),i.init({reload:i.needsReevaluation});let a=i.assertIsValid({throwOnError:!1});if(a)return a;if(!i.areDomainArgsFieldsValid(t)){let e=E(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${n})`);return{value:j.GenericError,message:E(`Dimensions don't match the pivot definition`)+`. `+e}}let o=i.parseArgsToPivotDomain(t);this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(r)?.trackHeader(o);let s=o.at(-1);if(s?.field===`measure`)return i.getPivotMeasureValue(I(s.value),o);let{value:c,format:l}=i.getPivotHeaderValueAndFormat(o);return{value:c,format:!s||s.field===`measure`||s.value===`false`?void 0:l}}},Ew={description:E(`Get a pivot table.`),args:[Y(`pivot_id (string)`,E(`ID of the pivot.`)),Y(`row_count (number, optional)`,E(`number of rows`)),Y(`include_total (boolean, default=TRUE)`,E(`Whether to include total/sub-totals or not.`)),Y(`include_column_titles (boolean, default=TRUE)`,E(`Whether to include the column titles or not.`)),Y(`column_count (number, optional)`,E(`number of columns`))],compute:function(e,t={value:1e4},n={value:!0},r={value:!0},i={value:Number.MAX_VALUE}){let a=I(e),o=F(t,this.locale);if(o<0)return new M(E(`The number of rows must be positive.`));let s=F(i,this.locale);if(s<0)return new M(E(`The number of columns must be positive.`));let c=L(r),l=L(n),u=aw(a,this.getters),d=this.getters.getPivot(u),f=this.getters.getPivotCoreDefinition(u);cw(this,u,f.measures),d.init({reload:d.needsReevaluation});let p=d.assertIsValid({throwOnError:!1});if(p)return p;let m=d.getTableStructure(),h=m.getPivotCells(l,c),g=c?m.columns.length:0,_=this.getters.getPivotDisplayName(u),v=Math.min(g+o,h[0].length);if(v===0)return[[{value:_}]];let ee=Math.min(1+s,h.length),te=[];for(let e of x(0,ee)){te[e]=[];for(let t of x(0,v)){let n=h[e][t];switch(n.type){case`EMPTY`:te[e].push({value:``});break;case`HEADER`:let t=d.getPivotHeaderValueAndFormat(n.domain);te[e].push(Uu(d,n.domain,t));break;case`MEASURE_HEADER`:te[e].push(d.getPivotMeasureValue(n.measure,n.domain));break;case`VALUE`:te[e].push(d.getPivotCellValueAndFormat(n.measure,n.domain));break}}}return c&&(te[0][0]={value:_}),te}},Dw={description:E(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[Y(`cell_reference (meta)`,E(`The starting point from which to count the offset rows and columns.`)),Y(`offset_rows (number)`,E(`The number of rows to offset by.`)),Y(`offset_columns (number)`,E(`The number of columns to offset by.`)),Y(`height (number, default='height of cell_reference')`,E(`The number of rows of the range to return starting at the offset target.`)),Y(`width (number, default='width of cell_reference')`,E(`The number of columns of the range to return starting at the offset target.`))],compute:function(e,t,n,r,i){if(P(e?.value))return e;let a=e?.value;if(!a)return new M(`In this context, the function OFFSET needs to have a cell or range in parameter.`);let o=Qn(a),s=o.bottom-o.top+1,c=o.right-o.left+1;if(r){let e=F(r,this.locale);y_(E(`Height value is %(_height)s. It should be greater than or equal to 1.`,{_height:e}),e),s=e}if(i){let e=F(i,this.locale);y_(E(`Width value is %(_width)s. It should be greater than or equal to 1.`,{_width:e}),e),c=e}let{sheetName:l}=Vs(a),u=l&&this.getters.getSheetIdByName(l)||this.getters.getActiveSheetId(),d=F(t,this.locale),f=F(n,this.locale),p=this.__originCellPosition;p&&this.updateDependencies?.(p);let m=o.left+f,h=o.top+d;if(m<0||h<0)return new ia(E(`OFFSET evaluates to an out of bounds range.`));let g={left:m,top:h,right:m+c-1,bottom:h+s-1},_=this.getters.getRangeFromZone(u,g);return _.invalidXc||_.invalidSheetName?new ia:(p&&this.addDependencies?.(p,[_]),ja(c,s,(e,t)=>this.getters.getEvaluatedCell({sheetId:u,col:m+e,row:h+t})))}};var Ow=l({ADD:()=>kw,CONCAT:()=>Aw,DIVIDE:()=>jw,EQ:()=>Fw,GT:()=>Lw,GTE:()=>Rw,LT:()=>zw,LTE:()=>Bw,MINUS:()=>Vw,MULTIPLY:()=>Hw,NE:()=>Uw,POW:()=>Ww,UMINUS:()=>Gw,UNARY_PERCENT:()=>Kw,UPLUS:()=>qw});let kw={description:E(`Sum of two numbers.`),args:[Y(`value1 (number)`,E(`The first addend.`)),Y(`value2 (number)`,E(`The second addend.`))],compute:function(e,t){return{value:F(e,this.locale)+F(t,this.locale),format:e?.format||t?.format}}},Aw={description:E(`Concatenation of two values.`),args:[Y(`value1 (string)`,E(`The value to which value2 will be appended.`)),Y(`value2 (string)`,E(`The value to append to value1.`))],compute:function(e,t){return I(e)+I(t)},isExported:!0},jw={description:E(`One number divided by another.`),args:[Y(`dividend (number)`,E(`The number to be divided.`)),Y(`divisor (number)`,E(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return N(()=>n!==0,E(`The divisor must be different from zero.`),j.DivisionByZero),{value:F(e,this.locale)/n,format:e?.format||t?.format}}};function Mw(e){return e===void 0||e.value===null}let Nw={number:0,string:``,boolean:!1};function Pw(e,t,n=2e-16){return Math.abs(e-t)<n}let Fw={description:E(`Equal.`),args:[Y(`value1 (string, number, boolean)`,E(`The first value.`)),Y(`value2 (string, number, boolean)`,E(`The value to test against value1 for equality.`))],compute:function(e,t){let n=Mw(e)?Nw[typeof t?.value]:e?.value,r=Mw(t)?Nw[typeof e?.value]:t?.value;return typeof n==`string`&&(n=n.toUpperCase()),typeof r==`string`&&(r=r.toUpperCase()),typeof n==`number`&&typeof r==`number`?Pw(n,r):n===r}};function Iw(e,t,n){let r=Mw(e)?Nw[typeof t?.value]:e?.value,i=Mw(t)?Nw[typeof e?.value]:t?.value;if(P(r))throw e;if(P(i))throw t;typeof r!=`number`&&(r=I(r).toUpperCase()),typeof i!=`number`&&(i=I(i).toUpperCase());let a=typeof r,o=typeof i;return a===`string`&&o===`number`?!0:o===`string`&&a===`number`?!1:n(r,i)}let Lw={description:E(`Strictly greater than.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being greater than value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return Iw(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!Pw(e,t)&&e>t:e>t)}},Rw={description:E(`Greater than or equal to.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being greater than or equal to value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return Iw(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?Pw(e,t)||e>t:e>=t)}},zw={description:E(`Less than.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being less than value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return!Rw.compute.bind(this)(e,t)}},Bw={description:E(`Less than or equal to.`),args:[Y(`value1 (number, string, boolean)`,E(`The value to test as being less than or equal to value2.`)),Y(`value2 (number, string, boolean)`,E(`The second value.`))],compute:function(e,t){return!Lw.compute.bind(this)(e,t)}},Vw={description:E(`Difference of two numbers.`),args:[Y(`value1 (number)`,E(`The minuend, or number to be subtracted from.`)),Y(`value2 (number)`,E(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:F(e,this.locale)-F(t,this.locale),format:e?.format||t?.format}}},Hw={description:E(`Product of two numbers`),args:[Y(`factor1 (number)`,E(`The first multiplicand.`)),Y(`factor2 (number)`,E(`The second multiplicand.`))],compute:function(e,t){return{value:F(e,this.locale)*F(t,this.locale),format:e?.format||t?.format}}},Uw={description:E(`Not equal.`),args:[Y(`value1 (string, number, boolean)`,E(`The first value.`)),Y(`value2 (string, number, boolean)`,E(`The value to test against value1 for inequality.`))],compute:function(e,t){return!Fw.compute.bind(this)(e,t)}},Ww={description:E(`A number raised to a power.`),args:[Y(`base (number)`,E(`The number to raise to the exponent power.`)),Y(`exponent (number)`,E(`The exponent to raise base to.`))],compute:function(e,t){return Lv.compute.bind(this)(e,t)}},Gw={description:E(`A number with the sign reversed.`),args:[Y(`value (number)`,E(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-F(e,this.locale),format:e?.format}}},Kw={description:E(`Value interpreted as a percentage.`),args:[Y(`percentage (number)`,E(`The value to interpret as a percentage.`))],compute:function(e){return F(e,this.locale)/100}},qw={description:E(`A specified number, unchanged.`),args:[Y(`value (any)`,E(`The number to return.`))],compute:function(e={value:null}){return e}},X=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),Jw={transform:e=>e,inverseTransform:e=>e},Yw=1e-10,Xw=.0254,Zw=Xw/72,Qw=.3048,$w=.9144,eT=1609.34,tT=1852,nT=946073047258e4,rT={g:{...Jw,category:`weight`},u:{...X(166053e-29),category:`weight`},grain:{...X(.0647989),category:`weight`},ozm:{...X(28.3495),category:`weight`},lbm:{...X(453.592),category:`weight`},stone:{...X(6350.29),category:`weight`},sg:{...X(14593.90294),category:`weight`},cwt:{...X(45359.237),category:`weight`},uk_cwt:{...X(50802.3),category:`weight`},ton:{...X(907184.74),category:`weight`},uk_ton:{...X(1016046.9),category:`weight`},m:{...Jw,category:`distance`},km:{...X(1e3),category:`distance`},ang:{...X(Yw),category:`distance`},Picapt:{...X(Zw),category:`distance`},pica:{...X(Xw/6),category:`distance`},in:{...X(Xw),category:`distance`},ft:{...X(Qw),category:`distance`},yd:{...X($w),category:`distance`},ell:{...X(1.143),category:`distance`},mi:{...X(eT),category:`distance`},survey_mi:{...X(1609.34),category:`distance`},Nmi:{...X(tT),category:`distance`},ly:{...X(nT),category:`distance`},parsec:{...X(0x6da012f95c9fd0),category:`distance`},sec:{...Jw,category:`time`},min:{...X(60),category:`time`},hr:{...X(3600),category:`time`},day:{...X(86400),category:`time`},yr:{...X(31556952),category:`time`},Pa:{...Jw,category:`pressure`},bar:{...X(1e5),category:`pressure`},mmHg:{...X(133.322),category:`pressure`},Torr:{...X(133.322),category:`pressure`},psi:{...X(6894.76),category:`pressure`},atm:{...X(101325),category:`pressure`},N:{...Jw,category:`force`},dyn:{...X(1e-5),category:`force`},pond:{...X(.00980665),category:`force`},lbf:{...X(4.44822),category:`force`},J:{...Jw,category:`energy`},eV:{...X(160218e-24),category:`energy`},e:{...X(1e-7),category:`energy`},flb:{...X(1.3558179483),category:`energy`},c:{...X(4.184),category:`energy`},cal:{...X(4.1868),category:`energy`},BTU:{...X(1055.06),category:`energy`},Wh:{...X(3600),category:`energy`},HPh:{...X(2684520),category:`energy`},W:{...Jw,category:`power`},PS:{...X(735.499),category:`power`},HP:{...X(745.7),category:`power`},T:{...Jw,category:`magnetism`},ga:{...X(1e-4),category:`magnetism`},K:{...Jw,category:`temperature`},C:{transform:e=>e+273.15,inverseTransform:e=>e-273.15,category:`temperature`},F:{transform:e=>(e-32)*5/9+273.15,inverseTransform:e=>(e-273.15)*9/5+32,category:`temperature`},Rank:{...X(5/9),category:`temperature`},Reau:{transform:e=>e*1.25+273.15,inverseTransform:e=>(e-273.15)/1.25,category:`temperature`},"m^3":{...Jw,category:`volume`,order:3},"ang^3":{...X(Yw**3),category:`volume`,order:3},"Picapt^3":{...X(Zw**3),category:`volume`,order:3},tsp:{...X(492892e-11),category:`volume`},tspm:{...X(5e-6),category:`volume`},tbs:{...X(14786764825785619e-21),category:`volume`},"in^3":{...X(Xw**3),category:`volume`,order:3},oz:{...X(295735295625e-16),category:`volume`},cup:{...X(237e-6),category:`volume`},pt:{...X(.0004731765),category:`volume`},uk_pt:{...X(568261e-9),category:`volume`},qt:{...X(.0009463529),category:`volume`},l:{...X(.001),category:`volume`},uk_qt:{...X(.0011365225),category:`volume`},gal:{...X(.0037854118),category:`volume`},uk_gal:{...X(.00454609),category:`volume`},"ft^3":{...X(Qw**3),category:`volume`,order:3},bushel:{...X(.0352390704),category:`volume`},barrel:{...X(.158987295),category:`volume`},"yd^3":{...X($w**3),category:`volume`,order:3},MTON:{...X(1.13267386368),category:`volume`},GRT:{...X(2.83168),category:`volume`},"mi^3":{...X(eT**3),category:`volume`,order:3},"Nmi^3":{...X(tT**3),category:`volume`,order:3},"ly^3":{...X(nT**3),category:`volume`,order:3},"m^2":{...Jw,category:`area`,order:2},"ang^2":{...X(Yw**2),category:`area`,order:2},"Picapt^2":{...X(Zw**2),category:`area`,order:2},"in^2":{...X(Xw**2),category:`area`,order:2},"ft^2":{...X(Qw**2),category:`area`,order:2},"yd^2":{...X($w**2),category:`area`,order:2},ar:{...X(100),category:`area`},Morgen:{...X(2500),category:`area`},uk_acre:{...X(4046.8564224),category:`area`},us_acre:{...X(4046.8726098743),category:`area`},ha:{...X(1e4),category:`area`},"mi^2":{...X(eT**2),category:`area`,order:2},"Nmi^2":{...X(tT**2),category:`area`,order:2},"ly^2":{...X(nT**2),category:`area`,order:2},bit:{...Jw,category:`information`},byte:{...X(8),category:`information`},"m/s":{...Jw,category:`speed`},"m/hr":{...X(1/3600),category:`speed`},"km/hr":{...X(1/3.6),category:`speed`},mph:{...X(.44704),category:`speed`},kn:{...X(.5144444444),category:`speed`},admkn:{...X(.5147733333),category:`speed`}},iT={shweight:`cwt`,lcwt:`uk_cwt`,hweight:`uk_cwt`,LTON:`uk_ton`,brton:`uk_ton`,pc:`parsec`,Pica:`Picapt`,d:`day`,mn:`min`,s:`sec`,p:`Pa`,at:`atm`,dy:`dyn`,ev:`eV`,hh:`HPh`,wh:`Wh`,btu:`BTU`,h:`HP`,cel:`C`,fah:`F`,kel:`K`,us_pt:`pt`,L:`l`,lt:`l`,ang3:`ang^3`,ft3:`ft^3`,in3:`in^3`,ly3:`ly^3`,m3:`m^3`,mi3:`mi^3`,yd3:`yd^3`,Nmi3:`Nmi^3`,Picapt3:`Picapt^3`,"Pica^3":`Picapt^3`,Pica3:`Picapt^3`,regton:`GRT`,ang2:`ang^2`,ft2:`ft^2`,in2:`in^2`,ly2:`ly^2`,m2:`m^2`,mi2:`mi^2`,Nmi2:`Nmi^2`,Picapt2:`Picapt^2`,"Pica^2":`Picapt^2`,Pica2:`Picapt^2`,yd2:`yd^2`,"m/h":`m/hr`,"m/sec":`m/s`},aT={"":1,Y:1e24,Z:1e21,E:0xde0b6b3a7640000,P:0x38d7ea4c68000,T:0xe8d4a51000,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-21,Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},oT={weight:E(`Weight`),distance:E(`Distance`),time:E(`Time`),pressure:E(`Pressure`),force:E(`Force`),energy:E(`Energy`),power:E(`Power`),magnetism:E(`Magnetism`),temperature:E(`Temperature`),volume:E(`Volume`),area:E(`Area`),information:E(`Information`),speed:E(`Speed`)};function sT(e){return oT[e]??``}function cT(e){for(let[t,n]of Object.entries(aT)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=rT[r];if(!i&&iT[r]&&(i=rT[iT[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var lT=l({CONVERT:()=>uT});let uT={description:E(`Converts a numeric value to a different unit of measure.`),args:[Y(`value (number)`,E(`the numeric value in start_unit to convert to end_unit`)),Y(`start_unit (string)`,E(`The starting unit, the unit currently assigned to value`)),Y(`end_unit (string)`,E(`The unit of measure into which to convert value`))],compute:function(e,t,n){let r=F(e,this.locale),i=I(t),a=I(n),o=cT(i),s=cT(a);return o?s?o.category===s.category?{value:s.inverseTransform(o.factor*o.transform(r))/s.factor,format:e?.format}:{value:j.GenericError,message:E(`Incompatible units of measure ('%s' vs '%s')`,sT(o.category),sT(s.category))}:{value:j.GenericError,message:E(`Invalid units of measure ('%s')`,a)}:{value:j.GenericError,message:E(`Invalid units of measure ('%s')`,i)}},isExported:!0};var dT=l({CHAR:()=>pT,CLEAN:()=>mT,CONCATENATE:()=>hT,EXACT:()=>gT,FIND:()=>_T,JOIN:()=>vT,LEFT:()=>yT,LEN:()=>bT,LOWER:()=>xT,MID:()=>ST,PROPER:()=>CT,REPLACE:()=>wT,RIGHT:()=>TT,SEARCH:()=>ET,SPLIT:()=>DT,SUBSTITUTE:()=>OT,TEXT:()=>MT,TEXTJOIN:()=>kT,TRIM:()=>AT,UPPER:()=>jT,VALUE:()=>NT});let fT=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,pT={description:E(`Gets character associated with number.`),args:[Y(`table_number (number)`,E(`The number of the character to look up from the current Unicode table in decimal format.`))],compute:function(e){let t=Math.trunc(F(e,this.locale));return N(()=>t>=1,E(`The table_number (%s) is out of range.`,t.toString())),String.fromCharCode(t)},isExported:!0},mT={description:E(`Remove non-printable characters from a piece of text.`),args:[Y(`text (string)`,E(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=I(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},hT={description:E(`Appends strings to one another.`),args:[Y(`string1 (string, range<string>)`,E(`The initial string.`)),Y(`string2 (string, range<string>, repeating)`,E(`More strings to append in sequence.`))],compute:function(...e){return Oa(e,(e,t)=>e+I(t),``)},isExported:!0},gT={description:E(`Tests whether two strings are identical.`),args:[Y(`string1 (string)`,E(`The first string to compare.`)),Y(`string2 (string)`,E(`The second string to compare.`))],compute:function(e,t){return I(e)===I(t)},isExported:!0},_T={description:E(`First position of string found in text, case-sensitive.`),args:[Y(`search_for (string)`,E(`The string to look for within text_to_search.`)),Y(`text_to_search (string)`,E(`The text to search for the first occurrence of search_for.`)),Y(`starting_at (number, default=1)`,E(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e),i=I(t),a=F(n,this.locale);N(()=>i!==``,E(`The text_to_search must be non-empty.`)),N(()=>a>=1,E(`The starting_at (%s) must be greater than or equal to 1.`,a.toString()));let o=i.indexOf(r,a-1);return N(()=>o>=0,E(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r.toString(),i)),o+1},isExported:!0},vT={description:E(`Concatenates elements of arrays with delimiter.`),args:[Y(`delimiter (string)`,E(`The character or string to place between each concatenated value.`)),Y(`value_or_array1 (string, range<string>)`,E(`The value or values to be appended using delimiter.`)),Y(`value_or_array2 (string, range<string>, repeating)`,E(`More values to be appended using delimiter.`))],compute:function(e,...t){let n=I(e);return Oa(t,(e,t)=>(e?e+n:``)+I(t),``)}},yT={description:E(`Substring from beginning of specified string.`),args:[Y(`text (string)`,E(`The string from which the left portion will be returned.`)),Y(`number_of_characters (number, optional)`,E(`The number of characters to return from the left side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;return N(()=>n>=0,E(`The number_of_characters (%s) must be positive or null.`,n.toString())),I(e).substring(0,n)},isExported:!0},bT={description:E(`Length of a string.`),args:[Y(`text (string)`,E(`The string whose length will be returned.`))],compute:function(e){return I(e).length},isExported:!0},xT={description:E(`Converts a specified string to lowercase.`),args:[Y(`text (string)`,E(`The string to convert to lowercase.`))],compute:function(e){return I(e).toLowerCase()},isExported:!0},ST={description:E(`A segment of a string.`),args:[Y(`text (string)`,E(`The string to extract a segment from.`)),Y(`starting_at (number)`,E(`The index from the left of string from which to begin extracting. The first character in string has the index 1.`)),Y(`extract_length (number)`,E(`The length of the segment to extract.`))],compute:function(e,t,n){let r=I(e),i=F(t,this.locale),a=F(n,this.locale);return N(()=>i>=1,E(`The starting_at argument (%s) must be positive greater than one.`,i.toString())),N(()=>a>=0,E(`The extract_length argument (%s) must be positive or null.`,a.toString())),r.slice(i-1,i+a-1)},isExported:!0},CT={description:E(`Capitalizes each word in a specified string.`),args:[Y(`text_to_capitalize (string)`,E(`The text which will be returned with the first letter of each word in uppercase and all other letters in lowercase.`))],compute:function(e){return I(e).replace(fT,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},wT={description:E(`Replaces part of a text string with different text.`),args:[Y(`text (string)`,E(`The text, a part of which will be replaced.`)),Y(`position (number)`,E(`The position where the replacement will begin (starting from 1).`)),Y(`length (number)`,E(`The number of characters in the text to be replaced.`)),Y(`new_text (string)`,E(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=F(t,this.locale);N(()=>i>=1,E(`The position (%s) must be greater than or equal to 1.`,i.toString()));let a=I(e),o=F(n,this.locale),s=I(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},TT={description:E(`A substring from the end of a specified string.`),args:[Y(`text (string)`,E(`The string from which the right portion will be returned.`)),Y(`number_of_characters (number, optional)`,E(`The number of characters to return from the right side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;N(()=>n>=0,E(`The number_of_characters (%s) must be positive or null.`,n.toString()));let r=I(e),i=r.length;return r.substring(i-n,i)},isExported:!0},ET={description:E(`First position of string found in text, ignoring case.`),args:[Y(`search_for (string)`,E(`The string to look for within text_to_search.`)),Y(`text_to_search (string)`,E(`The text to search for the first occurrence of search_for.`)),Y(`starting_at (number, default=1)`,E(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e).toLowerCase(),i=I(t).toLowerCase(),a=F(n,this.locale);if(i===``)return{value:j.GenericError,message:E(`The text_to_search must be non-empty.`)};if(a<1)return{value:j.GenericError,message:E(`The starting_at (%s) must be greater than or equal to 1.`,a)};let o=i.indexOf(r,a-1);return o===-1?{value:j.GenericError,message:E(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)}:{value:o+1}},isExported:!0},DT={description:E(`Split text by specific character delimiter(s).`),args:[Y(`text (string)`,E(`The text to divide.`)),Y(`delimiter (string)`,E(`The character or characters to use to split text.`)),Y(`split_by_each (boolean, default=true})`,E(`Whether or not to divide text around each character contained in delimiter.`)),Y(`remove_empty_text (boolean, default=true)`,E(`Whether or not to remove empty text messages from the split results. The default behavior is to treat consecutive delimiters as one (if TRUE). If FALSE, empty cells values are added between consecutive delimiters.`))],compute:function(e,t,n={value:!0},r={value:!0}){let i=I(e),a=nt(I(t)),o=L(n),s=L(r);N(()=>a.length>0,E(`The _delimiter (%s) must be not be empty.`,a));let c=o?RegExp(`[${a}]`,`g`):new RegExp(a,`g`),l=i.split(c);return s&&(l=l.filter(e=>e!==``)),Pa([l])},isExported:!1},OT={description:E(`Replaces existing text with new text in a string.`),args:[Y(`text_to_search (string)`,E(`The text within which to search and replace.`)),Y(`search_for (string)`,E(`The string to search for within text_to_search.`)),Y(`replace_with (string)`,E(`The string that will replace search_for.`)),Y(`occurrence_number (number, optional)`,E(`The instance of search_for within text_to_search to replace with replace_with. By default, all occurrences of search_for are replaced; however, if occurrence_number is specified, only the indicated instance of search_for is replaced.`))],compute:function(e,t,n,r){let i=F(r,this.locale);N(()=>i>=0,E(`The occurrenceNumber (%s) must be positive or null.`,i.toString()));let a=I(e),o=I(t);if(o===``)return a;let s=I(n),c=new RegExp(nt(o),`g`);if(i===0)return a.replace(c,s);let l=0;return a.replace(c,e=>++l===i?s:e)},isExported:!0},kT={description:E(`Combines text from multiple strings and/or arrays.`),args:[Y(`delimiter (string)`,E(` A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),Y(`ignore_empty (boolean)`,E(`A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result.`)),Y(`text1 (string, range<string>)`,E(`Any text item. This could be a string, or an array of strings in a range.`)),Y(`text2 (string, range<string>, repeating)`,E(`Additional text item(s).`))],compute:function(e,t,...n){let r=I(e),i=L(t),a=0;return Oa(n,(e,t)=>i&&I(t)===``?e:(a++?e+r:``)+I(t),``)},isExported:!0},AT={description:E(`Removes space characters.`),args:[Y(`text (string)`,E(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return Ht(I(e))},isExported:!0},jT={description:E(`Converts a specified string to uppercase.`),args:[Y(`text (string)`,E(`The string to convert to uppercase.`))],compute:function(e){return I(e).toUpperCase()},isExported:!0},MT={description:E(`Converts a number to text according to a specified format.`),args:[Y(`number (number)`,E(`The number, date or time to format.`)),Y(`format (string)`,E(`The pattern by which to format the number, enclosed in quotation marks.`))],compute:function(e,t){return B(F(e,this.locale),{format:I(t),locale:this.locale})},isExported:!0},NT={description:E(`Converts a string to a numeric value.`),args:[Y(`value (number)`,E(`the string to be converted`))],compute:function(e){return F(e,this.locale)},isExported:!0};var PT=l({HYPERLINK:()=>FT});let FT={description:E(`Creates a hyperlink in a cell.`),args:[Y(`url (string)`,E(`The full URL of the link enclosed in quotation marks.`)),Y(`link_label (string, optional)`,E(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=I(e).trim(),r=I(t)||n;return n===``?r:ht(r,n)},isExported:!0},IT=[{name:E(`Array`),functions:x_},{name:E(`Database`),functions:pb},{name:E(`Date`),functions:Ob},{name:E(`Filter`),functions:hx},{name:E(`Financial`),functions:Zx},{name:E(`Info`),functions:IC},{name:E(`Lookup`),functions:lw},{name:E(`Logical`),functions:JC},{name:E(`Math`),functions:q_},{name:E(`Misc`),functions:G_},{name:E(`Operator`),functions:Ow},{name:E(`Statistical`),functions:ay},{name:E(`Text`),functions:dT},{name:E(`Engineering`),functions:lx},{name:E(`Web`),functions:PT},{name:E(`Parser`),functions:lT}],LT=/^[A-Z0-9\_\.]+$/,RT=new class extends h{mapping={};add(e,t){if(e=e.toUpperCase(),!LT.test(e))throw Error(E(`Invalid function name %s. Function names can exclusively contain alphanumerical values separated by dots (.) or underscore (_)`,e));let n=m_(t);return g_(n.args),this.mapping[e]=zT(n,e),super.add(e,n),this}};for(let e of IT){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),RT.add(n,{isExported:!1,...r})}}function zT(e,t){let n=[];function r(...r){let o=[];n=Array(r.length);for(let i=0;i<r.length;i++){let a=e.args[e.getArgToFocus(i+1)-1];n[i]=a;let s=r[i];if(!A(s)&&a.acceptMatrixOnly)throw new na(E(`Function %s expects the parameter '%s' to be reference to a cell or range.`,t,(i+1).toString()));o.push(!a.acceptMatrix)}return i(Fa(a.bind(this),r,o))}function i(e){return A(e)?Na(e,e=>HT(e,t)):HT(e,t),e}function a(...e){for(let t=0;t<e.length;t++){let r=e[t];if(!n[t].acceptErrors&&!A(r)&&P(r?.value))return r}try{return o.apply(this,e)}catch(e){return BT(e,t)}}function o(...t){let n=e.compute.apply(this,t);return A(n)?typeof n[0][0]==`object`&&n[0][0]!==null&&`value`in n[0][0]?n:Ma(n,e=>({value:e})):typeof n==`object`&&n&&`value`in n?n:{value:n}}return r}function BT(e,t){return VT(e)&&P(e.value)?(WT(e)&&HT(e,t),e):(console.error(e),new M(UT+(WT(e)?` `+e.message:``)))}function VT(e){return e?.value!==void 0&&typeof e.value==`string`}function HT(e,t){e.message?.includes(`[[FUNCTION_NAME]]`)&&(e.message=e.message.replace(`[[FUNCTION_NAME]]`,t))}let UT=E(`An unexpected error occurred. Submit a support ticket at odoo.com/help.`);function WT(e){return e?.message!==void 0&&typeof e.message==`string`}c_.add(`functions`,{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if(e.type!==`SYMBOL`)return[];let t=e.value;return this.composer.currentContent.startsWith(`=`)?Object.entries(RT.content).filter(([e,{hidden:t}])=>!t).map(([e,{description:n}])=>({text:e,description:n,htmlContent:u_(t,e,ge,`o-semi-bold`)})).sort((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)):[]},selectProposal(e,t){let n=e.end,r=e.end;[`SYMBOL`,`FUNCTION`].includes(e.type)&&(n=e.start);let i=this.composer.currentTokens;t+=`(`;let a=i.map(e=>e.start).indexOf(e.start);a+1<i.length&&i[a+1]?.type===`LEFT_PAREN`&&r++,this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t)}});var GT=class{mutators=[`setFocusableElement`,`focus`];focusableElement=void 0;setFocusableElement(e){return this.focusableElement=e,`noStateChange`}focus(){if(this.focusableElement===document.activeElement)return`noStateChange`;this.focusableElement?.focus()}};let KT=/Mac/i,qT=[`Shift`,`Control`,`Alt`,`Meta`];function JT(e,t){return e?!!t.target&&e.contains(t.target):!1}function YT(){let e=document.querySelector(`.o-grid-overlay`);if(e){let{top:t,left:n}=e.getBoundingClientRect();return{top:t,left:n}}throw Error(`Can't find spreadsheet position`)}function XT(e){let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}function*ZT(e){if(yield e,e.hasChildNodes())for(let t of e.childNodes)yield*ZT(t)}function QT(){return Array.from(document.querySelectorAll(`.o-spreadsheet .o-menu`))}let $T=/^[a-zA-Z]$/;function eE(e,t=`key`){let n=``;qT.includes(e.key)||(nE(e)&&(n+=`Ctrl+`),e.altKey&&(n+=`Alt+`),e.shiftKey&&(n+=`Shift+`));let r=t===`key`?e.key:e.code;return n+=$T.test(r)?r.toUpperCase():r,n}function tE(){return!!KT.test(navigator.userAgent)}function nE(e){return tE()?e.metaKey:e.ctrlKey}function rE(){let e=(0,t.useState)({x:0,y:0,width:0,height:0}),n=null;function r(){if(n||=document.querySelector(`.o-spreadsheet`),n){let{top:t,left:r,width:i,height:a}=n.getBoundingClientRect();e.x=r,e.y=t,e.width=i,e.height=a}}return(0,t.onMounted)(r),(0,t.onPatched)(r),e}function iE(e){let n=(0,t.useState)({x:0,y:0,width:0,height:0});function r(){let t=e.el;if(t===null)return;let{top:r,left:i,width:a,height:o}=t.getBoundingClientRect();n.x=i,n.y=r,n.width=a,n.height=o}return(0,t.onMounted)(r),(0,t.onPatched)(r),n}function aE(){let e=(0,t.useState)({x:0,y:0,width:0,height:0}),n=(0,t.useComponent)(),r=rE();function i(){let t=n.env,i=`getPopoverContainerRect`in t?t.getPopoverContainerRect():r;e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return i(),(0,t.onMounted)(i),(0,t.onPatched)(i),e}let oE={ArrowDown:`down`,ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`};function sE(e,t){let n=oE[e.key];e.shiftKey?t.resizeAnchorZone(n,nE(e)?`end`:1):t.moveAnchorCell(n,nE(e)?`end`:1)}H`
51
51
  .o-autocomplete-dropdown {
52
52
  pointer-events: auto;
53
53
  cursor: pointer;
@@ -3301,4 +3301,4 @@ stores.inject(MyMetaStore, storeInstance);
3301
3301
  <Relationships xmlns="${ef.Relationships}">
3302
3302
  <Relationship ${K(e)} />
3303
3303
  </Relationships>
3304
- `),`_rels/.rels`)}function MH(e){let t={},n=new Set;for(let r of e.sheets){let e=r.name.slice(0,31),i=1;for(;n.has(e);)e=e.slice(0,31-String(i).length)+i++;n.add(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${nt(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function NH(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>pr(Qn(e.range)).numberOfRows>1);return e}var PH=class extends rd{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},n={},r=[],i=new wc,a=!1){let o=performance.now();console.debug(`##### Model creation #####`),super(),Jn(),r=Wh(e,r);let s=Rh(e,a);this.state=new tV,this.uuidGenerator=i,this.config=this.setupConfig(n),this.session=this.setupSession(s.revisionId),this.coreGetters={},this.range=new UL(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.selection=new $B(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of sB.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(r);for(let e of uB.getAll()){let t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of lB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of cB.getAll()){let t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),n.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly()){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}(0,t.markRaw)(this),console.debug(`Model created in`,performance.now()-o,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:Et(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new cz(YB({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowed(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e)}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:E(`Anonymous`).toString()},n=e.transportService||new VB;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(Xi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){let t=Gi(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some(e=>e!==`Success`)?new qi(t.flat()):qi.Success}checkDispatchAllowedCoreCommand(e){let t=this.corePlugins.map(t=>t.allowDispatch(e));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=3;for(let e of this.handlers)e.finalize();this.status=0,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(FH(e,t));dispatch=(e,t)=>{let n=FH(e,t),r=this.status;if(this.getters.isReadonly()&&!Ki(n))return new qi(`Readonly`);if(!this.session.canApplyOptimisticUpdate())return new qi(`WaitingSessionConfirmation`);switch(r){case 0:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),t;this.status=1;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Gi(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=0,this.trigger(`update`);break;case 1:if(Gi(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case 3:throw Error(`Cannot dispatch commands in the finalize state`);case 2:if(Gi(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return qi.Success};dispatchFromCorePlugin=(e,t)=>{let n=FH(e,t),r=this.status;this.status=2;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,qi.Success};dispatchToHandlers(e,t){let n=Gi(t);for(let r of e)!n&&r instanceof EL||r.beforeHandle(t);for(let r of e)!n&&r instanceof EL||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let e=Xh();for(let t of this.handlers)t instanceof EL&&t.export(e);return e.revisionId=this.session.getRevisionId()||`START_REVISION`,e=y(e),e}updateMode(e){this.config.mode=e,this.trigger(`update`)}exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=Qh();for(let t of this.handlers)t instanceof TL&&t.exportForExcel(e);return e=y(e),CH(e)}garbageCollectExternalResources(){for(let e of this.corePlugins)e.garbageCollectExternalResources()}};function FH(e,t={}){let n=y(t);return n.type=e,n}let IH={},LH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},RH={autoCompleteProviders:c_,autofillModifiersRegistry:$E,autofillRulesRegistry:eD,cellMenuRegistry:yj,colMenuRegistry:dN,errorTypes:ta,linkMenuRegistry:nk,functionRegistry:RT,featurePluginRegistry:cB,iconsOnCellRegistry:pf,statefulUIPluginRegistry:lB,coreViewsPluginRegistry:uB,corePluginRegistry:sB,rowMenuRegistry:gN,sidePanelRegistry:fI,figureRegistry:pO,chartSidePanelComponentRegistry:rP,chartComponentRegistry:aO,chartRegistry:iO,chartSubtypeRegistry:sO,topbarMenuRegistry:SN,topbarComponentRegistry:wN,clickableCellRegistry:dB,otRegistry:CN,inverseCommandRegistry:yO,urlRegistry:Xa,cellPopoverRegistry:uD,numberFormatMenuRegistry:fN,repeatLocalCommandTransformRegistry:Uz,repeatCommandTransformRegistry:Hz,clipboardHandlersRegistries:ed,pivotRegistry:AF,pivotTimeAdapterRegistry:lu,pivotSidePanelRegistry:IF,pivotNormalizationValueRegistry:Bu,supportedPivotPositionalFormulaRegistry:JE,pivotToFunctionValueRegistry:Vu,migrationStepRegistry:Fh},zH={arg:Y,isEvaluationError:P,toBoolean:L,toJsDate:R,toNumber:F,toString:I,toNormalizedPivotValue:Iu,toXC:w,toZone:Qn,toUnboundedZone:Zn,toCartesian:Pn,numberToLetters:Tn,lettersToNumber:En,UuidGenerator:wc,formatValue:B,createCurrencyFormat:Qo,ColorGenerator:wn,computeTextWidth:sc,createEmptyWorkbookData:Xh,createEmptySheet:Yh,createEmptyExcelSheet:Zh,getDefaultChartJsRuntime:Xg,chartFontColor:Dd,getChartAxisTitleRuntime:Md,getChartAxisType:wD,getTrendDatasetForBarChart:Fd,getTrendDatasetForLineChart:jD,getFillingMode:t_,rgbaToHex:cn,colorToRGBA:ln,positionToZone:D,isDefined:S,isMatrix:A,lazy:Et,genericRepeat:Wz,createAction:m,createActions:f,transformRangeData:nd,deepEquals:C,overlap:ur,union:or,isInside:dr,deepCopy:y,expandZoneOnInsertion:nr,reduceZoneOnDeletion:ar,unquote:at,getMaxObjectId:Ou,getFunctionsFromTokens:LE,getFirstPivotFunction:GE,getNumberOfPivotFunctions:qE,parseDimension:ju,isDateOrDatetimeField:Mu,makeFieldProposal:BE,insertTokenAfterArgSeparator:HE,insertTokenAfterLeftParenthesis:UE,mergeContiguousZones:jr,getPivotHighlights:vN,pivotTimeAdapter:uu,UNDO_REDO_PIVOT_COMMANDS:kR,createPivotFormula:Fu,areDomainArgsFieldsValid:Pu,splitReference:Vs,formatTickValue:zd,sanitizeSheetName:st,isNumber:Oi,isDateTime:Xr},BH={isMarkdownLink:pt,parseMarkdownLink:gt,markdownLink:ht,openLink:to,urlRepresentation:eo},VH={Checkbox:TN,Section:Z,RoundColorPicker:HN,ChartDataSeries:kN,ChartErrorSection:jN,ChartLabelRange:MN,ChartTitle:WN,ChartPanel:oP,ChartFigure:lO,ChartJsComponent:o_,Grid:SL,GridOverlay:$I,ScorecardChart:s_,LineConfigPanel:ZN,BarConfigPanel:PN,PieChartDesignPanel:QN,GenericChartConfigPanel:NN,ChartWithAxisDesignPanel:qN,GaugeChartConfigPanel:YN,GaugeChartDesignPanel:XN,ScorecardChartConfigPanel:eP,ScorecardChartDesignPanel:tP,ChartTypePicker:iP,FigureComponent:pI,Menu:pk,Popover:lk,SelectionInput:ON,ValidationMessages:AN,AddDimensionButton:tF,PivotDimensionGranularity:aF,PivotDimensionOrder:oF,PivotDimension:iF,PivotLayoutConfigurator:lF,PivotHTMLRenderer:wL,EditableName:CL,PivotDeferUpdate:$P,PivotTitleSection:uF,CogWheelMenu:rF,TextInput:nF,SidePanelCollapsible:IN},HH={useDragAndDropListItems:fP,useHighlights:bP,useHighlightsOnHover:yP},UH={useStoreProvider:cd,DependencyContainer:id,CellPopoverStore:GO,ComposerFocusStore:_d,CellComposerStore:TI,FindAndReplaceStore:qP,HighlightStore:xN,HoveredCellStore:WO,ModelStore:pd,NotificationStore:sP,RendererStore:md,SelectionInputStore:DN,SpreadsheetStore:hd,useStore:V,useLocalStore:ld,SidePanelStore:vL,PivotSidePanelStore:PF,PivotMeasureDisplayPanelStore:ZP};function WH(e,t){return RT.add(e,t),{addFunction:(e,t)=>WH(e,t)}}let GH={DEFAULT_LOCALE:k,HIGHLIGHT_COLOR:_,PIVOT_TABLE_CONFIG:Ze,TREND_LINE_XAXIS_ID:`x1`,CHART_AXIS_CHOICES:Vd,ChartTerms:ag};e.AbstractCellClipboardHandler=Pc,e.AbstractChart=Ag,e.AbstractFigureClipboardHandler=Gu,e.CellErrorType=j,e.CommandResult=Yi,e.CorePlugin=EL,e.DispatchResult=qi,e.EvaluationError=M,e.Model=PH,e.PivotRuntimeDefinition=dF,e.Registry=h,e.Revision=oz,e.SPREADSHEET_DIMENSIONS=LH,e.Spreadsheet=BB,e.SpreadsheetPivotTable=mF,e.UIPlugin=$,e.__info__=IH,e.addFunction=WH,e.addRenderingLayer=ea,e.astToFormula=bC,e.compile=OE,e.compileTokens=kE,e.components=VH,e.constants=GH,e.convertAstNodes=gC,e.coreTypes=Wi,e.findCellInNewZone=Sr,e.functionCache=DE,e.helpers=zH,e.hooks=HH,e.invalidateCFEvaluationCommands=Vi,e.invalidateDependenciesCommands=Bi,e.invalidateEvaluationCommands=Ri,e.iterateAstNodes=_C,e.links=BH,e.load=Rh,e.parse=mC,e.parseTokens=hC,e.readonlyAllowedCommands=Ui,e.registries=RH,e.setDefaultSheetViewSize=Ye,e.setTranslationMethod=qn,e.stores=UH,e.tokenColors=_E,e.tokenize=Rc,IH.version=`18.0.77`,IH.date=`2026-07-30T06:52:06.623Z`,IH.hash=`54a18dc`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
3304
+ `),`_rels/.rels`)}function MH(e){let t={},n=new Set;for(let r of e.sheets){let e=r.name.slice(0,31),i=1;for(;n.has(e);)e=e.slice(0,31-String(i).length)+i++;n.add(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${nt(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function NH(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>pr(Qn(e.range)).numberOfRows>1);return e}var PH=class extends rd{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},n={},r=[],i=new wc,a=!1){let o=performance.now();console.debug(`##### Model creation #####`),super(),Jn(),r=Wh(e,r);let s=Rh(e,a);this.state=new tV,this.uuidGenerator=i,this.config=this.setupConfig(n),this.session=this.setupSession(s.revisionId),this.coreGetters={},this.range=new UL(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.selection=new $B(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of sB.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(r);for(let e of uB.getAll()){let t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of lB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of cB.getAll()){let t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),n.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly()){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}(0,t.markRaw)(this),console.debug(`Model created in`,performance.now()-o,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:Et(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new cz(YB({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowed(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e)}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:E(`Anonymous`).toString()},n=e.transportService||new VB;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(Xi));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){let t=Gi(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some(e=>e!==`Success`)?new qi(t.flat()):qi.Success}checkDispatchAllowedCoreCommand(e){let t=this.corePlugins.map(t=>t.allowDispatch(e));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=3;for(let e of this.handlers)e.finalize();this.status=0,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(FH(e,t));dispatch=(e,t)=>{let n=FH(e,t),r=this.status;if(this.getters.isReadonly()&&!Ki(n))return new qi(`Readonly`);if(!this.session.canApplyOptimisticUpdate())return new qi(`WaitingSessionConfirmation`);switch(r){case 0:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),t;this.status=1;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Gi(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=0,this.trigger(`update`);break;case 1:if(Gi(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case 3:throw Error(`Cannot dispatch commands in the finalize state`);case 2:if(Gi(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return qi.Success};dispatchFromCorePlugin=(e,t)=>{let n=FH(e,t),r=this.status;this.status=2;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,qi.Success};dispatchToHandlers(e,t){let n=Gi(t);for(let r of e)!n&&r instanceof EL||r.beforeHandle(t);for(let r of e)!n&&r instanceof EL||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let e=Xh();for(let t of this.handlers)t instanceof EL&&t.export(e);return e.revisionId=this.session.getRevisionId()||`START_REVISION`,e=y(e),e}updateMode(e){this.config.mode=e,this.trigger(`update`)}exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=Qh();for(let t of this.handlers)t instanceof TL&&t.exportForExcel(e);return e=y(e),CH(e)}garbageCollectExternalResources(){for(let e of this.corePlugins)e.garbageCollectExternalResources()}};function FH(e,t={}){let n=y(t);return n.type=e,n}let IH={},LH={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},RH={autoCompleteProviders:c_,autofillModifiersRegistry:$E,autofillRulesRegistry:eD,cellMenuRegistry:yj,colMenuRegistry:dN,errorTypes:ta,linkMenuRegistry:nk,functionRegistry:RT,featurePluginRegistry:cB,iconsOnCellRegistry:pf,statefulUIPluginRegistry:lB,coreViewsPluginRegistry:uB,corePluginRegistry:sB,rowMenuRegistry:gN,sidePanelRegistry:fI,figureRegistry:pO,chartSidePanelComponentRegistry:rP,chartComponentRegistry:aO,chartRegistry:iO,chartSubtypeRegistry:sO,topbarMenuRegistry:SN,topbarComponentRegistry:wN,clickableCellRegistry:dB,otRegistry:CN,inverseCommandRegistry:yO,urlRegistry:Xa,cellPopoverRegistry:uD,numberFormatMenuRegistry:fN,repeatLocalCommandTransformRegistry:Uz,repeatCommandTransformRegistry:Hz,clipboardHandlersRegistries:ed,pivotRegistry:AF,pivotTimeAdapterRegistry:lu,pivotSidePanelRegistry:IF,pivotNormalizationValueRegistry:Bu,supportedPivotPositionalFormulaRegistry:JE,pivotToFunctionValueRegistry:Vu,migrationStepRegistry:Fh},zH={arg:Y,isEvaluationError:P,toBoolean:L,toJsDate:R,toNumber:F,toString:I,toNormalizedPivotValue:Iu,toXC:w,toZone:Qn,toUnboundedZone:Zn,toCartesian:Pn,numberToLetters:Tn,lettersToNumber:En,UuidGenerator:wc,formatValue:B,createCurrencyFormat:Qo,ColorGenerator:wn,computeTextWidth:sc,createEmptyWorkbookData:Xh,createEmptySheet:Yh,createEmptyExcelSheet:Zh,getDefaultChartJsRuntime:Xg,chartFontColor:Dd,getChartAxisTitleRuntime:Md,getChartAxisType:wD,getTrendDatasetForBarChart:Fd,getTrendDatasetForLineChart:jD,getFillingMode:t_,rgbaToHex:cn,colorToRGBA:ln,positionToZone:D,isDefined:S,isMatrix:A,lazy:Et,genericRepeat:Wz,createAction:m,createActions:f,transformRangeData:nd,deepEquals:C,overlap:ur,union:or,isInside:dr,deepCopy:y,expandZoneOnInsertion:nr,reduceZoneOnDeletion:ar,unquote:at,getMaxObjectId:Ou,getFunctionsFromTokens:LE,getFirstPivotFunction:GE,getNumberOfPivotFunctions:qE,parseDimension:ju,isDateOrDatetimeField:Mu,makeFieldProposal:BE,insertTokenAfterArgSeparator:HE,insertTokenAfterLeftParenthesis:UE,mergeContiguousZones:jr,getPivotHighlights:vN,pivotTimeAdapter:uu,UNDO_REDO_PIVOT_COMMANDS:kR,createPivotFormula:Fu,areDomainArgsFieldsValid:Pu,splitReference:Vs,formatTickValue:zd,sanitizeSheetName:st,isNumber:Oi,isDateTime:Xr},BH={isMarkdownLink:pt,parseMarkdownLink:gt,markdownLink:ht,openLink:to,urlRepresentation:eo},VH={Checkbox:TN,Section:Z,RoundColorPicker:HN,ChartDataSeries:kN,ChartErrorSection:jN,ChartLabelRange:MN,ChartTitle:WN,ChartPanel:oP,ChartFigure:lO,ChartJsComponent:o_,Grid:SL,GridOverlay:$I,ScorecardChart:s_,LineConfigPanel:ZN,BarConfigPanel:PN,PieChartDesignPanel:QN,GenericChartConfigPanel:NN,ChartWithAxisDesignPanel:qN,GaugeChartConfigPanel:YN,GaugeChartDesignPanel:XN,ScorecardChartConfigPanel:eP,ScorecardChartDesignPanel:tP,ChartTypePicker:iP,FigureComponent:pI,Menu:pk,Popover:lk,SelectionInput:ON,ValidationMessages:AN,AddDimensionButton:tF,PivotDimensionGranularity:aF,PivotDimensionOrder:oF,PivotDimension:iF,PivotLayoutConfigurator:lF,PivotHTMLRenderer:wL,EditableName:CL,PivotDeferUpdate:$P,PivotTitleSection:uF,CogWheelMenu:rF,TextInput:nF,SidePanelCollapsible:IN},HH={useDragAndDropListItems:fP,useHighlights:bP,useHighlightsOnHover:yP},UH={useStoreProvider:cd,DependencyContainer:id,CellPopoverStore:GO,ComposerFocusStore:_d,CellComposerStore:TI,FindAndReplaceStore:qP,HighlightStore:xN,HoveredCellStore:WO,ModelStore:pd,NotificationStore:sP,RendererStore:md,SelectionInputStore:DN,SpreadsheetStore:hd,useStore:V,useLocalStore:ld,SidePanelStore:vL,PivotSidePanelStore:PF,PivotMeasureDisplayPanelStore:ZP};function WH(e,t){return RT.add(e,t),{addFunction:(e,t)=>WH(e,t)}}let GH={DEFAULT_LOCALE:k,HIGHLIGHT_COLOR:_,PIVOT_TABLE_CONFIG:Ze,TREND_LINE_XAXIS_ID:`x1`,CHART_AXIS_CHOICES:Vd,ChartTerms:ag};e.AbstractCellClipboardHandler=Pc,e.AbstractChart=Ag,e.AbstractFigureClipboardHandler=Gu,e.CellErrorType=j,e.CommandResult=Yi,e.CorePlugin=EL,e.DispatchResult=qi,e.EvaluationError=M,e.Model=PH,e.PivotRuntimeDefinition=dF,e.Registry=h,e.Revision=oz,e.SPREADSHEET_DIMENSIONS=LH,e.Spreadsheet=BB,e.SpreadsheetPivotTable=mF,e.UIPlugin=$,e.__info__=IH,e.addFunction=WH,e.addRenderingLayer=ea,e.astToFormula=bC,e.compile=OE,e.compileTokens=kE,e.components=VH,e.constants=GH,e.convertAstNodes=gC,e.coreTypes=Wi,e.findCellInNewZone=Sr,e.functionCache=DE,e.helpers=zH,e.hooks=HH,e.invalidateCFEvaluationCommands=Vi,e.invalidateDependenciesCommands=Bi,e.invalidateEvaluationCommands=Ri,e.iterateAstNodes=_C,e.links=BH,e.load=Rh,e.parse=mC,e.parseTokens=hC,e.readonlyAllowedCommands=Ui,e.registries=RH,e.setDefaultSheetViewSize=Ye,e.setTranslationMethod=qn,e.stores=UH,e.tokenColors=_E,e.tokenize=Rc,IH.version=`18.0.78`,IH.date=`2026-08-10T12:30:26.634Z`,IH.hash=`3fdaa53`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);