@odoo/o-spreadsheet 19.4.0-alpha.4 → 19.4.0-alpha.5
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.
|
@@ -962,4 +962,4 @@ If you meant to create a named range, named range cannot have the same name as a
|
|
|
962
962
|
<Relationships xmlns="${Gd.Relationships}">
|
|
963
963
|
<Relationship ${J(e)} />
|
|
964
964
|
</Relationships>
|
|
965
|
-
`),`_rels/.rels`)}function tW(e){let t={},n=[];for(let r of e.sheets){let e=r.name.slice(0,31);e=Ht(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 nW(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>Nn(hn(e.range)).numberOfRows>1);return e}var rW=function(e){return e[e.Ready=0]=`Ready`,e[e.Running=1]=`Running`,e[e.RunningCore=2]=`RunningCore`,e[e.Finalizing=3]=`Finalizing`,e}(rW||{}),iW=class e extends br{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=rW.Ready;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},t={},n=[],r=!1){let i=performance.now();console.debug(`##### Model creation #####`),super(),Mi(),n=SS(e,n);let a=mS(e,r);this.state=new hH,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(a.revisionId),this.coreGetters={},this.range=new dH(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 pH(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 $z.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(n);for(let e of nB.getAll()){let t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of tB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eB.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()-i,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession({shouldSnapshot:e}={shouldSnapshot:!0}){let t=e&&!this.getters.isReadonly()?_t(()=>this.exportData()):void 0;await this.session.leave(t)}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=rW.RunningCore,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new lz(cH({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 $V(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:G.smallUuid(),name:A(`Anonymous`).toString()},n=e.transportService||new JB,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 eH(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(Na));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,colorScheme:this.config.colorScheme}}checkDispatchAllowed(e){let t=Hl(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return this.processCommandResults(t)}processCommandResults(e){return e.some(e=>e!==H.Success)?new Wl(e.flat()):Wl.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=rW.Finalizing;for(let e of this.handlers)e.finalize();this.status=rW.Ready,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(aW(e,t));dispatch=(e,t)=>{let n=aW(e,t),r=this.status;if(this.getters.isReadonly()&&!Ul(n))return new Wl(H.Readonly);if(!this.session.canApplyOptimisticUpdate())return new Wl(H.WaitingSessionConfirmation);switch(r){case rW.Ready:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),this.trigger(`command-rejected`,{command:n,result:t}),t;this.status=rW.Running;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Hl(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=rW.Ready,this.trigger(`update`);break;case rW.Running:if(Hl(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case rW.Finalizing:throw Error(`Cannot dispatch commands in the finalize state`);case rW.RunningCore:if(Hl(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return Wl.Success};dispatchFromCorePlugin=(e,t)=>{let n=aW(e,t),r=this.status;this.status=rW.RunningCore;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,Wl.Success};dispatchToHandlers(e,t){let n=Hl(t);for(let r of e)!n&&r instanceof Bg||r.beforeHandle(t);for(let r of e)!n&&r instanceof Bg||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 JB};return T(n,new e(x(t),r)._exportData(!1))?t:(n.isNotSquishable=!0,n)}_exportData(e){let t=kS();for(let n of this.handlers)n instanceof Bg&&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=jS();for(let t of this.handlers)t instanceof zg&&await t.exportForExcel(e);return e=x(e),KU(e)}};function aW(e,t={}){let n=x(t);return n.type=e,n}var oW=class extends mz{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=rn(n,[]);this.dispatch(`SET_BORDERS_ON_TARGET`,{sheetId:e,target:i,border:r})}this.queuedBordersToAdd={}}},sW=class extends pz{copy(e){}},cW=class extends sW{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:G.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=x(t.copiedCarousel.items);for(let e of f){if(e.type!==`chart`)continue;let n=t.copiedCharts[e.chartId],r=G.smallUuid(),o=AD.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:f}}),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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},lW=class extends sW{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:G.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=AD.fromDefinition(this.getters,a,c.copyInSheetId(a)).getDefinition();l=AD.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:G.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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},uW=class extends mz{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:G.smallUuid(),ranges:[]}}},dW=class extends mz{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?G.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=rn([...rn(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})}}},fW=class extends sW{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:G.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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},pW=class extends mz{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}]})}},mW=class extends mz{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})}}},hW=class extends mz{isPasteAllowed(e,t,n,r){if(!(`cells`in n))return H.Success;let{xSplit:i,ySplit:a}=this.getters.getPaneDivisions(e);return Jn(US(t,n.cells),i,a)?H.FrozenPaneOverlap:H.Success}},gW=class extends mz{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=>Mn(f,e))){s.add(u.id);let{numberOfRows:e}=Nn(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=>Mn(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=Ct({...this.getters.getCellTableStyle(e),hideGridLines:!1}),n=this.getters.getCellStyle(e),r=this.getters.getCellTableBorder(e),i=this.getters.getCellBorder(e);return{style:{...t,...Ct(n)},border:{...r,...Ct(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=Nn(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}))}};eI.figureHandlers.add(`chart`,lW).add(`image`,fW).add(`carousel`,cW),eI.cellHandlers.add(`dataValidation`,dW).add(`cell`,hz).add(`sheet`,hW).add(`merge`,pW).add(`border`,oW).add(`table`,gW).add(`conditionalFormat`,uW).add(`references`,mW);var _W=class extends t.Component{static maxSize={maxHeight:80};static template=`o-spreadsheet-ErrorToolTip`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};get dataValidationErrorMessage(){return this.env.model.getters.getInvalidDataValidationMessage(this.props.cellPosition)}get evaluationError(){let e=this.env.model.getters.getEvaluatedCell(this.props.cellPosition);if(e.message)return e}get errorOriginPositionString(){if(this.env.model.getters.isDashboard())return``;let e=this.evaluationError?.errorOriginPosition;if(!e||T(e,this.props.cellPosition))return``;let t=e.sheetId;return this.env.model.getters.getRangeString(this.env.model.getters.getRangeFromZone(t,D(e)),this.env.model.getters.getActiveSheetId())}selectCell(){let e=this.evaluationError?.errorOriginPosition;if(!e)return;let t=this.env.model.getters.getActiveSheetId();e.sheetId!==t&&this.env.model.dispatch(`ACTIVATE_SHEET`,{sheetIdFrom:t,sheetIdTo:e.sheetId}),this.env.model.selection.selectCell(e.col,e.row)}get isSpillErrorBecauseOfMissingHeaders(){let e=this.evaluationError;return e?.value===j.SpilledBlocked&&!e.errorOriginPosition&&!this.env.model.getters.getSpreadZone(this.props.cellPosition,{ignoreSpillError:!0})}getMissingHeadersForSpread(){if(!this.isSpillErrorBecauseOfMissingHeaders)return;let e=this.env.model.getters.getCell(this.props.cellPosition);if(!e||!e.isFormula)return;let t=e.compiledFormula.toFormulaString(this.env.model.getters);return Kt(this.env.model.getters,this.props.cellPosition,t)}addMissingHeaders({missingCols:e,missingRows:t}){let n=this.props.cellPosition.sheetId;e>0&&this.env.model.dispatch(`ADD_COLUMNS_ROWS`,{sheetId:n,sheetName:this.env.model.getters.getSheetName(n),dimension:`COL`,base:this.env.model.getters.getNumberCols(n)-1,position:`after`,quantity:e+20}),t>0&&this.env.model.dispatch(`ADD_COLUMNS_ROWS`,{sheetId:n,sheetName:this.env.model.getters.getSheetName(n),dimension:`ROW`,base:this.env.model.getters.getNumberRows(n)-1,position:`after`,quantity:t+50})}getAddMissingHeadersButtonText(e){return e.missingCols>0&&e.missingRows>0?A(`Add missing columns and rows`):e.missingCols>0?A(`Add missing columns`):A(`Add missing rows`)}};let vW={onHover:(e,t)=>{let n=t.getEvaluatedCell(e);return n.type===V.error&&n.message||t.getInvalidDataValidationMessage(e)?{isOpen:!0,props:{cellPosition:e},Component:_W,cellCorner:`top-right`}:{isOpen:!1}}},yW=new Set([`containsText`,`notContainsText`,`isEqualText`,`dateIs`,`dateIsBefore`,`dateIsOnOrBefore`,`dateIsAfter`,`dateIsOnOrAfter`,`dateIsBetween`,`dateIsNotBetween`,`isEqual`,`isNotEqual`,`isGreaterThan`,`isGreaterOrEqualTo`,`isLessThan`,`isLessOrEqualTo`,`isBetween`,`isNotBetween`,`customFormula`,`beginsWithText`,`endsWithText`,`isNotEmpty`,`isEmpty`]),bW=[`containsText`,`notContainsText`,`isEqualText`,`isEmpty`,`isNotEmpty`,`beginsWithText`,`endsWithText`],xW=[`isEqual`,`isNotEqual`,`isGreaterThan`,`isGreaterOrEqualTo`,`isLessThan`,`isLessOrEqualTo`,`isBetween`,`isNotBetween`,`isEmpty`,`isNotEmpty`],SW=[`dateIs`,`dateIsBefore`,`dateIsOnOrBefore`,`dateIsAfter`,`dateIsOnOrAfter`,`dateIsBetween`,`dateIsNotBetween`,`isEmpty`,`isNotEmpty`];var CW=class extends t.Component{static template=`o-spreadsheet-FilterMenuCriterion`;static props={filterPosition:Object,onCriterionChanged:Function,criterionOperators:Array};static components={Select:Qh};state;setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.state.criterion=this.getFilterCriterionValue(e.filterPosition))}),this.state=(0,t.useState)({criterion:this.getFilterCriterionValue(this.props.filterPosition)})}getFilterCriterionValue(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilterCriterionValue({sheetId:t,...e});return n?.filterType===`criterion`?x(n):{filterType:`criterion`,type:`none`,values:[]}}get criterionOptions(){return[{label:A(`None`),value:`none`},...Ck(new Set(this.props.criterionOperators))]}get criterionComponent(){return this.state.criterion.type===`none`?void 0:Sk.get(this.state.criterion.type).component}onCriterionChanged(e){this.state.criterion.values=e.values,this.state.criterion.dateValue=e.dateValue,this.props.onCriterionChanged(this.state.criterion)}onCriterionTypeChange(e){this.state.criterion.type=e,this.props.onCriterionChanged(this.state.criterion)}},wW=class extends t.Component{static template=`o-spreadsheet-FilterMenuValueItem`;static components={Checkbox:Qw};static props={value:String,isChecked:Boolean,isSelected:Boolean,onMouseMove:Function,onClick:Function,scrolledTo:{type:String,optional:!0}};itemRef=(0,t.useRef)(`menuValueItem`);setup(){(0,t.onWillPatch)(()=>{this.props.scrolledTo&&this.scrollListToSelectedValue()})}scrollListToSelectedValue(){this.itemRef.el&&this.itemRef.el.scrollIntoView?.({block:`nearest`})}},TW=class extends t.Component{static template=`o-spreadsheet-FilterMenuValueList`;static props={filterPosition:Object,onUpdateHiddenValues:Function};static components={FilterMenuValueItem:wW};state=(0,t.useState)({values:[],displayedValues:[],textFilter:``,selectedValue:void 0,numberOfDisplayedValues:50,hasMoreValues:!1});searchBar=(0,t.useRef)(`filterMenuSearchBar`);setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.state.values=this.getFilterHiddenValues(e.filterPosition),this.computeDisplayedValues())}),this.state.values=this.getFilterHiddenValues(this.props.filterPosition),this.computeDisplayedValues()}getFilterHiddenValues(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilter({sheetId:t,...e});if(!n)return[];let r=this.env.model.getters.getFilterValue({sheetId:t,...e}),i=(n.filteredRange?In(n.filteredRange.zone):[]).map(e=>({position:e,cellValue:this.env.model.getters.getEvaluatedCell({sheetId:t,...e}).formattedValue}));r?.filterType!==`criterion`&&(i=i.filter(e=>!this.env.model.getters.isRowHidden(t,e.position.row)));let a=i.map(e=>e.cellValue),o=r?.filterType===`values`?r.hiddenValues:[],s=new Set(o.map(Fu)),c=new Set,l=[],u=e=>{let t=Fu(e);c.has(t)||(l.push({string:e||``,checked:r?.filterType===`criterion`?!1:!s.has(t),normalizedValue:t}),c.add(t))};return a.forEach(u),o.forEach(u),l.sort((e,t)=>e.normalizedValue.localeCompare(t.normalizedValue,void 0,{numeric:!0,sensitivity:`base`}))}checkValue(e){this.state.selectedValue=e.string,e.checked=!e.checked,this.searchBar.el?.focus(),this.updateHiddenValues()}onMouseMove(e){this.state.selectedValue=e.string}getSearchedValues(){return this.state.textFilter?_O(this.state.textFilter,this.state.values,e=>e.string):this.state.values}setAllChecked(e){let t=new Set(this.getSearchedValues());for(let n of this.state.values)t.has(n)&&(n.checked=e);this.updateHiddenValues()}selectAll(){this.setAllChecked(!0)}clearAll(){this.setAllChecked(!1)}updateHiddenValues(){let e=this.state.values.filter(e=>!e.checked).map(e=>e.string);this.props.onUpdateHiddenValues(e)}updateSearch(e){let t=e.target;this.state.textFilter=t.value,this.state.selectedValue=void 0,this.computeDisplayedValues()}computeDisplayedValues(){let e=this.getSearchedValues();this.state.displayedValues=e.slice(0,this.state.numberOfDisplayedValues),this.state.hasMoreValues=e.length>this.state.numberOfDisplayedValues}loadMoreValues(){this.state.numberOfDisplayedValues+=100,this.computeDisplayedValues()}onKeyDown(e){let t=this.state.displayedValues;if(t.length===0)return;let n;if(this.state.selectedValue!==void 0){let e=t.findIndex(e=>e.string===this.state.selectedValue);n=e===-1?void 0:e}switch(e.key){case`ArrowDown`:n=n===void 0?0:Math.min(n+1,t.length-1),e.preventDefault(),e.stopPropagation();break;case`ArrowUp`:n=n===void 0?t.length-1:Math.max(n-1,0),e.preventDefault(),e.stopPropagation();break;case`Enter`:n!==void 0&&this.checkValue(t[n]),e.stopPropagation(),e.preventDefault();break}this.state.selectedValue=n===void 0?void 0:t[n].string,(e.key===`ArrowUp`||e.key===`ArrowDown`)&&this.scrollListToSelectedValue(e.key)}clearScrolledToValue(){this.state.values.forEach(e=>e.scrolledTo=void 0)}scrollListToSelectedValue(e){this.clearScrolledToValue();let t=this.state.values.find(e=>e.string===this.state.selectedValue);t&&(t.scrolledTo=e===`ArrowUp`?`top`:`bottom`)}},EW=class extends t.Component{static template=`o-spreadsheet-FilterMenu`;static props={filterPosition:Object,onClosed:{type:Function,optional:!0}};static components={FilterMenuValueList:TW,SidePanelCollapsible:vT,FilterMenuCriterion:CW};criterionCategory=`text`;updatedCriterionValue;setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.updatedCriterionValue=void 0,this.criterionCategory=this.getCriterionCategory(e.filterPosition))}),this.criterionCategory=this.getCriterionCategory(this.props.filterPosition)}get isSortable(){if(!this.table)return!1;let e=this.env.model.getters.getCoreTableMatchingTopLeft(this.table.range.sheetId,this.table.range.zone);return!this.env.model.getters.isReadonly()&&e?.type!==`dynamic`}get table(){let e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getTable({sheetId:e,...t})}get filterValueType(){let e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getFilterValue({sheetId:e,...t})?.filterType}getCriterionCategory(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilter({sheetId:t,...e});if(!n||!n.filteredRange)return`text`;let r={text:0,number:0,date:0},i=n.filteredRange.zone;for(let n=i.top;n<=i.bottom&&!(n>100);n++){let i=this.env.model.getters.getEvaluatedCell({sheetId:t,row:n,col:e.col});i.type===V.text||i.type===V.boolean?r.text++:i.type===V.number&&(i.format&&To(i.format)?r.date++:r.number++)}let a=Math.max(r.text,r.number,r.date);return Object.keys(r).find(e=>r[e]===a)||`text`}onUpdateHiddenValues(e){this.updatedCriterionValue={filterType:`values`,hiddenValues:e}}onCriterionChanged(e){this.updatedCriterionValue=e}confirm(){if(!this.updatedCriterionValue){this.props.onClosed?.();return}let e=this.props.filterPosition;this.env.model.dispatch(`UPDATE_FILTER`,{...e,sheetId:this.env.model.getters.getActiveSheetId(),value:this.updatedCriterionValue}),this.props.onClosed?.()}get criterionOperators(){return this.criterionCategory===`date`?SW:this.criterionCategory===`number`?xW:bW}cancel(){this.props.onClosed?.()}sortFilterZone(e){let t=this.props.filterPosition,n=this.table?.range.zone;if(!t||!n||n.top===n.bottom)return;let r=this.env.model.getters.getActiveSheetId(),i={...n,top:n.top+1},a={col:t.col,row:i.top};UP(this.env,r,a,i,e,{emptyCellAsZero:!0,sortHeaders:!0}),this.props.onClosed?.()}};let DW={onOpen:(e,t)=>({isOpen:!0,props:{filterPosition:e},Component:EW,cellCorner:`bottom-left`})};var OW=class extends t.Component{static template=`o-spreadsheet-LinkDisplay`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};cellPopovers;setup(){this.cellPopovers=O(RS)}get cell(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getEvaluatedCell({sheetId:n,col:e,row:t})}get link(){if(this.cell.link)return this.cell.link;let{col:e,row:t}=this.props.cellPosition;throw Error(`LinkDisplay Component can only be used with link cells. ${E(e,t)} is not a link.`)}getUrlRepresentation(e){return Zl(e,this.env.model.getters)}openLink(e){Ql(this.link,this.env,Sm(e))}edit(){let{col:e,row:t}=this.props.cellPosition;this.env.model.selection.selectCell(e,t),this.cellPopovers.open({col:e,row:t},`LinkEditor`)}unlink(){let e=this.env.model.getters.getActiveSheetId(),{col:t,row:n}=this.props.cellPosition,r=this.env.model.getters.getCellComputedStyle({sheetId:e,col:t,row:n}),i=r?.textColor===`#017E84`?void 0:r?.textColor;this.env.model.dispatch(`UPDATE_CELL`,{col:t,row:n,sheetId:e,content:this.link.label,style:{...r,textColor:i,underline:void 0}})}};let kW={onHover:(e,t)=>{let n=t.getEvaluatedCell(e);return!t.isDashboard()&&n.link&&t.isVisibleInViewport(e)?{isOpen:!0,Component:OW,props:{cellPosition:e},cellCorner:`bottom-left`}:{isOpen:!1}}};var AW=class extends t.Component{static template=`o-spreadsheet-LinkEditor`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};static components={MenuPopover:Zh};static size={maxHeight:500};urlInput=(0,t.useRef)(`urlInput`);suggestionListRef=(0,t.useRef)(`suggestionList`);urlInputContainer=(0,t.useRef)(`urlInputContainer`);state=(0,t.useState)(this.defaultState);setup(){this.computeLinks(),(0,t.onMounted)(()=>this.urlInput.el?.focus())}computeLinks(){this.state.selectedIndex=null,this.state.linksByCategory=this.linkProposalByCategory,this.state.linksList=Object.values(this.state.linksByCategory).flat()}get linkProposalByCategory(){let e={},t=-1,n=this.state.url;for(let r of ql.getKeys()){let i=ql.get(r),a=i.getLinkProposals?.(this.env)||[],o=n&&this.state.isUrlEditable?_O(n,a,e=>i.urlRepresentation(e.url,this.env.model.getters)):a;o.length!==0&&(e[i.title]=o.map(e=>{t++;let n=i.urlRepresentation(e.url,this.env.model.getters),r=t;return{text:n,icon:e.icon,index:r,onSelect:()=>{this.state.url=e.url,this.state.label=e.label,this.state.isUrlEditable=e.isUrlEditable,this.state.selectedIndex=r,this.urlInputContainer.el?.focus()}}}))}return e}get defaultState(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getActiveSheetId(),r=this.env.model.getters.getEvaluatedCell({sheetId:n,col:e,row:t});return r.link?{url:r.link.url,label:r.formattedValue,isUrlEditable:r.link.isUrlEditable,selectedIndex:null,linksByCategory:{},linksList:[]}:{label:r.formattedValue,url:``,isUrlEditable:!0,selectedIndex:null,linksByCategory:{},linksList:[]}}getUrlRepresentation(e){return Zl(e,this.env.model.getters)}removeLink(){this.state.url=``,this.state.isUrlEditable=!0,this.computeLinks()}save(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getLocale(),r=this.state.label?bg(this.state.label,n):this.state.url;this.env.model.dispatch(`UPDATE_CELL`,{col:e,row:t,sheetId:this.env.model.getters.getActiveSheetId(),content:ot(r,this.state.url)}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){switch(e.key){case`Enter`:this.state.url&&this.save(),e.stopPropagation(),e.preventDefault();break;case`Escape`:this.cancel(),e.stopPropagation();break}}onInputKeyDown(e){switch(e.key){case`Enter`:if(this.state.selectedIndex!==null){let t=this.state.linksList[this.state.selectedIndex];if(t){let n=this.state.url;t.onSelect(),this.state.url!==n&&(e.stopPropagation(),e.preventDefault())}}break;case`ArrowDown`:this.state.selectedIndex=this.state.selectedIndex===null||this.state.selectedIndex===this.state.linksList.length-1?0:(this.state.selectedIndex+1)%this.state.linksList.length,this.showSelectedProposal(),e.stopPropagation(),e.preventDefault();break;case`ArrowUp`:this.state.selectedIndex!==null&&(this.state.selectedIndex=this.state.selectedIndex===0?this.state.linksList.length-1:(this.state.selectedIndex-1)%this.state.linksList.length,this.showSelectedProposal(),e.stopPropagation(),e.preventDefault());break}}showSelectedProposal(){this.suggestionListRef.el?.querySelector(`.suggestion-item[data-index="${this.state.selectedIndex}"]`)?.scrollIntoView({block:`nearest`})}};LS.add(`ErrorToolTip`,vW).add(`LinkCell`,kW).add(`LinkEditor`,{onOpen:(e,t)=>({isOpen:!0,props:{cellPosition:e},Component:AW,cellCorner:`bottom-left`})}).add(`FilterMenu`,DW),vO.add(`dataValidation`,{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){if(Ut(t)||!this.composer.currentEditedCell)return[];let n=this.composer.currentEditedCell,r=this.getters.getValidationRuleForCell(n);if(!r||r.criterion.type!==`isValueInList`&&r.criterion.type!==`isValueInRange`)return[];let i=this.composer.currentEditedCell.sheetId,a=r.criterion.type===`isValueInRange`?this.getters.getDataValidationRangeValues(i,r.criterion):r.criterion.values.map(e=>({label:e,value:e}));if(r.criterion.displayStyle!==`chip`)return a.map(e=>({text:e.value,fuzzySearchKey:e.label,htmlContent:[{value:e.label}]}));let o=r.criterion.colors;return a.map(e=>{let t=o?.[e.value];return{text:e.value,htmlContent:[{value:e.label,color:Cd(t||`#E7E9ED`),backgroundColor:t||`#E7E9ED`,classes:[`badge rounded-pill fs-6 fw-normal w-100 mt-1 text-start`]}],fuzzySearchKey:e.label}})},selectProposal(e,t){this.composer.setCurrentContent(t.text),this.composer.stopEdition()}}),vO.add(`functions_and_named_ranges`,{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if(e.type!==`SYMBOL`)return[];let t=e.value;if(!Ut(this.composer.currentContent))return[];let n=Object.entries(_s.content).filter(([e,{hidden:t}])=>!t).map(([e,{description:n}])=>({type:`function`,text:e,icon:`o-spreadsheet-Icon.FX_SVG`,description:n,htmlContent:uj(t,e,ae,`o-semi-bold`)}));return n.push(...this.getters.getNamedRanges().map(e=>({type:`named_range`,text:e.name,description:this.getters.getRangeString(e.range),icon:`o-spreadsheet-Icon.NAMED_RANGE`,htmlContent:uj(t,e.name,ae,`o-semi-bold`)}))),n.sort((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)),n},selectProposal(e,t){let n=e.end,r=e.end;[`SYMBOL`,`FUNCTION`].includes(e.type)&&(n=e.start);let i=this.composer.currentTokens,a=t.text;if(t.type===`function`){a+=`(`;let t=i.map(e=>e.start).indexOf(e.start);t+1<i.length&&i[t+1]?.type===`LEFT_PAREN`&&r++}this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(a)}});function jW(e,t){for(let n=0;n<t.length;n++){let r=t[n].proposalValues;r===void 0||r.length===0||vO.add(`${e}_function_${t[n].name}_argument_proposals`,{sequence:50,autoSelectFirstProposal:!0,selectProposal:MW,getProposals:t=>{let i=t.functionContext;if(!i||i.parent.toUpperCase()!==e.toUpperCase()||i.argPosition!==n)return;let a=[],o=``;for(let{value:e,label:t}of r){switch(typeof e){case`string`:o=`"${e}"`;break;case`number`:o=e.toString();break;case`boolean`:o=e?`TRUE`:`FALSE`;break;default:}a.push({text:o,description:t,htmlContent:[{value:o,color:typeof e==`string`?Ve.STRING:Ve.NUMBER}],fuzzySearchKey:o,alwaysExpanded:!0})}return a}})}}function MW(e,t){let n=e.end,r=e.end;[`LEFT_PAREN`,`ARG_SEPARATOR`].includes(e.type)||(n=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t.text)}_s.getAll().forEach(e=>jW(e.name,e.args)),vO.add(`pivot_ids`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||![`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`].includes(t.parent.toUpperCase())||t.argPosition!==0)return;let n=this.getters.getPivotIds();if(!n.includes(e.value))return n.map(e=>{let t=this.getters.getPivotCoreDefinition(e),n=`${this.getters.getPivotFormulaId(e)}`;return{text:n,description:t.name,htmlContent:[{value:n,color:Ve.NUMBER}],fuzzySearchKey:n+t.name,alwaysExpanded:!0}}).filter(w)},selectProposal:MW}),vO.add(`pivot_measures`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(t?.parent.toUpperCase()!==`PIVOT.VALUE`||t.argPosition!==1)return[];let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return[];let i=this.getters.getPivot(r);return i.init(),i.isValid()?i.definition.measures.map(e=>{if(e.fieldName===`__count`){let e=`"__count"`;return{text:e,description:A(`Count`),htmlContent:[{value:e,color:Ve.STRING}],fuzzySearchKey:A(`Count`)+e}}return cM(e)}).filter(w):[]},selectProposal:MW}),vO.add(`pivot_group_fields`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!NW(e)&&!PW(e))return;let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);i.init();let a=i.getFields(),{columns:o,rows:s}=i.definition,c=t.args;t?.parent.toUpperCase()===`PIVOT.VALUE`?(c=c.filter((e,t)=>t%2==0),c=c.slice(1,t.argPosition)):c=c.filter((e,t)=>t%2==1);let l=c.map(e=>e?.value).filter(w),u=o.map(e=>e.nameWithGranularity),d=s.map(e=>e.nameWithGranularity),f=[],p=[`ARG_SEPARATOR`,`SPACE`].includes(e.type)?l.at(-1):l.at(-2),m=MI.get(i.type);if(m&&p?.startsWith(`#`)&&(p=p.slice(1)),p===void 0&&(f.push(u[0]),f.push(d[0])),d.includes(p)){let e=d[d.indexOf(p)+1];f.push(e),f.push(u[0])}if(u.includes(p)){let e=u[u.indexOf(p)+1];f.push(e)}let h=f.filter(w);return h.map(e=>{let[t,n]=e.split(`:`),r=a[t];return r?sM(r,n):void 0}).concat(h.map(e=>{if(!m)return;let t=a[e.split(`:`)[0]];if(!t)return;let n=`"#${e}"`;return{text:n,description:A(`%s (positional)`,t.string)+(t.help?` (${t.help})`:``),htmlContent:[{value:n,color:Ve.STRING}],fuzzySearchKey:t.string+n}})).filter(w)},selectProposal:MW});function NW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==0}function PW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==1}vO.add(`pivot_group_values`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!e||!FW(e)&&!IW(e))return;let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);if(!i.isValid())return;let a=t.argPosition,o=e.functionContext?.args[a-1]?.value;if(!o)return;let s;try{s=i.definition.getDimension(o)}catch{return}return s.granularity===`month_number`?Object.values(co).map((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:Ve.NUMBER}]})):s.granularity===`quarter_number`?[1,2,3,4].map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:A(`Quarter %s`,e),htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`day_of_month`?C(1,32).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`iso_week_number`?C(0,54).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`day_of_week`?C(1,8).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`hour_number`?C(0,24).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`minute_number`?C(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`second_number`?C(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):i.getPossibleFieldValues(s).map(({value:e,label:t})=>{let n=typeof e==`string`,r=n?`"${e}"`:e.toString(),i=n?Ve.STRING:Ve.NUMBER,a=t===e?``:t;return{text:r,description:a,htmlContent:[{value:r,color:i}],fuzzySearchKey:r+a}})},selectProposal:MW});function FW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==1}function IW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==0}vO.add(`sheet_names`,{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return e.type===`SYMBOL`||e.type===`UNKNOWN`&&e.value.startsWith(`'`)?this.getters.getSheetIds().map(e=>{let t=Ze(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith(`'`)?t:`'`+t}}):[]},selectProposal(e,t){let n=e.start,r=e.end;this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t.text+`!`)}});function LW(e){return e.yRanges.length&&!ws.test(e.yRanges[0])?H.InvalidYRange:e.xRange&&!ws.test(e.xRange)?H.InvalidXRange:e.labelRange&&!ws.test(e.labelRange)?H.InvalidLabelRange:e.sizeRange&&!ws.test(e.sizeRange)?H.InvalidBubbleSizeRange:H.Success}let RW={sequence:40,allowedDefinitionKeys:[...Hp.commonKeys,`yRanges`,`xRange`,`labelRange`,`sizeRange`,`dataSetsHaveTitle`,`verticalAxisPosition`,`labelsAsText`,`bubbleColor`,`legendPosition`,`axesDesign`,`showValues`],fromStrDefinition(e,t,n){let r=e.yRanges.map(e=>Rc(n,t,e)).filter(w),i=Rc(n,t,e.xRange),a=Rc(n,t,e.labelRange),o=Rc(n,t,e.sizeRange);return{...e,yRanges:r,xRange:i,labelRange:a,sizeRange:o}},toStrDefinition(e,t,n){return{...e,yRanges:e.yRanges.map(e=>n.getRangeString(e,t)),xRange:e.xRange?n.getRangeString(e.xRange,t):void 0,labelRange:e.labelRange?n.getRangeString(e.labelRange,t):void 0,sizeRange:e.sizeRange?n.getRangeString(e.sizeRange,t):void 0}},validateDefinition(e,t){return e.checkValidations(t,LW)},transformDefinition(e,t,{adaptRangeString:n}){let r=e=>{if(!e)return;let{changeType:r,range:i}=n(t,e);return r===`REMOVE`?void 0:i};return{...e,yRanges:e.yRanges.map(r).filter(w),xRange:r(e.xRange),sizeRange:r(e.sizeRange),labelRange:r(e.labelRange)}},getDefinitionFromContextCreation(e,t){let n=e.dataSource?.type===`range`;return{background:e.background,yRanges:n?e.dataSource.dataSets?.map(e=>e.dataRange)??[]:[],verticalAxisPosition:e.dataSetStyles?.[0]?.verticalAxisPosition,dataSetsHaveTitle:n?e.dataSource.dataSetsHaveTitle??!1:!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`bubble`,labelRange:e.bubbleLabelRange||void 0,labelsAsText:e.labelsAsText??!1,xRange:e.auxiliaryRange||void 0,sizeRange:e.bubbleSizeRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues,humanize:e.humanize,bubbleColor:e.bubbleColorMode||{color:`multiple`}}},getContextCreation(e,t){return{...e,dataSource:{type:`range`,dataSets:e.yRanges.map((e,t)=>({dataSetId:`${t}`,dataRange:e}))},bubbleLabelRange:e.labelRange,auxiliaryRange:e.xRange,bubbleSizeRange:e.sizeRange,bubbleColorMode:e.bubbleColor}},getDefinitionForExcel:()=>void 0,updateRanges(e,t){let n=e.yRanges.map(e=>sf(e,t)).filter(w),r=sf(e.xRange,t),i=sf(e.labelRange,t),a=sf(e.sizeRange,t);return{...e,yRanges:n,xRange:r,labelRange:i,sizeRange:a}},duplicateInDuplicatedSheet(e,t,n){let r=e=>of(t,n,e);return{...e,yRanges:e.yRanges.map(r).filter(w),xRange:r(e.xRange),labelRange:r(e.labelRange),sizeRange:r(e.sizeRange)}},copyInSheetId:e=>e,getRuntime(e,t){let n=tE(t,e);return{chartJsConfig:{type:`line`,data:{datasets:fp(t,n),labels:n.labels},options:{...Qm,layout:EE(t,n),scales:Jf(t,n),plugins:{title:YE(t,e),legend:NE(t,n),tooltip:nD(t,n),chartShowValuesPlugin:UE(t,n),background:{color:t.background}}}}}}};function zW(e){return!zD.includes(e.horizontalGroupBy)||!zD.includes(e.verticalGroupBy)?H.InvalidChartDefinition:H.Success}let BW={sequence:110,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`dataSetStyles`,`showValues`,`colorScale`,`missingValueColor`,`axesDesign`,`horizontalGroupBy`,`verticalGroupBy`,`legendPosition`],validateDefinition(e,t){return e.checkValidations(t,zW)},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=qT(t,n(),e),{labels:i,datasets:a}=cp(t,r);return{chartJsConfig:{type:`calendar`,data:{labels:i,datasets:a},options:{...Qm,indexAxis:`x`,layout:DE(t,r),scales:Hf(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:eD(t,r),chartShowValuesPlugin:WE(t,r),chartColorScalePlugin:Uf(t,r),background:{color:r.background}}}}}}},VW={sequence:15,allowedDefinitionKeys:[...Hp.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:()=>H.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r,verticalAxis:vf(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=WT(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:hp(t,a)},options:{...Qm,layout:EE(t,a),scales:Vf(t,a),plugins:{title:YE(t,e),legend:PE(t,a),tooltip:$E(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},HW={sequence:100,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.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:()=>H.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=$T(t,n(),e);return{chartJsConfig:{type:`funnel`,data:{labels:a.labels,datasets:vp(t,a)},options:{...Qm,indexAxis:`y`,layout:EE(t,a),scales:$f(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:cD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}}}}},UW={sequence:90,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`colorScale`,`missingValueColor`,`region`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>H.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=QT(t,n(),e);return{chartJsConfig:{type:`choropleth`,data:{datasets:_p(t,a)},options:{...Qm,layout:EE(t,a),scales:Qf(t,a),plugins:{title:YE(t,e),tooltip:sD(t,a),legend:{display:!1},background:{color:a.background}},...i}}}}},WW={sequence:80,dataSeriesLimit:2,allowedDefinitionKeys:[...Hp.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:()=>H.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 i=JT(t,PD(e,t.dataSource),e),{dataSetsValues:a}=i,o=Math.max(...a.map(e=>Math.max(...e.data.map(e=>U(e)?Math.abs(e.value):-1/0))));return{...t,horizontal:!0,backgroundColor:LT(i.background||`#FFFFFF`),fontColor:LT(ff(i.background)),dataSets:n,labelRange:r,verticalAxis:vf(t),maxValue:o}},getRuntime(e,t,{extractData:n},r,i){let a=JT(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:sp(t,a)},options:{...Qm,indexAxis:`y`,layout:EE(t,a),scales:Xf(t,a),plugins:{title:YE(t,e),legend:kE(t,a),tooltip:aD(t,a),chartShowValuesPlugin:KE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},GW={sequence:80,allowedDefinitionKeys:[...Hp.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:()=>H.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:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r}},getRuntime(e,t,{extractData:n},r,i){let a=ZT(t,n(),e);return{chartJsConfig:{type:`radar`,data:{labels:a.labels,datasets:gp(t,a)},options:{...Qm,layout:EE(t,a),scales:Zf(t,a),plugins:{title:YE(t,e),legend:IE(t,a),tooltip:oD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},KW={sequence:60,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`labelsAsText`,`aggregated`,`axesDesign`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>H.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:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r,verticalAxis:vf(t)}},getRuntime(e,t,{extractData:n},r,i){let a=YT(t,n(),e);return{chartJsConfig:{type:`line`,data:{labels:a.labels,datasets:dp(t,a)},options:{...Qm,layout:EE(t,a),scales:qf(t,a),plugins:{title:YE(t,e),legend:ME(t,a),tooltip:tD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},qW={sequence:30,allowedDefinitionKeys:[...Hp.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:()=>H.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=eE(t,n(),e);return{chartJsConfig:{type:`doughnut`,data:{datasets:bp(t,a)},options:{cutout:t.pieHolePercentage===void 0?`25%`:`${t.pieHolePercentage}%`,...Qm,layout:EE(t,a),plugins:{title:YE(t,e),legend:LE(t,a),tooltip:lD(t,a),sunburstLabelsPlugin:GE(t,a),sunburstHoverPlugin:{enabled:!0},background:{color:a.background}},...i}}}}},JW={sequence:100,allowedDefinitionKeys:[...Hp.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:()=>H.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=eE(t,n(),e);return{chartJsConfig:{type:`treemap`,data:{labels:a.labels,datasets:Tp(t,a)},options:{...Qm,layout:EE(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:uD(t,a),background:{color:a.background}},...i}}}}};ny.add(`bar`,mD),ny.add(`combo`,VW),ny.add(`line`,TD),ny.add(`pie`,ED),ny.add(`scorecard`,Qp),ny.add(`gauge`,bD),ny.add(`scatter`,KW),ny.add(`waterfall`,DD),ny.add(`pyramid`,WW),ny.add(`radar`,GW),ny.add(`geo`,UW),ny.add(`funnel`,HW),ny.add(`sunburst`,qW),ny.add(`treemap`,JW),ny.add(`calendar`,BW),ny.add(`bubble`,RW),hh.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(`bubble`,{displayName:A(`Bubble`),chartType:`bubble`,chartSubtype:`bubble`,category:`misc`,preview:`o-spreadsheet-ChartPreview.BUBBLE_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`}),FL.add(`filter_icon`,(e,t)=>{if(e.isFilterHeader(t)){let n=e.isFilterActive(t),r=ad(e.getCellComputedStyle(t).fillColor||`#fff`)<.45;return{type:`filter_icon`,svg:fv(n,r,!1),hoverSvg:fv(n,r,!0),priority:3,horizontalAlign:`right`,size:17,margin:2,position:t,onClick:(e,t)=>{let n=t.getStore(RS),r=n.persistentCellPopover;if(r.isOpen&&r.col===e.col&&r.row===e.row&&r.type===`FilterMenu`){n.close();return}n.open(e,`FilterMenu`)}}}});var YW=l({ARRAYTOTEXT:()=>wG,ARRAY_CONSTRAIN:()=>QW,ARRAY_LITERAL:()=>$W,ARRAY_ROW:()=>eG,CHOOSECOLS:()=>tG,CHOOSEROWS:()=>nG,EXPAND:()=>rG,FLATTEN:()=>iG,FREQUENCY:()=>aG,HSTACK:()=>oG,MDETERM:()=>sG,MINVERSE:()=>cG,MMULT:()=>lG,SUMPRODUCT:()=>uG,SUMX2MY2:()=>fG,SUMX2PY2:()=>pG,SUMXMY2:()=>mG,TOCOL:()=>_G,TOROW:()=>vG,TRANSPOSE:()=>yG,VSTACK:()=>bG,WRAPCOLS:()=>xG,WRAPROWS:()=>SG});function XW(e,t){let n=e.map(I),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 ZW(e,t){let n=e.map(I),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=ma(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 QW={description:A(`Returns a result array constrained to a specific width and height.`),args:[z(`input_range (any, range<any>)`,A(`The range to constrain.`)),z(`rows (number)`,A(`The number of rows in the constrained array.`)),z(`columns (number)`,A(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=I(e),i=ea(t?.value,this.locale),a=ea(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 ma(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},$W={description:A(`Appends ranges vertically and in sequence to return a larger array. All ranges must have the same number of columns.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return ZW(e,{requireSameColCount:!0})},isExported:!1,hidden:!0},eG={description:A(`Appends ranges horizontally and in sequence to return a larger array. All ranges must have the same number of rows.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return XW(e,{requireSameRowCount:!0})},isExported:!1,hidden:!0},tG={description:A(`Creates a new array from the selected columns in the existing range.`),args:[z(`array (any, range<any>)`,A(`The array that contains the columns to be returned.`)),z(`col_num (number, range<number>, repeating)`,A(`The column index of the column to be returned.`))],compute:function(e,...t){let n=I(e),r=ka(t,e=>ea(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},nG={description:A(`Creates a new array from the selected rows in the existing range.`),args:[z(`array (any, range<any>)`,A(`The array that contains the rows to be returned.`)),z(`row_num (number, range<number>, repeating)`,A(`The row index of the row to be returned.`))],compute:function(e,...t){let n=I(e),r=ka(t,e=>ea(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return a.length===0?ma(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},rG={description:A(`Expands or pads an array to specified row and column dimensions.`),args:[z(`array (any, range<any>)`,A(`The array to expand.`)),z(`rows (number)`,A(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),z(`columns (number, optional)`,A(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),z(`pad_with (any, default=0)`,A(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=I(e),a=ea(t?.value,this.locale),o=n===void 0?i.length:ea(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())):ma(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},iG={description:A(`Flattens all the values from one or more ranges into a single column.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to flatten.`))],compute:function(...e){return[ka(e,e=>e===void 0?{value:``}:e)]},isExported:!1},aG={description:A(`Calculates the frequency distribution of a range.`),args:[z(`data (range<number>)`,A(`The array of ranges containing the values to be counted.`)),z(`classes (number, range<number>)`,A(`The range containing the set of classes.`))],compute:function(e,t){let n=ka([e],e=>e.value).filter(e=>typeof e==`number`),r=ka([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},oG={description:A(`Appends ranges horizontally and in sequence to return a larger array.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return XW(e)},isExported:!0},sG={description:A(`Returns the matrix determinant of a square matrix.`),args:[z(`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=Qi(e,`square_matrix`);return Bb(t)?Ub(t).determinant:new M(A(`The argument square_matrix must have the same number of columns and rows.`))},isExported:!0},cG={description:A(`Returns the multiplicative inverse of a square matrix.`),args:[z(`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=Qi(e,`square_matrix`);if(!Bb(t))return new M(A(`The argument square_matrix must have the same number of columns and rows.`));let{inverted:n}=Ub(t);return n||new M(A(`The matrix is not invertible.`))},isExported:!0},lG={description:A(`Calculates the matrix product of two matrices.`),args:[z(`matrix1 (number, range<number>)`,A(`The first matrix in the matrix multiplication operation.`)),z(`matrix2 (number, range<number>)`,A(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=Qi(e,`matrix1`),r=Qi(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?Gb(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},uG={description:A(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[z(`range (number, range<number>, repeating)`,A(`The range whose entries will be multiplied with corresponding entries in the other range.`))],compute:function(...e){if(!zb(...e))return new M(A(`All the ranges must have the same dimensions.`));let t=e.map(I),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*=N(n[e][r],this.locale);n+=i}return n},isExported:!0};function dG(e,t,n){if(!zb(e,t))return new M(A(`The arguments array_x and array_y must have the same dimensions.`));let r=I(e),i=I(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 fG={description:A(`Calculates the sum of the difference of the squares of the values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>e**2-t**2)},isExported:!0},pG={description:A(`Calculates the sum of the sum of the squares of the values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>e**2+t**2)},isExported:!0},mG={description:A(`Calculates the sum of squares of the differences of values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>(e-t)**2)},isExported:!0},hG=[z(`array (any, range<any>)`,A(`The array which will be transformed.`)),z(`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`)}]),z(`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 gG(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!Gi(e.value);if(t===3)return e=>e.value!==null&&!Gi(e.value);throw new M(A(`Argument ignore must be between 0 and 3`))}let _G={description:A(`Transforms a range of cells into a single column.`),args:hG,compute:function(e,t={value:0},n={value:!1}){let r=I(e),i=N(t.value,this.locale),a=(F(n.value)?r:_a(r)).flat().filter(gG(i));return a.length===0?new Ri(A(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},vG={description:A(`Transforms a range of cells into a single row.`),args:hG,compute:function(e,t={value:0},n={value:!1}){let r=I(e),i=N(t.value,this.locale),a=(F(n.value)?r:_a(r)).flat().filter(gG(i)).map(e=>[e]);return a.length===0||a[0].length===0?new Ri(A(`No results for the given arguments of TOROW.`)):a},isExported:!0},yG={description:A(`Transposes the rows and columns of a range.`),args:[z(`range (any, range<any>)`,A(`The range to be transposed.`))],compute:function(e){let t=I(e),n=t[0].length,r=t.length;return ma(n,r,(e,n)=>t[n][e])},isExported:!0},bG={description:A(`Appends ranges vertically and in sequence to return a larger array.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return ZW(e)},isExported:!0},xG={description:A(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[z(`range (any, range<any>)`,A(`The range to wrap.`)),z(`wrap_count (number)`,A(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),z(`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=I(e),i=ea(t?.value,this.locale);if(!Rb(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return ma(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},SG={description:A(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[z(`range (any, range<any>)`,A(`The range to wrap.`)),z(`wrap_count (number)`,A(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),z(`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=I(e),i=ea(t?.value,this.locale);if(!Rb(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return ma(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0},CG=[{value:0,label:A(`Concise format\xA0(default)`)},{value:1,label:A(`Strict format`)}],wG={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:[z(`array (range)`,A(`The array to convert into text`)),z(`format (number, default=0)`,A(`The format of the returned data.`),CG)],compute:function(e,t={value:0}){let n=N(t,this.locale),r=I(e);if(n===1)return pO(r,``,this.locale);if(n===0){let e=this.locale.decimalSeparator===`,`?`/`:`,`;return _a(r).flatMap(e=>e.map(e=>Gi(e.value)?e.value:P(e))).join(e)}else return new M(A(`Format must be 0 or 1`))},isExported:!0};var TG=l({ABS:()=>DG,ACOS:()=>OG,ACOSH:()=>kG,ACOT:()=>AG,ACOTH:()=>jG,ASIN:()=>MG,ASINH:()=>NG,ATAN:()=>PG,ATAN2:()=>FG,ATANH:()=>IG,CEILING:()=>LG,CEILING_MATH:()=>zG,CEILING_PRECISE:()=>BG,COS:()=>VG,COSH:()=>HG,COT:()=>UG,COTH:()=>WG,COUNTBLANK:()=>GG,COUNTIF:()=>KG,COUNTIFS:()=>qG,COUNTUNIQUE:()=>JG,COUNTUNIQUEIFS:()=>YG,CSC:()=>XG,CSCH:()=>ZG,DECIMAL:()=>QG,DEGREES:()=>$G,EXP:()=>eK,FLOOR:()=>tK,FLOOR_MATH:()=>rK,FLOOR_PRECISE:()=>iK,INT:()=>BK,ISEVEN:()=>aK,ISODD:()=>sK,ISO_CEILING:()=>oK,LN:()=>cK,LOG:()=>lK,MOD:()=>dK,MUNIT:()=>fK,ODD:()=>pK,PI:()=>mK,POWER:()=>hK,PRODUCT:()=>gK,RAND:()=>_K,RANDARRAY:()=>vK,RANDBETWEEN:()=>yK,ROUND:()=>bK,ROUNDDOWN:()=>xK,ROUNDUP:()=>SK,SEC:()=>CK,SECH:()=>wK,SEQUENCE:()=>TK,SIN:()=>EK,SINH:()=>DK,SQRT:()=>OK,SUBTOTAL:()=>MK,SUM:()=>NK,SUMIF:()=>PK,SUMIFS:()=>FK,TAN:()=>IK,TANH:()=>LK,TRUNC:()=>zK});let EG=/^-?[a-z0-9]+$/i,DG={description:A(`Absolute value of a number.`),args:[z(`value (number)`,A(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(N(e,this.locale))},isExported:!0},OG={description:A(`Inverse cosine of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=N(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},kG={description:A(`Inverse hyperbolic cosine of a number.`),args:[z(`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=N(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:[z(`value (number)`,A(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=N(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},jG={description:A(`Inverse hyperbolic cotangent of a value.`),args:[z(`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=N(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},MG={description:A(`Inverse sine of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=N(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},NG={description:A(`Inverse hyperbolic sine of a number.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(N(e,this.locale))},isExported:!0},PG={description:A(`Inverse tangent of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(N(e,this.locale))},isExported:!0},FG={description:A(`Angle from the X axis to a point (x,y), in radians.`),args:[z(`x (number)`,A(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),z(`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=N(e,this.locale),r=N(t,this.locale);return n===0&&r===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):Math.atan2(r,n)},isExported:!0},IG={description:A(`Inverse hyperbolic tangent of a number.`),args:[z(`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=N(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},LG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`value (number)`,A(`The value to round up to the nearest integer multiple of factor.`)),z(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=N(e,this.locale),r=N(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 RG(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 zG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),z(`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=N(t,this.locale);return{value:RG(N(e,this.locale),r,N(n,this.locale)),format:e?.format}},isExported:!0},BG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=N(t,this.locale);return{value:RG(N(e,this.locale),n),format:e?.format}},isExported:!0},VG={description:A(`Cosine of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(N(e,this.locale))},isExported:!0},HG={description:A(`Hyperbolic cosine of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(N(e,this.locale))},isExported:!0},UG={description:A(`Cotangent of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tan(t)},isExported:!0},WG={description:A(`Hyperbolic cotangent of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tanh(t)},isExported:!0},GG={description:A(`Number of empty values.`),args:[z(`value (any, range, repeating)`,A(`Value or range in which to count the number of blanks.`))],compute:function(...e){return da(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},KG={description:A(`A conditional count across a range.`),args:[z(`range (range)`,A(`The range that is tested against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return Ca(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},qG={description:A(`Count values depending on multiple criteria.`),args:[z(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(...e){let t=0;return Ca(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},JG={description:A(`Counts number of unique values in a range.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider for uniqueness.`))],compute:function(...e){return Fb(e)}},YG={description:A(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the number of unique values will be counted.`)),z(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=new Set;return Ca(t,(t,r)=>{let i=e[t]?.[r];Aa(i)&&n.add(i.value)},this.locale),n.size}},XG={description:A(`Cosecant of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sin(t)},isExported:!0},ZG={description:A(`Hyperbolic cosecant of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sinh(t)},isExported:!0},QG={description:A(`Converts from another base to decimal.`),args:[z(`value (string)`,A(`The number to convert.`)),z(`base (number)`,A(`The base to convert the value from.`))],compute:function(e,t){let n=N(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=P(e);if(r===``)return 0;if(!EG.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},$G={description:A(`Converts an angle value in radians to degrees.`),args:[z(`angle (number)`,A(`The angle to convert from radians to degrees.`))],compute:function(e){return N(e,this.locale)*180/Math.PI},isExported:!0},eK={description:A(`Euler's number, e (~2.718) raised to a power.`),args:[z(`value (number)`,A(`The exponent to raise e.`))],compute:function(e){return Math.exp(N(e,this.locale))},isExported:!0},tK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`value (number)`,A(`The value to round down to the nearest integer multiple of factor.`)),z(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=N(e,this.locale),r=N(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 nK(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 rK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),z(`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=N(t,this.locale);return{value:nK(N(e,this.locale),r,N(n,this.locale)),format:e?.format}},isExported:!0},iK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=N(t,this.locale);return{value:nK(N(e,this.locale),n),format:e?.format}},isExported:!0},aK={description:A(`Whether the provided value is even.`),args:[z(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=$i(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},oK={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:RG(N(e,this.locale),N(t,this.locale)),format:e?.format}},isExported:!0},sK={description:A(`Whether the provided value is even.`),args:[z(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=$i(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},cK={description:A(`The logarithm of a number, base e (euler's number).`),args:[z(`value (number)`,A(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=N(e,this.locale);return t<=0?new M(A(`The value (%s) must be strictly positive.`,t)):Math.log(t)},isExported:!0},lK={description:A(`The logarithm of a number, for a given base.`),args:[z(`value (number)`,A(`The value for which to calculate the logarithm.`)),z(`base (number, default=10)`,A(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=N(e,this.locale),r=N(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 uK(e,t){Lb(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 dK={description:A(`Modulo (remainder) operator.`),args:[z(`dividend (number)`,A(`The number to be divided to find the remainder.`)),z(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=N(t,this.locale);return{value:uK(N(e,this.locale),n),format:e?.format}},isExported:!0},fK={description:A(`Returns a n x n unit matrix, where n is the input dimension.`),args:[z(`dimension (number)`,A(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=ea(e,this.locale);return t<1?new M(A(`The argument dimension must be positive`)):Hb(t)},isExported:!0},pK={description:A(`Rounds a number up to the nearest odd integer.`),args:[z(`value (number)`,A(`The value to round to the next greatest odd number.`))],compute:function(e){let t=N(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},mK={description:A(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},hK={description:A(`A number raised to a power.`),args:[z(`base (number)`,A(`The number to raise to the exponent power.`)),z(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){let n=N(e,this.locale),r=N(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},gK={description:A(`Result of multiplying a series of numbers together.`),args:[z(`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(Ue(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),Gi(e))return r}else r!==void 0&&r.value!==null&&(n*=$i(r,this.locale),t+=1);return{value:t===0?0:n,format:Wi(e[0])}},isExported:!0},_K={description:A(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},vK={description:A(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[z(`rows (number, default=1)`,A(`The number of rows to be returned.`)),z(`columns (number, default=1)`,A(`The number of columns to be returned.`)),z(`min (number, default=0)`,A(`The minimum number you would like returned.`)),z(`max (number, default=1)`,A(`The maximum number you would like returned.`)),z(`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=ea(t,this.locale),o=ea(e,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=F(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},yK={description:A(`Random integer between two values, inclusive.`),args:[z(`low (number)`,A(`The low end of the random range.`)),z(`high (number)`,A(`The high end of the random range.`))],compute:function(e,t){let n=N(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=N(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},bK={description:A(`Rounds a number according to standard rules.`),args:[z(`value (number)`,A(`The value to round to places number of places.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},xK={description:A(`Rounds down a number.`),args:[z(`value (number)`,A(`The value to round to places number of places, always rounding down.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},SK={description:A(`Rounds up a number.`),args:[z(`value (number)`,A(`The value to round to places number of places, always rounding up.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},CK={description:A(`Secant of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(N(e,this.locale))},isExported:!0},wK={description:A(`Hyperbolic secant of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(N(e,this.locale))},isExported:!0},TK={description:A(`Returns a sequence of numbers.`),args:[z(`rows (number)`,A(`The number of rows to return`)),z(`columns (number, optional, default=1)`,A(`The number of columns to return`)),z(`start (number, optional, default=1)`,A(`The first number in the sequence`)),z(`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=N(n,this.locale),a=N(r,this.locale),o=ea(e,this.locale),s=ea(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)):ma(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},EK={description:A(`Sine of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(N(e,this.locale))},isExported:!0},DK={description:A(`Hyperbolic sine of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(N(e,this.locale))},isExported:!0},OK={description:A(`Positive square root of a positive number.`),args:[z(`value (number)`,A(`The number for which to calculate the positive square root.`))],compute:function(e){let t=N(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},kK={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(kK).map(([e,t])=>({value:parseInt(e),label:A(`%s (include manually-hidden rows)`,t)})),jK=Object.entries(kK).map(([e,t])=>({value:parseInt(e)+100,label:A(`%s (exclude manually-hidden rows)`,t)})),MK={description:A(`Returns a subtotal for a vertical range of cells using a specified aggregation function.`),args:[z(`function_code (number)`,A(`The function to use in subtotal aggregation.`),[...AK,...jK]),z(`ref (any, range<any>, repeating)`,A(`Range or reference for which you want the subtotal.`))],compute:function(e,...t){let n=ea(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=I(e),n=t[0][0]?.position;if(n===void 0)return new Li(Ji);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||!Gt(n,`SUBTOTAL`))&&i.push(this.getFormulaResult({sheetId:s,col:t,row:e}))}}return this[kK[n]].apply(this,[[i]])},isExported:!0},NK={description:A(`Sum of a series of numbers and/or cells.`),args:[z(`value (number, range<number>, repeating)`,A(`Number or range to add together.`))],compute:function(...e){let t=e[0];return{value:Pb(e,this.locale),format:Wi(t)}},isExported:!0},PK={description:A(`A conditional sum across a range.`),args:[z(`criteria_range (range)`,A(`The range which is tested against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to range.`)),z(`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 Ca([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},FK={description:A(`Sums a range depending on multiple criteria.`),args:[z(`sum_range (range)`,A(`The range to sum.`)),z(`criteria_range (any, range, repeating)`,A(`Range to check.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=0;return Ca(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},IK={description:A(`Tangent of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(N(e,this.locale))},isExported:!0},LK={description:A(`Hyperbolic tangent of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(N(e,this.locale))},isExported:!0};function RK(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let zK={description:A(`Truncates a number.`),args:[z(`value (number)`,A(`The value to be truncated.`)),z(`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:RK(N(e,this.locale),N(t,this.locale)),format:e?.format}},isExported:!0},BK={description:A(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[z(`value (number)`,A(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(N(e,this.locale))},isExported:!0};var VK=l({AVEDEV:()=>ZK,AVERAGE:()=>QK,AVERAGEA:()=>nq,AVERAGEIF:()=>rq,AVERAGEIFS:()=>iq,AVERAGE_WEIGHTED:()=>tq,CORREL:()=>Eq,COUNT:()=>aq,COUNTA:()=>oq,COVAR:()=>sq,COVARIANCE_P:()=>cq,COVARIANCE_S:()=>lq,FORECAST:()=>uq,GROWTH:()=>dq,INTERCEPT:()=>fq,LARGE:()=>pq,LINEST:()=>mq,LOGEST:()=>hq,MATTHEWS:()=>gq,MAX:()=>_q,MAXA:()=>vq,MAXIFS:()=>yq,MEDIAN:()=>bq,MIN:()=>xq,MINA:()=>Sq,MINIFS:()=>Cq,PEARSON:()=>Tq,PERCENTILE:()=>Dq,PERCENTILE_EXC:()=>Oq,PERCENTILE_INC:()=>kq,POLYFIT_COEFFS:()=>Aq,POLYFIT_FORECAST:()=>jq,QUARTILE:()=>Mq,QUARTILE_EXC:()=>Nq,QUARTILE_INC:()=>Pq,RANK:()=>Fq,RSQ:()=>Iq,SLOPE:()=>Lq,SMALL:()=>Rq,SPEARMAN:()=>zq,STDEV:()=>Bq,STDEVA:()=>Uq,STDEVP:()=>Wq,STDEVPA:()=>Gq,STDEV_P:()=>Vq,STDEV_S:()=>Hq,STEYX:()=>Kq,TREND:()=>qq,VAR:()=>Jq,VARA:()=>Zq,VARP:()=>Qq,VARPA:()=>$q,VAR_P:()=>Yq,VAR_S:()=>Xq});let HK=[{value:!0,label:A(`b is calculated normally`)},{value:!1,label:A(`b is forced to 1`)}],UK=[{value:!1,label:A(`do not return additional regression statistics`)},{value:!0,label:A(`return additional regression statistics`)}],WK=[{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)`)}],GK=[{value:!0,label:A(`Compute intercept`)},{value:!1,label:A(`Force intercept to 0`)}],KK=[{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 qK(e,t){let n=[],r=[],i=0,a=0;ca([e],e=>{n.push(e),i+=1}),ca([t],e=>{r.push(e),a+=1}),Ib(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 JK(e,t,n){let{flatDataX:r,flatDataY:i}=qK(e,t),a=i.length;Lb(a),n&&Lb(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 YK(e,t,n,r){let i=0,a=n?pa:fa,o=a(e,(e,t)=>(i+=1,e+t),0,r);Lb(i),t&&Lb(i-1);let s=o/i;return a(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function XK(e,t,n,r){let i=N(t,r);Ib(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 ca(e,e=>{let t=e?.value;typeof t==`number`&&(o=wa(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),Ib(s!==0,ja),n||Ib(1/(s+1)<=i&&i<=s/(s+1),A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),Ti(a,i,n)}let ZK={description:A(`Average magnitude of deviations from mean.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){let t=0,n=fa(e,(e,n)=>(t+=1,e+n),0,this.locale);if(t===0)return new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`));let r=n/t;return fa(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},QK={description:A(`Numerical average value in a dataset, ignoring text.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){return{value:Xb(e,this.locale),format:Wi(e[0])}},isExported:!0},$K=A(`[[FUNCTION_NAME]] has mismatched range sizes.`),eq=A(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),tq={description:A(`Weighted average.`),args:[z(`values (number, range<number>, repeating)`,A(`Value to average.`)),z(`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(!zb(i,a))return new M($K);if(Ue(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=Ue(a)?a?.[e][r].value:N(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){if(s<0)return new M(eq);t+=o*s,n+=s;continue}if(c!==l)return new M(A(`[[FUNCTION_NAME]] expects number values.`))}else{let e=N(i,this.locale),r=Ue(a)?a?.[0][0].value:N(a,this.locale);if(typeof r==`number`){if(r<0)return new M(eq);t+=e*r,n+=r}}}return n===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:t/n,format:Wi(e[0])}}},nq={description:A(`Numerical average value in a dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){let t=0,n=pa(e,(e,n)=>(t+=1,e+n),0,this.locale);return t===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:n/t,format:Wi(e[0])}},isExported:!0},rq={description:A(`Average of values depending on criteria.`),args:[z(`criteria_range (number, range<number>)`,A(`The range to check against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to criteria_range.`)),z(`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=I(n===void 0?e:n),i=0,a=0;return Ca([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),i===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):a/i},isExported:!0},iq={description:A(`Average of values depending on multiple criteria.`),args:[z(`average_range (range)`,A(`The range to average.`)),z(`criteria_range (any, range, repeating)`,A(`Range to check.`)),z(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=I(e),r=0,i=0;return Ca(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),r===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):i/r},isExported:!0},aq={description:A(`The number of numeric values in dataset.`),args:[z(`value (number, any, range<number>, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return Qb(e,this.locale)},isExported:!0},oq={description:A(`The number of values in a dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return $b(e)},isExported:!0},sq={description:A(`The covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!1)},isExported:!0},cq={description:A(`The covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!1)},isExported:!0},lq={description:A(`The sample covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!0)},isExported:!0},uq={description:A(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[z(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`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}=qK(t,n);return r.length===0||i.length===0?new Ri(ja):lx([i],[r],ha(I(e),e=>N(e,this.locale)),!0)},isExported:!0},dq={description:A(`Fits points to exponential growth trend.`),args:[z(`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.`)),z(`known_data_x (range<number>, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),z(`new_data_x (any, range, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),z(`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.`),HK)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ma(`known_data_y`)):sx(lx(cx(Qi(e,`known_data_y`)),Qi(t,`known_data_x`),Qi(n,`new_data_y`),F(r)))}},fq={description:A(`Compute the intercept of the linear regression.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);let[[],[i]]=rx([n],[r]);return i},isExported:!0},pq={description:A(`Nth largest element from a data set.`),args:[z(`data (any, range)`,A(`Array or range containing the dataset to consider.`)),z(`n (number)`,A(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(N(t?.value,this.locale)),r=[],i,a=0;ca([e],e=>{typeof e?.value==`number`&&(i=wa(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(ja):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},mq={description:A(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),z(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),HK),z(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),UK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return e.length===0||e[0].length===0?new M(Ma(`data_y`)):rx(Qi(t,`data_x`),Qi(e,`data_y`),F(n),F(r))},isExported:!0},hq={description:A(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>, optional, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),z(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),HK),z(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),UK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){if(e.length===0||e[0].length===0)return new M(Ma(`data_y`));let i=rx(Qi(t,`data_x`),cx(Qi(e,`data_y`)),F(n),F(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},gq={description:A(`Compute the Matthews correlation coefficient of a dataset.`),args:[z(`data_x (range)`,A(`The range representing the array or matrix of observed data.`)),z(`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(Yb(n,r),n.length===0||r.length===0)return new Ri(ja);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=F(n[e]);t===F(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},_q={description:A(`Maximum value in a numeric dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){return ex(e,this.locale)},isExported:!0},vq={description:A(`Maximum numeric value in a dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){let t=pa(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:Wi(e[0])}},isExported:!0},yq={description:A(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the maximum will be determined.`)),z(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=-1/0;return Ca(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},bq={description:A(`Median value in a numeric dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when calculating the median value.`))],compute:function(...e){let t=[];return la(e,e=>{t.push(e)},this.locale),{value:XK(t,{value:.5},!0,this.locale),format:Wi(t[0])}},isExported:!0},xq={description:A(`Minimum value in a numeric dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){return tx(e,this.locale)},isExported:!0},Sq={description:A(`Minimum numeric value in a dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){let t=pa(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:Wi(e[0])}},isExported:!0},Cq={description:A(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the minimum will be determined.`)),z(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=1/0;return Ca(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 wq(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);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 Tq={description:A(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return wq(e,t)},isExported:!0},Eq=Tq,Dq={description:A(`Value at a given percentile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return kq.compute.bind(this)(e,t)},isExported:!0},Oq={description:A(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`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:XK([e],t,!1,this.locale),format:Wi(e)}},isExported:!0},kq={description:A(`Value at a given percentile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:XK([e],t,!0,this.locale),format:Wi(e)}},isExported:!0},Aq={description:A(`Compute the coefficients of polynomial regression of the dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),z(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),WK),z(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),GK)],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=qK(e,t);return i.length===0||a.length===0?new Ri(ja):ix(a,i,N(n,this.locale),F(r))},isExported:!1},jq={description:A(`Predict value by computing a polynomial regression of the dataset.`),args:[z(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),z(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),WK),z(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),GK)],compute:function(e,t,n,r,i={value:!0}){let a=N(r,this.locale),{flatDataX:o,flatDataY:s}=qK(t,n);if(o.length===0||s.length===0)return new Ri(ja);let c=ix(s,o,a,F(i)).flat();return ha(I(e),e=>ox(c,N(e,this.locale),a))},isExported:!1},Mq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`quartile_number (number)`,A(`Which quartile value to return.`),KK)],compute:function(e,t){return Pq.compute.bind(this)(e,t)},isExported:!0},Nq={description:A(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`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(N(t,this.locale))};return{value:XK([e],n,!1,this.locale),format:Wi(e)}},isExported:!0},Pq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`quartile_number (number)`,A(`Which quartile value to return.`),KK)],compute:function(e,t){let n={value:.25*Math.trunc(N(t,this.locale))};return{value:XK([e],n,!0,this.locale),format:Wi(e)}},isExported:!0},Fq={description:A(`Returns the rank of a specified value in a dataset.`),args:[z(`value (number)`,A(`The value whose rank will be determined.`)),z(`data (range)`,A(`The range containing the dataset to consider.`)),z(`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=F(n),i=N(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=N(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new Ri(A(`Value not found in the given data.`))},isExported:!0},Iq={description:A(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let n=wq(e,t);if(n instanceof Error)throw n;return n**2},isExported:!0},Lq={description:A(`Compute the slope of the linear regression.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);let[[i]]=rx([n],[r]);return i},isExported:!0},Rq={description:A(`Nth smallest element in a data set.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`n (number)`,A(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(N(t?.value,this.locale)),r=[],i,a=0;ca([e],e=>{typeof e?.value==`number`&&(i=wa(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(ja):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},zq={description:A(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(t,e);if(n.length===0||r.length===0)return new Ri(ja);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},Bq={description:A(`Standard deviation.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Jq.compute.bind(this)(...e))},isExported:!0},Vq={description:A(`Standard deviation of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Yq.compute.bind(this)(...e))},isExported:!0},Hq={description:A(`Standard deviation.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Xq.compute.bind(this)(...e))},isExported:!0},Uq={description:A(`Standard deviation of sample (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Zq.compute.bind(this)(...e))},isExported:!0},Wq={description:A(`Standard deviation of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Qq.compute.bind(this)(...e))},isExported:!0},Gq={description:A(`Standard deviation of entire population (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt($q.compute.bind(this)(...e))},isExported:!0},Kq={description:A(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);return n.length===0||r.length===0?new Ri(ja):rx([n],[r],!0,!0)[1][2]},isExported:!0},qq={description:A(`Fits points to linear trend derived via least-squares.`),args:[z(`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.`)),z(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),z(`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.`)),z(`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.`),HK)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ma(`known_data_y`)):lx(Qi(e,`known_data_y`),Qi(t,`known_data_x`),Qi(n,`new_data_y`),F(r))}},Jq={description:A(`Variance.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!1,this.locale)},isExported:!0},Yq={description:A(`Variance of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!1,this.locale)},isExported:!0},Xq={description:A(`Variance.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!1,this.locale)},isExported:!0},Zq={description:A(`Variance of sample (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!0,this.locale)},isExported:!0},Qq={description:A(`Variance of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!1,this.locale)},isExported:!0},$q={description:A(`Variance of entire population (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!0,this.locale)},isExported:!0};var eJ=l({DAVERAGE:()=>rJ,DCOUNT:()=>iJ,DCOUNTA:()=>aJ,DGET:()=>oJ,DMAX:()=>sJ,DMIN:()=>cJ,DPRODUCT:()=>lJ,DSTDEV:()=>uJ,DSTDEVP:()=>dJ,DSUM:()=>fJ,DVAR:()=>pJ,DVARP:()=>mJ});function tJ(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(P(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=P(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(A(`The field (%s) must be one of %s.`,P(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=P(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)Ca(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 nJ=[z(`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.`)),z(`field (number, string)`,A(`Indicates which column in database contains the values to be extracted and operated on.`)),z(`criteria (range)`,A(`An array or range containing zero or more criteria to filter the database values by before operating.`))],rJ={description:A(`Average of a set of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return QK.compute.bind(this)([r])},isExported:!0},iJ={description:A(`Counts values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return aq.compute.bind(this)([r])},isExported:!0},aJ={description:A(`Counts values and text from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return oq.compute.bind(this)([r])},isExported:!0},oJ={description:A(`Single value from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return r.length===1?r[0]:new M(A(`More than one match found in DGET evaluation.`))},isExported:!0},sJ={description:A(`Maximum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return _q.compute.bind(this)([r])},isExported:!0},cJ={description:A(`Minimum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return xq.compute.bind(this)([r])},isExported:!0},lJ={description:A(`Product of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return gK.compute.bind(this)([r])},isExported:!0},uJ={description:A(`Standard deviation of population sample from table.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Bq.compute.bind(this)([r])},isExported:!0},dJ={description:A(`Standard deviation of entire population from table.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Wq.compute.bind(this)([r])},isExported:!0},fJ={description:A(`Sum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return NK.compute.bind(this)([r])},isExported:!0},pJ={description:A(`Variance of population sample from table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Jq.compute.bind(this)([r])},isExported:!0},mJ={description:A(`Variance of a population from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Qq.compute.bind(this)([r])},isExported:!0},hJ=A(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`),gJ=A(`There must be both positive and negative values in cashflow_amounts.`),_J=e=>A(`The cost (%s) must be positive or null.`,e),vJ=e=>A(`The cost (%s) must be strictly positive.`,e),yJ=e=>A(`The frequency (%s) must be one of %s`,e,[1,2,4].toString()),bJ=e=>A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e),xJ=e=>A(`The depreciation factor (%s) must be strictly positive.`,e),SJ=e=>A(`The discount (%s) must be different from -1.`,e),CJ=e=>A(`The discount (%s) must be strictly positive.`,e),wJ=e=>A(`The discount (%s) must be smaller than 1.`,e),TJ=e=>A(`The effective_rate (%s) must be strictly positive.`,e),EJ=e=>A(`The end_period (%s) must be positive or null.`,e),DJ=(e,t)=>A(`The end_period (%(end)s) must be smaller or equal to the life (%(life)s).`,{end:e,life:t}),OJ=e=>A(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e),kJ=(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),jJ=e=>A(`The future_value (%s) must be strictly positive.`,e),MJ=e=>A(`The investment (%s) must be strictly positive.`,e),NJ=e=>A(`The issue (%s) must be positive or null.`,e),PJ=(e,t)=>A(`The last_period (%(last)s) must be smaller or equal to the number_of_periods (%(nPeriods)s).`,{last:e,nPeriods:t}),FJ=e=>A(`The last_period (%s) must be strictly positive.`,e),IJ=e=>A(`The life (%s) must be strictly positive.`,e),LJ=(e,t)=>A(`The maturity (%(maturity)s) must be strictly greater than the settlement (%(settlement)s).`,{maturity:t,settlement:e}),RJ=e=>A(`The month (%s) must be between 1 and 12 inclusive.`,e),zJ=e=>A(`The nominal_rate (%s) must be strictly positive.`,e),BJ=e=>A(`The number_of_periods (%s) must be different from zero.`,e),VJ=e=>A(`The number_of_periods (%s) must be strictly positive.`,e),HJ=e=>A(`The period must be between 1 and number_of_periods (%s)`,e),UJ=(e,t)=>A(`The period (%(period)s) must be less than or equal to %(lifeLimit)s.`,{period:e,lifeLimit:t}),WJ=e=>A(`The period (%s) must be positive or null.`,e),GJ=e=>A(`The periods_by_year (%s) must be strictly positive.`,e),KJ=(e,t)=>A(`The period (%(period)s) must be less than or equal life (%(life)s).`,{period:e,life:t}),qJ=e=>A(`The period (%s) must be strictly positive.`,e),JJ=e=>A(`The present_value (%s) must be strictly positive.`,e),YJ=e=>A(`The price (%s) must be strictly positive.`,e),XJ=(e,t)=>A(`The purchase_date (%(purchaseDate)s) must be before the first_period_end (%(firstPeriodEnd)s).`,{purchaseDate:e,firstPeriodEnd:t}),ZJ=e=>A(`The purchase_date (%s) must be positive or null.`,e),QJ=e=>A(`The rate_guess (%s) must be strictly greater than -1.`,e),$J=e=>A(`The rate (%s) must be positive or null.`,e),eY=e=>A(`The rate (%s) must be strictly positive.`,e),tY=e=>A(`The redemption (%s) must be strictly positive.`,e),nY=e=>A(`The salvage (%s) must be positive or null.`,e),rY=(e,t)=>A(`The salvage (%(salvage)s) must be smaller or equal than the cost (%(cost)s).`,{salvage:e,cost:t}),iY=(e,t)=>A(`The settlement date (%(settlement)s) must be greater or equal to the issue date (%(issue)s).`,{settlement:e,issue:t}),aY=(e,t)=>A(`The settlement date (%(settlement)s) must at most one year after the maturity date (%(maturity)s).`,{settlement:e,maturity:t}),oY=(e,t)=>A(`The settlement date (%(settlement)s) must be strictly greater than the issue date (%(issue)s).`,{settlement:e,issue:t}),sY=e=>A(`The start_period (%s) must be positive or null.`,e),cY=(e,t)=>A(`The start_period (%(start)s) must be smaller or equal to the end_period (%(end)s).`,{start:e,end:t}),lY=e=>A(`The unit (%s) must be strictly positive.`,e),uY=e=>A(`The yield (%s) must be positive or null.`,e);function dY(e){return e.some(e=>e>0)&&e.some(e=>e<0)}function fY(e){return![0,1,2,3,4].includes(e)}function pY(e){return![1,2,4].includes(e)}function mY(e,t,n){let r=aa(e,n),i=aa(t,n),a=aa(e,n);return a.setFullYear(r.getFullYear()+1),i.getTime()<=a.getTime()}let hY=[{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 gY=l({DATE:()=>vY,DATEDIF:()=>yY,DATEVALUE:()=>bY,DAY:()=>xY,DAYS:()=>SY,DAYS360:()=>CY,EDATE:()=>wY,EOMONTH:()=>TY,HOUR:()=>EY,ISOWEEKNUM:()=>DY,MINUTE:()=>OY,MONTH:()=>kY,MONTH_END:()=>KY,MONTH_START:()=>GY,NETWORKDAYS:()=>AY,NETWORKDAYS_INTL:()=>NY,NOW:()=>PY,QUARTER:()=>qY,QUARTER_END:()=>YY,QUARTER_START:()=>JY,SECOND:()=>FY,TIME:()=>IY,TIMEVALUE:()=>LY,TODAY:()=>RY,WEEKDAY:()=>zY,WEEKNUM:()=>BY,WORKDAY:()=>VY,WORKDAY_INTL:()=>HY,YEAR:()=>UY,YEARFRAC:()=>WY,YEAR_END:()=>ZY,YEAR_START:()=>XY}),_Y=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}(_Y||{});let vY={description:A(`Converts year/month/day into a date.`),args:[z(`year (number)`,A(`The year component of the date.`)),z(`month (number)`,A(`The month component of the date.`)),z(`day (number)`,A(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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=ri(new k(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},yY={description:A(`Calculates the number of days, months, or years between two dates.`),args:[z(`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.`)),z(`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.`)),z(`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=P(n).toUpperCase();if(!Object.values(_Y).includes(r))return new M(Xi(Object.values(_Y),P(n)));let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=ni(i),s=ni(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 _Y.WHOLE_YEARS:return fi(o,s);case _Y.WHOLE_MONTHS:return ui(o,s);case _Y.WHOLE_DAYS:return di(o,s);case _Y.MONTH_WITHOUT_WHOLE_YEARS:return ui(o,s)-fi(o,s)*12;case _Y.DAYS_WITHOUT_WHOLE_MONTHS:let e=s.getDate()-o.getDate();return e<0&&(e=ai(new k(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case _Y.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR:{if(pi(i,a))return di(o,s);let e=new k(o.getFullYear(),s.getMonth(),s.getDate()),t=di(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=di(o,e)),t}}},isExported:!0},bY={description:A(`Converts a date string to a date value.`),args:[z(`date_string (string)`,A(`The string representing the date.`))],compute:function(e){let t=P(e),n=Kr(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},xY={description:A(`Day of the month that a specific date falls on.`),args:[z(`date (string)`,A(`The date from which to extract the day.`))],compute:function(e){return aa(e,this.locale).getDate()},isExported:!0},SY={description:A(`Number of days between two dates.`),args:[z(`end_date (date)`,A(`The end of the date range.`)),z(`start_date (date)`,A(`The start of the date range.`))],compute:function(e,t){let n=aa(e,this.locale),r=aa(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Mr)},isExported:!0},CY={description:A(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[z(`start_date (date)`,A(`The start date to consider in the calculation.`)),z(`end_date (date)`,A(`The end date to consider in the calculation.`)),z(`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(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=li(r,i,F(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},wY={description:A(`Date a number of months before/after another date.`),args:[z(`start_date (date)`,A(`The date from which to calculate the result.`)),z(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:ri(si(aa(e,this.locale),Math.trunc(N(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},TY={description:A(`Last day of a month before or after a date.`),args:[z(`start_date (date)`,A(`The date from which to calculate the result.`)),z(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=aa(e,this.locale),r=Math.trunc(N(t,this.locale));return{value:ri(new k(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},EY={description:A(`Hour component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the hour component.`))],compute:function(e){return aa(e,this.locale).getHours()},isExported:!0},DY={description:A(`ISO week number of the year.`),args:[z(`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=aa(e,this.locale),n=t.getFullYear(),r=1;for(;new k(n,0,r).getDay()!==4;)r+=1;let i=new k(n,0,r-3),a=31;for(;new k(n,11,a).getDay()!==4;)--a;let o=new k(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 k(n,11,a+3+1);break;case-1:let e=1;for(;new k(n-1,0,e).getDay()!==4;)e+=1;c=new k(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Mr;return Math.floor(l/7)+1},isExported:!0},OY={description:A(`Minute component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the minute component.`))],compute:function(e){return aa(e,this.locale).getMinutes()},isExported:!0},kY={description:A(`Month of the year a specific date falls in`),args:[z(`date (date)`,A(`The date from which to extract the month.`))],compute:function(e){return aa(e,this.locale).getMonth()+1},isExported:!0},AY={description:A(`Net working days between two provided days.`),args:[z(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),z(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),z(`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 NY.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function jY(e){let t=e?.value;if(typeof t==`string`){Ib(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 Ib(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 MY=[{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`)}],NY={description:A(`Net working days between two dates (specifying weekends).`),args:[z(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),z(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),z(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),MY),z(`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=aa(e,this.locale),a=aa(t,this.locale),o=jY(n),s=new Set;r!==void 0&&ca([r],e=>{let t=aa(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=k.fromTimestamp((c?i:a).getTime()),u=k.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},PY={description:A(`Current date and time as a date value.`),args:[],compute:function(){let e=k.now(),t=e.getTime()-jr.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Mr)+n,format:Ig(this.locale)}},isExported:!0},FY={description:A(`Minute component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the second component.`))],compute:function(e){return aa(e,this.locale).getSeconds()},isExported:!0},IY={description:A(`Converts hour/minute/second into a time.`),args:[z(`hour (number)`,A(`The hour component of the time.`)),z(`minute (number)`,A(`The minute component of the time.`)),z(`second (number)`,A(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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},LY={description:A(`Converts a time string into its serial number representation.`),args:[z(`time_string (string)`,A(`The string that holds the time representation.`))],compute:function(e){let t=P(e),n=Kr(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},RY={description:A(`Current date as a date value.`),args:[],compute:function(){let e=k.now();return{value:ri(new k(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},zY={description:A(`Day of the week of the date provided (as number).`),args:[z(`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.`)),z(`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=aa(e,this.locale),r=Math.round(N(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},BY={description:A(`Week number of the year.`),args:[z(`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.`)),z(`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=aa(e,this.locale),r=Math.round(N(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 DY.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 k(a,0,o);for(;s.getDay()!==i;)o+=1,s=new k(a,0,o);let c=(n.getTime()-s.getTime())/Mr;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},VY={description:A(`Date after a number of workdays.`),args:[z(`start_date (date)`,A(`The date from which to begin counting.`)),z(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),z(`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 HY.compute.bind(this)(e,t,{value:1},n)},isExported:!0},HY={description:A(`Date after a number of workdays (specifying weekends).`),args:[z(`start_date (date)`,A(`The date from which to begin counting.`)),z(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),z(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),MY),z(`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=aa(e,this.locale),a=Math.trunc(N(t,this.locale));if(n.value===`1111111`)return new M(A(`The weekend must be different from '1111111'.`));let o=jY(n),s=new Set;r!==void 0&&ca([r],e=>{let t=aa(e,this.locale);s.add(t.getTime())});let c=k.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-jr.getTime();return{value:Math.round(f/Mr),format:this.locale.dateFormat}},isExported:!0},UY={description:A(`Year specified by a given date.`),args:[z(`date (date)`,A(`The date from which to extract the year.`))],compute:function(e){return aa(e,this.locale).getFullYear()},isExported:!0},WY={description:A(`Exact number of years between two dates.`),args:[z(`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.`)),z(`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.`)),z(`day_count_convention (number, default=0)`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n={value:0}){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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)):li(r,i,a)}},GY={description:A(`First day of the month preceding a date.`),args:[z(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){let t=aa(e,this.locale);return{value:ri(new k(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},KY={description:A(`Last day of the month following a date.`),args:[z(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){return TY.compute.bind(this)(e,{value:0})}},qY={description:A(`Quarter of the year a specific date falls in`),args:[z(`date (date)`,A(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((aa(e,this.locale).getMonth()+1)/3)}},JY={description:A(`First day of the quarter of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=qY.compute.bind(this)(e);return{value:ri(new k(UY.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},YY={description:A(`Last day of the quarter of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=qY.compute.bind(this)(e);return{value:ri(new k(UY.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},XY={description:A(`First day of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:ri(new k(UY.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},ZY={description:A(`Last day of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:ri(new k(UY.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var QY=l({DELTA:()=>$Y});let $Y={description:A(`Compare two numeric values, returning 1 if they're equal.`),args:[z(`number1 (number)`,A(`The first number to compare.`)),z(`number2 (number, default=0)`,A(`The second number to compare.`))],compute:function(e,t={value:0}){return+(N(e,this.locale)===N(t,this.locale))},isExported:!0};var eX=l({FILTER:()=>nX,SORT:()=>rX,SORTN:()=>iX,UNIQUE:()=>aX});function tX(e,t,...n){for(let e=0;e<n.length;e++){let t=e%2==0?`sort_column`:`is_ascending`;Ib(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(F(Kb(n[o+1])?.value)?`asc`:`desc`);let s=n[o];if(Ue(s)&&(s.length>1||s[0].length>1))Ib(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=N(Kb(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:Pz(`desc`),asc:Pz(`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 nX={description:A(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[z(`range (any, range<any>)`,A(`The data to be filtered.`)),z(`condition (boolean, range<boolean>, repeating)`,A(`Column or row containing true or false values corresponding to the range.`))],compute:function(e,...t){let n=I(e),r=t.map(e=>ha(I(e),e=>e.value));for(let e of r)if(!Rb(e))return new M(A(`The arguments condition must be a single column or row.`));if(!zb(...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`?_a(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`?_a(o):o:new Ri(A(`No match found in FILTER evaluation`))},isExported:!1},rX={description:A(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[z(`range (range)`,A(`The data to be sorted.`)),z(`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.`)),z(`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 _a(tX(_a(e),this.locale,...t))},isExported:!0},iX={description:A(`Returns the first n items in a data set after performing a sort.`),args:[z(`range (range)`,A(`The data to be sorted.`)),z(`n (number)`,A(`The number of items to return.`)),z(`display_ties_mode (number, default=0)`,A(`A number representing the way to display ties.`)),z(`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.`)),z(`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=N(t?.value??1,this.locale),i=n.length%2==0?0:N(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=tX(_a(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 _a(o.slice(0,r));case 1:for(let e=r;e<o.length;e++)if(!s(e,r-1))return _a(o.slice(0,e));return _a(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 _a(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 _a(e)}}},isExported:!1},aX={description:A(`Unique rows in the provided source range.`),args:[z(`range (any, range<any>)`,A(`The data to filter by unique entries.`)),z(`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`)}]),z(`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(!Ue(e))return[[e]];let r=F(t?.value)||!1,i=F(n?.value)||!1;r||(e=_a(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:_a(o):new M(A(`No unique values found`))},isExported:!0};var oX=l({ACCRINTM:()=>dX,AMORLINC:()=>fX,COUPDAYBS:()=>mX,COUPDAYS:()=>pX,COUPDAYSNC:()=>hX,COUPNCD:()=>gX,COUPNUM:()=>_X,COUPPCD:()=>vX,CUMIPMT:()=>yX,CUMPRINC:()=>bX,DB:()=>xX,DDB:()=>CX,DISC:()=>wX,DOLLARDE:()=>TX,DOLLARFR:()=>EX,DURATION:()=>DX,EFFECT:()=>OX,FV:()=>AX,FVSCHEDULE:()=>jX,INTRATE:()=>MX,IPMT:()=>PX,IRR:()=>IX,ISPMT:()=>LX,MDURATION:()=>RX,MIRR:()=>zX,NOMINAL:()=>BX,NPER:()=>VX,NPV:()=>UX,PDURATION:()=>WX,PMT:()=>KX,PPMT:()=>JX,PRICE:()=>XX,PRICEDISC:()=>ZX,PRICEMAT:()=>QX,PV:()=>YX,RATE:()=>eZ,RECEIVED:()=>tZ,RRI:()=>nZ,SLN:()=>rZ,SYD:()=>iZ,TBILLEQ:()=>sZ,TBILLPRICE:()=>oZ,TBILLYIELD:()=>cZ,VDB:()=>lZ,XIRR:()=>uZ,XNPV:()=>dZ,YIELD:()=>fZ,YIELDDISC:()=>pZ,YIELDMAT:()=>mZ});let sX=[{value:1,label:A(`Annual`)},{value:2,label:A(`Semi-annual`)},{value:4,label:A(`Quarterly`)}],cX=[{value:0,label:A(`End of period (default)`)},{value:1,label:A(`Beginning of period`)}],lX=[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)];function uX(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)){Ib(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,Ib(d<r,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let dX={description:A(`Accrued interest of security paying at maturity.`),args:[z(`issue (date)`,A(`The date the security was initially issued.`)),z(`maturity (date)`,A(`The maturity date of the security.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(r,this.locale),c=N(n,this.locale),l=Math.trunc(N(i,this.locale));if(a<0)return new M(NJ(a));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(tY(s));if(c<=0)return new M(eY(c));let u=li(a,o,l);return s*c*u},isExported:!0},fX={description:A(`Depreciation for an accounting period.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`purchase_date (date)`,A(`The date the asset was purchased.`)),z(`first_period_end (date)`,A(`The date the first period ended.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`rate (number)`,A(`The deprecation rate.`)),z(`day_count_convention (number, optional)`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=N(e,this.locale),c=Math.trunc(N(t,this.locale)),l=Math.trunc(N(n,this.locale)),u=N(r,this.locale),d=N(i,this.locale),f=N(a,this.locale),p=Math.trunc(N(o,this.locale));if(s<=0)return new M(vJ(s));if(c<0)return new M(ZJ(c));if(u<0)return new M(nY(u));if(u>s)return new M(rY(u,s));if(d<0)return new M(WJ(d));if(f<=0)return new M(eY(f));if(fY(p))return new M(bJ(p));if(c>l)return new M(XJ(c,l));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=li(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},pX={description:A(`Days in coupon period containing settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));if(s===1){let i=vX.compute.bind(this)(e,t,n,r).value,a=gX.compute.bind(this)(e,t,n,r).value;return N(a,this.locale)-N(i,this.locale)}return(s===3?365:360)/o},isExported:!0},mX={description:A(`Days from settlement until next coupon.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=vX.compute.bind(this)(e,t,n,r).value,l=N(c,this.locale);if([1,2,3].includes(s))return i-l;if(s===4){let e=li(l,i,s);return Math.round(e*360)}let u=aa(i,this.locale),d=aa(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&&oi(d)&&oi(u)&&(_=30),_===31&&(g===30||g===31)&&(_=30),m===2&&oi(d)&&(g=30),g===31&&(g=30),(p-f)*360+(h-m)*30+(_-g)},isExported:!0},hX={description:A(`Days from settlement until next coupon.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=gX.compute.bind(this)(e,t,n,r).value,l=N(c,this.locale);if([1,2,3].includes(s))return l-i;if(s===4){let e=li(i,l,s);return Math.round(e*360)}let u=mX.compute.bind(this)(e,t,n,r);return N(pX.compute.bind(this)(e,t,n,r),this.locale)-N(u,this.locale)},isExported:!0},gX={description:A(`Next coupon date after the settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=12/o,l=_X.compute.bind(this)(e,t,n,r);return{value:ri(si(aa(a,this.locale),-(N(l,this.locale)-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},_X={description:A(`Number of coupons between settlement and maturity.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=1,l=a,u=12/o;for(;l>i;)l=ri(si(aa(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},vX={description:A(`Last coupon date prior to or on the settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=12/o,l=_X.compute.bind(this)(e,t,n,r);return{value:ri(si(aa(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},yX={description:A(`Cumulative interest paid over a set of periods.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),z(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i,a={value:0}){let o=N(r,this.locale),s=N(i,this.locale),c=N(e,this.locale),l=N(n,this.locale),u=N(t,this.locale),d=+!!F(a);if(u<=0)return new M(VJ(u));if(o<=0)return new M(AJ(o));if(s<=0)return new M(FJ(s));if(o>s)return new M(kJ(o,s));if(s>u)return new M(PJ(s,u));if(c<=0)return new M(eY(c));if(l<=0)return new M(JJ(l));let f=0;for(let e=o;e<=s;e++)f+=NX(c,e,u,l,0,d);return f},isExported:!0},bX={description:A(`Cumulative principal paid over a set of periods.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),z(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i,a={value:0}){let o=N(r,this.locale),s=N(i,this.locale),c=N(e,this.locale),l=N(n,this.locale),u=N(t,this.locale),d=+!!F(a);if(u<=0)return new M(VJ(u));if(o<=0)return new M(AJ(o));if(s<=0)return new M(FJ(s));if(o>s)return new M(kJ(o,s));if(s>u)return new M(PJ(s,u));if(c<=0)return new M(eY(c));if(l<=0)return new M(JJ(l));let f=0;for(let e=o;e<=s;e++)f+=qX(c,e,u,l,0,d);return f},isExported:!0},xX={description:A(`Depreciation via declining balance method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`month (number, optional)`,A(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=Math.trunc(N(r,this.locale)),l=i.length?Math.trunc(N(i[0],this.locale)):12,u=s+(l===12?0:1);if(a<0)return new M(_J(a));if(o<0)return new M(nY(o));if(c<=0)return new M(qJ(c));if(s<=0)return new M(IJ(s));if(1>l||l>12)return new M(RJ(l));if(c>u)return new M(UJ(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},SX=`#,##0.00`,CX={description:A(`Depreciation via double-declining balance method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`factor (number, default=2)`,A(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=N(i,this.locale);if(a<0)return new M(_J(a));if(o<0)return new M(nY(o));if(c<=0)return new M(qJ(c));if(s<=0)return new M(IJ(s));if(c>s)return new M(KJ(c,s));if(l<=0)return new M(xJ(l));if(a===0||o>=a)return{value:0,format:SX};let u=l/s;if(u>1)return{value:c===1?a-o:0,format:SX};if(c<=1)return{value:a*u,format:SX};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:SX}},isExported:!0},wX={description:A(`Discount rate of a security based on price.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(YJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return(c-s)/c/u},isExported:!0},TX={description:A(`Convert a decimal fraction to decimal value.`),args:[z(`fractional_price (number)`,A(`The price quotation given using fractional decimal conventions.`)),z(`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=N(e,this.locale),r=Math.trunc(N(t,this.locale));if(r<=0)return new M(lY(r));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},EX={description:A(`Convert a decimal value to decimal fraction.`),args:[z(`decimal_price (number)`,A(`The price quotation given as a decimal value.`)),z(`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=N(e,this.locale),r=Math.trunc(N(t,this.locale));if(r<=0)return new M(lY(r));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},DX={description:A(`Number of periods for an investment to reach a value.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=N(n,this.locale),l=N(r,this.locale),u=Math.trunc(N(i,this.locale)),d=Math.trunc(N(a,this.locale));if(o>=s)return new M(LJ(o,s));if(pY(u))return new M(yJ(u));if(fY(d))return new M(bJ(d));if(c<0)return new M($J(c));if(l<0)return new M(uY(l));let f=li(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},OX={description:A(`Annual effective interest rate.`),args:[z(`nominal_rate (number)`,A(`The nominal interest rate per year.`)),z(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=N(e,this.locale),r=Math.trunc(N(t,this.locale));return n<=0?new M(zJ(n)):r<=0?new M(GJ(r)):(1+n/r)**+r-1},isExported:!0};function kX(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:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_amount (number)`,A(`The amount per period to be paid.`)),z(`present_value (number, default=0)`,A(`The current value of the annuity.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:kX(N(e,this.locale),N(t,this.locale),N(n,this.locale),N(r,this.locale),+!!F(i)),format:`#,##0.00`}},isExported:!0},jX={description:A(`Future value of principal from series of rates.`),args:[z(`principal (number)`,A(`The amount of initial capital or value to compound against.`)),z(`rate_schedule (number, range<number>)`,A(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=N(e,this.locale);return da([t],(e,t)=>e*(1+N(t,this.locale)),n)},isExported:!0},MX={description:A(`Calculates effective interest rate.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`investment (number)`,A(`The amount invested in the security.`)),z(`redemption (number)`,A(`The amount to be received at maturity.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(r,this.locale),c=N(n,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(c<=0)return new M(MJ(c));if(s<=0)return new M(tY(s));if(fY(l))return new M(bJ(l));let u=li(a,o,l);return(s-c)/c/u},isExported:!0};function NX(e,t,n,r,i,a){return GX(e,n,r,i,a)-qX(e,t,n,r,i,a)}let PX={description:A(`Payment on the principal of an investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`period (number)`,A(`The amortization period, in terms of number of periods.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:NX(N(e,this.locale),N(t,this.locale),N(n,this.locale),N(r,this.locale),N(i,this.locale),+!!F(a)),format:`#,##0.00`}},isExported:!0},FX=.1,IX={description:A(`Internal rate of return given periodic cashflows.`),args:[z(`cashflow_amounts (number, range<number>)`,A(`An array or range containing the income or payments associated with the investment.`)),z(`rate_guess (number, default=${FX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:FX}){let n=N(t,this.locale);if(n<=-1)return new M(QJ(n));let r=!1,i=!1,a=[];if(la([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),!r||!i)return new M(gJ);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:uX(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},LX={description:A(`Returns the interest paid at a particular period of an investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`period (number)`,A(`The period for which you want to view the interest payment.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=N(e,this.locale),a=N(t,this.locale),o=N(n,this.locale),s=N(r,this.locale);return o===0?new M(BJ(o)):-1*(s-a/o*s)*i},isExported:!0},RX={description:A(`Modified Macaulay duration.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`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=DX.compute.bind(this)(e,t,n,r,i,a),s=N(r,this.locale),c=Math.trunc(N(i,this.locale));return N(o,this.locale)/(1+s/c)},isExported:!0},zX={description:A(`Modified internal rate of return.`),args:[z(`cashflow_amounts (range<number>)`,A(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),z(`financing_rate (number)`,A(`The interest rate paid on funds invested.`)),z(`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=N(t,this.locale),i=N(n,this.locale),a=_a(e).flat().filter(e=>e.value!==null).map(e=>N(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(gJ);let l=1/(o-1);return(-s/c)**l-1},isExported:!0},BX={description:A(`Annual nominal interest rate.`),args:[z(`effective_rate (number)`,A(`The effective interest rate per year.`)),z(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=N(e,this.locale),r=Math.trunc(N(t,this.locale));return n<=0?new M(TJ(n)):r<=0?new M(GJ(r)):((n+1)**(1/r)-1)*r},isExported:!0},VX={description:A(`Number of payment periods for an investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`payment_amount (number)`,A(`The amount of each payment made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=+!!F(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 HX(e,t,n,r){let i=0;return fa(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let UX={description:A(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[z(`discount (number)`,A(`The discount rate of the investment over one period.`)),z(`cashflow (number, range<number>, repeating)`,A(`The future cash flows.`))],compute:function(e,...t){let n=N(e,this.locale);return n===-1?new M(SJ(n)):{value:HX(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},WX={description:A(`Computes the number of periods needed for an investment to reach a value.`),args:[z(`rate (number)`,A(`The rate at which the investment grows each period.`)),z(`present_value (number)`,A(`The investment's current value.`)),z(`future_value (number)`,A(`The investment's desired future value.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return r<=0?new M(eY(r)):i<=0?new M(JJ(i)):a<=0?new M(jJ(a)):(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function GX(e,t,n,r,i){if(t<=0)throw new M(VJ(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 KX={description:A(`Periodic payment for an annuity investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){let a=N(t,this.locale),o=N(e,this.locale),s=+!!F(i),c=N(r,this.locale);return{value:GX(o,a,N(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function qX(e,t,n,r,i,a){if(n<=0)throw new M(VJ(n));if(t<=0||t>n)throw new M(HJ(n));let o=GX(e,n,r,i,a);return a===1&&t===1?o:o+-kX(e,a===0?t-1:t-2,o,r+o*a,0)*e}let JX={description:A(`Payment on the principal of an investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`period (number)`,A(`The amortization period, in terms of number of periods.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=N(n,this.locale),s=N(e,this.locale),c=N(t,this.locale),l=+!!F(a),u=N(i,this.locale);return{value:qX(s,c,o,N(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},YX={description:A(`Present value of an annuity investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_amount (number)`,A(`The amount per period to be paid.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=+!!F(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},XX={description:A(`Price of a security paying periodic interest.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(N(e,this.locale)),c=Math.trunc(N(t,this.locale)),l=N(n,this.locale),u=N(r,this.locale),d=N(i,this.locale),f=Math.trunc(N(a,this.locale)),p=Math.trunc(N(o,this.locale));if(s>=c)return new M(LJ(s,c));if(pY(f))return new M(yJ(f));if(fY(p))return new M(bJ(p));if(l<0)return new M($J(l));if(u<0)return new M(uY(u));if(d<=0)return new M(tY(d));let m=li(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},ZX={description:A(`Price of a discount security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the security at time of purchase.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(CJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return c-s*c*u},isExported:!0},QX={description:A(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`issue (date)`,A(`The date the security was initially issued.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=Math.trunc(N(n,this.locale)),l=N(r,this.locale),u=N(i,this.locale),d=Math.trunc(N(a,this.locale));if(o<=c)return new M(oY(o,c));if(o>=s)return new M(LJ(o,s));if(fY(d))return new M(bJ(d));if(l<0)return new M($J(l));if(u<0)return new M(uY(u));let f=li(o,s,d),p=li(o,c,d),m=100+li(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},$X=.1,eZ={description:A(`Interest rate of an annuity investment.`),args:[z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_per_period (number)`,A(`The amount per period to be paid.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX),z(`rate_guess (number, default=${$X})`,A(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:$X}){let o=N(e,this.locale),s=N(t,this.locale),c=+!!F(i),l=N(a,this.locale)||$X,u=N(r,this.locale),d=N(n,this.locale);return o<=0?new M(VJ(o)):dY([s,d,u])?l<=-1?new M(QJ(l)):(u-=s*c,d+=s*c,{value:uX(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},tZ={description:A(`Amount received at maturity for a security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`investment (number)`,A(`The amount invested (irrespective of face value of each security).`)),z(`discount (number)`,A(`The discount rate of the security invested in.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));return a>=o?new M(LJ(a,o)):fY(l)?new M(bJ(l)):s<=0?new M(MJ(s)):c<=0?new M(CJ(c)):s/(1-c*li(a,o,l))},isExported:!0},nZ={description:A(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[z(`number_of_periods (number)`,A(`The number of periods.`)),z(`present_value (number)`,A(`The present value of the investment.`)),z(`future_value (number)`,A(`The future value of the investment.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return r<=0?new M(VJ(r)):(a/i)**(1/r)-1},isExported:!0},rZ={description:A(`Depreciation of an asset using the straight-line method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},iZ={description:A(`Depreciation via sum of years digit method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=N(e,this.locale),a=N(t,this.locale),o=N(n,this.locale),s=N(r,this.locale);if(s<=0)return new M(qJ(s));if(o<=0)return new M(IJ(o));if(s>o)return new M(KJ(s,o));let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function aZ(e,t,n){return 100*(1-n*li(e,t,2))}let oZ={description:A(`Price of a US Treasury bill.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);return r>=i?new M(LJ(r,i)):mY(r,i,this.locale)?a<=0?new M(CJ(a)):a>=1?new M(wJ(a)):aZ(r,i,a):new M(aY(r,i))},isExported:!0},sZ={description:A(`Equivalent rate of return for a US Treasury bill.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);if(r>=i)return new M(LJ(r,i));if(!mY(r,i,this.locale))return new M(aY(r,i));if(a<=0)return new M(CJ(a));if(a>=1)return new M(wJ(a));let o=SY.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=aZ(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},cZ={description:A(`The yield of a US Treasury bill based on price.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);if(r>=i)return new M(LJ(r,i));if(!mY(r,i,this.locale))return new M(aY(r,i));if(a<=0)return new M(YJ(a));let o=li(r,i,2);return(100-a)/a*(1/o)},isExported:!0},lZ={description:A(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`start (number)`,A(`Starting period to calculate depreciation.`)),z(`end (number)`,A(`Ending period to calculate depreciation.`)),z(`factor (number, default=2)`,A(`The number of months in the first year of depreciation.`)),z(`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=N(e,this.locale),c=N(t,this.locale),l=N(n,this.locale),u=Math.trunc(N(r,this.locale)),d=Math.trunc(N(i,this.locale)),f=N(a,this.locale),p=F(o);if(s<0)return new M(_J(s));if(c<0)return new M(nY(c));if(l<=0)return new M(IJ(l));if(u<0)return new M(sY(u));if(d<0)return new M(EJ(d));if(u>d)return new M(cY(u,d));if(d>l)return new M(DJ(d,l));if(f<=0)return new M(xJ(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},uZ={description:A(`Internal rate of return given non-periodic cash flows.`),args:[z(`cashflow_amounts (range<number>)`,A(`An range containing the income or payments associated with the investment.`)),z(`cashflow_dates (range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),z(`rate_guess (number, default=${$X})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:$X}){let r=N(n,this.locale);if(!zb(e,t))return new M(hJ);let i=e.flat().map(e=>N(e,this.locale)),a=t.flat().map(e=>N(e,this.locale));if(!dY(i))return new M(gJ);if(a.some(e=>e<a[0]))return new M(OJ(a[0]));if(r<=-1)return new M(QJ(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 uX(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},dZ={description:A(`Net present value given to non-periodic cash flows..`),args:[z(`discount (number)`,A(`The discount rate of the investment over one period.`)),z(`cashflow_amounts (number, range<number>)`,A(`An range containing the income or payments associated with the investment.`)),z(`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=N(e,this.locale);if(!zb(t,n))return new M(hJ);let i=I(t).flat().map(e=>$i(e,this.locale)),a=I(n).flat().map(e=>$i(e,this.locale));if(a.some(e=>e<a[0]))return new M(OJ(a[0]));if(r<=0)return new M(eY(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},fZ={description:A(`Annual yield of a security paying periodic interest.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(N(e,this.locale)),c=Math.trunc(N(t,this.locale)),l=N(n,this.locale),u=N(r,this.locale),d=N(i,this.locale),f=Math.trunc(N(a,this.locale)),p=Math.trunc(N(o,this.locale));if(s>=c)return new M(LJ(s,c));if(pY(f))return new M(yJ(f));if(fY(p))return new M(bJ(p));if(l<0)return new M($J(l));if(u<=0)return new M(YJ(u));if(d<=0)return new M(tY(d));let m=li(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(uX(b,ee,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},pZ={description:A(`Annual yield of a discount security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(YJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return(c/s-1)/u},isExported:!0},mZ={description:A(`Annual yield of a security paying interest at maturity.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`issue (date)`,A(`The date the security was initially issued.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`price (number)`,A(`The price at which the security is bought.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=Math.trunc(N(n,this.locale)),l=N(r,this.locale),u=N(i,this.locale),d=Math.trunc(N(a,this.locale));if(o>=s)return new M(LJ(o,s));if(fY(d))return new M(bJ(d));if(o<c)return new M(iY(o,c));if(l<0)return new M($J(l));if(u<=0)return new M(YJ(u));let f=li(c,s,d),p=li(c,o,d),m=li(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0};var hZ=l({CELL:()=>_Z,ISBLANK:()=>TZ,ISERR:()=>vZ,ISERROR:()=>yZ,ISFORMULA:()=>DZ,ISLOGICAL:()=>bZ,ISNA:()=>xZ,ISNONTEXT:()=>SZ,ISNUMBER:()=>CZ,ISTEXT:()=>wZ,NA:()=>EZ});let gZ=[{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.`)}],_Z={description:A(`Gets information about a cell.`),args:[z(`info_type (string)`,A(`The type of information requested.`),gZ),z(`reference (any, range<any>)`,A(`The reference to the cell.`))],compute:function(e,t){let n=P(e).toLowerCase();if(!gZ.map(e=>e.value).includes(n))return new M(A(`The info_type should be one of %s.`,gZ.join(`, `)));let r=I(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`:qo(r.format)?`l`:typeof r.value==`number`||typeof r.value==`boolean`?`v`:`l`}return``},isExported:!0},vZ={description:A(`Whether a value is an error other than #N/A.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return Gi(t)&&t!==j.NotAvailable},isExported:!0},yZ={description:A(`Whether a value is an error.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return Gi(t)},isExported:!0},bZ={description:A("Whether a value is `true` or `false`."),args:[z(`value (any)`,A(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},xZ={description:A(`Whether a value is the error #N/A.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},SZ={description:A(`Whether a value is non-textual.`),args:[z(`value (any)`,A(`The value to be checked.`))],compute:function(e){return!wZ.compute.bind(this)(e)},isExported:!0},CZ={description:A(`Whether a value is a number.`),args:[z(`value (any)`,A(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},wZ={description:A(`Whether a value is text.`),args:[z(`value (any)`,A(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&Gi(e?.value)===!1},isExported:!0},TZ={description:A(`Whether the referenced cell is empty`),args:[z(`value (any)`,A(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},EZ={description:A(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0},DZ={description:A(`Checks whether there is a reference to a cell that contains a formula, and returns TRUE or FALSE.`),args:[z(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){return e?.position===void 0?new Li(Ji):this.getters.getCell(e.position)?.isFormula??!1},isExported:!0};var OZ=l({AND:()=>kZ,FALSE:()=>AZ,IF:()=>jZ,IFERROR:()=>MZ,IFNA:()=>NZ,IFS:()=>PZ,NOT:()=>FZ,OR:()=>IZ,SWITCH:()=>LZ,TRUE:()=>RZ,XOR:()=>zZ});let kZ={description:A("Logical `and` operator."),args:[z(`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}=Mb(e);return n?t:new M(ja)},isExported:!0},AZ={description:A("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},jZ={description:A(`Returns value depending on logical expression.`),args:[z(`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.`)),z(`value_if_true (any, range)`,A(`The value the function returns if logical_expression is TRUE.`)),z(`value_if_false (any, range, default=FALSE)`,A(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){return Jb(e)?os(this,_s.get(`IF`),[e,t,n]):(F(Kb(e))?t:n)??{value:0}},isExported:!0},MZ={description:A(`Value if it is not an error, otherwise 2nd argument.`),args:[z(`value (any, range)`,A(`The value to return if value itself is not an error.`)),z(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an error.`))],compute:function(e,t){return Jb(e)?os(this,_s.get(`IFERROR`),[e,t]):(Gi(Kb(e)?.value)?t:e)??{value:0}},isExported:!0},NZ={description:A(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[z(`value (any, range)`,A(`The value to return if value itself is not #N/A an error.`)),z(`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 Jb(e)?os(this,_s.get(`IFNA`),[e,t]):(Kb(e)?.value===j.NotAvailable?t:e)??{value:0}},isExported:!0},PZ={description:A(`Returns a value depending on multiple logical expressions.`),args:[z(`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.`)),z(`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(Jb(e[0]))return os(this,_s.get(`IFS`),e);let t=F(Kb(e.shift())),n=e.shift();if(t)return n??{value:0}}return new M(A(`No match.`))},isExported:!0},FZ={description:A(`Returns opposite of provided logical value.`),args:[z(`logical_expression (boolean)`,A(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!F(e)},isExported:!0},IZ={description:A("Logical `or` operator."),args:[z(`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}=Nb(e);return n?t:new M(ja)},isExported:!0},LZ={description:A(`Returns a value by comparing cases to an expression.`),args:[z(`expression (number, boolean, string)`,A(`The value to be checked.`)),z(`case (any, repeating)`,A(`Case to be checked against expression.`)),z(`value (any, repeating)`,A(`Value to be returned if its corresponding case matches expression.`)),z(`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?Ki(e):t.pop();for(let n=0;n<t.length;n+=2){let r=t[n];if(r&&Gi(r.value))return r;if(e?.value===r?.value)return t[n+1]||{value:0}}return n||{value:0}},isExported:!0},RZ={description:A("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},zZ={description:A("Logical `xor` operator."),args:[z(`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 ya(e,e=>(t=!0,n=n?!e:e,!0)),t?n:new M(ja)},isExported:!0};function BZ(e,t){let n=t.getPivotId(e);if(!n)throw new M(A(`There is no pivot with id "%s"`,e));return n}function VZ(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 HZ(e){if(e.length%2!=0)throw new M(A(`Function PIVOT takes an even number of arguments.`))}function UZ(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=bn(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new Li;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&Mn(D(e.__originCellPosition),n))throw new Ii;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 WZ=l({ADDRESS:()=>qZ,CHOOSE:()=>uQ,COLUMN:()=>JZ,COLUMNS:()=>YZ,DROP:()=>dQ,FORMULATEXT:()=>pQ,HLOOKUP:()=>XZ,INDEX:()=>ZZ,INDIRECT:()=>QZ,LOOKUP:()=>$Z,MATCH:()=>eQ,OFFSET:()=>lQ,PIVOT:()=>cQ,PIVOT_HEADER:()=>sQ,PIVOT_VALUE:()=>oQ,ROW:()=>tQ,ROWS:()=>nQ,TAKE:()=>fQ,VLOOKUP:()=>rQ,XLOOKUP:()=>aQ});let GZ=[{value:!0,label:A(`A1 style (default)`)},{value:!1,label:A(`R1C1 style`)}],KZ=[{value:!0,label:A(`Approximate match (default)`)},{value:!1,label:A(`Exact match`)}],qZ={description:A(`Returns a cell reference as a string. `),args:[z(`row (number)`,A(`The row number of the cell reference. `)),z(`column (number)`,A(`The column number (not name) of the cell reference. A is column number 1. `)),z(`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)`)}]),z(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation or R1C1 style notation.`),GZ),z(`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=ta(e,this.locale),o=ta(t,this.locale);if(a<1)return new M(Vb(a));if(o<1)return new M(Vb(o));let s=ta(n,this.locale);if(![1,2,3,4].includes(s))return new M(Yi(1,4,s));let c=F(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:js(P(i),l)},isExported:!0},JZ={description:A(`Column number of a specified cell.`),args:[z(`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=I(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 Li(Ji);let r=n.position.col;return t.length===1?r+1:ma(t.length,1,e=>({value:r+e+1}))},isExported:!0},YZ={description:A(`Number of columns in a specified array or range.`),args:[z(`range (any, range<any>)`,A(`The range whose column count will be returned.`))],compute:function(e){let t=I(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},XZ={description:A(`Horizontal lookup`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`index (number)`,A(`The row index of the value to be returned, where the first row in range is numbered 1.`)),z(`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.`),KZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(N(n?.value,this.locale)),a=I(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[F(r.value)?wa(a,e,`nextSmaller`,`asc`,a.length,o):Ta(a,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?Ki(e):s[i-1]},isExported:!0},ZZ={description:A(`Returns the content of a cell, specified by row and column offset.`),args:[z(`reference (any, range)`,A(`The range of cells from which the values are returned.`)),z(`row (number, default=0)`,A(`The index of the row to be returned from within the reference range of cells.`)),z(`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=I(e),i=N(t.value,this.locale),a=N(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},QZ={description:A(`Returns the content of a cell, specified by a string.`),args:[z(`reference (string)`,A(`The range of cells from which the values are returned.`)),z(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`),GZ)],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new Li(A(`Reference should be defined.`));if(!F(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 Li;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},$Z={description:A(`Look up a value.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`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=I(t),i=I(n),a=r.length,o=r[0].length,s=o>=a,c=wa(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?Ki(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},eQ={description:A(`Position of item in range that matches value.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`range (any, range)`,A(`The one-dimensional array to be searched.`)),z(`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=N(n,this.locale),i=I(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=wa(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Ta(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=wa(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?Ki(e):s+1},isExported:!0},tQ={description:A(`Row number of a specified cell.`),args:[z(`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=I(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 Li(Ji);let r=n.position.row;return t[0].length===1?r+1:ma(1,t[0].length,(e,t)=>({value:r+t+1}))},isExported:!0},nQ={description:A(`Number of rows in a specified array or range.`),args:[z(`range (any, range<any>)`,A(`The range whose row count will be returned.`))],compute:function(e){let t=I(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},rQ={description:A(`Vertical lookup.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`index (number)`,A(`The column index of the value to be returned, where the first column in range is numbered 1.`)),z(`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.`),KZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(N(n?.value,this.locale)),a=I(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=F(r.value)?wa(a,e,`nextSmaller`,`asc`,a[0].length,o):Ta(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?Ki(e):c},isExported:!0},iQ={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},aQ={description:A(`Search a range for a match and return the corresponding item from a second range.`),args:[z(`search_key (string,number,boolean)`,A(`The value to search for.`)),z(`lookup_range (any, range)`,A(`The range to consider for the search. Should be a single column or a single row.`)),z(`return_range (any, range)`,A(`The range containing the return value. Should have the same dimensions as lookup_range.`)),z(`if_not_found (any, optional)`,A(`If a valid match is not found, return this value.`)),z(`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`)}]),z(`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(N(i.value,this.locale)),s=Math.trunc(N(a.value,this.locale)),c=I(t),l=I(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=iQ[o],m=s===-1,h=s===2||s===-2?wa(c,e,p,s===2?`asc`:`desc`,f,d):Ta(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?Ki(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},oQ={description:A(`Get the value from a pivot.`),args:[z(`pivot_id (number,string)`,A(`ID of the pivot.`)),z(`measure_name (string)`,A(`Name of the measure.`)),z(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),z(`domain_value (number,string,boolean,repeating,optional)`,A(`Value.`))],compute:function(e,t,...n){let r=P(e),i=P(t),a=BZ(r,this.getters);VZ(a,i,this.getters),HZ(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);UZ(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)}},sQ={description:A(`Get the header of a pivot.`),args:[z(`pivot_id (number,string)`,A(`ID of the pivot.`)),z(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),z(`domain_value (number,string,value,repeating,optional)`,A(`Value.`))],compute:function(e,...t){let n=P(e),r=BZ(n,this.getters);HZ(t);let i=this.getters.getPivot(r);UZ(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(P(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}}},cQ={description:A(`Get a pivot table.`),args:[z(`pivot_id (string)`,A(`ID of the pivot.`)),z(`row_count (number, optional)`,A(`number of rows`)),z(`include_total (boolean, default=TRUE)`,A(`Whether to include total/sub-totals or not.`)),z(`include_column_titles (boolean, default=TRUE)`,A(`Whether to include the column titles or not.`)),z(`column_count (number, optional)`,A(`number of columns`)),z(`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=BZ(P(e),this.getters),s=this.getters.getPivot(o),c=this.getters.getPivotCoreDefinition(o),l=nS(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.`));UZ(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(vg(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(qx(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}},lQ={description:A(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[z(`cell_reference (any, range<any>)`,A(`The starting point from which to count the offset rows and columns.`)),z(`offset_rows (number)`,A(`The number of rows to offset by.`)),z(`offset_columns (number)`,A(`The number of columns to offset by.`)),z(`height (number, default='height of cell_reference')`,A(`The number of rows of the range to return starting at the offset target.`)),z(`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 Li(Ji);let a=I(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 Li(Ji);let s=a[0].length,c=a.length;if(r){let e=N(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=N(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=N(t,this.locale),u=N(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 Li(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 Li:(d&&this.addDependencies?.(d,[g]),ma(c,s,(e,t)=>this.getFormulaResult({sheetId:h,col:f+e,row:p+t})))}},uQ={description:A(`Returns an element from a list of choices based on index.`),args:[z(`index (number)`,A(`Which choice to return.`)),z(`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(N(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},dQ={description:A(`Excludes a specified number of rows or columns from the start or end of an array.`),args:[z(`array (range)`,A(`The array from which to drop rows or columns`)),z(`rows (number)`,A(`The number of rows to drop. A negative value drops from the end of the array.`)),z(`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=N(t,this.locale),i=N(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},fQ={description:A(`Returns a specified number of contiguous rows or columns from the start or end of an array.`),args:[z(`array (range)`,A(`The array from which to take rows or columns.`)),z(`rows (number)`,A(`The number of rows to take. A negative value takes from the end of the array.`)),z(`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?N(t,this.locale):e[0].length,i=N(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},pQ={description:A(`Returns a formula as a string.`),args:[z(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){if(e?.position===void 0)return new Li(Ji);let t=this.getters.getCell(e.position);return t?.isFormula?t.compiledFormula.toFormulaString(this.getters):new Ri(A(`The cell does not contain a formula.`))},isExported:!0};var mQ=l({ADD:()=>hQ,CONCAT:()=>gQ,DIVIDE:()=>_Q,EQ:()=>xQ,GT:()=>CQ,GTE:()=>wQ,LT:()=>TQ,LTE:()=>EQ,MINUS:()=>DQ,MULTIPLY:()=>OQ,NE:()=>kQ,POW:()=>AQ,SPILLED_RANGE:()=>jQ,UMINUS:()=>MQ,UNARY_PERCENT:()=>NQ,UPLUS:()=>PQ});let hQ={description:A(`Sum of two numbers.`),args:[z(`value1 (number)`,A(`The first addend.`)),z(`value2 (number)`,A(`The second addend.`))],compute:function(e,t){return{value:N(e,this.locale)+N(t,this.locale),format:e?.format||t?.format}}},gQ={description:A(`Concatenation of two values.`),args:[z(`value1 (string)`,A(`The value to which value2 will be appended.`)),z(`value2 (string)`,A(`The value to append to value1.`))],compute:function(e,t){return P(e)+P(t)},isExported:!0},_Q={description:A(`One number divided by another.`),args:[z(`dividend (number)`,A(`The number to be divided.`)),z(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=N(t,this.locale);return n===0?new Vi(A(`The divisor must be different from zero.`)):{value:N(e,this.locale)/n,format:e?.format||t?.format}}};function vQ(e){return e===void 0||e.value===null}let yQ={number:0,string:``,boolean:!1};function bQ(e,t,n=2e-16){return Math.abs(e-t)<n}let xQ={description:A(`Equal.`),args:[z(`value1 (string, number, boolean)`,A(`The first value.`)),z(`value2 (string, number, boolean)`,A(`The value to test against value1 for equality.`))],compute:function(e,t){if(Gi(e?.value))return e;if(Gi(t?.value))return t;let n=vQ(e)?yQ[typeof t?.value]:e?.value,r=vQ(t)?yQ[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:bQ(n,r)}:{value:n===r}}};function SQ(e,t,n){if(Gi(e?.value))return e;if(Gi(t?.value))return t;let r=vQ(e)?yQ[typeof t?.value]:e?.value,i=vQ(t)?yQ[typeof e?.value]:t?.value;typeof r!=`number`&&(r=P(r).toUpperCase()),typeof i!=`number`&&(i=P(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 CQ={description:A(`Strictly greater than.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being greater than value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return SQ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!bQ(e,t)&&e>t:e>t)}},wQ={description:A(`Greater than or equal to.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being greater than or equal to value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return SQ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?bQ(e,t)||e>t:e>=t)}},TQ={description:A(`Less than.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being less than value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=wQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},EQ={description:A(`Less than or equal to.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being less than or equal to value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=CQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},DQ={description:A(`Difference of two numbers.`),args:[z(`value1 (number)`,A(`The minuend, or number to be subtracted from.`)),z(`value2 (number)`,A(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:N(e,this.locale)-N(t,this.locale),format:e?.format||t?.format}}},OQ={description:A(`Product of two numbers`),args:[z(`factor1 (number)`,A(`The first multiplicand.`)),z(`factor2 (number)`,A(`The second multiplicand.`))],compute:function(e,t){return{value:N(e,this.locale)*N(t,this.locale),format:e?.format||t?.format}}},kQ={description:A(`Not equal.`),args:[z(`value1 (string, number, boolean)`,A(`The first value.`)),z(`value2 (string, number, boolean)`,A(`The value to test against value1 for inequality.`))],compute:function(e,t){let n=xQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},AQ={description:A(`A number raised to a power.`),args:[z(`base (number)`,A(`The number to raise to the exponent power.`)),z(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){return hK.compute.bind(this)(e,t)}},jQ={description:A(`Gets the spilled range of an array formula.`),args:[z(`ref (any, range<any>)`,A(`The reference to get the spilled range from.`))],compute:function(e){if(e===void 0)return new Li(Ji);let t=I(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(Gi(n.value))return n;if(n.position===void 0)return new Li(Ji);let r=this.__originCellPosition;r&&this.updateDependencies?.(r);let i=this.getters.getSpreadZone(n.position);if(i===void 0)return new Li;let a=this.getters.getRangeFromZone(this.__originSheetId,i);return r&&this.addDependencies?.(r,[a]),ma(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},MQ={description:A(`A number with the sign reversed.`),args:[z(`value (number)`,A(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-N(e,this.locale),format:e?.format}}},NQ={description:A(`Value interpreted as a percentage.`),args:[z(`percentage (number)`,A(`The value to interpret as a percentage.`))],compute:function(e){return N(e,this.locale)/100}},PQ={description:A(`A specified number, unchanged.`),args:[z(`value (any)`,A(`The number to return.`))],compute:function(e={value:null}){return e}},$=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),FQ={transform:e=>e,inverseTransform:e=>e},IQ=1e-10,LQ=.0254,RQ=LQ/72,zQ=.3048,BQ=.9144,VQ=1609.34,HQ=1852,UQ=946073047258e4,WQ={g:{...FQ,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:{...FQ,category:`distance`},km:{...$(1e3),category:`distance`},ang:{...$(IQ),category:`distance`},Picapt:{...$(RQ),category:`distance`},pica:{...$(LQ/6),category:`distance`},in:{...$(LQ),category:`distance`},ft:{...$(zQ),category:`distance`},yd:{...$(BQ),category:`distance`},ell:{...$(1.143),category:`distance`},mi:{...$(VQ),category:`distance`},survey_mi:{...$(1609.34),category:`distance`},Nmi:{...$(HQ),category:`distance`},ly:{...$(UQ),category:`distance`},parsec:{...$(0x6da012f95c9fd0),category:`distance`},sec:{...FQ,category:`time`},min:{...$(60),category:`time`},hr:{...$(3600),category:`time`},day:{...$(86400),category:`time`},yr:{...$(31556952),category:`time`},Pa:{...FQ,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:{...FQ,category:`force`},dyn:{...$(1e-5),category:`force`},pond:{...$(.00980665),category:`force`},lbf:{...$(4.44822),category:`force`},J:{...FQ,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:{...FQ,category:`power`},PS:{...$(735.499),category:`power`},HP:{...$(745.7),category:`power`},T:{...FQ,category:`magnetism`},ga:{...$(1e-4),category:`magnetism`},K:{...FQ,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":{...FQ,category:`volume`,order:3},"ang^3":{...$(IQ**3),category:`volume`,order:3},"Picapt^3":{...$(RQ**3),category:`volume`,order:3},tsp:{...$(492892e-11),category:`volume`},tspm:{...$(5e-6),category:`volume`},tbs:{...$(14786764825785619e-21),category:`volume`},"in^3":{...$(LQ**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":{...$(zQ**3),category:`volume`,order:3},bushel:{...$(.0352390704),category:`volume`},barrel:{...$(.158987295),category:`volume`},"yd^3":{...$(BQ**3),category:`volume`,order:3},MTON:{...$(1.13267386368),category:`volume`},GRT:{...$(2.83168),category:`volume`},"mi^3":{...$(VQ**3),category:`volume`,order:3},"Nmi^3":{...$(HQ**3),category:`volume`,order:3},"ly^3":{...$(UQ**3),category:`volume`,order:3},"m^2":{...FQ,category:`area`,order:2},"ang^2":{...$(IQ**2),category:`area`,order:2},"Picapt^2":{...$(RQ**2),category:`area`,order:2},"in^2":{...$(LQ**2),category:`area`,order:2},"ft^2":{...$(zQ**2),category:`area`,order:2},"yd^2":{...$(BQ**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":{...$(VQ**2),category:`area`,order:2},"Nmi^2":{...$(HQ**2),category:`area`,order:2},"ly^2":{...$(UQ**2),category:`area`,order:2},bit:{...FQ,category:`information`},byte:{...$(8),category:`information`},"m/s":{...FQ,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`}},GQ={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`},KQ={"":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},qQ={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`)},JQ=Object.entries(WQ).map(([e,t])=>({value:e,label:YQ(t.category)}));function YQ(e){return qQ[e]??``}function XQ(e){for(let[t,n]of Object.entries(KQ)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=WQ[r];if(!i&&GQ[r]&&(i=WQ[GQ[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var ZQ=l({CONVERT:()=>QQ});let QQ={description:A(`Converts a numeric value to a different unit of measure.`),args:[z(`value (number)`,A(`the numeric value in start_unit to convert to end_unit`)),z(`start_unit (string)`,A(`The starting unit, the unit currently assigned to value`),JQ),z(`end_unit (string)`,A(`The unit of measure into which to convert value`),JQ)],compute:function(e,t,n){let r=N(e,this.locale),i=P(t),a=P(n),o=XQ(i),s=XQ(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')`,YQ(o.category),YQ(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 $Q=l({CHAR:()=>r$,CLEAN:()=>i$,CONCATENATE:()=>a$,EXACT:()=>o$,FIND:()=>s$,FORMAT_LARGE_NUMBER:()=>c$,JOIN:()=>l$,LEFT:()=>u$,LEN:()=>d$,LOWER:()=>f$,MID:()=>p$,PROPER:()=>m$,REGEXEXTRACT:()=>g$,REGEXREPLACE:()=>_$,REGEXTEST:()=>h$,REPLACE:()=>v$,RIGHT:()=>y$,SEARCH:()=>b$,SPLIT:()=>x$,SUBSTITUTE:()=>S$,TEXT:()=>D$,TEXTAFTER:()=>k$,TEXTBEFORE:()=>A$,TEXTJOIN:()=>C$,TEXTSPLIT:()=>w$,TRIM:()=>T$,UPPER:()=>E$,VALUE:()=>O$});let e$=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,t$=[{value:0,label:A(`Case-sensitive (default)`)},{value:1,label:A(`Case-insensitive`)}],n$=[{value:0,label:A(`Don't match to end (default)`)},{value:1,label:A(`Match to end`)}],r$={description:A(`Gets character associated with number.`),args:[z(`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(N(e,this.locale));return t<1?new M(A(`The table_number (%s) is out of range.`,t)):String.fromCharCode(t)},isExported:!0},i$={description:A(`Remove non-printable characters from a piece of text.`),args:[z(`text (string)`,A(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=P(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},a$={description:A(`Appends strings to one another.`),args:[z(`string (string, range<string>, repeating)`,A(`String to append in sequence.`))],compute:function(...e){return da(e,(e,t)=>e+P(t),``)},isExported:!0},o$={description:A(`Tests whether two strings are identical.`),args:[z(`string1 (string)`,A(`The first string to compare.`)),z(`string2 (string)`,A(`The second string to compare.`))],compute:function(e,t){return P(e)===P(t)},isExported:!0},s$={description:A(`First position of string found in text, case-sensitive.`),args:[z(`search_for (string)`,A(`The string to look for within text_to_search.`)),z(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),z(`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=P(e),i=P(t),a=N(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},c$={description:A(`Apply a large number format`),args:[z(`value (number)`,A(`The number.`)),z(`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:N(e,this.locale),format:zo(e,t,this.locale)}}},l$={description:A(`Concatenates elements of arrays with delimiter.`),args:[z(`delimiter (string)`,A(`The character or string to place between each concatenated value.`)),z(`value_or_array (string, range<string>, repeating)`,A(`Value to be appended using delimiter.`))],compute:function(e,...t){let n=P(e);return da(t,(e,t)=>(e?e+n:``)+P(t),``)}},u$={description:A(`Substring from beginning of specified string.`),args:[z(`text (string)`,A(`The string from which the left portion will be returned.`)),z(`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?N(t[0],this.locale):1;return n<0?new M(A(`The number_of_characters (%s) must be positive or null.`,n)):P(e).substring(0,n)},isExported:!0},d$={description:A(`Length of a string.`),args:[z(`text (string)`,A(`The string whose length will be returned.`))],compute:function(e){return P(e).length},isExported:!0},f$={description:A(`Converts a specified string to lowercase.`),args:[z(`text (string)`,A(`The string to convert to lowercase.`))],compute:function(e){return P(e).toLowerCase()},isExported:!0},p$={description:A(`A segment of a string.`),args:[z(`text (string)`,A(`The string to extract a segment from.`)),z(`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.`)),z(`extract_length (number)`,A(`The length of the segment to extract.`))],compute:function(e,t,n){let r=P(e),i=N(t,this.locale),a=N(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},m$={description:A(`Capitalizes each word in a specified string.`),args:[z(`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 P(e).replace(e$,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},h$={description:A(`Checks whether a string matches the supplied regular expression.`),args:[z(`text (string)`,A(`The string to test.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`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=P(e),i=P(t),a=N(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},g$={description:A(`Extract text from a string based on the supplied regular expression.`),args:[z(`text (string)`,A(`The string on which you want to extract text.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`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`)}]),z(`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=P(e),a=P(t),o=N(n,this.locale),s=N(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},_$={description:A(`Replace text in a string based on the supplied regular expression.`),args:[z(`text (string)`,A(`The string in which you want to replace text.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`replacement (string)`,A(`The text to use as the replacement.`)),z(`occurrence (number, default=0)`,A(`0 = replace all matches. A negative number counts from the end.`)),z(`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=P(e),o=P(t),s=P(n),c=N(r,this.locale),l=N(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},v$={description:A(`Replaces part of a text string with different text.`),args:[z(`text (string)`,A(`The text, a part of which will be replaced.`)),z(`position (number)`,A(`The position where the replacement will begin (starting from 1).`)),z(`length (number)`,A(`The number of characters in the text to be replaced.`)),z(`new_text (string)`,A(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=N(t,this.locale);if(i<1)return new M(A(`The position (%s) must be greater than or equal to 1.`,i));let a=P(e),o=N(n,this.locale),s=P(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},y$={description:A(`A substring from the end of a specified string.`),args:[z(`text (string)`,A(`The string from which the right portion will be returned.`)),z(`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?N(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=P(e),i=r.length;return r.substring(i-n,i)},isExported:!0},b$={description:A(`First position of string found in text, ignoring case.`),args:[z(`search_for (string)`,A(`The string to look for within text_to_search.`)),z(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),z(`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=P(e).toLowerCase(),i=P(t).toLowerCase(),a=N(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},x$={description:A(`Split text by specific character delimiter(s).`),args:[z(`text (string)`,A(`The text to divide.`)),z(`delimiter (string)`,A(`The character or characters to use to split text.`)),z(`split_by_each (boolean, default=true})`,A(`Whether or not to divide text around each character contained in delimiter.`)),z(`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=P(e),a=qe(P(t)),o=F(n),s=F(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!==``)),_a([l])},isExported:!1},S$={description:A(`Replaces existing text with new text in a string.`),args:[z(`text_to_search (string)`,A(`The text within which to search and replace.`)),z(`search_for (string)`,A(`The string to search for within text_to_search.`)),z(`replace_with (string)`,A(`The string that will replace search_for.`)),z(`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=N(r,this.locale);if(i<0)return new M(A(`The occurrenceNumber (%s) must be positive or null.`,i));let a=P(e),o=P(t);if(o===``)return a;let s=P(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},C$={description:A(`Combines text from multiple strings and/or arrays.`),args:[z(`delimiter (string)`,A(`A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),z(`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)`)}]),z(`texts (string, range<string>, repeating)`,A(`Text item to join.`))],compute:function(e,t={value:!0},...n){let r=P(e),i=F(t),a=0;return da(n,(e,t)=>i&&P(t)===``?e:(a++?e+r:``)+P(t),``)},isExported:!0},w$={description:A(`Splits text into rows or columns using specified column and row delimiters.`),args:[z(`text (string)`,A(`The text to split.`)),z(`col_delimiter (string, range<string>)`,A(`Character or string to split columns by.`)),z(`row_delimiter (string, range<string>, optional)`,A(`Character or string to split rows by.`)),z(`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`)}]),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`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 Ri){let o=P(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=I(t).flat().map(e=>qe(P(e))),c=I(n).flat().map(e=>qe(P(e)));if(s.some(e=>e===``)||c.some(e=>e===``))return new M(A(`The delimiters cannot be empty values.`));let l=F(r),u=N(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 _a(d)},isExported:!0},T$={description:A(`Removes space characters.`),args:[z(`text (string)`,A(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return Pt(P(e))},isExported:!0},E$={description:A(`Converts a specified string to uppercase.`),args:[z(`text (string)`,A(`The string to convert to uppercase.`))],compute:function(e){return P(e).toUpperCase()},isExported:!0},D$={description:A(`Converts a number to text according to a specified format.`),args:[z(`number (number)`,A(`The number, date or time to format.`)),z(`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 R(N(e,this.locale),{format:P(t),locale:this.locale})},isExported:!0},O$={description:A(`Converts a string to a numeric value.`),args:[z(`value (number)`,A(`the string to be converted`))],compute:function(e){return N(e,this.locale)},isExported:!0},k$={description:A(`Returns text that occurs after a given substring or delimiter.`),args:[z(`text (string)`,A(`The source text.`)),z(`delimiter (string)`,A(`The substring after which text will be returned.`)),z(`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.`)),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`match_end (number, default=0))`,A(`Whether to treat the end of text as a delimiter.`),n$),z(`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 Ri){let o=P(e),s=N(n,this.locale),c=N(r,this.locale),l=N(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=P(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:[z(`text (string)`,A(`The source text.`)),z(`delimiter (string)`,A(`The substring after which text will be returned.`)),z(`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.`)),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`match_end (number, default=0))`,A(`Whether to match a delimiter against the end of the text.`),n$),z(`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 Ri){let o=P(e),s=N(n,this.locale),c=N(r,this.locale),l=N(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=P(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 j$=l({HYPERLINK:()=>M$});let M$={description:A(`Creates a hyperlink in a cell.`),args:[z(`url (string)`,A(`The full URL of the link enclosed in quotation marks.`)),z(`link_label (string, optional)`,A(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=P(e).trim(),r=P(t)||n;return n===``?r:ot(r,n)},isExported:!0},N$=[{name:A(`Array`),functions:YW},{name:A(`Database`),functions:eJ},{name:A(`Date`),functions:gY},{name:A(`Filter`),functions:eX},{name:A(`Financial`),functions:oX},{name:A(`Info`),functions:hZ},{name:A(`Lookup`),functions:WZ},{name:A(`Logical`),functions:OZ},{name:A(`Math`),functions:TG},{name:A(`Operator`),functions:mQ},{name:A(`Statistical`),functions:VK},{name:A(`Text`),functions:$Q},{name:A(`Engineering`),functions:QY},{name:A(`Web`),functions:j$},{name:A(`Parser`),functions:ZQ}];for(let e of N$){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),_s.add(n,{isExported:!1,...r})}}let P$={},F$={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},I$={autoCompleteProviders:vO,autofillModifiersRegistry:tR,autofillRulesRegistry:nR,cellMenuRegistry:VP,colMenuRegistry:nF,errorTypes:Pi,functionRegistry:_s,featurePluginRegistry:eB,iconsOnCellRegistry:FL,statefulUIPluginRegistry:tB,coreViewsPluginRegistry:nB,corePluginRegistry:$z,rowMenuRegistry:lF,sidePanelRegistry:sN,figureRegistry:rg,chartSidePanelComponentRegistry:WO,chartDataSourceSidePanelComponentRegistry:Zw,chartComponentRegistry:Ah,chartTypeRegistry:ny,chartSubtypeRegistry:hh,chartDataSourceRegistry:ty,topbarMenuRegistry:OB,topbarComponentRegistry:qB,clickableCellRegistry:rB,otRegistry:ER,inverseCommandRegistry:oB,urlRegistry:ql,cellPopoverRegistry:LS,numberFormatMenuRegistry:wB,repeatLocalCommandTransformRegistry:wz,repeatCommandTransformRegistry:Cz,clipboardHandlersRegistries:eI,pivotRegistry:eM,pivotTimeAdapterRegistry:fx,pivotSidePanelRegistry:mM,pivotNormalizationValueRegistry:Wx,supportedPivotPositionalFormulaRegistry:MI,pivotToFunctionValueRegistry:Gx,migrationStepRegistry:lS,chartJsExtensionRegistry:gr},L$={arg:z,isEvaluationError:Gi,toBoolean:F,toJsDate:aa,toNumber:N,toString:P,toNormalizedPivotValue:Bx,toFunctionPivotValue:Hx,toXC:E,toZone:hn,toUnboundedZone:mn,toCartesian:nn,numberToLetters:qt,lettersToNumber:Jt,UuidGenerator:G,formatValue:R,createCurrencyFormat:Mo,ColorGenerator:Fd,computeTextWidth:wu,createEmptyWorkbookData:kS,createEmptySheet:OS,createEmptyExcelSheet:AS,doesCellContainFunction:Gt,rgbaToHex:sd,colorToRGBA:cd,positionToZone:D,isDefined:w,isMatrix:Ue,lazy:_t,genericRepeat:KB,createAction:h,createActions:p,transformRangeData:ir,deepEquals:T,overlap:kn,union:Tn,isInside:jn,deepCopy:x,expandZoneOnInsertion:xn,reduceZoneOnDeletion:wn,unquote:Xe,getMaxObjectId:Mx,getFirstPivotFunction:aM,getNumberOfPivotFunctions:oM,parseDimension:Fx,isDateOrDatetimeField:Ix,makeFieldProposal:sM,periodYearToComparable:dx,insertTokenAfterArgSeparator:lM,insertTokenAfterLeftParenthesis:uM,mergeContiguousZones:tr,getPivotHighlights:oj,pivotTimeAdapter:px,UNDO_REDO_PIVOT_COMMANDS:QL,createPivotFormula:zx,areDomainArgsFieldsValid:Rx,splitReference:As,sanitizeSheetName:Qe,getUniqueText:Ht,isNumber:Si,isDateTime:Wr,createCustomFields:Zx,schemeToColorScale:oS,isDateTimeFormat:To,jsDateToNumber:ii,numberToJsDate:ni,DateTime:k,parseFormat:Ja,isFormula:Ut,domainToColRowDomain:wj,collapseHierarchicalDisplayName:rS},R$={isMarkdownLink:it,parseMarkdownLink:st,markdownLink:ot,openLink:Ql,urlRepresentation:Zl},z$={Checkbox:Qw,Section:Z,Select:Qh,RoundColorPicker:TT,ChartDataSeries:uT,ChartErrorSection:mT,ChartLabelRange:dT,ChartRangeDataSourceComponent:kD,ChartTitle:ST,ChartPanel:JO,ChartFigure:tg,ChartJsComponent:Vp,ClickableCellSortIcon:NI,ZoomableChartJsComponent:Sh,Grid:jI,GridOverlay:oI,ScorecardChart:Pm,GaugeChartComponent:Oh,LineConfigPanel:kO,BarConfigPanel:gT,PieChartDesignPanel:MO,GenericChartConfigPanel:hT,ChartWithAxisDesignPanel:MT,GenericZoomableChartDesignPanel:NT,LineChartDesignPanel:AO,GaugeChartConfigPanel:qD,GaugeChartDesignPanel:wO,ScorecardChartConfigPanel:FO,ScorecardChartDesignPanel:IO,GeoChartDesignPanel:DO,RadarChartDesignPanel:NO,WaterfallChartDesignPanel:UO,ComboChartDesignPanel:WD,FunnelChartDesignPanel:KD,SunburstChartDesignPanel:LO,TreeMapChartDesignPanel:HO,ChartTypePicker:KO,FigureComponent:ig,MenuPopover:Zh,Popover:qh,SelectionInput:lT,ValidationMessages:pT,AddDimensionButton:dj,PivotDimensionGranularity:pj,PivotDimensionOrder:mj,PivotDimension:fj,PivotLayoutConfigurator:vj,PivotHTMLRenderer:FI,PivotDeferUpdate:cj,PivotTitleSection:yj,CogWheelMenu:Yw,TextInput:Hw,SidePanelCollapsible:vT,RadioSelection:wT,GeoChartRegionSelectSection:TO,ChartDashboardMenu:$h,FullScreenFigure:PI,NumberInput:yT,TopBar:YV,Composer:iO},B$={useDragAndDropListItems:Fw,useHighlights:QO,useHighlightsOnHover:ZO},V$={useStoreProvider:Cr,DependencyContainer:xr,CellPopoverStore:RS,ComposerFocusStore:mr,CellComposerStore:BF,FindAndReplaceStore:Bk,HighlightStore:oT,DelayedHoveredCellStore:ag,HoveredTableStore:rI,ModelStore:sr,NotificationStore:yO,RendererStore:dr,SelectionInputStore:cT,SpreadsheetStore:fr,useStore:O,useLocalStore:wr,SidePanelStore:lN,PivotSidePanelStore:fM,PivotMeasureDisplayPanelStore:ij,ClientFocusStore:dF,GridRenderer:mI};function H$(e,t){return _s.add(e,t),{addFunction:(e,t)=>H$(e,t)}}let U$={DEFAULT_LOCALE:L,HIGHLIGHT_COLOR:ee,PIVOT_STATIC_TABLE_CONFIG:Fe,PIVOT_INSERT_TABLE_STYLE_ID:Ie,ChartTerms:lg,FIGURE_ID_SPLITTER:`??`,GRID_ICON_EDGE_LENGTH:17,GRID_ICON_MARGIN:2,CHART_TYPES:aS},W$={...OD,...II};e.AbstractCellClipboardHandler=mz,e.AbstractChart=Hp,e.AbstractFigureClipboardHandler=sW,e.BadExpressionError=Fi,e.CHART_TYPES=aS,e.CellErrorType=j,e.CellValueType=V,e.CircularDependencyError=Ii,e.ClientDisconnectedError=cz,e.ClipboardMIMEType=zS,e.CommandResult=H,e.CompiledFormula=bl,e.CorePlugin=Bg,e.CoreViewPlugin=fN,e.DEFAULT_LOCALE=L,e.DEFAULT_LOCALES=Na,e.DEFAULT_LOCALE_DIGIT_GROUPING=`[3,0]`,e.DIRECTION=We,e.DispatchResult=Wl,e.DivisionByZeroError=Vi,e.EvaluationError=M,e.InvalidReferenceError=Li,e.LocalTransportService=JB,e.Model=iW,e.NEXT_VALUE=sg,e.NotAvailableError=Ri,e.NumberTooLargeError=Hi,e.OrderedLayers=lr,e.PREVIOUS_VALUE=og,e.PivotRuntimeDefinition=bj,e.Registry=B,e.Revision=sz,e.SPREADSHEET_DIMENSIONS=F$,e.SplillBlockedError=Bi,e.Spreadsheet=QV,e.SpreadsheetPivotTable=Vj,e.UIPlugin=pR,e.UnknownFunctionError=zi,e.__info__=P$,e.addFunction=H$,e.addRenderingLayer=ur,e.astToFormula=IF,e.availableConditionalFormatOperators=wk,e.availableDataValidationOperators=Ik,e.availableFiltersOperators=yW,e.borderStyles=He,e.canExecuteInReadonly=Ul,e.categories=N$,e.chartHelpers=W$,e.components=z$,e.constants=U$,e.convertAstNodes=Ec,e.coreTypes=Vl,e.createAutocompleteArgumentsProvider=jW,e.errorTypes=Pi,e.filterDateCriterionOperators=SW,e.filterNumberCriterionOperators=xW,e.filterTextCriterionOperators=bW,e.findCellInNewZone=Hn,e.functionCache=vl,e.getCaretDownSvg=av,e.getCaretUpSvg=ov,e.helpers=L$,e.hooks=B$,e.invalidSubtotalFormulasCommands=Rl,e.invalidateBordersCommands=Ll,e.invalidateCFEvaluationCommands=Il,e.invalidateChartEvaluationCommands=Pl,e.invalidateDependenciesCommands=Fl,e.invalidateEvaluationCommands=Nl,e.isCoreCommand=Hl,e.isHeadersDependant=Ol,e.isMatrix=Ue,e.isPositionDependent=jl,e.isRangeDependant=Al,e.isSheetDependent=Dl,e.isTargetDependent=kl,e.isZoneDependent=Ml,e.iterateAstNodes=Dc,e.links=R$,e.load=mS,e.lockedSheetAllowedCommands=Bl,e.parse=wc,e.parseTokens=Tc,e.readonlyAllowedCommands=zl,e.registries=I$,e.schemeToColorScale=oS,e.setDefaultSheetViewSize=Ne,e.setTranslationMethod=ji,e.stores=V$,e.tokenColors=Ve,e.tokenize=Hs,P$.version=`19.4.0-alpha.4`,P$.date=`2026-05-11T13:50:06.000Z`,P$.hash=`4f00b68`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
|
965
|
+
`),`_rels/.rels`)}function tW(e){let t={},n=[];for(let r of e.sheets){let e=r.name.slice(0,31);e=Ht(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 nW(e){for(let t of e.sheets)t.tables=t.tables.filter(e=>Nn(hn(e.range)).numberOfRows>1);return e}var rW=function(e){return e[e.Ready=0]=`Ready`,e[e.Running=1]=`Running`,e[e.RunningCore=2]=`RunningCore`,e[e.Finalizing=3]=`Finalizing`,e}(rW||{}),iW=class e extends br{corePlugins=[];statefulUIPlugins=[];range;session;isReplayingCommand=!1;renderers={};status=rW.Ready;config;corePluginConfig;coreViewPluginConfig;uiPluginConfig;state;selection;getters;coreGetters;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},t={},n=[],r=!1){let i=performance.now();console.debug(`##### Model creation #####`),super(),Mi(),n=SS(e,n);let a=mS(e,r);this.state=new hH,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(a.revisionId),this.coreGetters={},this.range=new dH(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 pH(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 $z.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(n);for(let e of nB.getAll()){let t=this.setupCoreViewPlugin(e);this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of tB.getAll()){let t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of eB.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()-i,`ms`),console.debug(`######`)}joinSession(){this.session.join(this.config.client)}async leaveSession({shouldSnapshot:e}={shouldSnapshot:!0}){let t=e&&!this.getters.isReadonly()?_t(()=>this.exportData()):void 0;await this.session.leave(t)}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=rW.RunningCore,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new lz(cH({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 $V(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:G.smallUuid(),name:A(`Anonymous`).toString()},n=e.transportService||new JB,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 eH(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(Na));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,colorScheme:this.config.colorScheme}}checkDispatchAllowed(e){let t=Hl(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return this.processCommandResults(t)}processCommandResults(e){return e.some(e=>e!==H.Success)?new Wl(e.flat()):Wl.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=rW.Finalizing;for(let e of this.handlers)e.finalize();this.status=rW.Ready,this.trigger(`command-finalized`)}canDispatch=(e,t)=>this.checkDispatchAllowed(aW(e,t));dispatch=(e,t)=>{let n=aW(e,t),r=this.status;if(this.getters.isReadonly()&&!Ul(n))return new Wl(H.Readonly);if(!this.session.canApplyOptimisticUpdate())return new Wl(H.WaitingSessionConfirmation);switch(r){case rW.Ready:let t=this.checkDispatchAllowed(n);if(!t.isSuccessful)return this.trigger(`update`),this.trigger(`command-rejected`,{command:n,result:t}),t;this.status=rW.Running;let{changes:r,commands:i}=this.state.recordChanges(()=>{let t=performance.now();Hl(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=rW.Ready,this.trigger(`update`);break;case rW.Running:if(Hl(n)){let e=this.checkDispatchAllowed(n);if(!e.isSuccessful)return e;this.state.addCommand(n)}this.dispatchToHandlers(this.handlers,n);break;case rW.Finalizing:throw Error(`Cannot dispatch commands in the finalize state`);case rW.RunningCore:if(Hl(n))throw Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,n)}return Wl.Success};dispatchFromCorePlugin=(e,t)=>{let n=aW(e,t),r=this.status;this.status=rW.RunningCore;let i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,n),this.status=r,Wl.Success};dispatchToHandlers(e,t){let n=Hl(t);for(let r of e)!n&&r instanceof Bg||r.beforeHandle(t);for(let r of e)!n&&r instanceof Bg||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 JB};return T(n,new e(x(t),r)._exportData(!1))?t:(n.isNotSquishable=!0,n)}_exportData(e){let t=kS();for(let n of this.handlers)n instanceof Bg&&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=jS();for(let t of this.handlers)t instanceof zg&&await t.exportForExcel(e);return e=x(e),KU(e)}};function aW(e,t={}){let n=x(t);return n.type=e,n}var oW=class extends mz{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=rn(n,[]);this.dispatch(`SET_BORDERS_ON_TARGET`,{sheetId:e,target:i,border:r})}this.queuedBordersToAdd={}}},sW=class extends pz{copy(e){}},cW=class extends sW{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:G.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=x(t.copiedCarousel.items);for(let e of f){if(e.type!==`chart`)continue;let n=t.copiedCharts[e.chartId],r=G.smallUuid(),o=AD.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:f}}),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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},lW=class extends sW{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:G.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=AD.fromDefinition(this.getters,a,c.copyInSheetId(a)).getDefinition();l=AD.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:G.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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},uW=class extends mz{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:G.smallUuid(),ranges:[]}}},dW=class extends mz{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?G.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=rn([...rn(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})}}},fW=class extends sW{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:G.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?H.EmptyTarget:r?.pasteOption===void 0?H.Success:H.WrongFigurePasteOption}},pW=class extends mz{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}]})}},mW=class extends mz{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})}}},hW=class extends mz{isPasteAllowed(e,t,n,r){if(!(`cells`in n))return H.Success;let{xSplit:i,ySplit:a}=this.getters.getPaneDivisions(e);return Jn(US(t,n.cells),i,a)?H.FrozenPaneOverlap:H.Success}},gW=class extends mz{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=>Mn(f,e))){s.add(u.id);let{numberOfRows:e}=Nn(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=>Mn(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=Ct({...this.getters.getCellTableStyle(e),hideGridLines:!1}),n=this.getters.getCellStyle(e),r=this.getters.getCellTableBorder(e),i=this.getters.getCellBorder(e);return{style:{...t,...Ct(n)},border:{...r,...Ct(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=Nn(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}))}};eI.figureHandlers.add(`chart`,lW).add(`image`,fW).add(`carousel`,cW),eI.cellHandlers.add(`dataValidation`,dW).add(`cell`,hz).add(`sheet`,hW).add(`merge`,pW).add(`border`,oW).add(`table`,gW).add(`conditionalFormat`,uW).add(`references`,mW);var _W=class extends t.Component{static maxSize={maxHeight:80};static template=`o-spreadsheet-ErrorToolTip`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};get dataValidationErrorMessage(){return this.env.model.getters.getInvalidDataValidationMessage(this.props.cellPosition)}get evaluationError(){let e=this.env.model.getters.getEvaluatedCell(this.props.cellPosition);if(e.message)return e}get errorOriginPositionString(){if(this.env.model.getters.isDashboard())return``;let e=this.evaluationError?.errorOriginPosition;if(!e||T(e,this.props.cellPosition))return``;let t=e.sheetId;return this.env.model.getters.getRangeString(this.env.model.getters.getRangeFromZone(t,D(e)),this.env.model.getters.getActiveSheetId())}selectCell(){let e=this.evaluationError?.errorOriginPosition;if(!e)return;let t=this.env.model.getters.getActiveSheetId();e.sheetId!==t&&this.env.model.dispatch(`ACTIVATE_SHEET`,{sheetIdFrom:t,sheetIdTo:e.sheetId}),this.env.model.selection.selectCell(e.col,e.row)}get isSpillErrorBecauseOfMissingHeaders(){let e=this.evaluationError;return e?.value===j.SpilledBlocked&&!e.errorOriginPosition&&!this.env.model.getters.getSpreadZone(this.props.cellPosition,{ignoreSpillError:!0})}getMissingHeadersForSpread(){if(!this.isSpillErrorBecauseOfMissingHeaders)return;let e=this.env.model.getters.getCell(this.props.cellPosition);if(!e||!e.isFormula)return;let t=e.compiledFormula.toFormulaString(this.env.model.getters);return Kt(this.env.model.getters,this.props.cellPosition,t)}addMissingHeaders({missingCols:e,missingRows:t}){let n=this.props.cellPosition.sheetId;e>0&&this.env.model.dispatch(`ADD_COLUMNS_ROWS`,{sheetId:n,sheetName:this.env.model.getters.getSheetName(n),dimension:`COL`,base:this.env.model.getters.getNumberCols(n)-1,position:`after`,quantity:e+20}),t>0&&this.env.model.dispatch(`ADD_COLUMNS_ROWS`,{sheetId:n,sheetName:this.env.model.getters.getSheetName(n),dimension:`ROW`,base:this.env.model.getters.getNumberRows(n)-1,position:`after`,quantity:t+50})}getAddMissingHeadersButtonText(e){return e.missingCols>0&&e.missingRows>0?A(`Add missing columns and rows`):e.missingCols>0?A(`Add missing columns`):A(`Add missing rows`)}};let vW={onHover:(e,t)=>{let n=t.getEvaluatedCell(e);return n.type===V.error&&n.message||t.getInvalidDataValidationMessage(e)?{isOpen:!0,props:{cellPosition:e},Component:_W,cellCorner:`top-right`}:{isOpen:!1}}},yW=new Set([`containsText`,`notContainsText`,`isEqualText`,`dateIs`,`dateIsBefore`,`dateIsOnOrBefore`,`dateIsAfter`,`dateIsOnOrAfter`,`dateIsBetween`,`dateIsNotBetween`,`isEqual`,`isNotEqual`,`isGreaterThan`,`isGreaterOrEqualTo`,`isLessThan`,`isLessOrEqualTo`,`isBetween`,`isNotBetween`,`customFormula`,`beginsWithText`,`endsWithText`,`isNotEmpty`,`isEmpty`]),bW=[`containsText`,`notContainsText`,`isEqualText`,`isEmpty`,`isNotEmpty`,`beginsWithText`,`endsWithText`],xW=[`isEqual`,`isNotEqual`,`isGreaterThan`,`isGreaterOrEqualTo`,`isLessThan`,`isLessOrEqualTo`,`isBetween`,`isNotBetween`,`isEmpty`,`isNotEmpty`],SW=[`dateIs`,`dateIsBefore`,`dateIsOnOrBefore`,`dateIsAfter`,`dateIsOnOrAfter`,`dateIsBetween`,`dateIsNotBetween`,`isEmpty`,`isNotEmpty`];var CW=class extends t.Component{static template=`o-spreadsheet-FilterMenuCriterion`;static props={filterPosition:Object,onCriterionChanged:Function,criterionOperators:Array};static components={Select:Qh};state;setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.state.criterion=this.getFilterCriterionValue(e.filterPosition))}),this.state=(0,t.useState)({criterion:this.getFilterCriterionValue(this.props.filterPosition)})}getFilterCriterionValue(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilterCriterionValue({sheetId:t,...e});return n?.filterType===`criterion`?x(n):{filterType:`criterion`,type:`none`,values:[]}}get criterionOptions(){return[{label:A(`None`),value:`none`},...Ck(new Set(this.props.criterionOperators))]}get criterionComponent(){return this.state.criterion.type===`none`?void 0:Sk.get(this.state.criterion.type).component}onCriterionChanged(e){this.state.criterion.values=e.values,this.state.criterion.dateValue=e.dateValue,this.props.onCriterionChanged(this.state.criterion)}onCriterionTypeChange(e){this.state.criterion.type=e,this.props.onCriterionChanged(this.state.criterion)}},wW=class extends t.Component{static template=`o-spreadsheet-FilterMenuValueItem`;static components={Checkbox:Qw};static props={value:String,isChecked:Boolean,isSelected:Boolean,onMouseMove:Function,onClick:Function,scrolledTo:{type:String,optional:!0}};itemRef=(0,t.useRef)(`menuValueItem`);setup(){(0,t.onWillPatch)(()=>{this.props.scrolledTo&&this.scrollListToSelectedValue()})}scrollListToSelectedValue(){this.itemRef.el&&this.itemRef.el.scrollIntoView?.({block:`nearest`})}},TW=class extends t.Component{static template=`o-spreadsheet-FilterMenuValueList`;static props={filterPosition:Object,onUpdateHiddenValues:Function};static components={FilterMenuValueItem:wW};state=(0,t.useState)({values:[],displayedValues:[],textFilter:``,selectedValue:void 0,numberOfDisplayedValues:50,hasMoreValues:!1});searchBar=(0,t.useRef)(`filterMenuSearchBar`);setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.state.values=this.getFilterHiddenValues(e.filterPosition),this.computeDisplayedValues())}),this.state.values=this.getFilterHiddenValues(this.props.filterPosition),this.computeDisplayedValues()}getFilterHiddenValues(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilter({sheetId:t,...e});if(!n)return[];let r=this.env.model.getters.getFilterValue({sheetId:t,...e}),i=(n.filteredRange?In(n.filteredRange.zone):[]).map(e=>({position:e,cellValue:this.env.model.getters.getEvaluatedCell({sheetId:t,...e}).formattedValue}));r?.filterType!==`criterion`&&(i=i.filter(e=>!this.env.model.getters.isRowHidden(t,e.position.row)));let a=i.map(e=>e.cellValue),o=r?.filterType===`values`?r.hiddenValues:[],s=new Set(o.map(Fu)),c=new Set,l=[],u=e=>{let t=Fu(e);c.has(t)||(l.push({string:e||``,checked:r?.filterType===`criterion`?!1:!s.has(t),normalizedValue:t}),c.add(t))};return a.forEach(u),o.forEach(u),l.sort((e,t)=>e.normalizedValue.localeCompare(t.normalizedValue,void 0,{numeric:!0,sensitivity:`base`}))}checkValue(e){this.state.selectedValue=e.string,e.checked=!e.checked,this.searchBar.el?.focus(),this.updateHiddenValues()}onMouseMove(e){this.state.selectedValue=e.string}getSearchedValues(){return this.state.textFilter?_O(this.state.textFilter,this.state.values,e=>e.string):this.state.values}setAllChecked(e){let t=new Set(this.getSearchedValues());for(let n of this.state.values)t.has(n)&&(n.checked=e);this.updateHiddenValues()}selectAll(){this.setAllChecked(!0)}clearAll(){this.setAllChecked(!1)}updateHiddenValues(){let e=this.state.values.filter(e=>!e.checked).map(e=>e.string);this.props.onUpdateHiddenValues(e)}updateSearch(e){let t=e.target;this.state.textFilter=t.value,this.state.selectedValue=void 0,this.computeDisplayedValues()}computeDisplayedValues(){let e=this.getSearchedValues();this.state.displayedValues=e.slice(0,this.state.numberOfDisplayedValues),this.state.hasMoreValues=e.length>this.state.numberOfDisplayedValues}loadMoreValues(){this.state.numberOfDisplayedValues+=100,this.computeDisplayedValues()}onKeyDown(e){let t=this.state.displayedValues;if(t.length===0)return;let n;if(this.state.selectedValue!==void 0){let e=t.findIndex(e=>e.string===this.state.selectedValue);n=e===-1?void 0:e}switch(e.key){case`ArrowDown`:n=n===void 0?0:Math.min(n+1,t.length-1),e.preventDefault(),e.stopPropagation();break;case`ArrowUp`:n=n===void 0?t.length-1:Math.max(n-1,0),e.preventDefault(),e.stopPropagation();break;case`Enter`:n!==void 0&&this.checkValue(t[n]),e.stopPropagation(),e.preventDefault();break}this.state.selectedValue=n===void 0?void 0:t[n].string,(e.key===`ArrowUp`||e.key===`ArrowDown`)&&this.scrollListToSelectedValue(e.key)}clearScrolledToValue(){this.state.values.forEach(e=>e.scrolledTo=void 0)}scrollListToSelectedValue(e){this.clearScrolledToValue();let t=this.state.values.find(e=>e.string===this.state.selectedValue);t&&(t.scrolledTo=e===`ArrowUp`?`top`:`bottom`)}},EW=class extends t.Component{static template=`o-spreadsheet-FilterMenu`;static props={filterPosition:Object,onClosed:{type:Function,optional:!0}};static components={FilterMenuValueList:TW,SidePanelCollapsible:vT,FilterMenuCriterion:CW};criterionCategory=`text`;updatedCriterionValue;setup(){(0,t.onWillUpdateProps)(e=>{T(e.filterPosition,this.props.filterPosition)||(this.updatedCriterionValue=void 0,this.criterionCategory=this.getCriterionCategory(e.filterPosition))}),this.criterionCategory=this.getCriterionCategory(this.props.filterPosition)}get isSortable(){if(!this.table)return!1;let e=this.env.model.getters.getCoreTableMatchingTopLeft(this.table.range.sheetId,this.table.range.zone);return!this.env.model.getters.isReadonly()&&e?.type!==`dynamic`}get table(){let e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getTable({sheetId:e,...t})}get filterValueType(){let e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getFilterValue({sheetId:e,...t})?.filterType}getCriterionCategory(e){let t=this.env.model.getters.getActiveSheetId(),n=this.env.model.getters.getFilter({sheetId:t,...e});if(!n||!n.filteredRange)return`text`;let r={text:0,number:0,date:0},i=n.filteredRange.zone;for(let n=i.top;n<=i.bottom&&!(n>100);n++){let i=this.env.model.getters.getEvaluatedCell({sheetId:t,row:n,col:e.col});i.type===V.text||i.type===V.boolean?r.text++:i.type===V.number&&(i.format&&To(i.format)?r.date++:r.number++)}let a=Math.max(r.text,r.number,r.date);return Object.keys(r).find(e=>r[e]===a)||`text`}onUpdateHiddenValues(e){this.updatedCriterionValue={filterType:`values`,hiddenValues:e}}onCriterionChanged(e){this.updatedCriterionValue=e}confirm(){if(!this.updatedCriterionValue){this.props.onClosed?.();return}let e=this.props.filterPosition;this.env.model.dispatch(`UPDATE_FILTER`,{...e,sheetId:this.env.model.getters.getActiveSheetId(),value:this.updatedCriterionValue}),this.props.onClosed?.()}get criterionOperators(){return this.criterionCategory===`date`?SW:this.criterionCategory===`number`?xW:bW}cancel(){this.props.onClosed?.()}sortFilterZone(e){let t=this.props.filterPosition,n=this.table?.range.zone;if(!t||!n||n.top===n.bottom)return;let r=this.env.model.getters.getActiveSheetId(),i={...n,top:n.top+1},a={col:t.col,row:i.top};UP(this.env,r,a,i,e,{emptyCellAsZero:!0,sortHeaders:!0}),this.props.onClosed?.()}};let DW={onOpen:(e,t)=>({isOpen:!0,props:{filterPosition:e},Component:EW,cellCorner:`bottom-left`})};var OW=class extends t.Component{static template=`o-spreadsheet-LinkDisplay`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};cellPopovers;setup(){this.cellPopovers=O(RS)}get cell(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getEvaluatedCell({sheetId:n,col:e,row:t})}get link(){if(this.cell.link)return this.cell.link;let{col:e,row:t}=this.props.cellPosition;throw Error(`LinkDisplay Component can only be used with link cells. ${E(e,t)} is not a link.`)}getUrlRepresentation(e){return Zl(e,this.env.model.getters)}openLink(e){Ql(this.link,this.env,Sm(e))}edit(){let{col:e,row:t}=this.props.cellPosition;this.env.model.selection.selectCell(e,t),this.cellPopovers.open({col:e,row:t},`LinkEditor`)}unlink(){let e=this.env.model.getters.getActiveSheetId(),{col:t,row:n}=this.props.cellPosition,r=this.env.model.getters.getCellComputedStyle({sheetId:e,col:t,row:n}),i=r?.textColor===`#017E84`?void 0:r?.textColor;this.env.model.dispatch(`UPDATE_CELL`,{col:t,row:n,sheetId:e,content:this.link.label,style:{...r,textColor:i,underline:void 0}})}};let kW={onHover:(e,t)=>{let n=t.getEvaluatedCell(e);return!t.isDashboard()&&n.link&&t.isVisibleInViewport(e)?{isOpen:!0,Component:OW,props:{cellPosition:e},cellCorner:`bottom-left`}:{isOpen:!1}}};var AW=class extends t.Component{static template=`o-spreadsheet-LinkEditor`;static props={cellPosition:Object,onClosed:{type:Function,optional:!0}};static components={MenuPopover:Zh};static size={maxHeight:500};urlInput=(0,t.useRef)(`urlInput`);suggestionListRef=(0,t.useRef)(`suggestionList`);urlInputContainer=(0,t.useRef)(`urlInputContainer`);state=(0,t.useState)(this.defaultState);setup(){this.computeLinks(),(0,t.onMounted)(()=>this.urlInput.el?.focus())}computeLinks(){this.state.selectedIndex=null,this.state.linksByCategory=this.linkProposalByCategory,this.state.linksList=Object.values(this.state.linksByCategory).flat()}get linkProposalByCategory(){let e={},t=-1,n=this.state.url;for(let r of ql.getKeys()){let i=ql.get(r),a=i.getLinkProposals?.(this.env)||[],o=n&&this.state.isUrlEditable?_O(n,a,e=>i.urlRepresentation(e.url,this.env.model.getters)):a;o.length!==0&&(e[i.title]=o.map(e=>{t++;let n=i.urlRepresentation(e.url,this.env.model.getters),r=t;return{text:n,icon:e.icon,index:r,onSelect:()=>{this.state.url=e.url,this.state.label=e.label,this.state.isUrlEditable=e.isUrlEditable,this.state.selectedIndex=r,this.urlInputContainer.el?.focus()}}}))}return e}get defaultState(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getActiveSheetId(),r=this.env.model.getters.getEvaluatedCell({sheetId:n,col:e,row:t});return r.link?{url:r.link.url,label:r.formattedValue,isUrlEditable:r.link.isUrlEditable,selectedIndex:null,linksByCategory:{},linksList:[]}:{label:r.formattedValue,url:``,isUrlEditable:!0,selectedIndex:null,linksByCategory:{},linksList:[]}}getUrlRepresentation(e){return Zl(e,this.env.model.getters)}removeLink(){this.state.url=``,this.state.isUrlEditable=!0,this.computeLinks()}save(){let{col:e,row:t}=this.props.cellPosition,n=this.env.model.getters.getLocale(),r=this.state.label?bg(this.state.label,n):this.state.url;this.env.model.dispatch(`UPDATE_CELL`,{col:e,row:t,sheetId:this.env.model.getters.getActiveSheetId(),content:ot(r,this.state.url)}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){switch(e.key){case`Enter`:this.state.url&&this.save(),e.stopPropagation(),e.preventDefault();break;case`Escape`:this.cancel(),e.stopPropagation();break}}onInputKeyDown(e){switch(e.key){case`Enter`:if(this.state.selectedIndex!==null){let t=this.state.linksList[this.state.selectedIndex];if(t){let n=this.state.url;t.onSelect(),this.state.url!==n&&(e.stopPropagation(),e.preventDefault())}}break;case`ArrowDown`:this.state.selectedIndex=this.state.selectedIndex===null||this.state.selectedIndex===this.state.linksList.length-1?0:(this.state.selectedIndex+1)%this.state.linksList.length,this.showSelectedProposal(),e.stopPropagation(),e.preventDefault();break;case`ArrowUp`:this.state.selectedIndex!==null&&(this.state.selectedIndex=this.state.selectedIndex===0?this.state.linksList.length-1:(this.state.selectedIndex-1)%this.state.linksList.length,this.showSelectedProposal(),e.stopPropagation(),e.preventDefault());break}}showSelectedProposal(){this.suggestionListRef.el?.querySelector(`.suggestion-item[data-index="${this.state.selectedIndex}"]`)?.scrollIntoView({block:`nearest`})}};LS.add(`ErrorToolTip`,vW).add(`LinkCell`,kW).add(`LinkEditor`,{onOpen:(e,t)=>({isOpen:!0,props:{cellPosition:e},Component:AW,cellCorner:`bottom-left`})}).add(`FilterMenu`,DW),vO.add(`dataValidation`,{displayAllOnInitialContent:!0,canBeToggled:!1,getProposals(e,t){if(Ut(t)||!this.composer.currentEditedCell)return[];let n=this.composer.currentEditedCell,r=this.getters.getValidationRuleForCell(n);if(!r||r.criterion.type!==`isValueInList`&&r.criterion.type!==`isValueInRange`)return[];let i=this.composer.currentEditedCell.sheetId,a=r.criterion.type===`isValueInRange`?this.getters.getDataValidationRangeValues(i,r.criterion):r.criterion.values.map(e=>({label:e,value:e}));if(r.criterion.displayStyle!==`chip`)return a.map(e=>({text:e.value,fuzzySearchKey:e.label,htmlContent:[{value:e.label}]}));let o=r.criterion.colors;return a.map(e=>{let t=o?.[e.value];return{text:e.value,htmlContent:[{value:e.label,color:Cd(t||`#E7E9ED`),backgroundColor:t||`#E7E9ED`,classes:[`badge rounded-pill fs-6 fw-normal w-100 mt-1 text-start`]}],fuzzySearchKey:e.label}})},selectProposal(e,t){this.composer.setCurrentContent(t.text),this.composer.stopEdition()}}),vO.add(`functions_and_named_ranges`,{sequence:100,autoSelectFirstProposal:!0,maxDisplayedProposals:10,getProposals(e){if(e.type!==`SYMBOL`)return[];let t=e.value;if(!Ut(this.composer.currentContent))return[];let n=Object.entries(_s.content).filter(([e,{hidden:t}])=>!t).map(([e,{description:n}])=>({type:`function`,text:e,icon:`o-spreadsheet-Icon.FX_SVG`,description:n,htmlContent:uj(t,e,ae,`o-semi-bold`)}));return n.push(...this.getters.getNamedRanges().map(e=>({type:`named_range`,text:e.name,description:this.getters.getRangeString(e.range),icon:`o-spreadsheet-Icon.NAMED_RANGE`,htmlContent:uj(t,e.name,ae,`o-semi-bold`)}))),n.sort((e,t)=>e.text.length-t.text.length||e.text.localeCompare(t.text)),n},selectProposal(e,t){let n=e.end,r=e.end;[`SYMBOL`,`FUNCTION`].includes(e.type)&&(n=e.start);let i=this.composer.currentTokens,a=t.text;if(t.type===`function`){a+=`(`;let t=i.map(e=>e.start).indexOf(e.start);t+1<i.length&&i[t+1]?.type===`LEFT_PAREN`&&r++}this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(a)}});function jW(e,t){for(let n=0;n<t.length;n++){let r=t[n].proposalValues;r===void 0||r.length===0||vO.add(`${e}_function_${t[n].name}_argument_proposals`,{sequence:50,autoSelectFirstProposal:!0,selectProposal:MW,getProposals:t=>{let i=t.functionContext;if(!i||i.parent.toUpperCase()!==e.toUpperCase()||i.argPosition!==n)return;let a=[],o=``;for(let{value:e,label:t}of r){switch(typeof e){case`string`:o=`"${e}"`;break;case`number`:o=e.toString();break;case`boolean`:o=e?`TRUE`:`FALSE`;break;default:}a.push({text:o,description:t,htmlContent:[{value:o,color:typeof e==`string`?Ve.STRING:Ve.NUMBER}],fuzzySearchKey:o,alwaysExpanded:!0})}return a}})}}function MW(e,t){let n=e.end,r=e.end;[`LEFT_PAREN`,`ARG_SEPARATOR`].includes(e.type)||(n=e.start),this.composer.stopComposerRangeSelection(),this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t.text)}_s.getAll().forEach(e=>jW(e.name,e.args)),vO.add(`pivot_ids`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||![`PIVOT.VALUE`,`PIVOT.HEADER`,`PIVOT`].includes(t.parent.toUpperCase())||t.argPosition!==0)return;let n=this.getters.getPivotIds();if(!n.includes(e.value))return n.map(e=>{let t=this.getters.getPivotCoreDefinition(e),n=`${this.getters.getPivotFormulaId(e)}`;return{text:n,description:t.name,htmlContent:[{value:n,color:Ve.NUMBER}],fuzzySearchKey:n+t.name,alwaysExpanded:!0}}).filter(w)},selectProposal:MW}),vO.add(`pivot_measures`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(t?.parent.toUpperCase()!==`PIVOT.VALUE`||t.argPosition!==1)return[];let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return[];let i=this.getters.getPivot(r);return i.init(),i.isValid()?i.definition.measures.map(e=>{if(e.fieldName===`__count`){let e=`"__count"`;return{text:e,description:A(`Count`),htmlContent:[{value:e,color:Ve.STRING}],fuzzySearchKey:A(`Count`)+e}}return cM(e)}).filter(w):[]},selectProposal:MW}),vO.add(`pivot_group_fields`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!NW(e)&&!PW(e))return;let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);i.init();let a=i.getFields(),{columns:o,rows:s}=i.definition,c=t.args;t?.parent.toUpperCase()===`PIVOT.VALUE`?(c=c.filter((e,t)=>t%2==0),c=c.slice(1,t.argPosition)):c=c.filter((e,t)=>t%2==1);let l=c.map(e=>e?.value).filter(w),u=o.map(e=>e.nameWithGranularity),d=s.map(e=>e.nameWithGranularity),f=[],p=[`ARG_SEPARATOR`,`SPACE`].includes(e.type)?l.at(-1):l.at(-2),m=MI.get(i.type);if(m&&p?.startsWith(`#`)&&(p=p.slice(1)),p===void 0&&(f.push(u[0]),f.push(d[0])),d.includes(p)){let e=d[d.indexOf(p)+1];f.push(e),f.push(u[0])}if(u.includes(p)){let e=u[u.indexOf(p)+1];f.push(e)}let h=f.filter(w);return h.map(e=>{let[t,n]=e.split(`:`),r=a[t];return r?sM(r,n):void 0}).concat(h.map(e=>{if(!m)return;let t=a[e.split(`:`)[0]];if(!t)return;let n=`"#${e}"`;return{text:n,description:A(`%s (positional)`,t.string)+(t.help?` (${t.help})`:``),htmlContent:[{value:n,color:Ve.STRING}],fuzzySearchKey:t.string+n}})).filter(w)},selectProposal:MW});function NW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==0}function PW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==1}vO.add(`pivot_group_values`,{sequence:50,autoSelectFirstProposal:!0,getProposals(e){let t=e.functionContext;if(!t||!e||!FW(e)&&!IW(e))return;let n=dM(e),r=this.getters.getPivotId(n);if(!r||!this.getters.isExistingPivot(r))return;let i=this.getters.getPivot(r);if(!i.isValid())return;let a=t.argPosition,o=e.functionContext?.args[a-1]?.value;if(!o)return;let s;try{s=i.definition.getDimension(o)}catch{return}return s.granularity===`month_number`?Object.values(co).map((e,t)=>({text:`${t+1}`,fuzzySearchKey:e.toString(),description:e.toString(),htmlContent:[{value:`${t+1}`,color:Ve.NUMBER}]})):s.granularity===`quarter_number`?[1,2,3,4].map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:A(`Quarter %s`,e),htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`day_of_month`?C(1,32).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`iso_week_number`?C(0,54).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`day_of_week`?C(1,8).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`hour_number`?C(0,24).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`minute_number`?C(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):s.granularity===`second_number`?C(0,60).map(e=>({text:`${e}`,fuzzySearchKey:`${e}`,description:``,htmlContent:[{value:`${e}`,color:Ve.NUMBER}]})):i.getPossibleFieldValues(s).map(({value:e,label:t})=>{let n=typeof e==`string`,r=n?`"${e}"`:e.toString(),i=n?Ve.STRING:Ve.NUMBER,a=t===e?``:t;return{text:r,description:a,htmlContent:[{value:r,color:i}],fuzzySearchKey:r+a}})},selectProposal:MW});function FW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.VALUE`&&t.argPosition>=2&&t.argPosition%2==1}function IW(e){let t=e.functionContext;return t?.parent.toUpperCase()===`PIVOT.HEADER`&&t.argPosition>=1&&t.argPosition%2==0}vO.add(`sheet_names`,{sequence:150,autoSelectFirstProposal:!0,getProposals(e){return e.type===`SYMBOL`||e.type===`UNKNOWN`&&e.value.startsWith(`'`)?this.getters.getSheetIds().map(e=>{let t=Ze(this.getters.getSheetName(e));return{text:t,fuzzySearchKey:t.startsWith(`'`)?t:`'`+t}}):[]},selectProposal(e,t){let n=e.start,r=e.end;this.composer.changeComposerCursorSelection(n,r),this.composer.replaceComposerCursorSelection(t.text+`!`)}});function LW(e){return e.yRanges.length&&!ws.test(e.yRanges[0])?H.InvalidYRange:e.xRange&&!ws.test(e.xRange)?H.InvalidXRange:e.labelRange&&!ws.test(e.labelRange)?H.InvalidLabelRange:e.sizeRange&&!ws.test(e.sizeRange)?H.InvalidBubbleSizeRange:H.Success}let RW={sequence:40,allowedDefinitionKeys:[...Hp.commonKeys,`yRanges`,`xRange`,`labelRange`,`sizeRange`,`dataSetsHaveTitle`,`verticalAxisPosition`,`labelsAsText`,`bubbleColor`,`legendPosition`,`axesDesign`,`showValues`],fromStrDefinition(e,t,n){let r=e.yRanges.map(e=>Rc(n,t,e)).filter(w),i=Rc(n,t,e.xRange),a=Rc(n,t,e.labelRange),o=Rc(n,t,e.sizeRange);return{...e,yRanges:r,xRange:i,labelRange:a,sizeRange:o}},toStrDefinition(e,t,n){return{...e,yRanges:e.yRanges.map(e=>n.getRangeString(e,t)),xRange:e.xRange?n.getRangeString(e.xRange,t):void 0,labelRange:e.labelRange?n.getRangeString(e.labelRange,t):void 0,sizeRange:e.sizeRange?n.getRangeString(e.sizeRange,t):void 0}},validateDefinition(e,t){return e.checkValidations(t,LW)},transformDefinition(e,t,{adaptRangeString:n}){let r=e=>{if(!e)return;let{changeType:r,range:i}=n(t,e);return r===`REMOVE`?void 0:i};return{...e,yRanges:e.yRanges.map(r).filter(w),xRange:r(e.xRange),sizeRange:r(e.sizeRange),labelRange:r(e.labelRange)}},getDefinitionFromContextCreation(e,t){let n=e.dataSource?.type===`range`;return{background:e.background,yRanges:n?e.dataSource.dataSets?.map(e=>e.dataRange)??[]:[],verticalAxisPosition:e.dataSetStyles?.[0]?.verticalAxisPosition,dataSetsHaveTitle:n?e.dataSource.dataSetsHaveTitle??!1:!1,legendPosition:e.legendPosition??`top`,title:e.title||{text:``},type:`bubble`,labelRange:e.bubbleLabelRange||void 0,labelsAsText:e.labelsAsText??!1,xRange:e.auxiliaryRange||void 0,sizeRange:e.bubbleSizeRange||void 0,axesDesign:e.axesDesign,showValues:e.showValues,humanize:e.humanize,bubbleColor:e.bubbleColorMode||{color:`multiple`}}},getContextCreation(e,t){return{...e,dataSource:{type:`range`,dataSets:e.yRanges.map((e,t)=>({dataSetId:`${t}`,dataRange:e}))},bubbleLabelRange:e.labelRange,auxiliaryRange:e.xRange,bubbleSizeRange:e.sizeRange,bubbleColorMode:e.bubbleColor}},getDefinitionForExcel:()=>void 0,updateRanges(e,t){let n=e.yRanges.map(e=>sf(e,t)).filter(w),r=sf(e.xRange,t),i=sf(e.labelRange,t),a=sf(e.sizeRange,t);return{...e,yRanges:n,xRange:r,labelRange:i,sizeRange:a}},duplicateInDuplicatedSheet(e,t,n){let r=e=>of(t,n,e);return{...e,yRanges:e.yRanges.map(r).filter(w),xRange:r(e.xRange),labelRange:r(e.labelRange),sizeRange:r(e.sizeRange)}},copyInSheetId:e=>e,getRuntime(e,t){let n=tE(t,e);return{chartJsConfig:{type:`line`,data:{datasets:fp(t,n),labels:n.labels},options:{...Qm,layout:EE(t,n),scales:Jf(t,n),plugins:{title:YE(t,e),legend:NE(t,n),tooltip:nD(t,n),chartShowValuesPlugin:UE(t,n),background:{color:t.background}}}}}}};function zW(e){return!zD.includes(e.horizontalGroupBy)||!zD.includes(e.verticalGroupBy)?H.InvalidChartDefinition:H.Success}let BW={sequence:110,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`dataSetStyles`,`showValues`,`colorScale`,`missingValueColor`,`axesDesign`,`horizontalGroupBy`,`verticalGroupBy`,`legendPosition`],validateDefinition(e,t){return e.checkValidations(t,zW)},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=qT(t,n(),e),{labels:i,datasets:a}=cp(t,r);return{chartJsConfig:{type:`calendar`,data:{labels:i,datasets:a},options:{...Qm,indexAxis:`x`,layout:DE(t,r),scales:Hf(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:eD(t,r),chartShowValuesPlugin:WE(t,r),chartColorScalePlugin:Uf(t,r),background:{color:r.background}}}}}}},VW={sequence:15,allowedDefinitionKeys:[...Hp.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:()=>H.Success,updateRanges:e=>e,getContextCreation:e=>e,getDefinitionForExcel(e,t,{dataSets:n,labelRange:r}){return{...t,backgroundColor:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r,verticalAxis:vf(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=WT(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:hp(t,a)},options:{...Qm,layout:EE(t,a),scales:Vf(t,a),plugins:{title:YE(t,e),legend:PE(t,a),tooltip:$E(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},HW={sequence:100,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.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:()=>H.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=$T(t,n(),e);return{chartJsConfig:{type:`funnel`,data:{labels:a.labels,datasets:vp(t,a)},options:{...Qm,indexAxis:`y`,layout:EE(t,a),scales:$f(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:cD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}}}}},UW={sequence:90,dataSeriesLimit:1,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`colorScale`,`missingValueColor`,`region`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>H.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=QT(t,n(),e);return{chartJsConfig:{type:`choropleth`,data:{datasets:_p(t,a)},options:{...Qm,layout:EE(t,a),scales:Qf(t,a),plugins:{title:YE(t,e),tooltip:sD(t,a),legend:{display:!1},background:{color:a.background}},...i}}}}},WW={sequence:80,dataSeriesLimit:2,allowedDefinitionKeys:[...Hp.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:()=>H.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 i=JT(t,PD(e,t.dataSource),e),{dataSetsValues:a}=i,o=Math.max(...a.map(e=>Math.max(...e.data.map(e=>U(e)?Math.abs(e.value):-1/0))));return{...t,horizontal:!0,backgroundColor:LT(i.background||`#FFFFFF`),fontColor:LT(ff(i.background)),dataSets:n,labelRange:r,verticalAxis:vf(t),maxValue:o}},getRuntime(e,t,{extractData:n},r,i){let a=JT(t,n(),e);return{chartJsConfig:{type:`bar`,data:{labels:a.labels,datasets:sp(t,a)},options:{...Qm,indexAxis:`y`,layout:EE(t,a),scales:Xf(t,a),plugins:{title:YE(t,e),legend:kE(t,a),tooltip:aD(t,a),chartShowValuesPlugin:KE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},GW={sequence:80,allowedDefinitionKeys:[...Hp.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:()=>H.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:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r}},getRuntime(e,t,{extractData:n},r,i){let a=ZT(t,n(),e);return{chartJsConfig:{type:`radar`,data:{labels:a.labels,datasets:gp(t,a)},options:{...Qm,layout:EE(t,a),scales:Zf(t,a),plugins:{title:YE(t,e),legend:IE(t,a),tooltip:oD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},KW={sequence:60,allowedDefinitionKeys:[...Hp.commonKeys,`dataSource`,`legendPosition`,`dataSetStyles`,`showValues`,`labelsAsText`,`aggregated`,`axesDesign`],fromStrDefinition:e=>e,toStrDefinition:e=>e,copyInSheetId:e=>e,duplicateInDuplicatedSheet:e=>e,transformDefinition:e=>e,validateDefinition:()=>H.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:LT(t.background||`#FFFFFF`),fontColor:LT(ff(t.background)),dataSets:n,labelRange:r,verticalAxis:vf(t)}},getRuntime(e,t,{extractData:n},r,i){let a=YT(t,n(),e);return{chartJsConfig:{type:`line`,data:{labels:a.labels,datasets:dp(t,a)},options:{...Qm,layout:EE(t,a),scales:qf(t,a),plugins:{title:YE(t,e),legend:ME(t,a),tooltip:tD(t,a),chartShowValuesPlugin:UE(t,a),background:{color:a.background}},...i}},customizableSeries:a.dataSetsValues.map(({dataSetId:e,label:t})=>({dataSetId:e,label:t}))}}},qW={sequence:30,allowedDefinitionKeys:[...Hp.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:()=>H.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=eE(t,n(),e);return{chartJsConfig:{type:`doughnut`,data:{datasets:bp(t,a)},options:{cutout:t.pieHolePercentage===void 0?`25%`:`${t.pieHolePercentage}%`,...Qm,layout:EE(t,a),plugins:{title:YE(t,e),legend:LE(t,a),tooltip:lD(t,a),sunburstLabelsPlugin:GE(t,a),sunburstHoverPlugin:{enabled:!0},background:{color:a.background}},...i}}}}},JW={sequence:100,allowedDefinitionKeys:[...Hp.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:()=>H.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=eE(t,n(),e);return{chartJsConfig:{type:`treemap`,data:{labels:a.labels,datasets:Tp(t,a)},options:{...Qm,layout:EE(t,a),plugins:{title:YE(t,e),legend:{display:!1},tooltip:uD(t,a),background:{color:a.background}},...i}}}}};ny.add(`bar`,mD),ny.add(`combo`,VW),ny.add(`line`,TD),ny.add(`pie`,ED),ny.add(`scorecard`,Qp),ny.add(`gauge`,bD),ny.add(`scatter`,KW),ny.add(`waterfall`,DD),ny.add(`pyramid`,WW),ny.add(`radar`,GW),ny.add(`geo`,UW),ny.add(`funnel`,HW),ny.add(`sunburst`,qW),ny.add(`treemap`,JW),ny.add(`calendar`,BW),ny.add(`bubble`,RW),hh.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(`bubble`,{displayName:A(`Bubble`),chartType:`bubble`,chartSubtype:`bubble`,category:`misc`,preview:`o-spreadsheet-ChartPreview.BUBBLE_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`}),FL.add(`filter_icon`,(e,t)=>{if(e.isFilterHeader(t)){let n=e.isFilterActive(t),r=ad(e.getCellComputedStyle(t).fillColor||`#fff`)<.45;return{type:`filter_icon`,svg:fv(n,r,!1),hoverSvg:fv(n,r,!0),priority:3,horizontalAlign:`right`,size:17,margin:2,position:t,onClick:(e,t)=>{let n=t.getStore(RS),r=n.persistentCellPopover;if(r.isOpen&&r.col===e.col&&r.row===e.row&&r.type===`FilterMenu`){n.close();return}n.open(e,`FilterMenu`)}}}});var YW=l({ARRAYTOTEXT:()=>wG,ARRAY_CONSTRAIN:()=>QW,ARRAY_LITERAL:()=>$W,ARRAY_ROW:()=>eG,CHOOSECOLS:()=>tG,CHOOSEROWS:()=>nG,EXPAND:()=>rG,FLATTEN:()=>iG,FREQUENCY:()=>aG,HSTACK:()=>oG,MDETERM:()=>sG,MINVERSE:()=>cG,MMULT:()=>lG,SUMPRODUCT:()=>uG,SUMX2MY2:()=>fG,SUMX2PY2:()=>pG,SUMXMY2:()=>mG,TOCOL:()=>_G,TOROW:()=>vG,TRANSPOSE:()=>yG,VSTACK:()=>bG,WRAPCOLS:()=>xG,WRAPROWS:()=>SG});function XW(e,t){let n=e.map(I),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 ZW(e,t){let n=e.map(I),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=ma(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 QW={description:A(`Returns a result array constrained to a specific width and height.`),args:[z(`input_range (any, range<any>)`,A(`The range to constrain.`)),z(`rows (number)`,A(`The number of rows in the constrained array.`)),z(`columns (number)`,A(`The number of columns in the constrained array.`))],compute:function(e,t,n){let r=I(e),i=ea(t?.value,this.locale),a=ea(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 ma(Math.min(a,r.length),o,(e,t)=>r[e][t])},isExported:!1},$W={description:A(`Appends ranges vertically and in sequence to return a larger array. All ranges must have the same number of columns.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return ZW(e,{requireSameColCount:!0})},isExported:!1,hidden:!0},eG={description:A(`Appends ranges horizontally and in sequence to return a larger array. All ranges must have the same number of rows.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return XW(e,{requireSameRowCount:!0})},isExported:!1,hidden:!0},tG={description:A(`Creates a new array from the selected columns in the existing range.`),args:[z(`array (any, range<any>)`,A(`The array that contains the columns to be returned.`)),z(`col_num (number, range<number>, repeating)`,A(`The column index of the column to be returned.`))],compute:function(e,...t){let n=I(e),r=ka(t,e=>ea(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},nG={description:A(`Creates a new array from the selected rows in the existing range.`),args:[z(`array (any, range<any>)`,A(`The array that contains the rows to be returned.`)),z(`row_num (number, range<number>, repeating)`,A(`The row index of the row to be returned.`))],compute:function(e,...t){let n=I(e),r=ka(t,e=>ea(e?.value,this.locale)),i=n.length,a=r.filter(e=>e===0||n[0].length<Math.abs(e));return a.length===0?ma(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},rG={description:A(`Expands or pads an array to specified row and column dimensions.`),args:[z(`array (any, range<any>)`,A(`The array to expand.`)),z(`rows (number)`,A(`The number of rows in the expanded array. If missing, rows will not be expanded.`)),z(`columns (number, optional)`,A(`The number of columns in the expanded array. If missing, columns will not be expanded.`)),z(`pad_with (any, default=0)`,A(`The value with which to pad.`))],compute:function(e,t,n,r={value:0}){let i=I(e),a=ea(t?.value,this.locale),o=n===void 0?i.length:ea(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())):ma(o,a,(e,t)=>e>=i.length||t>=i[e].length?r:i[e][t])},isExported:!0},iG={description:A(`Flattens all the values from one or more ranges into a single column.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to flatten.`))],compute:function(...e){return[ka(e,e=>e===void 0?{value:``}:e)]},isExported:!1},aG={description:A(`Calculates the frequency distribution of a range.`),args:[z(`data (range<number>)`,A(`The array of ranges containing the values to be counted.`)),z(`classes (number, range<number>)`,A(`The range containing the set of classes.`))],compute:function(e,t){let n=ka([e],e=>e.value).filter(e=>typeof e==`number`),r=ka([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},oG={description:A(`Appends ranges horizontally and in sequence to return a larger array.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return XW(e)},isExported:!0},sG={description:A(`Returns the matrix determinant of a square matrix.`),args:[z(`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=Qi(e,`square_matrix`);return Bb(t)?Ub(t).determinant:new M(A(`The argument square_matrix must have the same number of columns and rows.`))},isExported:!0},cG={description:A(`Returns the multiplicative inverse of a square matrix.`),args:[z(`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=Qi(e,`square_matrix`);if(!Bb(t))return new M(A(`The argument square_matrix must have the same number of columns and rows.`));let{inverted:n}=Ub(t);return n||new M(A(`The matrix is not invertible.`))},isExported:!0},lG={description:A(`Calculates the matrix product of two matrices.`),args:[z(`matrix1 (number, range<number>)`,A(`The first matrix in the matrix multiplication operation.`)),z(`matrix2 (number, range<number>)`,A(`The second matrix in the matrix multiplication operation.`))],compute:function(e,t){let n=Qi(e,`matrix1`),r=Qi(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?Gb(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},uG={description:A(`Calculates the sum of the products of corresponding entries in equal-sized ranges.`),args:[z(`range (number, range<number>, repeating)`,A(`The range whose entries will be multiplied with corresponding entries in the other range.`))],compute:function(...e){if(!zb(...e))return new M(A(`All the ranges must have the same dimensions.`));let t=e.map(I),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*=N(n[e][r],this.locale);n+=i}return n},isExported:!0};function dG(e,t,n){if(!zb(e,t))return new M(A(`The arguments array_x and array_y must have the same dimensions.`));let r=I(e),i=I(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 fG={description:A(`Calculates the sum of the difference of the squares of the values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>e**2-t**2)},isExported:!0},pG={description:A(`Calculates the sum of the sum of the squares of the values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>e**2+t**2)},isExported:!0},mG={description:A(`Calculates the sum of squares of the differences of values in two array.`),args:[z(`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.`)),z(`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 dG(e,t,(e,t)=>(e-t)**2)},isExported:!0},hG=[z(`array (any, range<any>)`,A(`The array which will be transformed.`)),z(`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`)}]),z(`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 gG(e){let t=Math.trunc(e);if(t===0)return()=>!0;if(t===1)return e=>e.value!==null;if(t===2)return e=>!Gi(e.value);if(t===3)return e=>e.value!==null&&!Gi(e.value);throw new M(A(`Argument ignore must be between 0 and 3`))}let _G={description:A(`Transforms a range of cells into a single column.`),args:hG,compute:function(e,t={value:0},n={value:!1}){let r=I(e),i=N(t.value,this.locale),a=(F(n.value)?r:_a(r)).flat().filter(gG(i));return a.length===0?new Ri(A(`No results for the given arguments of TOCOL.`)):[a]},isExported:!0},vG={description:A(`Transforms a range of cells into a single row.`),args:hG,compute:function(e,t={value:0},n={value:!1}){let r=I(e),i=N(t.value,this.locale),a=(F(n.value)?r:_a(r)).flat().filter(gG(i)).map(e=>[e]);return a.length===0||a[0].length===0?new Ri(A(`No results for the given arguments of TOROW.`)):a},isExported:!0},yG={description:A(`Transposes the rows and columns of a range.`),args:[z(`range (any, range<any>)`,A(`The range to be transposed.`))],compute:function(e){let t=I(e),n=t[0].length,r=t.length;return ma(n,r,(e,n)=>t[n][e])},isExported:!0},bG={description:A(`Appends ranges vertically and in sequence to return a larger array.`),args:[z(`range (any, range<any>, repeating)`,A(`The range to be appended.`))],compute:function(...e){return ZW(e)},isExported:!0},xG={description:A(`Wraps the provided row or column of cells by columns after a specified number of elements to form a new array.`),args:[z(`range (any, range<any>)`,A(`The range to wrap.`)),z(`wrap_count (number)`,A(`The maximum number of cells for each column, rounded down to the nearest whole number.`)),z(`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=I(e),i=ea(t?.value,this.locale);if(!Rb(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return ma(Math.ceil(a.length/i),i,(e,t)=>{let r=e*i+t;return r<a.length?a[r]:n})},isExported:!0},SG={description:A(`Wraps the provided row or column of cells by rows after a specified number of elements to form a new array.`),args:[z(`range (any, range<any>)`,A(`The range to wrap.`)),z(`wrap_count (number)`,A(`The maximum number of cells for each row, rounded down to the nearest whole number.`)),z(`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=I(e),i=ea(t?.value,this.locale);if(!Rb(r))return new M(A(`Argument range must be a single row or column.`));let a=r.flat();return ma(i,Math.ceil(a.length/i),(e,t)=>{let r=t*i+e;return r<a.length?a[r]:n})},isExported:!0},CG=[{value:0,label:A(`Concise format\xA0(default)`)},{value:1,label:A(`Strict format`)}],wG={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:[z(`array (range)`,A(`The array to convert into text`)),z(`format (number, default=0)`,A(`The format of the returned data.`),CG)],compute:function(e,t={value:0}){let n=N(t,this.locale),r=I(e);if(n===1)return pO(r,``,this.locale);if(n===0){let e=this.locale.decimalSeparator===`,`?`/`:`,`;return _a(r).flatMap(e=>e.map(e=>Gi(e.value)?e.value:P(e))).join(e)}else return new M(A(`Format must be 0 or 1`))},isExported:!0};var TG=l({ABS:()=>DG,ACOS:()=>OG,ACOSH:()=>kG,ACOT:()=>AG,ACOTH:()=>jG,ASIN:()=>MG,ASINH:()=>NG,ATAN:()=>PG,ATAN2:()=>FG,ATANH:()=>IG,CEILING:()=>LG,CEILING_MATH:()=>zG,CEILING_PRECISE:()=>BG,COS:()=>VG,COSH:()=>HG,COT:()=>UG,COTH:()=>WG,COUNTBLANK:()=>GG,COUNTIF:()=>KG,COUNTIFS:()=>qG,COUNTUNIQUE:()=>JG,COUNTUNIQUEIFS:()=>YG,CSC:()=>XG,CSCH:()=>ZG,DECIMAL:()=>QG,DEGREES:()=>$G,EXP:()=>eK,FLOOR:()=>tK,FLOOR_MATH:()=>rK,FLOOR_PRECISE:()=>iK,INT:()=>BK,ISEVEN:()=>aK,ISODD:()=>sK,ISO_CEILING:()=>oK,LN:()=>cK,LOG:()=>lK,MOD:()=>dK,MUNIT:()=>fK,ODD:()=>pK,PI:()=>mK,POWER:()=>hK,PRODUCT:()=>gK,RAND:()=>_K,RANDARRAY:()=>vK,RANDBETWEEN:()=>yK,ROUND:()=>bK,ROUNDDOWN:()=>xK,ROUNDUP:()=>SK,SEC:()=>CK,SECH:()=>wK,SEQUENCE:()=>TK,SIN:()=>EK,SINH:()=>DK,SQRT:()=>OK,SUBTOTAL:()=>MK,SUM:()=>NK,SUMIF:()=>PK,SUMIFS:()=>FK,TAN:()=>IK,TANH:()=>LK,TRUNC:()=>zK});let EG=/^-?[a-z0-9]+$/i,DG={description:A(`Absolute value of a number.`),args:[z(`value (number)`,A(`The number of which to return the absolute value.`))],compute:function(e){return Math.abs(N(e,this.locale))},isExported:!0},OG={description:A(`Inverse cosine of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse cosine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=N(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},kG={description:A(`Inverse hyperbolic cosine of a number.`),args:[z(`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=N(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:[z(`value (number)`,A(`The value for which to calculate the inverse cotangent.`))],compute:function(e){let t=N(e,this.locale);return(Math.sign(t)||1)*Math.PI/2-Math.atan(t)},isExported:!0},jG={description:A(`Inverse hyperbolic cotangent of a value.`),args:[z(`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=N(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},MG={description:A(`Inverse sine of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse sine. Must be between -1 and 1, inclusive.`))],compute:function(e){let t=N(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},NG={description:A(`Inverse hyperbolic sine of a number.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse hyperbolic sine.`))],compute:function(e){return Math.asinh(N(e,this.locale))},isExported:!0},PG={description:A(`Inverse tangent of a value, in radians.`),args:[z(`value (number)`,A(`The value for which to calculate the inverse tangent.`))],compute:function(e){return Math.atan(N(e,this.locale))},isExported:!0},FG={description:A(`Angle from the X axis to a point (x,y), in radians.`),args:[z(`x (number)`,A(`The x coordinate of the endpoint of the line segment for which to calculate the angle from the x-axis.`)),z(`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=N(e,this.locale),r=N(t,this.locale);return n===0&&r===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):Math.atan2(r,n)},isExported:!0},IG={description:A(`Inverse hyperbolic tangent of a number.`),args:[z(`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=N(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},LG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`value (number)`,A(`The value to round up to the nearest integer multiple of factor.`)),z(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=N(e,this.locale),r=N(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 RG(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 zG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),z(`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=N(t,this.locale);return{value:RG(N(e,this.locale),r,N(n,this.locale)),format:e?.format}},isExported:!0},BG={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=N(t,this.locale);return{value:RG(N(e,this.locale),n),format:e?.format}},isExported:!0},VG={description:A(`Cosine of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cosine of, in radians.`))],compute:function(e){return Math.cos(N(e,this.locale))},isExported:!0},HG={description:A(`Hyperbolic cosine of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cosine of.`))],compute:function(e){return Math.cosh(N(e,this.locale))},isExported:!0},UG={description:A(`Cotangent of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cotangent of, in radians.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tan(t)},isExported:!0},WG={description:A(`Hyperbolic cotangent of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cotangent of.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.tanh(t)},isExported:!0},GG={description:A(`Number of empty values.`),args:[z(`value (any, range, repeating)`,A(`Value or range in which to count the number of blanks.`))],compute:function(...e){return da(e,(e,t)=>t===void 0||t.value===null||t.value===``?e+1:e,0)},isExported:!0},KG={description:A(`A conditional count across a range.`),args:[z(`range (range)`,A(`The range that is tested against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to range.`))],compute:function(...e){let t=0;return Ca(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},qG={description:A(`Count values depending on multiple criteria.`),args:[z(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(...e){let t=0;return Ca(e,(e,n)=>{t+=1},this.locale),t},isExported:!0},JG={description:A(`Counts number of unique values in a range.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider for uniqueness.`))],compute:function(...e){return Fb(e)}},YG={description:A(`Counts number of unique values in a range, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the number of unique values will be counted.`)),z(`criteria_range (any, range, repeating)`,A(`Range over which to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=new Set;return Ca(t,(t,r)=>{let i=e[t]?.[r];Aa(i)&&n.add(i.value)},this.locale),n.size}},XG={description:A(`Cosecant of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the cosecant of, in radians.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sin(t)},isExported:!0},ZG={description:A(`Hyperbolic cosecant of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic cosecant of.`))],compute:function(e){let t=N(e,this.locale);return t===0?new Vi(A(`Function [[FUNCTION_NAME]] caused a divide by zero error.`)):1/Math.sinh(t)},isExported:!0},QG={description:A(`Converts from another base to decimal.`),args:[z(`value (string)`,A(`The number to convert.`)),z(`base (number)`,A(`The base to convert the value from.`))],compute:function(e,t){let n=N(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=P(e);if(r===``)return 0;if(!EG.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},$G={description:A(`Converts an angle value in radians to degrees.`),args:[z(`angle (number)`,A(`The angle to convert from radians to degrees.`))],compute:function(e){return N(e,this.locale)*180/Math.PI},isExported:!0},eK={description:A(`Euler's number, e (~2.718) raised to a power.`),args:[z(`value (number)`,A(`The exponent to raise e.`))],compute:function(e){return Math.exp(N(e,this.locale))},isExported:!0},tK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`value (number)`,A(`The value to round down to the nearest integer multiple of factor.`)),z(`factor (number, default=1)`,A(`The number to whose multiples value will be rounded.`))],compute:function(e,t={value:1}){let n=N(e,this.locale),r=N(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 nK(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 rK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded. The sign of significance will be ignored.`)),z(`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=N(t,this.locale);return{value:nK(N(e,this.locale),r,N(n,this.locale)),format:e?.format}},isExported:!0},iK={description:A(`Rounds number down to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round down to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){let n=N(t,this.locale);return{value:nK(N(e,this.locale),n),format:e?.format}},isExported:!0},aK={description:A(`Whether the provided value is even.`),args:[z(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=$i(e,this.locale);return!(Math.floor(Math.abs(t))&1)},isExported:!0},oK={description:A(`Rounds number up to nearest multiple of factor.`),args:[z(`number (number)`,A(`The value to round up to the nearest integer multiple of significance.`)),z(`significance (number, default=1)`,A(`The number to whose multiples number will be rounded.`))],compute:function(e,t={value:1}){return{value:RG(N(e,this.locale),N(t,this.locale)),format:e?.format}},isExported:!0},sK={description:A(`Whether the provided value is even.`),args:[z(`value (number)`,A(`The value to be verified as even.`))],compute:function(e){let t=$i(e,this.locale);return!!(Math.floor(Math.abs(t))&1)},isExported:!0},cK={description:A(`The logarithm of a number, base e (euler's number).`),args:[z(`value (number)`,A(`The value for which to calculate the logarithm, base e.`))],compute:function(e){let t=N(e,this.locale);return t<=0?new M(A(`The value (%s) must be strictly positive.`,t)):Math.log(t)},isExported:!0},lK={description:A(`The logarithm of a number, for a given base.`),args:[z(`value (number)`,A(`The value for which to calculate the logarithm.`)),z(`base (number, default=10)`,A(`The base of the logarithm.`))],compute:function(e,t={value:10}){let n=N(e,this.locale),r=N(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 uK(e,t){Lb(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 dK={description:A(`Modulo (remainder) operator.`),args:[z(`dividend (number)`,A(`The number to be divided to find the remainder.`)),z(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=N(t,this.locale);return{value:uK(N(e,this.locale),n),format:e?.format}},isExported:!0},fK={description:A(`Returns a n x n unit matrix, where n is the input dimension.`),args:[z(`dimension (number)`,A(`An integer specifying the dimension size of the unit matrix. It must be positive.`))],compute:function(e){let t=ea(e,this.locale);return t<1?new M(A(`The argument dimension must be positive`)):Hb(t)},isExported:!0},pK={description:A(`Rounds a number up to the nearest odd integer.`),args:[z(`value (number)`,A(`The value to round to the next greatest odd number.`))],compute:function(e){let t=N(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},mK={description:A(`The number pi.`),args:[],compute:function(){return Math.PI},isExported:!0},hK={description:A(`A number raised to a power.`),args:[z(`base (number)`,A(`The number to raise to the exponent power.`)),z(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){let n=N(e,this.locale),r=N(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},gK={description:A(`Result of multiplying a series of numbers together.`),args:[z(`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(Ue(r))for(let e of r)for(let r of e){let e=r.value;if(typeof e==`number`&&(n*=e,t+=1),Gi(e))return r}else r!==void 0&&r.value!==null&&(n*=$i(r,this.locale),t+=1);return{value:t===0?0:n,format:Wi(e[0])}},isExported:!0},_K={description:A(`A random number between 0 inclusive and 1 exclusive.`),args:[],compute:function(){return Math.random()},isExported:!0},vK={description:A(`Returns a grid of random numbers between 0 inclusive and 1 exclusive.`),args:[z(`rows (number, default=1)`,A(`The number of rows to be returned.`)),z(`columns (number, default=1)`,A(`The number of columns to be returned.`)),z(`min (number, default=0)`,A(`The minimum number you would like returned.`)),z(`max (number, default=1)`,A(`The maximum number you would like returned.`)),z(`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=ea(t,this.locale),o=ea(e,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=F(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},yK={description:A(`Random integer between two values, inclusive.`),args:[z(`low (number)`,A(`The low end of the random range.`)),z(`high (number)`,A(`The high end of the random range.`))],compute:function(e,t){let n=N(e,this.locale);Number.isInteger(n)||(n=Math.ceil(n));let r=N(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},bK={description:A(`Rounds a number according to standard rules.`),args:[z(`value (number)`,A(`The value to round to places number of places.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},xK={description:A(`Rounds down a number.`),args:[z(`value (number)`,A(`The value to round to places number of places, always rounding down.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},SK={description:A(`Rounds up a number.`),args:[z(`value (number)`,A(`The value to round to places number of places, always rounding up.`)),z(`places (number, default=0)`,A(`The number of decimal places to which to round.`))],compute:function(e,t={value:0}){let n=N(e,this.locale),r=N(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},CK={description:A(`Secant of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the secant of, in radians.`))],compute:function(e){return 1/Math.cos(N(e,this.locale))},isExported:!0},wK={description:A(`Hyperbolic secant of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic secant of.`))],compute:function(e){return 1/Math.cosh(N(e,this.locale))},isExported:!0},TK={description:A(`Returns a sequence of numbers.`),args:[z(`rows (number)`,A(`The number of rows to return`)),z(`columns (number, optional, default=1)`,A(`The number of columns to return`)),z(`start (number, optional, default=1)`,A(`The first number in the sequence`)),z(`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=N(n,this.locale),a=N(r,this.locale),o=ea(e,this.locale),s=ea(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)):ma(s,o,(e,t)=>({value:i+t*s*a+e*a}))},isExported:!0},EK={description:A(`Sine of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the sine of, in radians.`))],compute:function(e){return Math.sin(N(e,this.locale))},isExported:!0},DK={description:A(`Hyperbolic sine of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic sine of.`))],compute:function(e){return Math.sinh(N(e,this.locale))},isExported:!0},OK={description:A(`Positive square root of a positive number.`),args:[z(`value (number)`,A(`The number for which to calculate the positive square root.`))],compute:function(e){let t=N(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},kK={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(kK).map(([e,t])=>({value:parseInt(e),label:A(`%s (include manually-hidden rows)`,t)})),jK=Object.entries(kK).map(([e,t])=>({value:parseInt(e)+100,label:A(`%s (exclude manually-hidden rows)`,t)})),MK={description:A(`Returns a subtotal for a vertical range of cells using a specified aggregation function.`),args:[z(`function_code (number)`,A(`The function to use in subtotal aggregation.`),[...AK,...jK]),z(`ref (any, range<any>, repeating)`,A(`Range or reference for which you want the subtotal.`))],compute:function(e,...t){let n=ea(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=I(e),n=t[0][0]?.position;if(n===void 0)return new Li(Ji);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||!Gt(n,`SUBTOTAL`))&&i.push(this.getFormulaResult({sheetId:s,col:t,row:e}))}}return this[kK[n]].apply(this,[[i]])},isExported:!0},NK={description:A(`Sum of a series of numbers and/or cells.`),args:[z(`value (number, range<number>, repeating)`,A(`Number or range to add together.`))],compute:function(...e){let t=e[0];return{value:Pb(e,this.locale),format:Wi(t)}},isExported:!0},PK={description:A(`A conditional sum across a range.`),args:[z(`criteria_range (range)`,A(`The range which is tested against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to range.`)),z(`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 Ca([e,t],(e,t)=>{let i=n[e]?.[t]?.value;typeof i==`number`&&(r+=i)},this.locale),r},isExported:!0},FK={description:A(`Sums a range depending on multiple criteria.`),args:[z(`sum_range (range)`,A(`The range to sum.`)),z(`criteria_range (any, range, repeating)`,A(`Range to check.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=0;return Ca(t,(t,r)=>{let i=e[t]?.[r]?.value;typeof i==`number`&&(n+=i)},this.locale),n},isExported:!0},IK={description:A(`Tangent of an angle provided in radians.`),args:[z(`angle (number)`,A(`The angle to find the tangent of, in radians.`))],compute:function(e){return Math.tan(N(e,this.locale))},isExported:!0},LK={description:A(`Hyperbolic tangent of any real number.`),args:[z(`value (number)`,A(`Any real value to calculate the hyperbolic tangent of.`))],compute:function(e){return Math.tanh(N(e,this.locale))},isExported:!0};function RK(e,t){return t===0?Math.trunc(e):(Number.isInteger(t)||(t=Math.trunc(t)),Math.trunc(e*10**t)/10**t)}let zK={description:A(`Truncates a number.`),args:[z(`value (number)`,A(`The value to be truncated.`)),z(`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:RK(N(e,this.locale),N(t,this.locale)),format:e?.format}},isExported:!0},BK={description:A(`Rounds a number down to the nearest integer that is less than or equal to it.`),args:[z(`value (number)`,A(`The number to round down to the nearest integer.`))],compute:function(e){return Math.floor(N(e,this.locale))},isExported:!0};var VK=l({AVEDEV:()=>ZK,AVERAGE:()=>QK,AVERAGEA:()=>nq,AVERAGEIF:()=>rq,AVERAGEIFS:()=>iq,AVERAGE_WEIGHTED:()=>tq,CORREL:()=>Eq,COUNT:()=>aq,COUNTA:()=>oq,COVAR:()=>sq,COVARIANCE_P:()=>cq,COVARIANCE_S:()=>lq,FORECAST:()=>uq,GROWTH:()=>dq,INTERCEPT:()=>fq,LARGE:()=>pq,LINEST:()=>mq,LOGEST:()=>hq,MATTHEWS:()=>gq,MAX:()=>_q,MAXA:()=>vq,MAXIFS:()=>yq,MEDIAN:()=>bq,MIN:()=>xq,MINA:()=>Sq,MINIFS:()=>Cq,PEARSON:()=>Tq,PERCENTILE:()=>Dq,PERCENTILE_EXC:()=>Oq,PERCENTILE_INC:()=>kq,POLYFIT_COEFFS:()=>Aq,POLYFIT_FORECAST:()=>jq,QUARTILE:()=>Mq,QUARTILE_EXC:()=>Nq,QUARTILE_INC:()=>Pq,RANK:()=>Fq,RSQ:()=>Iq,SLOPE:()=>Lq,SMALL:()=>Rq,SPEARMAN:()=>zq,STDEV:()=>Bq,STDEVA:()=>Uq,STDEVP:()=>Wq,STDEVPA:()=>Gq,STDEV_P:()=>Vq,STDEV_S:()=>Hq,STEYX:()=>Kq,TREND:()=>qq,VAR:()=>Jq,VARA:()=>Zq,VARP:()=>Qq,VARPA:()=>$q,VAR_P:()=>Yq,VAR_S:()=>Xq});let HK=[{value:!0,label:A(`b is calculated normally`)},{value:!1,label:A(`b is forced to 1`)}],UK=[{value:!1,label:A(`do not return additional regression statistics`)},{value:!0,label:A(`return additional regression statistics`)}],WK=[{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)`)}],GK=[{value:!0,label:A(`Compute intercept`)},{value:!1,label:A(`Force intercept to 0`)}],KK=[{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 qK(e,t){let n=[],r=[],i=0,a=0;ca([e],e=>{n.push(e),i+=1}),ca([t],e=>{r.push(e),a+=1}),Ib(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 JK(e,t,n){let{flatDataX:r,flatDataY:i}=qK(e,t),a=i.length;Lb(a),n&&Lb(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 YK(e,t,n,r){let i=0,a=n?pa:fa,o=a(e,(e,t)=>(i+=1,e+t),0,r);Lb(i),t&&Lb(i-1);let s=o/i;return a(e,(e,t)=>e+(t-s)**2,0,r)/(i-+!!t)}function XK(e,t,n,r){let i=N(t,r);Ib(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 ca(e,e=>{let t=e?.value;typeof t==`number`&&(o=wa(a,e,`nextSmaller`,`asc`,a.length,(e,t)=>e[t]),a.splice(o+1,0,t),s++)}),Ib(s!==0,ja),n||Ib(1/(s+1)<=i&&i<=s/(s+1),A(`Function [[FUNCTION_NAME]] parameter 2 value is out of range.`)),Ti(a,i,n)}let ZK={description:A(`Average magnitude of deviations from mean.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){let t=0,n=fa(e,(e,n)=>(t+=1,e+n),0,this.locale);if(t===0)return new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`));let r=n/t;return fa(e,(e,t)=>e+Math.abs(r-t),0,this.locale)/t},isExported:!0},QK={description:A(`Numerical average value in a dataset, ignoring text.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){return{value:Xb(e,this.locale),format:Wi(e[0])}},isExported:!0},$K=A(`[[FUNCTION_NAME]] has mismatched range sizes.`),eq=A(`[[FUNCTION_NAME]] expects the weight to be positive or equal to 0.`),tq={description:A(`Weighted average.`),args:[z(`values (number, range<number>, repeating)`,A(`Value to average.`)),z(`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(!zb(i,a))return new M($K);if(Ue(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=Ue(a)?a?.[e][r].value:N(a,this.locale),c=typeof o==`number`,l=typeof s==`number`;if(c&&l){if(s<0)return new M(eq);t+=o*s,n+=s;continue}if(c!==l)return new M(A(`[[FUNCTION_NAME]] expects number values.`))}else{let e=N(i,this.locale),r=Ue(a)?a?.[0][0].value:N(a,this.locale);if(typeof r==`number`){if(r<0)return new M(eq);t+=e*r,n+=r}}}return n===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:t/n,format:Wi(e[0])}}},nq={description:A(`Numerical average value in a dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the average value.`))],compute:function(...e){let t=0,n=pa(e,(e,n)=>(t+=1,e+n),0,this.locale);return t===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):{value:n/t,format:Wi(e[0])}},isExported:!0},rq={description:A(`Average of values depending on criteria.`),args:[z(`criteria_range (number, range<number>)`,A(`The range to check against criterion.`)),z(`criterion (string)`,A(`The pattern or test to apply to criteria_range.`)),z(`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=I(n===void 0?e:n),i=0,a=0;return Ca([e,t],(e,t)=>{let n=r[e]?.[t]?.value;typeof n==`number`&&(i+=1,a+=n)},this.locale),i===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):a/i},isExported:!0},iq={description:A(`Average of values depending on multiple criteria.`),args:[z(`average_range (range)`,A(`The range to average.`)),z(`criteria_range (any, range, repeating)`,A(`Range to check.`)),z(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=I(e),r=0,i=0;return Ca(t,(e,t)=>{let a=n[e]?.[t]?.value;typeof a==`number`&&(r+=1,i+=a)},this.locale),r===0?new Vi(A(`Evaluation of function [[FUNCTION_NAME]] caused a divide by zero error.`)):i/r},isExported:!0},aq={description:A(`The number of numeric values in dataset.`),args:[z(`value (number, any, range<number>, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return Qb(e,this.locale)},isExported:!0},oq={description:A(`The number of values in a dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when counting.`))],compute:function(...e){return $b(e)},isExported:!0},sq={description:A(`The covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!1)},isExported:!0},cq={description:A(`The covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!1)},isExported:!0},lq={description:A(`The sample covariance of a dataset.`),args:[z(`data_y (any, range)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (any, range)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return JK(e,t,!0)},isExported:!0},uq={description:A(`Calculates the expected y-value for a specified x based on a linear regression of a dataset.`),args:[z(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`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}=qK(t,n);return r.length===0||i.length===0?new Ri(ja):lx([i],[r],ha(I(e),e=>N(e,this.locale)),!0)},isExported:!0},dq={description:A(`Fits points to exponential growth trend.`),args:[z(`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.`)),z(`known_data_x (range<number>, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),z(`new_data_x (any, range, default=known_data_x)`,A(`The data points to return the y values for on the ideal curve fit.`)),z(`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.`),HK)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ma(`known_data_y`)):sx(lx(cx(Qi(e,`known_data_y`)),Qi(t,`known_data_x`),Qi(n,`new_data_y`),F(r)))}},fq={description:A(`Compute the intercept of the linear regression.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);let[[],[i]]=rx([n],[r]);return i},isExported:!0},pq={description:A(`Nth largest element from a data set.`),args:[z(`data (any, range)`,A(`Array or range containing the dataset to consider.`)),z(`n (number)`,A(`The rank from largest to smallest of the element to return.`))],compute:function(e,t){let n=Math.trunc(N(t?.value,this.locale)),r=[],i,a=0;ca([e],e=>{typeof e?.value==`number`&&(i=wa(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(ja):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},mq={description:A(`Given partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),z(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),HK),z(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),UK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){return e.length===0||e[0].length===0?new M(Ma(`data_y`)):rx(Qi(t,`data_x`),Qi(e,`data_y`),F(n),F(r))},isExported:!0},hq={description:A(`Given partial data about an exponential growth curve, calculates various parameters about the best fit ideal exponential growth curve.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>, optional, default={1;2;3;...})`,A(`The range representing the array or matrix of independent data.`)),z(`calculate_b (boolean, default=TRUE)`,A(`A flag specifying whether to compute the slope or not`),HK),z(`verbose (boolean, default=FALSE)`,A(`A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept`),UK)],compute:function(e,t=[[]],n={value:!0},r={value:!1}){if(e.length===0||e[0].length===0)return new M(Ma(`data_y`));let i=rx(Qi(t,`data_x`),cx(Qi(e,`data_y`)),F(n),F(r));for(let e=0;e<i.length;e++)i[e][0]=Math.exp(i[e][0]);return i},isExported:!0},gq={description:A(`Compute the Matthews correlation coefficient of a dataset.`),args:[z(`data_x (range)`,A(`The range representing the array or matrix of observed data.`)),z(`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(Yb(n,r),n.length===0||r.length===0)return new Ri(ja);let i=n.length,a=0,o=0,s=0,c=0;for(let e=0;e<i;++e){let t=F(n[e]);t===F(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},_q={description:A(`Maximum value in a numeric dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){return ex(e,this.locale)},isExported:!0},vq={description:A(`Maximum numeric value in a dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when calculating the maximum value.`))],compute:function(...e){let t=pa(e,(e,t)=>Math.max(t,e),-1/0,this.locale);return{value:t===-1/0?0:t,format:Wi(e[0])}},isExported:!0},yq={description:A(`Returns the maximum value in a range of cells, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the maximum will be determined.`)),z(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criteria to check.`))],compute:function(e,...t){let n=-1/0;return Ca(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},bq={description:A(`Median value in a numeric dataset.`),args:[z(`value (any, range, repeating)`,A(`Value or range to consider when calculating the median value.`))],compute:function(...e){let t=[];return la(e,e=>{t.push(e)},this.locale),{value:XK(t,{value:.5},!0,this.locale),format:Wi(t[0])}},isExported:!0},xq={description:A(`Minimum value in a numeric dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){return tx(e,this.locale)},isExported:!0},Sq={description:A(`Minimum numeric value in a dataset.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to consider when calculating the minimum value.`))],compute:function(...e){let t=pa(e,(e,t)=>Math.min(t,e),1/0,this.locale);return{value:t===1/0?0:t,format:Wi(e[0])}},isExported:!0},Cq={description:A(`Returns the minimum value in a range of cells, filtered by a set of criteria.`),args:[z(`range (range)`,A(`The range of cells from which the minimum will be determined.`)),z(`criteria_range (any, range, repeating)`,A(`Range to evaluate criteria.`)),z(`criterion (string, repeating)`,A(`Criterion to check.`))],compute:function(e,...t){let n=1/0;return Ca(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 wq(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);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 Tq={description:A(`Compute the Pearson product-moment correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){return wq(e,t)},isExported:!0},Eq=Tq,Dq={description:A(`Value at a given percentile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return kq.compute.bind(this)(e,t)},isExported:!0},Oq={description:A(`Value at a given percentile of a dataset exclusive of 0 and 1.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`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:XK([e],t,!1,this.locale),format:Wi(e)}},isExported:!0},kq={description:A(`Value at a given percentile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`percentile (number)`,A(`The percentile whose value within data will be calculated and returned.`))],compute:function(e,t){return{value:XK([e],t,!0,this.locale),format:Wi(e)}},isExported:!0},Aq={description:A(`Compute the coefficients of polynomial regression of the dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),z(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),WK),z(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),GK)],compute:function(e,t,n,r={value:!0}){let{flatDataX:i,flatDataY:a}=qK(e,t);return i.length===0||a.length===0?new Ri(ja):ix(a,i,N(n,this.locale),F(r))},isExported:!1},jq={description:A(`Predict value by computing a polynomial regression of the dataset.`),args:[z(`x (number, range<number>)`,A(`The value(s) on the x-axis to forecast.`)),z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`)),z(`order (number)`,A(`The order of the polynomial to fit the data, between 1 and 6.`),WK),z(`intercept (boolean, default=TRUE)`,A(`A flag specifying whether to compute the intercept or not.`),GK)],compute:function(e,t,n,r,i={value:!0}){let a=N(r,this.locale),{flatDataX:o,flatDataY:s}=qK(t,n);if(o.length===0||s.length===0)return new Ri(ja);let c=ix(s,o,a,F(i)).flat();return ha(I(e),e=>ox(c,N(e,this.locale),a))},isExported:!1},Mq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`quartile_number (number)`,A(`Which quartile value to return.`),KK)],compute:function(e,t){return Pq.compute.bind(this)(e,t)},isExported:!0},Nq={description:A(`Value nearest to a specific quartile of a dataset exclusive of 0 and 4.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`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(N(t,this.locale))};return{value:XK([e],n,!1,this.locale),format:Wi(e)}},isExported:!0},Pq={description:A(`Value nearest to a specific quartile of a dataset.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`quartile_number (number)`,A(`Which quartile value to return.`),KK)],compute:function(e,t){let n={value:.25*Math.trunc(N(t,this.locale))};return{value:XK([e],n,!0,this.locale),format:Wi(e)}},isExported:!0},Fq={description:A(`Returns the rank of a specified value in a dataset.`),args:[z(`value (number)`,A(`The value whose rank will be determined.`)),z(`data (range)`,A(`The range containing the dataset to consider.`)),z(`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=F(n),i=N(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=N(t,this.locale);e===i?o=!0:e>i!==r&&a++}return o?a:new Ri(A(`Value not found in the given data.`))},isExported:!0},Iq={description:A(`Compute the square of r, the Pearson product-moment correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let n=wq(e,t);if(n instanceof Error)throw n;return n**2},isExported:!0},Lq={description:A(`Compute the slope of the linear regression.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);if(n.length===0||r.length===0)return new Ri(ja);let[[i]]=rx([n],[r]);return i},isExported:!0},Rq={description:A(`Nth smallest element in a data set.`),args:[z(`data (any, range)`,A(`The array or range containing the dataset to consider.`)),z(`n (number)`,A(`The rank from smallest to largest of the element to return.`))],compute:function(e,t){let n=Math.trunc(N(t?.value,this.locale)),r=[],i,a=0;ca([e],e=>{typeof e?.value==`number`&&(i=wa(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(ja):a<n?new M(A(`Function [[FUNCTION_NAME]] parameter 2 value (%s) is out of range.`,n)):o},isExported:!0},zq={description:A(`Compute the Spearman rank correlation coefficient of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(t,e);if(n.length===0||r.length===0)return new Ri(ja);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},Bq={description:A(`Standard deviation.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Jq.compute.bind(this)(...e))},isExported:!0},Vq={description:A(`Standard deviation of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Yq.compute.bind(this)(...e))},isExported:!0},Hq={description:A(`Standard deviation.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Xq.compute.bind(this)(...e))},isExported:!0},Uq={description:A(`Standard deviation of sample (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return Math.sqrt(Zq.compute.bind(this)(...e))},isExported:!0},Wq={description:A(`Standard deviation of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt(Qq.compute.bind(this)(...e))},isExported:!0},Gq={description:A(`Standard deviation of entire population (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return Math.sqrt($q.compute.bind(this)(...e))},isExported:!0},Kq={description:A(`Calculates the standard error of the predicted y-value for each x in the regression of a dataset.`),args:[z(`data_y (range<number>)`,A(`The range representing the array or matrix of dependent data.`)),z(`data_x (range<number>)`,A(`The range representing the array or matrix of independent data.`))],compute:function(e,t){let{flatDataX:n,flatDataY:r}=qK(e,t);return n.length===0||r.length===0?new Ri(ja):rx([n],[r],!0,!0)[1][2]},isExported:!0},qq={description:A(`Fits points to linear trend derived via least-squares.`),args:[z(`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.`)),z(`known_data_x (number, range<number>, optional, default={1;2;3;...})`,A(`The values of the independent variable(s) corresponding with known_data_y.`)),z(`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.`)),z(`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.`),HK)],compute:function(e,t=[[]],n=[[]],r={value:!0}){return e.length===0||e[0].length===0?new M(Ma(`known_data_y`)):lx(Qi(e,`known_data_y`),Qi(t,`known_data_x`),Qi(n,`new_data_y`),F(r))}},Jq={description:A(`Variance.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!1,this.locale)},isExported:!0},Yq={description:A(`Variance of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!1,this.locale)},isExported:!0},Xq={description:A(`Variance.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!1,this.locale)},isExported:!0},Zq={description:A(`Variance of sample (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the sample.`))],compute:function(...e){return YK(e,!0,!0,this.locale)},isExported:!0},Qq={description:A(`Variance of entire population.`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!1,this.locale)},isExported:!0},$q={description:A(`Variance of entire population (text as 0).`),args:[z(`value (number, range<number>, repeating)`,A(`Value or range to include in the population.`))],compute:function(...e){return YK(e,!1,!0,this.locale)},isExported:!0};var eJ=l({DAVERAGE:()=>rJ,DCOUNT:()=>iJ,DCOUNTA:()=>aJ,DGET:()=>oJ,DMAX:()=>sJ,DMIN:()=>cJ,DPRODUCT:()=>lJ,DSTDEV:()=>uJ,DSTDEVP:()=>dJ,DSUM:()=>fJ,DVAR:()=>pJ,DVARP:()=>mJ});function tJ(e,t,n,r){let i=new Map,a=e.length;for(let t=a-1;t>=0;t--)i.set(P(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=P(t).toUpperCase();if(s=i.get(e)??-1,s===-1)throw new M(A(`The field (%s) must be one of %s.`,P(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=P(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)Ca(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 nJ=[z(`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.`)),z(`field (number, string)`,A(`Indicates which column in database contains the values to be extracted and operated on.`)),z(`criteria (range)`,A(`An array or range containing zero or more criteria to filter the database values by before operating.`))],rJ={description:A(`Average of a set of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return QK.compute.bind(this)([r])},isExported:!0},iJ={description:A(`Counts values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return aq.compute.bind(this)([r])},isExported:!0},aJ={description:A(`Counts values and text from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return oq.compute.bind(this)([r])},isExported:!0},oJ={description:A(`Single value from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return r.length===1?r[0]:new M(A(`More than one match found in DGET evaluation.`))},isExported:!0},sJ={description:A(`Maximum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return _q.compute.bind(this)([r])},isExported:!0},cJ={description:A(`Minimum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return xq.compute.bind(this)([r])},isExported:!0},lJ={description:A(`Product of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return gK.compute.bind(this)([r])},isExported:!0},uJ={description:A(`Standard deviation of population sample from table.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Bq.compute.bind(this)([r])},isExported:!0},dJ={description:A(`Standard deviation of entire population from table.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Wq.compute.bind(this)([r])},isExported:!0},fJ={description:A(`Sum of values from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return NK.compute.bind(this)([r])},isExported:!0},pJ={description:A(`Variance of population sample from table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Jq.compute.bind(this)([r])},isExported:!0},mJ={description:A(`Variance of a population from a table-like range.`),args:nJ,compute:function(e,t,n){let r=tJ(e,t,n,this.locale);return Qq.compute.bind(this)([r])},isExported:!0},hJ=A(`The cashflow_amounts and cashflow_dates ranges must have the same dimensions.`),gJ=A(`There must be both positive and negative values in cashflow_amounts.`),_J=e=>A(`The cost (%s) must be positive or null.`,e),vJ=e=>A(`The cost (%s) must be strictly positive.`,e),yJ=e=>A(`The frequency (%s) must be one of %s`,e,[1,2,4].toString()),bJ=e=>A(`The day_count_convention (%s) must be between 0 and 4 inclusive.`,e),xJ=e=>A(`The depreciation factor (%s) must be strictly positive.`,e),SJ=e=>A(`The discount (%s) must be different from -1.`,e),CJ=e=>A(`The discount (%s) must be strictly positive.`,e),wJ=e=>A(`The discount (%s) must be smaller than 1.`,e),TJ=e=>A(`The effective_rate (%s) must be strictly positive.`,e),EJ=e=>A(`The end_period (%s) must be positive or null.`,e),DJ=(e,t)=>A(`The end_period (%(end)s) must be smaller or equal to the life (%(life)s).`,{end:e,life:t}),OJ=e=>A(`All the dates should be greater or equal to the first date in cashflow_dates (%s).`,e),kJ=(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),jJ=e=>A(`The future_value (%s) must be strictly positive.`,e),MJ=e=>A(`The investment (%s) must be strictly positive.`,e),NJ=e=>A(`The issue (%s) must be positive or null.`,e),PJ=(e,t)=>A(`The last_period (%(last)s) must be smaller or equal to the number_of_periods (%(nPeriods)s).`,{last:e,nPeriods:t}),FJ=e=>A(`The last_period (%s) must be strictly positive.`,e),IJ=e=>A(`The life (%s) must be strictly positive.`,e),LJ=(e,t)=>A(`The maturity (%(maturity)s) must be strictly greater than the settlement (%(settlement)s).`,{maturity:t,settlement:e}),RJ=e=>A(`The month (%s) must be between 1 and 12 inclusive.`,e),zJ=e=>A(`The nominal_rate (%s) must be strictly positive.`,e),BJ=e=>A(`The number_of_periods (%s) must be different from zero.`,e),VJ=e=>A(`The number_of_periods (%s) must be strictly positive.`,e),HJ=e=>A(`The period must be between 1 and number_of_periods (%s)`,e),UJ=(e,t)=>A(`The period (%(period)s) must be less than or equal to %(lifeLimit)s.`,{period:e,lifeLimit:t}),WJ=e=>A(`The period (%s) must be positive or null.`,e),GJ=e=>A(`The periods_by_year (%s) must be strictly positive.`,e),KJ=(e,t)=>A(`The period (%(period)s) must be less than or equal life (%(life)s).`,{period:e,life:t}),qJ=e=>A(`The period (%s) must be strictly positive.`,e),JJ=e=>A(`The present_value (%s) must be strictly positive.`,e),YJ=e=>A(`The price (%s) must be strictly positive.`,e),XJ=(e,t)=>A(`The purchase_date (%(purchaseDate)s) must be before the first_period_end (%(firstPeriodEnd)s).`,{purchaseDate:e,firstPeriodEnd:t}),ZJ=e=>A(`The purchase_date (%s) must be positive or null.`,e),QJ=e=>A(`The rate_guess (%s) must be strictly greater than -1.`,e),$J=e=>A(`The rate (%s) must be positive or null.`,e),eY=e=>A(`The rate (%s) must be strictly positive.`,e),tY=e=>A(`The redemption (%s) must be strictly positive.`,e),nY=e=>A(`The salvage (%s) must be positive or null.`,e),rY=(e,t)=>A(`The salvage (%(salvage)s) must be smaller or equal than the cost (%(cost)s).`,{salvage:e,cost:t}),iY=(e,t)=>A(`The settlement date (%(settlement)s) must be greater or equal to the issue date (%(issue)s).`,{settlement:e,issue:t}),aY=(e,t)=>A(`The settlement date (%(settlement)s) must at most one year after the maturity date (%(maturity)s).`,{settlement:e,maturity:t}),oY=(e,t)=>A(`The settlement date (%(settlement)s) must be strictly greater than the issue date (%(issue)s).`,{settlement:e,issue:t}),sY=e=>A(`The start_period (%s) must be positive or null.`,e),cY=(e,t)=>A(`The start_period (%(start)s) must be smaller or equal to the end_period (%(end)s).`,{start:e,end:t}),lY=e=>A(`The unit (%s) must be strictly positive.`,e),uY=e=>A(`The yield (%s) must be positive or null.`,e);function dY(e){return e.some(e=>e>0)&&e.some(e=>e<0)}function fY(e){return![0,1,2,3,4].includes(e)}function pY(e){return![1,2,4].includes(e)}function mY(e,t,n){let r=aa(e,n),i=aa(t,n),a=aa(e,n);return a.setFullYear(r.getFullYear()+1),i.getTime()<=a.getTime()}let hY=[{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 gY=l({DATE:()=>vY,DATEDIF:()=>yY,DATEVALUE:()=>bY,DAY:()=>xY,DAYS:()=>SY,DAYS360:()=>CY,EDATE:()=>wY,EOMONTH:()=>TY,HOUR:()=>EY,ISOWEEKNUM:()=>DY,MINUTE:()=>OY,MONTH:()=>kY,MONTH_END:()=>KY,MONTH_START:()=>GY,NETWORKDAYS:()=>AY,NETWORKDAYS_INTL:()=>NY,NOW:()=>PY,QUARTER:()=>qY,QUARTER_END:()=>YY,QUARTER_START:()=>JY,SECOND:()=>FY,TIME:()=>IY,TIMEVALUE:()=>LY,TODAY:()=>RY,WEEKDAY:()=>zY,WEEKNUM:()=>BY,WORKDAY:()=>VY,WORKDAY_INTL:()=>HY,YEAR:()=>UY,YEARFRAC:()=>WY,YEAR_END:()=>ZY,YEAR_START:()=>XY}),_Y=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}(_Y||{});let vY={description:A(`Converts year/month/day into a date.`),args:[z(`year (number)`,A(`The year component of the date.`)),z(`month (number)`,A(`The month component of the date.`)),z(`day (number)`,A(`The day component of the date.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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=ri(new k(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},yY={description:A(`Calculates the number of days, months, or years between two dates.`),args:[z(`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.`)),z(`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.`)),z(`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=P(n).toUpperCase();if(!Object.values(_Y).includes(r))return new M(Xi(Object.values(_Y),P(n)));let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=ni(i),s=ni(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 _Y.WHOLE_YEARS:return fi(o,s);case _Y.WHOLE_MONTHS:return ui(o,s);case _Y.WHOLE_DAYS:return di(o,s);case _Y.MONTH_WITHOUT_WHOLE_YEARS:return ui(o,s)-fi(o,s)*12;case _Y.DAYS_WITHOUT_WHOLE_MONTHS:let e=s.getDate()-o.getDate();return e<0&&(e=ai(new k(s.getFullYear(),s.getMonth()-1,1))-Math.abs(e)),e;case _Y.DAYS_BETWEEN_NO_MORE_THAN_ONE_YEAR:{if(pi(i,a))return di(o,s);let e=new k(o.getFullYear(),s.getMonth(),s.getDate()),t=di(o,e);return t<0&&(e.setFullYear(o.getFullYear()+1),t=di(o,e)),t}}},isExported:!0},bY={description:A(`Converts a date string to a date value.`),args:[z(`date_string (string)`,A(`The string representing the date.`))],compute:function(e){let t=P(e),n=Kr(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},xY={description:A(`Day of the month that a specific date falls on.`),args:[z(`date (string)`,A(`The date from which to extract the day.`))],compute:function(e){return aa(e,this.locale).getDate()},isExported:!0},SY={description:A(`Number of days between two dates.`),args:[z(`end_date (date)`,A(`The end of the date range.`)),z(`start_date (date)`,A(`The start of the date range.`))],compute:function(e,t){let n=aa(e,this.locale),r=aa(t,this.locale),i=n.getTime()-r.getTime();return Math.round(i/Mr)},isExported:!0},CY={description:A(`Number of days between two dates on a 360-day year (months of 30 days).`),args:[z(`start_date (date)`,A(`The start date to consider in the calculation.`)),z(`end_date (date)`,A(`The end date to consider in the calculation.`)),z(`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(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=li(r,i,F(n)?4:0);return Math.sign(i-r)*Math.round(a*360)},isExported:!0},wY={description:A(`Date a number of months before/after another date.`),args:[z(`start_date (date)`,A(`The date from which to calculate the result.`)),z(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to calculate.`))],compute:function(e,t){return{value:ri(si(aa(e,this.locale),Math.trunc(N(t,this.locale)),!1)),format:this.locale.dateFormat}},isExported:!0},TY={description:A(`Last day of a month before or after a date.`),args:[z(`start_date (date)`,A(`The date from which to calculate the result.`)),z(`months (number)`,A(`The number of months before (negative) or after (positive) 'start_date' to consider.`))],compute:function(e,t){let n=aa(e,this.locale),r=Math.trunc(N(t,this.locale));return{value:ri(new k(n.getFullYear(),n.getMonth()+r+1,0)),format:this.locale.dateFormat}},isExported:!0},EY={description:A(`Hour component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the hour component.`))],compute:function(e){return aa(e,this.locale).getHours()},isExported:!0},DY={description:A(`ISO week number of the year.`),args:[z(`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=aa(e,this.locale),n=t.getFullYear(),r=1;for(;new k(n,0,r).getDay()!==4;)r+=1;let i=new k(n,0,r-3),a=31;for(;new k(n,11,a).getDay()!==4;)--a;let o=new k(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 k(n,11,a+3+1);break;case-1:let e=1;for(;new k(n-1,0,e).getDay()!==4;)e+=1;c=new k(n-1,0,e-3);break}let l=(t.getTime()-c.getTime())/Mr;return Math.floor(l/7)+1},isExported:!0},OY={description:A(`Minute component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the minute component.`))],compute:function(e){return aa(e,this.locale).getMinutes()},isExported:!0},kY={description:A(`Month of the year a specific date falls in`),args:[z(`date (date)`,A(`The date from which to extract the month.`))],compute:function(e){return aa(e,this.locale).getMonth()+1},isExported:!0},AY={description:A(`Net working days between two provided days.`),args:[z(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),z(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),z(`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 NY.compute.bind(this)(e,t,{value:1},n)},isExported:!0};function jY(e){let t=e?.value;if(typeof t==`string`){Ib(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 Ib(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 MY=[{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`)}],NY={description:A(`Net working days between two dates (specifying weekends).`),args:[z(`start_date (date)`,A(`The start date of the period from which to calculate the number of net working days.`)),z(`end_date (date)`,A(`The end date of the period from which to calculate the number of net working days.`)),z(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),MY),z(`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=aa(e,this.locale),a=aa(t,this.locale),o=jY(n),s=new Set;r!==void 0&&ca([r],e=>{let t=aa(e,this.locale);s.add(t.getTime())});let c=i.getTime()>a.getTime(),l=k.fromTimestamp((c?i:a).getTime()),u=k.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},PY={description:A(`Current date and time as a date value.`),args:[],compute:function(){let e=k.now(),t=e.getTime()-jr.getTime(),n=e.getHours()/24+e.getMinutes()/1440+e.getSeconds()/86400;return{value:Math.floor(t/Mr)+n,format:Ig(this.locale)}},isExported:!0},FY={description:A(`Minute component of a specific time.`),args:[z(`time (date)`,A(`The time from which to calculate the second component.`))],compute:function(e){return aa(e,this.locale).getSeconds()},isExported:!0},IY={description:A(`Converts hour/minute/second into a time.`),args:[z(`hour (number)`,A(`The hour component of the time.`)),z(`minute (number)`,A(`The minute component of the time.`)),z(`second (number)`,A(`The second component of the time.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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},LY={description:A(`Converts a time string into its serial number representation.`),args:[z(`time_string (string)`,A(`The string that holds the time representation.`))],compute:function(e){let t=P(e),n=Kr(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},RY={description:A(`Current date as a date value.`),args:[],compute:function(){let e=k.now();return{value:ri(new k(e.getFullYear(),e.getMonth(),e.getDate())),format:this.locale.dateFormat}},isExported:!0},zY={description:A(`Day of the week of the date provided (as number).`),args:[z(`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.`)),z(`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=aa(e,this.locale),r=Math.round(N(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},BY={description:A(`Week number of the year.`),args:[z(`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.`)),z(`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=aa(e,this.locale),r=Math.round(N(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 DY.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 k(a,0,o);for(;s.getDay()!==i;)o+=1,s=new k(a,0,o);let c=(n.getTime()-s.getTime())/Mr;return c<0?1:Math.floor(c/7)+(o===1?1:2)},isExported:!0},VY={description:A(`Date after a number of workdays.`),args:[z(`start_date (date)`,A(`The date from which to begin counting.`)),z(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),z(`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 HY.compute.bind(this)(e,t,{value:1},n)},isExported:!0},HY={description:A(`Date after a number of workdays (specifying weekends).`),args:[z(`start_date (date)`,A(`The date from which to begin counting.`)),z(`num_days (number)`,A(`The number of working days to advance from start_date. If negative, counts backwards.`)),z(`weekend (any, default=1)`,A(`A number or string representing which days of the week are considered weekends.`),MY),z(`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=aa(e,this.locale),a=Math.trunc(N(t,this.locale));if(n.value===`1111111`)return new M(A(`The weekend must be different from '1111111'.`));let o=jY(n),s=new Set;r!==void 0&&ca([r],e=>{let t=aa(e,this.locale);s.add(t.getTime())});let c=k.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-jr.getTime();return{value:Math.round(f/Mr),format:this.locale.dateFormat}},isExported:!0},UY={description:A(`Year specified by a given date.`),args:[z(`date (date)`,A(`The date from which to extract the year.`))],compute:function(e){return aa(e,this.locale).getFullYear()},isExported:!0},WY={description:A(`Exact number of years between two dates.`),args:[z(`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.`)),z(`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.`)),z(`day_count_convention (number, default=0)`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n={value:0}){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=Math.trunc(N(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)):li(r,i,a)}},GY={description:A(`First day of the month preceding a date.`),args:[z(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){let t=aa(e,this.locale);return{value:ri(new k(t.getFullYear(),t.getMonth(),1)),format:this.locale.dateFormat}}},KY={description:A(`Last day of the month following a date.`),args:[z(`date (date)`,A(`The date from which to calculate the result.`))],compute:function(e){return TY.compute.bind(this)(e,{value:0})}},qY={description:A(`Quarter of the year a specific date falls in`),args:[z(`date (date)`,A(`The date from which to extract the quarter.`))],compute:function(e){return Math.ceil((aa(e,this.locale).getMonth()+1)/3)}},JY={description:A(`First day of the quarter of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the start of quarter.`))],compute:function(e){let t=qY.compute.bind(this)(e);return{value:ri(new k(UY.compute.bind(this)(e),(t-1)*3,1)),format:this.locale.dateFormat}}},YY={description:A(`Last day of the quarter of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the end of quarter.`))],compute:function(e){let t=qY.compute.bind(this)(e);return{value:ri(new k(UY.compute.bind(this)(e),t*3,0)),format:this.locale.dateFormat}}},XY={description:A(`First day of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the start of the year.`))],compute:function(e){return{value:ri(new k(UY.compute.bind(this)(e),0,1)),format:this.locale.dateFormat}}},ZY={description:A(`Last day of the year a specific date falls in.`),args:[z(`date (date)`,A(`The date from which to calculate the end of the year.`))],compute:function(e){return{value:ri(new k(UY.compute.bind(this)(e)+1,0,0)),format:this.locale.dateFormat}}};var QY=l({DELTA:()=>$Y});let $Y={description:A(`Compare two numeric values, returning 1 if they're equal.`),args:[z(`number1 (number)`,A(`The first number to compare.`)),z(`number2 (number, default=0)`,A(`The second number to compare.`))],compute:function(e,t={value:0}){return+(N(e,this.locale)===N(t,this.locale))},isExported:!0};var eX=l({FILTER:()=>nX,SORT:()=>rX,SORTN:()=>iX,UNIQUE:()=>aX});function tX(e,t,...n){for(let e=0;e<n.length;e++){let t=e%2==0?`sort_column`:`is_ascending`;Ib(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(F(Kb(n[o+1])?.value)?`asc`:`desc`);let s=n[o];if(Ue(s)&&(s.length>1||s[0].length>1))Ib(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=N(Kb(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:Pz(`desc`),asc:Pz(`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 nX={description:A(`Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.`),args:[z(`range (any, range<any>)`,A(`The data to be filtered.`)),z(`condition (boolean, range<boolean>, repeating)`,A(`Column or row containing true or false values corresponding to the range.`))],compute:function(e,...t){let n=I(e),r=t.map(e=>ha(I(e),e=>e.value));for(let e of r)if(!Rb(e))return new M(A(`The arguments condition must be a single column or row.`));if(!zb(...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`?_a(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`?_a(o):o:new Ri(A(`No match found in FILTER evaluation`))},isExported:!1},rX={description:A(`Sorts the rows of a given array or range by the values in one or more columns.`),args:[z(`range (range)`,A(`The data to be sorted.`)),z(`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.`)),z(`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 _a(tX(_a(e),this.locale,...t))},isExported:!0},iX={description:A(`Returns the first n items in a data set after performing a sort.`),args:[z(`range (range)`,A(`The data to be sorted.`)),z(`n (number)`,A(`The number of items to return.`)),z(`display_ties_mode (number, default=0)`,A(`A number representing the way to display ties.`)),z(`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.`)),z(`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=N(t?.value??1,this.locale),i=n.length%2==0?0:N(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=tX(_a(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 _a(o.slice(0,r));case 1:for(let e=r;e<o.length;e++)if(!s(e,r-1))return _a(o.slice(0,e));return _a(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 _a(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 _a(e)}}},isExported:!1},aX={description:A(`Unique rows in the provided source range.`),args:[z(`range (any, range<any>)`,A(`The data to filter by unique entries.`)),z(`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`)}]),z(`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(!Ue(e))return[[e]];let r=F(t?.value)||!1,i=F(n?.value)||!1;r||(e=_a(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:_a(o):new M(A(`No unique values found`))},isExported:!0};var oX=l({ACCRINTM:()=>dX,AMORLINC:()=>fX,COUPDAYBS:()=>mX,COUPDAYS:()=>pX,COUPDAYSNC:()=>hX,COUPNCD:()=>gX,COUPNUM:()=>_X,COUPPCD:()=>vX,CUMIPMT:()=>yX,CUMPRINC:()=>bX,DB:()=>xX,DDB:()=>CX,DISC:()=>wX,DOLLARDE:()=>TX,DOLLARFR:()=>EX,DURATION:()=>DX,EFFECT:()=>OX,FV:()=>AX,FVSCHEDULE:()=>jX,INTRATE:()=>MX,IPMT:()=>PX,IRR:()=>IX,ISPMT:()=>LX,MDURATION:()=>RX,MIRR:()=>zX,NOMINAL:()=>BX,NPER:()=>VX,NPV:()=>UX,PDURATION:()=>WX,PMT:()=>KX,PPMT:()=>JX,PRICE:()=>XX,PRICEDISC:()=>ZX,PRICEMAT:()=>QX,PV:()=>YX,RATE:()=>eZ,RECEIVED:()=>tZ,RRI:()=>nZ,SLN:()=>rZ,SYD:()=>iZ,TBILLEQ:()=>sZ,TBILLPRICE:()=>oZ,TBILLYIELD:()=>cZ,VDB:()=>lZ,XIRR:()=>uZ,XNPV:()=>dZ,YIELD:()=>fZ,YIELDDISC:()=>pZ,YIELDMAT:()=>mZ});let sX=[{value:1,label:A(`Annual`)},{value:2,label:A(`Semi-annual`)},{value:4,label:A(`Quarterly`)}],cX=[{value:0,label:A(`End of period (default)`)},{value:1,label:A(`Beginning of period`)}],lX=[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)];function uX(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)){Ib(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,Ib(d<r,A(`Function [[FUNCTION_NAME]] didn't find any result.`)),d++}while(!u);return o}let dX={description:A(`Accrued interest of security paying at maturity.`),args:[z(`issue (date)`,A(`The date the security was initially issued.`)),z(`maturity (date)`,A(`The maturity date of the security.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(r,this.locale),c=N(n,this.locale),l=Math.trunc(N(i,this.locale));if(a<0)return new M(NJ(a));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(tY(s));if(c<=0)return new M(eY(c));let u=li(a,o,l);return s*c*u},isExported:!0},fX={description:A(`Depreciation for an accounting period.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`purchase_date (date)`,A(`The date the asset was purchased.`)),z(`first_period_end (date)`,A(`The date the first period ended.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`rate (number)`,A(`The deprecation rate.`)),z(`day_count_convention (number, optional)`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=N(e,this.locale),c=Math.trunc(N(t,this.locale)),l=Math.trunc(N(n,this.locale)),u=N(r,this.locale),d=N(i,this.locale),f=N(a,this.locale),p=Math.trunc(N(o,this.locale));if(s<=0)return new M(vJ(s));if(c<0)return new M(ZJ(c));if(u<0)return new M(nY(u));if(u>s)return new M(rY(u,s));if(d<0)return new M(WJ(d));if(f<=0)return new M(eY(f));if(fY(p))return new M(bJ(p));if(c>l)return new M(XJ(c,l));let m=d<1&&d>0?1:Math.trunc(d),h=s*f,g=li(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},pX={description:A(`Days in coupon period containing settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));if(s===1){let i=vX.compute.bind(this)(e,t,n,r).value,a=gX.compute.bind(this)(e,t,n,r).value;return N(a,this.locale)-N(i,this.locale)}return(s===3?365:360)/o},isExported:!0},mX={description:A(`Days from settlement until next coupon.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=vX.compute.bind(this)(e,t,n,r).value,l=N(c,this.locale);if([1,2,3].includes(s))return i-l;if(s===4){let e=li(l,i,s);return Math.round(e*360)}let u=aa(i,this.locale),d=aa(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&&oi(d)&&oi(u)&&(_=30),_===31&&(g===30||g===31)&&(_=30),m===2&&oi(d)&&(g=30),g===31&&(g=30),(p-f)*360+(h-m)*30+(_-g)},isExported:!0},hX={description:A(`Days from settlement until next coupon.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=gX.compute.bind(this)(e,t,n,r).value,l=N(c,this.locale);if([1,2,3].includes(s))return l-i;if(s===4){let e=li(i,l,s);return Math.round(e*360)}let u=mX.compute.bind(this)(e,t,n,r);return N(pX.compute.bind(this)(e,t,n,r),this.locale)-N(u,this.locale)},isExported:!0},gX={description:A(`Next coupon date after the settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=12/o,l=_X.compute.bind(this)(e,t,n,r);return{value:ri(si(aa(a,this.locale),-(N(l,this.locale)-1)*c,!0)),format:this.locale.dateFormat}},isExported:!0},_X={description:A(`Number of coupons between settlement and maturity.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=1,l=a,u=12/o;for(;l>i;)l=ri(si(aa(l,this.locale),-u,!1)),c++;return c-1},isExported:!0},vX={description:A(`Last coupon date prior to or on the settlement date.`),args:lX,compute:function(e,t,n,r={value:0}){r||=0;let i=Math.trunc(N(e,this.locale)),a=Math.trunc(N(t,this.locale)),o=Math.trunc(N(n,this.locale)),s=Math.trunc(N(r,this.locale));if(i>=a)return new M(LJ(i,a));if(pY(o))return new M(yJ(o));if(fY(s))return new M(bJ(s));let c=12/o,l=_X.compute.bind(this)(e,t,n,r);return{value:ri(si(aa(a,this.locale),-l*c,!0)),format:this.locale.dateFormat}},isExported:!0},yX={description:A(`Cumulative interest paid over a set of periods.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),z(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i,a={value:0}){let o=N(r,this.locale),s=N(i,this.locale),c=N(e,this.locale),l=N(n,this.locale),u=N(t,this.locale),d=+!!F(a);if(u<=0)return new M(VJ(u));if(o<=0)return new M(AJ(o));if(s<=0)return new M(FJ(s));if(o>s)return new M(kJ(o,s));if(s>u)return new M(PJ(s,u));if(c<=0)return new M(eY(c));if(l<=0)return new M(JJ(l));let f=0;for(let e=o;e<=s;e++)f+=NX(c,e,u,l,0,d);return f},isExported:!0},bX={description:A(`Cumulative principal paid over a set of periods.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`first_period (number)`,A(`The number of the payment period to begin the cumulative calculation.`)),z(`last_period (number)`,A(`The number of the payment period to end the cumulative calculation.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i,a={value:0}){let o=N(r,this.locale),s=N(i,this.locale),c=N(e,this.locale),l=N(n,this.locale),u=N(t,this.locale),d=+!!F(a);if(u<=0)return new M(VJ(u));if(o<=0)return new M(AJ(o));if(s<=0)return new M(FJ(s));if(o>s)return new M(kJ(o,s));if(s>u)return new M(PJ(s,u));if(c<=0)return new M(eY(c));if(l<=0)return new M(JJ(l));let f=0;for(let e=o;e<=s;e++)f+=qX(c,e,u,l,0,d);return f},isExported:!0},xX={description:A(`Depreciation via declining balance method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`month (number, optional)`,A(`The number of months in the first year of depreciation.`))],compute:function(e,t,n,r,...i){let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=Math.trunc(N(r,this.locale)),l=i.length?Math.trunc(N(i[0],this.locale)):12,u=s+(l===12?0:1);if(a<0)return new M(_J(a));if(o<0)return new M(nY(o));if(c<=0)return new M(qJ(c));if(s<=0)return new M(IJ(s));if(1>l||l>12)return new M(RJ(l));if(c>u)return new M(UJ(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},SX=`#,##0.00`,CX={description:A(`Depreciation via double-declining balance method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`)),z(`factor (number, default=2)`,A(`The factor by which depreciation decreases.`))],compute:function(e,t,n,r,i={value:2}){let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=N(i,this.locale);if(a<0)return new M(_J(a));if(o<0)return new M(nY(o));if(c<=0)return new M(qJ(c));if(s<=0)return new M(IJ(s));if(c>s)return new M(KJ(c,s));if(l<=0)return new M(xJ(l));if(a===0||o>=a)return{value:0,format:SX};let u=l/s;if(u>1)return{value:c===1?a-o:0,format:SX};if(c<=1)return{value:a*u,format:SX};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:SX}},isExported:!0},wX={description:A(`Discount rate of a security based on price.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(YJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return(c-s)/c/u},isExported:!0},TX={description:A(`Convert a decimal fraction to decimal value.`),args:[z(`fractional_price (number)`,A(`The price quotation given using fractional decimal conventions.`)),z(`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=N(e,this.locale),r=Math.trunc(N(t,this.locale));if(r<=0)return new M(lY(r));let i=Math.trunc(n);return i+(n-i)*(10**Math.ceil(Math.log10(r))/r)},isExported:!0},EX={description:A(`Convert a decimal value to decimal fraction.`),args:[z(`decimal_price (number)`,A(`The price quotation given as a decimal value.`)),z(`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=N(e,this.locale),r=Math.trunc(N(t,this.locale));if(r<=0)return new M(lY(r));let i=Math.trunc(n);return i+(n-i)*(r/10**Math.ceil(Math.log10(r)))},isExported:!0},DX={description:A(`Number of periods for an investment to reach a value.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=N(n,this.locale),l=N(r,this.locale),u=Math.trunc(N(i,this.locale)),d=Math.trunc(N(a,this.locale));if(o>=s)return new M(LJ(o,s));if(pY(u))return new M(yJ(u));if(fY(d))return new M(bJ(d));if(c<0)return new M($J(c));if(l<0)return new M(uY(l));let f=li(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},OX={description:A(`Annual effective interest rate.`),args:[z(`nominal_rate (number)`,A(`The nominal interest rate per year.`)),z(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=N(e,this.locale),r=Math.trunc(N(t,this.locale));return n<=0?new M(zJ(n)):r<=0?new M(GJ(r)):(1+n/r)**+r-1},isExported:!0};function kX(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:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_amount (number)`,A(`The amount per period to be paid.`)),z(`present_value (number, default=0)`,A(`The current value of the annuity.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){return r||=0,i||=0,{value:kX(N(e,this.locale),N(t,this.locale),N(n,this.locale),N(r,this.locale),+!!F(i)),format:`#,##0.00`}},isExported:!0},jX={description:A(`Future value of principal from series of rates.`),args:[z(`principal (number)`,A(`The amount of initial capital or value to compound against.`)),z(`rate_schedule (number, range<number>)`,A(`A series of interest rates to compound against the principal.`))],compute:function(e,t){let n=N(e,this.locale);return da([t],(e,t)=>e*(1+N(t,this.locale)),n)},isExported:!0},MX={description:A(`Calculates effective interest rate.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`investment (number)`,A(`The amount invested in the security.`)),z(`redemption (number)`,A(`The amount to be received at maturity.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(r,this.locale),c=N(n,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(c<=0)return new M(MJ(c));if(s<=0)return new M(tY(s));if(fY(l))return new M(bJ(l));let u=li(a,o,l);return(s-c)/c/u},isExported:!0};function NX(e,t,n,r,i,a){return GX(e,n,r,i,a)-qX(e,t,n,r,i,a)}let PX={description:A(`Payment on the principal of an investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`period (number)`,A(`The amortization period, in terms of number of periods.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i={value:0},a={value:0}){return{value:NX(N(e,this.locale),N(t,this.locale),N(n,this.locale),N(r,this.locale),N(i,this.locale),+!!F(a)),format:`#,##0.00`}},isExported:!0},FX=.1,IX={description:A(`Internal rate of return given periodic cashflows.`),args:[z(`cashflow_amounts (number, range<number>)`,A(`An array or range containing the income or payments associated with the investment.`)),z(`rate_guess (number, default=${FX})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t={value:FX}){let n=N(t,this.locale);if(n<=-1)return new M(QJ(n));let r=!1,i=!1,a=[];if(la([e],({value:e})=>{e>0&&(r=!0),e<0&&(i=!0),a.push(e)},this.locale),!r||!i)return new M(gJ);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:uX(l,u,n+1,20,1e-5)-1,format:`0%`}},isExported:!0},LX={description:A(`Returns the interest paid at a particular period of an investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`period (number)`,A(`The period for which you want to view the interest payment.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`))],compute:function(e,t,n,r){let i=N(e,this.locale),a=N(t,this.locale),o=N(n,this.locale),s=N(r,this.locale);return o===0?new M(BJ(o)):-1*(s-a/o*s)*i},isExported:!0},RX={description:A(`Modified Macaulay duration.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`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=DX.compute.bind(this)(e,t,n,r,i,a),s=N(r,this.locale),c=Math.trunc(N(i,this.locale));return N(o,this.locale)/(1+s/c)},isExported:!0},zX={description:A(`Modified internal rate of return.`),args:[z(`cashflow_amounts (range<number>)`,A(`A range containing the income or payments associated with the investment. The array should contain bot payments and incomes.`)),z(`financing_rate (number)`,A(`The interest rate paid on funds invested.`)),z(`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=N(t,this.locale),i=N(n,this.locale),a=_a(e).flat().filter(e=>e.value!==null).map(e=>N(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(gJ);let l=1/(o-1);return(-s/c)**l-1},isExported:!0},BX={description:A(`Annual nominal interest rate.`),args:[z(`effective_rate (number)`,A(`The effective interest rate per year.`)),z(`periods_per_year (number)`,A(`The number of compounding periods per year.`))],compute:function(e,t){let n=N(e,this.locale),r=Math.trunc(N(t,this.locale));return n<=0?new M(TJ(n)):r<=0?new M(GJ(r)):((n+1)**(1/r)-1)*r},isExported:!0},VX={description:A(`Number of payment periods for an investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`payment_amount (number)`,A(`The amount of each payment made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=+!!F(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 HX(e,t,n,r){let i=0;return fa(n,(t,n)=>(i++,t+n/(1+e)**i),t,r)}let UX={description:A(`The net present value of an investment based on a series of periodic cash flows and a discount rate.`),args:[z(`discount (number)`,A(`The discount rate of the investment over one period.`)),z(`cashflow (number, range<number>, repeating)`,A(`The future cash flows.`))],compute:function(e,...t){let n=N(e,this.locale);return n===-1?new M(SJ(n)):{value:HX(n,0,t,this.locale),format:`#,##0.00`}},isExported:!0},WX={description:A(`Computes the number of periods needed for an investment to reach a value.`),args:[z(`rate (number)`,A(`The rate at which the investment grows each period.`)),z(`present_value (number)`,A(`The investment's current value.`)),z(`future_value (number)`,A(`The investment's desired future value.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return r<=0?new M(eY(r)):i<=0?new M(JJ(i)):a<=0?new M(jJ(a)):(Math.log(a)-Math.log(i))/Math.log(1+r)},isExported:!0};function GX(e,t,n,r,i){if(t<=0)throw new M(VJ(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 KX={description:A(`Periodic payment for an annuity investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){let a=N(t,this.locale),o=N(e,this.locale),s=+!!F(i),c=N(r,this.locale);return{value:GX(o,a,N(n,this.locale),c,s),format:`#,##0.00`}},isExported:!0};function qX(e,t,n,r,i,a){if(n<=0)throw new M(VJ(n));if(t<=0||t>n)throw new M(HJ(n));let o=GX(e,n,r,i,a);return a===1&&t===1?o:o+-kX(e,a===0?t-1:t-2,o,r+o*a,0)*e}let JX={description:A(`Payment on the principal of an investment.`),args:[z(`rate (number)`,A(`The annualized rate of interest.`)),z(`period (number)`,A(`The amortization period, in terms of number of periods.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r,i={value:0},a={value:0}){let o=N(n,this.locale),s=N(e,this.locale),c=N(t,this.locale),l=+!!F(a),u=N(i,this.locale);return{value:qX(s,c,o,N(r,this.locale),u,l),format:`#,##0.00`}},isExported:!0},YX={description:A(`Present value of an annuity investment.`),args:[z(`rate (number)`,A(`The interest rate.`)),z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_amount (number)`,A(`The amount per period to be paid.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX)],compute:function(e,t,n,r={value:0},i={value:0}){r||=0,i||=0;let a=N(e,this.locale),o=N(t,this.locale),s=N(n,this.locale),c=N(r,this.locale),l=+!!F(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},XX={description:A(`Price of a security paying periodic interest.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(N(e,this.locale)),c=Math.trunc(N(t,this.locale)),l=N(n,this.locale),u=N(r,this.locale),d=N(i,this.locale),f=Math.trunc(N(a,this.locale)),p=Math.trunc(N(o,this.locale));if(s>=c)return new M(LJ(s,c));if(pY(f))return new M(yJ(f));if(fY(p))return new M(bJ(p));if(l<0)return new M($J(l));if(u<0)return new M(uY(u));if(d<=0)return new M(tY(d));let m=li(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},ZX={description:A(`Price of a discount security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the security at time of purchase.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(CJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return c-s*c*u},isExported:!0},QX={description:A(`Calculates the price of a security paying interest at maturity, based on expected yield.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`issue (date)`,A(`The date the security was initially issued.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`yield (number)`,A(`The expected annual yield of the security.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=Math.trunc(N(n,this.locale)),l=N(r,this.locale),u=N(i,this.locale),d=Math.trunc(N(a,this.locale));if(o<=c)return new M(oY(o,c));if(o>=s)return new M(LJ(o,s));if(fY(d))return new M(bJ(d));if(l<0)return new M($J(l));if(u<0)return new M(uY(u));let f=li(o,s,d),p=li(o,c,d),m=100+li(c,s,d)*l*100,h=1+f*u,g=p*l*100;return m/h-g},isExported:!0},$X=.1,eZ={description:A(`Interest rate of an annuity investment.`),args:[z(`number_of_periods (number)`,A(`The number of payments to be made.`)),z(`payment_per_period (number)`,A(`The amount per period to be paid.`)),z(`present_value (number)`,A(`The current value of the annuity.`)),z(`future_value (number, default=0)`,A(`The future value remaining after the final payment has been made.`)),z(`end_or_beginning (number, default=0)`,A(`The timing of the payment payments are due for each period.`),cX),z(`rate_guess (number, default=${$X})`,A(`An estimate for what the interest rate will be.`))],compute:function(e,t,n,r={value:0},i={value:0},a={value:$X}){let o=N(e,this.locale),s=N(t,this.locale),c=+!!F(i),l=N(a,this.locale)||$X,u=N(r,this.locale),d=N(n,this.locale);return o<=0?new M(VJ(o)):dY([s,d,u])?l<=-1?new M(QJ(l)):(u-=s*c,d+=s*c,{value:uX(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},tZ={description:A(`Amount received at maturity for a security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`investment (number)`,A(`The amount invested (irrespective of face value of each security).`)),z(`discount (number)`,A(`The discount rate of the security invested in.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));return a>=o?new M(LJ(a,o)):fY(l)?new M(bJ(l)):s<=0?new M(MJ(s)):c<=0?new M(CJ(c)):s/(1-c*li(a,o,l))},isExported:!0},nZ={description:A(`Computes the rate needed for an investment to reach a specific value within a specific number of periods.`),args:[z(`number_of_periods (number)`,A(`The number of periods.`)),z(`present_value (number)`,A(`The present value of the investment.`)),z(`future_value (number)`,A(`The future value of the investment.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return r<=0?new M(VJ(r)):(a/i)**(1/r)-1},isExported:!0},rZ={description:A(`Depreciation of an asset using the straight-line method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`))],compute:function(e,t,n){let r=N(e,this.locale),i=N(t,this.locale),a=N(n,this.locale);return{value:(r-i)/a,format:`#,##0.00`}},isExported:!0},iZ={description:A(`Depreciation via sum of years digit method.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`period (number)`,A(`The single period within life for which to calculate depreciation.`))],compute:function(e,t,n,r){let i=N(e,this.locale),a=N(t,this.locale),o=N(n,this.locale),s=N(r,this.locale);if(s<=0)return new M(qJ(s));if(o<=0)return new M(IJ(o));if(s>o)return new M(KJ(s,o));let c=o*(o+1)/2,l=o-s+1;return{value:(i-a)*(l/c),format:`#,##0.00`}},isExported:!0};function aZ(e,t,n){return 100*(1-n*li(e,t,2))}let oZ={description:A(`Price of a US Treasury bill.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);return r>=i?new M(LJ(r,i)):mY(r,i,this.locale)?a<=0?new M(CJ(a)):a>=1?new M(wJ(a)):aZ(r,i,a):new M(aY(r,i))},isExported:!0},sZ={description:A(`Equivalent rate of return for a US Treasury bill.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`discount (number)`,A(`The discount rate of the bill at time of purchase.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);if(r>=i)return new M(LJ(r,i));if(!mY(r,i,this.locale))return new M(aY(r,i));if(a<=0)return new M(CJ(a));if(a>=1)return new M(wJ(a));let o=SY.compute.bind(this)({value:i},{value:r});if(o<=182)return 365*a/(360-a*o);let s=aZ(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},cZ={description:A(`The yield of a US Treasury bill based on price.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`))],compute:function(e,t,n){let r=Math.trunc(N(e,this.locale)),i=Math.trunc(N(t,this.locale)),a=N(n,this.locale);if(r>=i)return new M(LJ(r,i));if(!mY(r,i,this.locale))return new M(aY(r,i));if(a<=0)return new M(YJ(a));let o=li(r,i,2);return(100-a)/a*(1/o)},isExported:!0},lZ={description:A(`Variable declining balance. WARNING : does not handle decimal periods.`),args:[z(`cost (number)`,A(`The initial cost of the asset.`)),z(`salvage (number)`,A(`The value of the asset at the end of depreciation.`)),z(`life (number)`,A(`The number of periods over which the asset is depreciated.`)),z(`start (number)`,A(`Starting period to calculate depreciation.`)),z(`end (number)`,A(`Ending period to calculate depreciation.`)),z(`factor (number, default=2)`,A(`The number of months in the first year of depreciation.`)),z(`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=N(e,this.locale),c=N(t,this.locale),l=N(n,this.locale),u=Math.trunc(N(r,this.locale)),d=Math.trunc(N(i,this.locale)),f=N(a,this.locale),p=F(o);if(s<0)return new M(_J(s));if(c<0)return new M(nY(c));if(l<=0)return new M(IJ(l));if(u<0)return new M(sY(u));if(d<0)return new M(EJ(d));if(u>d)return new M(cY(u,d));if(d>l)return new M(DJ(d,l));if(f<=0)return new M(xJ(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},uZ={description:A(`Internal rate of return given non-periodic cash flows.`),args:[z(`cashflow_amounts (range<number>)`,A(`An range containing the income or payments associated with the investment.`)),z(`cashflow_dates (range<number>)`,A(`An range with dates corresponding to the cash flows in cashflow_amounts.`)),z(`rate_guess (number, default=${$X})`,A(`An estimate for what the internal rate of return will be.`))],compute:function(e,t,n={value:$X}){let r=N(n,this.locale);if(!zb(e,t))return new M(hJ);let i=e.flat().map(e=>N(e,this.locale)),a=t.flat().map(e=>N(e,this.locale));if(!dY(i))return new M(gJ);if(a.some(e=>e<a[0]))return new M(OJ(a[0]));if(r<=-1)return new M(QJ(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 uX(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},dZ={description:A(`Net present value given to non-periodic cash flows..`),args:[z(`discount (number)`,A(`The discount rate of the investment over one period.`)),z(`cashflow_amounts (number, range<number>)`,A(`An range containing the income or payments associated with the investment.`)),z(`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=N(e,this.locale);if(!zb(t,n))return new M(hJ);let i=I(t).flat().map(e=>$i(e,this.locale)),a=I(n).flat().map(e=>$i(e,this.locale));if(a.some(e=>e<a[0]))return new M(OJ(a[0]));if(r<=0)return new M(eY(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},fZ={description:A(`Annual yield of a security paying periodic interest.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`frequency (number)`,A(`The number of interest or coupon payments per year (1, 2, or 4).`),sX),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a,o={value:0}){o||=0;let s=Math.trunc(N(e,this.locale)),c=Math.trunc(N(t,this.locale)),l=N(n,this.locale),u=N(r,this.locale),d=N(i,this.locale),f=Math.trunc(N(a,this.locale)),p=Math.trunc(N(o,this.locale));if(s>=c)return new M(LJ(s,c));if(pY(f))return new M(yJ(f));if(fY(p))return new M(bJ(p));if(l<0)return new M($J(l));if(u<=0)return new M(YJ(u));if(d<=0)return new M(tY(d));let m=li(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(uX(b,ee,1+(l+1)/f,100,1e-5)-1)*f},isExported:!0},pZ={description:A(`Annual yield of a discount security.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`price (number)`,A(`The price at which the security is bought per 100 face value.`)),z(`redemption (number)`,A(`The redemption amount per 100 face value, or par.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i={value:0}){i||=0;let a=Math.trunc(N(e,this.locale)),o=Math.trunc(N(t,this.locale)),s=N(n,this.locale),c=N(r,this.locale),l=Math.trunc(N(i,this.locale));if(a>=o)return new M(LJ(a,o));if(fY(l))return new M(bJ(l));if(s<=0)return new M(YJ(s));if(c<=0)return new M(tY(c));let u=li(a,o,l);return(c/s-1)/u},isExported:!0},mZ={description:A(`Annual yield of a security paying interest at maturity.`),args:[z(`settlement (date)`,A(`The settlement date of the security, the date after issuance when the security is delivered to the buyer.`)),z(`maturity (date)`,A(`The maturity or end date of the security, when it can be redeemed at face, or par value.`)),z(`issue (date)`,A(`The date the security was initially issued.`)),z(`rate (number)`,A(`The annualized rate of interest.`)),z(`price (number)`,A(`The price at which the security is bought.`)),z(`day_count_convention (number, default=0 )`,A(`An indicator of what day count method to use.`),hY)],compute:function(e,t,n,r,i,a={value:0}){a||=0;let o=Math.trunc(N(e,this.locale)),s=Math.trunc(N(t,this.locale)),c=Math.trunc(N(n,this.locale)),l=N(r,this.locale),u=N(i,this.locale),d=Math.trunc(N(a,this.locale));if(o>=s)return new M(LJ(o,s));if(fY(d))return new M(bJ(d));if(o<c)return new M(iY(o,c));if(l<0)return new M($J(l));if(u<=0)return new M(YJ(u));let f=li(c,s,d),p=li(c,o,d),m=li(o,s,d);return(100*(1+l*f)/(u+100*l*p)-1)/m},isExported:!0};var hZ=l({CELL:()=>_Z,ISBLANK:()=>TZ,ISERR:()=>vZ,ISERROR:()=>yZ,ISFORMULA:()=>DZ,ISLOGICAL:()=>bZ,ISNA:()=>xZ,ISNONTEXT:()=>SZ,ISNUMBER:()=>CZ,ISTEXT:()=>wZ,NA:()=>EZ});let gZ=[{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.`)}],_Z={description:A(`Gets information about a cell.`),args:[z(`info_type (string)`,A(`The type of information requested.`),gZ),z(`reference (any, range<any>)`,A(`The reference to the cell.`))],compute:function(e,t){let n=P(e).toLowerCase();if(!gZ.map(e=>e.value).includes(n))return new M(A(`The info_type should be one of %s.`,gZ.join(`, `)));let r=I(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`:qo(r.format)?`l`:typeof r.value==`number`||typeof r.value==`boolean`?`v`:`l`}return``},isExported:!0},vZ={description:A(`Whether a value is an error other than #N/A.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return Gi(t)&&t!==j.NotAvailable},isExported:!0},yZ={description:A(`Whether a value is an error.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){let t=e?.value;return Gi(t)},isExported:!0},bZ={description:A("Whether a value is `true` or `false`."),args:[z(`value (any)`,A(`The value to be verified as a logical TRUE or FALSE.`))],compute:function(e){return typeof e?.value==`boolean`},isExported:!0},xZ={description:A(`Whether a value is the error #N/A.`),args:[z(`value (any)`,A(`The value to be verified as an error type.`))],compute:function(e){return e?.value===j.NotAvailable},isExported:!0},SZ={description:A(`Whether a value is non-textual.`),args:[z(`value (any)`,A(`The value to be checked.`))],compute:function(e){return!wZ.compute.bind(this)(e)},isExported:!0},CZ={description:A(`Whether a value is a number.`),args:[z(`value (any)`,A(`The value to be verified as a number.`))],compute:function(e){return typeof e?.value==`number`},isExported:!0},wZ={description:A(`Whether a value is text.`),args:[z(`value (any)`,A(`The value to be verified as text.`))],compute:function(e){return typeof e?.value==`string`&&Gi(e?.value)===!1},isExported:!0},TZ={description:A(`Whether the referenced cell is empty`),args:[z(`value (any)`,A(`Reference to the cell that will be checked for emptiness.`))],compute:function(e){return e?.value===null},isExported:!0},EZ={description:A(`Returns the error value #N/A.`),args:[],compute:function(){return{value:j.NotAvailable}},isExported:!0},DZ={description:A(`Checks whether there is a reference to a cell that contains a formula, and returns TRUE or FALSE.`),args:[z(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){return e?.position===void 0?new Li(Ji):this.getters.getCell(e.position)?.isFormula??!1},isExported:!0};var OZ=l({AND:()=>kZ,FALSE:()=>AZ,IF:()=>jZ,IFERROR:()=>MZ,IFNA:()=>NZ,IFS:()=>PZ,NOT:()=>FZ,OR:()=>IZ,SWITCH:()=>LZ,TRUE:()=>RZ,XOR:()=>zZ});let kZ={description:A("Logical `and` operator."),args:[z(`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}=Mb(e);return n?t:new M(ja)},isExported:!0},AZ={description:A("Logical value `false`."),args:[],compute:function(){return!1},isExported:!0},jZ={description:A(`Returns value depending on logical expression.`),args:[z(`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.`)),z(`value_if_true (any, range)`,A(`The value the function returns if logical_expression is TRUE.`)),z(`value_if_false (any, range, default=FALSE)`,A(`The value the function returns if logical_expression is FALSE.`))],compute:function(e,t,n){return Jb(e)?os(this,_s.get(`IF`),[e,t,n]):(F(Kb(e))?t:n)??{value:0}},isExported:!0},MZ={description:A(`Value if it is not an error, otherwise 2nd argument.`),args:[z(`value (any, range)`,A(`The value to return if value itself is not an error.`)),z(`value_if_error (any, range, default="empty")`,A(`The value the function returns if value is an error.`))],compute:function(e,t){return Jb(e)?os(this,_s.get(`IFERROR`),[e,t]):(Gi(Kb(e)?.value)?t:e)??{value:0}},isExported:!0},NZ={description:A(`Value if it is not an #N/A error, otherwise 2nd argument.`),args:[z(`value (any, range)`,A(`The value to return if value itself is not #N/A an error.`)),z(`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 Jb(e)?os(this,_s.get(`IFNA`),[e,t]):(Kb(e)?.value===j.NotAvailable?t:e)??{value:0}},isExported:!0},PZ={description:A(`Returns a value depending on multiple logical expressions.`),args:[z(`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.`)),z(`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(Jb(e[0]))return os(this,_s.get(`IFS`),e);let t=F(Kb(e.shift())),n=e.shift();if(t)return n??{value:0}}return new M(A(`No match.`))},isExported:!0},FZ={description:A(`Returns opposite of provided logical value.`),args:[z(`logical_expression (boolean)`,A(`An expression or reference to a cell holding an expression that represents some logical value.`))],compute:function(e){return!F(e)},isExported:!0},IZ={description:A("Logical `or` operator."),args:[z(`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}=Nb(e);return n?t:new M(ja)},isExported:!0},LZ={description:A(`Returns a value by comparing cases to an expression.`),args:[z(`expression (number, boolean, string)`,A(`The value to be checked.`)),z(`case (any, repeating)`,A(`Case to be checked against expression.`)),z(`value (any, repeating)`,A(`Value to be returned if its corresponding case matches expression.`)),z(`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?Ki(e):t.pop();for(let n=0;n<t.length;n+=2){let r=t[n];if(r&&Gi(r.value))return r;if(e?.value===r?.value)return t[n+1]||{value:0}}return n||{value:0}},isExported:!0},RZ={description:A("Logical value `true`."),args:[],compute:function(){return!0},isExported:!0},zZ={description:A("Logical `xor` operator."),args:[z(`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 ya(e,e=>(t=!0,n=n?!e:e,!0)),t?n:new M(ja)},isExported:!0};function BZ(e,t){let n=t.getPivotId(e);if(!n)throw new M(A(`There is no pivot with id "%s"`,e));return n}function VZ(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 HZ(e){if(e.length%2!=0)throw new M(A(`Function PIVOT takes an even number of arguments.`))}function UZ(e,t,n){let r=[],i=e.getters.getPivotCoreDefinition(t);if(i.type===`SPREADSHEET`&&i.dataSet){let{sheetId:t,zone:n}=i.dataSet,a=bn(n),o=e.getters.getRangeFromSheetXC(t,a);if(o===void 0||o.invalidXc||o.invalidSheetName)throw new Li;if(e.__originCellPosition&&o.sheetId===e.__originSheetId&&Mn(D(e.__originCellPosition),n))throw new Ii;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 WZ=l({ADDRESS:()=>qZ,CHOOSE:()=>uQ,COLUMN:()=>JZ,COLUMNS:()=>YZ,DROP:()=>dQ,FORMULATEXT:()=>pQ,HLOOKUP:()=>XZ,INDEX:()=>ZZ,INDIRECT:()=>QZ,LOOKUP:()=>$Z,MATCH:()=>eQ,OFFSET:()=>lQ,PIVOT:()=>cQ,PIVOT_HEADER:()=>sQ,PIVOT_VALUE:()=>oQ,ROW:()=>tQ,ROWS:()=>nQ,TAKE:()=>fQ,VLOOKUP:()=>rQ,XLOOKUP:()=>aQ});let GZ=[{value:!0,label:A(`A1 style (default)`)},{value:!1,label:A(`R1C1 style`)}],KZ=[{value:!0,label:A(`Approximate match (default)`)},{value:!1,label:A(`Exact match`)}],qZ={description:A(`Returns a cell reference as a string. `),args:[z(`row (number)`,A(`The row number of the cell reference. `)),z(`column (number)`,A(`The column number (not name) of the cell reference. A is column number 1. `)),z(`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)`)}]),z(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation or R1C1 style notation.`),GZ),z(`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=ta(e,this.locale),o=ta(t,this.locale);if(a<1)return new M(Vb(a));if(o<1)return new M(Vb(o));let s=ta(n,this.locale);if(![1,2,3,4].includes(s))return new M(Yi(1,4,s));let c=F(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:js(P(i),l)},isExported:!0},JZ={description:A(`Column number of a specified cell.`),args:[z(`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=I(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 Li(Ji);let r=n.position.col;return t.length===1?r+1:ma(t.length,1,e=>({value:r+e+1}))},isExported:!0},YZ={description:A(`Number of columns in a specified array or range.`),args:[z(`range (any, range<any>)`,A(`The range whose column count will be returned.`))],compute:function(e){let t=I(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},XZ={description:A(`Horizontal lookup`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`index (number)`,A(`The row index of the value to be returned, where the first row in range is numbered 1.`)),z(`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.`),KZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(N(n?.value,this.locale)),a=I(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[F(r.value)?wa(a,e,`nextSmaller`,`asc`,a.length,o):Ta(a,e,`wildcard`,a.length,o,this.lookupCaches)];return s===void 0?Ki(e):s[i-1]},isExported:!0},ZZ={description:A(`Returns the content of a cell, specified by row and column offset.`),args:[z(`reference (any, range)`,A(`The range of cells from which the values are returned.`)),z(`row (number, default=0)`,A(`The index of the row to be returned from within the reference range of cells.`)),z(`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=I(e),i=N(t.value,this.locale),a=N(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},QZ={description:A(`Returns the content of a cell, specified by a string.`),args:[z(`reference (string)`,A(`The range of cells from which the values are returned.`)),z(`use_a1_notation (boolean, default=TRUE)`,A(`A boolean indicating whether to use A1 style notation (TRUE) or R1C1 style notation (FALSE).`),GZ)],compute:function(e,t={value:!0}){let n=e?.value?.toString();if(!n)return new Li(A(`Reference should be defined.`));if(!F(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 Li;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},$Z={description:A(`Look up a value.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`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=I(t),i=I(n),a=r.length,o=r[0].length,s=o>=a,c=wa(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?Ki(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},eQ={description:A(`Position of item in range that matches value.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`range (any, range)`,A(`The one-dimensional array to be searched.`)),z(`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=N(n,this.locale),i=I(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=wa(i,e,`nextSmaller`,`asc`,l,c);break;case 0:s=Ta(i,e,`wildcard`,l,c,this.lookupCaches);break;case-1:s=wa(i,e,`nextGreater`,`desc`,l,c);break}return a===1&&i[0][s]===void 0||a!==1&&i[s]===void 0?Ki(e):s+1},isExported:!0},tQ={description:A(`Row number of a specified cell.`),args:[z(`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=I(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 Li(Ji);let r=n.position.row;return t[0].length===1?r+1:ma(1,t[0].length,(e,t)=>({value:r+t+1}))},isExported:!0},nQ={description:A(`Number of rows in a specified array or range.`),args:[z(`range (any, range<any>)`,A(`The range whose row count will be returned.`))],compute:function(e){let t=I(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},rQ={description:A(`Vertical lookup.`),args:[z(`search_key (string, number, boolean)`,A(`The value to search for. For example, 42, 'Cats', or I24.`)),z(`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.`)),z(`index (number)`,A(`The column index of the value to be returned, where the first column in range is numbered 1.`)),z(`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.`),KZ)],compute:function(e,t,n,r={value:!0}){let i=Math.trunc(N(n?.value,this.locale)),a=I(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=F(r.value)?wa(a,e,`nextSmaller`,`asc`,a[0].length,o):Ta(a,e,`wildcard`,a[0].length,o,this.lookupCaches),c=a[i-1][s];return c===void 0?Ki(e):c},isExported:!0},iQ={0:`strict`,1:`nextGreater`,"-1":`nextSmaller`,2:`wildcard`},aQ={description:A(`Search a range for a match and return the corresponding item from a second range.`),args:[z(`search_key (string,number,boolean)`,A(`The value to search for.`)),z(`lookup_range (any, range)`,A(`The range to consider for the search. Should be a single column or a single row.`)),z(`return_range (any, range)`,A(`The range containing the return value. Should have the same dimensions as lookup_range.`)),z(`if_not_found (any, optional)`,A(`If a valid match is not found, return this value.`)),z(`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`)}]),z(`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(N(i.value,this.locale)),s=Math.trunc(N(a.value,this.locale)),c=I(t),l=I(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=iQ[o],m=s===-1,h=s===2||s===-2?wa(c,e,p,s===2?`asc`:`desc`,f,d):Ta(c,e,p,f,d,this.lookupCaches,m);return h===-1?r===void 0?Ki(e):[[r]]:u===`col`?l.map(e=>[e[h]]):[l[h]]},isExported:!0},oQ={description:A(`Get the value from a pivot.`),args:[z(`pivot_id (number,string)`,A(`ID of the pivot.`)),z(`measure_name (string)`,A(`Name of the measure.`)),z(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),z(`domain_value (number,string,boolean,repeating,optional)`,A(`Value.`))],compute:function(e,t,...n){let r=P(e),i=P(t),a=BZ(r,this.getters);VZ(a,i,this.getters),HZ(n);let o=this.getters.getPivot(a),s=this.getters.getPivotCoreDefinition(a);UZ(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)}},sQ={description:A(`Get the header of a pivot.`),args:[z(`pivot_id (number,string)`,A(`ID of the pivot.`)),z(`domain_field_name (string,repeating,optional)`,A(`Field name.`)),z(`domain_value (number,string,value,repeating,optional)`,A(`Value.`))],compute:function(e,...t){let n=P(e),r=BZ(n,this.getters);HZ(t);let i=this.getters.getPivot(r);UZ(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(P(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}}},cQ={description:A(`Get a pivot table.`),args:[z(`pivot_id (string)`,A(`ID of the pivot.`)),z(`row_count (number, optional)`,A(`number of rows`)),z(`include_total (boolean, default=TRUE)`,A(`Whether to include total/sub-totals or not.`)),z(`include_column_titles (boolean, default=TRUE)`,A(`Whether to include the column titles or not.`)),z(`column_count (number, optional)`,A(`number of columns`)),z(`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=BZ(P(e),this.getters),s=this.getters.getPivot(o),c=this.getters.getPivotCoreDefinition(o),l=nS(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.`));UZ(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(vg(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(qx(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}},lQ={description:A(`Returns a range reference shifted by a specified number of rows and columns from a starting cell reference.`),args:[z(`cell_reference (any, range<any>)`,A(`The starting point from which to count the offset rows and columns.`)),z(`offset_rows (number)`,A(`The number of rows to offset by.`)),z(`offset_columns (number)`,A(`The number of columns to offset by.`)),z(`height (number, default='height of cell_reference')`,A(`The number of rows of the range to return starting at the offset target.`)),z(`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 Li(Ji);let a=I(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 Li(Ji);let s=a[0].length,c=a.length;if(r){let e=N(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=N(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=N(t,this.locale),u=N(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 Li(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 Li:(d&&this.addDependencies?.(d,[g]),ma(c,s,(e,t)=>this.getFormulaResult({sheetId:h,col:f+e,row:p+t})))}},uQ={description:A(`Returns an element from a list of choices based on index.`),args:[z(`index (number)`,A(`Which choice to return.`)),z(`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(N(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},dQ={description:A(`Excludes a specified number of rows or columns from the start or end of an array.`),args:[z(`array (range)`,A(`The array from which to drop rows or columns`)),z(`rows (number)`,A(`The number of rows to drop. A negative value drops from the end of the array.`)),z(`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=N(t,this.locale),i=N(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},fQ={description:A(`Returns a specified number of contiguous rows or columns from the start or end of an array.`),args:[z(`array (range)`,A(`The array from which to take rows or columns.`)),z(`rows (number)`,A(`The number of rows to take. A negative value takes from the end of the array.`)),z(`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?N(t,this.locale):e[0].length,i=N(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},pQ={description:A(`Returns a formula as a string.`),args:[z(`cell_reference (any)`,A(`A reference to a cell.`))],compute:function(e){if(e?.position===void 0)return new Li(Ji);let t=this.getters.getCell(e.position);return t?.isFormula?t.compiledFormula.toFormulaString(this.getters):new Ri(A(`The cell does not contain a formula.`))},isExported:!0};var mQ=l({ADD:()=>hQ,CONCAT:()=>gQ,DIVIDE:()=>_Q,EQ:()=>xQ,GT:()=>CQ,GTE:()=>wQ,LT:()=>TQ,LTE:()=>EQ,MINUS:()=>DQ,MULTIPLY:()=>OQ,NE:()=>kQ,POW:()=>AQ,SPILLED_RANGE:()=>jQ,UMINUS:()=>MQ,UNARY_PERCENT:()=>NQ,UPLUS:()=>PQ});let hQ={description:A(`Sum of two numbers.`),args:[z(`value1 (number)`,A(`The first addend.`)),z(`value2 (number)`,A(`The second addend.`))],compute:function(e,t){return{value:N(e,this.locale)+N(t,this.locale),format:e?.format||t?.format}}},gQ={description:A(`Concatenation of two values.`),args:[z(`value1 (string)`,A(`The value to which value2 will be appended.`)),z(`value2 (string)`,A(`The value to append to value1.`))],compute:function(e,t){return P(e)+P(t)},isExported:!0},_Q={description:A(`One number divided by another.`),args:[z(`dividend (number)`,A(`The number to be divided.`)),z(`divisor (number)`,A(`The number to divide by.`))],compute:function(e,t){let n=N(t,this.locale);return n===0?new Vi(A(`The divisor must be different from zero.`)):{value:N(e,this.locale)/n,format:e?.format||t?.format}}};function vQ(e){return e===void 0||e.value===null}let yQ={number:0,string:``,boolean:!1};function bQ(e,t,n=2e-16){return Math.abs(e-t)<n}let xQ={description:A(`Equal.`),args:[z(`value1 (string, number, boolean)`,A(`The first value.`)),z(`value2 (string, number, boolean)`,A(`The value to test against value1 for equality.`))],compute:function(e,t){if(Gi(e?.value))return e;if(Gi(t?.value))return t;let n=vQ(e)?yQ[typeof t?.value]:e?.value,r=vQ(t)?yQ[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:bQ(n,r)}:{value:n===r}}};function SQ(e,t,n){if(Gi(e?.value))return e;if(Gi(t?.value))return t;let r=vQ(e)?yQ[typeof t?.value]:e?.value,i=vQ(t)?yQ[typeof e?.value]:t?.value;typeof r!=`number`&&(r=P(r).toUpperCase()),typeof i!=`number`&&(i=P(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 CQ={description:A(`Strictly greater than.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being greater than value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return SQ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?!bQ(e,t)&&e>t:e>t)}},wQ={description:A(`Greater than or equal to.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being greater than or equal to value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){return SQ(e,t,(e,t)=>typeof e==`number`&&typeof t==`number`?bQ(e,t)||e>t:e>=t)}},TQ={description:A(`Less than.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being less than value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=wQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},EQ={description:A(`Less than or equal to.`),args:[z(`value1 (number, string, boolean)`,A(`The value to test as being less than or equal to value2.`)),z(`value2 (number, string, boolean)`,A(`The second value.`))],compute:function(e,t){let n=CQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},DQ={description:A(`Difference of two numbers.`),args:[z(`value1 (number)`,A(`The minuend, or number to be subtracted from.`)),z(`value2 (number)`,A(`The subtrahend, or number to subtract from value1.`))],compute:function(e,t){return{value:N(e,this.locale)-N(t,this.locale),format:e?.format||t?.format}}},OQ={description:A(`Product of two numbers`),args:[z(`factor1 (number)`,A(`The first multiplicand.`)),z(`factor2 (number)`,A(`The second multiplicand.`))],compute:function(e,t){return{value:N(e,this.locale)*N(t,this.locale),format:e?.format||t?.format}}},kQ={description:A(`Not equal.`),args:[z(`value1 (string, number, boolean)`,A(`The first value.`)),z(`value2 (string, number, boolean)`,A(`The value to test against value1 for inequality.`))],compute:function(e,t){let n=xQ.compute.bind(this)(e,t);return Gi(n.value)?n:{value:!n.value}}},AQ={description:A(`A number raised to a power.`),args:[z(`base (number)`,A(`The number to raise to the exponent power.`)),z(`exponent (number)`,A(`The exponent to raise base to.`))],compute:function(e,t){return hK.compute.bind(this)(e,t)}},jQ={description:A(`Gets the spilled range of an array formula.`),args:[z(`ref (any, range<any>)`,A(`The reference to get the spilled range from.`))],compute:function(e){if(e===void 0)return new Li(Ji);let t=I(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(Gi(n.value))return n;if(n.position===void 0)return new Li(Ji);let r=this.__originCellPosition;r&&this.updateDependencies?.(r);let i=this.getters.getSpreadZone(n.position);if(i===void 0)return new Li;let a=this.getters.getRangeFromZone(this.__originSheetId,i);return r&&this.addDependencies?.(r,[a]),ma(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},MQ={description:A(`A number with the sign reversed.`),args:[z(`value (number)`,A(`The number to have its sign reversed. Equivalently, the number to multiply by -1.`))],compute:function(e){return{value:-N(e,this.locale),format:e?.format}}},NQ={description:A(`Value interpreted as a percentage.`),args:[z(`percentage (number)`,A(`The value to interpret as a percentage.`))],compute:function(e){return N(e,this.locale)/100}},PQ={description:A(`A specified number, unchanged.`),args:[z(`value (any)`,A(`The number to return.`))],compute:function(e={value:null}){return e}},$=e=>({transform:t=>t*e,inverseTransform:t=>t/e}),FQ={transform:e=>e,inverseTransform:e=>e},IQ=1e-10,LQ=.0254,RQ=LQ/72,zQ=.3048,BQ=.9144,VQ=1609.34,HQ=1852,UQ=946073047258e4,WQ={g:{...FQ,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:{...FQ,category:`distance`},km:{...$(1e3),category:`distance`},ang:{...$(IQ),category:`distance`},Picapt:{...$(RQ),category:`distance`},pica:{...$(LQ/6),category:`distance`},in:{...$(LQ),category:`distance`},ft:{...$(zQ),category:`distance`},yd:{...$(BQ),category:`distance`},ell:{...$(1.143),category:`distance`},mi:{...$(VQ),category:`distance`},survey_mi:{...$(1609.34),category:`distance`},Nmi:{...$(HQ),category:`distance`},ly:{...$(UQ),category:`distance`},parsec:{...$(0x6da012f95c9fd0),category:`distance`},sec:{...FQ,category:`time`},min:{...$(60),category:`time`},hr:{...$(3600),category:`time`},day:{...$(86400),category:`time`},yr:{...$(31556952),category:`time`},Pa:{...FQ,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:{...FQ,category:`force`},dyn:{...$(1e-5),category:`force`},pond:{...$(.00980665),category:`force`},lbf:{...$(4.44822),category:`force`},J:{...FQ,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:{...FQ,category:`power`},PS:{...$(735.499),category:`power`},HP:{...$(745.7),category:`power`},T:{...FQ,category:`magnetism`},ga:{...$(1e-4),category:`magnetism`},K:{...FQ,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":{...FQ,category:`volume`,order:3},"ang^3":{...$(IQ**3),category:`volume`,order:3},"Picapt^3":{...$(RQ**3),category:`volume`,order:3},tsp:{...$(492892e-11),category:`volume`},tspm:{...$(5e-6),category:`volume`},tbs:{...$(14786764825785619e-21),category:`volume`},"in^3":{...$(LQ**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":{...$(zQ**3),category:`volume`,order:3},bushel:{...$(.0352390704),category:`volume`},barrel:{...$(.158987295),category:`volume`},"yd^3":{...$(BQ**3),category:`volume`,order:3},MTON:{...$(1.13267386368),category:`volume`},GRT:{...$(2.83168),category:`volume`},"mi^3":{...$(VQ**3),category:`volume`,order:3},"Nmi^3":{...$(HQ**3),category:`volume`,order:3},"ly^3":{...$(UQ**3),category:`volume`,order:3},"m^2":{...FQ,category:`area`,order:2},"ang^2":{...$(IQ**2),category:`area`,order:2},"Picapt^2":{...$(RQ**2),category:`area`,order:2},"in^2":{...$(LQ**2),category:`area`,order:2},"ft^2":{...$(zQ**2),category:`area`,order:2},"yd^2":{...$(BQ**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":{...$(VQ**2),category:`area`,order:2},"Nmi^2":{...$(HQ**2),category:`area`,order:2},"ly^2":{...$(UQ**2),category:`area`,order:2},bit:{...FQ,category:`information`},byte:{...$(8),category:`information`},"m/s":{...FQ,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`}},GQ={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`},KQ={"":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},qQ={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`)},JQ=Object.entries(WQ).map(([e,t])=>({value:e,label:YQ(t.category)}));function YQ(e){return qQ[e]??``}function XQ(e){for(let[t,n]of Object.entries(KQ)){if(t&&!e.startsWith(t))continue;let r=e.slice(t.length),i=WQ[r];if(!i&&GQ[r]&&(i=WQ[GQ[r]]),i)return{...i,factor:i.order?n**+i.order:n}}}var ZQ=l({CONVERT:()=>QQ});let QQ={description:A(`Converts a numeric value to a different unit of measure.`),args:[z(`value (number)`,A(`the numeric value in start_unit to convert to end_unit`)),z(`start_unit (string)`,A(`The starting unit, the unit currently assigned to value`),JQ),z(`end_unit (string)`,A(`The unit of measure into which to convert value`),JQ)],compute:function(e,t,n){let r=N(e,this.locale),i=P(t),a=P(n),o=XQ(i),s=XQ(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')`,YQ(o.category),YQ(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 $Q=l({CHAR:()=>r$,CLEAN:()=>i$,CONCATENATE:()=>a$,EXACT:()=>o$,FIND:()=>s$,FORMAT_LARGE_NUMBER:()=>c$,JOIN:()=>l$,LEFT:()=>u$,LEN:()=>d$,LOWER:()=>f$,MID:()=>p$,PROPER:()=>m$,REGEXEXTRACT:()=>g$,REGEXREPLACE:()=>_$,REGEXTEST:()=>h$,REPLACE:()=>v$,RIGHT:()=>y$,SEARCH:()=>b$,SPLIT:()=>x$,SUBSTITUTE:()=>S$,TEXT:()=>D$,TEXTAFTER:()=>k$,TEXTBEFORE:()=>A$,TEXTJOIN:()=>C$,TEXTSPLIT:()=>w$,TRIM:()=>T$,UPPER:()=>E$,VALUE:()=>O$});let e$=/[A-Za-zÀ-ÖØ-öø-ÿ]+/g,t$=[{value:0,label:A(`Case-sensitive (default)`)},{value:1,label:A(`Case-insensitive`)}],n$=[{value:0,label:A(`Don't match to end (default)`)},{value:1,label:A(`Match to end`)}],r$={description:A(`Gets character associated with number.`),args:[z(`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(N(e,this.locale));return t<1?new M(A(`The table_number (%s) is out of range.`,t)):String.fromCharCode(t)},isExported:!0},i$={description:A(`Remove non-printable characters from a piece of text.`),args:[z(`text (string)`,A(`The text whose non-printable characters are to be removed.`))],compute:function(e){let t=P(e),n=``;for(let e of t)e&&e.charCodeAt(0)>31&&(n+=e);return n},isExported:!0},a$={description:A(`Appends strings to one another.`),args:[z(`string (string, range<string>, repeating)`,A(`String to append in sequence.`))],compute:function(...e){return da(e,(e,t)=>e+P(t),``)},isExported:!0},o$={description:A(`Tests whether two strings are identical.`),args:[z(`string1 (string)`,A(`The first string to compare.`)),z(`string2 (string)`,A(`The second string to compare.`))],compute:function(e,t){return P(e)===P(t)},isExported:!0},s$={description:A(`First position of string found in text, case-sensitive.`),args:[z(`search_for (string)`,A(`The string to look for within text_to_search.`)),z(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),z(`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=P(e),i=P(t),a=N(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},c$={description:A(`Apply a large number format`),args:[z(`value (number)`,A(`The number.`)),z(`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:N(e,this.locale),format:zo(e,t,this.locale)}}},l$={description:A(`Concatenates elements of arrays with delimiter.`),args:[z(`delimiter (string)`,A(`The character or string to place between each concatenated value.`)),z(`value_or_array (string, range<string>, repeating)`,A(`Value to be appended using delimiter.`))],compute:function(e,...t){let n=P(e);return da(t,(e,t)=>(e?e+n:``)+P(t),``)}},u$={description:A(`Substring from beginning of specified string.`),args:[z(`text (string)`,A(`The string from which the left portion will be returned.`)),z(`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?N(t[0],this.locale):1;return n<0?new M(A(`The number_of_characters (%s) must be positive or null.`,n)):P(e).substring(0,n)},isExported:!0},d$={description:A(`Length of a string.`),args:[z(`text (string)`,A(`The string whose length will be returned.`))],compute:function(e){return P(e).length},isExported:!0},f$={description:A(`Converts a specified string to lowercase.`),args:[z(`text (string)`,A(`The string to convert to lowercase.`))],compute:function(e){return P(e).toLowerCase()},isExported:!0},p$={description:A(`A segment of a string.`),args:[z(`text (string)`,A(`The string to extract a segment from.`)),z(`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.`)),z(`extract_length (number)`,A(`The length of the segment to extract.`))],compute:function(e,t,n){let r=P(e),i=N(t,this.locale),a=N(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},m$={description:A(`Capitalizes each word in a specified string.`),args:[z(`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 P(e).replace(e$,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())},isExported:!0},h$={description:A(`Checks whether a string matches the supplied regular expression.`),args:[z(`text (string)`,A(`The string to test.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`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=P(e),i=P(t),a=N(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},g$={description:A(`Extract text from a string based on the supplied regular expression.`),args:[z(`text (string)`,A(`The string on which you want to extract text.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`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`)}]),z(`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=P(e),a=P(t),o=N(n,this.locale),s=N(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},_$={description:A(`Replace text in a string based on the supplied regular expression.`),args:[z(`text (string)`,A(`The string in which you want to replace text.`)),z(`pattern (string)`,A(`The regular expression pattern to match against the text.`)),z(`replacement (string)`,A(`The text to use as the replacement.`)),z(`occurrence (number, default=0)`,A(`0 = replace all matches. A negative number counts from the end.`)),z(`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=P(e),o=P(t),s=P(n),c=N(r,this.locale),l=N(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},v$={description:A(`Replaces part of a text string with different text.`),args:[z(`text (string)`,A(`The text, a part of which will be replaced.`)),z(`position (number)`,A(`The position where the replacement will begin (starting from 1).`)),z(`length (number)`,A(`The number of characters in the text to be replaced.`)),z(`new_text (string)`,A(`The text which will be inserted into the original text.`))],compute:function(e,t,n,r){let i=N(t,this.locale);if(i<1)return new M(A(`The position (%s) must be greater than or equal to 1.`,i));let a=P(e),o=N(n,this.locale),s=P(r);return a.substring(0,i-1)+s+a.substring(i-1+o)},isExported:!0},y$={description:A(`A substring from the end of a specified string.`),args:[z(`text (string)`,A(`The string from which the right portion will be returned.`)),z(`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?N(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=P(e),i=r.length;return r.substring(i-n,i)},isExported:!0},b$={description:A(`First position of string found in text, ignoring case.`),args:[z(`search_for (string)`,A(`The string to look for within text_to_search.`)),z(`text_to_search (string)`,A(`The text to search for the first occurrence of search_for.`)),z(`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=P(e).toLowerCase(),i=P(t).toLowerCase(),a=N(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},x$={description:A(`Split text by specific character delimiter(s).`),args:[z(`text (string)`,A(`The text to divide.`)),z(`delimiter (string)`,A(`The character or characters to use to split text.`)),z(`split_by_each (boolean, default=true})`,A(`Whether or not to divide text around each character contained in delimiter.`)),z(`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=P(e),a=qe(P(t)),o=F(n),s=F(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!==``)),_a([l])},isExported:!1},S$={description:A(`Replaces existing text with new text in a string.`),args:[z(`text_to_search (string)`,A(`The text within which to search and replace.`)),z(`search_for (string)`,A(`The string to search for within text_to_search.`)),z(`replace_with (string)`,A(`The string that will replace search_for.`)),z(`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=N(r,this.locale);if(i<0)return new M(A(`The occurrenceNumber (%s) must be positive or null.`,i));let a=P(e),o=P(t);if(o===``)return a;let s=P(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},C$={description:A(`Combines text from multiple strings and/or arrays.`),args:[z(`delimiter (string)`,A(`A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.`)),z(`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)`)}]),z(`texts (string, range<string>, repeating)`,A(`Text item to join.`))],compute:function(e,t={value:!0},...n){let r=P(e),i=F(t),a=0;return da(n,(e,t)=>i&&P(t)===``?e:(a++?e+r:``)+P(t),``)},isExported:!0},w$={description:A(`Splits text into rows or columns using specified column and row delimiters.`),args:[z(`text (string)`,A(`The text to split.`)),z(`col_delimiter (string, range<string>)`,A(`Character or string to split columns by.`)),z(`row_delimiter (string, range<string>, optional)`,A(`Character or string to split rows by.`)),z(`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`)}]),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`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 Ri){let o=P(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=I(t).flat().map(e=>qe(P(e))),c=I(n).flat().map(e=>qe(P(e)));if(s.some(e=>e===``)||c.some(e=>e===``))return new M(A(`The delimiters cannot be empty values.`));let l=F(r),u=N(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 _a(d)},isExported:!0},T$={description:A(`Removes space characters.`),args:[z(`text (string)`,A(`The text or reference to a cell containing text to be trimmed.`))],compute:function(e){return Pt(P(e))},isExported:!0},E$={description:A(`Converts a specified string to uppercase.`),args:[z(`text (string)`,A(`The string to convert to uppercase.`))],compute:function(e){return P(e).toUpperCase()},isExported:!0},D$={description:A(`Converts a number to text according to a specified format.`),args:[z(`number (number)`,A(`The number, date or time to format.`)),z(`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 R(N(e,this.locale),{format:P(t),locale:this.locale})},isExported:!0},O$={description:A(`Converts a string to a numeric value.`),args:[z(`value (number)`,A(`the string to be converted`))],compute:function(e){return N(e,this.locale)},isExported:!0},k$={description:A(`Returns text that occurs after a given substring or delimiter.`),args:[z(`text (string)`,A(`The source text.`)),z(`delimiter (string)`,A(`The substring after which text will be returned.`)),z(`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.`)),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`match_end (number, default=0))`,A(`Whether to treat the end of text as a delimiter.`),n$),z(`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 Ri){let o=P(e),s=N(n,this.locale),c=N(r,this.locale),l=N(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=P(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:[z(`text (string)`,A(`The source text.`)),z(`delimiter (string)`,A(`The substring after which text will be returned.`)),z(`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.`)),z(`match_mode (number, default=0)`,A(`Searches the text for a delimiter match. By default, a case-sensitive match is done.`),t$),z(`match_end (number, default=0))`,A(`Whether to match a delimiter against the end of the text.`),n$),z(`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 Ri){let o=P(e),s=N(n,this.locale),c=N(r,this.locale),l=N(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=P(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 j$=l({HYPERLINK:()=>M$});let M$={description:A(`Creates a hyperlink in a cell.`),args:[z(`url (string)`,A(`The full URL of the link enclosed in quotation marks.`)),z(`link_label (string, optional)`,A(`The text to display in the cell, enclosed in quotation marks.`))],compute:function(e,t){let n=P(e).trim(),r=P(t)||n;return n===``?r:ot(r,n)},isExported:!0},N$=[{name:A(`Array`),functions:YW},{name:A(`Database`),functions:eJ},{name:A(`Date`),functions:gY},{name:A(`Filter`),functions:eX},{name:A(`Financial`),functions:oX},{name:A(`Info`),functions:hZ},{name:A(`Lookup`),functions:WZ},{name:A(`Logical`),functions:OZ},{name:A(`Math`),functions:TG},{name:A(`Operator`),functions:mQ},{name:A(`Statistical`),functions:VK},{name:A(`Text`),functions:$Q},{name:A(`Engineering`),functions:QY},{name:A(`Web`),functions:j$},{name:A(`Parser`),functions:ZQ}];for(let e of N$){let t=e.functions;for(let n in t){let r=t[n];r.category=r.category||e.name,n=n.replace(/_/g,`.`),_s.add(n,{isExported:!1,...r})}}let P$={},F$={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},I$={autoCompleteProviders:vO,autofillModifiersRegistry:tR,autofillRulesRegistry:nR,cellMenuRegistry:VP,colMenuRegistry:nF,errorTypes:Pi,functionRegistry:_s,featurePluginRegistry:eB,iconsOnCellRegistry:FL,statefulUIPluginRegistry:tB,coreViewsPluginRegistry:nB,corePluginRegistry:$z,rowMenuRegistry:lF,sidePanelRegistry:sN,figureRegistry:rg,chartSidePanelComponentRegistry:WO,chartDataSourceSidePanelComponentRegistry:Zw,chartComponentRegistry:Ah,chartTypeRegistry:ny,chartSubtypeRegistry:hh,chartDataSourceRegistry:ty,topbarMenuRegistry:OB,topbarComponentRegistry:qB,clickableCellRegistry:rB,otRegistry:ER,inverseCommandRegistry:oB,urlRegistry:ql,cellPopoverRegistry:LS,numberFormatMenuRegistry:wB,repeatLocalCommandTransformRegistry:wz,repeatCommandTransformRegistry:Cz,clipboardHandlersRegistries:eI,pivotRegistry:eM,pivotTimeAdapterRegistry:fx,pivotSidePanelRegistry:mM,pivotNormalizationValueRegistry:Wx,supportedPivotPositionalFormulaRegistry:MI,pivotToFunctionValueRegistry:Gx,migrationStepRegistry:lS,chartJsExtensionRegistry:gr},L$={arg:z,isEvaluationError:Gi,toBoolean:F,toJsDate:aa,toNumber:N,toString:P,toNormalizedPivotValue:Bx,toFunctionPivotValue:Hx,toXC:E,toZone:hn,toUnboundedZone:mn,toCartesian:nn,numberToLetters:qt,lettersToNumber:Jt,UuidGenerator:G,formatValue:R,createCurrencyFormat:Mo,ColorGenerator:Fd,computeTextWidth:wu,createEmptyWorkbookData:kS,createEmptySheet:OS,createEmptyExcelSheet:AS,doesCellContainFunction:Gt,rgbaToHex:sd,colorToRGBA:cd,positionToZone:D,isDefined:w,isMatrix:Ue,lazy:_t,genericRepeat:KB,createAction:h,createActions:p,transformRangeData:ir,deepEquals:T,overlap:kn,union:Tn,isInside:jn,deepCopy:x,expandZoneOnInsertion:xn,reduceZoneOnDeletion:wn,unquote:Xe,getMaxObjectId:Mx,getFirstPivotFunction:aM,getNumberOfPivotFunctions:oM,parseDimension:Fx,isDateOrDatetimeField:Ix,makeFieldProposal:sM,periodYearToComparable:dx,insertTokenAfterArgSeparator:lM,insertTokenAfterLeftParenthesis:uM,mergeContiguousZones:tr,getPivotHighlights:oj,pivotTimeAdapter:px,UNDO_REDO_PIVOT_COMMANDS:QL,createPivotFormula:zx,areDomainArgsFieldsValid:Rx,splitReference:As,sanitizeSheetName:Qe,getUniqueText:Ht,isNumber:Si,isDateTime:Wr,createCustomFields:Zx,schemeToColorScale:oS,isDateTimeFormat:To,jsDateToNumber:ii,numberToJsDate:ni,DateTime:k,parseFormat:Ja,isFormula:Ut,domainToColRowDomain:wj,collapseHierarchicalDisplayName:rS},R$={isMarkdownLink:it,parseMarkdownLink:st,markdownLink:ot,openLink:Ql,urlRepresentation:Zl},z$={Checkbox:Qw,Section:Z,Select:Qh,RoundColorPicker:TT,ChartDataSeries:uT,ChartErrorSection:mT,ChartLabelRange:dT,ChartRangeDataSourceComponent:kD,ChartTitle:ST,ChartPanel:JO,ChartFigure:tg,ChartJsComponent:Vp,ClickableCellSortIcon:NI,ZoomableChartJsComponent:Sh,Grid:jI,GridOverlay:oI,ScorecardChart:Pm,GaugeChartComponent:Oh,LineConfigPanel:kO,BarConfigPanel:gT,PieChartDesignPanel:MO,GenericChartConfigPanel:hT,ChartWithAxisDesignPanel:MT,GenericZoomableChartDesignPanel:NT,LineChartDesignPanel:AO,GaugeChartConfigPanel:qD,GaugeChartDesignPanel:wO,ScorecardChartConfigPanel:FO,ScorecardChartDesignPanel:IO,GeoChartDesignPanel:DO,RadarChartDesignPanel:NO,WaterfallChartDesignPanel:UO,ComboChartDesignPanel:WD,FunnelChartDesignPanel:KD,SunburstChartDesignPanel:LO,TreeMapChartDesignPanel:HO,ChartTypePicker:KO,FigureComponent:ig,MenuPopover:Zh,Popover:qh,SelectionInput:lT,ValidationMessages:pT,AddDimensionButton:dj,PivotDimensionGranularity:pj,PivotDimensionOrder:mj,PivotDimension:fj,PivotLayoutConfigurator:vj,PivotHTMLRenderer:FI,PivotDeferUpdate:cj,PivotTitleSection:yj,CogWheelMenu:Yw,TextInput:Hw,SidePanelCollapsible:vT,RadioSelection:wT,GeoChartRegionSelectSection:TO,ChartDashboardMenu:$h,FullScreenFigure:PI,NumberInput:yT,TopBar:YV,Composer:iO},B$={useDragAndDropListItems:Fw,useHighlights:QO,useHighlightsOnHover:ZO},V$={useStoreProvider:Cr,DependencyContainer:xr,CellPopoverStore:RS,ComposerFocusStore:mr,CellComposerStore:BF,FindAndReplaceStore:Bk,HighlightStore:oT,DelayedHoveredCellStore:ag,HoveredTableStore:rI,ModelStore:sr,NotificationStore:yO,RendererStore:dr,SelectionInputStore:cT,SpreadsheetStore:fr,useStore:O,useLocalStore:wr,SidePanelStore:lN,PivotSidePanelStore:fM,PivotMeasureDisplayPanelStore:ij,ClientFocusStore:dF,GridRenderer:mI};function H$(e,t){return _s.add(e,t),{addFunction:(e,t)=>H$(e,t)}}let U$={DEFAULT_LOCALE:L,HIGHLIGHT_COLOR:ee,PIVOT_STATIC_TABLE_CONFIG:Fe,PIVOT_INSERT_TABLE_STYLE_ID:Ie,ChartTerms:lg,FIGURE_ID_SPLITTER:`??`,GRID_ICON_EDGE_LENGTH:17,GRID_ICON_MARGIN:2,CHART_TYPES:aS},W$={...OD,...II};e.AbstractCellClipboardHandler=mz,e.AbstractChart=Hp,e.AbstractFigureClipboardHandler=sW,e.BadExpressionError=Fi,e.CHART_TYPES=aS,e.CellErrorType=j,e.CellValueType=V,e.CircularDependencyError=Ii,e.ClientDisconnectedError=cz,e.ClipboardMIMEType=zS,e.CommandResult=H,e.CompiledFormula=bl,e.CorePlugin=Bg,e.CoreViewPlugin=fN,e.DEFAULT_LOCALE=L,e.DEFAULT_LOCALES=Na,e.DEFAULT_LOCALE_DIGIT_GROUPING=`[3,0]`,e.DIRECTION=We,e.DispatchResult=Wl,e.DivisionByZeroError=Vi,e.EvaluationError=M,e.InvalidReferenceError=Li,e.LocalTransportService=JB,e.Model=iW,e.NEXT_VALUE=sg,e.NotAvailableError=Ri,e.NumberTooLargeError=Hi,e.OrderedLayers=lr,e.PREVIOUS_VALUE=og,e.PivotRuntimeDefinition=bj,e.Registry=B,e.Revision=sz,e.SPREADSHEET_DIMENSIONS=F$,e.SplillBlockedError=Bi,e.Spreadsheet=QV,e.SpreadsheetPivotTable=Vj,e.UIPlugin=pR,e.UnknownFunctionError=zi,e.__info__=P$,e.addFunction=H$,e.addRenderingLayer=ur,e.astToFormula=IF,e.availableConditionalFormatOperators=wk,e.availableDataValidationOperators=Ik,e.availableFiltersOperators=yW,e.borderStyles=He,e.canExecuteInReadonly=Ul,e.categories=N$,e.chartHelpers=W$,e.components=z$,e.constants=U$,e.convertAstNodes=Ec,e.coreTypes=Vl,e.createAutocompleteArgumentsProvider=jW,e.errorTypes=Pi,e.filterDateCriterionOperators=SW,e.filterNumberCriterionOperators=xW,e.filterTextCriterionOperators=bW,e.findCellInNewZone=Hn,e.functionCache=vl,e.getCaretDownSvg=av,e.getCaretUpSvg=ov,e.helpers=L$,e.hooks=B$,e.invalidSubtotalFormulasCommands=Rl,e.invalidateBordersCommands=Ll,e.invalidateCFEvaluationCommands=Il,e.invalidateChartEvaluationCommands=Pl,e.invalidateDependenciesCommands=Fl,e.invalidateEvaluationCommands=Nl,e.isCoreCommand=Hl,e.isHeadersDependant=Ol,e.isMatrix=Ue,e.isPositionDependent=jl,e.isRangeDependant=Al,e.isSheetDependent=Dl,e.isTargetDependent=kl,e.isZoneDependent=Ml,e.iterateAstNodes=Dc,e.links=R$,e.load=mS,e.lockedSheetAllowedCommands=Bl,e.parse=wc,e.parseTokens=Tc,e.readonlyAllowedCommands=zl,e.registries=I$,e.schemeToColorScale=oS,e.setDefaultSheetViewSize=Ne,e.setTranslationMethod=ji,e.stores=V$,e.tokenColors=Ve,e.tokenize=Hs,P$.version=`19.4.0-alpha.5`,P$.date=`2026-05-12T12:20:57.205Z`,P$.hash=`02a5f91`})(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|