@odoo/o-spreadsheet 19.3.2 → 19.3.3

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.
@@ -955,4 +955,4 @@ If you meant to create a named range, named range cannot have the same name as a
955
955
  <Relationships xmlns="${nf.Relationships}">
956
956
  <Relationship ${J(e)} />
957
957
  </Relationships>
958
- `),`_rels/.rels`)}function QU(e){let t={},n=[];for(let r of e.sheets){let e=r.name.slice(0,31);e=qt(e,n,{compute:(e,t)=>e.slice(0,31-String(t).length)+t}),n.push(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${Qe(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function $U(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>Rn(bn(e.range)).numberOfRows>1);return e}var eW=function(e){return e[e.Ready=0]=`Ready`,e[e.Running=1]=`Running`,e[e.RunningCore=2]=`RunningCore`,e[e.Finalizing=3]=`Finalizing`,e}(eW||{}),tW=class e extends ur{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=eW.Ready;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},t={},n=[],r=new Bd,i=!1){let a=performance.now();console.debug(`##### Model creation #####`),super(),Pi(),n=ow(e,n);let o=QC(e,i);this.state=new pH,this.uuidGenerator=r,this.config=this.setupConfig(t),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.session=this.setupSession(o.revisionId),this.coreGetters={},this.range=new uH(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeData=this.range.getRangeData.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.coreGetters.copyFormulaStringForSheet=this.range.copyFormulaStringForSheet.bind(this.range),this.selection=new fH(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.coreViewPluginConfig=this.setupCoreViewPluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Gz.getAll())this.setupCorePlugin(e,o);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(n);for(let e of Jz.getAll()){let t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of qz.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of Kz.getAll()){let t=this.setupUiPlugin(e);this.handlers.push(t),this.uiHandlers.push(t)}if(this.config.mode!==`export_verification`&&(this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),t.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly())){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}console.debug(`Model created in`,performance.now()-a,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:St(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCoreViewPlugin(e){let t=new e(this.coreViewPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=eW.RunningCore,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new sz(sH({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowedRemoteCommand(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e,new QV(this.getters))}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:A(`Anonymous`).toString()},n=e.transportService||new rV,r=e.mode===`readonly`||e.mode===`dashboard`||e.mode===`export_verification`;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:r?new $V(n):n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(zo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,custom:this.config.custom,external:this.config.external}}setupCoreViewPluginConfig(){return{getters:this.getters,stateObserver:this.state,custom:this.config.custom,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}checkDispatchAllowed(e){let t=Du(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return this.processCommandResults(t)}processCommandResults(e){return e.some(e=>e!==U.Success)?new ku(e.flat()):ku.Success}checkDispatchAllowedRemoteCommand(e){let t=this.coreHandlers.map(t=>t.allowDispatch(e));return this.processCommandResults(t)}checkDispatchAllowedCoreCommand(e){return this.handlers.map(t=>t.allowDispatch(e))}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=eW.Finalizing;for(let e of this.handlers)e.finalize();this.status=eW.Ready,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(nW(e,t));dispatch=(e,t)=>{let n=nW(e,t),r=this.status;if(this.getters.isReadonly()&&!Ou(n))return new ku(U.Readonly);if(!this.session.canApplyOptimisticUpdate())return new ku(U.WaitingSessionConfirmation);switch(r){case eW.Ready:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),this.trigger(`command-rejected`,{command:n,result:t}),t;this.status=eW.Running;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Du(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=eW.Ready,this.trigger(`update`);break;case eW.Running:if(Du(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case eW.Finalizing:throw Error(`Cannot dispatch commands in the finalize state`);case eW.RunningCore:if(Du(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return ku.Success};dispatchFromCorePlugin=(e,t)=>{let n=nW(e,t),r=this.status;this.status=eW.RunningCore;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,ku.Success};dispatchToHandlers(e,t){let n=Du(t);for(let r of e)!n&&r instanceof OI||r.beforeHandle(t);for(let r of e)!n&&r instanceof OI||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let t=this._exportData(!0),n=this._exportData(!1),r={...this.config,mode:`export_verification`,client:{id:`exporter`,name:`exporter`},snapshotRequested:!1,transportService:new rV};return T(n,new e(x(t),r)._exportData(!1))?t:(n.isNotSquishable=!0,n)}_exportData(e){let t=pw();for(let n of this.handlers)n instanceof OI&&n.export(t,e);return t.revisionId=this.session.getRevisionId()||`START_REVISION`,t=x(t),t}updateMode(e){this.config.mode=e,this.trigger(`update`)}async exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=hw();for(let t of this.handlers)t instanceof DI&&await t.exportForExcel(e);return e=x(e),UU(e)}};function nW(e,t={}){let n=x(t);return n.type=e,n}function rW(e){return!NO.includes(e.horizontalGroupBy)||!NO.includes(e.verticalGroupBy)?U.InvalidChartDefinition:U.Success}let iW={sequence:110,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`dataSetStyles`,`showValues`,`colorScale`,`missingValueColor`,`axesDesign`,`horizontalGroupBy`,`verticalGroupBy`,`legendPosition`],validateDefinition(e,t){return e.checkValidations(t,rW)},fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){let n=`left`;return e.legendPosition===`right`&&(n=`right`),{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},title:e.title||{text:``},type:`calendar`,showValues:e.showValues,axesDesign:e.axesDesign,legendPosition:n,horizontalGroupBy:`day_of_week`,verticalGroupBy:`month_number`}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n}){let r=i_(t,n(),e),{labels:i,datasets:a}=gp(t,r);return{chartJsConfig:{type:`calendar`,data:{labels:i,datasets:a},options:{...ah,indexAxis:`x`,layout:I_(t,r),scales:Zf(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:ov(t,r),chartShowValuesPlugin:X_(t,r),chartColorScalePlugin:Qf(t,r),background:{color:t.background}}}}}}},aW={sequence:15,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`aggregated`,`axesDesign`,`showValues`,`hideDataMarkers`,`zoomable`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t)}},getDefinitionFromContextCreation(e,t){let n=e.dataSetStyles??{};if(e.dataSource?.type===`range`){let t=e.dataSource?.dataSets?.[0]?.dataSetId;for(let r of e.dataSource?.dataSets||[])n[r.dataSetId]={...e.dataSetStyles?.[r.dataSetId]||{},type:r.dataSetId===t?`bar`:`line`}}return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:n,aggregated:e.aggregated,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`combo`,axesDesign:e.axesDesign,showValues:e.showValues,hideDataMarkers:e.hideDataMarkers,zoomable:e.zoomable,humanize:e.humanize}},getRuntime(e,t,{extractData:n},r,i){let a=t_(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:xp(t,a)},options:{...ah,layout:F_(t,a),scales:Xf(t,a),plugins:{title:tv(t,e),legend:H_(t,a),tooltip:av(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},oW={sequence:100,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`dataSetStyles`,`axesDesign`,`legendPosition`,`horizontal`,`aggregated`,`showValues`,`funnelColors`,`cumulative`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},aggregated:e.aggregated??!1,legendPosition:`none`,title:e.title||{text:``},type:`funnel`,showValues:e.showValues,axesDesign:e.axesDesign,funnelColors:e.funnelColors,horizontal:!0,cumulative:e.cumulative??!0,humanize:e.humanize}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n},r,i){let a=u_(t,n(),e);return{chartJsConfig:{type:`funnel`,data:{labels:a.labels,datasets:wp(t,a)},options:{...ah,indexAxis:`y`,layout:F_(t,a),scales:sp(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:pv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}}}}},sW={sequence:90,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`colorScale`,`missingValueColor`,`region`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`geo`,humanize:e.humanize}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n},r,i){let a=l_(t,n(),e);return{chartJsConfig:{type:`choropleth`,data:{datasets:Cp(t,a)},options:{...ah,layout:F_(t,a),scales:op(t,a),plugins:{title:tv(t,e),tooltip:fv(t,a),legend:{display:!1},background:{color:t.background}},...i}}}}},cW={sequence:80,dataSeriesLimit:2,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`aggregated`,`axesDesign`,`stacked`,`horizontal`],fromStrDefinition:e=>({...e,horizontal:!0,stacked:!0}),toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pyramid`,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){if(t.dataSource.type!==`range`)return;let{dataSetsValues:i}=a_(t,OO(e,t.dataSource),e),a=Math.max(...i.map(e=>Math.max(...e.data.map(e=>W(e)?Math.abs(e.value):-1/0))));return{...t,horizontal:!0,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t),maxValue:a}},getRuntime(e,t,{extractData:n},r,i){let a=a_(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:hp(t,a)},options:{...ah,indexAxis:`y`,layout:F_(t,a),scales:ip(t,a),plugins:{title:tv(t,e),legend:R_(t,a),tooltip:uv(t,a),chartShowValuesPlugin:Q_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},lW={sequence:80,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`aggregated`,`stacked`,`fillArea`,`hideDataMarkers`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`radar`,fillArea:e.fillArea??!1,showValues:e.showValues??!1,hideDataMarkers:e.hideDataMarkers,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r}},getRuntime(e,t,{extractData:n},r,i){let a=c_(t,n(),e);return{chartJsConfig:{type:`radar`,data:{labels:a.labels,datasets:Sp(t,a)},options:{...ah,layout:F_(t,a),scales:ap(t,a),plugins:{title:tv(t,e),legend:W_(t,a),tooltip:dv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},uW={sequence:60,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`labelsAsText`,`aggregated`,`axesDesign`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`scatter`,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t)}},getRuntime(e,t,{extractData:n},r,i){let a=o_(t,n(),e);return{chartJsConfig:{type:`line`,data:{labels:a.labels,datasets:yp(t,a)},options:{...ah,layout:F_(t,a),scales:np(t,a),plugins:{title:tv(t,e),legend:V_(t,a),tooltip:sv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},dW={sequence:30,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`showLabels`,`valuesDesign`,`groupColors`,`pieHolePercentage`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSetStyles:e.dataSetStyles??{},dataSource:t.fromHierarchicalContextCreation(e),legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`sunburst`,showValues:e.showValues,showLabels:e.showLabels,valuesDesign:e.valuesDesign,groupColors:e.groupColors,humanize:e.humanize,pieHolePercentage:e.pieHolePercentage}},getContextCreation(e,t,n){return{...e,...t.getHierarchicalContextCreation(n)}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractHierarchicalData:n},r,i){let a=d_(t,n(),e);return{chartJsConfig:{type:`doughnut`,data:{datasets:Ep(t,a)},options:{cutout:t.pieHolePercentage===void 0?`25%`:`${t.pieHolePercentage}%`,...ah,layout:F_(t,a),plugins:{title:tv(t,e),legend:G_(t,a),tooltip:mv(t,a),sunburstLabelsPlugin:Z_(t,a),sunburstHoverPlugin:{enabled:!0},background:{color:t.background}},...i}}}}},fW={sequence:100,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showHeaders`,`headerDesign`,`showLabels`,`valuesDesign`,`coloringOptions`,`showValues`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSetStyles:e.dataSetStyles??{},dataSource:t.fromHierarchicalContextCreation(e),legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`treemap`,showValues:e.showValues,showHeaders:e.showHeaders,headerDesign:e.headerDesign,showLabels:e.showLabels,valuesDesign:e.valuesDesign,coloringOptions:e.treemapColoringOptions,humanize:e.humanize}},getContextCreation(e,t,n){return{...e,treemapColoringOptions:e.coloringOptions,...t.getHierarchicalContextCreation(n)}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractHierarchicalData:n},r,i){let a=d_(t,n(),e);return{chartJsConfig:{type:`treemap`,data:{labels:a.labels,datasets:jp(t,a)},options:{...ah,layout:F_(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:hv(t,a),background:{color:t.background}},...i}}}}};dS.add(`bar`,bv),dS.add(`combo`,aW),dS.add(`line`,jv),dS.add(`pie`,Mv),dS.add(`scorecard`,im),dS.add(`gauge`,Ev),dS.add(`scatter`,uW),dS.add(`waterfall`,Nv),dS.add(`pyramid`,cW),dS.add(`radar`,lW),dS.add(`geo`,sW),dS.add(`funnel`,oW),dS.add(`sunburst`,dW),dS.add(`treemap`,fW),dS.add(`calendar`,iW),Gv.add(`line`,{matcher:e=>e.type===`line`&&!e.stacked&&!e.fillArea,displayName:A(`Line`),chartType:`line`,chartSubtype:`line`,subtypeDefinition:{stacked:!1,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.LINE_CHART`}).add(`stacked_line`,{matcher:e=>e.type===`line`&&!e.fillArea&&!!e.stacked,displayName:A(`Stacked Line`),chartType:`line`,chartSubtype:`stacked_line`,subtypeDefinition:{stacked:!0,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.STACKED_LINE_CHART`}).add(`area`,{matcher:e=>e.type===`line`&&!e.stacked&&!!e.fillArea,displayName:A(`Area`),chartType:`line`,chartSubtype:`area`,subtypeDefinition:{stacked:!1,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.AREA_CHART`}).add(`stacked_area`,{matcher:e=>e.type===`line`&&e.stacked&&!!e.fillArea,displayName:A(`Stacked Area`),chartType:`line`,chartSubtype:`stacked_area`,subtypeDefinition:{stacked:!0,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.STACKED_AREA_CHART`}).add(`scatter`,{displayName:A(`Scatter`),chartType:`scatter`,chartSubtype:`scatter`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCATTER_CHART`}).add(`column`,{matcher:e=>e.type===`bar`&&!e.stacked&&!e.horizontal,displayName:A(`Column`),chartType:`bar`,chartSubtype:`column`,subtypeDefinition:{stacked:!1,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.COLUMN_CHART`}).add(`stacked_column`,{matcher:e=>e.type===`bar`&&e.stacked&&!e.horizontal,displayName:A(`Stacked Column`),chartType:`bar`,chartSubtype:`stacked_column`,subtypeDefinition:{stacked:!0,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART`}).add(`bar`,{matcher:e=>e.type===`bar`&&!e.stacked&&!!e.horizontal,displayName:A(`Bar`),chartType:`bar`,chartSubtype:`bar`,subtypeDefinition:{horizontal:!0,stacked:!1},category:`bar`,preview:`o-spreadsheet-ChartPreview.BAR_CHART`}).add(`stacked_bar`,{matcher:e=>e.type===`bar`&&e.stacked&&!!e.horizontal,displayName:A(`Stacked Bar`),chartType:`bar`,chartSubtype:`stacked_bar`,subtypeDefinition:{horizontal:!0,stacked:!0},category:`bar`,preview:`o-spreadsheet-ChartPreview.STACKED_BAR_CHART`}).add(`combo`,{displayName:A(`Combo`),chartSubtype:`combo`,chartType:`combo`,category:`line`,preview:`o-spreadsheet-ChartPreview.COMBO_CHART`}).add(`pie`,{matcher:e=>e.type===`pie`&&!e.isDoughnut,displayName:A(`Pie`),chartSubtype:`pie`,chartType:`pie`,subtypeDefinition:{isDoughnut:!1},category:`pie`,preview:`o-spreadsheet-ChartPreview.PIE_CHART`}).add(`doughnut`,{matcher:e=>e.type===`pie`&&!!e.isDoughnut,displayName:A(`Doughnut`),chartSubtype:`doughnut`,chartType:`pie`,subtypeDefinition:{isDoughnut:!0},category:`pie`,preview:`o-spreadsheet-ChartPreview.DOUGHNUT_CHART`}).add(`gauge`,{displayName:A(`Gauge`),chartSubtype:`gauge`,chartType:`gauge`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GAUGE_CHART`}).add(`scorecard`,{displayName:A(`Scorecard`),chartSubtype:`scorecard`,chartType:`scorecard`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCORECARD_CHART`}).add(`waterfall`,{displayName:A(`Waterfall`),chartSubtype:`waterfall`,chartType:`waterfall`,category:`misc`,preview:`o-spreadsheet-ChartPreview.WATERFALL_CHART`}).add(`pyramid`,{displayName:A(`Population Pyramid`),chartSubtype:`pyramid`,chartType:`pyramid`,category:`misc`,preview:`o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART`}).add(`radar`,{matcher:e=>e.type===`radar`&&!e.fillArea,displayName:A(`Radar`),chartSubtype:`radar`,chartType:`radar`,subtypeDefinition:{fillArea:!1},category:`misc`,preview:`o-spreadsheet-ChartPreview.RADAR_CHART`}).add(`filled_radar`,{matcher:e=>e.type===`radar`&&!!e.fillArea,displayName:A(`Filled Radar`),chartType:`radar`,chartSubtype:`filled_radar`,subtypeDefinition:{fillArea:!0},category:`misc`,preview:`o-spreadsheet-ChartPreview.FILLED_RADAR_CHART`}).add(`geo`,{displayName:A(`Geo Chart`),chartSubtype:`geo`,chartType:`geo`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GEO_CHART`}).add(`funnel`,{displayName:A(`Funnel`),chartSubtype:`funnel`,chartType:`funnel`,category:`misc`,preview:`o-spreadsheet-ChartPreview.FUNNEL_CHART`}).add(`sunburst`,{matcher:e=>e.type===`sunburst`,displayName:A(`Sunburst`),chartSubtype:`sunburst`,chartType:`sunburst`,category:`hierarchical`,preview:`o-spreadsheet-ChartPreview.SUNBURST_CHART`}).add(`treemap`,{matcher:e=>e.type===`treemap`,displayName:A(`Tree Map`),chartType:`treemap`,chartSubtype:`treemap`,category:`hierarchical`,preview:`o-spreadsheet-ChartPreview.TREE_MAP_CHART`}).add(`calendar`,{displayName:A(`Calendar`),chartSubtype:`calendar`,chartType:`calendar`,category:`misc`,preview:`o-spreadsheet-ChartPreview.CALENDAR_CHART`});var pW=class extends XL{queuedBordersToAdd={};copy(e){let t=e.sheetId;if(e.zones.length===0)return;let{rowsIndexes:n,columnsIndexes:r}=e,i=[];for(let e of n){let n=[];for(let i of r){let r={col:i,row:e,sheetId:t};n.push(this.getters.getCellBorder(r))}i.push(n)}return{borders:i}}paste(e,t,n){let r=e.sheetId;if(n.pasteOption===`asValue`)return;let i=e.zones;if(!n.isCutOperation)this.pasteFromCopy(r,i,t.borders);else{let{left:e,top:n}=i[0];this.pasteZone(r,e,n,t.borders)}this.executeQueuedChanges(r)}pasteZone(e,t,n,r){for(let[i,a]of r.entries())for(let[r,o]of a.entries()){let a={col:t+r,row:n+i,sheetId:e};this.pasteBorder(o,a)}}pasteBorder(e,t){let n={...this.getters.getCellBorder(t),...e},r=JSON.stringify(n);this.queuedBordersToAdd[r]||(this.queuedBordersToAdd[r]=[]),this.queuedBordersToAdd[r].push(D(t))}executeQueuedChanges(e){for(let t in this.queuedBordersToAdd){let n=this.queuedBordersToAdd[t],r=JSON.parse(t),i=ln(n,[]);this.dispatch(`SET_BORDERS_ON_TARGET`,{sheetId:e,target:i,border:r})}this.queuedBordersToAdd={}}},mW=class extends YL{copy(e){}},hW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);if(n.tag!==`carousel`)return;let r={...n},i=this.getters.getCarousel(e.figureId),a={};for(let e of i.items)if(e.type===`chart`){let t=this.getters.getChart(e.chartId);if(!t)throw Error(`No chart for the given id: ${e.chartId}`);a[e.chartId]=t}return{figureId:e.figureId,copiedFigure:r,copiedCarousel:i,copiedCharts:a,copiedSheetId:t}}getPasteTarget(e){return{zones:[],figureId:new Bd().smallUuid(),sheetId:e}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=e.sheetId,{width:o,height:s}=t.copiedFigure,c=this.getters.getMaxAnchorOffset(a,s,o),{left:l,top:u}=r[0],d={x:0,y:0};l>c.col&&(l=c.col,d.x=c.offset.x),u>c.row&&(u=c.row,d.y=c.offset.y),this.dispatch(`CREATE_CAROUSEL`,{figureId:i,sheetId:a,definition:{items:[]},col:l,row:u,offset:d,size:{height:s,width:o}});let f=new Bd,p=x(t.copiedCarousel.items);for(let e of p){if(e.type!==`chart`)continue;let n=t.copiedCharts[e.chartId],r=f.smallUuid(),o=wO.fromDefinition(this.getters,a,n.copyInSheetId(a)).getDefinition();this.dispatch(`CREATE_CHART`,{figureId:i,chartId:r,sheetId:a,definition:o}),e.chartId=r}this.dispatch(`UPDATE_CAROUSEL`,{sheetId:a,figureId:i,definition:{...t.copiedCarousel,items:p}}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.copiedSheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},gW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);if(n.tag!==`chart`)return;let r={...n},i=this.getters.getChartFromFigureId(e.figureId);if(!i)throw Error(`No chart for the given id: ${e.figureId}`);let a=i;return{figureId:e.figureId,copiedFigure:r,copiedChart:a}}getPasteTarget(e,t,n,r){return{zones:[],figureId:new Bd().smallUuid(),sheetId:e}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=e.sheetId,{width:o,height:s}=t.copiedFigure,c=t.copiedChart,l=wO.fromDefinition(this.getters,a,c.copyInSheetId(a)).getDefinition();l=wO.fromStrDefinition(this.getters,a,l).getDefinition();let u=this.getters.getMaxAnchorOffset(a,s,o),{left:d,top:f}=r[0],p={x:0,y:0};d>u.col&&(d=u.col,p.x=u.offset.x),f>u.row&&(f=u.row,p.y=u.offset.y),this.dispatch(`CREATE_CHART`,{figureId:i,chartId:new Bd().smallUuid(),sheetId:a,definition:l,col:d,row:f,offset:p,size:{height:s,width:o}}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.copiedChart.sheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},_W=class extends XL{uuidGenerator=new Bd;queuedChanges={};copy(e){if(!e.zones.length)return;let{rowsIndexes:t,columnsIndexes:n}=e,r=e.sheetId,i=[];for(let e of t){let t=[];for(let i of n){let n=Array.from(this.getters.getRulesByCell(r,i,e));t.push({position:{col:i,row:e,sheetId:r},rules:n})}i.push(t)}return{cfRules:i}}paste(e,t,n){if(this.queuedChanges={},n.pasteOption===`asValue`)return;let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t):this.pasteFromCopy(i,r,t.cfRules,n),this.executeQueuedChanges()}pasteFromCut(e,t,n){let r=t[0];this.pasteZone(e,r.left,r.top,n.cfRules,{isCutOperation:!0})}pasteZone(e,t,n,r,i){for(let[a,o]of r.entries())for(let[r,s]of o.entries()){let o={col:t+r,row:n+a,sheetId:e};this.pasteCf(s,o,i?.isCutOperation)}}pasteCf(e,t,n){if(e?.rules&&e.rules.length>0){let r=D(e.position),i=D(t);for(let a of e.rules){let o=[];if(n&&o.push(r),e.position.sheetId===t.sheetId)this.adaptCFRules(e.position.sheetId,a,[i],o);else{this.adaptCFRules(e.position.sheetId,a,[],o);let n=this.getCFToCopyTo(t.sheetId,a);this.adaptCFRules(t.sheetId,n,[i],[])}}}}adaptCFRules(e,t,n,r){this.queuedChanges[e]||(this.queuedChanges[e]=[]);let i=this.queuedChanges[e].find(e=>e.cf.id===t.id);i?(i.toAdd.push(...n),i.toRemove.push(...r)):this.queuedChanges[e].push({toAdd:n,toRemove:r,cf:t})}executeQueuedChanges(){for(let e in this.queuedChanges)for(let{toAdd:t,toRemove:n,cf:r}of this.queuedChanges[e]){let i=this.getters.getAdaptedCfRanges(e,r,t,n);if(i){if(i.length===0){this.dispatch(`REMOVE_CONDITIONAL_FORMAT`,{id:r.id,sheetId:e});continue}this.dispatch(`ADD_CONDITIONAL_FORMAT`,{cf:{id:r.id,rule:r.rule,stopIfTrue:r.stopIfTrue},ranges:i,sheetId:e})}}}getCFToCopyTo(e,t){let n=this.getters.getConditionalFormats(e).find(e=>e.stopIfTrue===t.stopIfTrue&&T(e.rule,t.rule)),r=this.queuedChanges[e];return!n&&r&&(n=r.find(e=>e.cf.stopIfTrue===t.stopIfTrue&&T(e.cf.rule,t.rule))?.cf),n||{...t,id:this.uuidGenerator.smallUuid(),ranges:[]}}},vW=class extends XL{uuidGenerator=new Bd;queuedChanges={};copy(e){let{rowsIndexes:t,columnsIndexes:n}=e,r=e.sheetId,i=[];for(let e of t){let t=[];for(let i of n){let n={sheetId:r,col:i,row:e},a=this.getters.getValidationRuleForCell(n);t.push({position:n,rule:a})}i.push(t)}return{dvRules:i}}paste(e,t,n){if(this.queuedChanges={},n.pasteOption)return;let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t):this.pasteFromCopy(i,r,t.dvRules),this.executeQueuedChanges()}pasteFromCut(e,t,n){let r=t[0];this.pasteZone(e,r.left,r.top,n.dvRules,{isCutOperation:!0})}pasteZone(e,t,n,r,i){for(let[a,o]of r.entries())for(let[r,s]of o.entries()){let o={col:t+r,row:n+a,sheetId:e};this.pasteDataValidation(s,o,i?.isCutOperation)}}pasteDataValidation(e,t,n){if(e){let r=D(t),i=D(e.position),a=e.rule;if(!a){let e=this.getters.getValidationRuleForCell(t);e&&this.adaptDataValidationRule(t.sheetId,e,[],[r]);return}let o=[];if(n&&o.push(i),e.position.sheetId===t.sheetId){let n=this.getDataValidationRuleToCopyTo(t.sheetId,a,!1);this.adaptDataValidationRule(e.position.sheetId,n,[r],o)}else{let n=this.getters.getValidationRuleForCell(e.position);n&&this.adaptDataValidationRule(e.position.sheetId,n,[],o);let i=this.getDataValidationRuleToCopyTo(t.sheetId,a);this.adaptDataValidationRule(t.sheetId,i,[r],[])}}}getDataValidationRuleToCopyTo(e,t,n=!0){let r=this.getters.getDataValidationRules(e).find(e=>T(t.criterion,e.criterion)&&t.isBlocking===e.isBlocking),i=this.queuedChanges[e];return!r&&i&&(r=i.find(e=>T(t.criterion,e.rule.criterion)&&t.isBlocking===e.rule.isBlocking)?.rule),r||{...t,id:n?this.uuidGenerator.smallUuid():t.id,ranges:[]}}adaptDataValidationRule(e,t,n,r){this.queuedChanges[e]||(this.queuedChanges[e]=[]);let i=this.queuedChanges[e].find(e=>e.rule.id===t.id);i?(i.toAdd.push(...n),i.toRemove.push(...r)):this.queuedChanges[e].push({toAdd:n,toRemove:r,rule:t})}executeQueuedChanges(){for(let e in this.queuedChanges)for(let{toAdd:t,toRemove:n,rule:r}of this.queuedChanges[e]){let i=ln([...ln(r.ranges.map(e=>e.zone),n),...t],[]);if(i.length===0){this.dispatch(`REMOVE_DATA_VALIDATION_RULE`,{sheetId:e,id:r.id});continue}this.dispatch(`ADD_DATA_VALIDATION_RULE`,{rule:{id:r.id,criterion:r.criterion,isBlocking:r.isBlocking},ranges:i.map(t=>this.getters.getRangeDataFromZone(e,t)),sheetId:e})}}},yW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);let r={...n};if(n.tag!==`image`)return;let i=x(this.getters.getImage(e.figureId));return{figureId:e.figureId,copiedFigure:r,copiedImage:i,sheetId:t}}getPasteTarget(e,t,n,r){return{sheetId:e,zones:[],figureId:new Bd().smallUuid()}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=this.getters.getActiveSheetId(),{width:o,height:s}=t.copiedFigure,c=x(t.copiedImage),l=this.getters.getMaxAnchorOffset(a,s,o),{left:u,top:d}=r[0],f={x:0,y:0};u>l.col&&(u=l.col,f.x=l.offset.x),d>l.row&&(d=l.row,f.y=l.offset.y),this.dispatch(`CREATE_IMAGE`,{figureId:i,sheetId:a,col:u,row:d,offset:f,size:{height:s,width:o},definition:c}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.sheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},bW=class extends XL{copy(e){let t=this.getters.getActiveSheetId(),{rowsIndexes:n,columnsIndexes:r}=e,i=[];for(let e of n){let n=[];for(let i of r){let r={col:i,row:e,sheetId:t};n.push(this.getters.getMerge(r))}i.push(n)}return{merges:i,sheetId:t}}paste(e,t,n){if(n.isCutOperation){let e=t.merges.flat().filter(w);this.dispatch(`REMOVE_MERGE`,{sheetId:t.sheetId,target:e})}this.pasteFromCopy(e.sheetId,e.zones,t.merges,n)}pasteZone(e,t,n,r){for(let[i,a]of r.entries())for(let[r,o]of a.entries()){let a={col:t+r,row:n+i,sheetId:e};this.pasteMerge(o,a)}}pasteMerge(e,t){if(!e||this.getters.isInMerge(t))return;let{sheetId:n,col:r,row:i}=t;this.dispatch(`ADD_MERGE`,{sheetId:n,force:!0,target:[{left:r,top:i,right:r+e.right-e.left,bottom:i+e.bottom-e.top}]})}},xW=class extends XL{copy(e){return{zones:e.clippedZones,sheetId:e.sheetId}}paste(e,t,n){if(n.isCutOperation){let n=e.zones[0];this.dispatch(`MOVE_RANGES`,{target:t.zones,sheetId:t.sheetId,sheetName:this.getters.getSheetName(t.sheetId),targetSheetId:e.sheetId,col:n.left,row:n.top})}}},SW=class extends XL{isPasteAllowed(e,t,n,r){if(!(`cells`in n))return U.Success;let{xSplit:i,ySplit:a}=this.getters.getPaneDivisions(e);return $n(QT(t,n.cells),i,a)?U.FrozenPaneOverlap:U.Success}},CW=class extends XL{copy(e,t,n=`copyPaste`){let r=e.sheetId,{rowsIndexes:i,columnsIndexes:a,zones:o}=e,s=new Set,c=[];for(let e of i){let l=[];c.push(l);for(let c of a){let a={col:c,row:e,sheetId:r},u=this.getters.getTable(a);if(!u){l.push({});continue}let d=this.getters.getCoreTable(a),f=d?.range.zone,p;if(!s.has(u.id)&&d&&f&&o.some(e=>Ln(f,e))){s.add(u.id);let{numberOfRows:e}=Rn(f);for(let n=f.top;n<=f.bottom;n++)!t&&!i.includes(n)&&e--;let n=d.range,r=this.getters.extendRange(d.range,`ROW`,n.zone.top+e-1-n.zone.bottom);p={range:this.getters.getRangeData(r),config:d.config,type:d.type}}if(u.isPivotTable){let t=u.range.zone.top===e&&u.range.zone.left===c,n=o.some(e=>Ln(u.range.zone,e));(t||n)&&s.add(u.id)}n!==`shiftCells`&&l.push({table:p,style:this.getTableStyleToCopy(a),isWholeTableCopied:s.has(u.id)})}}return{tableCells:c,sheetId:e.sheetId}}getTableStyleToCopy(e){let t=Ot({...this.getters.getCellTableStyle(e),hideGridLines:!1}),n=this.getters.getCellStyle(e),r=this.getters.getCellTableBorder(e),i=this.getters.getCellBorder(e);return{style:{...t,...Ot(n)},border:{...r,...Ot(i)}}}paste(e,t,n){let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t,n):this.pasteFromCopy(i,r,t.tableCells,n)}pasteFromCut(e,t,n,r){for(let e of n.tableCells)for(let t of e)t.table&&this.dispatch(`REMOVE_TABLE`,{sheetId:n.sheetId,target:[this.getters.getRangeFromRangeData(t.table.range).zone]});let i=t[0];this.pasteZone(e,i.left,i.top,n.tableCells,r)}pasteZone(e,t,n,r,i){for(let a=0;a<r.length;a++){let o=r[a];for(let r=0;r<o.length;r++){let s=o[r];if(!s)continue;let c={col:t+r,row:n+a,sheetId:e};this.pasteTableCell(e,s,c,i)}}if(r.length===1)for(let i=0;i<r[0].length;i++)this.dispatch(`AUTOFILL_TABLE_COLUMN`,{col:t+i,row:n,sheetId:e})}pasteTableCell(e,t,n,r){if(t.table&&!r?.pasteOption){let{range:r}=t.table,i=Rn(this.getters.getRangeFromRangeData(r).zone),a={left:n.col,top:n.row,right:n.col+i.numberOfCols-1,bottom:n.row+i.numberOfRows-1};this.dispatch(`CREATE_TABLE`,{sheetId:n.sheetId,ranges:[this.getters.getRangeDataFromZone(e,a)],config:t.table.config,tableType:t.table.type})}this.getters.getCoreTable(n)||r?.pasteOption===`asValue`||(!r?.pasteOption&&!t.isWholeTableCopied||r?.pasteOption===`onlyFormat`)&&(t.style?.style&&this.dispatch(`UPDATE_CELL`,{...n,style:t.style.style}),t.style?.border&&this.dispatch(`SET_BORDER`,{...n,border:t.style.border}))}};GF.figureHandlers.add(`chart`,gW).add(`image`,yW).add(`carousel`,hW),GF.cellHandlers.add(`dataValidation`,vW).add(`cell`,ZL).add(`sheet`,SW).add(`merge`,bW).add(`border`,pW).add(`table`,CW).add(`conditionalFormat`,_W).add(`references`,xW);var wW=l({ARRAYTOTEXT:()=>$W,ARRAY_CONSTRAIN:()=>DW,ARRAY_LITERAL:()=>OW,ARRAY_ROW:()=>kW,CHOOSECOLS:()=>AW,CHOOSEROWS:()=>jW,EXPAND:()=>MW,FLATTEN:()=>NW,FREQUENCY:()=>PW,HSTACK:()=>FW,MDETERM:()=>IW,MINVERSE:()=>LW,MMULT:()=>RW,SUMPRODUCT:()=>zW,SUMX2MY2:()=>VW,SUMX2PY2:()=>HW,SUMXMY2:()=>UW,TOCOL:()=>KW,TOROW:()=>qW,TRANSPOSE:()=>JW,VSTACK:()=>YW,WRAPCOLS:()=>XW,WRAPROWS:()=>ZW});function TW(e,t){let n=e.map(R),r=n.map(e=>e?.[0]?.length??0),i=Math.max(...r);if(t?.requireSameRowCount){let e=r[0];if(r.some(t=>t!==e))return new M(A(`All ranges in [[FUNCTION_NAME]] must have the same number of columns (got %s).`,r.join(`, `)))}let a=[];for(let e of n)for(let t=0;t<e.length;t++){let n=Array(i).fill({value:null});for(let r=0;r<e[t].length;r++)n[r]=e[t][r];a.push(n)}return a}function EW(e,t){let n=e.map(R),r=n.map(e=>e?.length??0),i=Math.max(...r);if(t?.requireSameColCount){let e=r[0];if(r.some(t=>t!==e))return new M(A(`All ranges in [[FUNCTION_NAME]] must have the same number of columns (got %s).`,r.join(`, `)))}let a=uo(i,n.reduce((e,t)=>e+(t?.[0]?.length??0),0),()=>({value:null})),o=0;for(let e of n){for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)a[t][o+n]=e[t][n];o+=e[0]?.length??0}return a}let DW={description:A(`Returns a result array constrained to a specific width and height.`),args:[k(`input_range (any, range<any>)`,A(`The range to constrain.`)),k(`rows (number)`,A(`The number of rows in the constrained array.`)),k(`columns (number)`,A(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=R(e),i=Xa(t?.value,this.locale),a=Xa(n?.value,this.locale);if(i<=0)return new M(A(`The rows argument (%s) must be strictly positive.`,i.toString()));if(a<=0)return new M(A(`The columns argument (%s) must be strictly positive.`,a.toString()));let o=Math.min(i,r[0].length);return uo(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},OW={description:A(`Appends ranges vertically and in sequence to return a larger array. All ranges must have the same number of columns.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return EW(e,{requireSameColCount:!0})},isExported:!1,hidden:!0},kW={description:A(`Appends ranges horizontally and in sequence to return a larger array. All ranges must have the same number of rows.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return TW(e,{requireSameRowCount:!0})},isExported:!1,hidden:!0},AW={description:A(`Creates a new array from the selected columns in the existing range.`),args:[k(`array (any, range<any>)`,A(`The array that contains the columns to be returned.`)),k(`col_num (number, range<number>, repeating)`,A(`The column index of the column to be returned.`))],compute:function(e,...t){let n=R(e),r=Do(t,e=>Xa(e?.value,this.locale)),i=r.filter(e=>e===0||n.length<Math.abs(e));if(i.length!==0)return new M(A(`The columns arguments must be between -%s and %s (got %s), excluding 0.`,n.length.toString(),n.length.toString(),i.join(`,`)));let a=Array(r.length);for(let e=0;e<r.length;e++)r[e]>0?a[e]=n[r[e]-1]:a[e]=n[n.length+r[e]];return a},isExported:!0},jW={description:A(`Creates a new array from the selected rows in the existing range.`),args:[k(`array (any, range<any>)`,A(`The array that contains the rows to be returned.`)),k(`row_num (number, range<number>, repeating)`,A(`The row index of the row to be returned.`))],compute:function(e,...t){let n=R(e),r=Do(t,e=>Xa(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return a.length===0?uo(i,r.length,(e,t)=>r[t]>0?n[e][r[t]-1]:n[e][n[e].length+r[t]]):new M(A(`The rows arguments must be between -%s and %s (got %s), excluding 0.`,n[0].length.toString(),n[0].length.toString(),a.join(`,`)))},isExported:!0},MW={description:A(`Expands or pads an array to specified row and column dimensions.`),args:[k(`array (any, range<any>)`,A(`The array to expand.`)),k(`rows (number)`,A(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),k(`columns (number, optional)`,A(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),k(`pad_with (any, default=0)`,A(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=R(e),a=Xa(t?.value,this.locale),o=n===void 0?i.length:Xa(n.value,this.locale);return a<i[0].length?new M(A(`The rows arguments (%s) must be greater or equal than the number of rows of the array.`,a.toString())):o<i.length?new M(A(`The columns arguments (%s) must be greater or equal than the number of columns of the array.`,o.toString())):uo(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},NW={description:A(`Flattens all the values from one or more ranges into a single column.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to flatten.`))],compute:function(...e){return[Do(e,e=>e===void 0?{value:``}:e)]},isExported:!1},PW={description:A(`Calculates the frequency distribution of a range.`),args:[k(`data (range<number>)`,A(`The array of ranges containing the values to be counted.`)),k(`classes (number, range<number>)`,A(`The range containing the set of classes.`))],compute:function(e,t){let n=Do([e],e=>e.value).filter(e=>typeof e==`number`),r=Do([t],e=>e.value).filter(e=>typeof e==`number`).map((e,t)=>({initialIndex:t,value:e,count:0})).sort((e,t)=>e.value-t.value);r.push({initialIndex:r.length,value:1/0,count:0});let i=n.sort((e,t)=>e-t),a=0;for(let e of i){for(;e>r[a].value&&a<r.length-1;)a++;r[a].count++}return[r.sort((e,t)=>e.initialIndex-t.initialIndex).map(e=>e.count)]},isExported:!0},FW={description:A(`Appends ranges horizontally and in sequence to return a larger array.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return TW(e)},isExported:!0},IW={description:A(`Returns the matrix determinant of a square matrix.`),args:[k(`square_matrix (number, range<number>)`,A(`An range with an equal number of rows and columns representing a matrix whose determinant will be calculated.`))],compute:function(e){let t=Ja(e,`square_matrix`);return gh(t)?yh(t).determinant:new M(A(`The argument square_matrix must have the same number of columns and rows.`))},isExported:!0},LW={description:A(`Returns the multiplicative inverse of a square matrix.`),args:[k(`square_matrix (number, range<number>)`,A(`An range with an equal number of rows and columns representing a matrix whose multiplicative inverse will be calculated.`))],compute:function(e){let t=Ja(e,`square_matrix`);if(!gh(t))return new M(A(`The argument square_matrix must have the same number of columns and rows.`));let{inverted:n}=yh(t);return n||new M(A(`The matrix is not invertible.`))},isExported:!0},RW={description:A(`Calculates the matrix product of two matrices.`),args:[k(`matrix1 (number, range<number>)`,A(`The first matrix in the matrix multiplication operation.`)),k(`matrix2 (number, range<number>)`,A(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=Ja(e,`matrix1`),r=Ja(t,`matrix2`);return n.length===0||r.length===0?new M(A(`The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices.`)):n.length===r[0].length?xh(n,r):new M(A(`In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the number of rows of the second matrix (%s).`,n.length.toString(),r[0].length.toString()))},isExported:!0},zW={description:A(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[k(`range (number, range<number>, repeating)`,A(`The range whose entries will be multiplied with corresponding entries in the other range.`))],compute:function(...e){if(!hh(...e))return new M(A(`All the ranges must have the same dimensions.`));let t=e.map(R),n=0;for(let e=0;e<t[0].length;e++)for(let r=0;r<t[0][e].length;r++){if(!t.every(t=>typeof t[e][r].value==`number`))continue;let i=1;for(let n of t)i*=F(n[e][r],this.locale);n+=i}return n},isExported:!0};function BW(e,t,n){if(!hh(e,t))return new M(A(`The arguments array_x and array_y must have the same dimensions.`));let r=R(e),i=R(t),a=!1,o=0;for(let e in r)for(let t in r[e]){let s=r[e][t].value,c=i[e][t].value;typeof s!=`number`||typeof c!=`number`||(a=!0,o+=n(s,c))}return a?o:new M(A(`The arguments array_x and array_y must contain at least one pair of numbers.`))}let VW={description:A(`Calculates the sum of the difference of the squares of the values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values whose squares will be reduced by the squares of corresponding entries in array_y and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values whose squares will be subtracted from the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>e**2-t**2)},isExported:!0},HW={description:A(`Calculates the sum of the sum of the squares of the values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values whose squares will be added to the squares of corresponding entries in array_y and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values whose squares will be added to the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>e**2+t**2)},isExported:!0},UW={description:A(`Calculates the sum of squares of the differences of values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values that will be reduced by corresponding entries in array_y, squared, and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values that will be subtracted from corresponding entries in array_x, the result squared, and all such results added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>(e-t)**2)},isExported:!0},WW=[k(`array (any, range<any>)`,A(`The array which will be transformed.`)),k(`ignore (number, default=0)`,A(`Whether to ignore certain types of values. By default, no values are ignored.`),[{value:0,label:A(`Keep all values (default)`)},{value:1,label:A(`Ignore blanks`)},{value:2,label:A(`Ignore errors`)},{value:3,label:A(`Ignore blanks and errors`)}]),k(`scan_by_column (number, default=false)`,A(`Scan the array by column. By default, the array is scanned by row.`),[{value:!1,label:A(`Scan by row (default)`)},{value:!0,label:A(`Scan by column`)}])];function GW(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!P(e.value);if(t===3)return e=>e.value!==null&&!P(e.value);throw new M(A(`Argument ignore must be between 0 and 3`))}let KW={description:A(`Transforms a range of cells into a single column.`),args:WW,compute:function(e,t={value:0},n={value:!1}){let r=R(e),i=F(t.value,this.locale),a=(L(n.value)?r:mo(r)).flat().filter(GW(i));return a.length===0?new Bi(A(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},qW={description:A(`Transforms a range of cells into a single row.`),args:WW,compute:function(e,t={value:0},n={value:!1}){let r=R(e),i=F(t.value,this.locale),a=(L(n.value)?r:mo(r)).flat().filter(GW(i)).map(e=>[e]);return a.length===0||a[0].length===0?new Bi(A(`No results for the given arguments of TOROW.`)):a},isExported:!0},JW={description:A(`Transposes the rows and columns of a range.`),args:[k(`range (any, range<any>)`,A(`The range to be transposed.`))],compute:function(e){let t=R(e),n=t[0].length,r=t.length;return uo(n,r,(e,n)=>t[n][e])},isExported:!0},YW={description:A(`Appends ranges vertically and in sequence to return a larger array.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return EW(e)},isExported:!0},XW={description:A(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[k(`range (any, range<any>)`,A(`The range to wrap.`)),k(`wrap_count (number)`,A(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),k(`pad_with (any, default=0)`,A(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=R(e),i=Xa(t?.value,this.locale);if(!mh(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return uo(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},ZW={description:A(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[k(`range (any, range<any>)`,A(`The range to wrap.`)),k(`wrap_count (number)`,A(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),k(`pad_with (any, default=0)`,A(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=R(e),i=Xa(t?.value,this.locale);if(!mh(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return uo(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0},QW=[{value:0,label:A(`Concise format\xA0(default)`)},{value:1,label:A(`Strict format`)}],$W={description:A(`returns an array of text values from any specified range. It passes text values unchanged, and converts non-text values to text.`),args:[k(`array (range)`,A(`The array to convert into text`)),k(`format (number, default=0)`,A(`The format of the returned data.`),QW)],compute:function(e,t={value:0}){let n=F(t,this.locale),r=R(e);if(n===1)return sT(r,``,this.locale);if(n===0){let e=this.locale.decimalSeparator===`,`?`/`:`,`;return mo(r).flatMap(e=>e.map(e=>P(e.value)?e.value:I(e))).join(e)}else return new M(A(`Format must be 0 or 1`))},isExported:!0};var eG=l({ABS:()=>nG,ACOS:()=>rG,ACOSH:()=>iG,ACOT:()=>aG,ACOTH:()=>oG,ASIN:()=>sG,ASINH:()=>cG,ATAN:()=>lG,ATAN2:()=>uG,ATANH:()=>dG,CEILING:()=>fG,CEILING_MATH:()=>mG,CEILING_PRECISE:()=>hG,COS:()=>gG,COSH:()=>_G,COT:()=>vG,COTH:()=>yG,COUNTBLANK:()=>bG,COUNTIF:()=>xG,COUNTIFS:()=>SG,COUNTUNIQUE:()=>CG,COUNTUNIQUEIFS:()=>wG,CSC:()=>TG,CSCH:()=>EG,DECIMAL:()=>DG,DEGREES:()=>OG,EXP:()=>kG,FLOOR:()=>AG,FLOOR_MATH:()=>MG,FLOOR_PRECISE:()=>NG,INT:()=>hK,ISEVEN:()=>PG,ISODD:()=>IG,ISO_CEILING:()=>FG,LN:()=>LG,LOG:()=>RG,MOD:()=>BG,MUNIT:()=>VG,ODD:()=>HG,PI:()=>UG,POWER:()=>WG,PRODUCT:()=>GG,RAND:()=>KG,RANDARRAY:()=>qG,RANDBETWEEN:()=>JG,ROUND:()=>YG,ROUNDDOWN:()=>XG,ROUNDUP:()=>ZG,SEC:()=>QG,SECH:()=>$G,SEQUENCE:()=>eK,SIN:()=>tK,SINH:()=>nK,SQRT:()=>rK,SUBTOTAL:()=>sK,SUM:()=>cK,SUMIF:()=>lK,SUMIFS:()=>uK,TAN:()=>dK,TANH:()=>fK,TRUNC:()=>mK});let tG=/^-?[a-z0-9]+$/i,nG={description:A(`Absolute value of a number.`),args:[k(`value (number)`,A(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(F(e,this.locale))},isExported:!0},rG={description:A(`Inverse cosine of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>1?new M(A(`The value (%s) must be between -1 and 1 inclusive.`,t)):Math.acos(t)},isExported:!0},iG={description:A(`Inverse hyperbolic cosine of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to 1.`))],compute:function(e){let t=F(e,this.locale);return t<1?new M(A(`The value (%s) must be greater than or equal to 1.`,t)):Math.acosh(t)},isExported:!0},aG={description:A(`Inverse cotangent of a value.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=F(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},oG={description:A(`Inverse hyperbolic cotangent of a value.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic cotangent. Must not be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)<=1?new M(A(`The value (%s) cannot be between -1 and 1 inclusive.`,t)):Math.log((t+1)/(t-1))/2},isExported:!0},sG={description:A(`Inverse sine of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>1?new M(A(`The value (%s) must be between -1 and 1 inclusive.`,t)):Math.asin(t)},isExported:!0},cG={description:A(`Inverse hyperbolic sine of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(F(e,this.locale))},isExported:!0},lG={description:A(`Inverse tangent of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(F(e,this.locale))},isExported:!0},uG={description:A(`Angle from the X axis to a point (x,y), in radians.`),args:[k(`x (number)`,A(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),k(`y (number)`,A(`The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return n===0&&r===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):Math.atan2(r,n)},isExported:!0},dG={description:A(`Inverse hyperbolic tangent of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>=1?new M(A(`The value (%s) must be between -1 and 1 exclusive.`,t)):Math.atanh(t)},isExported:!0},fG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`value (number)`,A(`The value to round up to the nearest integer multiple of factor.`)),k(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return r<0&&n>0?new M(A(`The factor (%s) must be positive when the value (%s) is positive.`,r,n)):{value:r?Math.ceil(n/r)*r:0,format:e?.format}},isExported:!0};function pG(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.ceil(e/t)*t:n===0?-Math.floor(Math.abs(e)/t)*t:-Math.ceil(Math.abs(e)/t)*t)}let mG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),k(`mode (number, default=0)`,A(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded towards zero. Otherwise, it is rounded away from zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:pG(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},hG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:pG(F(e,this.locale),n),format:e?.format}},isExported:!0},gG={description:A(`Cosine of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(F(e,this.locale))},isExported:!0},_G={description:A(`Hyperbolic cosine of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(F(e,this.locale))},isExported:!0},vG={description:A(`Cotangent of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tan(t)},isExported:!0},yG={description:A(`Hyperbolic cotangent of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tanh(t)},isExported:!0},bG={description:A(`Number of empty values.`),args:[k(`value (any, range, repeating)`,A(`Value or range in which to count the number of blanks.`))],compute:function(...e){return so(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},xG={description:A(`A conditional count across a range.`),args:[k(`range (range)`,A(`The range that is tested against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return xo(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},SG={description:A(`Count values depending on multiple criteria.`),args:[k(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(...e){let t=0;return xo(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},CG={description:A(`Counts number of unique values in a range.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider for uniqueness.`))],compute:function(...e){return eg(e)}},wG={description:A(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the number of unique values will be counted.`)),k(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=new Set;return xo(t,(t,r)=>{let i=e[t]?.[r];Oo(i)&&n.add(i.value)},this.locale),n.size}},TG={description:A(`Cosecant of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sin(t)},isExported:!0},EG={description:A(`Hyperbolic cosecant of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sinh(t)},isExported:!0},DG={description:A(`Converts from another base to decimal.`),args:[k(`value (string)`,A(`The number to convert.`)),k(`base (number)`,A(`The base to convert the value from.`))],compute:function(e,t){let n=F(t,this.locale);if(n=Math.floor(n),2>n||n>36)return new M(A(`The base (%s) must be between 2 and 36 inclusive.`,n));let r=I(e);if(r===``)return 0;if(!tG.test(r))return new M(A(`The value (%s) must be a valid base %s representation.`,r,n));let i=parseInt(r,n);return isNaN(i)?new M(A(`The value (%s) must be a valid base %s representation.`,r,n)):i},isExported:!0},OG={description:A(`Converts an angle value in radians to degrees.`),args:[k(`angle (number)`,A(`The angle to convert from radians to degrees.`))],compute:function(e){return F(e,this.locale)*180/Math.PI},isExported:!0},kG={description:A(`Euler's number, e (~2.718) raised to a power.`),args:[k(`value (number)`,A(`The exponent to raise e.`))],compute:function(e){return Math.exp(F(e,this.locale))},isExported:!0},AG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`value (number)`,A(`The value to round down to the nearest integer multiple of factor.`)),k(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return r<0&&n>0?new M(A(`The factor (%s) must be positive when the value (%s) is positive.`,r,n)):{value:r?Math.floor(n/r)*r:0,format:e?.format}},isExported:!0};function jG(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:n===0?-Math.ceil(Math.abs(e)/t)*t:-Math.floor(Math.abs(e)/t)*t)}let MG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),k(`mode (number, default=0)`,A(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded away from zero. Otherwise, it is rounded towards zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:jG(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},NG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:jG(F(e,this.locale),n),format:e?.format}},isExported:!0},PG={description:A(`Whether the provided value is even.`),args:[k(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=Ya(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},FG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:pG(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},IG={description:A(`Whether the provided value is even.`),args:[k(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=Ya(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},LG={description:A(`The logarithm of a number, base e (euler's number).`),args:[k(`value (number)`,A(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=F(e,this.locale);return t<=0?new M(A(`The value (%s) must be strictly positive.`,t)):Math.log(t)},isExported:!0},RG={description:A(`The logarithm of a number, for a given base.`),args:[k(`value (number)`,A(`The value for which to calculate the logarithm.`)),k(`base (number, default=10)`,A(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=F(e,this.locale),r=F(t,this.locale);return n<=0?new M(A(`The value (%s) must be strictly positive.`,n)):r<=0?new M(A(`The base (%s) must be strictly positive.`,r)):r===1?new M(A(`The base must be different from 1.`)):Math.log10(n)/Math.log10(r)},isExported:!0};function zG(e,t){ph(t,A(`The divisor must be different from 0.`));let n=e%t;return n>0&&t<0||n<0&&t>0?n+t:n}let BG={description:A(`Modulo (remainder) operator.`),args:[k(`dividend (number)`,A(`The number to be divided to find the remainder.`)),k(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return{value:zG(F(e,this.locale),n),format:e?.format}},isExported:!0},VG={description:A(`Returns a n x n unit matrix, where n is the input dimension.`),args:[k(`dimension (number)`,A(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=Xa(e,this.locale);return t<1?new M(A(`The argument dimension must be positive`)):vh(t)},isExported:!0},HG={description:A(`Rounds a number up to the nearest odd integer.`),args:[k(`value (number)`,A(`The value to round to the next greatest odd number.`))],compute:function(e){let t=F(e,this.locale),n=Math.ceil(Math.abs(t));return n=n&1?n:n+1,{value:t<0?-n:n,format:e?.format}},isExported:!0},UG={description:A(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},WG={description:A(`A number raised to a power.`),args:[k(`base (number)`,A(`The number to raise to the exponent power.`)),k(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return n<0&&!Number.isInteger(r)?new M(A(`The exponent (%s) must be an integer when the base is negative.`,r)):{value:n**+r,format:e?.format}},isExported:!0},GG={description:A(`Result of multiplying a series of numbers together.`),args:[k(`factor (number, range<number>, repeating)`,A(`Number or range to calculate for the product.`))],compute:function(...e){let t=0,n=1;for(let r of e)if(Je(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),P(e))return r}else r!==void 0&&r.value!==null&&(n*=Ya(r,this.locale),t+=1);return{value:t===0?0:n,format:Va(e[0])}},isExported:!0},KG={description:A(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},qG={description:A(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[k(`rows (number, default=1)`,A(`The number of rows to be returned.`)),k(`columns (number, default=1)`,A(`The number of columns to be returned.`)),k(`min (number, default=0)`,A(`The minimum number you would like returned.`)),k(`max (number, default=1)`,A(`The maximum number you would like returned.`)),k(`whole_number (boolean, default=FALSE)`,A(`Return a whole number or a decimal value.`),[{value:!1,label:A(`Decimal (default)`)},{value:!0,label:A(`Integer`)}])],compute:function(e={value:1},t={value:1},n={value:0},r={value:1},i={value:!1}){let a=Xa(t,this.locale),o=Xa(e,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=L(i);if(a<1)return new M(A(`The number of columns (%s) must be positive.`,a));if(o<1)return new M(A(`The number of rows (%s) must be positive.`,o));if(s>c)return new M(A(`The maximum (%s) must be greater than or equal to the minimum (%s).`,c,s));if(l&&(!Number.isInteger(s)||!Number.isInteger(c)))return new M(A(`The maximum (%s) and minimum (%s) must be integers when whole_number is TRUE.`,c.toString(),s.toString()));let u=Array(a);for(let e=0;e<a;e++){u[e]=Array(o);for(let t=0;t<o;t++)l?u[e][t]=Math.floor(Math.random()*(c-s+1)+s):u[e][t]=s+Math.random()*(c-s)}return u},isExported:!0},JG={description:A(`Random integer between two values, inclusive.`),args:[k(`low (number)`,A(`The low end of the random range.`)),k(`high (number)`,A(`The high end of the random range.`))],compute:function(e,t){let n=F(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=F(t,this.locale);return Number.isInteger(r)||(r=Math.floor(r)),n>r?new M(A(`The high (%s) must be greater than or equal to the low (%s).`,r,n)):{value:n+Math.ceil((r-n+1)*Math.random())-1,format:e?.format}},isExported:!0},YG={description:A(`Rounds a number according to standard rules.`),args:[k(`value (number)`,A(`The value to round to places number of places.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.round(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.round(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},XG={description:A(`Rounds down a number.`),args:[k(`value (number)`,A(`The value to round to places number of places, always rounding down.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.floor(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.floor(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},ZG={description:A(`Rounds up a number.`),args:[k(`value (number)`,A(`The value to round to places number of places, always rounding up.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.ceil(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.ceil(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},QG={description:A(`Secant of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(F(e,this.locale))},isExported:!0},$G={description:A(`Hyperbolic secant of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(F(e,this.locale))},isExported:!0},eK={description:A(`Returns a sequence of numbers.`),args:[k(`rows (number)`,A(`The number of rows to return`)),k(`columns (number, optional, default=1)`,A(`The number of columns to return`)),k(`start (number, optional, default=1)`,A(`The first number in the sequence`)),k(`step (number, optional, default=1)`,A(`The amount to increment each value in the sequence`))],compute:function(e,t={value:1},n={value:1},r={value:1}){let i=F(n,this.locale),a=F(r,this.locale),o=Xa(e,this.locale),s=Xa(t,this.locale);return s<1?new M(A(`The number of columns (%s) must be positive.`,s)):o<1?new M(A(`The number of rows (%s) must be positive.`,o)):uo(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},tK={description:A(`Sine of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(F(e,this.locale))},isExported:!0},nK={description:A(`Hyperbolic sine of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(F(e,this.locale))},isExported:!0},rK={description:A(`Positive square root of a positive number.`),args:[k(`value (number)`,A(`The number for which to calculate the positive square root.`))],compute:function(e){let t=F(e,this.locale);return t<0?new M(A(`The value (%s) must be positive or null.`,t)):{value:Math.sqrt(t),format:e?.format}},isExported:!0},iK={1:`AVERAGE`,2:`COUNT`,3:`COUNTA`,4:`MAX`,5:`MIN`,6:`PRODUCT`,7:`STDEV`,8:`STDEVP`,9:`SUM`,10:`VAR`,11:`VARP`},aK=Object.entries(iK).map(([e,t])=>({value:parseInt(e),label:A(`%s (include manually-hidden rows)`,t)})),oK=Object.entries(iK).map(([e,t])=>({value:parseInt(e)+100,label:A(`%s (exclude manually-hidden rows)`,t)})),sK={description:A(`Returns a subtotal for a vertical range of cells using a specified aggregation function.`),args:[k(`function_code (number)`,A(`The function to use in subtotal aggregation.`),[...aK,...oK]),k(`ref (any, range<any>, repeating)`,A(`Range or reference for which you want the subtotal.`))],compute:function(e,...t){let n=Xa(e,this.locale),r=!0;if(n>100&&(n-=100,r=!1),n<1||n>11)return new M(A(`The function code (%s) must be between 1 to 11 or 101 to 111.`,n));let i=[];for(let e of t){let t=R(e),n=t[0][0]?.position;if(n===void 0)return new zi(Wa);let a=n.col+t.length-1,o=n.row+t[0].length-1,s=n.sheetId;for(let e=n.row;e<=o;e++)if(!this.getters.isRowFiltered(s,e)&&!(!r&&this.getters.isRowHiddenByUser(s,e)))for(let t=n.col;t<=a;t++){let n=this.getters.getCorrespondingFormulaCell({sheetId:s,col:t,row:e});(!n||!Xt(n,`SUBTOTAL`))&&i.push(this.getFormulaResult({sheetId:s,col:t,row:e}))}}return this[iK[n]].apply(this,[[i]])},isExported:!0},cK={description:A(`Sum of a series of numbers and/or cells.`),args:[k(`value (number, range<number>, repeating)`,A(`Number or range to add together.`))],compute:function(...e){let t=e[0];return{value:$h(e,this.locale),format:Va(t)}},isExported:!0},lK={description:A(`A conditional sum across a range.`),args:[k(`criteria_range (range)`,A(`The range which is tested against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to range.`)),k(`sum_range (range, default=criteria_range)`,A(`The range to be summed, if different from range.`))],compute:function(e,t,n){n===void 0&&(n=e);let r=0;return xo([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},uK={description:A(`Sums a range depending on multiple criteria.`),args:[k(`sum_range (range)`,A(`The range to sum.`)),k(`criteria_range (any, range, repeating)`,A(`Range to check.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},dK={description:A(`Tangent of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(F(e,this.locale))},isExported:!0},fK={description:A(`Hyperbolic tangent of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(F(e,this.locale))},isExported:!0};function pK(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let mK={description:A(`Truncates a number.`),args:[k(`value (number)`,A(`The value to be truncated.`)),k(`places (number, default=0)`,A(`The number of significant digits to the right of the decimal point to retain.`))],compute:function(e,t={value:0}){return{value:pK(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},hK={description:A(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[k(`value (number)`,A(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(F(e,this.locale))},isExported:!0};var gK=l({AVEDEV:()=>EK,AVERAGE:()=>DK,AVERAGEA:()=>jK,AVERAGEIF:()=>MK,AVERAGEIFS:()=>NK,AVERAGE_WEIGHTED:()=>AK,CORREL:()=>tq,COUNT:()=>PK,COUNTA:()=>FK,COVAR:()=>IK,COVARIANCE_P:()=>LK,COVARIANCE_S:()=>RK,FORECAST:()=>zK,GROWTH:()=>BK,INTERCEPT:()=>VK,LARGE:()=>HK,LINEST:()=>UK,LOGEST:()=>WK,MATTHEWS:()=>GK,MAX:()=>KK,MAXA:()=>qK,MAXIFS:()=>JK,MEDIAN:()=>YK,MIN:()=>XK,MINA:()=>ZK,MINIFS:()=>QK,PEARSON:()=>eq,PERCENTILE:()=>nq,PERCENTILE_EXC:()=>rq,PERCENTILE_INC:()=>iq,POLYFIT_COEFFS:()=>aq,POLYFIT_FORECAST:()=>oq,QUARTILE:()=>sq,QUARTILE_EXC:()=>cq,QUARTILE_INC:()=>lq,RANK:()=>uq,RSQ:()=>dq,SLOPE:()=>fq,SMALL:()=>pq,SPEARMAN:()=>mq,STDEV:()=>hq,STDEVA:()=>vq,STDEVP:()=>yq,STDEVPA:()=>bq,STDEV_P:()=>gq,STDEV_S:()=>_q,STEYX:()=>xq,TREND:()=>Sq,VAR:()=>Cq,VARA:()=>Eq,VARP:()=>Dq,VARPA:()=>Oq,VAR_P:()=>wq,VAR_S:()=>Tq});let _K=[{value:!0,label:A(`b is calculated normally`)},{value:!1,label:A(`b is forced to 1`)}],vK=[{value:!1,label:A(`do not return additional regression statistics`)},{value:!0,label:A(`return additional regression statistics`)}],yK=[{value:1,label:A(`order 1 (Linear)`)},{value:2,label:A(`order 2 (Quadratic)`)},{value:3,label:A(`order 3 (Cubic)`)},{value:4,label:A(`order 4 (Quartic)`)},{value:5,label:A(`order 5 (Quintic)`)},{value:6,label:A(`order 6 (Sextic)`)}],bK=[{value:!0,label:A(`Compute intercept`)},{value:!1,label:A(`Force intercept to 0`)}],xK=[{value:0,label:A(`Minimum value`)},{value:1,label:A(`First quartile (25th percentile)`)},{value:2,label:A(`Median value (50th percentile)`)},{value:3,label:A(`Third quartile (75th percentile)`)},{value:4,label:A(`Maximum value`)}];function SK(e,t){let n=[],r=[],i=0,a=0;io([e],e=>{n.push(e),i+=1}),io([t],e=>{r.push(e),a+=1}),fh(i===a,A(`[[FUNCTION_NAME]] has mismatched argument count %s vs %s.`,i,a));let o=[],s=[];for(let e=0;e<i;e++){let t=n[e]?.value,i=r[e]?.value;typeof t==`number`&&typeof i==`number`&&(s.push(t),o.push(i))}return{flatDataX:o,flatDataY:s}}function CK(e,t,n){let{flatDataX:r,flatDataY:i}=SK(e,t),a=i.length;ph(a),n&&ph(a-1);let o=0,s=0;for(let e=0;e<a;e++)o+=i[e],s+=r[e];let c=o/a,l=s/a,u=0;for(let e=0;e<a;e++)u+=(i[e]-c)*(r[e]-l);return u/(a-+!!n)}function wK(e,t,n,r){let i=0,a=n?lo:co,o=a(e,(e,t)=>(i+=1,e+t),0,r);ph(i),t&&ph(i-1);let s=o/i;return a(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function TK(e,t,n,r){let i=F(t,r);fh(n?0<=i&&i<=1:0<i&&i<1,A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`));let a=[],o,s=0;return io(e,e=>{let t=e?.value;typeof t==`number`&&(o=So(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),fh(s!==0,ko),n||fh(1/(s+1)<=i&&i<=s/(s+1),A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),za(a,i,n)}let EK={description:A(`Average magnitude of deviations from mean.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){let t=0,n=co(e,(e,n)=>(t+=1,e+n),0,this.locale);if(t===0)return new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`));let r=n/t;return co(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},DK={description:A(`Numerical average value in a dataset, ignoring text.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){return{value:Eh(e,this.locale),format:Va(e[0])}},isExported:!0},OK=A(`[[FUNCTION_NAME]] has mismatched range sizes.`),kK=A(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),AK={description:A(`Weighted average.`),args:[k(`values (number, range<number>, repeating)`,A(`Value to average.`)),k(`weights (number, range<number>, repeating)`,A(`Weight for each corresponding value.`))],compute:function(...e){let t=0,n=0;for(let r=0;r<e.length-1;r+=2){let i=e[r],a=e[r+1];if(!hh(i,a))return new M(OK);if(Je(i))for(let e=0;e<i.length;e++)for(let r=0;r<i[0].length;r++){let o=i[e][r].value,s=Je(a)?a?.[e][r].value:F(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){if(s<0)return new M(kK);t+=o*s,n+=s;continue}if(c!==l)return new M(A(`[[FUNCTION_NAME]] expects number values.`))}else{let e=F(i,this.locale),r=Je(a)?a?.[0][0].value:F(a,this.locale);if(typeof r==`number`){if(r<0)return new M(kK);t+=e*r,n+=r}}}return n===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:t/n,format:Va(e[0])}}},jK={description:A(`Numerical average value in a dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){let t=0,n=lo(e,(e,n)=>(t+=1,e+n),0,this.locale);return t===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:n/t,format:Va(e[0])}},isExported:!0},MK={description:A(`Average of values depending on criteria.`),args:[k(`criteria_range (number, range<number>)`,A(`The range to check against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to criteria_range.`)),k(`average_range (number, range<number>, default=criteria_range)`,A(`The range to average. If not included, criteria_range is used for the average instead.`))],compute:function(e,t,n){let r=R(n===void 0?e:n),i=0,a=0;return xo([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),i===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):a/i},isExported:!0},NK={description:A(`Average of values depending on multiple criteria.`),args:[k(`average_range (range)`,A(`The range to average.`)),k(`criteria_range (any, range, repeating)`,A(`Range to check.`)),k(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=R(e),r=0,i=0;return xo(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),r===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):i/r},isExported:!0},PK={description:A(`The number of numeric values in dataset.`),args:[k(`value (number, any, range<number>, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return Oh(e,this.locale)},isExported:!0},FK={description:A(`The number of values in a dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return kh(e)},isExported:!0},IK={description:A(`The covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!1)},isExported:!0},LK={description:A(`The covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!1)},isExported:!0},RK={description:A(`The sample covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!0)},isExported:!0},zK={description:A(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[k(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t,n){let{flatDataX:r,flatDataY:i}=SK(t,n);return r.length===0||i.length===0?new Bi(ko):zh([i],[r],fo(R(e),e=>F(e,this.locale)),!0)},isExported:!0},BK={description:A(`Fits points to exponential growth trend.`),args:[k(`known_data_y (range<number>)`,A(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal exponential growth curve.`)),k(`known_data_x (range<number>, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),k(`new_data_x (any, range, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),k(`b (boolean, default=TRUE)`,A(`Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.`),_K)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ao(`known_data_y`)):Lh(zh(Rh(Ja(e,`known_data_y`)),Ja(t,`known_data_x`),Ja(n,`new_data_y`),L(r)))}},VK={description:A(`Compute the intercept of the linear regression.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let[[],[i]]=Nh([n],[r]);return i},isExported:!0},HK={description:A(`Nth largest element from a data set.`),args:[k(`data (any, range)`,A(`Array or range containing the dataset to consider.`)),k(`n (number)`,A(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;io([e],e=>{typeof e?.value==`number`&&(i=So(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.shift(),a--))});let o=r.shift();return o===void 0?new M(ko):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},UK={description:A(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),k(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),_K),k(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),vK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return e.length===0||e[0].length===0?new M(Ao(`data_y`)):Nh(Ja(t,`data_x`),Ja(e,`data_y`),L(n),L(r))},isExported:!0},WK={description:A(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>, optional, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),k(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),_K),k(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),vK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){if(e.length===0||e[0].length===0)return new M(Ao(`data_y`));let i=Nh(Ja(t,`data_x`),Rh(Ja(e,`data_y`)),L(n),L(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},GK={description:A(`Compute the Matthews correlation coefficient of a dataset.`),args:[k(`data_x (range)`,A(`The range representing the array or matrix of observed data.`)),k(`data_y (range)`,A(`The range representing the array or matrix of predicted data.`))],compute:function(e,t){let n=e.flat(),r=t.flat();if(Th(n,r),n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=L(n[e]);t===L(r[e])?t?o++:a++:t?c++:s++}return(o*a-s*c)/Math.sqrt((o+s)*(o+c)*(a+s)*(a+c))},isExported:!1},KK={description:A(`Maximum value in a numeric dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){return Ah(e,this.locale)},isExported:!0},qK={description:A(`Maximum numeric value in a dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){let t=lo(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:Va(e[0])}},isExported:!0},JK={description:A(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the maximum will be determined.`)),k(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=-1/0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n<i?i:n)},this.locale),n===-1/0?0:n},isExported:!0},YK={description:A(`Median value in a numeric dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when calculating the median value.`))],compute:function(...e){let t=[];return ao(e,e=>{t.push(e)},this.locale),{value:TK(t,{value:.5},!0,this.locale),format:Va(t[0])}},isExported:!0},XK={description:A(`Minimum value in a numeric dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){return jh(e,this.locale)},isExported:!0},ZK={description:A(`Minimum numeric value in a dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){let t=lo(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:Va(e[0])}},isExported:!0},QK={description:A(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the minimum will be determined.`)),k(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=1/0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n>i?i:n)},this.locale),n===1/0?0:n},isExported:!0};function $K(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=0,o=0,s=0,c=0,l=0;for(let e=0;e<i;e++){let t=n[e],i=r[e];a+=t,o+=i,s+=t*i,c+=t*t,l+=i*i}return(i*s-a*o)/Math.sqrt((i*c-a*a)*(i*l-o*o))}let eq={description:A(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return $K(e,t)},isExported:!0},tq=eq,nq={description:A(`Value at a given percentile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return iq.compute.bind(this)(e,t)},isExported:!0},rq={description:A(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile, exclusive of 0 and 1, whose value within 'data' will be calculated and returned.`))],compute:function(e,t){return{value:TK([e],t,!1,this.locale),format:Va(e)}},isExported:!0},iq={description:A(`Value at a given percentile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:TK([e],t,!0,this.locale),format:Va(e)}},isExported:!0},aq={description:A(`Compute the coefficients of polynomial regression of the dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),k(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),yK),k(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),bK)],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=SK(e,t);return i.length===0||a.length===0?new Bi(ko):Ph(a,i,F(n,this.locale),L(r))},isExported:!1},oq={description:A(`Predict value by computing a polynomial regression of the dataset.`),args:[k(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),k(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),yK),k(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),bK)],compute:function(e,t,n,r,i={value:!0}){let a=F(r,this.locale),{flatDataX:o,flatDataY:s}=SK(t,n);if(o.length===0||s.length===0)return new Bi(ko);let c=Ph(s,o,a,L(i)).flat();return fo(R(e),e=>Ih(c,F(e,this.locale),a))},isExported:!1},sq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value to return.`),xK)],compute:function(e,t){return lq.compute.bind(this)(e,t)},isExported:!0},cq={description:A(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value, exclusive of 0 and 4, to return.`),[{value:1,label:A(`First quartile (25th percentile)`)},{value:2,label:A(`Median value (50th percentile)`)},{value:3,label:A(`Third quartile (75th percentile)`)}])],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:TK([e],n,!1,this.locale),format:Va(e)}},isExported:!0},lq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value to return.`),xK)],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:TK([e],n,!0,this.locale),format:Va(e)}},isExported:!0},uq={description:A(`Returns the rank of a specified value in a dataset.`),args:[k(`value (number)`,A(`The value whose rank will be determined.`)),k(`data (range)`,A(`The range containing the dataset to consider.`)),k(`is_ascending (boolean, default=FALSE)`,A(`Whether to consider the values in data in descending or ascending order.`),[{value:!1,label:A(`Descending`)},{value:!0,label:A(`Ascending`)}])],compute:function(e,t,n={value:!1}){let r=L(n),i=F(e,this.locale),a=1,o=!1;for(let e of t)for(let t of e){if(typeof t.value!=`number`)continue;let e=F(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new Bi(A(`Value not found in the given data.`))},isExported:!0},dq={description:A(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let n=$K(e,t);if(n instanceof Error)throw n;return n**2},isExported:!0},fq={description:A(`Compute the slope of the linear regression.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let[[i]]=Nh([n],[r]);return i},isExported:!0},pq={description:A(`Nth smallest element in a data set.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`n (number)`,A(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;io([e],e=>{typeof e?.value==`number`&&(i=So(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.pop(),a--))});let o=r.pop();return o===void 0?new M(ko):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},mq={description:A(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(t,e);if(n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=n.map((e,t)=>[e,r[t]]);a.sort((e,t)=>e[0]-t[0]);for(let e=0;e<i;++e)a[e][0]=e;a.sort((e,t)=>e[1]-t[1]);let o=0;for(let e=0;e<i;++e)o+=(a[e][0]-e)**2;return 1-6*o/(i**3-i)},isExported:!1},hq={description:A(`Standard deviation.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Cq.compute.bind(this)(...e))},isExported:!0},gq={description:A(`Standard deviation of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(wq.compute.bind(this)(...e))},isExported:!0},_q={description:A(`Standard deviation.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Tq.compute.bind(this)(...e))},isExported:!0},vq={description:A(`Standard deviation of sample (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Eq.compute.bind(this)(...e))},isExported:!0},yq={description:A(`Standard deviation of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Dq.compute.bind(this)(...e))},isExported:!0},bq={description:A(`Standard deviation of entire population (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Oq.compute.bind(this)(...e))},isExported:!0},xq={description:A(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);return n.length===0||r.length===0?new Bi(ko):Nh([n],[r],!0,!0)[1][2]},isExported:!0},Sq={description:A(`Fits points to linear trend derived via least-squares.`),args:[k(`known_data_y (number, range<number>)`,A(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal linear trend.`)),k(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),k(`new_data_x (number, range<number>, optional, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),k(`b (boolean, optional, default=TRUE)`,A(`Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.`),_K)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ao(`known_data_y`)):zh(Ja(e,`known_data_y`),Ja(t,`known_data_x`),Ja(n,`new_data_y`),L(r))}},Cq={description:A(`Variance.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!1,this.locale)},isExported:!0},wq={description:A(`Variance of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!1,this.locale)},isExported:!0},Tq={description:A(`Variance.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!1,this.locale)},isExported:!0},Eq={description:A(`Variance of sample (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!0,this.locale)},isExported:!0},Dq={description:A(`Variance of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!1,this.locale)},isExported:!0},Oq={description:A(`Variance of entire population (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!0,this.locale)},isExported:!0};var kq=l({DAVERAGE:()=>Mq,DCOUNT:()=>Nq,DCOUNTA:()=>Pq,DGET:()=>Fq,DMAX:()=>Iq,DMIN:()=>Lq,DPRODUCT:()=>Rq,DSTDEV:()=>zq,DSTDEVP:()=>Bq,DSUM:()=>Vq,DVAR:()=>Hq,DVARP:()=>Uq});function Aq(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(I(e[t][0]).toUpperCase(),t);let o=t?.value;if(typeof o!=`number`&&typeof o!=`string`)throw new M(A(`The field must be a number or a string`));let s;if(typeof o==`number`){if(s=Math.trunc(o)-1,s<0||a-1<s)throw new M(A(`The field (%(fieldValue)s) must be one of %(dimRowDB)s or must be a number between 1 and %s inclusive.`,{fieldValue:o.toString(),dimRowDB:a.toString()}))}else{let e=I(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(A(`The field (%s) must be one of %s.`,I(t),[...i.keys()].toString()))}let c=n[0].length;if(c<2)throw new M(A(`The criteria range contains %s row, it must be at least 2 rows.`,c.toString()));let l=new Set,u=e[0].length;for(let t=1;t<c;t++){let a=[],o=!0;for(let r=0;r<n.length;r++){let s=I(n[r][0]).toUpperCase(),c=i.get(s),l=n[r][t];if(l.value!==null)if(c!==void 0)a.push([e[c].slice(1,u)]),a.push(l);else{o=!1;break}}if(o)if(a.length>0)xo(a,(e,t)=>{l.add(t)},r,!0);else{l=new Set(Array(u-1).keys());break}}let d=e[s];return[...l].map(e=>d[e+1])}let jq=[k(`database (range)`,A(`The array or range containing the data to consider, structured in such a way that the first row contains the labels for each column's values.`)),k(`field (number, string)`,A(`Indicates which column in database contains the values to be extracted and operated on.`)),k(`criteria (range)`,A(`An array or range containing zero or more criteria to filter the database values by before operating.`))],Mq={description:A(`Average of a set of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return DK.compute.bind(this)([r])},isExported:!0},Nq={description:A(`Counts values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return PK.compute.bind(this)([r])},isExported:!0},Pq={description:A(`Counts values and text from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return FK.compute.bind(this)([r])},isExported:!0},Fq={description:A(`Single value from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return r.length===1?r[0]:new M(A(`More than one match found in DGET evaluation.`))},isExported:!0},Iq={description:A(`Maximum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return KK.compute.bind(this)([r])},isExported:!0},Lq={description:A(`Minimum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return XK.compute.bind(this)([r])},isExported:!0},Rq={description:A(`Product of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return GG.compute.bind(this)([r])},isExported:!0},zq={description:A(`Standard deviation of population sample from table.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return hq.compute.bind(this)([r])},isExported:!0},Bq={description:A(`Standard deviation of entire population from table.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return yq.compute.bind(this)([r])},isExported:!0},Vq={description:A(`Sum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return cK.compute.bind(this)([r])},isExported:!0},Hq={description:A(`Variance of population sample from table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return Cq.compute.bind(this)([r])},isExported:!0},Uq={description:A(`Variance of a population from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return Dq.compute.bind(this)([r])},isExported:!0},Wq=A(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`),Gq=A(`There must be both positive and negative values in cashflow_amounts.`),Kq=e=>A(`The cost (%s) must be positive or null.`,e),qq=e=>A(`The cost (%s) must be strictly positive.`,e),Jq=e=>A(`The frequency (%s) must be one of %s`,e,[1,2,4].toString()),Yq=e=>A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e),Xq=e=>A(`The depreciation factor (%s) must be strictly positive.`,e),Zq=e=>A(`The discount (%s) must be different from -1.`,e),Qq=e=>A(`The discount (%s) must be strictly positive.`,e),$q=e=>A(`The discount (%s) must be smaller than 1.`,e),eJ=e=>A(`The effective_rate (%s) must be strictly positive.`,e),tJ=e=>A(`The end_period (%s) must be positive or null.`,e),nJ=(e,t)=>A(`The end_period (%(end)s) must be smaller or equal to the life (%(life)s).`,{end:e,life:t}),rJ=e=>A(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e),iJ=(e,t)=>A(`The first_period (%(first)s) must be smaller or equal to the last_period (%(last)s).`,{first:e,last:t}),aJ=e=>A(`The first_period (%s) must be strictly positive.`,e),oJ=e=>A(`The future_value (%s) must be strictly positive.`,e),sJ=e=>A(`The investment (%s) must be strictly positive.`,e),cJ=e=>A(`The issue (%s) must be positive or null.`,e),lJ=(e,t)=>A(`The last_period (%(last)s) must be smaller or equal to the number_of_periods (%(nPeriods)s).`,{last:e,nPeriods:t}),uJ=e=>A(`The last_period (%s) must be strictly positive.`,e),dJ=e=>A(`The life (%s) must be strictly positive.`,e),fJ=(e,t)=>A(`The maturity (%(maturity)s) must be strictly greater than the settlement (%(settlement)s).`,{maturity:t,settlement:e}),pJ=e=>A(`The month (%s) must be between 1 and 12 inclusive.`,e),mJ=e=>A(`The nominal_rate (%s) must be strictly positive.`,e),hJ=e=>A(`The number_of_periods (%s) must be different from zero.`,e),gJ=e=>A(`The number_of_periods (%s) must be strictly positive.`,e),_J=e=>A(`The period must be between 1 and number_of_periods (%s)`,e),vJ=(e,t)=>A(`The period (%(period)s) must be less than or equal to %(lifeLimit)s.`,{period:e,lifeLimit:t}),yJ=e=>A(`The period (%s) must be positive or null.`,e),bJ=e=>A(`The periods_by_year (%s) must be strictly positive.`,e),xJ=(e,t)=>A(`The period (%(period)s) must be less than or equal life (%(life)s).`,{period:e,life:t}),SJ=e=>A(`The period (%s) must be strictly positive.`,e),CJ=e=>A(`The present_value (%s) must be strictly positive.`,e),wJ=e=>A(`The price (%s) must be strictly positive.`,e),TJ=(e,t)=>A(`The purchase_date (%(purchaseDate)s) must be before the first_period_end (%(firstPeriodEnd)s).`,{purchaseDate:e,firstPeriodEnd:t}),EJ=e=>A(`The purchase_date (%s) must be positive or null.`,e),DJ=e=>A(`The rate_guess (%s) must be strictly greater than -1.`,e),OJ=e=>A(`The rate (%s) must be positive or null.`,e),kJ=e=>A(`The rate (%s) must be strictly positive.`,e),AJ=e=>A(`The redemption (%s) must be strictly positive.`,e),jJ=e=>A(`The salvage (%s) must be positive or null.`,e),MJ=(e,t)=>A(`The salvage (%(salvage)s) must be smaller or equal than the cost (%(cost)s).`,{salvage:e,cost:t}),NJ=(e,t)=>A(`The settlement date (%(settlement)s) must be greater or equal to the issue date (%(issue)s).`,{settlement:e,issue:t}),PJ=(e,t)=>A(`The settlement date (%(settlement)s) must at most one year after the maturity date (%(maturity)s).`,{settlement:e,maturity:t}),FJ=(e,t)=>A(`The settlement date (%(settlement)s) must be strictly greater than the issue date (%(issue)s).`,{settlement:e,issue:t}),IJ=e=>A(`The start_period (%s) must be positive or null.`,e),LJ=(e,t)=>A(`The start_period (%(start)s) must be smaller or equal to the end_period (%(end)s).`,{start:e,end:t}),RJ=e=>A(`The unit (%s) must be strictly positive.`,e),zJ=e=>A(`The yield (%s) must be positive or null.`,e);function BJ(e){return e.some(e=>e>0)&&e.some(e=>e<0)}function VJ(e){return![0,1,2,3,4].includes(e)}function HJ(e){return![1,2,4].includes(e)}function UJ(e,t,n){let r=to(e,n),i=to(t,n),a=to(e,n);return a.setFullYear(r.getFullYear()+1),i.getTime()<=a.getTime()}let WJ=[{value:0,label:A(`US (NASD) 30/360`)},{value:1,label:A(`Actual/Actual`)},{value:2,label:A(`Actual/360`)},{value:3,label:A(`Actual/365`)},{value:4,label:A(`European 30/360`)}];var GJ=l({DATE:()=>qJ,DATEDIF:()=>JJ,DATEVALUE:()=>YJ,DAY:()=>XJ,DAYS:()=>ZJ,DAYS360:()=>QJ,EDATE:()=>$J,EOMONTH:()=>eY,HOUR:()=>tY,ISOWEEKNUM:()=>nY,MINUTE:()=>rY,MONTH:()=>iY,MONTH_END:()=>xY,MONTH_START:()=>bY,NETWORKDAYS:()=>aY,NETWORKDAYS_INTL:()=>cY,NOW:()=>lY,QUARTER:()=>SY,QUARTER_END:()=>wY,QUARTER_START:()=>CY,SECOND:()=>uY,TIME:()=>dY,TIMEVALUE:()=>fY,TODAY:()=>pY,WEEKDAY:()=>mY,WEEKNUM:()=>hY,WORKDAY:()=>gY,WORKDAY_INTL:()=>_Y,YEAR:()=>vY,YEARFRAC:()=>yY,YEAR_END:()=>EY,YEAR_START:()=>TY}),KJ=function(e){return e.WHOLE_YEARS=`Y`,e.WHOLE_MONTHS=`M`,e.WHOLE_DAYS=`D`,e.DAYS_WITHOUT_WHOLE_MONTHS=`MD`,e.MONTH_WITHOUT_WHOLE_YEARS=`YM`,e.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR=`YD`,e}(KJ||{});let qJ={description:A(`Converts year/month/day into a date.`),args:[k(`year (number)`,A(`The year component of the date.`)),k(`month (number)`,A(`The month component of the date.`)),k(`day (number)`,A(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));if(r<0||r>9999)return new M(A(`The year (%s) must be between 0 and 9999 inclusive.`,r.toString()));r<1900&&(r+=1900);let o=_a(new N(r,i-1,a));return o<0?new M(A(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`)):{value:o,format:this.locale.dateFormat}},isExported:!0},JJ={description:A(`Calculates the number of days, months, or years between two dates.`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),k(`end_date (date)`,A(`The end date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),k(`unit (string)`,A(`A text abbreviation for unit of time.`),[{value:`Y`,label:A(`The number of whole years between start_date and end_date`)},{value:`M`,label:A(`The number of whole months between start_date and end_date`)},{value:`D`,label:A(`The number of days between start_date and end_date`)},{value:`MD`,label:A(`The number of days between start_date and end_date after subtracting whole months`)},{value:`YM`,label:A(`The number of whole months between start_date and end_date after subtracting whole years`)},{value:`YD`,label:A(`The number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart`)}])],compute:function(e,t,n){let r=I(n).toUpperCase();if(!Object.values(KJ).includes(r))return new M(Ka(Object.values(KJ),I(n)));let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=ga(i),s=ga(a);if(a<i)return new M(A(`start_date (%s) should be on or before end_date (%s).`,o.toLocaleDateString(),s.toLocaleDateString()));switch(r){case KJ.WHOLE_YEARS:return Ea(o,s);case KJ.WHOLE_MONTHS:return wa(o,s);case KJ.WHOLE_DAYS:return Ta(o,s);case KJ.MONTH_WITHOUT_WHOLE_YEARS:return wa(o,s)-Ea(o,s)*12;case KJ.DAYS_WITHOUT_WHOLE_MONTHS:let e=s.getDate()-o.getDate();return e<0&&(e=ya(new N(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case KJ.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR:{if(Da(i,a))return Ta(o,s);let e=new N(o.getFullYear(),s.getMonth(),s.getDate()),t=Ta(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=Ta(o,e)),t}}},isExported:!0},YJ={description:A(`Converts a date string to a date value.`),args:[k(`date_string (string)`,A(`The string representing the date.`))],compute:function(e){let t=I(e),n=oa(t,this.locale);return n===null?new M(A(`The date_string (%s) cannot be parsed to date/time.`,t.toString())):Math.trunc(n.value)},isExported:!0},XJ={description:A(`Day of the month that a specific date falls on.`),args:[k(`date (string)`,A(`The date from which to extract the day.`))],compute:function(e){return to(e,this.locale).getDate()},isExported:!0},ZJ={description:A(`Number of days between two dates.`),args:[k(`end_date (date)`,A(`The end of the date range.`)),k(`start_date (date)`,A(`The start of the date range.`))],compute:function(e,t){let n=to(e,this.locale),r=to(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Ki)},isExported:!0},QJ={description:A(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation.`)),k(`end_date (date)`,A(`The end date to consider in the calculation.`)),k(`method (boolean, default=false)`,A(`An indicator of what day count method to use.`),[{value:!1,label:A(`U.S. NASD method (default)`)},{value:!0,label:A(`European method`)}])],compute:function(e,t,n={value:!1}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Ca(r,i,L(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},$J={description:A(`Date a number of months before/after another date.`),args:[k(`start_date (date)`,A(`The date from which to calculate the result.`)),k(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:_a(xa(to(e,this.locale),Math.trunc(F(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},eY={description:A(`Last day of a month before or after a date.`),args:[k(`start_date (date)`,A(`The date from which to calculate the result.`)),k(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=to(e,this.locale),r=Math.trunc(F(t,this.locale));return{value:_a(new N(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},tY={description:A(`Hour component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the hour component.`))],compute:function(e){return to(e,this.locale).getHours()},isExported:!0},nY={description:A(`ISO week number of the year.`),args:[k(`date (date)`,A(`The date for which to determine the ISO week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`))],compute:function(e){let t=to(e,this.locale),n=t.getFullYear(),r=1;for(;new N(n,0,r).getDay()!==4;)r+=1;let i=new N(n,0,r-3),a=31;for(;new N(n,11,a).getDay()!==4;)--a;let o=new N(n,11,a+3),s;s=i.getTime()<=t.getTime()?t.getTime()<=o.getTime()?0:1:-1;let c;switch(s){case 0:c=i;break;case 1:c=new N(n,11,a+3+1);break;case-1:let e=1;for(;new N(n-1,0,e).getDay()!==4;)e+=1;c=new N(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Ki;return Math.floor(l/7)+1},isExported:!0},rY={description:A(`Minute component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the minute component.`))],compute:function(e){return to(e,this.locale).getMinutes()},isExported:!0},iY={description:A(`Month of the year a specific date falls in`),args:[k(`date (date)`,A(`The date from which to extract the month.`))],compute:function(e){return to(e,this.locale).getMonth()+1},isExported:!0},aY={description:A(`Net working days between two provided days.`),args:[k(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),k(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the date serial numbers to consider holidays.`))],compute:function(e,t,n){return cY.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function oY(e){let t=e?.value;if(typeof t==`string`){fh(t.length===7&&[...t].every(e=>e===`0`||e===`1`),A(`When weekend is a string (%s) it must be composed of "0" or "1".`,t));let e=[];for(let n=0;n<7;n++)t[n]===`1`&&e.push((n+1)%7);return e}if(typeof t==`number`)return fh(1<=t&&t<=7||11<=t&&t<=17,A(`The weekend (%s) must be a string or a number in the range 1-7 or 11-17.`,t.toString())),t<=7?[t-2==-1?6:t-2,t-1]:[t-11];throw new M(A(`The weekend must be a number or a string.`))}let sY=[{value:1,label:A(`Saturday/Sunday are weekends`)},{value:2,label:A(`Sunday/Monday are weekends`)},{value:3,label:A(`Monday/Tuesday are weekends`)},{value:4,label:A(`Tuesday/Wednesday are weekends`)},{value:5,label:A(`Wednesday/Thursday are weekends`)},{value:6,label:A(`Thursday/Friday are weekends`)},{value:7,label:A(`Friday/Saturday are weekends`)},{value:11,label:A(`Sunday is the only weekend`)},{value:12,label:A(`Monday is the only weekend`)},{value:13,label:A(`Tuesday is the only weekend`)},{value:14,label:A(`Wednesday is the only weekend`)},{value:15,label:A(`Thursday is the only weekend`)},{value:16,label:A(`Friday is the only weekend`)},{value:17,label:A(`Saturday is the only weekend`)}],cY={description:A(`Net working days between two dates (specifying weekends).`),args:[k(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),k(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),k(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),sY),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider as holidays.`))],compute:function(e,t,n={value:1},r){let i=to(e,this.locale),a=to(t,this.locale),o=oY(n),s=new Set;r!==void 0&&io([r],e=>{let t=to(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=N.fromTimestamp((c?i:a).getTime()),u=N.fromTimestamp((c?a:i).getTime()),d=l.getTime(),f=u.getTime(),p=0;for(;f<=d;)!o.includes(u.getDay())&&!s.has(f)&&(p+=1),u.setDate(u.getDate()+1),f=u.getTime();return c?-p:p},isExported:!0},lY={description:A(`Current date and time as a date value.`),args:[],compute:function(){let e=N.now(),t=e.getTime()-Gi.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Ki)+n,format:ub(this.locale)}},isExported:!0},uY={description:A(`Minute component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the second component.`))],compute:function(e){return to(e,this.locale).getSeconds()},isExported:!0},dY={description:A(`Converts hour/minute/second into a time.`),args:[k(`hour (number)`,A(`The hour component of the time.`)),k(`minute (number)`,A(`The minute component of the time.`)),k(`second (number)`,A(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return i+=Math.floor(a/60),a=a%60+(a<0?60:0),r+=Math.floor(i/60),i=i%60+(i<0?60:0),r%=24,r<0?new M(A(`The function [[FUNCTION_NAME]] result cannot be negative`)):{value:r/24+i/1440+a/(1440*60),format:this.locale.timeFormat}},isExported:!0},fY={description:A(`Converts a time string into its serial number representation.`),args:[k(`time_string (string)`,A(`The string that holds the time representation.`))],compute:function(e){let t=I(e),n=oa(t,this.locale);if(n===null)return new M(A(`The time_string (%s) cannot be parsed to date/time.`,t));let r=n.value-Math.trunc(n.value);return r<0?1+r:r},isExported:!0},pY={description:A(`Current date as a date value.`),args:[],compute:function(){let e=N.now();return{value:_a(new N(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},mY={description:A(`Day of the week of the date provided (as number).`),args:[k(`date (date)`,A(`The date for which to determine the day of the week. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`type (number, default=1)`,A(`A number indicating which numbering system to use to represent weekdays. By default, counts starting with Sunday = 1.`),[{value:1,label:A(`Numbers 1 (Sunday) trough 7 (Saturday)`)},{value:2,label:A(`Numbers 1 (Monday) trough 7 (Sunday)`)},{value:3,label:A(`Numbers 0 (Monday) trough 6 (Sunday)`)},{value:11,label:A(`Numbers 1 (Monday) trough 7 (Sunday)`)},{value:12,label:A(`Numbers 1 (Tuesday) trough 7 (Monday)`)},{value:13,label:A(`Numbers 1 (Wednesday) trough 7 (Tuesday)`)},{value:14,label:A(`Numbers 1 (Thursday) trough 7 (Wednesday)`)},{value:15,label:A(`Numbers 1 (Friday) trough 7 (Thursday)`)},{value:16,label:A(`Numbers 1 (Saturday) trough 7 (Friday)`)},{value:17,label:A(`Numbers 1 (Sunday) trough 7 (Saturday)`)}])],compute:function(e,t={value:1}){let n=to(e,this.locale),r=Math.round(F(t,this.locale)),i=n.getDay();if(!(1<=r&&r<=3)&&!(11<=r&&r<=17))return new M(A(`The type (%s) must be between 1 and 3 or between 11 and 17.`,r));switch(r){case 1:return i+1;case 2:return i===0?7:i;case 3:return i===0?6:i-1}let a=r-10,o=(i+1-a+7)%7;return o===0?7:o},isExported:!0},hY={description:A(`Week number of the year.`),args:[k(`date (date)`,A(`The date for which to determine the week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`type (number, default=1)`,A(`A number representing the day that a week starts on. Sunday = 1.`),[{value:1,label:A(`Sunday`)},{value:2,label:A(`Monday`)},{value:11,label:A(`Monday`)},{value:12,label:A(`Tuesday`)},{value:13,label:A(`Wednesday`)},{value:14,label:A(`Thursday`)},{value:15,label:A(`Friday`)},{value:16,label:A(`Saturday`)},{value:17,label:A(`Sunday`)},{value:21,label:A(`ISO week number (Monday as first day of the week)`)}])],compute:function(e,t={value:1}){let n=to(e,this.locale),r=Math.round(F(t,this.locale));if(![1,2,11,12,13,14,15,16,17,21].includes(r))return new M(A(`The type (%s) is out of range.`,r.toString()));if(r===21)return nY.compute.bind(this)(e);let i;i=r===1||r===2?r-1:r-10==7?0:r-10;let a=n.getFullYear(),o=1,s=new N(a,0,o);for(;s.getDay()!==i;)o+=1,s=new N(a,0,o);let c=(n.getTime()-s.getTime())/Ki;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},gY={description:A(`Date after a number of workdays.`),args:[k(`start_date (date)`,A(`The date from which to begin counting.`)),k(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:null}){return _Y.compute.bind(this)(e,t,{value:1},n)},isExported:!0},_Y={description:A(`Date after a number of workdays (specifying weekends).`),args:[k(`start_date (date)`,A(`The date from which to begin counting.`)),k(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),k(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),sY),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:1},r){let i=to(e,this.locale),a=Math.trunc(F(t,this.locale));if(n.value===`1111111`)return new M(A(`The weekend must be different from '1111111'.`));let o=oY(n),s=new Set;r!==void 0&&io([r],e=>{let t=to(e,this.locale);s.add(t.getTime())});let c=N.fromTimestamp(i.getTime()),l=c.getTime(),u=Math.sign(a),d=Math.abs(a);for(;d>0;)c.setDate(c.getDate()+u),l=c.getTime(),!o.includes(c.getDay())&&!s.has(l)&&--d;let f=l-Gi.getTime();return{value:Math.round(f/Ki),format:this.locale.dateFormat}},isExported:!0},vY={description:A(`Year specified by a given date.`),args:[k(`date (date)`,A(`The date from which to extract the year.`))],compute:function(e){return to(e,this.locale).getFullYear()},isExported:!0},yY={description:A(`Exact number of years between two dates.`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`end_date (date)`,A(`The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`day_count_convention (number, default=0)`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return r<0?new M(A(`The start_date (%s) must be positive or null.`,r)):i<0?new M(A(`The end_date (%s) must be positive or null.`,i)):0>a||a>4?new M(A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,a)):Ca(r,i,a)}},bY={description:A(`First day of the month preceding a date.`),args:[k(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){let t=to(e,this.locale);return{value:_a(new N(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},xY={description:A(`Last day of the month following a date.`),args:[k(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){return eY.compute.bind(this)(e,{value:0})}},SY={description:A(`Quarter of the year a specific date falls in`),args:[k(`date (date)`,A(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((to(e,this.locale).getMonth()+1)/3)}},CY={description:A(`First day of the quarter of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=SY.compute.bind(this)(e);return{value:_a(new N(vY.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},wY={description:A(`Last day of the quarter of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=SY.compute.bind(this)(e);return{value:_a(new N(vY.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},TY={description:A(`First day of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:_a(new N(vY.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},EY={description:A(`Last day of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:_a(new N(vY.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var DY=l({DELTA:()=>OY});let OY={description:A(`Compare two numeric values, returning 1 if they're equal.`),args:[k(`number1 (number)`,A(`The first number to compare.`)),k(`number2 (number, default=0)`,A(`The second number to compare.`))],compute:function(e,t={value:0}){return+(F(e,this.locale)===F(t,this.locale))},isExported:!0};var kY=l({FILTER:()=>jY,SORT:()=>MY,SORTN:()=>NY,UNIQUE:()=>PY});function AY(e,t,...n){for(let e=0;e<n.length;e++){let t=e%2==0?`sort_column`:`is_ascending`;fh(n[e]!==void 0,A(`Value for parameter %s is missing in [[FUNCTION_NAME]].`,t))}let r=[],i=[],a=e.length;for(let o=0;o<n.length;o+=2){r.push(L(Sh(n[o+1])?.value)?`asc`:`desc`);let s=n[o];if(Je(s)&&(s.length>1||s[0].length>1))fh(s.length===1&&s[0].length===a,A(`Wrong size for %s. Expected a range of size 1x%s. Got %sx%s.`,`sort_column${o+1}`,a,s.length,s[0].length)),i.push(s.flat().map(e=>e.value));else{let n=F(Sh(s)?.value,t);if(n<1||n>e[0].length)return e;i.push(e.map(e=>e[n-1].value))}}if(i.length===0)for(let t=0;t<e[0].length;t++)i.push(e.map(e=>e[t].value)),r.push(`asc`);let o={desc:Ez(`desc`),asc:Ez(`asc`)},s=C(0,e.length);return s.sort((e,t)=>{for(let[n,a]of i.entries()){let i=a[e],s=a[t],c={value:i,type:i===null?V.empty:typeof i==`string`?V.text:typeof i},l={value:s,type:s===null?V.empty:typeof s==`string`?V.text:typeof s},u=o[r[n]](c,l);if(u!==0)return u}return 0}),s.map(t=>e[t])}let jY={description:A(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[k(`range (any, range<any>)`,A(`The data to be filtered.`)),k(`condition (boolean, range<boolean>, repeating)`,A(`Column or row containing true or false values corresponding to the range.`))],compute:function(e,...t){let n=R(e),r=t.map(e=>fo(R(e),e=>e.value));for(let e of r)if(!mh(e))return new M(A(`The arguments condition must be a single column or row.`));if(!hh(...t))return new M(A(`The arguments conditions must have the same dimensions.`));let i=r.map(e=>e.flat()),a=r[0].length===1?`row`:`col`;if(n=a===`row`?mo(n):n,i.some(e=>e.length!==n.length))return new M(A(`FILTER has mismatched sizes on the range and conditions.`));let o=[];for(let e=0;e<n.length;e++){let t=n[e];i.every(t=>(typeof t[e]==`boolean`||typeof t[e]==`number`)&&t[e])&&o.push(t)}return o.length?a===`row`?mo(o):o:new Bi(A(`No match found in FILTER evaluation`))},isExported:!1},MY={description:A(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[k(`range (range)`,A(`The data to be sorted.`)),k(`sort_column (any, range<number>, repeating, optional)`,A(`The index of the column in range or a range outside of range containing the value by which to sort.`)),k(`is_ascending (boolean, repeating, optional)`,A(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`),[{value:!0,label:A(`Ascending`)},{value:!1,label:A(`Descending`)}])],compute:function(e,...t){return mo(AY(mo(e),this.locale,...t))},isExported:!0},NY={description:A(`Returns the first n items in a data set after performing a sort.`),args:[k(`range (range)`,A(`The data to be sorted.`)),k(`n (number)`,A(`The number of items to return.`)),k(`display_ties_mode (number, default=0)`,A(`A number representing the way to display ties.`)),k(`sort_column (number, range<number>, repeating, optional)`,A(`The index of the column in range or a range outside of range containing the value by which to sort.`)),k(`is_ascending (boolean, repeating, optional)`,A(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`),[{value:!0,label:A(`Ascending`)},{value:!1,label:A(`Descending`)}])],compute:function(e,t,...n){let r=F(t?.value??1,this.locale),i=n.length%2==0?0:F(n[0]?.value,this.locale),a=n.length%2==0?n:n.slice(1);if(r<0)return new M(A(`Wrong value of 'n'. Expected a positive number. Got %s.`,r));if(i<0||i>3)return new M(A(`Wrong value of 'display_ties_mode'. Expected a positive number between 0 and 3. Got %s.`,i));let o=AY(mo(e),this.locale,...a),s=(e,t)=>JSON.stringify(o[e].map(e=>e.value))===JSON.stringify(o[t].map(e=>e.value));switch(i){case 0:return mo(o.slice(0,r));case 1:for(let e=r;e<o.length;e++)if(!s(e,r-1))return mo(o.slice(0,e));return mo(o);case 2:{let e=[o[0]];for(let t=1;t<o.length;t++)for(let n=0;n<t&&!s(t,n);n++)n===t-1&&e.push(o[t]);return mo(e.slice(0,r))}case 3:{let e=[o[0]],t=1;for(let n=1;n<o.length&&(s(n,n-1)||t++,!(t>r));n++)e.push(o[n]);return mo(e)}}},isExported:!1},PY={description:A(`Unique rows in the provided source range.`),args:[k(`range (any, range<any>)`,A(`The data to filter by unique entries.`)),k(`by_column (boolean, default=FALSE)`,A(`Whether to filter the data by columns or by rows.`),[{value:!0,label:A(`Return unique columns`)},{value:!1,label:A(`Return unique rows`)}]),k(`exactly_once (boolean, default=FALSE)`,A(`Whether to return only entries with no duplicates.`),[{value:!0,label:A(`Return items that appear exactly once`)},{value:!1,label:A(`Return every distinct item`)}])],compute:function(e={value:``},t,n){if(!Je(e))return[[e]];let r=L(t?.value)||!1,i=L(n?.value)||!1;r||(e=mo(e));let a=new Map;for(let t of e){let e=JSON.stringify(t.map(e=>e.value)),n=a.get(e);n?n.count++:a.set(e,{data:t,count:1})}let o=[];for(let e of a.values())i&&e.count>1||o.push(e.data);return o.length?r?o:mo(o):new M(A(`No unique values found`))},isExported:!0};var FY=l({ACCRINTM:()=>BY,AMORLINC:()=>VY,COUPDAYBS:()=>UY,COUPDAYS:()=>HY,COUPDAYSNC:()=>WY,COUPNCD:()=>GY,COUPNUM:()=>KY,COUPPCD:()=>qY,CUMIPMT:()=>JY,CUMPRINC:()=>YY,DB:()=>XY,DDB:()=>QY,DISC:()=>$Y,DOLLARDE:()=>eX,DOLLARFR:()=>tX,DURATION:()=>nX,EFFECT:()=>rX,FV:()=>aX,FVSCHEDULE:()=>oX,INTRATE:()=>sX,IPMT:()=>lX,IRR:()=>dX,ISPMT:()=>fX,MDURATION:()=>pX,MIRR:()=>mX,NOMINAL:()=>hX,NPER:()=>gX,NPV:()=>vX,PDURATION:()=>yX,PMT:()=>xX,PPMT:()=>CX,PRICE:()=>TX,PRICEDISC:()=>EX,PRICEMAT:()=>DX,PV:()=>wX,RATE:()=>kX,RECEIVED:()=>AX,RRI:()=>jX,SLN:()=>MX,SYD:()=>NX,TBILLEQ:()=>IX,TBILLPRICE:()=>FX,TBILLYIELD:()=>LX,VDB:()=>RX,XIRR:()=>zX,XNPV:()=>BX,YIELD:()=>VX,YIELDDISC:()=>HX,YIELDMAT:()=>UX});let IY=[{value:1,label:A(`Annual`)},{value:2,label:A(`Semi-annual`)},{value:4,label:A(`Quarterly`)}],LY=[{value:0,label:A(`End of period (default)`)},{value:1,label:A(`Beginning of period`)}],RY=[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)];function zY(e,t,n,r,i=1e-10,a){let o=n,s,c,l,u=!1,d=0,f;do{if(l=e(o),isNaN(l)){fh(d<r&&a!==void 0,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++,o=a(f),f=o;continue}s=o-l/t(o),c=Math.abs(s-o),o=s,u=c<i||Math.abs(l)<i,fh(d<r,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let BY={description:A(`Accrued interest of security paying at maturity.`),args:[k(`issue (date)`,A(`The date the security was initially issued.`)),k(`maturity (date)`,A(`The maturity date of the security.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));if(a<0)return new M(cJ(a));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(AJ(s));if(c<=0)return new M(kJ(c));let u=Ca(a,o,l);return s*c*u},isExported:!0},VY={description:A(`Depreciation for an accounting period.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`purchase_date (date)`,A(`The date the asset was purchased.`)),k(`first_period_end (date)`,A(`The date the first period ended.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`rate (number)`,A(`The deprecation rate.`)),k(`day_count_convention (number, optional)`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=F(e,this.locale),c=Math.trunc(F(t,this.locale)),l=Math.trunc(F(n,this.locale)),u=F(r,this.locale),d=F(i,this.locale),f=F(a,this.locale),p=Math.trunc(F(o,this.locale));if(s<=0)return new M(qq(s));if(c<0)return new M(EJ(c));if(u<0)return new M(jJ(u));if(u>s)return new M(MJ(u,s));if(d<0)return new M(yJ(d));if(f<=0)return new M(kJ(f));if(VJ(p))return new M(Yq(p));if(c>l)return new M(TJ(c,l));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=Ca(c,l,p),_=c===l?h:h*g,v=s-_-h*m;return v>=u?m===0?_:h:u-v<h?h-(u-v):0},isExported:!0},HY={description:A(`Days in coupon period containing settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));if(s===1){let i=qY.compute.bind(this)(e,t,n,r).value,a=GY.compute.bind(this)(e,t,n,r).value;return F(a,this.locale)-F(i,this.locale)}return(s===3?365:360)/o},isExported:!0},UY={description:A(`Days from settlement until next coupon.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=qY.compute.bind(this)(e,t,n,r).value,l=F(c,this.locale);if([1,2,3].includes(s))return i-l;if(s===4){let e=Ca(l,i,s);return Math.round(e*360)}let u=to(i,this.locale),d=to(l,this.locale),f=d.getFullYear(),p=u.getFullYear(),m=d.getMonth()+1,h=u.getMonth()+1,g=d.getDate(),_=u.getDate();return m===2&&h===2&&ba(d)&&ba(u)&&(_=30),_===31&&(g===30||g===31)&&(_=30),m===2&&ba(d)&&(g=30),g===31&&(g=30),(p-f)*360+(h-m)*30+(_-g)},isExported:!0},WY={description:A(`Days from settlement until next coupon.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=GY.compute.bind(this)(e,t,n,r).value,l=F(c,this.locale);if([1,2,3].includes(s))return l-i;if(s===4){let e=Ca(i,l,s);return Math.round(e*360)}let u=UY.compute.bind(this)(e,t,n,r);return F(HY.compute.bind(this)(e,t,n,r),this.locale)-F(u,this.locale)},isExported:!0},GY={description:A(`Next coupon date after the settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=12/o,l=KY.compute.bind(this)(e,t,n,r);return{value:_a(xa(to(a,this.locale),-(F(l,this.locale)-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},KY={description:A(`Number of coupons between settlement and maturity.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=1,l=a,u=12/o;for(;l>i;)l=_a(xa(to(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},qY={description:A(`Last coupon date prior to or on the settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=12/o,l=KY.compute.bind(this)(e,t,n,r);return{value:_a(xa(to(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},JY={description:A(`Cumulative interest paid over a set of periods.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),k(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);if(u<=0)return new M(gJ(u));if(o<=0)return new M(aJ(o));if(s<=0)return new M(uJ(s));if(o>s)return new M(iJ(o,s));if(s>u)return new M(lJ(s,u));if(c<=0)return new M(kJ(c));if(l<=0)return new M(CJ(l));let f=0;for(let e=o;e<=s;e++)f+=cX(c,e,u,l,0,d);return f},isExported:!0},YY={description:A(`Cumulative principal paid over a set of periods.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),k(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);if(u<=0)return new M(gJ(u));if(o<=0)return new M(aJ(o));if(s<=0)return new M(uJ(s));if(o>s)return new M(iJ(o,s));if(s>u)return new M(lJ(s,u));if(c<=0)return new M(kJ(c));if(l<=0)return new M(CJ(l));let f=0;for(let e=o;e<=s;e++)f+=SX(c,e,u,l,0,d);return f},isExported:!0},XY={description:A(`Depreciation via declining balance method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`month (number, optional)`,A(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=Math.trunc(F(r,this.locale)),l=i.length?Math.trunc(F(i[0],this.locale)):12,u=s+(l===12?0:1);if(a<0)return new M(Kq(a));if(o<0)return new M(jJ(o));if(c<=0)return new M(SJ(c));if(s<=0)return new M(dJ(s));if(1>l||l>12)return new M(pJ(l));if(c>u)return new M(vJ(c,u));let d=l/12,f=1-(o/a)**(1/s);f=Math.round(f*1e3)/1e3;let p=a,m=a*(1-f*d);for(let e=1;e<c;e++)p=m,m=p*(1-f),e===s&&(m=p*(1-f*(1-d)));return{value:p-m,format:`#,##0.00`}},isExported:!0},ZY=`#,##0.00`,QY={description:A(`Depreciation via double-declining balance method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`factor (number, default=2)`,A(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(a<0)return new M(Kq(a));if(o<0)return new M(jJ(o));if(c<=0)return new M(SJ(c));if(s<=0)return new M(dJ(s));if(c>s)return new M(xJ(c,s));if(l<=0)return new M(Xq(l));if(a===0||o>=a)return{value:0,format:ZY};let u=l/s;if(u>1)return{value:c===1?a-o:0,format:ZY};if(c<=1)return{value:a*u,format:ZY};let d=a*(1-u)**(c-1),f=a*(1-u)**c,p=f<o?d-o:d-f;return{value:Math.max(p,0),format:ZY}},isExported:!0},$Y={description:A(`Discount rate of a security based on price.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(wJ(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return(c-s)/c/u},isExported:!0},eX={description:A(`Convert a decimal fraction to decimal value.`),args:[k(`fractional_price (number)`,A(`The price quotation given using fractional decimal conventions.`)),k(`unit (number)`,A(`The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));if(r<=0)return new M(RJ(r));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},tX={description:A(`Convert a decimal value to decimal fraction.`),args:[k(`decimal_price (number)`,A(`The price quotation given as a decimal value.`)),k(`unit (number)`,A(`The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));if(r<=0)return new M(RJ(r));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},nX={description:A(`Number of periods for an investment to reach a value.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=F(n,this.locale),l=F(r,this.locale),u=Math.trunc(F(i,this.locale)),d=Math.trunc(F(a,this.locale));if(o>=s)return new M(fJ(o,s));if(HJ(u))return new M(Jq(u));if(VJ(d))return new M(Yq(d));if(c<0)return new M(OJ(c));if(l<0)return new M(zJ(l));let f=Ca(o,s,d),p=f-Math.trunc(f)||1/u,m=Math.ceil(f*u),h=c/u,g=l/u,_=0,v=0;for(let e=1;e<=m;e++){let t=(h+ +(e===m))/(1+g)**e;v+=(p+(e-1)/u)*t,_+=t}return _===0?0:v/_},isExported:!0},rX={description:A(`Annual effective interest rate.`),args:[k(`nominal_rate (number)`,A(`The nominal interest rate per year.`)),k(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return n<=0?new M(mJ(n)):r<=0?new M(bJ(r)):(1+n/r)**+r-1},isExported:!0};function iX(e,t,n,r,i){return e===0?-(r+n*t):-r*(1+e)**t-n*(1+e*i)*((1+e)**t-1)/e}let aX={description:A(`Future value of an annuity investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_amount (number)`,A(`The amount per period to be paid.`)),k(`present_value (number, default=0)`,A(`The current value of the annuity.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:iX(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),+!!L(i)),format:`#,##0.00`}},isExported:!0},oX={description:A(`Future value of principal from series of rates.`),args:[k(`principal (number)`,A(`The amount of initial capital or value to compound against.`)),k(`rate_schedule (number, range<number>)`,A(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=F(e,this.locale);return so([t],(e,t)=>e*(1+F(t,this.locale)),n)},isExported:!0},sX={description:A(`Calculates effective interest rate.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`investment (number)`,A(`The amount invested in the security.`)),k(`redemption (number)`,A(`The amount to be received at maturity.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(c<=0)return new M(sJ(c));if(s<=0)return new M(AJ(s));if(VJ(l))return new M(Yq(l));let u=Ca(a,o,l);return(s-c)/c/u},isExported:!0};function cX(e,t,n,r,i,a){return bX(e,n,r,i,a)-SX(e,t,n,r,i,a)}let lX={description:A(`Payment on the principal of an investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`period (number)`,A(`The amortization period, in terms of number of periods.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:cX(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale),+!!L(a)),format:`#,##0.00`}},isExported:!0},uX=.1,dX={description:A(`Internal rate of return given periodic cashflows.`),args:[k(`cashflow_amounts (number, range<number>)`,A(`An array or range containing the income or payments associated with the investment.`)),k(`rate_guess (number, default=${uX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:uX}){let n=F(t,this.locale);if(n<=-1)return new M(DJ(n));let r=!1,i=!1,a=[];if(ao([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),!r||!i)return new M(Gq);let o=a.shift();function s(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*e**(r-i)),t*e**r)}function c(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*(r-i)*e**(r-i-1)),t*r*e**(r-1))}function l(e){return s(e,o,a)}function u(e){return c(e,o,a)}return{value:zY(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},fX={description:A(`Returns the interest paid at a particular period of an investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`period (number)`,A(`The period for which you want to view the interest payment.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);return o===0?new M(hJ(o)):-1*(s-a/o*s)*i},isExported:!0},pX={description:A(`Modified Macaulay duration.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){let o=nX.compute.bind(this)(e,t,n,r,i,a),s=F(r,this.locale),c=Math.trunc(F(i,this.locale));return F(o,this.locale)/(1+s/c)},isExported:!0},mX={description:A(`Modified internal rate of return.`),args:[k(`cashflow_amounts (range<number>)`,A(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),k(`financing_rate (number)`,A(`The interest rate paid on funds invested.`)),k(`reinvestment_return_rate (number)`,A(`The return (as a percentage) earned on reinvestment of income received from the investment.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=mo(e).flat().filter(e=>e.value!==null).map(e=>F(e,this.locale)),o=a.length,s=0,c=0;for(let e of C(0,o)){let t=a[e];t>=0?s+=t*(i+1)**(o-e-1):c+=t/(r+1)**e}if(c===0||s===0)return new M(Gq);let l=1/(o-1);return(-s/c)**l-1},isExported:!0},hX={description:A(`Annual nominal interest rate.`),args:[k(`effective_rate (number)`,A(`The effective interest rate per year.`)),k(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return n<=0?new M(eJ(n)):r<=0?new M(bJ(r)):((n+1)**(1/r)-1)*r},isExported:!0},gX={description:A(`Number of payment periods for an investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`payment_amount (number)`,A(`The amount of each payment made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);if(a===0)return-(c+s)/o;let u=o*(1+a*l)/a;return Math.log((u-c)/(s+u))/Math.log(1+a)},isExported:!0};function _X(e,t,n,r){let i=0;return co(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let vX={description:A(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[k(`discount (number)`,A(`The discount rate of the investment over one period.`)),k(`cashflow (number, range<number>, repeating)`,A(`The future cash flows.`))],compute:function(e,...t){let n=F(e,this.locale);return n===-1?new M(Zq(n)):{value:_X(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},yX={description:A(`Computes the number of periods needed for an investment to reach a value.`),args:[k(`rate (number)`,A(`The rate at which the investment grows each period.`)),k(`present_value (number)`,A(`The investment's current value.`)),k(`future_value (number)`,A(`The investment's desired future value.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return r<=0?new M(kJ(r)):i<=0?new M(CJ(i)):a<=0?new M(oJ(a)):(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function bX(e,t,n,r,i){if(t<=0)throw new M(gJ(t));if(e===0)return-(r+n)/t;let a=-(n*(1+e)**t+r);return a=a*e/((1+e*i)*((1+e)**t-1)),a}let xX={description:A(`Periodic payment for an annuity investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){let a=F(t,this.locale),o=F(e,this.locale),s=+!!L(i),c=F(r,this.locale);return{value:bX(o,a,F(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function SX(e,t,n,r,i,a){if(n<=0)throw new M(gJ(n));if(t<=0||t>n)throw new M(_J(n));let o=bX(e,n,r,i,a);return a===1&&t===1?o:o+-iX(e,a===0?t-1:t-2,o,r+o*a,0)*e}let CX={description:A(`Payment on the principal of an investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`period (number)`,A(`The amortization period, in terms of number of periods.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=F(n,this.locale),s=F(e,this.locale),c=F(t,this.locale),l=+!!L(a),u=F(i,this.locale);return{value:SX(s,c,o,F(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},wX={description:A(`Present value of an annuity investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_amount (number)`,A(`The amount per period to be paid.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);return{value:a?-(s*(1+a*l)*((1+a)**o-1)/a+c)/(1+a)**o:-(c+s*o),format:`#,##0.00`}},isExported:!0},TX={description:A(`Price of a security paying periodic interest.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));if(s>=c)return new M(fJ(s,c));if(HJ(f))return new M(Jq(f));if(VJ(p))return new M(Yq(p));if(l<0)return new M(OJ(l));if(u<0)return new M(zJ(u));if(d<=0)return new M(AJ(d));let m=Ca(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=1+u/f,v=100*l/f;if(h===1)return(v+d)/(g*u/f+1)-v*(1-g);let y=0;for(let e=1;e<=h;e++)y+=v/_**(e-1+g);return d/_**(h-1+g)+y-v*(1-g)},isExported:!0},EX={description:A(`Price of a discount security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the security at time of purchase.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(Qq(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return c-s*c*u},isExported:!0},DX={description:A(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`issue (date)`,A(`The date the security was initially issued.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));if(o<=c)return new M(FJ(o,c));if(o>=s)return new M(fJ(o,s));if(VJ(d))return new M(Yq(d));if(l<0)return new M(OJ(l));if(u<0)return new M(zJ(u));let f=Ca(o,s,d),p=Ca(o,c,d),m=100+Ca(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},OX=.1,kX={description:A(`Interest rate of an annuity investment.`),args:[k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_per_period (number)`,A(`The amount per period to be paid.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY),k(`rate_guess (number, default=${OX})`,A(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:OX}){let o=F(e,this.locale),s=F(t,this.locale),c=+!!L(i),l=F(a,this.locale)||OX,u=F(r,this.locale),d=F(n,this.locale);return o<=0?new M(gJ(o)):BJ([s,d,u])?l<=-1?new M(DJ(l)):(u-=s*c,d+=s*c,{value:zY(e=>{let t=(1+e)**+o,n=(t-1)/e;return u+d*t+s*n},e=>{let t=(1+e)**(o-1),n=((1+e)**+o-1)/e,r=o*t/e-n/e;return d*o*t+s*r},l,40,1e-5),format:`0%`}):new M(A(`There must be both positive and negative values in [payment_amount, present_value, future_value].`))},isExported:!0},AX={description:A(`Amount received at maturity for a security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`investment (number)`,A(`The amount invested (irrespective of face value of each security).`)),k(`discount (number)`,A(`The discount rate of the security invested in.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));return a>=o?new M(fJ(a,o)):VJ(l)?new M(Yq(l)):s<=0?new M(sJ(s)):c<=0?new M(Qq(c)):s/(1-c*Ca(a,o,l))},isExported:!0},jX={description:A(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[k(`number_of_periods (number)`,A(`The number of periods.`)),k(`present_value (number)`,A(`The present value of the investment.`)),k(`future_value (number)`,A(`The future value of the investment.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return r<=0?new M(gJ(r)):(a/i)**(1/r)-1},isExported:!0},MX={description:A(`Depreciation of an asset using the straight-line method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},NX={description:A(`Depreciation via sum of years digit method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);if(s<=0)return new M(SJ(s));if(o<=0)return new M(dJ(o));if(s>o)return new M(xJ(s,o));let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function PX(e,t,n){return 100*(1-n*Ca(e,t,2))}let FX={description:A(`Price of a US Treasury bill.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);return r>=i?new M(fJ(r,i)):UJ(r,i,this.locale)?a<=0?new M(Qq(a)):a>=1?new M($q(a)):PX(r,i,a):new M(PJ(r,i))},isExported:!0},IX={description:A(`Equivalent rate of return for a US Treasury bill.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);if(r>=i)return new M(fJ(r,i));if(!UJ(r,i,this.locale))return new M(PJ(r,i));if(a<=0)return new M(Qq(a));if(a>=1)return new M($q(a));let o=ZJ.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=PX(r,i,a)/100,c=o/(o===366?366:365);return(-2*c+2*Math.sqrt(c**2-(2*c-1)*(1-1/s)))/(2*c-1)},isExported:!0},LX={description:A(`The yield of a US Treasury bill based on price.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);if(r>=i)return new M(fJ(r,i));if(!UJ(r,i,this.locale))return new M(PJ(r,i));if(a<=0)return new M(wJ(a));let o=Ca(r,i,2);return(100-a)/a*(1/o)},isExported:!0},RX={description:A(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`start (number)`,A(`Starting period to calculate depreciation.`)),k(`end (number)`,A(`Ending period to calculate depreciation.`)),k(`factor (number, default=2)`,A(`The number of months in the first year of depreciation.`)),k(`no_switch (number, default=false)`,A(`Whether to switch to straight-line depreciation when the depreciation is greater than the declining balance calculation.`),[{value:!1,label:A(`Switch to straight-line depreciation`)},{value:!0,label:A(`Do not switch to straight-line depreciation`)}])],compute:function(e,t,n,r,i,a={value:2},o={value:!1}){a||=0;let s=F(e,this.locale),c=F(t,this.locale),l=F(n,this.locale),u=Math.trunc(F(r,this.locale)),d=Math.trunc(F(i,this.locale)),f=F(a,this.locale),p=L(o);if(s<0)return new M(Kq(s));if(c<0)return new M(jJ(c));if(l<=0)return new M(dJ(l));if(u<0)return new M(IJ(u));if(d<0)return new M(tJ(d));if(u>d)return new M(LJ(u,d));if(d>l)return new M(nJ(d,l));if(f<=0)return new M(Xq(f));if(s===0)return 0;if(c>=s)return u<1?s-c:0;let m=f/l;if(m>=1)return u<1?s-c:0;let h=s,g=0,_=0,v=!1;for(let e=0;e<d;e++){if(!v||p){let t=h*m,n=l-e,r=(h-c)/n;!p&&r>t?(v=!0,g=r):g=t}let t=Math.max(h-g,c);e>=u&&(_+=h-t),h=t}return _},isExported:!0},zX={description:A(`Internal rate of return given non-periodic cash flows.`),args:[k(`cashflow_amounts (range<number>)`,A(`An range containing the income or payments associated with the investment.`)),k(`cashflow_dates (range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),k(`rate_guess (number, default=${OX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:OX}){let r=F(n,this.locale);if(!hh(e,t))return new M(Wq);let i=e.flat().map(e=>F(e,this.locale)),a=t.flat().map(e=>F(e,this.locale));if(!BJ(i))return new M(Gq);if(a.some(e=>e<a[0]))return new M(rJ(a[0]));if(r<=-1)return new M(DJ(r));let o=new Map;for(let e of C(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e));return zY(e=>{let t=c[0];for(let n of C(1,c.length)){let r=(s[0]-s[n])/365;t+=c[n]*(1+e)**r}return t},e=>{let t=0;for(let n of C(1,c.length)){let r=(s[0]-s[n])/365;t+=r*c[n]*(1+e)**(r-1)}return t},r,40,1e-5,e=>e?e/10-.9:-.9)},isExported:!0},BX={description:A(`Net present value given to non-periodic cash flows..`),args:[k(`discount (number)`,A(`The discount rate of the investment over one period.`)),k(`cashflow_amounts (number, range<number>)`,A(`An range containing the income or payments associated with the investment.`)),k(`cashflow_dates (number, range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`))],compute:function(e,t,n){let r=F(e,this.locale);if(!hh(t,n))return new M(Wq);let i=R(t).flat().map(e=>Ya(e,this.locale)),a=R(n).flat().map(e=>Ya(e,this.locale));if(a.some(e=>e<a[0]))return new M(rJ(a[0]));if(r<=0)return new M(kJ(r));if(i.length===1)return i[0];let o=new Map;for(let e of C(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e)),l=c[0];for(let e of C(1,c.length)){let t=(s[0]-s[e])/365;l+=c[e]*(1+r)**t}return l},isExported:!0},VX={description:A(`Annual yield of a security paying periodic interest.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));if(s>=c)return new M(fJ(s,c));if(HJ(f))return new M(Jq(f));if(VJ(p))return new M(Yq(p));if(l<0)return new M(OJ(l));if(u<=0)return new M(wJ(u));if(d<=0)return new M(AJ(d));let m=Ca(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=100*l/f;if(h===1){let e=u+_*(1-g);return(d+_-e)*f*(1/g)/e}function v(e,t,n,r,i,a){let o=a-(e+i*(1-t))*r**(n-1+t);for(let e=1;e<=n;e++)o+=i*r**(e-1);return o}function y(e,t,n,r,i){let a=-(e+i*(1-t))*(n-1+t)*r**(n-2+t);for(let e=1;e<=n;e++)a+=i*(e-1)*r**(e-2);return a}function b(e){return v(u,g,h,e,_,d)}function ee(e){return y(u,g,h,e,_)}return(zY(b,ee,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},HX={description:A(`Annual yield of a discount security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(wJ(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return(c/s-1)/u},isExported:!0},UX={description:A(`Annual yield of a security paying interest at maturity.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`issue (date)`,A(`The date the security was initially issued.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`price (number)`,A(`The price at which the security is bought.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));if(o>=s)return new M(fJ(o,s));if(VJ(d))return new M(Yq(d));if(o<c)return new M(NJ(o,c));if(l<0)return new M(OJ(l));if(u<=0)return new M(wJ(u));let f=Ca(c,s,d),p=Ca(c,o,d),m=Ca(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0};var WX=l({CELL:()=>KX,ISBLANK:()=>eZ,ISERR:()=>qX,ISERROR:()=>JX,ISFORMULA:()=>nZ,ISLOGICAL:()=>YX,ISNA:()=>XX,ISNONTEXT:()=>ZX,ISNUMBER:()=>QX,ISTEXT:()=>$X,NA:()=>tZ});let GX=[{value:`address`,label:A(`Returns an absolute reference as plain text of the top left cell in reference.`)},{value:`col`,label:A(`Returns the column number of the cell in reference.`)},{value:`contents`,label:A(`Returns the value contained in the top left cell in reference.`)},{value:`format`,label:A(`Returns the format of the top left cell in reference.`)},{value:`row`,label:A(`Returns the row number of the top left cell in reference.`)},{value:`type`,label:A(`Returns the type of data in the cell in reference. The following values are returned: "b" for a blank cell, "l" (for label) if the cell contains plain text, and "v" (for value) if the cell contains any other type of data.`)}],KX={description:A(`Gets information about a cell.`),args:[k(`info_type (string)`,A(`The type of information requested.`),GX),k(`reference (any, range<any>)`,A(`The reference to the cell.`))],compute:function(e,t){let n=I(e).toLowerCase();if(!GX.map(e=>e.value).includes(n))return new M(A(`The info_type should be one of %s.`,GX.join(`, `)));let r=R(t)[0][0],i=r.position;if(i===void 0)return new M(A(`The reference is invalid.`));switch(n){case`address`:return(this.__originSheetId===i.sheetId?``:this.getters.getSheetName(i.sheetId)+`!`)+E(i.col,i.row,{colFixed:!0,rowFixed:!0});case`col`:return i.col+1;case`contents`:return r.value;case`format`:return r.format||``;case`row`:return i.row+1;case`type`:return r.value===null?`b`:su(r.format)?`l`:typeof r.value==`number`||typeof r.value==`boolean`?`v`:`l`}return``},isExported:!0},qX={description:A(`Whether a value is an error other than #N/A.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)&&t!==j.NotAvailable},isExported:!0},JX={description:A(`Whether a value is an error.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)},isExported:!0},YX={description:A("Whether a value is `true` or `false`."),args:[k(`value (any)`,A(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},XX={description:A(`Whether a value is the error #N/A.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},ZX={description:A(`Whether a value is non-textual.`),args:[k(`value (any)`,A(`The value to be checked.`))],compute:function(e){return!$X.compute.bind(this)(e)},isExported:!0},QX={description:A(`Whether a value is a number.`),args:[k(`value (any)`,A(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},$X={description:A(`Whether a value is text.`),args:[k(`value (any)`,A(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&P(e?.value)===!1},isExported:!0},eZ={description:A(`Whether the referenced cell is empty`),args:[k(`value (any)`,A(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},tZ={description:A(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0},nZ={description:A(`Checks whether there is a reference to a cell that contains a formula, and returns TRUE or FALSE.`),args:[k(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){return e?.position===void 0?new zi(Wa):this.getters.getCell(e.position)?.isFormula??!1},isExported:!0};var rZ=l({AND:()=>iZ,FALSE:()=>aZ,IF:()=>oZ,IFERROR:()=>sZ,IFNA:()=>cZ,IFS:()=>lZ,NOT:()=>uZ,OR:()=>dZ,SWITCH:()=>fZ,TRUE:()=>pZ,XOR:()=>mZ});let iZ={description:A("Logical `and` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let{result:t,foundBoolean:n}=Zh(e);return n?t:new M(ko)},isExported:!0},aZ={description:A("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},oZ={description:A(`Returns value depending on logical expression.`),args:[k(`logical_expression (boolean, range<boolean>)`,A(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.`)),k(`value_if_true (any, range)`,A(`The value the function returns if logical_expression is TRUE.`)),k(`value_if_false (any, range, default=FALSE)`,A(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){return wh(e)?ho(oZ.compute,[e,t,n]):(L(Sh(e))?t:n)??{value:0}},isExported:!0},sZ={description:A(`Value if it is not an error, otherwise 2nd argument.`),args:[k(`value (any, range)`,A(`The value to return if value itself is not an error.`)),k(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an error.`))],compute:function(e,t){return wh(e)?ho(sZ.compute,[e,t]):(P(Sh(e)?.value)?t:e)??{value:0}},isExported:!0},cZ={description:A(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[k(`value (any, range)`,A(`The value to return if value itself is not #N/A an error.`)),k(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an #N/A error.`))],compute:function(e,t){return wh(e)?ho(cZ.compute,[e,t]):(Sh(e)?.value===j.NotAvailable?t:e)??{value:0}},isExported:!0},lZ={description:A(`Returns a value depending on multiple logical expressions.`),args:[k(`condition (any, range, repeating)`,A(`The condition to be evaluated. It can be a boolean, a number, an array, or a reference to any of those.`)),k(`value (any, range, repeating)`,A(`The value to be returned if its corresponding condition is TRUE.`))],compute:function(...e){if(e.length%2!=0)return new M(A(`Wrong number of arguments. Expected an even number of arguments.`));for(;e.length>0;){if(wh(e[0]))return ho(lZ.compute,e);let t=L(Sh(e.shift())),n=e.shift();if(t)return n??{value:0}}return new M(A(`No match.`))},isExported:!0},uZ={description:A(`Returns opposite of provided logical value.`),args:[k(`logical_expression (boolean)`,A(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!L(e)},isExported:!0},dZ={description:A("Logical `or` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let{result:t,foundBoolean:n}=Qh(e);return n?t:new M(ko)},isExported:!0},fZ={description:A(`Returns a value by comparing cases to an expression.`),args:[k(`expression (number, boolean, string)`,A(`The value to be checked.`)),k(`case (any, repeating)`,A(`Case to be checked against expression.`)),k(`value (any, repeating)`,A(`Value to be returned if its corresponding case matches expression.`)),k(`default (any, default="empty")`,A(`An optional default value to be returned if none of the cases match expression.`))],compute:function(e,...t){let n=t.length%2==0?Ha(e):t.pop();for(let n=0;n<t.length;n+=2){let r=t[n];if(r&&P(r.value))return r;if(e?.value===r?.value)return t[n+1]||{value:0}}return n||{value:0}},isExported:!0},pZ={description:A("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},mZ={description:A("Logical `xor` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let t=!1,n=!1;return _o(e,e=>(t=!0,n=n?!e:e,!0)),t?n:new M(ko)},isExported:!0};function hZ(e,t){let n=t.getPivotId(e);if(!n)throw new M(A(`There is no pivot with id "%s"`,e));return n}function gZ(e,t,n){let{measures:r}=n.getPivotCoreDefinition(e);if(!r.find(e=>e.id===t))throw new M(A(`The argument %s is not a valid measure. Here are the measures: %s`,t,`(${r.map(e=>e.id).join(`, `)})`))}function _Z(e){if(e.length%2!=0)throw new M(A(`Function PIVOT takes an even number of arguments.`))}function vZ(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=Tn(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new zi;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&Ln(D(e.__originCellPosition),n))throw new Ri;r.push(o)}for(let i of n)i.computedBy&&r.push(...e.getters.getMeasureFullDependencies(t,i));let a=e.__originCellPosition;a&&r.length&&(e.updateDependencies?.(a),e.addDependencies?.(a,r))}var yZ=l({ADDRESS:()=>SZ,CHOOSE:()=>zZ,COLUMN:()=>CZ,COLUMNS:()=>wZ,DROP:()=>BZ,FORMULATEXT:()=>HZ,HLOOKUP:()=>TZ,INDEX:()=>EZ,INDIRECT:()=>DZ,LOOKUP:()=>OZ,MATCH:()=>kZ,OFFSET:()=>RZ,PIVOT:()=>LZ,PIVOT_HEADER:()=>IZ,PIVOT_VALUE:()=>FZ,ROW:()=>AZ,ROWS:()=>jZ,TAKE:()=>VZ,VLOOKUP:()=>MZ,XLOOKUP:()=>PZ});let bZ=[{value:!0,label:A(`A1 style (default)`)},{value:!1,label:A(`R1C1 style`)}],xZ=[{value:!0,label:A(`Approximate match (default)`)},{value:!1,label:A(`Exact match`)}],SZ={description:A(`Returns a cell reference as a string. `),args:[k(`row (number)`,A(`The row number of the cell reference. `)),k(`column (number)`,A(`The column number (not name) of the cell reference. A is column number 1. `)),k(`absolute_relative_mode (number, default=1)`,A(`An indicator of whether the reference is row/column absolute.`),[{value:1,label:A(`Absolute row and column (e.g. $A$1)`)},{value:2,label:A(`Absolute row, relative column (e.g. A$1)`)},{value:3,label:A(`Relative row, absolute column (e.g. $A1)`)},{value:4,label:A(`Relative row and column (e.g. A1)`)}]),k(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation or R1C1 style notation.`),bZ),k(`sheet (string, optional)`,A(`A string indicating the name of the sheet into which the address points.`))],compute:function(e,t,n={value:1},r={value:!0},i){let a=Za(e,this.locale),o=Za(t,this.locale);if(a<1)return new M(_h(a));if(o<1)return new M(_h(o));let s=Za(n,this.locale);if(![1,2,3,4].includes(s))return new M(Ga(1,4,s));let c=L(r),l;if(c){let e={rowFixed:[1,2].includes(s),colFixed:[1,3].includes(s)};l=E(o-1,a-1,e)}else l=([1,2].includes(s)?`R${a}`:`R[${a}]`)+([1,3].includes(s)?`C${o}`:`C[${o}]`);return i===void 0?l:$o(I(i),l)},isExported:!0},CZ={description:A(`Column number of a specified cell.`),args:[k(`cell_reference (any, range<any>, default='this cell')`,A(`The cell whose column number will be returned. Column A corresponds to 1. By default, the function use the cell in which the formula is entered.`))],compute:function(e){if(e===void 0)return this.__originCellPosition===void 0?new M(A(`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`)):this.__originCellPosition.col+1;let t=R(e),n=t[0][0];if(n===void 0)return new M(A(`The range is out of bounds.`));if(n.position===void 0)return new zi(Wa);let r=n.position.col;return t.length===1?r+1:uo(t.length,1,e=>({value:r+e+1}))},isExported:!0},wZ={description:A(`Number of columns in a specified array or range.`),args:[k(`range (any, range<any>)`,A(`The range whose column count will be returned.`))],compute:function(e){let t=R(e);return t[0][0]===void 0?new M(A(`The range is out of bounds.`)):t[0][0].value===j.InvalidReference?t[0][0]:t.length},isExported:!0},TZ={description:A(`Horizontal lookup`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The range to consider for the search. The first row in the range is searched for the key specified in search_key.`)),k(`index (number)`,A(`The row index of the value to be returned, where the first row in range is numbered 1.`)),k(`is_sorted (boolean, default=true)`,A(`Indicates whether the row to be searched (the first row of the specified range) is sorted, in which case the closest match for search_key will be returned.`),xZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=R(t);if(1>i||i>a[0].length)return new M(A(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[t][0].value,s=a[L(r.value)?So(a,e,`nextSmaller`,`asc`,a.length,o):Co(a,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?Ha(e):s[i-1]},isExported:!0},EZ={description:A(`Returns the content of a cell, specified by row and column offset.`),args:[k(`reference (any, range)`,A(`The range of cells from which the values are returned.`)),k(`row (number, default=0)`,A(`The index of the row to be returned from within the reference range of cells.`)),k(`column (number, default=0)`,A(`The index of the column to be returned from within the reference range of cells.`))],compute:function(e,t={value:0},n={value:0}){let r=R(e),i=F(t.value,this.locale),a=F(n.value,this.locale);return a<0||a-1>=r.length||i<0||i-1>=r[0].length?new M(A(`Index out of range.`)):i===0&&a===0?r:i===0?[r[a-1]]:a===0?r.map(e=>[e[i-1]]):r[a-1][i-1]},isExported:!0},DZ={description:A(`Returns the content of a cell, specified by a string.`),args:[k(`reference (string)`,A(`The range of cells from which the values are returned.`)),k(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`),bZ)],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new zi(A(`Reference should be defined.`));if(!L(t))return new M(A(`R1C1 notation is not supported.`));let r=this.__originSheetId,i=this.__originCellPosition;i&&this.updateDependencies?.(i);let a=this.getters.getNamedRange(n),o=a?a.range:this.getters.getRangeFromSheetXC(r,n);if(o===void 0||o.invalidXc||o.invalidSheetName)return new zi;i&&this.addDependencies?.(i,[o]);let s=[];for(let e=o.zone.left;e<=o.zone.right;e++){let t=[];for(let n=o.zone.top;n<=o.zone.bottom;n++){let r={sheetId:o.sheetId,col:e,row:n};t.push(this.getFormulaResult(r))}s.push(t)}return s.length===1&&s[0].length===1?s[0][0]:s},isExported:!0},OZ={description:A(`Look up a value.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`search_array (any, range)`,A(`One method of using this function is to provide a single sorted row or column search_array to look through for the search_key with a second argument result_range. The other way is to combine these two arguments into one search_array where the first row or column is searched and a value is returned from the last row or column in the array. If search_key is not found, a non-exact match may be returned.`)),k(`result_range (any, range, optional)`,A(`The range from which to return a result. The value returned corresponds to the location where search_key is found in search_range. This range must be only a single row or column and should not be used if using the search_result_array method.`))],compute:function(e,t,n){let r=R(t),i=R(n),a=r.length,o=r[0].length,s=o>=a,c=So(r,e,`nextSmaller`,`asc`,s?o:a,s?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value);return c===-1||s&&r[0][c]===void 0||!s&&r[c][o-1]===void 0?Ha(e):i[0].length===0?s?r[a-1][c]:r[c][o-1]:(a=i.length,o=i[0].length,a!==1&&o!==1?new M(A(`The result_range must be a single row or a single column.`)):a>1?c>a-1?new M(A(`[[FUNCTION_NAME]] evaluates to an out of range row value %s.`,c+1)):i[c][0]:c>o-1?new M(A(`[[FUNCTION_NAME]] evaluates to an out of range column value %s.`,c+1)):i[0][c])},isExported:!0},kZ={description:A(`Position of item in range that matches value.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The one-dimensional array to be searched.`)),k(`search_type (number, default=1)`,A(`The search method is a number 1, 0 or -1 indicating which value to return. 1 finds the largest value less than or equal to search_key when range is sorted in ascending order. 0 finds the exact value when range is unsorted. -1 finds the smallest value greater than or equal to search_key when range is sorted in descending order.`),[{value:1,label:A(`Ascending order (default)`)},{value:0,label:A(`Exact match`)},{value:-1,label:A(`Descending order`)}])],compute:function(e,t,n={value:1}){let r=F(n,this.locale),i=R(t),a=i.length,o=i[0].length;if(a!==1&&o!==1)return new M(A(`The range must be a single row or a single column.`));let s=-1,c=a===1?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,l=a===1?i[0].length:i.length;switch(r=Math.sign(r),r){case 1:s=So(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Co(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=So(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?Ha(e):s+1},isExported:!0},AZ={description:A(`Row number of a specified cell.`),args:[k(`cell_reference (any, range<any>, default='this cell')`,A(`The cell whose row number will be returned. By default, this function uses the cell in which the formula is entered.`))],compute:function(e){if(e===void 0)return this.__originCellPosition?.row===void 0?new M(A(`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`)):this.__originCellPosition.row+1;let t=R(e),n=t[0][0];if(n===void 0)return new M(A(`The range is out of bounds.`));if(n.position===void 0)return new zi(Wa);let r=n.position.row;return t[0].length===1?r+1:uo(1,t[0].length,(e,t)=>({value:r+t+1}))},isExported:!0},jZ={description:A(`Number of rows in a specified array or range.`),args:[k(`range (any, range<any>)`,A(`The range whose row count will be returned.`))],compute:function(e){let t=R(e);return t[0][0]===void 0?new M(A(`The range is out of bounds.`)):t[0][0].value===j.InvalidReference?t[0][0]:t[0].length},isExported:!0},MZ={description:A(`Vertical lookup.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The range to consider for the search. The first column in the range is searched for the key specified in search_key.`)),k(`index (number)`,A(`The column index of the value to be returned, where the first column in range is numbered 1.`)),k(`is_sorted (boolean, default=true)`,A(`Indicates whether the column to be searched (the first column of the specified range) is sorted, in which case the closest match for search_key will be returned.`),xZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=R(t);if(1>i||i>a.length)return new M(A(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[0][t].value,s=L(r.value)?So(a,e,`nextSmaller`,`asc`,a[0].length,o):Co(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?Ha(e):c},isExported:!0},NZ={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},PZ={description:A(`Search a range for a match and return the corresponding item from a second range.`),args:[k(`search_key (string,number,boolean)`,A(`The value to search for.`)),k(`lookup_range (any, range)`,A(`The range to consider for the search. Should be a single column or a single row.`)),k(`return_range (any, range)`,A(`The range containing the return value. Should have the same dimensions as lookup_range.`)),k(`if_not_found (any, optional)`,A(`If a valid match is not found, return this value.`)),k(`match_mode (any, default=0)`,A(`Specifies how to match search_key with the items in lookup_range. `),[{value:0,label:A(`Exact match (default)`)},{value:-1,label:A(`Exact match or next smaller item`)},{value:1,label:A(`Exact match or next larger item`)},{value:2,label:A(`Wildcard character match`)}]),k(`search_mode (any, default=1)`,A(`Specifies the search mode to use. By default, a first to last search will be used.`),[{value:1,label:A(`Search first to last (default)`)},{value:-1,label:A(`Search last to first`)},{value:2,label:A(`Binary search (sorted ascending order)`)},{value:-2,label:A(`Binary search (sorted descending order)`)}])],compute:function(e,t,n,r,i={value:0},a={value:1}){let o=Math.trunc(F(i.value,this.locale)),s=Math.trunc(F(a.value,this.locale)),c=R(t),l=R(n);if(c.length!==1&&c[0].length!==1)return new M(A(`lookup_range should be either a single row or single column.`));if(![1,-1,2,-2].includes(s))return new M(A(`search_mode should be a value in [-1, 1, -2, 2].`));if(![-1,0,1,2].includes(o))return new M(A(`match_mode should be a value in [-1, 0, 1, 2].`));let u=c.length===1?`col`:`row`;if(o===2&&[-2,2].includes(s))return new M(A(`The search and match mode combination is not supported for XLOOKUP evaluation.`));if(u===`col`?l[0].length!==c[0].length:l.length!==c.length)return new M(A(`return_range should have the same dimensions as lookup_range.`));let d=u===`col`?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,f=u===`col`?c[0].length:c.length,p=NZ[o],m=s===-1,h=s===2||s===-2?So(c,e,p,s===2?`asc`:`desc`,f,d):Co(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?Ha(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},FZ={description:A(`Get the value from a pivot.`),args:[k(`pivot_id (number,string)`,A(`ID of the pivot.`)),k(`measure_name (string)`,A(`Name of the measure.`)),k(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),k(`domain_value (number,string,boolean,repeating,optional)`,A(`Value.`))],compute:function(e,t,...n){let r=I(e),i=I(t),a=hZ(r,this.getters);gZ(a,i,this.getters),_Z(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);vZ(this,a,s.measures.filter(e=>e.id===i)),o.init({reload:o.needsReevaluation});let c=o.assertIsValid({throwOnError:!1});if(c)return c;if(!o.areDomainArgsFieldsValid(n)){let e=A(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${r})`);return{value:j.GenericError,message:A(`Dimensions don't match the pivot definition`)+`. `+e}}let l=o.parseArgsToPivotDomain(n);return this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(a)?.trackValue(i,l),o.getPivotCellValueAndFormat(i,l)}},IZ={description:A(`Get the header of a pivot.`),args:[k(`pivot_id (number,string)`,A(`ID of the pivot.`)),k(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),k(`domain_value (number,string,value,repeating,optional)`,A(`Value.`))],compute:function(e,...t){let n=I(e),r=hZ(n,this.getters);_Z(t);let i=this.getters.getPivot(r);vZ(this,r,[]),i.init({reload:i.needsReevaluation});let a=i.assertIsValid({throwOnError:!1});if(a)return a;if(!i.areDomainArgsFieldsValid(t)){let e=A(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${n})`);return{value:j.GenericError,message:A(`Dimensions don't match the pivot definition`)+`. `+e}}let o=i.parseArgsToPivotDomain(t);this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(r)?.trackHeader(o);let s=o.at(-1);if(s?.field===`measure`)return i.getPivotMeasureValue(I(s.value),o);let{value:c,format:l}=i.getPivotHeaderValueAndFormat(o);return{value:c,format:!s||s.field===`measure`||s.value===`false`?void 0:l}}},LZ={description:A(`Get a pivot table.`),args:[k(`pivot_id (string)`,A(`ID of the pivot.`)),k(`row_count (number, optional)`,A(`number of rows`)),k(`include_total (boolean, default=TRUE)`,A(`Whether to include total/sub-totals or not.`)),k(`include_column_titles (boolean, default=TRUE)`,A(`Whether to include the column titles or not.`)),k(`column_count (number, optional)`,A(`number of columns`)),k(`include_measure_titles (boolean, default=TRUE)`,A(`Whether to include the measure titles row or not.`))],compute:function(e,t,n,r,i,a){let o=hZ(I(e),this.getters),s=this.getters.getPivot(o),c=this.getters.getPivotCoreDefinition(o),l=Kg(c,t,n,r,i,a,this.locale);if(l.numberOfRows<0)return new M(A(`The number of rows must be positive.`));if(l.numberOfColumns<0)return new M(A(`The number of columns must be positive.`));vZ(this,o,c.measures),s.init({reload:s.needsReevaluation});let u=s.assertIsValid({throwOnError:!1});if(u)return u;let d=s.getCollapsedTableStructure();if(d.numberOfCells>5e5)return new M(Ky(d.numberOfCells,this.locale));let f=d.getPivotCells(l),p=this.getters.getPivotName(o),{numberOfCols:m,numberOfRows:h}=d.getPivotTableDimensions(l);if(h===0)return[[{value:p}]];let g=[];for(let e of C(0,m)){g[e]=[];for(let t of C(0,h)){let n=f[e][t];switch(n.type){case`EMPTY`:g[e].push({value:``});break;case`HEADER`:let t=s.getPivotHeaderValueAndFormat(n.domain);g[e].push(Lg(n.domain,t));break;case`MEASURE_HEADER`:g[e].push(s.getPivotMeasureValue(n.measure,n.domain));break;case`VALUE`:g[e].push(s.getPivotCellValueAndFormat(n.measure,n.domain));break;case`ROW_GROUP_NAME`:let r=s.definition.rows.find(e=>e.nameWithGranularity===n.rowField)?.displayName;g[e].push({value:r||``});break}}}return(l.displayColumnHeaders||l.displayMeasuresRow)&&f[0][0].type===`EMPTY`&&(g[0][0]={value:p}),g}},RZ={description:A(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[k(`cell_reference (any, range<any>)`,A(`The starting point from which to count the offset rows and columns.`)),k(`offset_rows (number)`,A(`The number of rows to offset by.`)),k(`offset_columns (number)`,A(`The number of columns to offset by.`)),k(`height (number, default='height of cell_reference')`,A(`The number of rows of the range to return starting at the offset target.`)),k(`width (number, default='width of cell_reference')`,A(`The number of columns of the range to return starting at the offset target.`))],compute:function(e,t,n,r,i){if(e===void 0)return new zi(Wa);let a=R(e),o=a[0][0];if(o===void 0)return new M(A(`The range is out of bounds.`));if(o.position===void 0)return new zi(Wa);let s=a[0].length,c=a.length;if(r){let e=F(r,this.locale);if(e<1)return new M(A(`Height value is %(_height)s. It should be greater than or equal to 1.`,{_height:e}));s=e}if(i){let e=F(i,this.locale);if(e<1)return new M(A(`Width value is %(_width)s. It should be greater than or equal to 1.`,{_width:e}));c=e}let l=F(t,this.locale),u=F(n,this.locale),d=this.__originCellPosition;d&&this.updateDependencies?.(d);let f=o.position.col+u,p=o.position.row+l;if(f<0||p<0)return new zi(A(`OFFSET evaluates to an out of bounds range.`));let m={left:f,top:p,right:f+c-1,bottom:p+s-1},h=o.position.sheetId,g=this.getters.getRangeFromZone(h,m);return g.invalidXc||g.invalidSheetName?new zi:(d&&this.addDependencies?.(d,[g]),uo(c,s,(e,t)=>this.getFormulaResult({sheetId:h,col:f+e,row:p+t})))}},zZ={description:A(`Returns an element from a list of choices based on index.`),args:[k(`index (number)`,A(`Which choice to return.`)),k(`choice (any, range<any>, repeating)`,A(`A potential value to return. May be a reference to a cell or an individual value.`))],compute:function(e,...t){let n=Math.floor(F(e,this.locale))-1;return n<0||n>=t.length?new M(A(`Index for CHOOSE is invalid. Valid values are between 1 and %(choices)s inclusive.`,{choices:t.length})):t[n]??new M(A(`Choice is undefined.`))},isExported:!0},BZ={description:A(`Excludes a specified number of rows or columns from the start or end of an array.`),args:[k(`array (range)`,A(`The array from which to drop rows or columns`)),k(`rows (number)`,A(`The number of rows to drop. A negative value drops from the end of the array.`)),k(`columns (number, optional)`,A(`The number of columns to exclude. A negative value drops from the end of the array.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=e;if(Math.abs(i)>=e.length||Math.abs(r)>=e[0].length)return new M(A(`The number of rows or column to exclude must be smaller than the number of elements in the array.`));a=i>=0?a.slice(i):a.slice(0,a.length+i);for(let e=0;e<a.length;e++)r>=0?a[e]=a[e].slice(r):a[e]=a[e].slice(0,a[e].length+r);return a},isExported:!0},VZ={description:A(`Returns a specified number of contiguous rows or columns from the start or end of an array.`),args:[k(`array (range)`,A(`The array from which to take rows or columns.`)),k(`rows (number)`,A(`The number of rows to take. A negative value takes from the end of the array.`)),k(`columns (number, optional)`,A(`The number of columns to take. A negative value takes from the end of the array.`))],compute:function(e,t,n){let r=t?F(t,this.locale):e[0].length,i=F(n,this.locale),a=e;if((Math.abs(i)>=e.length||i===0)&&(i=e.length),Math.abs(r)>=e[0].length&&(r=e[0].length),a=i>=0?a.slice(0,i):a.slice(a.length+i,a.length),r===0)return new M(A(`The number of rows can not be zero.`));for(let e=0;e<a.length;e++)r>0?a[e]=a[e].slice(0,r):a[e]=a[e].slice(a[e].length+r,a[e].length);return a},isExported:!0},HZ={description:A(`Returns a formula as a string.`),args:[k(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){if(e?.position===void 0)return new zi(Wa);let t=this.getters.getCell(e.position);return t?.isFormula?t.compiledFormula.toFormulaString(this.getters):new Bi(A(`The cell does not contain a formula.`))},isExported:!0};var UZ=l({ADD:()=>WZ,CONCAT:()=>GZ,DIVIDE:()=>KZ,EQ:()=>XZ,GT:()=>QZ,GTE:()=>$Z,LT:()=>eQ,LTE:()=>tQ,MINUS:()=>nQ,MULTIPLY:()=>rQ,NE:()=>iQ,POW:()=>aQ,SPILLED_RANGE:()=>oQ,UMINUS:()=>sQ,UNARY_PERCENT:()=>cQ,UPLUS:()=>lQ});let WZ={description:A(`Sum of two numbers.`),args:[k(`value1 (number)`,A(`The first addend.`)),k(`value2 (number)`,A(`The second addend.`))],compute:function(e,t){return{value:F(e,this.locale)+F(t,this.locale),format:e?.format||t?.format}}},GZ={description:A(`Concatenation of two values.`),args:[k(`value1 (string)`,A(`The value to which value2 will be appended.`)),k(`value2 (string)`,A(`The value to append to value1.`))],compute:function(e,t){return I(e)+I(t)},isExported:!0},KZ={description:A(`One number divided by another.`),args:[k(`dividend (number)`,A(`The number to be divided.`)),k(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return n===0?new Ui(A(`The divisor must be different from zero.`)):{value:F(e,this.locale)/n,format:e?.format||t?.format}}};function qZ(e){return e===void 0||e.value===null}let JZ={number:0,string:``,boolean:!1};function YZ(e,t,n=2e-16){return Math.abs(e-t)<n}let XZ={description:A(`Equal.`),args:[k(`value1 (string, number, boolean)`,A(`The first value.`)),k(`value2 (string, number, boolean)`,A(`The value to test against value1 for equality.`))],compute:function(e,t){if(P(e?.value))return e;if(P(t?.value))return t;let n=qZ(e)?JZ[typeof t?.value]:e?.value,r=qZ(t)?JZ[typeof e?.value]:t?.value;return typeof n==`string`&&(n=n.toUpperCase()),typeof r==`string`&&(r=r.toUpperCase()),typeof n==`number`&&typeof r==`number`?{value:YZ(n,r)}:{value:n===r}}};function ZZ(e,t,n){if(P(e?.value))return e;if(P(t?.value))return t;let r=qZ(e)?JZ[typeof t?.value]:e?.value,i=qZ(t)?JZ[typeof e?.value]:t?.value;typeof r!=`number`&&(r=I(r).toUpperCase()),typeof i!=`number`&&(i=I(i).toUpperCase());let a=typeof r,o=typeof i;return a===`string`&&o===`number`?{value:!0}:o===`string`&&a===`number`?{value:!1}:{value:n(r,i)}}let QZ={description:A(`Strictly greater than.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being greater than value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return ZZ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!YZ(e,t)&&e>t:e>t)}},$Z={description:A(`Greater than or equal to.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being greater than or equal to value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return ZZ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?YZ(e,t)||e>t:e>=t)}},eQ={description:A(`Less than.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being less than value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=$Z.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},tQ={description:A(`Less than or equal to.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being less than or equal to value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=QZ.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},nQ={description:A(`Difference of two numbers.`),args:[k(`value1 (number)`,A(`The minuend, or number to be subtracted from.`)),k(`value2 (number)`,A(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:F(e,this.locale)-F(t,this.locale),format:e?.format||t?.format}}},rQ={description:A(`Product of two numbers`),args:[k(`factor1 (number)`,A(`The first multiplicand.`)),k(`factor2 (number)`,A(`The second multiplicand.`))],compute:function(e,t){return{value:F(e,this.locale)*F(t,this.locale),format:e?.format||t?.format}}},iQ={description:A(`Not equal.`),args:[k(`value1 (string, number, boolean)`,A(`The first value.`)),k(`value2 (string, number, boolean)`,A(`The value to test against value1 for inequality.`))],compute:function(e,t){let n=XZ.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},aQ={description:A(`A number raised to a power.`),args:[k(`base (number)`,A(`The number to raise to the exponent power.`)),k(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){return WG.compute.bind(this)(e,t)}},oQ={description:A(`Gets the spilled range of an array formula.`),args:[k(`ref (any, range<any>)`,A(`The reference to get the spilled range from.`))],compute:function(e){if(e===void 0)return new zi(Wa);let t=R(e);if(t.length!==1||t[0].length!==1)return new M(A(`Only single-cell references are allowed to get the spilled range.`));let n=t[0][0];if(P(n.value))return n;if(n.position===void 0)return new zi(Wa);let r=this.__originCellPosition;r&&this.updateDependencies?.(r);let i=this.getters.getSpreadZone(n.position);if(i===void 0)return new zi;let a=this.getters.getRangeFromZone(this.__originSheetId,i);return r&&this.addDependencies?.(r,[a]),uo(i.right-i.left+1,i.bottom-i.top+1,(e,t)=>this.getFormulaResult({sheetId:a.sheetId,col:i.left+e,row:i.top+t}))},hidden:!0},sQ={description:A(`A number with the sign reversed.`),args:[k(`value (number)`,A(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-F(e,this.locale),format:e?.format}}},cQ={description:A(`Value interpreted as a percentage.`),args:[k(`percentage (number)`,A(`The value to interpret as a percentage.`))],compute:function(e){return F(e,this.locale)/100}},lQ={description:A(`A specified number, unchanged.`),args:[k(`value (any)`,A(`The number to return.`))],compute:function(e={value:null}){return e}},$=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),uQ={transform:e=>e,inverseTransform:e=>e},dQ=1e-10,fQ=.0254,pQ=fQ/72,mQ=.3048,hQ=.9144,gQ=1609.34,_Q=1852,vQ=946073047258e4,yQ={g:{...uQ,category:`weight`},u:{...$(166053e-29),category:`weight`},grain:{...$(.0647989),category:`weight`},ozm:{...$(28.3495),category:`weight`},lbm:{...$(453.592),category:`weight`},stone:{...$(6350.29),category:`weight`},sg:{...$(14593.90294),category:`weight`},cwt:{...$(45359.237),category:`weight`},uk_cwt:{...$(50802.3),category:`weight`},ton:{...$(907184.74),category:`weight`},uk_ton:{...$(1016046.9),category:`weight`},m:{...uQ,category:`distance`},km:{...$(1e3),category:`distance`},ang:{...$(dQ),category:`distance`},Picapt:{...$(pQ),category:`distance`},pica:{...$(fQ/6),category:`distance`},in:{...$(fQ),category:`distance`},ft:{...$(mQ),category:`distance`},yd:{...$(hQ),category:`distance`},ell:{...$(1.143),category:`distance`},mi:{...$(gQ),category:`distance`},survey_mi:{...$(1609.34),category:`distance`},Nmi:{...$(_Q),category:`distance`},ly:{...$(vQ),category:`distance`},parsec:{...$(0x6da012f95c9fd0),category:`distance`},sec:{...uQ,category:`time`},min:{...$(60),category:`time`},hr:{...$(3600),category:`time`},day:{...$(86400),category:`time`},yr:{...$(31556952),category:`time`},Pa:{...uQ,category:`pressure`},bar:{...$(1e5),category:`pressure`},mmHg:{...$(133.322),category:`pressure`},Torr:{...$(133.322),category:`pressure`},psi:{...$(6894.76),category:`pressure`},atm:{...$(101325),category:`pressure`},N:{...uQ,category:`force`},dyn:{...$(1e-5),category:`force`},pond:{...$(.00980665),category:`force`},lbf:{...$(4.44822),category:`force`},J:{...uQ,category:`energy`},eV:{...$(160218e-24),category:`energy`},e:{...$(1e-7),category:`energy`},flb:{...$(1.3558179483),category:`energy`},c:{...$(4.184),category:`energy`},cal:{...$(4.1868),category:`energy`},BTU:{...$(1055.06),category:`energy`},Wh:{...$(3600),category:`energy`},HPh:{...$(2684520),category:`energy`},W:{...uQ,category:`power`},PS:{...$(735.499),category:`power`},HP:{...$(745.7),category:`power`},T:{...uQ,category:`magnetism`},ga:{...$(1e-4),category:`magnetism`},K:{...uQ,category:`temperature`},C:{transform:e=>e+273.15,inverseTransform:e=>e-273.15,category:`temperature`},F:{transform:e=>(e-32)*5/9+273.15,inverseTransform:e=>(e-273.15)*9/5+32,category:`temperature`},Rank:{...$(5/9),category:`temperature`},Reau:{transform:e=>e*1.25+273.15,inverseTransform:e=>(e-273.15)/1.25,category:`temperature`},"m^3":{...uQ,category:`volume`,order:3},"ang^3":{...$(dQ**3),category:`volume`,order:3},"Picapt^3":{...$(pQ**3),category:`volume`,order:3},tsp:{...$(492892e-11),category:`volume`},tspm:{...$(5e-6),category:`volume`},tbs:{...$(14786764825785619e-21),category:`volume`},"in^3":{...$(fQ**3),category:`volume`,order:3},oz:{...$(295735295625e-16),category:`volume`},cup:{...$(237e-6),category:`volume`},pt:{...$(.0004731765),category:`volume`},uk_pt:{...$(568261e-9),category:`volume`},qt:{...$(.0009463529),category:`volume`},l:{...$(.001),category:`volume`},uk_qt:{...$(.0011365225),category:`volume`},gal:{...$(.0037854118),category:`volume`},uk_gal:{...$(.00454609),category:`volume`},"ft^3":{...$(mQ**3),category:`volume`,order:3},bushel:{...$(.0352390704),category:`volume`},barrel:{...$(.158987295),category:`volume`},"yd^3":{...$(hQ**3),category:`volume`,order:3},MTON:{...$(1.13267386368),category:`volume`},GRT:{...$(2.83168),category:`volume`},"mi^3":{...$(gQ**3),category:`volume`,order:3},"Nmi^3":{...$(_Q**3),category:`volume`,order:3},"ly^3":{...$(vQ**3),category:`volume`,order:3},"m^2":{...uQ,category:`area`,order:2},"ang^2":{...$(dQ**2),category:`area`,order:2},"Picapt^2":{...$(pQ**2),category:`area`,order:2},"in^2":{...$(fQ**2),category:`area`,order:2},"ft^2":{...$(mQ**2),category:`area`,order:2},"yd^2":{...$(hQ**2),category:`area`,order:2},ar:{...$(100),category:`area`},Morgen:{...$(2500),category:`area`},uk_acre:{...$(4046.8564224),category:`area`},us_acre:{...$(4046.8726098743),category:`area`},ha:{...$(1e4),category:`area`},"mi^2":{...$(gQ**2),category:`area`,order:2},"Nmi^2":{...$(_Q**2),category:`area`,order:2},"ly^2":{...$(vQ**2),category:`area`,order:2},bit:{...uQ,category:`information`},byte:{...$(8),category:`information`},"m/s":{...uQ,category:`speed`},"m/hr":{...$(1/3600),category:`speed`},"km/hr":{...$(1/3.6),category:`speed`},mph:{...$(.44704),category:`speed`},kn:{...$(.5144444444),category:`speed`},admkn:{...$(.5147733333),category:`speed`}},bQ={shweight:`cwt`,lcwt:`uk_cwt`,hweight:`uk_cwt`,LTON:`uk_ton`,brton:`uk_ton`,pc:`parsec`,Pica:`Picapt`,d:`day`,mn:`min`,s:`sec`,p:`Pa`,at:`atm`,dy:`dyn`,ev:`eV`,hh:`HPh`,wh:`Wh`,btu:`BTU`,h:`HP`,cel:`C`,fah:`F`,kel:`K`,us_pt:`pt`,L:`l`,lt:`l`,ang3:`ang^3`,ft3:`ft^3`,in3:`in^3`,ly3:`ly^3`,m3:`m^3`,mi3:`mi^3`,yd3:`yd^3`,Nmi3:`Nmi^3`,Picapt3:`Picapt^3`,"Pica^3":`Picapt^3`,Pica3:`Picapt^3`,regton:`GRT`,ang2:`ang^2`,ft2:`ft^2`,in2:`in^2`,ly2:`ly^2`,m2:`m^2`,mi2:`mi^2`,Nmi2:`Nmi^2`,Picapt2:`Picapt^2`,"Pica^2":`Picapt^2`,Pica2:`Picapt^2`,yd2:`yd^2`,"m/h":`m/hr`,"m/sec":`m/s`},xQ={"":1,Y:1e24,Z:1e21,E:0xde0b6b3a7640000,P:0x38d7ea4c68000,T:0xe8d4a51000,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-21,Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},SQ={weight:A(`Weight`),distance:A(`Distance`),time:A(`Time`),pressure:A(`Pressure`),force:A(`Force`),energy:A(`Energy`),power:A(`Power`),magnetism:A(`Magnetism`),temperature:A(`Temperature`),volume:A(`Volume`),area:A(`Area`),information:A(`Information`),speed:A(`Speed`)},CQ=Object.entries(yQ).map(([e,t])=>({value:e,label:wQ(t.category)}));function wQ(e){return SQ[e]??``}function TQ(e){for(let[t,n]of Object.entries(xQ)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=yQ[r];if(!i&&bQ[r]&&(i=yQ[bQ[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var EQ=l({CONVERT:()=>DQ});let DQ={description:A(`Converts a numeric value to a different unit of measure.`),args:[k(`value (number)`,A(`the numeric value in start_unit to convert to end_unit`)),k(`start_unit (string)`,A(`The starting unit, the unit currently assigned to value`),CQ),k(`end_unit (string)`,A(`The unit of measure into which to convert value`),CQ)],compute:function(e,t,n){let r=F(e,this.locale),i=I(t),a=I(n),o=TQ(i),s=TQ(a);return o?s?o.category===s.category?{value:s.inverseTransform(o.factor*o.transform(r))/s.factor,format:e?.format}:{value:j.GenericError,message:A(`Incompatible units of measure ('%s' vs '%s')`,wQ(o.category),wQ(s.category))}:{value:j.GenericError,message:A(`Invalid units of measure ('%s')`,a)}:{value:j.GenericError,message:A(`Invalid units of measure ('%s')`,i)}},isExported:!0};var OQ=l({CHAR:()=>MQ,CLEAN:()=>NQ,CONCATENATE:()=>PQ,EXACT:()=>FQ,FIND:()=>IQ,FORMAT_LARGE_NUMBER:()=>LQ,JOIN:()=>RQ,LEFT:()=>zQ,LEN:()=>BQ,LOWER:()=>VQ,MID:()=>HQ,PROPER:()=>UQ,REGEXEXTRACT:()=>GQ,REGEXREPLACE:()=>KQ,REGEXTEST:()=>WQ,REPLACE:()=>qQ,RIGHT:()=>JQ,SEARCH:()=>YQ,SPLIT:()=>XQ,SUBSTITUTE:()=>ZQ,TEXT:()=>n$,TEXTAFTER:()=>i$,TEXTBEFORE:()=>a$,TEXTJOIN:()=>QQ,TEXTSPLIT:()=>$Q,TRIM:()=>e$,UPPER:()=>t$,VALUE:()=>r$});let kQ=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,AQ=[{value:0,label:A(`Case-sensitive (default)`)},{value:1,label:A(`Case-insensitive`)}],jQ=[{value:0,label:A(`Don't match to end (default)`)},{value:1,label:A(`Match to end`)}],MQ={description:A(`Gets character associated with number.`),args:[k(`table_number (number)`,A(`The number of the character to look up from the current Unicode table in decimal format.`))],compute:function(e){let t=Math.trunc(F(e,this.locale));return t<1?new M(A(`The table_number (%s) is out of range.`,t)):String.fromCharCode(t)},isExported:!0},NQ={description:A(`Remove non-printable characters from a piece of text.`),args:[k(`text (string)`,A(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=I(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},PQ={description:A(`Appends strings to one another.`),args:[k(`string (string, range<string>, repeating)`,A(`String to append in sequence.`))],compute:function(...e){return so(e,(e,t)=>e+I(t),``)},isExported:!0},FQ={description:A(`Tests whether two strings are identical.`),args:[k(`string1 (string)`,A(`The first string to compare.`)),k(`string2 (string)`,A(`The second string to compare.`))],compute:function(e,t){return I(e)===I(t)},isExported:!0},IQ={description:A(`First position of string found in text, case-sensitive.`),args:[k(`search_for (string)`,A(`The string to look for within text_to_search.`)),k(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),k(`starting_at (number, default=1)`,A(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e),i=I(t),a=F(n,this.locale);if(i===``)return new M(A(`The text_to_search must be non-empty.`));if(a<1)return new M(A(`The starting_at (%s) must be greater than or equal to 1.`,a));let o=i.indexOf(r,a-1);return o===-1?new M(A(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)):o+1},isExported:!0},LQ={description:A(`Apply a large number format`),args:[k(`value (number)`,A(`The number.`)),k(`unit (string, optional)`,A(`The formatting unit. Use 'k', 'm', or 'b' to force the unit`),[{value:`k`,label:A(`Thousand`)},{value:`m`,label:A(`Million`)},{value:`b`,label:A(`Billion`)}])],compute:function(e,t){return{value:F(e,this.locale),format:$l(e,t,this.locale)}}},RQ={description:A(`Concatenates elements of arrays with delimiter.`),args:[k(`delimiter (string)`,A(`The character or string to place between each concatenated value.`)),k(`value_or_array (string, range<string>, repeating)`,A(`Value to be appended using delimiter.`))],compute:function(e,...t){let n=I(e);return so(t,(e,t)=>(e?e+n:``)+I(t),``)}},zQ={description:A(`Substring from beginning of specified string.`),args:[k(`text (string)`,A(`The string from which the left portion will be returned.`)),k(`number_of_characters (number, optional)`,A(`The number of characters to return from the left side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;return n<0?new M(A(`The number_of_characters (%s) must be positive or null.`,n)):I(e).substring(0,n)},isExported:!0},BQ={description:A(`Length of a string.`),args:[k(`text (string)`,A(`The string whose length will be returned.`))],compute:function(e){return I(e).length},isExported:!0},VQ={description:A(`Converts a specified string to lowercase.`),args:[k(`text (string)`,A(`The string to convert to lowercase.`))],compute:function(e){return I(e).toLowerCase()},isExported:!0},HQ={description:A(`A segment of a string.`),args:[k(`text (string)`,A(`The string to extract a segment from.`)),k(`starting_at (number)`,A(`The index from the left of string from which to begin extracting. The first character in string has the index 1.`)),k(`extract_length (number)`,A(`The length of the segment to extract.`))],compute:function(e,t,n){let r=I(e),i=F(t,this.locale),a=F(n,this.locale);return i<1?new M(A(`The starting_at argument (%s) must be positive greater than one.`,i.toString())):a<0?new M(A(`The extract_length argument (%s) must be positive or null.`,a)):r.slice(i-1,i+a-1)},isExported:!0},UQ={description:A(`Capitalizes each word in a specified string.`),args:[k(`text_to_capitalize (string)`,A(`The text which will be returned with the first letter of each word in uppercase and all other letters in lowercase.`))],compute:function(e){return I(e).replace(kQ,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},WQ={description:A(`Checks whether a string matches the supplied regular expression.`),args:[k(`text (string)`,A(`The string to test.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n={value:0}){let r=I(e),i=I(t),a=F(n,this.locale);if(i===``)return!0;if(r===``)return!1;if(a!==0&&a!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,a));let o=a===1?`gi`:`g`,s;try{s=new RegExp(i,o)}catch{return new M(A(`Invalid regular expression`))}return s.test(r)},isExported:!0},GQ={description:A(`Extract text from a string based on the supplied regular expression.`),args:[k(`text (string)`,A(`The string on which you want to extract text.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`return_mode (number, default=0)`,A(`0 = first match, 1 = all matches as an array, 2 = capturing groups from the first match as an array.`),[{value:0,label:A(`First match`)},{value:1,label:A(`All matches`)},{value:2,label:A(`Capture groups of first match`)}]),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n={value:0},r={value:0}){let i=I(e),a=I(t),o=F(n,this.locale),s=F(r,this.locale);if(i===``||a===``)return{value:``};if(o<0||o>2)return new M(A(`The return_mode (%s) must be 0, 1 or 2.`,o));if(s!==0&&s!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,s));let c=s===1?`gi`:`g`,l;try{l=new RegExp(a,c)}catch{return new M(A(`Invalid regular expression`))}let u=[...i.matchAll(l)];return u.length===0?{value:j.NotAvailable,message:A(`No matches found.`)}:o===0?u[0][0]:o===1?u.map(e=>[e[0]]):u[0].length<2?new M(A(`No capturing groups found.`)):u[0].slice(1).map(e=>[e])},isExported:!0},KQ={description:A(`Replace text in a string based on the supplied regular expression.`),args:[k(`text (string)`,A(`The string in which you want to replace text.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`replacement (string)`,A(`The text to use as the replacement.`)),k(`occurrence (number, default=0)`,A(`0 = replace all matches. A negative number counts from the end.`)),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n,r={value:0},i={value:0}){let a=I(e),o=I(t),s=I(n),c=F(r,this.locale),l=F(i,this.locale);if(l!==0&&l!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,l));let u=l===1?`gi`:`g`,d;try{d=new RegExp(o,u)}catch{return new M(A(`Invalid regular expression`))}if(c!==0){let e=[...a.matchAll(d)];if(e.length===0||Math.abs(c)>e.length)return a;let t=c>0?c-1:e.length+c,n=e[t][0].length,r=e[t].index;return a.substring(0,r)+s+a.substring(r+n)}return a.replace(d,s)},isExported:!0},qQ={description:A(`Replaces part of a text string with different text.`),args:[k(`text (string)`,A(`The text, a part of which will be replaced.`)),k(`position (number)`,A(`The position where the replacement will begin (starting from 1).`)),k(`length (number)`,A(`The number of characters in the text to be replaced.`)),k(`new_text (string)`,A(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=F(t,this.locale);if(i<1)return new M(A(`The position (%s) must be greater than or equal to 1.`,i));let a=I(e),o=F(n,this.locale),s=I(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},JQ={description:A(`A substring from the end of a specified string.`),args:[k(`text (string)`,A(`The string from which the right portion will be returned.`)),k(`number_of_characters (number, optional)`,A(`The number of characters to return from the right side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;if(n<0)return new M(A(`The number_of_characters (%s) must be positive or null.`,n));let r=I(e),i=r.length;return r.substring(i-n,i)},isExported:!0},YQ={description:A(`First position of string found in text, ignoring case.`),args:[k(`search_for (string)`,A(`The string to look for within text_to_search.`)),k(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),k(`starting_at (number, default=1)`,A(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e).toLowerCase(),i=I(t).toLowerCase(),a=F(n,this.locale);if(i===``)return{value:j.GenericError,message:A(`The text_to_search must be non-empty.`)};if(a<1)return{value:j.GenericError,message:A(`The starting_at (%s) must be greater than or equal to 1.`,a)};let o=i.indexOf(r,a-1);return o===-1?{value:j.GenericError,message:A(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)}:{value:o+1}},isExported:!0},XQ={description:A(`Split text by specific character delimiter(s).`),args:[k(`text (string)`,A(`The text to divide.`)),k(`delimiter (string)`,A(`The character or characters to use to split text.`)),k(`split_by_each (boolean, default=true})`,A(`Whether or not to divide text around each character contained in delimiter.`)),k(`remove_empty_text (boolean, default=true)`,A(`Whether or not to remove empty text messages from the split results. The default behavior is to treat consecutive delimiters as one (if TRUE). If FALSE, empty cells values are added between consecutive delimiters.`))],compute:function(e,t,n={value:!0},r={value:!0}){let i=I(e),a=Qe(I(t)),o=L(n),s=L(r);if(a.length<=0)return new M(A(`The delimiter (%s) must be not be empty.`,a));let c=o?RegExp(`[${a}]`,`g`):new RegExp(a,`g`),l=i.split(c);return s&&(l=l.filter(e=>e!==``)),mo([l])},isExported:!1},ZQ={description:A(`Replaces existing text with new text in a string.`),args:[k(`text_to_search (string)`,A(`The text within which to search and replace.`)),k(`search_for (string)`,A(`The string to search for within text_to_search.`)),k(`replace_with (string)`,A(`The string that will replace search_for.`)),k(`occurrence_number (number, optional)`,A(`The instance of search_for within text_to_search to replace with replace_with. By default, all occurrences of search_for are replaced; however, if occurrence_number is specified, only the indicated instance of search_for is replaced.`))],compute:function(e,t,n,r){let i=F(r,this.locale);if(i<0)return new M(A(`The occurrenceNumber (%s) must be positive or null.`,i));let a=I(e),o=I(t);if(o===``)return a;let s=I(n),c=new RegExp(Qe(o),`g`);if(i===0)return a.replace(c,s);let l=0;return a.replace(c,e=>++l===i?s:e)},isExported:!0},QQ={description:A(`Combines text from multiple strings and/or arrays.`),args:[k(`delimiter (string)`,A(`A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),k(`ignore_empty (boolean)`,A(`A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result.`),[{value:!0,label:A(`Ignore empty cells`)},{value:!1,label:A(`Include empty cells (default)`)}]),k(`texts (string, range<string>, repeating)`,A(`Text item to join.`))],compute:function(e,t={value:!0},...n){let r=I(e),i=L(t),a=0;return so(n,(e,t)=>i&&I(t)===``?e:(a++?e+r:``)+I(t),``)},isExported:!0},$Q={description:A(`Splits text into rows or columns using specified column and row delimiters.`),args:[k(`text (string)`,A(`The text to split.`)),k(`col_delimiter (string, range<string>)`,A(`Character or string to split columns by.`)),k(`row_delimiter (string, range<string>, optional)`,A(`Character or string to split rows by.`)),k(`ignore_empty (boolean, default=false)`,A(`Whether to ignore empty cells.`),[{value:!1,label:A(`Include empty cells (default)`)},{value:!0,label:A(`Ignore empty cells`)}]),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`pad_with (string, default="${j.NotAvailable}")`,A(`The value to use for padding empty cells.`))],compute:function(e,t,n,r={value:!1},i={value:0},a=new Bi){let o=I(e);if(o.length<=0)return new M(A(`No text to split.`));if(t===void 0&&n===void 0)return new M(A(`At least one delimiter must be provided.`));let s=R(t).flat().map(e=>Qe(I(e))),c=R(n).flat().map(e=>Qe(I(e)));if(s.some(e=>e===``)||c.some(e=>e===``))return new M(A(`The delimiters cannot be empty values.`));let l=L(r),u=F(i,this.locale);if(![0,1].includes(u))return new M(A(`match_mode should be a value of 0 or 1.`));let d=[],f=u===1?`gi`:`g`,p=c.filter(e=>!s.includes(e)),m=p.length?o.split(new RegExp(p.join(`|`),f)):[o];l&&(m=m.filter(e=>e!==``));let h=new RegExp(s.join(`|`),f);for(let e of m){let t=s.length?e.split(h):[e];l&&(t=t.filter(e=>e!==``)),d.push(t.map(e=>({value:e})))}let g=Math.max(...d.map(e=>e.length));for(let e of d)for(;e.length<g;)e.push(a);return mo(d)},isExported:!0},e$={description:A(`Removes space characters.`),args:[k(`text (string)`,A(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return zt(I(e))},isExported:!0},t$={description:A(`Converts a specified string to uppercase.`),args:[k(`text (string)`,A(`The string to convert to uppercase.`))],compute:function(e){return I(e).toUpperCase()},isExported:!0},n$={description:A(`Converts a number to text according to a specified format.`),args:[k(`number (number)`,A(`The number, date or time to format.`)),k(`format (string)`,A(`The case-sensitive format of the result, enclosed in quotation marks. Examples: "0.00" rounded to 2 decimal places, "hh:mm:ss" for hour:minutes:seconds.`))],compute:function(e,t){return H(F(e,this.locale),{format:I(t),locale:this.locale})},isExported:!0},r$={description:A(`Converts a string to a numeric value.`),args:[k(`value (number)`,A(`the string to be converted`))],compute:function(e){return F(e,this.locale)},isExported:!0},i$={description:A(`Returns text that occurs after a given substring or delimiter.`),args:[k(`text (string)`,A(`The source text.`)),k(`delimiter (string)`,A(`The substring after which text will be returned.`)),k(`instance_num (number, default=1)`,A(`The desired instance of the delimiter after which we extract the text. A negative number searches from the end.`)),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`match_end (number, default=0))`,A(`Whether to treat the end of text as a delimiter.`),jQ),k(`if_not_found (string, default="${j.NotAvailable}")`,A(`Value to return if the delimiter is not found.`))],compute:function(e,t,n={value:1},r={value:0},i={value:0},a=new Bi){let o=I(e),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(s===0)return new M(A(`The instance_num (%s) must not be zero.`,s));if(c!==0&&c!==1)return new M(A(`match_mode should have a value of 0 or 1.`));if(l!==0&&l!==1)return new M(A(`match_end should have a value of 0 or 1.`));let u=I(t);if(u===``)return Math.sign(s)>0?{value:o}:{value:``};let d=c===1?`gi`:`g`,f=Qe(u),p=new RegExp(f,d),m=[...o.matchAll(p)].map(e=>e.index+f.length);if(s<0&&(m=m.reverse()),l&&Math.abs(s)===m.length+1)return Math.sign(s)>0?{value:``}:{value:o};let h=m[Math.abs(s)-1];return h===void 0?a:{value:o.substring(h)}},isExported:!0},a$={description:A(`Returns text that occurs before a given substring or delimiter.`),args:[k(`text (string)`,A(`The source text.`)),k(`delimiter (string)`,A(`The substring after which text will be returned.`)),k(`instance_num (number, default=1)`,A(`The desired instance of the delimiter before which we extract the text. A negative number searches from the end.`)),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`match_end (number, default=0))`,A(`Whether to match a delimiter against the end of the text.`),jQ),k(`if_not_found (string, default="${j.NotAvailable}")`,A(`Value to return if the delimiter is not found.`))],compute:function(e,t,n={value:1},r={value:0},i={value:0},a=new Bi){let o=I(e),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(s===0)return new M(A(`The instance_num (%s) must not be zero.`,s));if(c!==0&&c!==1)return new M(A(`match_mode should have a value of 0 or 1.`));if(l!==0&&l!==1)return new M(A(`match_end should have a value of 0 or 1.`));let u=I(t);if(u===``)return Math.sign(s)>0?{value:``}:{value:o};let d=c===1?`gi`:`g`,f=Qe(u),p=new RegExp(f,d),m=[...o.matchAll(p)].map(e=>e.index+f.length);if(s<0&&(m=m.reverse()),l&&Math.abs(s)===m.length+1)return Math.sign(s)>0?{value:o}:{value:``};let h=m[Math.abs(s)-1];return h===void 0?a:{value:o.substring(0,h-u.length)}},isExported:!0};var o$=l({HYPERLINK:()=>s$});let s$={description:A(`Creates a hyperlink in a cell.`),args:[k(`url (string)`,A(`The full URL of the link enclosed in quotation marks.`)),k(`link_label (string, optional)`,A(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=I(e).trim(),r=I(t)||n;return n===``?r:dt(r,n)},isExported:!0},c$=[{name:A(`Array`),functions:wW},{name:A(`Database`),functions:kq},{name:A(`Date`),functions:GJ},{name:A(`Filter`),functions:kY},{name:A(`Financial`),functions:FY},{name:A(`Info`),functions:WX},{name:A(`Lookup`),functions:yZ},{name:A(`Logical`),functions:rZ},{name:A(`Math`),functions:eG},{name:A(`Operator`),functions:UZ},{name:A(`Statistical`),functions:gK},{name:A(`Text`),functions:OQ},{name:A(`Engineering`),functions:DY},{name:A(`Web`),functions:o$},{name:A(`Parser`),functions:EQ}];for(let e of c$){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),Ro.add(n,{isExported:!1,...r})}}let l$={},u$={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,DESKTOP_BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},d$={autoCompleteProviders:uT,autofillModifiersRegistry:eR,autofillRulesRegistry:tR,cellMenuRegistry:FP,colMenuRegistry:JP,errorTypes:Ii,functionRegistry:Ro,featurePluginRegistry:Kz,iconsOnCellRegistry:kL,statefulUIPluginRegistry:qz,coreViewsPluginRegistry:Jz,corePluginRegistry:Gz,rowMenuRegistry:tF,sidePanelRegistry:rN,figureRegistry:Ny,chartSidePanelComponentRegistry:ck,chartDataSourceSidePanelComponentRegistry:$D,chartComponentRegistry:oy,chartTypeRegistry:dS,chartSubtypeRegistry:Gv,chartDataSourceRegistry:uS,topbarMenuRegistry:IB,topbarComponentRegistry:nV,clickableCellRegistry:tB,otRegistry:wR,inverseCommandRegistry:iB,urlRegistry:Mu,cellPopoverRegistry:xw,numberFormatMenuRegistry:SB,repeatLocalCommandTransformRegistry:gz,repeatCommandTransformRegistry:hz,clipboardHandlersRegistries:GF,pivotRegistry:Xj,pivotTimeAdapterRegistry:ng,pivotSidePanelRegistry:uM,pivotNormalizationValueRegistry:Pg,supportedPivotPositionalFormulaRegistry:CI,pivotToFunctionValueRegistry:Fg,migrationStepRegistry:qC,chartJsExtensionRegistry:Vd},f$={arg:k,isEvaluationError:P,toBoolean:L,toJsDate:to,toNumber:F,toString:I,toNormalizedPivotValue:Ag,toFunctionPivotValue:Mg,toXC:E,toZone:bn,toUnboundedZone:yn,toCartesian:cn,numberToLetters:Qt,lettersToNumber:$t,UuidGenerator:Bd,formatValue:H,createCurrencyFormat:Kl,ColorGenerator:di,computeTextWidth:Sd,createEmptyWorkbookData:pw,createEmptySheet:fw,createEmptyExcelSheet:mw,rgbaToHex:Vr,colorToRGBA:Hr,positionToZone:D,isDefined:w,isMatrix:Je,lazy:St,genericRepeat:tV,createAction:h,createActions:p,transformRangeData:lr,deepEquals:T,overlap:Pn,union:An,isInside:In,deepCopy:x,expandZoneOnInsertion:En,reduceZoneOnDeletion:kn,unquote:tt,getMaxObjectId:Sg,getFirstPivotFunction:tM,getNumberOfPivotFunctions:nM,parseDimension:Tg,isDateOrDatetimeField:Eg,makeFieldProposal:rM,periodYearToComparable:tg,insertTokenAfterArgSeparator:aM,insertTokenAfterLeftParenthesis:oM,mergeContiguousZones:or,getPivotHighlights:nj,pivotTimeAdapter:rg,UNDO_REDO_PIVOT_COMMANDS:KL,createPivotFormula:kg,areDomainArgsFieldsValid:Og,splitReference:Qo,sanitizeSheetName:rt,getUniqueText:qt,isNumber:Ia,isDateTime:ia,createCustomFields:Vg,schemeToColorScale:Hh,isDateTimeFormat:zl,jsDateToNumber:va,numberToJsDate:ga,DateTime:N,parseFormat:ll,isFormula:Jt,domainToColRowDomain:bj,collapseHierarchicalDisplayName:qg},p$={isMarkdownLink:lt,parseMarkdownLink:ft,markdownLink:dt,openLink:Lu,urlRepresentation:Iu},m$={Checkbox:VT,Section:Q,Select:Oy,RoundColorPicker:ET,ChartDataSeries:tO,ChartErrorSection:aO,ChartLabelRange:nO,ChartRangeDataSourceComponent:CO,ChartTitle:dO,ChartPanel:fk,ChartFigure:jy,ChartJsComponent:qp,ClickableCellSortIcon:wI,ZoomableChartJsComponent:Qv,Grid:SI,GridOverlay:ZF,ScorecardChart:Bm,GaugeChartComponent:iy,LineConfigPanel:qO,BarConfigPanel:sO,PieChartDesignPanel:XO,GenericChartConfigPanel:oO,ChartWithAxisDesignPanel:bO,GenericZoomableChartDesignPanel:xO,LineChartDesignPanel:JO,GaugeChartConfigPanel:VO,GaugeChartDesignPanel:HO,ScorecardChartConfigPanel:$O,ScorecardChartDesignPanel:ek,GeoChartDesignPanel:GO,RadarChartDesignPanel:ZO,WaterfallChartDesignPanel:sk,ComboChartDesignPanel:RO,FunnelChartDesignPanel:BO,SunburstChartDesignPanel:tk,TreeMapChartDesignPanel:ok,ChartTypePicker:uk,FigureComponent:Py,MenuPopover:Dy,Popover:Cy,SelectionInput:FT,ValidationMessages:iO,AddDimensionButton:sj,PivotDimensionGranularity:lj,PivotDimensionOrder:uj,PivotDimension:cj,PivotLayoutConfigurator:mj,PivotHTMLRenderer:EI,PivotDeferUpdate:ij,PivotTitleSection:hj,CogWheelMenu:ZD,TextInput:GD,SidePanelCollapsible:Ow,RadioSelection:pO,GeoChartRegionSelectSection:UO,ChartDashboardMenu:ky,FullScreenFigure:TI,NumberInput:cO,TopBar:JV,Composer:Qw},h$={useDragAndDropListItems:OT,useHighlights:gk,useHighlightsOnHover:hk},g$={useStoreProvider:hr,DependencyContainer:dr,CellPopoverStore:Sw,ComposerFocusStore:Dr,CellComposerStore:jF,FindAndReplaceStore:Lk,HighlightStore:fT,DelayedHoveredCellStore:Fy,HoveredTableStore:JF,ModelStore:br,NotificationStore:pT,RendererStore:wr,SelectionInputStore:PT,SpreadsheetStore:Tr,useStore:O,useLocalStore:gr,SidePanelStore:aN,PivotSidePanelStore:cM,PivotMeasureDisplayPanelStore:ej,ClientFocusStore:rF,GridRenderer:aI};function _$(e,t){return Ro.add(e,t),{addFunction:(e,t)=>_$(e,t)}}let v$={DEFAULT_LOCALE:z,HIGHLIGHT_COLOR:ee,PIVOT_STATIC_TABLE_CONFIG:Be,PIVOT_INSERT_TABLE_STYLE_ID:Ve,ChartTerms:Ly,FIGURE_ID_SPLITTER:`??`,GRID_ICON_EDGE_LENGTH:17,GRID_ICON_MARGIN:2,CHART_TYPES:Vh},y$={...Pv,...yv};e.AbstractCellClipboardHandler=XL,e.AbstractChart=Jp,e.AbstractFigureClipboardHandler=mW,e.CellErrorType=j,e.ClientDisconnectedError=oz,e.CommandResult=U,e.CompiledFormula=Hc,e.CorePlugin=OI,e.CoreViewPlugin=nL,e.DEFAULT_LOCALE=z,e.DEFAULT_LOCALES=zo,e.DispatchResult=ku,e.EvaluationError=M,e.LocalTransportService=rV,e.Model=tW,e.PivotRuntimeDefinition=gj,e.Registry=B,e.Revision=az,e.SPREADSHEET_DIMENSIONS=u$,e.Spreadsheet=ZV,e.SpreadsheetPivotTable=Lj,e.UIPlugin=QL,e.__info__=l$,e.addFunction=_$,e.addRenderingLayer=Cr,e.astToFormula=DF,e.canExecuteInReadonly=Ou,e.categories=c$,e.chartHelpers=y$,e.components=m$,e.constants=v$,e.convertAstNodes=Js,e.coreTypes=Eu,e.createAutocompleteArgumentsProvider=Yz,e.findCellInNewZone=qn,e.functionCache=Bc,e.getCaretDownSvg=wb,e.getCaretUpSvg=Tb,e.helpers=f$,e.hooks=h$,e.invalidateCFEvaluationCommands=xu,e.invalidateChartEvaluationCommands=yu,e.invalidateDependenciesCommands=bu,e.invalidateEvaluationCommands=vu,e.isCoreCommand=Du,e.isSheetDependent=fu,e.iterateAstNodes=Ys,e.links=p$,e.load=QC,e.lockedSheetAllowedCommands=Tu,e.parse=Ks,e.parseTokens=qs,e.readonlyAllowedCommands=wu,e.registries=d$,e.setDefaultSheetViewSize=Re,e.setTranslationMethod=Ni,e.stores=g$,e.tokenColors=Ke,e.tokenize=us,l$.version=`19.3.2`,l$.date=`2026-05-11T13:52:24.823Z`,l$.hash=`14395f7`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
958
+ `),`_rels/.rels`)}function QU(e){let t={},n=[];for(let r of e.sheets){let e=r.name.slice(0,31);e=qt(e,n,{compute:(e,t)=>e.slice(0,31-String(t).length)+t}),n.push(e),e!==r.name&&(t[r.name]=e,r.name=e)}if(!Object.keys(t).length)return e;let r=Object.keys(t).sort((e,t)=>t.length-e.length),i=JSON.stringify(e);for(let e of r){let n=RegExp(`'?${Qe(e)}'?!`,`g`);i=i.replaceAll(n,n=>{let r=t[e];return n.replace(e,r)})}return JSON.parse(i)}function $U(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>Rn(bn(e.range)).numberOfRows>1);return e}var eW=function(e){return e[e.Ready=0]=`Ready`,e[e.Running=1]=`Running`,e[e.RunningCore=2]=`RunningCore`,e[e.Finalizing=3]=`Finalizing`,e}(eW||{}),tW=class e extends ur{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=eW.Ready;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},t={},n=[],r=new Bd,i=!1){let a=performance.now();console.debug(`##### Model creation #####`),super(),Pi(),n=ow(e,n);let o=QC(e,i);this.state=new pH,this.uuidGenerator=r,this.config=this.setupConfig(t),this.getters={isReadonly:()=>this.config.mode===`readonly`||this.config.mode===`dashboard`,isDashboard:()=>this.config.mode===`dashboard`},this.session=this.setupSession(o.revisionId),this.coreGetters={},this.range=new uH(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeData=this.range.getRangeData.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.coreGetters.copyFormulaStringForSheet=this.range.copyFormulaStringForSheet.bind(this.range),this.selection=new fH(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.coreViewPluginConfig=this.setupCoreViewPluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Gz.getAll())this.setupCorePlugin(e,o);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(n);for(let e of Jz.getAll()){let t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of qz.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of Kz.getAll()){let t=this.setupUiPlugin(e);this.handlers.push(t),this.uiHandlers.push(t)}if(this.config.mode!==`export_verification`&&(this.dispatch(`START`),this.selection.observe(this,{handleEvent:()=>this.trigger(`update`)}),this.setupSessionEvents(),this.joinSession(),t.snapshotRequested||e[`[Content_Types].xml`]&&!this.getters.isReadonly())){let e=performance.now();console.debug(`Snapshot requested`),this.session.snapshot(this.exportData()),console.debug(`Snapshot taken in`,performance.now()-e,`ms`)}console.debug(`Model created in`,performance.now()-a,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession(){let e=this.getters.isReadonly()?void 0:St(()=>this.exportData());await this.session.leave(e)}setupUiPlugin(e){let t=new e(this.uiPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}for(let n of e.layers)this.renderers[n]||(this.renderers[n]=[]),this.renderers[n].push(t);return t}setupCoreViewPlugin(e){let t=new e(this.coreViewPluginConfig);for(let n of e.getters){if(!(n in t))throw Error(`Invalid getter name: ${n} for plugin ${t.constructor}`);if(n in this.getters)throw Error(`Getter "${n}" is already defined.`);this.getters[n]=t[n].bind(t)}return t}setupCorePlugin(e,t){let n=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in n))throw Error(`Invalid getter name: ${t} for plugin ${n.constructor}`);if(t in this.coreGetters)throw Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=n[t].bind(n)}n.import(t),this.corePlugins.push(n),this.coreHandlers.push(n),this.handlers.push(n)}onRemoteRevisionReceived({commands:e}){for(let t of e){let e=this.status;this.status=eW.RunningCore,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new sz(sH({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{if(!this.checkDispatchAllowedRemoteCommand(e).isSuccessful){this.dispatchToHandlers(this.coreHandlers,{type:`UNDO`,commands:[e]});return}this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1}}),this.config.transportService,e,new QV(this.getters))}setupSessionEvents(){this.session.on(`remote-revision-received`,this,this.onRemoteRevisionReceived),this.session.on(`revision-undone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`UNDO`,{commands:e}),this.finalize()}),this.session.on(`revision-redone`,this,({commands:e})=>{this.dispatchFromCorePlugin(`REDO`,{commands:e}),this.finalize()}),this.session.on(`unexpected-revision-id`,this,()=>this.trigger(`unexpected-revision-id`)),this.session.on(`collaborative-event-received`,this,()=>{this.trigger(`update`)})}setupConfig(e){let t=e.client||{id:this.uuidGenerator.smallUuid(),name:A(`Anonymous`).toString()},n=e.transportService||new rV,r=e.mode===`readonly`||e.mode===`dashboard`||e.mode===`export_verification`;return{...e,mode:e.mode||`normal`,custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:r?new $V(n):n,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger(`notify-ui`,e),raiseBlockingErrorUI:e=>this.trigger(`raise-error-ui`,{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){let t=e.loadLocales||(()=>Promise.resolve(zo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,custom:this.config.custom,external:this.config.external}}setupCoreViewPluginConfig(){return{getters:this.getters,stateObserver:this.state,custom:this.config.custom,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrency:this.config.defaultCurrency,customColors:this.config.customColors||[],external:this.config.external}}checkDispatchAllowed(e){let t=Du(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return this.processCommandResults(t)}processCommandResults(e){return e.some(e=>e!==U.Success)?new ku(e.flat()):ku.Success}checkDispatchAllowedRemoteCommand(e){let t=this.coreHandlers.map(t=>t.allowDispatch(e));return this.processCommandResults(t)}checkDispatchAllowedCoreCommand(e){return this.handlers.map(t=>t.allowDispatch(e))}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map(t=>t.allowDispatch(e))}finalize(){this.status=eW.Finalizing;for(let e of this.handlers)e.finalize();this.status=eW.Ready,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(nW(e,t));dispatch=(e,t)=>{let n=nW(e,t),r=this.status;if(this.getters.isReadonly()&&!Ou(n))return new ku(U.Readonly);if(!this.session.canApplyOptimisticUpdate())return new ku(U.WaitingSessionConfirmation);switch(r){case eW.Ready:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),this.trigger(`command-rejected`,{command:n,result:t}),t;this.status=eW.Running;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Du(n)&&this.state.addCommand(n),this.dispatchToHandlers(this.handlers,n),this.finalize();let r=performance.now()-t;r>5&&console.debug(e,r,`ms`)});this.session.save(n,i,r),this.status=eW.Ready,this.trigger(`update`);break;case eW.Running:if(Du(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case eW.Finalizing:throw Error(`Cannot dispatch commands in the finalize state`);case eW.RunningCore:if(Du(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return ku.Success};dispatchFromCorePlugin=(e,t)=>{let n=nW(e,t),r=this.status;this.status=eW.RunningCore;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,ku.Success};dispatchToHandlers(e,t){let n=Du(t);for(let r of e)!n&&r instanceof OI||r.beforeHandle(t);for(let r of e)!n&&r instanceof OI||r.handle(t);this.trigger(`command-dispatched`,t)}drawLayer(e,t){let n=this.renderers[t];if(n)for(let r of n)e.ctx.save(),r.drawLayer(e,t),e.ctx.restore()}exportData(){let t=this._exportData(!0),n=this._exportData(!1),r={...this.config,mode:`export_verification`,client:{id:`exporter`,name:`exporter`},snapshotRequested:!1,transportService:new rV};return T(n,new e(x(t),r)._exportData(!1))?t:(n.isNotSquishable=!0,n)}_exportData(e){let t=pw();for(let n of this.handlers)n instanceof OI&&n.export(t,e);return t.revisionId=this.session.getRevisionId()||`START_REVISION`,t=x(t),t}updateMode(e){this.config.mode=e,this.trigger(`update`)}async exportXLSX(){this.dispatch(`EVALUATE_CELLS`);let e=hw();for(let t of this.handlers)t instanceof DI&&await t.exportForExcel(e);return e=x(e),UU(e)}};function nW(e,t={}){let n=x(t);return n.type=e,n}function rW(e){return!NO.includes(e.horizontalGroupBy)||!NO.includes(e.verticalGroupBy)?U.InvalidChartDefinition:U.Success}let iW={sequence:110,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`dataSetStyles`,`showValues`,`colorScale`,`missingValueColor`,`axesDesign`,`horizontalGroupBy`,`verticalGroupBy`,`legendPosition`],validateDefinition(e,t){return e.checkValidations(t,rW)},fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){let n=`left`;return e.legendPosition===`right`&&(n=`right`),{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},title:e.title||{text:``},type:`calendar`,showValues:e.showValues,axesDesign:e.axesDesign,legendPosition:n,horizontalGroupBy:`day_of_week`,verticalGroupBy:`month_number`}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n}){let r=i_(t,n(),e),{labels:i,datasets:a}=gp(t,r);return{chartJsConfig:{type:`calendar`,data:{labels:i,datasets:a},options:{...ah,indexAxis:`x`,layout:I_(t,r),scales:Zf(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:ov(t,r),chartShowValuesPlugin:X_(t,r),chartColorScalePlugin:Qf(t,r),background:{color:t.background}}}}}}},aW={sequence:15,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`aggregated`,`axesDesign`,`showValues`,`hideDataMarkers`,`zoomable`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t)}},getDefinitionFromContextCreation(e,t){let n=e.dataSetStyles??{};if(e.dataSource?.type===`range`){let t=e.dataSource?.dataSets?.[0]?.dataSetId;for(let r of e.dataSource?.dataSets||[])n[r.dataSetId]={...e.dataSetStyles?.[r.dataSetId]||{},type:r.dataSetId===t?`bar`:`line`}}return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:n,aggregated:e.aggregated,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`combo`,axesDesign:e.axesDesign,showValues:e.showValues,hideDataMarkers:e.hideDataMarkers,zoomable:e.zoomable,humanize:e.humanize}},getRuntime(e,t,{extractData:n},r,i){let a=t_(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:xp(t,a)},options:{...ah,layout:F_(t,a),scales:Xf(t,a),plugins:{title:tv(t,e),legend:H_(t,a),tooltip:av(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},oW={sequence:100,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`dataSetStyles`,`axesDesign`,`legendPosition`,`horizontal`,`aggregated`,`showValues`,`funnelColors`,`cumulative`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},aggregated:e.aggregated??!1,legendPosition:`none`,title:e.title||{text:``},type:`funnel`,showValues:e.showValues,axesDesign:e.axesDesign,funnelColors:e.funnelColors,horizontal:!0,cumulative:e.cumulative??!0,humanize:e.humanize}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n},r,i){let a=u_(t,n(),e);return{chartJsConfig:{type:`funnel`,data:{labels:a.labels,datasets:wp(t,a)},options:{...ah,indexAxis:`y`,layout:F_(t,a),scales:sp(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:pv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}}}}},sW={sequence:90,dataSeriesLimit:1,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`colorScale`,`missingValueColor`,`region`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`geo`,humanize:e.humanize}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractData:n},r,i){let a=l_(t,n(),e);return{chartJsConfig:{type:`choropleth`,data:{datasets:Cp(t,a)},options:{...ah,layout:F_(t,a),scales:op(t,a),plugins:{title:tv(t,e),tooltip:fv(t,a),legend:{display:!1},background:{color:t.background}},...i}}}}},cW={sequence:80,dataSeriesLimit:2,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`aggregated`,`axesDesign`,`stacked`,`horizontal`],fromStrDefinition:e=>({...e,horizontal:!0,stacked:!0}),toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`pyramid`,axesDesign:e.axesDesign,horizontal:!0,stacked:!0,showValues:e.showValues,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){if(t.dataSource.type!==`range`)return;let{dataSetsValues:i}=a_(t,OO(e,t.dataSource),e),a=Math.max(...i.map(e=>Math.max(...e.data.map(e=>W(e)?Math.abs(e.value):-1/0))));return{...t,horizontal:!0,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t),maxValue:a}},getRuntime(e,t,{extractData:n},r,i){let a=a_(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:hp(t,a)},options:{...ah,indexAxis:`y`,layout:F_(t,a),scales:ip(t,a),plugins:{title:tv(t,e),legend:R_(t,a),tooltip:uv(t,a),chartShowValuesPlugin:Q_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},lW={sequence:80,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`aggregated`,`stacked`,`fillArea`,`hideDataMarkers`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},stacked:e.stacked??!1,aggregated:e.aggregated??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`radar`,fillArea:e.fillArea??!1,showValues:e.showValues??!1,hideDataMarkers:e.hideDataMarkers,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r}},getRuntime(e,t,{extractData:n},r,i){let a=c_(t,n(),e);return{chartJsConfig:{type:`radar`,data:{labels:a.labels,datasets:Sp(t,a)},options:{...ah,layout:F_(t,a),scales:ap(t,a),plugins:{title:tv(t,e),legend:W_(t,a),tooltip:dv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},uW={sequence:60,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`labelsAsText`,`aggregated`,`axesDesign`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSource:t.fromContextCreation(e),dataSetStyles:e.dataSetStyles??{},labelsAsText:e.labelsAsText??!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`scatter`,aggregated:e.aggregated??!1,axesDesign:e.axesDesign,showValues:e.showValues,humanize:e.humanize}},getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:Vm(t.background||`#FFFFFF`),fontColor:Vm(Cf(t.background)),dataSets:n,labelRange:r,verticalAxis:kf(t)}},getRuntime(e,t,{extractData:n},r,i){let a=o_(t,n(),e);return{chartJsConfig:{type:`line`,data:{labels:a.labels,datasets:yp(t,a)},options:{...ah,layout:F_(t,a),scales:np(t,a),plugins:{title:tv(t,e),legend:V_(t,a),tooltip:sv(t,a),chartShowValuesPlugin:Y_(t,a),background:{color:t.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},dW={sequence:30,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`showLabels`,`valuesDesign`,`groupColors`,`pieHolePercentage`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSetStyles:e.dataSetStyles??{},dataSource:t.fromHierarchicalContextCreation(e),legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`sunburst`,showValues:e.showValues,showLabels:e.showLabels,valuesDesign:e.valuesDesign,groupColors:e.groupColors,humanize:e.humanize,pieHolePercentage:e.pieHolePercentage}},getContextCreation(e,t,n){return{...e,...t.getHierarchicalContextCreation(n)}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractHierarchicalData:n},r,i){let a=d_(t,n(),e);return{chartJsConfig:{type:`doughnut`,data:{datasets:Ep(t,a)},options:{cutout:t.pieHolePercentage===void 0?`25%`:`${t.pieHolePercentage}%`,...ah,layout:F_(t,a),plugins:{title:tv(t,e),legend:G_(t,a),tooltip:mv(t,a),sunburstLabelsPlugin:Z_(t,a),sunburstHoverPlugin:{enabled:!0},background:{color:t.background}},...i}}}}},fW={sequence:100,allowedDefinitionKeys:[...Jp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showHeaders`,`headerDesign`,`showLabels`,`valuesDesign`,`coloringOptions`,`showValues`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>U.Success,updateRanges:e=>e,getDefinitionFromContextCreation(e,t){return{background:e.background,dataSetStyles:e.dataSetStyles??{},dataSource:t.fromHierarchicalContextCreation(e),legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`treemap`,showValues:e.showValues,showHeaders:e.showHeaders,headerDesign:e.headerDesign,showLabels:e.showLabels,valuesDesign:e.valuesDesign,coloringOptions:e.treemapColoringOptions,humanize:e.humanize}},getContextCreation(e,t,n){return{...e,treemapColoringOptions:e.coloringOptions,...t.getHierarchicalContextCreation(n)}},getDefinitionForExcel:()=>void 0,getRuntime(e,t,{extractHierarchicalData:n},r,i){let a=d_(t,n(),e);return{chartJsConfig:{type:`treemap`,data:{labels:a.labels,datasets:jp(t,a)},options:{...ah,layout:F_(t,a),plugins:{title:tv(t,e),legend:{display:!1},tooltip:hv(t,a),background:{color:t.background}},...i}}}}};dS.add(`bar`,bv),dS.add(`combo`,aW),dS.add(`line`,jv),dS.add(`pie`,Mv),dS.add(`scorecard`,im),dS.add(`gauge`,Ev),dS.add(`scatter`,uW),dS.add(`waterfall`,Nv),dS.add(`pyramid`,cW),dS.add(`radar`,lW),dS.add(`geo`,sW),dS.add(`funnel`,oW),dS.add(`sunburst`,dW),dS.add(`treemap`,fW),dS.add(`calendar`,iW),Gv.add(`line`,{matcher:e=>e.type===`line`&&!e.stacked&&!e.fillArea,displayName:A(`Line`),chartType:`line`,chartSubtype:`line`,subtypeDefinition:{stacked:!1,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.LINE_CHART`}).add(`stacked_line`,{matcher:e=>e.type===`line`&&!e.fillArea&&!!e.stacked,displayName:A(`Stacked Line`),chartType:`line`,chartSubtype:`stacked_line`,subtypeDefinition:{stacked:!0,fillArea:!1},category:`line`,preview:`o-spreadsheet-ChartPreview.STACKED_LINE_CHART`}).add(`area`,{matcher:e=>e.type===`line`&&!e.stacked&&!!e.fillArea,displayName:A(`Area`),chartType:`line`,chartSubtype:`area`,subtypeDefinition:{stacked:!1,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.AREA_CHART`}).add(`stacked_area`,{matcher:e=>e.type===`line`&&e.stacked&&!!e.fillArea,displayName:A(`Stacked Area`),chartType:`line`,chartSubtype:`stacked_area`,subtypeDefinition:{stacked:!0,fillArea:!0},category:`area`,preview:`o-spreadsheet-ChartPreview.STACKED_AREA_CHART`}).add(`scatter`,{displayName:A(`Scatter`),chartType:`scatter`,chartSubtype:`scatter`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCATTER_CHART`}).add(`column`,{matcher:e=>e.type===`bar`&&!e.stacked&&!e.horizontal,displayName:A(`Column`),chartType:`bar`,chartSubtype:`column`,subtypeDefinition:{stacked:!1,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.COLUMN_CHART`}).add(`stacked_column`,{matcher:e=>e.type===`bar`&&e.stacked&&!e.horizontal,displayName:A(`Stacked Column`),chartType:`bar`,chartSubtype:`stacked_column`,subtypeDefinition:{stacked:!0,horizontal:!1},category:`column`,preview:`o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART`}).add(`bar`,{matcher:e=>e.type===`bar`&&!e.stacked&&!!e.horizontal,displayName:A(`Bar`),chartType:`bar`,chartSubtype:`bar`,subtypeDefinition:{horizontal:!0,stacked:!1},category:`bar`,preview:`o-spreadsheet-ChartPreview.BAR_CHART`}).add(`stacked_bar`,{matcher:e=>e.type===`bar`&&e.stacked&&!!e.horizontal,displayName:A(`Stacked Bar`),chartType:`bar`,chartSubtype:`stacked_bar`,subtypeDefinition:{horizontal:!0,stacked:!0},category:`bar`,preview:`o-spreadsheet-ChartPreview.STACKED_BAR_CHART`}).add(`combo`,{displayName:A(`Combo`),chartSubtype:`combo`,chartType:`combo`,category:`line`,preview:`o-spreadsheet-ChartPreview.COMBO_CHART`}).add(`pie`,{matcher:e=>e.type===`pie`&&!e.isDoughnut,displayName:A(`Pie`),chartSubtype:`pie`,chartType:`pie`,subtypeDefinition:{isDoughnut:!1},category:`pie`,preview:`o-spreadsheet-ChartPreview.PIE_CHART`}).add(`doughnut`,{matcher:e=>e.type===`pie`&&!!e.isDoughnut,displayName:A(`Doughnut`),chartSubtype:`doughnut`,chartType:`pie`,subtypeDefinition:{isDoughnut:!0},category:`pie`,preview:`o-spreadsheet-ChartPreview.DOUGHNUT_CHART`}).add(`gauge`,{displayName:A(`Gauge`),chartSubtype:`gauge`,chartType:`gauge`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GAUGE_CHART`}).add(`scorecard`,{displayName:A(`Scorecard`),chartSubtype:`scorecard`,chartType:`scorecard`,category:`misc`,preview:`o-spreadsheet-ChartPreview.SCORECARD_CHART`}).add(`waterfall`,{displayName:A(`Waterfall`),chartSubtype:`waterfall`,chartType:`waterfall`,category:`misc`,preview:`o-spreadsheet-ChartPreview.WATERFALL_CHART`}).add(`pyramid`,{displayName:A(`Population Pyramid`),chartSubtype:`pyramid`,chartType:`pyramid`,category:`misc`,preview:`o-spreadsheet-ChartPreview.POPULATION_PYRAMID_CHART`}).add(`radar`,{matcher:e=>e.type===`radar`&&!e.fillArea,displayName:A(`Radar`),chartSubtype:`radar`,chartType:`radar`,subtypeDefinition:{fillArea:!1},category:`misc`,preview:`o-spreadsheet-ChartPreview.RADAR_CHART`}).add(`filled_radar`,{matcher:e=>e.type===`radar`&&!!e.fillArea,displayName:A(`Filled Radar`),chartType:`radar`,chartSubtype:`filled_radar`,subtypeDefinition:{fillArea:!0},category:`misc`,preview:`o-spreadsheet-ChartPreview.FILLED_RADAR_CHART`}).add(`geo`,{displayName:A(`Geo Chart`),chartSubtype:`geo`,chartType:`geo`,category:`misc`,preview:`o-spreadsheet-ChartPreview.GEO_CHART`}).add(`funnel`,{displayName:A(`Funnel`),chartSubtype:`funnel`,chartType:`funnel`,category:`misc`,preview:`o-spreadsheet-ChartPreview.FUNNEL_CHART`}).add(`sunburst`,{matcher:e=>e.type===`sunburst`,displayName:A(`Sunburst`),chartSubtype:`sunburst`,chartType:`sunburst`,category:`hierarchical`,preview:`o-spreadsheet-ChartPreview.SUNBURST_CHART`}).add(`treemap`,{matcher:e=>e.type===`treemap`,displayName:A(`Tree Map`),chartType:`treemap`,chartSubtype:`treemap`,category:`hierarchical`,preview:`o-spreadsheet-ChartPreview.TREE_MAP_CHART`}).add(`calendar`,{displayName:A(`Calendar`),chartSubtype:`calendar`,chartType:`calendar`,category:`misc`,preview:`o-spreadsheet-ChartPreview.CALENDAR_CHART`});var pW=class extends XL{queuedBordersToAdd={};copy(e){let t=e.sheetId;if(e.zones.length===0)return;let{rowsIndexes:n,columnsIndexes:r}=e,i=[];for(let e of n){let n=[];for(let i of r){let r={col:i,row:e,sheetId:t};n.push(this.getters.getCellBorder(r))}i.push(n)}return{borders:i}}paste(e,t,n){let r=e.sheetId;if(n.pasteOption===`asValue`)return;let i=e.zones;if(!n.isCutOperation)this.pasteFromCopy(r,i,t.borders);else{let{left:e,top:n}=i[0];this.pasteZone(r,e,n,t.borders)}this.executeQueuedChanges(r)}pasteZone(e,t,n,r){for(let[i,a]of r.entries())for(let[r,o]of a.entries()){let a={col:t+r,row:n+i,sheetId:e};this.pasteBorder(o,a)}}pasteBorder(e,t){let n={...this.getters.getCellBorder(t),...e},r=JSON.stringify(n);this.queuedBordersToAdd[r]||(this.queuedBordersToAdd[r]=[]),this.queuedBordersToAdd[r].push(D(t))}executeQueuedChanges(e){for(let t in this.queuedBordersToAdd){let n=this.queuedBordersToAdd[t],r=JSON.parse(t),i=ln(n,[]);this.dispatch(`SET_BORDERS_ON_TARGET`,{sheetId:e,target:i,border:r})}this.queuedBordersToAdd={}}},mW=class extends YL{copy(e){}},hW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);if(n.tag!==`carousel`)return;let r={...n},i=this.getters.getCarousel(e.figureId),a={};for(let e of i.items)if(e.type===`chart`){let t=this.getters.getChart(e.chartId);if(!t)throw Error(`No chart for the given id: ${e.chartId}`);a[e.chartId]=t}return{figureId:e.figureId,copiedFigure:r,copiedCarousel:i,copiedCharts:a,copiedSheetId:t}}getPasteTarget(e){return{zones:[],figureId:new Bd().smallUuid(),sheetId:e}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=e.sheetId,{width:o,height:s}=t.copiedFigure,c=this.getters.getMaxAnchorOffset(a,s,o),{left:l,top:u}=r[0],d={x:0,y:0};l>c.col&&(l=c.col,d.x=c.offset.x),u>c.row&&(u=c.row,d.y=c.offset.y),this.dispatch(`CREATE_CAROUSEL`,{figureId:i,sheetId:a,definition:{items:[]},col:l,row:u,offset:d,size:{height:s,width:o}});let f=new Bd,p=x(t.copiedCarousel.items);for(let e of p){if(e.type!==`chart`)continue;let n=t.copiedCharts[e.chartId],r=f.smallUuid(),o=wO.fromDefinition(this.getters,a,n.copyInSheetId(a)).getDefinition();this.dispatch(`CREATE_CHART`,{figureId:i,chartId:r,sheetId:a,definition:o}),e.chartId=r}this.dispatch(`UPDATE_CAROUSEL`,{sheetId:a,figureId:i,definition:{...t.copiedCarousel,items:p}}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.copiedSheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},gW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);if(n.tag!==`chart`)return;let r={...n},i=this.getters.getChartFromFigureId(e.figureId);if(!i)throw Error(`No chart for the given id: ${e.figureId}`);let a=i;return{figureId:e.figureId,copiedFigure:r,copiedChart:a}}getPasteTarget(e,t,n,r){return{zones:[],figureId:new Bd().smallUuid(),sheetId:e}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=e.sheetId,{width:o,height:s}=t.copiedFigure,c=t.copiedChart,l=wO.fromDefinition(this.getters,a,c.copyInSheetId(a)).getDefinition();l=wO.fromStrDefinition(this.getters,a,l).getDefinition();let u=this.getters.getMaxAnchorOffset(a,s,o),{left:d,top:f}=r[0],p={x:0,y:0};d>u.col&&(d=u.col,p.x=u.offset.x),f>u.row&&(f=u.row,p.y=u.offset.y),this.dispatch(`CREATE_CHART`,{figureId:i,chartId:new Bd().smallUuid(),sheetId:a,definition:l,col:d,row:f,offset:p,size:{height:s,width:o}}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.copiedChart.sheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},_W=class extends XL{uuidGenerator=new Bd;queuedChanges={};copy(e){if(!e.zones.length)return;let{rowsIndexes:t,columnsIndexes:n}=e,r=e.sheetId,i=[];for(let e of t){let t=[];for(let i of n){let n=Array.from(this.getters.getRulesByCell(r,i,e));t.push({position:{col:i,row:e,sheetId:r},rules:n})}i.push(t)}return{cfRules:i}}paste(e,t,n){if(this.queuedChanges={},n.pasteOption===`asValue`)return;let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t):this.pasteFromCopy(i,r,t.cfRules,n),this.executeQueuedChanges()}pasteFromCut(e,t,n){let r=t[0];this.pasteZone(e,r.left,r.top,n.cfRules,{isCutOperation:!0})}pasteZone(e,t,n,r,i){for(let[a,o]of r.entries())for(let[r,s]of o.entries()){let o={col:t+r,row:n+a,sheetId:e};this.pasteCf(s,o,i?.isCutOperation)}}pasteCf(e,t,n){if(e?.rules&&e.rules.length>0){let r=D(e.position),i=D(t);for(let a of e.rules){let o=[];if(n&&o.push(r),e.position.sheetId===t.sheetId)this.adaptCFRules(e.position.sheetId,a,[i],o);else{this.adaptCFRules(e.position.sheetId,a,[],o);let n=this.getCFToCopyTo(t.sheetId,a);this.adaptCFRules(t.sheetId,n,[i],[])}}}}adaptCFRules(e,t,n,r){this.queuedChanges[e]||(this.queuedChanges[e]=[]);let i=this.queuedChanges[e].find(e=>e.cf.id===t.id);i?(i.toAdd.push(...n),i.toRemove.push(...r)):this.queuedChanges[e].push({toAdd:n,toRemove:r,cf:t})}executeQueuedChanges(){for(let e in this.queuedChanges)for(let{toAdd:t,toRemove:n,cf:r}of this.queuedChanges[e]){let i=this.getters.getAdaptedCfRanges(e,r,t,n);if(i){if(i.length===0){this.dispatch(`REMOVE_CONDITIONAL_FORMAT`,{id:r.id,sheetId:e});continue}this.dispatch(`ADD_CONDITIONAL_FORMAT`,{cf:{id:r.id,rule:r.rule,stopIfTrue:r.stopIfTrue},ranges:i,sheetId:e})}}}getCFToCopyTo(e,t){let n=this.getters.getConditionalFormats(e).find(e=>e.stopIfTrue===t.stopIfTrue&&T(e.rule,t.rule)),r=this.queuedChanges[e];return!n&&r&&(n=r.find(e=>e.cf.stopIfTrue===t.stopIfTrue&&T(e.cf.rule,t.rule))?.cf),n||{...t,id:this.uuidGenerator.smallUuid(),ranges:[]}}},vW=class extends XL{uuidGenerator=new Bd;queuedChanges={};copy(e){let{rowsIndexes:t,columnsIndexes:n}=e,r=e.sheetId,i=[];for(let e of t){let t=[];for(let i of n){let n={sheetId:r,col:i,row:e},a=this.getters.getValidationRuleForCell(n);t.push({position:n,rule:a})}i.push(t)}return{dvRules:i}}paste(e,t,n){if(this.queuedChanges={},n.pasteOption)return;let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t):this.pasteFromCopy(i,r,t.dvRules),this.executeQueuedChanges()}pasteFromCut(e,t,n){let r=t[0];this.pasteZone(e,r.left,r.top,n.dvRules,{isCutOperation:!0})}pasteZone(e,t,n,r,i){for(let[a,o]of r.entries())for(let[r,s]of o.entries()){let o={col:t+r,row:n+a,sheetId:e};this.pasteDataValidation(s,o,i?.isCutOperation)}}pasteDataValidation(e,t,n){if(e){let r=D(t),i=D(e.position),a=e.rule;if(!a){let e=this.getters.getValidationRuleForCell(t);e&&this.adaptDataValidationRule(t.sheetId,e,[],[r]);return}let o=[];if(n&&o.push(i),e.position.sheetId===t.sheetId){let n=this.getDataValidationRuleToCopyTo(t.sheetId,a,!1);this.adaptDataValidationRule(e.position.sheetId,n,[r],o)}else{let n=this.getters.getValidationRuleForCell(e.position);n&&this.adaptDataValidationRule(e.position.sheetId,n,[],o);let i=this.getDataValidationRuleToCopyTo(t.sheetId,a);this.adaptDataValidationRule(t.sheetId,i,[r],[])}}}getDataValidationRuleToCopyTo(e,t,n=!0){let r=this.getters.getDataValidationRules(e).find(e=>T(t.criterion,e.criterion)&&t.isBlocking===e.isBlocking),i=this.queuedChanges[e];return!r&&i&&(r=i.find(e=>T(t.criterion,e.rule.criterion)&&t.isBlocking===e.rule.isBlocking)?.rule),r||{...t,id:n?this.uuidGenerator.smallUuid():t.id,ranges:[]}}adaptDataValidationRule(e,t,n,r){this.queuedChanges[e]||(this.queuedChanges[e]=[]);let i=this.queuedChanges[e].find(e=>e.rule.id===t.id);i?(i.toAdd.push(...n),i.toRemove.push(...r)):this.queuedChanges[e].push({toAdd:n,toRemove:r,rule:t})}executeQueuedChanges(){for(let e in this.queuedChanges)for(let{toAdd:t,toRemove:n,rule:r}of this.queuedChanges[e]){let i=ln([...ln(r.ranges.map(e=>e.zone),n),...t],[]);if(i.length===0){this.dispatch(`REMOVE_DATA_VALIDATION_RULE`,{sheetId:e,id:r.id});continue}this.dispatch(`ADD_DATA_VALIDATION_RULE`,{rule:{id:r.id,criterion:r.criterion,isBlocking:r.isBlocking},ranges:i.map(t=>this.getters.getRangeDataFromZone(e,t)),sheetId:e})}}},yW=class extends mW{copy(e){let t=e.sheetId,n=this.getters.getFigure(t,e.figureId);if(!n)throw Error(`No figure for the given id: ${e.figureId}`);let r={...n};if(n.tag!==`image`)return;let i=x(this.getters.getImage(e.figureId));return{figureId:e.figureId,copiedFigure:r,copiedImage:i,sheetId:t}}getPasteTarget(e,t,n,r){return{sheetId:e,zones:[],figureId:new Bd().smallUuid()}}paste(e,t,n){if(!e.figureId)return;let{zones:r,figureId:i}=e,a=this.getters.getActiveSheetId(),{width:o,height:s}=t.copiedFigure,c=x(t.copiedImage),l=this.getters.getMaxAnchorOffset(a,s,o),{left:u,top:d}=r[0],f={x:0,y:0};u>l.col&&(u=l.col,f.x=l.offset.x),d>l.row&&(d=l.row,f.y=l.offset.y),this.dispatch(`CREATE_IMAGE`,{figureId:i,sheetId:a,col:u,row:d,offset:f,size:{height:s,width:o},definition:c}),n.isCutOperation&&this.dispatch(`DELETE_FIGURE`,{sheetId:t.sheetId,figureId:t.copiedFigure.id}),this.dispatch(`SELECT_FIGURE`,{figureId:i})}isPasteAllowed(e,t,n,r){return t.length===0?U.EmptyTarget:r?.pasteOption===void 0?U.Success:U.WrongFigurePasteOption}},bW=class extends XL{copy(e){let t=this.getters.getActiveSheetId(),{rowsIndexes:n,columnsIndexes:r}=e,i=[];for(let e of n){let n=[];for(let i of r){let r={col:i,row:e,sheetId:t};n.push(this.getters.getMerge(r))}i.push(n)}return{merges:i,sheetId:t}}paste(e,t,n){if(n.isCutOperation){let e=t.merges.flat().filter(w);this.dispatch(`REMOVE_MERGE`,{sheetId:t.sheetId,target:e})}this.pasteFromCopy(e.sheetId,e.zones,t.merges,n)}pasteZone(e,t,n,r){for(let[i,a]of r.entries())for(let[r,o]of a.entries()){let a={col:t+r,row:n+i,sheetId:e};this.pasteMerge(o,a)}}pasteMerge(e,t){if(!e||this.getters.isInMerge(t))return;let{sheetId:n,col:r,row:i}=t;this.dispatch(`ADD_MERGE`,{sheetId:n,force:!0,target:[{left:r,top:i,right:r+e.right-e.left,bottom:i+e.bottom-e.top}]})}},xW=class extends XL{copy(e){return{zones:e.clippedZones,sheetId:e.sheetId}}paste(e,t,n){if(n.isCutOperation){let n=e.zones[0];this.dispatch(`MOVE_RANGES`,{target:t.zones,sheetId:t.sheetId,sheetName:this.getters.getSheetName(t.sheetId),targetSheetId:e.sheetId,col:n.left,row:n.top})}}},SW=class extends XL{isPasteAllowed(e,t,n,r){if(!(`cells`in n))return U.Success;let{xSplit:i,ySplit:a}=this.getters.getPaneDivisions(e);return $n(QT(t,n.cells),i,a)?U.FrozenPaneOverlap:U.Success}},CW=class extends XL{copy(e,t,n=`copyPaste`){let r=e.sheetId,{rowsIndexes:i,columnsIndexes:a,zones:o}=e,s=new Set,c=[];for(let e of i){let l=[];c.push(l);for(let c of a){let a={col:c,row:e,sheetId:r},u=this.getters.getTable(a);if(!u){l.push({});continue}let d=this.getters.getCoreTable(a),f=d?.range.zone,p;if(!s.has(u.id)&&d&&f&&o.some(e=>Ln(f,e))){s.add(u.id);let{numberOfRows:e}=Rn(f);for(let n=f.top;n<=f.bottom;n++)!t&&!i.includes(n)&&e--;let n=d.range,r=this.getters.extendRange(d.range,`ROW`,n.zone.top+e-1-n.zone.bottom);p={range:this.getters.getRangeData(r),config:d.config,type:d.type}}if(u.isPivotTable){let t=u.range.zone.top===e&&u.range.zone.left===c,n=o.some(e=>Ln(u.range.zone,e));(t||n)&&s.add(u.id)}n!==`shiftCells`&&l.push({table:p,style:this.getTableStyleToCopy(a),isWholeTableCopied:s.has(u.id)})}}return{tableCells:c,sheetId:e.sheetId}}getTableStyleToCopy(e){let t=Ot({...this.getters.getCellTableStyle(e),hideGridLines:!1}),n=this.getters.getCellStyle(e),r=this.getters.getCellTableBorder(e),i=this.getters.getCellBorder(e);return{style:{...t,...Ot(n)},border:{...r,...Ot(i)}}}paste(e,t,n){let r=e.zones,i=e.sheetId;n.isCutOperation?this.pasteFromCut(i,r,t,n):this.pasteFromCopy(i,r,t.tableCells,n)}pasteFromCut(e,t,n,r){for(let e of n.tableCells)for(let t of e)t.table&&this.dispatch(`REMOVE_TABLE`,{sheetId:n.sheetId,target:[this.getters.getRangeFromRangeData(t.table.range).zone]});let i=t[0];this.pasteZone(e,i.left,i.top,n.tableCells,r)}pasteZone(e,t,n,r,i){for(let a=0;a<r.length;a++){let o=r[a];for(let r=0;r<o.length;r++){let s=o[r];if(!s)continue;let c={col:t+r,row:n+a,sheetId:e};this.pasteTableCell(e,s,c,i)}}if(r.length===1)for(let i=0;i<r[0].length;i++)this.dispatch(`AUTOFILL_TABLE_COLUMN`,{col:t+i,row:n,sheetId:e})}pasteTableCell(e,t,n,r){if(t.table&&!r?.pasteOption){let{range:r}=t.table,i=Rn(this.getters.getRangeFromRangeData(r).zone),a={left:n.col,top:n.row,right:n.col+i.numberOfCols-1,bottom:n.row+i.numberOfRows-1};this.dispatch(`CREATE_TABLE`,{sheetId:n.sheetId,ranges:[this.getters.getRangeDataFromZone(e,a)],config:t.table.config,tableType:t.table.type})}this.getters.getCoreTable(n)||r?.pasteOption===`asValue`||(!r?.pasteOption&&!t.isWholeTableCopied||r?.pasteOption===`onlyFormat`)&&(t.style?.style&&this.dispatch(`UPDATE_CELL`,{...n,style:t.style.style}),t.style?.border&&this.dispatch(`SET_BORDER`,{...n,border:t.style.border}))}};GF.figureHandlers.add(`chart`,gW).add(`image`,yW).add(`carousel`,hW),GF.cellHandlers.add(`dataValidation`,vW).add(`cell`,ZL).add(`sheet`,SW).add(`merge`,bW).add(`border`,pW).add(`table`,CW).add(`conditionalFormat`,_W).add(`references`,xW);var wW=l({ARRAYTOTEXT:()=>$W,ARRAY_CONSTRAIN:()=>DW,ARRAY_LITERAL:()=>OW,ARRAY_ROW:()=>kW,CHOOSECOLS:()=>AW,CHOOSEROWS:()=>jW,EXPAND:()=>MW,FLATTEN:()=>NW,FREQUENCY:()=>PW,HSTACK:()=>FW,MDETERM:()=>IW,MINVERSE:()=>LW,MMULT:()=>RW,SUMPRODUCT:()=>zW,SUMX2MY2:()=>VW,SUMX2PY2:()=>HW,SUMXMY2:()=>UW,TOCOL:()=>KW,TOROW:()=>qW,TRANSPOSE:()=>JW,VSTACK:()=>YW,WRAPCOLS:()=>XW,WRAPROWS:()=>ZW});function TW(e,t){let n=e.map(R),r=n.map(e=>e?.[0]?.length??0),i=Math.max(...r);if(t?.requireSameRowCount){let e=r[0];if(r.some(t=>t!==e))return new M(A(`All ranges in [[FUNCTION_NAME]] must have the same number of columns (got %s).`,r.join(`, `)))}let a=[];for(let e of n)for(let t=0;t<e.length;t++){let n=Array(i).fill({value:null});for(let r=0;r<e[t].length;r++)n[r]=e[t][r];a.push(n)}return a}function EW(e,t){let n=e.map(R),r=n.map(e=>e?.length??0),i=Math.max(...r);if(t?.requireSameColCount){let e=r[0];if(r.some(t=>t!==e))return new M(A(`All ranges in [[FUNCTION_NAME]] must have the same number of columns (got %s).`,r.join(`, `)))}let a=uo(i,n.reduce((e,t)=>e+(t?.[0]?.length??0),0),()=>({value:null})),o=0;for(let e of n){for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)a[t][o+n]=e[t][n];o+=e[0]?.length??0}return a}let DW={description:A(`Returns a result array constrained to a specific width and height.`),args:[k(`input_range (any, range<any>)`,A(`The range to constrain.`)),k(`rows (number)`,A(`The number of rows in the constrained array.`)),k(`columns (number)`,A(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=R(e),i=Xa(t?.value,this.locale),a=Xa(n?.value,this.locale);if(i<=0)return new M(A(`The rows argument (%s) must be strictly positive.`,i.toString()));if(a<=0)return new M(A(`The columns argument (%s) must be strictly positive.`,a.toString()));let o=Math.min(i,r[0].length);return uo(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},OW={description:A(`Appends ranges vertically and in sequence to return a larger array. All ranges must have the same number of columns.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return EW(e,{requireSameColCount:!0})},isExported:!1,hidden:!0},kW={description:A(`Appends ranges horizontally and in sequence to return a larger array. All ranges must have the same number of rows.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return TW(e,{requireSameRowCount:!0})},isExported:!1,hidden:!0},AW={description:A(`Creates a new array from the selected columns in the existing range.`),args:[k(`array (any, range<any>)`,A(`The array that contains the columns to be returned.`)),k(`col_num (number, range<number>, repeating)`,A(`The column index of the column to be returned.`))],compute:function(e,...t){let n=R(e),r=Do(t,e=>Xa(e?.value,this.locale)),i=r.filter(e=>e===0||n.length<Math.abs(e));if(i.length!==0)return new M(A(`The columns arguments must be between -%s and %s (got %s), excluding 0.`,n.length.toString(),n.length.toString(),i.join(`,`)));let a=Array(r.length);for(let e=0;e<r.length;e++)r[e]>0?a[e]=n[r[e]-1]:a[e]=n[n.length+r[e]];return a},isExported:!0},jW={description:A(`Creates a new array from the selected rows in the existing range.`),args:[k(`array (any, range<any>)`,A(`The array that contains the rows to be returned.`)),k(`row_num (number, range<number>, repeating)`,A(`The row index of the row to be returned.`))],compute:function(e,...t){let n=R(e),r=Do(t,e=>Xa(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return a.length===0?uo(i,r.length,(e,t)=>r[t]>0?n[e][r[t]-1]:n[e][n[e].length+r[t]]):new M(A(`The rows arguments must be between -%s and %s (got %s), excluding 0.`,n[0].length.toString(),n[0].length.toString(),a.join(`,`)))},isExported:!0},MW={description:A(`Expands or pads an array to specified row and column dimensions.`),args:[k(`array (any, range<any>)`,A(`The array to expand.`)),k(`rows (number)`,A(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),k(`columns (number, optional)`,A(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),k(`pad_with (any, default=0)`,A(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=R(e),a=Xa(t?.value,this.locale),o=n===void 0?i.length:Xa(n.value,this.locale);return a<i[0].length?new M(A(`The rows arguments (%s) must be greater or equal than the number of rows of the array.`,a.toString())):o<i.length?new M(A(`The columns arguments (%s) must be greater or equal than the number of columns of the array.`,o.toString())):uo(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},NW={description:A(`Flattens all the values from one or more ranges into a single column.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to flatten.`))],compute:function(...e){return[Do(e,e=>e===void 0?{value:``}:e)]},isExported:!1},PW={description:A(`Calculates the frequency distribution of a range.`),args:[k(`data (range<number>)`,A(`The array of ranges containing the values to be counted.`)),k(`classes (number, range<number>)`,A(`The range containing the set of classes.`))],compute:function(e,t){let n=Do([e],e=>e.value).filter(e=>typeof e==`number`),r=Do([t],e=>e.value).filter(e=>typeof e==`number`).map((e,t)=>({initialIndex:t,value:e,count:0})).sort((e,t)=>e.value-t.value);r.push({initialIndex:r.length,value:1/0,count:0});let i=n.sort((e,t)=>e-t),a=0;for(let e of i){for(;e>r[a].value&&a<r.length-1;)a++;r[a].count++}return[r.sort((e,t)=>e.initialIndex-t.initialIndex).map(e=>e.count)]},isExported:!0},FW={description:A(`Appends ranges horizontally and in sequence to return a larger array.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return TW(e)},isExported:!0},IW={description:A(`Returns the matrix determinant of a square matrix.`),args:[k(`square_matrix (number, range<number>)`,A(`An range with an equal number of rows and columns representing a matrix whose determinant will be calculated.`))],compute:function(e){let t=Ja(e,`square_matrix`);return gh(t)?yh(t).determinant:new M(A(`The argument square_matrix must have the same number of columns and rows.`))},isExported:!0},LW={description:A(`Returns the multiplicative inverse of a square matrix.`),args:[k(`square_matrix (number, range<number>)`,A(`An range with an equal number of rows and columns representing a matrix whose multiplicative inverse will be calculated.`))],compute:function(e){let t=Ja(e,`square_matrix`);if(!gh(t))return new M(A(`The argument square_matrix must have the same number of columns and rows.`));let{inverted:n}=yh(t);return n||new M(A(`The matrix is not invertible.`))},isExported:!0},RW={description:A(`Calculates the matrix product of two matrices.`),args:[k(`matrix1 (number, range<number>)`,A(`The first matrix in the matrix multiplication operation.`)),k(`matrix2 (number, range<number>)`,A(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=Ja(e,`matrix1`),r=Ja(t,`matrix2`);return n.length===0||r.length===0?new M(A(`The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices.`)):n.length===r[0].length?xh(n,r):new M(A(`In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the number of rows of the second matrix (%s).`,n.length.toString(),r[0].length.toString()))},isExported:!0},zW={description:A(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[k(`range (number, range<number>, repeating)`,A(`The range whose entries will be multiplied with corresponding entries in the other range.`))],compute:function(...e){if(!hh(...e))return new M(A(`All the ranges must have the same dimensions.`));let t=e.map(R),n=0;for(let e=0;e<t[0].length;e++)for(let r=0;r<t[0][e].length;r++){if(!t.every(t=>typeof t[e][r].value==`number`))continue;let i=1;for(let n of t)i*=F(n[e][r],this.locale);n+=i}return n},isExported:!0};function BW(e,t,n){if(!hh(e,t))return new M(A(`The arguments array_x and array_y must have the same dimensions.`));let r=R(e),i=R(t),a=!1,o=0;for(let e in r)for(let t in r[e]){let s=r[e][t].value,c=i[e][t].value;typeof s!=`number`||typeof c!=`number`||(a=!0,o+=n(s,c))}return a?o:new M(A(`The arguments array_x and array_y must contain at least one pair of numbers.`))}let VW={description:A(`Calculates the sum of the difference of the squares of the values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values whose squares will be reduced by the squares of corresponding entries in array_y and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values whose squares will be subtracted from the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>e**2-t**2)},isExported:!0},HW={description:A(`Calculates the sum of the sum of the squares of the values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values whose squares will be added to the squares of corresponding entries in array_y and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values whose squares will be added to the squares of corresponding entries in array_x and added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>e**2+t**2)},isExported:!0},UW={description:A(`Calculates the sum of squares of the differences of values in two array.`),args:[k(`array_x (number, range<number>)`,A(`The array or range of values that will be reduced by corresponding entries in array_y, squared, and added together.`)),k(`array_y (number, range<number>)`,A(`The array or range of values that will be subtracted from corresponding entries in array_x, the result squared, and all such results added together.`))],compute:function(e,t){return BW(e,t,(e,t)=>(e-t)**2)},isExported:!0},WW=[k(`array (any, range<any>)`,A(`The array which will be transformed.`)),k(`ignore (number, default=0)`,A(`Whether to ignore certain types of values. By default, no values are ignored.`),[{value:0,label:A(`Keep all values (default)`)},{value:1,label:A(`Ignore blanks`)},{value:2,label:A(`Ignore errors`)},{value:3,label:A(`Ignore blanks and errors`)}]),k(`scan_by_column (number, default=false)`,A(`Scan the array by column. By default, the array is scanned by row.`),[{value:!1,label:A(`Scan by row (default)`)},{value:!0,label:A(`Scan by column`)}])];function GW(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!P(e.value);if(t===3)return e=>e.value!==null&&!P(e.value);throw new M(A(`Argument ignore must be between 0 and 3`))}let KW={description:A(`Transforms a range of cells into a single column.`),args:WW,compute:function(e,t={value:0},n={value:!1}){let r=R(e),i=F(t.value,this.locale),a=(L(n.value)?r:mo(r)).flat().filter(GW(i));return a.length===0?new Bi(A(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},qW={description:A(`Transforms a range of cells into a single row.`),args:WW,compute:function(e,t={value:0},n={value:!1}){let r=R(e),i=F(t.value,this.locale),a=(L(n.value)?r:mo(r)).flat().filter(GW(i)).map(e=>[e]);return a.length===0||a[0].length===0?new Bi(A(`No results for the given arguments of TOROW.`)):a},isExported:!0},JW={description:A(`Transposes the rows and columns of a range.`),args:[k(`range (any, range<any>)`,A(`The range to be transposed.`))],compute:function(e){let t=R(e),n=t[0].length,r=t.length;return uo(n,r,(e,n)=>t[n][e])},isExported:!0},YW={description:A(`Appends ranges vertically and in sequence to return a larger array.`),args:[k(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return EW(e)},isExported:!0},XW={description:A(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[k(`range (any, range<any>)`,A(`The range to wrap.`)),k(`wrap_count (number)`,A(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),k(`pad_with (any, default=0)`,A(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=R(e),i=Xa(t?.value,this.locale);if(!mh(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return uo(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},ZW={description:A(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[k(`range (any, range<any>)`,A(`The range to wrap.`)),k(`wrap_count (number)`,A(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),k(`pad_with (any, default=0)`,A(`The value with which to fill the extra cells in the range.`))],compute:function(e,t,n={value:0}){let r=R(e),i=Xa(t?.value,this.locale);if(!mh(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return uo(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0},QW=[{value:0,label:A(`Concise format\xA0(default)`)},{value:1,label:A(`Strict format`)}],$W={description:A(`returns an array of text values from any specified range. It passes text values unchanged, and converts non-text values to text.`),args:[k(`array (range)`,A(`The array to convert into text`)),k(`format (number, default=0)`,A(`The format of the returned data.`),QW)],compute:function(e,t={value:0}){let n=F(t,this.locale),r=R(e);if(n===1)return sT(r,``,this.locale);if(n===0){let e=this.locale.decimalSeparator===`,`?`/`:`,`;return mo(r).flatMap(e=>e.map(e=>P(e.value)?e.value:I(e))).join(e)}else return new M(A(`Format must be 0 or 1`))},isExported:!0};var eG=l({ABS:()=>nG,ACOS:()=>rG,ACOSH:()=>iG,ACOT:()=>aG,ACOTH:()=>oG,ASIN:()=>sG,ASINH:()=>cG,ATAN:()=>lG,ATAN2:()=>uG,ATANH:()=>dG,CEILING:()=>fG,CEILING_MATH:()=>mG,CEILING_PRECISE:()=>hG,COS:()=>gG,COSH:()=>_G,COT:()=>vG,COTH:()=>yG,COUNTBLANK:()=>bG,COUNTIF:()=>xG,COUNTIFS:()=>SG,COUNTUNIQUE:()=>CG,COUNTUNIQUEIFS:()=>wG,CSC:()=>TG,CSCH:()=>EG,DECIMAL:()=>DG,DEGREES:()=>OG,EXP:()=>kG,FLOOR:()=>AG,FLOOR_MATH:()=>MG,FLOOR_PRECISE:()=>NG,INT:()=>hK,ISEVEN:()=>PG,ISODD:()=>IG,ISO_CEILING:()=>FG,LN:()=>LG,LOG:()=>RG,MOD:()=>BG,MUNIT:()=>VG,ODD:()=>HG,PI:()=>UG,POWER:()=>WG,PRODUCT:()=>GG,RAND:()=>KG,RANDARRAY:()=>qG,RANDBETWEEN:()=>JG,ROUND:()=>YG,ROUNDDOWN:()=>XG,ROUNDUP:()=>ZG,SEC:()=>QG,SECH:()=>$G,SEQUENCE:()=>eK,SIN:()=>tK,SINH:()=>nK,SQRT:()=>rK,SUBTOTAL:()=>sK,SUM:()=>cK,SUMIF:()=>lK,SUMIFS:()=>uK,TAN:()=>dK,TANH:()=>fK,TRUNC:()=>mK});let tG=/^-?[a-z0-9]+$/i,nG={description:A(`Absolute value of a number.`),args:[k(`value (number)`,A(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(F(e,this.locale))},isExported:!0},rG={description:A(`Inverse cosine of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>1?new M(A(`The value (%s) must be between -1 and 1 inclusive.`,t)):Math.acos(t)},isExported:!0},iG={description:A(`Inverse hyperbolic cosine of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic cosine. Must be greater than or equal to 1.`))],compute:function(e){let t=F(e,this.locale);return t<1?new M(A(`The value (%s) must be greater than or equal to 1.`,t)):Math.acosh(t)},isExported:!0},aG={description:A(`Inverse cotangent of a value.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=F(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},oG={description:A(`Inverse hyperbolic cotangent of a value.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic cotangent. Must not be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)<=1?new M(A(`The value (%s) cannot be between -1 and 1 inclusive.`,t)):Math.log((t+1)/(t-1))/2},isExported:!0},sG={description:A(`Inverse sine of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>1?new M(A(`The value (%s) must be between -1 and 1 inclusive.`,t)):Math.asin(t)},isExported:!0},cG={description:A(`Inverse hyperbolic sine of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(F(e,this.locale))},isExported:!0},lG={description:A(`Inverse tangent of a value, in radians.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(F(e,this.locale))},isExported:!0},uG={description:A(`Angle from the X axis to a point (x,y), in radians.`),args:[k(`x (number)`,A(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),k(`y (number)`,A(`The y coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return n===0&&r===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):Math.atan2(r,n)},isExported:!0},dG={description:A(`Inverse hyperbolic tangent of a number.`),args:[k(`value (number)`,A(`The value for which to calculate the inverse hyperbolic tangent. Must be between -1 and 1, exclusive.`))],compute:function(e){let t=F(e,this.locale);return Math.abs(t)>=1?new M(A(`The value (%s) must be between -1 and 1 exclusive.`,t)):Math.atanh(t)},isExported:!0},fG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`value (number)`,A(`The value to round up to the nearest integer multiple of factor.`)),k(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return r<0&&n>0?new M(A(`The factor (%s) must be positive when the value (%s) is positive.`,r,n)):{value:r?Math.ceil(n/r)*r:0,format:e?.format}},isExported:!0};function pG(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.ceil(e/t)*t:n===0?-Math.floor(Math.abs(e)/t)*t:-Math.ceil(Math.abs(e)/t)*t)}let mG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),k(`mode (number, default=0)`,A(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded towards zero. Otherwise, it is rounded away from zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:pG(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},hG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:pG(F(e,this.locale),n),format:e?.format}},isExported:!0},gG={description:A(`Cosine of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(F(e,this.locale))},isExported:!0},_G={description:A(`Hyperbolic cosine of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(F(e,this.locale))},isExported:!0},vG={description:A(`Cotangent of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tan(t)},isExported:!0},yG={description:A(`Hyperbolic cotangent of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tanh(t)},isExported:!0},bG={description:A(`Number of empty values.`),args:[k(`value (any, range, repeating)`,A(`Value or range in which to count the number of blanks.`))],compute:function(...e){return so(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},xG={description:A(`A conditional count across a range.`),args:[k(`range (range)`,A(`The range that is tested against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return xo(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},SG={description:A(`Count values depending on multiple criteria.`),args:[k(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(...e){let t=0;return xo(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},CG={description:A(`Counts number of unique values in a range.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider for uniqueness.`))],compute:function(...e){return eg(e)}},wG={description:A(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the number of unique values will be counted.`)),k(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=new Set;return xo(t,(t,r)=>{let i=e[t]?.[r];Oo(i)&&n.add(i.value)},this.locale),n.size}},TG={description:A(`Cosecant of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sin(t)},isExported:!0},EG={description:A(`Hyperbolic cosecant of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=F(e,this.locale);return t===0?new Ui(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sinh(t)},isExported:!0},DG={description:A(`Converts from another base to decimal.`),args:[k(`value (string)`,A(`The number to convert.`)),k(`base (number)`,A(`The base to convert the value from.`))],compute:function(e,t){let n=F(t,this.locale);if(n=Math.floor(n),2>n||n>36)return new M(A(`The base (%s) must be between 2 and 36 inclusive.`,n));let r=I(e);if(r===``)return 0;if(!tG.test(r))return new M(A(`The value (%s) must be a valid base %s representation.`,r,n));let i=parseInt(r,n);return isNaN(i)?new M(A(`The value (%s) must be a valid base %s representation.`,r,n)):i},isExported:!0},OG={description:A(`Converts an angle value in radians to degrees.`),args:[k(`angle (number)`,A(`The angle to convert from radians to degrees.`))],compute:function(e){return F(e,this.locale)*180/Math.PI},isExported:!0},kG={description:A(`Euler's number, e (~2.718) raised to a power.`),args:[k(`value (number)`,A(`The exponent to raise e.`))],compute:function(e){return Math.exp(F(e,this.locale))},isExported:!0},AG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`value (number)`,A(`The value to round down to the nearest integer multiple of factor.`)),k(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=F(e,this.locale),r=F(t,this.locale);return r<0&&n>0?new M(A(`The factor (%s) must be positive when the value (%s) is positive.`,r,n)):{value:r?Math.floor(n/r)*r:0,format:e?.format}},isExported:!0};function jG(e,t,n=0){return t===0?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:n===0?-Math.ceil(Math.abs(e)/t)*t:-Math.floor(Math.abs(e)/t)*t)}let MG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),k(`mode (number, default=0)`,A(`If number is negative, specifies the rounding direction. If 0 or blank, it is rounded away from zero. Otherwise, it is rounded towards zero.`))],compute:function(e,t={value:1},n={value:0}){let r=F(t,this.locale);return{value:jG(F(e,this.locale),r,F(n,this.locale)),format:e?.format}},isExported:!0},NG={description:A(`Rounds number down to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=F(t,this.locale);return{value:jG(F(e,this.locale),n),format:e?.format}},isExported:!0},PG={description:A(`Whether the provided value is even.`),args:[k(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=Ya(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},FG={description:A(`Rounds number up to nearest multiple of factor.`),args:[k(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),k(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:pG(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},IG={description:A(`Whether the provided value is even.`),args:[k(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=Ya(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},LG={description:A(`The logarithm of a number, base e (euler's number).`),args:[k(`value (number)`,A(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=F(e,this.locale);return t<=0?new M(A(`The value (%s) must be strictly positive.`,t)):Math.log(t)},isExported:!0},RG={description:A(`The logarithm of a number, for a given base.`),args:[k(`value (number)`,A(`The value for which to calculate the logarithm.`)),k(`base (number, default=10)`,A(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=F(e,this.locale),r=F(t,this.locale);return n<=0?new M(A(`The value (%s) must be strictly positive.`,n)):r<=0?new M(A(`The base (%s) must be strictly positive.`,r)):r===1?new M(A(`The base must be different from 1.`)):Math.log10(n)/Math.log10(r)},isExported:!0};function zG(e,t){ph(t,A(`The divisor must be different from 0.`));let n=e%t;return n>0&&t<0||n<0&&t>0?n+t:n}let BG={description:A(`Modulo (remainder) operator.`),args:[k(`dividend (number)`,A(`The number to be divided to find the remainder.`)),k(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return{value:zG(F(e,this.locale),n),format:e?.format}},isExported:!0},VG={description:A(`Returns a n x n unit matrix, where n is the input dimension.`),args:[k(`dimension (number)`,A(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=Xa(e,this.locale);return t<1?new M(A(`The argument dimension must be positive`)):vh(t)},isExported:!0},HG={description:A(`Rounds a number up to the nearest odd integer.`),args:[k(`value (number)`,A(`The value to round to the next greatest odd number.`))],compute:function(e){let t=F(e,this.locale),n=Math.ceil(Math.abs(t));return n=n&1?n:n+1,{value:t<0?-n:n,format:e?.format}},isExported:!0},UG={description:A(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},WG={description:A(`A number raised to a power.`),args:[k(`base (number)`,A(`The number to raise to the exponent power.`)),k(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){let n=F(e,this.locale),r=F(t,this.locale);return n<0&&!Number.isInteger(r)?new M(A(`The exponent (%s) must be an integer when the base is negative.`,r)):{value:n**+r,format:e?.format}},isExported:!0},GG={description:A(`Result of multiplying a series of numbers together.`),args:[k(`factor (number, range<number>, repeating)`,A(`Number or range to calculate for the product.`))],compute:function(...e){let t=0,n=1;for(let r of e)if(Je(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),P(e))return r}else r!==void 0&&r.value!==null&&(n*=Ya(r,this.locale),t+=1);return{value:t===0?0:n,format:Va(e[0])}},isExported:!0},KG={description:A(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},qG={description:A(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[k(`rows (number, default=1)`,A(`The number of rows to be returned.`)),k(`columns (number, default=1)`,A(`The number of columns to be returned.`)),k(`min (number, default=0)`,A(`The minimum number you would like returned.`)),k(`max (number, default=1)`,A(`The maximum number you would like returned.`)),k(`whole_number (boolean, default=FALSE)`,A(`Return a whole number or a decimal value.`),[{value:!1,label:A(`Decimal (default)`)},{value:!0,label:A(`Integer`)}])],compute:function(e={value:1},t={value:1},n={value:0},r={value:1},i={value:!1}){let a=Xa(t,this.locale),o=Xa(e,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=L(i);if(a<1)return new M(A(`The number of columns (%s) must be positive.`,a));if(o<1)return new M(A(`The number of rows (%s) must be positive.`,o));if(s>c)return new M(A(`The maximum (%s) must be greater than or equal to the minimum (%s).`,c,s));if(l&&(!Number.isInteger(s)||!Number.isInteger(c)))return new M(A(`The maximum (%s) and minimum (%s) must be integers when whole_number is TRUE.`,c.toString(),s.toString()));let u=Array(a);for(let e=0;e<a;e++){u[e]=Array(o);for(let t=0;t<o;t++)l?u[e][t]=Math.floor(Math.random()*(c-s+1)+s):u[e][t]=s+Math.random()*(c-s)}return u},isExported:!0},JG={description:A(`Random integer between two values, inclusive.`),args:[k(`low (number)`,A(`The low end of the random range.`)),k(`high (number)`,A(`The high end of the random range.`))],compute:function(e,t){let n=F(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=F(t,this.locale);return Number.isInteger(r)||(r=Math.floor(r)),n>r?new M(A(`The high (%s) must be greater than or equal to the low (%s).`,r,n)):{value:n+Math.ceil((r-n+1)*Math.random())-1,format:e?.format}},isExported:!0},YG={description:A(`Rounds a number according to standard rules.`),args:[k(`value (number)`,A(`The value to round to places number of places.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.round(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.round(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},XG={description:A(`Rounds down a number.`),args:[k(`value (number)`,A(`The value to round to places number of places, always rounding down.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.floor(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.floor(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},ZG={description:A(`Rounds up a number.`),args:[k(`value (number)`,A(`The value to round to places number of places, always rounding up.`)),k(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=F(e,this.locale),r=F(t,this.locale),i=Math.abs(n),a;return r===0?a=Math.ceil(i):(Number.isInteger(r)||(r=Math.trunc(r)),a=Math.ceil(i*10**r)/10**r),{value:n>=0?a:-a,format:e?.format}},isExported:!0},QG={description:A(`Secant of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(F(e,this.locale))},isExported:!0},$G={description:A(`Hyperbolic secant of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(F(e,this.locale))},isExported:!0},eK={description:A(`Returns a sequence of numbers.`),args:[k(`rows (number)`,A(`The number of rows to return`)),k(`columns (number, optional, default=1)`,A(`The number of columns to return`)),k(`start (number, optional, default=1)`,A(`The first number in the sequence`)),k(`step (number, optional, default=1)`,A(`The amount to increment each value in the sequence`))],compute:function(e,t={value:1},n={value:1},r={value:1}){let i=F(n,this.locale),a=F(r,this.locale),o=Xa(e,this.locale),s=Xa(t,this.locale);return s<1?new M(A(`The number of columns (%s) must be positive.`,s)):o<1?new M(A(`The number of rows (%s) must be positive.`,o)):uo(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},tK={description:A(`Sine of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(F(e,this.locale))},isExported:!0},nK={description:A(`Hyperbolic sine of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(F(e,this.locale))},isExported:!0},rK={description:A(`Positive square root of a positive number.`),args:[k(`value (number)`,A(`The number for which to calculate the positive square root.`))],compute:function(e){let t=F(e,this.locale);return t<0?new M(A(`The value (%s) must be positive or null.`,t)):{value:Math.sqrt(t),format:e?.format}},isExported:!0},iK={1:`AVERAGE`,2:`COUNT`,3:`COUNTA`,4:`MAX`,5:`MIN`,6:`PRODUCT`,7:`STDEV`,8:`STDEVP`,9:`SUM`,10:`VAR`,11:`VARP`},aK=Object.entries(iK).map(([e,t])=>({value:parseInt(e),label:A(`%s (include manually-hidden rows)`,t)})),oK=Object.entries(iK).map(([e,t])=>({value:parseInt(e)+100,label:A(`%s (exclude manually-hidden rows)`,t)})),sK={description:A(`Returns a subtotal for a vertical range of cells using a specified aggregation function.`),args:[k(`function_code (number)`,A(`The function to use in subtotal aggregation.`),[...aK,...oK]),k(`ref (any, range<any>, repeating)`,A(`Range or reference for which you want the subtotal.`))],compute:function(e,...t){let n=Xa(e,this.locale),r=!0;if(n>100&&(n-=100,r=!1),n<1||n>11)return new M(A(`The function code (%s) must be between 1 to 11 or 101 to 111.`,n));let i=[];for(let e of t){let t=R(e),n=t[0][0]?.position;if(n===void 0)return new zi(Wa);let a=n.col+t.length-1,o=n.row+t[0].length-1,s=n.sheetId;for(let e=n.row;e<=o;e++)if(!this.getters.isRowFiltered(s,e)&&!(!r&&this.getters.isRowHiddenByUser(s,e)))for(let t=n.col;t<=a;t++){let n=this.getters.getCorrespondingFormulaCell({sheetId:s,col:t,row:e});(!n||!Xt(n,`SUBTOTAL`))&&i.push(this.getFormulaResult({sheetId:s,col:t,row:e}))}}return this[iK[n]].apply(this,[[i]])},isExported:!0},cK={description:A(`Sum of a series of numbers and/or cells.`),args:[k(`value (number, range<number>, repeating)`,A(`Number or range to add together.`))],compute:function(...e){let t=e[0];return{value:$h(e,this.locale),format:Va(t)}},isExported:!0},lK={description:A(`A conditional sum across a range.`),args:[k(`criteria_range (range)`,A(`The range which is tested against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to range.`)),k(`sum_range (range, default=criteria_range)`,A(`The range to be summed, if different from range.`))],compute:function(e,t,n){n===void 0&&(n=e);let r=0;return xo([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},uK={description:A(`Sums a range depending on multiple criteria.`),args:[k(`sum_range (range)`,A(`The range to sum.`)),k(`criteria_range (any, range, repeating)`,A(`Range to check.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},dK={description:A(`Tangent of an angle provided in radians.`),args:[k(`angle (number)`,A(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(F(e,this.locale))},isExported:!0},fK={description:A(`Hyperbolic tangent of any real number.`),args:[k(`value (number)`,A(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(F(e,this.locale))},isExported:!0};function pK(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let mK={description:A(`Truncates a number.`),args:[k(`value (number)`,A(`The value to be truncated.`)),k(`places (number, default=0)`,A(`The number of significant digits to the right of the decimal point to retain.`))],compute:function(e,t={value:0}){return{value:pK(F(e,this.locale),F(t,this.locale)),format:e?.format}},isExported:!0},hK={description:A(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[k(`value (number)`,A(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(F(e,this.locale))},isExported:!0};var gK=l({AVEDEV:()=>EK,AVERAGE:()=>DK,AVERAGEA:()=>jK,AVERAGEIF:()=>MK,AVERAGEIFS:()=>NK,AVERAGE_WEIGHTED:()=>AK,CORREL:()=>tq,COUNT:()=>PK,COUNTA:()=>FK,COVAR:()=>IK,COVARIANCE_P:()=>LK,COVARIANCE_S:()=>RK,FORECAST:()=>zK,GROWTH:()=>BK,INTERCEPT:()=>VK,LARGE:()=>HK,LINEST:()=>UK,LOGEST:()=>WK,MATTHEWS:()=>GK,MAX:()=>KK,MAXA:()=>qK,MAXIFS:()=>JK,MEDIAN:()=>YK,MIN:()=>XK,MINA:()=>ZK,MINIFS:()=>QK,PEARSON:()=>eq,PERCENTILE:()=>nq,PERCENTILE_EXC:()=>rq,PERCENTILE_INC:()=>iq,POLYFIT_COEFFS:()=>aq,POLYFIT_FORECAST:()=>oq,QUARTILE:()=>sq,QUARTILE_EXC:()=>cq,QUARTILE_INC:()=>lq,RANK:()=>uq,RSQ:()=>dq,SLOPE:()=>fq,SMALL:()=>pq,SPEARMAN:()=>mq,STDEV:()=>hq,STDEVA:()=>vq,STDEVP:()=>yq,STDEVPA:()=>bq,STDEV_P:()=>gq,STDEV_S:()=>_q,STEYX:()=>xq,TREND:()=>Sq,VAR:()=>Cq,VARA:()=>Eq,VARP:()=>Dq,VARPA:()=>Oq,VAR_P:()=>wq,VAR_S:()=>Tq});let _K=[{value:!0,label:A(`b is calculated normally`)},{value:!1,label:A(`b is forced to 1`)}],vK=[{value:!1,label:A(`do not return additional regression statistics`)},{value:!0,label:A(`return additional regression statistics`)}],yK=[{value:1,label:A(`order 1 (Linear)`)},{value:2,label:A(`order 2 (Quadratic)`)},{value:3,label:A(`order 3 (Cubic)`)},{value:4,label:A(`order 4 (Quartic)`)},{value:5,label:A(`order 5 (Quintic)`)},{value:6,label:A(`order 6 (Sextic)`)}],bK=[{value:!0,label:A(`Compute intercept`)},{value:!1,label:A(`Force intercept to 0`)}],xK=[{value:0,label:A(`Minimum value`)},{value:1,label:A(`First quartile (25th percentile)`)},{value:2,label:A(`Median value (50th percentile)`)},{value:3,label:A(`Third quartile (75th percentile)`)},{value:4,label:A(`Maximum value`)}];function SK(e,t){let n=[],r=[],i=0,a=0;io([e],e=>{n.push(e),i+=1}),io([t],e=>{r.push(e),a+=1}),fh(i===a,A(`[[FUNCTION_NAME]] has mismatched argument count %s vs %s.`,i,a));let o=[],s=[];for(let e=0;e<i;e++){let t=n[e]?.value,i=r[e]?.value;typeof t==`number`&&typeof i==`number`&&(s.push(t),o.push(i))}return{flatDataX:o,flatDataY:s}}function CK(e,t,n){let{flatDataX:r,flatDataY:i}=SK(e,t),a=i.length;ph(a),n&&ph(a-1);let o=0,s=0;for(let e=0;e<a;e++)o+=i[e],s+=r[e];let c=o/a,l=s/a,u=0;for(let e=0;e<a;e++)u+=(i[e]-c)*(r[e]-l);return u/(a-+!!n)}function wK(e,t,n,r){let i=0,a=n?lo:co,o=a(e,(e,t)=>(i+=1,e+t),0,r);ph(i),t&&ph(i-1);let s=o/i;return a(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function TK(e,t,n,r){let i=F(t,r);fh(n?0<=i&&i<=1:0<i&&i<1,A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`));let a=[],o,s=0;return io(e,e=>{let t=e?.value;typeof t==`number`&&(o=So(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),fh(s!==0,ko),n||fh(1/(s+1)<=i&&i<=s/(s+1),A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),za(a,i,n)}let EK={description:A(`Average magnitude of deviations from mean.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){let t=0,n=co(e,(e,n)=>(t+=1,e+n),0,this.locale);if(t===0)return new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`));let r=n/t;return co(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},DK={description:A(`Numerical average value in a dataset, ignoring text.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){return{value:Eh(e,this.locale),format:Va(e[0])}},isExported:!0},OK=A(`[[FUNCTION_NAME]] has mismatched range sizes.`),kK=A(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),AK={description:A(`Weighted average.`),args:[k(`values (number, range<number>, repeating)`,A(`Value to average.`)),k(`weights (number, range<number>, repeating)`,A(`Weight for each corresponding value.`))],compute:function(...e){let t=0,n=0;for(let r=0;r<e.length-1;r+=2){let i=e[r],a=e[r+1];if(!hh(i,a))return new M(OK);if(Je(i))for(let e=0;e<i.length;e++)for(let r=0;r<i[0].length;r++){let o=i[e][r].value,s=Je(a)?a?.[e][r].value:F(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){if(s<0)return new M(kK);t+=o*s,n+=s;continue}if(c!==l)return new M(A(`[[FUNCTION_NAME]] expects number values.`))}else{let e=F(i,this.locale),r=Je(a)?a?.[0][0].value:F(a,this.locale);if(typeof r==`number`){if(r<0)return new M(kK);t+=e*r,n+=r}}}return n===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:t/n,format:Va(e[0])}}},jK={description:A(`Numerical average value in a dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){let t=0,n=lo(e,(e,n)=>(t+=1,e+n),0,this.locale);return t===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:n/t,format:Va(e[0])}},isExported:!0},MK={description:A(`Average of values depending on criteria.`),args:[k(`criteria_range (number, range<number>)`,A(`The range to check against criterion.`)),k(`criterion (string)`,A(`The pattern or test to apply to criteria_range.`)),k(`average_range (number, range<number>, default=criteria_range)`,A(`The range to average. If not included, criteria_range is used for the average instead.`))],compute:function(e,t,n){let r=R(n===void 0?e:n),i=0,a=0;return xo([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),i===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):a/i},isExported:!0},NK={description:A(`Average of values depending on multiple criteria.`),args:[k(`average_range (range)`,A(`The range to average.`)),k(`criteria_range (any, range, repeating)`,A(`Range to check.`)),k(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=R(e),r=0,i=0;return xo(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),r===0?new Ui(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):i/r},isExported:!0},PK={description:A(`The number of numeric values in dataset.`),args:[k(`value (number, any, range<number>, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return Oh(e,this.locale)},isExported:!0},FK={description:A(`The number of values in a dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return kh(e)},isExported:!0},IK={description:A(`The covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!1)},isExported:!0},LK={description:A(`The covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!1)},isExported:!0},RK={description:A(`The sample covariance of a dataset.`),args:[k(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return CK(e,t,!0)},isExported:!0},zK={description:A(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[k(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t,n){let{flatDataX:r,flatDataY:i}=SK(t,n);return r.length===0||i.length===0?new Bi(ko):zh([i],[r],fo(R(e),e=>F(e,this.locale)),!0)},isExported:!0},BK={description:A(`Fits points to exponential growth trend.`),args:[k(`known_data_y (range<number>)`,A(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal exponential growth curve.`)),k(`known_data_x (range<number>, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),k(`new_data_x (any, range, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),k(`b (boolean, default=TRUE)`,A(`Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.`),_K)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ao(`known_data_y`)):Lh(zh(Rh(Ja(e,`known_data_y`)),Ja(t,`known_data_x`),Ja(n,`new_data_y`),L(r)))}},VK={description:A(`Compute the intercept of the linear regression.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let[[],[i]]=Nh([n],[r]);return i},isExported:!0},HK={description:A(`Nth largest element from a data set.`),args:[k(`data (any, range)`,A(`Array or range containing the dataset to consider.`)),k(`n (number)`,A(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;io([e],e=>{typeof e?.value==`number`&&(i=So(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.shift(),a--))});let o=r.shift();return o===void 0?new M(ko):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},UK={description:A(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),k(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),_K),k(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),vK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return e.length===0||e[0].length===0?new M(Ao(`data_y`)):Nh(Ja(t,`data_x`),Ja(e,`data_y`),L(n),L(r))},isExported:!0},WK={description:A(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>, optional, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),k(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),_K),k(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),vK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){if(e.length===0||e[0].length===0)return new M(Ao(`data_y`));let i=Nh(Ja(t,`data_x`),Rh(Ja(e,`data_y`)),L(n),L(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},GK={description:A(`Compute the Matthews correlation coefficient of a dataset.`),args:[k(`data_x (range)`,A(`The range representing the array or matrix of observed data.`)),k(`data_y (range)`,A(`The range representing the array or matrix of predicted data.`))],compute:function(e,t){let n=e.flat(),r=t.flat();if(Th(n,r),n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=L(n[e]);t===L(r[e])?t?o++:a++:t?c++:s++}return(o*a-s*c)/Math.sqrt((o+s)*(o+c)*(a+s)*(a+c))},isExported:!1},KK={description:A(`Maximum value in a numeric dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){return Ah(e,this.locale)},isExported:!0},qK={description:A(`Maximum numeric value in a dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){let t=lo(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:Va(e[0])}},isExported:!0},JK={description:A(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the maximum will be determined.`)),k(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=-1/0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n<i?i:n)},this.locale),n===-1/0?0:n},isExported:!0},YK={description:A(`Median value in a numeric dataset.`),args:[k(`value (any, range, repeating)`,A(`Value or range to consider when calculating the median value.`))],compute:function(...e){let t=[];return ao(e,e=>{t.push(e)},this.locale),{value:TK(t,{value:.5},!0,this.locale),format:Va(t[0])}},isExported:!0},XK={description:A(`Minimum value in a numeric dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){return jh(e,this.locale)},isExported:!0},ZK={description:A(`Minimum numeric value in a dataset.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){let t=lo(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:Va(e[0])}},isExported:!0},QK={description:A(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[k(`range (range)`,A(`The range of cells from which the minimum will be determined.`)),k(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),k(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=1/0;return xo(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n=n>i?i:n)},this.locale),n===1/0?0:n},isExported:!0};function $K(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=0,o=0,s=0,c=0,l=0;for(let e=0;e<i;e++){let t=n[e],i=r[e];a+=t,o+=i,s+=t*i,c+=t*t,l+=i*i}return(i*s-a*o)/Math.sqrt((i*c-a*a)*(i*l-o*o))}let eq={description:A(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return $K(e,t)},isExported:!0},tq=eq,nq={description:A(`Value at a given percentile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return iq.compute.bind(this)(e,t)},isExported:!0},rq={description:A(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile, exclusive of 0 and 1, whose value within 'data' will be calculated and returned.`))],compute:function(e,t){return{value:TK([e],t,!1,this.locale),format:Va(e)}},isExported:!0},iq={description:A(`Value at a given percentile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:TK([e],t,!0,this.locale),format:Va(e)}},isExported:!0},aq={description:A(`Compute the coefficients of polynomial regression of the dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),k(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),yK),k(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),bK)],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=SK(e,t);return i.length===0||a.length===0?new Bi(ko):Ph(a,i,F(n,this.locale),L(r))},isExported:!1},oq={description:A(`Predict value by computing a polynomial regression of the dataset.`),args:[k(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),k(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),yK),k(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),bK)],compute:function(e,t,n,r,i={value:!0}){let a=F(r,this.locale),{flatDataX:o,flatDataY:s}=SK(t,n);if(o.length===0||s.length===0)return new Bi(ko);let c=Ph(s,o,a,L(i)).flat();return fo(R(e),e=>Ih(c,F(e,this.locale),a))},isExported:!1},sq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value to return.`),xK)],compute:function(e,t){return lq.compute.bind(this)(e,t)},isExported:!0},cq={description:A(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value, exclusive of 0 and 4, to return.`),[{value:1,label:A(`First quartile (25th percentile)`)},{value:2,label:A(`Median value (50th percentile)`)},{value:3,label:A(`Third quartile (75th percentile)`)}])],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:TK([e],n,!1,this.locale),format:Va(e)}},isExported:!0},lq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`quartile_number (number)`,A(`Which quartile value to return.`),xK)],compute:function(e,t){let n={value:.25*Math.trunc(F(t,this.locale))};return{value:TK([e],n,!0,this.locale),format:Va(e)}},isExported:!0},uq={description:A(`Returns the rank of a specified value in a dataset.`),args:[k(`value (number)`,A(`The value whose rank will be determined.`)),k(`data (range)`,A(`The range containing the dataset to consider.`)),k(`is_ascending (boolean, default=FALSE)`,A(`Whether to consider the values in data in descending or ascending order.`),[{value:!1,label:A(`Descending`)},{value:!0,label:A(`Ascending`)}])],compute:function(e,t,n={value:!1}){let r=L(n),i=F(e,this.locale),a=1,o=!1;for(let e of t)for(let t of e){if(typeof t.value!=`number`)continue;let e=F(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new Bi(A(`Value not found in the given data.`))},isExported:!0},dq={description:A(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let n=$K(e,t);if(n instanceof Error)throw n;return n**2},isExported:!0},fq={description:A(`Compute the slope of the linear regression.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);if(n.length===0||r.length===0)return new Bi(ko);let[[i]]=Nh([n],[r]);return i},isExported:!0},pq={description:A(`Nth smallest element in a data set.`),args:[k(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),k(`n (number)`,A(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(F(t?.value,this.locale)),r=[],i,a=0;io([e],e=>{typeof e?.value==`number`&&(i=So(r,e,`nextSmaller`,`asc`,r.length,(e,t)=>e[t].value),r.splice(i+1,0,e),a++,a>n&&(r.pop(),a--))});let o=r.pop();return o===void 0?new M(ko):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},mq={description:A(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(t,e);if(n.length===0||r.length===0)return new Bi(ko);let i=n.length,a=n.map((e,t)=>[e,r[t]]);a.sort((e,t)=>e[0]-t[0]);for(let e=0;e<i;++e)a[e][0]=e;a.sort((e,t)=>e[1]-t[1]);let o=0;for(let e=0;e<i;++e)o+=(a[e][0]-e)**2;return 1-6*o/(i**3-i)},isExported:!1},hq={description:A(`Standard deviation.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Cq.compute.bind(this)(...e))},isExported:!0},gq={description:A(`Standard deviation of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(wq.compute.bind(this)(...e))},isExported:!0},_q={description:A(`Standard deviation.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Tq.compute.bind(this)(...e))},isExported:!0},vq={description:A(`Standard deviation of sample (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Eq.compute.bind(this)(...e))},isExported:!0},yq={description:A(`Standard deviation of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Dq.compute.bind(this)(...e))},isExported:!0},bq={description:A(`Standard deviation of entire population (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Oq.compute.bind(this)(...e))},isExported:!0},xq={description:A(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[k(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),k(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=SK(e,t);return n.length===0||r.length===0?new Bi(ko):Nh([n],[r],!0,!0)[1][2]},isExported:!0},Sq={description:A(`Fits points to linear trend derived via least-squares.`),args:[k(`known_data_y (number, range<number>)`,A(`The array or range containing dependent (y) values that are already known, used to curve fit an ideal linear trend.`)),k(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),k(`new_data_x (number, range<number>, optional, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),k(`b (boolean, optional, default=TRUE)`,A(`Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.`),_K)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ao(`known_data_y`)):zh(Ja(e,`known_data_y`),Ja(t,`known_data_x`),Ja(n,`new_data_y`),L(r))}},Cq={description:A(`Variance.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!1,this.locale)},isExported:!0},wq={description:A(`Variance of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!1,this.locale)},isExported:!0},Tq={description:A(`Variance.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!1,this.locale)},isExported:!0},Eq={description:A(`Variance of sample (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return wK(e,!0,!0,this.locale)},isExported:!0},Dq={description:A(`Variance of entire population.`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!1,this.locale)},isExported:!0},Oq={description:A(`Variance of entire population (text as 0).`),args:[k(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return wK(e,!1,!0,this.locale)},isExported:!0};var kq=l({DAVERAGE:()=>Mq,DCOUNT:()=>Nq,DCOUNTA:()=>Pq,DGET:()=>Fq,DMAX:()=>Iq,DMIN:()=>Lq,DPRODUCT:()=>Rq,DSTDEV:()=>zq,DSTDEVP:()=>Bq,DSUM:()=>Vq,DVAR:()=>Hq,DVARP:()=>Uq});function Aq(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(I(e[t][0]).toUpperCase(),t);let o=t?.value;if(typeof o!=`number`&&typeof o!=`string`)throw new M(A(`The field must be a number or a string`));let s;if(typeof o==`number`){if(s=Math.trunc(o)-1,s<0||a-1<s)throw new M(A(`The field (%(fieldValue)s) must be one of %(dimRowDB)s or must be a number between 1 and %s inclusive.`,{fieldValue:o.toString(),dimRowDB:a.toString()}))}else{let e=I(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(A(`The field (%s) must be one of %s.`,I(t),[...i.keys()].toString()))}let c=n[0].length;if(c<2)throw new M(A(`The criteria range contains %s row, it must be at least 2 rows.`,c.toString()));let l=new Set,u=e[0].length;for(let t=1;t<c;t++){let a=[],o=!0;for(let r=0;r<n.length;r++){let s=I(n[r][0]).toUpperCase(),c=i.get(s),l=n[r][t];if(l.value!==null)if(c!==void 0)a.push([e[c].slice(1,u)]),a.push(l);else{o=!1;break}}if(o)if(a.length>0)xo(a,(e,t)=>{l.add(t)},r,!0);else{l=new Set(Array(u-1).keys());break}}let d=e[s];return[...l].map(e=>d[e+1])}let jq=[k(`database (range)`,A(`The array or range containing the data to consider, structured in such a way that the first row contains the labels for each column's values.`)),k(`field (number, string)`,A(`Indicates which column in database contains the values to be extracted and operated on.`)),k(`criteria (range)`,A(`An array or range containing zero or more criteria to filter the database values by before operating.`))],Mq={description:A(`Average of a set of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return DK.compute.bind(this)([r])},isExported:!0},Nq={description:A(`Counts values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return PK.compute.bind(this)([r])},isExported:!0},Pq={description:A(`Counts values and text from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return FK.compute.bind(this)([r])},isExported:!0},Fq={description:A(`Single value from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return r.length===1?r[0]:new M(A(`More than one match found in DGET evaluation.`))},isExported:!0},Iq={description:A(`Maximum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return KK.compute.bind(this)([r])},isExported:!0},Lq={description:A(`Minimum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return XK.compute.bind(this)([r])},isExported:!0},Rq={description:A(`Product of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return GG.compute.bind(this)([r])},isExported:!0},zq={description:A(`Standard deviation of population sample from table.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return hq.compute.bind(this)([r])},isExported:!0},Bq={description:A(`Standard deviation of entire population from table.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return yq.compute.bind(this)([r])},isExported:!0},Vq={description:A(`Sum of values from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return cK.compute.bind(this)([r])},isExported:!0},Hq={description:A(`Variance of population sample from table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return Cq.compute.bind(this)([r])},isExported:!0},Uq={description:A(`Variance of a population from a table-like range.`),args:jq,compute:function(e,t,n){let r=Aq(e,t,n,this.locale);return Dq.compute.bind(this)([r])},isExported:!0},Wq=A(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`),Gq=A(`There must be both positive and negative values in cashflow_amounts.`),Kq=e=>A(`The cost (%s) must be positive or null.`,e),qq=e=>A(`The cost (%s) must be strictly positive.`,e),Jq=e=>A(`The frequency (%s) must be one of %s`,e,[1,2,4].toString()),Yq=e=>A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e),Xq=e=>A(`The depreciation factor (%s) must be strictly positive.`,e),Zq=e=>A(`The discount (%s) must be different from -1.`,e),Qq=e=>A(`The discount (%s) must be strictly positive.`,e),$q=e=>A(`The discount (%s) must be smaller than 1.`,e),eJ=e=>A(`The effective_rate (%s) must be strictly positive.`,e),tJ=e=>A(`The end_period (%s) must be positive or null.`,e),nJ=(e,t)=>A(`The end_period (%(end)s) must be smaller or equal to the life (%(life)s).`,{end:e,life:t}),rJ=e=>A(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e),iJ=(e,t)=>A(`The first_period (%(first)s) must be smaller or equal to the last_period (%(last)s).`,{first:e,last:t}),aJ=e=>A(`The first_period (%s) must be strictly positive.`,e),oJ=e=>A(`The future_value (%s) must be strictly positive.`,e),sJ=e=>A(`The investment (%s) must be strictly positive.`,e),cJ=e=>A(`The issue (%s) must be positive or null.`,e),lJ=(e,t)=>A(`The last_period (%(last)s) must be smaller or equal to the number_of_periods (%(nPeriods)s).`,{last:e,nPeriods:t}),uJ=e=>A(`The last_period (%s) must be strictly positive.`,e),dJ=e=>A(`The life (%s) must be strictly positive.`,e),fJ=(e,t)=>A(`The maturity (%(maturity)s) must be strictly greater than the settlement (%(settlement)s).`,{maturity:t,settlement:e}),pJ=e=>A(`The month (%s) must be between 1 and 12 inclusive.`,e),mJ=e=>A(`The nominal_rate (%s) must be strictly positive.`,e),hJ=e=>A(`The number_of_periods (%s) must be different from zero.`,e),gJ=e=>A(`The number_of_periods (%s) must be strictly positive.`,e),_J=e=>A(`The period must be between 1 and number_of_periods (%s)`,e),vJ=(e,t)=>A(`The period (%(period)s) must be less than or equal to %(lifeLimit)s.`,{period:e,lifeLimit:t}),yJ=e=>A(`The period (%s) must be positive or null.`,e),bJ=e=>A(`The periods_by_year (%s) must be strictly positive.`,e),xJ=(e,t)=>A(`The period (%(period)s) must be less than or equal life (%(life)s).`,{period:e,life:t}),SJ=e=>A(`The period (%s) must be strictly positive.`,e),CJ=e=>A(`The present_value (%s) must be strictly positive.`,e),wJ=e=>A(`The price (%s) must be strictly positive.`,e),TJ=(e,t)=>A(`The purchase_date (%(purchaseDate)s) must be before the first_period_end (%(firstPeriodEnd)s).`,{purchaseDate:e,firstPeriodEnd:t}),EJ=e=>A(`The purchase_date (%s) must be positive or null.`,e),DJ=e=>A(`The rate_guess (%s) must be strictly greater than -1.`,e),OJ=e=>A(`The rate (%s) must be positive or null.`,e),kJ=e=>A(`The rate (%s) must be strictly positive.`,e),AJ=e=>A(`The redemption (%s) must be strictly positive.`,e),jJ=e=>A(`The salvage (%s) must be positive or null.`,e),MJ=(e,t)=>A(`The salvage (%(salvage)s) must be smaller or equal than the cost (%(cost)s).`,{salvage:e,cost:t}),NJ=(e,t)=>A(`The settlement date (%(settlement)s) must be greater or equal to the issue date (%(issue)s).`,{settlement:e,issue:t}),PJ=(e,t)=>A(`The settlement date (%(settlement)s) must at most one year after the maturity date (%(maturity)s).`,{settlement:e,maturity:t}),FJ=(e,t)=>A(`The settlement date (%(settlement)s) must be strictly greater than the issue date (%(issue)s).`,{settlement:e,issue:t}),IJ=e=>A(`The start_period (%s) must be positive or null.`,e),LJ=(e,t)=>A(`The start_period (%(start)s) must be smaller or equal to the end_period (%(end)s).`,{start:e,end:t}),RJ=e=>A(`The unit (%s) must be strictly positive.`,e),zJ=e=>A(`The yield (%s) must be positive or null.`,e);function BJ(e){return e.some(e=>e>0)&&e.some(e=>e<0)}function VJ(e){return![0,1,2,3,4].includes(e)}function HJ(e){return![1,2,4].includes(e)}function UJ(e,t,n){let r=to(e,n),i=to(t,n),a=to(e,n);return a.setFullYear(r.getFullYear()+1),i.getTime()<=a.getTime()}let WJ=[{value:0,label:A(`US (NASD) 30/360`)},{value:1,label:A(`Actual/Actual`)},{value:2,label:A(`Actual/360`)},{value:3,label:A(`Actual/365`)},{value:4,label:A(`European 30/360`)}];var GJ=l({DATE:()=>qJ,DATEDIF:()=>JJ,DATEVALUE:()=>YJ,DAY:()=>XJ,DAYS:()=>ZJ,DAYS360:()=>QJ,EDATE:()=>$J,EOMONTH:()=>eY,HOUR:()=>tY,ISOWEEKNUM:()=>nY,MINUTE:()=>rY,MONTH:()=>iY,MONTH_END:()=>xY,MONTH_START:()=>bY,NETWORKDAYS:()=>aY,NETWORKDAYS_INTL:()=>cY,NOW:()=>lY,QUARTER:()=>SY,QUARTER_END:()=>wY,QUARTER_START:()=>CY,SECOND:()=>uY,TIME:()=>dY,TIMEVALUE:()=>fY,TODAY:()=>pY,WEEKDAY:()=>mY,WEEKNUM:()=>hY,WORKDAY:()=>gY,WORKDAY_INTL:()=>_Y,YEAR:()=>vY,YEARFRAC:()=>yY,YEAR_END:()=>EY,YEAR_START:()=>TY}),KJ=function(e){return e.WHOLE_YEARS=`Y`,e.WHOLE_MONTHS=`M`,e.WHOLE_DAYS=`D`,e.DAYS_WITHOUT_WHOLE_MONTHS=`MD`,e.MONTH_WITHOUT_WHOLE_YEARS=`YM`,e.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR=`YD`,e}(KJ||{});let qJ={description:A(`Converts year/month/day into a date.`),args:[k(`year (number)`,A(`The year component of the date.`)),k(`month (number)`,A(`The month component of the date.`)),k(`day (number)`,A(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));if(r<0||r>9999)return new M(A(`The year (%s) must be between 0 and 9999 inclusive.`,r.toString()));r<1900&&(r+=1900);let o=_a(new N(r,i-1,a));return o<0?new M(A(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`)):{value:o,format:this.locale.dateFormat}},isExported:!0},JJ={description:A(`Calculates the number of days, months, or years between two dates.`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),k(`end_date (date)`,A(`The end date to consider in the calculation. Must be a reference to a cell containing a DATE, a function returning a DATE type, or a number.`)),k(`unit (string)`,A(`A text abbreviation for unit of time.`),[{value:`Y`,label:A(`The number of whole years between start_date and end_date`)},{value:`M`,label:A(`The number of whole months between start_date and end_date`)},{value:`D`,label:A(`The number of days between start_date and end_date`)},{value:`MD`,label:A(`The number of days between start_date and end_date after subtracting whole months`)},{value:`YM`,label:A(`The number of whole months between start_date and end_date after subtracting whole years`)},{value:`YD`,label:A(`The number of days between start_date and end_date, assuming start_date and end_date were no more than one year apart`)}])],compute:function(e,t,n){let r=I(n).toUpperCase();if(!Object.values(KJ).includes(r))return new M(Ka(Object.values(KJ),I(n)));let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=ga(i),s=ga(a);if(a<i)return new M(A(`start_date (%s) should be on or before end_date (%s).`,o.toLocaleDateString(),s.toLocaleDateString()));switch(r){case KJ.WHOLE_YEARS:return Ea(o,s);case KJ.WHOLE_MONTHS:return wa(o,s);case KJ.WHOLE_DAYS:return Ta(o,s);case KJ.MONTH_WITHOUT_WHOLE_YEARS:return wa(o,s)-Ea(o,s)*12;case KJ.DAYS_WITHOUT_WHOLE_MONTHS:let e=s.getDate()-o.getDate();return e<0&&(e=ya(new N(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case KJ.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR:{if(Da(i,a))return Ta(o,s);let e=new N(o.getFullYear(),s.getMonth(),s.getDate()),t=Ta(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=Ta(o,e)),t}}},isExported:!0},YJ={description:A(`Converts a date string to a date value.`),args:[k(`date_string (string)`,A(`The string representing the date.`))],compute:function(e){let t=I(e),n=oa(t,this.locale);return n===null?new M(A(`The date_string (%s) cannot be parsed to date/time.`,t.toString())):Math.trunc(n.value)},isExported:!0},XJ={description:A(`Day of the month that a specific date falls on.`),args:[k(`date (string)`,A(`The date from which to extract the day.`))],compute:function(e){return to(e,this.locale).getDate()},isExported:!0},ZJ={description:A(`Number of days between two dates.`),args:[k(`end_date (date)`,A(`The end of the date range.`)),k(`start_date (date)`,A(`The start of the date range.`))],compute:function(e,t){let n=to(e,this.locale),r=to(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Ki)},isExported:!0},QJ={description:A(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation.`)),k(`end_date (date)`,A(`The end date to consider in the calculation.`)),k(`method (boolean, default=false)`,A(`An indicator of what day count method to use.`),[{value:!1,label:A(`U.S. NASD method (default)`)},{value:!0,label:A(`European method`)}])],compute:function(e,t,n={value:!1}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Ca(r,i,L(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},$J={description:A(`Date a number of months before/after another date.`),args:[k(`start_date (date)`,A(`The date from which to calculate the result.`)),k(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:_a(xa(to(e,this.locale),Math.trunc(F(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},eY={description:A(`Last day of a month before or after a date.`),args:[k(`start_date (date)`,A(`The date from which to calculate the result.`)),k(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=to(e,this.locale),r=Math.trunc(F(t,this.locale));return{value:_a(new N(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},tY={description:A(`Hour component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the hour component.`))],compute:function(e){return to(e,this.locale).getHours()},isExported:!0},nY={description:A(`ISO week number of the year.`),args:[k(`date (date)`,A(`The date for which to determine the ISO week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`))],compute:function(e){let t=to(e,this.locale),n=t.getFullYear(),r=1;for(;new N(n,0,r).getDay()!==4;)r+=1;let i=new N(n,0,r-3),a=31;for(;new N(n,11,a).getDay()!==4;)--a;let o=new N(n,11,a+3),s;s=i.getTime()<=t.getTime()?t.getTime()<=o.getTime()?0:1:-1;let c;switch(s){case 0:c=i;break;case 1:c=new N(n,11,a+3+1);break;case-1:let e=1;for(;new N(n-1,0,e).getDay()!==4;)e+=1;c=new N(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Ki;return Math.floor(l/7)+1},isExported:!0},rY={description:A(`Minute component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the minute component.`))],compute:function(e){return to(e,this.locale).getMinutes()},isExported:!0},iY={description:A(`Month of the year a specific date falls in`),args:[k(`date (date)`,A(`The date from which to extract the month.`))],compute:function(e){return to(e,this.locale).getMonth()+1},isExported:!0},aY={description:A(`Net working days between two provided days.`),args:[k(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),k(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the date serial numbers to consider holidays.`))],compute:function(e,t,n){return cY.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function oY(e){let t=e?.value;if(typeof t==`string`){fh(t.length===7&&[...t].every(e=>e===`0`||e===`1`),A(`When weekend is a string (%s) it must be composed of "0" or "1".`,t));let e=[];for(let n=0;n<7;n++)t[n]===`1`&&e.push((n+1)%7);return e}if(typeof t==`number`)return fh(1<=t&&t<=7||11<=t&&t<=17,A(`The weekend (%s) must be a string or a number in the range 1-7 or 11-17.`,t.toString())),t<=7?[t-2==-1?6:t-2,t-1]:[t-11];throw new M(A(`The weekend must be a number or a string.`))}let sY=[{value:1,label:A(`Saturday/Sunday are weekends`)},{value:2,label:A(`Sunday/Monday are weekends`)},{value:3,label:A(`Monday/Tuesday are weekends`)},{value:4,label:A(`Tuesday/Wednesday are weekends`)},{value:5,label:A(`Wednesday/Thursday are weekends`)},{value:6,label:A(`Thursday/Friday are weekends`)},{value:7,label:A(`Friday/Saturday are weekends`)},{value:11,label:A(`Sunday is the only weekend`)},{value:12,label:A(`Monday is the only weekend`)},{value:13,label:A(`Tuesday is the only weekend`)},{value:14,label:A(`Wednesday is the only weekend`)},{value:15,label:A(`Thursday is the only weekend`)},{value:16,label:A(`Friday is the only weekend`)},{value:17,label:A(`Saturday is the only weekend`)}],cY={description:A(`Net working days between two dates (specifying weekends).`),args:[k(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),k(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),k(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),sY),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider as holidays.`))],compute:function(e,t,n={value:1},r){let i=to(e,this.locale),a=to(t,this.locale),o=oY(n),s=new Set;r!==void 0&&io([r],e=>{let t=to(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=N.fromTimestamp((c?i:a).getTime()),u=N.fromTimestamp((c?a:i).getTime()),d=l.getTime(),f=u.getTime(),p=0;for(;f<=d;)!o.includes(u.getDay())&&!s.has(f)&&(p+=1),u.setDate(u.getDate()+1),f=u.getTime();return c?-p:p},isExported:!0},lY={description:A(`Current date and time as a date value.`),args:[],compute:function(){let e=N.now(),t=e.getTime()-Gi.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Ki)+n,format:ub(this.locale)}},isExported:!0},uY={description:A(`Minute component of a specific time.`),args:[k(`time (date)`,A(`The time from which to calculate the second component.`))],compute:function(e){return to(e,this.locale).getSeconds()},isExported:!0},dY={description:A(`Converts hour/minute/second into a time.`),args:[k(`hour (number)`,A(`The hour component of the time.`)),k(`minute (number)`,A(`The minute component of the time.`)),k(`second (number)`,A(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return i+=Math.floor(a/60),a=a%60+(a<0?60:0),r+=Math.floor(i/60),i=i%60+(i<0?60:0),r%=24,r<0?new M(A(`The function [[FUNCTION_NAME]] result cannot be negative`)):{value:r/24+i/1440+a/(1440*60),format:this.locale.timeFormat}},isExported:!0},fY={description:A(`Converts a time string into its serial number representation.`),args:[k(`time_string (string)`,A(`The string that holds the time representation.`))],compute:function(e){let t=I(e),n=oa(t,this.locale);if(n===null)return new M(A(`The time_string (%s) cannot be parsed to date/time.`,t));let r=n.value-Math.trunc(n.value);return r<0?1+r:r},isExported:!0},pY={description:A(`Current date as a date value.`),args:[],compute:function(){let e=N.now();return{value:_a(new N(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},mY={description:A(`Day of the week of the date provided (as number).`),args:[k(`date (date)`,A(`The date for which to determine the day of the week. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`type (number, default=1)`,A(`A number indicating which numbering system to use to represent weekdays. By default, counts starting with Sunday = 1.`),[{value:1,label:A(`Numbers 1 (Sunday) trough 7 (Saturday)`)},{value:2,label:A(`Numbers 1 (Monday) trough 7 (Sunday)`)},{value:3,label:A(`Numbers 0 (Monday) trough 6 (Sunday)`)},{value:11,label:A(`Numbers 1 (Monday) trough 7 (Sunday)`)},{value:12,label:A(`Numbers 1 (Tuesday) trough 7 (Monday)`)},{value:13,label:A(`Numbers 1 (Wednesday) trough 7 (Tuesday)`)},{value:14,label:A(`Numbers 1 (Thursday) trough 7 (Wednesday)`)},{value:15,label:A(`Numbers 1 (Friday) trough 7 (Thursday)`)},{value:16,label:A(`Numbers 1 (Saturday) trough 7 (Friday)`)},{value:17,label:A(`Numbers 1 (Sunday) trough 7 (Saturday)`)}])],compute:function(e,t={value:1}){let n=to(e,this.locale),r=Math.round(F(t,this.locale)),i=n.getDay();if(!(1<=r&&r<=3)&&!(11<=r&&r<=17))return new M(A(`The type (%s) must be between 1 and 3 or between 11 and 17.`,r));switch(r){case 1:return i+1;case 2:return i===0?7:i;case 3:return i===0?6:i-1}let a=r-10,o=(i+1-a+7)%7;return o===0?7:o},isExported:!0},hY={description:A(`Week number of the year.`),args:[k(`date (date)`,A(`The date for which to determine the week number. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`type (number, default=1)`,A(`A number representing the day that a week starts on. Sunday = 1.`),[{value:1,label:A(`Sunday`)},{value:2,label:A(`Monday`)},{value:11,label:A(`Monday`)},{value:12,label:A(`Tuesday`)},{value:13,label:A(`Wednesday`)},{value:14,label:A(`Thursday`)},{value:15,label:A(`Friday`)},{value:16,label:A(`Saturday`)},{value:17,label:A(`Sunday`)},{value:21,label:A(`ISO week number (Monday as first day of the week)`)}])],compute:function(e,t={value:1}){let n=to(e,this.locale),r=Math.round(F(t,this.locale));if(![1,2,11,12,13,14,15,16,17,21].includes(r))return new M(A(`The type (%s) is out of range.`,r.toString()));if(r===21)return nY.compute.bind(this)(e);let i;i=r===1||r===2?r-1:r-10==7?0:r-10;let a=n.getFullYear(),o=1,s=new N(a,0,o);for(;s.getDay()!==i;)o+=1,s=new N(a,0,o);let c=(n.getTime()-s.getTime())/Ki;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},gY={description:A(`Date after a number of workdays.`),args:[k(`start_date (date)`,A(`The date from which to begin counting.`)),k(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:null}){return _Y.compute.bind(this)(e,t,{value:1},n)},isExported:!0},_Y={description:A(`Date after a number of workdays (specifying weekends).`),args:[k(`start_date (date)`,A(`The date from which to begin counting.`)),k(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),k(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),sY),k(`holidays (date, range<date>, optional)`,A(`A range or array constant containing the dates to consider holidays.`))],compute:function(e,t,n={value:1},r){let i=to(e,this.locale),a=Math.trunc(F(t,this.locale));if(n.value===`1111111`)return new M(A(`The weekend must be different from '1111111'.`));let o=oY(n),s=new Set;r!==void 0&&io([r],e=>{let t=to(e,this.locale);s.add(t.getTime())});let c=N.fromTimestamp(i.getTime()),l=c.getTime(),u=Math.sign(a),d=Math.abs(a);for(;d>0;)c.setDate(c.getDate()+u),l=c.getTime(),!o.includes(c.getDay())&&!s.has(l)&&--d;let f=l-Gi.getTime();return{value:Math.round(f/Ki),format:this.locale.dateFormat}},isExported:!0},vY={description:A(`Year specified by a given date.`),args:[k(`date (date)`,A(`The date from which to extract the year.`))],compute:function(e){return to(e,this.locale).getFullYear()},isExported:!0},yY={description:A(`Exact number of years between two dates.`),args:[k(`start_date (date)`,A(`The start date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`end_date (date)`,A(`The end date to consider in the calculation. Must be a reference to a cell containing a date, a function returning a date type, or a number.`)),k(`day_count_convention (number, default=0)`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n={value:0}){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=Math.trunc(F(n,this.locale));return r<0?new M(A(`The start_date (%s) must be positive or null.`,r)):i<0?new M(A(`The end_date (%s) must be positive or null.`,i)):0>a||a>4?new M(A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,a)):Ca(r,i,a)}},bY={description:A(`First day of the month preceding a date.`),args:[k(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){let t=to(e,this.locale);return{value:_a(new N(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},xY={description:A(`Last day of the month following a date.`),args:[k(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){return eY.compute.bind(this)(e,{value:0})}},SY={description:A(`Quarter of the year a specific date falls in`),args:[k(`date (date)`,A(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((to(e,this.locale).getMonth()+1)/3)}},CY={description:A(`First day of the quarter of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=SY.compute.bind(this)(e);return{value:_a(new N(vY.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},wY={description:A(`Last day of the quarter of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=SY.compute.bind(this)(e);return{value:_a(new N(vY.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},TY={description:A(`First day of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:_a(new N(vY.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},EY={description:A(`Last day of the year a specific date falls in.`),args:[k(`date (date)`,A(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:_a(new N(vY.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var DY=l({DELTA:()=>OY});let OY={description:A(`Compare two numeric values, returning 1 if they're equal.`),args:[k(`number1 (number)`,A(`The first number to compare.`)),k(`number2 (number, default=0)`,A(`The second number to compare.`))],compute:function(e,t={value:0}){return+(F(e,this.locale)===F(t,this.locale))},isExported:!0};var kY=l({FILTER:()=>jY,SORT:()=>MY,SORTN:()=>NY,UNIQUE:()=>PY});function AY(e,t,...n){for(let e=0;e<n.length;e++){let t=e%2==0?`sort_column`:`is_ascending`;fh(n[e]!==void 0,A(`Value for parameter %s is missing in [[FUNCTION_NAME]].`,t))}let r=[],i=[],a=e.length;for(let o=0;o<n.length;o+=2){r.push(L(Sh(n[o+1])?.value)?`asc`:`desc`);let s=n[o];if(Je(s)&&(s.length>1||s[0].length>1))fh(s.length===1&&s[0].length===a,A(`Wrong size for %s. Expected a range of size 1x%s. Got %sx%s.`,`sort_column${o+1}`,a,s.length,s[0].length)),i.push(s.flat().map(e=>e.value));else{let n=F(Sh(s)?.value,t);if(n<1||n>e[0].length)return e;i.push(e.map(e=>e[n-1].value))}}if(i.length===0)for(let t=0;t<e[0].length;t++)i.push(e.map(e=>e[t].value)),r.push(`asc`);let o={desc:Ez(`desc`),asc:Ez(`asc`)},s=C(0,e.length);return s.sort((e,t)=>{for(let[n,a]of i.entries()){let i=a[e],s=a[t],c={value:i,type:i===null?V.empty:typeof i==`string`?V.text:typeof i},l={value:s,type:s===null?V.empty:typeof s==`string`?V.text:typeof s},u=o[r[n]](c,l);if(u!==0)return u}return 0}),s.map(t=>e[t])}let jY={description:A(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[k(`range (any, range<any>)`,A(`The data to be filtered.`)),k(`condition (boolean, range<boolean>, repeating)`,A(`Column or row containing true or false values corresponding to the range.`))],compute:function(e,...t){let n=R(e),r=t.map(e=>fo(R(e),e=>e.value));for(let e of r)if(!mh(e))return new M(A(`The arguments condition must be a single column or row.`));if(!hh(...t))return new M(A(`The arguments conditions must have the same dimensions.`));let i=r.map(e=>e.flat()),a=r[0].length===1?`row`:`col`;if(n=a===`row`?mo(n):n,i.some(e=>e.length!==n.length))return new M(A(`FILTER has mismatched sizes on the range and conditions.`));let o=[];for(let e=0;e<n.length;e++){let t=n[e];i.every(t=>(typeof t[e]==`boolean`||typeof t[e]==`number`)&&t[e])&&o.push(t)}return o.length?a===`row`?mo(o):o:new Bi(A(`No match found in FILTER evaluation`))},isExported:!1},MY={description:A(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[k(`range (range)`,A(`The data to be sorted.`)),k(`sort_column (any, range<number>, repeating, optional)`,A(`The index of the column in range or a range outside of range containing the value by which to sort.`)),k(`is_ascending (boolean, repeating, optional)`,A(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`),[{value:!0,label:A(`Ascending`)},{value:!1,label:A(`Descending`)}])],compute:function(e,...t){return mo(AY(mo(e),this.locale,...t))},isExported:!0},NY={description:A(`Returns the first n items in a data set after performing a sort.`),args:[k(`range (range)`,A(`The data to be sorted.`)),k(`n (number)`,A(`The number of items to return.`)),k(`display_ties_mode (number, default=0)`,A(`A number representing the way to display ties.`)),k(`sort_column (number, range<number>, repeating, optional)`,A(`The index of the column in range or a range outside of range containing the value by which to sort.`)),k(`is_ascending (boolean, repeating, optional)`,A(`TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.`),[{value:!0,label:A(`Ascending`)},{value:!1,label:A(`Descending`)}])],compute:function(e,t,...n){let r=F(t?.value??1,this.locale),i=n.length%2==0?0:F(n[0]?.value,this.locale),a=n.length%2==0?n:n.slice(1);if(r<0)return new M(A(`Wrong value of 'n'. Expected a positive number. Got %s.`,r));if(i<0||i>3)return new M(A(`Wrong value of 'display_ties_mode'. Expected a positive number between 0 and 3. Got %s.`,i));let o=AY(mo(e),this.locale,...a),s=(e,t)=>JSON.stringify(o[e].map(e=>e.value))===JSON.stringify(o[t].map(e=>e.value));switch(i){case 0:return mo(o.slice(0,r));case 1:for(let e=r;e<o.length;e++)if(!s(e,r-1))return mo(o.slice(0,e));return mo(o);case 2:{let e=[o[0]];for(let t=1;t<o.length;t++)for(let n=0;n<t&&!s(t,n);n++)n===t-1&&e.push(o[t]);return mo(e.slice(0,r))}case 3:{let e=[o[0]],t=1;for(let n=1;n<o.length&&(s(n,n-1)||t++,!(t>r));n++)e.push(o[n]);return mo(e)}}},isExported:!1},PY={description:A(`Unique rows in the provided source range.`),args:[k(`range (any, range<any>)`,A(`The data to filter by unique entries.`)),k(`by_column (boolean, default=FALSE)`,A(`Whether to filter the data by columns or by rows.`),[{value:!0,label:A(`Return unique columns`)},{value:!1,label:A(`Return unique rows`)}]),k(`exactly_once (boolean, default=FALSE)`,A(`Whether to return only entries with no duplicates.`),[{value:!0,label:A(`Return items that appear exactly once`)},{value:!1,label:A(`Return every distinct item`)}])],compute:function(e={value:``},t,n){if(!Je(e))return[[e]];let r=L(t?.value)||!1,i=L(n?.value)||!1;r||(e=mo(e));let a=new Map;for(let t of e){let e=JSON.stringify(t.map(e=>e.value)),n=a.get(e);n?n.count++:a.set(e,{data:t,count:1})}let o=[];for(let e of a.values())i&&e.count>1||o.push(e.data);return o.length?r?o:mo(o):new M(A(`No unique values found`))},isExported:!0};var FY=l({ACCRINTM:()=>BY,AMORLINC:()=>VY,COUPDAYBS:()=>UY,COUPDAYS:()=>HY,COUPDAYSNC:()=>WY,COUPNCD:()=>GY,COUPNUM:()=>KY,COUPPCD:()=>qY,CUMIPMT:()=>JY,CUMPRINC:()=>YY,DB:()=>XY,DDB:()=>QY,DISC:()=>$Y,DOLLARDE:()=>eX,DOLLARFR:()=>tX,DURATION:()=>nX,EFFECT:()=>rX,FV:()=>aX,FVSCHEDULE:()=>oX,INTRATE:()=>sX,IPMT:()=>lX,IRR:()=>dX,ISPMT:()=>fX,MDURATION:()=>pX,MIRR:()=>mX,NOMINAL:()=>hX,NPER:()=>gX,NPV:()=>vX,PDURATION:()=>yX,PMT:()=>xX,PPMT:()=>CX,PRICE:()=>TX,PRICEDISC:()=>EX,PRICEMAT:()=>DX,PV:()=>wX,RATE:()=>kX,RECEIVED:()=>AX,RRI:()=>jX,SLN:()=>MX,SYD:()=>NX,TBILLEQ:()=>IX,TBILLPRICE:()=>FX,TBILLYIELD:()=>LX,VDB:()=>RX,XIRR:()=>zX,XNPV:()=>BX,YIELD:()=>VX,YIELDDISC:()=>HX,YIELDMAT:()=>UX});let IY=[{value:1,label:A(`Annual`)},{value:2,label:A(`Semi-annual`)},{value:4,label:A(`Quarterly`)}],LY=[{value:0,label:A(`End of period (default)`)},{value:1,label:A(`Beginning of period`)}],RY=[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)];function zY(e,t,n,r,i=1e-10,a){let o=n,s,c,l,u=!1,d=0,f;do{if(l=e(o),isNaN(l)){fh(d<r&&a!==void 0,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++,o=a(f),f=o;continue}s=o-l/t(o),c=Math.abs(s-o),o=s,u=c<i||Math.abs(l)<i,fh(d<r,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let BY={description:A(`Accrued interest of security paying at maturity.`),args:[k(`issue (date)`,A(`The date the security was initially issued.`)),k(`maturity (date)`,A(`The maturity date of the security.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));if(a<0)return new M(cJ(a));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(AJ(s));if(c<=0)return new M(kJ(c));let u=Ca(a,o,l);return s*c*u},isExported:!0},VY={description:A(`Depreciation for an accounting period.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`purchase_date (date)`,A(`The date the asset was purchased.`)),k(`first_period_end (date)`,A(`The date the first period ended.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`rate (number)`,A(`The deprecation rate.`)),k(`day_count_convention (number, optional)`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=F(e,this.locale),c=Math.trunc(F(t,this.locale)),l=Math.trunc(F(n,this.locale)),u=F(r,this.locale),d=F(i,this.locale),f=F(a,this.locale),p=Math.trunc(F(o,this.locale));if(s<=0)return new M(qq(s));if(c<0)return new M(EJ(c));if(u<0)return new M(jJ(u));if(u>s)return new M(MJ(u,s));if(d<0)return new M(yJ(d));if(f<=0)return new M(kJ(f));if(VJ(p))return new M(Yq(p));if(c>l)return new M(TJ(c,l));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=Ca(c,l,p),_=c===l?h:h*g,v=s-_-h*m;return v>=u?m===0?_:h:u-v<h?h-(u-v):0},isExported:!0},HY={description:A(`Days in coupon period containing settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));if(s===1){let i=qY.compute.bind(this)(e,t,n,r).value,a=GY.compute.bind(this)(e,t,n,r).value;return F(a,this.locale)-F(i,this.locale)}return(s===3?365:360)/o},isExported:!0},UY={description:A(`Days from settlement until next coupon.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=qY.compute.bind(this)(e,t,n,r).value,l=F(c,this.locale);if([1,2,3].includes(s))return i-l;if(s===4){let e=Ca(l,i,s);return Math.round(e*360)}let u=to(i,this.locale),d=to(l,this.locale),f=d.getFullYear(),p=u.getFullYear(),m=d.getMonth()+1,h=u.getMonth()+1,g=d.getDate(),_=u.getDate();return m===2&&h===2&&ba(d)&&ba(u)&&(_=30),_===31&&(g===30||g===31)&&(_=30),m===2&&ba(d)&&(g=30),g===31&&(g=30),(p-f)*360+(h-m)*30+(_-g)},isExported:!0},WY={description:A(`Days from settlement until next coupon.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=GY.compute.bind(this)(e,t,n,r).value,l=F(c,this.locale);if([1,2,3].includes(s))return l-i;if(s===4){let e=Ca(i,l,s);return Math.round(e*360)}let u=UY.compute.bind(this)(e,t,n,r);return F(HY.compute.bind(this)(e,t,n,r),this.locale)-F(u,this.locale)},isExported:!0},GY={description:A(`Next coupon date after the settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=12/o,l=KY.compute.bind(this)(e,t,n,r);return{value:_a(xa(to(a,this.locale),-(F(l,this.locale)-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},KY={description:A(`Number of coupons between settlement and maturity.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=1,l=a,u=12/o;for(;l>i;)l=_a(xa(to(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},qY={description:A(`Last coupon date prior to or on the settlement date.`),args:RY,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(F(e,this.locale)),a=Math.trunc(F(t,this.locale)),o=Math.trunc(F(n,this.locale)),s=Math.trunc(F(r,this.locale));if(i>=a)return new M(fJ(i,a));if(HJ(o))return new M(Jq(o));if(VJ(s))return new M(Yq(s));let c=12/o,l=KY.compute.bind(this)(e,t,n,r);return{value:_a(xa(to(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},JY={description:A(`Cumulative interest paid over a set of periods.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),k(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);if(u<=0)return new M(gJ(u));if(o<=0)return new M(aJ(o));if(s<=0)return new M(uJ(s));if(o>s)return new M(iJ(o,s));if(s>u)return new M(lJ(s,u));if(c<=0)return new M(kJ(c));if(l<=0)return new M(CJ(l));let f=0;for(let e=o;e<=s;e++)f+=cX(c,e,u,l,0,d);return f},isExported:!0},YY={description:A(`Cumulative principal paid over a set of periods.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),k(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i,a={value:0}){let o=F(r,this.locale),s=F(i,this.locale),c=F(e,this.locale),l=F(n,this.locale),u=F(t,this.locale),d=+!!L(a);if(u<=0)return new M(gJ(u));if(o<=0)return new M(aJ(o));if(s<=0)return new M(uJ(s));if(o>s)return new M(iJ(o,s));if(s>u)return new M(lJ(s,u));if(c<=0)return new M(kJ(c));if(l<=0)return new M(CJ(l));let f=0;for(let e=o;e<=s;e++)f+=SX(c,e,u,l,0,d);return f},isExported:!0},XY={description:A(`Depreciation via declining balance method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`month (number, optional)`,A(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=Math.trunc(F(r,this.locale)),l=i.length?Math.trunc(F(i[0],this.locale)):12,u=s+(l===12?0:1);if(a<0)return new M(Kq(a));if(o<0)return new M(jJ(o));if(c<=0)return new M(SJ(c));if(s<=0)return new M(dJ(s));if(1>l||l>12)return new M(pJ(l));if(c>u)return new M(vJ(c,u));let d=l/12,f=1-(o/a)**(1/s);f=Math.round(f*1e3)/1e3;let p=a,m=a*(1-f*d);for(let e=1;e<c;e++)p=m,m=p*(1-f),e===s&&(m=p*(1-f*(1-d)));return{value:p-m,format:`#,##0.00`}},isExported:!0},ZY=`#,##0.00`,QY={description:A(`Depreciation via double-declining balance method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),k(`factor (number, default=2)`,A(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(a<0)return new M(Kq(a));if(o<0)return new M(jJ(o));if(c<=0)return new M(SJ(c));if(s<=0)return new M(dJ(s));if(c>s)return new M(xJ(c,s));if(l<=0)return new M(Xq(l));if(a===0||o>=a)return{value:0,format:ZY};let u=l/s;if(u>1)return{value:c===1?a-o:0,format:ZY};if(c<=1)return{value:a*u,format:ZY};let d=a*(1-u)**(c-1),f=a*(1-u)**c,p=f<o?d-o:d-f;return{value:Math.max(p,0),format:ZY}},isExported:!0},$Y={description:A(`Discount rate of a security based on price.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(wJ(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return(c-s)/c/u},isExported:!0},eX={description:A(`Convert a decimal fraction to decimal value.`),args:[k(`fractional_price (number)`,A(`The price quotation given using fractional decimal conventions.`)),k(`unit (number)`,A(`The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));if(r<=0)return new M(RJ(r));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},tX={description:A(`Convert a decimal value to decimal fraction.`),args:[k(`decimal_price (number)`,A(`The price quotation given as a decimal value.`)),k(`unit (number)`,A(`The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));if(r<=0)return new M(RJ(r));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},nX={description:A(`Number of periods for an investment to reach a value.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=F(n,this.locale),l=F(r,this.locale),u=Math.trunc(F(i,this.locale)),d=Math.trunc(F(a,this.locale));if(o>=s)return new M(fJ(o,s));if(HJ(u))return new M(Jq(u));if(VJ(d))return new M(Yq(d));if(c<0)return new M(OJ(c));if(l<0)return new M(zJ(l));let f=Ca(o,s,d),p=f-Math.trunc(f)||1/u,m=Math.ceil(f*u),h=c/u,g=l/u,_=0,v=0;for(let e=1;e<=m;e++){let t=(h+ +(e===m))/(1+g)**e;v+=(p+(e-1)/u)*t,_+=t}return _===0?0:v/_},isExported:!0},rX={description:A(`Annual effective interest rate.`),args:[k(`nominal_rate (number)`,A(`The nominal interest rate per year.`)),k(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return n<=0?new M(mJ(n)):r<=0?new M(bJ(r)):(1+n/r)**+r-1},isExported:!0};function iX(e,t,n,r,i){return e===0?-(r+n*t):-r*(1+e)**t-n*(1+e*i)*((1+e)**t-1)/e}let aX={description:A(`Future value of an annuity investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_amount (number)`,A(`The amount per period to be paid.`)),k(`present_value (number, default=0)`,A(`The current value of the annuity.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:iX(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),+!!L(i)),format:`#,##0.00`}},isExported:!0},oX={description:A(`Future value of principal from series of rates.`),args:[k(`principal (number)`,A(`The amount of initial capital or value to compound against.`)),k(`rate_schedule (number, range<number>)`,A(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=F(e,this.locale);return so([t],(e,t)=>e*(1+F(t,this.locale)),n)},isExported:!0},sX={description:A(`Calculates effective interest rate.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`investment (number)`,A(`The amount invested in the security.`)),k(`redemption (number)`,A(`The amount to be received at maturity.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(r,this.locale),c=F(n,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(c<=0)return new M(sJ(c));if(s<=0)return new M(AJ(s));if(VJ(l))return new M(Yq(l));let u=Ca(a,o,l);return(s-c)/c/u},isExported:!0};function cX(e,t,n,r,i,a){return bX(e,n,r,i,a)-SX(e,t,n,r,i,a)}let lX={description:A(`Payment on the principal of an investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`period (number)`,A(`The amortization period, in terms of number of periods.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:cX(F(e,this.locale),F(t,this.locale),F(n,this.locale),F(r,this.locale),F(i,this.locale),+!!L(a)),format:`#,##0.00`}},isExported:!0},uX=.1,dX={description:A(`Internal rate of return given periodic cashflows.`),args:[k(`cashflow_amounts (number, range<number>)`,A(`An array or range containing the income or payments associated with the investment.`)),k(`rate_guess (number, default=${uX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:uX}){let n=F(t,this.locale);if(n<=-1)return new M(DJ(n));let r=!1,i=!1,a=[];if(ao([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),!r||!i)return new M(Gq);let o=a.shift();function s(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*e**(r-i)),t*e**r)}function c(e,t,n){let r=n.length,i=0;return n.reduce((t,n)=>(i++,t+n*(r-i)*e**(r-i-1)),t*r*e**(r-1))}function l(e){return s(e,o,a)}function u(e){return c(e,o,a)}return{value:zY(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},fX={description:A(`Returns the interest paid at a particular period of an investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`period (number)`,A(`The period for which you want to view the interest payment.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);return o===0?new M(hJ(o)):-1*(s-a/o*s)*i},isExported:!0},pX={description:A(`Modified Macaulay duration.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`))],compute:function(e,t,n,r,i,a={value:0}){let o=nX.compute.bind(this)(e,t,n,r,i,a),s=F(r,this.locale),c=Math.trunc(F(i,this.locale));return F(o,this.locale)/(1+s/c)},isExported:!0},mX={description:A(`Modified internal rate of return.`),args:[k(`cashflow_amounts (range<number>)`,A(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),k(`financing_rate (number)`,A(`The interest rate paid on funds invested.`)),k(`reinvestment_return_rate (number)`,A(`The return (as a percentage) earned on reinvestment of income received from the investment.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=mo(e).flat().filter(e=>e.value!==null).map(e=>F(e,this.locale)),o=a.length,s=0,c=0;for(let e of C(0,o)){let t=a[e];t>=0?s+=t*(i+1)**(o-e-1):c+=t/(r+1)**e}if(c===0||s===0)return new M(Gq);let l=1/(o-1);return(-s/c)**l-1},isExported:!0},hX={description:A(`Annual nominal interest rate.`),args:[k(`effective_rate (number)`,A(`The effective interest rate per year.`)),k(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=F(e,this.locale),r=Math.trunc(F(t,this.locale));return n<=0?new M(eJ(n)):r<=0?new M(bJ(r)):((n+1)**(1/r)-1)*r},isExported:!0},gX={description:A(`Number of payment periods for an investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`payment_amount (number)`,A(`The amount of each payment made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);if(a===0)return-(c+s)/o;let u=o*(1+a*l)/a;return Math.log((u-c)/(s+u))/Math.log(1+a)},isExported:!0};function _X(e,t,n,r){let i=0;return co(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let vX={description:A(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[k(`discount (number)`,A(`The discount rate of the investment over one period.`)),k(`cashflow (number, range<number>, repeating)`,A(`The future cash flows.`))],compute:function(e,...t){let n=F(e,this.locale);return n===-1?new M(Zq(n)):{value:_X(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},yX={description:A(`Computes the number of periods needed for an investment to reach a value.`),args:[k(`rate (number)`,A(`The rate at which the investment grows each period.`)),k(`present_value (number)`,A(`The investment's current value.`)),k(`future_value (number)`,A(`The investment's desired future value.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return r<=0?new M(kJ(r)):i<=0?new M(CJ(i)):a<=0?new M(oJ(a)):(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function bX(e,t,n,r,i){if(t<=0)throw new M(gJ(t));if(e===0)return-(r+n)/t;let a=-(n*(1+e)**t+r);return a=a*e/((1+e*i)*((1+e)**t-1)),a}let xX={description:A(`Periodic payment for an annuity investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){let a=F(t,this.locale),o=F(e,this.locale),s=+!!L(i),c=F(r,this.locale);return{value:bX(o,a,F(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function SX(e,t,n,r,i,a){if(n<=0)throw new M(gJ(n));if(t<=0||t>n)throw new M(_J(n));let o=bX(e,n,r,i,a);return a===1&&t===1?o:o+-iX(e,a===0?t-1:t-2,o,r+o*a,0)*e}let CX={description:A(`Payment on the principal of an investment.`),args:[k(`rate (number)`,A(`The annualized rate of interest.`)),k(`period (number)`,A(`The amortization period, in terms of number of periods.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=F(n,this.locale),s=F(e,this.locale),c=F(t,this.locale),l=+!!L(a),u=F(i,this.locale);return{value:SX(s,c,o,F(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},wX={description:A(`Present value of an annuity investment.`),args:[k(`rate (number)`,A(`The interest rate.`)),k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_amount (number)`,A(`The amount per period to be paid.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=F(e,this.locale),o=F(t,this.locale),s=F(n,this.locale),c=F(r,this.locale),l=+!!L(i);return{value:a?-(s*(1+a*l)*((1+a)**o-1)/a+c)/(1+a)**o:-(c+s*o),format:`#,##0.00`}},isExported:!0},TX={description:A(`Price of a security paying periodic interest.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));if(s>=c)return new M(fJ(s,c));if(HJ(f))return new M(Jq(f));if(VJ(p))return new M(Yq(p));if(l<0)return new M(OJ(l));if(u<0)return new M(zJ(u));if(d<=0)return new M(AJ(d));let m=Ca(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=1+u/f,v=100*l/f;if(h===1)return(v+d)/(g*u/f+1)-v*(1-g);let y=0;for(let e=1;e<=h;e++)y+=v/_**(e-1+g);return d/_**(h-1+g)+y-v*(1-g)},isExported:!0},EX={description:A(`Price of a discount security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the security at time of purchase.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(Qq(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return c-s*c*u},isExported:!0},DX={description:A(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`issue (date)`,A(`The date the security was initially issued.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`yield (number)`,A(`The expected annual yield of the security.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));if(o<=c)return new M(FJ(o,c));if(o>=s)return new M(fJ(o,s));if(VJ(d))return new M(Yq(d));if(l<0)return new M(OJ(l));if(u<0)return new M(zJ(u));let f=Ca(o,s,d),p=Ca(o,c,d),m=100+Ca(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},OX=.1,kX={description:A(`Interest rate of an annuity investment.`),args:[k(`number_of_periods (number)`,A(`The number of payments to be made.`)),k(`payment_per_period (number)`,A(`The amount per period to be paid.`)),k(`present_value (number)`,A(`The current value of the annuity.`)),k(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),k(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),LY),k(`rate_guess (number, default=${OX})`,A(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:OX}){let o=F(e,this.locale),s=F(t,this.locale),c=+!!L(i),l=F(a,this.locale)||OX,u=F(r,this.locale),d=F(n,this.locale);return o<=0?new M(gJ(o)):BJ([s,d,u])?l<=-1?new M(DJ(l)):(u-=s*c,d+=s*c,{value:zY(e=>{let t=(1+e)**+o,n=(t-1)/e;return u+d*t+s*n},e=>{let t=(1+e)**(o-1),n=((1+e)**+o-1)/e,r=o*t/e-n/e;return d*o*t+s*r},l,40,1e-5),format:`0%`}):new M(A(`There must be both positive and negative values in [payment_amount, present_value, future_value].`))},isExported:!0},AX={description:A(`Amount received at maturity for a security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`investment (number)`,A(`The amount invested (irrespective of face value of each security).`)),k(`discount (number)`,A(`The discount rate of the security invested in.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));return a>=o?new M(fJ(a,o)):VJ(l)?new M(Yq(l)):s<=0?new M(sJ(s)):c<=0?new M(Qq(c)):s/(1-c*Ca(a,o,l))},isExported:!0},jX={description:A(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[k(`number_of_periods (number)`,A(`The number of periods.`)),k(`present_value (number)`,A(`The present value of the investment.`)),k(`future_value (number)`,A(`The future value of the investment.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return r<=0?new M(gJ(r)):(a/i)**(1/r)-1},isExported:!0},MX={description:A(`Depreciation of an asset using the straight-line method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=F(e,this.locale),i=F(t,this.locale),a=F(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},NX={description:A(`Depreciation via sum of years digit method.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`period (number)`,A(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=F(e,this.locale),a=F(t,this.locale),o=F(n,this.locale),s=F(r,this.locale);if(s<=0)return new M(SJ(s));if(o<=0)return new M(dJ(o));if(s>o)return new M(xJ(s,o));let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function PX(e,t,n){return 100*(1-n*Ca(e,t,2))}let FX={description:A(`Price of a US Treasury bill.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);return r>=i?new M(fJ(r,i)):UJ(r,i,this.locale)?a<=0?new M(Qq(a)):a>=1?new M($q(a)):PX(r,i,a):new M(PJ(r,i))},isExported:!0},IX={description:A(`Equivalent rate of return for a US Treasury bill.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);if(r>=i)return new M(fJ(r,i));if(!UJ(r,i,this.locale))return new M(PJ(r,i));if(a<=0)return new M(Qq(a));if(a>=1)return new M($q(a));let o=ZJ.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=PX(r,i,a)/100,c=o/(o===366?366:365);return(-2*c+2*Math.sqrt(c**2-(2*c-1)*(1-1/s)))/(2*c-1)},isExported:!0},LX={description:A(`The yield of a US Treasury bill based on price.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(F(e,this.locale)),i=Math.trunc(F(t,this.locale)),a=F(n,this.locale);if(r>=i)return new M(fJ(r,i));if(!UJ(r,i,this.locale))return new M(PJ(r,i));if(a<=0)return new M(wJ(a));let o=Ca(r,i,2);return(100-a)/a*(1/o)},isExported:!0},RX={description:A(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[k(`cost (number)`,A(`The initial cost of the asset.`)),k(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),k(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),k(`start (number)`,A(`Starting period to calculate depreciation.`)),k(`end (number)`,A(`Ending period to calculate depreciation.`)),k(`factor (number, default=2)`,A(`The number of months in the first year of depreciation.`)),k(`no_switch (number, default=false)`,A(`Whether to switch to straight-line depreciation when the depreciation is greater than the declining balance calculation.`),[{value:!1,label:A(`Switch to straight-line depreciation`)},{value:!0,label:A(`Do not switch to straight-line depreciation`)}])],compute:function(e,t,n,r,i,a={value:2},o={value:!1}){a||=0;let s=F(e,this.locale),c=F(t,this.locale),l=F(n,this.locale),u=Math.trunc(F(r,this.locale)),d=Math.trunc(F(i,this.locale)),f=F(a,this.locale),p=L(o);if(s<0)return new M(Kq(s));if(c<0)return new M(jJ(c));if(l<=0)return new M(dJ(l));if(u<0)return new M(IJ(u));if(d<0)return new M(tJ(d));if(u>d)return new M(LJ(u,d));if(d>l)return new M(nJ(d,l));if(f<=0)return new M(Xq(f));if(s===0)return 0;if(c>=s)return u<1?s-c:0;let m=f/l;if(m>=1)return u<1?s-c:0;let h=s,g=0,_=0,v=!1;for(let e=0;e<d;e++){if(!v||p){let t=h*m,n=l-e,r=(h-c)/n;!p&&r>t?(v=!0,g=r):g=t}let t=Math.max(h-g,c);e>=u&&(_+=h-t),h=t}return _},isExported:!0},zX={description:A(`Internal rate of return given non-periodic cash flows.`),args:[k(`cashflow_amounts (range<number>)`,A(`An range containing the income or payments associated with the investment.`)),k(`cashflow_dates (range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),k(`rate_guess (number, default=${OX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:OX}){let r=F(n,this.locale);if(!hh(e,t))return new M(Wq);let i=e.flat().map(e=>F(e,this.locale)),a=t.flat().map(e=>F(e,this.locale));if(!BJ(i))return new M(Gq);if(a.some(e=>e<a[0]))return new M(rJ(a[0]));if(r<=-1)return new M(DJ(r));let o=new Map;for(let e of C(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e));return zY(e=>{let t=c[0];for(let n of C(1,c.length)){let r=(s[0]-s[n])/365;t+=c[n]*(1+e)**r}return t},e=>{let t=0;for(let n of C(1,c.length)){let r=(s[0]-s[n])/365;t+=r*c[n]*(1+e)**(r-1)}return t},r,40,1e-5,e=>e?e/10-.9:-.9)},isExported:!0},BX={description:A(`Net present value given to non-periodic cash flows..`),args:[k(`discount (number)`,A(`The discount rate of the investment over one period.`)),k(`cashflow_amounts (number, range<number>)`,A(`An range containing the income or payments associated with the investment.`)),k(`cashflow_dates (number, range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`))],compute:function(e,t,n){let r=F(e,this.locale);if(!hh(t,n))return new M(Wq);let i=R(t).flat().map(e=>Ya(e,this.locale)),a=R(n).flat().map(e=>Ya(e,this.locale));if(a.some(e=>e<a[0]))return new M(rJ(a[0]));if(r<=0)return new M(kJ(r));if(i.length===1)return i[0];let o=new Map;for(let e of C(0,a.length)){let t=a[e];o.has(t)?o.set(t,o.get(t)+i[e]):o.set(t,i[e])}let s=Array.from(o.keys()),c=s.map(e=>o.get(e)),l=c[0];for(let e of C(1,c.length)){let t=(s[0]-s[e])/365;l+=c[e]*(1+r)**t}return l},isExported:!0},VX={description:A(`Annual yield of a security paying periodic interest.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),IY),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(F(e,this.locale)),c=Math.trunc(F(t,this.locale)),l=F(n,this.locale),u=F(r,this.locale),d=F(i,this.locale),f=Math.trunc(F(a,this.locale)),p=Math.trunc(F(o,this.locale));if(s>=c)return new M(fJ(s,c));if(HJ(f))return new M(Jq(f));if(VJ(p))return new M(Yq(p));if(l<0)return new M(OJ(l));if(u<=0)return new M(wJ(u));if(d<=0)return new M(AJ(d));let m=Ca(s,c,p)*f,h=Math.ceil(m),g=m-Math.floor(m)||1,_=100*l/f;if(h===1){let e=u+_*(1-g);return(d+_-e)*f*(1/g)/e}function v(e,t,n,r,i,a){let o=a-(e+i*(1-t))*r**(n-1+t);for(let e=1;e<=n;e++)o+=i*r**(e-1);return o}function y(e,t,n,r,i){let a=-(e+i*(1-t))*(n-1+t)*r**(n-2+t);for(let e=1;e<=n;e++)a+=i*(e-1)*r**(e-2);return a}function b(e){return v(u,g,h,e,_,d)}function ee(e){return y(u,g,h,e,_)}return(zY(b,ee,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},HX={description:A(`Annual yield of a discount security.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),k(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(F(e,this.locale)),o=Math.trunc(F(t,this.locale)),s=F(n,this.locale),c=F(r,this.locale),l=Math.trunc(F(i,this.locale));if(a>=o)return new M(fJ(a,o));if(VJ(l))return new M(Yq(l));if(s<=0)return new M(wJ(s));if(c<=0)return new M(AJ(c));let u=Ca(a,o,l);return(c/s-1)/u},isExported:!0},UX={description:A(`Annual yield of a security paying interest at maturity.`),args:[k(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),k(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),k(`issue (date)`,A(`The date the security was initially issued.`)),k(`rate (number)`,A(`The annualized rate of interest.`)),k(`price (number)`,A(`The price at which the security is bought.`)),k(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),WJ)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(F(e,this.locale)),s=Math.trunc(F(t,this.locale)),c=Math.trunc(F(n,this.locale)),l=F(r,this.locale),u=F(i,this.locale),d=Math.trunc(F(a,this.locale));if(o>=s)return new M(fJ(o,s));if(VJ(d))return new M(Yq(d));if(o<c)return new M(NJ(o,c));if(l<0)return new M(OJ(l));if(u<=0)return new M(wJ(u));let f=Ca(c,s,d),p=Ca(c,o,d),m=Ca(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0};var WX=l({CELL:()=>KX,ISBLANK:()=>eZ,ISERR:()=>qX,ISERROR:()=>JX,ISFORMULA:()=>nZ,ISLOGICAL:()=>YX,ISNA:()=>XX,ISNONTEXT:()=>ZX,ISNUMBER:()=>QX,ISTEXT:()=>$X,NA:()=>tZ});let GX=[{value:`address`,label:A(`Returns an absolute reference as plain text of the top left cell in reference.`)},{value:`col`,label:A(`Returns the column number of the cell in reference.`)},{value:`contents`,label:A(`Returns the value contained in the top left cell in reference.`)},{value:`format`,label:A(`Returns the format of the top left cell in reference.`)},{value:`row`,label:A(`Returns the row number of the top left cell in reference.`)},{value:`type`,label:A(`Returns the type of data in the cell in reference. The following values are returned: "b" for a blank cell, "l" (for label) if the cell contains plain text, and "v" (for value) if the cell contains any other type of data.`)}],KX={description:A(`Gets information about a cell.`),args:[k(`info_type (string)`,A(`The type of information requested.`),GX),k(`reference (any, range<any>)`,A(`The reference to the cell.`))],compute:function(e,t){let n=I(e).toLowerCase();if(!GX.map(e=>e.value).includes(n))return new M(A(`The info_type should be one of %s.`,GX.join(`, `)));let r=R(t)[0][0],i=r.position;if(i===void 0)return new M(A(`The reference is invalid.`));switch(n){case`address`:return(this.__originSheetId===i.sheetId?``:this.getters.getSheetName(i.sheetId)+`!`)+E(i.col,i.row,{colFixed:!0,rowFixed:!0});case`col`:return i.col+1;case`contents`:return r.value;case`format`:return r.format||``;case`row`:return i.row+1;case`type`:return r.value===null?`b`:su(r.format)?`l`:typeof r.value==`number`||typeof r.value==`boolean`?`v`:`l`}return``},isExported:!0},qX={description:A(`Whether a value is an error other than #N/A.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)&&t!==j.NotAvailable},isExported:!0},JX={description:A(`Whether a value is an error.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return P(t)},isExported:!0},YX={description:A("Whether a value is `true` or `false`."),args:[k(`value (any)`,A(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},XX={description:A(`Whether a value is the error #N/A.`),args:[k(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},ZX={description:A(`Whether a value is non-textual.`),args:[k(`value (any)`,A(`The value to be checked.`))],compute:function(e){return!$X.compute.bind(this)(e)},isExported:!0},QX={description:A(`Whether a value is a number.`),args:[k(`value (any)`,A(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},$X={description:A(`Whether a value is text.`),args:[k(`value (any)`,A(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&P(e?.value)===!1},isExported:!0},eZ={description:A(`Whether the referenced cell is empty`),args:[k(`value (any)`,A(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},tZ={description:A(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0},nZ={description:A(`Checks whether there is a reference to a cell that contains a formula, and returns TRUE or FALSE.`),args:[k(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){return e?.position===void 0?new zi(Wa):this.getters.getCell(e.position)?.isFormula??!1},isExported:!0};var rZ=l({AND:()=>iZ,FALSE:()=>aZ,IF:()=>oZ,IFERROR:()=>sZ,IFNA:()=>cZ,IFS:()=>lZ,NOT:()=>uZ,OR:()=>dZ,SWITCH:()=>fZ,TRUE:()=>pZ,XOR:()=>mZ});let iZ={description:A("Logical `and` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let{result:t,foundBoolean:n}=Zh(e);return n?t:new M(ko)},isExported:!0},aZ={description:A("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},oZ={description:A(`Returns value depending on logical expression.`),args:[k(`logical_expression (boolean, range<boolean>)`,A(`An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.`)),k(`value_if_true (any, range)`,A(`The value the function returns if logical_expression is TRUE.`)),k(`value_if_false (any, range, default=FALSE)`,A(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){return wh(e)?ho(oZ.compute,[e,t,n]):(L(Sh(e))?t:n)??{value:0}},isExported:!0},sZ={description:A(`Value if it is not an error, otherwise 2nd argument.`),args:[k(`value (any, range)`,A(`The value to return if value itself is not an error.`)),k(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an error.`))],compute:function(e,t){return wh(e)?ho(sZ.compute,[e,t]):(P(Sh(e)?.value)?t:e)??{value:0}},isExported:!0},cZ={description:A(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[k(`value (any, range)`,A(`The value to return if value itself is not #N/A an error.`)),k(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an #N/A error.`))],compute:function(e,t){return wh(e)?ho(cZ.compute,[e,t]):(Sh(e)?.value===j.NotAvailable?t:e)??{value:0}},isExported:!0},lZ={description:A(`Returns a value depending on multiple logical expressions.`),args:[k(`condition (any, range, repeating)`,A(`The condition to be evaluated. It can be a boolean, a number, an array, or a reference to any of those.`)),k(`value (any, range, repeating)`,A(`The value to be returned if its corresponding condition is TRUE.`))],compute:function(...e){if(e.length%2!=0)return new M(A(`Wrong number of arguments. Expected an even number of arguments.`));for(;e.length>0;){if(wh(e[0]))return ho(lZ.compute,e);let t=L(Sh(e.shift())),n=e.shift();if(t)return n??{value:0}}return new M(A(`No match.`))},isExported:!0},uZ={description:A(`Returns opposite of provided logical value.`),args:[k(`logical_expression (boolean)`,A(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!L(e)},isExported:!0},dZ={description:A("Logical `or` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let{result:t,foundBoolean:n}=Qh(e);return n?t:new M(ko)},isExported:!0},fZ={description:A(`Returns a value by comparing cases to an expression.`),args:[k(`expression (number, boolean, string)`,A(`The value to be checked.`)),k(`case (any, repeating)`,A(`Case to be checked against expression.`)),k(`value (any, repeating)`,A(`Value to be returned if its corresponding case matches expression.`)),k(`default (any, default="empty")`,A(`An optional default value to be returned if none of the cases match expression.`))],compute:function(e,...t){let n=t.length%2==0?Ha(e):t.pop();for(let n=0;n<t.length;n+=2){let r=t[n];if(r&&P(r.value))return r;if(e?.value===r?.value)return t[n+1]||{value:0}}return n||{value:0}},isExported:!0},pZ={description:A("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},mZ={description:A("Logical `xor` operator."),args:[k(`logical_expression (boolean, range<boolean>, repeating)`,A(`Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.`))],compute:function(...e){let t=!1,n=!1;return _o(e,e=>(t=!0,n=n?!e:e,!0)),t?n:new M(ko)},isExported:!0};function hZ(e,t){let n=t.getPivotId(e);if(!n)throw new M(A(`There is no pivot with id "%s"`,e));return n}function gZ(e,t,n){let{measures:r}=n.getPivotCoreDefinition(e);if(!r.find(e=>e.id===t))throw new M(A(`The argument %s is not a valid measure. Here are the measures: %s`,t,`(${r.map(e=>e.id).join(`, `)})`))}function _Z(e){if(e.length%2!=0)throw new M(A(`Function PIVOT takes an even number of arguments.`))}function vZ(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=Tn(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new zi;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&Ln(D(e.__originCellPosition),n))throw new Ri;r.push(o)}for(let i of n)i.computedBy&&r.push(...e.getters.getMeasureFullDependencies(t,i));let a=e.__originCellPosition;a&&r.length&&(e.updateDependencies?.(a),e.addDependencies?.(a,r))}var yZ=l({ADDRESS:()=>SZ,CHOOSE:()=>zZ,COLUMN:()=>CZ,COLUMNS:()=>wZ,DROP:()=>BZ,FORMULATEXT:()=>HZ,HLOOKUP:()=>TZ,INDEX:()=>EZ,INDIRECT:()=>DZ,LOOKUP:()=>OZ,MATCH:()=>kZ,OFFSET:()=>RZ,PIVOT:()=>LZ,PIVOT_HEADER:()=>IZ,PIVOT_VALUE:()=>FZ,ROW:()=>AZ,ROWS:()=>jZ,TAKE:()=>VZ,VLOOKUP:()=>MZ,XLOOKUP:()=>PZ});let bZ=[{value:!0,label:A(`A1 style (default)`)},{value:!1,label:A(`R1C1 style`)}],xZ=[{value:!0,label:A(`Approximate match (default)`)},{value:!1,label:A(`Exact match`)}],SZ={description:A(`Returns a cell reference as a string. `),args:[k(`row (number)`,A(`The row number of the cell reference. `)),k(`column (number)`,A(`The column number (not name) of the cell reference. A is column number 1. `)),k(`absolute_relative_mode (number, default=1)`,A(`An indicator of whether the reference is row/column absolute.`),[{value:1,label:A(`Absolute row and column (e.g. $A$1)`)},{value:2,label:A(`Absolute row, relative column (e.g. A$1)`)},{value:3,label:A(`Relative row, absolute column (e.g. $A1)`)},{value:4,label:A(`Relative row and column (e.g. A1)`)}]),k(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation or R1C1 style notation.`),bZ),k(`sheet (string, optional)`,A(`A string indicating the name of the sheet into which the address points.`))],compute:function(e,t,n={value:1},r={value:!0},i){let a=Za(e,this.locale),o=Za(t,this.locale);if(a<1)return new M(_h(a));if(o<1)return new M(_h(o));let s=Za(n,this.locale);if(![1,2,3,4].includes(s))return new M(Ga(1,4,s));let c=L(r),l;if(c){let e={rowFixed:[1,2].includes(s),colFixed:[1,3].includes(s)};l=E(o-1,a-1,e)}else l=([1,2].includes(s)?`R${a}`:`R[${a}]`)+([1,3].includes(s)?`C${o}`:`C[${o}]`);return i===void 0?l:$o(I(i),l)},isExported:!0},CZ={description:A(`Column number of a specified cell.`),args:[k(`cell_reference (any, range<any>, default='this cell')`,A(`The cell whose column number will be returned. Column A corresponds to 1. By default, the function use the cell in which the formula is entered.`))],compute:function(e){if(e===void 0)return this.__originCellPosition===void 0?new M(A(`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`)):this.__originCellPosition.col+1;let t=R(e),n=t[0][0];if(n===void 0)return new M(A(`The range is out of bounds.`));if(n.position===void 0)return new zi(Wa);let r=n.position.col;return t.length===1?r+1:uo(t.length,1,e=>({value:r+e+1}))},isExported:!0},wZ={description:A(`Number of columns in a specified array or range.`),args:[k(`range (any, range<any>)`,A(`The range whose column count will be returned.`))],compute:function(e){let t=R(e);return t[0][0]===void 0?new M(A(`The range is out of bounds.`)):t[0][0].value===j.InvalidReference?t[0][0]:t.length},isExported:!0},TZ={description:A(`Horizontal lookup`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The range to consider for the search. The first row in the range is searched for the key specified in search_key.`)),k(`index (number)`,A(`The row index of the value to be returned, where the first row in range is numbered 1.`)),k(`is_sorted (boolean, default=true)`,A(`Indicates whether the row to be searched (the first row of the specified range) is sorted, in which case the closest match for search_key will be returned.`),xZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=R(t);if(1>i||i>a[0].length)return new M(A(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[t][0].value,s=a[L(r.value)?So(a,e,`nextSmaller`,`asc`,a.length,o):Co(a,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?Ha(e):s[i-1]},isExported:!0},EZ={description:A(`Returns the content of a cell, specified by row and column offset.`),args:[k(`reference (any, range)`,A(`The range of cells from which the values are returned.`)),k(`row (number, default=0)`,A(`The index of the row to be returned from within the reference range of cells.`)),k(`column (number, default=0)`,A(`The index of the column to be returned from within the reference range of cells.`))],compute:function(e,t={value:0},n={value:0}){let r=R(e),i=F(t.value,this.locale),a=F(n.value,this.locale);return a<0||a-1>=r.length||i<0||i-1>=r[0].length?new M(A(`Index out of range.`)):i===0&&a===0?r:i===0?[r[a-1]]:a===0?r.map(e=>[e[i-1]]):r[a-1][i-1]},isExported:!0},DZ={description:A(`Returns the content of a cell, specified by a string.`),args:[k(`reference (string)`,A(`The range of cells from which the values are returned.`)),k(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`),bZ)],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new zi(A(`Reference should be defined.`));if(!L(t))return new M(A(`R1C1 notation is not supported.`));let r=this.__originSheetId,i=this.__originCellPosition;i&&this.updateDependencies?.(i);let a=this.getters.getNamedRange(n),o=a?a.range:this.getters.getRangeFromSheetXC(r,n);if(o===void 0||o.invalidXc||o.invalidSheetName)return new zi;i&&this.addDependencies?.(i,[o]);let s=[];for(let e=o.zone.left;e<=o.zone.right;e++){let t=[];for(let n=o.zone.top;n<=o.zone.bottom;n++){let r={sheetId:o.sheetId,col:e,row:n};t.push(this.getFormulaResult(r))}s.push(t)}return s.length===1&&s[0].length===1?s[0][0]:s},isExported:!0},OZ={description:A(`Look up a value.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`search_array (any, range)`,A(`One method of using this function is to provide a single sorted row or column search_array to look through for the search_key with a second argument result_range. The other way is to combine these two arguments into one search_array where the first row or column is searched and a value is returned from the last row or column in the array. If search_key is not found, a non-exact match may be returned.`)),k(`result_range (any, range, optional)`,A(`The range from which to return a result. The value returned corresponds to the location where search_key is found in search_range. This range must be only a single row or column and should not be used if using the search_result_array method.`))],compute:function(e,t,n){let r=R(t),i=R(n),a=r.length,o=r[0].length,s=o>=a,c=So(r,e,`nextSmaller`,`asc`,s?o:a,s?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value);return c===-1||s&&r[0][c]===void 0||!s&&r[c][o-1]===void 0?Ha(e):i[0].length===0?s?r[a-1][c]:r[c][o-1]:(a=i.length,o=i[0].length,a!==1&&o!==1?new M(A(`The result_range must be a single row or a single column.`)):a>1?c>a-1?new M(A(`[[FUNCTION_NAME]] evaluates to an out of range row value %s.`,c+1)):i[c][0]:c>o-1?new M(A(`[[FUNCTION_NAME]] evaluates to an out of range column value %s.`,c+1)):i[0][c])},isExported:!0},kZ={description:A(`Position of item in range that matches value.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The one-dimensional array to be searched.`)),k(`search_type (number, default=1)`,A(`The search method is a number 1, 0 or -1 indicating which value to return. 1 finds the largest value less than or equal to search_key when range is sorted in ascending order. 0 finds the exact value when range is unsorted. -1 finds the smallest value greater than or equal to search_key when range is sorted in descending order.`),[{value:1,label:A(`Ascending order (default)`)},{value:0,label:A(`Exact match`)},{value:-1,label:A(`Descending order`)}])],compute:function(e,t,n={value:1}){let r=F(n,this.locale),i=R(t),a=i.length,o=i[0].length;if(a!==1&&o!==1)return new M(A(`The range must be a single row or a single column.`));let s=-1,c=a===1?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,l=a===1?i[0].length:i.length;switch(r=Math.sign(r),r){case 1:s=So(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Co(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=So(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?Ha(e):s+1},isExported:!0},AZ={description:A(`Row number of a specified cell.`),args:[k(`cell_reference (any, range<any>, default='this cell')`,A(`The cell whose row number will be returned. By default, this function uses the cell in which the formula is entered.`))],compute:function(e){if(e===void 0)return this.__originCellPosition?.row===void 0?new M(A(`In this context, the function [[FUNCTION_NAME]] needs to have a cell or range in parameter.`)):this.__originCellPosition.row+1;let t=R(e),n=t[0][0];if(n===void 0)return new M(A(`The range is out of bounds.`));if(n.position===void 0)return new zi(Wa);let r=n.position.row;return t[0].length===1?r+1:uo(1,t[0].length,(e,t)=>({value:r+t+1}))},isExported:!0},jZ={description:A(`Number of rows in a specified array or range.`),args:[k(`range (any, range<any>)`,A(`The range whose row count will be returned.`))],compute:function(e){let t=R(e);return t[0][0]===void 0?new M(A(`The range is out of bounds.`)):t[0][0].value===j.InvalidReference?t[0][0]:t[0].length},isExported:!0},MZ={description:A(`Vertical lookup.`),args:[k(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),k(`range (any, range)`,A(`The range to consider for the search. The first column in the range is searched for the key specified in search_key.`)),k(`index (number)`,A(`The column index of the value to be returned, where the first column in range is numbered 1.`)),k(`is_sorted (boolean, default=true)`,A(`Indicates whether the column to be searched (the first column of the specified range) is sorted, in which case the closest match for search_key will be returned.`),xZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(F(n?.value,this.locale)),a=R(t);if(1>i||i>a.length)return new M(A(`[[FUNCTION_NAME]] evaluates to an out of bounds range.`));let o=(e,t)=>e[0][t].value,s=L(r.value)?So(a,e,`nextSmaller`,`asc`,a[0].length,o):Co(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?Ha(e):c},isExported:!0},NZ={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},PZ={description:A(`Search a range for a match and return the corresponding item from a second range.`),args:[k(`search_key (string,number,boolean)`,A(`The value to search for.`)),k(`lookup_range (any, range)`,A(`The range to consider for the search. Should be a single column or a single row.`)),k(`return_range (any, range)`,A(`The range containing the return value. Should have the same dimensions as lookup_range.`)),k(`if_not_found (any, optional)`,A(`If a valid match is not found, return this value.`)),k(`match_mode (any, default=0)`,A(`Specifies how to match search_key with the items in lookup_range. `),[{value:0,label:A(`Exact match (default)`)},{value:-1,label:A(`Exact match or next smaller item`)},{value:1,label:A(`Exact match or next larger item`)},{value:2,label:A(`Wildcard character match`)}]),k(`search_mode (any, default=1)`,A(`Specifies the search mode to use. By default, a first to last search will be used.`),[{value:1,label:A(`Search first to last (default)`)},{value:-1,label:A(`Search last to first`)},{value:2,label:A(`Binary search (sorted ascending order)`)},{value:-2,label:A(`Binary search (sorted descending order)`)}])],compute:function(e,t,n,r,i={value:0},a={value:1}){let o=Math.trunc(F(i.value,this.locale)),s=Math.trunc(F(a.value,this.locale)),c=R(t),l=R(n);if(c.length!==1&&c[0].length!==1)return new M(A(`lookup_range should be either a single row or single column.`));if(![1,-1,2,-2].includes(s))return new M(A(`search_mode should be a value in [-1, 1, -2, 2].`));if(![-1,0,1,2].includes(o))return new M(A(`match_mode should be a value in [-1, 0, 1, 2].`));let u=c.length===1?`col`:`row`;if(o===2&&[-2,2].includes(s))return new M(A(`The search and match mode combination is not supported for XLOOKUP evaluation.`));if(u===`col`?l[0].length!==c[0].length:l.length!==c.length)return new M(A(`return_range should have the same dimensions as lookup_range.`));let d=u===`col`?(e,t)=>e[0][t].value:(e,t)=>e[t][0].value,f=u===`col`?c[0].length:c.length,p=NZ[o],m=s===-1,h=s===2||s===-2?So(c,e,p,s===2?`asc`:`desc`,f,d):Co(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?Ha(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},FZ={description:A(`Get the value from a pivot.`),args:[k(`pivot_id (number,string)`,A(`ID of the pivot.`)),k(`measure_name (string)`,A(`Name of the measure.`)),k(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),k(`domain_value (number,string,boolean,repeating,optional)`,A(`Value.`))],compute:function(e,t,...n){let r=I(e),i=I(t),a=hZ(r,this.getters);gZ(a,i,this.getters),_Z(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);vZ(this,a,s.measures.filter(e=>e.id===i)),o.init({reload:o.needsReevaluation});let c=o.assertIsValid({throwOnError:!1});if(c)return c;if(!o.areDomainArgsFieldsValid(n)){let e=A(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${r})`);return{value:j.GenericError,message:A(`Dimensions don't match the pivot definition`)+`. `+e}}let l=o.parseArgsToPivotDomain(n);return this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(a)?.trackValue(i,l),o.getPivotCellValueAndFormat(i,l)}},IZ={description:A(`Get the header of a pivot.`),args:[k(`pivot_id (number,string)`,A(`ID of the pivot.`)),k(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),k(`domain_value (number,string,value,repeating,optional)`,A(`Value.`))],compute:function(e,...t){let n=I(e),r=hZ(n,this.getters);_Z(t);let i=this.getters.getPivot(r);vZ(this,r,[]),i.init({reload:i.needsReevaluation});let a=i.assertIsValid({throwOnError:!1});if(a)return a;if(!i.areDomainArgsFieldsValid(t)){let e=A(`Consider using a dynamic pivot formula: %s. Or re-insert the static pivot from the Data menu.`,`=PIVOT(${n})`);return{value:j.GenericError,message:A(`Dimensions don't match the pivot definition`)+`. `+e}}let o=i.parseArgsToPivotDomain(t);this.getters.getActiveSheetId()===this.__originSheetId&&this.getters.getPivotPresenceTracker(r)?.trackHeader(o);let s=o.at(-1);if(s?.field===`measure`)return i.getPivotMeasureValue(I(s.value),o);let{value:c,format:l}=i.getPivotHeaderValueAndFormat(o);return{value:c,format:!s||s.field===`measure`||s.value===`false`?void 0:l}}},LZ={description:A(`Get a pivot table.`),args:[k(`pivot_id (string)`,A(`ID of the pivot.`)),k(`row_count (number, optional)`,A(`number of rows`)),k(`include_total (boolean, default=TRUE)`,A(`Whether to include total/sub-totals or not.`)),k(`include_column_titles (boolean, default=TRUE)`,A(`Whether to include the column titles or not.`)),k(`column_count (number, optional)`,A(`number of columns`)),k(`include_measure_titles (boolean, default=TRUE)`,A(`Whether to include the measure titles row or not.`))],compute:function(e,t,n,r,i,a){let o=hZ(I(e),this.getters),s=this.getters.getPivot(o),c=this.getters.getPivotCoreDefinition(o),l=Kg(c,t,n,r,i,a,this.locale);if(l.numberOfRows<0)return new M(A(`The number of rows must be positive.`));if(l.numberOfColumns<0)return new M(A(`The number of columns must be positive.`));vZ(this,o,c.measures),s.init({reload:s.needsReevaluation});let u=s.assertIsValid({throwOnError:!1});if(u)return u;let d=s.getCollapsedTableStructure();if(d.numberOfCells>5e5)return new M(Ky(d.numberOfCells,this.locale));let f=d.getPivotCells(l),p=this.getters.getPivotName(o),{numberOfCols:m,numberOfRows:h}=d.getPivotTableDimensions(l);if(h===0)return[[{value:p}]];let g=[];for(let e of C(0,m)){g[e]=[];for(let t of C(0,h)){let n=f[e][t];switch(n.type){case`EMPTY`:g[e].push({value:``});break;case`HEADER`:let t=s.getPivotHeaderValueAndFormat(n.domain);g[e].push(Lg(n.domain,t));break;case`MEASURE_HEADER`:g[e].push(s.getPivotMeasureValue(n.measure,n.domain));break;case`VALUE`:g[e].push(s.getPivotCellValueAndFormat(n.measure,n.domain));break;case`ROW_GROUP_NAME`:let r=s.definition.rows.find(e=>e.nameWithGranularity===n.rowField)?.displayName;g[e].push({value:r||``});break}}}return(l.displayColumnHeaders||l.displayMeasuresRow)&&f[0][0].type===`EMPTY`&&(g[0][0]={value:p}),g}},RZ={description:A(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[k(`cell_reference (any, range<any>)`,A(`The starting point from which to count the offset rows and columns.`)),k(`offset_rows (number)`,A(`The number of rows to offset by.`)),k(`offset_columns (number)`,A(`The number of columns to offset by.`)),k(`height (number, default='height of cell_reference')`,A(`The number of rows of the range to return starting at the offset target.`)),k(`width (number, default='width of cell_reference')`,A(`The number of columns of the range to return starting at the offset target.`))],compute:function(e,t,n,r,i){if(e===void 0)return new zi(Wa);let a=R(e),o=a[0][0];if(o===void 0)return new M(A(`The range is out of bounds.`));if(o.position===void 0)return new zi(Wa);let s=a[0].length,c=a.length;if(r){let e=F(r,this.locale);if(e<1)return new M(A(`Height value is %(_height)s. It should be greater than or equal to 1.`,{_height:e}));s=e}if(i){let e=F(i,this.locale);if(e<1)return new M(A(`Width value is %(_width)s. It should be greater than or equal to 1.`,{_width:e}));c=e}let l=F(t,this.locale),u=F(n,this.locale),d=this.__originCellPosition;d&&this.updateDependencies?.(d);let f=o.position.col+u,p=o.position.row+l;if(f<0||p<0)return new zi(A(`OFFSET evaluates to an out of bounds range.`));let m={left:f,top:p,right:f+c-1,bottom:p+s-1},h=o.position.sheetId,g=this.getters.getRangeFromZone(h,m);return g.invalidXc||g.invalidSheetName?new zi:(d&&this.addDependencies?.(d,[g]),uo(c,s,(e,t)=>this.getFormulaResult({sheetId:h,col:f+e,row:p+t})))}},zZ={description:A(`Returns an element from a list of choices based on index.`),args:[k(`index (number)`,A(`Which choice to return.`)),k(`choice (any, range<any>, repeating)`,A(`A potential value to return. May be a reference to a cell or an individual value.`))],compute:function(e,...t){let n=Math.floor(F(e,this.locale))-1;return n<0||n>=t.length?new M(A(`Index for CHOOSE is invalid. Valid values are between 1 and %(choices)s inclusive.`,{choices:t.length})):t[n]??new M(A(`Choice is undefined.`))},isExported:!0},BZ={description:A(`Excludes a specified number of rows or columns from the start or end of an array.`),args:[k(`array (range)`,A(`The array from which to drop rows or columns`)),k(`rows (number)`,A(`The number of rows to drop. A negative value drops from the end of the array.`)),k(`columns (number, optional)`,A(`The number of columns to exclude. A negative value drops from the end of the array.`))],compute:function(e,t,n){let r=F(t,this.locale),i=F(n,this.locale),a=e;if(Math.abs(i)>=e.length||Math.abs(r)>=e[0].length)return new M(A(`The number of rows or column to exclude must be smaller than the number of elements in the array.`));a=i>=0?a.slice(i):a.slice(0,a.length+i);for(let e=0;e<a.length;e++)r>=0?a[e]=a[e].slice(r):a[e]=a[e].slice(0,a[e].length+r);return a},isExported:!0},VZ={description:A(`Returns a specified number of contiguous rows or columns from the start or end of an array.`),args:[k(`array (range)`,A(`The array from which to take rows or columns.`)),k(`rows (number)`,A(`The number of rows to take. A negative value takes from the end of the array.`)),k(`columns (number, optional)`,A(`The number of columns to take. A negative value takes from the end of the array.`))],compute:function(e,t,n){let r=t?F(t,this.locale):e[0].length,i=F(n,this.locale),a=e;if((Math.abs(i)>=e.length||i===0)&&(i=e.length),Math.abs(r)>=e[0].length&&(r=e[0].length),a=i>=0?a.slice(0,i):a.slice(a.length+i,a.length),r===0)return new M(A(`The number of rows can not be zero.`));for(let e=0;e<a.length;e++)r>0?a[e]=a[e].slice(0,r):a[e]=a[e].slice(a[e].length+r,a[e].length);return a},isExported:!0},HZ={description:A(`Returns a formula as a string.`),args:[k(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){if(e?.position===void 0)return new zi(Wa);let t=this.getters.getCell(e.position);return t?.isFormula?t.compiledFormula.toFormulaString(this.getters):new Bi(A(`The cell does not contain a formula.`))},isExported:!0};var UZ=l({ADD:()=>WZ,CONCAT:()=>GZ,DIVIDE:()=>KZ,EQ:()=>XZ,GT:()=>QZ,GTE:()=>$Z,LT:()=>eQ,LTE:()=>tQ,MINUS:()=>nQ,MULTIPLY:()=>rQ,NE:()=>iQ,POW:()=>aQ,SPILLED_RANGE:()=>oQ,UMINUS:()=>sQ,UNARY_PERCENT:()=>cQ,UPLUS:()=>lQ});let WZ={description:A(`Sum of two numbers.`),args:[k(`value1 (number)`,A(`The first addend.`)),k(`value2 (number)`,A(`The second addend.`))],compute:function(e,t){return{value:F(e,this.locale)+F(t,this.locale),format:e?.format||t?.format}}},GZ={description:A(`Concatenation of two values.`),args:[k(`value1 (string)`,A(`The value to which value2 will be appended.`)),k(`value2 (string)`,A(`The value to append to value1.`))],compute:function(e,t){return I(e)+I(t)},isExported:!0},KZ={description:A(`One number divided by another.`),args:[k(`dividend (number)`,A(`The number to be divided.`)),k(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=F(t,this.locale);return n===0?new Ui(A(`The divisor must be different from zero.`)):{value:F(e,this.locale)/n,format:e?.format||t?.format}}};function qZ(e){return e===void 0||e.value===null}let JZ={number:0,string:``,boolean:!1};function YZ(e,t,n=2e-16){return Math.abs(e-t)<n}let XZ={description:A(`Equal.`),args:[k(`value1 (string, number, boolean)`,A(`The first value.`)),k(`value2 (string, number, boolean)`,A(`The value to test against value1 for equality.`))],compute:function(e,t){if(P(e?.value))return e;if(P(t?.value))return t;let n=qZ(e)?JZ[typeof t?.value]:e?.value,r=qZ(t)?JZ[typeof e?.value]:t?.value;return typeof n==`string`&&(n=n.toUpperCase()),typeof r==`string`&&(r=r.toUpperCase()),typeof n==`number`&&typeof r==`number`?{value:YZ(n,r)}:{value:n===r}}};function ZZ(e,t,n){if(P(e?.value))return e;if(P(t?.value))return t;let r=qZ(e)?JZ[typeof t?.value]:e?.value,i=qZ(t)?JZ[typeof e?.value]:t?.value;typeof r!=`number`&&(r=I(r).toUpperCase()),typeof i!=`number`&&(i=I(i).toUpperCase());let a=typeof r,o=typeof i;return a===`string`&&o===`number`?{value:!0}:o===`string`&&a===`number`?{value:!1}:{value:n(r,i)}}let QZ={description:A(`Strictly greater than.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being greater than value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return ZZ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!YZ(e,t)&&e>t:e>t)}},$Z={description:A(`Greater than or equal to.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being greater than or equal to value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return ZZ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?YZ(e,t)||e>t:e>=t)}},eQ={description:A(`Less than.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being less than value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=$Z.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},tQ={description:A(`Less than or equal to.`),args:[k(`value1 (number, string, boolean)`,A(`The value to test as being less than or equal to value2.`)),k(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=QZ.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},nQ={description:A(`Difference of two numbers.`),args:[k(`value1 (number)`,A(`The minuend, or number to be subtracted from.`)),k(`value2 (number)`,A(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:F(e,this.locale)-F(t,this.locale),format:e?.format||t?.format}}},rQ={description:A(`Product of two numbers`),args:[k(`factor1 (number)`,A(`The first multiplicand.`)),k(`factor2 (number)`,A(`The second multiplicand.`))],compute:function(e,t){return{value:F(e,this.locale)*F(t,this.locale),format:e?.format||t?.format}}},iQ={description:A(`Not equal.`),args:[k(`value1 (string, number, boolean)`,A(`The first value.`)),k(`value2 (string, number, boolean)`,A(`The value to test against value1 for inequality.`))],compute:function(e,t){let n=XZ.compute.bind(this)(e,t);return P(n.value)?n:{value:!n.value}}},aQ={description:A(`A number raised to a power.`),args:[k(`base (number)`,A(`The number to raise to the exponent power.`)),k(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){return WG.compute.bind(this)(e,t)}},oQ={description:A(`Gets the spilled range of an array formula.`),args:[k(`ref (any, range<any>)`,A(`The reference to get the spilled range from.`))],compute:function(e){if(e===void 0)return new zi(Wa);let t=R(e);if(t.length!==1||t[0].length!==1)return new M(A(`Only single-cell references are allowed to get the spilled range.`));let n=t[0][0];if(P(n.value))return n;if(n.position===void 0)return new zi(Wa);let r=this.__originCellPosition;r&&this.updateDependencies?.(r);let i=this.getters.getSpreadZone(n.position);if(i===void 0)return new zi;let a=this.getters.getRangeFromZone(this.__originSheetId,i);return r&&this.addDependencies?.(r,[a]),uo(i.right-i.left+1,i.bottom-i.top+1,(e,t)=>this.getFormulaResult({sheetId:a.sheetId,col:i.left+e,row:i.top+t}))},hidden:!0},sQ={description:A(`A number with the sign reversed.`),args:[k(`value (number)`,A(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-F(e,this.locale),format:e?.format}}},cQ={description:A(`Value interpreted as a percentage.`),args:[k(`percentage (number)`,A(`The value to interpret as a percentage.`))],compute:function(e){return F(e,this.locale)/100}},lQ={description:A(`A specified number, unchanged.`),args:[k(`value (any)`,A(`The number to return.`))],compute:function(e={value:null}){return e}},$=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),uQ={transform:e=>e,inverseTransform:e=>e},dQ=1e-10,fQ=.0254,pQ=fQ/72,mQ=.3048,hQ=.9144,gQ=1609.34,_Q=1852,vQ=946073047258e4,yQ={g:{...uQ,category:`weight`},u:{...$(166053e-29),category:`weight`},grain:{...$(.0647989),category:`weight`},ozm:{...$(28.3495),category:`weight`},lbm:{...$(453.592),category:`weight`},stone:{...$(6350.29),category:`weight`},sg:{...$(14593.90294),category:`weight`},cwt:{...$(45359.237),category:`weight`},uk_cwt:{...$(50802.3),category:`weight`},ton:{...$(907184.74),category:`weight`},uk_ton:{...$(1016046.9),category:`weight`},m:{...uQ,category:`distance`},km:{...$(1e3),category:`distance`},ang:{...$(dQ),category:`distance`},Picapt:{...$(pQ),category:`distance`},pica:{...$(fQ/6),category:`distance`},in:{...$(fQ),category:`distance`},ft:{...$(mQ),category:`distance`},yd:{...$(hQ),category:`distance`},ell:{...$(1.143),category:`distance`},mi:{...$(gQ),category:`distance`},survey_mi:{...$(1609.34),category:`distance`},Nmi:{...$(_Q),category:`distance`},ly:{...$(vQ),category:`distance`},parsec:{...$(0x6da012f95c9fd0),category:`distance`},sec:{...uQ,category:`time`},min:{...$(60),category:`time`},hr:{...$(3600),category:`time`},day:{...$(86400),category:`time`},yr:{...$(31556952),category:`time`},Pa:{...uQ,category:`pressure`},bar:{...$(1e5),category:`pressure`},mmHg:{...$(133.322),category:`pressure`},Torr:{...$(133.322),category:`pressure`},psi:{...$(6894.76),category:`pressure`},atm:{...$(101325),category:`pressure`},N:{...uQ,category:`force`},dyn:{...$(1e-5),category:`force`},pond:{...$(.00980665),category:`force`},lbf:{...$(4.44822),category:`force`},J:{...uQ,category:`energy`},eV:{...$(160218e-24),category:`energy`},e:{...$(1e-7),category:`energy`},flb:{...$(1.3558179483),category:`energy`},c:{...$(4.184),category:`energy`},cal:{...$(4.1868),category:`energy`},BTU:{...$(1055.06),category:`energy`},Wh:{...$(3600),category:`energy`},HPh:{...$(2684520),category:`energy`},W:{...uQ,category:`power`},PS:{...$(735.499),category:`power`},HP:{...$(745.7),category:`power`},T:{...uQ,category:`magnetism`},ga:{...$(1e-4),category:`magnetism`},K:{...uQ,category:`temperature`},C:{transform:e=>e+273.15,inverseTransform:e=>e-273.15,category:`temperature`},F:{transform:e=>(e-32)*5/9+273.15,inverseTransform:e=>(e-273.15)*9/5+32,category:`temperature`},Rank:{...$(5/9),category:`temperature`},Reau:{transform:e=>e*1.25+273.15,inverseTransform:e=>(e-273.15)/1.25,category:`temperature`},"m^3":{...uQ,category:`volume`,order:3},"ang^3":{...$(dQ**3),category:`volume`,order:3},"Picapt^3":{...$(pQ**3),category:`volume`,order:3},tsp:{...$(492892e-11),category:`volume`},tspm:{...$(5e-6),category:`volume`},tbs:{...$(14786764825785619e-21),category:`volume`},"in^3":{...$(fQ**3),category:`volume`,order:3},oz:{...$(295735295625e-16),category:`volume`},cup:{...$(237e-6),category:`volume`},pt:{...$(.0004731765),category:`volume`},uk_pt:{...$(568261e-9),category:`volume`},qt:{...$(.0009463529),category:`volume`},l:{...$(.001),category:`volume`},uk_qt:{...$(.0011365225),category:`volume`},gal:{...$(.0037854118),category:`volume`},uk_gal:{...$(.00454609),category:`volume`},"ft^3":{...$(mQ**3),category:`volume`,order:3},bushel:{...$(.0352390704),category:`volume`},barrel:{...$(.158987295),category:`volume`},"yd^3":{...$(hQ**3),category:`volume`,order:3},MTON:{...$(1.13267386368),category:`volume`},GRT:{...$(2.83168),category:`volume`},"mi^3":{...$(gQ**3),category:`volume`,order:3},"Nmi^3":{...$(_Q**3),category:`volume`,order:3},"ly^3":{...$(vQ**3),category:`volume`,order:3},"m^2":{...uQ,category:`area`,order:2},"ang^2":{...$(dQ**2),category:`area`,order:2},"Picapt^2":{...$(pQ**2),category:`area`,order:2},"in^2":{...$(fQ**2),category:`area`,order:2},"ft^2":{...$(mQ**2),category:`area`,order:2},"yd^2":{...$(hQ**2),category:`area`,order:2},ar:{...$(100),category:`area`},Morgen:{...$(2500),category:`area`},uk_acre:{...$(4046.8564224),category:`area`},us_acre:{...$(4046.8726098743),category:`area`},ha:{...$(1e4),category:`area`},"mi^2":{...$(gQ**2),category:`area`,order:2},"Nmi^2":{...$(_Q**2),category:`area`,order:2},"ly^2":{...$(vQ**2),category:`area`,order:2},bit:{...uQ,category:`information`},byte:{...$(8),category:`information`},"m/s":{...uQ,category:`speed`},"m/hr":{...$(1/3600),category:`speed`},"km/hr":{...$(1/3.6),category:`speed`},mph:{...$(.44704),category:`speed`},kn:{...$(.5144444444),category:`speed`},admkn:{...$(.5147733333),category:`speed`}},bQ={shweight:`cwt`,lcwt:`uk_cwt`,hweight:`uk_cwt`,LTON:`uk_ton`,brton:`uk_ton`,pc:`parsec`,Pica:`Picapt`,d:`day`,mn:`min`,s:`sec`,p:`Pa`,at:`atm`,dy:`dyn`,ev:`eV`,hh:`HPh`,wh:`Wh`,btu:`BTU`,h:`HP`,cel:`C`,fah:`F`,kel:`K`,us_pt:`pt`,L:`l`,lt:`l`,ang3:`ang^3`,ft3:`ft^3`,in3:`in^3`,ly3:`ly^3`,m3:`m^3`,mi3:`mi^3`,yd3:`yd^3`,Nmi3:`Nmi^3`,Picapt3:`Picapt^3`,"Pica^3":`Picapt^3`,Pica3:`Picapt^3`,regton:`GRT`,ang2:`ang^2`,ft2:`ft^2`,in2:`in^2`,ly2:`ly^2`,m2:`m^2`,mi2:`mi^2`,Nmi2:`Nmi^2`,Picapt2:`Picapt^2`,"Pica^2":`Picapt^2`,Pica2:`Picapt^2`,yd2:`yd^2`,"m/h":`m/hr`,"m/sec":`m/s`},xQ={"":1,Y:1e24,Z:1e21,E:0xde0b6b3a7640000,P:0x38d7ea4c68000,T:0xe8d4a51000,G:1e9,M:1e6,k:1e3,h:100,da:10,e:10,d:.1,c:.01,m:.001,u:1e-6,n:1e-9,p:1e-12,f:1e-15,a:1e-18,z:1e-21,y:1e-21,Yi:2**80,Zi:2**70,Ei:2**60,Pi:2**50,Ti:2**40,Gi:2**30,Mi:2**20,ki:2**10},SQ={weight:A(`Weight`),distance:A(`Distance`),time:A(`Time`),pressure:A(`Pressure`),force:A(`Force`),energy:A(`Energy`),power:A(`Power`),magnetism:A(`Magnetism`),temperature:A(`Temperature`),volume:A(`Volume`),area:A(`Area`),information:A(`Information`),speed:A(`Speed`)},CQ=Object.entries(yQ).map(([e,t])=>({value:e,label:wQ(t.category)}));function wQ(e){return SQ[e]??``}function TQ(e){for(let[t,n]of Object.entries(xQ)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=yQ[r];if(!i&&bQ[r]&&(i=yQ[bQ[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var EQ=l({CONVERT:()=>DQ});let DQ={description:A(`Converts a numeric value to a different unit of measure.`),args:[k(`value (number)`,A(`the numeric value in start_unit to convert to end_unit`)),k(`start_unit (string)`,A(`The starting unit, the unit currently assigned to value`),CQ),k(`end_unit (string)`,A(`The unit of measure into which to convert value`),CQ)],compute:function(e,t,n){let r=F(e,this.locale),i=I(t),a=I(n),o=TQ(i),s=TQ(a);return o?s?o.category===s.category?{value:s.inverseTransform(o.factor*o.transform(r))/s.factor,format:e?.format}:{value:j.GenericError,message:A(`Incompatible units of measure ('%s' vs '%s')`,wQ(o.category),wQ(s.category))}:{value:j.GenericError,message:A(`Invalid units of measure ('%s')`,a)}:{value:j.GenericError,message:A(`Invalid units of measure ('%s')`,i)}},isExported:!0};var OQ=l({CHAR:()=>MQ,CLEAN:()=>NQ,CONCATENATE:()=>PQ,EXACT:()=>FQ,FIND:()=>IQ,FORMAT_LARGE_NUMBER:()=>LQ,JOIN:()=>RQ,LEFT:()=>zQ,LEN:()=>BQ,LOWER:()=>VQ,MID:()=>HQ,PROPER:()=>UQ,REGEXEXTRACT:()=>GQ,REGEXREPLACE:()=>KQ,REGEXTEST:()=>WQ,REPLACE:()=>qQ,RIGHT:()=>JQ,SEARCH:()=>YQ,SPLIT:()=>XQ,SUBSTITUTE:()=>ZQ,TEXT:()=>n$,TEXTAFTER:()=>i$,TEXTBEFORE:()=>a$,TEXTJOIN:()=>QQ,TEXTSPLIT:()=>$Q,TRIM:()=>e$,UPPER:()=>t$,VALUE:()=>r$});let kQ=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,AQ=[{value:0,label:A(`Case-sensitive (default)`)},{value:1,label:A(`Case-insensitive`)}],jQ=[{value:0,label:A(`Don't match to end (default)`)},{value:1,label:A(`Match to end`)}],MQ={description:A(`Gets character associated with number.`),args:[k(`table_number (number)`,A(`The number of the character to look up from the current Unicode table in decimal format.`))],compute:function(e){let t=Math.trunc(F(e,this.locale));return t<1?new M(A(`The table_number (%s) is out of range.`,t)):String.fromCharCode(t)},isExported:!0},NQ={description:A(`Remove non-printable characters from a piece of text.`),args:[k(`text (string)`,A(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=I(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},PQ={description:A(`Appends strings to one another.`),args:[k(`string (string, range<string>, repeating)`,A(`String to append in sequence.`))],compute:function(...e){return so(e,(e,t)=>e+I(t),``)},isExported:!0},FQ={description:A(`Tests whether two strings are identical.`),args:[k(`string1 (string)`,A(`The first string to compare.`)),k(`string2 (string)`,A(`The second string to compare.`))],compute:function(e,t){return I(e)===I(t)},isExported:!0},IQ={description:A(`First position of string found in text, case-sensitive.`),args:[k(`search_for (string)`,A(`The string to look for within text_to_search.`)),k(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),k(`starting_at (number, default=1)`,A(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e),i=I(t),a=F(n,this.locale);if(i===``)return new M(A(`The text_to_search must be non-empty.`));if(a<1)return new M(A(`The starting_at (%s) must be greater than or equal to 1.`,a));let o=i.indexOf(r,a-1);return o===-1?new M(A(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)):o+1},isExported:!0},LQ={description:A(`Apply a large number format`),args:[k(`value (number)`,A(`The number.`)),k(`unit (string, optional)`,A(`The formatting unit. Use 'k', 'm', or 'b' to force the unit`),[{value:`k`,label:A(`Thousand`)},{value:`m`,label:A(`Million`)},{value:`b`,label:A(`Billion`)}])],compute:function(e,t){return{value:F(e,this.locale),format:$l(e,t,this.locale)}}},RQ={description:A(`Concatenates elements of arrays with delimiter.`),args:[k(`delimiter (string)`,A(`The character or string to place between each concatenated value.`)),k(`value_or_array (string, range<string>, repeating)`,A(`Value to be appended using delimiter.`))],compute:function(e,...t){let n=I(e);return so(t,(e,t)=>(e?e+n:``)+I(t),``)}},zQ={description:A(`Substring from beginning of specified string.`),args:[k(`text (string)`,A(`The string from which the left portion will be returned.`)),k(`number_of_characters (number, optional)`,A(`The number of characters to return from the left side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;return n<0?new M(A(`The number_of_characters (%s) must be positive or null.`,n)):I(e).substring(0,n)},isExported:!0},BQ={description:A(`Length of a string.`),args:[k(`text (string)`,A(`The string whose length will be returned.`))],compute:function(e){return I(e).length},isExported:!0},VQ={description:A(`Converts a specified string to lowercase.`),args:[k(`text (string)`,A(`The string to convert to lowercase.`))],compute:function(e){return I(e).toLowerCase()},isExported:!0},HQ={description:A(`A segment of a string.`),args:[k(`text (string)`,A(`The string to extract a segment from.`)),k(`starting_at (number)`,A(`The index from the left of string from which to begin extracting. The first character in string has the index 1.`)),k(`extract_length (number)`,A(`The length of the segment to extract.`))],compute:function(e,t,n){let r=I(e),i=F(t,this.locale),a=F(n,this.locale);return i<1?new M(A(`The starting_at argument (%s) must be positive greater than one.`,i.toString())):a<0?new M(A(`The extract_length argument (%s) must be positive or null.`,a)):r.slice(i-1,i+a-1)},isExported:!0},UQ={description:A(`Capitalizes each word in a specified string.`),args:[k(`text_to_capitalize (string)`,A(`The text which will be returned with the first letter of each word in uppercase and all other letters in lowercase.`))],compute:function(e){return I(e).replace(kQ,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},WQ={description:A(`Checks whether a string matches the supplied regular expression.`),args:[k(`text (string)`,A(`The string to test.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n={value:0}){let r=I(e),i=I(t),a=F(n,this.locale);if(i===``)return!0;if(r===``)return!1;if(a!==0&&a!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,a));let o=a===1?`gi`:`g`,s;try{s=new RegExp(i,o)}catch{return new M(A(`Invalid regular expression`))}return s.test(r)},isExported:!0},GQ={description:A(`Extract text from a string based on the supplied regular expression.`),args:[k(`text (string)`,A(`The string on which you want to extract text.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`return_mode (number, default=0)`,A(`0 = first match, 1 = all matches as an array, 2 = capturing groups from the first match as an array.`),[{value:0,label:A(`First match`)},{value:1,label:A(`All matches`)},{value:2,label:A(`Capture groups of first match`)}]),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n={value:0},r={value:0}){let i=I(e),a=I(t),o=F(n,this.locale),s=F(r,this.locale);if(i===``||a===``)return{value:``};if(o<0||o>2)return new M(A(`The return_mode (%s) must be 0, 1 or 2.`,o));if(s!==0&&s!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,s));let c=s===1?`gi`:`g`,l;try{l=new RegExp(a,c)}catch{return new M(A(`Invalid regular expression`))}let u=[...i.matchAll(l)];return u.length===0?{value:j.NotAvailable,message:A(`No matches found.`)}:o===0?u[0][0]:o===1?u.map(e=>[e[0]]):u[0].length<2?new M(A(`No capturing groups found.`)):u[0].slice(1).map(e=>[e])},isExported:!0},KQ={description:A(`Replace text in a string based on the supplied regular expression.`),args:[k(`text (string)`,A(`The string in which you want to replace text.`)),k(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),k(`replacement (string)`,A(`The text to use as the replacement.`)),k(`occurrence (number, default=0)`,A(`0 = replace all matches. A negative number counts from the end.`)),k(`case_sensitivity (number, default=0)`,A(`Whether the match is case-sensitive.`),[{value:0,label:A(`Case-sensitive`)},{value:1,label:A(`Case-insensitive`)}])],compute:function(e,t,n,r={value:0},i={value:0}){let a=I(e),o=I(t),s=I(n),c=F(r,this.locale),l=F(i,this.locale);if(l!==0&&l!==1)return new M(A(`The case_sensitivity (%s) must be 0 or 1.`,l));let u=l===1?`gi`:`g`,d;try{d=new RegExp(o,u)}catch{return new M(A(`Invalid regular expression`))}if(c!==0){let e=[...a.matchAll(d)];if(e.length===0||Math.abs(c)>e.length)return a;let t=c>0?c-1:e.length+c,n=e[t][0].length,r=e[t].index;return a.substring(0,r)+s+a.substring(r+n)}return a.replace(d,s)},isExported:!0},qQ={description:A(`Replaces part of a text string with different text.`),args:[k(`text (string)`,A(`The text, a part of which will be replaced.`)),k(`position (number)`,A(`The position where the replacement will begin (starting from 1).`)),k(`length (number)`,A(`The number of characters in the text to be replaced.`)),k(`new_text (string)`,A(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=F(t,this.locale);if(i<1)return new M(A(`The position (%s) must be greater than or equal to 1.`,i));let a=I(e),o=F(n,this.locale),s=I(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},JQ={description:A(`A substring from the end of a specified string.`),args:[k(`text (string)`,A(`The string from which the right portion will be returned.`)),k(`number_of_characters (number, optional)`,A(`The number of characters to return from the right side of string.`))],compute:function(e,...t){let n=t.length?F(t[0],this.locale):1;if(n<0)return new M(A(`The number_of_characters (%s) must be positive or null.`,n));let r=I(e),i=r.length;return r.substring(i-n,i)},isExported:!0},YQ={description:A(`First position of string found in text, ignoring case.`),args:[k(`search_for (string)`,A(`The string to look for within text_to_search.`)),k(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),k(`starting_at (number, default=1)`,A(`The character within text_to_search at which to start the search.`))],compute:function(e,t,n={value:1}){let r=I(e).toLowerCase(),i=I(t).toLowerCase(),a=F(n,this.locale);if(i===``)return{value:j.GenericError,message:A(`The text_to_search must be non-empty.`)};if(a<1)return{value:j.GenericError,message:A(`The starting_at (%s) must be greater than or equal to 1.`,a)};let o=i.indexOf(r,a-1);return o===-1?{value:j.GenericError,message:A(`In [[FUNCTION_NAME]] evaluation, cannot find '%s' within '%s'.`,r,i)}:{value:o+1}},isExported:!0},XQ={description:A(`Split text by specific character delimiter(s).`),args:[k(`text (string)`,A(`The text to divide.`)),k(`delimiter (string)`,A(`The character or characters to use to split text.`)),k(`split_by_each (boolean, default=true})`,A(`Whether or not to divide text around each character contained in delimiter.`)),k(`remove_empty_text (boolean, default=true)`,A(`Whether or not to remove empty text messages from the split results. The default behavior is to treat consecutive delimiters as one (if TRUE). If FALSE, empty cells values are added between consecutive delimiters.`))],compute:function(e,t,n={value:!0},r={value:!0}){let i=I(e),a=Qe(I(t)),o=L(n),s=L(r);if(a.length<=0)return new M(A(`The delimiter (%s) must be not be empty.`,a));let c=o?RegExp(`[${a}]`,`g`):new RegExp(a,`g`),l=i.split(c);return s&&(l=l.filter(e=>e!==``)),mo([l])},isExported:!1},ZQ={description:A(`Replaces existing text with new text in a string.`),args:[k(`text_to_search (string)`,A(`The text within which to search and replace.`)),k(`search_for (string)`,A(`The string to search for within text_to_search.`)),k(`replace_with (string)`,A(`The string that will replace search_for.`)),k(`occurrence_number (number, optional)`,A(`The instance of search_for within text_to_search to replace with replace_with. By default, all occurrences of search_for are replaced; however, if occurrence_number is specified, only the indicated instance of search_for is replaced.`))],compute:function(e,t,n,r){let i=F(r,this.locale);if(i<0)return new M(A(`The occurrenceNumber (%s) must be positive or null.`,i));let a=I(e),o=I(t);if(o===``)return a;let s=I(n),c=new RegExp(Qe(o),`g`);if(i===0)return a.replace(c,s);let l=0;return a.replace(c,e=>++l===i?s:e)},isExported:!0},QQ={description:A(`Combines text from multiple strings and/or arrays.`),args:[k(`delimiter (string)`,A(`A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),k(`ignore_empty (boolean)`,A(`A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result.`),[{value:!0,label:A(`Ignore empty cells`)},{value:!1,label:A(`Include empty cells (default)`)}]),k(`texts (string, range<string>, repeating)`,A(`Text item to join.`))],compute:function(e,t={value:!0},...n){let r=I(e),i=L(t),a=0;return so(n,(e,t)=>i&&I(t)===``?e:(a++?e+r:``)+I(t),``)},isExported:!0},$Q={description:A(`Splits text into rows or columns using specified column and row delimiters.`),args:[k(`text (string)`,A(`The text to split.`)),k(`col_delimiter (string, range<string>)`,A(`Character or string to split columns by.`)),k(`row_delimiter (string, range<string>, optional)`,A(`Character or string to split rows by.`)),k(`ignore_empty (boolean, default=false)`,A(`Whether to ignore empty cells.`),[{value:!1,label:A(`Include empty cells (default)`)},{value:!0,label:A(`Ignore empty cells`)}]),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`pad_with (string, default="${j.NotAvailable}")`,A(`The value to use for padding empty cells.`))],compute:function(e,t,n,r={value:!1},i={value:0},a=new Bi){let o=I(e);if(o.length<=0)return new M(A(`No text to split.`));if(t===void 0&&n===void 0)return new M(A(`At least one delimiter must be provided.`));let s=R(t).flat().map(e=>Qe(I(e))),c=R(n).flat().map(e=>Qe(I(e)));if(s.some(e=>e===``)||c.some(e=>e===``))return new M(A(`The delimiters cannot be empty values.`));let l=L(r),u=F(i,this.locale);if(![0,1].includes(u))return new M(A(`match_mode should be a value of 0 or 1.`));let d=[],f=u===1?`gi`:`g`,p=c.filter(e=>!s.includes(e)),m=p.length?o.split(new RegExp(p.join(`|`),f)):[o];l&&(m=m.filter(e=>e!==``));let h=new RegExp(s.join(`|`),f);for(let e of m){let t=s.length?e.split(h):[e];l&&(t=t.filter(e=>e!==``)),d.push(t.map(e=>({value:e})))}let g=Math.max(...d.map(e=>e.length));for(let e of d)for(;e.length<g;)e.push(a);return mo(d)},isExported:!0},e$={description:A(`Removes space characters.`),args:[k(`text (string)`,A(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return zt(I(e))},isExported:!0},t$={description:A(`Converts a specified string to uppercase.`),args:[k(`text (string)`,A(`The string to convert to uppercase.`))],compute:function(e){return I(e).toUpperCase()},isExported:!0},n$={description:A(`Converts a number to text according to a specified format.`),args:[k(`number (number)`,A(`The number, date or time to format.`)),k(`format (string)`,A(`The case-sensitive format of the result, enclosed in quotation marks. Examples: "0.00" rounded to 2 decimal places, "hh:mm:ss" for hour:minutes:seconds.`))],compute:function(e,t){return H(F(e,this.locale),{format:I(t),locale:this.locale})},isExported:!0},r$={description:A(`Converts a string to a numeric value.`),args:[k(`value (number)`,A(`the string to be converted`))],compute:function(e){return F(e,this.locale)},isExported:!0},i$={description:A(`Returns text that occurs after a given substring or delimiter.`),args:[k(`text (string)`,A(`The source text.`)),k(`delimiter (string)`,A(`The substring after which text will be returned.`)),k(`instance_num (number, default=1)`,A(`The desired instance of the delimiter after which we extract the text. A negative number searches from the end.`)),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`match_end (number, default=0))`,A(`Whether to treat the end of text as a delimiter.`),jQ),k(`if_not_found (string, default="${j.NotAvailable}")`,A(`Value to return if the delimiter is not found.`))],compute:function(e,t,n={value:1},r={value:0},i={value:0},a=new Bi){let o=I(e),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(s===0)return new M(A(`The instance_num (%s) must not be zero.`,s));if(c!==0&&c!==1)return new M(A(`match_mode should have a value of 0 or 1.`));if(l!==0&&l!==1)return new M(A(`match_end should have a value of 0 or 1.`));let u=I(t);if(u===``)return Math.sign(s)>0?{value:o}:{value:``};let d=c===1?`gi`:`g`,f=Qe(u),p=new RegExp(f,d),m=[...o.matchAll(p)].map(e=>e.index+f.length);if(s<0&&(m=m.reverse()),l&&Math.abs(s)===m.length+1)return Math.sign(s)>0?{value:``}:{value:o};let h=m[Math.abs(s)-1];return h===void 0?a:{value:o.substring(h)}},isExported:!0},a$={description:A(`Returns text that occurs before a given substring or delimiter.`),args:[k(`text (string)`,A(`The source text.`)),k(`delimiter (string)`,A(`The substring after which text will be returned.`)),k(`instance_num (number, default=1)`,A(`The desired instance of the delimiter before which we extract the text. A negative number searches from the end.`)),k(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),AQ),k(`match_end (number, default=0))`,A(`Whether to match a delimiter against the end of the text.`),jQ),k(`if_not_found (string, default="${j.NotAvailable}")`,A(`Value to return if the delimiter is not found.`))],compute:function(e,t,n={value:1},r={value:0},i={value:0},a=new Bi){let o=I(e),s=F(n,this.locale),c=F(r,this.locale),l=F(i,this.locale);if(s===0)return new M(A(`The instance_num (%s) must not be zero.`,s));if(c!==0&&c!==1)return new M(A(`match_mode should have a value of 0 or 1.`));if(l!==0&&l!==1)return new M(A(`match_end should have a value of 0 or 1.`));let u=I(t);if(u===``)return Math.sign(s)>0?{value:``}:{value:o};let d=c===1?`gi`:`g`,f=Qe(u),p=new RegExp(f,d),m=[...o.matchAll(p)].map(e=>e.index+f.length);if(s<0&&(m=m.reverse()),l&&Math.abs(s)===m.length+1)return Math.sign(s)>0?{value:o}:{value:``};let h=m[Math.abs(s)-1];return h===void 0?a:{value:o.substring(0,h-u.length)}},isExported:!0};var o$=l({HYPERLINK:()=>s$});let s$={description:A(`Creates a hyperlink in a cell.`),args:[k(`url (string)`,A(`The full URL of the link enclosed in quotation marks.`)),k(`link_label (string, optional)`,A(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=I(e).trim(),r=I(t)||n;return n===``?r:dt(r,n)},isExported:!0},c$=[{name:A(`Array`),functions:wW},{name:A(`Database`),functions:kq},{name:A(`Date`),functions:GJ},{name:A(`Filter`),functions:kY},{name:A(`Financial`),functions:FY},{name:A(`Info`),functions:WX},{name:A(`Lookup`),functions:yZ},{name:A(`Logical`),functions:rZ},{name:A(`Math`),functions:eG},{name:A(`Operator`),functions:UZ},{name:A(`Statistical`),functions:gK},{name:A(`Text`),functions:OQ},{name:A(`Engineering`),functions:DY},{name:A(`Web`),functions:o$},{name:A(`Parser`),functions:EQ}];for(let e of c$){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),Ro.add(n,{isExported:!1,...r})}}let l$={},u$={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:26,HEADER_WIDTH:48,DESKTOP_BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:96,DEFAULT_CELL_HEIGHT:23,SCROLLBAR_WIDTH:15},d$={autoCompleteProviders:uT,autofillModifiersRegistry:eR,autofillRulesRegistry:tR,cellMenuRegistry:FP,colMenuRegistry:JP,errorTypes:Ii,functionRegistry:Ro,featurePluginRegistry:Kz,iconsOnCellRegistry:kL,statefulUIPluginRegistry:qz,coreViewsPluginRegistry:Jz,corePluginRegistry:Gz,rowMenuRegistry:tF,sidePanelRegistry:rN,figureRegistry:Ny,chartSidePanelComponentRegistry:ck,chartDataSourceSidePanelComponentRegistry:$D,chartComponentRegistry:oy,chartTypeRegistry:dS,chartSubtypeRegistry:Gv,chartDataSourceRegistry:uS,topbarMenuRegistry:IB,topbarComponentRegistry:nV,clickableCellRegistry:tB,otRegistry:wR,inverseCommandRegistry:iB,urlRegistry:Mu,cellPopoverRegistry:xw,numberFormatMenuRegistry:SB,repeatLocalCommandTransformRegistry:gz,repeatCommandTransformRegistry:hz,clipboardHandlersRegistries:GF,pivotRegistry:Xj,pivotTimeAdapterRegistry:ng,pivotSidePanelRegistry:uM,pivotNormalizationValueRegistry:Pg,supportedPivotPositionalFormulaRegistry:CI,pivotToFunctionValueRegistry:Fg,migrationStepRegistry:qC,chartJsExtensionRegistry:Vd},f$={arg:k,isEvaluationError:P,toBoolean:L,toJsDate:to,toNumber:F,toString:I,toNormalizedPivotValue:Ag,toFunctionPivotValue:Mg,toXC:E,toZone:bn,toUnboundedZone:yn,toCartesian:cn,numberToLetters:Qt,lettersToNumber:$t,UuidGenerator:Bd,formatValue:H,createCurrencyFormat:Kl,ColorGenerator:di,computeTextWidth:Sd,createEmptyWorkbookData:pw,createEmptySheet:fw,createEmptyExcelSheet:mw,rgbaToHex:Vr,colorToRGBA:Hr,positionToZone:D,isDefined:w,isMatrix:Je,lazy:St,genericRepeat:tV,createAction:h,createActions:p,transformRangeData:lr,deepEquals:T,overlap:Pn,union:An,isInside:In,deepCopy:x,expandZoneOnInsertion:En,reduceZoneOnDeletion:kn,unquote:tt,getMaxObjectId:Sg,getFirstPivotFunction:tM,getNumberOfPivotFunctions:nM,parseDimension:Tg,isDateOrDatetimeField:Eg,makeFieldProposal:rM,periodYearToComparable:tg,insertTokenAfterArgSeparator:aM,insertTokenAfterLeftParenthesis:oM,mergeContiguousZones:or,getPivotHighlights:nj,pivotTimeAdapter:rg,UNDO_REDO_PIVOT_COMMANDS:KL,createPivotFormula:kg,areDomainArgsFieldsValid:Og,splitReference:Qo,sanitizeSheetName:rt,getUniqueText:qt,isNumber:Ia,isDateTime:ia,createCustomFields:Vg,schemeToColorScale:Hh,isDateTimeFormat:zl,jsDateToNumber:va,numberToJsDate:ga,DateTime:N,parseFormat:ll,isFormula:Jt,domainToColRowDomain:bj,collapseHierarchicalDisplayName:qg},p$={isMarkdownLink:lt,parseMarkdownLink:ft,markdownLink:dt,openLink:Lu,urlRepresentation:Iu},m$={Checkbox:VT,Section:Q,Select:Oy,RoundColorPicker:ET,ChartDataSeries:tO,ChartErrorSection:aO,ChartLabelRange:nO,ChartRangeDataSourceComponent:CO,ChartTitle:dO,ChartPanel:fk,ChartFigure:jy,ChartJsComponent:qp,ClickableCellSortIcon:wI,ZoomableChartJsComponent:Qv,Grid:SI,GridOverlay:ZF,ScorecardChart:Bm,GaugeChartComponent:iy,LineConfigPanel:qO,BarConfigPanel:sO,PieChartDesignPanel:XO,GenericChartConfigPanel:oO,ChartWithAxisDesignPanel:bO,GenericZoomableChartDesignPanel:xO,LineChartDesignPanel:JO,GaugeChartConfigPanel:VO,GaugeChartDesignPanel:HO,ScorecardChartConfigPanel:$O,ScorecardChartDesignPanel:ek,GeoChartDesignPanel:GO,RadarChartDesignPanel:ZO,WaterfallChartDesignPanel:sk,ComboChartDesignPanel:RO,FunnelChartDesignPanel:BO,SunburstChartDesignPanel:tk,TreeMapChartDesignPanel:ok,ChartTypePicker:uk,FigureComponent:Py,MenuPopover:Dy,Popover:Cy,SelectionInput:FT,ValidationMessages:iO,AddDimensionButton:sj,PivotDimensionGranularity:lj,PivotDimensionOrder:uj,PivotDimension:cj,PivotLayoutConfigurator:mj,PivotHTMLRenderer:EI,PivotDeferUpdate:ij,PivotTitleSection:hj,CogWheelMenu:ZD,TextInput:GD,SidePanelCollapsible:Ow,RadioSelection:pO,GeoChartRegionSelectSection:UO,ChartDashboardMenu:ky,FullScreenFigure:TI,NumberInput:cO,TopBar:JV,Composer:Qw},h$={useDragAndDropListItems:OT,useHighlights:gk,useHighlightsOnHover:hk},g$={useStoreProvider:hr,DependencyContainer:dr,CellPopoverStore:Sw,ComposerFocusStore:Dr,CellComposerStore:jF,FindAndReplaceStore:Lk,HighlightStore:fT,DelayedHoveredCellStore:Fy,HoveredTableStore:JF,ModelStore:br,NotificationStore:pT,RendererStore:wr,SelectionInputStore:PT,SpreadsheetStore:Tr,useStore:O,useLocalStore:gr,SidePanelStore:aN,PivotSidePanelStore:cM,PivotMeasureDisplayPanelStore:ej,ClientFocusStore:rF,GridRenderer:aI};function _$(e,t){return Ro.add(e,t),{addFunction:(e,t)=>_$(e,t)}}let v$={DEFAULT_LOCALE:z,HIGHLIGHT_COLOR:ee,PIVOT_STATIC_TABLE_CONFIG:Be,PIVOT_INSERT_TABLE_STYLE_ID:Ve,ChartTerms:Ly,FIGURE_ID_SPLITTER:`??`,GRID_ICON_EDGE_LENGTH:17,GRID_ICON_MARGIN:2,CHART_TYPES:Vh},y$={...Pv,...yv};e.AbstractCellClipboardHandler=XL,e.AbstractChart=Jp,e.AbstractFigureClipboardHandler=mW,e.CellErrorType=j,e.ClientDisconnectedError=oz,e.CommandResult=U,e.CompiledFormula=Hc,e.CorePlugin=OI,e.CoreViewPlugin=nL,e.DEFAULT_LOCALE=z,e.DEFAULT_LOCALES=zo,e.DispatchResult=ku,e.EvaluationError=M,e.LocalTransportService=rV,e.Model=tW,e.PivotRuntimeDefinition=gj,e.Registry=B,e.Revision=az,e.SPREADSHEET_DIMENSIONS=u$,e.Spreadsheet=ZV,e.SpreadsheetPivotTable=Lj,e.UIPlugin=QL,e.__info__=l$,e.addFunction=_$,e.addRenderingLayer=Cr,e.astToFormula=DF,e.canExecuteInReadonly=Ou,e.categories=c$,e.chartHelpers=y$,e.components=m$,e.constants=v$,e.convertAstNodes=Js,e.coreTypes=Eu,e.createAutocompleteArgumentsProvider=Yz,e.findCellInNewZone=qn,e.functionCache=Bc,e.getCaretDownSvg=wb,e.getCaretUpSvg=Tb,e.helpers=f$,e.hooks=h$,e.invalidateCFEvaluationCommands=xu,e.invalidateChartEvaluationCommands=yu,e.invalidateDependenciesCommands=bu,e.invalidateEvaluationCommands=vu,e.isCoreCommand=Du,e.isSheetDependent=fu,e.iterateAstNodes=Ys,e.links=p$,e.load=QC,e.lockedSheetAllowedCommands=Tu,e.parse=Ks,e.parseTokens=qs,e.readonlyAllowedCommands=wu,e.registries=d$,e.setDefaultSheetViewSize=Re,e.setTranslationMethod=Ni,e.stores=g$,e.tokenColors=Ke,e.tokenize=us,l$.version=`19.3.3`,l$.date=`2026-05-12T12:20:41.287Z`,l$.hash=`35017e4`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);