dev-libre-is/docs/_source/_static/handsontable.full.min.js

995 lines
1.7 MiB
JavaScript
Raw Normal View History

2024-08-31 12:30:08 -06:00
/*!
* Copyright (c) HANDSONCODE sp. z o. o.
*
* HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in
* Gdynia, Poland, at Aleja Zwyciestwa 96-98, registered by the District Court in Gdansk under number
* 538651, EU tax ID number: PL5862294002, share capital: PLN 62,800.00.
*
* This software is protected by applicable copyright laws, including international treaties, and dual-
* licensed - depending on whether your use for commercial purposes, meaning intended for or
* resulting in commercial advantage or monetary compensation, or not.
*
* If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
* the suitability, performance, and usefulness of this software outside the production environment,
* you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file.
*
* Your use of this software for commercial purposes is subject to the terms included in an applicable
* license agreement.
*
* In any case, you must not make any such use of this software as to develop software which may be
* considered competitive with this software.
*
* UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO
* LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
* USE OR INABILITY TO USE THIS SOFTWARE.
*
* Version: 14.5.0
* Release date: 30/07/2024 (built at 30/07/2024 09:20:07)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Handsontable",[],t):"object"==typeof exports?exports.Handsontable=t():e.Handsontable=t()}("undefined"!=typeof self?self:this,(()=>(()=>{var e={44820:(e,t,r)=>{"use strict";r.d(t,{iz:()=>lt,Ay:()=>ph});var n,s,i={};r.r(i),r.d(i,{AbsPlugin:()=>eo,AddressPlugin:()=>Zi,ArrayPlugin:()=>Ji,BitShiftPlugin:()=>ro,BitwiseLogicOperationsPlugin:()=>oo,BooleanPlugin:()=>ao,CharPlugin:()=>lo,CodePlugin:()=>ho,ComplexPlugin:()=>Ql,ConditionalAggregationPlugin:()=>ma,CountBlankPlugin:()=>uo,CountUniquePlugin:()=>co,DateTimePlugin:()=>po,DegreesPlugin:()=>Eo,DeltaPlugin:()=>wo,ExpPlugin:()=>Co,FinancialPlugin:()=>vo,FormulaTextPlugin:()=>_o,HyperlinkPlugin:()=>bo,InformationPlugin:()=>Ao,IsEvenPlugin:()=>Oo,IsOddPlugin:()=>Io,LogarithmPlugin:()=>xo,LookupPlugin:()=>va,MathConstantsPlugin:()=>Lo,MathPlugin:()=>$l,MatrixPlugin:()=>Ho,MedianPlugin:()=>Fo,ModuloPlugin:()=>Uo,NumericAggregationPlugin:()=>Wo,PowerPlugin:()=>Go,RadiansPlugin:()=>zo,RadixConversionPlugin:()=>Ko,RandomPlugin:()=>ta,RomanPlugin:()=>Ra,RoundingPlugin:()=>sa,SimpleArithmerticPlugin:()=>Na,SqrtPlugin:()=>ia,StatisticalAggregationPlugin:()=>hh,StatisticalPlugin:()=>zl,SumprodPlugin:()=>ya,TextPlugin:()=>Ea,TrigonometryPlugin:()=>wa}),function(e){e.RELATIVE="RELATIVE",e.ABSOLUTE="ABSOLUTE"}(n||(n={}));class o{constructor(e,t,r){this.type=e,this.col=t,this.sheet=r}static absolute(e,t){return new o(n.ABSOLUTE,e,t)}static relative(e,t){return new o(n.RELATIVE,e,t)}static compareByAbsoluteAddress(e){return(t,r)=>t.toSimpleColumnAddress(e).col-r.toSimpleColumnAddress(e).col}isColumnAbsolute(){return this.type===n.ABSOLUTE}isColumnRelative(){return this.type===n.RELATIVE}isAbsolute(){return this.type===n.ABSOLUTE&&void 0!==this.sheet}moved(e,t,r){const n=void 0===this.sheet?void 0:e;return new o(this.type,this.col+t,n)}shiftedByColumns(e){return new o(this.type,this.col+e,this.sheet)}toSimpleColumnAddress(e){const t=Lr(this,e);let r=this.col;return this.isColumnRelative()&&(r=e.col+this.col),_r(t,r)}shiftRelativeDimensions(e,t){const r=this.isColumnRelative()?this.col+e:this.col;return new o(this.type,r,this.sheet)}shiftAbsoluteDimensions(e,t){const r=this.isColumnAbsolute()?this.col+e:this.col;return new o(this.type,r,this.sheet)}withSheet(e){return new o(this.type,this.col,e)}isInvalid(e){return this.toSimpleColumnAddress(e).col<0}hash(e){const t=e&&void 0!==this.sheet?`#${this.sheet}`:"";switch(this.type){case n.RELATIVE:return`${t}#COLR${this.col}`;case n.ABSOLUTE:return`${t}#COLA${this.col}`}}unparse(e){const t=this.toSimpleColumnAddress(e);if(br(t))return;const r=P(t.col);return`${this.type===n.ABSOLUTE?"$":""}${r}`}exceedsSheetSizeLimits(e){return this.col>=e}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class a{constructor(e,t,r){this.type=e,this.row=t,this.sheet=r}static absolute(e,t){return new a(n.ABSOLUTE,e,t)}static relative(e,t){return new a(n.RELATIVE,e,t)}static compareByAbsoluteAddress(e){return(t,r)=>t.toSimpleRowAddress(e).row-r.toSimpleRowAddress(e).row}isRowAbsolute(){return this.type===n.ABSOLUTE}isRowRelative(){return this.type===n.RELATIVE}isAbsolute(){return this.type===n.ABSOLUTE&&void 0!==this.sheet}moved(e,t,r){const n=void 0===this.sheet?void 0:e;return new a(this.type,this.row+r,n)}shiftedByRows(e){return new a(this.type,this.row+e,this.sheet)}toSimpleRowAddress(e){const t=Lr(this,e);let r=this.row;return this.isRowRelative()&&(r=e.row+this.row),Nr(t,r)}shiftRelativeDimensions(e,t){const r=this.isRowRelative()?this.row+t:this.row;return new a(this.type,r,this.sheet)}shiftAbsoluteDimensions(e,t){const r=this.isRowAbsolute()?this.row+t:this.row;return new a(this.type,r,this.sheet)}withSheet(e){return new a(this.type,this.row,e)}isInvalid(e){return this.toSimpleRowAddress(e).row<0}hash(e){const t=e&&void 0!==this.sheet?`#${this.sheet}`:"";switch(this.type){case n.RELATIVE:return`${t}#ROWR${this.row}`;case n.ABSOLUTE:return`${t}#ROWA${this.row}`}}unparse(e){const t=this.toSimpleRowAddress(e);if(Mr(t))return;return`${this.type===n.ABSOLUTE?"$":""}${t.row+1}`}exceedsSheetSizeLimits(e){return this.row>=e}}!function(e){e.CELL_REFERENCE_RELATIVE="CELL_REFERENCE",e.CELL_REFERENCE_ABSOLUTE="CELL_REFERENCE_ABSOLUTE",e.CELL_REFERENCE_ABSOLUTE_COL="CELL_REFERENCE_ABSOLUTE_COL",e.CELL_REFERENCE_ABSOLUTE_ROW="CELL_REFERENCE_ABSOLUTE_ROW"}(s||(s={}));class l{constructor(e,t,r,n){this.col=e,this.row=t,this.type=r,this.sheet=n}static fromColAndRow(e,t,r){return(e.isColumnAbsolute()&&t.isRowAbsolute()?l.absolute.bind(this):e.isColumnAbsolute()?l.absoluteCol.bind(this):t.isRowAbsolute()?l.absoluteRow.bind(this):l.relative.bind(this))(e.col,t.row,r)}static relative(e,t,r){return new l(e,t,s.CELL_REFERENCE_RELATIVE,r)}static absolute(e,t,r){return new l(e,t,s.CELL_REFERENCE_ABSOLUTE,r)}static absoluteCol(e,t,r){return new l(e,t,s.CELL_REFERENCE_ABSOLUTE_COL,r)}static absoluteRow(e,t,r){return new l(e,t,s.CELL_REFERENCE_ABSOLUTE_ROW,r)}toSimpleCellAddress(e){const t=Lr(this,e);return this.type===s.CELL_REFERENCE_ABSOLUTE?Ar(t,this.col,this.row):this.type===s.CELL_REFERENCE_ABSOLUTE_ROW?Ar(t,e.col+this.col,this.row):this.type===s.CELL_REFERENCE_ABSOLUTE_COL?Ar(t,this.col,e.row+this.row):Ar(t,e.col+this.col,e.row+this.row)}toColumnAddress(){const e=this.isColumnRelative()?n.RELATIVE:n.ABSOLUTE;return new o(e,this.col,this.sheet)}toRowAddress(){const e=this.isRowRelative()?n.RELATIVE:n.ABSOLUTE;return new a(e,this.row,this.sheet)}toSimpleColumnAddress(e){const t=Lr(this,e);let r=this.col;return this.isColumnRelative()&&(r+=e.col),_r(t,r)}toSimpleRowAddress(e){const t=Lr(this,e);let r=this.row;return this.isRowRelative()&&(r+=e.row),Nr(t,r)}isRowAbsolute(){return this.type===s.CELL_REFERENCE_ABSOLUTE||this.type===s.CELL_REFERENCE_ABSOLUTE_ROW}isColumnAbsolute(){return this.type===s.CELL_REFERENCE_ABSOLUTE||this.type===s.CELL_REFERENCE_ABSOLUTE_COL}isColumnRelative(){return this.type===s.CELL_REFERENCE_RELATIVE||this.type===s.CELL_REFERENCE_ABSOLUTE_ROW}isRowRelative(){return this.type===s.CELL_REFERENCE_RELATIVE||this.type===s.CELL_REFERENCE_ABSOLUTE_COL}isAbsolute(){return this.type===s.CELL_REFERENCE_ABSOLUTE&&void 0!==this.sheet}shiftedByRows(e){return new l(this.col,this.row+e,this.type,this.sheet)}shiftedByColumns(e){return new l(this.col+e,this.row,this.type,this.sheet)}moved(e,t,r){const n=void 0===this.sheet?void 0:e;return new l(this.col+t,this.row+r,this.type,n)}withSheet(e){return new l(this.col,this.row,this.type,e)}isInvalid(e){return Or(this.toSimpleCellAddress(e))}shiftRelativeDimensions(e,t){const r=this.isColumnAbsolute()?this.col:this.col+e,n=this.isRowAbsolute()?this.row:this.row+t;return new l(r,n,this.type,this.sheet)}shiftAbsoluteDimensions(e,t){const r=this.isColumnRelative()?this.col:this.col+e,n=this.isRowRelative()?this.row:this.row+t;return new l(r,n,this.type,this.sheet)}hash(e){const t=e&&void 0!
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const h=":",u="$",c="A-Za-zÀ-ʯ",d=`${c}0-9_.`,p=`[${c}0-9_]+`,g=`(${p}|'(((?!').|'')*)')!`,f=`(${g})?\\${u}?[A-Za-z]+\\${u}?[0-9]+`,m=`(${g})?\\${u}?[A-Za-z]+`,y=`(${g})?\\${u}?[0-9]+`,E="[rR][0-9]*[cC][0-9]*",w=`(${f})[^${d}]`,C=`[${c}_][${d}]*`,v=["0","1","2","3","4","5","6","7","8","9"],R=[...Array.from(Array(26)).map(((e,t)=>t+"A".charCodeAt(0))),...Array.from(Array(26)).map(((e,t)=>t+"a".charCodeAt(0))),...Array.from(Array(496)).map(((e,t)=>t+192))].map((e=>String.fromCharCode(e))),S=new RegExp(`^(${g})?(\\${u}?)([A-Za-z]+)(\\${u}?)([0-9]+)$`),T=new RegExp(`^(${g})?(\\${u}?)([A-Za-z]+)$`),N=new RegExp(`^(${g})?(\\${u}?)([0-9]+)$`),M=new RegExp(`^${p}$`),_=(e,t,r)=>{const n=S.exec(t),s=x(n[6]);let i=D(n,e);if(void 0===i)return;null===i&&(i=void 0);const o=Number(n[8])-1;return n[5]===u&&n[7]===u?l.absolute(s,o,i):n[5]===u?l.absoluteCol(s,o-r.row,i):n[7]===u?l.absoluteRow(s-r.col,o,i):l.relative(s-r.col,o-r.row,i)},b=(e,t,r)=>{const n=T.exec(t);let s=D(n,e);if(void 0===s)return;null===s&&(s=void 0);const i=x(n[6]);return n[5]===u?o.absolute(i,s):o.relative(i-r.col,s)},A=(e,t,r)=>{const n=N.exec(t);let s=D(n,e);if(void 0===s)return;null===s&&(s=void 0);const i=Number(n[6])-1;return n[5]===u?a.absolute(i,s):a.relative(i-r.row,s)},O=(e,t,r)=>{const n=S.exec(t);if(!n)return;const s=x(n[6]);let i=D(n,e);if(void 0===i)return;null===i&&(i=r);const o=Number(n[8])-1;return Ar(i,s,o)},I=(e,t,r)=>{const n=P(t.col),s=L(t.sheet,e);if(void 0!==s)return r!==t.sheet?`${s}!${n}${t.row+1}`:`${n}${t.row+1}`};function x(e){return 1===e.length?e.toUpperCase().charCodeAt(0)-65:e.split("").reduce(((e,t)=>26*e+(t.toUpperCase().charCodeAt(0)-64)),0)-1}function P(e){let t="";for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}function L(e,t){let r=t(e);if(void 0!==r)return M.test(r)?r:(r=r.replace(/'/g,"''"),`'${r}'`)}function D(e,t){var r;let n=null!==(r=e[3])&&void 0!==r?r:e[2];return n?(n=n.replace(/''/g,"'"),t(n)):null}var k=r(83012);
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const H=(e,t)=>({type:e,message:t});var F,U,V;!function(e){e.LexingError="LexingError",e.ParserError="ParsingError",e.StaticOffsetError="StaticOffsetError",e.StaticOffsetOutOfRangeError="StaticOffsetOutOfRangeError",e.RangeOffsetNotAllowed="RangeOffsetNotAllowed",e.InvalidRangeSize="InvalidRangeSize"}(F||(F={})),function(e){e.EMPTY="EMPTY",e.NUMBER="NUMBER",e.STRING="STRING",e.MINUS_UNARY_OP="MINUS_UNARY_OP",e.PLUS_UNARY_OP="PLUS_UNARY_OP",e.PERCENT_OP="PERCENT_OP",e.CONCATENATE_OP="CONCATENATE_OP",e.EQUALS_OP="EQUALS_OP",e.NOT_EQUAL_OP="NOT_EQUAL_OP",e.GREATER_THAN_OP="GREATER_THAN_OP",e.LESS_THAN_OP="LESS_THAN_OP",e.GREATER_THAN_OR_EQUAL_OP="GREATER_THAN_OR_EQUAL_OP",e.LESS_THAN_OR_EQUAL_OP="LESS_THAN_OR_EQUAL_OP",e.PLUS_OP="PLUS_OP",e.MINUS_OP="MINUS_OP",e.TIMES_OP="TIMES_OP",e.DIV_OP="DIV_OP",e.POWER_OP="POWER_OP",e.FUNCTION_CALL="FUNCTION_CALL",e.NAMED_EXPRESSION="NAMED_EXPRESSION",e.PARENTHESIS="PARENTHESES",e.CELL_REFERENCE="CELL_REFERENCE",e.CELL_RANGE="CELL_RANGE",e.COLUMN_RANGE="COLUMN_RANGE",e.ROW_RANGE="ROW_RANGE",e.ERROR="ERROR",e.ERROR_WITH_RAW_INPUT="ERROR_WITH_RAW_INPUT",e.ARRAY="ARRAY"}(U||(U={})),function(e){e[e.RELATIVE=0]="RELATIVE",e[e.START_ABSOLUTE=1]="START_ABSOLUTE",e[e.BOTH_ABSOLUTE=2]="BOTH_ABSOLUTE"}(V||(V={}));const B=(e,t)=>({type:U.CELL_REFERENCE,reference:e,leadingWhitespace:null==t?void 0:t.image}),W=(e,t,r,n)=>($(e,t,r),{type:U.CELL_RANGE,start:e,end:t,sheetReferenceType:r,leadingWhitespace:n}),Y=(e,t,r)=>({type:U.ARRAY,args:e,leadingWhitespace:null==t?void 0:t.image,internalWhitespace:null==r?void 0:r.image}),j=(e,t)=>({type:U.ERROR,error:e,leadingWhitespace:null==t?void 0:t.image}),G=(e,t,r)=>({type:U.ERROR_WITH_RAW_INPUT,error:t,rawInput:e,leadingWhitespace:null==r?void 0:r.image}),z=()=>({type:U.ERROR,error:Tr.parsingError()});function $(e,t,r){if(void 0!==e.sheet&&void 0===t.sheet||void 0===e.sheet&&void 0!==t.sheet)throw new Error("Start address inconsistent with end address");if(void 0===e.sheet&&r!==V.RELATIVE||void 0!==e.sheet&&r===V.RELATIVE)throw new Error("Sheet address inconsistent with sheet reference type")}function K(e,t){return(null!=t?t:"")+e}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const X={[U.PLUS_OP]:"+",[U.MINUS_OP]:"-",[U.TIMES_OP]:"*",[U.DIV_OP]:"/",[U.CONCATENATE_OP]:"&",[U.POWER_OP]:"^",[U.EQUALS_OP]:"=",[U.NOT_EQUAL_OP]:"<>",[U.GREATER_THAN_OP]:">",[U.GREATER_THAN_OR_EQUAL_OP]:">=",[U.LESS_THAN_OP]:"<",[U.LESS_THAN_OR_EQUAL_OP]:"<="};class q{constructor(e){this.functionRegistry=e,this.cache=new Map}set(e,t){const r=((e,t,r,n)=>({ast:e,relativeDependencies:t,hasVolatileFunction:r,hasStructuralChangeFunction:n}))(t,ke(t,this.functionRegistry),Q(t,this.functionRegistry.isFunctionVolatile),Q(t,this.functionRegistry.isFunctionDependentOnSheetStructureChange));return this.cache.set(e,r),r}get(e){return this.cache.get(e)}maybeSetAndThenGet(e,t){const r=this.cache.get(e);return void 0!==r?r.ast:(this.set(e,t),t)}}const Q=(e,t)=>{switch(e.type){case U.EMPTY:case U.NUMBER:case U.STRING:case U.ERROR:case U.ERROR_WITH_RAW_INPUT:case U.CELL_REFERENCE:case U.CELL_RANGE:case U.COLUMN_RANGE:case U.ROW_RANGE:case U.NAMED_EXPRESSION:return!1;case U.PERCENT_OP:case U.PLUS_UNARY_OP:case U.MINUS_UNARY_OP:return Q(e.value,t);case U.CONCATENATE_OP:case U.EQUALS_OP:case U.NOT_EQUAL_OP:case U.LESS_THAN_OP:case U.GREATER_THAN_OP:case U.LESS_THAN_OR_EQUAL_OP:case U.GREATER_THAN_OR_EQUAL_OP:case U.MINUS_OP:case U.PLUS_OP:case U.TIMES_OP:case U.DIV_OP:case U.POWER_OP:return Q(e.left,t)||Q(e.right,t);case U.PARENTHESIS:return Q(e.expression,t);case U.FUNCTION_CALL:return!!t(e.procedureName)||e.args.some((e=>Q(e,t)));case U.ARRAY:return e.args.some((e=>e.some((e=>Q(e,t)))))}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Z{}Z.DistinctSigns="Distinct signs.",Z.WrongArgNumber="Wrong number of arguments.",Z.EmptyArg="Empty function argument.",Z.EmptyArray="Empty array not allowed.",Z.ArrayDimensions="Array dimensions are not compatible.",Z.NoSpaceForArrayResult="No space for array result.",Z.ValueSmall="Value too small.",Z.ValueLarge="Value too large.",Z.BadCriterion="Incorrect criterion.",Z.RangeManySheets="Range spans more than one sheet.",Z.CellRangeExpected="Cell range expected.",Z.WrongDimension="Wrong range dimension.",Z.ScalarExpected="Cell range not allowed.",Z.NumberCoercion="Value cannot be coerced to number.",Z.NumberExpected="Number argument expected.",Z.IntegerExpected="Value needs to be an integer.",Z.BadMode="Mode not recognized.",Z.DateBounds="Date outside of bounds.",Z.OutOfSheet="Resulting reference is out of the sheet.",Z.WrongType="Wrong type of argument.",Z.NaN="NaN or infinite value encountered.",Z.EqualLength="Ranges need to be of equal length.",Z.Negative="Value cannot be negative.",Z.NotBinary="String does not represent a binary number.",Z.NotOctal="String does not represent an octal number.",Z.NotHex="String does not represent a hexadecimal number.",Z.EndStartPeriod="End period needs to be at least start period.",Z.CellRefExpected="Cell reference expected.",Z.EmptyRange="Empty range not allowed.",Z.BadRef="Address is not correct.",Z.NumberRange="Number-only range expected.",Z.ValueNotFound="Value not found.",Z.ValueBaseLarge="Value in base too large.",Z.ValueBaseSmall="Value in base too small.",Z.ValueBaseLong="Value in base too long.",Z.NegativeLength="Length cannot be negative.",Z.PatternNotFound="Pattern not found.",Z.OneValue="Needs at least one value.",Z.TwoValues="Range needs to contain at least two elements.",Z.ThreeValues="Range needs to contain at least three elements.",Z.IndexBounds="Index out of bounds.",Z.IndexLarge="Index too large.",Z.Formula="Expected formula.",Z.NegativeCount="Count cannot be negative.",Z.ParseError="Parsing error.",Z.SheetRef="Sheet does not exist.",Z.PeriodLong="Period number cannot exceed life length.",Z.InvalidDate="Invalid date.",Z.BitshiftLong="Result of bitshift is too long.",Z.EmptyString="Empty-string argument not allowed.",Z.LengthBounds="Length out of bounds.",Z.NegativeTime="Time cannot be negative.",Z.NoDefault="No default option.",Z.NoConditionMet="None of the conditions were met.",Z.Selector="Selector cannot exceed the number of arguments.",Z.StartEndDate="Start date needs to be earlier than end date.",Z.IncorrectDateTime="String does not represent correct DateTime.",Z.CharacterCodeBounds="Character code out of bounds.",Z.NonZero="Argument cannot be 0.",Z.LessThanOne="Argument cannot be less than 1.",Z.WeekendString="Incorrect weekend bitmask string.",Z.InvalidRoman="Invalid roman numeral.",Z.WrongOrder="Wrong order of values.",Z.ComplexNumberExpected="Complex number expected.",Z.ShouldBeIorJ="Should be 'i' or 'j'.",Z.SizeMismatch="Array dimensions mismatched.",Z.FunctionName=e=>`Function name ${e} not recognized.`,Z.NamedExpressionName=e=>`Named expression ${e} not recognized.`,Z.LicenseKey=e=>`License key is ${e}.`;
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const J=(0,k.createToken)({name:"AdditionOp",pattern:k.Lexer.NA}),ee=(0,k.createToken)({name:"PlusOp",pattern:/\+/,categories:J}),te=(0,k.createToken)({name:"MinusOp",pattern:/-/,categories:J}),re=(0,k.createToken)({name:"MultiplicationOp",pattern:k.Lexer.NA}),ne=(0,k.createToken)({name:"TimesOp",pattern:/\*/,categories:re}),se=(0,k.createToken)({name:"DivOp",pattern:/\//,categories:re}),ie=(0,k.createToken)({name:"PowerOp",pattern:/\^/}),oe=(0,k.createToken)({name:"PercentOp",pattern:/%/}),ae=(0,k.createToken)({name:"BooleanOp",pattern:k.Lexer.NA}),le=(0,k.createToken)({name:"EqualsOp",pattern:/=/,categories:ae}),he=(0,k.createToken)({name:"NotEqualOp",pattern:/<>/,categories:ae}),ue=(0,k.createToken)({name:"GreaterThanOp",pattern:/>/,categories:ae}),ce=(0,k.createToken)({name:"LessThanOp",pattern:/</,categories:ae}),de=(0,k.createToken)({name:"GreaterThanOrEqualOp",pattern:/>=/,categories:ae}),pe=(0,k.createToken)({name:"LessThanOrEqualOp",pattern:/<=/,categories:ae}),ge=(0,k.createToken)({name:"ConcatenateOp",pattern:/&/}),fe=(0,k.createToken)({name:"LParen",pattern:/\(/}),me=(0,k.createToken)({name:"RParen",pattern:/\)/}),ye=(0,k.createToken)({name:"ArrayLParen",pattern:/{/}),Ee=(0,k.createToken)({name:"ArrayRParen",pattern:/}/}),we=(0,k.createToken)({name:"StringLiteral",pattern:/"([^"\\]*(\\.[^"\\]*)*)"/}),Ce=(0,k.createToken)({name:"ErrorLiteral",pattern:/#[A-Za-z0-9\/]+[?!]?/}),ve=(0,k.createToken)({name:"RangeSeparator",pattern:new RegExp(h)}),Re=(0,k.createToken)({name:"ColumnRange",pattern:new RegExp(`${m}${h}${m}`)}),Se=(0,k.createToken)({name:"RowRange",pattern:new RegExp(`${y}${h}${y}`)}),Te=(0,k.createToken)({name:"ProcedureName",pattern:new RegExp(`([${c}][${d}]*)\\(`)}),Ne=new
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class{constructor(){this.POSSIBLE_START_CHARACTERS=[...R,...v,u,"'","_"],this.cellReferenceRegexp=new RegExp(w,"y")}match(e,t){this.cellReferenceRegexp.lastIndex=t;const r=this.cellReferenceRegexp.exec(e+"@");return null==r||null==r[1]?null:(r[0]=r[1],r)}},Me=(0,k.createToken)({name:"CellReference",pattern:Ne.match.bind(Ne),start_chars_hint:Ne.POSSIBLE_START_CHARACTERS,line_breaks:!1}),_e=new
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class{constructor(){this.POSSIBLE_START_CHARACTERS=[...R,"_"],this.namedExpressionRegexp=new RegExp(C,"y"),this.r1c1CellRefRegexp=new RegExp(`^${E}$`)}match(e,t){this.namedExpressionRegexp.lastIndex=t;const r=this.namedExpressionRegexp.exec(e);return null==r||null==r[0]||this.r1c1CellRefRegexp.test(r[0])?null:r}},be=(0,k.createToken)({name:"NamedExpression",pattern:_e.match.bind(_e),start_chars_hint:_e.POSSIBLE_START_CHARACTERS,line_breaks:!1}),Ae=e=>{const t=e.translationPackage.getFunctionTranslation("OFFSET"),r=e.errorMapping,n=e.translationPackage.buildFunctionMapping(),s=new RegExp("standard"===e.ignoreWhiteSpace?"[ \\t\\n\\r]+":"\\s+"),i=(0,k.createToken)({name:"WhiteSpace",pattern:s}),o=(0,k.createToken)({name:"ArrayRowSep",pattern:e.arrayRowSeparator}),a=(0,k.createToken)({name:"ArrayColSep",pattern:e.arrayColumnSeparator}),l=(0,k.createToken)({name:"NumberLiteral",pattern:new RegExp(`(([${e.decimalSeparator}]\\d+)|(\\d+([${e.decimalSeparator}]\\d*)?))(e[+-]?\\d+)?`)}),h=(0,k.createToken)({name:"OffsetProcedureName",pattern:new RegExp(t,"i")});let u,c;e.functionArgSeparator===e.arrayColumnSeparator?(u=a,c=[]):e.functionArgSeparator===e.arrayRowSeparator?(u=o,c=[]):(u=(0,k.createToken)({name:"ArgSeparator",pattern:e.functionArgSeparator}),c=[u]);return{ArgSeparator:u,NumberLiteral:l,OffsetProcedureName:h,ArrayRowSeparator:o,ArrayColSeparator:a,WhiteSpace:i,allTokens:[i,ee,te,ne,se,ie,le,he,oe,de,pe,ue,ce,fe,me,ye,Ee,h,Te,ve,...c,Re,Se,l,we,Ce,ge,ae,J,re,Me,be,o,a],errorMapping:r,functionMapping:n,decimalSeparator:e.decimalSeparator,maxColumns:e.maxColumns,maxRows:e.maxRows}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Oe extends k.EmbeddedActionsParser{constructor(e,t){super(e.allTokens,{outputCst:!1,maxLookahead:7}),this.booleanExpressionOrEmpty=this.RULE("booleanExpressionOrEmpty",(()=>{return this.OR([{ALT:()=>this.SUBRULE(this.booleanExpression)},{ALT:(0,k.EMPTY_ALT)({type:U.EMPTY,leadingWhitespace:null==e?void 0:e.image})}]);var e})),this.procedureExpression=this.RULE("procedureExpression",(()=>{var e;const t=this.CONSUME(Te),r=t.image.toUpperCase().slice(0,-1),n=null!==(e=this.lexerConfig.functionMapping[r])&&void 0!==e?e:r,s=[];let i=this.SUBRULE(this.booleanExpressionOrEmpty);this.MANY((()=>{var e;const t=this.CONSUME(this.lexerConfig.ArgSeparator);i.type===U.EMPTY&&(i.leadingWhitespace=null===(e=t.leadingWhitespace)||void 0===e?void 0:e.image),s.push(i),i=this.SUBRULE2(this.booleanExpressionOrEmpty)})),s.push(i),1===s.length&&s[0].type===U.EMPTY&&(s.length=0);const o=this.CONSUME(me);return((e,t,r,n,s)=>({type:U.FUNCTION_CALL,procedureName:e,args:t,leadingWhitespace:null==r?void 0:r.image,internalWhitespace:null==n?void 0:n.image,hyperlink:s}))(n,s,t.leadingWhitespace,o.leadingWhitespace)})),this.namedExpressionExpression=this.RULE("namedExpressionExpression",(()=>{const e=this.CONSUME(be);return t=e.image,r=e.leadingWhitespace,{type:U.NAMED_EXPRESSION,expressionName:t,leadingWhitespace:null==r?void 0:r.image};var t,r})),this.offsetProcedureExpression=this.RULE("offsetProcedureExpression",(()=>{const e=[];return this.CONSUME(this.lexerConfig.OffsetProcedureName),this.CONSUME(fe),this.MANY_SEP({SEP:this.lexerConfig.ArgSeparator,DEF:()=>{e.push(this.SUBRULE(this.booleanExpression))}}),this.CONSUME(me),this.handleOffsetHeuristic(e)})),this.columnRangeExpression=this.RULE("columnRangeExpression",(()=>{const e=this.CONSUME(Re),[t,r]=e.image.split(":"),n=this.ACTION((()=>b(this.sheetMapping,t,this.formulaAddress))),s=this.ACTION((()=>b(this.sheetMapping,r,this.formulaAddress)));if(void 0===n||void 0===s)return j(new Tr(ir.REF));if(n.exceedsSheetSizeLimits(this.lexerConfig.maxColumns)||s.exceedsSheetSizeLimits(this.lexerConfig.maxColumns))return G(e.image,new Tr(ir.NAME),e.leadingWhitespace);if(void 0===n.sheet&&void 0!==s.sheet)return this.parsingError(F.ParserError,"Malformed range expression");const{firstEnd:i,secondEnd:o,sheetRefType:a}=Oe.fixSheetIdsForRangeEnds(n,s);return l=i,h=o,u=a,c=e.leadingWhitespace,$(l,h,u),{type:U.COLUMN_RANGE,start:l,end:h,sheetReferenceType:u,leadingWhitespace:null==c?void 0:c.image};var l,h,u,c})),this.rowRangeExpression=this.RULE("rowRangeExpression",(()=>{const e=this.CONSUME(Se),[t,r]=e.image.split(":"),n=this.ACTION((()=>A(this.sheetMapping,t,this.formulaAddress))),s=this.ACTION((()=>A(this.sheetMapping,r,this.formulaAddress)));if(void 0===n||void 0===s)return j(new Tr(ir.REF));if(n.exceedsSheetSizeLimits(this.lexerConfig.maxRows)||s.exceedsSheetSizeLimits(this.lexerConfig.maxRows))return G(e.image,new Tr(ir.NAME),e.leadingWhitespace);if(void 0===n.sheet&&void 0!==s.sheet)return this.parsingError(F.ParserError,"Malformed range expression");const{firstEnd:i,secondEnd:o,sheetRefType:a}=Oe.fixSheetIdsForRangeEnds(n,s);return l=i,h=o,u=a,c=e.leadingWhitespace,$(l,h,u),{type:U.ROW_RANGE,start:l,end:h,sheetReferenceType:u,leadingWhitespace:null==c?void 0:c.image};var l,h,u,c})),this.cellReference=this.RULE("cellReference",(()=>{const e=this.CONSUME(Me),t=this.ACTION((()=>_(this.sheetMapping,e.image,this.formulaAddress)));return void 0===t?G(e.image,new Tr(ir.REF),e.leadingWhitespace):t.exceedsSheetSizeLimits(this.lexerConfig.maxColumns,this.lexerConfig.maxRows)?G(e.image,new Tr(ir.NAME),e.leadingWhitespace):B(t,e.leadingWhitespace)})),this.endRangeReference=this.RULE("endRangeReference",(e=>{var t;const r=this.CONSUME(Me),n=this.ACTION((()=>_(this.sheetMapping,e.image,this.formulaAddress))),s=this.ACTION((()=>_(this.sheetMapping,r.image,this.formulaAddress)));return void 0===n||void 0===s?this.ACTION((()=>G(`${e.image}:${r.image}`,new Tr(ir.REF),e.leadingWhitespace))):n.exceedsSheetSizeLimits(this.lexerConfig.maxColumns,this.lexerConfig.maxRows)||s.exceedsSheetSizeLimits(this.lexerConfig.maxCo
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class xe{constructor(e,t,r,n){this.config=e,this.lexerConfig=t,this.sheetMappingFn=r,this.namedExpressions=n}unparse(e,t){return"="+this.unparseAst(e,t)}unparseAst(e,t){var r,n;switch(e.type){case U.EMPTY:return K("",e.leadingWhitespace);case U.NUMBER:return K(Pe(e.value,this.config.decimalSeparator),e.leadingWhitespace);case U.STRING:return K('"'+e.value+'"',e.leadingWhitespace);case U.FUNCTION_CALL:{const r=e.args.map((e=>void 0!==e?this.unparseAst(e,t):"")).join(this.config.functionArgSeparator),n=(this.config.translationPackage.isFunctionTranslated(e.procedureName)?this.config.translationPackage.getFunctionTranslation(e.procedureName):e.procedureName)+"("+r+K(")",e.internalWhitespace);return K(n,e.leadingWhitespace)}case U.NAMED_EXPRESSION:return K((null===(r=this.namedExpressions.nearestNamedExpression(e.expressionName,t.sheet))||void 0===r?void 0:r.displayName)||e.expressionName,e.leadingWhitespace);case U.CELL_REFERENCE:{let r;return r=void 0!==e.reference.sheet?this.unparseSheetName(e.reference.sheet)+"!":"",r+=null!==(n=e.reference.unparse(t))&&void 0!==n?n:this.config.translationPackage.getErrorTranslation(ir.REF),K(r,e.leadingWhitespace)}case U.COLUMN_RANGE:case U.ROW_RANGE:case U.CELL_RANGE:return K(this.formatRange(e,t),e.leadingWhitespace);case U.PLUS_UNARY_OP:{const r=this.unparseAst(e.value,t);return K("+",e.leadingWhitespace)+r}case U.MINUS_UNARY_OP:{const r=this.unparseAst(e.value,t);return K("-",e.leadingWhitespace)+r}case U.PERCENT_OP:return this.unparseAst(e.value,t)+K("%",e.leadingWhitespace);case U.ERROR:return K(this.config.translationPackage.getErrorTranslation(e.error?e.error.type:ir.ERROR),e.leadingWhitespace);case U.ERROR_WITH_RAW_INPUT:return K(e.rawInput,e.leadingWhitespace);case U.PARENTHESIS:{const r="("+this.unparseAst(e.expression,t)+K(")",e.internalWhitespace);return K(r,e.leadingWhitespace)}case U.ARRAY:{const r="{"+e.args.map((e=>e.map((e=>this.unparseAst(e,t))).join(this.config.arrayColumnSeparator))).join(this.config.arrayRowSeparator)+K("}",e.internalWhitespace);return K(r,e.leadingWhitespace)}default:{const r=this.unparseAst(e.left,t),n=this.unparseAst(e.right,t);return r+K(X[e.type],e.leadingWhitespace)+n}}}unparseSheetName(e){const t=L(e,this.sheetMappingFn);if(void 0===t)throw new lt(e);return t}formatRange(e,t){let r="",n="";void 0!==e.start.sheet&&e.sheetReferenceType!==V.RELATIVE&&(r=this.unparseSheetName(e.start.sheet)+"!"),void 0!==e.end.sheet&&e.sheetReferenceType===V.BOTH_ABSOLUTE&&(n=this.unparseSheetName(e.end.sheet)+"!");const s=e.start.unparse(t),i=e.end.unparse(t);return void 0===s||void 0===i?this.config.translationPackage.getErrorTranslation(ir.REF):`${r}${s}:${n}${i}`}}function Pe(e,t){return e.toString().replace(".",t)}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Le{constructor(e,t,r){this.config=e,this.functionRegistry=t,this.sheetMapping=r,this.statsCacheUsed=0,this.lexerConfig=Ae(e),this.lexer=new Ie(this.lexerConfig),this.formulaParser=new Oe(this.lexerConfig,this.sheetMapping),this.cache=new q(this.functionRegistry)}parse(e,t){this.formulaAddress=t;const r=this.tokenizeFormula(e);if(r.errors.length>0){const e=r.errors.map((e=>({type:F.LexingError,message:e.message})));return{ast:z(),errors:e,hasVolatileFunction:!1,hasStructuralChangeFunction:!1,dependencies:[]}}const n=this.computeHashFromTokens(r.tokens,t);let s=this.cache.get(n);if(void 0!==s)++this.statsCacheUsed;else{const e=this.bindWhitespacesToTokens(r.tokens),i=this.formulaParser.parseFromTokens(e,t);if(i.errors.length>0)return Object.assign(Object.assign({},i),{hasVolatileFunction:!1,hasStructuralChangeFunction:!1,dependencies:[]});s=this.cache.set(n,i.ast)}const{ast:i,hasVolatileFunction:o,hasStructuralChangeFunction:a}=s,l=this.convertReversedRangesToRegularRanges(i);return{ast:l,errors:[],hasVolatileFunction:o,hasStructuralChangeFunction:a,dependencies:ke(l,this.functionRegistry)}}convertReversedRangesToRegularRanges(e){switch(e.type){case U.EMPTY:case U.NUMBER:case U.STRING:case U.ERROR:case U.ERROR_WITH_RAW_INPUT:case U.CELL_REFERENCE:case U.NAMED_EXPRESSION:return e;case U.CELL_RANGE:{const{start:t,end:r}=e,n=this.orderCellRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case U.COLUMN_RANGE:{const{start:t,end:r}=e,n=this.orderColumnRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case U.ROW_RANGE:{const{start:t,end:r}=e,n=this.orderRowRangeEnds(t,r);return Object.assign(Object.assign({},e),{start:n.start,end:n.end})}case U.PERCENT_OP:case U.PLUS_UNARY_OP:case U.MINUS_UNARY_OP:{const t=this.convertReversedRangesToRegularRanges(e.value);return Object.assign(Object.assign({},e),{value:t})}case U.CONCATENATE_OP:case U.EQUALS_OP:case U.NOT_EQUAL_OP:case U.LESS_THAN_OP:case U.GREATER_THAN_OP:case U.LESS_THAN_OR_EQUAL_OP:case U.GREATER_THAN_OR_EQUAL_OP:case U.MINUS_OP:case U.PLUS_OP:case U.TIMES_OP:case U.DIV_OP:case U.POWER_OP:{const t=this.convertReversedRangesToRegularRanges(e.left),r=this.convertReversedRangesToRegularRanges(e.right);return Object.assign(Object.assign({},e),{left:t,right:r})}case U.PARENTHESIS:{const t=this.convertReversedRangesToRegularRanges(e.expression);return Object.assign(Object.assign({},e),{expression:t})}case U.FUNCTION_CALL:{const t=e.args.map((e=>this.convertReversedRangesToRegularRanges(e)));return Object.assign(Object.assign({},e),{args:t})}case U.ARRAY:{const t=e.args.map((e=>e.map((e=>this.convertReversedRangesToRegularRanges(e)))));return Object.assign(Object.assign({},e),{args:t})}}}orderCellRangeEnds(e,t){const r=[e,t],[n,s]=r.map((e=>e.toColumnAddress())).sort(o.compareByAbsoluteAddress(this.formulaAddress)),[i,h]=r.map((e=>e.toRowAddress())).sort(a.compareByAbsoluteAddress(this.formulaAddress)),[u,c]=r.map((e=>e.sheet)).sort(Le.compareSheetIds.bind(this));return{start:l.fromColAndRow(n,i,u),end:l.fromColAndRow(s,h,c)}}orderColumnRangeEnds(e,t){const r=[e,t],[n,s]=r.sort(o.compareByAbsoluteAddress(this.formulaAddress)),[i,a]=r.map((e=>e.sheet)).sort(Le.compareSheetIds.bind(this));return{start:new o(n.type,n.col,i),end:new o(s.type,s.col,a)}}orderRowRangeEnds(e,t){const r=[e,t],[n,s]=r.sort(a.compareByAbsoluteAddress(this.formulaAddress)),[i,o]=r.map((e=>e.sheet)).sort(Le.compareSheetIds.bind(this));return{start:new a(n.type,n.row,i),end:new a(s.type,s.row,o)}}static compareSheetIds(e,t){return(e=null!=e?e:1/0)-(t=null!=t?t:1/0)}fetchCachedResultForAst(e){const t=this.computeHashFromAst(e);return this.fetchCachedResult(t)}fetchCachedResult(e){const t=this.cache.get(e);if(void 0===t)throw new Error("There is no AST with such key in the cache");{const{ast:e,hasVolatileFunction:r,hasStructuralChangeFunction:n,relativeDependencies:s}=t;return{ast:e,errors:[],hasVolatileFunction:r,hasStructuralChangeFunction:n,dependencies:s}}}computeHashFromTokens(e,t){var r;let n="",s=0;for(;s<e.length;){const i=e[s];if((0,k
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const De=(e,t,r,n)=>{switch(e.type){case U.EMPTY:case U.NUMBER:case U.STRING:case U.ERROR:return;case U.NAMED_EXPRESSION:return void(n&&r.push(new Be(e.expressionName)));case U.CELL_REFERENCE:return void(n&&r.push(new He(e.reference)));case U.CELL_RANGE:return void(n&&e.start.sheet===e.end.sheet&&r.push(new Fe(e.start,e.end)));case U.COLUMN_RANGE:return void(n&&e.start.sheet===e.end.sheet&&r.push(new Ue(e.start,e.end)));case U.ROW_RANGE:return void(n&&e.start.sheet===e.end.sheet&&r.push(new Ve(e.start,e.end)));case U.PERCENT_OP:case U.PLUS_UNARY_OP:case U.MINUS_UNARY_OP:return void De(e.value,t,r,!0);case U.CONCATENATE_OP:case U.EQUALS_OP:case U.NOT_EQUAL_OP:case U.LESS_THAN_OP:case U.GREATER_THAN_OP:case U.LESS_THAN_OR_EQUAL_OP:case U.GREATER_THAN_OR_EQUAL_OP:case U.MINUS_OP:case U.PLUS_OP:case U.TIMES_OP:case U.DIV_OP:case U.POWER_OP:return De(e.left,t,r,!0),void De(e.right,t,r,!0);case U.PARENTHESIS:return void De(e.expression,t,r,n);case U.FUNCTION_CALL:{const n=!t.doesFunctionNeedArgumentToBeComputed(e.procedureName);return void e.args.forEach((e=>De(e,t,r,n)))}}},ke=(e,t)=>{const r=new Array;return De(e,t,r,!0),r};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class He{constructor(e){this.dependency=e}absolutize(e){return this.dependency.toSimpleCellAddress(e)}}class Fe{constructor(e,t){this.start=e,this.end=t}absolutize(e){return new Fr(this.start.toSimpleCellAddress(e),this.end.toSimpleCellAddress(e))}}class Ue{constructor(e,t){this.start=e,this.end=t}absolutize(e){const t=this.start.toSimpleColumnAddress(e),r=this.end.toSimpleColumnAddress(e);return new Ur(t.sheet,t.col,r.col)}}class Ve{constructor(e,t){this.start=e,this.end=t}absolutize(e){const t=this.start.toSimpleRowAddress(e),r=this.end.toSimpleRowAddress(e);return new Vr(t.sheet,t.row,r.row)}}class Be{constructor(e){this.name=e}absolutize(e){return this}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const We=(e,t)=>e.map((e=>e.absolutize(t))),Ye=Symbol("Empty value");function je(e){return e instanceof Ge?e.val:e}class Ge{constructor(e,t){this.val=e,this.format=t}fromNumber(e){return new this.constructor(e)}}function ze(e,t){if("number"==typeof e)return t;{const r=e.fromNumber(t);return r.format=e.format,r}}class $e extends Ge{getDetailedType(){return Je.NUMBER_DATE}}class Ke extends Ge{getDetailedType(){return Je.NUMBER_CURRENCY}}class Xe extends Ge{getDetailedType(){return Je.NUMBER_TIME}}class qe extends Ge{getDetailedType(){return Je.NUMBER_DATETIME}}class Qe extends Ge{getDetailedType(){return Je.NUMBER_PERCENT}}function Ze(e){return"number"==typeof e||e instanceof Ge}var Je,et;function tt(e){return e instanceof Ge?{type:e.getDetailedType(),format:e.format}:{type:Je.NUMBER_RAW}}!function(e){e.NUMBER_RAW="NUMBER_RAW",e.NUMBER_DATE="NUMBER_DATE",e.NUMBER_TIME="NUMBER_TIME",e.NUMBER_DATETIME="NUMBER_DATETIME",e.NUMBER_CURRENCY="NUMBER_CURRENCY",e.NUMBER_PERCENT="NUMBER_PERCENT"}(Je||(Je={}));
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class rt{constructor(e,t,r,n){this._data=e,this.range=t,this.dependencyGraph=r,this._hasOnlyNumbers=n,this.size=void 0===e?new cn(t.effectiveWidth(r),t.effectiveHeight(r)):new cn(e[0].length,e.length)}get data(){return this.ensureThatComputed(),this._data}static fromRange(e,t,r){return new rt(e,t,r,!0)}static onlyNumbers(e){return new rt(e,void 0,void 0,!0)}static onlyValues(e){return new rt(e,void 0,void 0,void 0)}static onlyRange(e,t){return new rt(void 0,e,t,void 0)}static fromScalar(e){return new rt([[e]],void 0,void 0,void 0)}isAdHoc(){return void 0===this.range}width(){return this.size.width}height(){return this.size.height}valuesFromTopLeftCorner(){this.ensureThatComputed();const e=[];for(let t=0;t<this._data.length;t++)for(let r=0;r<this._data[0].length;r++)e.push(this._data[t][r]);return e}*effectiveAddressesFromData(e){for(let t=0;t<this.data.length;++t){const r=this.data[t];for(let n=0;n<r.length;++n)yield Ar(e.sheet,e.col+n,e.row+t)}}*entriesFromTopLeftCorner(e){this.ensureThatComputed();for(let t=0;t<this.size.height;++t)for(let r=0;r<this.size.width;++r)yield[this._data[t][r],Ar(e.sheet,e.col+r,e.row+t)]}*iterateValuesFromTopLeftCorner(){yield*this.valuesFromTopLeftCorner()}numberOfElements(){return this.size.width*this.size.height}hasOnlyNumbers(){if(void 0===this._hasOnlyNumbers){this._hasOnlyNumbers=!0;for(const e of this.data)for(const t of e)if("number"!=typeof t)return this._hasOnlyNumbers=!1,!1}return this._hasOnlyNumbers}rawNumbers(){return this._data}rawData(){var e;return this.ensureThatComputed(),null!==(e=this._data)&&void 0!==e?e:[]}sameDimensionsAs(e){return this.width()===e.width()&&this.height()===e.height()}ensureThatComputed(){void 0===this._data&&(this._hasOnlyNumbers=!0,this._data=this.range.addressesArrayMap(this.dependencyGraph,(e=>{const t=this.dependencyGraph.getCellValue(e);return t instanceof rt?(this._hasOnlyNumbers=!1,new Tr(ir.VALUE,Z.ScalarExpected)):(Ze(t)||(this._hasOnlyNumbers=!1),t)})))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class nt{constructor(){this.changes=new Map}static empty(){return new nt}addAll(e){for(const t of e.changes.values())this.add(t.address,t);return this}addChange(e,t,r){this.addInterpreterValue(e,t,r)}exportChanges(e){let t=[];return this.changes.forEach((r=>{const n=e.exportChange(r);Array.isArray(n)?t=t.concat(n):t.push(n)})),t}getChanges(){return Array.from(this.changes.values())}isEmpty(){return 0===this.changes.size}add(e,t){const r=t.value;if(r instanceof rt)for(const t of r.effectiveAddressesFromData(e))this.changes.delete(xr(t));this.changes.set(xr(e),t)}addInterpreterValue(e,t,r){this.add(t,{address:t,value:e,oldValue:r})}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class st{constructor(e,t,r){if(this.sheet=e,this.rowStart=t,this.rowEnd=r,t<0)throw Error("Starting row cant be less than 0");if(r<t)throw Error("Row span cant end before start")}get numberOfRows(){return this.rowEnd-this.rowStart+1}get start(){return this.rowStart}get end(){return this.rowEnd}static fromNumberOfRows(e,t,r){return new st(e,t,t+r-1)}static fromRowStartAndEnd(e,t,r){return new st(e,t,r)}*rows(){for(let e=this.rowStart;e<=this.rowEnd;++e)yield e}intersect(e){if(this.sheet!==e.sheet)throw Error("Can't intersect spans from different sheets");const t=Math.max(this.rowStart,e.rowStart),r=Math.min(this.rowEnd,e.rowEnd);return t>r?null:new st(this.sheet,t,r)}firstRow(){return new st(this.sheet,this.rowStart,this.rowStart)}}class it{constructor(e,t,r){if(this.sheet=e,this.columnStart=t,this.columnEnd=r,t<0)throw Error("Starting column cant be less than 0");if(r<t)throw Error("Column span cant end before start")}get numberOfColumns(){return this.columnEnd-this.columnStart+1}get start(){return this.columnStart}get end(){return this.columnEnd}static fromNumberOfColumns(e,t,r){return new it(e,t,t+r-1)}static fromColumnStartAndEnd(e,t,r){return new it(e,t,r)}*columns(){for(let e=this.columnStart;e<=this.columnEnd;++e)yield e}intersect(e){if(this.sheet!==e.sheet)throw Error("Can't intersect spans from different sheets");const t=Math.max(this.columnStart,e.columnStart),r=Math.min(this.columnEnd,e.columnEnd);return t>r?null:new it(this.sheet,t,r)}firstColumn(){return new it(this.sheet,this.columnStart,this.columnStart)}}!function(e){e.BUILD_ENGINE_TOTAL="BUILD_ENGINE_TOTAL",e.PARSER="PARSER",e.GRAPH_BUILD="GRAPH_BUILD",e.COLLECT_DEPENDENCIES="COLLECT_DEPENDENCIES",e.PROCESS_DEPENDENCIES="PROCESS_DEPENDENCIES",e.TOP_SORT="TOP_SORT",e.BUILD_COLUMN_INDEX="BUILD_COLUMN_INDEX",e.EVALUATION="EVALUATION",e.VLOOKUP="VLOOKUP",e.TRANSFORM_ASTS="TRANSFORM_ASTS",e.TRANSFORM_ASTS_POSTPONED="TRANSFORM_ASTS_POSTPONED",e.ADJUSTING_ADDRESS_MAPPING="ADJUSTING_ADDRESS_MAPPING",e.ADJUSTING_ARRAY_MAPPING="ADJUSTING_ARRAY_MAPPING",e.ADJUSTING_RANGES="ADJUSTING_RANGES",e.ADJUSTING_GRAPH="ADJUSTING_GRAPH",e.CRITERION_FUNCTION_FULL_CACHE_USED="CRITERION_FUNCTION_FULL_CACHE_USED",e.CRITERION_FUNCTION_PARTIAL_CACHE_USED="CRITERION_FUNCTION_PARTIAL_CACHE_USED"}(et||(et={}));
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ot{constructor(){this.stats=new Map([[et.CRITERION_FUNCTION_FULL_CACHE_USED,0],[et.CRITERION_FUNCTION_PARTIAL_CACHE_USED,0]]),this.startTimes=new Map}incrementCriterionFunctionFullCacheUsed(){var e;const t=(null!==(e=this.stats.get(et.CRITERION_FUNCTION_FULL_CACHE_USED))&&void 0!==e?e:0)+1;this.stats.set(et.CRITERION_FUNCTION_FULL_CACHE_USED,t)}incrementCriterionFunctionPartialCacheUsed(){var e;const t=(null!==(e=this.stats.get(et.CRITERION_FUNCTION_PARTIAL_CACHE_USED))&&void 0!==e?e:0)+1;this.stats.set(et.CRITERION_FUNCTION_PARTIAL_CACHE_USED,t)}reset(){this.stats.clear(),this.startTimes.clear(),this.stats.set(et.CRITERION_FUNCTION_FULL_CACHE_USED,0),this.stats.set(et.CRITERION_FUNCTION_PARTIAL_CACHE_USED,0)}start(e){if(this.startTimes.get(e))throw Error(`Statistics ${e} already started`);this.startTimes.set(e,Date.now())}end(e){var t;const r=Date.now(),n=this.startTimes.get(e);if(!n)throw Error(`Statistics ${e} not started`);{let s=null!==(t=this.stats.get(e))&&void 0!==t?t:0;s+=r-n,this.stats.set(e,s),this.startTimes.delete(e)}}measure(e,t){this.start(e);const r=t();return this.end(e),r}snapshot(){return new Map(this.stats)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class at extends ot{incrementCriterionFunctionFullCacheUsed(){}incrementCriterionFunctionPartialCacheUsed(){}start(e){}end(e){}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class lt extends Error{constructor(e){super(`There's no sheet with id = ${e}`)}}class ht extends Error{constructor(e){super(`There's no sheet with name '${e}'`)}}class ut extends Error{constructor(e){super(`Sheet with name ${e} already exists`)}}class ct extends Error{constructor(){super("Sheet size limit exceeded")}}class dt extends Error{constructor(){super("This is not a formula")}}class pt extends Error{constructor(e){super(`Address (row = ${e.row}, col = ${e.col}) is invalid`)}}class gt extends Error{constructor(e){super(`Invalid arguments, expected ${e}`)}}class ft extends Error{constructor(e,t){super(`Sheets ${e} and ${t} are not equal.`)}}class mt extends Error{constructor(e){super(`Name of Named Expression '${e}' is already present`)}}class yt extends Error{constructor(e){super(`Name of Named Expression '${e}' is invalid`)}}class Et extends Error{constructor(e){super(`Named Expression '${e}' does not exist`)}}class wt extends Error{constructor(){super("There is no operation to undo")}}class Ct extends Error{constructor(){super("There is no operation to redo")}}class vt extends Error{constructor(){super("There is nothing to paste")}}function Rt(e,t){switch(typeof t){case"function":case"symbol":return t.toString();case"bigint":return"BigInt("+t.toString()+")";default:return t instanceof RegExp?"RegExp("+t.toString()+")":t}}class St extends Error{constructor(e){super(`Unable to parse value: ${JSON.stringify(e,Rt,4)}`)}}class Tt extends Error{constructor(e,t){super(`Expected value of type: ${e} for config parameter: ${t}`)}}class Nt extends Error{constructor(e){super(`Config parameter ${e} cannot be empty.`)}}class Mt extends Error{constructor(e,t){super(`Config parameter ${e} should be at least ${t}`)}}class _t extends Error{constructor(e,t){super(`Config parameter ${e} should be at most ${t}`)}}class bt extends Error{constructor(e,t){super(`Expected one of ${e} for config parameter: ${t}`)}}class At extends Error{constructor(){super("Computations are suspended")}}class Ot extends Error{constructor(e){super(`Translation for ${e} is missing in the translation package you're using.`)}}class It extends Error{constructor(e){super(`Cannot register translation for function with id: ${e}`)}}class xt extends Error{constructor(){super("Language not registered.")}}class Pt extends Error{constructor(){super("Language already registered.")}}class Lt extends Error{static functionNotDeclaredInPlugin(e,t){return new Lt(`Function with id ${e} not declared in plugin ${t}`)}static functionMethodNotFound(e,t){return new Lt(`Function method ${e} not found in plugin ${t}`)}}class Dt extends Error{static cannotRegisterFunctionWithId(e){return new Dt(`Cannot register function with id ${e}`)}static cannotUnregisterFunctionWithId(e){return new Dt(`Cannot unregister function with id ${e}`)}static cannotUnregisterProtectedPlugin(){return new Dt("Cannot unregister protected plugin")}}class kt extends Error{constructor(){super("Cannot perform this operation, source location has an array inside.")}}class Ht extends Error{constructor(){super("Cannot perform this operation, target location has an array inside.")}}class Ft extends Error{constructor(){super("Relative addresses not allowed in named expressions.")}}class Ut extends Error{constructor(e,t){super(`Alias id ${e} in plugin ${t} already defined as a function or alias.`)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Vt{constructor(e){this.policy=e,this.mapping=new Map}getCell(e){const t=this.mapping.get(e.sheet);if(void 0===t)throw new lt(e.sheet);return t.getCell(e)}fetchCell(e){const t=this.mapping.get(e.sheet);if(void 0===t)throw new lt(e.sheet);const r=t.getCell(e);if(!r)throw Error("Vertex for address missing in AddressMapping");return r}strategyFor(e){const t=this.mapping.get(e);if(void 0===t)throw new lt(e);return t}addSheet(e,t){if(this.mapping.has(e))throw Error("Sheet already added");this.mapping.set(e,t)}autoAddSheet(e,t){const{height:r,width:n,fill:s}=t,i=this.policy.call(s);this.addSheet(e,new i(n,r))}getCellValue(e){const t=this.getCell(e);return void 0===t?Ye:t instanceof zt?t.getArrayCellValue(e):t.getCellValue()}getRawValue(e){const t=this.getCell(e);return t instanceof dr?t.getValues().rawValue:t instanceof zt?t.getArrayCellRawValue(e):null}setCell(e,t){const r=this.mapping.get(e.sheet);if(!r)throw Error("Sheet not initialized");r.setCell(e,t)}moveCell(e,t){const r=this.mapping.get(e.sheet);if(!r)throw Error("Sheet not initialized.");if(e.sheet!==t.sheet)throw Error("Cannot move cells between sheets.");if(r.has(t))throw new Error("Cannot move cell. Destination already occupied.");const n=r.getCell(e);if(void 0===n)throw new Error("Cannot move cell. No cell with such address.");this.setCell(t,n),this.removeCell(e)}removeCell(e){const t=this.mapping.get(e.sheet);if(!t)throw Error("Sheet not initialized");t.removeCell(e)}has(e){const t=this.mapping.get(e.sheet);return void 0!==t&&t.has(e)}getHeight(e){const t=this.mapping.get(e);if(void 0===t)throw new lt(e);return t.getHeight()}getWidth(e){const t=this.mapping.get(e);if(!t)throw new lt(e);return t.getWidth()}addRows(e,t,r){const n=this.mapping.get(e);if(void 0===n)throw new lt(e);n.addRows(t,r)}removeRows(e){const t=this.mapping.get(e.sheet);if(void 0===t)throw new lt(e.sheet);t.removeRows(e)}removeSheet(e){this.mapping.delete(e)}addColumns(e,t,r){const n=this.mapping.get(e);if(void 0===n)throw new lt(e);n.addColumns(t,r)}removeColumns(e){const t=this.mapping.get(e.sheet);if(void 0===t)throw new lt(e.sheet);t.removeColumns(e)}*verticesFromRowsSpan(e){yield*this.mapping.get(e.sheet).verticesFromRowsSpan(e)}*verticesFromColumnsSpan(e){yield*this.mapping.get(e.sheet).verticesFromColumnsSpan(e)}*entriesFromRowsSpan(e){yield*this.mapping.get(e.sheet).entriesFromRowsSpan(e)}*entriesFromColumnsSpan(e){yield*this.mapping.get(e.sheet).entriesFromColumnsSpan(e)}*entries(){for(const[e,t]of this.mapping.entries())yield*t.getEntries(e)}*sheetEntries(e){const t=this.mapping.get(e);if(void 0===t)throw new lt(e);yield*t.getEntries(e)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Bt{constructor(){this.arrayMapping=new Map}getArray(e){const t=this.getArrayByCorner(e.start);if(null==t?void 0:t.getRange().sameAs(e))return t}getArrayByCorner(e){return this.arrayMapping.get(xr(e))}setArray(e,t){this.arrayMapping.set(xr(e.start),t)}removeArray(e){"string"==typeof e?this.arrayMapping.delete(e):this.arrayMapping.delete(xr(e.start))}count(){return this.arrayMapping.size}*arraysInRows(e){for(const[t,r]of this.arrayMapping.entries())r.spansThroughSheetRows(e.sheet,e.rowStart,e.rowEnd)&&(yield[t,r])}*arraysInCols(e){for(const[t,r]of this.arrayMapping.entries())r.spansThroughSheetColumn(e.sheet,e.columnStart,e.columnEnd)&&(yield[t,r])}isFormulaArrayInRow(e,t){for(const r of this.arrayMapping.values())if(r.spansThroughSheetRows(e,t))return!0;return!1}isFormulaArrayInAllRows(e){let t=!0;for(const r of e.rows())this.isFormulaArrayInRow(e.sheet,r)||(t=!1);return t}isFormulaArrayInColumn(e,t){for(const r of this.arrayMapping.values())if(r.spansThroughSheetColumn(e,t))return!0;return!1}isFormulaArrayInAllColumns(e){let t=!0;for(const r of e.columns())this.isFormulaArrayInColumn(e.sheet,r)||(t=!1);return t}isFormulaArrayInRange(e){for(const t of this.arrayMapping.values())if(t.getRange().doesOverlap(e))return!0;return!1}isFormulaArrayAtAddress(e){for(const t of this.arrayMapping.values())if(t.getRange().addressInRange(e))return!0;return!1}moveArrayVerticesAfterRowByRows(e,t,r){this.updateArrayVerticesInSheet(e,((e,n)=>{const s=n.getRange();return t<=s.start.row?[s.shifted(0,r),n]:void 0}))}moveArrayVerticesAfterColumnByColumns(e,t,r){this.updateArrayVerticesInSheet(e,((e,n)=>{const s=n.getRange();return t<=s.start.col?[s.shifted(r,0),n]:void 0}))}updateArrayVerticesInSheet(e,t){const r=Array();for(const[n,s]of this.arrayMapping.entries()){if(s.sheet!==e)continue;const i=t(n,s);void 0!==i&&(this.removeArray(n),r.push(i))}r.forEach((([e,t])=>{this.setArray(e,t)}))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Wt{constructor(e){this.size=e}width(){return this.size.width}height(){return this.size.height}get(e,t){throw Error("Array not computed yet.")}simpleRangeValue(){throw Error("Array not computed yet.")}}class Yt{constructor(e){if(this.size=new cn(e.length>0?e[0].length:0,e.length),this.array=e,this.size.width<=0||this.size.height<=0)throw Error("Incorrect array size")}static fromInterpreterValue(e){return new Yt(e instanceof rt?e.data:[[e]])}simpleRangeValue(){return rt.onlyValues(this.array)}addRows(e,t){this.array.splice(e,0,...this.nullArrays(t,this.width())),this.size.height+=t}addColumns(e,t){for(let r=0;r<this.height();r++)this.array[r].splice(e,0,...new Array(t).fill(Ye));this.size.width+=t}removeRows(e,t){if(this.outOfBound(0,e)||this.outOfBound(0,t))throw Error("Array index out of bound");const r=t-e+1;this.array.splice(e,r),this.size.height-=r}removeColumns(e,t){if(this.outOfBound(e,0)||this.outOfBound(t,0))throw Error("Array index out of bound");const r=t-e+1;for(const t of this.array)t.splice(e,r);this.size.width-=r}nullArrays(e,t){const r=[];for(let n=0;n<e;++n)r.push(new Array(t).fill(Ye));return r}get(e,t){if(this.outOfBound(e,t))throw Error("Array index out of bound");return this.array[t][e]}set(e,t,r){if(this.outOfBound(e,t))throw Error("Array index out of bound");this.array[t][e]=r}width(){return this.size.width}height(){return this.size.height}raw(){return this.array}resize(e){if(this.height()<e.height&&isFinite(e.height)&&this.addRows(this.height(),e.height-this.height()),this.height()>e.height)throw Error("Resizing to smaller array");if(this.width()<e.width&&isFinite(e.width)&&this.addColumns(this.width(),e.width-this.width()),this.width()>e.width)throw Error("Resizing to smaller array")}outOfBound(e,t){return e<0||t<0||t>this.size.height-1||e>this.size.width-1}}class jt{constructor(e,t){this.error=e,this.size=t}get(e,t){return this.error}width(){return this.size.width}height(){return this.size.height}simpleRangeValue(){return this.error}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Gt{constructor(e,t,r){this.formula=e,this.cellAddress=t,this.version=r}get width(){return 1}get height(){return 1}static fromAst(e,t,r,n){return r.isScalar()?new $t(e,t,n):new zt(e,t,r,n)}getFormula(e){return this.ensureRecentData(e),this.formula}ensureRecentData(e){if(this.version!=e.version()){const[t,r,n]=e.applyTransformations(this.formula,this.cellAddress,this.version);this.formula=t,this.cellAddress=r,this.version=n}}getAddress(e){return this.ensureRecentData(e),this.cellAddress}}class zt extends Gt{constructor(e,t,r,n=0){super(e,t,n),r.isRef?this.array=new jt(new Tr(ir.REF,Z.NoSpaceForArrayResult),cn.error()):this.array=new Wt(r)}get width(){return this.array.width()}get height(){return this.array.height()}get sheet(){return this.cellAddress.sheet}get leftCorner(){return this.cellAddress}setCellValue(e){if(e instanceof Tr)return this.setErrorValue(e),e;const t=Yt.fromInterpreterValue(e);return t.resize(this.array.size),this.array=t,e}getCellValue(){if(this.array instanceof Wt)throw Error("Array not computed yet.");return this.array.simpleRangeValue()}valueOrUndef(){if(!(this.array instanceof Wt))return this.array.simpleRangeValue()}getArrayCellValue(e){const t=e.col-this.cellAddress.col,r=e.row-this.cellAddress.row;try{return this.array.get(t,r)}catch(e){return new Tr(ir.REF)}}getArrayCellRawValue(e){const t=this.getArrayCellValue(e);return t instanceof Tr||t===Ye?void 0:je(t)}setArrayCellValue(e,t){const r=e.col-this.cellAddress.col,n=e.row-this.cellAddress.row;this.array instanceof Yt&&this.array.set(r,n,t)}setNoSpace(){return this.array=new jt(new Tr(ir.SPILL,Z.NoSpaceForArrayResult),cn.error()),this.getCellValue()}getRange(){return Fr.spanFrom(this.cellAddress,this.width,this.height)}getRangeOrUndef(){return Fr.spanFromOrUndef(this.cellAddress,this.width,this.height)}setAddress(e){this.cellAddress=e}setFormula(e){this.formula=e}spansThroughSheetRows(e,t,r=t){return this.cellAddress.sheet===e&&this.cellAddress.row<=r&&t<this.cellAddress.row+this.height}spansThroughSheetColumn(e,t,r=t){return this.cellAddress.sheet===e&&this.cellAddress.col<=r&&t<this.cellAddress.col+this.width}isComputed(){return!(this.array instanceof Wt)}columnsFromArray(){return it.fromNumberOfColumns(this.cellAddress.sheet,this.cellAddress.col,this.width)}rowsFromArray(){return st.fromNumberOfRows(this.cellAddress.sheet,this.cellAddress.row,this.height)}ensureRecentData(e){}isLeftCorner(e){return Dr(this.cellAddress,e)}setErrorValue(e){this.array=new jt(e,this.array.size)}}class $t extends Gt{constructor(e,t,r){super(e,t,r)}valueOrUndef(){return this.cachedCellValue}setCellValue(e){return this.cachedCellValue=e,this.cachedCellValue}getCellValue(){if(void 0!==this.cachedCellValue)return this.cachedCellValue;throw Error("Value of the formula cell is not computed.")}isComputed(){return void 0!==this.cachedCellValue}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Kt{constructor(e){this.range=e,this.functionCache=new Map,this.criterionFunctionCache=new Map,this.dependentCacheRanges=new Set,this.bruteForce=!1}get start(){return this.range.start}get end(){return this.range.end}get sheet(){return this.range.start.sheet}getFunctionValue(e){return this.functionCache.get(e)}setFunctionValue(e,t){this.functionCache.set(e,t)}getCriterionFunctionValue(e,t){var r;return null===(r=this.getCriterionFunctionValues(e).get(t))||void 0===r?void 0:r[0]}getCriterionFunctionValues(e){var t;return null!==(t=this.criterionFunctionCache.get(e))&&void 0!==t?t:new Map}setCriterionFunctionValues(e,t){this.criterionFunctionCache.set(e,t)}addDependentCacheRange(e){e!==this&&this.dependentCacheRanges.add(e)}clearCache(){this.functionCache.clear(),this.criterionFunctionCache.clear(),this.dependentCacheRanges.forEach((e=>e.criterionFunctionCache.clear())),this.dependentCacheRanges.clear()}getStart(){return this.start}getEnd(){return this.end}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const Xt=(e,t,r,n,s)=>{if(t instanceof Kt){const e=t.range.intersectionWith(r);return void 0!==e?Array.from(e.addresses(s)):[]}let i,o;return t instanceof Gt?(i=t.getFormula(n),o=t.getAddress(n),ke(i,e).filter((e=>e instanceof He)).map((e=>e.dependency.toSimpleCellAddress(o))).filter((e=>r.addressInRange(e)))):[]};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var qt;!function(e){e[e.ON_STACK=0]="ON_STACK",e[e.PROCESSED=1]="PROCESSED",e[e.POPPED=2]="POPPED"}(qt||(qt={}));class Qt{constructor(e=[],t=[]){this.nodesSparseArray=e,this.edgesSparseArray=t,this.entranceTime=[],this.low=[],this.parent=[],this.inSCC=[],this.nodeStatus=[],this.order=[],this.sccNonSingletons=[],this.timeCounter=0}getTopSortedWithSccSubgraphFrom(e,t,r){const n=e.reverse();return n.forEach((e=>this.runDFS(e))),this.postprocess(n,r,t)}getAdjacentNodeIds(e){return this.edgesSparseArray[e].filter((e=>void 0!==e&&this.nodesSparseArray[e]))}runDFS(e){if(void 0!==this.nodeStatus[e])return;this.nodeStatus[e]=qt.ON_STACK;const t=[e],r=[];for(;t.length>0;){const e=t[t.length-1];switch(this.nodeStatus[e]){case qt.ON_STACK:this.handleOnStack(e,r,t);break;case qt.PROCESSED:this.handleProcessed(e,r,t);break;case qt.POPPED:t.pop()}}}handleOnStack(e,t,r){this.entranceTime[e]=this.timeCounter,this.low[e]=this.timeCounter,this.timeCounter++,t.push(e),this.getAdjacentNodeIds(e).forEach((t=>{void 0===this.entranceTime[t]&&(r.push(t),this.parent[t]=e,this.nodeStatus[t]=qt.ON_STACK)})),this.nodeStatus[e]=qt.PROCESSED}handleProcessed(e,t,r){let n=this.entranceTime[e];if(this.getAdjacentNodeIds(e).forEach((t=>{this.inSCC[t]||(n=this.parent[t]===e?Math.min(n,this.low[t]):Math.min(n,this.entranceTime[t]))})),this.low[e]=n,n===this.entranceTime[e]){const r=[];do{r.push(t[t.length-1]),t.pop()}while(r[r.length-1]!==e);r.forEach((e=>{this.inSCC[e]=!0})),this.order.push(...r),r.length>1&&r.forEach((e=>{this.sccNonSingletons[e]=!0}))}r.pop(),this.nodeStatus[e]=qt.POPPED}postprocess(e,t,r){const n=[];e.forEach((e=>{n[e]=!0}));const s=[],i=[];return this.order.reverse(),this.order.forEach((e=>{const o=this.getAdjacentNodeIds(e);this.sccNonSingletons[e]||o.includes(e)?(i.push(this.nodesSparseArray[e]),t(this.nodesSparseArray[e]),o.forEach((e=>n[e]=!0))):(s.push(this.nodesSparseArray[e]),n[e]&&r(this.nodesSparseArray[e])&&o.forEach((e=>n[e]=!0)))})),{sorted:s,cycled:i}}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Zt{constructor(e,t){this.rawValue=e,this.processFn=t,this.processedValue=null}getProcessedValue(){return null===this.processedValue&&(this.processedValue=this.processFn(this.rawValue)),this.processedValue}markAsModified(){this.processedValue=null}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Jt{constructor(e){this.dependencyQuery=e,this.nodesSparseArray=[],this.edgesSparseArray=[],this.nodesIds=new Map,this.dirtyAndVolatileNodeIds=new Zt({dirty:[],volatile:[]},(e=>this.processDirtyAndVolatileNodeIds(e))),this.infiniteRangeIds=new Set,this.changingWithStructureNodeIds=[],this.nextId=0}getNodes(){return this.nodesSparseArray.filter((e=>void 0!==e))}hasNode(e){return this.nodesIds.has(e)}existsEdge(e,t){const r=this.getNodeId(e),n=this.getNodeId(t);return void 0!==r&&void 0!==n&&this.edgesSparseArray[r].includes(n)}adjacentNodes(e){const t=this.getNodeId(e);if(void 0===t)throw this.missingNodeError(e);return new Set(this.edgesSparseArray[t].filter((e=>void 0!==e)).map((e=>this.nodesSparseArray[e])))}adjacentNodesCount(e){const t=this.getNodeId(e);if(void 0===t)throw this.missingNodeError(e);return this.fixEdgesArrayForNode(t).length}addNodeAndReturnId(e){const t=this.nodesIds.get(e);if(void 0!==t)return t;const r=this.nextId;return this.nextId++,this.nodesSparseArray[r]=e,this.edgesSparseArray[r]=[],this.nodesIds.set(e,r),r}addEdge(e,t){const r=this.getNodeIdIfNotNumber(e),n=this.getNodeIdIfNotNumber(t);if(void 0===r)throw this.missingNodeError(e);if(void 0===n)throw this.missingNodeError(t);this.edgesSparseArray[r].includes(n)||this.edgesSparseArray[r].push(n)}removeNode(e){const t=this.getNodeId(e);if(void 0===t)throw this.missingNodeError(e);this.edgesSparseArray[t].length>0&&(this.edgesSparseArray[t].forEach((e=>this.dirtyAndVolatileNodeIds.rawValue.dirty.push(e))),this.dirtyAndVolatileNodeIds.markAsModified());const r=this.removeDependencies(e);return delete this.nodesSparseArray[t],delete this.edgesSparseArray[t],this.infiniteRangeIds.delete(t),this.nodesIds.delete(e),r}removeEdge(e,t){const r=this.getNodeIdIfNotNumber(e),n=this.getNodeIdIfNotNumber(t);if(void 0===r)throw this.missingNodeError(e);if(void 0===n)throw this.missingNodeError(t);const s=this.edgesSparseArray[r].indexOf(n);if(-1===s)throw new Error("Edge does not exist");delete this.edgesSparseArray[r][s]}removeEdgeIfExists(e,t){const r=this.getNodeId(e),n=this.getNodeId(t);if(void 0===r)return;if(void 0===n)return;const s=this.edgesSparseArray[r].indexOf(n);-1!==s&&delete this.edgesSparseArray[r][s]}topSortWithScc(){return this.getTopSortedWithSccSubgraphFrom(this.getNodes(),(()=>!0),(()=>{}))}getTopSortedWithSccSubgraphFrom(e,t,r){const n=new Qt(this.nodesSparseArray,this.edgesSparseArray),s=e.map((e=>this.getNodeId(e))).filter((e=>void 0!==e));return n.getTopSortedWithSccSubgraphFrom(s,t,r)}markNodeAsVolatile(e){const t=this.getNodeId(e);void 0!==t&&(this.dirtyAndVolatileNodeIds.rawValue.volatile.push(t),this.dirtyAndVolatileNodeIds.markAsModified())}markNodeAsDirty(e){const t=this.getNodeId(e);void 0!==t&&(this.dirtyAndVolatileNodeIds.rawValue.dirty.push(t),this.dirtyAndVolatileNodeIds.markAsModified())}getDirtyAndVolatileNodes(){return this.dirtyAndVolatileNodeIds.getProcessedValue()}clearDirtyNodes(){this.dirtyAndVolatileNodeIds.rawValue.dirty=[],this.dirtyAndVolatileNodeIds.markAsModified()}markNodeAsChangingWithStructure(e){const t=this.getNodeId(e);void 0!==t&&this.changingWithStructureNodeIds.push(t)}markChangingWithStructureNodesAsDirty(){this.changingWithStructureNodeIds.length<=0||(this.dirtyAndVolatileNodeIds.rawValue.dirty=[...this.dirtyAndVolatileNodeIds.rawValue.dirty,...this.changingWithStructureNodeIds],this.dirtyAndVolatileNodeIds.markAsModified())}markNodeAsInfiniteRange(e){const t=this.getNodeIdIfNotNumber(e);void 0!==t&&this.infiniteRangeIds.add(t)}getInfiniteRanges(){return[...this.infiniteRangeIds].map((e=>({node:this.nodesSparseArray[e],id:e})))}getNodeId(e){return this.nodesIds.get(e)}getNodeIdIfNotNumber(e){return"number"==typeof e?e:this.nodesIds.get(e)}fixEdgesArrayForNode(e){const t=this.edgesSparseArray[e];return this.edgesSparseArray[e]=t.filter((e=>void 0!==e&&this.nodesSparseArray[e])),this.edgesSparseArray[e]}removeDependencies(e){const t=this.dependencyQuery(e);return t.forEach((([t,r])=>{this.removeEdgeIfExists(r,e)})),t}processDirtyAndVolatileNodeIds({dirty:e,volatile:t}){return[...new Set([...e,...
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class er{constructor(){this.rangeMapping=new Map}getMappingSize(e){var t,r;return null!==(r=null===(t=this.rangeMapping.get(e))||void 0===t?void 0:t.size)&&void 0!==r?r:0}setRange(e){let t=this.rangeMapping.get(e.getStart().sheet);void 0===t&&(t=new Map,this.rangeMapping.set(e.getStart().sheet,t));const r=tr(e.getStart(),e.getEnd());t.set(r,e)}removeRange(e){const t=e.getStart().sheet,r=this.rangeMapping.get(t);if(void 0===r)return;const n=tr(e.getStart(),e.getEnd());r.delete(n),0===r.size&&this.rangeMapping.delete(t)}getRange(e,t){const r=this.rangeMapping.get(e.sheet),n=tr(e,t);return null==r?void 0:r.get(n)}fetchRange(e,t){const r=this.getRange(e,t);if(!r)throw Error("Range does not exist");return r}truncateRanges(e,t){const r=Array(),n=Array(),s=Array(),i=e.sheet;for(const[o,a]of this.entriesFromSheet(e.sheet)){const l=a.range;e.start<=t(a.range.end)&&(l.removeSpan(e),l.shouldBeRemoved()?(this.removeByKey(i,o),r.push(a)):n.push([o,a]),s.push(a))}const o=[];n.sort(((e,r)=>rr(e[1],r[1],t)));for(const[e,t]of n){const r=tr((a=t.range).start,a.end);if(r===e)continue;const n=this.getByKey(i,r);this.removeByKey(i,e),void 0!==n&&t!=n?o.push([n,t]):this.setRange(t)}var a;return{verticesToRemove:r,verticesToMerge:o,verticesWithChangedSize:s}}moveAllRangesInSheetAfterRowByRows(e,t,r){return this.updateVerticesFromSheet(e,((e,n)=>t<=n.start.row?(n.range.shiftByRows(r),{changedSize:!1,vertex:n}):t>n.start.row&&t<=n.end.row?(n.range.expandByRows(r),{changedSize:!0,vertex:n}):void 0))}moveAllRangesInSheetAfterColumnByColumns(e,t,r){return this.updateVerticesFromSheet(e,((e,n)=>t<=n.start.col?(n.range.shiftByColumns(r),{changedSize:!1,vertex:n}):t>n.start.col&&t<=n.end.col?(n.range.expandByColumns(r),{changedSize:!0,vertex:n}):void 0))}moveRangesInsideSourceRange(e,t,r,n){this.updateVerticesFromSheet(e.sheet,((s,i)=>e.containsRange(i.range)?(i.range.shiftByColumns(t),i.range.shiftByRows(r),i.range.moveToSheet(n),{changedSize:!1,vertex:i}):void 0))}removeRangesInSheet(e){if(this.rangeMapping.has(e)){const t=this.rangeMapping.get(e).values();return this.rangeMapping.delete(e),t}return[][Symbol.iterator]()}*rangesInSheet(e){const t=this.rangeMapping.get(e);t&&(yield*t.values())}*rangeVerticesContainedInRange(e){for(const t of this.rangesInSheet(e.sheet))e.containsRange(t.range)&&(yield t)}findSmallerRange(e){if(e.height()>1&&Number.isFinite(e.height())){const t=Ar(e.end.sheet,e.end.col,e.end.row-1),r=this.getRange(e.start,t);if(void 0!==r){return{smallerRangeVertex:r,restRange:Fr.fromSimpleCellAddresses(Ar(e.start.sheet,e.start.col,e.end.row),e.end)}}}return{restRange:e}}*entriesFromSheet(e){const t=this.rangeMapping.get(e);t&&(yield*t.entries())}removeByKey(e,t){this.rangeMapping.get(e).delete(t)}getByKey(e,t){var r;return null===(r=this.rangeMapping.get(e))||void 0===r?void 0:r.get(t)}updateVerticesFromSheet(e,t){const r=Array();for(const[n,s]of this.entriesFromSheet(e)){const i=t(n,s);void 0!==i&&(this.removeByKey(e,n),r.push(i))}return r.forEach((e=>{this.setRange(e.vertex)})),{verticesWithChangedSize:r.filter((e=>e.changedSize)).map((e=>e.vertex))}}}function tr(e,t){return`${e.col},${e.row},${t.col},${t.row}`}const rr=(e,t,r)=>{const n=r(e.range.start),s=r(e.range.start);if(n===s){return r(e.range.end)-r(t.range.end)}return n-s};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class nr{constructor(e,t,r){this.functions=e,this.errors=t,this.ui=r,this._protectedTranslations={VERSION:"VERSION"},this.checkUI(),this.checkErrors(),this.checkFunctionTranslations(this.functions),Object.assign(this.functions,this._protectedTranslations)}extendFunctions(e){this.checkFunctionTranslations(e),Object.assign(this.functions,e)}buildFunctionMapping(){return Object.keys(this.functions).reduce(((e,t)=>(e[this.functions[t]]=t,e)),{})}buildErrorMapping(){return Object.keys(this.errors).reduce(((e,t)=>(e[this.errors[t]]=t,e)),{})}isFunctionTranslated(e){return void 0!==this.functions[e]}getFunctionTranslations(e){const t=[];for(const r of e)this.isFunctionTranslated(r)&&t.push(this.functions[r]);return t}getFunctionTranslation(e){const t=this.functions[e];if(void 0===t)throw new Ot(`functions.${e}`);return t}getMaybeFunctionTranslation(e){return this.functions[e]}getErrorTranslation(e){if(e===ir.LIC)return`#${ir.LIC}!`;const t=this.errors[e];if(void 0===t)throw new Ot(`errors.${e}`);return t}getUITranslation(e){const t=this.ui[e];if(void 0===t)throw new Ot(`ui.${e}`);return t}checkUI(){for(const e of Object.values(sr))if(!(e in this.ui))throw new Ot(`ui.${e}`)}checkErrors(){for(const e of Object.values(ir))if(!(e in this.errors)&&e!==ir.LIC)throw new Ot(`errors.${e}`)}checkFunctionTranslations(e){const t=new Set(Object.getOwnPropertyNames(e));for(const e of Object.getOwnPropertyNames(this._protectedTranslations))if(t.has(e))throw new It(e)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var sr,ir,or;
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function ar(e){return e.toLowerCase()}!function(e){e.NEW_SHEET_PREFIX="NEW_SHEET_PREFIX"}(sr||(sr={}));class lr{constructor(e,t){this.id=e,this.displayName=t}get canonicalName(){return ar(this.displayName)}}class hr{constructor(e){this.languages=e,this.mappingFromCanonicalName=new Map,this.mappingFromId=new Map,this.lastSheetId=-1,this.fetch=e=>{const t=this.mappingFromCanonicalName.get(ar(e));if(void 0===t)throw new ht(e);return t.id},this.get=e=>{var t;return null===(t=this.mappingFromCanonicalName.get(ar(e)))||void 0===t?void 0:t.id},this.fetchDisplayName=e=>this.fetchSheetById(e).displayName,this.sheetNamePrefix=e.getUITranslation(sr.NEW_SHEET_PREFIX)}addSheet(e=`${this.sheetNamePrefix}${this.lastSheetId+2}`){const t=ar(e);if(this.mappingFromCanonicalName.has(t))throw new ut(e);this.lastSheetId++;const r=new lr(this.lastSheetId,e);return this.store(r),r.id}removeSheet(e){const t=this.fetchSheetById(e);e==this.lastSheetId&&--this.lastSheetId,this.mappingFromCanonicalName.delete(t.canonicalName),this.mappingFromId.delete(t.id)}getDisplayName(e){var t;return null===(t=this.mappingFromId.get(e))||void 0===t?void 0:t.displayName}*displayNames(){for(const e of this.mappingFromCanonicalName.values())yield e.displayName}numberOfSheets(){return this.mappingFromCanonicalName.size}hasSheetWithId(e){return this.mappingFromId.has(e)}hasSheetWithName(e){return this.mappingFromCanonicalName.has(ar(e))}renameSheet(e,t){const r=this.fetchSheetById(e),n=r.displayName;if(n===t)return;const s=this.mappingFromCanonicalName.get(ar(t));if(void 0!==s&&s.id!==r.id)throw new ut(t);const i=r.canonicalName;return this.mappingFromCanonicalName.delete(i),r.displayName=t,this.store(r),n}sheetNames(){return Array.from(this.mappingFromId.values()).map((e=>e.displayName))}store(e){this.mappingFromId.set(e.id,e),this.mappingFromCanonicalName.set(e.canonicalName,e)}fetchSheetById(e){const t=this.mappingFromId.get(e);if(void 0===t)throw new lt(e);return t}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ur{constructor(e,t,r,n,s,i,o,a){this.addressMapping=e,this.rangeMapping=t,this.sheetMapping=r,this.arrayMapping=n,this.stats=s,this.lazilyTransformingAstService=i,this.functionRegistry=o,this.namedExpressions=a,this.changes=nt.empty(),this.dependencyQueryAddresses=e=>{if(e instanceof Kt)return this.rangeDependencyQuery(e).map((([e,t])=>e));{const t=this.formulaDependencyQuery(e);if(void 0!==t){const[e,r]=t;return r.map((t=>t instanceof Be?this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet).address:Pr(t)?t:Hr(t.start,t.end)))}return[]}},this.dependencyQueryVertices=e=>{if(e instanceof Kt)return this.rangeDependencyQuery(e);{const t=this.formulaDependencyQuery(e);if(void 0!==t){const[e,r]=t;return r.map((t=>{if(t instanceof Fr)return[t.start,this.rangeMapping.fetchRange(t.start,t.end)];if(t instanceof Be){const r=this.namedExpressions.namedExpressionOrPlaceholder(t.name,e.sheet);return[r.address,this.addressMapping.fetchCell(r.address)]}return[t,this.addressMapping.fetchCell(t)]}))}return[]}},this.rangeDependencyQuery=e=>{const t=[],{smallerRangeVertex:r,restRange:n}=this.rangeMapping.findSmallerRange(e.range);let s;void 0!==r&&this.graph.adjacentNodes(r).has(e)?(s=n,t.push([new Fr(r.start,r.end),r])):s=e.range;for(const e of s.addresses(this)){const r=this.addressMapping.getCell(e);void 0!==r&&t.push([e,r])}return t},this.formulaDependencyQuery=e=>{let t,r;if(!(e instanceof Gt))return;r=e.getAddress(this.lazilyTransformingAstService),t=e.getFormula(this.lazilyTransformingAstService);const n=ke(t,this.functionRegistry);return[r,We(n,r)]},this.graph=new Jt(this.dependencyQueryVertices)}static buildEmpty(e,t,r,n,s){return new ur(new Vt(t.chooseAddressMappingPolicy),new er,new hr(t.translationPackage),new Bt,s,e,r,n)}setFormulaToCell(e,t,r,n,s,i){const o=Gt.fromAst(t,e,n,this.lazilyTransformingAstService.version());return this.exchangeOrAddFormulaVertex(o),this.processCellDependencies(r,o),this.graph.markNodeAsDirty(o),s&&this.markAsVolatile(o),i&&this.markAsDependentOnStructureChange(o),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setParsingErrorToCell(e,t){const r=this.shrinkPossibleArrayAndGetCell(e);return this.exchangeOrAddGraphNode(r,t),this.addressMapping.setCell(e,t),this.graph.markNodeAsDirty(t),this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setValueToCell(e,t){const r=this.shrinkPossibleArrayAndGetCell(e);if(r instanceof zt&&this.arrayMapping.removeArray(r.getRange()),r instanceof dr){r.getValues().rawValue!==t.rawValue&&(r.setValues(t),this.graph.markNodeAsDirty(r))}else{const n=new dr(t.parsedValue,t.rawValue);this.exchangeOrAddGraphNode(r,n),this.addressMapping.setCell(e,n),this.graph.markNodeAsDirty(n)}return this.correctInfiniteRangesDependency(e),this.getAndClearContentChanges()}setCellEmpty(e){const t=this.shrinkPossibleArrayAndGetCell(e);if(void 0===t)return nt.empty();if(this.graph.adjacentNodes(t).size>0){const r=new cr;this.exchangeGraphNode(t,r),0===this.graph.adjacentNodesCount(r)?(this.removeVertex(r),this.addressMapping.removeCell(e)):(this.graph.markNodeAsDirty(r),this.addressMapping.setCell(e,r))}else this.removeVertex(t),this.addressMapping.removeCell(e);return this.getAndClearContentChanges()}clearDirtyVertices(){this.graph.clearDirtyNodes()}verticesToRecompute(){return this.graph.getDirtyAndVolatileNodes()}processCellDependencies(e,t){const r=this.graph.getNodeId(t);e.forEach((e=>{if(e instanceof Fr){const t=e;let n=this.getRange(t.start,t.end);void 0===n&&(n=new Kt(t),this.rangeMapping.setRange(n)),this.graph.addNodeAndReturnId(n);const s=this.graph.getNodeId(n);t.isFinite()||this.graph.markNodeAsInfiniteRange(s);const{smallerRangeVertex:i,restRange:o}=this.rangeMapping.findSmallerRange(t);if(void 0!==i){if(this.graph.addEdge(i,s),n.bruteForce){n.bruteForce=!1;for(const e of t.addresses(this))this.graph.removeEdge(this.fetchCell(e),s)}}else n.bruteForce=!0;const a=this.arrayMapping.getArray(o);if(void 0!==a)this.graph.addEdge(a,s);else for(const e of o.addresses(this)){const{vertex:t,id:r}=this.fetchCellOrCreateEmpty(e);
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class cr{constructor(){}getCellValue(){return Ye}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class dr{constructor(e,t){this.parsedValue=e,this.rawValue=t}getValues(){return{parsedValue:this.parsedValue,rawValue:this.rawValue}}setValues(e){this.parsedValue=e.parsedValue,this.rawValue=e.rawValue}getCellValue(){return this.parsedValue}setCellValue(e){throw Error("SetCellValue is deprecated for ValueCellVertex")}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class pr{constructor(e,t){this.errors=e,this.rawInput=t}getCellValue(){const e=this.errors.map((e=>e.message)).find((e=>e));return Tr.parsingError(e)}getFormula(){return this.rawInput}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class gr{constructor(e,t){this.width=e,this.height=t,this.mapping=new Map}getCell(e){var t;return null===(t=this.mapping.get(e.col))||void 0===t?void 0:t.get(e.row)}setCell(e,t){this.width=Math.max(this.width,e.col+1),this.height=Math.max(this.height,e.row+1);let r=this.mapping.get(e.col);r||(r=new Map,this.mapping.set(e.col,r)),r.set(e.row,t)}has(e){var t;return!!(null===(t=this.mapping.get(e.col))||void 0===t?void 0:t.get(e.row))}getHeight(){return this.height}getWidth(){return this.width}removeCell(e){var t;null===(t=this.mapping.get(e.col))||void 0===t||t.delete(e.row)}addRows(e,t){this.mapping.forEach((r=>{const n=new Map;r.forEach(((s,i)=>{i>=e&&(n.set(i+t,s),r.delete(i))})),n.forEach(((e,t)=>{r.set(t,e)}))})),this.height+=t}addColumns(e,t){const r=new Map;this.mapping.forEach(((n,s)=>{s>=e&&(r.set(s+t,n),this.mapping.delete(s))})),r.forEach(((e,t)=>{this.mapping.set(t,e)})),this.width+=t}removeRows(e){this.mapping.forEach((t=>{const r=new Map;t.forEach(((n,s)=>{s>=e.rowStart&&(t.delete(s),s>e.rowEnd&&r.set(s-e.numberOfRows,n))})),r.forEach(((e,r)=>{t.set(r,e)}))}));const t=Math.min(this.height-1,e.rowEnd),r=Math.max(0,t-e.rowStart+1);this.height=Math.max(0,this.height-r)}removeColumns(e){const t=new Map;this.mapping.forEach(((r,n)=>{n>=e.columnStart&&(this.mapping.delete(n),n>e.columnEnd&&t.set(n-e.numberOfColumns,r))})),t.forEach(((e,t)=>{this.mapping.set(t,e)}));const r=Math.min(this.width-1,e.columnEnd),n=Math.max(0,r-e.columnStart+1);this.width=Math.max(0,this.width-n)}*getEntries(e){for(const[t,r]of this.mapping)for(const[n,s]of r)yield[Ar(e,t,n),s]}*verticesFromColumn(e){const t=this.mapping.get(e);if(void 0!==t)for(const[e,r]of t)yield r}*verticesFromRow(e){for(const t of this.mapping.values()){const r=t.get(e);void 0!==r&&(yield r)}}*verticesFromColumnsSpan(e){for(const t of e.columns()){const e=this.mapping.get(t);if(void 0!==e)for(const[t,r]of e)yield r}}*verticesFromRowsSpan(e){for(const t of this.mapping.values())for(const r of e.rows()){const e=t.get(r);void 0!==e&&(yield e)}}*entriesFromRowsSpan(e){for(const[t,r]of this.mapping.entries())for(const n of e.rows()){const s=r.get(n);void 0!==s&&(yield[Ar(e.sheet,t,n),s])}}*entriesFromColumnsSpan(e){for(const t of e.columns()){const r=this.mapping.get(t);if(void 0!==r)for(const[n,s]of r.entries())yield[Ar(e.sheet,t,n),s]}}*vertices(){for(const[e,t]of this.mapping)for(const[e,r]of t)void 0!==r&&(yield r)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class fr{constructor(e,t){this.width=e,this.height=t,this.mapping=new Array(t);for(let r=0;r<t;r++)this.mapping[r]=new Array(e)}getCell(e){return this.getCellVertex(e.col,e.row)}setCell(e,t){this.width=Math.max(this.width,e.col+1),this.height=Math.max(this.height,e.row+1);this.mapping[e.row]||(this.mapping[e.row]=new Array(this.width)),this.mapping[e.row][e.col]=t}has(e){const t=this.mapping[e.row];return!!t&&!!t[e.col]}getHeight(){return this.height}getWidth(){return this.width}removeCell(e){void 0!==this.mapping[e.row]&&delete this.mapping[e.row][e.col]}addRows(e,t){const r=[];for(let e=0;e<t;e++)r.push(new Array(this.width));this.mapping.splice(e,0,...r),this.height+=t}addColumns(e,t){for(let r=0;r<this.height;r++)this.mapping[r].splice(e,0,...new Array(t));this.width+=t}removeRows(e){this.mapping.splice(e.rowStart,e.numberOfRows);const t=Math.min(this.height-1,e.rowEnd),r=Math.max(0,t-e.rowStart+1);this.height=Math.max(0,this.height-r)}removeColumns(e){for(let t=0;t<this.height;t++)this.mapping[t].splice(e.columnStart,e.numberOfColumns);const t=Math.min(this.width-1,e.columnEnd),r=Math.max(0,t-e.columnStart+1);this.width=Math.max(0,this.width-r)}*getEntries(e){for(let t=0;t<this.height;++t)for(let r=0;r<this.width;++r){const n=this.getCellVertex(r,t);n&&(yield[Ar(e,r,t),n])}}*verticesFromColumn(e){for(let t=0;t<this.height;++t){const r=this.getCellVertex(e,t);r&&(yield r)}}*verticesFromRow(e){for(let t=0;t<this.width;++t){const r=this.getCellVertex(t,e);r&&(yield r)}}*verticesFromColumnsSpan(e){for(let t=e.columnStart;t<=e.columnEnd;++t)for(let e=0;e<this.height;++e){const r=this.getCellVertex(t,e);r&&(yield r)}}*verticesFromRowsSpan(e){for(let t=0;t<this.width;++t)for(let r=e.rowStart;r<=e.rowEnd;++r){const e=this.getCellVertex(t,r);e&&(yield e)}}*entriesFromRowsSpan(e){for(let t=0;t<this.width;++t)for(let r=e.rowStart;r<=e.rowEnd;++r){const n=this.getCellVertex(t,r);n&&(yield[Ar(e.sheet,t,r),n])}}*entriesFromColumnsSpan(e){for(let t=e.columnStart;t<=e.columnEnd;++t)for(let r=0;r<this.height;++r){const n=this.getCellVertex(t,r);n&&(yield[Ar(e.sheet,t,r),n])}}*vertices(){for(let e=0;e<this.height;++e)for(let t=0;t<this.width;++t){const r=this.getCellVertex(t,e);r&&(yield r)}}getCellVertex(e,t){var r;return null===(r=this.mapping[t])||void 0===r?void 0:r[e]}}!function(e){e.DIV_BY_ZERO="DIV_BY_ZERO",e.NAME="NAME",e.VALUE="VALUE",e.NUM="NUM",e.NA="NA",e.CYCLE="CYCLE",e.REF="REF",e.SPILL="SPILL",e.LIC="LIC",e.ERROR="ERROR"}(ir||(ir={})),function(e){e.FORMULA="FORMULA",e.VALUE="VALUE",e.ARRAY="ARRAY",e.EMPTY="EMPTY",e.ARRAYFORMULA="ARRAYFORMULA"}(or||(or={}));var mr,yr;!function(e){e.EMPTY="EMPTY",e.NUMBER="NUMBER",e.STRING="STRING",e.BOOLEAN="BOOLEAN",e.ERROR="ERROR"}(mr||(mr={})),function(e){e.NUMBER="NUMBER"}(yr||(yr={}));const Er=Object.assign(Object.assign({},mr),yr),wr=Object.assign(Object.assign({},mr),Je),Cr=e=>{switch(e){case Er.EMPTY:return 0;case Er.NUMBER:return 1;case Er.STRING:return 2;case Er.BOOLEAN:return 3;case Er.ERROR:return 4}throw new Error("Cell value not computed")},vr=e=>{if(e===Ye)return Er.EMPTY;if(e instanceof Tr||e instanceof rt)return Er.ERROR;if("string"==typeof e)return Er.STRING;if(Ze(e))return Er.NUMBER;if("boolean"==typeof e)return Er.BOOLEAN;throw new Error("Cell value not computed")},Rr=e=>{return Ze(e)?(t=e)instanceof Ge?t.getDetailedType():Je.NUMBER_RAW:vr(e);var t},Sr=e=>{return Ze(e)&&(t=e)instanceof Ge?t.format:void 0;var t};class Tr{constructor(e,t,r){this.type=e,this.message=t,this.root=r}static parsingError(e){return new Tr(ir.ERROR,`${Z.ParseError}${e?" "+e:""}`)}attachRootVertex(e){return void 0===this.root?new Tr(this.type,this.message,e):this}}const Nr=(e,t)=>({sheet:e,row:t}),Mr=e=>e.row<0,_r=(e,t)=>({sheet:e,col:t}),br=e=>e.col<0,Ar=(e,t,r)=>({sheet:e,col:t,row:r}),Or=e=>e.col<0||e.row<0,Ir=(e,t,r,n)=>Ar(t,e.col+r,e.row+n),xr=e=>`${e.sheet},${e.row},${e.col}`;function Pr(e){var t,r,n;return e&&("object"==typeof e||"function"==typeof e)&&"number"==typeof(null===(t=e)||void 0===t?void 0:t.sheet)&&"number"==typeof(null===(r=e)||void 0===r?void 0:r.col)&&"number"==typeof(nul
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Br{constructor(e,t,r){this.formulaAddress=e,this.arraysFlag=t,this.formulaVertex=r}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const Wr=/^\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij]))\s*(([+-])\s*([+-]?)\s*(([\d\.,]+(e[+-]?\d+)?)\s*([ij]?)|([ij])))?$/;class Yr{constructor(e,t,r){this.config=e,this.dateTimeHelper=t,this.numberLiteralsHelper=r,this.lt=(e,t)=>this.compare(e,t)<0,this.leq=(e,t)=>this.compare(e,t)<=0,this.gt=(e,t)=>this.compare(e,t)>0,this.geq=(e,t)=>this.compare(e,t)>=0,this.eq=(e,t)=>0===this.compare(e,t),this.neq=(e,t)=>0!==this.compare(e,t),this.pow=(e,t)=>Math.pow(je(e),je(t)),this.addWithEpsilonRaw=(e,t)=>{const r=e+t;return Math.abs(r)<this.actualEps*Math.abs(e)?0:r},this.addWithEpsilon=(e,t)=>{const r=nn(e,t);return this.ExtendedNumberFactory(this.addWithEpsilonRaw(je(e),je(t)),r)},this.unaryMinus=e=>ze(e,-je(e)),this.unaryPlus=e=>e,this.unaryPercent=e=>new Qe(je(e)/100),this.concat=(e,t)=>e.concat(t),this.nonstrictadd=(e,t)=>e instanceof Tr?e:t instanceof Tr?t:"number"==typeof e?"number"==typeof t?this.addWithEpsilonRaw(e,t):e:"number"==typeof t?t:0,this.subtract=(e,t)=>{const r=nn(e,t),n=je(e);let s=n-je(t);return Math.abs(s)<this.actualEps*Math.abs(n)&&(s=0),this.ExtendedNumberFactory(s,r)},this.divide=(e,t)=>{const r=je(e),n=je(t);if(0===n)return new Tr(ir.DIV_BY_ZERO);{const s=sn(e,t);return this.ExtendedNumberFactory(r/n,s)}},this.multiply=(e,t)=>{const r=sn(e,t);return this.ExtendedNumberFactory(je(e)*je(t),r)},this.manyToExactComplex=e=>{const t=[];for(const r of e){if(r instanceof Tr)return r;if(Ze(r)||"string"==typeof r){const e=this.coerceScalarToComplex(r);e instanceof Tr||t.push(e)}}return t},this.coerceNumbersExactRanges=e=>this.manyToNumbers(e,this.manyToExactNumbers),this.coerceNumbersCoerceRangesDropNulls=e=>this.manyToNumbers(e,this.manyToCoercedNumbersDropNulls),this.manyToExactNumbers=e=>{const t=[];for(const r of e){if(r instanceof Tr)return r;Ze(r)&&t.push(je(r))}return t},this.manyToOnlyNumbersDropNulls=e=>{const t=[];for(const r of e){if(r instanceof Tr)return r;if(Ze(r))t.push(je(r));else if(r!==Ye)return new Tr(ir.VALUE,Z.NumberExpected)}return t},this.manyToCoercedNumbersDropNulls=e=>{const t=[];for(const r of e){if(r instanceof Tr)return r;if(r===Ye)continue;const e=this.coerceScalarToNumberOrError(r);Ze(e)&&t.push(je(e))}return t},this.collator=
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function(e){const t=e.caseSensitive?e.accentSensitive?"variant":"case":e.accentSensitive?"accent":"base",r=e.caseFirst,n=e.ignorePunctuation;return new Intl.Collator(e.localeLang,{sensitivity:t,caseFirst:r,ignorePunctuation:n})}(e),this.actualEps=e.smartRounding?e.precisionEpsilon:0}eqMatcherFunction(e){const t=this.buildRegex(e);return e=>"string"==typeof e&&t.test(this.normalizeString(e))}neqMatcherFunction(e){const t=this.buildRegex(e);return e=>!("string"==typeof e&&t.test(this.normalizeString(e)))}searchString(e,t){var r;const n=this.buildRegex(e,!1).exec(t);return null!==(r=null==n?void 0:n.index)&&void 0!==r?r:-1}requiresRegex(e){if(!this.config.useRegularExpressions&&!this.config.useWildcards)return!this.config.matchWholeCell;for(let t=0;t<e.length;t++){const r=e.charAt(t);if(en(r)||this.config.useRegularExpressions&&rn(r))return!0}return!1}floatCmp(e,t){const r=je(e),n=je(t),s=1+this.actualEps;return n>=0&&r*s>=n&&r<=n*s||n<=0&&r*s<=n&&r>=n*s?0:r>n?1:-1}coerceScalarToNumberOrError(e){var t;return e instanceof Tr?e:null!==(t=this.coerceToMaybeNumber(e))&&void 0!==t?t:new Tr(ir.VALUE,Z.NumberCoercion)}coerceToMaybeNumber(e){var t;return null!==(t=this.coerceNonDateScalarToMaybeNumber(e))&&void 0!==t?t:"string"==typeof e?this.dateTimeHelper.dateStringToDateNumber(e):void 0}coerceNonDateScalarToMaybeNumber(e){if(e===Ye)return 0;if("string"==typeof e){if(""===e)return 0;const t=this.coerceStringToMaybePercentNumber(e);if(void 0!==t)return t;const r=this.coerceStringToMaybeCurrencyNumber(e);return void 0!==r?r:this.numberLiteralsHelper.numericStringToMaybeNumber(e.trim())}return Ze(e)?e:"boolean"==typeof e?Number(e):void 0}coerceStringToMaybePercentNumber(e){const t=e.trim();if(t.endsWith("%")){const e=t.slice(0,t.length-1).trim(),r=this.numberLiteralsHelper.numericStringToMaybeNumber(e);if(void 0!==r)return new Qe(r/100)}}coerceStringToMaybeCurrencyNumber(e){const t=this.currencyMatcher(e.trim());if(void 0!==t){const[e,r]=t,n=this.numberLiteralsHelper.numericStringToMaybeNumber(r);if(void 0!==n)return new Ke(n,e)}}currencyMatcher(e){for(const t of this.config.currencySymbol){if(e.startsWith(t))return[t,e.slice(t.length).trim()];if(e.endsWith(t))return[t,e.slice(0,e.length-t.length).trim()]}}coerceComplexExactRanges(e){const t=[];for(const r of e)if(r instanceof rt)t.push(r);else if(r!==Ye){const e=this.coerceScalarToComplex(r);if(e instanceof Tr)return e;t.push(e)}const r=[];for(const e of t)if(e instanceof rt){const t=this.manyToExactComplex(e.valuesFromTopLeftCorner());if(t instanceof Tr)return t;r.push(...t)}else r.push(e);return r}coerceScalarToComplex(e){return e instanceof Tr?e:e===Ye?[0,0]:Ze(e)?[je(e),0]:"string"==typeof e?this.coerceStringToComplex(e):new Tr(ir.NUM,Z.ComplexNumberExpected)}ExtendedNumberFactory(e,t){const{type:r,format:n}=t;switch(r){case Je.NUMBER_RAW:return e;case Je.NUMBER_CURRENCY:return new Ke(e,null!=n?n:this.config.currencySymbol[0]);case Je.NUMBER_DATE:return new $e(e,n);case Je.NUMBER_DATETIME:return new qe(e,n);case Je.NUMBER_TIME:return new Xe(e,n);case Je.NUMBER_PERCENT:return new Qe(e,n)}}buildRegex(e,t=!0){let r;e=this.normalizeString(e);let n=this.config.useWildcards,s=this.config.useRegularExpressions;if(s)try{RegExp(e)}catch(e){s=!1,n=!1}return r=s?function(e,t){let r="";for(let n=0;n<e.length;n++){const s=e.charAt(n);en(s)||rn(s)?r+=s:r+=t?s:s.toLowerCase()}return r}(e,this.config.caseSensitive):n?function(e,t){let r="";for(let n=0;n<e.length;n++){const s=e.charAt(n);if("~"===s){if(n==e.length-1){r+="~";continue}const t=e.charAt(n+1);en(t)||rn(t)?(r+="\\"+t,n++):(r+=t,n++)}else en(s)?r+="."+s:rn(s)?r+="\\"+s:r+=t?s:s.toLowerCase()}return r}(e,this.config.caseSensitive):function(e,t){let r="";for(let n=0;n<e.length;n++){const s=e.charAt(n);en(s)||rn(s)?r+="\\"+s:r+=t?s:s.toLowerCase()}return r}(e,this.config.caseSensitive),this.config.matchWholeCell&&t?RegExp("^("+r+")$"):RegExp(r)}normalizeString(e){return this.config.caseSensitive||(e=e.toLowerCase()),this.config.accentSensitive||(e=ln(e,"nfd").replace(/[\u0300-\u036f]/g,"")),e}compare(e,t){if("string"==typeof e||"string"
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var hn;!function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.BOOLEAN="BOOLEAN",e.SCALAR="SCALAR",e.NOERROR="NOERROR",e.RANGE="RANGE",e.INTEGER="INTEGER",e.COMPLEX="COMPLEX",e.ANY="ANY"}(hn||(hn={}));class un{constructor(e){this.coerceScalarToNumberOrError=e=>this.arithmeticHelper.coerceScalarToNumberOrError(e),this.runFunction=(e,t,r,n)=>{const s=this.evaluateArguments(e,t,r),i=s.map((([e,t])=>e)),o=s.map((([e,t])=>t)),a=this.buildMetadataForEachArgumentValue(i.length,r),l=t.arraysFlag&&!r.vectorizationForbidden;if(!this.isNumberOfArgumentValuesValid(a,i.length))return new Tr(ir.NA,Z.WrongArgNumber);const[h,u]=l?this.calculateSizeOfVectorizedResultArray(i,a):[1,1];if(1===h&&1===u){const e=this.vectorizeAndBroadcastArgumentsIfNecessary(l,i,a,0,0);return this.calculateSingleCellOfResultArray(t,e,a,o,n,r.returnNumberType)}const c=[...Array(h).keys()].map((e=>[...Array(u).keys()].map((s=>{const h=this.vectorizeAndBroadcastArgumentsIfNecessary(l,i,a,e,s),u=this.calculateSingleCellOfResultArray(t,h,a,o,n,r.returnNumberType);if(u instanceof rt)throw new Error("Function returning array cannot be vectorized.");return u}))));return rt.onlyValues(c)},this.runFunctionWithReferenceArgument=(e,t,r,n,s,i=()=>new Tr(ir.NA,Z.CellRefExpected))=>{if(0===e.length)return this.returnNumberWrapper(n(),r.returnNumberType);if(e.length>1)return new Tr(ir.NA,Z.WrongArgNumber);let o,a=e[0];for(;a.type===U.PARENTHESIS;)a=a.expression;if(a.type===U.CELL_REFERENCE)o=a.reference.toSimpleCellAddress(t.formulaAddress);else if(a.type===U.CELL_RANGE||a.type===U.COLUMN_RANGE||a.type===U.ROW_RANGE)try{o=Fr.fromAst(a,t.formulaAddress).start}catch(e){return new Tr(ir.REF,Z.CellRefExpected)}return void 0!==o?this.returnNumberWrapper(s(o),r.returnNumberType):this.runFunction(e,t,r,i)},this.interpreter=e,this.dependencyGraph=e.dependencyGraph,this.columnSearch=e.columnSearch,this.config=e.config,this.serialization=e.serialization,this.arraySizePredictor=e.arraySizePredictor,this.dateTimeHelper=e.dateTimeHelper,this.arithmeticHelper=e.arithmeticHelper}evaluateAst(e,t){return this.interpreter.evaluateAst(e,t)}arraySizeForAst(e,t){return this.arraySizePredictor.checkArraySizeForAst(e,t)}listOfScalarValues(e,t){const r=[];for(const n of e){const e=this.evaluateAst(n,t);if(e instanceof rt)for(const t of e.valuesFromTopLeftCorner())r.push([t,!0]);else r.push([e,!1])}return r}coerceToType(e,t,r){let n;if(e instanceof rt)switch(t.argumentType){case hn.RANGE:case hn.ANY:n=e;break;default:{const t=an(e,r);if(void 0===t)return;e=t}}if(!(e instanceof rt))switch(t.argumentType){case hn.INTEGER:case hn.NUMBER:const r=this.coerceScalarToNumberOrError(e);if(!Ze(r)){n=r;break}const s=je(r);if(void 0!==t.maxValue&&s>t.maxValue)return new Tr(ir.NUM,Z.ValueLarge);if(void 0!==t.minValue&&s<t.minValue)return new Tr(ir.NUM,Z.ValueSmall);if(void 0!==t.lessThan&&s>=t.lessThan)return new Tr(ir.NUM,Z.ValueLarge);if(void 0!==t.greaterThan&&s<=t.greaterThan)return new Tr(ir.NUM,Z.ValueSmall);if(t.argumentType===hn.INTEGER&&!Number.isInteger(s))return new Tr(ir.NUM,Z.IntegerExpected);n=r;break;case hn.STRING:n=Xr(e);break;case hn.BOOLEAN:n=Kr(e);break;case hn.SCALAR:case hn.NOERROR:case hn.ANY:n=e;break;case hn.RANGE:if(e instanceof Tr)return e;n=Gr(e);break;case hn.COMPLEX:return this.arithmeticHelper.coerceScalarToComplex(je(e))}return t.passSubtype||void 0===n?n:je(n)}calculateSingleCellOfResultArray(e,t,r,n,s,i){const o=this.coerceArgumentsToRequiredTypes(e,t,r,n);if(o instanceof Tr)return o;const a=s(...o);return this.returnNumberWrapper(a,i)}coerceArgumentsToRequiredTypes(e,t,r,n){const s=[];for(let i=0;i<r.length;i++){const o=r[i],a=void 0!==t[i]?t[i]:null==o?void 0:o.defaultValue;if(void 0===a){s.push(void 0);continue}const l=this.coerceToType(a,o,e);if(void 0===l&&!n[i])return new Tr(ir.VALUE,Z.WrongType);if(l instanceof Tr&&o.argumentType!==hn.SCALAR)return l;s.push(l)}return s}vectorizeAndBroadcastArgumentsIfNecessary(e,t,r,n,s){return t.map(((t,i)=>e&&this.isRangePassedAsAScalarArgument(t,r[i])?this.vectorizeAndBroadcastRangeArgument(t,n,s):t))}vectorizeAndBroadcastRangeArgument(e,t
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class cn{constructor(e,t,r=!1){this.width=e,this.height=t,this.isRef=r}static error(){return new cn(1,1,!0)}static scalar(){return new cn(1,1,!1)}isScalar(){return 1===this.width&&1===this.height||this.isRef}}class dn{constructor(e,t){this.config=e,this.functionRegistry=t}checkArraySize(e,t){return this.checkArraySizeForAst(e,{formulaAddress:t,arraysFlag:this.config.useArrayArithmetic})}checkArraySizeForAst(e,t){switch(e.type){case U.FUNCTION_CALL:return this.checkArraySizeForFunction(e,t);case U.COLUMN_RANGE:case U.ROW_RANGE:case U.CELL_RANGE:{const r=Fr.fromAstOrUndef(e,t.formulaAddress);return void 0===r?cn.error():new cn(r.width(),r.height(),!0)}case U.ARRAY:{const r=[],n=[];for(const s of e.args){const e=s.map((e=>this.checkArraySizeForAst(e,t))),i=Math.min(...e.map((e=>e.height))),o=e.reduce(((e,t)=>e+t.width),0);r.push(i),n.push(o)}const s=r.reduce(((e,t)=>e+t),0),i=Math.min(...n);return new cn(i,s)}case U.STRING:case U.NUMBER:return cn.scalar();case U.CELL_REFERENCE:return new cn(1,1,!0);case U.DIV_OP:case U.CONCATENATE_OP:case U.EQUALS_OP:case U.GREATER_THAN_OP:case U.GREATER_THAN_OR_EQUAL_OP:case U.LESS_THAN_OP:case U.LESS_THAN_OR_EQUAL_OP:case U.MINUS_OP:case U.NOT_EQUAL_OP:case U.PLUS_OP:case U.POWER_OP:case U.TIMES_OP:{const r=this.checkArraySizeForAst(e.left,t),i=this.checkArraySizeForAst(e.right,t);return!t.arraysFlag&&(r.height>1||r.width>1||i.height>1||i.width>1)?cn.error():(n=r,s=i,new cn(Math.max(n.width,s.width),Math.max(n.height,s.height)))}case U.MINUS_UNARY_OP:case U.PLUS_UNARY_OP:case U.PERCENT_OP:{const n=this.checkArraySizeForAst(e.value,t);return!t.arraysFlag&&(n.height>1||n.width>1)?cn.error():new cn((r=n).width,r.height)}case U.PARENTHESIS:return this.checkArraySizeForAst(e.expression,t);case U.EMPTY:default:return cn.error()}var r,n,s}checkArraySizeForFunction(e,t){const r=this.functionRegistry.getArraySizeFunction(e.procedureName);if(void 0!==r)return r(e,t);const n=this.functionRegistry.getMetadata(e.procedureName);if(void 0===n||n.expandRanges||!t.arraysFlag||n.vectorizationForbidden||void 0===n.parameters)return new cn(1,1);const s=e.args.map((e=>{var r;return this.checkArraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(r=null==n?void 0:n.arrayFunction)&&void 0!==r&&r))})),i=[...n.parameters];if(void 0!==n.repeatLastArgs&&i.length<s.length&&(s.length-i.length)%n.repeatLastArgs!=0)return cn.error();for(;i.length<s.length;){if(void 0===n.repeatLastArgs)return cn.error();i.push(...i.slice(i.length-n.repeatLastArgs))}let o=1,a=1;for(let e=0;e<s.length;e++)i[e].argumentType!==hn.RANGE&&i[e].argumentType!==hn.ANY&&(a=Math.max(a,s[e].height),o=Math.max(o,s[e].width));return new cn(o,a)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class pn{constructor(e,t,r){var n;this.value=t,this.address=r,this.type=e.type,this.message=null!==(n=e.message)&&void 0!==n?n:""}toString(){return this.value}valueOf(){return this.value}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function gn(e,t,r){if(void 0===e)return Ki.defaultConfig[r];if("string"==typeof t){if(typeof e===t)return e;throw new Tt(t,r)}if(t.includes(e))return e;throw new bt(t.map((e=>`'${e}'`)).join(" "),r)}function fn(e,t,r){if(e<r)throw new Mt(t,r)}function mn(e,t,r,n){if(t(e))return e;if(void 0===e)return Ki.defaultConfig[n];throw new Tt(r,n)}function yn(...e){const t=new Map;e.forEach((e=>{const r=t.get(e.value)||[];r.push(e.name),t.set(e.value,r)}));const r=[];for(const e of t.values())e.length>1&&r.push(e);if(r.length>0){r.forEach((e=>e.sort()));const e=r.map((e=>`[${e}]`)).join("; ");throw new Error(`Config initialization failed. Parameters in conflict: ${e}`)}}function En(e,t,r){if(typeof e!==t)throw new Tt(t,r)}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const wn=new RegExp("^ss(\\.(s+|0+))?$"),Cn=new RegExp("^[0-9/.\\-: ]+[ap]?m?$"),vn=new RegExp("\\s+"),Rn=new RegExp("[ /.-]"),Sn=1e3,Tn=bn((function(e){const t=e.toLowerCase().trim(),r=(t.endsWith("am/pm")?t.substring(0,t.length-5):t.endsWith("a/p")?t.substring(0,e.length-3):t).trim().split(":");return{itemsCount:r.length,hourItem:r.indexOf("hh"),minuteItem:r.indexOf("mm"),secondItem:r.findIndex((e=>wn.test(e)))}})),Nn=bn((function(e){const t=e.toLowerCase().trim().split(Rn);return{itemsCount:t.length,dayItem:t.indexOf("dd"),monthItem:t.indexOf("mm"),shortYearItem:t.indexOf("yy"),longYearItem:t.indexOf("yyyy")}}));function Mn(e,t){var r,n,s;if(void 0===t)return;const{itemsCount:i,hourItem:o,minuteItem:a,secondItem:l}=Tn(t);let h;if("am"===e[e.length-1]||"a"===e[e.length-1]?(h=!1,e.pop()):"pm"!==e[e.length-1]&&"p"!==e[e.length-1]||(h=!0,e.pop()),e.length!==i)return;const u=Number(null!==(r=e[l])&&void 0!==r?r:"0");if(!Number.isFinite(u))return;const c=Math.round(u*Sn)/Sn,d=Number(null!==(n=e[a])&&void 0!==n?n:"0");if(!Number.isFinite(d)||!Number.isInteger(d))return;const p=Number(null!==(s=e[o])&&void 0!==s?s:"0");if(!Number.isFinite(p)||!Number.isInteger(p))return;if(void 0!==h&&(p<0||p>12))return;return{hours:void 0!==h?p%12+(h?12:0):p,minutes:d,seconds:c}}function _n(e,t){var r;if(void 0===t)return;const{itemsCount:n,dayItem:s,monthItem:i,shortYearItem:o,longYearItem:a}=Nn(t);if(e.length!==n)return;const l=Number(e[s]);if(!Number.isFinite(l)||!Number.isInteger(l))return;const h=Number(e[i]);if(!Number.isFinite(h)||!Number.isInteger(h))return;if(e[a]&&e[o])return;const u=Number(null!==(r=e[a])&&void 0!==r?r:e[o]);return Number.isFinite(u)&&Number.isInteger(u)&&!(e[a]&&(u<1e3||u>9999)||e[o]&&(u<0||u>99))?{year:u,month:h,day:l}:void 0}function bn(e){const t={};return r=>{const n=t[r];if(void 0!==n)return n;const s=e(r);return t[r]=s,s}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const An=[31,28,31,30,31,30,31,31,30,31,30,31],On=[0,31,59,90,120,151,181,212,243,273,304,334],In=60,xn=60,Pn=24;function Ln(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&("year"in e&&"number"==typeof e.year&&"month"in e&&"number"==typeof e.month&&"day"in e&&"number"==typeof e.day)}function Dn(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&("hours"in e&&"number"==typeof e.hours&&"minutes"in e&&"number"==typeof e.minutes&&"seconds"in e&&"number"==typeof e.seconds)}const kn={year:9999,month:12,day:31};class Hn{constructor(e){this.config=e,this.minDateAbsoluteValue=this.dateToNumberFromZero(e.nullDate),this.maxDateValue=this.dateToNumber(kn),this.leapYear1900=e.leapYear1900,!this.leapYear1900&&0<=this.dateToNumber({year:1900,month:2,day:28})?this.epochYearZero=this.numberToSimpleDate(2).year:this.epochYearZero=this.numberToSimpleDate(1).year,this.parseDateTime=e.parseDateTime}getWithinBounds(e){return e<=this.maxDateValue&&e>=0?e:void 0}dateStringToDateNumber(e){const{dateTime:t,dateFormat:r="",timeFormat:n=""}=this.parseDateTimeFromConfigFormats(e);if(void 0!==t)return Dn(t)?Ln(t)?new qe(Bn(t)+this.dateToNumber(t),r+" "+n):new Xe(Bn(t),n):Ln(t)?new $e(this.dateToNumber(t),r):0}parseDateTimeFromConfigFormats(e){return this.parseDateTimeFromFormats(e,this.config.dateFormats,this.config.timeFormats)}getNullYear(){return this.config.nullYear}getEpochYearZero(){return this.epochYearZero}isValidDate(e){return!(isNaN(e.year)||isNaN(e.month)||isNaN(e.day))&&(e.day===Math.round(e.day)&&e.month===Math.round(e.month)&&e.year===Math.round(e.year)&&(!(e.year<1582)&&(!(e.month<1||e.month>12)&&(!(e.day<1)&&(this.isLeapYear(e.year)&&2===e.month?e.day<=29:e.day<=An[e.month-1])))))}dateToNumber(e){return this.dateToNumberFromZero(e)-this.minDateAbsoluteValue}relativeNumberToAbsoluteNumber(e){return e+this.minDateAbsoluteValue-(this.leapYear1900?1:0)}numberToSimpleDate(e){const t=Math.floor(e)+this.minDateAbsoluteValue;let r=Math.floor(t/365.2425);this.dateToNumberFromZero({year:r+1,month:1,day:1})<=t?r++:this.dateToNumberFromZero({year:r-1,month:1,day:1})>t&&r--;const n=t-this.dateToNumberFromZero({year:r,month:1,day:1}),s=function(e){let t=0;On[t+6]<=e&&(t+=6);On[t+3]<=e&&(t+=3);On[t+2]<=e?t+=2:On[t+1]<=e&&(t+=1);return t}(n-(this.isLeapYear(r)&&n>=59?1:0));return{year:r,month:s+1,day:n-On[s]-(this.isLeapYear(r)&&s>1?1:0)+1}}numberToSimpleDateTime(e){const t=Vn(e%1),r=Math.floor(t.hours/Pn);t.hours=t.hours%Pn;const n=this.numberToSimpleDate(Math.floor(e)+r);return Object.assign(Object.assign({},n),t)}leapYearsCount(e){return Math.floor(e/4)-Math.floor(e/100)+Math.floor(e/400)+(this.config.leapYear1900&&e>=1900?1:0)}daysInMonth(e,t){return this.isLeapYear(e)&&2===t?29:An[t-1]}endOfMonth(e){return{year:e.year,month:e.month,day:this.daysInMonth(e.year,e.month)}}toBasisUS(e,t){return 31===e.day&&(e.day=30),30===e.day&&31===t.day&&(t.day=30),2===e.month&&e.day===this.daysInMonth(e.year,e.month)&&(e.day=30,2===t.month&&t.day===this.daysInMonth(t.year,t.month)&&(t.day=30)),[e,t]}yearLengthForBasis(e,t){return e.year!==t.year?e.year+1!==t.year||e.month<t.month||e.month===t.month&&e.day<t.day?(this.leapYearsCount(t.year)-this.leapYearsCount(e.year-1))/(t.year-e.year+1)+365:this.countLeapDays(t)!==this.countLeapDays({year:e.year,month:e.month,day:e.day-1})?366:365:this.isLeapYear(e.year)?366:365}parseSingleFormat(e,t,r){const n=this.parseDateTime(e,t,r);if(!Ln(n)||(n.year>=0&&n.year<100&&(n.year<this.getNullYear()?n.year+=2e3:n.year+=1900),this.isValidDate(n)))return n}parseDateTimeFromFormats(e,t,r){const n=0===t.length?[void 0]:t,s=0===r.length?[void 0]:r;for(const t of n)for(const r of s){const n=this.parseSingleFormat(e,t,r);if(void 0!==n)return{dateTime:n,timeFormat:r,dateFormat:t}}return{}}countLeapDays(e){return e.month>2||2===e.month&&e.day>=29?this.leapYearsCount(e.year):this.leapYearsCount(e.year-1)}dateToNumberFromZero(e){return 365*e.year+On[e.month-1]+e.day-1+(e.month<=2?this.leapYearsCount(e.year-1):this.leapYearsCount(e.year))}isLeapYear(e){return!(e%4)&&(!!(e%100)||(!(e%400)||1900===e&&this.config.leapYear1900
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const Yn=/(\\.|dd|DD|d|D|mm|MM|m|M|YYYY|YY|yyyy|yy|HH|hh|H|h|ss(\.(0+|s+))?|s|AM\/PM|am\/pm|A\/P|a\/p|\[mm]|\[MM]|\[hh]|\[HH])/g,jn=/(\\.|[#0]+(\.[#0]*)?)/g;var Gn,zn;function $n(e,t){return{type:e,value:t}}function Kn(e,t){const r=[];let n=0;for(let s=0;s<e.length;++s){const i=e[s];if(i.index!==n){const e=t.substr(n,i.index-n);r.push($n(Gn.FREE_TEXT,e))}i[0].startsWith("\\")?r.push($n(Gn.FREE_TEXT,i[0])):r.push($n(Gn.FORMAT,i[0])),n=i.index+i[0].length}const s=e[e.length-1];if(s.index+s[0].length<t.length){const e=t.substr(s.index+s[0].length,t.length);r.push($n(Gn.FREE_TEXT,e))}return r}function Xn(e){const t=function(e){Yn.lastIndex=0;const t=[];let r;do{r=Yn.exec(e),null!==r&&t.push(r)}while(r);return t}(e);return t.every((e=>Qn(e)))?void 0:{type:zn.DATE,tokens:Kn(t,e)}}function qn(e){const t=function(e){jn.lastIndex=0;const t=jn.exec(e);return null!==t?[t]:[]}(e);return t.every((e=>Qn(e)))?void 0:{type:zn.NUMBER,tokens:Kn(t,e)}}function Qn(e){return e[0].startsWith("\\")}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function Zn(e,t,r,n){const s=r.stringifyDateTime(n.numberToSimpleDateTime(e),t);if(void 0!==s)return s;const i=r.stringifyDuration(Vn(e),t);if(void 0!==i)return i;const o=qn(t);return void 0!==o?function(e,t){let r="";for(let n=0;n<e.length;++n){const s=e[n];if(s.type===Gn.FREE_TEXT){r+=s.value;continue}const i=s.value.split("."),o=i[0],a=i[1]||"",l=i[1]?".":"",h=Number(t.toFixed(a.length)).toString().split(".");let u=h[0]||"",c=h[1]||"";if(o.length>u.length){u=Jn(u,ts(o.substr(0,o.length-u.length),"0")+u.length)}c=es(c,ts(a.substr(c.length,a.length-c.length),"0")+c.length),r+=u+l+c}return r}(o.tokens,e):t}function Jn(e,t){let r=`${e}`;for(;r.length<t;)r="0"+r;return r}function es(e,t){let r=`${e}`;for(;r.length<t;)r+="0";return r}function ts(e,t){return e.split(t).length-1}!function(e){e.FORMAT="FORMAT",e.FREE_TEXT="FREE_TEXT"}(Gn||(Gn={})),function(e){e.DATE="DATE",e.NUMBER="NUMBER",e.STRING="STRING"}(zn||(zn={}));
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const rs="length",ns=e=>parseInt(e,16),ss=e=>parseInt(e,10),is=e=>(e+"").replace(/\-/g,""),os=(e,t,r)=>e.substr(t,r),as=e=>e.codePointAt(0)-65;
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const ls={invalid:()=>"The license key for HyperFormula is invalid.",expired:({keyValidityDate:e})=>`The license key for HyperFormula expired on ${e}, and is not valid for the installed version.`,missing:()=>"The license key for HyperFormula is missing."};let hs=!1;function us(e){const t={template:"missing",vars:{}};if("gpl-v3"===e||"internal-use-in-handsontable"===e)t.template="valid";else if("string"==typeof e&&function(e){if((e=(e+"").replace(/\-/g,""))[rs]!==as("Z"))return!1;let t=0;return[[0,as("G")+1],[as("H"),as("H")-1],[as("G")+as("H"),as("G")]].reduce(((r,[n,s],i)=>(r|=(ss(`${ss(ns(os(e,t+n-(0===i?0:2),s+(i?2:0)))+(ns(os(e,t+n+s,2))+[]).padStart(2,"0"))}`)%97||2)>>1,t+=2,r)),as("A"))===[]+1>>1}(e)){const[n,s,i]="10/04/2024".split("/"),o=Math.floor(new Date(`${s}/${n}/${i}`).getTime()/864e5),a=25===is(r=e)[rs]?ns(os(is(r),ns("12"),as("F")))/(ns(os(is(r),as("C"),as("Y")>>4))||1+(![][rs]<<3)):0;t.vars.keyValidityDate=function(e){const t=["January","February","March","April","May","June","July","August","September","October","November","December"][e.getMonth()],r=e.getDate(),n=e.getFullYear();return`${t} ${r}, ${n}`}(new Date(864e5*(a+1))),t.template=o>a?"expired":"valid"}else""!==e&&(t.template="invalid");var r;return hs||"valid"===t.template||(console.warn(ls[t.template](t.vars)),hs=!0),t.template}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var cs,ds,ps;!function(e){e.Number=class{constructor(e){this.value=e,this.value=ze(this.value,Jr(je(this.value)))}};e.String=class{constructor(e){this.value=e}};e.Boolean=class{constructor(e){this.value=e}};class t{static getSingletonInstance(){return t.instance||(t.instance=new t),t.instance}}e.Empty=t;e.Formula=class{constructor(e){this.formula=e}};e.Error=class{constructor(e,t){this.value=new Tr(e,t)}}}(cs||(cs={}));class gs{constructor(e,t,r){this.config=e,this.dateHelper=t,this.numberLiteralsHelper=r}parse(e){if(null==e)return cs.Empty.getSingletonInstance();if("number"==typeof e)return Zr(e)?new cs.Error(ir.NUM,Z.ValueLarge):new cs.Number(e);if("boolean"==typeof e)return new cs.Boolean(e);if(e instanceof Date){const t=this.dateHelper.dateToNumber({day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear()})+Bn({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()+e.getMilliseconds()/1e3});return t<0?new cs.Error(ir.NUM,Z.DateBounds):t%1==0?new cs.Number(new $e(t,"Date()")):t<1?new cs.Number(new Xe(t,"Date()")):new cs.Number(new qe(t,"Date()"))}if("string"==typeof e){if(function(e){const t=e.toLowerCase();return"true"===t||"false"===t}(e))return new cs.Boolean("true"===e.toLowerCase());if(e.startsWith("="))return new cs.Formula(e);if(function(e,t){const r=e.toUpperCase();return/#[A-Za-z0-9\/]+[?!]?/.test(r)&&Object.prototype.hasOwnProperty.call(t,r)}(e,this.config.errorMapping))return new cs.Error(this.config.errorMapping[e.toUpperCase()]);{let t,r=e.trim(),n=0;if(r.endsWith("%"))n=1,r=r.slice(0,r.length-1);else{const e=this.currencyMatcher(r);void 0!==e&&(n=2,[t,r]=e)}const s=this.numberLiteralsHelper.numericStringToMaybeNumber(r);if(void 0!==s){let e;return e=1===n?new Qe(s/100):2===n?new Ke(s,t):s,new cs.Number(e)}const i=this.dateHelper.dateStringToDateNumber(r);return void 0!==i?new cs.Number(i):new cs.String(e.startsWith("'")?e.slice(1):e)}}throw new St(e)}currencyMatcher(e){for(const t of this.config.currencySymbol){if(e.startsWith(t))return[t,e.slice(t.length)];if(e.endsWith(t))return[t,e.slice(0,e.length-t.length)]}}}!function(e){e[e.COPY=0]="COPY",e[e.CUT=1]="CUT"}(ds||(ds={})),function(e){e[e.VALUE=0]="VALUE",e[e.EMPTY=1]="EMPTY",e[e.FORMULA=2]="FORMULA",e[e.PARSING_ERROR=3]="PARSING_ERROR"}(ps||(ps={}));class fs{constructor(e,t,r,n,s){this.sourceLeftCorner=e,this.width=t,this.height=r,this.type=n,this.content=s}*getContent(e){if(void 0!==this.content)for(let t=0;t<this.height;++t)for(let r=0;r<this.width;++r)yield[Ar(e.sheet,e.col+r,e.row+t),this.content[t][r]]}}class ms{constructor(e,t,r){this.dependencyGraph=t,this.operations=r,this.maxRows=e.maxRows,this.maxColumns=e.maxColumns}cut(e,t,r){this.clipboard=new fs(e,t,r,ds.CUT)}copy(e,t,r){const n=[];for(let s=0;s<r;++s){n[s]=[];for(let r=0;r<t;++r){const t=this.operations.getClipboardCell(Ar(e.sheet,e.col+r,e.row+s));n[s].push(t)}}this.clipboard=new fs(e,t,r,ds.COPY,n)}abortCut(){this.clipboard&&this.clipboard.type===ds.CUT&&this.clear()}clear(){this.clipboard=void 0}ensureItIsPossibleToCopyPaste(e){if(void 0===this.clipboard)return;if(Or(e)||!this.dependencyGraph.sheetMapping.hasSheetWithId(e.sheet))throw new gt("a valid target address.");const t=Fr.spanFrom(e,this.clipboard.width,this.clipboard.height);if(t.exceedsSheetSizeLimits(this.maxColumns,this.maxRows))throw new ct;if(this.dependencyGraph.arrayMapping.isFormulaArrayInRange(t))throw new Error("It is not possible to paste onto an array")}isCutClipboard(){return void 0!==this.clipboard&&this.clipboard.type===ds.CUT}isCopyClipboard(){return void 0!==this.clipboard&&this.clipboard.type===ds.COPY}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ys{constructor(e,t,r,n){this.displayName=e,this.address=t,this.added=r,this.options=n}normalizeExpressionName(){return this.displayName.toLowerCase()}copy(){return new ys(this.displayName,this.address,this.added,this.options)}}class Es{constructor(){this.mapping=new Map}has(e){return this.mapping.has(this.normalizeExpressionName(e))}isNameAvailable(e){const t=this.normalizeExpressionName(e),r=this.mapping.get(t);return!(r&&r.added)}add(e){this.mapping.set(e.normalizeExpressionName(),e)}get(e){return this.mapping.get(this.normalizeExpressionName(e))}getExisting(e){const t=this.mapping.get(this.normalizeExpressionName(e));return t&&t.added?t:void 0}remove(e){const t=this.normalizeExpressionName(e),r=this.mapping.get(t);r&&(r.added=!1)}getAllNamedExpressions(){return Array.from(this.mapping.values()).filter((e=>e.added))}normalizeExpressionName(e){return e.toLowerCase()}}class ws{constructor(){this.mapping=new Map}add(e){this.mapping.set(this.normalizeExpressionName(e.displayName),e)}get(e){return this.mapping.get(this.normalizeExpressionName(e))}has(e){return this.mapping.has(this.normalizeExpressionName(e))}getAllNamedExpressions(){return Array.from(this.mapping.values()).filter((e=>e.added))}isNameAvailable(e){const t=this.normalizeExpressionName(e);return!this.mapping.has(t)}remove(e){const t=this.normalizeExpressionName(e);this.mapping.get(t)&&this.mapping.delete(t)}normalizeExpressionName(e){return e.toLowerCase()}}class Cs{constructor(){this.nextNamedExpressionRow=0,this.workbookStore=new Es,this.worksheetStores=new Map,this.addressCache=new Map}isNameAvailable(e,t){var r,n;return void 0===t?this.workbookStore.isNameAvailable(e):null===(n=null===(r=this.worksheetStore(t))||void 0===r?void 0:r.isNameAvailable(e))||void 0===n||n}namedExpressionInAddress(e){const t=this.addressCache.get(e);return t&&t.added?t:void 0}namedExpressionForScope(e,t){var r;return void 0===t?this.workbookStore.getExisting(e):null===(r=this.worksheetStore(t))||void 0===r?void 0:r.get(e)}nearestNamedExpression(e,t){var r,n;return null!==(n=null===(r=this.worksheetStore(t))||void 0===r?void 0:r.get(e))&&void 0!==n?n:this.workbookStore.getExisting(e)}isExpressionInScope(e,t){var r,n;return null!==(n=null===(r=this.worksheetStore(t))||void 0===r?void 0:r.has(e))&&void 0!==n&&n}isNameValid(e){const t=new RegExp(`^${f}$`),r=new RegExp(`^${E}$`),n=new RegExp(`^${C}$`);return!t.test(e)&&!r.test(e)&&n.test(e)}addNamedExpression(e,t,r){const n=void 0===t?this.workbookStore:this.worksheetStoreOrCreate(t);let s=n.get(e);return void 0!==s?(s.added=!0,s.displayName=e,s.options=r):(s=new ys(e,this.nextAddress(),!0,r),n.add(s)),this.addressCache.set(s.address.row,s),s}restoreNamedExpression(e,t){const r=void 0===t?this.workbookStore:this.worksheetStoreOrCreate(t);return e.added=!0,r.add(e),this.addressCache.set(e.address.row,e),e}namedExpressionOrPlaceholder(e,t){var r;return null!==(r=this.worksheetStoreOrCreate(t).get(e))&&void 0!==r?r:this.workbookNamedExpressionOrPlaceholder(e)}workbookNamedExpressionOrPlaceholder(e){let t=this.workbookStore.get(e);return void 0===t&&(t=new ys(e,this.nextAddress(),!1),this.workbookStore.add(t)),t}remove(e,t){let r;r=void 0===t?this.workbookStore:this.worksheetStore(t);const n=null==r?void 0:r.get(e);if(void 0===r||void 0===n||!n.added)throw Error("Named expression does not exist");r.remove(e),r instanceof ws&&0===r.mapping.size&&this.worksheetStores.delete(t),this.addressCache.delete(n.address.row)}getAllNamedExpressionsNamesInScope(e){return this.getAllNamedExpressions().filter((({scope:t})=>t===e)).map((e=>e.expression.displayName))}getAllNamedExpressionsNames(){return this.getAllNamedExpressions().map((e=>e.expression.displayName))}getAllNamedExpressions(){const e=[];return this.workbookStore.getAllNamedExpressions().forEach((t=>{e.push({expression:t,scope:void 0})})),this.worksheetStores.forEach(((t,r)=>{t.getAllNamedExpressions().forEach((t=>{e.push({expression:t,scope:r})}))})),e}getAllNamedExpressionsForScope(e){var t,r;return void 0===e?this.workbookStore.getAllNamedExpressions():null!==(r=null===(t=this.wor
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Rs{performEagerTransformations(e,t){for(const r of e.arrayFormulaNodes()){const[n,s]=this.transformSingleAst(r.getFormula(e.lazilyTransformingAstService),r.getAddress(e.lazilyTransformingAstService)),i=t.rememberNewAst(n);r.setFormula(i),r.setAddress(s)}}transformSingleAst(e,t){return[this.transformAst(e,t),this.fixNodeAddress(t)]}transformAst(e,t){switch(e.type){case U.CELL_REFERENCE:return this.transformCellReferenceAst(e,t);case U.CELL_RANGE:return this.transformCellRangeAst(e,t);case U.COLUMN_RANGE:return this.transformColumnRangeAst(e,t);case U.ROW_RANGE:return this.transformRowRangeAst(e,t);case U.EMPTY:case U.ERROR:case U.NUMBER:case U.NAMED_EXPRESSION:case U.ERROR_WITH_RAW_INPUT:case U.STRING:return e;case U.PERCENT_OP:case U.MINUS_UNARY_OP:case U.PLUS_UNARY_OP:return Object.assign(Object.assign({},e),{value:this.transformAst(e.value,t)});case U.FUNCTION_CALL:return Object.assign(Object.assign({},e),{procedureName:e.procedureName,args:e.args.map((e=>this.transformAst(e,t)))});case U.PARENTHESIS:return Object.assign(Object.assign({},e),{expression:this.transformAst(e.expression,t)});case U.ARRAY:return Object.assign(Object.assign({},e),{args:e.args.map((e=>e.map((e=>this.transformAst(e,t)))))});default:return Object.assign(Object.assign({},e),{left:this.transformAst(e.left,t),right:this.transformAst(e.right,t)})}}transformCellReferenceAst(e,t){const r=this.transformCellAddress(e.reference,t);return r instanceof l?Object.assign(Object.assign({},e),{reference:r}):r===ir.REF?j(new Tr(ir.REF)):e}transformCellRangeAst(e,t){const r=this.transformCellRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===ir.REF?j(new Tr(ir.REF)):e}transformColumnRangeAst(e,t){const r=this.transformColumnRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===ir.REF?j(new Tr(ir.REF)):e}transformRowRangeAst(e,t){const r=this.transformRowRange(e.start,e.end,t);return Array.isArray(r)?Object.assign(Object.assign({},e),{start:r[0],end:r[1]}):r===ir.REF?j(new Tr(ir.REF)):e}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ss extends Rs{constructor(e){super(),this.columnsSpan=e}get sheet(){return this.columnsSpan.sheet}isIrreversible(){return!1}transformRowRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){throw Error("Not implemented")}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformCellAddress(e,t){const r=Lr(e,t);if(r!==this.columnsSpan.sheet&&t.sheet!==this.columnsSpan.sheet)return!1;const n=e.toSimpleColumnAddress(t);if(r===this.columnsSpan.sheet&&t.sheet!==this.columnsSpan.sheet)return this.columnsSpan.columnStart<=n.col&&e.shiftedByColumns(this.columnsSpan.numberOfColumns);if(t.sheet===this.columnsSpan.sheet&&r!==this.columnsSpan.sheet)return!e.isColumnAbsolute()&&(!(t.col<this.columnsSpan.columnStart)&&e.shiftedByColumns(-this.columnsSpan.numberOfColumns));if(e.isColumnAbsolute())return!(e.col<this.columnsSpan.columnStart)&&e.shiftedByColumns(this.columnsSpan.numberOfColumns);return e.toSimpleColumnAddress(t).col<this.columnsSpan.columnStart?!(t.col<this.columnsSpan.columnStart)&&e.shiftedByColumns(-this.columnsSpan.numberOfColumns):t.col<this.columnsSpan.columnStart&&e.shiftedByColumns(this.columnsSpan.numberOfColumns)}fixNodeAddress(e){return this.columnsSpan.sheet===e.sheet&&this.columnsSpan.columnStart<=e.col?Object.assign(Object.assign({},e),{col:e.col+this.columnsSpan.numberOfColumns}):e}transformRange(e,t,r){const n=this.transformCellAddress(e,r),s=this.transformCellAddress(t,r);return n===ir.REF||s===ir.REF?ir.REF:!(!n&&!s)&&[n||e,s||t]}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ts extends Rs{constructor(e){super(),this.rowsSpan=e}get sheet(){return this.rowsSpan.sheet}isIrreversible(){return!1}transformColumnRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){throw Error("Not implemented")}transformCellAddress(e,t){const r=Lr(e,t);if(r!==this.rowsSpan.sheet&&t.sheet!==this.rowsSpan.sheet)return!1;const n=e.toSimpleRowAddress(t);return r===this.rowsSpan.sheet&&t.sheet!==this.rowsSpan.sheet?this.rowsSpan.rowStart<=n.row&&e.shiftedByRows(this.rowsSpan.numberOfRows):t.sheet===this.rowsSpan.sheet&&r!==this.rowsSpan.sheet?!e.isRowAbsolute()&&(!(t.row<this.rowsSpan.rowStart)&&e.shiftedByRows(-this.rowsSpan.numberOfRows)):e.isRowAbsolute()?!(e.row<this.rowsSpan.rowStart)&&e.shiftedByRows(this.rowsSpan.numberOfRows):n.row<this.rowsSpan.rowStart?!(t.row<this.rowsSpan.rowStart)&&e.shiftedByRows(-this.rowsSpan.numberOfRows):t.row<this.rowsSpan.rowStart&&e.shiftedByRows(this.rowsSpan.numberOfRows)}fixNodeAddress(e){return this.rowsSpan.sheet===e.sheet&&this.rowsSpan.rowStart<=e.row?Object.assign(Object.assign({},e),{row:e.row+this.rowsSpan.numberOfRows}):e}transformRange(e,t,r){const n=this.transformCellAddress(e,r),s=this.transformCellAddress(t,r);return n===ir.REF||s===ir.REF?ir.REF:!(!n&&!s)&&[n||e,s||t]}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ns extends Rs{constructor(e){super(),this.sheet=e}isIrreversible(){return!0}fixNodeAddress(e){return e}transformCellAddress(e,t){return!!e.isInvalid(t)&&ir.REF}transformCellRange(e,t,r){return!(!e.isInvalid(r)&&!t.isInvalid(r))&&ir.REF}transformColumnRange(e,t,r){return!(!e.isInvalid(r)&&!t.isInvalid(r))&&ir.REF}transformRowRange(e,t,r){return!(!e.isInvalid(r)&&!t.isInvalid(r))&&ir.REF}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ms extends Rs{constructor(e,t,r,n){super(),this.sourceRange=e,this.toRight=t,this.toBottom=r,this.toSheet=n,this.dependentFormulaTransformer=new _s(e,t,r,n)}get sheet(){return this.sourceRange.sheet}isIrreversible(){return!0}transformSingleAst(e,t){if(this.sourceRange.addressInRange(t)){return[this.transformAst(e,t),this.fixNodeAddress(t)]}return this.dependentFormulaTransformer.transformSingleAst(e,t)}fixNodeAddress(e){return Ar(this.toSheet,e.col+this.toRight,e.row+this.toBottom)}transformCellAddress(e,t){return this.transformAddress(e,t)}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformAddress(e,t){const r=this.sourceRange;if(e instanceof l){const n=e.toSimpleCellAddress(t);if(r.addressInRange(n))return e.shiftAbsoluteDimensions(this.toRight,this.toBottom)}return e.shiftRelativeDimensions(-this.toRight,-this.toBottom)}transformRange(e,t,r){const n=this.sourceRange;if(e instanceof l&&t instanceof l){const s=e.toSimpleCellAddress(r),i=t.toSimpleCellAddress(r);if(n.addressInRange(s)&&n.addressInRange(i))return[e.shiftAbsoluteDimensions(this.toRight,this.toBottom),t.shiftAbsoluteDimensions(this.toRight,this.toBottom)]}return[e.shiftRelativeDimensions(-this.toRight,-this.toBottom),t.shiftRelativeDimensions(-this.toRight,-this.toBottom)]}}class _s extends Rs{constructor(e,t,r,n){super(),this.sourceRange=e,this.toRight=t,this.toBottom=r,this.toSheet=n}get sheet(){return this.sourceRange.sheet}isIrreversible(){return!0}fixNodeAddress(e){return e}transformCellAddress(e,t){return!!this.shouldMove(e,t)&&e.moved(this.toSheet,this.toRight,this.toBottom)}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}shouldMove(e,t){return e instanceof l?this.sourceRange.addressInRange(e.toSimpleCellAddress(t)):e instanceof a?this.sourceRange.rowInRange(e.toSimpleRowAddress(t))&&!this.sourceRange.isFinite():this.sourceRange.columnInRange(e.toSimpleColumnAddress(t))&&!this.sourceRange.isFinite()}transformRange(e,t,r){const n=this.transformCellAddress(e,r),s=this.transformCellAddress(t,r);return!(!n||!s)&&[n,s]}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class bs extends Rs{constructor(e){super(),this.columnsSpan=e}get sheet(){return this.columnsSpan.sheet}isIrreversible(){return!0}transformRowRangeAst(e,t){return e}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){throw Error("Not implemented")}transformColumnRange(e,t,r){return this.transformRange(e,t,r)}transformCellAddress(e,t){const r=Lr(e,t);if(this.columnsSpan.sheet!==t.sheet&&this.columnsSpan.sheet!==r)return!1;if(this.columnsSpan.sheet!==t.sheet&&this.columnsSpan.sheet===r){const r=e.toSimpleColumnAddress(t);if(r.col<this.columnsSpan.columnStart)return!1;if(r.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns)}if(this.columnsSpan.sheet===t.sheet&&this.columnsSpan.sheet!==r){if(e.isColumnAbsolute())return!1;if(t.col<this.columnsSpan.columnStart)return!1;if(t.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(this.columnsSpan.numberOfColumns)}if(this.columnsSpan.sheet===t.sheet&&this.columnsSpan.sheet===r)if(e.isColumnAbsolute()){if(e.col<this.columnsSpan.columnStart)return!1;if(e.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns)}else{const r=e.toSimpleColumnAddress(t);if(r.col<this.columnsSpan.columnStart){if(t.col<this.columnsSpan.columnStart)return!1;if(t.col>this.columnsSpan.columnEnd)return e.shiftedByColumns(this.columnsSpan.numberOfColumns)}else if(r.col>this.columnsSpan.columnEnd){if(t.col<this.columnsSpan.columnStart)return e.shiftedByColumns(-this.columnsSpan.numberOfColumns);if(t.col>this.columnsSpan.columnEnd)return!1}}return ir.REF}fixNodeAddress(e){return this.columnsSpan.sheet===e.sheet&&this.columnsSpan.columnStart<=e.col?Object.assign(Object.assign({},e),{col:e.col-this.columnsSpan.numberOfColumns}):e}transformRange(e,t,r){const n=Lr(e,r);let s=e,i=t;if(this.columnsSpan.sheet===n){const n=e.toSimpleColumnAddress(r),o=t.toSimpleColumnAddress(r);if(this.columnsSpan.columnStart<=n.col&&this.columnsSpan.columnEnd>=o.col)return ir.REF;n.col>=this.columnsSpan.columnStart&&n.col<=this.columnsSpan.columnEnd&&(s=e.shiftedByColumns(this.columnsSpan.columnEnd-n.col+1)),o.col>=this.columnsSpan.columnStart&&o.col<=this.columnsSpan.columnEnd&&(i=t.shiftedByColumns(-(o.col-this.columnsSpan.columnStart+1)))}const o=this.transformCellAddress(s,r),a=this.transformCellAddress(i,r);if(!1===o&&!1===a)return[s,i];if(o===ir.REF||a===ir.REF)throw Error("Cannot happen");return[o||s,a||i]}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class As extends Rs{constructor(e){super(),this.rowsSpan=e}get sheet(){return this.rowsSpan.sheet}isIrreversible(){return!0}transformColumnRangeAst(e,t){return e}transformCellAddress(e,t){const r=Lr(e,t);if(this.rowsSpan.sheet!==t.sheet&&this.rowsSpan.sheet!==r)return!1;if(this.rowsSpan.sheet!==t.sheet&&this.rowsSpan.sheet===r){const r=e.toSimpleRowAddress(t);if(r.row<this.rowsSpan.rowStart)return!1;if(r.row>this.rowsSpan.rowEnd)return e.shiftedByRows(-this.rowsSpan.numberOfRows)}if(this.rowsSpan.sheet===t.sheet&&this.rowsSpan.sheet!==r){if(e.isRowAbsolute())return!1;if(t.row<this.rowsSpan.rowStart)return!1;if(t.row>this.rowsSpan.rowEnd)return e.shiftedByRows(this.rowsSpan.numberOfRows)}if(this.rowsSpan.sheet===t.sheet&&this.rowsSpan.sheet===r)if(e.isRowAbsolute()){if(e.row<this.rowsSpan.rowStart)return!1;if(e.row>this.rowsSpan.rowEnd)return e.shiftedByRows(-this.rowsSpan.numberOfRows)}else{const r=e.toSimpleRowAddress(t);if(r.row<this.rowsSpan.rowStart){if(t.row<this.rowsSpan.rowStart)return!1;if(t.row>this.rowsSpan.rowEnd)return e.shiftedByRows(this.rowsSpan.numberOfRows)}else if(r.row>this.rowsSpan.rowEnd){if(t.row<this.rowsSpan.rowStart)return e.shiftedByRows(-this.rowsSpan.numberOfRows);if(t.row>this.rowsSpan.rowEnd)return!1}}return ir.REF}transformCellRange(e,t,r){return this.transformRange(e,t,r)}transformRowRange(e,t,r){return this.transformRange(e,t,r)}transformColumnRange(e,t,r){throw Error("Not implemented")}fixNodeAddress(e){return this.rowsSpan.sheet===e.sheet&&this.rowsSpan.rowStart<=e.row?Object.assign(Object.assign({},e),{row:e.row-this.rowsSpan.numberOfRows}):e}transformRange(e,t,r){const n=Lr(e,r);let s=e,i=t;if(this.rowsSpan.sheet===n){const n=e.toSimpleRowAddress(r),o=t.toSimpleRowAddress(r);if(this.rowsSpan.rowStart<=n.row&&this.rowsSpan.rowEnd>=o.row)return ir.REF;n.row>=this.rowsSpan.rowStart&&n.row<=this.rowsSpan.rowEnd&&(s=e.shiftedByRows(this.rowsSpan.rowEnd-n.row+1)),o.row>=this.rowsSpan.rowStart&&o.row<=this.rowsSpan.rowEnd&&(i=t.shiftedByRows(-(o.row-this.rowsSpan.rowStart+1)))}const o=this.transformCellAddress(s,r),a=this.transformCellAddress(i,r);return!1===o&&!1===a?[s,i]:o===ir.REF||a===ir.REF?ir.REF:[o||s,a||i]}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Os extends Rs{constructor(e){super(),this.sheet=e}isIrreversible(){return!0}performEagerTransformations(e,t){for(const t of e.arrayFormulaNodes()){const[r]=this.transformSingleAst(t.getFormula(e.lazilyTransformingAstService),t.getAddress(e.lazilyTransformingAstService));t.setFormula(r)}}fixNodeAddress(e){return e}transformCellAddress(e,t){return this.transformAddress(e)}transformCellRange(e,t,r){return this.transformAddress(e)}transformColumnRange(e,t,r){return this.transformAddress(e)}transformRowRange(e,t,r){return this.transformAddress(e)}transformAddress(e){return e.sheet===this.sheet&&ir.REF}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function Is(e){if(!Array.isArray(e))throw new gt("an array of arrays.");for(let t=0;t<e.length;t++)if(!Array.isArray(e[t]))throw new gt("an array of arrays.")}function xs(e){let t=0,r=0,n=0;for(let s=0;s<e.length;s++){let i=0;for(let t=0;t<e[s].length;t++){const r=e[s][t];null!=r&&(i=t+1,++n)}t=Math.max(t,i),i>0&&(r=s+1)}const s=t*r;return{height:r,width:t,fill:0===s?0:n/s}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ps{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return Fs(this.indexes)}rowsSpans(){return this.normalizedIndexes().map((e=>st.fromNumberOfRows(this.sheet,e[0],e[1])))}}class Ls{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return Us(this.indexes)}rowsSpans(){return this.normalizedIndexes().map((e=>st.fromNumberOfRows(this.sheet,e[0],e[1])))}}class Ds{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return Us(this.indexes)}columnsSpans(){return this.normalizedIndexes().map((e=>it.fromNumberOfColumns(this.sheet,e[0],e[1])))}}class ks{constructor(e,t){this.sheet=e,this.indexes=t}normalizedIndexes(){return Fs(this.indexes)}columnsSpans(){return this.normalizedIndexes().map((e=>it.fromNumberOfColumns(this.sheet,e[0],e[1])))}}class Hs{constructor(e,t,r,n,s,i,o,a,l){this.dependencyGraph=t,this.columnSearch=r,this.cellContentParser=n,this.parser=s,this.stats=i,this.lazilyTransformingAstService=o,this.namedExpressions=a,this.arraySizePredictor=l,this.changes=nt.empty(),this.allocateNamedExpressionAddressSpace(),this.maxColumns=e.maxColumns,this.maxRows=e.maxRows}get sheetMapping(){return this.dependencyGraph.sheetMapping}get addressMapping(){return this.dependencyGraph.addressMapping}removeRows(e){const t=[];for(const r of e.rowsSpans()){const e=this.doRemoveRows(r);e&&t.push(e)}return t}addRows(e){for(const t of e.rowsSpans())this.doAddRows(t)}addColumns(e){for(const t of e.columnsSpans())this.doAddColumns(t)}removeColumns(e){const t=[];for(const r of e.columnsSpans()){const e=this.doRemoveColumns(r);e&&t.push(e)}return t}removeSheet(e){this.dependencyGraph.removeSheet(e);let t=0;this.stats.measure(et.TRANSFORM_ASTS,(()=>{const r=new Os(e);r.performEagerTransformations(this.dependencyGraph,this.parser),t=this.lazilyTransformingAstService.addTransformation(r)})),this.sheetMapping.removeSheet(e),this.columnSearch.removeSheet(e);const r=this.namedExpressions.getAllNamedExpressionsForScope(e).map((t=>this.removeNamedExpression(t.normalizeExpressionName(),e)));return{version:t,scopedNamedExpressions:r}}removeSheetByName(e){const t=this.sheetMapping.fetch(e);return this.removeSheet(t)}clearSheet(e){this.dependencyGraph.clearSheet(e),this.columnSearch.removeSheet(e)}addSheet(e){const t=this.sheetMapping.addSheet(e);return this.dependencyGraph.addressMapping.autoAddSheet(t,xs([])),this.sheetMapping.fetchDisplayName(t)}renameSheet(e,t){return this.sheetMapping.renameSheet(e,t)}moveRows(e,t,r,n){const s=st.fromNumberOfRows(e,n,r);this.lazilyTransformingAstService.beginCombinedMode(e),this.doAddRows(s),n<t&&(t+=r);const i=Ar(e,0,t),o=Ar(e,0,n);this.moveCells(i,Number.POSITIVE_INFINITY,r,o);const a=st.fromNumberOfRows(e,t,r);return this.doRemoveRows(a),this.lazilyTransformingAstService.commitCombinedMode()}moveColumns(e,t,r,n){const s=it.fromNumberOfColumns(e,n,r);this.lazilyTransformingAstService.beginCombinedMode(e),this.doAddColumns(s),n<t&&(t+=r);const i=Ar(e,t,0),o=Ar(e,n,0);this.moveCells(i,r,Number.POSITIVE_INFINITY,o);const a=it.fromNumberOfColumns(e,t,r);return this.doRemoveColumns(a),this.lazilyTransformingAstService.commitCombinedMode()}moveCells(e,t,r,n){this.ensureItIsPossibleToMoveCells(e,t,r,n);const s=Fr.spanFrom(e,t,r),i=Fr.spanFrom(n,t,r),o=n.col-e.col,a=n.row-e.row,l=n.sheet,h=this.getRangeClipboardCells(i),u=this.dependencyGraph.rawValuesFromRange(i);this.columnSearch.removeValues(u);const c=this.dependencyGraph.rawValuesFromRange(s);this.columnSearch.moveValues(c,o,a,l);let d=0;this.stats.measure(et.TRANSFORM_ASTS,(()=>{const e=new Ms(s,o,a,l);e.performEagerTransformations(this.dependencyGraph,this.parser),d=this.lazilyTransformingAstService.addTransformation(e)})),this.dependencyGraph.moveCells(s,o,a,l);const p=this.updateNamedExpressionsForMovedCells(e,t,r,n);return{version:d,overwrittenCellsData:h,addedGlobalNamedExpressions:p}}setRowOrder(e,t){const r=[];let n=[];for(const[s,i]of t)if(s!==i){const t=Fr.spanFrom({sheet:e,col:0,row:s},1/0,1),o=this.getRangeClipboardCells(t);n=n.concat(o),r.push(o.map((([{sheet:e,col:t},r])=>[{sheet:e,col:t,row:i},r])))}ret
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Bs{}class Ws extends Bs{constructor(e,t){super(),this.command=e,this.rowsRemovals=t}doUndo(e){e.undoRemoveRows(this)}doRedo(e){e.redoRemoveRows(this)}}class Ys extends Bs{constructor(e,t,r,n,s,i,o){super(),this.sourceLeftCorner=e,this.width=t,this.height=r,this.destinationLeftCorner=n,this.overwrittenCellsData=s,this.addedGlobalNamedExpressions=i,this.version=o}doUndo(e){e.undoMoveCells(this)}doRedo(e){e.redoMoveCells(this)}}class js extends Bs{constructor(e){super(),this.command=e}doUndo(e){e.undoAddRows(this)}doRedo(e){e.redoAddRows(this)}}class Gs extends Bs{constructor(e,t,r){super(),this.sheetId=e,this.rowMapping=t,this.oldContent=r}doUndo(e){e.undoSetRowOrder(this)}doRedo(e){e.redoSetRowOrder(this)}}class zs extends Bs{constructor(e,t,r){super(),this.sheetId=e,this.columnMapping=t,this.oldContent=r}doUndo(e){e.undoSetColumnOrder(this)}doRedo(e){e.redoSetColumnOrder(this)}}class $s extends Bs{constructor(e,t,r){super(),this.sheetId=e,this.oldSheetContent=t,this.newSheetContent=r}doUndo(e){e.undoSetSheetContent(this)}doRedo(e){e.redoSetSheetContent(this)}}class Ks extends Bs{constructor(e,t,r,n,s){super(),this.sheet=e,this.startRow=t,this.numberOfRows=r,this.targetRow=n,this.version=s,this.undoStart=this.startRow<this.targetRow?this.targetRow-this.numberOfRows:this.targetRow,this.undoEnd=this.startRow>this.targetRow?this.startRow+this.numberOfRows:this.startRow}doUndo(e){e.undoMoveRows(this)}doRedo(e){e.redoMoveRows(this)}}class Xs extends Bs{constructor(e,t,r,n,s){super(),this.sheet=e,this.startColumn=t,this.numberOfColumns=r,this.targetColumn=n,this.version=s,this.undoStart=this.startColumn<this.targetColumn?this.targetColumn-this.numberOfColumns:this.targetColumn,this.undoEnd=this.startColumn>this.targetColumn?this.startColumn+this.numberOfColumns:this.startColumn}doUndo(e){e.undoMoveColumns(this)}doRedo(e){e.redoMoveColumns(this)}}class qs extends Bs{constructor(e){super(),this.command=e}doUndo(e){e.undoAddColumns(this)}doRedo(e){e.redoAddColumns(this)}}class Qs extends Bs{constructor(e,t){super(),this.command=e,this.columnsRemovals=t}doUndo(e){e.undoRemoveColumns(this)}doRedo(e){e.redoRemoveColumns(this)}}class Zs extends Bs{constructor(e){super(),this.sheetName=e}doUndo(e){e.undoAddSheet(this)}doRedo(e){e.redoAddSheet(this)}}class Js extends Bs{constructor(e,t,r,n,s){super(),this.sheetName=e,this.sheetId=t,this.oldSheetContent=r,this.scopedNamedExpressions=n,this.version=s}doUndo(e){e.undoRemoveSheet(this)}doRedo(e){e.redoRemoveSheet(this)}}class ei extends Bs{constructor(e,t,r){super(),this.sheetId=e,this.oldName=t,this.newName=r}doUndo(e){e.undoRenameSheet(this)}doRedo(e){e.redoRenameSheet(this)}}class ti extends Bs{constructor(e,t){super(),this.sheetId=e,this.oldSheetContent=t}doUndo(e){e.undoClearSheet(this)}doRedo(e){e.redoClearSheet(this)}}class ri extends Bs{constructor(e){super(),this.cellContents=e}doUndo(e){e.undoSetCellContents(this)}doRedo(e){e.redoSetCellContents(this)}}class ni extends Bs{constructor(e,t,r,n){super(),this.targetLeftCorner=e,this.oldContent=t,this.newContent=r,this.addedGlobalNamedExpressions=n}doUndo(e){e.undoPaste(this)}doRedo(e){e.redoPaste(this)}}class si extends Bs{constructor(e,t,r,n){super(),this.name=e,this.newContent=t,this.scope=r,this.options=n}doUndo(e){e.undoAddNamedExpression(this)}doRedo(e){e.redoAddNamedExpression(this)}}class ii extends Bs{constructor(e,t,r){super(),this.namedExpression=e,this.content=t,this.scope=r}doUndo(e){e.undoRemoveNamedExpression(this)}doRedo(e){e.redoRemoveNamedExpression(this)}}class oi extends Bs{constructor(e,t,r,n,s){super(),this.namedExpression=e,this.newContent=t,this.oldContent=r,this.scope=n,this.options=s}doUndo(e){e.undoChangeNamedExpression(this)}doRedo(e){e.redoChangeNamedExpression(this)}}class ai extends Bs{constructor(){super(...arguments),this.operations=[]}add(e){this.operations.push(e)}*reversedOperations(){for(let e=this.operations.length-1;e>=0;e--)yield this.operations[e]}doUndo(e){e.undoBatch(this)}doRedo(e){e.redoBatch(this)}}class li{constructor(e,t){this.operations=t,this.oldData=new Map,this.undoStack=[],thi
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class hi{constructor(e,t,r,n,s,i,o,a,l,h){this.operations=t,this.undoRedo=r,this.clipboardOperations=n,this.dependencyGraph=s,this.columnSearch=i,this.parser=o,this.cellContentParser=a,this.lazilyTransformingAstService=l,this.namedExpressions=h,this.maxRows=e.maxRows,this.maxColumns=e.maxColumns}get sheetMapping(){return this.dependencyGraph.sheetMapping}addRows(e,...t){const r=new Ls(e,t);this.ensureItIsPossibleToAddRows(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.operations.addRows(r),this.undoRedo.saveOperation(new js(r))}removeRows(e,...t){const r=new Ps(e,t);this.ensureItIsPossibleToRemoveRows(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const n=this.operations.removeRows(r);this.undoRedo.saveOperation(new Ws(r,n))}addColumns(e,...t){const r=new Ds(e,t);this.ensureItIsPossibleToAddColumns(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut(),this.operations.addColumns(r),this.undoRedo.saveOperation(new qs(r))}removeColumns(e,...t){const r=new ks(e,t);this.ensureItIsPossibleToRemoveColumns(e,...t),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const n=this.operations.removeColumns(r);this.undoRedo.saveOperation(new Qs(r,n))}moveCells(e,t,r,n){this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const{version:s,overwrittenCellsData:i,addedGlobalNamedExpressions:o}=this.operations.moveCells(e,t,r,n);this.undoRedo.saveOperation(new Ys(e,t,r,n,i,o,s))}moveRows(e,t,r,n){this.ensureItIsPossibleToMoveRows(e,t,r,n),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const s=this.operations.moveRows(e,t,r,n);this.undoRedo.saveOperation(new Ks(e,t,r,n,s))}moveColumns(e,t,r,n){this.ensureItIsPossibleToMoveColumns(e,t,r,n),this.undoRedo.clearRedoStack();const s=this.operations.moveColumns(e,t,r,n);this.undoRedo.saveOperation(new Xs(e,t,r,n,s))}cut(e,t,r){this.clipboardOperations.cut(e,t,r)}ensureItIsPossibleToCopy(e,t,r){if(!ui(t))throw new gt("width to be positive integer.");if(!ui(r))throw new gt("height to be positive integer.")}copy(e,t,r){this.ensureItIsPossibleToCopy(e,t,r),this.clipboardOperations.copy(e,t,r)}paste(e){const t=this.clipboardOperations.clipboard;if(void 0===t)throw new vt;if(this.clipboardOperations.isCutClipboard())this.moveCells(t.sourceLeftCorner,t.width,t.height,e);else if(this.clipboardOperations.isCopyClipboard()){this.clipboardOperations.ensureItIsPossibleToCopyPaste(e);const r=Fr.spanFrom(e,t.width,t.height),n=this.operations.getRangeClipboardCells(r);this.undoRedo.clearRedoStack();const s=this.operations.restoreClipboardCells(t.sourceLeftCorner.sheet,t.getContent(e));this.undoRedo.saveOperation(new ni(e,n,t.content,s))}}beginUndoRedoBatchMode(){this.undoRedo.beginBatchMode()}commitUndoRedoBatchMode(){this.undoRedo.commitBatchMode()}isClipboardEmpty(){return void 0===this.clipboardOperations.clipboard}clearClipboard(){this.clipboardOperations.clear()}addSheet(e){void 0!==e&&this.ensureItIsPossibleToAddSheet(e),this.undoRedo.clearRedoStack();const t=this.operations.addSheet(e);return this.undoRedo.saveOperation(new Zs(t)),t}removeSheet(e){this.ensureScopeIdIsValid(e),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const t=this.sheetMapping.fetchDisplayName(e),r=this.operations.getSheetClipboardCells(e),{version:n,scopedNamedExpressions:s}=this.operations.removeSheet(e);this.undoRedo.saveOperation(new Js(t,e,r,s,n))}renameSheet(e,t){this.ensureItIsPossibleToRenameSheet(e,t);const r=this.operations.renameSheet(e,t);return void 0!==r&&(this.undoRedo.clearRedoStack(),this.undoRedo.saveOperation(new ei(e,r,t))),r}clearSheet(e){this.ensureScopeIdIsValid(e),this.undoRedo.clearRedoStack(),this.clipboardOperations.abortCut();const t=this.operations.getSheetClipboardCells(e);this.operations.clearSheet(e),this.undoRedo.saveOperation(new ti(e,t))}setCellContents(e,t){if(t instanceof Array){for(let e=0;e<t.length;e++)if(!(t[e]instanceof Array))throw new gt("an array of arrays or a raw cell value.")}else t=[[t]];this.ensureItIsPossibleToChangeCellContents(e,t),
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class di{constructor(e,t,r,n,s,i){this.config=e,this.stats=t,this.interpreter=r,this.lazilyTransformingAstService=n,this.dependencyGraph=s,this.columnSearch=i}run(){this.stats.start(et.TOP_SORT);const{sorted:e,cycled:t}=this.dependencyGraph.topSortWithScc();this.stats.end(et.TOP_SORT),this.stats.measure(et.EVALUATION,(()=>{this.recomputeFormulas(t,e)}))}partialRun(e){const t=nt.empty();return this.stats.measure(et.EVALUATION,(()=>{this.dependencyGraph.graph.getTopSortedWithSccSubgraphFrom(e,(e=>{if(e instanceof Gt){const r=e.isComputed()?e.getCellValue():void 0,n=this.recomputeFormulaVertexValue(e);if(n!==r){const s=e.getAddress(this.lazilyTransformingAstService);return t.addChange(n,s),this.columnSearch.change(je(r),je(n),s),!0}return!1}return!(e instanceof Kt)||(e.clearCache(),!0)}),(e=>{if(e instanceof Kt)e.clearCache();else if(e instanceof Gt){const r=e.getAddress(this.lazilyTransformingAstService);this.columnSearch.remove(je(e.valueOrUndef()),r);const n=new Tr(ir.CYCLE,void 0,e);e.setCellValue(n),t.addChange(n,r)}}))})),t}runAndForget(e,t,r){const n=[];for(const e of We(r,t))if(e instanceof Fr){const t=e;if(void 0===this.dependencyGraph.getRange(t.start,t.end)){const e=new Kt(t);this.dependencyGraph.rangeMapping.setRange(e),n.push(e)}}const s=this.evaluateAstToCellValue(e,new Br(t,this.config.useArrayArithmetic));return n.forEach((e=>{this.dependencyGraph.rangeMapping.removeRange(e)})),s}recomputeFormulas(e,t){e.forEach((e=>{e instanceof Gt&&e.setCellValue(new Tr(ir.CYCLE,void 0,e))})),t.forEach((e=>{if(e instanceof Gt){const t=this.recomputeFormulaVertexValue(e),r=e.getAddress(this.lazilyTransformingAstService);this.columnSearch.add(je(t),r)}else e instanceof Kt&&e.clearCache()}))}recomputeFormulaVertexValue(e){const t=e.getAddress(this.lazilyTransformingAstService);if(e instanceof zt&&(e.array.size.isRef||!this.dependencyGraph.isThereSpaceForArray(e)))return e.setNoSpace();{const r=e.getFormula(this.lazilyTransformingAstService),n=this.evaluateAstToCellValue(r,new Br(t,this.config.useArrayArithmetic,e));return e.setCellValue(n)}}evaluateAstToCellValue(e,t){const r=this.interpreter.evaluateAst(e,t);return r instanceof rt?r:r===Ye&&this.config.evaluateNullToZero?0:r}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class pi{constructor(e,t){this.address=e,this.newValue=t}get col(){return this.address.col}get row(){return this.address.row}get sheet(){return this.address.sheet}get value(){return this.newValue}}class gi{constructor(e,t){this.name=e,this.newValue=t}}class fi{constructor(e,t,r,n){this.config=e,this.namedExpressions=t,this.sheetIndexMapping=r,this.lazilyTransformingService=n}exportChange(e){const t=e.value,r=e.address;if(r.sheet===Cs.SHEET_FOR_WORKBOOK_EXPRESSIONS){const e=this.namedExpressions.namedExpressionInAddress(r.row);if(!e)throw new Error("Missing named expression");return new gi(e.displayName,this.exportScalarOrRange(t))}if(t instanceof rt){const e=[];for(const[n,s]of t.entriesFromTopLeftCorner(r))e.push(new pi(s,this.exportValue(n)));return e}return new pi(r,this.exportValue(t))}exportValue(e){return e instanceof rt?this.detailedError(new Tr(ir.VALUE,Z.ScalarExpected)):this.config.smartRounding&&Ze(e)?this.cellValueRounding(je(e)):e instanceof Tr?this.detailedError(e):e===Ye?null:je(e)}exportScalarOrRange(e){return e instanceof rt?e.rawData().map((e=>e.map((e=>this.exportValue(e))))):this.exportValue(e)}detailedError(e){var t,r;let n;const s=null===(t=e.root)||void 0===t?void 0:t.getAddress(this.lazilyTransformingService);return void 0!==s&&(n=s.sheet===Cs.SHEET_FOR_WORKBOOK_EXPRESSIONS?null===(r=this.namedExpressions.namedExpressionInAddress(s.row))||void 0===r?void 0:r.displayName:I(this.sheetIndexMapping,s,-1)),new pn(e,this.config.translationPackage.getErrorTranslation(e.type),n)}cellValueRounding(e){if(0===e)return e;const t=Math.floor(Math.log10(Math.abs(e))),r=Math.pow(10,this.config.precisionRounding-t);return e<0?-Math.round(-e*r)/r:Math.round(e*r)/r}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class mi{constructor(e,t,r,n,s,i){this.dependencyGraph=e,this.columnSearch=t,this.parser=r,this.cellContentParser=n,this.stats=s,this.arraySizePredictor=i,this.buildStrategy=new yi(e,t,r,s,n,i)}buildGraph(e,t){const r=t.measure(et.COLLECT_DEPENDENCIES,(()=>this.buildStrategy.run(e)));this.dependencyGraph.getAndClearContentChanges(),t.measure(et.PROCESS_DEPENDENCIES,(()=>this.processDependencies(r)))}processDependencies(e){e.forEach(((e,t)=>{this.dependencyGraph.processCellDependencies(e,t)}))}}class yi{constructor(e,t,r,n,s,i){this.dependencyGraph=e,this.columnIndex=t,this.parser=r,this.stats=n,this.cellContentParser=s,this.arraySizePredictor=i}run(e){const t=new Map;for(const r in e){const n=this.dependencyGraph.getSheetId(r),s=e[r];for(let e=0;e<s.length;++e){const r=s[e];for(let s=0;s<r.length;++s){const i=r[s],o=Ar(n,s,e),a=this.cellContentParser.parse(i);if(a instanceof cs.Formula){const e=this.stats.measure(et.PARSER,(()=>this.parser.parse(a.formula,o)));if(e.errors.length>0){this.shrinkArrayIfNeeded(o);const t=new pr(e.errors,a.formula);this.dependencyGraph.addVertex(o,t)}else{this.shrinkArrayIfNeeded(o);const r=this.arraySizePredictor.checkArraySize(e.ast,o);if(r.isScalar()){const r=new $t(e.ast,o,0);t.set(r,We(e.dependencies,o)),this.dependencyGraph.addVertex(o,r),e.hasVolatileFunction&&this.dependencyGraph.markAsVolatile(r),e.hasStructuralChangeFunction&&this.dependencyGraph.markAsDependentOnStructureChange(r)}else{const n=new zt(e.ast,o,new cn(r.width,r.height));t.set(n,We(e.dependencies,o)),this.dependencyGraph.addArrayVertex(o,n)}}}else if(a instanceof cs.Empty);else{this.shrinkArrayIfNeeded(o);const e=new dr(a.value,i);this.columnIndex.add(je(a.value),o),this.dependencyGraph.addVertex(o,e)}}}}return t}shrinkArrayIfNeeded(e){const t=this.dependencyGraph.getCell(e);t instanceof zt&&this.dependencyGraph.shrinkArrayToCorner(t)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const Ei=new Map([["gpl-v3",1],["missing",2],["invalid",3],["expired",4]]);class wi extends un{version(e,t){return this.runFunction(e.args,t,this.metadata("VERSION"),(()=>{const{licenseKeyValidityState:e,licenseKey:t}=this.config;let r;return Ei.has(t)?r=Ei.get(t):Ei.has(e)?r=Ei.get(e):"valid"===e&&(r=t.slice(-5)),`HyperFormula v${zi.version}, ${r}`}))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function Ci(e,t){var r;let n=t.implementedFunctions[e];const s=null===(r=t.aliases)||void 0===r?void 0:r[e];if(void 0!==s){if(void 0!==n)throw new Ut(e,t.name);n=t.implementedFunctions[s]}if(void 0===n)throw Lt.functionNotDeclaredInPlugin(e,t.name);return n}wi.implementedFunctions={VERSION:{method:"version",parameters:[]}};class vi{constructor(e){if(this.config=e,this.functions=new Map,this.arraySizeFunctions=new Map,this.volatileFunctions=new Set,this.arrayFunctions=new Set,this.structuralChangeFunctions=new Set,this.functionsWhichDoesNotNeedArgumentsToBeComputed=new Set,this.functionsMetadata=new Map,this.doesFunctionNeedArgumentToBeComputed=e=>this.functionsWhichDoesNotNeedArgumentsToBeComputed.has(e),this.isFunctionVolatile=e=>this.volatileFunctions.has(e),this.isArrayFunction=e=>this.arrayFunctions.has(e),this.isFunctionDependentOnSheetStructureChange=e=>this.structuralChangeFunctions.has(e),e.functionPlugins.length>0){this.instancePlugins=new Map;for(const t of e.functionPlugins)vi.loadPluginFunctions(t,this.instancePlugins)}else this.instancePlugins=new Map(vi.plugins);for(const[e,t]of vi.protectedFunctions())vi.loadFunctionUnprotected(t,e,this.instancePlugins);for(const[e,t]of this.instancePlugins.entries())this.categorizeFunction(e,Ci(e,t))}static registerFunctionPlugin(e,t){this.loadPluginFunctions(e,this.plugins),void 0!==t&&this.loadTranslations(t)}static registerFunction(e,t,r){this.loadPluginFunction(t,e,this.plugins),void 0!==r&&this.loadTranslations(r)}static unregisterFunction(e){if(this.functionIsProtected(e))throw Dt.cannotUnregisterFunctionWithId(e);this.plugins.delete(e)}static unregisterFunctionPlugin(e){for(const t of this.protectedPlugins())if(t===e)throw Dt.cannotUnregisterProtectedPlugin();for(const[t,r]of this.plugins.entries())r===e&&this.plugins.delete(t)}static unregisterAll(){this.plugins.clear()}static getRegisteredFunctionIds(){return[...Array.from(this.plugins.keys()),...Array.from(this._protectedPlugins.keys())]}static getPlugins(){return Array.from(new Set(this.plugins.values()).values())}static getFunctionPlugin(e){return this.functionIsProtected(e)?void 0:this.plugins.get(e)}static functionIsProtected(e){return this._protectedPlugins.has(e)}static loadTranslations(e){const t=new Set(zi.getRegisteredLanguagesCodes());Object.keys(e).forEach((r=>{t.has(r)&&zi.getLanguage(r).extendFunctions(e[r])}))}static loadPluginFunctions(e,t){Object.keys(e.implementedFunctions).forEach((r=>{this.loadPluginFunction(e,r,t)})),void 0!==e.aliases&&Object.keys(e.aliases).forEach((r=>{this.loadPluginFunction(e,r,t)}))}static loadPluginFunction(e,t,r){if(this.functionIsProtected(t))throw Dt.cannotRegisterFunctionWithId(t);this.loadFunctionUnprotected(e,t,r)}static loadFunctionUnprotected(e,t,r){const n=Ci(t,e).method;if(!Object.prototype.hasOwnProperty.call(e.prototype,n))throw Lt.functionMethodNotFound(n,e.name);r.set(t,e)}static*protectedFunctions(){for(const[e,t]of this._protectedPlugins)void 0!==t&&(yield[e,t])}static*protectedPlugins(){for(const[,e]of this._protectedPlugins)void 0!==e&&(yield e)}initializePlugins(e){const t=[];for(const[r,n]of this.instancePlugins.entries()){let s=t.find((e=>e instanceof n));void 0===s&&(s=new n(e),t.push(s));const i=Ci(r,n),o=i.method;this.functions.set(r,[o,s]);const a=i.arraySizeMethod;void 0!==a&&this.arraySizeFunctions.set(r,[a,s])}}getFunctionPlugin(e){if(!vi.functionIsProtected(e))return this.instancePlugins.get(e)}getFunction(e){const t=this.functions.get(e);if(void 0!==t&&this.config.translationPackage.isFunctionTranslated(e)){const[e,r]=t;return(t,n)=>r[e](t,n)}}getArraySizeFunction(e){const t=this.arraySizeFunctions.get(e);if(void 0!==t&&this.config.translationPackage.isFunctionTranslated(e)){const[e,r]=t;return(t,n)=>r[e](t,n)}}getMetadata(e){return this.functionsMetadata.get(e)}getPlugins(){const e=new Set;for(const[t,r]of this.instancePlugins)vi.functionIsProtected(t)||e.add(r);return Array.from(e)}getRegisteredFunctionIds(){return Array.from(this.functions.keys())}categorizeFunction(e,t){t.isVolatile&&this.volatileFunctions.add(e),t.arrayFunction&&this
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var Ri;vi.plugins=new Map,vi._protectedPlugins=new Map([["VERSION",wi],["OFFSET",void 0]]),function(e){e.GREATER_THAN="GREATER_THAN",e.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL",e.LESS_THAN="LESS_THAN",e.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL",e.NOT_EQUAL="NOT_EQUAL",e.EQUAL="EQUAL"}(Ri||(Ri={}));const Si=(e,t)=>({operator:e,value:t});class Ti{constructor(e){var t,r,n,s;this.trueString=null!==(r=null===(t=e.translationPackage.getMaybeFunctionTranslation("TRUE"))||void 0===t?void 0:t.toLowerCase())&&void 0!==r?r:"true",this.falseString=null!==(s=null===(n=e.translationPackage.getMaybeFunctionTranslation("FALSE"))||void 0===n?void 0:n.toLowerCase())&&void 0!==s?s:"false"}fromCellValue(e,t){if("string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e)return;const r=this.parseCriterion(e,t);return void 0!==r?{raw:e,lambda:Mi(r,t)}:void 0}parseCriterion(e,t){if("number"==typeof e||"boolean"==typeof e)return Si(Ri.EQUAL,e);if("string"==typeof e){const r=Ni.exec(e);let n,s;r?(s=function(e){switch(e){case">":return Ri.GREATER_THAN;case">=":return Ri.GREATER_THAN_OR_EQUAL;case"<":return Ri.LESS_THAN;case"<=":return Ri.LESS_THAN_OR_EQUAL;case"<>":return Ri.NOT_EQUAL;case"=":return Ri.EQUAL;default:return}}(r[1]),n=r[2]):(s=Ri.EQUAL,n=e);const i=t.coerceToMaybeNumber(n),o=n.toLowerCase()===this.trueString||n.toLowerCase()!==this.falseString&&void 0;if(void 0===s)return;if(""===n)return Si(s,null);if(void 0!==i)return Si(s,je(i));if(s===Ri.EQUAL||s===Ri.NOT_EQUAL)return Si(s,null!=o?o:n)}}}const Ni=/([<>=]+)(.*)/;const Mi=(e,t)=>{switch(e.operator){case Ri.GREATER_THAN:return"number"==typeof e.value?r=>"number"==typeof r&&t.floatCmp(r,e.value)>0:e=>!1;case Ri.GREATER_THAN_OR_EQUAL:return"number"==typeof e.value?r=>"number"==typeof r&&t.floatCmp(r,e.value)>=0:e=>!1;case Ri.LESS_THAN:return"number"==typeof e.value?r=>"number"==typeof r&&t.floatCmp(r,e.value)<0:e=>!1;case Ri.LESS_THAN_OR_EQUAL:return"number"==typeof e.value?r=>"number"==typeof r&&t.floatCmp(r,e.value)<=0:e=>!1;case Ri.EQUAL:return"number"==typeof e.value?r=>{if("number"==typeof r)return 0===t.floatCmp(r,e.value);if("string"==typeof r){if(""===r)return!1;const n=t.coerceToMaybeNumber(r);return void 0!==n&&0===t.floatCmp(n,e.value)}return!1}:"string"==typeof e.value?t.eqMatcherFunction(e.value):"boolean"==typeof e.value?t=>"boolean"==typeof t&&t===e.value:e=>e===Ye;case Ri.NOT_EQUAL:return"number"==typeof e.value?r=>{if("number"==typeof r)return 0!==t.floatCmp(r,e.value);if("string"==typeof r){if(""===r)return!0;const n=t.coerceToMaybeNumber(r);return void 0===n||0!==t.floatCmp(n,e.value)}return!0}:"string"==typeof e.value?t.neqMatcherFunction(e.value):"boolean"==typeof e.value?t=>"boolean"!=typeof t||t!==e.value:e=>e!==Ye}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class _i{constructor(e,t,r,n,s,i,o,a,l,h){this.config=e,this.dependencyGraph=t,this.columnSearch=r,this.stats=n,this.arithmeticHelper=s,this.functionRegistry=i,this.namedExpressions=o,this.serialization=a,this.arraySizePredictor=l,this.dateTimeHelper=h,this.equalOp=(e,t)=>Ai(this.arithmeticHelper.eq,e,t),this.notEqualOp=(e,t)=>Ai(this.arithmeticHelper.neq,e,t),this.greaterThanOp=(e,t)=>Ai(this.arithmeticHelper.gt,e,t),this.lessThanOp=(e,t)=>Ai(this.arithmeticHelper.lt,e,t),this.greaterThanOrEqualOp=(e,t)=>Ai(this.arithmeticHelper.geq,e,t),this.lessThanOrEqualOp=(e,t)=>Ai(this.arithmeticHelper.leq,e,t),this.concatOp=(e,t)=>Ai(this.arithmeticHelper.concat,Xr(e),Xr(t)),this.plusOp=(e,t)=>Ai(this.arithmeticHelper.addWithEpsilon,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.minusOp=(e,t)=>Ai(this.arithmeticHelper.subtract,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.timesOp=(e,t)=>Ai(this.arithmeticHelper.multiply,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.powerOp=(e,t)=>Ai(this.arithmeticHelper.pow,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.divOp=(e,t)=>Ai(this.arithmeticHelper.divide,this.arithmeticHelper.coerceScalarToNumberOrError(e),this.arithmeticHelper.coerceScalarToNumberOrError(t)),this.unaryMinusOp=e=>bi(this.arithmeticHelper.unaryMinus,this.arithmeticHelper.coerceScalarToNumberOrError(e)),this.percentOp=e=>bi(this.arithmeticHelper.unaryPercent,this.arithmeticHelper.coerceScalarToNumberOrError(e)),this.unaryPlusOp=e=>this.arithmeticHelper.unaryPlus(e),this.functionRegistry.initializePlugins(this),this.criterionBuilder=new Ti(e)}evaluateAst(e,t){let r=this.evaluateAstWithoutPostprocessing(e,t);if(Ze(r)){if(Zr(je(r)))return new Tr(ir.NUM,Z.NaN);r=ze(r,Jr(je(r)))}return r instanceof rt&&1===r.height()&&1===r.width()&&([[r]]=r.data),function(e,t){if(e instanceof Tr&&void 0!==t)return e.attachRootVertex(t);return e}(r,t.formulaVertex)}evaluateAstWithoutPostprocessing(e,t){switch(e.type){case U.EMPTY:return Ye;case U.CELL_REFERENCE:{const r=e.reference.toSimpleCellAddress(t.formulaAddress);return Or(r)?new Tr(ir.REF,Z.BadRef):this.dependencyGraph.getCellValue(r)}case U.NUMBER:case U.STRING:return e.value;case U.CONCATENATE_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.concatOp,r,n,t)}case U.EQUALS_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.equalOp,r,n,t)}case U.NOT_EQUAL_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.notEqualOp,r,n,t)}case U.GREATER_THAN_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.greaterThanOp,r,n,t)}case U.LESS_THAN_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.lessThanOp,r,n,t)}case U.GREATER_THAN_OR_EQUAL_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.greaterThanOrEqualOp,r,n,t)}case U.LESS_THAN_OR_EQUAL_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.lessThanOrEqualOp,r,n,t)}case U.PLUS_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.plusOp,r,n,t)}case U.MINUS_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.minusOp,r,n,t)}case U.TIMES_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.timesOp,r,n,t)}case U.POWER_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.powerOp,r,n,t)}case U.DIV_OP:{const r=this.evaluateAst(e.left,t),n=this.evaluateAst(e.right,t);return this.binaryRangeWrapper(this.divOp,r,n,t)}case U
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Oi{constructor(e){this.sheet=e,this.transformations=[]}add(e){this.transformations.push(e)}performEagerTransformations(e,t){this.transformations.forEach((r=>r.performEagerTransformations(e,t)))}transformSingleAst(e,t){let[r,n]=[e,t];return this.transformations.forEach((e=>{[r,n]=e.transformSingleAst(r,n)})),[r,n]}isIrreversible(){return!0}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ii{constructor(e){this.stats=e,this.transformations=[]}version(){return this.transformations.length}addTransformation(e){return void 0!==this.combinedTransformer?this.combinedTransformer.add(e):this.transformations.push(e),this.version()}beginCombinedMode(e){this.combinedTransformer=new Oi(e)}commitCombinedMode(){if(void 0===this.combinedTransformer)throw Error("Combined mode wasn't started");return this.transformations.push(this.combinedTransformer),this.combinedTransformer=void 0,this.version()}applyTransformations(e,t,r){this.stats.start(et.TRANSFORM_ASTS_POSTPONED);for(let n=r;n<this.transformations.length;n++){const r=this.transformations[n];r.isIrreversible()&&(this.undoRedo.storeDataForVersion(n,t,this.parser.computeHashFromAst(e)),this.parser.rememberNewAst(e));const[s,i]=r.transformSingleAst(e,t);e=s,t=i}const n=this.parser.rememberNewAst(e);return this.stats.end(et.TRANSFORM_ASTS_POSTPONED),[n,t,this.transformations.length]}*getTransformationsFrom(e,t){for(let r=e;r<this.transformations.length;r++){const e=this.transformations[r];t&&!t(e)||(yield e)}}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const xi=-1;function Pi(e,t,r){let n=t,s=r;for(;n<s;){const t=Math.ceil((n+s)/2);e(t)?n=t:s=t-1}return n===s&&e(n)?n:xi}function Li(e,t){return typeof e==typeof t?e===Ye?0:e<t?-1:e>t?1:0:e===Ye?-1:t===Ye?1:t instanceof Tr||"number"==typeof e&&"string"==typeof t||"number"==typeof e&&"boolean"==typeof t?-1:"string"==typeof e&&"number"==typeof t?1:"string"==typeof e&&"boolean"==typeof t?-1:1}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Di{constructor(e){this.dependencyGraph=e}advancedFind(e,t){let r;const n=t.range;r=void 0===n?t.valuesFromTopLeftCorner():this.dependencyGraph.computeListOfValuesInRange(n);for(let t=0;t<r.length;t++)if(e(je(r[t])))return t;return-1}basicFind(e,t,r,{ordering:n,matchExactly:s}){const i="string"==typeof e?on(e):e,o=t.range;return void 0===o?this.findNormalizedValue(i,t.valuesFromTopLeftCorner()):"none"===n?this.findNormalizedValue(i,this.dependencyGraph.computeListOfValuesInRange(o)):function(e,t,{searchCoordinate:r,orderingDirection:n,matchExactly:s},i){const o=t.start[r],a="col"===r?t.effectiveEndColumn(i):t.effectiveEndRow(i),l="col"===r?e=>je(i.getCellValue(Ar(t.sheet,e,t.start.row))):e=>je(i.getCellValue(Ar(t.sheet,t.start.col,e))),h="asc"===n?(e,t)=>Li(e,t):(e,t)=>-Li(e,t),u=Pi((t=>h(e,l(t))>=0),o,a),c=l(u);return u===xi||typeof c!=typeof e||s&&c!==e?xi:u-o}(i,o,{searchCoordinate:r,orderingDirection:n,matchExactly:s},this.dependencyGraph)}findNormalizedValue(e,t){return t.map(je).map((e=>"string"==typeof e?on(e):e)).indexOf(e)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ki extends Di{constructor(e){super(e),this.dependencyGraph=e}add(e,t){}remove(e,t){}change(e,t,r){}applyChanges(e){}addColumns(e){}removeColumns(e){}removeSheet(e){}moveValues(e,t,r,n){}removeValues(e){}find(e,t,r){return this.basicFind(e,t,"row",r)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Hi{constructor(e,t,r){this.dependencyGraph=e,this.config=t,this.stats=r,this.index=new Map,this.transformingService=this.dependencyGraph.lazilyTransformingAstService,this.binarySearchStrategy=new ki(e)}add(e,t){if(!(e===Ye||e instanceof Tr))if(e instanceof rt)for(const[r,n]of e.entriesFromTopLeftCorner(t))this.addSingleCellValue(je(r),n);else this.addSingleCellValue(e,t)}remove(e,t){if(void 0!==e)if(e instanceof rt)for(const[r,n]of e.entriesFromTopLeftCorner(t))this.removeSingleValue(je(r),n);else this.removeSingleValue(e,t)}change(e,t,r){e!==t&&(this.remove(e,r),this.add(t,r))}applyChanges(e){for(const t of e)void 0!==t.oldValue&&this.change(je(t.oldValue),je(t.value),t.address)}moveValues(e,t,r,n){for(const[s,i]of e){const e=Ir(i,n,t,r);this.remove(s,i),this.add(s,e)}}removeValues(e){for(const[t,r]of e)this.remove(t,r)}find(e,t,{ordering:r,matchExactly:n}){const s=!0===n?"findFirst":"findLast",i=this.findUsingColumnIndex(e,t,s);return void 0!==i?i:this.binarySearchStrategy.find(e,t,{ordering:r,matchExactly:n})}findUsingColumnIndex(e,t,r){const n=t.range;if(void 0===n)return;this.ensureRecentData(n.sheet,n.start.col,e);const s=this.getColumnMap(n.sheet,n.start.col);if(!s)return-1;const i="string"==typeof e?on(e):e,o=s.get(i);if(!o||!o.index||0===o.index.length)return;const a=Hi.findRowBelongingToRange(o,n,r);return void 0!==a?a-n.start.row:void 0}static findRowBelongingToRange(e,t,r){const n=t.start.row,s=t.end.row,i="findFirst"===r?Fi(n,e.index,"upperBound"):Fi(s,e.index,"lowerBound");if(-1===i)return;const o=e.index[i];return o>=n&&o<=s?o:void 0}advancedFind(e,t){return this.binarySearchStrategy.advancedFind(e,t)}addColumns(e){const t=this.index.get(e.sheet);t&&t.splice(e.columnStart,0,...Array(e.numberOfColumns))}removeColumns(e){const t=this.index.get(e.sheet);t&&t.splice(e.columnStart,e.numberOfColumns)}removeSheet(e){this.index.delete(e)}getColumnMap(e,t){this.index.has(e)||this.index.set(e,[]);const r=this.index.get(e);let n=r[t];return n||(n=new Map,r[t]=n),n}getValueIndex(e,t,r){const n=this.getColumnMap(e,t);let s=this.getColumnMap(e,t).get(r);return s||(s={version:this.transformingService.version(),index:[]},n.set(r,s)),s}ensureRecentData(e,t,r){const n=this.getValueIndex(e,t,r),s=this.transformingService.version();if(n.version===s)return;const i=this.transformingService.getTransformationsFrom(n.version,(t=>t.sheet===e&&(t instanceof Ts||t instanceof As)));for(const e of i)e instanceof Ts?this.addRows(t,e.rowsSpan,r):e instanceof As&&this.removeRows(t,e.rowsSpan,r);n.version=s}addSingleCellValue(e,t){this.stats.measure(et.BUILD_COLUMN_INDEX,(()=>{this.ensureRecentData(t.sheet,t.col,e),"string"==typeof e&&(e=on(e));const r=this.getValueIndex(t.sheet,t.col,e);Hi.addValue(r,t.row)}))}removeSingleValue(e,t){this.stats.measure(et.BUILD_COLUMN_INDEX,(()=>{this.ensureRecentData(t.sheet,t.col,e);const r=this.getColumnMap(t.sheet,t.col);"string"==typeof e&&(e=on(e));const n=r.get(e);if(!n)return;const s=Fi(t.row,n.index);s>-1&&n.index.splice(s,1),0===n.index.length&&r.delete(e),0===r.size&&delete this.index.get(t.sheet)[t.col]}))}addRows(e,t,r){const n=this.getValueIndex(t.sheet,e,r);Hi.shiftRows(n,t.rowStart,t.numberOfRows)}removeRows(e,t,r){const n=this.getValueIndex(t.sheet,e,r);Hi.removeRowsFromValues(n,t),Hi.shiftRows(n,t.rowEnd+1,-t.numberOfRows)}static addValue(e,t){const r=Fi(t,e.index,"lowerBound");e.index[r]===t||e.index.splice(r+1,0,t)}static removeRowsFromValues(e,t){const r=Fi(t.rowStart,e.index,"upperBound"),n=Fi(t.rowEnd,e.index,"lowerBound");r>-1&&n>-1&&r<=n&&e.index[r]<=t.rowEnd&&e.index.splice(r,n-r+1)}static shiftRows(e,t,r){const n=Fi(t,e.index,"upperBound");if(-1!==n)for(let t=n;t<e.index.length;++t)e.index[t]+=r}}function Fi(e,t,r="upperBound"){let n=0,s=t.length-1;for(;n<=s;){const r=Math.floor((n+s)/2);if(e>t[r])n=r+1;else{if(!(e<t[r]))return r;s=r-1}}const i="lowerBound"===r?s:n;return i>=0&&i<=t.length?i:-1}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ui{constructor(e){this.config=e;const t="."===this.config.thousandSeparator?`\\${this.config.thousandSeparator}`:this.config.thousandSeparator,r="."===this.config.decimalSeparator?`\\${this.config.decimalSeparator}`:this.config.decimalSeparator;this.numberPattern=new RegExp(`^([+-]?((${r}\\d+)|(\\d+(${t}\\d{3,})*(${r}\\d*)?)))(e[+-]?\\d+)?$`),this.allThousandSeparatorsRegex=new RegExp(`${t}`,"g")}numericStringToMaybeNumber(e){if(this.numberPattern.test(e)){const t=this.numericStringToNumber(e);if(isNaN(t))return;return t}}numericStringToNumber(e){const t=e.replace(this.allThousandSeparatorsRegex,"").replace(this.config.decimalSeparator,".");return Number(t)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Vi{constructor(e,t,r){this.dependencyGraph=e,this.unparser=t,this.exporter=r}getCellHyperlink(e){const t=this.dependencyGraph.getCell(e);if(t instanceof $t){const e=t.getFormula(this.dependencyGraph.lazilyTransformingAstService);if("HYPERLINK"===e.procedureName)return e.hyperlink}}getCellFormula(e,t){const r=this.dependencyGraph.getCell(e);if(r instanceof $t){const n=r.getFormula(this.dependencyGraph.lazilyTransformingAstService);return t=null!=t?t:e,this.unparser.unparse(n,t)}if(r instanceof zt){const n=r.getAddress(this.dependencyGraph.lazilyTransformingAstService);if(n.row!==e.row||n.col!==e.col||n.sheet!==e.sheet)return;t=null!=t?t:e;const s=r.getFormula(this.dependencyGraph.lazilyTransformingAstService);if(void 0!==s)return this.unparser.unparse(s,t)}else if(r instanceof pr)return r.getFormula()}getCellSerialized(e,t){var r;return null!==(r=this.getCellFormula(e,t))&&void 0!==r?r:this.getRawValue(e)}getCellValue(e){return this.exporter.exportValue(this.dependencyGraph.getScalarValue(e))}getRawValue(e){return this.dependencyGraph.getRawValue(e)}getSheetValues(e){return this.genericSheetGetter(e,(e=>this.getCellValue(e)))}getSheetFormulas(e){return this.genericSheetGetter(e,(e=>this.getCellFormula(e)))}genericSheetGetter(e,t){const r=this.dependencyGraph.getSheetHeight(e),n=this.dependencyGraph.getSheetWidth(e),s=new Array(r);for(let i=0;i<r;i++){s[i]=new Array(n);for(let r=0;r<n;r++){const n=Ar(e,r,i);s[i][r]=t(n)}for(let e=n-1;e>=0&&(null===s[i][e]||void 0===s[i][e]);e--)s[i].pop()}for(let e=r-1;e>=0&&0===s[e].length;e--)s.pop();return s}genericAllSheetsGetter(e){const t={};for(const r of this.dependencyGraph.sheetMapping.displayNames()){const n=this.dependencyGraph.sheetMapping.fetch(r);t[r]=e(n)}return t}getSheetSerialized(e){return this.genericSheetGetter(e,(e=>this.getCellSerialized(e)))}getAllSheetsValues(){return this.genericAllSheetsGetter((e=>this.getSheetValues(e)))}getAllSheetsFormulas(){return this.genericAllSheetsGetter((e=>this.getSheetFormulas(e)))}getAllSheetsSerialized(){return this.genericAllSheetsGetter((e=>this.getSheetSerialized(e)))}getAllNamedExpressionsSerialized(){const e=[];let t=0;for(const r of this.dependencyGraph.sheetMapping.displayNames()){const n=this.dependencyGraph.sheetMapping.fetch(r);e[n]=t,t++}return this.dependencyGraph.namedExpressions.getAllNamedExpressions().map((t=>({name:t.expression.displayName,expression:this.getCellSerialized(t.expression.address),scope:void 0!==t.scope?e[t.scope]:void 0,options:t.expression.options})))}withNewConfig(e,t){const r=new xe(e,Ae(e),this.dependencyGraph.sheetMapping.fetchDisplayName,t);return new Vi(this.dependencyGraph,r,this.exporter)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Bi{static buildFromSheets(e,t={},r=[]){const n=new Ki(t);return this.buildEngine(n,e,r)}static buildFromSheet(e,t={},r=[]){const n=new Ki(t),s=n.translationPackage.getUITranslation(sr.NEW_SHEET_PREFIX)+"1";return this.buildEngine(n,{[s]:e},r)}static buildEmpty(e={},t=[]){return this.buildEngine(new Ki(e),{},t)}static rebuildWithConfig(e,t,r,n){return this.buildEngine(e,t,r,n)}static buildEngine(e,t={},r=[],n=(e.useStats?new ot:new at)){n.start(et.BUILD_ENGINE_TOTAL);const s=new Cs,i=new vi(e),o=new Ii(n),a=ur.buildEmpty(o,e,i,s,n),l=
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function(e,t,r){return t.useColumnIndex?new Hi(e,t,r):new ki(e)}(a,e,n),h=a.sheetMapping,u=a.addressMapping;for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const n=t[r];Is(n);const s=xs(n);if(s.height>e.maxRows||s.width>e.maxColumns)throw new ct;const i=h.addSheet(r);u.autoAddSheet(i,s)}const c=new Le(e,i,h.get);o.parser=c;const d=new xe(e,Ae(e),h.fetchDisplayName,s),p=new Hn(e),g=new Ui(e),f=new Yr(e,p,g),m=new gs(e,p,g),y=new dn(e,i),E=new Hs(e,a,l,m,c,n,o,s,y),w=new li(e,E);o.undoRedo=w;const C=new ms(e,a,E),v=new hi(e,E,w,C,a,l,c,m,o,s);r.forEach((e=>{v.ensureItIsPossibleToAddNamedExpression(e.name,e.expression,e.scope),v.operations.addNamedExpression(e.name,e.expression,e.scope,e.options)}));const R=new fi(e,s,h.fetchDisplayName,o),S=new Vi(a,d,R),T=new _i(e,a,l,n,f,i,s,S,y,p);n.measure(et.GRAPH_BUILD,(()=>{new mi(a,l,c,m,n,y).buildGraph(t,n)}));const N=new di(e,n,T,o,a,l);return N.run(),n.end(et.BUILD_ENGINE_TOTAL),{config:e,stats:n,dependencyGraph:a,columnSearch:l,parser:c,unparser:d,cellContentParser:m,evaluator:N,lazilyTransformingAstService:o,crudOperations:v,exporter:R,namedExpressions:s,serialization:S,functionRegistry:i}}}function Wi(e){return()=>{throw new Error(`The "${e}" method cannot be called because this HyperFormula instance has been destroyed`)}}var Yi,ji=r(23420);!function(e){e.SheetAdded="sheetAdded",e.SheetRemoved="sheetRemoved",e.SheetRenamed="sheetRenamed",e.NamedExpressionAdded="namedExpressionAdded",e.NamedExpressionRemoved="namedExpressionRemoved",e.ValuesUpdated="valuesUpdated",e.EvaluationSuspended="evaluationSuspended",e.EvaluationResumed="evaluationResumed"}(Yi||(Yi={}));class Gi extends ji.TinyEmitter{emit(e,...t){return super.emit(e,...t),this}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class zi{constructor(e,t,r,n,s,i,o,a,l,h,u,c,d,p){this._config=e,this._stats=t,this._dependencyGraph=r,this._columnSearch=n,this._parser=s,this._unparser=i,this._cellContentParser=o,this._evaluator=a,this._lazilyTransformingAstService=l,this._crudOperations=h,this._exporter=u,this._namedExpressions=c,this._serialization=d,this._functionRegistry=p,this._emitter=new Gi,this._evaluationSuspended=!1}static get defaultConfig(){return Xi({})}get graph(){return this.dependencyGraph.graph}get rangeMapping(){return this.dependencyGraph.rangeMapping}get arrayMapping(){return this.dependencyGraph.arrayMapping}get sheetMapping(){return this.dependencyGraph.sheetMapping}get addressMapping(){return this.dependencyGraph.addressMapping}get dependencyGraph(){return this._dependencyGraph}get evaluator(){return this._evaluator}get columnSearch(){return this._columnSearch}get lazilyTransformingAstService(){return this._lazilyTransformingAstService}get licenseKeyValidityState(){return this._config.licenseKeyValidityState}static buildFromArray(e,t={},r=[]){return this.buildFromEngineState(Bi.buildFromSheet(e,t,r))}static buildFromSheets(e,t={},r=[]){return this.buildFromEngineState(Bi.buildFromSheets(e,t,r))}static buildEmpty(e={},t=[]){return this.buildFromEngineState(Bi.buildEmpty(e,t))}static getLanguage(e){En(e,"string","languageCode");const t=this.registeredLanguages.get(e);if(void 0===t)throw new xt;return t}static registerLanguage(e,t){if(En(e,"string","languageCode"),this.registeredLanguages.has(e))throw new Pt;var r;this.registeredLanguages.set(e,(r=t,new nr(Object.assign({},r.functions),Object.assign({},r.errors),Object.assign({},r.ui))))}static unregisterLanguage(e){if(En(e,"string","languageCode"),!this.registeredLanguages.has(e))throw new xt;this.registeredLanguages.delete(e)}static getRegisteredLanguagesCodes(){return Array.from(this.registeredLanguages.keys())}static registerFunctionPlugin(e,t){vi.registerFunctionPlugin(e,t)}static unregisterFunctionPlugin(e){vi.unregisterFunctionPlugin(e)}static registerFunction(e,t,r){En(e,"string","functionId"),vi.registerFunction(e,t,r)}static unregisterFunction(e){En(e,"string","functionId"),vi.unregisterFunction(e)}static unregisterAllFunctions(){vi.unregisterAll()}static getRegisteredFunctionNames(e){En(e,"string","code");const t=vi.getRegisteredFunctionIds();return this.getLanguage(e).getFunctionTranslations(t)}static getFunctionPlugin(e){return En(e,"string","functionId"),vi.getFunctionPlugin(e)}static getAllFunctionPlugins(){return vi.getPlugins()}static buildFromEngineState(e){return new zi(e.config,e.stats,e.dependencyGraph,e.columnSearch,e.parser,e.unparser,e.cellContentParser,e.evaluator,e.lazilyTransformingAstService,e.crudOperations,e.exporter,e.namedExpressions,e.serialization,e.functionRegistry)}getCellValue(e){if(!Pr(e))throw new Tt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellValue(e)}getCellFormula(e){if(!Pr(e))throw new Tt("SimpleCellAddress","cellAddress");return this._serialization.getCellFormula(e)}getCellHyperlink(e){if(!Pr(e))throw new Tt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellHyperlink(e)}getCellSerialized(e){if(!Pr(e))throw new Tt("SimpleCellAddress","cellAddress");return this.ensureEvaluationIsNotSuspended(),this._serialization.getCellSerialized(e)}getSheetValues(e){return En(e,"number","sheetId"),this.ensureEvaluationIsNotSuspended(),this._serialization.getSheetValues(e)}getSheetFormulas(e){return En(e,"number","sheetId"),this._serialization.getSheetFormulas(e)}getSheetSerialized(e){return En(e,"number","sheetId"),this.ensureEvaluationIsNotSuspended(),this._serialization.getSheetSerialized(e)}getAllSheetsDimensions(){return this._serialization.genericAllSheetsGetter((e=>this.getSheetDimensions(e)))}getSheetDimensions(e){return En(e,"number","sheetId"),{width:this.dependencyGraph.getSheetWidth(e),height:this.dependencyGraph.getSheetHeight(e)}}getAllSheetsValues(){return this.ensureEvaluationIsNotSuspended(),this._serialization.getAllShe
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function(e){for(const[t,r]of Object.entries(e))r instanceof Function?e[t]=Wi(r):delete e[t]}(this)}ensureEvaluationIsNotSuspended(){if(this._evaluationSuspended)throw new At}extractTemporaryFormula(e,t=1){const r=this._cellContentParser.parse(e),n={sheet:t,col:0,row:0};if(!(r instanceof cs.Formula))return{address:n,dependencies:[]};const{ast:s,errors:i,dependencies:o}=this._parser.parse(r.formula,n);return i.length>0?{address:n,dependencies:[]}:{ast:s,address:n,dependencies:o}}rebuildWithConfig(e){const t=this._config.mergeConfig(e),r=this._config.mergeConfig({language:e.language}),n=this._serialization.withNewConfig(r,this._namedExpressions).getAllSheetsSerialized(),s=this._serialization.getAllNamedExpressionsSerialized(),i=Bi.rebuildWithConfig(t,n,s,this._stats);this._config=i.config,this._stats=i.stats,this._dependencyGraph=i.dependencyGraph,this._columnSearch=i.columnSearch,this._parser=i.parser,this._unparser=i.unparser,this._cellContentParser=i.cellContentParser,this._evaluator=i.evaluator,this._lazilyTransformingAstService=i.lazilyTransformingAstService,this._crudOperations=i.crudOperations,this._exporter=i.exporter,this._namedExpressions=i.namedExpressions,this._serialization=i.serialization,this._functionRegistry=i.functionRegistry}recomputeIfDependencyGraphNeedsIt(){if(this._evaluationSuspended)return[];{const e=this._crudOperations.getAndClearContentChanges(),t=this.dependencyGraph.verticesToRecompute();this.dependencyGraph.clearDirtyVertices(),t.length>0&&e.addAll(this.evaluator.partialRun(t));const r=e.exportChanges(this._exporter);return e.isEmpty()||this._emitter.emit(Yi.ValuesUpdated,r),r}}}zi.version="2.7.0",zi.buildDate="10/04/2024 11:28:07",zi.releaseDate="10/04/2024",zi.languages={},zi.registeredLanguages=new Map;
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const $i=new WeakMap;class Ki{constructor(e={},t=!0){const{accentSensitive:r,binarySearchThreshold:n,caseSensitive:s,caseFirst:i,chooseAddressMappingPolicy:o,context:a,currencySymbol:l,dateFormats:h,decimalSeparator:u,evaluateNullToZero:c,functionArgSeparator:d,functionPlugins:p,ignorePunctuation:g,leapYear1900:f,localeLang:m,language:y,ignoreWhiteSpace:E,licenseKey:w,matchWholeCell:C,arrayColumnSeparator:v,arrayRowSeparator:R,maxRows:S,maxColumns:T,nullYear:N,nullDate:M,parseDateTime:_,precisionEpsilon:b,precisionRounding:A,stringifyDateTime:O,stringifyDuration:I,smartRounding:x,timeFormats:P,thousandSeparator:L,useArrayArithmetic:D,useStats:k,undoLimit:H,useColumnIndex:F,useRegularExpressions:U,useWildcards:V}=e;t&&Ki.warnDeprecatedOptions(e),this.useArrayArithmetic=gn(D,"boolean","useArrayArithmetic"),this.accentSensitive=gn(r,"boolean","accentSensitive"),this.caseSensitive=gn(s,"boolean","caseSensitive"),this.caseFirst=gn(i,["upper","lower","false"],"caseFirst"),this.ignorePunctuation=gn(g,"boolean","ignorePunctuation"),this.chooseAddressMappingPolicy=null!=o?o:Ki.defaultConfig.chooseAddressMappingPolicy,this.dateFormats=[...mn(h,Array.isArray,"array","dateFormats")],this.timeFormats=[...mn(P,Array.isArray,"array","timeFormats")],this.functionArgSeparator=gn(d,"string","functionArgSeparator"),this.decimalSeparator=gn(u,[".",","],"decimalSeparator"),this.language=gn(y,"string","language"),this.ignoreWhiteSpace=gn(E,["standard","any"],"ignoreWhiteSpace"),this.licenseKey=gn(w,"string","licenseKey"),this.thousandSeparator=gn(L,["",","," ","."],"thousandSeparator"),this.arrayColumnSeparator=gn(v,[",",";"],"arrayColumnSeparator"),this.arrayRowSeparator=gn(R,[";","|"],"arrayRowSeparator"),this.localeLang=gn(m,"string","localeLang"),this.functionPlugins=[...null!=p?p:Ki.defaultConfig.functionPlugins],this.smartRounding=gn(x,"boolean","smartRounding"),this.evaluateNullToZero=gn(c,"boolean","evaluateNullToZero"),this.nullYear=gn(N,"number","nullYear"),fn(this.nullYear,"nullYear",0),function(e,t,r){if(e>r)throw new _t(t,r)}(this.nullYear,"nullYear",100),this.precisionRounding=gn(A,"number","precisionRounding"),fn(this.precisionRounding,"precisionRounding",0),this.precisionEpsilon=gn(b,"number","precisionEpsilon"),fn(this.precisionEpsilon,"precisionEpsilon",0),this.useColumnIndex=gn(F,"boolean","useColumnIndex"),this.useStats=gn(k,"boolean","useStats"),this.binarySearchThreshold=null!=n?n:Ki.defaultConfig.binarySearchThreshold,this.parseDateTime=gn(_,"function","parseDateTime"),this.stringifyDateTime=gn(O,"function","stringifyDateTime"),this.stringifyDuration=gn(I,"function","stringifyDuration"),this.translationPackage=zi.getLanguage(this.language),this.errorMapping=this.translationPackage.buildErrorMapping(),this.nullDate=mn(M,Ln,"IDate","nullDate"),this.leapYear1900=gn(f,"boolean","leapYear1900"),this.undoLimit=gn(H,"number","undoLimit"),this.useRegularExpressions=gn(U,"boolean","useRegularExpressions"),this.useWildcards=gn(V,"boolean","useWildcards"),this.matchWholeCell=gn(C,"boolean","matchWholeCell"),fn(this.undoLimit,"undoLimit",0),this.maxRows=gn(S,"number","maxRows"),fn(this.maxRows,"maxRows",1),this.maxColumns=gn(T,"number","maxColumns"),this.currencySymbol=this.setupCurrencySymbol(l),fn(this.maxColumns,"maxColumns",1),this.context=a,$i.set(this,{licenseKeyValidityState:us(this.licenseKey)}),yn({value:this.decimalSeparator,name:"decimalSeparator"},{value:this.functionArgSeparator,name:"functionArgSeparator"},{value:this.thousandSeparator,name:"thousandSeparator"}),yn({value:this.arrayRowSeparator,name:"arrayRowSeparator"},{value:this.arrayColumnSeparator,name:"arrayColumnSeparator"})}setupCurrencySymbol(e){const t=[...mn(e,Array.isArray,"array","currencySymbol")];return t.forEach((e=>{if("string"!=typeof e)throw new Tt("string[]","currencySymbol");if(""===e)throw new Nt("currencySymbol")})),t}get licenseKeyValidityState(){return $i.get(this).licenseKeyValidityState}getConfig(){return Xi(this)}mergeConfig(e){const t=Object.assign({},this.getConfig(),e);return Ki.warnDeprecatedOptions(e),new Ki(t,!1)}static warnDeprecate
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const qi={errors:{CYCLE:"#CYCLE!",DIV_BY_ZERO:"#DIV/0!",ERROR:"#ERROR!",NA:"#N/A",NAME:"#NAME?",NUM:"#NUM!",REF:"#REF!",SPILL:"#SPILL!",VALUE:"#VALUE!"},functions:{FILTER:"FILTER",ADDRESS:"ADDRESS",ARRAY_CONSTRAIN:"ARRAY_CONSTRAIN",ARRAYFORMULA:"ARRAYFORMULA",ABS:"ABS",ACOS:"ACOS",ACOSH:"ACOSH",ACOT:"ACOT",ACOTH:"ACOTH",AND:"AND",ARABIC:"ARABIC",ASIN:"ASIN",ASINH:"ASINH",ATAN2:"ATAN2",ATAN:"ATAN",ATANH:"ATANH",AVERAGE:"AVERAGE",AVERAGEA:"AVERAGEA",AVERAGEIF:"AVERAGEIF",BASE:"BASE",BIN2DEC:"BIN2DEC",BIN2HEX:"BIN2HEX",BIN2OCT:"BIN2OCT",BITAND:"BITAND",BITLSHIFT:"BITLSHIFT",BITOR:"BITOR",BITRSHIFT:"BITRSHIFT",BITXOR:"BITXOR",CEILING:"CEILING",CHAR:"CHAR",CHOOSE:"CHOOSE",CLEAN:"CLEAN",CODE:"CODE",COLUMN:"COLUMN",COLUMNS:"COLUMNS",CONCATENATE:"CONCATENATE",CORREL:"CORREL",COS:"COS",COSH:"COSH",COT:"COT",COTH:"COTH",COUNT:"COUNT",COUNTA:"COUNTA",COUNTBLANK:"COUNTBLANK",COUNTIF:"COUNTIF",COUNTIFS:"COUNTIFS",COUNTUNIQUE:"COUNTUNIQUE",CSC:"CSC",CSCH:"CSCH",CUMIPMT:"CUMIPMT",CUMPRINC:"CUMPRINC",DATE:"DATE",DATEDIF:"DATEDIF",DATEVALUE:"DATEVALUE",DAY:"DAY",DAYS360:"DAYS360",DAYS:"DAYS",DB:"DB",DDB:"DDB",DEC2BIN:"DEC2BIN",DEC2HEX:"DEC2HEX",DEC2OCT:"DEC2OCT",DECIMAL:"DECIMAL",DEGREES:"DEGREES",DELTA:"DELTA",DOLLARDE:"DOLLARDE",DOLLARFR:"DOLLARFR",EDATE:"EDATE",EFFECT:"EFFECT",EOMONTH:"EOMONTH",ERF:"ERF",ERFC:"ERFC",EVEN:"EVEN",EXACT:"EXACT",EXP:"EXP",FALSE:"FALSE",FIND:"FIND",FORMULATEXT:"FORMULATEXT",FV:"FV",FVSCHEDULE:"FVSCHEDULE",HEX2BIN:"HEX2BIN",HEX2DEC:"HEX2DEC",HEX2OCT:"HEX2OCT",HLOOKUP:"HLOOKUP",HOUR:"HOUR",HYPERLINK:"HYPERLINK",IF:"IF",IFERROR:"IFERROR",IFNA:"IFNA",IFS:"IFS",INDEX:"INDEX",INT:"INT",INTERVAL:"INTERVAL",IPMT:"IPMT",ISBINARY:"ISBINARY",ISBLANK:"ISBLANK",ISERR:"ISERR",ISERROR:"ISERROR",ISEVEN:"ISEVEN",ISFORMULA:"ISFORMULA",ISLOGICAL:"ISLOGICAL",ISNA:"ISNA",ISNONTEXT:"ISNONTEXT",ISNUMBER:"ISNUMBER",ISODD:"ISODD",ISOWEEKNUM:"ISOWEEKNUM",ISPMT:"ISPMT",ISREF:"ISREF",ISTEXT:"ISTEXT",LEFT:"LEFT",LEN:"LEN",LN:"LN",LOG10:"LOG10",LOG:"LOG",LOWER:"LOWER",MATCH:"MATCH",MAX:"MAX",MAXA:"MAXA",MAXIFS:"MAXIFS",MAXPOOL:"MAXPOOL",MEDIAN:"MEDIAN",MEDIANPOOL:"MEDIANPOOL",MID:"MID",MIN:"MIN",MINA:"MINA",MINIFS:"MINIFS",MINUTE:"MINUTE",MIRR:"MIRR",MMULT:"MMULT",MOD:"MOD",MONTH:"MONTH",NA:"NA",NETWORKDAYS:"NETWORKDAYS","NETWORKDAYS.INTL":"NETWORKDAYS.INTL",NOMINAL:"NOMINAL",NOT:"NOT",NOW:"NOW",NPER:"NPER",NPV:"NPV",OCT2BIN:"OCT2BIN",OCT2DEC:"OCT2DEC",OCT2HEX:"OCT2HEX",ODD:"ODD",OFFSET:"OFFSET",OR:"OR",PI:"PI",PMT:"PMT",PDURATION:"PDURATION",PRODUCT:"PRODUCT",POWER:"POWER",PPMT:"PPMT",PROPER:"PROPER",PV:"PV",RADIANS:"RADIANS",RAND:"RAND",RATE:"RATE",REPLACE:"REPLACE",REPT:"REPT",RIGHT:"RIGHT",ROMAN:"ROMAN",ROUND:"ROUND",ROUNDDOWN:"ROUNDDOWN",ROUNDUP:"ROUNDUP",ROW:"ROW",ROWS:"ROWS",RRI:"RRI",SEARCH:"SEARCH",SEC:"SEC",SECH:"SECH",SECOND:"SECOND",SHEET:"SHEET",SHEETS:"SHEETS",SIN:"SIN",SINH:"SINH",SLN:"SLN",SPLIT:"SPLIT",SQRT:"SQRT",STDEVA:"STDEVA","STDEV.P":"STDEV.P",STDEVPA:"STDEVPA","STDEV.S":"STDEV.S",SUBSTITUTE:"SUBSTITUTE",SUBTOTAL:"SUBTOTAL",SUM:"SUM",SUMIF:"SUMIF",SUMIFS:"SUMIFS",SUMPRODUCT:"SUMPRODUCT",SUMSQ:"SUMSQ",SWITCH:"SWITCH",SYD:"SYD",T:"T",TAN:"TAN",TANH:"TANH",TBILLEQ:"TBILLEQ",TBILLPRICE:"TBILLPRICE",TBILLYIELD:"TBILLYIELD",TEXT:"TEXT",TIME:"TIME",TIMEVALUE:"TIMEVALUE",TODAY:"TODAY",TRANSPOSE:"TRANSPOSE",TRIM:"TRIM",TRUE:"TRUE",TRUNC:"TRUNC",UNICHAR:"UNICHAR",UNICODE:"UNICODE",UPPER:"UPPER",VARA:"VARA","VAR.P":"VAR.P",VARPA:"VARPA","VAR.S":"VAR.S",VLOOKUP:"VLOOKUP",WEEKDAY:"WEEKDAY",WEEKNUM:"WEEKNUM",WORKDAY:"WORKDAY","WORKDAY.INTL":"WORKDAY.INTL",XNPV:"XNPV",XOR:"XOR",YEAR:"YEAR",YEARFRAC:"YEARFRAC","HF.ADD":"HF.ADD","HF.CONCAT":"HF.CONCAT","HF.DIVIDE":"HF.DIVIDE","HF.EQ":"HF.EQ","HF.GT":"HF.GT","HF.GTE":"HF.GTE","HF.LT":"HF.LT","HF.LTE":"HF.LTE","HF.MINUS":"HF.MINUS","HF.MULTIPLY":"HF.MULTIPLY","HF.NE":"HF.NE","HF.POW":"HF.POW","HF.UMINUS":"HF.UMINUS","HF.UNARY_PERCENT":"HF.UNARY_PERCENT","HF.UPLUS":"HF.UPLUS",VARP:"VARP",VAR:"VAR",STDEVP:"STDEVP",STDEV:"STDEV","EXPON.DIST":"EXPON.DIST",FISHER:"FISHER",FISHERINV:"FISHERINV",GAMMA:"GAMMA","GAMMA.DIST":"GAMMA.DIST",GAMMALN:"GAMMALN","GAMMALN.PRECISE":"GAMMALN.PRECISE"
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
var Qi;!function(e){e[e.FullyAbsolute=1]="FullyAbsolute",e[e.RowAbsoluteColRelative=2]="RowAbsoluteColRelative",e[e.RowRelativeColAbsolute=3]="RowRelativeColAbsolute",e[e.FullyRelative=4]="FullyRelative"}(Qi||(Qi={}));class Zi extends un{verifyAddressArguments(e,t,r,n){if(n){if(e<1||t<1)return new Tr(ir.VALUE,Z.LessThanOne)}else if(Qi.FullyAbsolute==r){if(e<1||t<1)return new Tr(ir.VALUE,Z.LessThanOne)}else if(Qi.RowAbsoluteColRelative==r){if(e<1)return new Tr(ir.VALUE,Z.LessThanOne)}else if(Qi.RowRelativeColAbsolute==r&&t<1)return new Tr(ir.VALUE,Z.LessThanOne)}address(e,t){return this.runFunction(e.args,t,this.metadata("ADDRESS"),((e,t,r,n,s)=>{const i=this.verifyAddressArguments(e,t,r,n);if(void 0!==i)return i;const o=P(t-1);let a="";null!=s&&(a=`${s}!`);const l=0==t?"C":`C[${t}]`,h=0==e?"R":`R[${e}]`;return Qi.FullyRelative==r?n?`${a}${o}${e}`:`${a}${h}${l}`:Qi.RowRelativeColAbsolute==r?n?`${a}$${o}${e}`:`${a}${h}C${t}`:Qi.RowAbsoluteColRelative==r?n?`${a}${o}$${e}`:`${a}R${e}${l}`:n?`${a}$${o}$${e}`:`${a}R${e}C${t}`}))}}Zi.implementedFunctions={ADDRESS:{method:"address",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0,defaultValue:1,minValue:1,maxValue:4},{argumentType:hn.BOOLEAN,optionalArg:!0,defaultValue:!0},{argumentType:hn.STRING,optionalArg:!0}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ji extends un{arrayformula(e,t){return this.runFunction(e.args,t,this.metadata("ARRAYFORMULA"),(e=>e))}arrayformulaArraySize(e,t){if(1!==e.args.length)return cn.error();const r=this.metadata("ARRAYFORMULA");return e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))}))[0]}arrayconstrain(e,t){return this.runFunction(e.args,t,this.metadata("ARRAY_CONSTRAIN"),((e,t,r)=>{t=Math.min(t,e.height()),r=Math.min(r,e.width());const n=e.data,s=[];for(let e=0;e<t;e++)s.push(n[e].slice(0,r));return rt.onlyValues(s)}))}arrayconstrainArraySize(e,t){if(3!==e.args.length)return cn.error();const r=this.metadata("ARRAY_CONSTRAIN"),n=e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))}));let{height:s,width:i}=n[0];return e.args[1].type===U.NUMBER&&(s=Math.min(s,e.args[1].value)),e.args[2].type===U.NUMBER&&(i=Math.min(i,e.args[2].value)),s<1||i<1||!Number.isInteger(s)||!Number.isInteger(i)?cn.error():new cn(i,s)}filter(e,t){return this.runFunction(e.args,t,this.metadata("FILTER"),((e,...t)=>{for(const r of t)if(e.width()!==r.width()||e.height()!==r.height())return new Tr(ir.NA,Z.EqualLength);if(e.width()>1&&e.height()>1)return new Tr(ir.NA,Z.WrongDimension);const r=e.data,n=[];for(let s=0;s<e.height();s++){const i=[];for(let n=0;n<e.width();n++){let e=!0;for(const r of t){if(!0!==Kr(r.data[s][n])){e=!1;break}}e&&i.push(r[s][n])}i.length>0&&n.push(i)}return n.length>0?rt.onlyValues(n):new Tr(ir.NA,Z.EmptyRange)}))}filterArraySize(e,t){if(e.args.length<=1)return cn.error();const r=this.metadata("FILTER"),n=e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))})),s=Math.max(...n.map((e=>e.width))),i=Math.max(...n.map((e=>e.height)));return new cn(s,i)}}Ji.implementedFunctions={ARRAYFORMULA:{method:"arrayformula",arraySizeMethod:"arrayformulaArraySize",arrayFunction:!0,parameters:[{argumentType:hn.ANY}]},ARRAY_CONSTRAIN:{method:"arrayconstrain",arraySizeMethod:"arrayconstrainArraySize",parameters:[{argumentType:hn.RANGE},{argumentType:hn.INTEGER,minValue:1},{argumentType:hn.INTEGER,minValue:1}],vectorizationForbidden:!0},FILTER:{method:"filter",arraySizeMethod:"filterArraySize",arrayFunction:!0,parameters:[{argumentType:hn.RANGE},{argumentType:hn.RANGE}],repeatLastArgs:1}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class eo extends un{abs(e,t){return this.runFunction(e.args,t,this.metadata("ABS"),Math.abs)}}eo.implementedFunctions={ABS:{method:"abs",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const to=0xffffffffffff;class ro extends un{bitlshift(e,t){return this.runFunction(e.args,t,this.metadata("BITLSHIFT"),no)}bitrshift(e,t){return this.runFunction(e.args,t,this.metadata("BITRSHIFT"),so)}}function no(e,t){return t<0?so(e,-t):io(e*Math.pow(2,t))}function so(e,t){return t<0?no(e,-t):io(Math.floor(e/Math.pow(2,t)))}function io(e){return e>to?new Tr(ir.NUM,Z.BitshiftLong):e}ro.implementedFunctions={BITLSHIFT:{method:"bitlshift",parameters:[{argumentType:hn.INTEGER,minValue:0},{argumentType:hn.INTEGER,minValue:-53,maxValue:53}]},BITRSHIFT:{method:"bitrshift",parameters:[{argumentType:hn.INTEGER,minValue:0},{argumentType:hn.INTEGER,minValue:-53,maxValue:53}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class oo extends un{bitand(e,t){return this.runFunction(e.args,t,this.metadata("BITAND"),((e,t)=>e&t))}bitor(e,t){return this.runFunction(e.args,t,this.metadata("BITOR"),((e,t)=>e|t))}bitxor(e,t){return this.runFunction(e.args,t,this.metadata("BITXOR"),((e,t)=>e^t))}}oo.implementedFunctions={BITAND:{method:"bitand",parameters:[{argumentType:hn.INTEGER,minValue:0},{argumentType:hn.INTEGER,minValue:0}]},BITOR:{method:"bitor",parameters:[{argumentType:hn.INTEGER,minValue:0},{argumentType:hn.INTEGER,minValue:0}]},BITXOR:{method:"bitxor",parameters:[{argumentType:hn.INTEGER,minValue:0},{argumentType:hn.INTEGER,minValue:0}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ao extends un{literalTrue(e,t){return this.runFunction(e.args,t,this.metadata("TRUE"),(()=>!0))}literalFalse(e,t){return this.runFunction(e.args,t,this.metadata("FALSE"),(()=>!1))}conditionalIf(e,t){return this.runFunction(e.args,t,this.metadata("IF"),((e,t,r)=>e?t:r))}ifs(e,t){return this.runFunction(e.args,t,this.metadata("IFS"),((...e)=>{for(let t=0;t<e.length;t+=2)if(e[t])return e[t+1];return new Tr(ir.NA,Z.NoConditionMet)}))}and(e,t){return this.runFunction(e.args,t,this.metadata("AND"),((...e)=>e.filter((e=>void 0!==e)).every((e=>!!e))))}or(e,t){return this.runFunction(e.args,t,this.metadata("OR"),((...e)=>e.filter((e=>void 0!==e)).some((e=>e))))}not(e,t){return this.runFunction(e.args,t,this.metadata("NOT"),(e=>!e))}xor(e,t){return this.runFunction(e.args,t,this.metadata("XOR"),((...e)=>{let t=0;return e.filter((e=>void 0!==e)).forEach((e=>{e&&t++})),t%2==1}))}switch(e,t){return this.runFunction(e.args,t,this.metadata("SWITCH"),((e,...t)=>{const r=t.length;let n=0;for(;n+1<r;n+=2)if(!(t[n]instanceof Tr)&&this.arithmeticHelper.eq(e,t[n]))return t[n+1];return n<r?t[n]:new Tr(ir.NA,Z.NoDefault)}))}iferror(e,t){return this.runFunction(e.args,t,this.metadata("IFERROR"),((e,t)=>e instanceof Tr?t:e))}ifna(e,t){return this.runFunction(e.args,t,this.metadata("IFNA"),((e,t)=>e instanceof Tr&&e.type===ir.NA?t:e))}choose(e,t){return this.runFunction(e.args,t,this.metadata("CHOOSE"),((e,...t)=>e>t.length?new Tr(ir.NUM,Z.Selector):t[e-1]))}}ao.implementedFunctions={TRUE:{method:"literalTrue",parameters:[]},FALSE:{method:"literalFalse",parameters:[]},IF:{method:"conditionalIf",parameters:[{argumentType:hn.BOOLEAN},{argumentType:hn.SCALAR,passSubtype:!0},{argumentType:hn.SCALAR,defaultValue:!1,passSubtype:!0}]},IFS:{method:"ifs",parameters:[{argumentType:hn.BOOLEAN},{argumentType:hn.SCALAR,passSubtype:!0}],repeatLastArgs:2},AND:{method:"and",parameters:[{argumentType:hn.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},OR:{method:"or",parameters:[{argumentType:hn.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},XOR:{method:"xor",parameters:[{argumentType:hn.BOOLEAN}],repeatLastArgs:1,expandRanges:!0},NOT:{method:"not",parameters:[{argumentType:hn.BOOLEAN}]},SWITCH:{method:"switch",parameters:[{argumentType:hn.NOERROR},{argumentType:hn.SCALAR,passSubtype:!0},{argumentType:hn.SCALAR,passSubtype:!0}],repeatLastArgs:1},IFERROR:{method:"iferror",parameters:[{argumentType:hn.SCALAR,passSubtype:!0},{argumentType:hn.SCALAR,passSubtype:!0}]},IFNA:{method:"ifna",parameters:[{argumentType:hn.SCALAR,passSubtype:!0},{argumentType:hn.SCALAR,passSubtype:!0}]},CHOOSE:{method:"choose",parameters:[{argumentType:hn.INTEGER,minValue:1},{argumentType:hn.SCALAR,passSubtype:!0}],repeatLastArgs:1}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class lo extends un{char(e,t){return this.runFunction(e.args,t,this.metadata("CHAR"),(e=>e<1||e>=256?new Tr(ir.VALUE,Z.CharacterCodeBounds):String.fromCharCode(Math.trunc(e))))}unichar(e,t){return this.runFunction(e.args,t,this.metadata("CHAR"),(e=>e<1||e>=1114112?new Tr(ir.VALUE,Z.CharacterCodeBounds):String.fromCodePoint(Math.trunc(e))))}}lo.implementedFunctions={CHAR:{method:"char",parameters:[{argumentType:hn.NUMBER}]},UNICHAR:{method:"unichar",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ho extends un{code(e,t){return this.runFunction(e.args,t,this.metadata("CODE"),(e=>0===e.length?new Tr(ir.VALUE,Z.EmptyString):e.charCodeAt(0)))}unicode(e,t){return this.runFunction(e.args,t,this.metadata("UNICODE"),(e=>{var t;return null!==(t=e.codePointAt(0))&&void 0!==t?t:new Tr(ir.VALUE,Z.EmptyString)}))}}ho.implementedFunctions={CODE:{method:"code",parameters:[{argumentType:hn.STRING}]},UNICODE:{method:"unicode",parameters:[{argumentType:hn.STRING}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class uo extends un{countblank(e,t){return this.runFunction(e.args,t,this.metadata("COUNTBLANK"),((...e)=>{let t=0;return e.forEach((e=>{e===Ye&&t++})),t}))}}uo.implementedFunctions={COUNTBLANK:{method:"countblank",parameters:[{argumentType:hn.SCALAR}],repeatLastArgs:1,expandRanges:!0}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class co extends un{countunique(e,t){return this.runFunction(e.args,t,this.metadata("COUNTUNIQUE"),((...e)=>{const t=new Set,r=new Set;for(const n of e)n instanceof Tr?r.add(n.type):""!==n&&t.add(n);return t.size+r.size}))}}co.implementedFunctions={COUNTUNIQUE:{method:"countunique",parameters:[{argumentType:hn.SCALAR}],repeatLastArgs:1,expandRanges:!0}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class po extends un{constructor(){super(...arguments),this.isoweeknumCore=e=>{const t=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e)),r=this.dateTimeHelper.numberToSimpleDate(e),n=this.dateTimeHelper.dateToNumber({year:r.year,month:1,day:1}),s=this.dateTimeHelper.relativeNumberToAbsoluteNumber(n),i=s+((4-s)%7+7)%7,o=Math.floor((t-1)/7)-Math.floor((i-1)/7)+1;return 0===o?this.isoweeknumCore(e-7)+1:o},this.days360Core=(e,t,r)=>{const n=this.dateTimeHelper.numberToSimpleDate(e),s=this.dateTimeHelper.numberToSimpleDate(t);let i,o;return r?(i=Wn(n),o=Wn(s)):[i,o]=this.dateTimeHelper.toBasisUS(n,s),360*(o.year-i.year)+30*(o.month-i.month)+o.day-i.day}}date(e,t){return this.runFunction(e.args,t,this.metadata("DATE"),((e,t,r)=>{const n=Math.trunc(r);let s=Math.trunc(t),i=Math.trunc(e);i<this.dateTimeHelper.getEpochYearZero()&&(i+=this.dateTimeHelper.getEpochYearZero());const o=Math.floor((s-1)/12);i+=o,s-=12*o;const a={year:i,month:s,day:1};if(this.dateTimeHelper.isValidDate(a)){let e=this.dateTimeHelper.dateToNumber(a)+(n-1);return e=this.dateTimeHelper.getWithinBounds(e),void 0===e?new Tr(ir.NUM,Z.DateBounds):e}return new Tr(ir.VALUE,Z.InvalidDate)}))}time(e,t){return this.runFunction(e.args,t,this.metadata("TIME"),((e,t,r)=>{const n=Bn({hours:Math.trunc(e),minutes:Math.trunc(t),seconds:Math.trunc(r)});return n<0?new Tr(ir.NUM,Z.NegativeTime):n%1}))}eomonth(e,t){return this.runFunction(e.args,t,this.metadata("EOMONTH"),((e,t)=>{const r=this.dateTimeHelper.numberToSimpleDate(e);let n=this.dateTimeHelper.dateToNumber(this.dateTimeHelper.endOfMonth(Fn(r,t)));return n=this.dateTimeHelper.getWithinBounds(n),void 0===n?new Tr(ir.NUM,Z.DateBounds):n}))}day(e,t){return this.runFunction(e.args,t,this.metadata("DAY"),(e=>this.dateTimeHelper.numberToSimpleDate(e).day))}days(e,t){return this.runFunction(e.args,t,this.metadata("DAYS"),((e,t)=>Math.trunc(e)-Math.trunc(t)))}month(e,t){return this.runFunction(e.args,t,this.metadata("MONTH"),(e=>this.dateTimeHelper.numberToSimpleDate(e).month))}year(e,t){return this.runFunction(e.args,t,this.metadata("YEAR"),(e=>this.dateTimeHelper.numberToSimpleDate(e).year))}hour(e,t){return this.runFunction(e.args,t,this.metadata("HOUR"),(e=>Vn(Un(e)%1).hours))}minute(e,t){return this.runFunction(e.args,t,this.metadata("MINUTE"),(e=>Vn(Un(e)%1).minutes))}second(e,t){return this.runFunction(e.args,t,this.metadata("SECOND"),(e=>Vn(Un(e)%1).seconds))}text(e,t){return this.runFunction(e.args,t,this.metadata("TEXT"),((e,t)=>Zn(e,t,this.config,this.dateTimeHelper)))}weekday(e,t){return this.runFunction(e.args,t,this.metadata("WEEKDAY"),((e,t)=>{const r=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e));if(3===t)return(r-1)%7;const n=mo.get(t);return void 0===n?new Tr(ir.NUM,Z.BadMode):(r-n)%7+1}))}weeknum(e,t){return this.runFunction(e.args,t,this.metadata("WEEKNUM"),((e,t)=>{const r=Math.floor(this.dateTimeHelper.relativeNumberToAbsoluteNumber(e)),n=this.dateTimeHelper.numberToSimpleDate(e),s=this.dateTimeHelper.dateToNumber({year:n.year,month:1,day:1}),i=this.dateTimeHelper.relativeNumberToAbsoluteNumber(s);if(21===t)return this.isoweeknumCore(e);const o=mo.get(t);return void 0===o?new Tr(ir.NUM,Z.BadMode):Math.floor((r-o)/7)-Math.floor((i-o)/7)+1}))}isoweeknum(e,t){return this.runFunction(e.args,t,this.metadata("ISOWEEKNUM"),this.isoweeknumCore)}datevalue(e,t){return this.runFunction(e.args,t,this.metadata("DATEVALUE"),(e=>{const{dateTime:t}=this.dateTimeHelper.parseDateTimeFromConfigFormats(e);return void 0===t?new Tr(ir.VALUE,Z.IncorrectDateTime):Ln(t)?(Dn(t)?Math.trunc(Bn(t)):0)+this.dateTimeHelper.dateToNumber(t):0}))}timevalue(e,t){return this.runFunction(e.args,t,this.metadata("TIMEVALUE"),(e=>{const t=this.dateTimeHelper.dateStringToDateNumber(e);return void 0===t?new Tr(ir.VALUE,Z.IncorrectDateTime):je(t)%1}))}now(e,t){return this.runFunction(e.args,t,this.metadata("NOW"),(()=>{const e=new Date(Date.now());return Bn({hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()})+this.dateTimeHelper.dateToNumber({year:e.getFullYear(),month:e.getMonth()+1,day:e.getDa
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Eo extends un{degrees(e,t){return this.runFunction(e.args,t,this.metadata("DEGREES"),(e=>e*(180/Math.PI)))}}Eo.implementedFunctions={DEGREES:{method:"degrees",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class wo extends un{delta(e,t){return this.runFunction(e.args,t,this.metadata("DELTA"),((e,t)=>e===t?1:0))}}wo.implementedFunctions={DELTA:{method:"delta",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:0}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Co extends un{exp(e,t){return this.runFunction(e.args,t,this.metadata("EXP"),Math.exp)}}Co.implementedFunctions={EXP:{method:"exp",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class vo extends un{pmt(e,t){return this.runFunction(e.args,t,this.metadata("PMT"),Ro)}ipmt(e,t){return this.runFunction(e.args,t,this.metadata("IPMT"),So)}ppmt(e,t){return this.runFunction(e.args,t,this.metadata("PPMT"),No)}fv(e,t){return this.runFunction(e.args,t,this.metadata("FV"),To)}cumipmt(e,t){return this.runFunction(e.args,t,this.metadata("CUMIPMT"),((e,t,r,n,s,i)=>{if(n>s)return new Tr(ir.NUM,Z.EndStartPeriod);let o=0;for(let a=n;a<=s;a++)o+=So(e,a,t,r,0,i);return o}))}cumprinc(e,t){return this.runFunction(e.args,t,this.metadata("CUMPRINC"),((e,t,r,n,s,i)=>{if(n>s)return new Tr(ir.NUM,Z.EndStartPeriod);let o=0;for(let a=n;a<=s;a++)o+=No(e,a,t,r,0,i);return o}))}db(e,t){return this.runFunction(e.args,t,this.metadata("DB"),((e,t,r,n,s)=>{if(12===s&&n>r||n>r+1)return new Tr(ir.NUM,Z.PeriodLong);if(t>=e)return 0;const i=Math.round(1e3*(1-Math.pow(t/e,1/r)))/1e3,o=e*i*s/12;if(1===n)return o;let a=o;for(let t=0;t<n-2;t++)a+=(e-a)*i;return n===r+1?(e-a)*i*(12-s)/12:(e-a)*i}))}ddb(e,t){return this.runFunction(e.args,t,this.metadata("DDB"),((e,t,r,n,s)=>{if(n>r)return new Tr(ir.NUM);let i,o=s/r;o>=1?(o=1,i=1===n?e:0):i=e*Math.pow(1-o,n-1);const a=e*Math.pow(1-o,n);return Math.max(i-Math.max(t,a),0)}))}dollarde(e,t){return this.runFunction(e.args,t,this.metadata("DOLLARDE"),((e,t)=>{if(t<1)return new Tr(ir.DIV_BY_ZERO);for(t=Math.trunc(t);t>10;)t/=10;return Math.trunc(e)+10*(e-Math.trunc(e))/t}))}dollarfr(e,t){return this.runFunction(e.args,t,this.metadata("DOLLARFR"),((e,t)=>{if(t<1)return new Tr(ir.DIV_BY_ZERO);for(t=Math.trunc(t);t>10;)t/=10;return Math.trunc(e)+(e-Math.trunc(e))*t/10}))}effect(e,t){return this.runFunction(e.args,t,this.metadata("EFFECT"),((e,t)=>(t=Math.trunc(t),Math.pow(1+e/t,t)-1)))}ispmt(e,t){return this.runFunction(e.args,t,this.metadata("ISPMT"),((e,t,r,n)=>0===r?new Tr(ir.DIV_BY_ZERO):n*e*(t/r-1)))}nominal(e,t){return this.runFunction(e.args,t,this.metadata("NOMINAL"),((e,t)=>(t=Math.trunc(t),(Math.pow(e+1,1/t)-1)*t)))}nper(e,t){return this.runFunction(e.args,t,this.metadata("NPER"),((e,t,r,n,s)=>0===e?0===t?new Tr(ir.DIV_BY_ZERO):(-r-n)/t:(s&&(t*=1+e),Math.log((t-n*e)/(r*e+t))/Math.log(1+e))))}rate(e,t){return this.runFunction(e.args,t,this.metadata("RATE"),((e,t,r,n,s,i)=>{if(i<=-1)return new Tr(ir.VALUE);const o=1e-7;let a=i;s=s?1:0;for(let i=0;i<50;i++){if(a<=-1)return new Tr(ir.NUM);let i,l;if(Math.abs(a)<o)i=r*(1+e*a)+t*(1+a*s)*e+n;else{const o=Math.pow(1+a,e);i=r*o+t*(1/a+s)*(o-1)+n}if(Math.abs(i)<o)return a;if(Math.abs(a)<o)l=r*e+t*s*e;else{const n=Math.pow(1+a,e),i=e*Math.pow(1+a,e-1);l=r*i+t*(1/a+s)*i+t*(-1/(a*a))*(n-1)}a-=i/l}return new Tr(ir.NUM)}))}pv(e,t){return this.runFunction(e.args,t,this.metadata("PV"),((e,t,r,n,s)=>(s=s?1:0,-1===e?new Tr(0===t?ir.NUM:ir.DIV_BY_ZERO):0===e?-r*t-n:((1-Math.pow(1+e,t))*r*(1+e*s)/e-n)/Math.pow(1+e,t))))}rri(e,t){return this.runFunction(e.args,t,this.metadata("RRI"),((e,t,r)=>0===t||r<0&&t>0||r>0&&t<0?new Tr(ir.NUM):Math.pow(r/t,1/e)-1))}sln(e,t){return this.runFunction(e.args,t,this.metadata("SLN"),((e,t,r)=>0===r?new Tr(ir.DIV_BY_ZERO):(e-t)/r))}syd(e,t){return this.runFunction(e.args,t,this.metadata("SYD"),((e,t,r,n)=>n>r?new Tr(ir.NUM):(e-t)*(r-n+1)*2/(r*(r+1))))}tbilleq(e,t){return this.runFunction(e.args,t,this.metadata("TBILLEQ"),((e,t,r)=>{if((e=Math.round(e))>=(t=Math.round(t)))return new Tr(ir.NUM);const n=this.dateTimeHelper.numberToSimpleDate(e),s=this.dateTimeHelper.numberToSimpleDate(t);if(s.year>n.year+1||s.year===n.year+1&&(s.month>n.month||s.month===n.month&&s.day>n.day))return new Tr(ir.NUM);const i=360-r*(t-e);return 0===i?0:i<0?new Tr(ir.NUM):365*r/i}))}tbillprice(e,t){return this.runFunction(e.args,t,this.metadata("TBILLPRICE"),((e,t,r)=>{if((e=Math.round(e))>=(t=Math.round(t)))return new Tr(ir.NUM);const n=this.dateTimeHelper.numberToSimpleDate(e),s=this.dateTimeHelper.numberToSimpleDate(t);if(s.year>n.year+1||s.year===n.year+1&&(s.month>n.month||s.month===n.month&&s.day>n.day))return new Tr(ir.NUM);const i=360-r*(t-e);return 0===i?0:i<0?new Tr(ir.NUM):100*(1-r*(t-e)/360)}))}tbillyield(e,t){return this.runFunction(e.args,t,
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class _o extends un{formulatext(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("FORMULATEXT"),(()=>new Tr(ir.NA,Z.WrongArgNumber)),(e=>{var t;return null!==(t=this.serialization.getCellFormula(e))&&void 0!==t?t:new Tr(ir.NA,Z.Formula)}))}}_o.implementedFunctions={FORMULATEXT:{method:"formulatext",parameters:[{argumentType:hn.NOERROR}],doesNotNeedArgumentsToBeComputed:!0,isDependentOnSheetStructureChange:!0,vectorizationForbidden:!0}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class bo extends un{hyperlink(e,t){return this.runFunction(e.args,t,this.metadata("HYPERLINK"),((t,r)=>(e.hyperlink=t,null!=r?r:t)))}}bo.implementedFunctions={HYPERLINK:{method:"hyperlink",parameters:[{argumentType:hn.STRING},{argumentType:hn.STRING,optionalArg:!0}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ao extends un{isbinary(e,t){return this.runFunction(e.args,t,this.metadata("ISBINARY"),(e=>/^[01]{1,10}$/.test(e)))}iserr(e,t){return this.runFunction(e.args,t,this.metadata("ISERR"),(e=>e instanceof Tr&&e.type!==ir.NA))}iserror(e,t){return this.runFunction(e.args,t,this.metadata("ISERROR"),(e=>e instanceof Tr))}isformula(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("ISFORMULA"),(()=>new Tr(ir.NA,Z.WrongArgNumber)),(e=>this.dependencyGraph.addressMapping.getCell(e)instanceof Gt))}isblank(e,t){return this.runFunction(e.args,t,this.metadata("ISBLANK"),(e=>e===Ye))}isna(e,t){return this.runFunction(e.args,t,this.metadata("ISNA"),(e=>e instanceof Tr&&e.type==ir.NA))}isnumber(e,t){return this.runFunction(e.args,t,this.metadata("ISNUMBER"),Ze)}islogical(e,t){return this.runFunction(e.args,t,this.metadata("ISLOGICAL"),(e=>"boolean"==typeof e))}isref(e,t){return this.runFunction(e.args,t,this.metadata("ISREF"),(e=>e instanceof Tr&&(e.type==ir.REF||e.type==ir.CYCLE)))}istext(e,t){return this.runFunction(e.args,t,this.metadata("ISTEXT"),(e=>"string"==typeof e))}isnontext(e,t){return this.runFunction(e.args,t,this.metadata("ISNONTEXT"),(e=>!("string"==typeof e)))}column(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("COLUMN"),(()=>t.formulaAddress.col+1),(e=>e.col+1))}columns(e,t){if(1!==e.args.length)return new Tr(ir.NA,Z.WrongArgNumber);if(e.args.some((e=>e.type===U.EMPTY)))return new Tr(ir.NUM,Z.EmptyArg);let r=e.args[0];for(;r.type===U.PARENTHESIS;)r=r.expression;if(r.type===U.CELL_RANGE||r.type===U.COLUMN_RANGE)return r.end.col-r.start.col+1;if(r.type===U.CELL_REFERENCE)return 1;if(r.type===U.ROW_RANGE)return this.config.maxColumns;{const e=this.evaluateAst(r,t);return e instanceof rt?e.width():e instanceof Tr?e:1}}row(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("ROW"),(()=>t.formulaAddress.row+1),(e=>e.row+1))}rows(e,t){if(1!==e.args.length)return new Tr(ir.NA,Z.WrongArgNumber);if(e.args.some((e=>e.type===U.EMPTY)))return new Tr(ir.NUM,Z.EmptyArg);let r=e.args[0];for(;r.type===U.PARENTHESIS;)r=r.expression;if(r.type===U.CELL_RANGE||r.type===U.ROW_RANGE)return r.end.row-r.start.row+1;if(r.type===U.CELL_REFERENCE)return 1;if(r.type===U.COLUMN_RANGE)return this.config.maxRows;{const e=this.evaluateAst(r,t);return e instanceof rt?e.height():e instanceof Tr?e:1}}index(e,t){return this.runFunction(e.args,t,this.metadata("INDEX"),((e,t,r)=>{var n,s,i,o,a,l;return r<1||t<1?new Tr(ir.VALUE,Z.LessThanOne):r>e.width()||t>e.height()?new Tr(ir.NUM,Z.ValueLarge):null!==(l=null!==(i=null===(s=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n[t-1])||void 0===s?void 0:s[r-1])&&void 0!==i?i:null===(a=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a[0])&&void 0!==l?l:new Tr(ir.VALUE,Z.CellRangeExpected)}))}na(e,t){return new Tr(ir.NA)}sheet(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("SHEET"),(()=>t.formulaAddress.sheet+1),(e=>e.sheet+1),(e=>{const t=this.dependencyGraph.sheetMapping.get(e);return void 0!==t?t+1:new Tr(ir.NA,Z.SheetRef)}))}sheets(e,t){return this.runFunctionWithReferenceArgument(e.args,t,this.metadata("SHEETS"),(()=>this.dependencyGraph.sheetMapping.numberOfSheets()),(()=>1),(()=>new Tr(ir.VALUE,Z.CellRefExpected)))}}Ao.implementedFunctions={COLUMN:{method:"column",parameters:[{argumentType:hn.NOERROR,optionalArg:!0}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},COLUMNS:{method:"columns",parameters:[{argumentType:hn.RANGE}],isDependentOnSheetStructureChange:!0,doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},ISBINARY:{method:"isbinary",parameters:[{argumentType:hn.STRING}]},ISERR:{method:"iserr",parameters:[{argumentType:hn.SCALAR}]},ISFORMULA:{method:"isformula",parameters:[{argumentType:hn.NOERROR}],doesNotNeedArgumentsToBeComputed:!0,vectorizationForbidden:!0},ISNA:{method:"isna",parameters:[{argumentType:hn.SCALAR}]},ISREF:{method:"isref",parameters:[{argumentType:hn.SCALAR}],vectorizationForbidden:!0},ISE
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Oo extends un{iseven(e,t){return this.runFunction(e.args,t,this.metadata("ISEVEN"),(e=>e%2==0))}}Oo.implementedFunctions={ISEVEN:{method:"iseven",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Io extends un{isodd(e,t){return this.runFunction(e.args,t,this.metadata("ISODD"),(e=>e%2==1))}}Io.implementedFunctions={ISODD:{method:"isodd",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class xo extends un{log10(e,t){return this.runFunction(e.args,t,this.metadata("LOG10"),Math.log10)}log(e,t){return this.runFunction(e.args,t,this.metadata("LOG"),((e,t)=>Math.log(e)/Math.log(t)))}ln(e,t){return this.runFunction(e.args,t,this.metadata("LN"),Math.log)}}xo.implementedFunctions={LOG10:{method:"log10",parameters:[{argumentType:hn.NUMBER}]},LOG:{method:"log",parameters:[{argumentType:hn.NUMBER,greaterThan:0},{argumentType:hn.NUMBER,defaultValue:10,greaterThan:0}]},LN:{method:"ln",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const Po=parseFloat(Math.PI.toFixed(14));class Lo extends un{pi(e,t){return this.runFunction(e.args,t,this.metadata("PI"),(()=>Po))}sqrtpi(e,t){return this.runFunction(e.args,t,this.metadata("SQRTPI"),(e=>Math.sqrt(Po*e)))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function Do(e,t){return new cn(t.width,e.height)}function ko(e,t,r){return new cn(1+(e.width-t)/r,1+(e.height-t)/r)}Lo.implementedFunctions={PI:{method:"pi",parameters:[]},SQRTPI:{method:"sqrtpi",parameters:[{argumentType:hn.NUMBER,minValue:0}]}};class Ho extends un{mmult(e,t){return this.runFunction(e.args,t,this.metadata("MMULT"),((e,t)=>{if(!e.hasOnlyNumbers()||!t.hasOnlyNumbers())return new Tr(ir.VALUE,Z.NumberRange);if(t.height()!==e.width())return new Tr(ir.VALUE,Z.ArrayDimensions);const r=Do(e.size,t.size),n=this.createKernel((function(e,t,r){let n=0;for(let s=0;s<r;++s)n+=e[this.thread.y][s]*t[s][this.thread.x];return n}),r)(e.rawNumbers(),t.rawNumbers(),e.width());return rt.onlyNumbers(n)}))}mmultArraySize(e,t){if(2!==e.args.length)return cn.error();const r=this.metadata("MMULT"),n=e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))})),[s,i]=n;return Do(s,i)}maxpool(e,t){return this.runFunction(e.args,t,this.metadata("MAXPOOL"),((e,t,r=t)=>{if(!e.hasOnlyNumbers())return new Tr(ir.VALUE,Z.NumberRange);const n=ko(e.size,t,r),s=this.createKernel((function(e,t,r){const n=this.thread.x*r,s=this.thread.y*r;let i=e[s][n];for(let r=0;r<t;r++)for(let o=0;o<t;o++)i=Math.max(i,e[s+r][n+o]);return i}),n)(e.rawNumbers(),t,r);return rt.onlyNumbers(s)}))}medianpool(e,t){return this.runFunction(e.args,t,this.metadata("MEDIANPOOL"),((e,t,r=t)=>{if(!e.hasOnlyNumbers())return new Tr(ir.VALUE,Z.NumberRange);const n=ko(e.size,t,r),s=this.createKernel((function(e,t,r){const n=this.thread.x*r,s=this.thread.y*r;let i=e[s][n];for(let r=0;r<t;r++)for(let o=0;o<t;o++)i=Math.max(i,e[s+r][n+o]);let o=e[s][n];for(let r=0;r<t;r++)for(let i=0;i<t;i++)o=Math.min(o,e[s+r][n+i]);const a=t*t;let l=o,h=i,u=42;for(let r=0;r<32;r++){const r=(l+h)/2;let i=0;for(let o=0;o<t;o++)for(let a=0;a<t;a++)e[s+o][n+a]>r&&i++;if(t%2==0){if(i===a/2){u=r;break}i>a/2?l=r:h=r}else{if(i===(a-1)/2){u=r;break}i>(a-1)/2?l=r:h=r}}return u}),n)(e.rawNumbers(),t,r);return rt.onlyNumbers(s)}))}maxpoolArraySize(e,t){if(e.args.length<2||e.args.length>3)return cn.error();const r=this.metadata("MAXPOOL"),n=e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))}))[0],s=e.args[1];let i;i=s.type===U.NUMBER?s.value:1;let o=i;if(3===e.args.length){const t=e.args[2];o=t.type===U.NUMBER?t.value:1}return i>n.width||i>n.height||o>i||(n.width-i)%o!=0||(n.height-i)%o!=0?cn.error():ko(n,i,o)}medianpoolArraySize(e,t){return this.maxpoolArraySize(e,t)}transpose(e,t){return this.runFunction(e.args,t,this.metadata("TRANSPOSE"),(e=>{const t=e.rawData(),r=e.size,n=[];for(let e=0;e<r.width;++e){n[e]=[];for(let s=0;s<r.height;++s)n[e][s]=t[s][e]}return rt.onlyValues(n)}))}transposeArraySize(e,t){if(1!==e.args.length)return cn.error();const r=this.metadata("TRANSPOSE"),n=e.args.map((e=>{var n;return this.arraySizeForAst(e,new Br(t.formulaAddress,t.arraysFlag||null!==(n=null==r?void 0:r.arrayFunction)&&void 0!==n&&n))})),[s]=n;return new cn(s.height,s.width)}createKernel(e,t){return function(...r){const n=[];for(let s=0;s<t.height;++s){n.push([]);for(let i=0;i<t.width;++i)n[s][i]=e.apply({thread:{x:i,y:s}},r)}return n}}}Ho.implementedFunctions={MMULT:{method:"mmult",arraySizeMethod:"mmultArraySize",parameters:[{argumentType:hn.RANGE},{argumentType:hn.RANGE}],vectorizationForbidden:!0},TRANSPOSE:{method:"transpose",arraySizeMethod:"transposeArraySize",parameters:[{argumentType:hn.RANGE}],vectorizationForbidden:!0},MAXPOOL:{method:"maxpool",arraySizeMethod:"maxpoolArraySize",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0}],vectorizationForbidden:!0},MEDIANPOOL:{method:"medianpool",arraySizeMethod:"medianpoolArraySize",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0}],vectorizationForbidden:!0}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Fo extends un{median(e,t){return this.runFunction(e.args,t,this.metadata("MEDIAN"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersExactRanges(e);return t instanceof Tr?t:0===t.length?new Tr(ir.NUM,Z.OneValue):(t.sort(((e,t)=>e-t)),t.length%2==0?(t[t.length/2-1]+t[t.length/2])/2:t[Math.floor(t.length/2)])}))}large(e,t){return this.runFunction(e.args,t,this.metadata("LARGE"),((e,t)=>{const r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());return r instanceof Tr?r:(r.sort(((e,t)=>e-t)),(t=Math.trunc(t))>r.length?new Tr(ir.NUM,Z.ValueLarge):r[r.length-t])}))}small(e,t){return this.runFunction(e.args,t,this.metadata("SMALL"),((e,t)=>{const r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());return r instanceof Tr?r:(r.sort(((e,t)=>e-t)),(t=Math.trunc(t))>r.length?new Tr(ir.NUM,Z.ValueLarge):r[t-1])}))}}Fo.implementedFunctions={MEDIAN:{method:"median",parameters:[{argumentType:hn.ANY}],repeatLastArgs:1},LARGE:{method:"large",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NUMBER,minValue:1}]},SMALL:{method:"small",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NUMBER,minValue:1}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Uo extends un{mod(e,t){return this.runFunction(e.args,t,this.metadata("MOD"),((e,t)=>0===t?new Tr(ir.DIV_BY_ZERO):e%t))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function Vo(e){return Ze(e)&&!Number.isFinite(je(e))?0:e}Uo.implementedFunctions={MOD:{method:"mod",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]}};class Bo{constructor(e,t,r){this.sumsq=e,this.sum=t,this.count=r}static single(e){return new Bo(e*e,e,1)}compose(e){return new Bo(this.sumsq+e.sumsq,this.sum+e.sum,this.count+e.count)}averageValue(){return this.count>0?this.sum/this.count:void 0}varSValue(){return this.count>1?(this.sumsq-this.sum*this.sum/this.count)/(this.count-1):void 0}varPValue(){return this.count>0?(this.sumsq-this.sum*this.sum/this.count)/this.count:void 0}}Bo.empty=new Bo(0,0,0);class Wo extends un{constructor(){super(...arguments),this.addWithEpsilonRaw=(e,t)=>this.arithmeticHelper.addWithEpsilonRaw(e,t)}sum(e,t){return this.doSum(e.args,t)}sumsq(e,t){return this.reduce(e.args,t,0,"SUMSQ",this.addWithEpsilonRaw,(e=>Math.pow(je(e),2)),Yo)}max(e,t){return this.doMax(e.args,t)}maxa(e,t){return Vo(this.reduce(e.args,t,Number.NEGATIVE_INFINITY,"MAXA",((e,t)=>Math.max(e,t)),je,jo))}min(e,t){return this.doMin(e.args,t)}mina(e,t){return Vo(this.reduce(e.args,t,Number.POSITIVE_INFINITY,"MINA",((e,t)=>Math.min(e,t)),je,jo))}count(e,t){return this.doCount(e.args,t)}counta(e,t){return this.doCounta(e.args,t)}average(e,t){return this.doAverage(e.args,t)}averagea(e,t){var r;const n=this.reduce(e.args,t,Bo.empty,"_AGGREGATE_A",((e,t)=>e.compose(t)),(e=>Bo.single(je(e))),jo);return n instanceof Tr?n:null!==(r=n.averageValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}vars(e,t){return this.doVarS(e.args,t)}varp(e,t){return this.doVarP(e.args,t)}vara(e,t){var r;const n=this.reduceAggregateA(e.args,t);return n instanceof Tr?n:null!==(r=n.varSValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}varpa(e,t){var r;const n=this.reduceAggregateA(e.args,t);return n instanceof Tr?n:null!==(r=n.varPValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}stdevs(e,t){return this.doStdevS(e.args,t)}stdevp(e,t){return this.doStdevP(e.args,t)}stdeva(e,t){const r=this.reduceAggregateA(e.args,t);if(r instanceof Tr)return r;{const e=r.varSValue();return void 0===e?new Tr(ir.DIV_BY_ZERO):Math.sqrt(e)}}stdevpa(e,t){const r=this.reduceAggregateA(e.args,t);if(r instanceof Tr)return r;{const e=r.varPValue();return void 0===e?new Tr(ir.DIV_BY_ZERO):Math.sqrt(e)}}product(e,t){return this.doProduct(e.args,t)}subtotal(e,t){if(e.args.length<2)return new Tr(ir.NA,Z.WrongArgNumber);const r=this.coerceToType(this.evaluateAst(e.args[0],t),{argumentType:hn.NUMBER},t),n=e.args.slice(1);switch(r){case 1:case 101:return this.doAverage(n,t);case 2:case 102:return this.doCount(n,t);case 3:case 103:return this.doCounta(n,t);case 4:case 104:return this.doMax(n,t);case 5:case 105:return this.doMin(n,t);case 6:case 106:return this.doProduct(n,t);case 7:case 107:return this.doStdevS(n,t);case 8:case 108:return this.doStdevP(n,t);case 9:case 109:return this.doSum(n,t);case 10:case 110:return this.doVarS(n,t);case 11:case 111:return this.doVarP(n,t);default:return new Tr(ir.VALUE,Z.BadMode)}}reduceAggregate(e,t){return this.reduce(e,t,Bo.empty,"_AGGREGATE",((e,t)=>e.compose(t)),(e=>Bo.single(je(e))),Yo)}reduceAggregateA(e,t){return this.reduce(e,t,Bo.empty,"_AGGREGATE_A",((e,t)=>e.compose(t)),(e=>Bo.single(je(e))),jo)}doAverage(e,t){var r;const n=this.reduceAggregate(e,t);return n instanceof Tr?n:null!==(r=n.averageValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}doVarS(e,t){var r;const n=this.reduceAggregate(e,t);return n instanceof Tr?n:null!==(r=n.varSValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}doVarP(e,t){var r;const n=this.reduceAggregate(e,t);return n instanceof Tr?n:null!==(r=n.varPValue())&&void 0!==r?r:new Tr(ir.DIV_BY_ZERO)}doStdevS(e,t){const r=this.reduceAggregate(e,t);if(r instanceof Tr)return r;{const e=r.varSValue();return void 0===e?new Tr(ir.DIV_BY_ZERO):Math.sqrt(e)}}doStdevP(e,t){const r=this.reduceAggregate(e,t);if(r instanceof Tr)return r;{const e=r.varPValue();return void 0===e?new Tr(ir.DIV_BY_ZERO):Math.sqrt(e)}}doCount(e,t){return this.reduce(e,t,0,"COUNT",((e,t)=>e+t),je,(e=>Ze(e)?1:0))}doCounta(e,t){return this.reduce(e,t,0,"COUNTA",((e,t)
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Go extends un{power(e,t){return this.runFunction(e.args,t,this.metadata("POWER"),Math.pow)}}Go.implementedFunctions={POWER:{method:"power",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class zo extends un{radians(e,t){return this.runFunction(e.args,t,this.metadata("RADIANS"),(e=>e*(Math.PI/180)))}}zo.implementedFunctions={RADIANS:{method:"radians",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
const $o=10;class Ko extends un{dec2bin(e,t){return this.runFunction(e.args,t,this.metadata("DEC2BIN"),((e,t)=>qo(e,2,t)))}dec2oct(e,t){return this.runFunction(e.args,t,this.metadata("DEC2OCT"),((e,t)=>qo(e,8,t)))}dec2hex(e,t){return this.runFunction(e.args,t,this.metadata("DEC2HEX"),((e,t)=>qo(e,16,t)))}bin2dec(e,t){return this.runFunction(e.args,t,this.metadata("BIN2DEC"),(e=>{const t=Xo(e,2,$o);return void 0===t?new Tr(ir.NUM,Z.NotBinary):ea(t,2)}))}bin2oct(e,t){return this.runFunction(e.args,t,this.metadata("BIN2OCT"),((e,t)=>{const r=Xo(e,2,$o);return void 0===r?new Tr(ir.NUM,Z.NotBinary):qo(ea(r,2),8,t)}))}bin2hex(e,t){return this.runFunction(e.args,t,this.metadata("BIN2HEX"),((e,t)=>{const r=Xo(e,2,$o);return void 0===r?new Tr(ir.NUM,Z.NotBinary):qo(ea(r,2),16,t)}))}oct2dec(e,t){return this.runFunction(e.args,t,this.metadata("OCT2DEC"),(e=>{const t=Xo(e,8,$o);return void 0===t?new Tr(ir.NUM,Z.NotOctal):ea(t,8)}))}oct2bin(e,t){return this.runFunction(e.args,t,this.metadata("OCT2BIN"),((e,t)=>{const r=Xo(e,8,$o);return void 0===r?new Tr(ir.NUM,Z.NotOctal):qo(ea(r,8),2,t)}))}oct2hex(e,t){return this.runFunction(e.args,t,this.metadata("OCT2HEX"),((e,t)=>{const r=Xo(e,8,$o);return void 0===r?new Tr(ir.NUM,Z.NotOctal):qo(ea(r,8),16,t)}))}hex2dec(e,t){return this.runFunction(e.args,t,this.metadata("HEX2DEC"),(e=>{const t=Xo(e,16,$o);return void 0===t?new Tr(ir.NUM,Z.NotHex):ea(t,16)}))}hex2bin(e,t){return this.runFunction(e.args,t,this.metadata("HEX2BIN"),((e,t)=>{const r=Xo(e,16,$o);return void 0===r?new Tr(ir.NUM,Z.NotHex):qo(ea(r,16),2,t)}))}hex2oct(e,t){return this.runFunction(e.args,t,this.metadata("HEX2OCT"),((e,t)=>{const r=Xo(e,16,$o);return void 0===r?new Tr(ir.NUM,Z.NotHex):qo(ea(r,16),8,t)}))}base(e,t){return this.runFunction(e.args,t,this.metadata("BASE"),Zo)}decimal(e,t){return this.runFunction(e.args,t,this.metadata("DECIMAL"),((e,t)=>{const r=Xo(e,t,255);return void 0===r?new Tr(ir.NUM,Z.NotHex):parseInt(r,t)}))}}function Xo(e,t,r){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".substr(0,t),s=new RegExp(`^[${n}]+$`);if(!(e.length>r)&&s.test(e))return e}function qo(e,t,r){if(e>function(e){return-Qo(e)-1}(t))return new Tr(ir.NUM,Z.ValueBaseLarge);if(e<Qo(t))return new Tr(ir.NUM,Z.ValueBaseSmall);const n=Jo(e,t);return void 0===r||e<0?n:n.length>r?new Tr(ir.NUM,Z.ValueBaseLong):Jn(n,r)}function Qo(e){return-Math.pow(e,$o)/2}function Zo(e,t,r){const n=Jo(e,t);return void 0!==r&&r>n.length?Jn(n,r):n}function Jo(e,t){return(e+(e<0?Math.pow(t,$o):0)).toString(t).toUpperCase()}function ea(e,t){const r=parseInt(e,t),n=Math.pow(t,$o);return r>=n/2?r-n:r}Ko.implementedFunctions={DEC2BIN:{method:"dec2bin",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},DEC2OCT:{method:"dec2oct",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},DEC2HEX:{method:"dec2hex",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,optionalArg:!0,minValue:1,maxValue:10}]},BIN2DEC:{method:"bin2dec",parameters:[{argumentType:hn.STRING}]},BIN2OCT:{method:"bin2oct",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},BIN2HEX:{method:"bin2hex",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},OCT2DEC:{method:"oct2dec",parameters:[{argumentType:hn.STRING}]},OCT2BIN:{method:"oct2bin",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},OCT2HEX:{method:"oct2hex",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},HEX2DEC:{method:"hex2dec",parameters:[{argumentType:hn.STRING}]},HEX2BIN:{method:"hex2bin",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},HEX2OCT:{method:"hex2oct",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,optionalArg:!0,minValue:0,maxValue:$o}]},DECIMAL:{method:"decimal",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,minValue:2,maxValue:36}]},BASE:{
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ta extends un{rand(e,t){return this.runFunction(e.args,t,this.metadata("RAND"),Math.random)}randbetween(e,t){return this.runFunction(e.args,t,this.metadata("RANDBETWEEN"),((e,t)=>t<e?new Tr(ir.NUM,Z.WrongOrder):((e=Math.ceil(e))===(t=Math.floor(t)+1)&&(t+=1),e+Math.floor(Math.random()*(t-e)))))}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function ra(e){const t=Math.ceil(e);return t%2==1?t:t+1}function na(e){const t=Math.ceil(e);return t%2==0?t:t+1}ta.implementedFunctions={RAND:{method:"rand",parameters:[],isVolatile:!0},RANDBETWEEN:{method:"randbetween",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}],isVolatile:!0}};class sa extends un{roundup(e,t){return this.runFunction(e.args,t,this.metadata("ROUNDDOWN"),((e,t)=>{const r=Math.pow(10,t);return e<0?-Math.ceil(-e*r)/r:Math.ceil(e*r)/r}))}rounddown(e,t){return this.runFunction(e.args,t,this.metadata("ROUNDDOWN"),((e,t)=>{const r=Math.pow(10,t);return e<0?-Math.floor(-e*r)/r:Math.floor(e*r)/r}))}round(e,t){return this.runFunction(e.args,t,this.metadata("ROUND"),((e,t)=>{const r=Math.pow(10,t);return e<0?-Math.round(-e*r)/r:Math.round(e*r)/r}))}intFunc(e,t){return this.runFunction(e.args,t,this.metadata("INT"),(e=>e<0?-Math.floor(-e):Math.floor(e)))}even(e,t){return this.runFunction(e.args,t,this.metadata("EVEN"),(e=>e<0?-na(-e):na(e)))}odd(e,t){return this.runFunction(e.args,t,this.metadata("ODD"),(e=>e<0?-ra(-e):ra(e)))}ceilingmath(e,t){return this.runFunction(e.args,t,this.metadata("CEILING.MATH"),((e,t,r)=>0===t||0===e?0:(t=Math.abs(t),1===r&&e<0&&(t=-t),Math.ceil(e/t)*t)))}ceiling(e,t){return this.runFunction(e.args,t,this.metadata("CEILING"),((e,t)=>0===e?0:0===t?new Tr(ir.DIV_BY_ZERO):e>0&&t<0?new Tr(ir.NUM,Z.DistinctSigns):Math.ceil(e/t)*t))}ceilingprecise(e,t){return this.runFunction(e.args,t,this.metadata("CEILING.PRECISE"),((e,t)=>0===t||0===e?0:(t=Math.abs(t),Math.ceil(e/t)*t)))}floormath(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR.MATH"),((e,t,r)=>0===t||0===e?0:(t=Math.abs(t),1===r&&e<0&&(t*=-1),Math.floor(e/t)*t)))}floor(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR"),((e,t)=>0===e?0:0===t?new Tr(ir.DIV_BY_ZERO):e>0&&t<0?new Tr(ir.NUM,Z.DistinctSigns):Math.floor(e/t)*t))}floorprecise(e,t){return this.runFunction(e.args,t,this.metadata("FLOOR.PRECISE"),((e,t)=>0===t||0===e?0:(t=Math.abs(t),Math.floor(e/t)*t)))}}sa.implementedFunctions={ROUNDUP:{method:"roundup",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:0}]},ROUNDDOWN:{method:"rounddown",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:0}]},ROUND:{method:"round",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:0}]},INT:{method:"intFunc",parameters:[{argumentType:hn.NUMBER}]},EVEN:{method:"even",parameters:[{argumentType:hn.NUMBER}]},ODD:{method:"odd",parameters:[{argumentType:hn.NUMBER}]},"CEILING.MATH":{method:"ceilingmath",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:1},{argumentType:hn.NUMBER,defaultValue:0}]},CEILING:{method:"ceiling",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]},"CEILING.PRECISE":{method:"ceilingprecise",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:1}]},"FLOOR.MATH":{method:"floormath",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:1},{argumentType:hn.NUMBER,defaultValue:0}]},FLOOR:{method:"floor",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]},"FLOOR.PRECISE":{method:"floorprecise",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER,defaultValue:1}]}},sa.aliases={"ISO.CEILING":"CEILING.PRECISE",TRUNC:"ROUNDDOWN"};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ia extends un{sqrt(e,t){return this.runFunction(e.args,t,this.metadata("SQRT"),Math.sqrt)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
function*oa(){}function aa(e){const t=e[Symbol.iterator](),{done:r,value:n}=t.next();return r?{rest:oa()}:{value:n,rest:t}}ia.implementedFunctions={SQRT:{method:"sqrt",parameters:[{argumentType:hn.NUMBER}]}};class la{constructor(e,t,r,n,s){this.interpreter=e,this.cacheKey=t,this.reduceInitialValue=r,this.composeFunction=n,this.mapFunction=s,this.dependencyGraph=this.interpreter.dependencyGraph}compute(e,t){for(const r of t)if(!r.conditionRange.sameDimensionsAs(e))return new Tr(ir.VALUE,Z.EqualLength);const r=this.tryToGetRangeVertexForRangeValue(e),n=t.map((e=>this.tryToGetRangeVertexForRangeValue(e.conditionRange)));if(r&&n.every((e=>void 0!==e))){const s=t.map((e=>e.criterionPackage.raw)).join(","),i=this.findAlreadyComputedValueInCache(r,this.cacheKey(t),s);if(void 0!==i)return this.interpreter.stats.incrementCriterionFunctionFullCacheUsed(),i;const o=this.buildNewCriterionCache(this.cacheKey(t),t.map((e=>e.conditionRange.range)),e.range);return o.has(s)||o.set(s,[this.evaluateRangeValue(e,t),t.map((e=>e.criterionPackage.lambda))]),r.setCriterionFunctionValues(this.cacheKey(t),o),n.forEach((e=>{void 0!==e&&e.addDependentCacheRange(r)})),o.get(s)[0]}return this.evaluateRangeValue(e,t)}tryToGetRangeVertexForRangeValue(e){const t=e.range;return void 0===t?void 0:this.dependencyGraph.getRange(t.start,t.end)}reduceFunction(e){let t=this.reduceInitialValue;for(const r of e)t=this.composeFunction(t,r);return t}findAlreadyComputedValueInCache(e,t,r){return e.getCriterionFunctionValue(t,r)}evaluateRangeValue(e,t){const r=t.map((e=>e.criterionPackage.lambda)),n=Array.from(e.valuesFromTopLeftCorner()).map(this.mapFunction)[Symbol.iterator](),s=ca(r,t.map((e=>e.conditionRange.iterateValuesFromTopLeftCorner())),n);return this.reduceFunction(s)}buildNewCriterionCache(e,t,r){const n=this.dependencyGraph.getRange(r.start,r.end),{smallerRangeVertex:s,restConditionRanges:i,restValuesRange:o}=((e,t,r)=>{if(r.end.row>r.start.row){const n=Ar(r.end.sheet,r.end.col,r.end.row-1),s=e.getRange(r.start,n);if(void 0!==s)return{smallerRangeVertex:s,restValuesRange:r.withStart(Ar(r.start.sheet,r.start.col,r.end.row)),restConditionRanges:t.map((e=>e.withStart(Ar(e.start.sheet,e.start.col,e.end.row))))}}return{restValuesRange:r,restConditionRanges:t}})(this.dependencyGraph,t,r);let a;a=void 0!==s&&this.dependencyGraph.existsEdge(s,n)?s.getCriterionFunctionValues(e):new Map;const l=new Map;return a.forEach((([e,t],r)=>{const n=ca(t,i.map((e=>ua(this.dependencyGraph,e))),Array.from(ua(this.dependencyGraph,o)).map(this.mapFunction)[Symbol.iterator]()),s=this.composeFunction(e,this.reduceFunction(n));this.interpreter.stats.incrementCriterionFunctionPartialCacheUsed(),l.set(r,[s,t])})),l}}class ha{constructor(e,t){this.conditionRange=e,this.criterionPackage=t}}function*ua(e,t){for(const r of t.addresses(e))yield je(e.getScalarValue(r))}function*ca(e,t,r){for(const n of r){const r=t.map((e=>aa(e)));if(!r.every((e=>Object.prototype.hasOwnProperty.call(e,"value"))))return;da(r.map((e=>je(e.value))),e).every((([e,t])=>t(e)))&&(yield n),t=r.map((e=>e.rest))}}function da(e,t){const r=[];for(let n=0;n<Math.min(e.length,t.length);n++)r.push([e[n],t[n]]);return r}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class pa{constructor(e,t){this.sum=e,this.count=t}static single(e){return new pa(e,1)}compose(e){return new pa(this.sum+e.sum,this.count+e.count)}averageValue(){return this.count>0?this.sum/this.count:void 0}}function ga(e){return Ze(e)&&!Number.isFinite(je(e))?0:e}function fa(e){return e instanceof Tr?e:Ze(e)?je(e):void 0}pa.empty=new pa(0,0);class ma extends un{sumif(e,t){const r="SUMIF";return this.runFunction(e.args,t,this.metadata(r),((e,t,n)=>this.computeConditionalAggregationFunction(null!=n?n:e,[e,t],r,0,((e,t)=>this.arithmeticHelper.nonstrictadd(e,t)),fa)))}sumifs(e,t){const r="SUMIFS";return this.runFunction(e.args,t,this.metadata(r),((e,...t)=>this.computeConditionalAggregationFunction(e,t,r,0,((e,t)=>this.arithmeticHelper.nonstrictadd(e,t)),fa)))}averageif(e,t){const r="AVERAGEIF";return this.runFunction(e.args,t,this.metadata(r),((e,t,n)=>{const s=this.computeConditionalAggregationFunction(null!=n?n:e,[e,t],r,pa.empty,((e,t)=>e.compose(t)),(e=>Ze(e)?pa.single(je(e)):pa.empty));return s instanceof Tr?s:s.averageValue()||new Tr(ir.DIV_BY_ZERO)}))}countif(e,t){const r="COUNTIF";return this.runFunction(e.args,t,this.metadata(r),((e,t)=>this.computeConditionalAggregationFunction(e,[e,t],r,0,((e,t)=>e+t),(()=>1))))}countifs(e,t){const r="COUNTIFS";return this.runFunction(e.args,t,this.metadata(r),((...e)=>this.computeConditionalAggregationFunction(e[0],e,r,0,((e,t)=>e+t),(()=>1))))}minifs(e,t){const r="MINIFS",n=(e,t)=>void 0===t||void 0===e?void 0===t?e:t:Math.min(e,t);return this.runFunction(e.args,t,this.metadata(r),((e,...t)=>ga(this.computeConditionalAggregationFunction(e,t,r,Number.POSITIVE_INFINITY,n,fa))))}maxifs(e,t){const r="MAXIFS",n=(e,t)=>void 0===t||void 0===e?void 0===t?e:t:Math.max(e,t);return this.runFunction(e.args,t,this.metadata(r),((e,...t)=>ga(this.computeConditionalAggregationFunction(e,t,r,Number.NEGATIVE_INFINITY,n,fa))))}computeConditionalAggregationFunction(e,t,r,n,s,i){const o=[];for(let e=0;e<t.length;e+=2){const r=t[e],n=this.interpreter.criterionBuilder.fromCellValue(t[e+1],this.arithmeticHelper);if(void 0===n)return new Tr(ir.VALUE,Z.BadCriterion);o.push(new ha(r,n))}return new la(this.interpreter,function(e){return t=>{const r=t.map((e=>`${e.conditionRange.range.sheet},${e.conditionRange.range.start.col},${e.conditionRange.range.start.row}`));return[e,...r].join(",")}}(r),n,s,i).compute(e,o)}}ma.implementedFunctions={SUMIF:{method:"sumif",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NOERROR},{argumentType:hn.RANGE,optionalArg:!0}]},COUNTIF:{method:"countif",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NOERROR}]},AVERAGEIF:{method:"averageif",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NOERROR},{argumentType:hn.RANGE,optionalArg:!0}]},SUMIFS:{method:"sumifs",parameters:[{argumentType:hn.RANGE},{argumentType:hn.RANGE},{argumentType:hn.NOERROR}],repeatLastArgs:2},COUNTIFS:{method:"countifs",parameters:[{argumentType:hn.RANGE},{argumentType:hn.NOERROR}],repeatLastArgs:2},MINIFS:{method:"minifs",parameters:[{argumentType:hn.RANGE},{argumentType:hn.RANGE},{argumentType:hn.NOERROR}],repeatLastArgs:2},MAXIFS:{method:"maxifs",parameters:[{argumentType:hn.RANGE},{argumentType:hn.RANGE},{argumentType:hn.NOERROR}],repeatLastArgs:2}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ya extends un{sumproduct(e,t){return this.runFunction(e.args,t,this.metadata("SUMPRODUCT"),((...e)=>{const t=e[0].width(),r=e[0].height();for(const n of e)if(n.width()!==t||n.height()!==r)return new Tr(ir.VALUE,Z.EqualLength);let n=0;const s=e.map((e=>e.iterateValuesFromTopLeftCorner()));for(let e=0;e<t*r;e++){let e=1;for(const t of s){const r=t.next().value;if(r instanceof Tr)return r;const n=this.coerceScalarToNumberOrError(r);Ze(n)?e*=je(n):e=0}n+=e}return n}))}}ya.implementedFunctions={SUMPRODUCT:{method:"sumproduct",parameters:[{argumentType:hn.RANGE}],repeatLastArgs:1}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ea extends un{concatenate(e,t){return this.runFunction(e.args,t,this.metadata("CONCATENATE"),((...e)=>"".concat(...e)))}split(e,t){return this.runFunction(e.args,t,this.metadata("SPLIT"),((e,t)=>{const r=e.split(" ");return t>=r.length||t<0?new Tr(ir.VALUE,Z.IndexBounds):r[t]}))}len(e,t){return this.runFunction(e.args,t,this.metadata("LEN"),(e=>e.length))}lower(e,t){return this.runFunction(e.args,t,this.metadata("LOWER"),(e=>e.toLowerCase()))}trim(e,t){return this.runFunction(e.args,t,this.metadata("TRIM"),(e=>e.replace(/^ +| +$/g,"").replace(/ +/g," ")))}proper(e,t){return this.runFunction(e.args,t,this.metadata("PROPER"),(e=>e.replace(/\p{L}+/gu,(e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase()))))}clean(e,t){return this.runFunction(e.args,t,this.metadata("CLEAN"),(e=>e.replace(/[\u0000-\u001F]/g,"")))}exact(e,t){return this.runFunction(e.args,t,this.metadata("EXACT"),((e,t)=>e===t))}rept(e,t){return this.runFunction(e.args,t,this.metadata("REPT"),((e,t)=>t<0?new Tr(ir.VALUE,Z.NegativeCount):e.repeat(t)))}right(e,t){return this.runFunction(e.args,t,this.metadata("RIGHT"),((e,t)=>t<0?new Tr(ir.VALUE,Z.NegativeLength):0===t?"":e.slice(-t)))}left(e,t){return this.runFunction(e.args,t,this.metadata("LEFT"),((e,t)=>t<0?new Tr(ir.VALUE,Z.NegativeLength):e.slice(0,t)))}mid(e,t){return this.runFunction(e.args,t,this.metadata("MID"),((e,t,r)=>t<1?new Tr(ir.VALUE,Z.LessThanOne):r<0?new Tr(ir.VALUE,Z.NegativeLength):e.substring(t-1,t+r-1)))}replace(e,t){return this.runFunction(e.args,t,this.metadata("REPLACE"),((e,t,r,n)=>t<1?new Tr(ir.VALUE,Z.LessThanOne):r<0?new Tr(ir.VALUE,Z.NegativeLength):e.substring(0,t-1)+n+e.substring(t+r-1)))}search(e,t){return this.runFunction(e.args,t,this.metadata("SEARCH"),((e,t,r)=>{if(r<1||r>t.length)return new Tr(ir.VALUE,Z.LengthBounds);const n=e.toLowerCase(),s=t.substring(r-1).toLowerCase(),i=this.arithmeticHelper.requiresRegex(n)?this.arithmeticHelper.searchString(n,s):s.indexOf(n);return i>-1?i+r:new Tr(ir.VALUE,Z.PatternNotFound)}))}substitute(e,t){return this.runFunction(e.args,t,this.metadata("SUBSTITUTE"),((e,t,r,n)=>{const s=this.escapeRegExpSpecialCharacters(t),i=new RegExp(s,"g");if(void 0===n)return e.replace(i,r);if(n<1)return new Tr(ir.VALUE,Z.LessThanOne);let o,a=0;for(;null!==(o=i.exec(e));)if(n===++a)return e.substring(0,o.index)+r+e.substring(i.lastIndex);return e}))}find(e,t){return this.runFunction(e.args,t,this.metadata("FIND"),((e,t,r)=>{if(r<1||r>t.length)return new Tr(ir.VALUE,Z.IndexBounds);const n=t.substring(r-1).indexOf(e)+r;return n>0?n:new Tr(ir.VALUE,Z.PatternNotFound)}))}t(e,t){return this.runFunction(e.args,t,this.metadata("T"),(e=>e instanceof Tr||"string"==typeof e?e:""))}upper(e,t){return this.runFunction(e.args,t,this.metadata("UPPER"),(e=>e.toUpperCase()))}escapeRegExpSpecialCharacters(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}Ea.implementedFunctions={CONCATENATE:{method:"concatenate",parameters:[{argumentType:hn.STRING}],repeatLastArgs:1,expandRanges:!0},EXACT:{method:"exact",parameters:[{argumentType:hn.STRING},{argumentType:hn.STRING}]},SPLIT:{method:"split",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER}]},LEN:{method:"len",parameters:[{argumentType:hn.STRING}]},LOWER:{method:"lower",parameters:[{argumentType:hn.STRING}]},MID:{method:"mid",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]},TRIM:{method:"trim",parameters:[{argumentType:hn.STRING}]},T:{method:"t",parameters:[{argumentType:hn.SCALAR}]},PROPER:{method:"proper",parameters:[{argumentType:hn.STRING}]},CLEAN:{method:"clean",parameters:[{argumentType:hn.STRING}]},REPT:{method:"rept",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER}]},RIGHT:{method:"right",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,defaultValue:1}]},LEFT:{method:"left",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER,defaultValue:1}]},REPLACE:{method:"replace",parameters:[{argumentType:hn.STRING},{argumentType:hn.NUMBER},{argumentType:hn.NUMBER},{argumentType:hn.STRING}]},SEARCH:{method:"search",parameters:[{argume
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class wa extends un{acos(e,t){return this.runFunction(e.args,t,this.metadata("ACOS"),Math.acos)}asin(e,t){return this.runFunction(e.args,t,this.metadata("ASIN"),Math.asin)}cos(e,t){return this.runFunction(e.args,t,this.metadata("COS"),Math.cos)}sin(e,t){return this.runFunction(e.args,t,this.metadata("SIN"),Math.sin)}tan(e,t){return this.runFunction(e.args,t,this.metadata("TAN"),Math.tan)}atan(e,t){return this.runFunction(e.args,t,this.metadata("ATAN"),Math.atan)}atan2(e,t){return this.runFunction(e.args,t,this.metadata("ATAN2"),((e,t)=>0===e&&0===t?new Tr(ir.DIV_BY_ZERO):Math.atan2(t,e)))}cot(e,t){return this.runFunction(e.args,t,this.metadata("COT"),(e=>0===e?new Tr(ir.DIV_BY_ZERO):1/Math.tan(e)))}acot(e,t){return this.runFunction(e.args,t,this.metadata("ACOT"),(e=>0===e?Po/2:Math.atan(1/e)))}sec(e,t){return this.runFunction(e.args,t,this.metadata("SEC"),(e=>1/Math.cos(e)))}csc(e,t){return this.runFunction(e.args,t,this.metadata("CSC"),(e=>0===e?new Tr(ir.DIV_BY_ZERO):1/Math.sin(e)))}sinh(e,t){return this.runFunction(e.args,t,this.metadata("SINH"),Math.sinh)}asinh(e,t){return this.runFunction(e.args,t,this.metadata("ASINH"),Math.asinh)}cosh(e,t){return this.runFunction(e.args,t,this.metadata("COSH"),Math.cosh)}acosh(e,t){return this.runFunction(e.args,t,this.metadata("ACOSH"),Math.acosh)}tanh(e,t){return this.runFunction(e.args,t,this.metadata("TANH"),Math.tanh)}atanh(e,t){return this.runFunction(e.args,t,this.metadata("ATANH"),Math.atanh)}coth(e,t){return this.runFunction(e.args,t,this.metadata("COTH"),(e=>0===e?new Tr(ir.DIV_BY_ZERO):1/Math.tanh(e)))}acoth(e,t){return this.runFunction(e.args,t,this.metadata("ACOTH"),(e=>0===e?new Tr(ir.NUM,Z.NonZero):Math.atanh(1/e)))}sech(e,t){return this.runFunction(e.args,t,this.metadata("SECH"),(e=>1/Math.cosh(e)))}csch(e,t){return this.runFunction(e.args,t,this.metadata("CSCH"),(e=>0===e?new Tr(ir.DIV_BY_ZERO):1/Math.sinh(e)))}}wa.implementedFunctions={ACOS:{method:"acos",parameters:[{argumentType:hn.NUMBER}]},ASIN:{method:"asin",parameters:[{argumentType:hn.NUMBER}]},COS:{method:"cos",parameters:[{argumentType:hn.NUMBER}]},SIN:{method:"sin",parameters:[{argumentType:hn.NUMBER}]},TAN:{method:"tan",parameters:[{argumentType:hn.NUMBER}]},ATAN:{method:"atan",parameters:[{argumentType:hn.NUMBER}]},ATAN2:{method:"atan2",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER}]},COT:{method:"cot",parameters:[{argumentType:hn.NUMBER}]},SEC:{method:"sec",parameters:[{argumentType:hn.NUMBER}]},CSC:{method:"csc",parameters:[{argumentType:hn.NUMBER}]},SINH:{method:"sinh",parameters:[{argumentType:hn.NUMBER}]},COSH:{method:"cosh",parameters:[{argumentType:hn.NUMBER}]},TANH:{method:"tanh",parameters:[{argumentType:hn.NUMBER}]},COTH:{method:"coth",parameters:[{argumentType:hn.NUMBER}]},SECH:{method:"sech",parameters:[{argumentType:hn.NUMBER}]},CSCH:{method:"csch",parameters:[{argumentType:hn.NUMBER}]},ACOT:{method:"acot",parameters:[{argumentType:hn.NUMBER}]},ASINH:{method:"asinh",parameters:[{argumentType:hn.NUMBER}]},ACOSH:{method:"acosh",parameters:[{argumentType:hn.NUMBER}]},ATANH:{method:"atanh",parameters:[{argumentType:hn.NUMBER}]},ACOTH:{method:"acoth",parameters:[{argumentType:hn.NUMBER}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ca extends Di{constructor(e){super(e),this.dependencyGraph=e}find(e,t,r){return this.basicFind(e,t,"col",r)}}
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class va extends un{constructor(){super(...arguments),this.rowSearch=new Ca(this.dependencyGraph)}vlookup(e,t){return this.runFunction(e.args,t,this.metadata("VLOOKUP"),((e,t,r,n)=>{const s=t.range;return void 0===s?new Tr(ir.VALUE,Z.WrongType):r<1?new Tr(ir.VALUE,Z.LessThanOne):r>s.width()?new Tr(ir.REF,Z.IndexLarge):this.doVlookup(qr(e),t,r-1,n)}))}hlookup(e,t){return this.runFunction(e.args,t,this.metadata("HLOOKUP"),((e,t,r,n)=>{const s=t.range;return void 0===s?new Tr(ir.VALUE,Z.WrongType):r<1?new Tr(ir.VALUE,Z.LessThanOne):r>s.height()?new Tr(ir.REF,Z.IndexLarge):this.doHlookup(qr(e),t,r-1,n)}))}match(e,t){return this.runFunction(e.args,t,this.metadata("MATCH"),((e,t,r)=>this.doMatch(qr(e),t,r)))}searchInRange(e,t,r,n){if(!r&&"string"==typeof e&&this.arithmeticHelper.requiresRegex(e))return n.advancedFind(this.arithmeticHelper.eqMatcherFunction(e),t);{const s=r?{ordering:"asc"}:{ordering:"none",matchExactly:!0};return n.find(e,t,s)}}doVlookup(e,t,r,n){this.dependencyGraph.stats.start(et.VLOOKUP);const s=t.range;let i;i=void 0===s?rt.onlyValues(t.data.map((e=>[e[0]]))):rt.onlyRange(Fr.spanFrom(s.start,1,s.height()),this.dependencyGraph);const o=this.searchInRange(e,i,n,this.columnSearch);if(this.dependencyGraph.stats.end(et.VLOOKUP),-1===o)return new Tr(ir.NA,Z.ValueNotFound);let a;if(void 0===s)a=t.data[o][r];else{const e=Ar(s.sheet,s.start.col+r,s.start.row+o);a=this.dependencyGraph.getCellValue(e)}return a instanceof rt?new Tr(ir.VALUE,Z.WrongType):a}doHlookup(e,t,r,n){const s=t.range;let i;i=void 0===s?rt.onlyValues([t.data[0]]):rt.onlyRange(Fr.spanFrom(s.start,s.width(),1),this.dependencyGraph);const o=this.searchInRange(e,i,n,this.rowSearch);if(-1===o)return new Tr(ir.NA,Z.ValueNotFound);let a;if(void 0===s)a=t.data[r][o];else{const e=Ar(s.sheet,s.start.col+o,s.start.row+r);a=this.dependencyGraph.getCellValue(e)}return a instanceof rt?new Tr(ir.VALUE,Z.WrongType):a}doMatch(e,t,r){if(![-1,0,1].includes(r))return new Tr(ir.VALUE,Z.BadMode);if(t.width()>1&&t.height()>1)return new Tr(ir.NA);const n=0===r?{ordering:"none",matchExactly:!0}:{ordering:-1===r?"desc":"asc"},s=(1===t.width()?this.columnSearch:this.rowSearch).find(e,t,n);return-1===s?new Tr(ir.NA,Z.ValueNotFound):s+1}}va.implementedFunctions={VLOOKUP:{method:"vlookup",parameters:[{argumentType:hn.NOERROR},{argumentType:hn.RANGE},{argumentType:hn.NUMBER},{argumentType:hn.BOOLEAN,defaultValue:!0}]},HLOOKUP:{method:"hlookup",parameters:[{argumentType:hn.NOERROR},{argumentType:hn.RANGE},{argumentType:hn.NUMBER},{argumentType:hn.BOOLEAN,defaultValue:!0}]},MATCH:{method:"match",parameters:[{argumentType:hn.NOERROR},{argumentType:hn.RANGE},{argumentType:hn.NUMBER,defaultValue:1}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ra extends un{roman(e,t){return this.runFunction(e.args,t,this.metadata("ROMAN"),((e,t)=>(e=Math.trunc(e),!1===t?t=4:!0===t&&(t=0),(t=je(this.coerceScalarToNumberOrError(t)))instanceof Tr?t:(t=Math.trunc(t))<0?new Tr(ir.VALUE,Z.ValueSmall):t>4?new Tr(ir.VALUE,Z.ValueLarge):function(e,t){const r={val:e%1e3,acc:"M".repeat(Math.floor(e/1e3))};4===t&&(Ta(r,"IM",999,1e3),Ta(r,"ID",499,500));t>=3&&(Ta(r,"VM",995,1e3),Ta(r,"VD",495,500));t>=2&&(Ta(r,"XM",990,1e3),Ta(r,"XD",490,500));t>=1&&(Ta(r,"LM",950,1e3),Ta(r,"LD",450,500));Ta(r,"CM",900,1e3),Ta(r,"CD",400,500),Ta(r,"D",500,900),r.acc+="C".repeat(Math.floor(r.val/100)),r.val%=100,t>=2&&(Ta(r,"IC",99,100),Ta(r,"IL",49,50));t>=1&&(Ta(r,"VC",95,100),Ta(r,"VL",45,50));return Ta(r,"XC",90,100),Ta(r,"XL",40,50),Ta(r,"L",50,90),r.acc+="X".repeat(Math.floor(r.val/10)),r.val%=10,Ta(r,"IX",9,10),Ta(r,"IV",4,5),Ta(r,"V",5,9),r.acc+="I".repeat(r.val),r.acc}(e,t))))}arabic(e,t){return this.runFunction(e.args,t,this.metadata("ARABIC"),(e=>{let t=!1;if((e=e.trim().toUpperCase()).startsWith("-")&&(t=!0,""===(e=e.slice(1))))return new Tr(ir.VALUE,Z.InvalidRoman);const r={input:e,acc:0};return Sa(r,{token:"MMM",val:3e3},{token:"MM",val:2e3},{token:"M",val:1e3}),Sa(r,{token:"IM",val:999},{token:"VM",val:995},{token:"XM",val:990},{token:"LM",val:950},{token:"CM",val:900}),Sa(r,{token:"D",val:500},{token:"ID",val:499},{token:"VD",val:495},{token:"XD",val:490},{token:"LD",val:450},{token:"CD",val:400}),Sa(r,{token:"CCC",val:300},{token:"CC",val:200},{token:"C",val:100}),Sa(r,{token:"IC",val:99},{token:"VC",val:95},{token:"XC",val:90}),Sa(r,{token:"L",val:50},{token:"IL",val:49},{token:"VL",val:45},{token:"XL",val:40}),Sa(r,{token:"XXX",val:30},{token:"XX",val:20},{token:"X",val:10}),Sa(r,{token:"IX",val:9}),Sa(r,{token:"V",val:5},{token:"IV",val:4}),Sa(r,{token:"III",val:3},{token:"II",val:2},{token:"I",val:1}),""!==r.input?new Tr(ir.VALUE,Z.InvalidRoman):t?-r.acc:r.acc}))}}function Sa(e,...t){for(const r of t)if(e.input.startsWith(r.token)){e.input=e.input.slice(r.token.length),e.acc+=r.val;break}}function Ta(e,t,r,n){e.val>=r&&e.val<n&&(e.val-=r,e.acc+=t)}Ra.implementedFunctions={ROMAN:{method:"roman",parameters:[{argumentType:hn.NUMBER,minValue:1,lessThan:4e3},{argumentType:hn.NOERROR,optionalArg:!0,defaultValue:0}]},ARABIC:{method:"arabic",parameters:[{argumentType:hn.STRING}]}};
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Na extends un{add(e,t){return this.runFunction(e.args,t,this.metadata("HF.ADD"),this.arithmeticHelper.addWithEpsilon)}concat(e,t){return this.runFunction(e.args,t,this.metadata("HF.CONCAT"),this.arithmeticHelper.concat)}divide(e,t){return this.runFunction(e.args,t,this.metadata("HF.DIVIDE"),this.arithmeticHelper.divide)}eq(e,t){return this.runFunction(e.args,t,this.metadata("HF.EQ"),this.arithmeticHelper.eq)}gt(e,t){return this.runFunction(e.args,t,this.metadata("HF.GT"),this.arithmeticHelper.gt)}gte(e,t){return this.runFunction(e.args,t,this.metadata("HF.GTE"),this.arithmeticHelper.geq)}lt(e,t){return this.runFunction(e.args,t,this.metadata("HF.LT"),this.arithmeticHelper.lt)}lte(e,t){return this.runFunction(e.args,t,this.metadata("HF.LTE"),this.arithmeticHelper.leq)}minus(e,t){return this.runFunction(e.args,t,this.metadata("HF.MINUS"),this.arithmeticHelper.subtract)}multiply(e,t){return this.runFunction(e.args,t,this.metadata("HF.MULTIPLY"),this.arithmeticHelper.multiply)}ne(e,t){return this.runFunction(e.args,t,this.metadata("HF.NE"),this.arithmeticHelper.neq)}pow(e,t){return this.runFunction(e.args,t,this.metadata("HF.POW"),this.arithmeticHelper.pow)}uminus(e,t){return this.runFunction(e.args,t,this.metadata("HF.UMINUS"),this.arithmeticHelper.unaryMinus)}upercent(e,t){return this.runFunction(e.args,t,this.metadata("HF.UNARY_PERCENT"),this.arithmeticHelper.unaryPercent)}uplus(e,t){return this.runFunction(e.args,t,this.metadata("HF.UPLUS"),this.arithmeticHelper.unaryPlus)}}Na.implementedFunctions={"HF.ADD":{method:"add",parameters:[{argumentType:hn.NUMBER,passSubtype:!0},{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.CONCAT":{method:"concat",parameters:[{argumentType:hn.STRING,passSubtype:!0},{argumentType:hn.STRING,passSubtype:!0}]},"HF.DIVIDE":{method:"divide",parameters:[{argumentType:hn.NUMBER,passSubtype:!0},{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.EQ":{method:"eq",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.GT":{method:"gt",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.GTE":{method:"gte",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.LT":{method:"lt",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.LTE":{method:"lte",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.MINUS":{method:"minus",parameters:[{argumentType:hn.NUMBER,passSubtype:!0},{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.MULTIPLY":{method:"multiply",parameters:[{argumentType:hn.NUMBER,passSubtype:!0},{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.NE":{method:"ne",parameters:[{argumentType:hn.NOERROR,passSubtype:!0},{argumentType:hn.NOERROR,passSubtype:!0}]},"HF.POW":{method:"pow",parameters:[{argumentType:hn.NUMBER,passSubtype:!0},{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.UMINUS":{method:"uminus",parameters:[{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.UNARY_PERCENT":{method:"upercent",parameters:[{argumentType:hn.NUMBER,passSubtype:!0}]},"HF.UPLUS":{method:"uplus",parameters:[{argumentType:hn.NUMBER,passSubtype:!0}]}};
/**
* @license
bessel.js (C) 2013-present SheetJS -- http://sheetjs.com
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (C) 2013-present SheetJS LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var Ma=Math;function _a(e,t){for(var r=0,n=0;r<e.length;++r)n=t*n+e[r];return n}function ba(e,t,r,n,s){if(0===t)return r;if(1===t)return n;for(var i=2/e,o=n,a=1;a<t;++a)o=n*a*i+s*r,r=n,n=o;return o}function Aa(e,t,r,n,s){return function(r,i){if(n){if(0===r)return 1==n?-1/0:1/0;if(r<0)return NaN}return 0===i?e(r):1===i?t(r):i<0?NaN:ba(r,i|=0,e(r),t(r),s)}}var Oa,Ia,xa,Pa,La,Da,ka,Ha,Fa,Ua,Va,Ba,Wa,Ya=function(){var e=.636619772,t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),r=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),n=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse();function i(i){var o=0,a=0,l=0,h=i*i;if(i<8)o=(a=_a(t,h))/(l=_a(r,h));else{var u=i-.785398164;a=_a(n,h=64/h),l=_a(s,h),o=Ma.sqrt(e/i)*(Ma.cos(u)*a-Ma.sin(u)*l*8/i)}return o}var o=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),a=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),l=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();function u(t){var r=0,n=0,s=0,i=t*t,u=Ma.abs(t)-2.356194491;return Math.abs(t)<8?r=(n=t*_a(o,i))/(s=_a(a,i)):(n=_a(l,i=64/i),s=_a(h,i),r=Ma.sqrt(e/Ma.abs(t))*(Ma.cos(u)*n-Ma.sin(u)*s*8/Ma.abs(t)),t<0&&(r=-r)),r}return function e(t,r){if(r=Math.round(r),!isFinite(t))return isNaN(t)?t:0;if(r<0)return(r%2?-1:1)*e(t,-r);if(t<0)return(r%2?-1:1)*e(-t,r);if(0===r)return i(t);if(1===r)return u(t);if(0===t)return 0;var n=0;if(t>r)n=ba(t,r,i(t),u(t),-1);else{for(var s=!1,o=0,a=0,l=1,h=0,c=2/t,d=2*Ma.floor((r+Ma.floor(Ma.sqrt(40*r)))/2);d>0;d--)h=d*c*l-o,o=l,l=h,Ma.abs(l)>1e10&&(l*=1e-10,o*=1e-10,n*=1e-10,a*=1e-10),s&&(a+=l),s=!s,d==r&&(n=o);n/=a=2*a-l}return n}}(),ja=(Oa=.636619772,Ia=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),xa=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),Pa=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),La=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),Da=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),ka=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),Ha=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),Fa=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse(),Aa((function(e){var t=0,r=0,n=0,s=e*e,i=e-.785398164;return e<8?t=(r=_a(Ia,s))/(n=_a(xa,s))+Oa*Ya(e,0)*Ma.log(e):(r=_a(Pa,s=64/s),n=_a(La,s),t=Ma.sqrt(Oa/e)*(Ma.sin(i)*r+Ma.cos(i)*n*8/e)),t}),(function(e){var t=0,r=0,n=0,s=e*e,i=e-2.356194491;return e<8?t=(r=e*_a(Da,s))/(n=_a(ka,s))+Oa*(Ya(e,1)*Ma.log(e)-1/e):(r=_a(Ha,s=64/s),n=_a(Fa,s),t=Ma.sqrt(Oa/e)*(Ma.sin(i)*r+Ma.cos(i)*n*8/e)),t}),0,1,-1)),Ga=(Ua=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),Va=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),Ba=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),Wa=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse(),function e(t,r){if(0===(r=Math.round(r)))return function(e){return e<=3.75?_a(Ua,e*e/14.0625):Ma.exp(Ma.abs(e))/Ma.sqrt(Ma.abs(e))*_a(Va,3.75/Ma.abs(e))}(t);if(1===r)return function(e){return e<3.75?e*_a(Ba,e*e/14.0625):(e<0?-1:1)*Ma.exp(Ma.abs(e))/Ma.sqrt(Ma.abs(e))*_a(Wa,3.75/Ma.abs(e))}(t);if(r<0)return NaN;if(0===Ma.abs(t))return 0;if(t==1/0)return 1/0;var n,s=0,i=2/Ma.abs(t),o=0,a=1,l=0;for(n=2*Ma.round((r+Ma.round(Ma.sqrt(40*r)))/2);n>0;n--)l=n*i*a+o,o=a,a=l,Ma.abs(a)>1e10&&(a*=1e-10,o*=1e-10,s*=1e-10),n==r&&(s=o);return s*=e(t,0)/a,t<0&&r%2?-s:s}),za=function(){var e=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),t=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-
/**
* @license
Copyright (c) 2013 jStat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
function $a(e){const t=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18];let r,n,s,i,o=t.length-1,a=!1,l=0,h=0;if(0===e)return 0;for(e<0&&(e=-e,a=!0),r=2/(2+e),n=4*r-2;o>0;o--)s=l,l=n*l-h+t[o],h=s;return i=r*Math.exp(-e*e+.5*(t[0]+n*l)-h),a?i-1:1-i}function Ka(e){return 1-$a(e)}function Xa(e){let t,r,n,s,i=0;if(e>=2)return-100;if(e<=0)return 100;for(s=e<1?e:2-e,n=Math.sqrt(-2*Math.log(s/2)),t=-.70711*((2.30753+.27061*n)/(1+n*(.99229+.04481*n))-n);i<2;i++)r=Ka(t)-s,t+=r/(1.1283791670955126*Math.exp(-t*t)-t*r);return e<1?t:-t}const qa=(e,t)=>e<0?0:t*Math.exp(-t*e),Qa=(e,t)=>e<0?0:1-Math.exp(-t*e);function Za(e){const t=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],r=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535];let n,s,i,o,a=!1,l=0,h=0,u=0,c=e;if(e>171.6243769536076)return 1/0;if(c<=0){if(o=c%1,!o)return 1/0;a=(1&c?-1:1)*Math.PI/Math.sin(Math.PI*o),c=1-c}for(i=c,s=c<1?c++:(c-=l=(0|c)-1)-1,n=0;n<8;++n)u=(u+t[n])*s,h=h*s+r[n];if(o=u/h+1,i<c)o/=i;else if(i>c)for(n=0;n<l;++n)o*=c,c++;return a&&(o=a/o),o}const Ja=function(e,t,r){return e<0?0:0===e&&1===t?1/r:Math.exp((t-1)*Math.log(e)-e/r-rl(t)-t*Math.log(r))},el=function(e,t,r){return e<0?0:nl(t,e/r)},tl=function(e,t,r){return sl(e,t)*r};function rl(e){let t=0;const r=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];let n,s,i,o=1.000000000190015;for(i=(s=n=e)+5.5,i-=(n+.5)*Math.log(i);t<6;t++)o+=r[t]/++s;return Math.log(2.5066282746310007*o/n)-i}function nl(e,t){const r=rl(e);let n=e,s=1/e,i=s,o=t+1-e,a=1/1e-30,l=1/o,h=l,u=1;const c=-~(8.5*Math.log(e>=1?e:1/e)+.4*e+17);let d;if(t<0||e<=0)return NaN;if(t<e+1){for(;u<=c;u++)s+=i*=t/++n;return s*Math.exp(-t+e*Math.log(t)-r)}for(;u<=c;u++)d=-u*(u-e),o+=2,l=d*l+o,a=o+d/a,l=1/l,h*=l*a;return 1-h*Math.exp(-t+e*Math.log(t)-r)}function sl(e,t){let r=0;const n=t-1,s=rl(t);let i,o,a,l,h,u,c;if(e>=1)return Math.max(100,t+100*Math.sqrt(t));if(e<=0)return 0;for(t>1?(u=Math.log(n),c=Math.exp(n*(u-1)-s),h=e<.5?e:1-e,a=Math.sqrt(-2*Math.log(h)),i=(2.30753+.27061*a)/(1+a*(.99229+.04481*a))-a,e<.5&&(i=-i),i=Math.max(.001,t*Math.pow(1-1/(9*t)-i/(3*Math.sqrt(t)),3))):(a=1-t*(.253+.12*t),i=e<a?Math.pow(e/a,1/t):1-Math.log(1-(e-a)/(1-a)));r<12;r++){if(i<=0)return 0;if(o=nl(t,i)-e,a=t>1?c*Math.exp(-(i-n)+n*(Math.log(i)-u)):Math.exp(-i+n*Math.log(i)-s),l=o/a,i-=a=l/(1-.5*Math.min(1,l*((t-1)/i-1))),i<=0&&(i=.5*(i+a)),Math.abs(a)<1e-8*i)break}return i}const il=function(e,t,r){return Math.exp(-.5*Math.log(2*Math.PI)-Math.log(r)-Math.pow(e-t,2)/(2*r*r))},ol=function(e,t,r){return.5*(1+$a((e-t)/Math.sqrt(2*r*r)))},al=function(e,t,r){return-1.4142135623730951*r*Xa(2*e)+t},ll=function(e,t,r){return e>1||e<0?0:1==t&&1==r?1:t<512&&r<512?Math.pow(e,t-1)*Math.pow(1-e,r-1)/cl(t,r):Math.exp((t-1)*Math.log(e)+(r-1)*Math.log(1-e)-dl(t,r))},hl=function(e,t,r){return e>1||e<0?+(e>1):gl(e,t,r)},ul=function(e,t,r){return pl(e,t,r)};function cl(e,t){if(!(e<=0||t<=0))return e+t>170?Math.exp(dl(e,t)):Za(e)*Za(t)/Za(e+t)}function dl(e,t){return rl(e)+rl(t)-rl(e+t)}function pl(e,t,r){var n,s,i,o,a,l,h,u,c,d,p=t-1,g=r-1,f=0;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(i=e<.5?e:1-e,l=(2.30753+.27061*(o=Math.sqrt(-2*Math.log(i))))/(1+o*(.99229+.04481*o))-o,e<.5&&(l=-l),h=(l*l-3)/6,u=2/(1/(2*t-1)+1/(2*r-1)),c=l*Math.sqrt(h+u)/u-(1/(2*r-1)-1/(2*t-1))*(h+5/6-2/(3*u)),l=t/(t+r*Math.exp(2*c))):(n=Math.log(t/(t+r)),s=Math.log(r/(t+r)),l=e<(o=Math.exp(t*n)/t)/(c=o+(a=Math.exp(r*s)/r))?Math.pow(t*c*e,1/t):1-Math.pow(r*c*(1-e),1/r)),d=-rl(t)-rl(r)+rl
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class zl extends un{erf(e,t){return this.runFunction(e.args,t,this.metadata("ERF"),((e,t)=>void 0===t?$a(e):$a(t)-$a(e)))}erfc(e,t){return this.runFunction(e.args,t,this.metadata("ERFC"),Ka)}expondist(e,t){return this.runFunction(e.args,t,this.metadata("EXPON.DIST"),((e,t,r)=>r?Qa(e,t):qa(e,t)))}fisher(e,t){return this.runFunction(e.args,t,this.metadata("FISHER"),(e=>Math.log((1+e)/(1-e))/2))}fisherinv(e,t){return this.runFunction(e.args,t,this.metadata("FISHERINV"),(e=>1-2/(Math.exp(2*e)+1)))}gamma(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA"),Za)}gammadist(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA.DIST"),((e,t,r,n)=>n?el(e,t,r):Ja(e,t,r)))}gammaln(e,t){return this.runFunction(e.args,t,this.metadata("GAMMALN"),rl)}gammainv(e,t){return this.runFunction(e.args,t,this.metadata("GAMMA.INV"),tl)}gauss(e,t){return this.runFunction(e.args,t,this.metadata("GAUSS"),(e=>ol(e,0,1)-.5))}betadist(e,t){return this.runFunction(e.args,t,this.metadata("BETA.DIST"),((e,t,r,n,s,i)=>e<=s?new Tr(ir.NUM,Z.ValueSmall):e>=i?new Tr(ir.NUM,Z.ValueLarge):(e=(e-s)/(i-s),n?hl(e,t,r):ll(e,t,r))))}betainv(e,t){return this.runFunction(e.args,t,this.metadata("BETA.INV"),((e,t,r,n,s)=>n>=s?new Tr(ir.NUM,Z.WrongOrder):ul(e,t,r)*(s-n)+n))}binomialdist(e,t){return this.runFunction(e.args,t,this.metadata("BINOM.DIST"),((e,t,r,n)=>e>t?new Tr(ir.NUM,Z.WrongOrder):(e=Math.trunc(e),t=Math.trunc(t),n?yl(e,t,r):ml(e,t,r))))}binomialinv(e,t){return this.runFunction(e.args,t,this.metadata("BINOM.INV"),((e,t,r)=>{let n=-1,s=e=Math.trunc(e);for(;s>n+1;){const i=Math.trunc((n+s)/2);yl(i,e,t)>=r?s=i:n=i}return s}))}besselifn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELI"),((e,t)=>Ga(e,Math.trunc(t))))}besseljfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELJ"),((e,t)=>Ya(e,Math.trunc(t))))}besselkfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELK"),((e,t)=>za(e,Math.trunc(t))))}besselyfn(e,t){return this.runFunction(e.args,t,this.metadata("BESSELY"),((e,t)=>ja(e,Math.trunc(t))))}chisqdist(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.DIST"),((e,t,r)=>(t=Math.trunc(t),r?Sl(e,t):Rl(e,t))))}chisqdistrt(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.DIST.RT"),((e,t)=>1-Sl(e,Math.trunc(t))))}chisqinv(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.INV"),((e,t)=>Tl(e,Math.trunc(t))))}chisqinvrt(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.INV.RT"),((e,t)=>Tl(1-e,Math.trunc(t))))}fdist(e,t){return this.runFunction(e.args,t,this.metadata("F.DIST"),((e,t,r,n)=>(t=Math.trunc(t),r=Math.trunc(r),n?Ml(e,t,r):Nl(e,t,r))))}fdistrt(e,t){return this.runFunction(e.args,t,this.metadata("F.DIST.RT"),((e,t,r)=>1-Ml(e,Math.trunc(t),Math.trunc(r))))}finv(e,t){return this.runFunction(e.args,t,this.metadata("F.INV"),((e,t,r)=>_l(e,Math.trunc(t),Math.trunc(r))))}finvrt(e,t){return this.runFunction(e.args,t,this.metadata("F.INV.RT"),((e,t,r)=>_l(1-e,Math.trunc(t),Math.trunc(r))))}weibulldist(e,t){return this.runFunction(e.args,t,this.metadata("WEIBULL.DIST"),((e,t,r,n)=>n?Al(e,r,t):bl(e,r,t)))}poissondist(e,t){return this.runFunction(e.args,t,this.metadata("POISSON.DIST"),((e,t,r)=>(e=Math.trunc(e),r?Ol.cdf(e,t):Ol.pdf(e,t))))}hypgeomdist(e,t){return this.runFunction(e.args,t,this.metadata("HYPGEOM.DIST"),((e,t,r,n,s)=>e>t||e>r||t>n||r>n||e+n<r+t?new Tr(ir.NUM,Z.ValueLarge):(e=Math.trunc(e),t=Math.trunc(t),r=Math.trunc(r),n=Math.trunc(n),s?Il.cdf(e,n,r,t):Il.pdf(e,n,r,t))))}tdist(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST"),((e,t,r)=>(t=Math.trunc(t),r?Pl(e,t):xl(e,t))))}tdist2t(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST.2T"),((e,t)=>2*(1-Pl(e,Math.trunc(t)))))}tdistrt(e,t){return this.runFunction(e.args,t,this.metadata("T.DIST.RT"),((e,t)=>1-Pl(e,Math.trunc(t))))}tdistold(e,t){return this.runFunction(e.args,t,this.metadata("TDIST"),((e,t,r)=>r*(1-Pl(e,Math.trunc(t)))))}tinv(e,t){return this.runFunction(e.args,t,this.metadata("T.INV"),((e,t)=>Ll(e,Math.trunc(t))))}tinv2t(e,t){return this.runFunction(e.args,t,this.metadata("T.INV.2T"),((e,t)
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class $l extends un{fact(e,t){return this.runFunction(e.args,t,this.metadata("FACT"),(e=>{e=Math.trunc(e);let t=1;for(let r=1;r<=e;r++)t*=r;return t}))}factdouble(e,t){return this.runFunction(e.args,t,this.metadata("FACTDOUBLE"),(e=>{let t=1;for(let r=e=Math.trunc(e);r>=1;r-=2)t*=r;return t}))}combin(e,t){return this.runFunction(e.args,t,this.metadata("COMBIN"),((e,t)=>t>e?new Tr(ir.NUM,Z.WrongOrder):Kl(e=Math.trunc(e),t=Math.trunc(t))))}combina(e,t){return this.runFunction(e.args,t,this.metadata("COMBINA"),((e,t)=>(e=Math.trunc(e))+(t=Math.trunc(t))-1>=1030?new Tr(ir.NUM,Z.ValueLarge):0===e&&0===t?1:Kl(e+t-1,t)))}gcd(e,t){return this.runFunction(e.args,t,this.metadata("GCD"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersCoerceRangesDropNulls(e);if(t instanceof Tr)return t;let r=0;for(const e of t){if(e<0)return new Tr(ir.NUM,Z.ValueSmall);r=Xl(r,Math.trunc(e))}return r>Number.MAX_SAFE_INTEGER?new Tr(ir.NUM,Z.ValueLarge):r}))}lcm(e,t){return this.runFunction(e.args,t,this.metadata("LCM"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersCoerceRangesDropNulls(e);if(t instanceof Tr)return t;let r=1;for(const e of t){if(e<0)return new Tr(ir.NUM,Z.ValueSmall);r=ql(r,Math.trunc(e))}return r>Number.MAX_SAFE_INTEGER?new Tr(ir.NUM,Z.ValueLarge):r}))}mround(e,t){return this.runFunction(e.args,t,this.metadata("MROUND"),((e,t)=>0===t?0:e>0&&t<0||e<0&&t>0?new Tr(ir.NUM,Z.DistinctSigns):Math.round(e/t)*t))}multinomial(e,t){return this.runFunction(e.args,t,this.metadata("MULTINOMIAL"),((...e)=>{let t=0,r=1;for(let n of e){if(n<0)return new Tr(ir.NUM,Z.ValueSmall);n=Math.trunc(n);for(let e=1;e<=n;e++)r*=(t+e)/e;t+=n}return Math.round(r)}))}quotient(e,t){return this.runFunction(e.args,t,this.metadata("QUOTIENT"),((e,t)=>0===t?new Tr(ir.DIV_BY_ZERO):Math.trunc(e/t)))}seriessum(e,t){return this.runFunction(e.args,t,this.metadata("SERIESSUM"),((e,t,r,n)=>{const s=this.arithmeticHelper.manyToOnlyNumbersDropNulls(n.valuesFromTopLeftCorner());if(s instanceof Tr)return s;let i=0;s.reverse();for(const t of s)i*=Math.pow(e,r),i+=t;return i*Math.pow(e,t)}))}sign(e,t){return this.runFunction(e.args,t,this.metadata("SIGN"),(e=>e>0?1:e<0?-1:0))}sumx2my2(e,t){return this.runFunction(e.args,t,this.metadata("SUMX2MY2"),((e,t)=>{const r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new Tr(ir.NA,Z.EqualLength);const s=r.length;let i=0;for(let e=0;e<s;e++){const t=r[e],s=n[e];if(t instanceof Tr)return t;if(s instanceof Tr)return s;"number"==typeof t&&"number"==typeof s&&(i+=Math.pow(t,2)-Math.pow(s,2))}return i}))}sumx2py2(e,t){return this.runFunction(e.args,t,this.metadata("SUMX2PY2"),((e,t)=>{const r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new Tr(ir.NA,Z.EqualLength);const s=r.length;let i=0;for(let e=0;e<s;e++){const t=r[e],s=n[e];if(t instanceof Tr)return t;if(s instanceof Tr)return s;"number"==typeof t&&"number"==typeof s&&(i+=Math.pow(t,2)+Math.pow(s,2))}return i}))}sumxmy2(e,t){return this.runFunction(e.args,t,this.metadata("SUMXMY2"),((e,t)=>{const r=e.valuesFromTopLeftCorner(),n=t.valuesFromTopLeftCorner();if(r.length!==n.length)return new Tr(ir.NA,Z.EqualLength);const s=r.length;let i=0;for(let e=0;e<s;e++){const t=r[e],s=n[e];if(t instanceof Tr)return t;if(s instanceof Tr)return s;"number"==typeof t&&"number"==typeof s&&(i+=Math.pow(t-s,2))}return i}))}}function Kl(e,t){2*t>e&&(t=e-t);let r=1;for(let n=1;n<=t;n++)r*=(e-t+n)/n;return Math.round(r)}function Xl(e,t){for(e<t&&([e,t]=[t,e]);t>0;)[e,t]=[t,e%t];return e}function ql(e,t){return 0===e||0===t?0:e*(t/Xl(e,t))}$l.implementedFunctions={FACT:{method:"fact",parameters:[{argumentType:hn.NUMBER,minValue:0,maxValue:170}]},FACTDOUBLE:{method:"factdouble",parameters:[{argumentType:hn.NUMBER,minValue:0,maxValue:288}]},COMBIN:{method:"combin",parameters:[{argumentType:hn.NUMBER,minValue:0,lessThan:1030},{argumentType:hn.NUMBER,minValue:0}]},COMBINA:{method:"combina",parameters:[{argumentType:hn.NUMBER,minValue:0},{argumentType:hn.NUMBER,minValue:0}]},GCD:{method:"gcd",parameters:[{argumentType:hn.ANY
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class Ql extends un{complex(e,t){return this.runFunction(e.args,t,this.metadata("COMPLEX"),((e,t,r)=>"i"!==r&&"j"!==r?new Tr(ir.VALUE,Z.ShouldBeIorJ):jr([e,t],r)))}imabs(e,t){return this.runFunction(e.args,t,this.metadata("IMABS"),oh)}imaginary(e,t){return this.runFunction(e.args,t,this.metadata("IMAGINARY"),(([e,t])=>t))}imreal(e,t){return this.runFunction(e.args,t,this.metadata("IMREAL"),(([e,t])=>e))}imargument(e,t){return this.runFunction(e.args,t,this.metadata("IMARGUMENT"),(([e,t])=>0===e&&0===t?new Tr(ir.DIV_BY_ZERO):Math.atan2(t,e)))}imconjugate(e,t){return this.runFunction(e.args,t,this.metadata("IMCONJUGATE"),(([e,t])=>jr([e,-t])))}imcos(e,t){return this.runFunction(e.args,t,this.metadata("IMCOS"),(e=>jr(th(e))))}imcosh(e,t){return this.runFunction(e.args,t,this.metadata("IMCOSH"),(e=>jr(rh(e))))}imcot(e,t){return this.runFunction(e.args,t,this.metadata("IMCOT"),(e=>jr(eh(th(e),nh(e)))))}imcsc(e,t){return this.runFunction(e.args,t,this.metadata("IMCSC"),(e=>jr(eh([1,0],nh(e)))))}imcsch(e,t){return this.runFunction(e.args,t,this.metadata("IMCSCH"),(e=>jr(eh([1,0],sh(e)))))}imsec(e,t){return this.runFunction(e.args,t,this.metadata("IMSEC"),(e=>jr(eh([1,0],th(e)))))}imsech(e,t){return this.runFunction(e.args,t,this.metadata("IMSECH"),(e=>jr(eh([1,0],rh(e)))))}imsin(e,t){return this.runFunction(e.args,t,this.metadata("IMSIN"),(e=>jr(nh(e))))}imsinh(e,t){return this.runFunction(e.args,t,this.metadata("IMSINH"),(e=>jr(sh(e))))}imtan(e,t){return this.runFunction(e.args,t,this.metadata("IMTAN"),(e=>jr(eh(nh(e),th(e)))))}imdiv(e,t){return this.runFunction(e.args,t,this.metadata("IMDIV"),((e,t)=>jr(eh(e,t))))}improduct(e,t){return this.runFunction(e.args,t,this.metadata("IMPRODUCT"),((...e)=>{const t=this.arithmeticHelper.coerceComplexExactRanges(e);if(t instanceof Tr)return t;let r=[1,0];for(const e of t)r=Jl(r,e);return jr(r)}))}imsum(e,t){return this.runFunction(e.args,t,this.metadata("IMSUM"),((...e)=>{const t=this.arithmeticHelper.coerceComplexExactRanges(e);if(t instanceof Tr)return t;let r=[0,0];for(const e of t)r=Zl(r,e);return jr(r)}))}imsub(e,t){return this.runFunction(e.args,t,this.metadata("IMSUB"),((e,t)=>jr(function([e,t],[r,n]){return[e-r,t-n]}(e,t))))}imexp(e,t){return this.runFunction(e.args,t,this.metadata("IMEXP"),(e=>jr(ih(e))))}imln(e,t){return this.runFunction(e.args,t,this.metadata("IMLN"),(e=>jr(ah(e))))}imlog10(e,t){return this.runFunction(e.args,t,this.metadata("IMLOG10"),(e=>{const[t,r]=ah(e),n=Math.log(10);return jr([t/n,r/n])}))}imlog2(e,t){return this.runFunction(e.args,t,this.metadata("IMLOG2"),(e=>{const[t,r]=ah(e),n=Math.log(2);return jr([t/n,r/n])}))}impower(e,t){return this.runFunction(e.args,t,this.metadata("IMPOWER"),((e,t)=>jr(lh(e,t))))}imsqrt(e,t){return this.runFunction(e.args,t,this.metadata("IMSQRT"),(e=>jr(lh(e,.5))))}}function Zl([e,t],[r,n]){return[e+r,t+n]}function Jl([e,t],[r,n]){return[e*r-t*n,e*n+r*t]}function eh([e,t],[r,n]){const s=Math.pow(r,2)+Math.pow(n,2),[i,o]=Jl([e,t],[r,-n]);return[i/s,o/s]}function th([e,t]){return[Math.cos(e)*Math.cosh(t),-Math.sin(e)*Math.sinh(t)]}function rh([e,t]){return[Math.cosh(e)*Math.cos(t),Math.sinh(e)*Math.sin(t)]}function nh([e,t]){return[Math.sin(e)*Math.cosh(t),Math.cos(e)*Math.sinh(t)]}function sh([e,t]){return[Math.sinh(e)*Math.cos(t),Math.cosh(e)*Math.sin(t)]}function ih([e,t]){return[Math.exp(e)*Math.cos(t),Math.exp(e)*Math.sin(t)]}function oh([e,t]){return Math.sqrt(e*e+t*t)}function ah([e,t]){return[Math.log(oh([e,t])),Math.atan2(t,e)]}function lh(e,t){const[r,n]=ah(e);return ih([t*r,t*n])}Ql.implementedFunctions={COMPLEX:{method:"complex",parameters:[{argumentType:hn.NUMBER},{argumentType:hn.NUMBER},{argumentType:hn.STRING,defaultValue:"i"}]},IMABS:{method:"imabs",parameters:[{argumentType:hn.COMPLEX}]},IMAGINARY:{method:"imaginary",parameters:[{argumentType:hn.COMPLEX}]},IMREAL:{method:"imreal",parameters:[{argumentType:hn.COMPLEX}]},IMARGUMENT:{method:"imargument",parameters:[{argumentType:hn.COMPLEX}]},IMCONJUGATE:{method:"imconjugate",parameters:[{argumentType:hn.COMPLEX}]},IMCOS:{method:"imcos",parameters:[{argumentTyp
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class hh extends un{avedev(e,t){return this.runFunction(e.args,t,this.metadata("AVEDEV"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof Tr)return t;if(0===t.length)return new Tr(ir.DIV_BY_ZERO);const r=Vl(t);return t.reduce(((e,t)=>e+Math.abs(t-r)),0)/t.length}))}devsq(e,t){return this.runFunction(e.args,t,this.metadata("DEVSQ"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersExactRanges(e);return t instanceof Tr?t:0===t.length?0:Bl(t)}))}geomean(e,t){return this.runFunction(e.args,t,this.metadata("GEOMEAN"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof Tr)return t;if(0===t.length)return new Tr(ir.NUM,Z.OneValue);for(const e of t)if(e<=0)return new Tr(ir.NUM,Z.ValueSmall);return r=t,Math.pow(function(e){for(var t=1,r=e.length;--r>=0;)t*=e[r];return t}(r),1/r.length);var r}))}harmean(e,t){return this.runFunction(e.args,t,this.metadata("HARMEAN"),((...e)=>{const t=this.arithmeticHelper.coerceNumbersExactRanges(e);if(t instanceof Tr)return t;if(0===t.length)return new Tr(ir.NUM,Z.OneValue);for(const e of t)if(e<=0)return new Tr(ir.NUM,Z.ValueSmall);return t.length/t.reduce(((e,t)=>e+1/t),0)}))}correl(e,t){return this.runFunction(e.args,t,this.metadata("CORREL"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;return r[0].length<=1?new Tr(ir.DIV_BY_ZERO,Z.TwoValues):Gl(r[0],r[1])}))}rsq(e,t){return this.runFunction(e.args,t,this.metadata("RSQ"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;return r[0].length<=1?new Tr(ir.DIV_BY_ZERO,Z.TwoValues):Math.pow(Gl(r[0],r[1]),2)}))}covariancep(e,t){return this.runFunction(e.args,t,this.metadata("COVARIANCE.P"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;const n=r[0].length;return n<1?new Tr(ir.DIV_BY_ZERO,Z.OneValue):1===n?0:jl(r[0],r[1])*(n-1)/n}))}covariances(e,t){return this.runFunction(e.args,t,this.metadata("COVARIANCE.S"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;return r[0].length<=1?new Tr(ir.DIV_BY_ZERO,Z.TwoValues):jl(r[0],r[1])}))}ztest(e,t){return this.runFunction(e.args,t,this.metadata("Z.TEST"),((e,t,r)=>{const n=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner());if(n instanceof Tr)return n;const s=n.length;if(void 0===r){if(s<2)return new Tr(ir.DIV_BY_ZERO,Z.TwoValues);r=Yl(n,!0)}return s<1?new Tr(ir.NA,Z.OneValue):0===r?new Tr(ir.DIV_BY_ZERO):1-ol((Vl(n)-t)/(r/Math.sqrt(s)),0,1)}))}ftest(e,t){return this.runFunction(e.args,t,this.metadata("F.TEST"),((e,t)=>{const r=this.arithmeticHelper.manyToExactNumbers(e.valuesFromTopLeftCorner()),n=this.arithmeticHelper.manyToExactNumbers(t.valuesFromTopLeftCorner());if(r instanceof Tr)return r;if(n instanceof Tr)return n;if(r.length<=1||n.length<=1)return new Tr(ir.DIV_BY_ZERO);const s=Wl(r,!0),i=Wl(n,!0);if(0===s||0===i)return new Tr(ir.DIV_BY_ZERO);const o=Ml(s/i,r.length-1,n.length-1);return 2*Math.min(o,1-o)}))}steyx(e,t){return this.runFunction(e.args,t,this.metadata("STEYX"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;const n=r[0].length;return n<=2?new Tr(ir.DIV_BY_ZERO,Z.ThreeValues):Math.sqrt((Bl(r[0])-Math.pow(jl(r[0],r[1])*(n-1),2)/Bl(r[1]))/(n-2))}))}slope(e,t){return this.runFunction(e.args,t,this.metadata("SLOPE"),((e,t)=>{if(e.numberOfElements()!==t.numberOfElements())return new Tr(ir.NA,Z.EqualLength);const r=uh(e,t);if(r instanceof Tr)return r;const n=r[0].length;return n<=1?new Tr(ir.DIV_BY_ZERO,Z.TwoValues):jl(r[0],r[1])*(n-1)/Bl(r[1])}))}chisqtest(e,t){return this.runFunction(e.args,t,this.metadata("CHISQ.TEST"),((e,t)=>{const r=e.height(),n=e.width();if(t.height()!==r||t.width()!==n)return new Tr(ir.NA,Z.EqualLength);const s=uh(e,t);if(s instanceof Tr)return s;if(s[0].
/**
* @license
* Copyright (c) 2024 Handsoncode. All rights reserved.
*/
class ch extends zi{}ch.HyperFormula=zi,ch.ErrorType=ir,ch.CellError=Tr,ch.CellType=or,ch.CellValueType=Er,ch.CellValueDetailedType=wr,ch.DetailedCellError=pn,ch.ExportedCellChange=pi,ch.ExportedNamedExpressionChange=gi,ch.ConfigValueTooBigError=_t,ch.ConfigValueTooSmallError=Mt,ch.EvaluationSuspendedError=At,ch.ExpectedOneOfValuesError=bt,ch.ExpectedValueOfTypeError=Tt,ch.ArraySize=cn,ch.SimpleRangeValue=rt,ch.EmptyValue=Ye,ch.FunctionPlugin=un,ch.FunctionArgumentType=hn,ch.FunctionPluginValidationError=Lt,ch.InvalidAddressError=pt,ch.InvalidArgumentsError=gt,ch.LanguageNotRegisteredError=xt,ch.LanguageAlreadyRegisteredError=Pt,ch.MissingTranslationError=Ot,ch.NamedExpressionDoesNotExistError=Et,ch.NamedExpressionNameIsAlreadyTakenError=mt,ch.NamedExpressionNameIsInvalidError=yt,ch.NoOperationToRedoError=Ct,ch.NoOperationToUndoError=wt,ch.NoRelativeAddressesAllowedError=Ft,ch.NoSheetWithIdError=lt,ch.NoSheetWithNameError=ht,ch.NotAFormulaError=dt,ch.NothingToPasteError=vt,ch.ProtectedFunctionTranslationError=It,ch.SheetNameAlreadyTakenError=ut,ch.SheetSizeLimitExceededError=ct,ch.SourceLocationHasArrayError=kt,ch.TargetLocationHasArrayError=Ht,ch.UnableToParseError=St;const dh=Ki.defaultConfig.language;zi.registerLanguage(dh,qi),zi.languages[qi.langCode]=qi;for(const e of Object.getOwnPropertyNames(i))e.startsWith("_")||zi.registerFunctionPlugin(i[e]);const ph=ch;window.HyperFormula=r(44820).Ay},14130:function(e,t,r){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,r){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,r)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function n(e,s,i){return n=r()?Reflect.construct:function(e,r,n){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return n&&t(i,n.prototype),i},n.apply(null,arguments)}function s(e){return i(e)||o(e)||a(e)||h()}function i(e){if(Array.isArray(e))return l(e)}function o(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u=Object.hasOwnProperty,c=Object.setPrototypeOf,d=Object.isFrozen,p=Object.getPrototypeOf,g=Object.getOwnPropertyDescriptor,f=Object.freeze,m=Object.seal,y=Object.create,E="undefined"!=typeof Reflect&&Reflect,w=E.apply,C=E.construct;w||(w=function(e,t,r){return e.apply(t,r)}),f||(f=function(e){return e}),m||(m=function(e){return e}),C||(C=function(e,t){return n(e,s(t))});var v=x(Array.prototype.forEach),R=x(Array.prototype.pop),S=x(Array.prototype.push),T=x(String.prototype.toLowerCase),N=x(String.prototype.toString),M=x(String.prototype.match),_=x(String.prototype.replace),b=x(String.prototype.indexOf),A=x(String.prototype.trim),O=x(RegExp.prototype.test),I=P(TypeError);function x(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return w(e,t,n)}}function P(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(e,r)}}function L(e,t,r){var n;r=null!==(n=r)&&void 0!==n?n:T,c&&c(e,null);for(var s=t.length;s--;){var i=t[s];if("string"==typeof i){var o=r(i);o!==i&&(d(t)||(t[s
//! moment.js
s.version="2.30.1",i(Xr),s.fn=hi,s.min=Jr,s.max=en,s.now=tn,s.utc=f,s.unix=ui,s.months=yi,s.isDate=d,s.locale=fr,s.invalid=w,s.duration=An,s.isMoment=T,s.weekdays=wi,s.parseZone=ci,s.localeData=Er,s.isDuration=ln,s.monthsShort=Ei,s.weekdaysMin=vi,s.defineLocale=mr,s.updateLocale=yr,s.locales=wr,s.weekdaysShort=Ci,s.normalizeUnits=ne,s.relativeTimeRounding=so,s.relativeTimeThreshold=io,s.calendarFormat=Wn,s.prototype=hi,s.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},s}(),window.moment=r(1314)},63192:(e,t,r)=>{e.exports=function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){if(i)return i(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=r[o]={exports:{}};t[o][0].call(h.exports,(function(e){return s(t[o][1][e]||e)}),h,h.exports,e,t,r,n)}return r[o].exports}for(var i=void 0,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(e,t,r){!function(e){"use strict";var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,i=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,u=9007199254740991,c=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,p=1e9;function g(e){var t=0|e;return 0<e||e===t?t:t-1}function f(e){for(var t,r,n=1,s=e.length,i=e[0]+"";n<s;){for(t=e[n++]+"",r=h-t.length;r--;t="0"+t);i+=t}for(s=i.length;48===i.charCodeAt(--s););return i.slice(0,s+1||1)}function m(e,t){var r,n,s=e.c,i=t.c,o=e.s,a=t.s,l=e.e,h=t.e;if(!o||!a)return null;if(r=s&&!s[0],n=i&&!i[0],r||n)return r?n?0:-a:o;if(o!=a)return o;if(r=o<0,n=l==h,!s||!i)return n?0:!s^r?1:-1;if(!n)return h<l^r?1:-1;for(a=(l=s.length)<(h=i.length)?l:h,o=0;o<a;o++)if(s[o]!=i[o])return s[o]>i[o]^r?1:-1;return l==h?0:h<l^r?1:-1}function y(e,t,r,n){if(e<t||r<e||e!==(e<0?s(e):i(e)))throw Error(o+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return g(e.e/h)==t&&e.c[t]%2!=0}function w(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function C(e,t,r){var n,s;if(t<0){for(s=r+".";++t;s+=r);e=s+e}else if(++t>(n=e.length)){for(s=r,t-=n;--t;s+=r);e+=s}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(r=function e(t){var r,v,R,S,T,N,M,_,b,A,O=Y.prototype={constructor:Y,toString:null,valueOf:null},I=new Y(1),x=20,P=4,L=-7,D=21,k=-1e7,H=1e7,F=!1,U=1,V=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},W="0123456789abcdefghijklmnopqrstuvwxyz";function Y(e,t){var r,s,o,l,c,d,p,g,f=this;if(!(f instanceof Y))return new Y(e,t);if(null==t){if(e instanceof Y)return f.s=e.s,f.e=e.e,void(f.c=(e=e.c)?e.slice():e);if((d="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,c=e;10<=c;c/=10,l++);return f.e=l,void(f.c=[e])}g=String(e)}else{if(g=String(e),!n.test(g))return R(f,g,d);f.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}-1<(l=g.indexOf("."))&&(g=g.replace(".","")),0<(c=g.search(/e/i))?(l<0&&(l=c),l+=+g.slice(c+1),g=g.substring(0,c)):l<0&&(l=g.length)}else{if(y(t,2,W.length,"Base"),g=String(e),10==t)return $(f=new Y(e instanceof Y?e:g),x+f.e+1,P);if(d="number"==typeof e){if(0*e!=0)return R(f,g,d,t);if(f.s=1/e<0?(g=g.slice(1),-1):1,Y.DEBUG&&15<g.replace(/^0\.0*|\./,"").length)throw Error(a+e);d=!1}else f.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=W.slice(0,t),l=c=0,p=g.length;c<p;c++)if(r.indexOf(s=g.charAt(c))<0){if("."==s){if(l<c){l=p;continue}}else if(!o&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){o=!0,c=-1,l=0;continue}return R(f,String(e),d,t)}-1<(l=(g=v(g,t,10,f.s)).indexOf("."))?g=g.replace(".",""):l=g.length}for(c=0;48===g.charCodeAt(c);c++);for(p=g.length;48===g.charCodeAt(--p););if(g=g.slice(c,++p)){if(p-=c,d&&Y.DEBUG&&15<p&&(u<e||e!==i(e)))throw Error(a+f.s*e);if(H<(l=l-c-1))f.c=f.e=null;el
Consider limiting the number of rendered columns by specifying the table width and/or\x20
turning off the "renderAllColumns" option.`));for(let e=0;e<t;e++){const t=this.table.renderedColumnToSource(e),r=this.table.columnUtils.getHeaderWidth(t);this.rootNode.childNodes[e].style.width=`${r}px`}for(let r=0;r<e;r++){const e=this.table.renderedColumnToSource(r),n=this.table.columnUtils.getStretchedColumnWidth(e);this.rootNode.childNodes[r+t].style.width=`${n}px`}const r=this.rootNode.firstChild;r&&(0,a.addClass)(r,"rowHeader")}}t.default=h},83013:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0;var s=r(49536),i=n(r(54493)),o=r(81595);class a extends i.default{constructor(e){super(null,e)}adjust(){const{columnHeadersCount:e,rowHeadersCount:t}=this.table;let r=this.rootNode.firstChild;if(e){const{columnsToRender:n}=this.table,s=n+t;for(let t=0,n=e;t<n;t++){for(r=this.rootNode.childNodes[t],r||(r=this.table.rootDocument.createElement("tr"),this.rootNode.appendChild(r)),this.renderedNodes=r.childNodes.length;this.renderedNodes<s;)r.appendChild(this.table.rootDocument.createElement("th")),this.renderedNodes+=1;for(;this.renderedNodes>s;)r.removeChild(r.lastChild),this.renderedNodes-=1}const i=this.rootNode.childNodes.length;if(i>e)for(let t=e;t<i;t++)this.rootNode.removeChild(this.rootNode.lastChild)}else r&&(0,s.empty)(r)}render(){const{columnHeadersCount:e}=this.table;this.table.isAriaEnabled()&&(0,s.setAttribute)(this.rootNode,[(0,o.A11Y_ROWGROUP)()]);for(let t=0;t<e;t+=1){const{columnHeaderFunctions:e,columnsToRender:r,rowHeadersCount:n}=this.table,i=this.rootNode.childNodes[t];this.table.isAriaEnabled()&&(0,s.setAttribute)(i,[(0,o.A11Y_ROW)(),(0,o.A11Y_ROWINDEX)(t+1)]);for(let a=-1*n;a<r;a+=1){const r=this.table.renderedColumnToSource(a),l=i.childNodes[a+n];l.className="",l.removeAttribute("style"),(0,s.removeAttribute)(l,[new RegExp("aria-(.*)"),new RegExp("role")]),this.table.isAriaEnabled()&&(0,s.setAttribute)(l,[(0,o.A11Y_COLINDEX)(a+1+this.table.rowHeadersCount),(0,o.A11Y_TABINDEX)(-1),(0,o.A11Y_COLUMNHEADER)(),...a>=0?[(0,o.A11Y_SCOPE_COL)()]:[(0,o.A11Y_ROW)()]]),e[t](r,l,t)}}}}t.default=a},7961:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0;var s=n(r(31211));t.RowHeadersRenderer=s.default;var i=n(r(83013));t.ColumnHeadersRenderer=i.default;var o=n(r(23792));t.ColGroupRenderer=o.default;var a=n(r(84140));t.RowsRenderer=a.default;var l=n(r(90720));t.CellsRenderer=l.default;var h=n(r(95593));t.TableRenderer=h.default;t.Renderer=class{constructor(){let{TABLE:e,THEAD:t,COLGROUP:r,TBODY:n,rowUtils:u,columnUtils:c,cellRenderer:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.renderer=new h.default(e,{cellRenderer:d}),this.renderer.setRenderers({rowHeaders:new s.default,columnHeaders:new i.default(t),colGroup:new o.default(r),rows:new a.default(n),cells:new l.default}),this.renderer.setAxisUtils(u,c)}setActiveOverlayName(e){return this.renderer.setActiveOverlayName(e),this}setFilters(e,t){return this.renderer.setFilters(e,t),this}setViewportSize(e,t){return this.renderer.setViewportSize(e,t),this}setHeaderContentRenderers(e,t){return this.renderer.setHeaderContentRenderers(e,t),this}adjust(){this.renderer.adjust()}render(){this.renderer.render()}}},31211:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0;var s=n(r(85707)),i=r(64625),o=n(r(54493)),a=r(49536),l=r(81595);class h extends o.default{constructor(){super("TH"),(0,s.default)(this,"orderViews",new WeakMap),(0,s.default)(this,"sourceRowIndex",0)}obtainOrderView(e){let t;return this.orderViews.has(e)?t=this.orderViews.get(e):(t=new i.SharedOrderView(e,(e=>this.nodesPool.obtain(this.sourceRowIndex,e)),this.nodeType),this.orderViews.set(e,t)),t}render(){const{rowsToRender:e,rowHeaderFunctions:t,rowHeadersCount:r,rows:n,cells:s}=this.table;for(let i=0;i<e;i++){const e=this.table.renderedRowToSource(i),o=n.getRenderedNode(i);this.sourceRowIndex=e;const h=this.obtainOrderView(o),u=s.obtainOrderView(o);h.appendView(u).setSize(r).setOffset(this.table.renderedColumnToSource(0)).start();for(let n=0;n<r;n++){h.render();const r=h.getCurrentNode();r.className="",r.removeAttribute("style"),(0,a.removeAttribute)(r,[new RegExp("aria-
Consider limiting the number of rendered rows by specifying the table height and/or\x20
turning off the "renderAllRows" option.`)),this.table.isAriaEnabled()&&(0,h.setAttribute)(this.rootNode,[(0,u.A11Y_ROWGROUP)()]),this.orderView.setSize(e).setOffset(this.table.renderedRowToSource(0)).start();for(let n=0;n<e;n++){this.orderView.render();const e=this.orderView.getCurrentNode(),s=this.table.renderedRowToSource(n);var t,r;if(this.table.isAriaEnabled())(0,h.setAttribute)(e,[(0,u.A11Y_ROW)(),(0,u.A11Y_ROWINDEX)(s+(null!==(t=null===(r=this.table.rowUtils)||void 0===r||null===(r=r.dataAccessObject)||void 0===r?void 0:r.columnHeaders.length)&&void 0!==t?t:0)+1)])}this.orderView.end()}}t.default=d},95593:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0;var s=n(r(85707));t.default=class{constructor(e){let{cellRenderer:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,s.default)(this,"rootNode",void 0),(0,s.default)(this,"rootDocument",void 0),(0,s.default)(this,"rowHeaders",null),(0,s.default)(this,"columnHeaders",null),(0,s.default)(this,"colGroup",null),(0,s.default)(this,"rows",null),(0,s.default)(this,"cells",null),(0,s.default)(this,"rowFilter",null),(0,s.default)(this,"columnFilter",null),(0,s.default)(this,"rowUtils",null),(0,s.default)(this,"columnUtils",null),(0,s.default)(this,"rowsToRender",0),(0,s.default)(this,"columnsToRender",0),(0,s.default)(this,"rowHeaderFunctions",[]),(0,s.default)(this,"rowHeadersCount",0),(0,s.default)(this,"columnHeaderFunctions",[]),(0,s.default)(this,"columnHeadersCount",0),(0,s.default)(this,"cellRenderer",void 0),(0,s.default)(this,"activeOverlayName",void 0),this.rootNode=e,this.rootDocument=this.rootNode.ownerDocument,this.cellRenderer=t}setActiveOverlayName(e){this.activeOverlayName=e}setAxisUtils(e,t){this.rowUtils=e,this.columnUtils=t}setViewportSize(e,t){this.rowsToRender=e,this.columnsToRender=t}setFilters(e,t){this.rowFilter=e,this.columnFilter=t}setHeaderContentRenderers(e,t){this.rowHeaderFunctions=e,this.rowHeadersCount=e.length,this.columnHeaderFunctions=t,this.columnHeadersCount=t.length}setRenderers(){let{rowHeaders:e,columnHeaders:t,colGroup:r,rows:n,cells:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.setTable(this),t.setTable(this),r.setTable(this),n.setTable(this),s.setTable(this),this.rowHeaders=e,this.columnHeaders=t,this.colGroup=r,this.rows=n,this.cells=s}renderedRowToSource(e){return this.rowFilter.renderedToSource(e)}renderedColumnToSource(e){return this.columnFilter.renderedToSource(e)}isAriaEnabled(){return this.rowUtils.wtSettings.getSetting("ariaTags")}render(){this.colGroup.adjust(),this.columnHeaders.adjust(),this.rows.adjust(),this.rowHeaders.adjust(),this.columnHeaders.render(),this.rows.render(),this.rowHeaders.render(),this.cells.render(),this.columnUtils.calculateWidths(),this.colGroup.render();const{rowsToRender:e,rows:t}=this;for(let r=0;r<e;r++){const e=t.getRenderedNode(r);if(e.firstChild){const t=this.renderedRowToSource(r),n=this.rowUtils.getHeightByOverlayName(t,this.activeOverlayName);e.firstChild.style.height=n?n-1+"px":""}}}}},19184:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834);var s=n(r(85707)),i=r(49536);function o(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function a(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var l=new WeakSet;function h(e){const{wtSettings:t,inlineStartOverlay:r,wtTable:n,wtViewport:s,totalColumns:o,rootWindow:a}=this.dataAccessObject;if(r.mainTableScrollableElement===a){let l=null;if(t.getSetting("rtlMode")){const e=n.TABLE.getBoundingClientRect(),t=this.dataAccessObject.rootWindow.document.documentElement.offsetWidth;l=Math.abs(e.right-t)}else{l=(0,i.offset)(n.wtRootElement).left}const h=Math.abs((0,i.getScrollLeft)(a,a));if(l>h){const t=(0,i.innerWidth)(a);let n=s.getRowHeaderWidth();for(let s=1;s<=o;s++)if(n+=r.sumCellSizes(s-1,s),l+n-h>=t){e=s-2;break}}}return e}function u(e){const{topOverlay:t,wtTable:r,wtViewport:n,totalRows:s,rootWindow:o}=this.dataAc
The license key for Handsontable is invalid.\x20
If you need any help, contact us at support@handsontable.com.`,expired:e=>{let{keyValidityDate:t,hotVersion:r}=e;return i.toSingleLine`
The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
version ${r}. Renew your license key at handsontable.com or downgrade to a version released prior\x20
to ${t}. If you need any help, contact us at sales@handsontable.com.`},missing:()=>i.toSingleLine`
The license key for Handsontable is missing. Use your purchased key to activate the product.\x20
Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20
passing the key: 'non-commercial-and-evaluation'. If you need any help, contact\x20
us at support@handsontable.com.`,non_commercial:()=>""},E={invalid:()=>i.toSingleLine`
The license key for Handsontable is invalid.\x20
<a href="https://handsontable.com/docs/tutorial-license-key.html" target="_blank">Read more</a> on how to\x20
install it properly or contact us at <a href="mailto:support@handsontable.com">support@handsontable.com</a>.`,expired:e=>{let{keyValidityDate:t,hotVersion:r}=e;return i.toSingleLine`
The license key for Handsontable expired on ${t}, and is not valid for the installed\x20
version ${r}. <a href="https://handsontable.com/pricing" target="_blank">Renew</a> your\x20
license key or downgrade to a version released prior to ${t}. If you need any\x20
help, contact us at <a href="mailto:sales@handsontable.com">sales@handsontable.com</a>.`},missing:()=>i.toSingleLine`
The license key for Handsontable is missing. Use your purchased key to activate the product.\x20
Alternatively, you can activate Handsontable to use for non-commercial purposes by\x20
passing the key: 'non-commercial-and-evaluation'.\x20
<a href="https://handsontable.com/docs/tutorial-license-key.html" target="_blank">Read more</a> about it in\x20
the documentation or contact us at <a href="mailto:support@handsontable.com">support@handsontable.com</a>.`,non_commercial:()=>""}},34261:(e,t,r)=>{"use strict";t.__esModule=!0,t.getMoves=function(e,t,r){return function(e){return e.forEach(((t,r)=>{e.slice(r+1).forEach((e=>{const r=e.from<e.to;e.from>t.from&&r&&(e.from-=1)}))})),e}(function(e,t){const r=[];return e.forEach((e=>{const n={from:e,to:t};r.forEach((e=>{const t=e.from>e.to,r=e.to<=n.from;e.from>n.from&&r&&t&&(n.from+=1)})),n.from>=t&&(t+=1),r.push(n)})),r}(e,function(e,t,r){const n=Array.from(Array(r).keys()).filter((t=>!1===e.includes(t)));var s;return 0===t?null!==(s=n[t])&&void 0!==s?s:0:n[t-1]+1}(e,t,r)))},r(15724)},27050:(e,t,r)=>{"use strict";function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=typeof e;if("number"===r)return!isNaN(e)&&isFinite(e);if("string"===r){if(0===e.length)return!1;if(1===e.length)return/\d/.test(e);const r=Array.from(new Set([".",...t])).map((e=>`\\${e}`)).join("|");return new RegExp(`^[+-]?(((${r})?\\d+((${r})\\d+)?(e[+-]?\\d+)?)|(0x[a-f\\d]+))$`,"i").test(e.trim())}return"object"===r&&!(!e||"number"!=typeof e.valueOf()||e instanceof Date)}t.__esModule=!0,t.clamp=function(e,t,r){if(Math.min(e,t)===e)return t;if(Math.max(e,r)===e)return r;return e},t.isNumeric=n,t.isNumericLike=function(e){return n(e,[","])},t.rangeEach=function(e,t,r){let n=-1;"function"==typeof t?(r=t,t=e):n=e-1;for(;++n<=t&&!1!==r(n););},t.rangeEachReverse=function(e,t,r){let n=e+1;"function"==typeof t&&(r=t,t=0);for(;--n>=t&&!1!==r(n););},t.valueAccordingPercent=function(e,t){return t=parseInt(t.toString().replace("%",""),10),t=isNaN(t)?0:t,parseInt(e*t/100,10)},r(36241),r(85151),r(49122),r(75183),r(40520),r(32495),r(72371)},58460:(e,t,r)=>{"use strict";t.__esModule=!0,t.clone=function(e){const t={};return o(e,((e,r)=>{t[r]=e})),t},t.createObjectPropListener=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";const r=`_${t}`,n={_touched:!1,[r]:e,isTouched(){return this._touched}};return Object.defineProperty(n,t,{get(){return this[r]},set(e){this._touched=!0,this[r]=e},enumerable:!0,configurable:!0}),n},t.deepClone=s,t.deepExtend=function e(t,r){o(r,((n,s)=>{r[s]&&"object"==typeof r[s]?(t[s]||(Array.isArray(r[s])?t[s]=[]:"[object Date]"===Object.prototype.toString.call(r[s])?t[s]=r[s]:t[s]={}),e(t[s],r[s])):t[s]=r[s]}))},t.deepObjectSize=function(e){if(!i(e))return 0;const t=function(e){let r=0;return i(e)?o(e,((e,n)=>{"__children"!==n&&(r+=t(e))})):r+=1,r};return t(e)},t.defineGetter=function(e,t,r,n){n.value=r,n.writable=!1!==n.writable,n.enumerable=!1!==n.enumerable,n.configurable=!1!==n.configurable,Object.defineProperty(e,t,n)},t.duckSchema=function e(t){let r;Array.isArray(t)?r=t.length?new Array(t.length).fill(null):[]:(r={},o(t,((t,n)=>{"__children"!==n&&(t&&"object"==typeof t&&!Array.isArray(t)?r[n]=e(t):Array.isArray(t)?t.length&&"object"==typeof t[0]&&!Array.isArray(t[0])?r[n]=[e(t[0])]:r[n]=[]:r[n]=null)})));return r},t.extend=function(e,t,r){const n=Array.isArray(r);return o(t,((t,s)=>{(!1===n||r.includes(s))&&(e[s]=t)})),e},t.getProperty=function(e,t){const r=t.split(".");let n=e;return o(r,(e=>{if(n=n[e],void 0===n)return n=void 0,!1})),n},t.hasOwnProperty=a,t.inherit=function(e,t){return t.prototype.constructor=t,e.prototype=new t,e.prototype.constructor=e,e},t.isObject=i,t.isObjectEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},t.mixin=function(e){e.MIXINS||(e.MIXINS=[]);for(var t=arguments.length,r=new Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];return(0,n.arrayEach)(r,(t=>{e.MIXINS.push(t.MIXIN_NAME),o(t,((t,r)=>{if(void 0!==e.prototype[r])throw new Error(`Mixin conflict. Property '${r}' already exist and cannot be overwritten.`);if("function"==typeof t)e.prototype[r]=t;else{const n=function(e,t){const r=`_${e}`;return function(){return void 0===this[r]&&(this[r]=(e=>{let t=e;return(Array.isArray(t)||i(t))&&(t=s(t)),t})(t)),this[r]}},o=function(e){const t=`_${e}`;return function(e){this[t]=e}};Object.defineProperty(e.prototype,r,{get:n(r,t),set:o(r),co
/**
* @preserve
* Authors: Handsoncode
* Last updated: Nov 15, 2017
*
* Description: Definition file for English - United States language-country.
*/}(r(63751));function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:t})(e)}const i={languageCode:"en-US",[n.CONTEXTMENU_ITEMS_NO_ITEMS]:"No available options",[n.CONTEXTMENU_ITEMS_ROW_ABOVE]:"Insert row above",[n.CONTEXTMENU_ITEMS_ROW_BELOW]:"Insert row below",[n.CONTEXTMENU_ITEMS_INSERT_LEFT]:"Insert column left",[n.CONTEXTMENU_ITEMS_INSERT_RIGHT]:"Insert column right",[n.CONTEXTMENU_ITEMS_REMOVE_ROW]:["Remove row","Remove rows"],[n.CONTEXTMENU_ITEMS_REMOVE_COLUMN]:["Remove column","Remove columns"],[n.CONTEXTMENU_ITEMS_UNDO]:"Undo",[n.CONTEXTMENU_ITEMS_REDO]:"Redo",[n.CONTEXTMENU_ITEMS_READ_ONLY]:"Read only",[n.CONTEXTMENU_ITEMS_CLEAR_COLUMN]:"Clear column",[n.CONTEXTMENU_ITEMS_ALIGNMENT]:"Alignment",[n.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT]:"Left",[n.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER]:"Center",[n.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT]:"Right",[n.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY]:"Justify",[n.CONTEXTMENU_ITEMS_ALIGNMENT_TOP]:"Top",[n.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE]:"Middle",[n.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM]:"Bottom",[n.CONTEXTMENU_ITEMS_FREEZE_COLUMN]:"Freeze column",[n.CONTEXTMENU_ITEMS_UNFREEZE_COLUMN]:"Unfreeze column",[n.CONTEXTMENU_ITEMS_BORDERS]:"Borders",[n.CONTEXTMENU_ITEMS_BORDERS_TOP]:"Top",[n.CONTEXTMENU_ITEMS_BORDERS_RIGHT]:"Right",[n.CONTEXTMENU_ITEMS_BORDERS_BOTTOM]:"Bottom",[n.CONTEXTMENU_ITEMS_BORDERS_LEFT]:"Left",[n.CONTEXTMENU_ITEMS_REMOVE_BORDERS]:"Remove border(s)",[n.CONTEXTMENU_ITEMS_ADD_COMMENT]:"Add comment",[n.CONTEXTMENU_ITEMS_EDIT_COMMENT]:"Edit comment",[n.CONTEXTMENU_ITEMS_REMOVE_COMMENT]:"Delete comment",[n.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT]:"Read-only comment",[n.CONTEXTMENU_ITEMS_MERGE_CELLS]:"Merge cells",[n.CONTEXTMENU_ITEMS_UNMERGE_CELLS]:"Unmerge cells",[n.CONTEXTMENU_ITEMS_COPY]:"Copy",[n.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS]:["Copy with header","Copy with headers"],[n.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS]:["Copy with group header","Copy with group headers"],[n.CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY]:["Copy header only","Copy headers only"],[n.CONTEXTMENU_ITEMS_CUT]:"Cut",[n.CONTEXTMENU_ITEMS_NESTED_ROWS_INSERT_CHILD]:"Insert child row",[n.CONTEXTMENU_ITEMS_NESTED_ROWS_DETACH_CHILD]:"Detach from parent",[n.CONTEXTMENU_ITEMS_HIDE_COLUMN]:["Hide column","Hide columns"],[n.CONTEXTMENU_ITEMS_SHOW_COLUMN]:["Show column","Show columns"],[n.CONTEXTMENU_ITEMS_HIDE_ROW]:["Hide row","Hide rows"],[n.CONTEXTMENU_ITEMS_SHOW_ROW]:["Show row","Show rows"],[n.FILTERS_CONDITIONS_NONE]:"None",[n.FILTERS_CONDITIONS_EMPTY]:"Is empty",[n.FILTERS_CONDITIONS_NOT_EMPTY]:"Is not empty",[n.FILTERS_CONDITIONS_EQUAL]:"Is equal to",[n.FILTERS_CONDITIONS_NOT_EQUAL]:"Is not equal to",[n.FILTERS_CONDITIONS_BEGINS_WITH]:"Begins with",[n.FILTERS_CONDITIONS_ENDS_WITH]:"Ends with",[n.FILTERS_CONDITIONS_CONTAINS]:"Contains",[n.FILTERS_CONDITIONS_NOT_CONTAIN]:"Does not contain",[n.FILTERS_CONDITIONS_GREATER_THAN]:"Greater than",[n.FILTERS_CONDITIONS_GREATER_THAN_OR_EQUAL]:"Greater than or equal to",[n.FILTERS_CONDITIONS_LESS_THAN]:"Less than",[n.FILTERS_CONDITIONS_LESS_THAN_OR_EQUAL]:"Less than or equal to",[n.FILTERS_CONDITIONS_BETWEEN]:"Is between",[n.FILTERS_CONDITIONS_NOT_BETWEEN]:"Is not between",[n.FILTERS_CONDITIONS_AFTER]:"After",[n.FILTERS_CONDITIONS_BEFORE]:"Before",[n.FILTERS_CONDITIONS_TODAY]:"Today",[n.FILTERS_CONDITIONS_TOMORROW]:"Tomorrow",[n.FILTERS_CONDITIONS_YESTERDAY]:"Yesterday",[n.FILTERS_VALUES_BLANK_CELLS]:"Blank cells",[n.FILTERS_DIVS_FILTER_BY_CONDITION]:"Filter by condition",[n.FILTERS_DIVS_FILTER_BY_VALUE]:"Filter by value",[n.FILTERS_LABELS_CONJUNCTION]:"And",[n.FILTERS_LABELS_DISJUNCTION]:"Or",[n.FILTERS_BUTTONS_SELECT_ALL]:"Select all",[n.FILTERS_BUTTONS_CLEAR]:"Clear",[n.FILTERS_BUTTONS_OK]:"OK",[n.FILTERS_BUTTONS_CANCEL]:"Cancel",[n.FILTERS_BUTTONS_PLACEHOLDER_SEARCH]:"Search",[n.FILTERS_BUTTONS_PLACEHOLDER_VALUE]:"Value",[n.FILTERS_BUTTONS_PLACEHOLDER_SECOND_VALUE]:"Second value",[n.CHECKBOX_CHECKED]:"Checked",[n.CHECKBOX_UNCHECKED]:"Unchecked"};t.default=i},45309:(e,t,r)=>{"use strict";var n=
before using it. Read more about this issue at: https://docs.handsontable.com/i18n/missing-language-code.`)};var n=r(67508),s=r(58460),i=r(39874),o=r(12556)},8945:(e,t,r)=>{"use strict";var n=r(96784);var s=k(r(25188));s.CellCoords,s.CellRange;var i,o,a,l,h,u=r(21642),c=k(r(63286)),d=r(65686),p=n(r(27952)),g=n(r(95754)),f=k(r(33050)),m=k(r(98758)),y=k(r(1479)),E=k(r(37671)),w=k(r(11459)),C=k(r(36201)),v=k(r(25735)),R=k(r(67508)),S=k(r(27050)),T=k(r(58460)),N=k(r(69114)),M=k(r(35592)),_=k(r(49536)),b=k(r(24456)),A=r(39761),O=r(94539),I=r(19434),x=r(36528),P=r(9415),L=r(55006);function D(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(D=function(e){return e?r:t})(e)}function k(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=D(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var o=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}(0,u.registerAllModules)(),(0,p.default)(s.default),s.default.__GhostTable=g.default,s.default._getListenersCounter=c.getListenersCounter,s.default._getRegisteredMapsCounter=d.getRegisteredMapsCounter,s.default.EventManager=c.default;const H=[m,y,E,w,C,v,R,S,T,N,M,f],F=[_,b];s.default.helper={},s.default.dom={},m.arrayEach(H,(e=>{m.arrayEach(Object.getOwnPropertyNames(e),(t=>{"_"!==t.charAt(0)&&(s.default.helper[t]=e[t])}))})),m.arrayEach(F,(e=>{m.arrayEach(Object.getOwnPropertyNames(e),(t=>{"_"!==t.charAt(0)&&(s.default.dom[t]=e[t])}))})),s.default.cellTypes=null!==(i=s.default.cellTypes)&&void 0!==i?i:{},m.arrayEach((0,x.getRegisteredCellTypeNames)(),(e=>{s.default.cellTypes[e]=(0,x.getCellType)(e)})),s.default.cellTypes.registerCellType=x.registerCellType,s.default.cellTypes.getCellType=x.getCellType,s.default.editors=null!==(o=s.default.editors)&&void 0!==o?o:{},m.arrayEach((0,A.getRegisteredEditorNames)(),(e=>{s.default.editors[`${N.toUpperCaseFirst(e)}Editor`]=(0,A.getEditor)(e)})),s.default.editors.registerEditor=A.registerEditor,s.default.editors.getEditor=A.getEditor,s.default.renderers=null!==(a=s.default.renderers)&&void 0!==a?a:{},m.arrayEach((0,O.getRegisteredRendererNames)(),(e=>{const t=(0,O.getRenderer)(e);"base"===e&&(s.default.renderers.cellDecorator=t),s.default.renderers[`${N.toUpperCaseFirst(e)}Renderer`]=t})),s.default.renderers.registerRenderer=O.registerRenderer,s.default.renderers.getRenderer=O.getRenderer,s.default.validators=null!==(l=s.default.validators)&&void 0!==l?l:{},m.arrayEach((0,I.getRegisteredValidatorNames)(),(e=>{s.default.validators[`${N.toUpperCaseFirst(e)}Validator`]=(0,I.getValidator)(e)})),s.default.validators.registerValidator=I.registerValidator,s.default.validators.getValidator=I.getValidator,s.default.plugins=null!==(h=s.default.plugins)&&void 0!==h?h:{},m.arrayEach((0,P.getPluginsNames)(),(e=>{s.default.plugins[e]=(0,P.getPlugin)(e)})),s.default.plugins[`${N.toUpperCaseFirst(L.BasePlugin.PLUGIN_KEY)}Plugin`]=L.BasePlugin,s.default.plugins.registerPlugin=P.registerPlugin,s.default.plugins.getPlugin=P.getPlugin;t.default=s.default},15129:(e,t,r)=>{"use strict";t.__esModule=!0,r(15724);var n=r(98758),s=r(58460);const i={_hooksStorage:Object.create(null),addHook(e,t){return this._hooksStorage[e]||(this._hooksStorage[e]=[]),this.hot.addHook(e,t),this._hooksStorage[e].push(t),this},removeHooksByKey(e){(0,n.arrayEach)(this._hooksStorage[e]||[],(t=>{this.hot.removeHook(e,t)}))},clearHooks(){(0,s.objectEach)(this._hooksStorage,((e,t)=>this.removeHooksByKey(t))),this._hooksStorage={}}};(0,s.defineGetter)(i,"MIXIN_NAME","hooksRefRegisterer",{writable:!1,enumerable:!1});t.default=i},48499:(e,t,r)=>{"use strict";t.__esModule=!0,r(15724);var n=r(58460),s=r(25735);const i={_localHooks:Object.create(null),addLocalHook(e,t){return this._localHooks[e]||(this._localHooks[e]=[]),this._localHooks[e].push(t),this},runLocalHooks(e,t,r,n,i,o,a){if(this._local
Please consult release notes https://github.com/handsontable/handsontable/releases/tag/[removedInVersion] to\x20
learn about the migration path.`,p=new Map([["modifyRow","8.0.0"],["modifyCol","8.0.0"],["unmodifyRow","8.0.0"],["unmodifyCol","8.0.0"],["skipLengthCache","8.0.0"],["hiddenColumn","8.0.0"],["hiddenRow","8.0.0"]]),g=new Map([[]]),f=new WeakMap;class m{static getSingleton(){return y}constructor(){(0,s.default)(this,"globalBucket",void 0),this.globalBucket=this.createEmptyBucket()}createEmptyBucket(){const e=Object.create(null);return(0,i.arrayEach)(c,(t=>{e[t]=[],this.initOrderMap(e,t)})),e}getBucket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?(e.pluginHookBucket||(e.pluginHookBucket=this.createEmptyBucket()),e.pluginHookBucket):this.globalBucket}add(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;if(Array.isArray(t))(0,i.arrayEach)(t,(t=>this.add(e,t,r)));else{p.has(e)&&(0,l.warn)((0,a.substitute)(d,{hookName:e,removedInVersion:p.get(e)})),g.has(e)&&(0,l.warn)(g.get(e));const s=this.getBucket(r);if(void 0===s[e]&&(this.register(e),s[e]=[],this.initOrderMap(s,e)),t.skip=!1,-1===s[e].indexOf(t)){let r=!1;t.initialHook&&(0,i.arrayEach)(s[e],((n,i)=>{if(n.initialHook)return s[e][i]=t,r=!0,!1})),r||s[e].push(t)}this.setCallbackOrderIndex(s,e,t,n),this.orderBucketByOrderIndex(s,e)}return this}once(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0;Array.isArray(t)?(0,i.arrayEach)(t,(t=>this.once(e,t,r))):(t.runOnce=!0,this.add(e,t,r,n))}remove(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const n=this.getBucket(r);return void 0!==n[e]&&n[e].indexOf(t)>=0&&(t.skip=!0,!0)}has(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const r=this.getBucket(t);return!(void 0===r[e]||!r[e].length)}run(e,t,r,n,s,i,o,a){{const l=this.globalBucket[t],h=l?l.length:0;let c=0;if(h)for(;c<h;){if(!l[c]||l[c].skip){c+=1;continue}const h=(0,u.fastCall)(l[c],e,r,n,s,i,o,a);void 0!==h&&(r=h),l[c]&&l[c].runOnce&&this.remove(t,l[c]),c+=1}}{const l=this.getBucket(e)[t],h=l?l.length:0;let c=0;if(h)for(;c<h;){if(!l[c]||l[c].skip){c+=1;continue}const h=(0,u.fastCall)(l[c],e,r,n,s,i,o,a);void 0!==h&&(r=h),l[c]&&l[c].runOnce&&this.remove(t,l[c],e),c+=1}}return r}destroy(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;(0,o.objectEach)(this.getBucket(e),((e,t,r)=>r[t].length=0))}register(e){this.isRegistered(e)||c.push(e)}deregister(e){this.isRegistered(e)&&c.splice(c.indexOf(e),1)}isDeprecated(e){return g.has(e)||p.has(e)}isRegistered(e){return c.indexOf(e)>=0}getRegistered(){return c}setCallbackOrderIndex(e,t,r,n){const s=Number.isInteger(n)?n:0,i=this.getCallbackOrderMap(e,t);i.set(s,[...i.get(s)||[],r])}orderBucketByOrderIndex(e,t){const r=this.getCallbackOrderMap(e,t);void 0===r||0===r.size||1===r.size&&r.has(0)||(e[t]=[...r].sort(((e,t)=>e[0]-t[0])).flatMap((e=>{let[,t]=e;return t})))}initOrderMap(e,t){f.has(e)||f.set(e,[]),f.get(e)[t]=new Map}getCallbackOrderMap(e,t){return f.get(e)[t]}}const y=new m;t.default=m},859:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724);var s=n(r(85707)),i=r(55006),o=r(36201),a=n(r(95754)),l=n(r(37056)),h=r(58460),u=r(27050),c=n(r(3791)),d=r(69114),p=r(6697),g=r(65686);function f(e,t,r){m(e,t),t.set(e,r)}function m(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function y(e,t){return e.get(w(e,t))}function E(e,t,r){return e.set(w(e,t),r),r}function w(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}l.default.getSingleton().register("modifyAutoColumnSizeSeed");const C=t.PLUGIN_KEY="autoColumnSize",v=t.PLUGIN_PRIORITY=10;var R=new WeakMap,S=new WeakMap,T=new WeakSet;class N extends i.BasePlugin{static get PLUGIN_KEY(){return C}static get PLUGIN_PRIORITY(){return v}static get SETTING_KEYS(){return!0}static get CALCULATION_STEP(){return 50}static get SYNC_CALCULATION_LIMIT(){return 50}constructor(e){var t,r;super(e),m(t=this,r=T),r.add(t)
numeric format. Cannot do the calculation.`);return s}}function m(){this.endpoints.initEndpoints()}function y(e){void 0!==e.columns&&this.endpoints.refreshCellMetas()}function E(e,t){e&&"ColumnSummary.reset"!==t&&"ColumnSummary.set"!==t&&"loadData"!==t&&this.endpoints.refreshChangedEndpoints(e)}function w(e,t){this.endpoints.resetSetupBeforeStructureAlteration("move_row",e[0],e.length,e,this.pluginName),this.endpoints.resetSetupAfterStructureAlteration("move_row",t,e.length,e,this.pluginName)}t.ColumnSummary=f},66677:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724);var s=n(r(85707)),i=r(98758),o=r(39874);t.default=class{constructor(e,t){(0,s.default)(this,"plugin",void 0),(0,s.default)(this,"hot",void 0),(0,s.default)(this,"endpoints",[]),(0,s.default)(this,"settings",void 0),(0,s.default)(this,"settingsType","array"),(0,s.default)(this,"currentEndpoint",null),(0,s.default)(this,"cellsToSetCache",[]),this.plugin=e,this.hot=this.plugin.hot,this.settings=t}initEndpoints(){this.endpoints=this.parseSettings(),this.refreshAllEndpoints()}getEndpoint(e){return"function"===this.settingsType?this.fillMissingEndpointData(this.settings)[e]:this.endpoints[e]}getAllEndpoints(){return"function"===this.settingsType?this.fillMissingEndpointData(this.settings):this.endpoints}fillMissingEndpointData(e){return this.parseSettings(e.call(this))}parseSettings(e){const t=[];let r=e;if(r||"function"!=typeof this.settings)return r||(r=this.settings),(0,i.arrayEach)(r,(e=>{const r={};this.assignSetting(e,r,"ranges",[[0,this.hot.countRows()-1]]),this.assignSetting(e,r,"reversedRowCoords",!1),this.assignSetting(e,r,"destinationRow",new Error("\n You must provide a destination row for the Column Summary plugin in order to work properly!\n ")),this.assignSetting(e,r,"destinationColumn",new Error("\n You must provide a destination column for the Column Summary plugin in order to work properly!\n ")),this.assignSetting(e,r,"sourceColumn",e.destinationColumn),this.assignSetting(e,r,"type","sum"),this.assignSetting(e,r,"forceNumeric",!1),this.assignSetting(e,r,"suppressDataTypeErrors",!0),this.assignSetting(e,r,"customFunction",null),this.assignSetting(e,r,"readOnly",!0),this.assignSetting(e,r,"roundFloat",!1),t.push(r)})),t;this.settingsType="function"}assignSetting(e,t,r,n){if("ranges"!==r||void 0!==e[r]){if("ranges"!==r||0!==e[r].length)if(void 0===e[r]){if(n instanceof Error)throw n;t[r]=n}else"destinationRow"===r&&t.reversedRowCoords?t[r]=this.hot.countRows()-e[r]-1:t[r]=e[r]}else t[r]=n}resetSetupBeforeStructureAlteration(e,t,r){if("function"!==this.settingsType)return;const n=e.indexOf("row")>-1?"row":"col",s=this.getAllEndpoints();(0,i.arrayEach)(s,(s=>{"row"===n&&s.destinationRow>=t&&("insert_row"===e?s.alterRowOffset=r:"remove_row"===e&&(s.alterRowOffset=-1*r)),"col"===n&&s.destinationColumn>=t&&("insert_col"===e?s.alterColumnOffset=r:"remove_col"===e&&(s.alterColumnOffset=-1*r))})),this.resetAllEndpoints(s,!1)}resetSetupAfterStructureAlteration(e,t,r,n,s){let o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if("function"===this.settingsType){const e=()=>(this.hot.removeHook("beforeViewRender",e),this.refreshAllEndpoints());return void this.hot.addHookOnce("beforeViewRender",e)}const a=e.indexOf("row")>-1?"row":"col",l=e.indexOf("remove")>-1?-1:1,h=this.getAllEndpoints(),u=0===e.indexOf("move_row"),c=t;(0,i.arrayEach)(h,(e=>{"row"===a&&e.destinationRow>=c&&(e.alterRowOffset=l*r),"col"===a&&e.destinationColumn>=c&&(e.alterColumnOffset=l*r)})),this.resetAllEndpoints(h,!u),u?(0,i.arrayEach)(h,(e=>{this.extendEndpointRanges(e,c,n[0],n.length),this.recreatePhysicalRanges(e),this.clearOffsetInformation(e)})):(0,i.arrayEach)(h,(e=>{this.shiftEndpointCoordinates(e,c)})),o&&this.refreshAllEndpoints()}clearOffsetInformation(e){e.alterRowOffset=void 0,e.alterColumnOffset=void 0}extendEndpointRanges(e,t,r,n){(0,i.arrayEach)(e.ranges,(e=>{e[1]&&(t>=e[0]&&t<=e[1]?r>e[1]?e[1]+=n:r<e[0]&&(e[0]-=n):r>=e[0]&&r<=e[1]&&(e[1]-=n,t<=e[0]&&(e[0]+=1,e[1]+=1)))}))}recreatePhysicalRanges(e){const t=e.
filter operation. Use \`removeConditions\` to clear the current conditions and then add new ones.\x20
Mind that you cannot mix different types of operations (for instance, if you use \`conjunction\`,\x20
use it consequently for a particular column).`)}else if((0,d.isUndefined)(c.operations[r]))throw new Error(a.toSingleLine`Unexpected operation named \`${r}\`. Possible ones are\x20
\`disjunction\` and \`conjunction\`.`);const g=this.getConditions(e);0===g.length?this.filteringStates.setValueAtIndex(e,{operation:r,conditions:[{name:l,args:o,func:(0,h.getCondition)(l,o)}]},n):g.push({name:l,args:o,func:(0,h.getCondition)(l,o)}),this.runLocalHooks("afterAdd",e)}getConditions(e){var t,r;return null!==(t=null===(r=this.filteringStates.getValueAtIndex(e))||void 0===r?void 0:r.conditions)&&void 0!==t?t:[]}getOperation(e){var t;return null===(t=this.filteringStates.getValueAtIndex(e))||void 0===t?void 0:t.operation}getFilteredColumns(){return this.filteringStates.getEntries().map((e=>{let[t]=e;return t}))}getColumnStackPosition(e){return this.getFilteredColumns().indexOf(e)}exportAllConditions(){return(0,i.arrayReduce)(this.filteringStates.getEntries(),((e,t)=>{let[r,{operation:n,conditions:s}]=t;return e.push({column:r,operation:n,conditions:(0,i.arrayMap)(s,(e=>{let{name:t,args:r}=e;return{name:t,args:r}}))}),e}),[])}importAllConditions(e){this.clean(),(0,i.arrayEach)(e,(e=>{(0,i.arrayEach)(e.conditions,(t=>this.addCondition(e.column,t)))}))}removeConditions(e){this.runLocalHooks("beforeRemove",e),this.filteringStates.clearValue(e),this.runLocalHooks("afterRemove",e)}clean(){this.runLocalHooks("beforeClean"),this.filteringStates.clear(),this.runLocalHooks("afterClean")}hasConditions(e,t){const r=this.getConditions(e);return t?r.some((e=>e.name===t)):r.length>0}destroy(){this.isMapRegistrable&&this.hot.columnIndexMapper.unregisterMap(g),this.filteringStates=null,this.clearLocalHooks()}}(0,o.mixin)(f,l.default);t.default=f},26985:(e,t,r)=>{"use strict";t.__esModule=!0,t.getCondition=function(e,t){if(!n[e])throw Error(`Filter condition "${e}" does not exist.`);const{condition:r,descriptor:s}=n[e];let i=t;s.inputValuesDecorator&&(i=s.inputValuesDecorator(i));return function(e){return r.apply(e.meta.instance,[].concat([e],[i]))}},t.getConditionDescriptor=function(e){if(!n[e])throw Error(`Filter condition "${e}" does not exist.`);return n[e].descriptor},t.registerCondition=function(e,t,r){r.key=e,n[e]={condition:t,descriptor:r}},r(67834);const n=t.conditions={}},50044:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724);var s=n(r(85707)),i=r(98758),o=r(58460),a=r(25735),l=n(r(48499)),h=n(r(2519)),u=n(r(294)),c=r(6195);function d(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function p(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var g=new WeakSet;class f{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>[];d(this,g),(0,s.default)(this,"hot",void 0),(0,s.default)(this,"conditionCollection",void 0),(0,s.default)(this,"columnDataFactory",void 0),(0,s.default)(this,"changes",[]),(0,s.default)(this,"grouping",!1),(0,s.default)(this,"latestEditedColumnPosition",-1),(0,s.default)(this,"latestOrderStack",[]),this.hot=e,this.conditionCollection=t,this.columnDataFactory=r,this.conditionCollection.addLocalHook("beforeRemove",(e=>p(g,this,m).call(this,e))),this.conditionCollection.addLocalHook("afterRemove",(e=>this.updateStatesAtColumn(e))),this.conditionCollection.addLocalHook("afterAdd",(e=>this.updateStatesAtColumn(e))),this.conditionCollection.addLocalHook("beforeClean",(()=>p(g,this,y).call(this))),this.conditionCollection.addLocalHook("afterClean",(()=>p(g,this,E).call(this)))}groupChanges(){this.grouping=!0}flush(){this.grouping=!1,(0,i.arrayEach)(this.changes,(e=>{this.updateStatesAtColumn(e)})),this.changes.length=0}updateStatesAtColumn(e,t){var r=this;if(this.grouping)return void(-1===this.changes.indexOf(e)&&this.changes.push(e));const n=this.conditionCollection.exportAllConditions();let s=this.conditionCollection.getColumnStackPosition(e);-1===s&&(s=this.latestEditedColumnPosition);const o=n.slice(0,s),l=n.slice(s);l.length&&l[0].column===e&&l.shift();const d=(0,a.curry)((function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const s=new h.def
The overall amount of conditions exceed the capability of the dropdown menu.\x20
For more details see the documentation.`);else{const t=this.conditionCollection.getOperation(n);this.components.get("filter_by_condition").updateState(i[0],n),this.components.get("filter_by_condition2").updateState(i[1],n),this.components.get("filter_operators").updateState(t,n),this.components.get("filter_by_value").updateState(e)}}t.Filters=L},40178:(e,t,r)=>{"use strict";t.__esModule=!0;var n=r(22549);t.PLUGIN_KEY=n.PLUGIN_KEY,t.PLUGIN_PRIORITY=n.PLUGIN_PRIORITY,t.Filters=n.Filters},5590:(e,t,r)=>{"use strict";t.__esModule=!0,t.getOperationFunc=function(e){if(!n[e])throw Error(`Operation with id "${e}" does not exist.`);const t=n[e].func;return function(e,r){return t(e,r)}},t.getOperationName=function(e){return n[e].name},t.registerOperation=function(e,t,r){n[e]={name:t,func:r}},r(67834);const n=t.operations={}},31240:(e,t,r)=>{"use strict";t.__esModule=!0,t.operationResult=l;var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var a=s?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}(r(63751)),s=r(5590);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}const o=t.OPERATION_ID="conjunction",a=t.SHORT_NAME_FOR_COMPONENT=n.FILTERS_LABELS_CONJUNCTION;function l(e,t){return e.every((e=>e.func(t)))}(0,s.registerOperation)(o,a,l)},65332:(e,t,r)=>{"use strict";t.__esModule=!0,t.operationResult=l;var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var a=s?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}(r(63751)),s=r(5590);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}const o=t.OPERATION_ID="disjunction",a=t.SHORT_NAME_FOR_COMPONENT=n.FILTERS_LABELS_DISJUNCTION;function l(e,t){return e.some((e=>e.func(t)))}(0,s.registerOperation)(o,a,l)},58123:(e,t,r)=>{"use strict";t.__esModule=!0,t.operationResult=l,r(67834);var n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=i(t);if(r&&r.has(e))return r.get(e);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&{}.hasOwnProperty.call(e,o)){var a=s?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(n,o,a):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}(r(63751)),s=r(5590);function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(i=function(e){return e?r:t})(e)}const o=t.OPERATION_ID="disjunctionWithExtraCondition",a=t.SHORT_NAME_FOR_COMPONENT=n.FILTERS_LABELS_DISJUNCTION;function l(e,t){if(e.length<3)throw Error("Operation doesn't work on less then three conditions.");return e.slice(0,e.length-1).some((e=>e.func(t)))&&e[e.length-1].func(t)}(0,s.registerOperation)(o,a,l)},16416:(e,t,r)=>{"use strict";t.__esModule=!0,t.createMenuFocusController=function(e,t){let r=-1;const l=(0,n.createFocusNavigator)(t),h=r=>()=>{e.isOpened()&&e.getKeyboardShortcutsCtrl().listen(a),l.setCurrentPage(t.indexOf(r))};function u(n){const h=e.getKeyboardShortcutsCtrl(),u=n.getKeyboardShortcutsCtrl();l.clear(),u.addCustomShortcuts([{keys:[["Tab"],["Shift","Tab"]],forwardToContext:h.getContext(a),callback:()=>{n.isSubMenu()&&n.close(),h.listen(a)}}]),n.isSubMenu()||h.addCustomShortcuts([{keys:[["Tab"],["Shift","Tab"]],callback:t=>{const n=e.getNavigator();n.getCurrentPage()>-1&&(r=n.
settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates.`),n}return null},t.setupSheet=function(e,t){!(0,i.isUndefined)(t)&&e.doesSheetExist(t)||(t=e.addSheet(t));return t},t.unregisterEngine=function(e,t){if(e){const r=c(),n=r.get(e),s=d(),i=s.get(e);n&&n.includes(t)&&(n.splice(n.indexOf(t),1),0===n.length&&r.delete(e)),i&&i.includes(t.guid)&&(i.splice(i.indexOf(t.guid),1),0===i.length&&(s.delete(e),e.destroy()))}},r(15724);var s=n(r(45212)),i=r(67508),o=r(12556),a=r(39874),l=r(58460),h=r(44721),u=r(19006);function c(){const e="engine_relationship",t=(0,s.default)(h.PLUGIN_KEY);return t.hasItem(e)||t.register(e,new Map),t.getItem(e)}function d(){const e="shared_engine_usage",t=(0,s.default)(h.PLUGIN_KEY);return t.hasItem(e)||t.register(e,new Map),t.getItem(e)}function p(e,t,r){const n=t[h.PLUGIN_KEY],s=(0,u.getEngineSettingsWithDefaultsAndOverrides)(t),i=c(),o=d();g(e,n.functions),f(e,n.language);const a=e.buildEmpty(s);return i.set(a,[r]),o.set(a,[r.guid]),m(a,n.namedExpressions),a.on("sheetAdded",(()=>{a.rebuildAndRecalculate()})),a.on("sheetRemoved",(()=>{a.rebuildAndRecalculate()})),a}function g(e,t){t&&t.forEach((t=>{const{name:r,plugin:n,translations:s}=t;try{e.registerFunction(r,n,s)}catch(e){(0,a.warn)(e.message)}}))}function f(e,t){if(t){const{langCode:r}=t;try{e.registerLanguage(r,t)}catch(e){(0,a.warn)(e.message)}}}function m(e,t){t&&(e.suspendEvaluation(),t.forEach((t=>{const{name:r,expression:n,scope:s,options:i}=t;try{e.addNamedExpression(r,n,s,i)}catch(e){(0,a.warn)(e.message)}})),e.resumeEvaluation())}},19006:(e,t,r)=>{"use strict";t.__esModule=!0,t.getEngineSettingsOverrides=o,t.getEngineSettingsWithDefaultsAndOverrides=function(e){var t;const r=e[n.PLUGIN_KEY],s=a(null!=r&&null!==(t=r.engine)&&void 0!==t&&t.hyperformula?r.engine:{}),l=o(e);return{...i,...s,...l}},t.getEngineSettingsWithOverrides=function(e){var t;const r=e[n.PLUGIN_KEY],s=a(null!=r&&null!==(t=r.engine)&&void 0!==t&&t.hyperformula?r.engine:{}),i=o(e);return{...s,...i}},t.haveEngineSettingsChanged=function(e,t){return Object.keys(t).some((r=>void 0!==t[r]&&t[r]!==e[r]))};var n=r(44721);const s=t.DEFAULT_LICENSE_KEY="internal-use-in-handsontable",i=t.DEFAULT_SETTINGS={licenseKey:s,useArrayArithmetic:!0,useColumnIndex:!1,useStats:!1,evaluateNullToZero:!0,precisionEpsilon:1e-13,precisionRounding:14,smartRounding:!0,leapYear1900:!1,nullDate:{year:1899,month:12,day:30},nullYear:30,dateFormats:["DD/MM/YYYY","DD/MM/YY"],timeFormats:["hh:mm","hh:mm:ss.sss"],matchWholeCell:!0,useRegularExpressions:!1,useWildcards:!0,functionArgSeparator:",",thousandSeparator:"",decimalSeparator:".",language:"enGB"};function o(e){var t;return{maxColumns:e.maxColumns,maxRows:e.maxRows,language:null===(t=e[n.PLUGIN_KEY])||void 0===t||null===(t=t.language)||void 0===t?void 0:t.langCode}}function a(e){return Object.keys(e).reduce(((t,r)=>("hyperformula"!==r&&(t[r]=e[r]),t)),{})}},44721:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724),r(66184),r(36241),r(85151),r(49122),r(75183),r(40520),r(32495),r(72371);var s=n(r(85707)),i=r(55006),o=n(r(45212)),a=r(39874),l=r(27050),h=r(67508),u=r(98538),c=r(91005),d=r(19006),p=r(37671),g=r(69114),f=n(r(37056)),m=n(r(16043));function y(e,t,r){E(e,t),t.set(e,r)}function E(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function w(e,t,r){return e.set(v(e,t),r),r}function C(e,t){return e.get(v(e,t))}function v(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const R=t.PLUGIN_KEY="formulas",S=t.SETTING_KEYS=["maxRows","maxColumns","language"],T=t.PLUGIN_PRIORITY=260;f.default.getSingleton().register("afterNamedExpressionAdded"),f.default.getSingleton().register("afterNamedExpressionRemoved"),f.default.getSingleton().register("afterSheetAdded"),f.default.getSingleton().register("afterSheetRemoved"),f.default.getSingleton().register("afterSheetRenamed"),f.default.getSingleton().register("afterFormulasValuesUpdate");const N=e=>
rowspan: ${n}, colspan: ${s}} contains negative values, which is\x20
not supported. It will not be added to the collection.`}static IS_OUT_OF_BOUNDS_WARNING(e){let{row:t,col:r}=e;return i.toSingleLine`The merged cell declared at [${t}, ${r}] is positioned\x20
(or positioned partially) outside of the table range. It was not added to the table, please fix your setup.`}static IS_SINGLE_CELL(e){let{row:t,col:r}=e;return i.toSingleLine`The merged cell declared at [${t}, ${r}] has both "rowspan"\x20
and "colspan" declared as "1", which makes it a single cell. It cannot be added to the collection.`}static ZERO_SPAN_WARNING(e){let{row:t,col:r}=e;return i.toSingleLine`The merged cell declared at [${t}, ${r}] has "rowspan"\x20
or "colspan" declared as "0", which is not supported. It cannot be added to the collection.`}static containsNegativeValues(e){let{row:t,col:r,rowspan:n,colspan:s}=e;return t<0||r<0||n<0||s<0}static isSingleCell(e){let{rowspan:t,colspan:r}=e;return 1===r&&1===t}static containsZeroSpan(e){let{rowspan:t,colspan:r}=e;return 0===r||0===t}static isOutOfBounds(e,t,r){return e.row<0||e.col<0||e.row>=t||e.row+e.rowspan-1>=t||e.col>=r||e.col+e.colspan-1>=r}normalize(e){const t=e.countRows(),r=e.countCols();this.row<0?this.row=0:this.row>t-1&&(this.row=t-1),this.col<0?this.col=0:this.col>r-1&&(this.col=r-1),this.row+this.rowspan>t-1&&(this.rowspan=t-this.row),this.col+this.colspan>r-1&&(this.colspan=r-this.col),l(u,this,null)}includes(e,t){return this.row<=e&&this.col<=t&&this.row+this.rowspan-1>=e&&this.col+this.colspan-1>=t}includesHorizontally(e){return this.col<=e&&this.col+this.colspan-1>=e}includesVertically(e){return this.row<=e&&this.row+this.rowspan-1>=e}shift(e,t){const r=e[0]||e[1],n=t+Math.abs(e[0]||e[1])-1,s=e[0]?"colspan":"rowspan",i=e[0]?"col":"row",o=Math.min(t,n),a=Math.max(t,n),h=this[i],c=this[i]+this[s]-1;if(h>=t&&(this[i]+=r),r>0)t<=c&&t>h&&(this[s]+=r);else if(r<0){if(o<=h&&a>=c)return this.removed=!0,l(u,this,null),!1;if(h>=o&&h<=a){const e=a-h+1,t=Math.abs(r)-e;this[i]-=t+r,this[s]-=e}else if(h<=o&&c>=a)this[s]+=r;else if(h<=o&&c>=o&&c<a){const e=c-o+1;this[s]-=e}}return l(u,this,null),!0}isFarther(e,t){return!e||("down"===t?e.row+e.rowspan-1<this.row+this.rowspan-1:"up"===t?e.row>this.row:"right"===t?e.col+e.colspan-1<this.col+this.colspan-1:"left"===t?e.col>this.col:null)}getLastRow(){return this.row+this.rowspan-1}getLastColumn(){return this.col+this.colspan-1}getRange(){return a(u,this)||l(u,this,this.cellRangeFactory(this.cellCoordsFactory(this.row,this.col),this.cellCoordsFactory(this.row,this.col),this.cellCoordsFactory(this.getLastRow(),this.getLastColumn()))),a(u,this)}}},61635:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724),r(63979),r(36241),r(85151),r(49122),r(75183),r(40520),r(32495),r(72371);var s=n(r(85707)),i=n(r(80962)),o=r(27050),a=r(39874),l=r(98758),h=r(12556);function u(e,t){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.add(e)}function c(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var d=new WeakSet;class p{constructor(e){u(this,d),(0,s.default)(this,"plugin",void 0),(0,s.default)(this,"mergedCells",[]),(0,s.default)(this,"mergedCellsMatrix",new Map),(0,s.default)(this,"hot",void 0),this.plugin=e,this.hot=e.hot}static IS_OVERLAPPING_WARNING(e){let{row:t,col:r}=e;return h.toSingleLine`The merged cell declared at [${t}, ${r}], overlaps\x20
with the other declared merged cell. The overlapping merged cell was not added to the table, please\x20
fix your setup.`}get(e,t){var r;return!!this.mergedCellsMatrix.has(e)&&(null!==(r=this.mergedCellsMatrix.get(e).get(t))&&void 0!==r&&r)}getByRange(e){let t=!1;return(0,l.arrayEach)(this.mergedCells,(r=>!(r.row<=e.from.row&&r.row+r.rowspan-1>=e.to.row&&r.col<=e.from.col&&r.col+r.colspan-1>=e.to.col)||(t=r,t))),t}filterOverlappingMergeCells(e){const t=new Set;this.mergedCells.forEach((e=>{const{row:r,col:n,colspan:s,rowspan:i}=e;for(let e=r;e<r+i;e++)for(let r=n;r<n+s;r++)t.add(`r${e},c${r}`)}));return e.filter((e=>{const{row:r,col:n,colspan:s,rowspan:i}=e,o=new Set;let l=!1;for(let h=r;h<r+i;h++){for(let r=n;r<n+s;r++){const n=`r${h},c${r}`;if(t.has(n)){(0,a.warn)(p.IS_OVERLAPPING_WARNING(e)),l=!0;break}o.add(n)}if(l)break}return l||t.add(...o),!l}))}getWithinRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{row:r,col:n}=e.getTopStartCorner(),{row:s,col:i}=e.getBottomEndCorner(),o=[];for(let e=r;e<=s;e++)for(let r=n;r<=i;r++){const n=this.get(e,r);n&&(t||!t&&n.row===e&&n.col===r)&&o.push(n)}return o}add(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.row,n=e.col,s=e.rowspan,o=e.colspan,l=new i.default(r,n,s,o,this.hot._createCellCoords,this.hot._createCellRange),h=this.get(r,n),u=!t&&this.isOverlapping(l);return h||u?((0,a.warn)(p.IS_OVERLAPPING_WARNING(l)),!1):(this.hot&&l.normalize(this.hot),this.mergedCells.push(l),c(d,this,f).call(this,l),l)}remove(e,t){const r=this.get(e,t),n=r?this.mergedCells.indexOf(r):-1;return!(!r||-1===n)&&(this.mergedCells.splice(n,1),c(d,this,m).call(this,r),r)}clear(){(0,l.arrayEach)(this.mergedCells,(e=>{let{row:t,col:r,rowspan:n,colspan:s}=e;(0,o.rangeEach)(t,t+n,(e=>{(0,o.rangeEach)(r,r+s,(t=>{const r=this.hot.getCell(e,t);r&&(r.removeAttribute("rowspan"),r.removeAttribute("colspan"),r.style.display="")}))}))})),this.mergedCells.length=0,this.mergedCellsMatrix=new Map}isOverlapping(e){const t=e.getRange();for(let e=0;e<this.mergedCells.length;e++){if(this.mergedCells[e].getRange().overlaps(t))return!0}return!1}isFirstRenderableMergedCell(e,t){const r=this.get(e,t);return r&&this.hot.rowIndexMapper.getNearestNotHiddenIndex(r.row,1)===e&&this.hot.columnIndexMapper.getNearestNotHiddenIndex(r.col,1)===t}getFirstRenderableCoords(e,t){const r=this.get(e,t);if(!r||this.isFirstRenderableMergedCell(e,t))return this.hot._createCellCoords(e,t);const n=this.hot.rowIndexMapper.getNearestNotHiddenIndex(r.row,1),s=this.hot.columnIndexMapper.getNearestNotHiddenIndex(r.col,1);return this.hot._createCellCoords(n,s)}getStartMostColumnIndex(e,t){const r=c(d,this,g).call(this,e,"col",-1);let n=t;for(let e=0;e<r.length;e++)if(r[e]<=t){n=r[e];break}return n}getEndMostColumnIndex(e,t){const r=c(d,this,g).call(this,e,"col",1);let n=t;for(let e=0;e<r.length;e++)if(r[e]>=t){n=r[e];break}return n}getTopMostRowIndex(e,t){const r=c(d,this,g).call(this,e,"row",-1);let n=t;for(let e=0;e<r.length;e++)if(r[e]<=t){n=r[e];break}return n}getBottomMostRowIndex(e,t){const r=c(d,this,g).call(this,e,"row",1);let n=t;for(let e=0;e<r.length;e++)if(r[e]>=t){n=r[e];break}return n}shiftCollections(e,t,r){const n=[0,0];switch(e){case"right":n[0]+=r;break;case"left":n[0]-=r;break;case"down":n[1]+=r;break;case"up":n[1]-=r}(0,l.arrayEach)(this.mergedCells,(e=>{c(d,this,m).call(this,e),e.shift(n,t),c(d,this,f).call(this,e)})),(0,o.rangeEachReverse)(this.mergedCells.length-1,0,(e=>{const t=this.mergedCells[e];t&&t.removed&&(this.mergedCells.splice(this.mergedCells.indexOf(t),1),c(d,this,m).call(this,t))}))}}function g(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n=new Map,s=1===r?e.getTopStartCorner():e.getBottomEndCorner(),i=1===r?e.getBottomEndCorner():e.getTopStartCorner();for(let e=s.row;1===r?e<=i.row:e>=i.row;e+=r)for(let o=s.col;1===r?o<=i.col:o>=i.col;o+=r){const s="row"===t?e:o,i=this.get(e,o);let a=s;i&&(a=1===r?i[t]+i[`${t}span`]-1:i[t]),n.has(s)||n.set(s,new Set),n.get(s).add(a)}return Array.from(new Set(Array.from(n.entries()).filter((e=>{let[,t]=e;return 1===t.size})).flatMap((e=>{let[,t]=e;return Array.from(t)}))))}function f(e){for(let
Only \`multiColumnSorting\` will work. The \`columnSorting\` plugin will be disabled.`)};var n=r(39874),s=r(12556)},75058:(e,t,r)=>{"use strict";t.__esModule=!0;var n=r(15309);t.PLUGIN_KEY=n.PLUGIN_KEY,t.PLUGIN_PRIORITY=n.PLUGIN_PRIORITY,t.MultipleSelectionHandles=n.MultipleSelectionHandles},15309:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(15724);var s=n(r(85707)),i=r(49536),o=r(1479),a=r(55006);const l=t.PLUGIN_KEY="multipleSelectionHandles",h=t.PLUGIN_PRIORITY=160;class u extends a.BasePlugin{constructor(){super(...arguments),(0,s.default)(this,"dragged",[]),(0,s.default)(this,"lastSetCell",null)}static get PLUGIN_KEY(){return l}static get PLUGIN_PRIORITY(){return h}isEnabled(){return(0,o.isMobileBrowser)()}enablePlugin(){this.enabled||(this.registerListeners(),super.enablePlugin())}registerListeners(){const e=this,{rootElement:t}=this.hot;function r(t){if(1===e.dragged.length)return e.dragged.splice(0,e.dragged.length),!0;const r=e.dragged.indexOf(t);if(-1===r)return!1;0===r?e.dragged=e.dragged.slice(0,1):1===r&&(e.dragged=e.dragged.slice(-1))}this.eventManager.addEventListener(t,"touchstart",(t=>{let r;return(0,i.hasClass)(t.target,"topSelectionHandle-HitArea")?(r=e.hot.getSelectedRangeLast(),e.dragged.push("top"),e.touchStartRange={width:r.getWidth(),height:r.getHeight(),direction:r.getDirection()},t.preventDefault(),!1):(0,i.hasClass)(t.target,"bottomSelectionHandle-HitArea")?(r=e.hot.getSelectedRangeLast(),e.dragged.push("bottom"),e.touchStartRange={width:r.getWidth(),height:r.getHeight(),direction:r.getDirection()},t.preventDefault(),!1):void 0})),this.eventManager.addEventListener(t,"touchend",(t=>(0,i.hasClass)(t.target,"topSelectionHandle-HitArea")?(r.call(e,"top"),e.touchStartRange=void 0,t.preventDefault(),!1):(0,i.hasClass)(t.target,"bottomSelectionHandle-HitArea")?(r.call(e,"bottom"),e.touchStartRange=void 0,t.preventDefault(),!1):void 0)),this.eventManager.addEventListener(t,"touchmove",(t=>{const{rootDocument:r}=this.hot;let n,s,i,o,a,l;if(0===e.dragged.length)return;const h=r.elementFromPoint(t.touches[0].clientX,t.touches[0].clientY);h&&h!==e.lastSetCell&&("TD"!==h.nodeName&&"TH"!==h.nodeName||(n=e.hot.getCoords(h),-1===n.col&&(n.col=0),s=e.hot.getSelectedRangeLast(),i=s.getWidth(),o=s.getHeight(),a=s.getDirection(),1===i&&1===o&&e.hot.selection.setRangeEnd(n),l=e.getCurrentRangeCoords(s,n,e.touchStartRange.direction,a,e.dragged[0]),null!==l.start&&e.hot.selection.setRangeStart(l.start),e.hot.selection.setRangeEnd(l.end),e.lastSetCell=h),t.preventDefault())}))}getCurrentRangeCoords(e,t,r,n,s){const i=e.getTopStartCorner(),o=e.getBottomEndCorner(),a=e.getBottomStartCorner(),l=e.getTopEndCorner();let h={start:null,end:null};switch(r){case"NE-SW":switch(n){case"NE-SW":case"NW-SE":h="top"===s?{start:this.hot._createCellCoords(t.row,e.highlight.col),end:this.hot._createCellCoords(a.row,t.col)}:{start:this.hot._createCellCoords(e.highlight.row,t.col),end:this.hot._createCellCoords(t.row,i.col)};break;case"SE-NW":"bottom"===s&&(h={start:this.hot._createCellCoords(o.row,t.col),end:this.hot._createCellCoords(t.row,i.col)})}break;case"NW-SE":switch(n){case"NE-SW":"top"===s?h={start:t,end:a}:h.end=t;break;case"NW-SE":"top"===s?h={start:t,end:o}:h.end=t;break;case"SE-NW":"top"===s?h={start:t,end:i}:h.end=t;break;case"SW-NE":"top"===s?h={start:t,end:l}:h.end=t}break;case"SW-NE":switch(n){case"NW-SE":h="bottom"===s?{start:this.hot._createCellCoords(t.row,i.col),end:this.hot._createCellCoords(a.row,t.col)}:{start:this.hot._createCellCoords(i.row,t.col),end:this.hot._createCellCoords(t.row,o.col)};break;case"SW-NE":h="top"===s?{start:this.hot._createCellCoords(e.highlight.row,t.col),end:this.hot._createCellCoords(t.row,o.col)}:{start:this.hot._createCellCoords(t.row,i.col),end:this.hot._createCellCoords(i.row,t.col)};break;case"SE-NW":"bottom"===s?h={start:this.hot._createCellCoords(t.row,l.col),end:this.hot._createCellCoords(i.row,t.col)}:"top"===s&&(h={start:a,end:t})}break;case"SE-NW":switch(n){case"NW-SE":case"NE-SW":case"SW-NE":"top"===s&&(h.end=t);break;case"SE-NW":"top"===s?h.end=t:h={start:t,
passed as an array of arrays e.q. [['A1', { label: 'A2', colspan: 2 }]]`),this.addHook("init",(()=>E(N,this,Y).call(this))),this.addHook("afterLoadData",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,j).call(e,...r)})),this.addHook("beforeOnCellMouseDown",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,I).call(e,...r)})),this.addHook("afterOnCellMouseDown",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,x).call(e,...r)})),this.addHook("beforeOnCellMouseOver",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,P).call(e,...r)})),this.addHook("beforeOnCellMouseUp",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,L).call(e,...r)})),this.addHook("beforeSelectionHighlightSet",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,D).call(e,...r)})),this.addHook("modifyTransformStart",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,k).call(e,...r)})),this.addHook("afterSelection",(()=>E(N,this,_).call(this))),this.addHook("afterSelectionFocusSet",(()=>E(N,this,_).call(this))),this.addHook("beforeViewportScrollHorizontally",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,b).call(e,...r)})),this.addHook("afterGetColumnHeaderRenderers",(e=>E(N,this,F).call(this,e))),this.addHook("modifyColWidth",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,V).call(e,...r)})),this.addHook("modifyColumnHeaderValue",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,B).call(e,...r)})),this.addHook("beforeHighlightingColumnHeader",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,A).call(e,...r)})),this.addHook("beforeCopy",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,O).call(e,...r)})),this.addHook("beforeSelectColumns",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,H).call(e,...r)})),this.addHook("afterViewportColumnCalculatorOverride",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,U).call(e,...r)})),this.addHook("modifyFocusedElement",(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(N,e,W).call(e,...r)})),this.hot.columnIndexMapper.addLocalHook("cacheUpdated",(()=>E(N,this,_).call(this))),this.hot.rowIndexMapper.addLocalHook("cacheUpdated",(()=>E(N,this,_).call(this))),super.enablePlugin(),this.updatePlugin()}updatePlugin(){if(!this.hot.view)return;const{nestedHeaders:e}=this.hot.getSettings();y(v,this).setColumnsLimit(this.hot.countCols()),Array.isArray(e)&&(this.detectedOverlappedHeaders=y(v,this).setState(e)),this.detectedOverlappedHeaders&&(0,h.warn)(a.toSingleLine`Your Nested Headers plugin setup contains overlapping headers. This kind of configuration\x20
is currently not supported.`),this.enabled&&this.hot.columnIndexMapper.hidingMapsCollection.getMergedValues().forEach(((e,t)=>{const r=!0===e?"hide-column":"show-column";y(v,this).triggerColumnModification(r,t)})),!y(R,this)&&this.enabled&&m(R,this,this.hot.columnIndexMapper.createChangesObserver("hiding").subscribe((e=>{e.forEach((e=>{let{op:t,index:r,newValue:n}=e;if("replace"===t){const e=!0===n?"hide-column":"show-column";y(v,this).triggerColumnModification(e,r)}})),this.ghostTable.buildWidthsMap()}))),this.ghostTable.setLayersCount(this.getLayersCount()).buildWidthsMap(),super.updatePlugin()}disablePlugin(){this.clearColspans(),y(v,this).clear(),y(R,this).unsubscribe(),m(R,this,null),this.ghostTable.clear(),super.disablePlugin()}getStateManager(){return y(v,this)}getLayersCount(){return y(v,this).getLayersCount()}getHeaderSettings(e,t){return y(v,this).getHeaderSettings(e,t)}clearColspans(){if(!this.hot.view)return;const{_wt:e}=this.hot.view,t=e.getSetting("columnHeaders").length,r=e.wtTable.THEAD,n=e.wtOverlays.topOverlay.clone.wtTable.THEAD,s=e.wtOverlays.topInlineStartCornerOverlay?e.wtOverlays.topInlineStartCornerOverlay.clone.wtTable.THEAD:null;for(let e=0;e<t;e++){const t=r.childNodes[e];if(!t)break;const o=n.childNodes[e],a=s?s.childNodes[e]:null;for(let e=0,r=t.childNodes.length;e<r;e++)t.childNodes[e].removeAttribute("colspan"),(0,i.removeClass)(t.childNodes[e],"hiddenHeader"),o&&o.childNodes[e]&&(o.childNodes[e].removeAttribute("colspan"),(0,i.removeClass)(o.childNodes[e],"hiddenHeader")),s&&a&&a.childNodes[e]&&(a.childNodes[e].removeAttribute("colspan"),(0,i.removeClass)(a.childNodes[e],"hiddenHeader"))}}headerRendererFactory(e){var t=this;const r=this.hot.view._wt.getSetting("fixedColumnsStart");return(n,s)=>{var o;const{columnIndexMapper:a,view:l}=this.hot;let h=a.getVisualFromRenderableIndex(n);null===h&&(h=n),s.removeAttribute("colspan"),(0,i.removeClass)(s,"hiddenHeader");const{colspan:u,isHidden:c,isPlaceholder:d,headerClassNames:p}=null!==(o=y(v,this).getHeaderSettings(e,h))&&void 0!==o?o:{label:""};if(d||c)(0,i.addClass)(s,"hiddenHeader");else if(u>1){var g,f;const{wtOverlays:e}=l._wt,t=null===(g=e.topInlineStartCornerOverlay)||void 0===g?void 0:g.clone.wtTable.THEAD.contains(s),i=null===(f=e.inlineStartOverlay)||void 0===f?void 0:f.clone.wtTable.THEAD.contains(s),o=t||i?Math.min(u,r-n):u;o>1&&s.setAttribute("colspan",o)}if(this.hot.view.appendColHeader(h,s,(function(){return t.getColumnHeaderValue(...arguments)}),e),!d&&!c){const e=s.querySelector("div.relative");e&&p&&p.length>0&&((0,i.removeClass)(e,this.hot.getColumnMeta(h).headerClassName),(0,i.addClass)(e,p))}}}getColumnHeaderValue(e,t){var r;const{isHidden:n,isPlaceholder:s}=null!==(r=y(v,this).getHeaderSettings(t,e))&&void 0!==r?r:{};return s||n?"":this.hot.getColHeader(e,t)}destroy(){m(v,this,null),null!==y(R,this)&&(y(R,this).unsubscribe(),m(R,this,null)),super.destroy()}_getHeaderTreeNodeDataByCoords(e){if(!(e.row>=0||e.col<0))return y(v,this).getHeaderTreeNodeData(e.row,e.col)}}function _(){var e;const t=null===(e=this.hot)||void 0===e?void 0:e.getSelectedRangeLast();if(!t)return;const{highlight:r}=t;if(r.isHeader()&&r.col>=0){const e=y(v,this).findLeftMostColumnIndex(r.row,r.col),t=this.hot.selection.highlight.getFocus();t.visualCellRange.highlight.col=e,t.visualCellRange.from.col=e,t.visualCellRange.to.col=e,t.commit()}}function b(e){const t=this.hot.getSelectedRangeLast();if(!t)return e;const{highlight:r}=t;if(!(r.isHeader()&&r.col>=0))return e;const n=this.hot.view.getFirstFullyVisibleColumn(),s=this.hot.view.getLastFullyVisibleColumn(),i=y(v,this).findLeftMostColumnIndex(r.row,r.col),o=y(v,this).findRightMostColumnIndex(r.row,r.col);return i<n&&o>s?e:i<n?i:o}function A(e,t,r){const n=y(v,this).getHeaderTreeNodeData(t,e);if(!n)return e;const{columnCursor:s,selectionType:i,selectionWidth:o}=r,{isRoot:a,colspan:l}=y(v,this).getHeaderSettings(t,e);if(i===u.HEADER_TYPE){if(!a)return n.columnIndex}else if(i===u.ACTIVE_HEADER_TYPE&&(l>o-s||!a))return null;return e}function O(e,t,r){let{columnHeadersCount:n}=r;if(
the last node, the hide column modification can be applied.`);const{crossHiddenColumns:r}=e.data;if(r.includes(t))return;let s=!1;if(e.walkUp((e=>{const{data:{collapsible:t}}=e;if(t)return s=!0,!1})),s)return;e.walkUp((e=>{const{data:r}=e;r.crossHiddenColumns.push(t),r.colspan>1?r.colspan-=1:r.isHidden=!0}))},r(67834),r(15724);var n=r(12556)},67250:(e,t,r)=>{"use strict";t.__esModule=!0,t.triggerNodeModification=function(e,t,r){if(!a.has(e))throw new Error(`The node modifier action ("${e}") does not exist.`);return a.get(e)(t,r)},r(67834);var n=r(84084),s=r(55048),i=r(57130),o=r(90651);const a=new Map([["collapse",n.collapseNode],["expand",s.expandNode],["hide-column",i.hideColumn],["show-column",o.showColumn]])},90651:(e,t,r)=>{"use strict";t.__esModule=!0,t.showColumn=function(e,t){if(!Number.isInteger(t))throw new Error("The passed gridColumnIndex argument has invalid type.");if(e.childs.length>0)throw new Error(n.toSingleLine`The passed node is not the last node on the tree. Only for\x20
the last node, the show column modification can be applied.`);const{crossHiddenColumns:r}=e.data;if(!r.includes(t))return;let s=!1;if(e.walkUp((e=>{const{data:{collapsible:t}}=e;if(t)return s=!0,!1})),s)return;e.walkUp((e=>{const{data:r}=e;r.crossHiddenColumns.splice(r.crossHiddenColumns.indexOf(t),1),!r.isHidden&&r.colspan<r.origColspan&&(r.colspan+=1),r.isHidden=!1}))},r(67834);var n=r(12556)},59122:(e,t)=>{"use strict";function r(e,t){let{childs:r}=e;if(0!==r.length)return r[0].data[t]}t.__esModule=!0,t.getFirstChildProperty=r,t.isNodeReflectsFirstChildColspan=function(e){return r(e,"origColspan")===e.data.origColspan},t.traverseHiddenNodeColumnIndexes=function(e,t){e.walkDown((e=>{let{data:r,childs:n}=e;if(!r.isHidden&&(t(r.columnIndex),0===n.length))for(let e=1;e<r.colspan;e++)t(r.columnIndex+e)}))}},16849:(e,t,r)=>{"use strict";t.__esModule=!0,t.normalizeSettings=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;const r=[];if(0===t)return r;(0,n.arrayEach)(e,(e=>{const a=[];let l=0;r.push(a),(0,n.arrayEach)(e,(e=>{const r=(0,o.createDefaultHeaderSettings)();if((0,s.isObject)(e)){const{label:t,colspan:n,headerClassName:s}=e;r.label=(0,i.stringify)(t),"number"==typeof n&&n>1&&(r.colspan=n,r.origColspan=n),"string"==typeof s&&(r.headerClassNames=[...s.split(" ")])}else r.label=(0,i.stringify)(e);l+=r.origColspan;let n=!1;if(l>=t&&(r.colspan=r.origColspan-(l-t),r.origColspan=r.colspan,n=!0),a.push(r),r.colspan>1)for(let e=0;e<r.colspan-1;e++)a.push((0,o.createPlaceholderHeaderSettings)());return!n}))}));const a=Math.max(...(0,n.arrayMap)(r,(e=>e.length)));return(0,n.arrayEach)(r,(e=>{if(e.length<a){const t=(0,n.arrayMap)(new Array(a-e.length),(()=>(0,o.createDefaultHeaderSettings)()));e.splice(e.length,0,...t)}})),r},r(15724);var n=r(98758),s=r(58460),i=r(67508),o=r(96458)},62883:(e,t,r)=>{"use strict";t.__esModule=!0,r(67834),r(15724);var n=r(58460),s=r(98758),i=r(16849);function o(e,t,r){(function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}function a(e,t){return e.get(h(e,t))}function l(e,t,r){return e.set(h(e,t),r),r}function h(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}const u=t.HEADER_CONFIGURABLE_PROPS=["label","collapsible"];var c=new WeakMap,d=new WeakMap,p=new WeakMap;t.default=class{constructor(){o(this,c,[]),o(this,d,0),o(this,p,1/0)}setColumnsLimit(e){l(p,this,e)}setData(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l(c,this,(0,i.normalizeSettings)(e,a(p,this))),l(d,this,a(c,this).length)}getData(){return a(c,this)}mergeWith(e){(0,s.arrayEach)(e,(e=>{let{row:t,col:r,...s}=e;const i=this.getHeaderSettings(t,r);null!==i&&(0,n.extend)(i,s,u)}))}map(e){(0,s.arrayEach)(a(c,this),(t=>{(0,s.arrayEach)(t,(t=>{const r=e({...t});(0,n.isObject)(r)&&(0,n.extend)(t,r,u)}))}))}getHeaderSettings(e,t){var r;if(e>=a(d,this)||e<0)return null;const n=a(c,this)[e];return!1===Array.isArray(n)||t>=n.length?null:null!==(r=n[t])&&void 0!==r?r:null}getHeadersSettings(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const n=[];if(e>=a(d,this)||e<0)return n;const s=a(c,this)[e];let i=0;for(let e=t;e<s.length;e++){const t=s[e];if(t.isPlaceholder)throw new Error("The first column settings cannot overlap the other header layers");if(i+=t.colspan,n.push(t),t.colspan>1&&(e+=t.colspan-1),i===r)break;if(i>r)throw new Error("The last column settings cannot overlap the other header layers")}return n}getLayersCount(){return a(d,this)}getColumnsCount(){return a(d,this)>0?a(c,this)[0].length:0}clear(){l(c,this,[]),l(d,this,0)}}},96458:(e,t)=>{"use strict";t.__esModule=!0,t.createDefaultHeaderSettings=function(){let{label:e="",colspan:t=1,origColspan:r=1,collapsible:n=!1,crossHiddenColumns:s=[],isCollapsed:i=!1,isHidden:o=!1,isRoot:a=!1,isPlaceholder:l=!1,headerClassNames:h=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{label:e,colspan:t,origColspan:r,collapsible:n,isCollapsed:i,cro
when the NestedRows plugin is enabled. Please use the 'dragRows' method instead.`),this.hot.runHooks("afterRowMove",t,r,n,s,!1),l=!0),l}shouldAllowMoving(e,t){return!(this.dataManager.isParent(e)||this.dataManager.isRowHighestLevel(e)||e===t||0===t)}getBaseParent(e){return this.dataManager.getRowParent(e[0])}getTargetParent(e,t){let r=this.dataManager.getRowParent(e?t-1:t);return null==r&&(r=this.dataManager.getRowParent(t-1)),r}shiftCollapsibleParentsLocations(e,t,r){r||(Math.max(...e)<=t?this.collapsingUI.collapsedRowsStash.shiftStash(e[0],t,-1*e.length):this.collapsingUI.collapsedRowsStash.shiftStash(t,e[0],e.length))}moveRows(e,t,r){const n=t===this.dataManager.getRowIndex(r)+this.dataManager.countChildren(r)+1;this.hot.batchRender((()=>{e.forEach((e=>{this.dataManager.moveRow(e,t,this.movedToCollapsed,n)}))}))}moveCellsMeta(e,t){const r=[],n=Math.max(...e)<t;e.forEach((e=>{r.push(this.hot.getCellMetaAtRow(e))})),this.hot.spliceCellsMeta(e[0],e.length),this.hot.spliceCellsMeta(t-(n?r.length:0),0,...r)}selectCells(e,t){const r=e.length;let n=0,s=0,i=null,o=null;if(this.movedToCollapsed){let i=null;i=e[r-1]<t?this.dataManager.translateTrimmedRow(t-r):this.dataManager.translateTrimmedRow(t);const o=this.dataManager.getRowParent(null===i?this.hot.countSourceRows()-1:i-1),a=this.dataManager.getRowIndex(o);n=this.dataManager.untranslateTrimmedRow(a),s=n}else e[r-1]<t?(s=t-1,n=s-r+1):(n=t,s=n+r-1);i=this.hot.selection,o=this.hot.countCols()-1,i.setRangeStart(this.hot._createCellCoords(n,0)),i.setRangeEnd(this.hot._createCellCoords(s,o),!0)}isRowOrderChanged(e,t){return e.some(((e,r)=>e-r!==t))}}},10235:(e,t,r)=>{"use strict";t.__esModule=!0;var n=r(65057);t.PLUGIN_KEY=n.PLUGIN_KEY,t.PLUGIN_PRIORITY=n.PLUGIN_PRIORITY,t.PersistentState=n.PersistentState},65057:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0;var s=n(r(85707)),i=r(55006),o=n(r(8266)),a=n(r(37056));a.default.getSingleton().register("persistentStateSave"),a.default.getSingleton().register("persistentStateLoad"),a.default.getSingleton().register("persistentStateReset");const l=t.PLUGIN_KEY="persistentState",h=t.PLUGIN_PRIORITY=0;class u extends i.BasePlugin{constructor(){super(...arguments),(0,s.default)(this,"storage",void 0)}static get PLUGIN_KEY(){return l}static get PLUGIN_PRIORITY(){return h}isEnabled(){return!!this.hot.getSettings()[l]}enablePlugin(){this.enabled||(this.storage||(this.storage=new o.default(this.hot.rootElement.id,this.hot.rootWindow)),this.addHook("persistentStateSave",((e,t)=>this.saveValue(e,t))),this.addHook("persistentStateLoad",((e,t)=>this.loadValue(e,t))),this.addHook("persistentStateReset",(()=>this.resetValue())),super.enablePlugin())}disablePlugin(){this.storage=void 0,super.disablePlugin()}updatePlugin(){this.disablePlugin(),this.enablePlugin(),super.updatePlugin()}loadValue(e,t){t.value=this.storage.loadValue(e)}saveValue(e,t){this.storage.saveValue(e,t)}resetValue(e){void 0===e?this.storage.resetAll():this.storage.reset(e)}destroy(){super.destroy()}}t.PersistentState=u},8266:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(15724),r(66184);var s=n(r(85707)),i=r(98758);t.default=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;(0,s.default)(this,"rootWindow",void 0),(0,s.default)(this,"prefix",void 0),(0,s.default)(this,"savedKeys",[]),this.rootWindow=t,this.prefix=e,this.loadSavedKeys()}saveValue(e,t){this.rootWindow.localStorage.setItem(`${this.prefix}_${e}`,JSON.stringify(t)),-1===this.savedKeys.indexOf(e)&&(this.savedKeys.push(e),this.saveSavedKeys())}loadValue(e,t){const r=void 0===e?t:e,n=this.rootWindow.localStorage.getItem(`${this.prefix}_${r}`);return null===n?void 0:JSON.parse(n)}reset(e){this.rootWindow.localStorage.removeItem(`${this.prefix}_${e}`)}resetAll(){(0,i.arrayEach)(this.savedKeys,((e,t)=>{this.rootWindow.localStorage.removeItem(`${this.prefix}_${this.savedKeys[t]}`)})),this.clearSavedKeys()}loadSavedKeys(){const e=this.rootWindow.localStorage.getItem(`${this.prefix}__persistentStateKeys`),t="string"==typeof e?JSON.parse(e):void 0;this.savedKeys=t||[]
the coordinates as an array of arrays ([[rowStart, columnStart/columnPropStart, rowEnd,\x20
columnEnd/columnPropEnd]]) or as an array of CellRange objects.`);const n=(0,p.normalizeSelectionFactory)(r,{createCellCoords:function(){return t.tableProps.createCellCoords(...arguments)},createCellRange:function(){return t.tableProps.createCellRange(...arguments)},propToCol:e=>this.tableProps.propToCol(e),keepDirection:!0}),s=this.settings.navigableHeaders,i={countRows:this.tableProps.countRows(),countCols:this.tableProps.countCols(),countRowHeaders:s?this.tableProps.countRowHeaders():0,countColHeaders:s?this.tableProps.countColHeaders():0},o=!e.some((e=>{const t=n(e),r=t.isValid(i);return!(r&&!t.containsHeaders()||r&&t.containsHeaders()&&t.isSingleHeader())}));return o&&(this.clear(),this.setExpectedLayers(e.length),(0,u.arrayEach)(e,(e=>{const{from:t,to:r}=n(e);this.setRangeStartOnly(t.clone(),!1),this.setRangeEnd(r.clone())})),this.finish()),o}selectColumns(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n="string"==typeof e?this.tableProps.propToCol(e):e,s="string"==typeof t?this.tableProps.propToCol(t):t,i=this.tableProps.countRows(),o=this.tableProps.countCols(),a=this.tableProps.countColHeaders(),l=0===a?0:-a,u=this.tableProps.createCellCoords(l,n),c=this.tableProps.createCellCoords(i-1,s),d=this.tableProps.createCellRange(u,u,c).isValid({countRows:i,countCols:o,countRowHeaders:0,countColHeaders:a});if(d){let e=0,t=0;Number.isInteger(null==r?void 0:r.row)&&Number.isInteger(null==r?void 0:r.col)?(e=(0,h.clamp)(r.row,l,i-1),t=(0,h.clamp)(r.col,Math.min(n,s),Math.max(n,s))):(e=(0,h.clamp)(r,l,i-1),t=n);const o=this.tableProps.createCellCoords(e,t),u=0===a?0:(0,h.clamp)(o.row,l,-1),c=i-1,d=this.tableProps.createCellCoords(u,n),p=this.tableProps.createCellCoords(c,s);this.runLocalHooks("beforeSelectColumns",d,p,o),d.row=u,p.row=c,this.setRangeStartOnly(d,void 0,o),this.selectedByColumnHeader.add(this.getLayerLevel()),this.setRangeEnd(p),this.runLocalHooks("afterSelectColumns",d,p,o),this.finish()}return d}selectRows(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.tableProps.countRows(),s=this.tableProps.countCols(),i=this.tableProps.countRowHeaders(),o=0===i?0:-i,a=this.tableProps.createCellCoords(e,o),l=this.tableProps.createCellCoords(t,s-1),u=this.tableProps.createCellRange(a,a,l).isValid({countRows:n,countCols:s,countRowHeaders:i,countColHeaders:0});if(u){let n=0,a=0;Number.isInteger(null==r?void 0:r.row)&&Number.isInteger(null==r?void 0:r.col)?(n=(0,h.clamp)(r.row,Math.min(e,t),Math.max(e,t)),a=(0,h.clamp)(r.col,o,s-1)):(n=e,a=(0,h.clamp)(r,o,s-1));const l=this.tableProps.createCellCoords(n,a),u=0===i?0:(0,h.clamp)(l.col,o,-1),c=s-1,d=this.tableProps.createCellCoords(e,u),p=this.tableProps.createCellCoords(t,c);this.runLocalHooks("beforeSelectRows",d,p,l),d.col=u,p.col=c,this.setRangeStartOnly(d,void 0,l),this.selectedByRowHeader.add(this.getLayerLevel()),this.setRangeEnd(p),this.runLocalHooks("afterSelectRows",d,p,l),this.finish()}return u}refresh(){if(!this.isSelected())return;const e=this.tableProps.countRows(),t=this.tableProps.countCols();if(0===e||0===t)return void this.deselect();const r=this.selectedRange.peekByIndex(this.selectedRange.size()-1),{from:n,to:s,highlight:i}=r;this.clear(),i.assign({row:(0,h.clamp)(i.row,-1/0,e-1),col:(0,h.clamp)(i.col,-1/0,t-1)}),n.assign({row:(0,h.clamp)(n.row,-1/0,e-1),col:(0,h.clamp)(n.col,-1/0,t-1)}),s.assign({row:(0,h.clamp)(s.row,0,e-1),col:(0,h.clamp)(s.col,0,t-1)}),this.selectedRange.ranges.push(r),this.highlight.getFocus().add(i).commit().syncWith(r),this.applyAndCommit(r)}commit(){if(this.highlight.getCustomSelections().forEach((e=>{e.commit()})),!this.isSelected())return;const e=this.highlight.getFocus(),t=this.getLayerLevel();e.commit().syncWith(this.selectedRange.current());for(let e=0;e<this.selectedRange.size();e+=1){this.highlight.useLayerLevel(e);const t=this.highlight.createArea(),r=this.highlight.createLayeredArea(),n=this.highlight.createRowHeader(),s=this.highlight.createCol
using the KeyboardEvent.key properties:\x20
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.`);const m={callback:r,group:n,runOnlyIf:a,captureCtrl:h,preventDefault:c,stopPropagation:d};(0,i.isDefined)(p)&&(m.relativeToGroup=p,m.position=g),u(f)&&(m.forwardToContext=f),e.forEach((e=>{const r=(0,s.normalizeKeys)(e);if(t.hasItem(r)){const e=t.getItem(r);let n=e.findIndex((e=>e.group===p));-1!==n?"before"===g?n-=1:n+=1:n=e.length,e.splice(n,0,m)}else t.addItem(r,[m])}))},c=e=>{const r=(0,s.normalizeKeys)(e);t.removeItem(r)};return{__kindOf:h,addShortcut:r,addShortcuts:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.forEach((e=>{(0,a.objectEach)(t,((r,n)=>{!1===Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=t[n])})),r(e)}))},getShortcuts:e=>{const r=(0,s.normalizeKeys)(e),n=t.getItem(r);return(0,i.isDefined)(n)?n.slice():[]},hasShortcut:e=>{const r=(0,s.normalizeKeys)(e);return t.hasItem(r)},removeShortcutsByKeys:c,removeShortcutsByGroup:e=>{t.getItems().forEach((t=>{let[r,n]=t;const i=n.filter((t=>t.group!==e));0===i.length?c((0,s.getKeysList)(r)):(n.length=0,n.push(...i))}))}}}},5061:(e,t,r)=>{"use strict";t.__esModule=!0;var n=r(47974);t.createShortcutManager=n.createShortcutManager},82452:(e,t,r)=>{"use strict";t.__esModule=!0,t.createKeysObserver=function(){const e=new Set;return{press(t){e.add(t)},release(t){e.delete(t)},releaseAll(){e.clear()},isPressed:t=>e.has(t)}},r(36241),r(85151),r(49122),r(75183),r(40520),r(32495),r(72371)},47974:(e,t,r)=>{"use strict";t.__esModule=!0,r(67834);var n=r(22781),s=r(24456),i=r(41970),o=r(61335),a=r(12556);t.createShortcutManager=e=>{let{ownerWindow:t,handleEvent:r,beforeKeyDown:l,afterKeyDown:h}=e;const u=(0,n.createUniqueMap)({errorIdExists:e=>`The "${e}" context name is already registered.`});let c="grid";const d=()=>c,p=e=>u.getItem(e);let g=!1;const f=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d();const n=(0,i.isContextObject)(r)?r:p(r);let o=!1;if(!n.hasShortcut(t))return o;const a=n.getShortcuts(t);for(let r=0;r<a.length;r++){const{callback:n,runOnlyIf:i,preventDefault:l,stopPropagation:h,captureCtrl:u,forwardToContext:c}=a[r];if(!0===i(e)){if(g=u,o=!1===n(e,t),g=!1,l&&e.preventDefault(),h&&((0,s.stopImmediatePropagation)(e),e.stopPropagation()),o)break;c&&f(e,t,c)}}return o},m=(0,o.useRecorder)(t,r,l,h,f);return m.mount(),{addContext:e=>{const t=(0,i.createContext)(e);return u.addItem(e,t),t},getActiveContextName:d,getContext:p,setActiveContextName:e=>{if(!u.hasItem(e))throw new Error(a.toSingleLine`You've tried to activate the "${e}" shortcut context\x20
that does not exist. Before activation, register the context using the "addContext" method.`);c=e},isCtrlPressed:()=>!g&&(m.isPressed("control")||m.isPressed("meta")),releasePressedKeys:()=>m.releasePressedKeys(),destroy:()=>m.unmount()}}},61335:(e,t,r)=>{"use strict";t.__esModule=!0,t.useRecorder=function(e,t,r,n,d){const p=e=>l.includes(e),g=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=[];return e.altKey&&r.push("alt"),t&&(e.ctrlKey||e.metaKey)?r.push("control/meta"):(e.ctrlKey&&r.push("control"),e.metaKey&&r.push("meta")),e.shiftKey&&r.push("shift"),r},f=e=>{if(!1===t(e))return;const o=r(e);if(229===e.keyCode||!1===o||(0,i.isImmediatePropagationStopped)(e))return;const l=(0,s.normalizeEventKey)(e);let h=[];p(l)||(h=g(e));const u=[l].concat(h);!d(e,u)&&((0,a.isMacOS)()&&h.includes("meta")||!(0,a.isMacOS)()&&h.includes("control"))&&d(e,[l].concat(g(e,!0))),n(e)},m=e=>{if(e.key){const t=(0,s.normalizeEventKey)(e);p(t)&&h.press(t)}},y=e=>{if(e.key){const t=(0,s.normalizeEventKey)(e);p(t)&&h.release(t)}},E=()=>{h.releaseAll()};return{mount:()=>{let t=e;for(c+=1;t;)1===c&&(t.document.documentElement.addEventListener("keydown",m),u.push({event:"keydown",listener:m}),t.document.documentElement.addEventListener("keyup",y),u.push({event:"keyup",listener:y})),t.document.documentElement.addEventListener("keydown",f),t.document.documentElement.addEventListener("blur",E),t=(0,o.getParentWindow)(t)},unmount:()=>{let t=e;for(c-=1;t;){if(0===c){for(let e=0;e<u.length;e++){const{event:r,listener:n}=u[e];t.document.documentElement.removeEventListener(r,n)}u.length=0}t.document.documentElement.removeEventListener("keydown",f),t.document.documentElement.removeEventListener("blur",E),t=(0,o.getParentWindow)(t)}},isPressed:e=>h.isPressed(e),releasePressedKeys:()=>h.releaseAll()}},r(15724);var n=r(82452),s=r(12e3),i=r(24456),o=r(49536),a=r(1479);const l=["meta","alt","shift","control"],h=(0,n.createKeysObserver)(),u=[];let c=0},12e3:(e,t)=>{"use strict";t.__esModule=!0;const r=new Map([[" ","space"],["spacebar","space"],["scroll","scrolllock"],["del","delete"],["esc","escape"],["medianexttrack","mediatracknext"],["mediaprevioustrack","mediatrackprevious"],["volumeup","audiovolumeup"],["volumedown","audiovolumedown"],["volumemute","audiovolumemute"],["multiply","*"],["add","+"],["divide","/"],["subtract","-"],["left","arrowleft"],["right","arrowright"],["up","arrowup"],["down","arrowdown"]]);t.normalizeKeys=e=>e.map((e=>{const t=e.toLowerCase();return r.has(t)?r.get(t):t})).sort().join("+");t.getKeysList=e=>e.split("+");const n=new Map([[186,"semicolon"],[187,"equal"],[188,"comma"],[189,"minus"],[190,"period"],[191,"slash"],[192,"backquote"],[219,"bracketleft"],[220,"backslash"],[221,"bracketright"],[222,"quote"]]);t.normalizeEventKey=e=>{let{which:t,key:r}=e;if(n.has(t))return n.get(t);const s=String.fromCharCode(t).toLowerCase();return/^[a-z0-9]$/.test(s)?s:r.toLowerCase()}},81212:(e,t,r)=>{"use strict";var n=r(96784);t.__esModule=!0,r(67834),r(15724);var s=n(r(85707)),i=r(49536),o=n(r(63286)),a=r(24456),l=n(r(6697)),h=r(32251),u=r(26048),c=r(81595);function d(e,t,r){p(e,t),t.set(e,r)}function p(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g(e,t){return e.get(m(e,t))}function f(e,t,r){return e.set(m(e,t),r),r}function m(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}var y=new WeakMap,E=new WeakMap,w=new WeakMap,C=new WeakMap,v=new WeakMap,R=new WeakMap,S=new WeakMap,T=new WeakSet;function N(){return parseInt(this.hot.rootElement.getAttribute((0,c.A11Y_COLCOUNT)()[0]),10)}function M(e){const t=m(T,this,N).call(this)+e;(0,i.setAttribute)(this.hot.rootElement,...(0,c.A11Y_COLCOUNT)(t))}t.default=class{constructor(e){var t,r;p(t=this,r=T),r.add(t),(0,s.default)(this,"hot",void 0),(0,s.default)(this,"eventManager",void 0),(0,s.default)(this,"settings",void 0),(0,s.default)(this,"THEAD",void 0),(0,s.default)(this,"TBODY",void 0),(0,s.defau
/*!
* Pikaday
*
* Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday
*/const t=()=>window,r=()=>window.document,n=(e,t)=>window.setTimeout(e,t),s=function(e,t,r,n){e.addEventListener(t,r,!!n)},i=function(e,t,r,n){e.removeEventListener(t,r,!!n)},o=function(e,t){return-1!==(" "+e.className+" ").indexOf(" "+t+" ")},a=function(e,t){o(e,t)||(e.className=""===e.className?t:e.className+" "+t)},l=function(e,t){var r;e.className=(r=(" "+e.className+" ").replace(" "+t+" "," ")).trim?r.trim():r.replace(/^\s+|\s+$/g,"")},h=function(e){return/Array/.test(Object.prototype.toString.call(e))},u=function(e){return/Date/.test(Object.prototype.toString.call(e))&&!isNaN(e.getTime())},c=function(e){let t=e.getDay();return 0===t||6===t},d=function(e){return e%4==0&&e%100!=0||e%400==0},p=function(e,t){return[31,d(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},g=function(e){u(e)&&e.setHours(0,0,0,0)},f=function(e,t){return e.getTime()===t.getTime()},m=function(e,t,r){let n,s;for(n in t)s=void 0!==e[n],s&&"object"==typeof t[n]&&null!==t[n]&&void 0===t[n].nodeName?u(t[n])?r&&(e[n]=new Date(t[n].getTime())):h(t[n])?r&&(e[n]=t[n].slice(0)):e[n]=m({},t[n],r):!r&&s||(e[n]=t[n]);return e},y=function(e,t,n){let s=r().createEvent("HTMLEvents");s.initEvent(t,!0,!1),s=m(s,n),e.dispatchEvent(s)},E=function(e){return e.month<0&&(e.year-=Math.ceil(Math.abs(e.month)/12),e.month+=12),e.month>11&&(e.year+=Math.floor(Math.abs(e.month)/12),e.month-=12),e},w={field:null,bound:void 0,ariaLabel:"Use the arrow keys to pick a date",position:"bottom left",reposition:!0,format:"YYYY-MM-DD",toString:null,parse:null,defaultDate:null,setDefaultDate:!1,firstDay:0,firstWeekOfYearMinDays:4,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,pickWholeWeek:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,enableSelectionDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,blurFieldOnSelect:!0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},theme:null,events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null,keyboardInput:!0},C=function(e,t,r){for(t+=e.firstDay;t>=7;)t-=7;return r?e.i18n.weekdaysShort[t]:e.i18n.weekdays[t]},v=function(e){let t=[],r="false";if(e.isEmpty){if(!e.showDaysInNextAndPreviousMonths)return'<td class="is-empty"></td>';t.push("is-outside-current-month"),e.enableSelectionDaysInNextAndPreviousMonths||t.push("is-selection-disabled")}return e.isDisabled&&t.push("is-disabled"),e.isToday&&t.push("is-today"),e.isSelected&&(t.push("is-selected"),r="true"),e.hasEvent&&t.push("has-event"),e.isInRange&&t.push("is-inrange"),e.isStartRange&&t.push("is-startrange"),e.isEndRange&&t.push("is-endrange"),'<td data-day="'+e.day+'" class="'+t.join(" ")+'" aria-selected="'+r+'"><button class="pika-button pika-day" type="button" data-pika-year="'+e.year+'" data-pika-month="'+e.month+'" data-pika-day="'+e.day+'">'+e.day+"</button></td>"},R=function(e,t,r,n,s){let i=new Date(n,r,t),o=e.hasMoment?e.moment(i).isoWeek():function(e,t){e.setHours(0,0,0,0);let r=e.getDate(),n=e.getDay(),s=t,i=s-1,o=function(e){return(e+7-1)%7};e.setDate(r+i-o(n));let a=new Date(e.getFullYear(),0,s),l=(e.getTime()-a.getTime())/864e5;return 1+Math.round((l-i+o(a.getDay()))/7)}(i,s);return'<td class="pika-week">'+o+"</td>"},S=function(e,t,r,n){return'<tr class="pika-row'+(r?" pick-whole-week":"")+(n?" is-selected":"")+'">'+(t?e.reverse():e).join("")+"</tr>"},T=function(e,t,r,n,s,i){let o,a,l,u,c,d=e._o,p=r===d.minYear,g=r===d.maxYear,f='<div id="'+i+'" class="pika-title" role="heading" aria-live="polite">',m=!0,y=!0;for(l=[],o=0;o<12;o++)l.push('<option value="'+(r===s?o-t:12+o-t)+'"'+(o===n?' selected="selected"':"")+(p&&o<d.minMonth||g&&o>d.maxMonth?' disabled="disabled"':"")+">"+d.i18n.months[o]+"</option>");for(u='<div class="pika-l