@univerjs/engine-formula 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +2864 -981
- package/lib/types/basics/calculate.d.ts +0 -1
- package/lib/types/basics/common.d.ts +0 -1
- package/lib/types/basics/date.d.ts +4 -1
- package/lib/types/basics/dirty.d.ts +0 -1
- package/lib/types/basics/engineering.d.ts +25 -0
- package/lib/types/basics/financial.d.ts +18 -0
- package/lib/types/basics/function.d.ts +0 -1
- package/lib/types/basics/match-token.d.ts +0 -1
- package/lib/types/basics/object-class-type.d.ts +0 -1
- package/lib/types/basics/runtime.d.ts +0 -1
- package/lib/types/commands/mutations/register-function.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-array-formula-data.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-defined-name.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-feature-calculation.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-formula-calculation.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-formula-data.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-other-formula.mutation.d.ts +0 -1
- package/lib/types/commands/mutations/set-super-table.mutation.d.ts +0 -1
- package/lib/types/controller/calculate.controller.d.ts +0 -1
- package/lib/types/controller/formula.controller.d.ts +0 -1
- package/lib/types/controller/set-defined-name.controller.d.ts +0 -1
- package/lib/types/controller/set-dependency.controller.d.ts +0 -1
- package/lib/types/controller/set-feature-calculation.controller.d.ts +0 -1
- package/lib/types/controller/set-other-formula.controller.d.ts +0 -1
- package/lib/types/controller/set-super-table.controller.d.ts +0 -1
- package/lib/types/engine/analysis/__tests__/create-command-test-bed.d.ts +0 -1
- package/lib/types/engine/analysis/lexer-node.d.ts +0 -1
- package/lib/types/engine/analysis/lexer-tree-builder.d.ts +0 -1
- package/lib/types/engine/analysis/lexer.d.ts +0 -1
- package/lib/types/engine/analysis/parser.d.ts +0 -1
- package/lib/types/engine/ast-node/ast-root-node.d.ts +0 -1
- package/lib/types/engine/ast-node/base-ast-node-factory.d.ts +0 -1
- package/lib/types/engine/ast-node/base-ast-node.d.ts +0 -1
- package/lib/types/engine/ast-node/function-node.d.ts +0 -1
- package/lib/types/engine/ast-node/lambda-node.d.ts +0 -1
- package/lib/types/engine/ast-node/lambda-parameter-node.d.ts +0 -1
- package/lib/types/engine/ast-node/null-node.d.ts +0 -1
- package/lib/types/engine/ast-node/operator-node.d.ts +0 -1
- package/lib/types/engine/ast-node/prefix-node.d.ts +0 -1
- package/lib/types/engine/ast-node/reference-node.d.ts +0 -1
- package/lib/types/engine/ast-node/suffix-node.d.ts +0 -1
- package/lib/types/engine/ast-node/union-node.d.ts +0 -1
- package/lib/types/engine/ast-node/value-node.d.ts +0 -1
- package/lib/types/engine/dependency/dependency-tree.d.ts +0 -1
- package/lib/types/engine/dependency/formula-dependency.d.ts +0 -1
- package/lib/types/engine/interpreter/interpreter.d.ts +0 -1
- package/lib/types/engine/reference-object/base-reference-object.d.ts +0 -1
- package/lib/types/engine/reference-object/cell-reference-object.d.ts +0 -1
- package/lib/types/engine/reference-object/column-reference-object.d.ts +0 -1
- package/lib/types/engine/reference-object/range-reference-object.d.ts +0 -1
- package/lib/types/engine/reference-object/row-reference-object.d.ts +0 -1
- package/lib/types/engine/reference-object/table-reference-object.d.ts +0 -1
- package/lib/types/engine/utils/array-object.d.ts +0 -1
- package/lib/types/engine/utils/ast-node-tool.d.ts +0 -1
- package/lib/types/engine/utils/cell.d.ts +0 -1
- package/lib/types/engine/utils/check-variant-error.d.ts +20 -0
- package/lib/types/engine/utils/compare.d.ts +0 -1
- package/lib/types/engine/utils/function-definition.d.ts +0 -1
- package/lib/types/engine/utils/get-runtime-feature-cell.d.ts +4 -0
- package/lib/types/engine/utils/math-kit.d.ts +9 -3
- package/lib/types/engine/utils/node-type.d.ts +0 -1
- package/lib/types/engine/utils/numfmt-kit.d.ts +0 -1
- package/lib/types/engine/utils/object-compare.d.ts +0 -1
- package/lib/types/engine/utils/prefixHandler.d.ts +0 -1
- package/lib/types/engine/utils/r1c1-reference.d.ts +0 -1
- package/lib/types/engine/utils/reference.d.ts +0 -1
- package/lib/types/engine/utils/sequence.d.ts +0 -1
- package/lib/types/engine/utils/value-object.d.ts +0 -1
- package/lib/types/engine/value-object/array-value-object.d.ts +0 -1
- package/lib/types/engine/value-object/base-value-object.d.ts +0 -1
- package/lib/types/engine/value-object/cube-value-object.d.ts +0 -1
- package/lib/types/engine/value-object/lambda-value-object.d.ts +0 -1
- package/lib/types/engine/value-object/primitive-object.d.ts +0 -1
- package/lib/types/functions/__tests__/create-function-test-bed.d.ts +0 -1
- package/lib/types/functions/base-function.d.ts +0 -1
- package/lib/types/functions/compatibility/function-map.d.ts +0 -1
- package/lib/types/functions/compatibility/rank/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/rank/index.d.ts +10 -0
- package/lib/types/functions/custom-function.d.ts +0 -1
- package/lib/types/functions/date/date/index.d.ts +0 -1
- package/lib/types/functions/date/datedif/index.d.ts +0 -1
- package/lib/types/functions/date/datevalue/index.d.ts +0 -1
- package/lib/types/functions/date/day/index.d.ts +0 -1
- package/lib/types/functions/date/days/index.d.ts +0 -1
- package/lib/types/functions/date/days360/index.d.ts +0 -2
- package/lib/types/functions/date/edate/index.d.ts +0 -1
- package/lib/types/functions/date/eomonth/index.d.ts +0 -1
- package/lib/types/functions/date/function-map.d.ts +0 -1
- package/lib/types/functions/date/hour/index.d.ts +0 -1
- package/lib/types/functions/date/isoweeknum/index.d.ts +0 -1
- package/lib/types/functions/date/minute/index.d.ts +0 -1
- package/lib/types/functions/date/month/index.d.ts +0 -1
- package/lib/types/functions/date/networkdays/index.d.ts +0 -1
- package/lib/types/functions/date/networkdays-intl/index.d.ts +0 -1
- package/lib/types/functions/date/now/index.d.ts +0 -1
- package/lib/types/functions/date/second/index.d.ts +0 -1
- package/lib/types/functions/date/time/index.d.ts +0 -1
- package/lib/types/functions/date/timevalue/index.d.ts +0 -1
- package/lib/types/functions/date/today/index.d.ts +0 -1
- package/lib/types/functions/date/weekday/index.d.ts +0 -1
- package/lib/types/functions/date/weeknum/index.d.ts +0 -1
- package/lib/types/functions/date/workday/index.d.ts +0 -1
- package/lib/types/functions/date/workday-intl/index.d.ts +0 -1
- package/lib/types/functions/date/year/index.d.ts +0 -1
- package/lib/types/functions/date/yearfrac/index.d.ts +0 -5
- package/lib/types/functions/engineering/besseli/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/besseli/index.d.ts +8 -0
- package/lib/types/functions/engineering/besselj/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/besselj/index.d.ts +8 -0
- package/lib/types/functions/engineering/besselk/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/besselk/index.d.ts +8 -0
- package/lib/types/functions/engineering/bessely/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bessely/index.d.ts +8 -0
- package/lib/types/functions/engineering/bin2dec/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bin2dec/index.d.ts +8 -0
- package/lib/types/functions/engineering/bin2hex/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bin2hex/index.d.ts +8 -0
- package/lib/types/functions/engineering/bin2oct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bin2oct/index.d.ts +8 -0
- package/lib/types/functions/engineering/bitand/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bitand/index.d.ts +7 -0
- package/lib/types/functions/engineering/bitlshift/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bitlshift/index.d.ts +7 -0
- package/lib/types/functions/engineering/bitor/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bitor/index.d.ts +7 -0
- package/lib/types/functions/engineering/bitrshift/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bitrshift/index.d.ts +7 -0
- package/lib/types/functions/engineering/bitxor/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/bitxor/index.d.ts +7 -0
- package/lib/types/functions/engineering/complex/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/complex/index.d.ts +8 -0
- package/lib/types/functions/engineering/convert/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/convert/index.d.ts +20 -0
- package/lib/types/functions/engineering/dec2bin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/dec2bin/index.d.ts +8 -0
- package/lib/types/functions/engineering/dec2hex/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/dec2hex/index.d.ts +8 -0
- package/lib/types/functions/engineering/dec2oct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/dec2oct/index.d.ts +8 -0
- package/lib/types/functions/engineering/delta/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/delta/index.d.ts +8 -0
- package/lib/types/functions/engineering/erf/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/erf/index.d.ts +8 -0
- package/lib/types/functions/engineering/erf-precise/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/erf-precise/index.d.ts +8 -0
- package/lib/types/functions/engineering/erfc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/erfc/index.d.ts +8 -0
- package/lib/types/functions/engineering/erfc-precise/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/erfc-precise/index.d.ts +8 -0
- package/lib/types/functions/engineering/function-map.d.ts +4 -16
- package/lib/types/functions/engineering/hex2bin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/hex2bin/index.d.ts +8 -0
- package/lib/types/functions/engineering/hex2dec/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/hex2dec/index.d.ts +8 -0
- package/lib/types/functions/engineering/hex2oct/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/hex2oct/index.d.ts +8 -0
- package/lib/types/functions/engineering/oct2bin/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/oct2bin/index.d.ts +8 -0
- package/lib/types/functions/engineering/oct2dec/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/oct2dec/index.d.ts +8 -0
- package/lib/types/functions/engineering/oct2hex/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/engineering/oct2hex/index.d.ts +8 -0
- package/lib/types/functions/financial/accrint/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/accrint/index.d.ts +9 -0
- package/lib/types/functions/financial/accrintm/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/accrintm/index.d.ts +8 -0
- package/lib/types/functions/financial/amorlinc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/amorlinc/index.d.ts +9 -0
- package/lib/types/functions/financial/coupdaybs/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/coupdaybs/index.d.ts +8 -0
- package/lib/types/functions/financial/coupdays/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/coupdays/index.d.ts +8 -0
- package/lib/types/functions/financial/coupdaysnc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/coupdaysnc/index.d.ts +8 -0
- package/lib/types/functions/financial/coupncd/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/coupncd/index.d.ts +8 -0
- package/lib/types/functions/financial/coupnum/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/coupnum/index.d.ts +8 -0
- package/lib/types/functions/financial/couppcd/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/couppcd/index.d.ts +8 -0
- package/lib/types/functions/financial/cumipmt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/cumipmt/index.d.ts +9 -0
- package/lib/types/functions/financial/cumprinc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/cumprinc/index.d.ts +9 -0
- package/lib/types/functions/financial/db/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/db/index.d.ts +8 -0
- package/lib/types/functions/financial/ddb/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/ddb/index.d.ts +8 -0
- package/lib/types/functions/financial/disc/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/disc/index.d.ts +8 -0
- package/lib/types/functions/financial/dollarde/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/dollarde/index.d.ts +8 -0
- package/lib/types/functions/financial/dollarfr/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/dollarfr/index.d.ts +8 -0
- package/lib/types/functions/financial/effect/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/effect/index.d.ts +8 -0
- package/lib/types/functions/financial/function-map.d.ts +5 -16
- package/lib/types/functions/financial/fv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/fv/index.d.ts +7 -0
- package/lib/types/functions/financial/fvschedule/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/fvschedule/index.d.ts +8 -0
- package/lib/types/functions/financial/intrate/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/intrate/index.d.ts +8 -0
- package/lib/types/functions/financial/ipmt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/ipmt/index.d.ts +7 -0
- package/lib/types/functions/financial/ispmt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/ispmt/index.d.ts +7 -0
- package/lib/types/functions/financial/nominal/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/nominal/index.d.ts +8 -0
- package/lib/types/functions/financial/nper/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/nper/index.d.ts +7 -0
- package/lib/types/functions/financial/pmt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/pmt/index.d.ts +7 -0
- package/lib/types/functions/financial/ppmt/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/ppmt/index.d.ts +7 -0
- package/lib/types/functions/financial/pv/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/pv/index.d.ts +7 -0
- package/lib/types/functions/financial/rate/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/financial/rate/index.d.ts +8 -0
- package/lib/types/functions/information/cell/index.d.ts +0 -1
- package/lib/types/functions/information/error-type/index.d.ts +0 -1
- package/lib/types/functions/information/function-map.d.ts +0 -1
- package/lib/types/functions/information/isblank/index.d.ts +0 -1
- package/lib/types/functions/information/iserr/index.d.ts +0 -1
- package/lib/types/functions/information/iserror/index.d.ts +0 -1
- package/lib/types/functions/information/iseven/iseven.d.ts +0 -1
- package/lib/types/functions/information/islogical/index.d.ts +0 -1
- package/lib/types/functions/information/isna/index.d.ts +0 -1
- package/lib/types/functions/information/isnontext/index.d.ts +0 -1
- package/lib/types/functions/information/isnumber/index.d.ts +0 -1
- package/lib/types/functions/information/isodd/isodd.d.ts +0 -1
- package/lib/types/functions/information/isref/index.d.ts +0 -1
- package/lib/types/functions/information/istext/index.d.ts +0 -1
- package/lib/types/functions/information/type/index.d.ts +0 -1
- package/lib/types/functions/logical/and/index.d.ts +0 -1
- package/lib/types/functions/logical/false/index.d.ts +0 -1
- package/lib/types/functions/logical/function-map.d.ts +0 -1
- package/lib/types/functions/logical/if/index.d.ts +0 -1
- package/lib/types/functions/logical/iferror/index.d.ts +0 -1
- package/lib/types/functions/logical/ifna/index.d.ts +0 -1
- package/lib/types/functions/logical/ifs/index.d.ts +0 -1
- package/lib/types/functions/logical/lambda/index.d.ts +0 -1
- package/lib/types/functions/logical/let/index.d.ts +10 -0
- package/lib/types/functions/logical/makearray/index.d.ts +0 -1
- package/lib/types/functions/logical/not/index.d.ts +2 -2
- package/lib/types/functions/logical/or/index.d.ts +0 -1
- package/lib/types/functions/logical/switch/index.d.ts +0 -1
- package/lib/types/functions/logical/true/index.d.ts +0 -1
- package/lib/types/functions/logical/xor/index.d.ts +0 -1
- package/lib/types/functions/lookup/address/index.d.ts +0 -1
- package/lib/types/functions/lookup/areas/index.d.ts +0 -1
- package/lib/types/functions/lookup/choose/index.d.ts +0 -1
- package/lib/types/functions/lookup/choosecols/index.d.ts +0 -1
- package/lib/types/functions/lookup/chooserows/index.d.ts +0 -1
- package/lib/types/functions/lookup/column/index.d.ts +0 -1
- package/lib/types/functions/lookup/columns/index.d.ts +0 -1
- package/lib/types/functions/lookup/filter/index.d.ts +0 -1
- package/lib/types/functions/lookup/function-map.d.ts +0 -1
- package/lib/types/functions/lookup/hlookup/index.d.ts +0 -1
- package/lib/types/functions/lookup/hstack/index.d.ts +0 -1
- package/lib/types/functions/lookup/index/index.d.ts +0 -1
- package/lib/types/functions/lookup/indirect/index.d.ts +0 -1
- package/lib/types/functions/lookup/lookup/index.d.ts +0 -1
- package/lib/types/functions/lookup/match/index.d.ts +0 -1
- package/lib/types/functions/lookup/offset/index.d.ts +0 -1
- package/lib/types/functions/lookup/row/index.d.ts +0 -1
- package/lib/types/functions/lookup/rows/index.d.ts +0 -1
- package/lib/types/functions/lookup/sort/index.d.ts +0 -1
- package/lib/types/functions/lookup/sortby/index.d.ts +0 -1
- package/lib/types/functions/lookup/transpose/index.d.ts +0 -1
- package/lib/types/functions/lookup/unique/index.d.ts +0 -1
- package/lib/types/functions/lookup/vlookup/index.d.ts +0 -1
- package/lib/types/functions/lookup/vstack/index.d.ts +0 -1
- package/lib/types/functions/lookup/xlookup/index.d.ts +0 -1
- package/lib/types/functions/lookup/xmatch/index.d.ts +0 -1
- package/lib/types/functions/math/abs/index.d.ts +0 -1
- package/lib/types/functions/math/acos/index.d.ts +0 -1
- package/lib/types/functions/math/acosh/index.d.ts +0 -1
- package/lib/types/functions/math/acot/index.d.ts +0 -1
- package/lib/types/functions/math/acoth/index.d.ts +0 -1
- package/lib/types/functions/math/asin/index.d.ts +0 -1
- package/lib/types/functions/math/asinh/index.d.ts +0 -1
- package/lib/types/functions/math/atan/index.d.ts +0 -1
- package/lib/types/functions/math/atan2/index.d.ts +0 -1
- package/lib/types/functions/math/atanh/index.d.ts +0 -1
- package/lib/types/functions/math/base/index.d.ts +0 -1
- package/lib/types/functions/math/ceiling/index.d.ts +0 -1
- package/lib/types/functions/math/ceiling-math/index.d.ts +0 -1
- package/lib/types/functions/math/ceiling-precise/index.d.ts +0 -1
- package/lib/types/functions/math/cos/index.d.ts +0 -1
- package/lib/types/functions/math/cosh/index.d.ts +0 -1
- package/lib/types/functions/math/cot/index.d.ts +0 -1
- package/lib/types/functions/math/coth/index.d.ts +0 -1
- package/lib/types/functions/math/csc/index.d.ts +0 -1
- package/lib/types/functions/math/csch/index.d.ts +0 -1
- package/lib/types/functions/math/decimal/index.d.ts +0 -1
- package/lib/types/functions/math/degrees/index.d.ts +0 -1
- package/lib/types/functions/math/even/index.d.ts +0 -1
- package/lib/types/functions/math/exp/index.d.ts +0 -1
- package/lib/types/functions/math/floor/index.d.ts +0 -1
- package/lib/types/functions/math/floor-math/index.d.ts +0 -1
- package/lib/types/functions/math/floor-precise/index.d.ts +0 -1
- package/lib/types/functions/math/function-map.d.ts +0 -1
- package/lib/types/functions/math/ln/index.d.ts +0 -1
- package/lib/types/functions/math/log/index.d.ts +0 -1
- package/lib/types/functions/math/log10/index.d.ts +0 -1
- package/lib/types/functions/math/mod/index.d.ts +0 -1
- package/lib/types/functions/math/mround/index.d.ts +0 -1
- package/lib/types/functions/math/odd/index.d.ts +0 -1
- package/lib/types/functions/math/pi/index.d.ts +0 -1
- package/lib/types/functions/math/power/index.d.ts +0 -1
- package/lib/types/functions/math/product/index.d.ts +0 -1
- package/lib/types/functions/math/radians/index.d.ts +0 -1
- package/lib/types/functions/math/rand/index.d.ts +0 -1
- package/lib/types/functions/math/randarray/index.d.ts +0 -1
- package/lib/types/functions/math/randbetween/index.d.ts +0 -1
- package/lib/types/functions/math/round/index.d.ts +0 -1
- package/lib/types/functions/math/rounddown/index.d.ts +0 -1
- package/lib/types/functions/math/roundup/index.d.ts +0 -1
- package/lib/types/functions/math/sec/index.d.ts +0 -1
- package/lib/types/functions/math/sech/index.d.ts +0 -1
- package/lib/types/functions/math/sin/index.d.ts +0 -1
- package/lib/types/functions/math/sinh/index.d.ts +0 -1
- package/lib/types/functions/math/sqrt/index.d.ts +0 -1
- package/lib/types/functions/math/sqrtpi/index.d.ts +0 -1
- package/lib/types/functions/math/subtotal/index.d.ts +0 -1
- package/lib/types/functions/math/sum/index.d.ts +0 -1
- package/lib/types/functions/math/sumif/index.d.ts +0 -1
- package/lib/types/functions/math/sumifs/index.d.ts +0 -1
- package/lib/types/functions/math/sumproduct/index.d.ts +0 -1
- package/lib/types/functions/math/sumsq/index.d.ts +0 -1
- package/lib/types/functions/math/sumx2my2/index.d.ts +0 -1
- package/lib/types/functions/math/sumx2py2/index.d.ts +0 -1
- package/lib/types/functions/math/sumxmy2/index.d.ts +0 -1
- package/lib/types/functions/math/tan/index.d.ts +0 -1
- package/lib/types/functions/math/tanh/index.d.ts +0 -1
- package/lib/types/functions/math/trunc/index.d.ts +0 -1
- package/lib/types/functions/meta/compare/index.d.ts +0 -1
- package/lib/types/functions/meta/cube/index.d.ts +0 -1
- package/lib/types/functions/meta/divided/index.d.ts +0 -1
- package/lib/types/functions/meta/function-map.d.ts +0 -1
- package/lib/types/functions/meta/minus/index.d.ts +0 -1
- package/lib/types/functions/meta/multiply/index.d.ts +0 -1
- package/lib/types/functions/meta/plus/index.d.ts +0 -1
- package/lib/types/functions/statistical/avedev/index.d.ts +0 -1
- package/lib/types/functions/statistical/average/index.d.ts +0 -1
- package/lib/types/functions/statistical/averagea/index.d.ts +0 -1
- package/lib/types/functions/statistical/averageif/index.d.ts +0 -1
- package/lib/types/functions/statistical/averageifs/index.d.ts +0 -1
- package/lib/types/functions/statistical/count/index.d.ts +0 -1
- package/lib/types/functions/statistical/counta/index.d.ts +0 -1
- package/lib/types/functions/statistical/countblank/index.d.ts +0 -1
- package/lib/types/functions/statistical/countif/index.d.ts +0 -1
- package/lib/types/functions/statistical/countifs/index.d.ts +0 -1
- package/lib/types/functions/statistical/function-map.d.ts +0 -1
- package/lib/types/functions/statistical/max/index.d.ts +0 -1
- package/lib/types/functions/statistical/maxa/index.d.ts +0 -1
- package/lib/types/functions/statistical/maxifs/index.d.ts +0 -1
- package/lib/types/functions/statistical/min/index.d.ts +0 -1
- package/lib/types/functions/statistical/mina/index.d.ts +0 -1
- package/lib/types/functions/statistical/minifs/index.d.ts +0 -1
- package/lib/types/functions/statistical/rank-avg/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rank-avg/index.d.ts +11 -0
- package/lib/types/functions/statistical/rank-eq/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rank-eq/index.d.ts +10 -0
- package/lib/types/functions/statistical/stdev-p/index.d.ts +0 -1
- package/lib/types/functions/statistical/stdev-s/index.d.ts +0 -1
- package/lib/types/functions/statistical/stdeva/index.d.ts +0 -1
- package/lib/types/functions/statistical/stdevpa/index.d.ts +0 -1
- package/lib/types/functions/statistical/var-p/index.d.ts +0 -1
- package/lib/types/functions/statistical/var-s/index.d.ts +0 -1
- package/lib/types/functions/statistical/vara/index.d.ts +0 -1
- package/lib/types/functions/statistical/varpa/index.d.ts +0 -1
- package/lib/types/functions/text/concat/index.d.ts +0 -1
- package/lib/types/functions/text/concatenate/index.d.ts +0 -1
- package/lib/types/functions/text/function-map.d.ts +0 -1
- package/lib/types/functions/text/len/index.d.ts +0 -1
- package/lib/types/functions/text/lenb/index.d.ts +0 -1
- package/lib/types/functions/text/lower/index.d.ts +0 -1
- package/lib/types/functions/text/rept/index.d.ts +0 -1
- package/lib/types/functions/text/text/index.d.ts +0 -1
- package/lib/types/functions/text/textafter/index.d.ts +0 -1
- package/lib/types/functions/text/textbefore/index.d.ts +0 -1
- package/lib/types/functions/text/textsplit/index.d.ts +0 -1
- package/lib/types/index.d.ts +20 -1
- package/lib/types/models/__tests__/create-command-test-bed.d.ts +0 -1
- package/lib/types/models/formula-data.model.d.ts +0 -1
- package/lib/types/models/utils/formula-data-util.d.ts +0 -1
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/services/active-dirty-manager.service.d.ts +0 -1
- package/lib/types/services/calculate-formula.service.d.ts +0 -1
- package/lib/types/services/current-data.service.d.ts +0 -1
- package/lib/types/services/defined-names.service.d.ts +0 -1
- package/lib/types/services/dependency-manager.service.d.ts +0 -1
- package/lib/types/services/feature-calculation-manager.service.d.ts +0 -1
- package/lib/types/services/function.service.d.ts +0 -1
- package/lib/types/services/other-formula-manager.service.d.ts +0 -1
- package/lib/types/services/runtime.service.d.ts +1 -1
- package/lib/types/services/super-table.service.d.ts +0 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -9
- package/lib/types/engine/utils/relative-formula.d.ts +0 -4
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, isRealNum, DEFAULT_EMPTY_DOCUMENT_VALUE, isNullCell, CellValueType, BooleanNumber, isFormulaString, isFormulaId, Inject, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, toDisposable, Injector, sortRules, OnLifecycle, LifecycleStages, requestImmediateMacroTask, IConfigService, ICommandService, Optional, Plugin
|
|
5
|
+
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, numfmt, isRealNum, DEFAULT_EMPTY_DOCUMENT_VALUE, isNullCell, CellValueType, BooleanNumber, isFormulaString, isFormulaId, Inject, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, toDisposable, Injector, sortRules, OnLifecycle, LifecycleStages, requestImmediateMacroTask, IConfigService, ICommandService, Optional, Plugin } from "@univerjs/core";
|
|
6
6
|
import { Subject } from "rxjs";
|
|
7
7
|
import { DataSyncPrimaryController } from "@univerjs/rpc";
|
|
8
8
|
function isInDirtyRange(dirtyRanges, unitId, sheetId, row, column) {
|
|
@@ -996,7 +996,7 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
996
996
|
this._segment.length > 0 && this._openTableBracket(), this._pushSegment(currentString), this._openSquareBracket();
|
|
997
997
|
else if (currentString === matchToken.CLOSE_SQUARE_BRACKET && this.isSingleQuotationClose() && this.isDoubleQuotationClose())
|
|
998
998
|
this._closeSquareBracket(), this.isSquareBracketClose() ? (this._pushSegment(currentString), this._isTableBracket() && (this._pushNodeToChildren(this._segment), this._resetSegment()), this._closeTableBracket()) : this._pushSegment(currentString);
|
|
999
|
-
else if (currentString === matchToken.DOUBLE_QUOTATION && this.isSingleQuotationClose() && this.
|
|
999
|
+
else if (currentString === matchToken.DOUBLE_QUOTATION && this.isSingleQuotationClose() && this.isSquareBracketClose()) {
|
|
1000
1000
|
if (this.isDoubleQuotationClose())
|
|
1001
1001
|
this._openDoubleQuotation();
|
|
1002
1002
|
else {
|
|
@@ -1061,13 +1061,13 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
1061
1061
|
lastChildNode && lastChildNode.changeToParent(subLexerNode_left);
|
|
1062
1062
|
}
|
|
1063
1063
|
this._setCurrentLexerNode(subLexerNode_main), this._currentLexerNode = subLexerNode_right, this._openColon(upLevel);
|
|
1064
|
-
} else if (SUFFIX_TOKEN_SET.has(currentString) && this._checkSimilarErrorToken(currentString, cur, formulaStringArray) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose()) {
|
|
1064
|
+
} else if (SUFFIX_TOKEN_SET.has(currentString) && this._checkSimilarErrorToken(currentString, cur, formulaStringArray) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose() && this.isBracesClose()) {
|
|
1065
1065
|
this._pushNodeToChildren(this._segment);
|
|
1066
1066
|
const subLexerNode = new LexerNode();
|
|
1067
1067
|
subLexerNode.setToken(currentString);
|
|
1068
1068
|
const lastChildNode = this._getLastChildCurrent();
|
|
1069
1069
|
lastChildNode instanceof LexerNode ? lastChildNode.changeToParent(subLexerNode) : lastChildNode !== !1 && (subLexerNode.getChildren().push(lastChildNode), this._removeLastChild()), this._pushNodeToChildren(subLexerNode), subLexerNode.setParent(this._currentLexerNode), this._resetSegment();
|
|
1070
|
-
} else if (OPERATOR_TOKEN_SET.has(currentString) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose()) {
|
|
1070
|
+
} else if (OPERATOR_TOKEN_SET.has(currentString) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose() && this.isBracesClose()) {
|
|
1071
1071
|
let trimSegment = this._segment.trim();
|
|
1072
1072
|
if (currentString === operatorToken.MINUS && trimSegment === "") {
|
|
1073
1073
|
const prevString = this._findPreviousToken(formulaStringArray, cur - 1) || "";
|
|
@@ -1695,783 +1695,20 @@ function strip(num, precision = 15) {
|
|
|
1695
1695
|
return Number.parseFloat(num.toPrecision(precision));
|
|
1696
1696
|
}
|
|
1697
1697
|
__name(strip, "strip");
|
|
1698
|
-
function withinErrorMargin(left, right) {
|
|
1699
|
-
return Math.abs(left - right) <
|
|
1698
|
+
function withinErrorMargin(left, right, tolerance = Number.EPSILON) {
|
|
1699
|
+
return Math.abs(left - right) < tolerance;
|
|
1700
1700
|
}
|
|
1701
1701
|
__name(withinErrorMargin, "withinErrorMargin");
|
|
1702
|
-
function stripErrorMargin(num, precision = 12) {
|
|
1702
|
+
function stripErrorMargin(num, precision = 12, tolerance = 1e-10) {
|
|
1703
1703
|
const stripResult = strip(num, precision);
|
|
1704
|
-
return withinErrorMargin(num, stripResult) ? stripResult : strip(num);
|
|
1704
|
+
return withinErrorMargin(num, stripResult, tolerance) ? stripResult : strip(num);
|
|
1705
1705
|
}
|
|
1706
1706
|
__name(stripErrorMargin, "stripErrorMargin");
|
|
1707
1707
|
function getFractionalPart(num) {
|
|
1708
1708
|
return num - Math.trunc(num);
|
|
1709
1709
|
}
|
|
1710
1710
|
__name(getFractionalPart, "getFractionalPart");
|
|
1711
|
-
|
|
1712
|
-
function getDefaultExportFromCjs(x) {
|
|
1713
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1714
|
-
}
|
|
1715
|
-
__name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
|
|
1716
|
-
var numfmt$2 = { exports: {} };
|
|
1717
|
-
(function(module, exports) {
|
|
1718
|
-
(function(e, t) {
|
|
1719
|
-
module.exports = t();
|
|
1720
|
-
})(typeof self < "u" ? self : commonjsGlobal, function() {
|
|
1721
|
-
return function() {
|
|
1722
|
-
var e = { d: /* @__PURE__ */ __name(function(t2, n2) {
|
|
1723
|
-
for (var a2 in n2) e.o(n2, a2) && !e.o(t2, a2) && Object.defineProperty(t2, a2, { enumerable: !0, get: n2[a2] });
|
|
1724
|
-
}, "d"), o: /* @__PURE__ */ __name(function(e2, t2) {
|
|
1725
|
-
return Object.prototype.hasOwnProperty.call(e2, t2);
|
|
1726
|
-
}, "o") }, t = {};
|
|
1727
|
-
e.d(t, { default: /* @__PURE__ */ __name(function() {
|
|
1728
|
-
return pe;
|
|
1729
|
-
}, "default") });
|
|
1730
|
-
var n = { 1078: "af", 1052: "sq", 1118: "am", 5121: "ar_DZ", 15361: "ar_BH", 3073: "ar_EG", 2049: "ar_IQ", 11265: "ar_JO", 13313: "ar_KW", 12289: "ar_LB", 4097: "ar_LY", 6145: "ar_MA", 8193: "ar_OM", 16385: "ar_QA", 1025: "ar_SA", 10241: "ar_SY", 7169: "ar_TN", 14337: "ar_AE", 9217: "ar_YE", 1067: "hy", 1101: "as", 2092: "az_AZ", 1068: "az_AZ", 1069: "eu", 1059: "be", 2117: "bn", 1093: "bn_IN", 5146: "bs", 1026: "bg", 1109: "my", 1027: "ca", 2052: "zh_CN", 3076: "zh_HK", 5124: "zh_MO", 4100: "zh_SG", 1028: "zh_TW", 1050: "hr", 1029: "cs", 1030: "da", 1125: "dv", 2067: "nl_BE", 1043: "nl_NL", 1126: "bin", 3081: "en_AU", 10249: "en_BZ", 4105: "en_CA", 9225: "en_CB", 2057: "en_GB", 16393: "en_IN", 6153: "en_IE", 8201: "en_JM", 5129: "en_NZ", 13321: "en_PH", 7177: "en_ZA", 11273: "en_TT", 1033: "en_US", 12297: "en_ZW", 1061: "et", 1071: "mk", 1080: "fo", 1065: "fa", 1124: "fil", 1035: "fi", 2060: "fr_BE", 11276: "fr_CM", 3084: "fr_CA", 9228: "fr_CG", 12300: "fr_CI", 1036: "fr_FR", 5132: "fr_LU", 13324: "fr_ML", 6156: "fr_MC", 14348: "fr_MA", 10252: "fr_SN", 4108: "fr_CH", 7180: "fr", 1122: "fy_NL", 2108: "gd_IE", 1084: "gd", 1110: "gl", 1079: "ka", 3079: "de_AT", 1031: "de_DE", 5127: "de_LI", 4103: "de_LU", 2055: "de_CH", 1032: "el", 1140: "gn", 1095: "gu", 1279: "en", 1037: "he", 1081: "hi", 1038: "hu", 1039: "is", 1136: "ig_NG", 1057: "id", 1040: "it_IT", 2064: "it_CH", 1041: "ja", 1099: "kn", 1120: "ks", 1087: "kk", 1107: "km", 1111: "kok", 1042: "ko", 1088: "ky", 1108: "lo", 1142: "la", 1062: "lv", 1063: "lt", 2110: "ms_BN", 1086: "ms_MY", 1100: "ml", 1082: "mt", 1112: "mni", 1153: "mi", 1102: "mr", 1104: "mn", 2128: "mn", 1121: "ne", 1044: "no_NO", 2068: "no_NO", 1096: "or", 1045: "pl", 1046: "pt_BR", 2070: "pt_PT", 1094: "pa", 1047: "rm", 2072: "ro_MO", 1048: "ro_RO", 1049: "ru", 2073: "ru_MO", 1083: "se", 1103: "sa", 3098: "sr_SP", 2074: "sr_SP", 1072: "st", 1074: "tn", 1113: "sd", 1115: "si", 1051: "sk", 1060: "sl", 1143: "so", 1070: "sb", 11274: "es_AR", 16394: "es_BO", 13322: "es_CL", 9226: "es_CO", 5130: "es_CR", 7178: "es_DO", 12298: "es_EC", 17418: "es_SV", 4106: "es_GT", 18442: "es_HN", 2058: "es_MX", 19466: "es_NI", 6154: "es_PA", 15370: "es_PY", 10250: "es_PE", 20490: "es_PR", 1034: "es_ES", 14346: "es_UY", 8202: "es_VE", 1089: "sw", 2077: "sv_FI", 1053: "sv_SE", 1114: "syc", 1064: "tg", 1097: "ta", 1092: "tt", 1098: "te", 1054: "th", 1105: "bo", 1073: "ts", 1055: "tr", 1090: "tk", 1058: "uk", 1056: "ur", 2115: "uz_UZ", 1091: "uz_UZ", 1075: "ve", 1066: "vi", 1106: "cy", 1076: "xh", 1085: "yi", 1077: "zu" };
|
|
1731
|
-
const a = /^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i, r = {}, i = { group: " ", decimal: ".", positive: "+", negative: "-", percent: "%", exponent: "E", nan: "NaN", infinity: "∞", ampm: ["AM", "PM"], mmmm6: ["Muharram", "Safar", "Rabiʻ I", "Rabiʻ II", "Jumada I", "Jumada II", "Rajab", "Shaʻban", "Ramadan", "Shawwal", "Dhuʻl-Qiʻdah", "Dhuʻl-Hijjah"], mmm6: ["Muh.", "Saf.", "Rab. I", "Rab. II", "Jum. I", "Jum. II", "Raj.", "Sha.", "Ram.", "Shaw.", "Dhuʻl-Q.", "Dhuʻl-H."], mmmm: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], mmm: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dddd: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ddd: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] };
|
|
1732
|
-
function s(e2) {
|
|
1733
|
-
const t2 = a.exec(e2);
|
|
1734
|
-
if (!t2) throw new SyntaxError("Malformed locale: ".concat(e2));
|
|
1735
|
-
return { lang: t2[1] + (t2[2] ? "_" + t2[2] : ""), language: t2[1], territory: t2[2] || "", codeset: t2[3] || "", modifier: t2[4] || "" };
|
|
1736
|
-
}
|
|
1737
|
-
__name(s, "s");
|
|
1738
|
-
function o(e2) {
|
|
1739
|
-
if (typeof e2 == "number") return n[65535 & e2] || null;
|
|
1740
|
-
const t2 = parseInt(e2, 16);
|
|
1741
|
-
return isFinite(t2) && n[65535 & t2] ? n[65535 & t2] || null : a.test(e2) ? e2 : null;
|
|
1742
|
-
}
|
|
1743
|
-
__name(o, "o");
|
|
1744
|
-
function l(e2) {
|
|
1745
|
-
const t2 = o(e2);
|
|
1746
|
-
let n2 = null;
|
|
1747
|
-
if (t2) {
|
|
1748
|
-
const e3 = s(t2);
|
|
1749
|
-
n2 = r[e3.lang] || r[e3.language] || null;
|
|
1750
|
-
}
|
|
1751
|
-
return n2;
|
|
1752
|
-
}
|
|
1753
|
-
__name(l, "l");
|
|
1754
|
-
function d(e2) {
|
|
1755
|
-
return Object.assign({}, i, e2);
|
|
1756
|
-
}
|
|
1757
|
-
__name(d, "d");
|
|
1758
|
-
function m(e2, t2) {
|
|
1759
|
-
const n2 = typeof t2 == "object" ? t2 : s(t2);
|
|
1760
|
-
return r[n2.lang] = d(e2), n2.language === n2.lang || r[n2.language] || (r[n2.language] = d(e2)), r[n2.lang];
|
|
1761
|
-
}
|
|
1762
|
-
__name(m, "m");
|
|
1763
|
-
const u = d({ group: "," });
|
|
1764
|
-
function c(e2, t2) {
|
|
1765
|
-
if (typeof e2 != "number") return e2;
|
|
1766
|
-
if (e2 < 0) return -c(-e2, t2);
|
|
1767
|
-
if (t2) {
|
|
1768
|
-
const n2 = 10 ** (t2 || 0) || 1;
|
|
1769
|
-
return c(e2 * n2, 0) / n2;
|
|
1770
|
-
}
|
|
1771
|
-
return Math.round(e2);
|
|
1772
|
-
}
|
|
1773
|
-
__name(c, "c"), u.isDefault = !0, m({ group: ",", ampm: ["上午", "下午"], mmmm: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"] }, "zh_CN"), m({ group: ",", nan: "非數值", ampm: ["上午", "下午"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"] }, "zh_TW"), m({ group: ",", ampm: ["午前", "午後"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], ddd: ["日", "月", "火", "水", "木", "金", "土"] }, "ja"), m({ group: ",", ampm: ["오전", "오후"], mmmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], mmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], dddd: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], ddd: ["일", "월", "화", "수", "목", "금", "토"] }, "ko"), m({ group: ",", ampm: ["ก่อนเที่ยง", "หลังเที่ยง"], mmmm: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], mmm: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], dddd: ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", "วันพฤหัสบดี", "วันศุกร์", "วันเสาร์"], ddd: ["อา.", "จ.", "อ.", "พ.", "พฤ.", "ศ.", "ส."] }, "th"), m({ decimal: ",", ampm: ["dop.", "odp."], mmmm: ["ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"], mmm: ["led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"], dddd: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"], ddd: ["ne", "po", "út", "st", "čt", "pá", "so"] }, "cs"), m({ group: ".", decimal: ",", mmmm: ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "da"), m({ group: ".", decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mrt.", "apr.", "mei", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], ddd: ["zo", "ma", "di", "wo", "do", "vr", "za"] }, "nl"), m({ group: "," }, "en"), m({ decimal: ",", nan: "epäluku", ampm: ["ap.", "ip."], mmmm: ["tammikuuta", "helmikuuta", "maaliskuuta", "huhtikuuta", "toukokuuta", "kesäkuuta", "heinäkuuta", "elokuuta", "syyskuuta", "lokakuuta", "marraskuuta", "joulukuuta"], mmm: ["tammik.", "helmik.", "maalisk.", "huhtik.", "toukok.", "kesäk.", "heinäk.", "elok.", "syysk.", "lokak.", "marrask.", "jouluk."], dddd: ["sunnuntaina", "maanantaina", "tiistaina", "keskiviikkona", "torstaina", "perjantaina", "lauantaina"], ddd: ["su", "ma", "ti", "ke", "to", "pe", "la"] }, "fi"), m({ group: " ", decimal: ",", mmmm: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], mmm: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], dddd: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], ddd: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."] }, "fr"), m({ group: ".", decimal: ",", mmmm: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], mmm: ["Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."], dddd: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], ddd: ["So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."] }, "de"), m({ group: ".", decimal: ",", ampm: ["π.μ.", "μ.μ."], mmmm: ["Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαΐου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοεμβρίου", "Δεκεμβρίου"], mmm: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαΐ", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"], dddd: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"], ddd: ["Κυρ", "Δευ", "Τρί", "Τετ", "Πέμ", "Παρ", "Σάβ"] }, "el"), m({ decimal: ",", ampm: ["de.", "du."], mmmm: ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], mmm: ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."], dddd: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], ddd: ["V", "H", "K", "Sze", "Cs", "P", "Szo"] }, "hu"), m({ group: ".", decimal: ",", ampm: ["f.h.", "e.h."], mmmm: ["janúar", "febrúar", "mars", "apríl", "maí", "júní", "júlí", "ágúst", "september", "október", "nóvember", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "maí", "jún.", "júl.", "ágú.", "sep.", "okt.", "nóv.", "des."], dddd: ["sunnudagur", "mánudagur", "þriðjudagur", "miðvikudagur", "fimmtudagur", "föstudagur", "laugardagur"], ddd: ["sun.", "mán.", "þri.", "mið.", "fim.", "fös.", "lau."] }, "is"), m({ group: ".", decimal: ",", mmmm: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], mmm: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"], dddd: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], ddd: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"] }, "id"), m({ group: ".", decimal: ",", mmmm: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"], mmm: ["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], dddd: ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"], ddd: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"] }, "it"), m({ decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "mai", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "des."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "nb"), m({ decimal: ",", mmmm: ["stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"], mmm: ["sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru"], dddd: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"], ddd: ["niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."] }, "pl"), m({ group: ".", decimal: ",", mmmm: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], mmm: ["jan.", "fev.", "mar.", "abr.", "mai.", "jun.", "jul.", "ago.", "set.", "out.", "nov.", "dez."], dddd: ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"], ddd: ["dom.", "seg.", "ter.", "qua.", "qui.", "sex.", "sáb."] }, "pt"), m({ decimal: ",", nan: "не число", mmmm: ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], mmm: ["янв.", "февр.", "мар.", "апр.", "мая", "июн.", "июл.", "авг.", "сент.", "окт.", "нояб.", "дек."], dddd: ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], ddd: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"] }, "ru"), m({ decimal: ",", mmmm: ["januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra"], mmm: ["jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec"], dddd: ["nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"], ddd: ["ne", "po", "ut", "st", "št", "pi", "so"] }, "sk"), m({ group: ".", decimal: ",", ampm: ["a. m.", "p. m."], mmmm: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], mmm: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic."], dddd: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], ddd: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."] }, "es"), m({ decimal: ",", ampm: ["fm", "em"], mmmm: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"], ddd: ["sön", "mån", "tis", "ons", "tors", "fre", "lör"] }, "sv"), m({ group: ".", decimal: ",", ampm: ["ÖÖ", "ÖS"], mmmm: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], mmm: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], dddd: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], ddd: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"] }, "tr");
|
|
1774
|
-
function p(e2, t2, n2) {
|
|
1775
|
-
const a2 = e2 < 0 ? -1 : 1, r2 = 10 ** (t2 || 2), i2 = 10 ** (n2 || 2);
|
|
1776
|
-
let s2, o2, l2 = Math.abs(e2), d2 = 0, m2 = 0, u2 = 0, c2 = 1;
|
|
1777
|
-
if ((e2 = l2) % 1 == 0) o2 = [e2 * a2, 1];
|
|
1778
|
-
else if (e2 < 1e-19) o2 = [a2, 1e19];
|
|
1779
|
-
else if (e2 > 1e19) o2 = [1e19 * a2, 1];
|
|
1780
|
-
else {
|
|
1781
|
-
do
|
|
1782
|
-
if (l2 = 1 / (l2 - Math.floor(l2)), s2 = c2, c2 = c2 * Math.floor(l2) + d2, d2 = s2, m2 = u2, u2 = Math.floor(e2 * c2 + 0.5), u2 >= r2 || c2 >= i2) return [a2 * m2, d2];
|
|
1783
|
-
while (Math.abs(e2 - u2 / c2) >= 1e-10 && l2 !== Math.floor(l2));
|
|
1784
|
-
o2 = [a2 * u2, c2];
|
|
1785
|
-
}
|
|
1786
|
-
return o2;
|
|
1787
|
-
}
|
|
1788
|
-
__name(p, "p");
|
|
1789
|
-
const f = { overflow: "######", dateErrorThrows: !1, dateErrorNumber: !0, dateSpanLarge: !0, leap1900: !0, nbsp: !0, throws: !0, invalid: "######", locale: "", ignoreTimezone: !1 }, g = Object.assign({}, f);
|
|
1790
|
-
function h(e2) {
|
|
1791
|
-
if (e2 === null && (e2 = f), e2) {
|
|
1792
|
-
for (const t2 in e2) if (t2 in f) {
|
|
1793
|
-
const n2 = e2[t2];
|
|
1794
|
-
g[t2] = n2 == null ? f[t2] : n2;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return { ...g };
|
|
1798
|
-
}
|
|
1799
|
-
__name(h, "h");
|
|
1800
|
-
const y = { "#": "", 0: "0", "?": " " }, _ = { "@": "text", "-": "minus", "+": "plus" }, b = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], j = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], v = new RegExp("[" + j.join("") + "]");
|
|
1801
|
-
function M(e2, t2, n2) {
|
|
1802
|
-
return t2[n2 + "_max"] = e2.length, t2[n2 + "_min"] = e2.replace(/#/g, "").length, t2;
|
|
1803
|
-
}
|
|
1804
|
-
__name(M, "M");
|
|
1805
|
-
const k = {};
|
|
1806
|
-
function x(e2) {
|
|
1807
|
-
if (!(e2 in k)) {
|
|
1808
|
-
const t2 = [], n2 = e2.replace(/^[#,]+/, "").replace(/[1-9]\d*/g, (e3) => "?".repeat(e3.length));
|
|
1809
|
-
for (let e3 = 0; e3 < n2.length; e3++) {
|
|
1810
|
-
const a2 = n2.charAt(e3);
|
|
1811
|
-
t2[e3] = a2 in y ? y[a2] : a2;
|
|
1812
|
-
}
|
|
1813
|
-
k[e2] = t2.join("");
|
|
1814
|
-
}
|
|
1815
|
-
return k[e2];
|
|
1816
|
-
}
|
|
1817
|
-
__name(x, "x");
|
|
1818
|
-
function F(e2, t2) {
|
|
1819
|
-
typeof e2 == "string" && (e2 = { type: "string", value: e2 = e2.replace(/ /g, y["?"]) }), t2.push(e2);
|
|
1820
|
-
}
|
|
1821
|
-
__name(F, "F");
|
|
1822
|
-
function z(e2) {
|
|
1823
|
-
const t2 = [], n2 = { scale: 1, percent: !1, text: !1, date: 0, date_eval: !1, date_system: 1, sec_decimals: 0, general: !1, clock: 24, int_pattern: [], frac_pattern: [], man_pattern: [], den_pattern: [], num_pattern: [], tokens: t2 };
|
|
1824
|
-
let a2 = e2 + "", r2 = "int", i2 = !1, s2 = null;
|
|
1825
|
-
const l2 = [];
|
|
1826
|
-
let d2, m2, u2 = !1;
|
|
1827
|
-
for (; a2 && !i2; ) {
|
|
1828
|
-
if (d2 = /^General/i.exec(a2)) n2.general = !0, F({ type: "general" }, t2);
|
|
1829
|
-
else if (r2 === "int" && (d2 = /^[#?0]+(?:,[#?0]+)*/.exec(a2)) || r2 === "den" && (d2 = /^[#?\d]+/.exec(a2)) || (d2 = /^[#?0]+/.exec(a2))) n2[r2 + "_pattern"].push(d2[0]), s2 = { type: r2, num: d2[0] }, F(s2, t2);
|
|
1830
|
-
else if ((d2 = /^\//.exec(a2)) && n2[r2 + "_pattern"].length) {
|
|
1831
|
-
if (!s2) throw new SyntaxError("Missing a numerator in pattern ".concat(e2));
|
|
1832
|
-
n2.fractions = !0, n2.num_pattern.push(n2[r2 + "_pattern"].pop()), s2.type = "num", r2 = "den", F({ type: "div" }, t2);
|
|
1833
|
-
} else if (d2 = /^,+/.exec(a2)) {
|
|
1834
|
-
const e3 = a2.charAt(1) in y;
|
|
1835
|
-
m2.slice(-1) in y && (d2[0].length > 1 || !e3) ? n2.scale = 1e-3 ** d2[0].length : n2.dec_fractions || F(d2[0], t2);
|
|
1836
|
-
} else {
|
|
1837
|
-
if (d2 = /^;/.exec(a2)) {
|
|
1838
|
-
i2 = !0;
|
|
1839
|
-
break;
|
|
1840
|
-
}
|
|
1841
|
-
if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type: _[d2[0]] }, t2);
|
|
1842
|
-
else if (d2 = /^(?:\[(h+|m+|s+)\])/i.exec(a2)) {
|
|
1843
|
-
const e3 = d2[1].toLowerCase(), a3 = e3[0], r3 = { type: "", size: 0, date: 1, raw: d2[0], pad: e3.length };
|
|
1844
|
-
a3 === "h" ? (r3.size = 16, r3.type = "hour-elap") : a3 === "m" ? (r3.size = 32, r3.type = "min-elap") : (r3.size = 64, r3.type = "sec-elap"), n2.date = n2.date | r3.size, l2.push(r3), F(r3, t2);
|
|
1845
|
-
} else if (d2 = /^(?:B2)/i.exec(a2)) u2 || (n2.date_system = 6);
|
|
1846
|
-
else if (d2 = /^(?:B1)/i.exec(a2)) u2 || (n2.date_system = 1);
|
|
1847
|
-
else if (d2 = /^(?:([hHmMsSyYbBdDegG])\1*)/.exec(a2)) {
|
|
1848
|
-
const e3 = { type: "", size: 0, date: 1, raw: d2[0] }, a3 = d2[0].toLowerCase(), r3 = a3[0];
|
|
1849
|
-
if (a3 === "y" || a3 === "yy") e3.size = 2, e3.type = "year-short";
|
|
1850
|
-
else if (r3 === "y" || r3 === "e") e3.size = 2, e3.type = "year";
|
|
1851
|
-
else if (a3 === "b" || a3 === "bb") e3.size = 2, e3.type = "b-year-short";
|
|
1852
|
-
else if (r3 === "b") e3.size = 2, e3.type = "b-year";
|
|
1853
|
-
else if (a3 === "d" || a3 === "dd") e3.size = 8, e3.type = "day", e3.pad = /dd/.test(a3);
|
|
1854
|
-
else if (a3 === "ddd") e3.size = 8, e3.type = "weekday-short";
|
|
1855
|
-
else if (r3 === "d") e3.size = 8, e3.type = "weekday";
|
|
1856
|
-
else if (r3 === "h") e3.size = 16, e3.type = "hour", e3.pad = /hh/i.test(a3);
|
|
1857
|
-
else if (r3 === "m") {
|
|
1858
|
-
a3.length === 3 ? (e3.size = 4, e3.type = "monthname-short") : a3.length === 5 ? (e3.size = 4, e3.type = "monthname-single") : a3.length >= 4 && (e3.size = 4, e3.type = "monthname");
|
|
1859
|
-
const t3 = l2[l2.length - 1];
|
|
1860
|
-
!e3.type && t3 && !t3.used && 80 & t3.size && (t3.used = !0, e3.size = 32, e3.type = "min", e3.pad = /mm/.test(a3)), e3.type || (e3.size = 4, e3.type = "month", e3.pad = /mm/.test(a3), e3.indeterminate = !0);
|
|
1861
|
-
} else if (r3 === "s") {
|
|
1862
|
-
e3.size = 64, e3.type = "sec", e3.pad = /ss/.test(a3);
|
|
1863
|
-
const t3 = l2[l2.length - 1];
|
|
1864
|
-
t3 && 32 & t3.size ? e3.used = !0 : t3 && t3.indeterminate && (delete t3.indeterminate, t3.size = 32, t3.type = "min", e3.used = !0);
|
|
1865
|
-
}
|
|
1866
|
-
n2.date = n2.date | e3.size, n2.date_eval = !0, l2.push(e3), F(e3, t2);
|
|
1867
|
-
} else if (d2 = /^(?:AM\/PM|am\/pm|A\/P)/.exec(a2)) n2.clock = 12, n2.date = 16 | n2.date, n2.date_eval = !0, F({ type: "am", short: d2[0] === "A/P" }, t2);
|
|
1868
|
-
else if (n2.date && (d2 = /^\.0{1,3}/i.exec(a2))) {
|
|
1869
|
-
const e3 = d2[0].length - 1, a3 = [64, 128, 256, 512][e3];
|
|
1870
|
-
n2.date = n2.date | a3, n2.date_eval = !0, n2.sec_decimals = Math.max(n2.sec_decimals, e3), F({ type: "subsec", size: a3, decimals: e3, date: 1, raw: d2[0] }, t2);
|
|
1871
|
-
} else if ((d2 = /^\\(.)/.exec(a2)) || (d2 = /^"([^"]*?)"/.exec(a2))) F(d2[1], t2);
|
|
1872
|
-
else if (d2 = /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(a2)) n2.condition = [d2[1], parseFloat(d2[2], 10)];
|
|
1873
|
-
else if (d2 = /^\[\$([^\]]+)\]/.exec(a2)) {
|
|
1874
|
-
const e3 = d2[1].split("-"), a3 = e3.length < 2 ? "" : e3[e3.length - 1], r3 = e3[0];
|
|
1875
|
-
r3 && F(r3, t2);
|
|
1876
|
-
const i3 = o(a3);
|
|
1877
|
-
i3 && (n2.locale = i3);
|
|
1878
|
-
const s3 = parseInt(a3, 16);
|
|
1879
|
-
isFinite(s3) && 16711680 & s3 && (s3 >> 16 & 255) === 6 && (n2.date_system = 6), u2 = !0;
|
|
1880
|
-
} else if (d2 = /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(a2)) n2.color = d2[2] ? b[parseInt(d2[2], 10)] || "#000" : d2[1].toLowerCase();
|
|
1881
|
-
else if (!(d2 = /^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(a2))) {
|
|
1882
|
-
if (d2 = /^%/.exec(a2)) n2.scale = 100, n2.percent = !0, F("%", t2);
|
|
1883
|
-
else if (d2 = /^_(\\.|.)/.exec(a2)) F(" ", t2);
|
|
1884
|
-
else if (d2 = /^\./.exec(a2)) F({ type: "point", value: d2[0] }, t2), n2.dec_fractions = !0, r2 = "frac";
|
|
1885
|
-
else if (d2 = /^[Ee]([+-]?|(?=[0#?]))/.exec(a2)) n2.exponential = !0, n2.exp_plus = d2[1] === "+", r2 = "man", F({ type: "exp", plus: d2[1] === "+" }, t2);
|
|
1886
|
-
else if (!(d2 = /^\*(\\.|.)/.exec(a2))) {
|
|
1887
|
-
if (d2 = /^[BENn[]/.exec(a2)) throw new SyntaxError("Unexpected char ".concat(a2.charAt(0), " in pattern ").concat(e2));
|
|
1888
|
-
a2[0] === "(" && (n2.parens = !0), d2 = [a2[0]], F(d2[0], t2);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
m2 = d2[0], a2 = a2.slice(d2 ? d2[0].length : 1);
|
|
1893
|
-
}
|
|
1894
|
-
if (n2.pattern = e2.slice(0, e2.length - a2.length), /^((?:\[[^\]]+\])+)(;|$)/.test(n2.pattern) && !/^\[(?:h+|m+|s+)\]/.test(n2.pattern) && F({ type: "text" }, t2), n2.fractions && n2.dec_fractions || n2.fractions && n2.exponential) throw new SyntaxError("Invalid pattern: ".concat(n2.pattern));
|
|
1895
|
-
const c2 = n2.int_pattern.join("");
|
|
1896
|
-
if (n2.grouping = c2.indexOf(",") >= 0, n2.grouping) {
|
|
1897
|
-
const e3 = c2.split(","), t3 = e3.length;
|
|
1898
|
-
t3 === 2 ? (n2.group_pri = e3[1].length, n2.group_sec = n2.group_pri) : t3 > 2 && (n2.group_pri = e3[t3 - 1].length, n2.group_sec = e3[t3 - 2].length);
|
|
1899
|
-
} else n2.group_pri = 0, n2.group_sec = 0;
|
|
1900
|
-
M(c2.replace(/[,]/g, ""), n2, "int"), M(n2.frac_pattern.join(""), n2, "frac"), M(n2.man_pattern.join(""), n2, "man");
|
|
1901
|
-
let p2 = n2.num_pattern.join(""), f2 = n2.den_pattern.join("");
|
|
1902
|
-
const g2 = /\?/.test(f2) || /\?/.test(p2);
|
|
1903
|
-
return f2 = f2.replace(/\d/g, g2 ? "?" : "#"), g2 && (f2 = f2.replace(/#$/g, "?")), M(p2, n2, "num"), M(f2, n2, "den"), g2 && (p2 = p2.replace(/#$/g, "?")), n2.int_padding = x(n2.int_pattern.join("")), n2.man_padding = x(n2.man_pattern.join("")), n2.num_padding = x(p2), n2.den_padding = x(f2), n2.den_pattern.length && (n2.denominator = parseInt(n2.den_pattern.join("").replace(/\D/g, ""), 10)), n2.integer = !!n2.int_pattern.join("").length, n2.fractions && t2.forEach((e3, n3) => {
|
|
1904
|
-
const a3 = t2[n3 + 1];
|
|
1905
|
-
e3.type === "string" && a3 && (a3.type === "num" ? e3.rule = "num+int" : a3.type === "div" ? e3.rule = "num" : a3.type === "den" && (e3.rule = "den"));
|
|
1906
|
-
}), n2;
|
|
1907
|
-
}
|
|
1908
|
-
__name(z, "z");
|
|
1909
|
-
const w = /* @__PURE__ */ __name((e2) => {
|
|
1910
|
-
const t2 = e2.condition;
|
|
1911
|
-
t2 && t2[1] < 0 && (t2[0] === "<" || t2[0] === "<=" || t2[0] === "=") || e2.tokens.unshift({ type: "minus", volatile: !0 });
|
|
1912
|
-
}, "w");
|
|
1913
|
-
function D(e2) {
|
|
1914
|
-
const t2 = [];
|
|
1915
|
-
let n2, a2 = !1, r2 = null, i2 = e2, s2 = 0, l2 = !1, d2 = 0, m2 = 0;
|
|
1916
|
-
do {
|
|
1917
|
-
if (l2 = z(i2), (l2.date || l2.general) && (l2.int_pattern.length || l2.frac_pattern.length || l2.scale !== 1 || l2.text)) throw new Error("Illegal format");
|
|
1918
|
-
if (l2.condition && (m2++, a2 = !0), l2.text) {
|
|
1919
|
-
if (r2) throw new Error("Unexpected partition");
|
|
1920
|
-
r2 = l2;
|
|
1921
|
-
}
|
|
1922
|
-
l2.locale && (n2 = o(l2.locale)), t2.push(l2), s2 = i2.charAt(l2.pattern.length) === ";" ? 1 : 0, i2 = i2.slice(l2.pattern.length + s2), d2++;
|
|
1923
|
-
} while (s2 && d2 < 4 && m2 < 3);
|
|
1924
|
-
if (s2) throw new Error("Unexpected partition");
|
|
1925
|
-
if (m2 > 2) throw new Error("Unexpected condition");
|
|
1926
|
-
const u2 = t2[3];
|
|
1927
|
-
if (u2 && (u2.int_pattern.length || u2.frac_pattern.length || u2.date)) throw new Error("Unexpected partition");
|
|
1928
|
-
if (a2) {
|
|
1929
|
-
const e3 = t2.length;
|
|
1930
|
-
if (e3 === 1 && (t2[1] = z("General"), t2[1].generated = !0), e3 < 3) {
|
|
1931
|
-
const e4 = t2[0], n3 = t2[1];
|
|
1932
|
-
if (w(e4), n3.condition) w(n3);
|
|
1933
|
-
else {
|
|
1934
|
-
const t3 = e4.condition;
|
|
1935
|
-
(t3[0] === "=" || t3[1] >= 0 && (t3[0] === ">" || t3[0] === ">=")) && n3.tokens.unshift({ type: "minus", volatile: !0 });
|
|
1936
|
-
}
|
|
1937
|
-
} else t2.forEach(w);
|
|
1938
|
-
} else {
|
|
1939
|
-
if (t2.length < 4 && r2) for (let e3 = 0, n3 = t2.length; e3 < n3; e3++) t2[e3] === r2 && t2.splice(e3, 1);
|
|
1940
|
-
if (t2.length < 1 && r2 && (t2[0] = z("General"), t2[0].generated = !0), t2.length < 2) {
|
|
1941
|
-
const e3 = z(t2[0].pattern);
|
|
1942
|
-
e3.tokens.unshift({ type: "minus", volatile: !0 }), e3.generated = !0, t2.push(e3);
|
|
1943
|
-
}
|
|
1944
|
-
if (t2.length < 3) {
|
|
1945
|
-
const e3 = z(t2[0].pattern);
|
|
1946
|
-
e3.generated = !0, t2.push(e3);
|
|
1947
|
-
}
|
|
1948
|
-
if (t2.length < 4) if (r2) t2.push(r2);
|
|
1949
|
-
else {
|
|
1950
|
-
const e3 = z("@");
|
|
1951
|
-
e3.generated = !0, t2.push(e3);
|
|
1952
|
-
}
|
|
1953
|
-
t2[0].condition = [">", 0], t2[1].condition = ["<", 0], t2[2].condition = null;
|
|
1954
|
-
}
|
|
1955
|
-
return { pattern: e2, partitions: t2, locale: n2 };
|
|
1956
|
-
}
|
|
1957
|
-
__name(D, "D");
|
|
1958
|
-
const S = Math.floor;
|
|
1959
|
-
function C(e2) {
|
|
1960
|
-
if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && e2 >= 0) {
|
|
1961
|
-
if (e2 === 0) return [1900, 1, 0];
|
|
1962
|
-
if (e2 === 60) return [1900, 2, 29];
|
|
1963
|
-
if (e2 < 60) return [1900, e2 < 32 ? 1 : 2, (e2 - 1) % 31 + 1];
|
|
1964
|
-
}
|
|
1965
|
-
let n2 = e2 + 68569 + 2415019;
|
|
1966
|
-
const a2 = S(4 * n2 / 146097);
|
|
1967
|
-
n2 -= S((146097 * a2 + 3) / 4);
|
|
1968
|
-
const r2 = S(4e3 * (n2 + 1) / 1461001);
|
|
1969
|
-
n2 = n2 - S(1461 * r2 / 4) + 31;
|
|
1970
|
-
const i2 = S(80 * n2 / 2447), s2 = n2 - S(2447 * i2 / 80);
|
|
1971
|
-
n2 = S(i2 / 11);
|
|
1972
|
-
const o2 = i2 + 2 - 12 * n2;
|
|
1973
|
-
return [0 | 100 * (a2 - 49) + r2 + n2, 0 | o2, 0 | s2];
|
|
1974
|
-
}
|
|
1975
|
-
__name(C, "C");
|
|
1976
|
-
function E(e2) {
|
|
1977
|
-
return C(e2 + 1462);
|
|
1978
|
-
}
|
|
1979
|
-
__name(E, "E");
|
|
1980
|
-
function A(e2) {
|
|
1981
|
-
if (e2 === 60) throw new Error("#VALUE!");
|
|
1982
|
-
if (e2 <= 1) return [1317, 8, 29];
|
|
1983
|
-
if (e2 < 60) return [1317, e2 < 32 ? 9 : 10, 1 + (e2 - 2) % 30];
|
|
1984
|
-
const t2 = 10631 / 30, n2 = 0.1335;
|
|
1985
|
-
let a2 = e2 + 466935;
|
|
1986
|
-
const r2 = S(a2 / 10631);
|
|
1987
|
-
a2 -= 10631 * r2;
|
|
1988
|
-
const i2 = S((a2 - n2) / t2);
|
|
1989
|
-
a2 -= S(i2 * t2 + n2);
|
|
1990
|
-
const s2 = S((a2 + 28.5001) / 29.5);
|
|
1991
|
-
return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 - S(29.5001 * s2 - 29)];
|
|
1992
|
-
}
|
|
1993
|
-
__name(A, "A");
|
|
1994
|
-
function Y(e2) {
|
|
1995
|
-
let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n2 = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
|
|
1996
|
-
const a2 = S(e2);
|
|
1997
|
-
return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
|
|
1998
|
-
}
|
|
1999
|
-
__name(Y, "Y");
|
|
2000
|
-
const T = Math.floor, N = 86400;
|
|
2001
|
-
function P(e2, t2) {
|
|
2002
|
-
let n2 = null;
|
|
2003
|
-
if (Array.isArray(e2)) {
|
|
2004
|
-
const [t3, a2, r2, i2, s2, o2] = e2;
|
|
2005
|
-
n2 = Date.UTC(t3, a2 == null ? 0 : a2 - 1, r2 != null ? r2 : 1, i2 || 0, s2 || 0, o2 || 0);
|
|
2006
|
-
} else if (e2 instanceof Date && (n2 = 1 * e2, !t2 || !t2.ignoreTimezone)) {
|
|
2007
|
-
const t3 = /* @__PURE__ */ new Date();
|
|
2008
|
-
t3.setUTCFullYear(e2.getFullYear(), e2.getMonth(), e2.getDate()), t3.setUTCHours(e2.getHours(), e2.getMinutes(), e2.getSeconds(), e2.getMilliseconds()), n2 = 1 * t3;
|
|
2009
|
-
}
|
|
2010
|
-
if (n2 != null && isFinite(n2)) {
|
|
2011
|
-
const e3 = n2 / 864e5;
|
|
2012
|
-
return e3 - (e3 <= -25509 ? -25568 : -25569);
|
|
2013
|
-
}
|
|
2014
|
-
return e2;
|
|
2015
|
-
}
|
|
2016
|
-
__name(P, "P");
|
|
2017
|
-
function I(e2, t2) {
|
|
2018
|
-
let n2 = 0 | e2;
|
|
2019
|
-
const a2 = N * (e2 - n2);
|
|
2020
|
-
let r2 = T(a2);
|
|
2021
|
-
a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
|
|
2022
|
-
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T(i2 / 60 / 60) % 60, m2 = T(i2 / 60) % 60, u2 = T(i2) % 60;
|
|
2023
|
-
if (t2 && t2.nativeDate) {
|
|
2024
|
-
const e3 = /* @__PURE__ */ new Date(0);
|
|
2025
|
-
return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
|
|
2026
|
-
}
|
|
2027
|
-
return [s2, o2, l2, d2, m2, u2];
|
|
2028
|
-
}
|
|
2029
|
-
__name(I, "I");
|
|
2030
|
-
function O(e2) {
|
|
2031
|
-
return !!(e2[0] && e2[0].percent || e2[1] && e2[1].percent || e2[2] && e2[2].percent || e2[3] && e2[3].percent);
|
|
2032
|
-
}
|
|
2033
|
-
__name(O, "O");
|
|
2034
|
-
function J(e2) {
|
|
2035
|
-
return !!(e2[0] && e2[0].date || e2[1] && e2[1].date || e2[2] && e2[2].date || e2[3] && e2[3].date);
|
|
2036
|
-
}
|
|
2037
|
-
__name(J, "J");
|
|
2038
|
-
function L(e2) {
|
|
2039
|
-
const [t2, n2, a2, r2] = e2;
|
|
2040
|
-
return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
|
|
2041
|
-
}
|
|
2042
|
-
__name(L, "L");
|
|
2043
|
-
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
|
|
2044
|
-
function B(e2, t2, n2, a2) {
|
|
2045
|
-
const r2 = 0 | n2;
|
|
2046
|
-
if (typeof n2 == "string") e2.push(n2);
|
|
2047
|
-
else if (n2 === r2) e2.push(Math.abs(r2));
|
|
2048
|
-
else {
|
|
2049
|
-
const t3 = Math.abs(n2);
|
|
2050
|
-
let r3 = t3 ? Math.floor(Math.log10(t3)) : 0, i2 = r3 < 0 ? t3 * 10 ** -r3 : t3 / 10 ** r3;
|
|
2051
|
-
i2 === 10 && (i2 = 1, r3++);
|
|
2052
|
-
const s2 = function(e3) {
|
|
2053
|
-
let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
2054
|
-
const n3 = Math.abs(e3);
|
|
2055
|
-
if (!n3) return G;
|
|
2056
|
-
const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
|
|
2057
|
-
let s3 = 0, o3 = 0;
|
|
2058
|
-
if (r4 !== n3) {
|
|
2059
|
-
s3 = 1;
|
|
2060
|
-
const e4 = String(c(i3 < 0 ? n3 * 10 ** -i3 : n3 / 10 ** i3, 15));
|
|
2061
|
-
let t5 = e4.length, a4 = !0, r5 = 0;
|
|
2062
|
-
for (; r5 <= e4.length; ) {
|
|
2063
|
-
if (e4[r5] === ".") {
|
|
2064
|
-
t5--;
|
|
2065
|
-
break;
|
|
2066
|
-
}
|
|
2067
|
-
e4[r5] === "0" && a4 ? t5-- : a4 = !1, r5++;
|
|
2068
|
-
}
|
|
2069
|
-
o3 = t5 - i3, o3 < 0 && (o3 = 0, s3 = 0);
|
|
2070
|
-
}
|
|
2071
|
-
return { total: a3 + Math.max(i3, 1) + s3 + o3, digits: Math.max(i3, 0) + o3, sign: a3, period: s3, int: Math.max(i3, 1), frac: o3 };
|
|
2072
|
-
}(t3), o2 = /* @__PURE__ */ __name(() => {
|
|
2073
|
-
const t4 = Math.abs(r3);
|
|
2074
|
-
let n3;
|
|
2075
|
-
n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(H(n3 + "", a2), a2.exponent, r3 < 0 ? a2.negative : a2.positive, t4 < 10 ? "0" : "", t4);
|
|
2076
|
-
}, "o");
|
|
2077
|
-
if (r3 >= -4 && r3 <= -1) {
|
|
2078
|
-
const n3 = t3.toPrecision(10 + r3).replace(/\.?0+$/, "");
|
|
2079
|
-
e2.push(H(n3, a2));
|
|
2080
|
-
} else if (r3 === 10) {
|
|
2081
|
-
const n3 = t3.toFixed(10).slice(0, 12).replace(/\.$/, "");
|
|
2082
|
-
e2.push(H(n3, a2));
|
|
2083
|
-
} else if (Math.abs(r3) <= 9) if (s2.total <= 11) {
|
|
2084
|
-
const n3 = c(t3, 9).toFixed(s2.frac);
|
|
2085
|
-
e2.push(H(n3, a2));
|
|
2086
|
-
} else r3 === 9 ? e2.push(Math.floor(t3)) : r3 >= 0 && r3 < 9 ? e2.push(c(t3, 9 - r3)) : o2();
|
|
2087
|
-
else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(H(c(t3, 9).toFixed(s2.frac), a2));
|
|
2088
|
-
}
|
|
2089
|
-
return e2;
|
|
2090
|
-
}
|
|
2091
|
-
__name(B, "B");
|
|
2092
|
-
const $ = 86400, W = { int: "integer", frac: "fraction", man: "mantissa", num: "numerator", den: "denominator" }, Z = /* @__PURE__ */ __name(function(e2) {
|
|
2093
|
-
let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
2094
|
-
const n2 = Math.floor(Math.log10(e2));
|
|
2095
|
-
return t2 > 1 ? Math.floor(n2 / t2) * t2 : n2;
|
|
2096
|
-
}, "Z");
|
|
2097
|
-
function K(e2, t2, n2, a2) {
|
|
2098
|
-
let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1, _2 = 0, b2 = 0, j2 = 0, v2 = 0, M2 = 0, k2 = 0;
|
|
2099
|
-
const x2 = a2 || u;
|
|
2100
|
-
if (!t2.text && isFinite(t2.scale) && t2.scale !== 1 && (e2 = function(e3) {
|
|
2101
|
-
if (e3 === 0) return e3;
|
|
2102
|
-
const t3 = Math.ceil(Math.log10(e3 < 0 ? -e3 : e3)), n3 = 10 ** (16 - Math.floor(t3));
|
|
2103
|
-
return Math.round(e3 * n3) / n3;
|
|
2104
|
-
}(e2 * t2.scale)), t2.exponential) {
|
|
2105
|
-
let n3 = Math.abs(e2);
|
|
2106
|
-
if (n3) {
|
|
2107
|
-
const e3 = 10 ** -Z(n3, t2.int_max), a3 = c(n3 * e3, t2.frac_max) / e3;
|
|
2108
|
-
d2 = Z(a3, t2.int_max);
|
|
2109
|
-
}
|
|
2110
|
-
n3 /= 10 ** d2, e2 = e2 < 0 ? -n3 : n3, r2 += Math.abs(d2);
|
|
2111
|
-
}
|
|
2112
|
-
if (t2.integer) {
|
|
2113
|
-
const n3 = Math.abs(c(e2, t2.fractions ? 1 : t2.frac_max));
|
|
2114
|
-
l2 += n3 < 1 ? "" : Math.floor(n3);
|
|
2115
|
-
}
|
|
2116
|
-
if (t2.grouping) {
|
|
2117
|
-
let e3 = "", n3 = l2.length;
|
|
2118
|
-
for (n3 > t2.group_pri && (n3 -= t2.group_pri, e3 = x2.group + l2.slice(n3, n3 + t2.group_pri) + e3); n3 > t2.group_sec; ) n3 -= t2.group_sec, e3 = x2.group + l2.slice(n3, n3 + t2.group_sec) + e3;
|
|
2119
|
-
l2 = n3 ? l2.slice(0, n3) + e3 : e3;
|
|
2120
|
-
}
|
|
2121
|
-
t2.dec_fractions && (o2 = String(c(e2, t2.frac_max)).split(".")[1] || "");
|
|
2122
|
-
let F2 = !1;
|
|
2123
|
-
if (t2.fractions) {
|
|
2124
|
-
const n3 = Math.abs(t2.integer ? e2 % 1 : e2);
|
|
2125
|
-
if (n3) if (F2 = !0, isFinite(t2.denominator)) s2 += t2.denominator, i2 += c(n3 * t2.denominator), i2 === "0" && (i2 = "", s2 = "", F2 = !1, l2 || (l2 = "0"));
|
|
2126
|
-
else {
|
|
2127
|
-
const e3 = p(n3, t2.integer ? t2.num_max : 1 / 0, t2.den_max);
|
|
2128
|
-
i2 += e3[0], s2 += e3[1], t2.integer && i2 === "0" && (l2 || (l2 = "0"), i2 = "", s2 = "", F2 = !1);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
if (t2.date) {
|
|
2132
|
-
m2 = Math.trunc(e2);
|
|
2133
|
-
const a3 = $ * (e2 - m2);
|
|
2134
|
-
if (f2 = Math.floor(a3), k2 = a3 - f2, Math.abs(k2) < 1e-6 ? k2 = 0 : k2 > 0.9999 && (k2 = 0, f2 += 1, f2 === $ && (f2 = 0, m2 += 1)), k2) {
|
|
2135
|
-
const e3 = 512 & t2.date || 256 & t2.date || 128 & t2.date;
|
|
2136
|
-
(e3 === 512 && k2 > 0.9995 || e3 === 256 && k2 > 0.995 || e3 === 128 && k2 > 0.95 || !e3 && k2 >= 0.5) && (f2++, k2 = 0);
|
|
2137
|
-
}
|
|
2138
|
-
if (m2 || t2.date_system) {
|
|
2139
|
-
const a4 = Y(e2, t2.date_system, n2.leap1900);
|
|
2140
|
-
g2 = a4[0], h2 = a4[1], _2 = a4[2];
|
|
2141
|
-
}
|
|
2142
|
-
if (f2) {
|
|
2143
|
-
const e3 = f2 < 0 ? $ + f2 : f2;
|
|
2144
|
-
M2 = Math.floor(e3) % 60, v2 = Math.floor(e3 / 60) % 60, j2 = Math.floor(e3 / 60 / 60) % 60;
|
|
2145
|
-
}
|
|
2146
|
-
if (b2 = (6 + m2) % 7, t2.date_eval && (z2 = e2, w2 = m2 + f2 / $, n2.dateSpanLarge ? z2 < -694324 || w2 >= 35830291 : z2 < 0 || w2 >= 2958466)) {
|
|
2147
|
-
if (n2.dateErrorThrows) throw new Error("Date out of bounds");
|
|
2148
|
-
return n2.dateErrorNumber ? B(e2 < 0 ? [x2.negative] : [], 0, e2, x2).join("") : n2.overflow;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
var z2, w2;
|
|
2152
|
-
if (t2.int_padding && (l2 = t2.int_padding.length === 1 ? l2 || t2.int_padding : t2.int_padding.substring(0, t2.int_padding.length - l2.length) + l2), t2.num_padding && (i2 = t2.num_padding.length === 1 ? i2 || t2.num_padding : t2.num_padding.substring(0, t2.num_padding.length - i2.length) + i2), t2.den_padding && (s2 = t2.den_padding.length === 1 ? s2 || t2.den_padding : s2 + t2.den_padding.slice(s2.length)), t2.man_padding) {
|
|
2153
|
-
const e3 = t2.exp_plus ? "+" : "";
|
|
2154
|
-
r2 = t2.man_padding.length === 1 ? (d2 < 0 ? "-" : e3) + (r2 || t2.man_padding) : (d2 < 0 ? "-" : e3) + t2.man_padding.slice(0, t2.man_padding.length - r2.length) + r2;
|
|
2155
|
-
}
|
|
2156
|
-
const D2 = [];
|
|
2157
|
-
let S2 = 0;
|
|
2158
|
-
const C2 = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
|
|
2159
|
-
for (let d3 = 0, u2 = t2.tokens.length; d3 < u2; d3++) {
|
|
2160
|
-
const u3 = t2.tokens[d3], c2 = u3.num ? u3.num.length : 0;
|
|
2161
|
-
if (u3.type === "string") u3.rule ? u3.rule === "num" ? F2 ? D2.push(u3.value) : (t2.num_min > 0 || t2.den_min > 0) && D2.push(u3.value.replace(/./g, y["?"])) : u3.rule === "num+int" ? F2 && l2 ? D2.push(u3.value) : t2.den_min > 0 && (l2 || t2.num_min) && D2.push(u3.value.replace(/./g, y["?"])) : u3.rule === "den" && (F2 ? D2.push(u3.value) : (t2.den_min > 0 || t2.den_min > 0) && D2.push(u3.value.replace(/./g, y["?"]))) : D2.push(u3.value);
|
|
2162
|
-
else if (u3.type === "error") D2.push(n2.invalid);
|
|
2163
|
-
else if (u3.type === "point") D2.push(t2.date ? u3.value : x2.decimal);
|
|
2164
|
-
else if (u3.type === "general") B(D2, 0, e2, x2);
|
|
2165
|
-
else if (u3.type === "exp") D2.push(x2.exponent);
|
|
2166
|
-
else if (u3.type === "minus") u3.volatile && t2.date || u3.volatile && (e2 >= 0 || typeof e2 != "number") || (u3.volatile && !t2.fractions && (t2.integer || t2.dec_fractions) ? (e2 < 0 && l2 && l2 !== "0" || o2) && D2.push(x2.negative) : D2.push(x2.negative));
|
|
2167
|
-
else if (u3.type === "plus") D2.push(x2.positive);
|
|
2168
|
-
else if (u3.type === "text") D2.push(e2);
|
|
2169
|
-
else if (u3.type === "div") F2 ? D2.push("/") : t2.num_min > 0 || t2.den_min > 0 ? D2.push(y["?"]) : D2.push(y["#"]);
|
|
2170
|
-
else if (u3.type === "int") if (t2.int_pattern.length === 1) D2.push(l2);
|
|
2171
|
-
else {
|
|
2172
|
-
const e3 = S2 ? t2.int_pattern.join("").length - C2.int : 1 / 0, n3 = S2 === t2.int_pattern.length - 1 ? 0 : t2.int_pattern.join("").length - (C2.int + u3.num.length);
|
|
2173
|
-
D2.push(l2.substring(l2.length - e3, l2.length - n3)), S2++, C2.int += u3.num.length;
|
|
2174
|
-
}
|
|
2175
|
-
else if (u3.type === "frac") {
|
|
2176
|
-
const e3 = C2.frac;
|
|
2177
|
-
for (let t3 = 0; t3 < c2; t3++) D2.push(o2[t3 + e3] || y[u3.num[t3]]);
|
|
2178
|
-
C2.frac += c2;
|
|
2179
|
-
} else if (u3.type in W) t2[u3.type + "_pattern"].length === 1 ? (u3.type === "int" && D2.push(l2), u3.type === "frac" && D2.push(o2), u3.type === "man" && D2.push(r2), u3.type === "num" && D2.push(i2), u3.type === "den" && D2.push(s2)) : (D2.push(W[u3.type].slice(C2[u3.type], C2[u3.type] + c2)), C2[u3.type] += c2);
|
|
2180
|
-
else if (u3.type === "year") g2 < 0 && D2.push(x2.negative), D2.push(String(Math.abs(g2)).padStart(4, "0"));
|
|
2181
|
-
else if (u3.type === "year-short") {
|
|
2182
|
-
const e3 = g2 % 100;
|
|
2183
|
-
D2.push(e3 < 10 ? "0" : "", e3);
|
|
2184
|
-
} else if (u3.type === "month") D2.push(u3.pad && h2 < 10 ? "0" : "", h2);
|
|
2185
|
-
else if (u3.type === "monthname-single") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1].charAt(0)) : D2.push(x2.mmmm[h2 - 1].charAt(0));
|
|
2186
|
-
else if (u3.type === "monthname-short") t2.date_system === 6 ? D2.push(x2.mmm6[h2 - 1]) : D2.push(x2.mmm[h2 - 1]);
|
|
2187
|
-
else if (u3.type === "monthname") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1]) : D2.push(x2.mmmm[h2 - 1]);
|
|
2188
|
-
else if (u3.type === "weekday-short") D2.push(x2.ddd[b2]);
|
|
2189
|
-
else if (u3.type === "weekday") D2.push(x2.dddd[b2]);
|
|
2190
|
-
else if (u3.type === "day") D2.push(u3.pad && _2 < 10 ? "0" : "", _2);
|
|
2191
|
-
else if (u3.type === "hour") {
|
|
2192
|
-
const e3 = j2 % t2.clock || (t2.clock < 24 ? t2.clock : 0);
|
|
2193
|
-
D2.push(u3.pad && e3 < 10 ? "0" : "", e3);
|
|
2194
|
-
} else if (u3.type === "min") D2.push(u3.pad && v2 < 10 ? "0" : "", v2);
|
|
2195
|
-
else if (u3.type === "sec") D2.push(u3.pad && M2 < 10 ? "0" : "", M2);
|
|
2196
|
-
else if (u3.type === "subsec") {
|
|
2197
|
-
D2.push(x2.decimal);
|
|
2198
|
-
const e3 = k2.toFixed(t2.sec_decimals);
|
|
2199
|
-
D2.push(e3.slice(2, 2 + u3.decimals));
|
|
2200
|
-
} else if (u3.type === "am") {
|
|
2201
|
-
const e3 = j2 < 12 ? 0 : 1;
|
|
2202
|
-
u3.short && !a2 ? D2.push("AP"[e3]) : D2.push(x2.ampm[e3]);
|
|
2203
|
-
} else if (u3.type === "hour-elap") {
|
|
2204
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2205
|
-
const t3 = 24 * m2 + Math.floor(Math.abs(f2) / 3600);
|
|
2206
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2207
|
-
} else if (u3.type === "min-elap") {
|
|
2208
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2209
|
-
const t3 = 1440 * m2 + Math.floor(Math.abs(f2) / 60);
|
|
2210
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2211
|
-
} else if (u3.type === "sec-elap") {
|
|
2212
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2213
|
-
const t3 = m2 * $ + Math.abs(f2);
|
|
2214
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2215
|
-
} else if (u3.type === "b-year") D2.push(g2 + 543);
|
|
2216
|
-
else if (u3.type === "b-year-short") {
|
|
2217
|
-
const e3 = (g2 + 543) % 100;
|
|
2218
|
-
D2.push(e3 < 10 ? "0" : "", e3);
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return n2.nbsp ? D2.join("") : D2.join("").replace(/\u00a0/g, " ");
|
|
2222
|
-
}
|
|
2223
|
-
__name(K, "K");
|
|
2224
|
-
function q(e2, t2) {
|
|
2225
|
-
for (let n2 = 0; n2 < 3; n2++) {
|
|
2226
|
-
const a2 = t2[n2];
|
|
2227
|
-
if (a2) {
|
|
2228
|
-
let t3;
|
|
2229
|
-
if (a2.condition) {
|
|
2230
|
-
const n3 = a2.condition[0], r2 = a2.condition[1];
|
|
2231
|
-
n3 === "=" ? t3 = e2 === r2 : n3 === ">" ? t3 = e2 > r2 : n3 === "<" ? t3 = e2 < r2 : n3 === ">=" ? t3 = e2 >= r2 : n3 === "<=" ? t3 = e2 <= r2 : n3 === "<>" && (t3 = e2 !== r2);
|
|
2232
|
-
} else t3 = !0;
|
|
2233
|
-
if (t3) return a2;
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
__name(q, "q");
|
|
2238
|
-
const V = z("@"), Q = "black", X = {};
|
|
2239
|
-
function ee(e2, t2) {
|
|
2240
|
-
if (e2) {
|
|
2241
|
-
const n2 = e2[0];
|
|
2242
|
-
t2[n2] = t2[n2] || {}, ee(e2.slice(1), t2[n2]);
|
|
2243
|
-
} else t2.$ = !0;
|
|
2244
|
-
}
|
|
2245
|
-
__name(ee, "ee"), ["d-F-y", "d-F-Y", "d-M-y", "d-M-Y", "F-d-y", "F-d-Y", "F-j-y", "F-j-Y", "j-F-y", "j-F-Y", "j-M-y", "j-M-Y", "M-d-y", "M-d-Y", "M-j-y", "M-j-Y", "m-d-y", "m-d-Y", "m-j-y", "m-j-Y", "n-d-y", "n-d-Y", "n-j-y", "n-j-Y", "y-F-d", "y-F-j", "y-M-d", "y-M-j", "Y-F-d", "Y-F-j", "Y-M-d", "Y-m-d", "Y-M-j", "Y-m-j", "Y-n-d", "Y-n-j", "j-F", "j-M", "d-F", "d-M", "n-d", "n-j", "n-Y", "m-d", "m-j", "m-Y", "M-Y", "M-y", "F-y", "F-Y", "Y-M", "Y-n", "Y-m", "Y-F", "Y-M"].forEach((e2) => {
|
|
2246
|
-
ee(e2, X), ee(e2 + " x", X), ee(e2 + " l", X), ee(e2 + " l x", X), ee("l " + e2, X), ee("l " + e2 + " x", X), ee(e2 + " D", X), ee(e2 + " D x", X), ee("D " + e2, X), ee("D " + e2 + " x", X);
|
|
2247
|
-
});
|
|
2248
|
-
const te = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, ne = { january: 1, february: 2, march: 3, april: 4, june: 6, july: 7, august: 8, september: 9, october: 10, november: 11, december: 12 }, ae = { sunday: "l", monday: "l", tuesday: "l", wednesday: "l", thursday: "l", friday: "l", saturday: "l", sun: "D", mon: "D", tue: "D", wed: "D", thu: "D", fri: "D", sat: "D" }, re = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
2249
|
-
function ie(e2) {
|
|
2250
|
-
const t2 = new RegExp("^([\\s+%" + j.join("") + "(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%" + j.join("") + ")]*)$").exec(e2);
|
|
2251
|
-
if (t2) {
|
|
2252
|
-
const [, e3, n2, a2, r2, i2] = t2;
|
|
2253
|
-
let s2 = 1, o2 = "", l2 = !1, d2 = !1, m2 = !1, u2 = !1, c2 = !1, p2 = null, f2 = !1, g2 = parseFloat(n2.replace(/,/g, ""));
|
|
2254
|
-
if (!isFinite(g2)) return null;
|
|
2255
|
-
for (let t3 = 0; t3 < e3.length; t3++) {
|
|
2256
|
-
const n3 = e3[t3];
|
|
2257
|
-
if (n3 === "-") {
|
|
2258
|
-
if (l2 || d2) return null;
|
|
2259
|
-
l2 = !0, s2 = -1;
|
|
2260
|
-
} else if (v.test(n3)) {
|
|
2261
|
-
if (c2) return null;
|
|
2262
|
-
c2 = !0, p2 = n3;
|
|
2263
|
-
} else if (n3 === "(") {
|
|
2264
|
-
if (d2 || l2) return null;
|
|
2265
|
-
d2 = !0, s2 = -1;
|
|
2266
|
-
} else if (n3 === "%") {
|
|
2267
|
-
if (u2) return null;
|
|
2268
|
-
u2 = !0;
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
for (let e4 = 0; e4 < i2.length; e4++) {
|
|
2272
|
-
const t3 = i2[e4];
|
|
2273
|
-
if (v.test(t3)) {
|
|
2274
|
-
if (c2) return null;
|
|
2275
|
-
c2 = !0, p2 = t3, f2 = !0;
|
|
2276
|
-
} else if (t3 === ")") {
|
|
2277
|
-
if (m2 || !d2) return null;
|
|
2278
|
-
m2 = !0;
|
|
2279
|
-
} else if (t3 === "%") {
|
|
2280
|
-
if (u2) return null;
|
|
2281
|
-
u2 = !0;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
if (r2) {
|
|
2285
|
-
if (u2 || c2) return null;
|
|
2286
|
-
o2 = "0.00E+00";
|
|
2287
|
-
} else if (u2) {
|
|
2288
|
-
if (c2) return null;
|
|
2289
|
-
o2 = a2.includes(".") ? "0.00%" : "0%", g2 *= 0.01;
|
|
2290
|
-
} else if (c2) {
|
|
2291
|
-
const e4 = a2.includes(".") ? "#,##0.00" : "#,##0";
|
|
2292
|
-
o2 = f2 ? e4 + p2 : p2 + e4;
|
|
2293
|
-
} else a2.includes(",") && (o2 = a2.includes(".") ? "#,##0.00" : "#,##0");
|
|
2294
|
-
const h2 = { v: g2 * s2 };
|
|
2295
|
-
return o2 && (h2.z = o2), h2;
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
__name(ie, "ie");
|
|
2299
|
-
const se = /* @__PURE__ */ __name((e2, t2, n2) => {
|
|
2300
|
-
const a2 = n2.path || "", r2 = Object.keys(t2);
|
|
2301
|
-
for (let i2 = 0; i2 < r2.length; i2++) {
|
|
2302
|
-
let s2;
|
|
2303
|
-
const o2 = r2[i2];
|
|
2304
|
-
if (t2[o2]) {
|
|
2305
|
-
if (o2 === "$" || o2 === "€") e2 || (s2 = n2);
|
|
2306
|
-
else if (o2 === "-") {
|
|
2307
|
-
const r3 = /^(\s*([./-]|,\s)\s*|\s+)/.exec(e2);
|
|
2308
|
-
if (r3) {
|
|
2309
|
-
const i3 = r3[1] === "-" || r3[1] === "/" || r3[1] === "." ? r3[1] : " ";
|
|
2310
|
-
if (!n2.sep || n2.sep === i3) {
|
|
2311
|
-
const l2 = r3[0].replace(/\s+/g, " ");
|
|
2312
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, sep: i3, path: a2 + l2 });
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
} else if (o2 === " ") {
|
|
2316
|
-
const r3 = /^[,.]?\s+/.exec(e2);
|
|
2317
|
-
if (r3) {
|
|
2318
|
-
const i3 = r3[0].replace(/\s+/g, " ");
|
|
2319
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, path: a2 + i3 });
|
|
2320
|
-
}
|
|
2321
|
-
} else if (o2 === "j" || o2 === "d") {
|
|
2322
|
-
const r3 = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e2);
|
|
2323
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, day: r3[0], path: a2 + o2 }));
|
|
2324
|
-
} else if (o2 === "n" || o2 === "m") {
|
|
2325
|
-
const r3 = /^(0?[1-9]|1[012])\b/.exec(e2);
|
|
2326
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, month: +r3[0], _mon: r3[0], path: a2 + o2 }));
|
|
2327
|
-
} else if (o2 === "F" || o2 === "M") {
|
|
2328
|
-
const r3 = /^([a-z]{3,9})\b/i.exec(e2), i3 = r3 && (o2 === "F" ? ne : te)[r3[0].toLowerCase()];
|
|
2329
|
-
i3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, month: i3, _mon: r3[0], path: a2 + o2 }));
|
|
2330
|
-
} else if (o2 === "l" || o2 === "D") {
|
|
2331
|
-
const r3 = /^([a-z]{3,9})\b/i.exec(e2);
|
|
2332
|
-
(r3 && ae[r3[0].toLowerCase()]) === o2 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, path: a2 + o2 }));
|
|
2333
|
-
} else if (o2 === "y") {
|
|
2334
|
-
const r3 = /^\d\d\b/.exec(e2);
|
|
2335
|
-
if (r3) {
|
|
2336
|
-
const i3 = +r3[0] >= 30 ? +r3[0] + 1900 : +r3[0] + 2e3;
|
|
2337
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, year: i3, path: a2 + o2 });
|
|
2338
|
-
}
|
|
2339
|
-
} else if (o2 === "Y") {
|
|
2340
|
-
const r3 = /^\d\d\d\d\b/.exec(e2);
|
|
2341
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, year: +r3[0], path: a2 + o2 }));
|
|
2342
|
-
} else {
|
|
2343
|
-
if (o2 !== "x") throw new Error('Unknown date token "'.concat(o2, '"'));
|
|
2344
|
-
{
|
|
2345
|
-
const r3 = le(e2);
|
|
2346
|
-
r3 && (s2 = se("", t2[o2], { ...n2, time: r3.v, tf: r3.z, path: a2 + o2 }));
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
if (s2) return s2;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}, "se");
|
|
2353
|
-
function oe(e2, t2) {
|
|
2354
|
-
const n2 = se(e2.trim(), X, { path: "" });
|
|
2355
|
-
if (n2) {
|
|
2356
|
-
var a2;
|
|
2357
|
-
if (n2.sep === "." && n2.path.length === 3) return null;
|
|
2358
|
-
const e3 = +((a2 = n2.year) !== null && a2 !== void 0 ? a2 : re);
|
|
2359
|
-
if (n2.day || (n2.day = 1), !function(e4, t3, n3) {
|
|
2360
|
-
if (n3 < 1 || t3 < 1 || t3 > 12) return !1;
|
|
2361
|
-
if (t3 === 2) {
|
|
2362
|
-
if (n3 > (e4 % 4 == 0 && e4 % 100 != 0 || e4 % 400 == 0 || e4 === 1900 ? 29 : 28)) return !1;
|
|
2363
|
-
} else if ((t3 === 4 || t3 === 6 || t3 === 9 || t3 === 11) && n3 > 30 || (t3 === 1 || t3 === 3 || t3 === 5 || t3 === 7 || t3 === 8 || t3 === 10 || t3 === 12) && n3 > 31) return !1;
|
|
2364
|
-
return !0;
|
|
2365
|
-
}(e3, n2.month, n2.day)) return null;
|
|
2366
|
-
let r2 = -1 / 0;
|
|
2367
|
-
if (e3 < 1900) return null;
|
|
2368
|
-
e3 <= 1900 && n2.month <= 2 ? r2 = 25568 : e3 < 1e4 && (r2 = 25569);
|
|
2369
|
-
const i2 = Date.UTC(e3, n2.month - 1, n2.day) / 864e5 + r2 + (n2.time || 0);
|
|
2370
|
-
if (i2 >= 0 && i2 <= 2958465) {
|
|
2371
|
-
const e4 = n2._mon[0] === "0" || n2.day[0] === "0" || n2._mon.length === 2 && n2.day.length === 2, a3 = n2.path.replace(/[jdlDnmMFyYx-]/g, (t3) => t3 === "j" || t3 === "d" ? e4 ? "dd" : "d" : t3 === "D" ? "ddd" : t3 === "l" ? "dddd" : t3 === "n" || t3 === "m" ? e4 ? "mm" : "m" : t3 === "M" ? "mmm" : t3 === "F" ? "mmmm" : t3 === "y" ? "yy" : t3 === "x" ? n2.tf || "" : t3 === "Y" ? "yyyy" : t3);
|
|
2372
|
-
return t2 && t2.nativeDate ? { v: I(i2, t2), z: a3 } : { v: i2, z: a3 };
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
return null;
|
|
2376
|
-
}
|
|
2377
|
-
__name(oe, "oe");
|
|
2378
|
-
function le(e2) {
|
|
2379
|
-
const t2 = /^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(e2);
|
|
2380
|
-
if (t2) {
|
|
2381
|
-
const [, e3, n2, a2, r2, i2] = t2;
|
|
2382
|
-
if (r2 && !a2 || !i2 && !n2 && !a2) return null;
|
|
2383
|
-
let s2 = 1 * (e3 || 0);
|
|
2384
|
-
if (i2) {
|
|
2385
|
-
if (s2 >= 13) return null;
|
|
2386
|
-
i2[0] !== "p" && i2[0] !== "P" || (s2 += 12);
|
|
2387
|
-
}
|
|
2388
|
-
return { v: (60 * s2 * 60 + 60 * (1 * (n2 || 0)) + 1 * (a2 || 0) + 1 * (r2 || 0)) / 86400, z: (e3.length === 2 ? "hh" : "h") + ":mm" + (a2 ? ":ss" : "") + (i2 ? " AM/PM" : "") };
|
|
2389
|
-
}
|
|
2390
|
-
return null;
|
|
2391
|
-
}
|
|
2392
|
-
__name(le, "le");
|
|
2393
|
-
function de(e2) {
|
|
2394
|
-
return /^\s*true\s*$/i.test(e2) ? { v: !0 } : /^\s*false\s*$/i.test(e2) ? { v: !1 } : null;
|
|
2395
|
-
}
|
|
2396
|
-
__name(de, "de");
|
|
2397
|
-
const me = {};
|
|
2398
|
-
function ue(e2, t2) {
|
|
2399
|
-
const { pattern: n2, partitions: a2, locale: r2 } = e2, i2 = /* @__PURE__ */ __name((e3) => {
|
|
2400
|
-
const n3 = Object.assign({}, h(), t2, e3);
|
|
2401
|
-
return r2 && (n3.locale = r2), n3;
|
|
2402
|
-
}, "i"), s2 = /* @__PURE__ */ __name((e3, t3) => {
|
|
2403
|
-
const n3 = i2(t3);
|
|
2404
|
-
return function(e4, t4, n4) {
|
|
2405
|
-
const a3 = l(n4.locale), r3 = t4[3] ? t4[3] : V;
|
|
2406
|
-
if (typeof e4 == "boolean" && (e4 = e4 ? "TRUE" : "FALSE"), e4 == null) return "";
|
|
2407
|
-
if (typeof e4 != "number") return K(e4, r3, n4, a3);
|
|
2408
|
-
if (!isFinite(e4)) {
|
|
2409
|
-
const t5 = a3 || u;
|
|
2410
|
-
return isNaN(e4) ? t5.nan : (e4 < 0 ? t5.negative : "") + t5.infinity;
|
|
2411
|
-
}
|
|
2412
|
-
const i3 = q(e4, t4);
|
|
2413
|
-
return i3 ? K(e4, i3, n4, a3) : n4.overflow;
|
|
2414
|
-
}(P(e3, n3), a2, n3);
|
|
2415
|
-
}, "s");
|
|
2416
|
-
s2.color = (e3, t3) => function(e4, t4) {
|
|
2417
|
-
if (typeof e4 != "number" || !isFinite(e4)) return (t4[3] ? t4[3].color : V.color) || Q;
|
|
2418
|
-
const n3 = q(e4, t4);
|
|
2419
|
-
return n3 && n3.color || Q;
|
|
2420
|
-
}(P(e3, i2(t3)), a2);
|
|
2421
|
-
const o2 = function(e3) {
|
|
2422
|
-
var t3;
|
|
2423
|
-
let n3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
2424
|
-
const [a3, r3] = e3, i3 = a3.frac_max, s3 = { type: "general", isDate: J(e3), isText: L(e3), isPercent: O(e3), maxDecimals: a3.general ? 9 : i3, scale: (t3 = a3.scale) !== null && t3 !== void 0 ? t3 : 1, color: 0, parentheses: 0, grouped: a3.grouping ? 1 : 0, _partitions: e3 }, o3 = !s3.isDate && !s3.isText && !a3.error && a3.tokens.some((e4) => e4.type === "string" && (n3 ? e4.value === n3 : v.test(e4.value)));
|
|
2425
|
-
let l2 = "G", d2 = i3 >= 0 ? Math.min(15, i3) : "", m2 = "", u2 = "";
|
|
2426
|
-
if (r3 && r3.color && (u2 = "-", s3.color = 1), a3.parens && (m2 = "()", s3.parentheses = 1), o3) l2 = "C", s3.type = "currency";
|
|
2427
|
-
else if (a3.error) s3.type = "error", s3.maxDecimals = 0;
|
|
2428
|
-
else if (s3.isDate) {
|
|
2429
|
-
let e4 = 0, t4 = 0, n4 = "";
|
|
2430
|
-
a3.tokens.forEach((a4) => {
|
|
2431
|
-
const r5 = a4.type;
|
|
2432
|
-
/^(b-)?year/.test(r5) ? (n4 += "Y", t4++) : r5.startsWith("month") ? (n4 += "M", t4++) : /^(week)?day/.test(r5) ? (n4 += "D", t4++) : r5 !== "hour" && r5 !== "min" && r5 !== "sec" && r5 !== "am" || (n4 += r5[0], e4++);
|
|
2433
|
-
}), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
|
|
2434
|
-
const r4 = R.find((e5) => n4.startsWith(e5[0]));
|
|
2435
|
-
l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
|
|
2436
|
-
} else s3.isText ? (l2 = "G", s3.type = "text", d2 = "", s3.maxDecimals = 0) : a3.general ? (l2 = "G", s3.type = "general", d2 = "") : a3.fractions ? (l2 = "G", s3.type = "fraction", d2 = "") : a3.exponential ? (l2 = "S", s3.type = "scientific") : s3.isPercent ? (l2 = "P", s3.type = "percent") : a3.grouping ? (l2 = ",", s3.type = "grouped") : (a3.int_max || i3) && (l2 = "F", s3.type = "number");
|
|
2437
|
-
return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
|
|
2438
|
-
}(a2, (t2 || {}).currency) || new SyntaxError();
|
|
2439
|
-
return s2.info = o2, s2.dateInfo = function(e3) {
|
|
2440
|
-
const [t3] = e3;
|
|
2441
|
-
return { year: !!(2 & t3.date), month: !!(4 & t3.date), day: !!(8 & t3.date), hours: !!(16 & t3.date), minutes: !!(32 & t3.date), seconds: !!(64 & t3.date), clockType: t3.clock === 12 ? 12 : 24 };
|
|
2442
|
-
}(a2), s2.isPercent = () => !!o2.isPercent, s2.isDate = () => !!o2.isDate, s2.isText = () => !!o2.isText, s2.pattern = n2, e2.error && (s2.error = e2.error), s2.options = i2, s2.locale = r2 || t2 && t2.locale || "", Object.freeze(s2);
|
|
2443
|
-
}
|
|
2444
|
-
__name(ue, "ue");
|
|
2445
|
-
function ce(e2, t2) {
|
|
2446
|
-
e2 || (e2 = "General");
|
|
2447
|
-
let n2 = null;
|
|
2448
|
-
return me[e2] ? n2 = me[e2] : (n2 = Object.assign({}, h(), t2).throws ? D(e2) : function(e3) {
|
|
2449
|
-
try {
|
|
2450
|
-
return D(e3);
|
|
2451
|
-
} catch (t3) {
|
|
2452
|
-
const n3 = { tokens: [{ type: "error" }], error: t3.message };
|
|
2453
|
-
return { pattern: e3, partitions: [n3, n3, n3, n3], error: t3.message, locale: null };
|
|
2454
|
-
}
|
|
2455
|
-
}(e2), n2.error || (me[e2] = n2)), ue(n2, t2);
|
|
2456
|
-
}
|
|
2457
|
-
__name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial = I, ce.options = h, ce.dec2frac = p, ce.round = c, ce.codeToLocale = n, ce.parseLocale = s, ce.getLocale = l, ce.addLocale = (e2, t2) => {
|
|
2458
|
-
const n2 = s(t2);
|
|
2459
|
-
return delete me[n2.lang], delete me[n2.language], m(e2, n2);
|
|
2460
|
-
}, ce.format = function(e2, t2, n2) {
|
|
2461
|
-
let a2 = arguments.length > 3 && arguments[3] !== void 0 && arguments[3];
|
|
2462
|
-
const r2 = n2 && typeof n2 == "object" ? n2 : { locale: n2, throws: !a2 };
|
|
2463
|
-
return ce(e2, r2)(P(t2, r2), r2);
|
|
2464
|
-
}, ce.is_date = ce.isDate, ce.parseNumber = ie, ce.parseDate = oe, ce.parseTime = le, ce.parseBool = de, ce.parseValue = function(e2, t2) {
|
|
2465
|
-
var n2, a2, r2;
|
|
2466
|
-
return (n2 = (a2 = (r2 = ie(e2)) !== null && r2 !== void 0 ? r2 : oe(e2, t2)) !== null && a2 !== void 0 ? a2 : le(e2)) !== null && n2 !== void 0 ? n2 : de(e2);
|
|
2467
|
-
};
|
|
2468
|
-
var pe = ce;
|
|
2469
|
-
return t = t.default;
|
|
2470
|
-
}();
|
|
2471
|
-
});
|
|
2472
|
-
})(numfmt$2);
|
|
2473
|
-
var numfmtExports = numfmt$2.exports, numfmt = numfmtExports;
|
|
2474
|
-
const numfmt$1 = /* @__PURE__ */ getDefaultExportFromCjs(numfmt), currencySymbols = [
|
|
1711
|
+
const currencySymbols = [
|
|
2475
1712
|
"$",
|
|
2476
1713
|
"£",
|
|
2477
1714
|
"¥",
|
|
@@ -2532,7 +1769,7 @@ __name(handleNumfmtInCell, "handleNumfmtInCell");
|
|
|
2532
1769
|
function getNumberFormatType(pattern) {
|
|
2533
1770
|
if (isAccounting(pattern))
|
|
2534
1771
|
return 3;
|
|
2535
|
-
const type = numfmt
|
|
1772
|
+
const type = numfmt.getInfo(pattern).type || "unknown";
|
|
2536
1773
|
return NumberFormatTypeMap[type];
|
|
2537
1774
|
}
|
|
2538
1775
|
__name(getNumberFormatType, "getNumberFormatType");
|
|
@@ -4215,7 +3452,7 @@ const _ArrayValueObject = class _ArrayValueObject extends BaseValueObject {
|
|
|
4215
3452
|
column + startColumn,
|
|
4216
3453
|
currentValue.getErrorType(),
|
|
4217
3454
|
r + startRow
|
|
4218
|
-
) :
|
|
3455
|
+
) : CELL_INVERTED_INDEX_CACHE.set(
|
|
4219
3456
|
unitId,
|
|
4220
3457
|
sheetId,
|
|
4221
3458
|
column + startColumn,
|
|
@@ -4361,6 +3598,19 @@ function getCellValue(cell) {
|
|
|
4361
3598
|
return (cell == null ? void 0 : cell.v) || 0;
|
|
4362
3599
|
}
|
|
4363
3600
|
__name(getCellValue, "getCellValue");
|
|
3601
|
+
function getRuntimeFeatureCell(row, column, sheetId, unitId, runtimeFeatureCellData) {
|
|
3602
|
+
var _a24;
|
|
3603
|
+
const featureKeys = Object.keys(runtimeFeatureCellData);
|
|
3604
|
+
for (const featureId of featureKeys) {
|
|
3605
|
+
const data = runtimeFeatureCellData[featureId], CellData = (_a24 = data == null ? void 0 : data[unitId]) == null ? void 0 : _a24[sheetId];
|
|
3606
|
+
if (CellData == null)
|
|
3607
|
+
continue;
|
|
3608
|
+
const value = CellData.getValue(row, column);
|
|
3609
|
+
if (value != null)
|
|
3610
|
+
return value;
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
__name(getRuntimeFeatureCell, "getRuntimeFeatureCell");
|
|
4364
3614
|
const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT$1), _BaseReferenceObject = class _BaseReferenceObject extends ObjectClassType {
|
|
4365
3615
|
constructor(_token) {
|
|
4366
3616
|
super();
|
|
@@ -4635,16 +3885,7 @@ const FORMULA_CACHE_LRU_COUNT$1 = 1e5, FORMULA_REF_TO_ARRAY_CACHE = new FormulaA
|
|
|
4635
3885
|
return (activeRuntimeData == null ? void 0 : activeRuntimeData.getValue(row, column)) || (activeRuntimeArrayFormulaCellData == null ? void 0 : activeRuntimeArrayFormulaCellData.getValue(row, column)) || this.getRuntimeFeatureCellValue(row, column) || (activeArrayFormulaCellData == null ? void 0 : activeArrayFormulaCellData.getValue(row, column)) || (activeSheetData == null ? void 0 : activeSheetData.cellData.getValue(row, column));
|
|
4636
3886
|
}
|
|
4637
3887
|
getRuntimeFeatureCellValue(row, column) {
|
|
4638
|
-
|
|
4639
|
-
const featureKeys = Object.keys(this._runtimeFeatureCellData);
|
|
4640
|
-
for (const featureId of featureKeys) {
|
|
4641
|
-
const data = this._runtimeFeatureCellData[featureId], runtimeFeatureCellData = (_a24 = data == null ? void 0 : data[this.getUnitId()]) == null ? void 0 : _a24[this.getSheetId()];
|
|
4642
|
-
if (runtimeFeatureCellData == null)
|
|
4643
|
-
continue;
|
|
4644
|
-
const value = runtimeFeatureCellData.getValue(row, column);
|
|
4645
|
-
if (value != null)
|
|
4646
|
-
return value;
|
|
4647
|
-
}
|
|
3888
|
+
return getRuntimeFeatureCell(row, column, this.getSheetId(), this.getUnitId(), this._runtimeFeatureCellData);
|
|
4648
3889
|
}
|
|
4649
3890
|
getCellByPosition(row, column) {
|
|
4650
3891
|
row || (row = this._rangeData.startRow), column || (column = this._rangeData.startColumn);
|
|
@@ -5439,8 +4680,70 @@ const _VarS = class _VarS extends BaseFunction {
|
|
|
5439
4680
|
};
|
|
5440
4681
|
__name(_VarS, "VarS");
|
|
5441
4682
|
let VarS = _VarS;
|
|
4683
|
+
const _Rank = class _Rank extends BaseFunction {
|
|
4684
|
+
constructor() {
|
|
4685
|
+
super(...arguments);
|
|
4686
|
+
__publicField(this, "minParams", 2);
|
|
4687
|
+
__publicField(this, "maxParams", 3);
|
|
4688
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
4689
|
+
}
|
|
4690
|
+
calculate(number, ref, order) {
|
|
4691
|
+
let _number = number;
|
|
4692
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
4693
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
4694
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
4695
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
4696
|
+
const maxRowLength = Math.max(
|
|
4697
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
4698
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
4699
|
+
), maxColumnLength = Math.max(
|
|
4700
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
4701
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
4702
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
4703
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
4704
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
4705
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
4706
|
+
if (refHasError)
|
|
4707
|
+
return refErrorObject;
|
|
4708
|
+
if (orderObject.isError())
|
|
4709
|
+
return orderObject;
|
|
4710
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
4711
|
+
if (Number.isNaN(numberValue) || Number.isNaN(orderValue))
|
|
4712
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
4713
|
+
const result = refNumbers.sort((a, b) => orderValue ? a - b : b - a).indexOf(numberValue);
|
|
4714
|
+
return result === -1 ? ErrorValueObject.create(ErrorType$1.NA) : NumberValueObject.create(result + 1);
|
|
4715
|
+
});
|
|
4716
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
4717
|
+
}
|
|
4718
|
+
_checkRefReferenceObject(ref) {
|
|
4719
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
4720
|
+
const refNumbers = [];
|
|
4721
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
4722
|
+
const _refObject = refObject;
|
|
4723
|
+
if (_refObject.isError())
|
|
4724
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
4725
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
4726
|
+
return !0;
|
|
4727
|
+
const refValue = +_refObject.getValue();
|
|
4728
|
+
if (Number.isNaN(refValue))
|
|
4729
|
+
return !0;
|
|
4730
|
+
refNumbers.push(refValue);
|
|
4731
|
+
}), {
|
|
4732
|
+
refHasError,
|
|
4733
|
+
refErrorObject,
|
|
4734
|
+
refNumbers
|
|
4735
|
+
}) : {
|
|
4736
|
+
refHasError: !0,
|
|
4737
|
+
refErrorObject,
|
|
4738
|
+
refNumbers
|
|
4739
|
+
};
|
|
4740
|
+
}
|
|
4741
|
+
};
|
|
4742
|
+
__name(_Rank, "Rank");
|
|
4743
|
+
let Rank = _Rank;
|
|
5442
4744
|
var FUNCTION_NAMES_COMPATIBILITY = /* @__PURE__ */ ((FUNCTION_NAMES_COMPATIBILITY2) => (FUNCTION_NAMES_COMPATIBILITY2.BETADIST = "BETADIST", FUNCTION_NAMES_COMPATIBILITY2.BETAINV = "BETAINV", FUNCTION_NAMES_COMPATIBILITY2.BINOMDIST = "BINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIDIST = "CHIDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIINV = "CHIINV", FUNCTION_NAMES_COMPATIBILITY2.CHITEST = "CHITEST", FUNCTION_NAMES_COMPATIBILITY2.CONFIDENCE = "CONFIDENCE", FUNCTION_NAMES_COMPATIBILITY2.COVAR = "COVAR", FUNCTION_NAMES_COMPATIBILITY2.CRITBINOM = "CRITBINOM", FUNCTION_NAMES_COMPATIBILITY2.EXPONDIST = "EXPONDIST", FUNCTION_NAMES_COMPATIBILITY2.FDIST = "FDIST", FUNCTION_NAMES_COMPATIBILITY2.FINV = "FINV", FUNCTION_NAMES_COMPATIBILITY2.FTEST = "FTEST", FUNCTION_NAMES_COMPATIBILITY2.GAMMADIST = "GAMMADIST", FUNCTION_NAMES_COMPATIBILITY2.GAMMAINV = "GAMMAINV", FUNCTION_NAMES_COMPATIBILITY2.HYPGEOMDIST = "HYPGEOMDIST", FUNCTION_NAMES_COMPATIBILITY2.LOGINV = "LOGINV", FUNCTION_NAMES_COMPATIBILITY2.LOGNORMDIST = "LOGNORMDIST", FUNCTION_NAMES_COMPATIBILITY2.MODE = "MODE", FUNCTION_NAMES_COMPATIBILITY2.NEGBINOMDIST = "NEGBINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMDIST = "NORMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMINV = "NORMINV", FUNCTION_NAMES_COMPATIBILITY2.NORMSDIST = "NORMSDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMSINV = "NORMSINV", FUNCTION_NAMES_COMPATIBILITY2.PERCENTILE = "PERCENTILE", FUNCTION_NAMES_COMPATIBILITY2.PERCENTRANK = "PERCENTRANK", FUNCTION_NAMES_COMPATIBILITY2.POISSON = "POISSON", FUNCTION_NAMES_COMPATIBILITY2.QUARTILE = "QUARTILE", FUNCTION_NAMES_COMPATIBILITY2.RANK = "RANK", FUNCTION_NAMES_COMPATIBILITY2.STDEV = "STDEV", FUNCTION_NAMES_COMPATIBILITY2.STDEVP = "STDEVP", FUNCTION_NAMES_COMPATIBILITY2.TDIST = "TDIST", FUNCTION_NAMES_COMPATIBILITY2.TINV = "TINV", FUNCTION_NAMES_COMPATIBILITY2.TTEST = "TTEST", FUNCTION_NAMES_COMPATIBILITY2.VAR = "VAR", FUNCTION_NAMES_COMPATIBILITY2.VARP = "VARP", FUNCTION_NAMES_COMPATIBILITY2.WEIBULL = "WEIBULL", FUNCTION_NAMES_COMPATIBILITY2.ZTEST = "ZTEST", FUNCTION_NAMES_COMPATIBILITY2))(FUNCTION_NAMES_COMPATIBILITY || {});
|
|
5443
4745
|
const functionCompatibility = [
|
|
4746
|
+
[Rank, FUNCTION_NAMES_COMPATIBILITY.RANK],
|
|
5444
4747
|
[StdevS, FUNCTION_NAMES_COMPATIBILITY.STDEV],
|
|
5445
4748
|
[StdevP, FUNCTION_NAMES_COMPATIBILITY.STDEVP],
|
|
5446
4749
|
[VarS, FUNCTION_NAMES_COMPATIBILITY.VAR],
|
|
@@ -5485,19 +4788,19 @@ function isValidDateStr(dateStr) {
|
|
|
5485
4788
|
}
|
|
5486
4789
|
__name(isValidDateStr, "isValidDateStr");
|
|
5487
4790
|
function parseFormattedDate(value) {
|
|
5488
|
-
return numfmt
|
|
4791
|
+
return numfmt.parseDate(value);
|
|
5489
4792
|
}
|
|
5490
4793
|
__name(parseFormattedDate, "parseFormattedDate");
|
|
5491
4794
|
function parseFormattedValue(value) {
|
|
5492
|
-
return numfmt
|
|
4795
|
+
return numfmt.parseValue(value);
|
|
5493
4796
|
}
|
|
5494
4797
|
__name(parseFormattedValue, "parseFormattedValue");
|
|
5495
4798
|
function parseFormattedTime(value) {
|
|
5496
|
-
return numfmt
|
|
4799
|
+
return numfmt.parseTime(value);
|
|
5497
4800
|
}
|
|
5498
4801
|
__name(parseFormattedTime, "parseFormattedTime");
|
|
5499
4802
|
function isDate(format) {
|
|
5500
|
-
return numfmt
|
|
4803
|
+
return numfmt.isDate(format);
|
|
5501
4804
|
}
|
|
5502
4805
|
__name(isDate, "isDate");
|
|
5503
4806
|
const weekendNumberMap = {
|
|
@@ -5609,6 +4912,72 @@ function getWeekDayByDateSerialNumber(dateSerialNumber) {
|
|
|
5609
4912
|
return !isDate19000229 && dateTime <= leapDayDateTime && (date = new Date(dateTime - 24 * 3600 * 1e3)), new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).getUTCDay();
|
|
5610
4913
|
}
|
|
5611
4914
|
__name(getWeekDayByDateSerialNumber, "getWeekDayByDateSerialNumber");
|
|
4915
|
+
function getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basis) {
|
|
4916
|
+
switch (basis) {
|
|
4917
|
+
case 0:
|
|
4918
|
+
return getDaysByNASD(startDateSerialNumber, endDateSerialNumber);
|
|
4919
|
+
case 1:
|
|
4920
|
+
return getDaysByActual(startDateSerialNumber, endDateSerialNumber);
|
|
4921
|
+
case 2:
|
|
4922
|
+
return {
|
|
4923
|
+
days: Math.abs(endDateSerialNumber - startDateSerialNumber),
|
|
4924
|
+
yearDays: 360
|
|
4925
|
+
};
|
|
4926
|
+
case 3:
|
|
4927
|
+
return {
|
|
4928
|
+
days: Math.abs(endDateSerialNumber - startDateSerialNumber),
|
|
4929
|
+
yearDays: 365
|
|
4930
|
+
};
|
|
4931
|
+
case 4:
|
|
4932
|
+
return getDaysByEuropean(startDateSerialNumber, endDateSerialNumber);
|
|
4933
|
+
default:
|
|
4934
|
+
return {
|
|
4935
|
+
days: Math.abs(endDateSerialNumber - startDateSerialNumber),
|
|
4936
|
+
yearDays: 365
|
|
4937
|
+
};
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
__name(getTwoDateDaysByBasis, "getTwoDateDaysByBasis");
|
|
4941
|
+
function getDaysByNASD(startDateSerialNumber, endDateSerialNumber) {
|
|
4942
|
+
const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
|
|
4943
|
+
let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1, endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
|
|
4944
|
+
startMonth === 2 ? excelSerialToDate(startDateSerialNumber + 1).getUTCMonth() + 1 === 3 && (startDay = 30) : startDay === 31 && (startDay = 30), endDay === 31 && (startDay < 30 ? (endDateDate = excelSerialToDate(endDateSerialNumber + 1), endYear = endDateDate.getUTCFullYear(), endMonth = endDateDate.getUTCMonth() + 1, endDay = endDateDate.getUTCDate()) : endDay = 30);
|
|
4945
|
+
const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30;
|
|
4946
|
+
return {
|
|
4947
|
+
days: Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths),
|
|
4948
|
+
yearDays: 360
|
|
4949
|
+
};
|
|
4950
|
+
}
|
|
4951
|
+
__name(getDaysByNASD, "getDaysByNASD");
|
|
4952
|
+
function getDaysByActual(startDateSerialNumber, endDateSerialNumber) {
|
|
4953
|
+
const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, totalDays = Math.abs(endDateSerialNumber - startDateSerialNumber), totalYear = Math.abs(endYear - startYear) + 1;
|
|
4954
|
+
let startYearFirstDaySerialNumber, endYearLastDaySerialNumber;
|
|
4955
|
+
if (endYear < startYear) {
|
|
4956
|
+
const startYearFirstDay = new Date(Date.UTC(endYear, 0, 1)), endYearLastDay = new Date(Date.UTC(startYear, 11, 31));
|
|
4957
|
+
startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), endYear === 1900 && (startYearFirstDaySerialNumber += 1);
|
|
4958
|
+
} else {
|
|
4959
|
+
const startYearFirstDay = new Date(Date.UTC(startYear, 0, 1)), endYearLastDay = new Date(Date.UTC(endYear, 11, 31));
|
|
4960
|
+
startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), startYear === 1900 && (startYearFirstDaySerialNumber += 1);
|
|
4961
|
+
}
|
|
4962
|
+
return {
|
|
4963
|
+
days: totalDays,
|
|
4964
|
+
yearDays: (endYearLastDaySerialNumber - startYearFirstDaySerialNumber + 1) / totalYear
|
|
4965
|
+
};
|
|
4966
|
+
}
|
|
4967
|
+
__name(getDaysByActual, "getDaysByActual");
|
|
4968
|
+
function getDaysByEuropean(startDateSerialNumber, endDateSerialNumber) {
|
|
4969
|
+
const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
|
|
4970
|
+
let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0;
|
|
4971
|
+
const endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1;
|
|
4972
|
+
let endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
|
|
4973
|
+
startDay === 31 && (startDay = 30), endDay === 31 && (endDay = 30);
|
|
4974
|
+
const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30;
|
|
4975
|
+
return {
|
|
4976
|
+
days: Math.abs(daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths),
|
|
4977
|
+
yearDays: 360
|
|
4978
|
+
};
|
|
4979
|
+
}
|
|
4980
|
+
__name(getDaysByEuropean, "getDaysByEuropean");
|
|
5612
4981
|
const _DateFunction = class _DateFunction extends BaseFunction {
|
|
5613
4982
|
constructor() {
|
|
5614
4983
|
super(...arguments);
|
|
@@ -5819,17 +5188,15 @@ const _Days360 = class _Days360 extends BaseFunction {
|
|
|
5819
5188
|
if (endDateObject.isError())
|
|
5820
5189
|
return endDateObject;
|
|
5821
5190
|
const endDateSerialNumber = getDateSerialNumberByObject(endDateObject);
|
|
5822
|
-
|
|
5191
|
+
if (typeof endDateSerialNumber != "number")
|
|
5192
|
+
return endDateSerialNumber;
|
|
5193
|
+
if (methodObject.isString() && (methodObject = methodObject.convertToNumberObjectValue()), methodObject.isError())
|
|
5194
|
+
return methodObject;
|
|
5195
|
+
const methodValue = +methodObject.getValue(), { days } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, methodValue ? 4 : 0), result = endDateSerialNumber >= startDateSerialNumber ? days : -days;
|
|
5196
|
+
return NumberValueObject.create(result);
|
|
5823
5197
|
});
|
|
5824
5198
|
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
5825
5199
|
}
|
|
5826
|
-
_getResult(startDateSerialNumber, endDateSerialNumber, methodObject) {
|
|
5827
|
-
const startDateDate = excelSerialToDate(startDateSerialNumber), startYear = startDateSerialNumber > 0 ? startDateDate.getUTCFullYear() : 1900, startMonth = startDateSerialNumber > 0 ? startDateDate.getUTCMonth() + 1 : 1;
|
|
5828
|
-
let startDay = startDateSerialNumber > 0 ? startDateDate.getUTCDate() : 0, endDateDate = excelSerialToDate(endDateSerialNumber), endYear = endDateSerialNumber > 0 ? endDateDate.getUTCFullYear() : 1900, endMonth = endDateSerialNumber > 0 ? endDateDate.getUTCMonth() + 1 : 1, endDay = endDateSerialNumber > 0 ? endDateDate.getUTCDate() : 0;
|
|
5829
|
-
+methodObject.getValue() ? (startDay === 31 && (startDay = 30), endDay === 31 && (endDay = 30)) : (startDay === 31 && (startDay = 30), endDay === 31 && (startDay < 30 ? (endDateDate = excelSerialToDate(endDateSerialNumber + 1), endYear = endDateDate.getUTCFullYear(), endMonth = endDateDate.getUTCMonth() + 1, endDay = endDateDate.getUTCDate()) : endDay = 30));
|
|
5830
|
-
const daysInYears = (endYear - startYear) * 360, daysInStartMonth = endDateSerialNumber >= startDateSerialNumber ? 30 - startDay : -startDay, daysInEndMonth = endDateSerialNumber >= startDateSerialNumber ? endDay : endDay - 30, daysInMidMonths = (endDateSerialNumber >= startDateSerialNumber ? endMonth - startMonth - 1 : endMonth - startMonth + 1) * 30, totalDays = daysInYears + daysInStartMonth + daysInEndMonth + daysInMidMonths;
|
|
5831
|
-
return NumberValueObject.create(totalDays);
|
|
5832
|
-
}
|
|
5833
5200
|
};
|
|
5834
5201
|
__name(_Days360, "Days360");
|
|
5835
5202
|
let Days360 = _Days360;
|
|
@@ -6521,156 +5888,2521 @@ const _WorkdayIntl = class _WorkdayIntl extends BaseFunction {
|
|
|
6521
5888
|
return typeof result != "number" ? result : NumberValueObject.create(result);
|
|
6522
5889
|
}
|
|
6523
5890
|
};
|
|
6524
|
-
__name(_WorkdayIntl, "WorkdayIntl");
|
|
6525
|
-
let WorkdayIntl = _WorkdayIntl;
|
|
6526
|
-
const _Year = class _Year extends BaseFunction {
|
|
5891
|
+
__name(_WorkdayIntl, "WorkdayIntl");
|
|
5892
|
+
let WorkdayIntl = _WorkdayIntl;
|
|
5893
|
+
const _Year = class _Year extends BaseFunction {
|
|
5894
|
+
constructor() {
|
|
5895
|
+
super(...arguments);
|
|
5896
|
+
__publicField(this, "minParams", 1);
|
|
5897
|
+
__publicField(this, "maxParams", 1);
|
|
5898
|
+
}
|
|
5899
|
+
calculate(serialNumber) {
|
|
5900
|
+
return serialNumber.isArray() ? serialNumber.map((serialNumberObject) => this._handleSingleObject(serialNumberObject)) : this._handleSingleObject(serialNumber);
|
|
5901
|
+
}
|
|
5902
|
+
_handleSingleObject(serialNumberObject) {
|
|
5903
|
+
if (serialNumberObject.isError())
|
|
5904
|
+
return serialNumberObject;
|
|
5905
|
+
let date;
|
|
5906
|
+
const dateValue = serialNumberObject.getValue();
|
|
5907
|
+
if (serialNumberObject.isString()) {
|
|
5908
|
+
if (!isValidDateStr(`${dateValue}`))
|
|
5909
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
5910
|
+
date = /* @__PURE__ */ new Date(`${dateValue}`);
|
|
5911
|
+
} else {
|
|
5912
|
+
const dateSerial = +dateValue;
|
|
5913
|
+
if (dateSerial < 0)
|
|
5914
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
5915
|
+
if (dateSerial === 0)
|
|
5916
|
+
return NumberValueObject.create(1900);
|
|
5917
|
+
date = excelSerialToDate(dateSerial);
|
|
5918
|
+
}
|
|
5919
|
+
const year = date.getUTCFullYear();
|
|
5920
|
+
return NumberValueObject.create(year);
|
|
5921
|
+
}
|
|
5922
|
+
};
|
|
5923
|
+
__name(_Year, "Year");
|
|
5924
|
+
let Year = _Year;
|
|
5925
|
+
function checkVariantErrorIsArray(variant) {
|
|
5926
|
+
let _variant = variant;
|
|
5927
|
+
if (variant.isArray()) {
|
|
5928
|
+
const rowCount = variant.getRowCount(), columnCount = variant.getColumnCount();
|
|
5929
|
+
if (rowCount > 1 || columnCount > 1)
|
|
5930
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
5931
|
+
_variant = variant.get(0, 0);
|
|
5932
|
+
}
|
|
5933
|
+
return _variant.isError(), _variant;
|
|
5934
|
+
}
|
|
5935
|
+
__name(checkVariantErrorIsArray, "checkVariantErrorIsArray");
|
|
5936
|
+
function checkVariantsErrorIsArrayOrBoolean(...variants) {
|
|
5937
|
+
for (let i = 0; i < variants.length; i++) {
|
|
5938
|
+
const variant = checkVariantErrorIsArray(variants[i]);
|
|
5939
|
+
if (variant.isError())
|
|
5940
|
+
return {
|
|
5941
|
+
isError: !0,
|
|
5942
|
+
errorObject: variant
|
|
5943
|
+
};
|
|
5944
|
+
if (variant.isBoolean())
|
|
5945
|
+
return {
|
|
5946
|
+
isError: !0,
|
|
5947
|
+
errorObject: ErrorValueObject.create(ErrorType$1.VALUE)
|
|
5948
|
+
};
|
|
5949
|
+
variants[i] = variant;
|
|
5950
|
+
}
|
|
5951
|
+
return {
|
|
5952
|
+
isError: !1,
|
|
5953
|
+
variants
|
|
5954
|
+
};
|
|
5955
|
+
}
|
|
5956
|
+
__name(checkVariantsErrorIsArrayOrBoolean, "checkVariantsErrorIsArrayOrBoolean");
|
|
5957
|
+
function checkVariantsErrorIsStringToNumber(...variants) {
|
|
5958
|
+
for (let i = 0; i < variants.length; i++) {
|
|
5959
|
+
let variant = variants[i];
|
|
5960
|
+
if (variant.isString() && (variant = variant.convertToNumberObjectValue()), variant.isError())
|
|
5961
|
+
return {
|
|
5962
|
+
isError: !0,
|
|
5963
|
+
errorObject: variant
|
|
5964
|
+
};
|
|
5965
|
+
variants[i] = variant;
|
|
5966
|
+
}
|
|
5967
|
+
return {
|
|
5968
|
+
isError: !1,
|
|
5969
|
+
variants
|
|
5970
|
+
};
|
|
5971
|
+
}
|
|
5972
|
+
__name(checkVariantsErrorIsStringToNumber, "checkVariantsErrorIsStringToNumber");
|
|
5973
|
+
const _Yearfrac = class _Yearfrac extends BaseFunction {
|
|
5974
|
+
constructor() {
|
|
5975
|
+
super(...arguments);
|
|
5976
|
+
__publicField(this, "minParams", 2);
|
|
5977
|
+
__publicField(this, "maxParams", 3);
|
|
5978
|
+
}
|
|
5979
|
+
calculate(startDate, endDate, basis) {
|
|
5980
|
+
let _basis = basis != null ? basis : NumberValueObject.create(0);
|
|
5981
|
+
const _startDate = checkVariantErrorIsArray(startDate);
|
|
5982
|
+
if (_startDate.isError())
|
|
5983
|
+
return _startDate;
|
|
5984
|
+
const _endDate = checkVariantErrorIsArray(endDate);
|
|
5985
|
+
if (_endDate.isError())
|
|
5986
|
+
return _endDate;
|
|
5987
|
+
if (_basis = checkVariantErrorIsArray(_basis), _basis.isError())
|
|
5988
|
+
return _basis;
|
|
5989
|
+
if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
|
|
5990
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
5991
|
+
const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
|
|
5992
|
+
if (typeof startDateSerialNumber != "number")
|
|
5993
|
+
return startDateSerialNumber;
|
|
5994
|
+
const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
|
|
5995
|
+
if (typeof endDateSerialNumber != "number")
|
|
5996
|
+
return endDateSerialNumber;
|
|
5997
|
+
const basisValue = Math.floor(+_basis.getValue());
|
|
5998
|
+
if (Number.isNaN(basisValue))
|
|
5999
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6000
|
+
if (basisValue < 0 || basisValue > 4)
|
|
6001
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6002
|
+
const { days, yearDays } = getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basisValue), result = days / yearDays;
|
|
6003
|
+
return NumberValueObject.create(result);
|
|
6004
|
+
}
|
|
6005
|
+
};
|
|
6006
|
+
__name(_Yearfrac, "Yearfrac");
|
|
6007
|
+
let Yearfrac = _Yearfrac;
|
|
6008
|
+
const functionDate = [
|
|
6009
|
+
[DateFunction, FUNCTION_NAMES_DATE.DATE],
|
|
6010
|
+
[Datedif, FUNCTION_NAMES_DATE.DATEDIF],
|
|
6011
|
+
[Datevalue, FUNCTION_NAMES_DATE.DATEVALUE],
|
|
6012
|
+
[Day, FUNCTION_NAMES_DATE.DAY],
|
|
6013
|
+
[Days, FUNCTION_NAMES_DATE.DAYS],
|
|
6014
|
+
[Days360, FUNCTION_NAMES_DATE.DAYS360],
|
|
6015
|
+
[Edate, FUNCTION_NAMES_DATE.EDATE],
|
|
6016
|
+
[Eomonth, FUNCTION_NAMES_DATE.EOMONTH],
|
|
6017
|
+
[Hour, FUNCTION_NAMES_DATE.HOUR],
|
|
6018
|
+
[Isoweeknum, FUNCTION_NAMES_DATE.ISOWEEKNUM],
|
|
6019
|
+
[Minute, FUNCTION_NAMES_DATE.MINUTE],
|
|
6020
|
+
[Month, FUNCTION_NAMES_DATE.MONTH],
|
|
6021
|
+
[Networkdays, FUNCTION_NAMES_DATE.NETWORKDAYS],
|
|
6022
|
+
[NetworkdaysIntl, FUNCTION_NAMES_DATE.NETWORKDAYS_INTL],
|
|
6023
|
+
[Now, FUNCTION_NAMES_DATE.NOW],
|
|
6024
|
+
[Second, FUNCTION_NAMES_DATE.SECOND],
|
|
6025
|
+
[Time, FUNCTION_NAMES_DATE.TIME],
|
|
6026
|
+
[Timevalue, FUNCTION_NAMES_DATE.TIMEVALUE],
|
|
6027
|
+
[Today, FUNCTION_NAMES_DATE.TODAY],
|
|
6028
|
+
[Weekday, FUNCTION_NAMES_DATE.WEEKDAY],
|
|
6029
|
+
[Weeknum, FUNCTION_NAMES_DATE.WEEKNUM],
|
|
6030
|
+
[Workday, FUNCTION_NAMES_DATE.WORKDAY],
|
|
6031
|
+
[WorkdayIntl, FUNCTION_NAMES_DATE.WORKDAY_INTL],
|
|
6032
|
+
[Year, FUNCTION_NAMES_DATE.YEAR],
|
|
6033
|
+
[Yearfrac, FUNCTION_NAMES_DATE.YEARFRAC]
|
|
6034
|
+
];
|
|
6035
|
+
var FUNCTION_NAMES_ENGINEERING = /* @__PURE__ */ ((FUNCTION_NAMES_ENGINEERING2) => (FUNCTION_NAMES_ENGINEERING2.BESSELI = "BESSELI", FUNCTION_NAMES_ENGINEERING2.BESSELJ = "BESSELJ", FUNCTION_NAMES_ENGINEERING2.BESSELK = "BESSELK", FUNCTION_NAMES_ENGINEERING2.BESSELY = "BESSELY", FUNCTION_NAMES_ENGINEERING2.BIN2DEC = "BIN2DEC", FUNCTION_NAMES_ENGINEERING2.BIN2HEX = "BIN2HEX", FUNCTION_NAMES_ENGINEERING2.BIN2OCT = "BIN2OCT", FUNCTION_NAMES_ENGINEERING2.BITAND = "BITAND", FUNCTION_NAMES_ENGINEERING2.BITLSHIFT = "BITLSHIFT", FUNCTION_NAMES_ENGINEERING2.BITOR = "BITOR", FUNCTION_NAMES_ENGINEERING2.BITRSHIFT = "BITRSHIFT", FUNCTION_NAMES_ENGINEERING2.BITXOR = "BITXOR", FUNCTION_NAMES_ENGINEERING2.COMPLEX = "COMPLEX", FUNCTION_NAMES_ENGINEERING2.CONVERT = "CONVERT", FUNCTION_NAMES_ENGINEERING2.DEC2BIN = "DEC2BIN", FUNCTION_NAMES_ENGINEERING2.DEC2HEX = "DEC2HEX", FUNCTION_NAMES_ENGINEERING2.DEC2OCT = "DEC2OCT", FUNCTION_NAMES_ENGINEERING2.DELTA = "DELTA", FUNCTION_NAMES_ENGINEERING2.ERF = "ERF", FUNCTION_NAMES_ENGINEERING2.ERF_PRECISE = "ERF.PRECISE", FUNCTION_NAMES_ENGINEERING2.ERFC = "ERFC", FUNCTION_NAMES_ENGINEERING2.ERFC_PRECISE = "ERFC.PRECISE", FUNCTION_NAMES_ENGINEERING2.GESTEP = "GESTEP", FUNCTION_NAMES_ENGINEERING2.HEX2BIN = "HEX2BIN", FUNCTION_NAMES_ENGINEERING2.HEX2DEC = "HEX2DEC", FUNCTION_NAMES_ENGINEERING2.HEX2OCT = "HEX2OCT", FUNCTION_NAMES_ENGINEERING2.IMABS = "IMABS", FUNCTION_NAMES_ENGINEERING2.IMAGINARY = "IMAGINARY", FUNCTION_NAMES_ENGINEERING2.IMARGUMENT = "IMARGUMENT", FUNCTION_NAMES_ENGINEERING2.IMCONJUGATE = "IMCONJUGATE", FUNCTION_NAMES_ENGINEERING2.IMCOS = "IMCOS", FUNCTION_NAMES_ENGINEERING2.IMCOSH = "IMCOSH", FUNCTION_NAMES_ENGINEERING2.IMCOT = "IMCOT", FUNCTION_NAMES_ENGINEERING2.IMCSC = "IMCSC", FUNCTION_NAMES_ENGINEERING2.IMCSCH = "IMCSCH", FUNCTION_NAMES_ENGINEERING2.IMDIV = "IMDIV", FUNCTION_NAMES_ENGINEERING2.IMEXP = "IMEXP", FUNCTION_NAMES_ENGINEERING2.IMLN = "IMLN", FUNCTION_NAMES_ENGINEERING2.IMLOG10 = "IMLOG10", FUNCTION_NAMES_ENGINEERING2.IMLOG2 = "IMLOG2", FUNCTION_NAMES_ENGINEERING2.IMPOWER = "IMPOWER", FUNCTION_NAMES_ENGINEERING2.IMPRODUCT = "IMPRODUCT", FUNCTION_NAMES_ENGINEERING2.IMREAL = "IMREAL", FUNCTION_NAMES_ENGINEERING2.IMSEC = "IMSEC", FUNCTION_NAMES_ENGINEERING2.IMSECH = "IMSECH", FUNCTION_NAMES_ENGINEERING2.IMSIN = "IMSIN", FUNCTION_NAMES_ENGINEERING2.IMSINH = "IMSINH", FUNCTION_NAMES_ENGINEERING2.IMSQRT = "IMSQRT", FUNCTION_NAMES_ENGINEERING2.IMSUB = "IMSUB", FUNCTION_NAMES_ENGINEERING2.IMSUM = "IMSUM", FUNCTION_NAMES_ENGINEERING2.IMTAN = "IMTAN", FUNCTION_NAMES_ENGINEERING2.OCT2BIN = "OCT2BIN", FUNCTION_NAMES_ENGINEERING2.OCT2DEC = "OCT2DEC", FUNCTION_NAMES_ENGINEERING2.OCT2HEX = "OCT2HEX", FUNCTION_NAMES_ENGINEERING2))(FUNCTION_NAMES_ENGINEERING || {}), BESSEL;
|
|
6036
|
+
((BESSEL2) => {
|
|
6037
|
+
const W = 0.636619772;
|
|
6038
|
+
function _horner(arr, v) {
|
|
6039
|
+
let z = 0;
|
|
6040
|
+
for (let i = 0; i < arr.length; ++i)
|
|
6041
|
+
z = v * z + arr[i];
|
|
6042
|
+
return z;
|
|
6043
|
+
}
|
|
6044
|
+
__name(_horner, "_horner");
|
|
6045
|
+
function _bessel_iter(x, n, f0, f1, sign) {
|
|
6046
|
+
if (n === 0)
|
|
6047
|
+
return f0;
|
|
6048
|
+
if (n === 1)
|
|
6049
|
+
return f1;
|
|
6050
|
+
const tdx = 2 / x;
|
|
6051
|
+
let _f0 = f0, _f1 = f1, f2 = f1;
|
|
6052
|
+
for (let o = 1; o < n; ++o)
|
|
6053
|
+
f2 = _f1 * o * tdx + sign * _f0, _f0 = _f1, _f1 = f2;
|
|
6054
|
+
return f2;
|
|
6055
|
+
}
|
|
6056
|
+
__name(_bessel_iter, "_bessel_iter");
|
|
6057
|
+
function _bessel_wrap(bessel0, bessel1, nonzero, sign) {
|
|
6058
|
+
return /* @__PURE__ */ __name(function(x, n) {
|
|
6059
|
+
if (nonzero) {
|
|
6060
|
+
if (x === 0)
|
|
6061
|
+
return nonzero === 1 ? -1 / 0 : 1 / 0;
|
|
6062
|
+
if (x < 0)
|
|
6063
|
+
return Number.NaN;
|
|
6064
|
+
}
|
|
6065
|
+
if (n === 0)
|
|
6066
|
+
return bessel0(x);
|
|
6067
|
+
if (n === 1)
|
|
6068
|
+
return bessel1(x);
|
|
6069
|
+
if (n < 0)
|
|
6070
|
+
return Number.NaN;
|
|
6071
|
+
const _n = n | 0, b0 = bessel0(x), b1 = bessel1(x);
|
|
6072
|
+
return _bessel_iter(x, _n, b0, b1, sign);
|
|
6073
|
+
}, "bessel");
|
|
6074
|
+
}
|
|
6075
|
+
__name(_bessel_wrap, "_bessel_wrap"), BESSEL2.besselj = /* @__PURE__ */ (() => {
|
|
6076
|
+
const b0_a1a = [-184.9052456, 77392.33017, -1121442418e-2, 6516196407e-1, -13362590354, 57568490574], b0_a2a = [1, 267.8532712, 59272.64853, 9494680718e-3, 1029532985, 57568490411], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934935152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
|
|
6077
|
+
function bessel0(x) {
|
|
6078
|
+
let a = 0, a1 = 0, a2 = 0, y = x * x;
|
|
6079
|
+
if (x < 8)
|
|
6080
|
+
a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2;
|
|
6081
|
+
else {
|
|
6082
|
+
const xx = x - 0.785398164;
|
|
6083
|
+
y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / x);
|
|
6084
|
+
}
|
|
6085
|
+
return a;
|
|
6086
|
+
}
|
|
6087
|
+
__name(bessel0, "bessel0");
|
|
6088
|
+
const b1_a1a = [-30.16036606, 15704.4826, -2972611439e-3, 2423968531e-1, -7895059235, 72362614232], b1_a2a = [1, 376.9991397, 99447.43394, 1858330474e-2, 2300535178, 144725228442], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
|
|
6089
|
+
function bessel1(x) {
|
|
6090
|
+
let a = 0, a1 = 0, a2 = 0, y = x * x;
|
|
6091
|
+
const xx = Math.abs(x) - 2.356194491;
|
|
6092
|
+
return Math.abs(x) < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / Math.abs(x)) * (Math.cos(xx) * a1 - Math.sin(xx) * a2 * 8 / Math.abs(x)), x < 0 && (a = -a)), a;
|
|
6093
|
+
}
|
|
6094
|
+
return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besselj2(x, n) {
|
|
6095
|
+
const _n = Math.round(n);
|
|
6096
|
+
if (!Number.isFinite(x))
|
|
6097
|
+
return Number.isNaN(x) ? x : 0;
|
|
6098
|
+
if (_n < 0)
|
|
6099
|
+
return (_n % 2 ? -1 : 1) * besselj2(x, -_n);
|
|
6100
|
+
if (x < 0)
|
|
6101
|
+
return (_n % 2 ? -1 : 1) * besselj2(-x, _n);
|
|
6102
|
+
if (_n === 0)
|
|
6103
|
+
return bessel0(x);
|
|
6104
|
+
if (_n === 1)
|
|
6105
|
+
return bessel1(x);
|
|
6106
|
+
if (x === 0)
|
|
6107
|
+
return 0;
|
|
6108
|
+
let ret = 0;
|
|
6109
|
+
if (x > _n)
|
|
6110
|
+
ret = _bessel_iter(x, _n, bessel0(x), bessel1(x), -1);
|
|
6111
|
+
else {
|
|
6112
|
+
const m = 2 * Math.floor((_n + Math.floor(Math.sqrt(40 * _n))) / 2);
|
|
6113
|
+
let jsum = !1, bjp = 0, sum = 0, bj = 1, bjm = 0;
|
|
6114
|
+
const tox = 2 / x;
|
|
6115
|
+
for (let j = m; j > 0; j--)
|
|
6116
|
+
bjm = j * tox * bj - bjp, bjp = bj, bj = bjm, Math.abs(bj) > 1e10 && (bj *= 1e-10, bjp *= 1e-10, ret *= 1e-10, sum *= 1e-10), jsum && (sum += bj), jsum = !jsum, j === _n && (ret = bjp);
|
|
6117
|
+
sum = 2 * sum - bj, ret /= sum;
|
|
6118
|
+
}
|
|
6119
|
+
return ret;
|
|
6120
|
+
}, "besselj2");
|
|
6121
|
+
})(), BESSEL2.bessely = (() => {
|
|
6122
|
+
const b0_a1a = [228.4622733, -86327.92757, 1087988129e-2, -5123598036e-1, 7062834065, -2957821389], b0_a2a = [1, 226.1030244, 47447.2647, 7189466438e-3, 7452499648e-1, 40076544269], b0_a1b = [2093887211e-16, -2073370639e-15, 2734510407e-14, -0.001098628627, 1], b0_a2b = [-934945152e-16, 7621095161e-16, -6911147651e-15, 1430488765e-13, -0.01562499995];
|
|
6123
|
+
function bessel0(x) {
|
|
6124
|
+
let a = 0, a1 = 0, a2 = 0, y = x * x;
|
|
6125
|
+
const xx = x - 0.785398164;
|
|
6126
|
+
return x < 8 ? (a1 = _horner(b0_a1a, y), a2 = _horner(b0_a2a, y), a = a1 / a2 + W * (0, BESSEL2.besselj)(x, 0) * Math.log(x)) : (y = 64 / y, a1 = _horner(b0_a1b, y), a2 = _horner(b0_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
|
|
6127
|
+
}
|
|
6128
|
+
__name(bessel0, "bessel0");
|
|
6129
|
+
const b1_a1a = [8511.937935, -4237922726e-3, 7349264551e-1, -51534381390, 127527439e4, -4900604943e3], b1_a2a = [1, 354.9632885, 102042.605, 2245904002e-2, 3733650367, 424441966400, 249958057e5], b1_a1b = [-240337019e-15, 2457520174e-15, -3516396496e-14, 183105e-8, 1], b1_a2b = [105787412e-15, -88228987e-14, 8449199096e-15, -2002690873e-13, 0.04687499995];
|
|
6130
|
+
function bessel1(x) {
|
|
6131
|
+
let a = 0, a1 = 0, a2 = 0, y = x * x;
|
|
6132
|
+
const xx = x - 2.356194491;
|
|
6133
|
+
return x < 8 ? (a1 = x * _horner(b1_a1a, y), a2 = _horner(b1_a2a, y), a = a1 / a2 + W * ((0, BESSEL2.besselj)(x, 1) * Math.log(x) - 1 / x)) : (y = 64 / y, a1 = _horner(b1_a1b, y), a2 = _horner(b1_a2b, y), a = Math.sqrt(W / x) * (Math.sin(xx) * a1 + Math.cos(xx) * a2 * 8 / x)), a;
|
|
6134
|
+
}
|
|
6135
|
+
return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 1, -1);
|
|
6136
|
+
})(), BESSEL2.besseli = /* @__PURE__ */ (() => {
|
|
6137
|
+
const b0_a = [45813e-7, 0.0360768, 0.2659732, 1.2067492, 3.0899424, 3.5156229, 1], b0_b = [392377e-8, -0.01647633, 0.02635537, -0.02057706, 916281e-8, -157565e-8, 225319e-8, 0.01328592, 0.39894228];
|
|
6138
|
+
function bessel0(x) {
|
|
6139
|
+
return x <= 3.75 ? _horner(b0_a, x * x / (3.75 * 3.75)) : Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b0_b, 3.75 / Math.abs(x));
|
|
6140
|
+
}
|
|
6141
|
+
__name(bessel0, "bessel0");
|
|
6142
|
+
const b1_a = [32411e-8, 301532e-8, 0.02658733, 0.15084934, 0.51498869, 0.87890594, 0.5], b1_b = [-420059e-8, 0.01787654, -0.02895312, 0.02282967, -0.01031555, 163801e-8, -362018e-8, -0.03988024, 0.39894228];
|
|
6143
|
+
function bessel1(x) {
|
|
6144
|
+
return x < 3.75 ? x * _horner(b1_a, x * x / (3.75 * 3.75)) : (x < 0 ? -1 : 1) * Math.exp(Math.abs(x)) / Math.sqrt(Math.abs(x)) * _horner(b1_b, 3.75 / Math.abs(x));
|
|
6145
|
+
}
|
|
6146
|
+
return __name(bessel1, "bessel1"), /* @__PURE__ */ __name(function besseli2(x, n) {
|
|
6147
|
+
const _n = Math.round(n);
|
|
6148
|
+
if (_n === 0)
|
|
6149
|
+
return bessel0(x);
|
|
6150
|
+
if (_n === 1)
|
|
6151
|
+
return bessel1(x);
|
|
6152
|
+
if (_n < 0)
|
|
6153
|
+
return Number.NaN;
|
|
6154
|
+
if (Math.abs(x) === 0)
|
|
6155
|
+
return 0;
|
|
6156
|
+
if (x === 1 / 0)
|
|
6157
|
+
return 1 / 0;
|
|
6158
|
+
let ret = 0, j;
|
|
6159
|
+
const tox = 2 / Math.abs(x);
|
|
6160
|
+
let bip = 0, bi = 1, bim = 0;
|
|
6161
|
+
const m = 2 * Math.round((_n + Math.round(Math.sqrt(40 * _n))) / 2);
|
|
6162
|
+
for (j = m; j > 0; j--)
|
|
6163
|
+
bim = j * tox * bi + bip, bip = bi, bi = bim, Math.abs(bi) > 1e10 && (bi *= 1e-10, bip *= 1e-10, ret *= 1e-10), j === _n && (ret = bip);
|
|
6164
|
+
return ret *= besseli2(x, 0) / bi, x < 0 && _n % 2 ? -ret : ret;
|
|
6165
|
+
}, "besseli2");
|
|
6166
|
+
})(), BESSEL2.besselk = (() => {
|
|
6167
|
+
const b0_a = [74e-7, 1075e-7, 262698e-8, 0.0348859, 0.23069756, 0.4227842, -0.57721566], b0_b = [53208e-8, -25154e-7, 587872e-8, -0.01062446, 0.02189568, -0.07832358, 1.25331414];
|
|
6168
|
+
function bessel0(x) {
|
|
6169
|
+
return x <= 2 ? -Math.log(x / 2) * (0, BESSEL2.besseli)(x, 0) + _horner(b0_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b0_b, 2 / x);
|
|
6170
|
+
}
|
|
6171
|
+
__name(bessel0, "bessel0");
|
|
6172
|
+
const b1_a = [-4686e-8, -110404e-8, -0.01919402, -0.18156897, -0.67278579, 0.15443144, 1], b1_b = [-68245e-8, 325614e-8, -780353e-8, 0.01504268, -0.0365562, 0.23498619, 1.25331414];
|
|
6173
|
+
function bessel1(x) {
|
|
6174
|
+
return x <= 2 ? Math.log(x / 2) * (0, BESSEL2.besseli)(x, 1) + 1 / x * _horner(b1_a, x * x / 4) : Math.exp(-x) / Math.sqrt(x) * _horner(b1_b, 2 / x);
|
|
6175
|
+
}
|
|
6176
|
+
return __name(bessel1, "bessel1"), _bessel_wrap(bessel0, bessel1, 2, 1);
|
|
6177
|
+
})();
|
|
6178
|
+
})(BESSEL || (BESSEL = {}));
|
|
6179
|
+
function isValidBinaryNumber(number) {
|
|
6180
|
+
return /^[01]{1,10}$/.test(number);
|
|
6181
|
+
}
|
|
6182
|
+
__name(isValidBinaryNumber, "isValidBinaryNumber");
|
|
6183
|
+
function isValidOctalNumber(number) {
|
|
6184
|
+
return /^[0-7]{1,10}$/.test(number);
|
|
6185
|
+
}
|
|
6186
|
+
__name(isValidOctalNumber, "isValidOctalNumber");
|
|
6187
|
+
function isValidHexadecimalNumber(number) {
|
|
6188
|
+
return /^[0-9A-Fa-f]{1,10}$/.test(number);
|
|
6189
|
+
}
|
|
6190
|
+
__name(isValidHexadecimalNumber, "isValidHexadecimalNumber");
|
|
6191
|
+
function erf(x) {
|
|
6192
|
+
if (x === 0)
|
|
6193
|
+
return 0;
|
|
6194
|
+
const cof = [
|
|
6195
|
+
-1.3026537197817094,
|
|
6196
|
+
0.6419697923564902,
|
|
6197
|
+
0.019476473204185836,
|
|
6198
|
+
-0.00956151478680863,
|
|
6199
|
+
-946595344482036e-18,
|
|
6200
|
+
366839497852761e-18,
|
|
6201
|
+
42523324806907e-18,
|
|
6202
|
+
-20278578112534e-18,
|
|
6203
|
+
-1624290004647e-18,
|
|
6204
|
+
130365583558e-17,
|
|
6205
|
+
15626441722e-18,
|
|
6206
|
+
-85238095915e-18,
|
|
6207
|
+
6529054439e-18,
|
|
6208
|
+
5059343495e-18,
|
|
6209
|
+
-991364156e-18,
|
|
6210
|
+
-227365122e-18,
|
|
6211
|
+
96467911e-18,
|
|
6212
|
+
2394038e-18,
|
|
6213
|
+
-6886027e-18,
|
|
6214
|
+
894487e-18,
|
|
6215
|
+
313092e-18,
|
|
6216
|
+
-112708e-18,
|
|
6217
|
+
381e-18,
|
|
6218
|
+
7106e-18,
|
|
6219
|
+
-1523e-18,
|
|
6220
|
+
-94e-18,
|
|
6221
|
+
121e-18,
|
|
6222
|
+
-28e-18
|
|
6223
|
+
];
|
|
6224
|
+
let _x = x, isneg = !1;
|
|
6225
|
+
_x < 0 && (_x = -_x, isneg = !0);
|
|
6226
|
+
const t = 2 / (2 + _x), ty = 4 * t - 2;
|
|
6227
|
+
let d = 0, dd = 0, tmp;
|
|
6228
|
+
for (let j = cof.length - 1; j > 0; j--)
|
|
6229
|
+
tmp = d, d = ty * d - dd + cof[j], dd = tmp;
|
|
6230
|
+
const res = t * Math.exp(-_x * _x + 0.5 * (cof[0] + ty * d) - dd);
|
|
6231
|
+
return isneg ? res - 1 : 1 - res;
|
|
6232
|
+
}
|
|
6233
|
+
__name(erf, "erf");
|
|
6234
|
+
const _Besseli = class _Besseli extends BaseFunction {
|
|
6235
|
+
constructor() {
|
|
6236
|
+
super(...arguments);
|
|
6237
|
+
__publicField(this, "minParams", 2);
|
|
6238
|
+
__publicField(this, "maxParams", 2);
|
|
6239
|
+
}
|
|
6240
|
+
calculate(x, n) {
|
|
6241
|
+
if (x.isNull() || n.isNull())
|
|
6242
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6243
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
|
|
6244
|
+
if (isError)
|
|
6245
|
+
return errorObject;
|
|
6246
|
+
const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
|
|
6247
|
+
if (Number.isNaN(xValue) || Number.isNaN(nValue))
|
|
6248
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6249
|
+
if (nValue < 0)
|
|
6250
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6251
|
+
const result = BESSEL.besseli(xValue, nValue);
|
|
6252
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6253
|
+
}
|
|
6254
|
+
};
|
|
6255
|
+
__name(_Besseli, "Besseli");
|
|
6256
|
+
let Besseli = _Besseli;
|
|
6257
|
+
const _Besselj = class _Besselj extends BaseFunction {
|
|
6258
|
+
constructor() {
|
|
6259
|
+
super(...arguments);
|
|
6260
|
+
__publicField(this, "minParams", 2);
|
|
6261
|
+
__publicField(this, "maxParams", 2);
|
|
6262
|
+
}
|
|
6263
|
+
calculate(x, n) {
|
|
6264
|
+
if (x.isNull() || n.isNull())
|
|
6265
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6266
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
|
|
6267
|
+
if (isError)
|
|
6268
|
+
return errorObject;
|
|
6269
|
+
const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
|
|
6270
|
+
if (Number.isNaN(xValue) || Number.isNaN(nValue))
|
|
6271
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6272
|
+
if (nValue < 0)
|
|
6273
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6274
|
+
const result = BESSEL.besselj(xValue, nValue);
|
|
6275
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6276
|
+
}
|
|
6277
|
+
};
|
|
6278
|
+
__name(_Besselj, "Besselj");
|
|
6279
|
+
let Besselj = _Besselj;
|
|
6280
|
+
const _Besselk = class _Besselk extends BaseFunction {
|
|
6281
|
+
constructor() {
|
|
6282
|
+
super(...arguments);
|
|
6283
|
+
__publicField(this, "minParams", 2);
|
|
6284
|
+
__publicField(this, "maxParams", 2);
|
|
6285
|
+
}
|
|
6286
|
+
calculate(x, n) {
|
|
6287
|
+
if (x.isNull() || n.isNull())
|
|
6288
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6289
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
|
|
6290
|
+
if (isError)
|
|
6291
|
+
return errorObject;
|
|
6292
|
+
const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
|
|
6293
|
+
if (Number.isNaN(xValue) || Number.isNaN(nValue))
|
|
6294
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6295
|
+
if (nValue < 0)
|
|
6296
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6297
|
+
const result = BESSEL.besselk(xValue, nValue);
|
|
6298
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6299
|
+
}
|
|
6300
|
+
};
|
|
6301
|
+
__name(_Besselk, "Besselk");
|
|
6302
|
+
let Besselk = _Besselk;
|
|
6303
|
+
const _Bessely = class _Bessely extends BaseFunction {
|
|
6304
|
+
constructor() {
|
|
6305
|
+
super(...arguments);
|
|
6306
|
+
__publicField(this, "minParams", 2);
|
|
6307
|
+
__publicField(this, "maxParams", 2);
|
|
6308
|
+
}
|
|
6309
|
+
calculate(x, n) {
|
|
6310
|
+
if (x.isNull() || n.isNull())
|
|
6311
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6312
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x, n);
|
|
6313
|
+
if (isError)
|
|
6314
|
+
return errorObject;
|
|
6315
|
+
const [xObject, nObject] = variants, xValue = +xObject.getValue(), nValue = Math.floor(+nObject.getValue());
|
|
6316
|
+
if (Number.isNaN(xValue) || Number.isNaN(nValue))
|
|
6317
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6318
|
+
if (nValue < 0)
|
|
6319
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6320
|
+
const result = BESSEL.bessely(xValue, nValue);
|
|
6321
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6322
|
+
}
|
|
6323
|
+
};
|
|
6324
|
+
__name(_Bessely, "Bessely");
|
|
6325
|
+
let Bessely = _Bessely;
|
|
6326
|
+
const _Bin2dec = class _Bin2dec extends BaseFunction {
|
|
6327
|
+
constructor() {
|
|
6328
|
+
super(...arguments);
|
|
6329
|
+
__publicField(this, "minParams", 1);
|
|
6330
|
+
__publicField(this, "maxParams", 1);
|
|
6331
|
+
}
|
|
6332
|
+
calculate(number) {
|
|
6333
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
6334
|
+
if (isError)
|
|
6335
|
+
return errorObject;
|
|
6336
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
6337
|
+
if (!isValidBinaryNumber(numberValue))
|
|
6338
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6339
|
+
let result;
|
|
6340
|
+
return numberValue.length === 10 && numberValue.substring(0, 1) === "1" ? result = Number.parseInt(numberValue.substring(1), 2) - 512 : result = Number.parseInt(numberValue, 2), NumberValueObject.create(result);
|
|
6341
|
+
}
|
|
6342
|
+
};
|
|
6343
|
+
__name(_Bin2dec, "Bin2dec");
|
|
6344
|
+
let Bin2dec = _Bin2dec;
|
|
6345
|
+
const _Bin2hex = class _Bin2hex extends BaseFunction {
|
|
6346
|
+
constructor() {
|
|
6347
|
+
super(...arguments);
|
|
6348
|
+
__publicField(this, "minParams", 1);
|
|
6349
|
+
__publicField(this, "maxParams", 2);
|
|
6350
|
+
}
|
|
6351
|
+
calculate(number, places) {
|
|
6352
|
+
if (number.isNull())
|
|
6353
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6354
|
+
let placesValue = 0;
|
|
6355
|
+
if (places) {
|
|
6356
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
6357
|
+
if (isError2)
|
|
6358
|
+
return errorObject2;
|
|
6359
|
+
const [placesObject] = variants2;
|
|
6360
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
6361
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6362
|
+
if (placesValue < 0 || placesValue > 10)
|
|
6363
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6364
|
+
}
|
|
6365
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
6366
|
+
if (isError)
|
|
6367
|
+
return errorObject;
|
|
6368
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
6369
|
+
if (!isValidBinaryNumber(numberValue))
|
|
6370
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6371
|
+
let result;
|
|
6372
|
+
if (numberValue.length === 10 && numberValue.substring(0, 1) === "1")
|
|
6373
|
+
result = (1099511627264 + Number.parseInt(numberValue.substring(1), 2)).toString(16);
|
|
6374
|
+
else if (result = Number.parseInt(numberValue, 2).toString(16), places) {
|
|
6375
|
+
if (placesValue < result.length)
|
|
6376
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6377
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
6378
|
+
}
|
|
6379
|
+
return StringValueObject.create(result.toLocaleUpperCase());
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6382
|
+
__name(_Bin2hex, "Bin2hex");
|
|
6383
|
+
let Bin2hex = _Bin2hex;
|
|
6384
|
+
const _Bin2oct = class _Bin2oct extends BaseFunction {
|
|
6385
|
+
constructor() {
|
|
6386
|
+
super(...arguments);
|
|
6387
|
+
__publicField(this, "minParams", 1);
|
|
6388
|
+
__publicField(this, "maxParams", 2);
|
|
6389
|
+
}
|
|
6390
|
+
calculate(number, places) {
|
|
6391
|
+
if (number.isNull())
|
|
6392
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6393
|
+
let placesValue = 0;
|
|
6394
|
+
if (places) {
|
|
6395
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
6396
|
+
if (isError2)
|
|
6397
|
+
return errorObject2;
|
|
6398
|
+
const [placesObject] = variants2;
|
|
6399
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
6400
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6401
|
+
if (placesValue < 0 || placesValue > 10)
|
|
6402
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6403
|
+
}
|
|
6404
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
6405
|
+
if (isError)
|
|
6406
|
+
return errorObject;
|
|
6407
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
6408
|
+
if (!isValidBinaryNumber(numberValue))
|
|
6409
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6410
|
+
let result;
|
|
6411
|
+
if (numberValue.length === 10 && numberValue.substring(0, 1) === "1")
|
|
6412
|
+
result = (1073741312 + Number.parseInt(numberValue.substring(1), 2)).toString(8);
|
|
6413
|
+
else if (result = Number.parseInt(numberValue, 2).toString(8), places) {
|
|
6414
|
+
if (placesValue < result.length)
|
|
6415
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6416
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
6417
|
+
}
|
|
6418
|
+
return StringValueObject.create(result);
|
|
6419
|
+
}
|
|
6420
|
+
};
|
|
6421
|
+
__name(_Bin2oct, "Bin2oct");
|
|
6422
|
+
let Bin2oct = _Bin2oct;
|
|
6423
|
+
const _Bitand = class _Bitand extends BaseFunction {
|
|
6424
|
+
constructor() {
|
|
6425
|
+
super(...arguments);
|
|
6426
|
+
__publicField(this, "minParams", 2);
|
|
6427
|
+
__publicField(this, "maxParams", 2);
|
|
6428
|
+
}
|
|
6429
|
+
calculate(number1, number2) {
|
|
6430
|
+
if (number1.isError())
|
|
6431
|
+
return number1;
|
|
6432
|
+
if (number2.isError())
|
|
6433
|
+
return number2;
|
|
6434
|
+
const maxRowLength = Math.max(
|
|
6435
|
+
number1.isArray() ? number1.getRowCount() : 1,
|
|
6436
|
+
number2.isArray() ? number2.getRowCount() : 1
|
|
6437
|
+
), maxColumnLength = Math.max(
|
|
6438
|
+
number1.isArray() ? number1.getColumnCount() : 1,
|
|
6439
|
+
number2.isArray() ? number2.getColumnCount() : 1
|
|
6440
|
+
), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
|
|
6441
|
+
let number1Object = itemObject;
|
|
6442
|
+
if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
|
|
6443
|
+
return number1Object;
|
|
6444
|
+
let number2Object = number2Array.get(rowIndex, columnIndex);
|
|
6445
|
+
if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
|
|
6446
|
+
return number2Object;
|
|
6447
|
+
const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
|
|
6448
|
+
if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
|
|
6449
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6450
|
+
const result = number1Value & number2Value;
|
|
6451
|
+
return NumberValueObject.create(result);
|
|
6452
|
+
});
|
|
6453
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6454
|
+
}
|
|
6455
|
+
};
|
|
6456
|
+
__name(_Bitand, "Bitand");
|
|
6457
|
+
let Bitand = _Bitand;
|
|
6458
|
+
const _Bitlshift = class _Bitlshift extends BaseFunction {
|
|
6459
|
+
constructor() {
|
|
6460
|
+
super(...arguments);
|
|
6461
|
+
__publicField(this, "minParams", 2);
|
|
6462
|
+
__publicField(this, "maxParams", 2);
|
|
6463
|
+
}
|
|
6464
|
+
calculate(number, shiftAmount) {
|
|
6465
|
+
if (number.isError())
|
|
6466
|
+
return number;
|
|
6467
|
+
if (shiftAmount.isError())
|
|
6468
|
+
return shiftAmount;
|
|
6469
|
+
const maxRowLength = Math.max(
|
|
6470
|
+
number.isArray() ? number.getRowCount() : 1,
|
|
6471
|
+
shiftAmount.isArray() ? shiftAmount.getRowCount() : 1
|
|
6472
|
+
), maxColumnLength = Math.max(
|
|
6473
|
+
number.isArray() ? number.getColumnCount() : 1,
|
|
6474
|
+
shiftAmount.isArray() ? shiftAmount.getColumnCount() : 1
|
|
6475
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), shiftAmountArray = expandArrayValueObject(maxRowLength, maxColumnLength, shiftAmount, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((itemObject, rowIndex, columnIndex) => {
|
|
6476
|
+
let numberObject = itemObject;
|
|
6477
|
+
if (numberObject.isString() && (numberObject = numberObject.convertToNumberObjectValue()), numberObject.isError())
|
|
6478
|
+
return numberObject;
|
|
6479
|
+
let shiftAmountObject = shiftAmountArray.get(rowIndex, columnIndex);
|
|
6480
|
+
if (shiftAmountObject.isString() && (shiftAmountObject = shiftAmountObject.convertToNumberObjectValue()), shiftAmountObject.isError())
|
|
6481
|
+
return shiftAmountObject;
|
|
6482
|
+
const numberValue = +numberObject.getValue();
|
|
6483
|
+
let shiftAmountValue = +shiftAmountObject.getValue();
|
|
6484
|
+
if (numberValue < 0 || Math.floor(numberValue) !== numberValue || numberValue > 281474976710655 || Math.abs(shiftAmountValue) > 53)
|
|
6485
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6486
|
+
shiftAmountValue = Math.trunc(shiftAmountValue);
|
|
6487
|
+
const result = Number(shiftAmountValue >= 0 ? BigInt(numberValue) << BigInt(shiftAmountValue) : BigInt(numberValue) >> BigInt(-shiftAmountValue));
|
|
6488
|
+
return result > 281474976710655 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6489
|
+
});
|
|
6490
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6491
|
+
}
|
|
6492
|
+
};
|
|
6493
|
+
__name(_Bitlshift, "Bitlshift");
|
|
6494
|
+
let Bitlshift = _Bitlshift;
|
|
6495
|
+
const _Bitor = class _Bitor extends BaseFunction {
|
|
6496
|
+
constructor() {
|
|
6497
|
+
super(...arguments);
|
|
6498
|
+
__publicField(this, "minParams", 2);
|
|
6499
|
+
__publicField(this, "maxParams", 2);
|
|
6500
|
+
}
|
|
6501
|
+
calculate(number1, number2) {
|
|
6502
|
+
if (number1.isError())
|
|
6503
|
+
return number1;
|
|
6504
|
+
if (number2.isError())
|
|
6505
|
+
return number2;
|
|
6506
|
+
const maxRowLength = Math.max(
|
|
6507
|
+
number1.isArray() ? number1.getRowCount() : 1,
|
|
6508
|
+
number2.isArray() ? number2.getRowCount() : 1
|
|
6509
|
+
), maxColumnLength = Math.max(
|
|
6510
|
+
number1.isArray() ? number1.getColumnCount() : 1,
|
|
6511
|
+
number2.isArray() ? number2.getColumnCount() : 1
|
|
6512
|
+
), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
|
|
6513
|
+
let number1Object = itemObject;
|
|
6514
|
+
if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
|
|
6515
|
+
return number1Object;
|
|
6516
|
+
let number2Object = number2Array.get(rowIndex, columnIndex);
|
|
6517
|
+
if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
|
|
6518
|
+
return number2Object;
|
|
6519
|
+
const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
|
|
6520
|
+
if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
|
|
6521
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6522
|
+
const result = Number(BigInt(number1Value) | BigInt(number2Value));
|
|
6523
|
+
return NumberValueObject.create(result);
|
|
6524
|
+
});
|
|
6525
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6526
|
+
}
|
|
6527
|
+
};
|
|
6528
|
+
__name(_Bitor, "Bitor");
|
|
6529
|
+
let Bitor = _Bitor;
|
|
6530
|
+
const _Bitrshift = class _Bitrshift extends BaseFunction {
|
|
6531
|
+
constructor() {
|
|
6532
|
+
super(...arguments);
|
|
6533
|
+
__publicField(this, "minParams", 2);
|
|
6534
|
+
__publicField(this, "maxParams", 2);
|
|
6535
|
+
}
|
|
6536
|
+
calculate(number, shiftAmount) {
|
|
6537
|
+
if (number.isError())
|
|
6538
|
+
return number;
|
|
6539
|
+
if (shiftAmount.isError())
|
|
6540
|
+
return shiftAmount;
|
|
6541
|
+
const maxRowLength = Math.max(
|
|
6542
|
+
number.isArray() ? number.getRowCount() : 1,
|
|
6543
|
+
shiftAmount.isArray() ? shiftAmount.getRowCount() : 1
|
|
6544
|
+
), maxColumnLength = Math.max(
|
|
6545
|
+
number.isArray() ? number.getColumnCount() : 1,
|
|
6546
|
+
shiftAmount.isArray() ? shiftAmount.getColumnCount() : 1
|
|
6547
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, number, ErrorValueObject.create(ErrorType$1.NA)), shiftAmountArray = expandArrayValueObject(maxRowLength, maxColumnLength, shiftAmount, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((itemObject, rowIndex, columnIndex) => {
|
|
6548
|
+
let numberObject = itemObject;
|
|
6549
|
+
if (numberObject.isString() && (numberObject = numberObject.convertToNumberObjectValue()), numberObject.isError())
|
|
6550
|
+
return numberObject;
|
|
6551
|
+
let shiftAmountObject = shiftAmountArray.get(rowIndex, columnIndex);
|
|
6552
|
+
if (shiftAmountObject.isString() && (shiftAmountObject = shiftAmountObject.convertToNumberObjectValue()), shiftAmountObject.isError())
|
|
6553
|
+
return shiftAmountObject;
|
|
6554
|
+
const numberValue = +numberObject.getValue();
|
|
6555
|
+
let shiftAmountValue = +shiftAmountObject.getValue();
|
|
6556
|
+
if (numberValue < 0 || Math.floor(numberValue) !== numberValue || numberValue > 281474976710655 || Math.abs(shiftAmountValue) > 53)
|
|
6557
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6558
|
+
shiftAmountValue = Math.trunc(shiftAmountValue);
|
|
6559
|
+
const result = Number(shiftAmountValue >= 0 ? BigInt(numberValue) >> BigInt(shiftAmountValue) : BigInt(numberValue) << BigInt(-shiftAmountValue));
|
|
6560
|
+
return result > 281474976710655 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
6561
|
+
});
|
|
6562
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6563
|
+
}
|
|
6564
|
+
};
|
|
6565
|
+
__name(_Bitrshift, "Bitrshift");
|
|
6566
|
+
let Bitrshift = _Bitrshift;
|
|
6567
|
+
const _Bitxor = class _Bitxor extends BaseFunction {
|
|
6568
|
+
constructor() {
|
|
6569
|
+
super(...arguments);
|
|
6570
|
+
__publicField(this, "minParams", 2);
|
|
6571
|
+
__publicField(this, "maxParams", 2);
|
|
6572
|
+
}
|
|
6573
|
+
calculate(number1, number2) {
|
|
6574
|
+
if (number1.isError())
|
|
6575
|
+
return number1;
|
|
6576
|
+
if (number2.isError())
|
|
6577
|
+
return number2;
|
|
6578
|
+
const maxRowLength = Math.max(
|
|
6579
|
+
number1.isArray() ? number1.getRowCount() : 1,
|
|
6580
|
+
number2.isArray() ? number2.getRowCount() : 1
|
|
6581
|
+
), maxColumnLength = Math.max(
|
|
6582
|
+
number1.isArray() ? number1.getColumnCount() : 1,
|
|
6583
|
+
number2.isArray() ? number2.getColumnCount() : 1
|
|
6584
|
+
), number1Array = expandArrayValueObject(maxRowLength, maxColumnLength, number1, ErrorValueObject.create(ErrorType$1.NA)), number2Array = expandArrayValueObject(maxRowLength, maxColumnLength, number2, ErrorValueObject.create(ErrorType$1.NA)), resultArray = number1Array.map((itemObject, rowIndex, columnIndex) => {
|
|
6585
|
+
let number1Object = itemObject;
|
|
6586
|
+
if (number1Object.isString() && (number1Object = number1Object.convertToNumberObjectValue()), number1Object.isError())
|
|
6587
|
+
return number1Object;
|
|
6588
|
+
let number2Object = number2Array.get(rowIndex, columnIndex);
|
|
6589
|
+
if (number2Object.isString() && (number2Object = number2Object.convertToNumberObjectValue()), number2Object.isError())
|
|
6590
|
+
return number2Object;
|
|
6591
|
+
const number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
|
|
6592
|
+
if (number1Value < 0 || number2Value < 0 || Math.floor(number1Value) !== number1Value || Math.floor(number2Value) !== number2Value || number1Value > 281474976710655 || number2Value > 281474976710655)
|
|
6593
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6594
|
+
const result = number1Value ^ number2Value;
|
|
6595
|
+
return NumberValueObject.create(result);
|
|
6596
|
+
});
|
|
6597
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6598
|
+
}
|
|
6599
|
+
};
|
|
6600
|
+
__name(_Bitxor, "Bitxor");
|
|
6601
|
+
let Bitxor = _Bitxor;
|
|
6602
|
+
const _Complex = class _Complex extends BaseFunction {
|
|
6603
|
+
constructor() {
|
|
6604
|
+
super(...arguments);
|
|
6605
|
+
__publicField(this, "minParams", 2);
|
|
6606
|
+
__publicField(this, "maxParams", 3);
|
|
6607
|
+
}
|
|
6608
|
+
calculate(realNum, iNum, suffix) {
|
|
6609
|
+
const _suffix = suffix != null ? suffix : StringValueObject.create("i"), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(realNum, iNum, _suffix);
|
|
6610
|
+
if (isError)
|
|
6611
|
+
return errorObject;
|
|
6612
|
+
const [realNumObject, iNumObject, suffixObject] = variants, realNumValue = +realNumObject.getValue(), iNumValue = +iNumObject.getValue(), suffixValue = `${suffixObject.getValue()}`;
|
|
6613
|
+
if (Number.isNaN(realNumValue) || Number.isNaN(iNumValue) || suffixValue !== "i" && suffixValue !== "j")
|
|
6614
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6615
|
+
if (realNumValue === 0 && iNumValue === 0)
|
|
6616
|
+
return NumberValueObject.create(0);
|
|
6617
|
+
if (realNumValue === 0)
|
|
6618
|
+
return iNumValue === 1 ? StringValueObject.create(suffixValue) : StringValueObject.create(`${iNumValue}${suffixValue}`);
|
|
6619
|
+
if (iNumValue === 0)
|
|
6620
|
+
return NumberValueObject.create(realNumValue);
|
|
6621
|
+
const sign = iNumValue > 0 ? "+" : "", suffixStr = iNumValue === 1 ? suffixValue : `${iNumValue}${suffixValue}`;
|
|
6622
|
+
return StringValueObject.create(`${realNumValue}${sign}${suffixStr}`);
|
|
6623
|
+
}
|
|
6624
|
+
};
|
|
6625
|
+
__name(_Complex, "Complex");
|
|
6626
|
+
let Complex = _Complex;
|
|
6627
|
+
const _Convert = class _Convert extends BaseFunction {
|
|
6628
|
+
constructor() {
|
|
6629
|
+
super(...arguments);
|
|
6630
|
+
__publicField(this, "minParams", 3);
|
|
6631
|
+
__publicField(this, "maxParams", 3);
|
|
6632
|
+
// List of units supported by CONVERT and units defined by the International System of Units
|
|
6633
|
+
// [Name, Symbol, Alternate symbols, Quantity, ISU, CONVERT, Conversion ratio]
|
|
6634
|
+
__publicField(this, "_units", [
|
|
6635
|
+
["a.u. of action", "?", null, "action", !1, !1, 105457168181818e-48],
|
|
6636
|
+
["a.u. of charge", "e", null, "electric_charge", !1, !1, 160217653141414e-33],
|
|
6637
|
+
["a.u. of energy", "Eh", null, "energy", !1, !1, 435974417757576e-32],
|
|
6638
|
+
["a.u. of length", "a?", null, "length", !1, !1, 529177210818182e-25],
|
|
6639
|
+
["a.u. of mass", "m?", null, "mass", !1, !1, 910938261616162e-45],
|
|
6640
|
+
["a.u. of time", "?/Eh", null, "time", !1, !1, 241888432650516e-31],
|
|
6641
|
+
["admiralty knot", "admkn", null, "speed", !1, !0, 0.514773333],
|
|
6642
|
+
["ampere", "A", null, "electric_current", !0, !1, 1],
|
|
6643
|
+
["ampere per meter", "A/m", null, "magnetic_field_intensity", !0, !1, 1],
|
|
6644
|
+
["ångström", "Å", ["ang"], "length", !1, !0, 1e-10],
|
|
6645
|
+
["are", "ar", null, "area", !1, !0, 100],
|
|
6646
|
+
["astronomical unit", "ua", null, "length", !1, !1, 149597870691667e-25],
|
|
6647
|
+
["bar", "bar", null, "pressure", !1, !1, 1e5],
|
|
6648
|
+
["barn", "b", null, "area", !1, !1, 1e-28],
|
|
6649
|
+
["becquerel", "Bq", null, "radioactivity", !0, !1, 1],
|
|
6650
|
+
["bit", "bit", ["b"], "information", !1, !0, 1],
|
|
6651
|
+
["btu", "BTU", ["btu"], "energy", !1, !0, 1055.05585262],
|
|
6652
|
+
["byte", "byte", null, "information", !1, !0, 8],
|
|
6653
|
+
["candela", "cd", null, "luminous_intensity", !0, !1, 1],
|
|
6654
|
+
["candela per square metre", "cd/m?", null, "luminance", !0, !1, 1],
|
|
6655
|
+
["centigrade", "C", ["cel"], "temperature", !0, !1, 1],
|
|
6656
|
+
["cubic ångström", "ang3", ["ang^3"], "volume", !1, !0, 1e-30],
|
|
6657
|
+
["cubic foot", "ft3", ["ft^3"], "volume", !1, !0, 0.028316846592],
|
|
6658
|
+
["cubic inch", "in3", ["in^3"], "volume", !1, !0, 16387064e-12],
|
|
6659
|
+
["cubic light-year", "ly3", ["ly^3"], "volume", !1, !0, 846786664623715e-61],
|
|
6660
|
+
["cubic metre", "m3", ["m^3"], "volume", !0, !0, 1],
|
|
6661
|
+
["cubic mile", "mi3", ["mi^3"], "volume", !1, !0, 416818182544058e-5],
|
|
6662
|
+
["cubic nautical mile", "Nmi3", ["Nmi^3"], "volume", !1, !0, 6352182208],
|
|
6663
|
+
["cubic Pica", "Pica3", ["Picapt3", "Pica^3", "Picapt^3"], "volume", !1, !0, 758660370370369e-22],
|
|
6664
|
+
["cubic yard", "yd3", ["yd^3"], "volume", !1, !0, 0.764554857984],
|
|
6665
|
+
["cup", "cup", null, "volume", !1, !0, 2365882365e-13],
|
|
6666
|
+
["dalton", "Da", ["u"], "mass", !1, !1, 166053886282828e-41],
|
|
6667
|
+
["day", "d", ["day"], "time", !1, !0, 86400],
|
|
6668
|
+
["degree", "°", null, "angle", !1, !1, 0.0174532925199433],
|
|
6669
|
+
["dyne", "dyn", ["dy"], "force", !1, !0, 1e-5],
|
|
6670
|
+
["electronvolt", "eV", ["ev"], "energy", !1, !0, 1.60217656514141],
|
|
6671
|
+
["ell", "ell", null, "length", !1, !0, 1.143],
|
|
6672
|
+
["erg", "erg", ["e"], "energy", !1, !0, 1e-7],
|
|
6673
|
+
["fahrenheit", "F", ["fah"], "temperature", !0, !1, 1],
|
|
6674
|
+
["fluid ounce", "oz", null, "volume", !1, !0, 295735295625e-16],
|
|
6675
|
+
["foot", "ft", null, "length", !1, !0, 0.3048],
|
|
6676
|
+
["foot-pound", "flb", null, "energy", !1, !0, 1.3558179483314],
|
|
6677
|
+
["gal", "Gal", null, "acceleration", !1, !1, 0.01],
|
|
6678
|
+
["gallon", "gal", null, "volume", !1, !0, 0.003785411784],
|
|
6679
|
+
["gauss", "G", ["ga"], "magnetic_flux_density", !1, !0, 1],
|
|
6680
|
+
["grain", "grain", null, "mass", !1, !0, 647989e-10],
|
|
6681
|
+
["gram", "g", null, "mass", !1, !0, 1e-3],
|
|
6682
|
+
["gray", "Gy", null, "absorbed_dose", !0, !1, 1],
|
|
6683
|
+
["gross registered ton", "GRT", ["regton"], "volume", !1, !0, 2.8316846592],
|
|
6684
|
+
["hectare", "ha", null, "area", !1, !0, 1e4],
|
|
6685
|
+
["henry", "H", null, "inductance", !0, !1, 1],
|
|
6686
|
+
["hertz", "Hz", null, "frequency", !0, !1, 1],
|
|
6687
|
+
["horsepower", "HP", ["h"], "power", !1, !0, 745.69987158227],
|
|
6688
|
+
["horsepower-hour", "HPh", ["hh", "hph"], "energy", !1, !0, 2684519538e-3],
|
|
6689
|
+
["hour", "h", ["hr"], "time", !1, !0, 3600],
|
|
6690
|
+
["imperial gallon (U.K.)", "uk_gal", null, "volume", !1, !0, 454609e-8],
|
|
6691
|
+
["imperial hundredweight", "lcwt", ["uk_cwt", "hweight"], "mass", !1, !0, 50.802345],
|
|
6692
|
+
["imperial quart (U.K)", "uk_qt", null, "volume", !1, !0, 0.0011365225],
|
|
6693
|
+
["imperial ton", "brton", ["uk_ton", "LTON"], "mass", !1, !0, 1016.046909],
|
|
6694
|
+
["inch", "in", null, "length", !1, !0, 0.0254],
|
|
6695
|
+
["international acre", "uk_acre", null, "area", !1, !0, 4046.8564224],
|
|
6696
|
+
["IT calorie", "cal", null, "energy", !1, !0, 4.1868],
|
|
6697
|
+
["joule", "J", null, "energy", !0, !0, 1],
|
|
6698
|
+
["katal", "kat", null, "catalytic_activity", !0, !1, 1],
|
|
6699
|
+
["kelvin", "K", ["kel"], "temperature", !0, !0, 1],
|
|
6700
|
+
["kilogram", "kg", null, "mass", !0, !0, 1],
|
|
6701
|
+
["knot", "kn", null, "speed", !1, !0, 0.514444444444444],
|
|
6702
|
+
["light-year", "ly", null, "length", !1, !0, 9460730472580800],
|
|
6703
|
+
["litre", "L", ["l", "lt"], "volume", !1, !0, 1e-3],
|
|
6704
|
+
["lumen", "lm", null, "luminous_flux", !0, !1, 1],
|
|
6705
|
+
["lux", "lx", null, "illuminance", !0, !1, 1],
|
|
6706
|
+
["maxwell", "Mx", null, "magnetic_flux", !1, !1, 1e-18],
|
|
6707
|
+
["measurement ton", "MTON", null, "volume", !1, !0, 1.13267386368],
|
|
6708
|
+
["meter per hour", "m/h", ["m/hr"], "speed", !1, !0, 27777777777778e-17],
|
|
6709
|
+
["meter per second", "m/s", ["m/sec"], "speed", !0, !0, 1],
|
|
6710
|
+
["meter per second squared", "m?s??", null, "acceleration", !0, !1, 1],
|
|
6711
|
+
["parsec", "pc", ["parsec"], "length", !1, !0, 30856775814671900],
|
|
6712
|
+
["meter squared per second", "m?/s", null, "kinematic_viscosity", !0, !1, 1],
|
|
6713
|
+
["metre", "m", null, "length", !0, !0, 1],
|
|
6714
|
+
["miles per hour", "mph", null, "speed", !1, !0, 0.44704],
|
|
6715
|
+
["millimetre of mercury", "mmHg", null, "pressure", !1, !1, 133.322],
|
|
6716
|
+
["minute", "?", null, "angle", !1, !1, 290888208665722e-18],
|
|
6717
|
+
["minute", "min", ["mn"], "time", !1, !0, 60],
|
|
6718
|
+
["modern teaspoon", "tspm", null, "volume", !1, !0, 5e-6],
|
|
6719
|
+
["mole", "mol", null, "amount_of_substance", !0, !1, 1],
|
|
6720
|
+
["morgen", "Morgen", null, "area", !1, !0, 2500],
|
|
6721
|
+
["n.u. of action", "?", null, "action", !1, !1, 105457168181818e-48],
|
|
6722
|
+
["n.u. of mass", "m?", null, "mass", !1, !1, 910938261616162e-45],
|
|
6723
|
+
["n.u. of speed", "c?", null, "speed", !1, !1, 299792458],
|
|
6724
|
+
["n.u. of time", "?/(me?c??)", null, "time", !1, !1, 128808866778687e-35],
|
|
6725
|
+
["nautical mile", "M", ["Nmi"], "length", !1, !0, 1852],
|
|
6726
|
+
["newton", "N", null, "force", !0, !0, 1],
|
|
6727
|
+
["œrsted", "Oe ", null, "magnetic_field_intensity", !1, !1, 79.5774715459477],
|
|
6728
|
+
["ohm", "Ω", null, "electric_resistance", !0, !1, 1],
|
|
6729
|
+
["ounce mass", "ozm", null, "mass", !1, !0, 0.028349523125],
|
|
6730
|
+
["pascal", "Pa", null, "pressure", !0, !1, 1],
|
|
6731
|
+
["pascal second", "Pa?s", null, "dynamic_viscosity", !0, !1, 1],
|
|
6732
|
+
["pferdestärke", "PS", null, "power", !1, !0, 735.49875],
|
|
6733
|
+
["phot", "ph", null, "illuminance", !1, !1, 1e-4],
|
|
6734
|
+
["pica (1/6 inch)", "pica", null, "length", !1, !0, 35277777777778e-17],
|
|
6735
|
+
["pica (1/72 inch)", "Pica", ["Picapt"], "length", !1, !0, 0.00423333333333333],
|
|
6736
|
+
["poise", "P", null, "dynamic_viscosity", !1, !1, 0.1],
|
|
6737
|
+
["pond", "pond", null, "force", !1, !0, 980665e-8],
|
|
6738
|
+
["pound force", "lbf", null, "force", !1, !0, 4.4482216152605],
|
|
6739
|
+
["pound mass", "lbm", null, "mass", !1, !0, 0.45359237],
|
|
6740
|
+
["quart", "qt", null, "volume", !1, !0, 946352946e-12],
|
|
6741
|
+
["radian", "rad", null, "angle", !0, !1, 1],
|
|
6742
|
+
["rankine", "Rank", null, "temperature", !1, !0, 1],
|
|
6743
|
+
["reaumur", "Reau", null, "temperature", !1, !0, 1],
|
|
6744
|
+
["second", "?", null, "angle", !1, !1, 484813681109536e-20],
|
|
6745
|
+
["second", "s", ["sec"], "time", !0, !0, 1],
|
|
6746
|
+
["short hundredweight", "cwt", ["shweight"], "mass", !1, !0, 45.359237],
|
|
6747
|
+
["siemens", "S", null, "electrical_conductance", !0, !1, 1],
|
|
6748
|
+
["sievert", "Sv", null, "equivalent_dose", !0, !1, 1],
|
|
6749
|
+
["slug", "sg", null, "mass", !1, !0, 14.59390294],
|
|
6750
|
+
["square ångström", "ang2", ["ang^2"], "area", !1, !0, 1e-20],
|
|
6751
|
+
["square foot", "ft2", ["ft^2"], "area", !1, !0, 0.09290304],
|
|
6752
|
+
["square inch", "in2", ["in^2"], "area", !1, !0, 64516e-8],
|
|
6753
|
+
["square light-year", "ly2", ["ly^2"], "area", !1, !0, 895054210748189e17],
|
|
6754
|
+
["square meter", "m?", null, "area", !0, !0, 1],
|
|
6755
|
+
["square mile", "mi2", ["mi^2"], "area", !1, !0, 2589988110336e-6],
|
|
6756
|
+
["square nautical mile", "Nmi2", ["Nmi^2"], "area", !1, !0, 3429904],
|
|
6757
|
+
["square Pica", "Pica2", ["Picapt2", "Pica^2", "Picapt^2"], "area", !1, !0, 1792111111111e-17],
|
|
6758
|
+
["square yard", "yd2", ["yd^2"], "area", !1, !0, 0.83612736],
|
|
6759
|
+
["statute mile", "mi", null, "length", !1, !0, 1609.344],
|
|
6760
|
+
["steradian", "sr", null, "solid_angle", !0, !1, 1],
|
|
6761
|
+
["stilb", "sb", null, "luminance", !1, !1, 1e-4],
|
|
6762
|
+
["stokes", "St", null, "kinematic_viscosity", !1, !1, 1e-4],
|
|
6763
|
+
["stone", "stone", null, "mass", !1, !0, 6.35029318],
|
|
6764
|
+
["tablespoon", "tbs", null, "volume", !1, !0, 147868e-10],
|
|
6765
|
+
["teaspoon", "tsp", null, "volume", !1, !0, 492892e-11],
|
|
6766
|
+
["tesla", "T", null, "magnetic_flux_density", !0, !0, 1],
|
|
6767
|
+
["thermodynamic calorie", "c", null, "energy", !1, !0, 4.184],
|
|
6768
|
+
["ton", "ton", null, "mass", !1, !0, 907.18474],
|
|
6769
|
+
["tonne", "t", null, "mass", !1, !1, 1e3],
|
|
6770
|
+
["U.K. pint", "uk_pt", null, "volume", !1, !0, 56826125e-11],
|
|
6771
|
+
["U.S. bushel", "bushel", null, "volume", !1, !0, 0.03523907],
|
|
6772
|
+
["U.S. oil barrel", "barrel", null, "volume", !1, !0, 0.158987295],
|
|
6773
|
+
["U.S. pint", "pt", ["us_pt"], "volume", !1, !0, 473176473e-12],
|
|
6774
|
+
["U.S. survey mile", "survey_mi", null, "length", !1, !0, 1609.347219],
|
|
6775
|
+
["U.S. survey/statute acre", "us_acre", null, "area", !1, !0, 4046.87261],
|
|
6776
|
+
["volt", "V", null, "voltage", !0, !1, 1],
|
|
6777
|
+
["watt", "W", null, "power", !0, !0, 1],
|
|
6778
|
+
["watt-hour", "Wh", ["wh"], "energy", !1, !0, 3600],
|
|
6779
|
+
["weber", "Wb", null, "magnetic_flux", !0, !1, 1],
|
|
6780
|
+
["yard", "yd", null, "length", !1, !0, 0.9144],
|
|
6781
|
+
["year", "yr", null, "time", !1, !0, 31557600]
|
|
6782
|
+
]);
|
|
6783
|
+
// Binary prefixes
|
|
6784
|
+
// [Name, Prefix power of 2 value, Previx value, Abbreviation, Derived from]
|
|
6785
|
+
__publicField(this, "_binaryPrefixes", {
|
|
6786
|
+
Yi: ["yobi", 80, 12089258196146292e8, "Yi", "yotta"],
|
|
6787
|
+
Zi: ["zebi", 70, 11805916207174113e5, "Zi", "zetta"],
|
|
6788
|
+
Ei: ["exbi", 60, 1152921504606847e3, "Ei", "exa"],
|
|
6789
|
+
Pi: ["pebi", 50, 1125899906842624, "Pi", "peta"],
|
|
6790
|
+
Ti: ["tebi", 40, 1099511627776, "Ti", "tera"],
|
|
6791
|
+
Gi: ["gibi", 30, 1073741824, "Gi", "giga"],
|
|
6792
|
+
Mi: ["mebi", 20, 1048576, "Mi", "mega"],
|
|
6793
|
+
ki: ["kibi", 10, 1024, "ki", "kilo"]
|
|
6794
|
+
});
|
|
6795
|
+
// Unit prefixes
|
|
6796
|
+
// [Name, Multiplier, Abbreviation]
|
|
6797
|
+
__publicField(this, "_unitPrefixes", {
|
|
6798
|
+
Y: ["yotta", 1e24, "Y"],
|
|
6799
|
+
Z: ["zetta", 1e21, "Z"],
|
|
6800
|
+
E: ["exa", 1e18, "E"],
|
|
6801
|
+
P: ["peta", 1e15, "P"],
|
|
6802
|
+
T: ["tera", 1e12, "T"],
|
|
6803
|
+
G: ["giga", 1e9, "G"],
|
|
6804
|
+
M: ["mega", 1e6, "M"],
|
|
6805
|
+
k: ["kilo", 1e3, "k"],
|
|
6806
|
+
h: ["hecto", 100, "h"],
|
|
6807
|
+
e: ["dekao", 10, "e"],
|
|
6808
|
+
d: ["deci", 0.1, "d"],
|
|
6809
|
+
c: ["centi", 0.01, "c"],
|
|
6810
|
+
m: ["milli", 1e-3, "m"],
|
|
6811
|
+
u: ["micro", 1e-6, "u"],
|
|
6812
|
+
n: ["nano", 1e-9, "n"],
|
|
6813
|
+
p: ["pico", 1e-12, "p"],
|
|
6814
|
+
f: ["femto", 1e-15, "f"],
|
|
6815
|
+
a: ["atto", 1e-18, "a"],
|
|
6816
|
+
z: ["zepto", 1e-21, "z"],
|
|
6817
|
+
y: ["yocto", 1e-24, "y"]
|
|
6818
|
+
});
|
|
6819
|
+
}
|
|
6820
|
+
calculate(number, fromUnit, toUnit) {
|
|
6821
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number, fromUnit, toUnit);
|
|
6822
|
+
if (isError)
|
|
6823
|
+
return errorObject;
|
|
6824
|
+
const [numberObject, fromUnitObject, toUnitObject] = variants, numberValue = +numberObject.getValue(), fromUnitValue = `${fromUnitObject.getValue()}`, toUnitValue = `${toUnitObject.getValue()}`;
|
|
6825
|
+
if (Number.isNaN(numberValue))
|
|
6826
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6827
|
+
let from, fromMultiplier = 1, to, toMultiplier = 1;
|
|
6828
|
+
const { _from, _to } = this._lookupFromAndToUnits(fromUnitValue, toUnitValue);
|
|
6829
|
+
if (from = _from, to = _to, from === null) {
|
|
6830
|
+
const { _from: _from2, _fromMultiplier } = this._lookupFromPrefix(fromUnitValue);
|
|
6831
|
+
from = _from2, fromMultiplier = _fromMultiplier;
|
|
6832
|
+
}
|
|
6833
|
+
if (to === null) {
|
|
6834
|
+
const { _to: _to2, _toMultiplier } = this._lookupToPrefix(toUnitValue);
|
|
6835
|
+
to = _to2, toMultiplier = _toMultiplier;
|
|
6836
|
+
}
|
|
6837
|
+
if (from === null || to === null || from[3] !== to[3])
|
|
6838
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6839
|
+
let result;
|
|
6840
|
+
return from[3] === "temperature" ? result = this._getTemperatureConversion(numberValue, from[1], to[1]) : result = numberValue * from[6] * fromMultiplier / (to[6] * toMultiplier), NumberValueObject.create(result);
|
|
6841
|
+
}
|
|
6842
|
+
_lookupFromAndToUnits(fromUnitValue, toUnitValue) {
|
|
6843
|
+
let _from = null, _to = null, alt;
|
|
6844
|
+
for (let i = 0; i < this._units.length; i++)
|
|
6845
|
+
alt = this._units[i][2] === null ? [] : this._units[i][2], (this._units[i][1] === fromUnitValue || alt.indexOf(fromUnitValue) >= 0) && (_from = this._units[i]), (this._units[i][1] === toUnitValue || alt.indexOf(toUnitValue) >= 0) && (_to = this._units[i]);
|
|
6846
|
+
return {
|
|
6847
|
+
_from,
|
|
6848
|
+
_to
|
|
6849
|
+
};
|
|
6850
|
+
}
|
|
6851
|
+
_lookupFromPrefix(fromUnitValue) {
|
|
6852
|
+
let _from = null, _fromMultiplier = 1, baseFromUnit = fromUnitValue, alt;
|
|
6853
|
+
const fromBinaryPrefix = this._binaryPrefixes[fromUnitValue.substring(0, 2)];
|
|
6854
|
+
let fromUnitPrefix = this._unitPrefixes[fromUnitValue.substring(0, 1)];
|
|
6855
|
+
fromUnitValue.substring(0, 2) === "da" && (fromUnitPrefix = ["dekao", 10, "da"]), fromBinaryPrefix ? (_fromMultiplier = fromBinaryPrefix[2], baseFromUnit = fromUnitValue.substring(2)) : fromUnitPrefix && (_fromMultiplier = fromUnitPrefix[1], baseFromUnit = fromUnitValue.substring(fromUnitPrefix[2].length));
|
|
6856
|
+
for (let j = 0; j < this._units.length; j++)
|
|
6857
|
+
alt = this._units[j][2] === null ? [] : this._units[j][2], (this._units[j][1] === baseFromUnit || alt.indexOf(baseFromUnit) >= 0) && (_from = this._units[j]);
|
|
6858
|
+
return {
|
|
6859
|
+
_from,
|
|
6860
|
+
_fromMultiplier
|
|
6861
|
+
};
|
|
6862
|
+
}
|
|
6863
|
+
_lookupToPrefix(toUnitValue) {
|
|
6864
|
+
let _to = null, _toMultiplier = 1, baseToUnit = toUnitValue, alt;
|
|
6865
|
+
const toBinaryPrefix = this._binaryPrefixes[toUnitValue.substring(0, 2)];
|
|
6866
|
+
let toUnitPrefix = this._unitPrefixes[toUnitValue.substring(0, 1)];
|
|
6867
|
+
toUnitValue.substring(0, 2) === "da" && (toUnitPrefix = ["dekao", 10, "da"]), toBinaryPrefix ? (_toMultiplier = toBinaryPrefix[2], baseToUnit = toUnitValue.substring(2)) : toUnitPrefix && (_toMultiplier = toUnitPrefix[1], baseToUnit = toUnitValue.substring(toUnitPrefix[2].length));
|
|
6868
|
+
for (let k = 0; k < this._units.length; k++)
|
|
6869
|
+
alt = this._units[k][2] === null ? [] : this._units[k][2], (this._units[k][1] === baseToUnit || alt.indexOf(baseToUnit) >= 0) && (_to = this._units[k]);
|
|
6870
|
+
return {
|
|
6871
|
+
_to,
|
|
6872
|
+
_toMultiplier
|
|
6873
|
+
};
|
|
6874
|
+
}
|
|
6875
|
+
_getTemperatureConversion(number, from, to) {
|
|
6876
|
+
switch (from) {
|
|
6877
|
+
case "C":
|
|
6878
|
+
return this._centigradeConversion(number, to);
|
|
6879
|
+
case "F":
|
|
6880
|
+
return this._fahrenheitConversion(number, to);
|
|
6881
|
+
case "K":
|
|
6882
|
+
return this._kelvinConversion(number, to);
|
|
6883
|
+
case "Rank":
|
|
6884
|
+
return this._rankineConversion(number, to);
|
|
6885
|
+
case "Reau":
|
|
6886
|
+
return this._reaumurConversion(number, to);
|
|
6887
|
+
default:
|
|
6888
|
+
return number;
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
_centigradeConversion(number, to) {
|
|
6892
|
+
switch (to) {
|
|
6893
|
+
case "F":
|
|
6894
|
+
return number * 9 / 5 + 32;
|
|
6895
|
+
case "K":
|
|
6896
|
+
return number + 273.15;
|
|
6897
|
+
case "Rank":
|
|
6898
|
+
return (number + 273.15) * 9 / 5;
|
|
6899
|
+
case "Reau":
|
|
6900
|
+
return number * 4 / 5;
|
|
6901
|
+
default:
|
|
6902
|
+
return number;
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6905
|
+
_fahrenheitConversion(number, to) {
|
|
6906
|
+
switch (to) {
|
|
6907
|
+
case "C":
|
|
6908
|
+
return (number - 32) * 5 / 9;
|
|
6909
|
+
case "K":
|
|
6910
|
+
return (number - 32) * 5 / 9 + 273.15;
|
|
6911
|
+
case "Rank":
|
|
6912
|
+
return number + 459.67;
|
|
6913
|
+
case "Reau":
|
|
6914
|
+
return (number - 32) * 4 / 9;
|
|
6915
|
+
default:
|
|
6916
|
+
return number;
|
|
6917
|
+
}
|
|
6918
|
+
}
|
|
6919
|
+
_kelvinConversion(number, to) {
|
|
6920
|
+
switch (to) {
|
|
6921
|
+
case "C":
|
|
6922
|
+
return number - 273.15;
|
|
6923
|
+
case "F":
|
|
6924
|
+
return (number - 273.15) * 9 / 5 + 32;
|
|
6925
|
+
case "Rank":
|
|
6926
|
+
return number * 9 / 5;
|
|
6927
|
+
case "Reau":
|
|
6928
|
+
return (number - 273.15) * 4 / 5;
|
|
6929
|
+
default:
|
|
6930
|
+
return number;
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
_rankineConversion(number, to) {
|
|
6934
|
+
switch (to) {
|
|
6935
|
+
case "C":
|
|
6936
|
+
return (number - 491.67) * 5 / 9;
|
|
6937
|
+
case "F":
|
|
6938
|
+
return number - 459.67;
|
|
6939
|
+
case "K":
|
|
6940
|
+
return number * 5 / 9;
|
|
6941
|
+
case "Reau":
|
|
6942
|
+
return (number - 491.67) * 4 / 9;
|
|
6943
|
+
default:
|
|
6944
|
+
return number;
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
_reaumurConversion(number, to) {
|
|
6948
|
+
switch (to) {
|
|
6949
|
+
case "C":
|
|
6950
|
+
return number * 5 / 4;
|
|
6951
|
+
case "F":
|
|
6952
|
+
return number * 9 / 4 + 32;
|
|
6953
|
+
case "K":
|
|
6954
|
+
return number * 5 / 4 + 273.15;
|
|
6955
|
+
case "Rank":
|
|
6956
|
+
return number * 9 / 4 + 491.67;
|
|
6957
|
+
default:
|
|
6958
|
+
return number;
|
|
6959
|
+
}
|
|
6960
|
+
}
|
|
6961
|
+
};
|
|
6962
|
+
__name(_Convert, "Convert");
|
|
6963
|
+
let Convert = _Convert;
|
|
6964
|
+
const _Dec2bin = class _Dec2bin extends BaseFunction {
|
|
6965
|
+
constructor() {
|
|
6966
|
+
super(...arguments);
|
|
6967
|
+
__publicField(this, "minParams", 1);
|
|
6968
|
+
__publicField(this, "maxParams", 2);
|
|
6969
|
+
}
|
|
6970
|
+
calculate(number, places) {
|
|
6971
|
+
if (number.isNull())
|
|
6972
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
6973
|
+
let placesValue = 0;
|
|
6974
|
+
if (places) {
|
|
6975
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
6976
|
+
if (isError2)
|
|
6977
|
+
return errorObject2;
|
|
6978
|
+
const [placesObject] = variants2;
|
|
6979
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
6980
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6981
|
+
if (placesValue < 0 || placesValue > 10)
|
|
6982
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6983
|
+
}
|
|
6984
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
6985
|
+
if (isError)
|
|
6986
|
+
return errorObject;
|
|
6987
|
+
const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
|
|
6988
|
+
if (Number.isNaN(numberValue))
|
|
6989
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6990
|
+
if (!/^-?[0-9]{1,3}$/.test(`${numberValue}`) || numberValue < -512 || numberValue > 511)
|
|
6991
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6992
|
+
let result;
|
|
6993
|
+
if (numberValue < 0) {
|
|
6994
|
+
const toStr = (512 + numberValue).toString(2);
|
|
6995
|
+
result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
|
|
6996
|
+
} else if (result = Number.parseInt(`${numberValue}`, 10).toString(2), places) {
|
|
6997
|
+
if (placesValue < result.length)
|
|
6998
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6999
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7000
|
+
}
|
|
7001
|
+
return StringValueObject.create(result);
|
|
7002
|
+
}
|
|
7003
|
+
};
|
|
7004
|
+
__name(_Dec2bin, "Dec2bin");
|
|
7005
|
+
let Dec2bin = _Dec2bin;
|
|
7006
|
+
const _Dec2hex = class _Dec2hex extends BaseFunction {
|
|
7007
|
+
constructor() {
|
|
7008
|
+
super(...arguments);
|
|
7009
|
+
__publicField(this, "minParams", 1);
|
|
7010
|
+
__publicField(this, "maxParams", 2);
|
|
7011
|
+
}
|
|
7012
|
+
calculate(number, places) {
|
|
7013
|
+
if (number.isNull())
|
|
7014
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7015
|
+
let placesValue = 0;
|
|
7016
|
+
if (places) {
|
|
7017
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7018
|
+
if (isError2)
|
|
7019
|
+
return errorObject2;
|
|
7020
|
+
const [placesObject] = variants2;
|
|
7021
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7022
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7023
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7024
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7025
|
+
}
|
|
7026
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7027
|
+
if (isError)
|
|
7028
|
+
return errorObject;
|
|
7029
|
+
const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
|
|
7030
|
+
if (Number.isNaN(numberValue))
|
|
7031
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7032
|
+
if (!/^-?[0-9]{1,12}$/.test(`${numberValue}`) || numberValue < -549755813888 || numberValue > 549755813887)
|
|
7033
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7034
|
+
let result;
|
|
7035
|
+
if (numberValue < 0)
|
|
7036
|
+
result = (1099511627776 + numberValue).toString(16);
|
|
7037
|
+
else if (result = Number.parseInt(`${numberValue}`, 10).toString(16), places) {
|
|
7038
|
+
if (placesValue < result.length)
|
|
7039
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7040
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7041
|
+
}
|
|
7042
|
+
return StringValueObject.create(result.toLocaleUpperCase());
|
|
7043
|
+
}
|
|
7044
|
+
};
|
|
7045
|
+
__name(_Dec2hex, "Dec2hex");
|
|
7046
|
+
let Dec2hex = _Dec2hex;
|
|
7047
|
+
const _Dec2oct = class _Dec2oct extends BaseFunction {
|
|
7048
|
+
constructor() {
|
|
7049
|
+
super(...arguments);
|
|
7050
|
+
__publicField(this, "minParams", 1);
|
|
7051
|
+
__publicField(this, "maxParams", 2);
|
|
7052
|
+
}
|
|
7053
|
+
calculate(number, places) {
|
|
7054
|
+
if (number.isNull())
|
|
7055
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7056
|
+
let placesValue = 0;
|
|
7057
|
+
if (places) {
|
|
7058
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7059
|
+
if (isError2)
|
|
7060
|
+
return errorObject2;
|
|
7061
|
+
const [placesObject] = variants2;
|
|
7062
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7063
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7064
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7065
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7066
|
+
}
|
|
7067
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7068
|
+
if (isError)
|
|
7069
|
+
return errorObject;
|
|
7070
|
+
const [numberObject] = variants, numberValue = Math.trunc(+numberObject.getValue());
|
|
7071
|
+
if (Number.isNaN(numberValue))
|
|
7072
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7073
|
+
if (!/^-?[0-9]{1,9}$/.test(`${numberValue}`) || numberValue < -536870912 || numberValue > 536870911)
|
|
7074
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7075
|
+
let result;
|
|
7076
|
+
if (numberValue < 0)
|
|
7077
|
+
result = (1073741824 + numberValue).toString(8);
|
|
7078
|
+
else if (result = Number.parseInt(`${numberValue}`, 10).toString(8), places) {
|
|
7079
|
+
if (placesValue < result.length)
|
|
7080
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7081
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7082
|
+
}
|
|
7083
|
+
return StringValueObject.create(result);
|
|
7084
|
+
}
|
|
7085
|
+
};
|
|
7086
|
+
__name(_Dec2oct, "Dec2oct");
|
|
7087
|
+
let Dec2oct = _Dec2oct;
|
|
7088
|
+
const _Delta = class _Delta extends BaseFunction {
|
|
7089
|
+
constructor() {
|
|
7090
|
+
super(...arguments);
|
|
7091
|
+
__publicField(this, "minParams", 1);
|
|
7092
|
+
__publicField(this, "maxParams", 2);
|
|
7093
|
+
}
|
|
7094
|
+
calculate(number1, number2) {
|
|
7095
|
+
const _number2 = number2 != null ? number2 : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number1, _number2);
|
|
7096
|
+
if (isError)
|
|
7097
|
+
return errorObject;
|
|
7098
|
+
const [number1Object, number2Object] = variants, number1Value = +number1Object.getValue(), number2Value = +number2Object.getValue();
|
|
7099
|
+
if (Number.isNaN(number1Value) || Number.isNaN(number2Value))
|
|
7100
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7101
|
+
const result = number1Value === number2Value ? 1 : 0;
|
|
7102
|
+
return NumberValueObject.create(result);
|
|
7103
|
+
}
|
|
7104
|
+
};
|
|
7105
|
+
__name(_Delta, "Delta");
|
|
7106
|
+
let Delta = _Delta;
|
|
7107
|
+
const _Erf = class _Erf extends BaseFunction {
|
|
7108
|
+
constructor() {
|
|
7109
|
+
super(...arguments);
|
|
7110
|
+
__publicField(this, "minParams", 1);
|
|
7111
|
+
__publicField(this, "maxParams", 2);
|
|
7112
|
+
}
|
|
7113
|
+
calculate(lowerLimit, upperLimit) {
|
|
7114
|
+
let result;
|
|
7115
|
+
if (upperLimit) {
|
|
7116
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(lowerLimit, upperLimit);
|
|
7117
|
+
if (isError)
|
|
7118
|
+
return errorObject;
|
|
7119
|
+
const [lowerLimitObject, upperLimitObject] = variants, lowerLimitValue = +lowerLimitObject.getValue(), upperLimitValue = +upperLimitObject.getValue();
|
|
7120
|
+
if (Number.isNaN(lowerLimitValue) || Number.isNaN(upperLimitValue))
|
|
7121
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7122
|
+
result = erf(upperLimitValue) - erf(lowerLimitValue);
|
|
7123
|
+
} else {
|
|
7124
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(lowerLimit);
|
|
7125
|
+
if (isError)
|
|
7126
|
+
return errorObject;
|
|
7127
|
+
const [lowerLimitObject] = variants, lowerLimitValue = +lowerLimitObject.getValue();
|
|
7128
|
+
if (Number.isNaN(lowerLimitValue))
|
|
7129
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7130
|
+
result = erf(lowerLimitValue);
|
|
7131
|
+
}
|
|
7132
|
+
return NumberValueObject.create(result);
|
|
7133
|
+
}
|
|
7134
|
+
};
|
|
7135
|
+
__name(_Erf, "Erf");
|
|
7136
|
+
let Erf = _Erf;
|
|
7137
|
+
const _ErfPrecise = class _ErfPrecise extends BaseFunction {
|
|
7138
|
+
constructor() {
|
|
7139
|
+
super(...arguments);
|
|
7140
|
+
__publicField(this, "minParams", 1);
|
|
7141
|
+
__publicField(this, "maxParams", 1);
|
|
7142
|
+
}
|
|
7143
|
+
calculate(x) {
|
|
7144
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
|
|
7145
|
+
if (isError)
|
|
7146
|
+
return errorObject;
|
|
7147
|
+
const [xObject] = variants, xValue = +xObject.getValue();
|
|
7148
|
+
if (Number.isNaN(xValue))
|
|
7149
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7150
|
+
const result = erf(xValue);
|
|
7151
|
+
return NumberValueObject.create(result);
|
|
7152
|
+
}
|
|
7153
|
+
};
|
|
7154
|
+
__name(_ErfPrecise, "ErfPrecise");
|
|
7155
|
+
let ErfPrecise = _ErfPrecise;
|
|
7156
|
+
const _Erfc = class _Erfc extends BaseFunction {
|
|
7157
|
+
constructor() {
|
|
7158
|
+
super(...arguments);
|
|
7159
|
+
__publicField(this, "minParams", 1);
|
|
7160
|
+
__publicField(this, "maxParams", 1);
|
|
7161
|
+
}
|
|
7162
|
+
calculate(x) {
|
|
7163
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
|
|
7164
|
+
if (isError)
|
|
7165
|
+
return errorObject;
|
|
7166
|
+
const [xObject] = variants, xValue = +xObject.getValue();
|
|
7167
|
+
if (Number.isNaN(xValue))
|
|
7168
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7169
|
+
const result = 1 - erf(xValue);
|
|
7170
|
+
return NumberValueObject.create(result);
|
|
7171
|
+
}
|
|
7172
|
+
};
|
|
7173
|
+
__name(_Erfc, "Erfc");
|
|
7174
|
+
let Erfc = _Erfc;
|
|
7175
|
+
const _ErfcPrecise = class _ErfcPrecise extends BaseFunction {
|
|
7176
|
+
constructor() {
|
|
7177
|
+
super(...arguments);
|
|
7178
|
+
__publicField(this, "minParams", 1);
|
|
7179
|
+
__publicField(this, "maxParams", 1);
|
|
7180
|
+
}
|
|
7181
|
+
calculate(x) {
|
|
7182
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(x);
|
|
7183
|
+
if (isError)
|
|
7184
|
+
return errorObject;
|
|
7185
|
+
const [xObject] = variants, xValue = +xObject.getValue();
|
|
7186
|
+
if (Number.isNaN(xValue))
|
|
7187
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7188
|
+
const result = 1 - erf(xValue);
|
|
7189
|
+
return NumberValueObject.create(result);
|
|
7190
|
+
}
|
|
7191
|
+
};
|
|
7192
|
+
__name(_ErfcPrecise, "ErfcPrecise");
|
|
7193
|
+
let ErfcPrecise = _ErfcPrecise;
|
|
7194
|
+
const _Hex2bin = class _Hex2bin extends BaseFunction {
|
|
7195
|
+
constructor() {
|
|
7196
|
+
super(...arguments);
|
|
7197
|
+
__publicField(this, "minParams", 1);
|
|
7198
|
+
__publicField(this, "maxParams", 2);
|
|
7199
|
+
}
|
|
7200
|
+
calculate(number, places) {
|
|
7201
|
+
if (number.isNull())
|
|
7202
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7203
|
+
let placesValue = 0;
|
|
7204
|
+
if (places) {
|
|
7205
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7206
|
+
if (isError2)
|
|
7207
|
+
return errorObject2;
|
|
7208
|
+
const [placesObject] = variants2;
|
|
7209
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7210
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7211
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7212
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7213
|
+
}
|
|
7214
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7215
|
+
if (isError)
|
|
7216
|
+
return errorObject;
|
|
7217
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7218
|
+
if (!isValidHexadecimalNumber(numberValue))
|
|
7219
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7220
|
+
const negative = numberValue.length === 10 && numberValue.substring(0, 1).toLocaleUpperCase() === "F", decimal = negative ? Number.parseInt(numberValue, 16) - 1099511627776 : Number.parseInt(numberValue, 16);
|
|
7221
|
+
if (decimal < -512 || decimal > 511)
|
|
7222
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7223
|
+
let result;
|
|
7224
|
+
if (negative) {
|
|
7225
|
+
const toStr = (512 + decimal).toString(2);
|
|
7226
|
+
result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
|
|
7227
|
+
} else if (result = decimal.toString(2), places) {
|
|
7228
|
+
if (placesValue < result.length)
|
|
7229
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7230
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7231
|
+
}
|
|
7232
|
+
return StringValueObject.create(result);
|
|
7233
|
+
}
|
|
7234
|
+
};
|
|
7235
|
+
__name(_Hex2bin, "Hex2bin");
|
|
7236
|
+
let Hex2bin = _Hex2bin;
|
|
7237
|
+
const _Hex2dec = class _Hex2dec extends BaseFunction {
|
|
7238
|
+
constructor() {
|
|
7239
|
+
super(...arguments);
|
|
7240
|
+
__publicField(this, "minParams", 1);
|
|
7241
|
+
__publicField(this, "maxParams", 1);
|
|
7242
|
+
}
|
|
7243
|
+
calculate(number) {
|
|
7244
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7245
|
+
if (isError)
|
|
7246
|
+
return errorObject;
|
|
7247
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7248
|
+
if (!isValidHexadecimalNumber(numberValue))
|
|
7249
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7250
|
+
let result = Number.parseInt(numberValue, 16);
|
|
7251
|
+
return result >= 549755813888 && (result -= 1099511627776), NumberValueObject.create(result);
|
|
7252
|
+
}
|
|
7253
|
+
};
|
|
7254
|
+
__name(_Hex2dec, "Hex2dec");
|
|
7255
|
+
let Hex2dec = _Hex2dec;
|
|
7256
|
+
const _Hex2oct = class _Hex2oct extends BaseFunction {
|
|
7257
|
+
constructor() {
|
|
7258
|
+
super(...arguments);
|
|
7259
|
+
__publicField(this, "minParams", 1);
|
|
7260
|
+
__publicField(this, "maxParams", 2);
|
|
7261
|
+
}
|
|
7262
|
+
calculate(number, places) {
|
|
7263
|
+
if (number.isNull())
|
|
7264
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7265
|
+
let placesValue = 0;
|
|
7266
|
+
if (places) {
|
|
7267
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7268
|
+
if (isError2)
|
|
7269
|
+
return errorObject2;
|
|
7270
|
+
const [placesObject] = variants2;
|
|
7271
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7272
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7273
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7274
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7275
|
+
}
|
|
7276
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7277
|
+
if (isError)
|
|
7278
|
+
return errorObject;
|
|
7279
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7280
|
+
if (!isValidHexadecimalNumber(numberValue))
|
|
7281
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7282
|
+
const decimal = Number.parseInt(numberValue, 16);
|
|
7283
|
+
if (decimal > 536870911 && decimal < 1098974756864)
|
|
7284
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7285
|
+
let result;
|
|
7286
|
+
if (decimal >= 1098974756864)
|
|
7287
|
+
result = (decimal - 1098437885952).toString(8);
|
|
7288
|
+
else if (result = decimal.toString(8), places) {
|
|
7289
|
+
if (placesValue < result.length)
|
|
7290
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7291
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7292
|
+
}
|
|
7293
|
+
return StringValueObject.create(result);
|
|
7294
|
+
}
|
|
7295
|
+
};
|
|
7296
|
+
__name(_Hex2oct, "Hex2oct");
|
|
7297
|
+
let Hex2oct = _Hex2oct;
|
|
7298
|
+
const _Oct2bin = class _Oct2bin extends BaseFunction {
|
|
7299
|
+
constructor() {
|
|
7300
|
+
super(...arguments);
|
|
7301
|
+
__publicField(this, "minParams", 1);
|
|
7302
|
+
__publicField(this, "maxParams", 2);
|
|
7303
|
+
}
|
|
7304
|
+
calculate(number, places) {
|
|
7305
|
+
if (number.isNull())
|
|
7306
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7307
|
+
let placesValue = 0;
|
|
7308
|
+
if (places) {
|
|
7309
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7310
|
+
if (isError2)
|
|
7311
|
+
return errorObject2;
|
|
7312
|
+
const [placesObject] = variants2;
|
|
7313
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7314
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7315
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7316
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7317
|
+
}
|
|
7318
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7319
|
+
if (isError)
|
|
7320
|
+
return errorObject;
|
|
7321
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7322
|
+
if (!isValidOctalNumber(numberValue))
|
|
7323
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7324
|
+
const negative = numberValue.length === 10 && numberValue.substring(0, 1) === "7", decimal = negative ? Number.parseInt(numberValue, 8) - 1073741824 : Number.parseInt(numberValue, 8);
|
|
7325
|
+
if (decimal < -512 || decimal > 511)
|
|
7326
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7327
|
+
let result;
|
|
7328
|
+
if (negative) {
|
|
7329
|
+
const toStr = (512 + decimal).toString(2);
|
|
7330
|
+
result = `1${"0".repeat(9 - toStr.length)}${toStr}`;
|
|
7331
|
+
} else if (result = decimal.toString(2), places) {
|
|
7332
|
+
if (placesValue < result.length)
|
|
7333
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7334
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7335
|
+
}
|
|
7336
|
+
return StringValueObject.create(result);
|
|
7337
|
+
}
|
|
7338
|
+
};
|
|
7339
|
+
__name(_Oct2bin, "Oct2bin");
|
|
7340
|
+
let Oct2bin = _Oct2bin;
|
|
7341
|
+
const _Oct2dec = class _Oct2dec extends BaseFunction {
|
|
7342
|
+
constructor() {
|
|
7343
|
+
super(...arguments);
|
|
7344
|
+
__publicField(this, "minParams", 1);
|
|
7345
|
+
__publicField(this, "maxParams", 1);
|
|
7346
|
+
}
|
|
7347
|
+
calculate(number) {
|
|
7348
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7349
|
+
if (isError)
|
|
7350
|
+
return errorObject;
|
|
7351
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7352
|
+
if (!isValidOctalNumber(numberValue))
|
|
7353
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7354
|
+
let result = Number.parseInt(numberValue, 8);
|
|
7355
|
+
return result >= 536870912 && (result -= 1073741824), NumberValueObject.create(result);
|
|
7356
|
+
}
|
|
7357
|
+
};
|
|
7358
|
+
__name(_Oct2dec, "Oct2dec");
|
|
7359
|
+
let Oct2dec = _Oct2dec;
|
|
7360
|
+
const _Oct2hex = class _Oct2hex extends BaseFunction {
|
|
7361
|
+
constructor() {
|
|
7362
|
+
super(...arguments);
|
|
7363
|
+
__publicField(this, "minParams", 1);
|
|
7364
|
+
__publicField(this, "maxParams", 2);
|
|
7365
|
+
}
|
|
7366
|
+
calculate(number, places) {
|
|
7367
|
+
if (number.isNull())
|
|
7368
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7369
|
+
let placesValue = 0;
|
|
7370
|
+
if (places) {
|
|
7371
|
+
const { isError: isError2, errorObject: errorObject2, variants: variants2 } = checkVariantsErrorIsArrayOrBoolean(places);
|
|
7372
|
+
if (isError2)
|
|
7373
|
+
return errorObject2;
|
|
7374
|
+
const [placesObject] = variants2;
|
|
7375
|
+
if (placesValue = Math.floor(+placesObject.getValue()), Number.isNaN(placesValue))
|
|
7376
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7377
|
+
if (placesValue < 0 || placesValue > 10)
|
|
7378
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7379
|
+
}
|
|
7380
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(number);
|
|
7381
|
+
if (isError)
|
|
7382
|
+
return errorObject;
|
|
7383
|
+
const [numberObject] = variants, numberValue = `${numberObject.getValue()}`;
|
|
7384
|
+
if (!isValidOctalNumber(numberValue))
|
|
7385
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7386
|
+
const decimal = Number.parseInt(numberValue, 8);
|
|
7387
|
+
let result;
|
|
7388
|
+
if (decimal >= 536870912)
|
|
7389
|
+
result = `ff${(decimal + 3221225472).toString(16)}`;
|
|
7390
|
+
else if (result = decimal.toString(16), places) {
|
|
7391
|
+
if (placesValue < result.length)
|
|
7392
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7393
|
+
result = "0".repeat(placesValue - result.length) + result;
|
|
7394
|
+
}
|
|
7395
|
+
return StringValueObject.create(result.toLocaleUpperCase());
|
|
7396
|
+
}
|
|
7397
|
+
};
|
|
7398
|
+
__name(_Oct2hex, "Oct2hex");
|
|
7399
|
+
let Oct2hex = _Oct2hex;
|
|
7400
|
+
const functionEngineering = [
|
|
7401
|
+
[Besseli, FUNCTION_NAMES_ENGINEERING.BESSELI],
|
|
7402
|
+
[Besselj, FUNCTION_NAMES_ENGINEERING.BESSELJ],
|
|
7403
|
+
[Besselk, FUNCTION_NAMES_ENGINEERING.BESSELK],
|
|
7404
|
+
[Bessely, FUNCTION_NAMES_ENGINEERING.BESSELY],
|
|
7405
|
+
[Bin2dec, FUNCTION_NAMES_ENGINEERING.BIN2DEC],
|
|
7406
|
+
[Bin2hex, FUNCTION_NAMES_ENGINEERING.BIN2HEX],
|
|
7407
|
+
[Bin2oct, FUNCTION_NAMES_ENGINEERING.BIN2OCT],
|
|
7408
|
+
[Bitand, FUNCTION_NAMES_ENGINEERING.BITAND],
|
|
7409
|
+
[Bitlshift, FUNCTION_NAMES_ENGINEERING.BITLSHIFT],
|
|
7410
|
+
[Bitor, FUNCTION_NAMES_ENGINEERING.BITOR],
|
|
7411
|
+
[Bitrshift, FUNCTION_NAMES_ENGINEERING.BITRSHIFT],
|
|
7412
|
+
[Bitxor, FUNCTION_NAMES_ENGINEERING.BITXOR],
|
|
7413
|
+
[Complex, FUNCTION_NAMES_ENGINEERING.COMPLEX],
|
|
7414
|
+
[Convert, FUNCTION_NAMES_ENGINEERING.CONVERT],
|
|
7415
|
+
[Dec2bin, FUNCTION_NAMES_ENGINEERING.DEC2BIN],
|
|
7416
|
+
[Dec2hex, FUNCTION_NAMES_ENGINEERING.DEC2HEX],
|
|
7417
|
+
[Dec2oct, FUNCTION_NAMES_ENGINEERING.DEC2OCT],
|
|
7418
|
+
[Delta, FUNCTION_NAMES_ENGINEERING.DELTA],
|
|
7419
|
+
[Erf, FUNCTION_NAMES_ENGINEERING.ERF],
|
|
7420
|
+
[ErfPrecise, FUNCTION_NAMES_ENGINEERING.ERF_PRECISE],
|
|
7421
|
+
[Erfc, FUNCTION_NAMES_ENGINEERING.ERFC],
|
|
7422
|
+
[ErfcPrecise, FUNCTION_NAMES_ENGINEERING.ERFC_PRECISE],
|
|
7423
|
+
[Hex2bin, FUNCTION_NAMES_ENGINEERING.HEX2BIN],
|
|
7424
|
+
[Hex2dec, FUNCTION_NAMES_ENGINEERING.HEX2DEC],
|
|
7425
|
+
[Hex2oct, FUNCTION_NAMES_ENGINEERING.HEX2OCT],
|
|
7426
|
+
[Oct2bin, FUNCTION_NAMES_ENGINEERING.OCT2BIN],
|
|
7427
|
+
[Oct2dec, FUNCTION_NAMES_ENGINEERING.OCT2DEC],
|
|
7428
|
+
[Oct2hex, FUNCTION_NAMES_ENGINEERING.OCT2HEX]
|
|
7429
|
+
];
|
|
7430
|
+
var FUNCTION_NAMES_FINANCIAL = /* @__PURE__ */ ((FUNCTION_NAMES_FINANCIAL2) => (FUNCTION_NAMES_FINANCIAL2.ACCRINT = "ACCRINT", FUNCTION_NAMES_FINANCIAL2.ACCRINTM = "ACCRINTM", FUNCTION_NAMES_FINANCIAL2.AMORDEGRC = "AMORDEGRC", FUNCTION_NAMES_FINANCIAL2.AMORLINC = "AMORLINC", FUNCTION_NAMES_FINANCIAL2.COUPDAYBS = "COUPDAYBS", FUNCTION_NAMES_FINANCIAL2.COUPDAYS = "COUPDAYS", FUNCTION_NAMES_FINANCIAL2.COUPDAYSNC = "COUPDAYSNC", FUNCTION_NAMES_FINANCIAL2.COUPNCD = "COUPNCD", FUNCTION_NAMES_FINANCIAL2.COUPNUM = "COUPNUM", FUNCTION_NAMES_FINANCIAL2.COUPPCD = "COUPPCD", FUNCTION_NAMES_FINANCIAL2.CUMIPMT = "CUMIPMT", FUNCTION_NAMES_FINANCIAL2.CUMPRINC = "CUMPRINC", FUNCTION_NAMES_FINANCIAL2.DB = "DB", FUNCTION_NAMES_FINANCIAL2.DDB = "DDB", FUNCTION_NAMES_FINANCIAL2.DISC = "DISC", FUNCTION_NAMES_FINANCIAL2.DOLLARDE = "DOLLARDE", FUNCTION_NAMES_FINANCIAL2.DOLLARFR = "DOLLARFR", FUNCTION_NAMES_FINANCIAL2.DURATION = "DURATION", FUNCTION_NAMES_FINANCIAL2.EFFECT = "EFFECT", FUNCTION_NAMES_FINANCIAL2.FV = "FV", FUNCTION_NAMES_FINANCIAL2.FVSCHEDULE = "FVSCHEDULE", FUNCTION_NAMES_FINANCIAL2.INTRATE = "INTRATE", FUNCTION_NAMES_FINANCIAL2.IPMT = "IPMT", FUNCTION_NAMES_FINANCIAL2.IRR = "IRR", FUNCTION_NAMES_FINANCIAL2.ISPMT = "ISPMT", FUNCTION_NAMES_FINANCIAL2.MDURATION = "MDURATION", FUNCTION_NAMES_FINANCIAL2.MIRR = "MIRR", FUNCTION_NAMES_FINANCIAL2.NOMINAL = "NOMINAL", FUNCTION_NAMES_FINANCIAL2.NPER = "NPER", FUNCTION_NAMES_FINANCIAL2.NPV = "NPV", FUNCTION_NAMES_FINANCIAL2.ODDFPRICE = "ODDFPRICE", FUNCTION_NAMES_FINANCIAL2.ODDFYIELD = "ODDFYIELD", FUNCTION_NAMES_FINANCIAL2.ODDLPRICE = "ODDLPRICE", FUNCTION_NAMES_FINANCIAL2.ODDLYIELD = "ODDLYIELD", FUNCTION_NAMES_FINANCIAL2.PDURATION = "PDURATION", FUNCTION_NAMES_FINANCIAL2.PMT = "PMT", FUNCTION_NAMES_FINANCIAL2.PPMT = "PPMT", FUNCTION_NAMES_FINANCIAL2.PRICE = "PRICE", FUNCTION_NAMES_FINANCIAL2.PRICEDISC = "PRICEDISC", FUNCTION_NAMES_FINANCIAL2.PRICEMAT = "PRICEMAT", FUNCTION_NAMES_FINANCIAL2.PV = "PV", FUNCTION_NAMES_FINANCIAL2.RATE = "RATE", FUNCTION_NAMES_FINANCIAL2.RECEIVED = "RECEIVED", FUNCTION_NAMES_FINANCIAL2.RRI = "RRI", FUNCTION_NAMES_FINANCIAL2.SLN = "SLN", FUNCTION_NAMES_FINANCIAL2.SYD = "SYD", FUNCTION_NAMES_FINANCIAL2.TBILLEQ = "TBILLEQ", FUNCTION_NAMES_FINANCIAL2.TBILLPRICE = "TBILLPRICE", FUNCTION_NAMES_FINANCIAL2.TBILLYIELD = "TBILLYIELD", FUNCTION_NAMES_FINANCIAL2.VDB = "VDB", FUNCTION_NAMES_FINANCIAL2.XIRR = "XIRR", FUNCTION_NAMES_FINANCIAL2.XNPV = "XNPV", FUNCTION_NAMES_FINANCIAL2.YIELD = "YIELD", FUNCTION_NAMES_FINANCIAL2.YIELDDISC = "YIELDDISC", FUNCTION_NAMES_FINANCIAL2.YIELDMAT = "YIELDMAT", FUNCTION_NAMES_FINANCIAL2))(FUNCTION_NAMES_FINANCIAL || {});
|
|
7431
|
+
const _Accrint = class _Accrint extends BaseFunction {
|
|
7432
|
+
constructor() {
|
|
7433
|
+
super(...arguments);
|
|
7434
|
+
__publicField(this, "minParams", 6);
|
|
7435
|
+
__publicField(this, "maxParams", 8);
|
|
7436
|
+
}
|
|
7437
|
+
calculate(issue, firstInterest, settlement, rate, par, frequency, basis, calcMethod) {
|
|
7438
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), _calcMethod = calcMethod != null ? calcMethod : BooleanValueObject.create(!0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(issue, firstInterest, settlement, rate, par, frequency, _basis);
|
|
7439
|
+
if (isError)
|
|
7440
|
+
return errorObject;
|
|
7441
|
+
const [issueObject, firstInterestObject, settlementObject, rateObject, parObject, frequencyObject, basisObject] = variants, issueSerialNumber = getDateSerialNumberByObject(issueObject);
|
|
7442
|
+
if (typeof issueSerialNumber != "number")
|
|
7443
|
+
return issueSerialNumber;
|
|
7444
|
+
const firstInterestSerialNumber = getDateSerialNumberByObject(firstInterestObject);
|
|
7445
|
+
if (typeof firstInterestSerialNumber != "number")
|
|
7446
|
+
return firstInterestSerialNumber;
|
|
7447
|
+
const settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7448
|
+
if (typeof settlementSerialNumber != "number")
|
|
7449
|
+
return settlementSerialNumber;
|
|
7450
|
+
const rateValue = +rateObject.getValue(), parValue = +parObject.getValue(), frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue()), calcMethodValue = +_calcMethod.getValue();
|
|
7451
|
+
return Number.isNaN(rateValue) || Number.isNaN(parValue) || Number.isNaN(frequencyValue) || Number.isNaN(basisValue) || Number.isNaN(calcMethodValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || parValue <= 0 || ![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(issueSerialNumber) >= Math.floor(settlementSerialNumber) ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(issueSerialNumber, firstInterestSerialNumber, settlementSerialNumber, rateValue, parValue, frequencyValue, basisValue, calcMethodValue);
|
|
7452
|
+
}
|
|
7453
|
+
_getResult(issueSerialNumber, firstInterestSerialNumber, settlementSerialNumber, rateValue, parValue, frequencyValue, basisValue, calcMethodValue) {
|
|
7454
|
+
let TwoDateDays;
|
|
7455
|
+
Math.floor(settlementSerialNumber) >= Math.floor(firstInterestSerialNumber) && !calcMethodValue ? TwoDateDays = getTwoDateDaysByBasis(firstInterestSerialNumber, settlementSerialNumber, basisValue) : TwoDateDays = getTwoDateDaysByBasis(issueSerialNumber, settlementSerialNumber, basisValue);
|
|
7456
|
+
const { days, yearDays } = TwoDateDays, NC = Math.ceil(days / yearDays * frequencyValue), NLi = yearDays / frequencyValue;
|
|
7457
|
+
let accruedDaysSum = 0;
|
|
7458
|
+
for (let i = 1; i <= NC; i++)
|
|
7459
|
+
if (i * NLi > days) {
|
|
7460
|
+
const Ai = days - (i - 1) * NLi;
|
|
7461
|
+
accruedDaysSum += Ai / NLi;
|
|
7462
|
+
} else
|
|
7463
|
+
accruedDaysSum += 1;
|
|
7464
|
+
const result = parValue * (rateValue / frequencyValue) * accruedDaysSum;
|
|
7465
|
+
return NumberValueObject.create(result);
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
__name(_Accrint, "Accrint");
|
|
7469
|
+
let Accrint = _Accrint;
|
|
7470
|
+
const _Accrintm = class _Accrintm extends BaseFunction {
|
|
7471
|
+
constructor() {
|
|
7472
|
+
super(...arguments);
|
|
7473
|
+
__publicField(this, "minParams", 4);
|
|
7474
|
+
__publicField(this, "maxParams", 5);
|
|
7475
|
+
}
|
|
7476
|
+
calculate(issue, settlement, rate, par, basis) {
|
|
7477
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(issue, settlement, rate, par, _basis);
|
|
7478
|
+
if (isError)
|
|
7479
|
+
return errorObject;
|
|
7480
|
+
const [issueObject, settlementObject, rateObject, parObject, basisObject] = variants, issueSerialNumber = getDateSerialNumberByObject(issueObject);
|
|
7481
|
+
if (typeof issueSerialNumber != "number")
|
|
7482
|
+
return issueSerialNumber;
|
|
7483
|
+
const settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7484
|
+
if (typeof settlementSerialNumber != "number")
|
|
7485
|
+
return settlementSerialNumber;
|
|
7486
|
+
const rateValue = +rateObject.getValue(), parValue = +parObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
|
|
7487
|
+
if (Number.isNaN(rateValue) || Number.isNaN(parValue) || Number.isNaN(basisValue))
|
|
7488
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7489
|
+
if (rateValue <= 0 || parValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(issueSerialNumber) > Math.floor(settlementSerialNumber))
|
|
7490
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7491
|
+
if (Math.floor(issueSerialNumber) === Math.floor(settlementSerialNumber))
|
|
7492
|
+
return NumberValueObject.create(0);
|
|
7493
|
+
const { days, yearDays } = getTwoDateDaysByBasis(issueSerialNumber, settlementSerialNumber, basisValue), result = parValue * rateValue * days / yearDays;
|
|
7494
|
+
return NumberValueObject.create(result);
|
|
7495
|
+
}
|
|
7496
|
+
};
|
|
7497
|
+
__name(_Accrintm, "Accrintm");
|
|
7498
|
+
let Accrintm = _Accrintm;
|
|
7499
|
+
const _Amorlinc = class _Amorlinc extends BaseFunction {
|
|
7500
|
+
constructor() {
|
|
7501
|
+
super(...arguments);
|
|
7502
|
+
__publicField(this, "minParams", 6);
|
|
7503
|
+
__publicField(this, "maxParams", 7);
|
|
7504
|
+
}
|
|
7505
|
+
calculate(cost, datePurchased, firstPeriod, salvage, period, rate, basis) {
|
|
7506
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(cost, datePurchased, firstPeriod, salvage, period, rate, _basis);
|
|
7507
|
+
if (isError)
|
|
7508
|
+
return errorObject;
|
|
7509
|
+
const [costObject, datePurchasedObject, firstPeriodObject, salvageObject, periodObject, rateObject, basisObject] = variants, datePurchasedSerialNumber = getDateSerialNumberByObject(datePurchasedObject);
|
|
7510
|
+
if (typeof datePurchasedSerialNumber != "number")
|
|
7511
|
+
return datePurchasedSerialNumber;
|
|
7512
|
+
const firstPeriodSerialNumber = getDateSerialNumberByObject(firstPeriodObject);
|
|
7513
|
+
if (typeof firstPeriodSerialNumber != "number")
|
|
7514
|
+
return firstPeriodSerialNumber;
|
|
7515
|
+
const costValue = +costObject.getValue(), salvageValue = +salvageObject.getValue();
|
|
7516
|
+
let periodValue = +periodObject.getValue();
|
|
7517
|
+
const rateValue = +rateObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
|
|
7518
|
+
return Number.isNaN(costValue) || Number.isNaN(salvageValue) || Number.isNaN(periodValue) || Number.isNaN(rateValue) || Number.isNaN(basisValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : costValue <= 0 || salvageValue < 0 || costValue < salvageValue || Math.floor(datePurchasedSerialNumber) > Math.floor(firstPeriodSerialNumber) || periodValue < 0 || rateValue <= 0 || ![0, 1, 3, 4].includes(basisValue) ? ErrorValueObject.create(ErrorType$1.NUM) : (periodValue > 1 ? periodValue = Math.floor(periodValue) : periodValue = Math.ceil(periodValue), this._getResult(costValue, datePurchasedSerialNumber, firstPeriodSerialNumber, salvageValue, periodValue, rateValue, basisValue));
|
|
7519
|
+
}
|
|
7520
|
+
_getResult(costValue, datePurchasedSerialNumber, firstPeriodSerialNumber, salvageValue, periodValue, rateValue, basisValue) {
|
|
7521
|
+
const totalDepreciation = costValue - salvageValue, baseDepreciation = costValue * rateValue, { days, yearDays } = getTwoDateDaysByBasis(datePurchasedSerialNumber, firstPeriodSerialNumber, basisValue), firstPeriodYearsFraction = days / yearDays, life = Math.ceil(totalDepreciation / baseDepreciation - firstPeriodYearsFraction);
|
|
7522
|
+
if (life < 0)
|
|
7523
|
+
return NumberValueObject.create(costValue);
|
|
7524
|
+
let result = baseDepreciation;
|
|
7525
|
+
return periodValue === 0 ? result = baseDepreciation * firstPeriodYearsFraction : periodValue === life ? result = totalDepreciation - baseDepreciation * (firstPeriodYearsFraction + periodValue - 1) : periodValue > life && (result = 0), NumberValueObject.create(result);
|
|
7526
|
+
}
|
|
7527
|
+
};
|
|
7528
|
+
__name(_Amorlinc, "Amorlinc");
|
|
7529
|
+
let Amorlinc = _Amorlinc;
|
|
7530
|
+
const _Coupdaybs = class _Coupdaybs extends BaseFunction {
|
|
7531
|
+
constructor() {
|
|
7532
|
+
super(...arguments);
|
|
7533
|
+
__publicField(this, "minParams", 3);
|
|
7534
|
+
__publicField(this, "maxParams", 4);
|
|
7535
|
+
}
|
|
7536
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7537
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7538
|
+
if (isError)
|
|
7539
|
+
return errorObject;
|
|
7540
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7541
|
+
if (typeof settlementSerialNumber != "number")
|
|
7542
|
+
return settlementSerialNumber;
|
|
7543
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7544
|
+
if (typeof maturitySerialNumber != "number")
|
|
7545
|
+
return maturitySerialNumber;
|
|
7546
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7547
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7548
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7549
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7550
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7551
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7552
|
+
for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
|
|
7553
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
|
|
7554
|
+
let coupDateSerialNumber = excelDateSerial(coupDate);
|
|
7555
|
+
coupDateSerialNumber < 0 && (coupDateSerialNumber = 0);
|
|
7556
|
+
const { days } = getTwoDateDaysByBasis(coupDateSerialNumber, settlementSerialNumber, basisValue);
|
|
7557
|
+
return NumberValueObject.create(days);
|
|
7558
|
+
}
|
|
7559
|
+
};
|
|
7560
|
+
__name(_Coupdaybs, "Coupdaybs");
|
|
7561
|
+
let Coupdaybs = _Coupdaybs;
|
|
7562
|
+
const _Coupdays = class _Coupdays extends BaseFunction {
|
|
7563
|
+
constructor() {
|
|
7564
|
+
super(...arguments);
|
|
7565
|
+
__publicField(this, "minParams", 3);
|
|
7566
|
+
__publicField(this, "maxParams", 4);
|
|
7567
|
+
}
|
|
7568
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7569
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7570
|
+
if (isError)
|
|
7571
|
+
return errorObject;
|
|
7572
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7573
|
+
if (typeof settlementSerialNumber != "number")
|
|
7574
|
+
return settlementSerialNumber;
|
|
7575
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7576
|
+
if (typeof maturitySerialNumber != "number")
|
|
7577
|
+
return maturitySerialNumber;
|
|
7578
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7579
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7580
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7581
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7582
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7583
|
+
let result;
|
|
7584
|
+
if (basisValue === 1) {
|
|
7585
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7586
|
+
for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
|
|
7587
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
|
|
7588
|
+
const beforeSettlementDateSerialNumber = excelDateSerial(coupDate);
|
|
7589
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
|
|
7590
|
+
const afterSettlementDateSerialNumber = excelDateSerial(coupDate);
|
|
7591
|
+
beforeSettlementDateSerialNumber < 0 && frequencyValue === 1 ? result = 365 : result = afterSettlementDateSerialNumber - beforeSettlementDateSerialNumber;
|
|
7592
|
+
} else basisValue === 3 ? result = 365 / frequencyValue : result = 360 / frequencyValue;
|
|
7593
|
+
return NumberValueObject.create(result);
|
|
7594
|
+
}
|
|
7595
|
+
};
|
|
7596
|
+
__name(_Coupdays, "Coupdays");
|
|
7597
|
+
let Coupdays = _Coupdays;
|
|
7598
|
+
const _Coupdaysnc = class _Coupdaysnc extends BaseFunction {
|
|
7599
|
+
constructor() {
|
|
7600
|
+
super(...arguments);
|
|
7601
|
+
__publicField(this, "minParams", 3);
|
|
7602
|
+
__publicField(this, "maxParams", 4);
|
|
7603
|
+
}
|
|
7604
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7605
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7606
|
+
if (isError)
|
|
7607
|
+
return errorObject;
|
|
7608
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7609
|
+
if (typeof settlementSerialNumber != "number")
|
|
7610
|
+
return settlementSerialNumber;
|
|
7611
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7612
|
+
if (typeof maturitySerialNumber != "number")
|
|
7613
|
+
return maturitySerialNumber;
|
|
7614
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7615
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7616
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7617
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7618
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7619
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7620
|
+
for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
|
|
7621
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
|
|
7622
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
|
|
7623
|
+
const coupDateSerialNumber = excelDateSerial(coupDate), { days } = getTwoDateDaysByBasis(settlementSerialNumber, coupDateSerialNumber, basisValue);
|
|
7624
|
+
return NumberValueObject.create(days);
|
|
7625
|
+
}
|
|
7626
|
+
};
|
|
7627
|
+
__name(_Coupdaysnc, "Coupdaysnc");
|
|
7628
|
+
let Coupdaysnc = _Coupdaysnc;
|
|
7629
|
+
const _Coupncd = class _Coupncd extends BaseFunction {
|
|
7630
|
+
constructor() {
|
|
7631
|
+
super(...arguments);
|
|
7632
|
+
__publicField(this, "minParams", 3);
|
|
7633
|
+
__publicField(this, "maxParams", 4);
|
|
7634
|
+
}
|
|
7635
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7636
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7637
|
+
if (isError)
|
|
7638
|
+
return errorObject;
|
|
7639
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7640
|
+
if (typeof settlementSerialNumber != "number")
|
|
7641
|
+
return settlementSerialNumber;
|
|
7642
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7643
|
+
if (typeof maturitySerialNumber != "number")
|
|
7644
|
+
return maturitySerialNumber;
|
|
7645
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7646
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7647
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7648
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7649
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7650
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7651
|
+
for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
|
|
7652
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
|
|
7653
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() + 12 / frequencyValue);
|
|
7654
|
+
const coupDateSerialNumber = excelDateSerial(coupDate);
|
|
7655
|
+
return NumberValueObject.create(coupDateSerialNumber);
|
|
7656
|
+
}
|
|
7657
|
+
};
|
|
7658
|
+
__name(_Coupncd, "Coupncd");
|
|
7659
|
+
let Coupncd = _Coupncd;
|
|
7660
|
+
const _Coupnum = class _Coupnum extends BaseFunction {
|
|
7661
|
+
constructor() {
|
|
7662
|
+
super(...arguments);
|
|
7663
|
+
__publicField(this, "minParams", 3);
|
|
7664
|
+
__publicField(this, "maxParams", 4);
|
|
7665
|
+
}
|
|
7666
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7667
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7668
|
+
if (isError)
|
|
7669
|
+
return errorObject;
|
|
7670
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7671
|
+
if (typeof settlementSerialNumber != "number")
|
|
7672
|
+
return settlementSerialNumber;
|
|
7673
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7674
|
+
if (typeof maturitySerialNumber != "number")
|
|
7675
|
+
return maturitySerialNumber;
|
|
7676
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7677
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7678
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7679
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7680
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7681
|
+
let result = 0;
|
|
7682
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7683
|
+
for (; coupDate > settlementDate; )
|
|
7684
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue), result++;
|
|
7685
|
+
return excelDateSerial(coupDate) < 0 ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
7686
|
+
}
|
|
7687
|
+
};
|
|
7688
|
+
__name(_Coupnum, "Coupnum");
|
|
7689
|
+
let Coupnum = _Coupnum;
|
|
7690
|
+
const _Couppcd = class _Couppcd extends BaseFunction {
|
|
7691
|
+
constructor() {
|
|
7692
|
+
super(...arguments);
|
|
7693
|
+
__publicField(this, "minParams", 3);
|
|
7694
|
+
__publicField(this, "maxParams", 4);
|
|
7695
|
+
}
|
|
7696
|
+
calculate(settlement, maturity, frequency, basis) {
|
|
7697
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, frequency, _basis);
|
|
7698
|
+
if (isError)
|
|
7699
|
+
return errorObject;
|
|
7700
|
+
const [settlementObject, maturityObject, frequencyObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7701
|
+
if (typeof settlementSerialNumber != "number")
|
|
7702
|
+
return settlementSerialNumber;
|
|
7703
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7704
|
+
if (typeof maturitySerialNumber != "number")
|
|
7705
|
+
return maturitySerialNumber;
|
|
7706
|
+
const frequencyValue = Math.floor(+frequencyObject.getValue()), basisValue = Math.floor(+basisObject.getValue());
|
|
7707
|
+
if (Number.isNaN(frequencyValue) || Number.isNaN(basisValue))
|
|
7708
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7709
|
+
if (![1, 2, 4].includes(frequencyValue) || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7710
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7711
|
+
const settlementDate = excelSerialToDate(settlementSerialNumber), coupDate = excelSerialToDate(maturitySerialNumber);
|
|
7712
|
+
for (coupDate.setUTCFullYear(settlementDate.getUTCFullYear()), coupDate < settlementDate && coupDate.setUTCFullYear(coupDate.getUTCFullYear() + 1); coupDate > settlementDate; )
|
|
7713
|
+
coupDate.setUTCMonth(coupDate.getUTCMonth() - 12 / frequencyValue);
|
|
7714
|
+
let coupDateSerialNumber = excelDateSerial(coupDate);
|
|
7715
|
+
return coupDateSerialNumber < 0 && (coupDateSerialNumber = 0), NumberValueObject.create(coupDateSerialNumber);
|
|
7716
|
+
}
|
|
7717
|
+
};
|
|
7718
|
+
__name(_Couppcd, "Couppcd");
|
|
7719
|
+
let Couppcd = _Couppcd;
|
|
7720
|
+
function calculatePMT(rate, nper, pv, fv, type) {
|
|
7721
|
+
let result;
|
|
7722
|
+
if (rate === 0)
|
|
7723
|
+
result = (pv + fv) / nper;
|
|
7724
|
+
else {
|
|
7725
|
+
const term = (1 + rate) ** nper;
|
|
7726
|
+
result = type === 1 ? (fv * rate / (term - 1) + pv * rate / (1 - 1 / term)) / (1 + rate) : fv * rate / (term - 1) + pv * rate / (1 - 1 / term);
|
|
7727
|
+
}
|
|
7728
|
+
return -result;
|
|
7729
|
+
}
|
|
7730
|
+
__name(calculatePMT, "calculatePMT");
|
|
7731
|
+
function calculateFV(rate, nper, pmt, pv, type) {
|
|
7732
|
+
let result;
|
|
7733
|
+
if (rate === 0)
|
|
7734
|
+
result = pv + pmt * nper;
|
|
7735
|
+
else {
|
|
7736
|
+
const term = (1 + rate) ** nper;
|
|
7737
|
+
result = type === 1 ? pv * term + pmt * (1 + rate) * (term - 1) / rate : pv * term + pmt * (term - 1) / rate;
|
|
7738
|
+
}
|
|
7739
|
+
return -result;
|
|
7740
|
+
}
|
|
7741
|
+
__name(calculateFV, "calculateFV");
|
|
7742
|
+
function calculateIPMT(rate, per, nper, pv, fv, type) {
|
|
7743
|
+
const payment = calculatePMT(rate, nper, pv, fv, type);
|
|
7744
|
+
return (per === 1 ? type === 1 ? 0 : -pv : type === 1 ? calculateFV(rate, per - 2, payment, pv, 1) - payment : calculateFV(rate, per - 1, payment, pv, 0)) * rate;
|
|
7745
|
+
}
|
|
7746
|
+
__name(calculateIPMT, "calculateIPMT");
|
|
7747
|
+
const _Cumipmt = class _Cumipmt extends BaseFunction {
|
|
7748
|
+
constructor() {
|
|
7749
|
+
super(...arguments);
|
|
7750
|
+
__publicField(this, "minParams", 6);
|
|
7751
|
+
__publicField(this, "maxParams", 6);
|
|
7752
|
+
}
|
|
7753
|
+
calculate(rate, nper, pv, startPeriod, endPeriod, type) {
|
|
7754
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(rate, nper, pv, startPeriod, endPeriod, type);
|
|
7755
|
+
if (isError)
|
|
7756
|
+
return errorObject;
|
|
7757
|
+
const [rateObject, nperObject, pvObject, startPeriodObject, endPeriodObject, typeObject] = variants, rateValue = +rateObject.getValue(), nperValue = +nperObject.getValue(), pvValue = +pvObject.getValue(), startPeriodValue = +startPeriodObject.getValue(), endPeriodValue = +endPeriodObject.getValue(), typeValue = +typeObject.getValue();
|
|
7758
|
+
return Number.isNaN(rateValue) || Number.isNaN(nperValue) || Number.isNaN(pvValue) || Number.isNaN(startPeriodValue) || Number.isNaN(endPeriodValue) || Number.isNaN(typeValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || nperValue <= 0 || pvValue <= 0 || startPeriodValue < 1 || endPeriodValue < 1 || startPeriodValue > endPeriodValue || startPeriodValue > nperValue || endPeriodValue > nperValue || ![0, 1].includes(typeValue) ? ErrorValueObject.create(ErrorType$1.NUM) : Math.trunc(startPeriodValue) !== startPeriodValue && Math.trunc(endPeriodValue) !== endPeriodValue && Math.trunc(startPeriodValue) === Math.trunc(endPeriodValue) ? NumberValueObject.create(0) : this._getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue);
|
|
7759
|
+
}
|
|
7760
|
+
_getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue) {
|
|
7761
|
+
const payment = calculatePMT(rateValue, nperValue, pvValue, 0, typeValue);
|
|
7762
|
+
let result = 0, _startPeriodValue = Math.ceil(startPeriodValue);
|
|
7763
|
+
_startPeriodValue === 1 && (typeValue === 0 && (result = -pvValue), _startPeriodValue++);
|
|
7764
|
+
let canNotCalculate = !1;
|
|
7765
|
+
for (let i = _startPeriodValue; i <= endPeriodValue; i++) {
|
|
7766
|
+
const principal = typeValue === 1 ? calculateFV(rateValue, i - 2, payment, pvValue, 1) : calculateFV(rateValue, i - 1, payment, pvValue, 0);
|
|
7767
|
+
if (principal === 0) {
|
|
7768
|
+
canNotCalculate = !0;
|
|
7769
|
+
break;
|
|
7770
|
+
}
|
|
7771
|
+
result += typeValue === 1 ? principal - payment : principal;
|
|
7772
|
+
}
|
|
7773
|
+
return result *= rateValue, (result < payment * (endPeriodValue - startPeriodValue + 1) || canNotCalculate) && (result = payment * (endPeriodValue - startPeriodValue + 1)), NumberValueObject.create(result);
|
|
7774
|
+
}
|
|
7775
|
+
};
|
|
7776
|
+
__name(_Cumipmt, "Cumipmt");
|
|
7777
|
+
let Cumipmt = _Cumipmt;
|
|
7778
|
+
const _Cumprinc = class _Cumprinc extends BaseFunction {
|
|
7779
|
+
constructor() {
|
|
7780
|
+
super(...arguments);
|
|
7781
|
+
__publicField(this, "minParams", 6);
|
|
7782
|
+
__publicField(this, "maxParams", 6);
|
|
7783
|
+
}
|
|
7784
|
+
calculate(rate, nper, pv, startPeriod, endPeriod, type) {
|
|
7785
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(rate, nper, pv, startPeriod, endPeriod, type);
|
|
7786
|
+
if (isError)
|
|
7787
|
+
return errorObject;
|
|
7788
|
+
const [rateObject, nperObject, pvObject, startPeriodObject, endPeriodObject, typeObject] = variants, rateValue = +rateObject.getValue(), nperValue = +nperObject.getValue(), pvValue = +pvObject.getValue(), startPeriodValue = +startPeriodObject.getValue(), endPeriodValue = +endPeriodObject.getValue(), typeValue = +typeObject.getValue();
|
|
7789
|
+
return Number.isNaN(rateValue) || Number.isNaN(nperValue) || Number.isNaN(pvValue) || Number.isNaN(startPeriodValue) || Number.isNaN(endPeriodValue) || Number.isNaN(typeValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : rateValue <= 0 || nperValue <= 0 || pvValue <= 0 || startPeriodValue < 1 || endPeriodValue < 1 || startPeriodValue > endPeriodValue || ![0, 1].includes(typeValue) ? ErrorValueObject.create(ErrorType$1.NUM) : Math.trunc(startPeriodValue) !== startPeriodValue && Math.trunc(endPeriodValue) !== endPeriodValue && Math.trunc(startPeriodValue) === Math.trunc(endPeriodValue) ? NumberValueObject.create(0) : this._getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue);
|
|
7790
|
+
}
|
|
7791
|
+
_getResult(rateValue, nperValue, pvValue, startPeriodValue, endPeriodValue, typeValue) {
|
|
7792
|
+
const payment = calculatePMT(rateValue, nperValue, pvValue, 0, typeValue);
|
|
7793
|
+
let result = 0, _startPeriodValue = Math.ceil(startPeriodValue);
|
|
7794
|
+
_startPeriodValue === 1 && (result = typeValue === 0 ? payment + pvValue * rateValue : payment, _startPeriodValue++);
|
|
7795
|
+
for (let i = _startPeriodValue; i <= endPeriodValue; i++)
|
|
7796
|
+
result += typeValue === 1 ? payment - (calculateFV(rateValue, i - 2, payment, pvValue, 1) - payment) * rateValue : payment - calculateFV(rateValue, i - 1, payment, pvValue, 0) * rateValue;
|
|
7797
|
+
return NumberValueObject.create(result);
|
|
7798
|
+
}
|
|
7799
|
+
};
|
|
7800
|
+
__name(_Cumprinc, "Cumprinc");
|
|
7801
|
+
let Cumprinc = _Cumprinc;
|
|
7802
|
+
const _Db = class _Db extends BaseFunction {
|
|
7803
|
+
constructor() {
|
|
7804
|
+
super(...arguments);
|
|
7805
|
+
__publicField(this, "minParams", 4);
|
|
7806
|
+
__publicField(this, "maxParams", 5);
|
|
7807
|
+
}
|
|
7808
|
+
calculate(cost, salvage, life, period, month) {
|
|
7809
|
+
let _month = month != null ? month : NumberValueObject.create(12);
|
|
7810
|
+
_month.isNull() && (_month = NumberValueObject.create(12));
|
|
7811
|
+
const maxRowLength = Math.max(
|
|
7812
|
+
cost.isArray() ? cost.getRowCount() : 1,
|
|
7813
|
+
salvage.isArray() ? salvage.getRowCount() : 1,
|
|
7814
|
+
life.isArray() ? life.getRowCount() : 1,
|
|
7815
|
+
period.isArray() ? period.getRowCount() : 1,
|
|
7816
|
+
_month.isArray() ? _month.getRowCount() : 1
|
|
7817
|
+
), maxColumnLength = Math.max(
|
|
7818
|
+
cost.isArray() ? cost.getColumnCount() : 1,
|
|
7819
|
+
salvage.isArray() ? salvage.getColumnCount() : 1,
|
|
7820
|
+
life.isArray() ? life.getColumnCount() : 1,
|
|
7821
|
+
period.isArray() ? period.getColumnCount() : 1,
|
|
7822
|
+
_month.isArray() ? _month.getColumnCount() : 1
|
|
7823
|
+
), costArray = expandArrayValueObject(maxRowLength, maxColumnLength, cost, ErrorValueObject.create(ErrorType$1.NA)), salvageArray = expandArrayValueObject(maxRowLength, maxColumnLength, salvage, ErrorValueObject.create(ErrorType$1.NA)), lifeArray = expandArrayValueObject(maxRowLength, maxColumnLength, life, ErrorValueObject.create(ErrorType$1.NA)), periodArray = expandArrayValueObject(maxRowLength, maxColumnLength, period, ErrorValueObject.create(ErrorType$1.NA)), monthArray = expandArrayValueObject(maxRowLength, maxColumnLength, _month, ErrorValueObject.create(ErrorType$1.NA)), resultArray = costArray.map((costObject, rowIndex, columnIndex) => {
|
|
7824
|
+
const salvageObject = salvageArray.get(rowIndex, columnIndex), lifeObject = lifeArray.get(rowIndex, columnIndex), periodObject = periodArray.get(rowIndex, columnIndex), monthObject = monthArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(costObject, salvageObject, lifeObject, periodObject, monthObject);
|
|
7825
|
+
if (isError)
|
|
7826
|
+
return errorObject;
|
|
7827
|
+
const [_costObject, _salvageObject, _lifeObject, _periodObject, _monthObject] = variants, costValue = +_costObject.getValue(), salvageValue = +_salvageObject.getValue(), lifeValue = +_lifeObject.getValue();
|
|
7828
|
+
let periodValue = +_periodObject.getValue();
|
|
7829
|
+
const monthValue = Math.floor(+_monthObject.getValue());
|
|
7830
|
+
return costValue < 0 || salvageValue < 0 || lifeValue <= 0 || periodValue <= 0 || Math.floor(periodValue) > Math.floor(lifeValue) || monthValue < 1 || monthValue > 12 ? ErrorValueObject.create(ErrorType$1.NUM) : (periodValue < 1 && (periodValue = 1), periodValue = Math.floor(periodValue), this._getResult(costValue, salvageValue, lifeValue, periodValue, monthValue, rowIndex, columnIndex));
|
|
7831
|
+
});
|
|
7832
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
7833
|
+
}
|
|
7834
|
+
_getResult(costValue, salvageValue, lifeValue, periodValue, monthValue, rowIndex, columnIndex) {
|
|
7835
|
+
const rate = +(1 - (salvageValue / costValue) ** (1 / lifeValue)).toFixed(3), initial = costValue * rate * monthValue / 12;
|
|
7836
|
+
let total = initial, current = 0;
|
|
7837
|
+
const ceiling = periodValue === lifeValue ? lifeValue - 1 : periodValue;
|
|
7838
|
+
for (let i = 2; i <= ceiling; i++)
|
|
7839
|
+
current = (costValue - total) * rate, total += current;
|
|
7840
|
+
let result;
|
|
7841
|
+
return periodValue === 1 ? result = initial : periodValue === lifeValue ? result = (costValue - total) * rate : result = current, Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
7842
|
+
}
|
|
7843
|
+
};
|
|
7844
|
+
__name(_Db, "Db");
|
|
7845
|
+
let Db = _Db;
|
|
7846
|
+
const _Ddb = class _Ddb extends BaseFunction {
|
|
7847
|
+
constructor() {
|
|
7848
|
+
super(...arguments);
|
|
7849
|
+
__publicField(this, "minParams", 4);
|
|
7850
|
+
__publicField(this, "maxParams", 5);
|
|
7851
|
+
}
|
|
7852
|
+
calculate(cost, salvage, life, period, factor) {
|
|
7853
|
+
let _factor = factor != null ? factor : NumberValueObject.create(2);
|
|
7854
|
+
_factor.isNull() && (_factor = NumberValueObject.create(2));
|
|
7855
|
+
const maxRowLength = Math.max(
|
|
7856
|
+
cost.isArray() ? cost.getRowCount() : 1,
|
|
7857
|
+
salvage.isArray() ? salvage.getRowCount() : 1,
|
|
7858
|
+
life.isArray() ? life.getRowCount() : 1,
|
|
7859
|
+
period.isArray() ? period.getRowCount() : 1,
|
|
7860
|
+
_factor.isArray() ? _factor.getRowCount() : 1
|
|
7861
|
+
), maxColumnLength = Math.max(
|
|
7862
|
+
cost.isArray() ? cost.getColumnCount() : 1,
|
|
7863
|
+
salvage.isArray() ? salvage.getColumnCount() : 1,
|
|
7864
|
+
life.isArray() ? life.getColumnCount() : 1,
|
|
7865
|
+
period.isArray() ? period.getColumnCount() : 1,
|
|
7866
|
+
_factor.isArray() ? _factor.getColumnCount() : 1
|
|
7867
|
+
), costArray = expandArrayValueObject(maxRowLength, maxColumnLength, cost, ErrorValueObject.create(ErrorType$1.NA)), salvageArray = expandArrayValueObject(maxRowLength, maxColumnLength, salvage, ErrorValueObject.create(ErrorType$1.NA)), lifeArray = expandArrayValueObject(maxRowLength, maxColumnLength, life, ErrorValueObject.create(ErrorType$1.NA)), periodArray = expandArrayValueObject(maxRowLength, maxColumnLength, period, ErrorValueObject.create(ErrorType$1.NA)), factorArray = expandArrayValueObject(maxRowLength, maxColumnLength, _factor, ErrorValueObject.create(ErrorType$1.NA)), resultArray = costArray.map((costObject, rowIndex, columnIndex) => {
|
|
7868
|
+
const salvageObject = salvageArray.get(rowIndex, columnIndex), lifeObject = lifeArray.get(rowIndex, columnIndex), periodObject = periodArray.get(rowIndex, columnIndex), factorObject = factorArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(costObject, salvageObject, lifeObject, periodObject, factorObject);
|
|
7869
|
+
if (isError)
|
|
7870
|
+
return errorObject;
|
|
7871
|
+
const [_costObject, _salvageObject, _lifeObject, _periodObject, _factorObject] = variants, costValue = +_costObject.getValue(), salvageValue = +_salvageObject.getValue(), lifeValue = +_lifeObject.getValue(), periodValue = Math.ceil(+_periodObject.getValue()), factorValue = +_factorObject.getValue();
|
|
7872
|
+
return costValue < 0 || salvageValue < 0 || lifeValue <= 0 || periodValue <= 0 || Math.floor(periodValue) > Math.floor(lifeValue) || factorValue <= 0 ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(costValue, salvageValue, lifeValue, periodValue, factorValue, rowIndex, columnIndex);
|
|
7873
|
+
});
|
|
7874
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
7875
|
+
}
|
|
7876
|
+
_getResult(costValue, salvageValue, lifeValue, periodValue, factorValue, rowIndex, columnIndex) {
|
|
7877
|
+
let total = 0, result = 0;
|
|
7878
|
+
if (salvageValue < costValue)
|
|
7879
|
+
for (let i = 1; i <= periodValue; i++)
|
|
7880
|
+
result = Math.min((costValue - total) * (factorValue / lifeValue), costValue - salvageValue - total), total += result;
|
|
7881
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
7882
|
+
}
|
|
7883
|
+
};
|
|
7884
|
+
__name(_Ddb, "Ddb");
|
|
7885
|
+
let Ddb = _Ddb;
|
|
7886
|
+
const _Disc = class _Disc extends BaseFunction {
|
|
7887
|
+
constructor() {
|
|
7888
|
+
super(...arguments);
|
|
7889
|
+
__publicField(this, "minParams", 4);
|
|
7890
|
+
__publicField(this, "maxParams", 5);
|
|
7891
|
+
}
|
|
7892
|
+
calculate(settlement, maturity, pr, redemption, basis) {
|
|
7893
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, pr, redemption, _basis);
|
|
7894
|
+
if (isError)
|
|
7895
|
+
return errorObject;
|
|
7896
|
+
const [settlementObject, maturityObject, prObject, redemptionObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
7897
|
+
if (typeof settlementSerialNumber != "number")
|
|
7898
|
+
return settlementSerialNumber;
|
|
7899
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
7900
|
+
if (typeof maturitySerialNumber != "number")
|
|
7901
|
+
return maturitySerialNumber;
|
|
7902
|
+
const prValue = +prObject.getValue(), redemptionValue = +redemptionObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
|
|
7903
|
+
if (Number.isNaN(prValue) || Number.isNaN(redemptionValue) || Number.isNaN(basisValue))
|
|
7904
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7905
|
+
if (prValue <= 0 || redemptionValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
7906
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7907
|
+
const { days, yearDays } = getTwoDateDaysByBasis(settlementSerialNumber, maturitySerialNumber, basisValue), result = (redemptionValue - prValue) / redemptionValue * (yearDays / days);
|
|
7908
|
+
return NumberValueObject.create(result);
|
|
7909
|
+
}
|
|
7910
|
+
};
|
|
7911
|
+
__name(_Disc, "Disc");
|
|
7912
|
+
let Disc = _Disc;
|
|
7913
|
+
const _Dollarde = class _Dollarde extends BaseFunction {
|
|
7914
|
+
constructor() {
|
|
7915
|
+
super(...arguments);
|
|
7916
|
+
__publicField(this, "minParams", 2);
|
|
7917
|
+
__publicField(this, "maxParams", 2);
|
|
7918
|
+
}
|
|
7919
|
+
calculate(fractionalDollar, fraction) {
|
|
7920
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(fractionalDollar, fraction);
|
|
7921
|
+
if (isError)
|
|
7922
|
+
return errorObject;
|
|
7923
|
+
const [fractionalDollarObject, fractionObject] = variants, fractionalDollarValue = +fractionalDollarObject.getValue();
|
|
7924
|
+
let fractionValue = Math.floor(+fractionObject.getValue());
|
|
7925
|
+
if (Number.isNaN(fractionalDollarValue) || Number.isNaN(fractionValue))
|
|
7926
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7927
|
+
if (fractionValue < 0)
|
|
7928
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7929
|
+
if (fractionValue >= 0 && fractionValue < 1)
|
|
7930
|
+
return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
|
|
7931
|
+
fractionValue = Number.parseInt(`${fractionValue}`, 10);
|
|
7932
|
+
let result = Number.parseInt(`${fractionalDollarValue}`, 10);
|
|
7933
|
+
result += fractionalDollarValue % 1 * 10 ** Math.ceil(Math.log(fractionValue) / Math.LN10) / fractionValue;
|
|
7934
|
+
const power = 10 ** (Math.ceil(Math.log(fractionValue) / Math.LN2) + 1);
|
|
7935
|
+
return result = Math.round(result * power) / power, NumberValueObject.create(result);
|
|
7936
|
+
}
|
|
7937
|
+
};
|
|
7938
|
+
__name(_Dollarde, "Dollarde");
|
|
7939
|
+
let Dollarde = _Dollarde;
|
|
7940
|
+
const _Dollarfr = class _Dollarfr extends BaseFunction {
|
|
7941
|
+
constructor() {
|
|
7942
|
+
super(...arguments);
|
|
7943
|
+
__publicField(this, "minParams", 2);
|
|
7944
|
+
__publicField(this, "maxParams", 2);
|
|
7945
|
+
}
|
|
7946
|
+
calculate(decimalDollar, fraction) {
|
|
7947
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(decimalDollar, fraction);
|
|
7948
|
+
if (isError)
|
|
7949
|
+
return errorObject;
|
|
7950
|
+
const [decimalDollarObject, fractionObject] = variants, decimalDollarValue = +decimalDollarObject.getValue();
|
|
7951
|
+
let fractionValue = Math.floor(+fractionObject.getValue());
|
|
7952
|
+
if (Number.isNaN(decimalDollarValue) || Number.isNaN(fractionValue))
|
|
7953
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7954
|
+
if (fractionValue < 0)
|
|
7955
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7956
|
+
if (fractionValue >= 0 && fractionValue < 1)
|
|
7957
|
+
return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
|
|
7958
|
+
fractionValue = Number.parseInt(`${fractionValue}`, 10);
|
|
7959
|
+
let result = Number.parseInt(`${decimalDollarValue}`, 10);
|
|
7960
|
+
return result += decimalDollarValue % 1 * 10 ** -Math.ceil(Math.log(fractionValue) / Math.LN10) * fractionValue, NumberValueObject.create(result);
|
|
7961
|
+
}
|
|
7962
|
+
};
|
|
7963
|
+
__name(_Dollarfr, "Dollarfr");
|
|
7964
|
+
let Dollarfr = _Dollarfr;
|
|
7965
|
+
const _Effect = class _Effect extends BaseFunction {
|
|
7966
|
+
constructor() {
|
|
7967
|
+
super(...arguments);
|
|
7968
|
+
__publicField(this, "minParams", 2);
|
|
7969
|
+
__publicField(this, "maxParams", 2);
|
|
7970
|
+
}
|
|
7971
|
+
calculate(nominalRate, npery) {
|
|
7972
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(nominalRate, npery);
|
|
7973
|
+
if (isError)
|
|
7974
|
+
return errorObject;
|
|
7975
|
+
const [nominalRateObject, nperyObject] = variants, nominalRateValue = +nominalRateObject.getValue();
|
|
7976
|
+
let nperyValue = Math.floor(+nperyObject.getValue());
|
|
7977
|
+
if (Number.isNaN(nominalRateValue) || Number.isNaN(nperyValue))
|
|
7978
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7979
|
+
if (nominalRateValue <= 0 || nperyValue < 1)
|
|
7980
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
7981
|
+
nperyValue = Number.parseInt(`${nperyValue}`, 10);
|
|
7982
|
+
const result = (1 + nominalRateValue / nperyValue) ** nperyValue - 1;
|
|
7983
|
+
return NumberValueObject.create(result);
|
|
7984
|
+
}
|
|
7985
|
+
};
|
|
7986
|
+
__name(_Effect, "Effect");
|
|
7987
|
+
let Effect = _Effect;
|
|
7988
|
+
const _Fv = class _Fv extends BaseFunction {
|
|
7989
|
+
constructor() {
|
|
7990
|
+
super(...arguments);
|
|
7991
|
+
__publicField(this, "minParams", 3);
|
|
7992
|
+
__publicField(this, "maxParams", 5);
|
|
7993
|
+
}
|
|
7994
|
+
calculate(rate, nper, pmt, pv, type) {
|
|
7995
|
+
const _pv = pv != null ? pv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
7996
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
7997
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
7998
|
+
pmt.isArray() ? pmt.getRowCount() : 1,
|
|
7999
|
+
_pv.isArray() ? _pv.getRowCount() : 1,
|
|
8000
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8001
|
+
), maxColumnLength = Math.max(
|
|
8002
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8003
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8004
|
+
pmt.isArray() ? pmt.getColumnCount() : 1,
|
|
8005
|
+
_pv.isArray() ? _pv.getColumnCount() : 1,
|
|
8006
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8007
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _pv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8008
|
+
const nperObject = nperArray.get(rowIndex, columnIndex), pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pmtObject, pvObject, typeObject);
|
|
8009
|
+
if (isError)
|
|
8010
|
+
return errorObject;
|
|
8011
|
+
const [_rateObject, _nperObject, _pmtObject, _pvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), typeValue = +_typeObject.getValue(), result = calculateFV(rateValue, nperValue, pmtValue, pvValue, typeValue ? 1 : 0);
|
|
8012
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
8013
|
+
});
|
|
8014
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
8015
|
+
}
|
|
8016
|
+
};
|
|
8017
|
+
__name(_Fv, "Fv");
|
|
8018
|
+
let Fv = _Fv;
|
|
8019
|
+
const _Fvschedule = class _Fvschedule extends BaseFunction {
|
|
8020
|
+
constructor() {
|
|
8021
|
+
super(...arguments);
|
|
8022
|
+
__publicField(this, "minParams", 2);
|
|
8023
|
+
__publicField(this, "maxParams", 2);
|
|
8024
|
+
}
|
|
8025
|
+
calculate(principal, schedule) {
|
|
8026
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(principal);
|
|
8027
|
+
if (isError)
|
|
8028
|
+
return errorObject;
|
|
8029
|
+
const [principalObject] = variants, principalValue = +principalObject.getValue();
|
|
8030
|
+
if (Number.isNaN(principalValue))
|
|
8031
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8032
|
+
let result = principalValue;
|
|
8033
|
+
if (schedule.isArray()) {
|
|
8034
|
+
const scheduleValues = schedule.getArrayValue().flat();
|
|
8035
|
+
for (let i = 0; i < scheduleValues.length; i++) {
|
|
8036
|
+
const scheduleObject = scheduleValues[i];
|
|
8037
|
+
if (scheduleObject.isBoolean())
|
|
8038
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8039
|
+
const scheduleValue = +scheduleObject.getValue();
|
|
8040
|
+
if (Number.isNaN(scheduleValue))
|
|
8041
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8042
|
+
result *= 1 + scheduleValue;
|
|
8043
|
+
}
|
|
8044
|
+
} else {
|
|
8045
|
+
if (schedule.isBoolean())
|
|
8046
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8047
|
+
const scheduleValue = +schedule.getValue();
|
|
8048
|
+
if (Number.isNaN(scheduleValue))
|
|
8049
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8050
|
+
result *= 1 + scheduleValue;
|
|
8051
|
+
}
|
|
8052
|
+
return NumberValueObject.create(result);
|
|
8053
|
+
}
|
|
8054
|
+
};
|
|
8055
|
+
__name(_Fvschedule, "Fvschedule");
|
|
8056
|
+
let Fvschedule = _Fvschedule;
|
|
8057
|
+
const _Intrate = class _Intrate extends BaseFunction {
|
|
6527
8058
|
constructor() {
|
|
6528
8059
|
super(...arguments);
|
|
6529
|
-
__publicField(this, "minParams",
|
|
6530
|
-
__publicField(this, "maxParams",
|
|
8060
|
+
__publicField(this, "minParams", 4);
|
|
8061
|
+
__publicField(this, "maxParams", 5);
|
|
6531
8062
|
}
|
|
6532
|
-
calculate(
|
|
6533
|
-
|
|
8063
|
+
calculate(settlement, maturity, investment, redemption, basis) {
|
|
8064
|
+
const _basis = basis != null ? basis : NumberValueObject.create(0), { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(settlement, maturity, investment, redemption, _basis);
|
|
8065
|
+
if (isError)
|
|
8066
|
+
return errorObject;
|
|
8067
|
+
const [settlementObject, maturityObject, investmentObject, redemptionObject, basisObject] = variants, settlementSerialNumber = getDateSerialNumberByObject(settlementObject);
|
|
8068
|
+
if (typeof settlementSerialNumber != "number")
|
|
8069
|
+
return settlementSerialNumber;
|
|
8070
|
+
const maturitySerialNumber = getDateSerialNumberByObject(maturityObject);
|
|
8071
|
+
if (typeof maturitySerialNumber != "number")
|
|
8072
|
+
return maturitySerialNumber;
|
|
8073
|
+
const investmentValue = +investmentObject.getValue(), redemptionValue = +redemptionObject.getValue(), basisValue = Math.floor(+basisObject.getValue());
|
|
8074
|
+
if (Number.isNaN(investmentValue) || Number.isNaN(redemptionValue) || Number.isNaN(basisValue))
|
|
8075
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8076
|
+
if (investmentValue <= 0 || redemptionValue <= 0 || basisValue < 0 || basisValue > 4 || Math.floor(settlementSerialNumber) >= Math.floor(maturitySerialNumber))
|
|
8077
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
8078
|
+
const { days, yearDays } = getTwoDateDaysByBasis(settlementSerialNumber, maturitySerialNumber, basisValue), result = (redemptionValue - investmentValue) / investmentValue * (yearDays / days);
|
|
8079
|
+
return NumberValueObject.create(result);
|
|
6534
8080
|
}
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
8081
|
+
};
|
|
8082
|
+
__name(_Intrate, "Intrate");
|
|
8083
|
+
let Intrate = _Intrate;
|
|
8084
|
+
const _Ipmt = class _Ipmt extends BaseFunction {
|
|
8085
|
+
constructor() {
|
|
8086
|
+
super(...arguments);
|
|
8087
|
+
__publicField(this, "minParams", 4);
|
|
8088
|
+
__publicField(this, "maxParams", 6);
|
|
8089
|
+
}
|
|
8090
|
+
calculate(rate, per, nper, pv, fv, type) {
|
|
8091
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
8092
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8093
|
+
per.isArray() ? per.getRowCount() : 1,
|
|
8094
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8095
|
+
pv.isArray() ? pv.getRowCount() : 1,
|
|
8096
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8097
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8098
|
+
), maxColumnLength = Math.max(
|
|
8099
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8100
|
+
per.isArray() ? per.getColumnCount() : 1,
|
|
8101
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8102
|
+
pv.isArray() ? pv.getColumnCount() : 1,
|
|
8103
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8104
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8105
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8106
|
+
const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject, fvObject, typeObject);
|
|
8107
|
+
if (isError)
|
|
8108
|
+
return errorObject;
|
|
8109
|
+
const [_rateObject, _perObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
|
|
8110
|
+
if (perValue < 1 || Math.floor(perValue) > Math.ceil(nperValue))
|
|
6547
8111
|
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
const year = date.getUTCFullYear();
|
|
6553
|
-
return NumberValueObject.create(year);
|
|
8112
|
+
const result = calculateIPMT(rateValue, perValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
|
|
8113
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
8114
|
+
});
|
|
8115
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6554
8116
|
}
|
|
6555
8117
|
};
|
|
6556
|
-
__name(
|
|
6557
|
-
let
|
|
6558
|
-
const
|
|
8118
|
+
__name(_Ipmt, "Ipmt");
|
|
8119
|
+
let Ipmt = _Ipmt;
|
|
8120
|
+
const _Ispmt = class _Ispmt extends BaseFunction {
|
|
8121
|
+
constructor() {
|
|
8122
|
+
super(...arguments);
|
|
8123
|
+
__publicField(this, "minParams", 4);
|
|
8124
|
+
__publicField(this, "maxParams", 4);
|
|
8125
|
+
}
|
|
8126
|
+
calculate(rate, per, nper, pv) {
|
|
8127
|
+
const maxRowLength = Math.max(
|
|
8128
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8129
|
+
per.isArray() ? per.getRowCount() : 1,
|
|
8130
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8131
|
+
pv.isArray() ? pv.getRowCount() : 1
|
|
8132
|
+
), maxColumnLength = Math.max(
|
|
8133
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8134
|
+
per.isArray() ? per.getColumnCount() : 1,
|
|
8135
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8136
|
+
pv.isArray() ? pv.getColumnCount() : 1
|
|
8137
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8138
|
+
const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject);
|
|
8139
|
+
if (isError)
|
|
8140
|
+
return errorObject;
|
|
8141
|
+
const [_rateObject, _perObject, _nperObject, _pvObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue();
|
|
8142
|
+
if (nperValue === 0)
|
|
8143
|
+
return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
|
|
8144
|
+
const result = pvValue * rateValue * (perValue / nperValue - 1);
|
|
8145
|
+
return NumberValueObject.create(result);
|
|
8146
|
+
});
|
|
8147
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
8148
|
+
}
|
|
8149
|
+
};
|
|
8150
|
+
__name(_Ispmt, "Ispmt");
|
|
8151
|
+
let Ispmt = _Ispmt;
|
|
8152
|
+
const _Nominal = class _Nominal extends BaseFunction {
|
|
6559
8153
|
constructor() {
|
|
6560
8154
|
super(...arguments);
|
|
6561
8155
|
__publicField(this, "minParams", 2);
|
|
6562
|
-
__publicField(this, "maxParams",
|
|
8156
|
+
__publicField(this, "maxParams", 2);
|
|
6563
8157
|
}
|
|
6564
|
-
calculate(
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
if (
|
|
6571
|
-
return _endDate;
|
|
6572
|
-
if (_basis = this._checkArrayError(_basis), _basis.isError())
|
|
6573
|
-
return _basis;
|
|
6574
|
-
if (_startDate.isBoolean() || _endDate.isBoolean() || _basis.isBoolean())
|
|
6575
|
-
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6576
|
-
const startDateSerialNumber = getDateSerialNumberByObject(_startDate);
|
|
6577
|
-
if (typeof startDateSerialNumber != "number")
|
|
6578
|
-
return startDateSerialNumber;
|
|
6579
|
-
const endDateSerialNumber = getDateSerialNumberByObject(_endDate);
|
|
6580
|
-
if (typeof endDateSerialNumber != "number")
|
|
6581
|
-
return endDateSerialNumber;
|
|
6582
|
-
const basisValue = Math.floor(+_basis.getValue());
|
|
6583
|
-
if (Number.isNaN(basisValue))
|
|
8158
|
+
calculate(effectRate, npery) {
|
|
8159
|
+
const { isError, errorObject, variants } = checkVariantsErrorIsArrayOrBoolean(effectRate, npery);
|
|
8160
|
+
if (isError)
|
|
8161
|
+
return errorObject;
|
|
8162
|
+
const [effectRateObject, nperyObject] = variants, effectRateValue = +effectRateObject.getValue();
|
|
8163
|
+
let nperyValue = Math.floor(+nperyObject.getValue());
|
|
8164
|
+
if (Number.isNaN(effectRateValue) || Number.isNaN(nperyValue))
|
|
6584
8165
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
6585
|
-
if (
|
|
8166
|
+
if (effectRateValue <= 0 || nperyValue < 1)
|
|
6586
8167
|
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
case 1:
|
|
6591
|
-
return this._getResultByActual(startDateSerialNumber, endDateSerialNumber);
|
|
6592
|
-
case 2:
|
|
6593
|
-
return NumberValueObject.create(Math.abs(endDateSerialNumber - startDateSerialNumber) / 360);
|
|
6594
|
-
case 3:
|
|
6595
|
-
return NumberValueObject.create(Math.abs(endDateSerialNumber - startDateSerialNumber) / 365);
|
|
6596
|
-
case 4:
|
|
6597
|
-
return this._getResultByEuropean(startDateSerialNumber, endDateSerialNumber);
|
|
6598
|
-
default:
|
|
6599
|
-
return NumberValueObject.create(0);
|
|
6600
|
-
}
|
|
8168
|
+
nperyValue = Number.parseInt(`${nperyValue}`, 10);
|
|
8169
|
+
const result = ((effectRateValue + 1) ** (1 / nperyValue) - 1) * nperyValue;
|
|
8170
|
+
return NumberValueObject.create(result);
|
|
6601
8171
|
}
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
return _variant.isError(), _variant;
|
|
8172
|
+
};
|
|
8173
|
+
__name(_Nominal, "Nominal");
|
|
8174
|
+
let Nominal = _Nominal;
|
|
8175
|
+
const _Nper = class _Nper extends BaseFunction {
|
|
8176
|
+
constructor() {
|
|
8177
|
+
super(...arguments);
|
|
8178
|
+
__publicField(this, "minParams", 3);
|
|
8179
|
+
__publicField(this, "maxParams", 5);
|
|
6611
8180
|
}
|
|
6612
|
-
|
|
6613
|
-
const
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
8181
|
+
calculate(rate, pmt, pv, fv, type) {
|
|
8182
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
8183
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8184
|
+
pmt.isArray() ? pmt.getRowCount() : 1,
|
|
8185
|
+
pv.isArray() ? pv.getRowCount() : 1,
|
|
8186
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8187
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8188
|
+
), maxColumnLength = Math.max(
|
|
8189
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8190
|
+
pmt.isArray() ? pmt.getColumnCount() : 1,
|
|
8191
|
+
pv.isArray() ? pv.getColumnCount() : 1,
|
|
8192
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8193
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8194
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8195
|
+
const pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, pmtObject, pvObject, fvObject, typeObject);
|
|
8196
|
+
if (isError)
|
|
8197
|
+
return errorObject;
|
|
8198
|
+
const [_rateObject, _pmtObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue();
|
|
8199
|
+
let typeValue = +_typeObject.getValue();
|
|
8200
|
+
if (typeValue = typeValue ? 1 : 0, rateValue === 0 && pmtValue === 0)
|
|
8201
|
+
return ErrorValueObject.create(ErrorType$1.DIV_BY_ZERO);
|
|
8202
|
+
let result;
|
|
8203
|
+
if (rateValue === 0)
|
|
8204
|
+
result = -(pvValue + fvValue) / pmtValue;
|
|
8205
|
+
else {
|
|
8206
|
+
const num = pmtValue * (1 + rateValue * typeValue) - fvValue * rateValue, den = pvValue * rateValue + pmtValue * (1 + rateValue * typeValue);
|
|
8207
|
+
result = Math.log(num / den) / Math.log(1 + rateValue);
|
|
8208
|
+
}
|
|
8209
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : NumberValueObject.create(result);
|
|
8210
|
+
});
|
|
8211
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6618
8212
|
}
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
startYearFirstDaySerialNumber = excelDateSerial(startYearFirstDay), endYearLastDaySerialNumber = excelDateSerial(endYearLastDay), startYear === 1900 && (startYearFirstDaySerialNumber += 1);
|
|
6628
|
-
}
|
|
6629
|
-
const result = totalDays / ((endYearLastDaySerialNumber - startYearFirstDaySerialNumber + 1) / totalYear);
|
|
6630
|
-
return NumberValueObject.create(result);
|
|
8213
|
+
};
|
|
8214
|
+
__name(_Nper, "Nper");
|
|
8215
|
+
let Nper = _Nper;
|
|
8216
|
+
const _Pmt = class _Pmt extends BaseFunction {
|
|
8217
|
+
constructor() {
|
|
8218
|
+
super(...arguments);
|
|
8219
|
+
__publicField(this, "minParams", 3);
|
|
8220
|
+
__publicField(this, "maxParams", 5);
|
|
6631
8221
|
}
|
|
6632
|
-
|
|
6633
|
-
const
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
8222
|
+
calculate(rate, nper, pv, fv, type) {
|
|
8223
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
8224
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8225
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8226
|
+
pv.isArray() ? pv.getRowCount() : 1,
|
|
8227
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8228
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8229
|
+
), maxColumnLength = Math.max(
|
|
8230
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8231
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8232
|
+
pv.isArray() ? pv.getColumnCount() : 1,
|
|
8233
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8234
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8235
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8236
|
+
const nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pvObject, fvObject, typeObject);
|
|
8237
|
+
if (isError)
|
|
8238
|
+
return errorObject;
|
|
8239
|
+
const [_rateObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
|
|
8240
|
+
if (rateValue <= -1)
|
|
8241
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
8242
|
+
const result = calculatePMT(rateValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
|
|
8243
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
8244
|
+
});
|
|
8245
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
6640
8246
|
}
|
|
6641
8247
|
};
|
|
6642
|
-
__name(
|
|
6643
|
-
let
|
|
6644
|
-
const
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
const
|
|
6673
|
-
|
|
8248
|
+
__name(_Pmt, "Pmt");
|
|
8249
|
+
let Pmt = _Pmt;
|
|
8250
|
+
const _Ppmt = class _Ppmt extends BaseFunction {
|
|
8251
|
+
constructor() {
|
|
8252
|
+
super(...arguments);
|
|
8253
|
+
__publicField(this, "minParams", 4);
|
|
8254
|
+
__publicField(this, "maxParams", 6);
|
|
8255
|
+
}
|
|
8256
|
+
calculate(rate, per, nper, pv, fv, type) {
|
|
8257
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
8258
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8259
|
+
per.isArray() ? per.getRowCount() : 1,
|
|
8260
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8261
|
+
pv.isArray() ? pv.getRowCount() : 1,
|
|
8262
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8263
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8264
|
+
), maxColumnLength = Math.max(
|
|
8265
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8266
|
+
per.isArray() ? per.getColumnCount() : 1,
|
|
8267
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8268
|
+
pv.isArray() ? pv.getColumnCount() : 1,
|
|
8269
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8270
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8271
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), perArray = expandArrayValueObject(maxRowLength, maxColumnLength, per, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8272
|
+
const perObject = perArray.get(rowIndex, columnIndex), nperObject = nperArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, perObject, nperObject, pvObject, fvObject, typeObject);
|
|
8273
|
+
if (isError)
|
|
8274
|
+
return errorObject;
|
|
8275
|
+
const [_rateObject, _perObject, _nperObject, _pvObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), perValue = +_perObject.getValue(), nperValue = +_nperObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue(), typeValue = +_typeObject.getValue();
|
|
8276
|
+
if (perValue < 1 || Math.floor(perValue) > Math.ceil(nperValue) || perValue - nperValue >= 1)
|
|
8277
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
8278
|
+
const result = calculatePMT(rateValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0) - calculateIPMT(rateValue, perValue, nperValue, pvValue, fvValue, typeValue ? 1 : 0);
|
|
8279
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
8280
|
+
});
|
|
8281
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
8282
|
+
}
|
|
8283
|
+
};
|
|
8284
|
+
__name(_Ppmt, "Ppmt");
|
|
8285
|
+
let Ppmt = _Ppmt;
|
|
8286
|
+
const _Pv = class _Pv extends BaseFunction {
|
|
8287
|
+
constructor() {
|
|
8288
|
+
super(...arguments);
|
|
8289
|
+
__publicField(this, "minParams", 3);
|
|
8290
|
+
__publicField(this, "maxParams", 5);
|
|
8291
|
+
}
|
|
8292
|
+
calculate(rate, nper, pmt, fv, type) {
|
|
8293
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), maxRowLength = Math.max(
|
|
8294
|
+
rate.isArray() ? rate.getRowCount() : 1,
|
|
8295
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8296
|
+
pmt.isArray() ? pmt.getRowCount() : 1,
|
|
8297
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8298
|
+
_type.isArray() ? _type.getRowCount() : 1
|
|
8299
|
+
), maxColumnLength = Math.max(
|
|
8300
|
+
rate.isArray() ? rate.getColumnCount() : 1,
|
|
8301
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8302
|
+
pmt.isArray() ? pmt.getColumnCount() : 1,
|
|
8303
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8304
|
+
_type.isArray() ? _type.getColumnCount() : 1
|
|
8305
|
+
), rateArray = expandArrayValueObject(maxRowLength, maxColumnLength, rate, ErrorValueObject.create(ErrorType$1.NA)), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), resultArray = rateArray.map((rateObject, rowIndex, columnIndex) => {
|
|
8306
|
+
const nperObject = nperArray.get(rowIndex, columnIndex), pmtObject = pmtArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(rateObject, nperObject, pmtObject, fvObject, typeObject);
|
|
8307
|
+
if (isError)
|
|
8308
|
+
return errorObject;
|
|
8309
|
+
const [_rateObject, _nperObject, _pmtObject, _fvObject, _typeObject] = variants, rateValue = +_rateObject.getValue(), nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), fvValue = +_fvObject.getValue();
|
|
8310
|
+
let typeValue = +_typeObject.getValue();
|
|
8311
|
+
typeValue = typeValue ? 1 : 0;
|
|
8312
|
+
const result = rateValue === 0 ? -pmtValue * nperValue - fvValue : ((1 - (1 + rateValue) ** nperValue) / rateValue * pmtValue * (1 + rateValue * typeValue) - fvValue) / (1 + rateValue) ** nperValue;
|
|
8313
|
+
return Number.isNaN(result) || !Number.isFinite(result) ? ErrorValueObject.create(ErrorType$1.NUM) : rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, '"¥"#,##0.00_);[Red]("¥"#,##0.00)') : NumberValueObject.create(result);
|
|
8314
|
+
});
|
|
8315
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
8316
|
+
}
|
|
8317
|
+
};
|
|
8318
|
+
__name(_Pv, "Pv");
|
|
8319
|
+
let Pv = _Pv;
|
|
8320
|
+
const _Rate = class _Rate extends BaseFunction {
|
|
8321
|
+
constructor() {
|
|
8322
|
+
super(...arguments);
|
|
8323
|
+
__publicField(this, "minParams", 3);
|
|
8324
|
+
__publicField(this, "maxParams", 6);
|
|
8325
|
+
}
|
|
8326
|
+
calculate(nper, pmt, pv, fv, type, guess) {
|
|
8327
|
+
const _fv = fv != null ? fv : NumberValueObject.create(0), _type = type != null ? type : NumberValueObject.create(0), _guess = guess != null ? guess : NumberValueObject.create(0.1), maxRowLength = Math.max(
|
|
8328
|
+
nper.isArray() ? nper.getRowCount() : 1,
|
|
8329
|
+
pmt.isArray() ? pmt.getRowCount() : 1,
|
|
8330
|
+
pv.isArray() ? pv.getRowCount() : 1,
|
|
8331
|
+
_fv.isArray() ? _fv.getRowCount() : 1,
|
|
8332
|
+
_type.isArray() ? _type.getRowCount() : 1,
|
|
8333
|
+
_guess.isArray() ? _guess.getRowCount() : 1
|
|
8334
|
+
), maxColumnLength = Math.max(
|
|
8335
|
+
nper.isArray() ? nper.getColumnCount() : 1,
|
|
8336
|
+
pmt.isArray() ? pmt.getColumnCount() : 1,
|
|
8337
|
+
pv.isArray() ? pv.getColumnCount() : 1,
|
|
8338
|
+
_fv.isArray() ? _fv.getColumnCount() : 1,
|
|
8339
|
+
_type.isArray() ? _type.getColumnCount() : 1,
|
|
8340
|
+
_guess.isArray() ? _guess.getColumnCount() : 1
|
|
8341
|
+
), nperArray = expandArrayValueObject(maxRowLength, maxColumnLength, nper, ErrorValueObject.create(ErrorType$1.NA)), pmtArray = expandArrayValueObject(maxRowLength, maxColumnLength, pmt, ErrorValueObject.create(ErrorType$1.NA)), pvArray = expandArrayValueObject(maxRowLength, maxColumnLength, pv, ErrorValueObject.create(ErrorType$1.NA)), fvArray = expandArrayValueObject(maxRowLength, maxColumnLength, _fv, ErrorValueObject.create(ErrorType$1.NA)), typeArray = expandArrayValueObject(maxRowLength, maxColumnLength, _type, ErrorValueObject.create(ErrorType$1.NA)), guessArray = expandArrayValueObject(maxRowLength, maxColumnLength, _guess, ErrorValueObject.create(ErrorType$1.NA)), resultArray = nperArray.map((nperObject, rowIndex, columnIndex) => {
|
|
8342
|
+
const pmtObject = pmtArray.get(rowIndex, columnIndex), pvObject = pvArray.get(rowIndex, columnIndex), fvObject = fvArray.get(rowIndex, columnIndex), typeObject = typeArray.get(rowIndex, columnIndex), guessObject = guessArray.get(rowIndex, columnIndex), { isError, errorObject, variants } = checkVariantsErrorIsStringToNumber(nperObject, pmtObject, pvObject, fvObject, typeObject, guessObject);
|
|
8343
|
+
if (isError)
|
|
8344
|
+
return errorObject;
|
|
8345
|
+
const [_nperObject, _pmtObject, _pvObject, _fvObject, _typeObject, _guessObject] = variants, nperValue = +_nperObject.getValue(), pmtValue = +_pmtObject.getValue(), pvValue = +_pvObject.getValue(), fvValue = +_fvObject.getValue();
|
|
8346
|
+
let typeValue = +_typeObject.getValue();
|
|
8347
|
+
const guessValue = +_guessObject.getValue();
|
|
8348
|
+
return typeValue = typeValue ? 1 : 0, nperValue <= 0 || pmtValue >= 0 ? ErrorValueObject.create(ErrorType$1.NUM) : this._getResult(nperValue, pmtValue, pvValue, fvValue, typeValue, guessValue, rowIndex, columnIndex);
|
|
8349
|
+
});
|
|
8350
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
8351
|
+
}
|
|
8352
|
+
_getResult(nperValue, pmtValue, pvValue, fvValue, typeValue, guessValue, rowIndex, columnIndex) {
|
|
8353
|
+
let result = guessValue;
|
|
8354
|
+
for (let i = 0; i < 20; i++) {
|
|
8355
|
+
if (result <= -1)
|
|
8356
|
+
return ErrorValueObject.create(ErrorType$1.NUM);
|
|
8357
|
+
let y, f;
|
|
8358
|
+
if (Math.abs(result) < 1e-10 ? y = pvValue * (1 + nperValue * result) + pmtValue * (1 + result * typeValue) * nperValue + fvValue : (f = (1 + result) ** nperValue, y = pvValue * f + pmtValue * (1 / result + typeValue) * (f - 1) + fvValue), Math.abs(y) < 1e-10)
|
|
8359
|
+
break;
|
|
8360
|
+
let dy;
|
|
8361
|
+
if (Math.abs(result) < 1e-10)
|
|
8362
|
+
dy = pvValue * nperValue + pmtValue * typeValue * nperValue;
|
|
8363
|
+
else {
|
|
8364
|
+
f = (1 + result) ** nperValue;
|
|
8365
|
+
const df = nperValue * (1 + result) ** (nperValue - 1);
|
|
8366
|
+
dy = pvValue * df + pmtValue * (1 / result + typeValue) * df + pmtValue * (-1 / (result * result)) * (f - 1);
|
|
8367
|
+
}
|
|
8368
|
+
result -= y / dy;
|
|
8369
|
+
}
|
|
8370
|
+
return rowIndex === 0 && columnIndex === 0 ? NumberValueObject.create(result, "0%") : NumberValueObject.create(result);
|
|
8371
|
+
}
|
|
8372
|
+
};
|
|
8373
|
+
__name(_Rate, "Rate");
|
|
8374
|
+
let Rate = _Rate;
|
|
8375
|
+
const functionFinancial = [
|
|
8376
|
+
[Accrint, FUNCTION_NAMES_FINANCIAL.ACCRINT],
|
|
8377
|
+
[Accrintm, FUNCTION_NAMES_FINANCIAL.ACCRINTM],
|
|
8378
|
+
[Amorlinc, FUNCTION_NAMES_FINANCIAL.AMORLINC],
|
|
8379
|
+
[Coupdaybs, FUNCTION_NAMES_FINANCIAL.COUPDAYBS],
|
|
8380
|
+
[Coupdays, FUNCTION_NAMES_FINANCIAL.COUPDAYS],
|
|
8381
|
+
[Coupdaysnc, FUNCTION_NAMES_FINANCIAL.COUPDAYSNC],
|
|
8382
|
+
[Coupncd, FUNCTION_NAMES_FINANCIAL.COUPNCD],
|
|
8383
|
+
[Coupnum, FUNCTION_NAMES_FINANCIAL.COUPNUM],
|
|
8384
|
+
[Couppcd, FUNCTION_NAMES_FINANCIAL.COUPPCD],
|
|
8385
|
+
[Cumipmt, FUNCTION_NAMES_FINANCIAL.CUMIPMT],
|
|
8386
|
+
[Cumprinc, FUNCTION_NAMES_FINANCIAL.CUMPRINC],
|
|
8387
|
+
[Db, FUNCTION_NAMES_FINANCIAL.DB],
|
|
8388
|
+
[Ddb, FUNCTION_NAMES_FINANCIAL.DDB],
|
|
8389
|
+
[Disc, FUNCTION_NAMES_FINANCIAL.DISC],
|
|
8390
|
+
[Dollarde, FUNCTION_NAMES_FINANCIAL.DOLLARDE],
|
|
8391
|
+
[Dollarfr, FUNCTION_NAMES_FINANCIAL.DOLLARFR],
|
|
8392
|
+
[Effect, FUNCTION_NAMES_FINANCIAL.EFFECT],
|
|
8393
|
+
[Fv, FUNCTION_NAMES_FINANCIAL.FV],
|
|
8394
|
+
[Fvschedule, FUNCTION_NAMES_FINANCIAL.FVSCHEDULE],
|
|
8395
|
+
[Intrate, FUNCTION_NAMES_FINANCIAL.INTRATE],
|
|
8396
|
+
[Ipmt, FUNCTION_NAMES_FINANCIAL.IPMT],
|
|
8397
|
+
[Ispmt, FUNCTION_NAMES_FINANCIAL.ISPMT],
|
|
8398
|
+
[Nominal, FUNCTION_NAMES_FINANCIAL.NOMINAL],
|
|
8399
|
+
[Nper, FUNCTION_NAMES_FINANCIAL.NPER],
|
|
8400
|
+
[Pmt, FUNCTION_NAMES_FINANCIAL.PMT],
|
|
8401
|
+
[Ppmt, FUNCTION_NAMES_FINANCIAL.PPMT],
|
|
8402
|
+
[Pv, FUNCTION_NAMES_FINANCIAL.PV],
|
|
8403
|
+
[Rate, FUNCTION_NAMES_FINANCIAL.RATE]
|
|
8404
|
+
];
|
|
8405
|
+
var FUNCTION_NAMES_INFORMATION = /* @__PURE__ */ ((FUNCTION_NAMES_INFORMATION2) => (FUNCTION_NAMES_INFORMATION2.CELL = "CELL", FUNCTION_NAMES_INFORMATION2.ERROR_TYPE = "ERROR.TYPE", FUNCTION_NAMES_INFORMATION2.INFO = "INFO", FUNCTION_NAMES_INFORMATION2.ISBLANK = "ISBLANK", FUNCTION_NAMES_INFORMATION2.ISERR = "ISERR", FUNCTION_NAMES_INFORMATION2.ISERROR = "ISERROR", FUNCTION_NAMES_INFORMATION2.ISEVEN = "ISEVEN", FUNCTION_NAMES_INFORMATION2.ISFORMULA = "ISFORMULA", FUNCTION_NAMES_INFORMATION2.ISLOGICAL = "ISLOGICAL", FUNCTION_NAMES_INFORMATION2.ISNA = "ISNA", FUNCTION_NAMES_INFORMATION2.ISNONTEXT = "ISNONTEXT", FUNCTION_NAMES_INFORMATION2.ISNUMBER = "ISNUMBER", FUNCTION_NAMES_INFORMATION2.ISODD = "ISODD", FUNCTION_NAMES_INFORMATION2.ISOMITTED = "ISOMITTED", FUNCTION_NAMES_INFORMATION2.ISREF = "ISREF", FUNCTION_NAMES_INFORMATION2.ISTEXT = "ISTEXT", FUNCTION_NAMES_INFORMATION2.N = "N", FUNCTION_NAMES_INFORMATION2.NA = "NA", FUNCTION_NAMES_INFORMATION2.SHEET = "SHEET", FUNCTION_NAMES_INFORMATION2.SHEETS = "SHEETS", FUNCTION_NAMES_INFORMATION2.TYPE = "TYPE", FUNCTION_NAMES_INFORMATION2))(FUNCTION_NAMES_INFORMATION || {});
|
|
6674
8406
|
const _Cell = class _Cell extends BaseFunction {
|
|
6675
8407
|
constructor() {
|
|
6676
8408
|
super(...arguments);
|
|
@@ -7134,35 +8866,33 @@ const _Ifs = class _Ifs extends BaseFunction {
|
|
|
7134
8866
|
for (let i = 0; i < params.length; i++)
|
|
7135
8867
|
if (params[i].isError())
|
|
7136
8868
|
return params[i];
|
|
7137
|
-
if (!params.some((param) => param.isArray())) {
|
|
7138
|
-
for (let i = 0; i < params.length; i += 2) {
|
|
7139
|
-
const condition = params[i], result = params[i + 1];
|
|
7140
|
-
if (condition.isNull())
|
|
7141
|
-
continue;
|
|
7142
|
-
if (condition.getValue())
|
|
7143
|
-
return result.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : result;
|
|
7144
|
-
}
|
|
7145
|
-
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7146
|
-
}
|
|
7147
8869
|
const maxRowLength = Math.max(
|
|
7148
8870
|
...params.map((param) => param.isArray() ? param.getRowCount() : 1)
|
|
7149
8871
|
), maxColumnLength = Math.max(
|
|
7150
8872
|
...params.map((param) => param.isArray() ? param.getColumnCount() : 1)
|
|
7151
8873
|
), expandedParams = params.map(
|
|
7152
8874
|
(param) => expandArrayValueObject(maxRowLength, maxColumnLength, param, ErrorValueObject.create(ErrorType$1.NA))
|
|
7153
|
-
)
|
|
7154
|
-
return expandedParams[0].map((_, rowIndex, columnIndex) => {
|
|
8875
|
+
), resultArray = expandedParams[0].map((_, rowIndex, columnIndex) => {
|
|
7155
8876
|
for (let i = 0; i < expandedParams.length; i += 2) {
|
|
7156
8877
|
const condition = expandedParams[i].get(rowIndex, columnIndex) || NullValueObject.create(), result = expandedParams[i + 1].get(rowIndex, columnIndex) || NullValueObject.create();
|
|
7157
8878
|
if (condition.isNull())
|
|
7158
8879
|
continue;
|
|
7159
8880
|
if (condition.isError())
|
|
7160
8881
|
return condition;
|
|
7161
|
-
|
|
8882
|
+
const conditionValue = condition.getValue();
|
|
8883
|
+
if (condition.isString()) {
|
|
8884
|
+
if (`${conditionValue}`.toLocaleUpperCase() === "TRUE")
|
|
8885
|
+
return result;
|
|
8886
|
+
if (`${conditionValue}`.toLocaleUpperCase() === "FALSE")
|
|
8887
|
+
continue;
|
|
8888
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8889
|
+
}
|
|
8890
|
+
if (+conditionValue)
|
|
7162
8891
|
return result.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : result;
|
|
7163
8892
|
}
|
|
7164
8893
|
return ErrorValueObject.create(ErrorType$1.NA);
|
|
7165
8894
|
});
|
|
8895
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
7166
8896
|
}
|
|
7167
8897
|
};
|
|
7168
8898
|
__name(_Ifs, "Ifs");
|
|
@@ -7179,6 +8909,18 @@ const _Lambda = class _Lambda extends BaseFunction {
|
|
|
7179
8909
|
};
|
|
7180
8910
|
__name(_Lambda, "Lambda");
|
|
7181
8911
|
let Lambda = _Lambda;
|
|
8912
|
+
const _Let = class _Let extends BaseFunction {
|
|
8913
|
+
constructor() {
|
|
8914
|
+
super(...arguments);
|
|
8915
|
+
__publicField(this, "minParams", 3);
|
|
8916
|
+
__publicField(this, "maxParams", 255);
|
|
8917
|
+
}
|
|
8918
|
+
calculate(...variants) {
|
|
8919
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
8920
|
+
}
|
|
8921
|
+
};
|
|
8922
|
+
__name(_Let, "Let");
|
|
8923
|
+
let Let = _Let;
|
|
7182
8924
|
const _Makearray = class _Makearray extends BaseFunction {
|
|
7183
8925
|
constructor() {
|
|
7184
8926
|
super(...arguments);
|
|
@@ -7198,8 +8940,8 @@ const _Makearray = class _Makearray extends BaseFunction {
|
|
|
7198
8940
|
for (let r = 0; r < row; r++) {
|
|
7199
8941
|
result[r] == null && (result[r] = []);
|
|
7200
8942
|
for (let c = 0; c < column; c++) {
|
|
7201
|
-
|
|
7202
|
-
result[r][c] = value;
|
|
8943
|
+
let value = lambda.execute(NumberValueObject.create(r + 1), NumberValueObject.create(c + 1));
|
|
8944
|
+
value.isArray() && (value = value.get(0, 0)), result[r][c] = value;
|
|
7203
8945
|
}
|
|
7204
8946
|
}
|
|
7205
8947
|
return new AsyncArrayObject(result);
|
|
@@ -7216,8 +8958,14 @@ const _Not = class _Not extends BaseFunction {
|
|
|
7216
8958
|
__publicField(this, "minParams", 1);
|
|
7217
8959
|
__publicField(this, "maxParams", 1);
|
|
7218
8960
|
}
|
|
7219
|
-
calculate(
|
|
7220
|
-
return
|
|
8961
|
+
calculate(logical) {
|
|
8962
|
+
return logical.isArray() ? logical.map((logicalObject) => this._handleSingleObject(logicalObject)) : this._handleSingleObject(logical);
|
|
8963
|
+
}
|
|
8964
|
+
_handleSingleObject(logical) {
|
|
8965
|
+
if (logical.isError())
|
|
8966
|
+
return logical;
|
|
8967
|
+
const logicalValue = +logical.getValue();
|
|
8968
|
+
return Number.isNaN(logicalValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : BooleanValueObject.create(!logicalValue);
|
|
7221
8969
|
}
|
|
7222
8970
|
};
|
|
7223
8971
|
__name(_Not, "Not");
|
|
@@ -7264,7 +9012,7 @@ const _Switch = class _Switch extends BaseFunction {
|
|
|
7264
9012
|
if (!switchValue.isNull()) {
|
|
7265
9013
|
if (switchValue.isError())
|
|
7266
9014
|
return switchValue;
|
|
7267
|
-
if (expression.getValue() === switchValue.getValue())
|
|
9015
|
+
if (`${expression.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
|
|
7268
9016
|
return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
|
|
7269
9017
|
}
|
|
7270
9018
|
}
|
|
@@ -7288,7 +9036,7 @@ const _Switch = class _Switch extends BaseFunction {
|
|
|
7288
9036
|
if (!switchValue.isNull()) {
|
|
7289
9037
|
if (switchValue.isError() || expValue.isError())
|
|
7290
9038
|
return switchValue.isError() ? switchValue : expValue;
|
|
7291
|
-
if (expValue.getValue() === switchValue.getValue())
|
|
9039
|
+
if (`${expValue.getValue()}`.toLocaleLowerCase() === `${switchValue.getValue()}`.toLocaleLowerCase())
|
|
7292
9040
|
return resultValue.isNull() ? ErrorValueObject.create(ErrorType$1.NA) : resultValue;
|
|
7293
9041
|
}
|
|
7294
9042
|
}
|
|
@@ -7344,6 +9092,7 @@ const functionLogical = [
|
|
|
7344
9092
|
[Ifna, FUNCTION_NAMES_LOGICAL.IFNA],
|
|
7345
9093
|
[Ifs, FUNCTION_NAMES_LOGICAL.IFS],
|
|
7346
9094
|
[Lambda, FUNCTION_NAMES_LOGICAL.LAMBDA],
|
|
9095
|
+
[Let, FUNCTION_NAMES_LOGICAL.LET],
|
|
7347
9096
|
[Makearray, FUNCTION_NAMES_LOGICAL.MAKEARRAY],
|
|
7348
9097
|
[Not, FUNCTION_NAMES_LOGICAL.NOT],
|
|
7349
9098
|
[Or, FUNCTION_NAMES_LOGICAL.OR],
|
|
@@ -7781,7 +9530,7 @@ const _Indirect = class _Indirect extends BaseFunction {
|
|
|
7781
9530
|
if (new RegExp(REFERENCE_REGEX_COLUMN).test(refTextV))
|
|
7782
9531
|
return this._setDefault(new ColumnReferenceObject(refTextV));
|
|
7783
9532
|
const gridRange = deserializeRangeWithSheet(refTextV), { range, sheetName, unitId } = gridRange;
|
|
7784
|
-
if (Number.isNaN(range.startRow))
|
|
9533
|
+
if (Number.isNaN(range.startRow) || range.endRow + 1 > 1048576 || Number.isNaN(range.startColumn) || range.endColumn + 1 > 16384)
|
|
7785
9534
|
return ErrorValueObject.create(ErrorType$1.REF);
|
|
7786
9535
|
const rangeReferenceObject = new RangeReferenceObject(range);
|
|
7787
9536
|
return rangeReferenceObject.setForcedUnitIdDirect(unitId), rangeReferenceObject.setForcedSheetName(sheetName), this._setDefault(rangeReferenceObject);
|
|
@@ -7933,7 +9682,7 @@ const _Offset = class _Offset extends BaseFunction {
|
|
|
7933
9682
|
});
|
|
7934
9683
|
}
|
|
7935
9684
|
_handleSingleObject(reference, rowsValue, columnsValue, heightValue, widthValue, isReportError = !1) {
|
|
7936
|
-
const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.
|
|
9685
|
+
const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.getRangePosition(), rowOffset = this.getIndexNumValue(rowsValue), columnOffset = this.getIndexNumValue(columnsValue);
|
|
7937
9686
|
if (typeof rowOffset != "number" || typeof columnOffset != "number")
|
|
7938
9687
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
7939
9688
|
const targetRow = referenceStartRow + rowOffset, targetColumn = referenceStartColumn + columnOffset;
|
|
@@ -8706,7 +10455,7 @@ const _Index = class _Index extends BaseFunction {
|
|
|
8706
10455
|
if (reference.isValueObject())
|
|
8707
10456
|
referenceRowCount = 1, referenceColumnCount = 1;
|
|
8708
10457
|
else if (reference.isReferenceObject()) {
|
|
8709
|
-
const { startRow, endRow, startColumn, endColumn } = reference.
|
|
10458
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
8710
10459
|
referenceRowCount = endRow - startRow + 1, referenceColumnCount = endColumn - startColumn + 1;
|
|
8711
10460
|
} else
|
|
8712
10461
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
@@ -8776,7 +10525,7 @@ const _Index = class _Index extends BaseFunction {
|
|
|
8776
10525
|
return logicValue;
|
|
8777
10526
|
}
|
|
8778
10527
|
_getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) {
|
|
8779
|
-
const { startRow, endRow, startColumn, endColumn } = reference.
|
|
10528
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
8780
10529
|
let referenceStartRow = 0, referenceEndRow = 0, referenceStartColumn = 0, referenceEndColumn = 0;
|
|
8781
10530
|
if (rowNumberValue === 0 ? (referenceStartRow = startRow, referenceEndRow = endRow) : referenceStartRow = referenceEndRow = startRow + rowNumberValue - 1, columnNumberValue === 0 ? (referenceStartColumn = startColumn, referenceEndColumn = endColumn) : referenceStartColumn = referenceEndColumn = startColumn + columnNumberValue - 1, referenceStartRow > endRow || referenceStartColumn > endColumn)
|
|
8782
10531
|
return ErrorValueObject.create(ErrorType$1.REF);
|
|
@@ -10943,7 +12692,7 @@ const _Averageif = class _Averageif extends BaseFunction {
|
|
|
10943
12692
|
const averageRangeRow = averageRange.getRowCount(), averageRangeColumn = averageRange.getColumnCount(), rowCount = range.isArray() ? range.getRowCount() : 1, columnCount = range.isArray() ? range.getColumnCount() : 1;
|
|
10944
12693
|
if (averageRangeRow === rowCount && averageRangeColumn === columnCount)
|
|
10945
12694
|
return averageRange;
|
|
10946
|
-
const { startRow, startColumn } = averageRange.
|
|
12695
|
+
const { startRow, startColumn } = averageRange.getRangePosition(), rangeData = {
|
|
10947
12696
|
startRow,
|
|
10948
12697
|
startColumn,
|
|
10949
12698
|
endRow: startRow + rowCount - 1,
|
|
@@ -11291,6 +13040,138 @@ const _Minifs = class _Minifs extends BaseFunction {
|
|
|
11291
13040
|
};
|
|
11292
13041
|
__name(_Minifs, "Minifs");
|
|
11293
13042
|
let Minifs = _Minifs;
|
|
13043
|
+
const _RankAvg = class _RankAvg extends BaseFunction {
|
|
13044
|
+
constructor() {
|
|
13045
|
+
super(...arguments);
|
|
13046
|
+
__publicField(this, "minParams", 2);
|
|
13047
|
+
__publicField(this, "maxParams", 3);
|
|
13048
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
13049
|
+
}
|
|
13050
|
+
calculate(number, ref, order) {
|
|
13051
|
+
let _number = number;
|
|
13052
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
13053
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
13054
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
13055
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
13056
|
+
const maxRowLength = Math.max(
|
|
13057
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
13058
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
13059
|
+
), maxColumnLength = Math.max(
|
|
13060
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
13061
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
13062
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
13063
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
13064
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
13065
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13066
|
+
if (refHasError)
|
|
13067
|
+
return refErrorObject;
|
|
13068
|
+
if (orderObject.isError())
|
|
13069
|
+
return orderObject;
|
|
13070
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
13071
|
+
return Number.isNaN(numberValue) || Number.isNaN(orderValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : this._getResult(numberValue, orderValue, refNumbers);
|
|
13072
|
+
});
|
|
13073
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
13074
|
+
}
|
|
13075
|
+
_getResult(numberValue, orderValue, refNumbers) {
|
|
13076
|
+
const refOrderNumbers = refNumbers.sort((a, b) => orderValue ? a - b : b - a);
|
|
13077
|
+
let index = refOrderNumbers.indexOf(numberValue);
|
|
13078
|
+
const results = [];
|
|
13079
|
+
for (; index >= 0; ) {
|
|
13080
|
+
const start = index + 1;
|
|
13081
|
+
results.push(start), index = refOrderNumbers.indexOf(numberValue, start);
|
|
13082
|
+
}
|
|
13083
|
+
if (results.length === 0)
|
|
13084
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13085
|
+
const result = results.reduce((acc, cur) => acc + cur, 0) / results.length;
|
|
13086
|
+
return NumberValueObject.create(result);
|
|
13087
|
+
}
|
|
13088
|
+
_checkRefReferenceObject(ref) {
|
|
13089
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
13090
|
+
const refNumbers = [];
|
|
13091
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
13092
|
+
const _refObject = refObject;
|
|
13093
|
+
if (_refObject.isError())
|
|
13094
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
13095
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
13096
|
+
return !0;
|
|
13097
|
+
const refValue = +_refObject.getValue();
|
|
13098
|
+
if (Number.isNaN(refValue))
|
|
13099
|
+
return !0;
|
|
13100
|
+
refNumbers.push(refValue);
|
|
13101
|
+
}), {
|
|
13102
|
+
refHasError,
|
|
13103
|
+
refErrorObject,
|
|
13104
|
+
refNumbers
|
|
13105
|
+
}) : {
|
|
13106
|
+
refHasError: !0,
|
|
13107
|
+
refErrorObject,
|
|
13108
|
+
refNumbers
|
|
13109
|
+
};
|
|
13110
|
+
}
|
|
13111
|
+
};
|
|
13112
|
+
__name(_RankAvg, "RankAvg");
|
|
13113
|
+
let RankAvg = _RankAvg;
|
|
13114
|
+
const _RankEq = class _RankEq extends BaseFunction {
|
|
13115
|
+
constructor() {
|
|
13116
|
+
super(...arguments);
|
|
13117
|
+
__publicField(this, "minParams", 2);
|
|
13118
|
+
__publicField(this, "maxParams", 3);
|
|
13119
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
13120
|
+
}
|
|
13121
|
+
calculate(number, ref, order) {
|
|
13122
|
+
let _number = number;
|
|
13123
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
13124
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
13125
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
13126
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
13127
|
+
const maxRowLength = Math.max(
|
|
13128
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
13129
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
13130
|
+
), maxColumnLength = Math.max(
|
|
13131
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
13132
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
13133
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
13134
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
13135
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
13136
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13137
|
+
if (refHasError)
|
|
13138
|
+
return refErrorObject;
|
|
13139
|
+
if (orderObject.isError())
|
|
13140
|
+
return orderObject;
|
|
13141
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
13142
|
+
if (Number.isNaN(numberValue) || Number.isNaN(orderValue))
|
|
13143
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13144
|
+
const result = refNumbers.sort((a, b) => orderValue ? a - b : b - a).indexOf(numberValue);
|
|
13145
|
+
return result === -1 ? ErrorValueObject.create(ErrorType$1.NA) : NumberValueObject.create(result + 1);
|
|
13146
|
+
});
|
|
13147
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
13148
|
+
}
|
|
13149
|
+
_checkRefReferenceObject(ref) {
|
|
13150
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
13151
|
+
const refNumbers = [];
|
|
13152
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
13153
|
+
const _refObject = refObject;
|
|
13154
|
+
if (_refObject.isError())
|
|
13155
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
13156
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
13157
|
+
return !0;
|
|
13158
|
+
const refValue = +_refObject.getValue();
|
|
13159
|
+
if (Number.isNaN(refValue))
|
|
13160
|
+
return !0;
|
|
13161
|
+
refNumbers.push(refValue);
|
|
13162
|
+
}), {
|
|
13163
|
+
refHasError,
|
|
13164
|
+
refErrorObject,
|
|
13165
|
+
refNumbers
|
|
13166
|
+
}) : {
|
|
13167
|
+
refHasError: !0,
|
|
13168
|
+
refErrorObject,
|
|
13169
|
+
refNumbers
|
|
13170
|
+
};
|
|
13171
|
+
}
|
|
13172
|
+
};
|
|
13173
|
+
__name(_RankEq, "RankEq");
|
|
13174
|
+
let RankEq = _RankEq;
|
|
11294
13175
|
const _Stdeva = class _Stdeva extends BaseFunction {
|
|
11295
13176
|
constructor() {
|
|
11296
13177
|
super(...arguments);
|
|
@@ -11360,6 +13241,8 @@ const functionStatistical = [
|
|
|
11360
13241
|
[Min, FUNCTION_NAMES_STATISTICAL.MIN],
|
|
11361
13242
|
[Mina, FUNCTION_NAMES_STATISTICAL.MINA],
|
|
11362
13243
|
[Minifs, FUNCTION_NAMES_STATISTICAL.MINIFS],
|
|
13244
|
+
[RankAvg, FUNCTION_NAMES_STATISTICAL.RANK_AVG],
|
|
13245
|
+
[RankEq, FUNCTION_NAMES_STATISTICAL.RANK_EQ],
|
|
11363
13246
|
[StdevP, FUNCTION_NAMES_STATISTICAL.STDEV_P],
|
|
11364
13247
|
[StdevS, FUNCTION_NAMES_STATISTICAL.STDEV_S],
|
|
11365
13248
|
[Stdeva, FUNCTION_NAMES_STATISTICAL.STDEVA],
|
|
@@ -11442,7 +13325,7 @@ const _Len = class _Len extends BaseFunction {
|
|
|
11442
13325
|
if (text.isNull())
|
|
11443
13326
|
return NumberValueObject.create(0);
|
|
11444
13327
|
if (text.isNumber()) {
|
|
11445
|
-
const numberValue = text.getValue(), numberValueString = stripErrorMargin(numberValue).toString();
|
|
13328
|
+
const numberValue = text.getValue(), numberValueString = stripErrorMargin(numberValue, 12, Number.EPSILON).toString();
|
|
11446
13329
|
return NumberValueObject.create(numberValueString.length);
|
|
11447
13330
|
}
|
|
11448
13331
|
if (text.isString() || text.isBoolean() || text.isNumber()) {
|
|
@@ -11546,7 +13429,7 @@ const _Rept = class _Rept extends BaseFunction {
|
|
|
11546
13429
|
};
|
|
11547
13430
|
__name(_Rept, "Rept");
|
|
11548
13431
|
let Rept = _Rept;
|
|
11549
|
-
const getFormatPreview = /* @__PURE__ */ __name((pattern, value) => numfmt
|
|
13432
|
+
const getFormatPreview = /* @__PURE__ */ __name((pattern, value) => numfmt.format(pattern, value), "getFormatPreview"), _Text = class _Text extends BaseFunction {
|
|
11550
13433
|
constructor() {
|
|
11551
13434
|
super(...arguments);
|
|
11552
13435
|
__publicField(this, "minParams", 2);
|
|
@@ -12879,12 +14762,15 @@ let FormulaRuntimeService = (_a4 = class extends Disposable {
|
|
|
12879
14762
|
const cell = (_f = (_e = (_d = this._runtimeData) == null ? void 0 : _d[formulaUnitId]) == null ? void 0 : _e[formulaSheetId]) == null ? void 0 : _f.getValue(r, c), arrayDataCell = (_i = (_h = (_g = this._runtimeArrayFormulaCellData) == null ? void 0 : _g[formulaUnitId]) == null ? void 0 : _h[formulaSheetId]) == null ? void 0 : _i.getValue(
|
|
12880
14763
|
r,
|
|
12881
14764
|
c
|
|
12882
|
-
), currentCell = (_l = (_k = (_j = unitData == null ? void 0 : unitData[formulaUnitId]) == null ? void 0 : _j[formulaSheetId]) == null ? void 0 : _k.cellData) == null ? void 0 : _l.getValue(r, c);
|
|
12883
|
-
if (!isNullCell(cell) || !isNullCell(arrayDataCell) && !this._isInArrayFormulaRange(unitArrayFormulaRange, r, c) || !isNullCell(currentCell))
|
|
14765
|
+
), currentCell = (_l = (_k = (_j = unitData == null ? void 0 : unitData[formulaUnitId]) == null ? void 0 : _j[formulaSheetId]) == null ? void 0 : _k.cellData) == null ? void 0 : _l.getValue(r, c), featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
|
|
14766
|
+
if (!isNullCell(cell) || !isNullCell(arrayDataCell) && !this._isInArrayFormulaRange(unitArrayFormulaRange, r, c) || !isNullCell(currentCell) || !isNullCell(featureCell))
|
|
12884
14767
|
return !0;
|
|
12885
14768
|
}
|
|
12886
14769
|
return !1;
|
|
12887
14770
|
}
|
|
14771
|
+
_getRuntimeFeatureCellValue(row, column, sheetId, unitId) {
|
|
14772
|
+
return getRuntimeFeatureCell(row, column, sheetId, unitId, this._runtimeFeatureCellData);
|
|
14773
|
+
}
|
|
12888
14774
|
_isInArrayFormulaRange(range, r, c) {
|
|
12889
14775
|
if (range == null)
|
|
12890
14776
|
return !1;
|
|
@@ -13215,7 +15101,7 @@ const _FunctionNode = class _FunctionNode extends BaseAstNode {
|
|
|
13215
15101
|
this._compatibility();
|
|
13216
15102
|
for (let i = 0; i < childrenCount; i++) {
|
|
13217
15103
|
const object = children[i].getValue();
|
|
13218
|
-
object != null && (object.isReferenceObject() ? variants.push(object.toArrayValueObject()) : variants.push(object));
|
|
15104
|
+
object != null && (object.isReferenceObject() && !this._functionExecutor.needsReferenceObject ? variants.push(object.toArrayValueObject()) : variants.push(object));
|
|
13219
15105
|
}
|
|
13220
15106
|
const resultVariant = this._calculate(variants);
|
|
13221
15107
|
let result;
|
|
@@ -14996,7 +16882,7 @@ let FormulaDependencyGenerator = (_a14 = class extends Disposable {
|
|
|
14996
16882
|
if (tree === void 0 || tree.isSkip())
|
|
14997
16883
|
continue;
|
|
14998
16884
|
if (tree.isAdded()) {
|
|
14999
|
-
formulaRunList.push(tree);
|
|
16885
|
+
formulaRunList.push(tree), tree.setSkip();
|
|
15000
16886
|
continue;
|
|
15001
16887
|
}
|
|
15002
16888
|
const cacheStack = [];
|
|
@@ -15732,29 +17618,11 @@ let UniverFormulaEnginePlugin = (_a23 = class extends Plugin {
|
|
|
15732
17618
|
UniverFormulaEnginePlugin = __decorateClass([
|
|
15733
17619
|
__decorateParam(1, Inject(Injector))
|
|
15734
17620
|
], UniverFormulaEnginePlugin);
|
|
15735
|
-
function isFormulaTransformable(lexerTreeBuilder, formula) {
|
|
15736
|
-
const originSequenceNodes = lexerTreeBuilder.sequenceNodesBuilder(formula);
|
|
15737
|
-
return !(!originSequenceNodes || originSequenceNodes.every((node) => typeof node == "string" || node.nodeType !== sequenceNodeType.REFERENCE));
|
|
15738
|
-
}
|
|
15739
|
-
__name(isFormulaTransformable, "isFormulaTransformable");
|
|
15740
|
-
function transformFormula(lexerTreeBuilder, formula, originRow, originCol, targetRow, targetCol) {
|
|
15741
|
-
if (!isFormulaTransformable(lexerTreeBuilder, formula))
|
|
15742
|
-
return formula;
|
|
15743
|
-
const originSequenceNodes = lexerTreeBuilder.sequenceNodesBuilder(formula), getRangeFromCell = /* @__PURE__ */ __name((row, col) => ({ startRow: row, endRow: row, startColumn: col, endColumn: col }), "getRangeFromCell"), originRange = getRangeFromCell(originRow, originCol), relativeRange = Rectangle.getRelativeRange(getRangeFromCell(targetRow, targetCol), originRange), sequenceNodes = Tools.deepClone(originSequenceNodes), transformSequenceNodes = Array.isArray(sequenceNodes) ? sequenceNodes.map((node) => {
|
|
15744
|
-
if (typeof node == "object" && node.nodeType === sequenceNodeType.REFERENCE) {
|
|
15745
|
-
const gridRangeName = deserializeRangeWithSheet(node.token), newRange = Rectangle.getPositionRange(relativeRange, gridRangeName.range), newToken = serializeRange(newRange);
|
|
15746
|
-
return {
|
|
15747
|
-
...node,
|
|
15748
|
-
token: newToken
|
|
15749
|
-
};
|
|
15750
|
-
}
|
|
15751
|
-
return node;
|
|
15752
|
-
}) : sequenceNodes;
|
|
15753
|
-
return `=${transformSequenceNodes && generateStringWithSequence(transformSequenceNodes)}`;
|
|
15754
|
-
}
|
|
15755
|
-
__name(transformFormula, "transformFormula");
|
|
15756
17621
|
export {
|
|
17622
|
+
ActiveDirtyManagerService,
|
|
15757
17623
|
ArrayValueObject,
|
|
17624
|
+
AstRootNodeFactory,
|
|
17625
|
+
AstTreeBuilder,
|
|
15758
17626
|
AsyncArrayObject,
|
|
15759
17627
|
AsyncObject,
|
|
15760
17628
|
BaseFunction,
|
|
@@ -15762,9 +17630,11 @@ export {
|
|
|
15762
17630
|
BaseValueObject,
|
|
15763
17631
|
BooleanValue,
|
|
15764
17632
|
BooleanValueObject,
|
|
17633
|
+
CalculateController,
|
|
15765
17634
|
CalculateFormulaService,
|
|
15766
17635
|
CustomFunction,
|
|
15767
17636
|
DefinedNamesService,
|
|
17637
|
+
DependencyManagerService,
|
|
15768
17638
|
ERROR_TYPE_SET,
|
|
15769
17639
|
ErrorType$1 as ErrorType,
|
|
15770
17640
|
ErrorValueObject,
|
|
@@ -15786,24 +17656,35 @@ export {
|
|
|
15786
17656
|
FeatureCalculationManagerService,
|
|
15787
17657
|
FormulaCurrentConfigService,
|
|
15788
17658
|
FormulaDataModel,
|
|
17659
|
+
FormulaDependencyGenerator,
|
|
15789
17660
|
FormulaExecuteStageType,
|
|
15790
17661
|
FormulaExecutedStateType,
|
|
15791
17662
|
FormulaRuntimeService,
|
|
17663
|
+
FunctionNodeFactory,
|
|
15792
17664
|
FunctionService,
|
|
15793
17665
|
FunctionType,
|
|
15794
17666
|
IActiveDirtyManagerService,
|
|
15795
17667
|
IDefinedNamesService,
|
|
17668
|
+
IDependencyManagerService,
|
|
15796
17669
|
IFeatureCalculationManagerService,
|
|
15797
17670
|
IFormulaCurrentConfigService,
|
|
15798
17671
|
IFormulaRuntimeService,
|
|
15799
17672
|
IFunctionService,
|
|
15800
17673
|
IOtherFormulaManagerService,
|
|
17674
|
+
ISuperTableService,
|
|
17675
|
+
Interpreter,
|
|
17676
|
+
LambdaNodeFactory,
|
|
17677
|
+
LambdaParameterNodeFactory,
|
|
17678
|
+
Lexer,
|
|
15801
17679
|
LexerNode,
|
|
15802
17680
|
LexerTreeBuilder,
|
|
15803
17681
|
NullValueObject,
|
|
15804
17682
|
NumberValueObject,
|
|
17683
|
+
OperatorNodeFactory,
|
|
15805
17684
|
OtherFormulaManagerService,
|
|
17685
|
+
PrefixNodeFactory,
|
|
15806
17686
|
RangeReferenceObject,
|
|
17687
|
+
ReferenceNodeFactory,
|
|
15807
17688
|
RegisterFunctionMutation,
|
|
15808
17689
|
RemoveDefinedNameMutation,
|
|
15809
17690
|
RemoveFeatureCalculationMutation,
|
|
@@ -15821,7 +17702,11 @@ export {
|
|
|
15821
17702
|
SetSuperTableMutation,
|
|
15822
17703
|
SetSuperTableOptionMutation,
|
|
15823
17704
|
StringValueObject,
|
|
17705
|
+
SuffixNodeFactory,
|
|
17706
|
+
SuperTableService,
|
|
17707
|
+
UnionNodeFactory,
|
|
15824
17708
|
UniverFormulaEnginePlugin,
|
|
17709
|
+
ValueNodeFactory,
|
|
15825
17710
|
ValueObjectFactory,
|
|
15826
17711
|
compareToken,
|
|
15827
17712
|
convertUnitDataToRuntime,
|
|
@@ -15851,7 +17736,6 @@ export {
|
|
|
15851
17736
|
includeFormulaLexerToken,
|
|
15852
17737
|
initSheetFormulaData,
|
|
15853
17738
|
isFormulaLexerToken,
|
|
15854
|
-
isFormulaTransformable,
|
|
15855
17739
|
isInDirtyRange,
|
|
15856
17740
|
isReferenceString,
|
|
15857
17741
|
isReferenceStringWithEffectiveColumn,
|
|
@@ -15867,6 +17751,5 @@ export {
|
|
|
15867
17751
|
serializeRangeWithSpreadsheet,
|
|
15868
17752
|
singleReferenceToGrid,
|
|
15869
17753
|
strip,
|
|
15870
|
-
stripErrorMargin
|
|
15871
|
-
transformFormula
|
|
17754
|
+
stripErrorMargin
|
|
15872
17755
|
};
|