@odoo/o-spreadsheet 16.1.4 → 16.1.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.
|
@@ -3106,7 +3106,7 @@ class ScorecardChart$1 extends owl.Component {
|
|
|
3106
3106
|
return this.runtime.fontColor;
|
|
3107
3107
|
}
|
|
3108
3108
|
get secondaryFontColor() {
|
|
3109
|
-
return relativeLuminance(this.
|
|
3109
|
+
return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
|
|
3110
3110
|
}
|
|
3111
3111
|
get figure() {
|
|
3112
3112
|
return this.props.figure;
|
|
@@ -43911,6 +43911,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
43911
43911
|
exports.tokenize = tokenize;
|
|
43912
43912
|
|
|
43913
43913
|
|
|
43914
|
-
__info__.version = '16.1.
|
|
43915
|
-
__info__.date = '2023-03-
|
|
43916
|
-
__info__.hash = '
|
|
43914
|
+
__info__.version = '16.1.5';
|
|
43915
|
+
__info__.date = '2023-03-16T12:12:08.747Z';
|
|
43916
|
+
__info__.hash = '12f7a8e';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -5310,7 +5310,7 @@ declare class ScorecardChart extends Component<Props$p, SpreadsheetChildEnv> {
|
|
|
5310
5310
|
get baselineArrowDirection(): BaselineArrowDirection;
|
|
5311
5311
|
get backgroundColor(): string;
|
|
5312
5312
|
get primaryFontColor(): string;
|
|
5313
|
-
get secondaryFontColor(): "#
|
|
5313
|
+
get secondaryFontColor(): "#525252" | "#C8C8C8";
|
|
5314
5314
|
get figure(): Figure;
|
|
5315
5315
|
get chartStyle(): string;
|
|
5316
5316
|
get chartContentStyle(): string;
|
|
@@ -3102,7 +3102,7 @@ class ScorecardChart$1 extends Component {
|
|
|
3102
3102
|
return this.runtime.fontColor;
|
|
3103
3103
|
}
|
|
3104
3104
|
get secondaryFontColor() {
|
|
3105
|
-
return relativeLuminance(this.
|
|
3105
|
+
return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
|
|
3106
3106
|
}
|
|
3107
3107
|
get figure() {
|
|
3108
3108
|
return this.props.figure;
|
|
@@ -43879,6 +43879,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43879
43879
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43880
43880
|
|
|
43881
43881
|
|
|
43882
|
-
__info__.version = '16.1.
|
|
43883
|
-
__info__.date = '2023-03-
|
|
43884
|
-
__info__.hash = '
|
|
43882
|
+
__info__.version = '16.1.5';
|
|
43883
|
+
__info__.date = '2023-03-16T12:12:08.747Z';
|
|
43884
|
+
__info__.hash = '12f7a8e';
|
|
@@ -3103,7 +3103,7 @@
|
|
|
3103
3103
|
return this.runtime.fontColor;
|
|
3104
3104
|
}
|
|
3105
3105
|
get secondaryFontColor() {
|
|
3106
|
-
return relativeLuminance(this.
|
|
3106
|
+
return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
|
|
3107
3107
|
}
|
|
3108
3108
|
get figure() {
|
|
3109
3109
|
return this.props.figure;
|
|
@@ -43910,9 +43910,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43910
43910
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43911
43911
|
|
|
43912
43912
|
|
|
43913
|
-
__info__.version = '16.1.
|
|
43914
|
-
__info__.date = '2023-03-
|
|
43915
|
-
__info__.hash = '
|
|
43913
|
+
__info__.version = '16.1.5';
|
|
43914
|
+
__info__.date = '2023-03-16T12:12:08.747Z';
|
|
43915
|
+
__info__.hash = '12f7a8e';
|
|
43916
43916
|
|
|
43917
43917
|
|
|
43918
43918
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
`;class ri extends t.Component{constructor(){super(...arguments),this.ctx=document.createElement("canvas").getContext("2d")}get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){const e=this.runtime.baselineDescr||"";return this.baseline&&e?" "+e:e}get baselineArrowDirection(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get primaryFontColor(){return this.runtime.fontColor}get secondaryFontColor(){return pt(this.primaryFontColor)<=.3?"#757575":"#bbbbbb"}get figure(){return this.props.figure}get chartStyle(){return`\n padding:${this.chartPadding}px;\n background:${this.backgroundColor};\n `}get chartContentStyle(){return`\n height:${this.getDrawableHeight()}px;\n `}get chartPadding(){return.02*this.props.figure.width}getTextStyles(){const e=.96*this.props.figure.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let i=function(e,t,o,i=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let r=(n+t)/2,s=o(r),a=0;for(;Math.abs(s-e)>i&&a<20;)s>=e?t=(n+t)/2:n=(n+t)/2,r=(n+t)/2,s=o(r),a++;return r}(e,o,(e=>t.getElementWidth(e,this.ctx,this)))/o;const n=(new ai).getElementMaxFontSize(this.getDrawableHeight(),this)*i,r=(new si).getElementMaxFontSize(this.getDrawableHeight(),this)*i;return{titleStyle:this.getTextStyle({fontSize:18,color:this.secondaryFontColor}),keyStyle:this.getTextStyle({fontSize:n,cellStyle:this.runtime.keyValueStyle,color:this.primaryFontColor}),baselineStyle:this.getTextStyle({fontSize:r}),baselineValueStyle:this.getTextStyle({fontSize:r,cellStyle:this.runtime.baselineStyle,color:this.runtime.baselineColor||this.secondaryFontColor}),baselineDescrStyle:this.getTextStyle({fontSize:.9*r,color:this.secondaryFontColor})}}getTextStyle(e){const t=oi(e.cellStyle);return t["font-size"]=`${e.fontSize}px`,t.display="inline-block",!t.color&&e.color&&(t.color=e.color),ii(t)}getDrawableHeight(){const e=2*this.chartPadding;let t=this.props.figure.height-e;return t-=this.title?18*ni:0,t}getWidestElement(){const e=new si,t=new ai;return e.getElementWidth(.35,this.ctx,this)>t.getElementWidth(.65,this.ctx,this)?e:t}}ri.template="o-spreadsheet-ScorecardChart";class si{getElementWidth(e,t,o){if(!o.runtime)return 0;const i=o.baseline,n="neutral"!==o.baselineArrowDirection?"A "+i:i;t.font=`${e}px ${G}`;let r=t.measureText(n).width;return t.font=`${.9*e}px ${G}`,r+=t.measureText(o.baselineDescr).width,r}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/ni}}class ai{getElementWidth(e,t,o){if(!o.runtime)return 0;const i=o.keyValue||"";return t.font=`${e}px ${G}`,t.measureText(i).width}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/ni}}function li(e){return 8===(e=ht(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}ri.props={figure:Object};class ci{constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?No(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?Ao(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}var di,ui;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(di||(di={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(ui||(ui={}));const gi=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","DELETE_CELL","INSERT_CELL","UNDO","REDO"]),pi=new Set([...gi,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","MOVE_CONDITIONAL_FORMAT"]),fi=new Set(["START","ACTIVATE_SHEET","COPY","PREPARE_SELECTION_INPUT_EXPANSION","STOP_SELECTION_INPUT","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","REFRESH_SEARCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),mi=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","MOVE_CONDITIONAL_FORMAT","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE"]);function vi(e){return mi.has(e.type)}class bi{constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>0!==e))}static get Success(){return new bi}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}var Si,Ci,Ei;function wi(e,t,o,i){let n=!1;const r=[];for(let i in o){let s=o[i];if(s.labelCell){const e=Ii(s.labelCell,t);s.labelCell!==e&&(n=!0,s={...s,labelCell:e})}const a=Ii(s.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===X?(n=!0,s=void 0):a!==s.dataRange&&(n=!0,s={...s,dataRange:a}),r[i]=s}let s=i;const a=Ii(s,t);a!==s&&(n=!0,s=a);return{isStale:n,dataSets:r.filter(Qe),labelRange:s}}function yi(e,t,o){return o.map((o=>({dataRange:Co(e,t,o.dataRange),labelCell:o.labelCell?Co(e,t,o.labelCell):void 0})))}function xi(e,t,o){return o?Co(e,t,o):void 0}function Ii(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function Ri(e,t,o,i){const n=[];for(const r of t){const t=e.getRangeFromSheetXC(o,r),{unboundedZone:s,sheetId:a,invalidSheetName:l}=t;if(!l)if(s.left!==s.right&&s.top!==s.bottom){if(void 0===s.right)continue;for(let t=s.left;t<=s.right;t++){const o={...s,left:t,right:t};n.push(Ti(e,a,o,i?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else s.left===s.right&&s.top===s.bottom?i||n.push(Ti(e,a,s,void 0)):n.push(Ti(e,a,s,i?{top:s.top,bottom:s.top,left:s.left,right:s.left}:void 0))}return n}function Ti(e,t,o,i){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${To(o)}`);if(i){const n=To(o),r=To(i);return{labelCell:e.getRangeFromSheetXC(t,r),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,To(o))}}function Ai(e,t){var o;const i=null===(o=t.labelCell)||void 0===o?void 0:o.zone;let n=t.dataRange.zone;if(i){const{height:e,width:t}=Vo(n);1===e?n={...n,left:n.left+1}:1===t&&(n={...n,top:n.top+1})}const r=t.dataRange.clone({zone:n});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference"):void 0,range:e.getRangeString(r,"forceSheetReference")}}function Oi(e,t){let o;if(e.labelRange){const i=hi(xo(e.labelRange),t);o=i?To(i):void 0}const i=e.dataSets.map(xo).map((e=>hi(e,t))).filter(Qe).map(To);return{...e,labelRange:o,dataSets:i}}e.CommandResult=void 0,(Si=e.CommandResult||(e.CommandResult={}))[Si.Success=0]="Success",Si[Si.CancelledForUnknownReason=1]="CancelledForUnknownReason",Si[Si.WillRemoveExistingMerge=2]="WillRemoveExistingMerge",Si[Si.MergeIsDestructive=3]="MergeIsDestructive",Si[Si.CellIsMerged=4]="CellIsMerged",Si[Si.InvalidTarget=5]="InvalidTarget",Si[Si.EmptyUndoStack=6]="EmptyUndoStack",Si[Si.EmptyRedoStack=7]="EmptyRedoStack",Si[Si.NotEnoughElements=8]="NotEnoughElements",Si[Si.NotEnoughSheets=9]="NotEnoughSheets",Si[Si.MissingSheetName=10]="MissingSheetName",Si[Si.DuplicatedSheetName=11]="DuplicatedSheetName",Si[Si.DuplicatedSheetId=12]="DuplicatedSheetId",Si[Si.ForbiddenCharactersInSheetName=13]="ForbiddenCharactersInSheetName",Si[Si.WrongSheetMove=14]="WrongSheetMove",Si[Si.WrongSheetPosition=15]="WrongSheetPosition",Si[Si.InvalidAnchorZone=16]="InvalidAnchorZone",Si[Si.SelectionOutOfBound=17]="SelectionOutOfBound",Si[Si.TargetOutOfSheet=18]="TargetOutOfSheet",Si[Si.WrongCutSelection=19]="WrongCutSelection",Si[Si.WrongPasteSelection=20]="WrongPasteSelection",Si[Si.WrongPasteOption=21]="WrongPasteOption",Si[Si.WrongFigurePasteOption=22]="WrongFigurePasteOption",Si[Si.EmptyClipboard=23]="EmptyClipboard",Si[Si.EmptyRange=24]="EmptyRange",Si[Si.InvalidRange=25]="InvalidRange",Si[Si.InvalidZones=26]="InvalidZones",Si[Si.InvalidSheetId=27]="InvalidSheetId",Si[Si.InvalidFigureId=28]="InvalidFigureId",Si[Si.InputAlreadyFocused=29]="InputAlreadyFocused",Si[Si.MaximumRangesReached=30]="MaximumRangesReached",Si[Si.InvalidChartDefinition=31]="InvalidChartDefinition",Si[Si.InvalidDataSet=32]="InvalidDataSet",Si[Si.InvalidLabelRange=33]="InvalidLabelRange",Si[Si.InvalidScorecardKeyValue=34]="InvalidScorecardKeyValue",Si[Si.InvalidScorecardBaseline=35]="InvalidScorecardBaseline",Si[Si.InvalidGaugeDataRange=36]="InvalidGaugeDataRange",Si[Si.EmptyGaugeRangeMin=37]="EmptyGaugeRangeMin",Si[Si.GaugeRangeMinNaN=38]="GaugeRangeMinNaN",Si[Si.EmptyGaugeRangeMax=39]="EmptyGaugeRangeMax",Si[Si.GaugeRangeMaxNaN=40]="GaugeRangeMaxNaN",Si[Si.GaugeRangeMinBiggerThanRangeMax=41]="GaugeRangeMinBiggerThanRangeMax",Si[Si.GaugeLowerInflectionPointNaN=42]="GaugeLowerInflectionPointNaN",Si[Si.GaugeUpperInflectionPointNaN=43]="GaugeUpperInflectionPointNaN",Si[Si.GaugeLowerBiggerThanUpper=44]="GaugeLowerBiggerThanUpper",Si[Si.InvalidAutofillSelection=45]="InvalidAutofillSelection",Si[Si.WrongComposerSelection=46]="WrongComposerSelection",Si[Si.MinBiggerThanMax=47]="MinBiggerThanMax",Si[Si.LowerBiggerThanUpper=48]="LowerBiggerThanUpper",Si[Si.MidBiggerThanMax=49]="MidBiggerThanMax",Si[Si.MinBiggerThanMid=50]="MinBiggerThanMid",Si[Si.FirstArgMissing=51]="FirstArgMissing",Si[Si.SecondArgMissing=52]="SecondArgMissing",Si[Si.MinNaN=53]="MinNaN",Si[Si.MidNaN=54]="MidNaN",Si[Si.MaxNaN=55]="MaxNaN",Si[Si.ValueUpperInflectionNaN=56]="ValueUpperInflectionNaN",Si[Si.ValueLowerInflectionNaN=57]="ValueLowerInflectionNaN",Si[Si.MinInvalidFormula=58]="MinInvalidFormula",Si[Si.MidInvalidFormula=59]="MidInvalidFormula",Si[Si.MaxInvalidFormula=60]="MaxInvalidFormula",Si[Si.ValueUpperInvalidFormula=61]="ValueUpperInvalidFormula",Si[Si.ValueLowerInvalidFormula=62]="ValueLowerInvalidFormula",Si[Si.InvalidSortZone=63]="InvalidSortZone",Si[Si.WaitingSessionConfirmation=64]="WaitingSessionConfirmation",Si[Si.MergeOverlap=65]="MergeOverlap",Si[Si.TooManyHiddenElements=66]="TooManyHiddenElements",Si[Si.Readonly=67]="Readonly",Si[Si.InvalidViewportSize=68]="InvalidViewportSize",Si[Si.InvalidScrollingDirection=69]="InvalidScrollingDirection",Si[Si.FigureDoesNotExist=70]="FigureDoesNotExist",Si[Si.InvalidConditionalFormatId=71]="InvalidConditionalFormatId",Si[Si.InvalidCellPopover=72]="InvalidCellPopover",Si[Si.EmptyTarget=73]="EmptyTarget",Si[Si.InvalidFreezeQuantity=74]="InvalidFreezeQuantity",Si[Si.FrozenPaneOverlap=75]="FrozenPaneOverlap",Si[Si.ValuesNotChanged=76]="ValuesNotChanged",Si[Si.InvalidFilterZone=77]="InvalidFilterZone",Si[Si.FilterOverlap=78]="FilterOverlap",Si[Si.FilterNotFound=79]="FilterNotFound",Si[Si.MergeInFilter=80]="MergeInFilter",Si[Si.NonContinuousTargets=81]="NonContinuousTargets",Si[Si.DuplicatedFigureId=82]="DuplicatedFigureId",Si[Si.InvalidSelectionStep=83]="InvalidSelectionStep",Si[Si.DuplicatedChartId=84]="DuplicatedChartId",Si[Si.ChartDoesNotExist=85]="ChartDoesNotExist",function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(Ci||(Ci={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Ei||(Ei={}));const Mi=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ni{constructor(){this.graphColorIndex=0}next(){return Mi[this.graphColorIndex++%Mi.length]}}function _i(e){return e&&pt(e)<.3?"#FFFFFF":"#000000"}function Fi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!xt.test(e)));if(t)return 32;if(e.dataSets.map(xo).some((e=>e.top!==e.bottom&&Zo(e))))return 32}return 0}function Di(e){if(e.labelRange){if(!xt.test(e.labelRange||""))return 33}return 0}function ki(e,t,o){if(e){if("text"===o||(null==t?void 0:t.type)!==di.number||e.type!==di.number)return e.formattedValue;{let i=t.value-e.value;if("percentage"===o&&0!==i&&(i=i/e.value*100),"percentage"!==o&&e.format)return oo(i,e.format);const n=Math.abs(parseFloat(i.toFixed(2))).toLocaleString();return"percentage"===o?n+"%":n}}return""}function $i(e,t,o,i,n){if("text"===t||(null==e?void 0:e.type)!==di.number||(null==o?void 0:o.type)!==di.number)return;const r=o.value-e.value;return r>0?i:r<0?n:void 0}function Pi(e,t,o){if("text"===o||(null==e?void 0:e.type)!==di.number||(null==t?void 0:t.type)!==di.number)return"neutral";const i=t.value-e.value;return i>0?"up":i<0?"down":"neutral"}const Li={Errors:{25:r("The range is invalid"),51:r("The argument is missing. Please provide a value"),52:r("The second argument is missing. Please provide a value"),53:r("The minpoint must be a number"),54:r("The midpoint must be a number"),55:r("The maxpoint must be a number"),56:r("The first value must be a number"),57:r("The second value must be a number"),47:r("Minimum must be smaller then Maximum"),50:r("Minimum must be smaller then Midpoint"),49:r("Midpoint must be smaller then Maximum"),48:r("Lower inflection point must be smaller than upper inflection point"),58:r("Invalid Minpoint formula"),60:r("Invalid Maxpoint formula"),59:r("Invalid Midpoint formula"),61:r("Invalid upper inflection point formula"),62:r("Invalid lower inflection point formula"),24:r("A range needs to be defined"),Unexpected:r("The rule is invalid for an unknown reason")},ColorScale:r("Color scale"),IconSet:r("Icon set")},Ui={IsEmpty:r("Is empty"),IsNotEmpty:r("Is not empty"),ContainsText:r("Contains"),NotContains:r("Does not contain"),BeginsWith:r("Starts with"),EndsWith:r("Ends with"),Equal:r("Is equal to"),NotEqual:r("Is not equal to"),GreaterThan:r("Is greater than"),GreaterThanOrEqual:r("Is greater than or equal to"),LessThan:r("Is less than"),LessThanOrEqual:r("Is less than or equal to"),Between:r("Is between"),NotBetween:r("Is not between")},Vi={Series:r("Series"),Errors:{Unexpected:r("The chart definition is invalid for an unknown reason"),32:r("The dataset is invalid"),33:r("Labels are invalid"),34:r("The key value is invalid"),35:r("The baseline value is invalid"),36:r("The data range is invalid"),37:r("A minimum range limit value is needed"),38:r("The minimum range limit value must be a number"),39:r("A maximum range limit value is needed"),40:r("The maximum range limit value must be a number"),41:r("Minimum range limit must be smaller than maximum range limit"),42:r("The lower inflection point value must be a number"),43:r("The upper inflection point value must be a number")}},zi={Automatic:r("Automatic"),Number:r("Number"),Percent:r("Percent"),Currency:r("Currency"),CurrencyRounded:r("Currency rounded"),Date:r("Date"),Time:r("Time"),DateTime:r("Date time"),Duration:r("Duration"),CustomCurrency:r("Custom currency")},Bi={Custom:r("Custom")},Hi=r("Merged cells are preventing this operation. Unmerge those cells and try again.");function Wi(e,t){if(t.dataRange){const o=t.labelCell?[To(t.labelCell.zone)]:[],i=Lo([To(t.dataRange.zone)],o)[0];if(void 0===i)return[];const n=e.getRangeFromSheetXC(t.dataRange.sheetId,i);return e.getRangeValues(n).map((e=>""===e?void 0:e))}return[]}function Gi(e,t){const o=Le(0,Math.max(e.length,...t.map((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.length)||0})))).filter((o=>{const i=e[o],n=t.map((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t[o]}));return i||n.some((e=>0===e||Boolean(e)))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>e.data[t]))})))}}function qi(e,t){const o=new Set(e),i={};o.forEach((e=>{i[e]=new Array(t.length).fill(0)}));for(const o of Le(0,e.length)){const r=e[o];for(const e of Le(0,t.length))i[r][e]+="number"==typeof(n=t[e].data[o])?n:0}var n;return{labels:Object.keys(i),dataSetsValues:t.map(((e,t)=>({...e,data:Object.values(i).map((e=>e[t]))})))}}function Zi(e){return e?e.length>K?e.substring(0,K)+"…":e:""}function ji(e,t,o){return{type:e.type,options:{responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:e.title?10:25,bottom:10}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:{duration:0},hover:{animationDuration:10},responsiveAnimationDuration:0,title:{display:!!e.title,fontSize:22,fontStyle:"normal",text:n(e.title),fontColor:o},legend:{onClick:void 0}},data:{labels:t.map(Zi),datasets:[]}}}function Xi(e,t,o){let i={values:[],formattedValues:[]};if(o)o.invalidXc||o.invalidSheetName||(i={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e)))});else if(1===t.length)for(let o=0;o<Wi(e,t[0]).length;o++)i.formattedValues.push(""),i.values.push("");else if(t[0]){i={formattedValues:Le(0,Wi(e,t[0]).length).map((e=>e.toString())),values:i.formattedValues}}return i}function Yi(e,t){const o=[];for(const[i,n]of Object.entries(t)){let t;if(n.labelCell){const o=n.labelCell,r=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=r&&o?Zi(r.formattedValue):t=`${Vi.Series} ${parseInt(i)+1}`}else t=t=`${Vi.Series} ${parseInt(i)+1}`;let r=n.dataRange?Wi(e,n):[];o.push({data:r,label:t})}return o}function Ki(e){return 0===e?"origin":e-1}class Qi extends ci{constructor(e,t,o){super(e,t,o),this.type="bar",this.dataSets=Ri(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated}static transformDefinition(e,t){return Oi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,stacked:!1,aggregated:!1,legendPosition:"top",title:e.title||"",type:"bar",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new Qi(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Qi(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),dataSets:e}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new Qi(n,this.sheetId,this.getters)}}function Ji(e){return e.dataRange&&!xt.test(e.dataRange)?36:0}function en(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):0),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):0))}function tn(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?41:0}function on(e,t){if(""===e)switch(t){case"rangeMin":return 37;case"rangeMax":return 39}return 0}function nn(e,t){if(isNaN(e))switch(t){case"rangeMin":return 38;case"rangeMax":return 40;case"lowerInflectionPointValue":return 42;case"upperInflectionPointValue":return 43}return 0}class rn extends ci{constructor(e,t,o){super(e,t,o),this.type="gauge",this.dataRange=Eo(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,Ji,e.chainValidations(en(on,e.batchValidations),en(nn,e.batchValidations),tn),e.chainValidations((o=nn,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):0),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):0)))));var o}static transformDefinition(e,t){let o;return e.dataRange&&(o=hi(xo(e.dataRange),t)),{...e,dataRange:o?To(o):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||"",type:"gauge",dataRange:e.range?e.range[0]:void 0,sectionRule:{colors:{lowerColor:"#cc0000",middleColor:"#f1c232",upperColor:"#6aa84f"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15"},upperInflectionPoint:{type:"percentage",value:"40"}}}}copyForSheetId(e){const t=xi(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new rn(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new rn(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{background:this.background,title:this.title,range:this.dataRange?[this.getters.getRangeString(this.dataRange,this.sheetId)]:void 0}}updateRanges(e){const t=Ii(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new rn(o,this.sheetId,this.getters)}}const sn={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},an={inSeconds:function(e){return Math.floor(e/sn.second)},inMinutes:function(e){return Math.floor(e/sn.minute)},inHours:function(e){return Math.floor(e/sn.hour)},inDays:function(e){return Math.floor(e/sn.day)},inMonths:function(e){return Math.floor(e/sn.month)},inYears:function(e){return Math.floor(e/sn.year)}},ln=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function cn(e,t){const o=function(e){const t=(e=(e=e.replace(/y/g,"Y")).replace(/d/g,"D")).indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),i=function(e,t){const o=e.map((e=>{var t;return null===(t=be(e))||void 0===t?void 0:t.jsDate}));if(o.some((e=>void 0===e))||e.length<2)return;const i=o.map((e=>e.getTime())),n=Math.max(...i)-Math.min(...i),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("D"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(sn.second>=sn[r]&&an.inSeconds(n)<180)return"second";if(sn.minute>=sn[r]&&an.inMinutes(n)<180)return"minute";if(sn.hour>=sn[r]&&an.inHours(n)<96)return"hour";if(sn.day>=sn[r]&&an.inDays(n)<90)return"day";if(sn.month>=sn[r]&&an.inMonths(n)<36)return"month";return"year"}(e,o),n={};return i&&(n[i]=o),{parser:o,displayFormats:n,unit:i}}class hn extends ci{constructor(e,t,o){super(e,t,o),this.type="line",this.dataSets=Ri(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(this.getters,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static transformDefinition(e,t){return Oi(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,labelsAsText:!1,legendPosition:"top",title:e.title||"",type:"line",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,stacked:!1,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new hn(n,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),dataSets:e}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new hn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new hn(t,e,this.getters)}}function dn(e,t){return gn(e,t)||pn(e,t)}function un(e,t){return function(e,t){return!e.labelsAsText&&gn(e.labelRange,t)}(e,t)?"time":function(e,t){return!e.labelsAsText&&pn(e.labelRange,t)}(e,t)?"linear":"category"}function gn(e,t){if(!e||!pn(e,t))return!1;const o=t.getEvaluatedCell({sheetId:e.sheetId,col:e.zone.left,row:e.zone.top}).format;return Boolean(o&&ln.test(o))}function pn(e,t){if(!e)return!1;const o=t.getRangeValues(e);return!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}class fn extends ci{constructor(e,t,o){super(e,t,o),this.type="pie",this.dataSets=Ri(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated}static transformDefinition(e,t){return Oi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,legendPosition:"top",title:e.title||"",type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new fn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fn(t,e,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),verticalAxisPosition:"left",dataSets:e}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new fn(n,this.sheetId,this.getters)}}function mn(e,t){const o=[],i=Math.max(...t.map((e=>e.data.length)));for(let t=0;t<=i;t++)o.push(e.next());return o}function vn(e){return e.keyValue&&!xt.test(e.keyValue)?34:0}function bn(e){return e.baseline&&!xt.test(e.baseline)?35:0}class Sn extends ci{constructor(e,t,o){super(e,t,o),this.type="scorecard",this.keyValue=Eo(o,t,e.keyValue),this.baseline=Eo(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,vn,bn)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:J,baselineColorUp:ee,baselineColorDown:te,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,i;return e.baseline&&(o=hi(xo(e.baseline),t)),e.keyValue&&(i=hi(xo(e.keyValue),t)),{...e,baseline:o?To(o):void 0,keyValue:i?To(i):void 0}}copyForSheetId(e){const t=xi(this.sheetId,e,this.baseline),o=xi(this.sheetId,e,this.keyValue),i=this.getDefinitionWithSpecificRanges(t,o,e);return new Sn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,e);return new Sn(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(e){const t=Ii(this.baseline,e),o=Ii(this.keyValue,e);if(this.baseline===t&&this.keyValue===o)return this;const i=this.getDefinitionWithSpecificRanges(t,o);return new Sn(i,this.sheetId,this.getters)}}class Cn{constructor(){this.content={}}add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}const En=new Cn;En.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new Qi(e,t,o),getChartRuntime:function(e,t){let o=Xi(t,e.dataSets,e.labelRange).formattedValues,i=Yi(t,e.dataSets);({labels:o,dataSetsValues:i}=Gi(o,i)),e.aggregated&&({labels:o,dataSetsValues:i}=qi(o,i));const n=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={xAxes:[{ticks:{maxRotation:60,minRotation:15,padding:5,labelOffset:2,fontColor:i}}],yAxes:[{position:e.verticalAxisPosition,ticks:{fontColor:i,beginAtZero:!0}}]},e.stacked&&(n.options.scales.xAxes[0].stacked=!0,n.options.scales.yAxes[0].stacked=!0),n}(e,o),r=new Ni;for(let{label:e,data:t}of i){const o=r.next(),i={label:e,data:t,borderColor:o,backgroundColor:o};n.data.datasets.push(i)}return{chartJsConfig:n,background:e.background||w}},validateChartDefinition:(e,t)=>Qi.validateChartDefinition(e,t),transformDefinition:(e,t)=>Qi.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Qi.getDefinitionFromContextCreation(e),name:r("Bar")}),En.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new hn(e,t,o),getChartRuntime:function(e,t){const o=un(e,t),i=Xi(t,e.dataSets,e.labelRange);let n="linear"===o?i.values:i.formattedValues,r=Yi(t,e.dataSets);({labels:n,dataSetsValues:r}=Gi(n,r)),"time"===o&&({labels:n,dataSetsValues:r}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],i=Me(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=it(o,e);for(let t of i)t.data[e]=void 0}return{labels:o,dataSetsValues:i}}(n,r)),e.aggregated&&({labels:n,dataSetsValues:r}=qi(n,r));const s=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i,generateLabels(e){const{data:t}=e,o=window.Chart.defaults.global.legend.labels.generateLabels(e);for(const[e,i]of o.entries())i.fillStyle=t.datasets[e].borderColor;return o}}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={xAxes:[{ticks:{maxRotation:60,minRotation:15,padding:5,labelOffset:2,fontColor:i}}],yAxes:[{position:e.verticalAxisPosition,ticks:{fontColor:i,beginAtZero:!0}}]},e.stacked&&(n.options.scales.yAxes[0].stacked=!0),n}(e,n),a=function(e,t){if(t)return e.getEvaluatedCell({sheetId:t.sheetId,col:t.zone.left,row:t.zone.top}).format}(t,e.labelRange);"time"===o?(s.options.scales.xAxes[0].type="time",s.options.scales.xAxes[0].time=cn(n,a),s.options.scales.xAxes[0].ticks.maxTicksLimit=15):"linear"===o&&(s.options.scales.xAxes[0].type="linear",s.options.scales.xAxes[0].ticks.callback=e=>oo(e,a));const l=new Ni;for(let[t,{label:i,data:a}]of r.entries()){["linear","time"].includes(o)&&(a=a.map(((e,t)=>({x:n[t]||void 0,y:e}))));const r=l.next();let c=mt(r);e.stacked&&(c.a=oe);const h={label:i,data:a,lineTension:0,borderColor:r,backgroundColor:ft(c),pointBackgroundColor:r,fill:!!e.stacked&&Ki(t)};s.data.datasets.push(h)}return{chartJsConfig:s,background:e.background||w}},validateChartDefinition:(e,t)=>hn.validateChartDefinition(e,t),transformDefinition:(e,t)=>hn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>hn.getDefinitionFromContextCreation(e),name:r("Line")}),En.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new fn(e,t,o),getChartRuntime:function(e,t){let o=Xi(t,e.dataSets,e.labelRange).formattedValues,i=Yi(t,e.dataSets);({labels:o,dataSetsValues:i}=Gi(o,i)),e.aggregated&&({labels:o,dataSetsValues:i}=qi(o,i));const n=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.tooltips={callbacks:{title:function(e,t){return t.datasets[e[0].datasetIndex].label}}},n}(e,o),r=new Ni;for(let{label:e,data:t}of i){const o={label:e,data:t,borderColor:"#FFFFFF",backgroundColor:mn(r,i)};n.data.datasets.push(o)}return{chartJsConfig:n,background:e.background||w}},validateChartDefinition:(e,t)=>fn.validateChartDefinition(e,t),transformDefinition:(e,t)=>fn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>fn.getDefinitionFromContextCreation(e),name:r("Pie")}),En.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Sn(e,t,o),getChartRuntime:function(e,t){let o,i,r="",s="";if(e.keyValue){const i={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(i),r=String(o.value),s=o.formattedValue}const a=e.baseline;if(a){const o={sheetId:e.baseline.sheetId,col:e.baseline.zone.left,row:e.baseline.zone.top};i=t.getEvaluatedCell(o)}const l=t.getBackgroundOfSingleCellChart(e.background,e.keyValue);return{title:n(e.title),keyValue:s||r,baselineDisplay:ki(i,o,e.baselineMode),baselineArrow:Pi(i,o,e.baselineMode),baselineColor:$i(i,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineDescr?n(e.baselineDescr):"",fontColor:_i(l),background:l,baselineStyle:"percentage"!==e.baselineMode&&a?t.getCellStyle({sheetId:a.sheetId,col:a.zone.left,row:a.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0}},validateChartDefinition:(e,t)=>Sn.validateChartDefinition(e,t),transformDefinition:(e,t)=>Sn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Sn.getDefinitionFromContextCreation(e),name:r("Scorecard")}),En.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new rn(e,t,o),getChartRuntime:function(e,t){const o=function(e){const t=ji(e,[],_i(e.background));return t.options.hover=void 0,t.options.events=[],t.options.layout={padding:{left:30,right:30,top:e.title?10:25,bottom:25}},t.options.needle={radiusPercentage:2,widthPercentage:3.2,lengthPercentage:80,color:"#000000"},t.options.valueLabel={display:!1,formatter:null,color:"#FFFFFF",backgroundColor:"#000000",fontSize:30,borderRadius:5,padding:{top:5,right:5,bottom:5,left:5},bottomMarginPercentage:5},t}(e),i=e.sectionRule.colors,n=e.sectionRule.lowerInflectionPoint,r=e.sectionRule.upperInflectionPoint,s=Number(n.value),a=Number(r.value),l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=c-l,d=[];if(""!==n.value){const e="number"===n.type?s:l+h*s/100;d.push({value:Fe(e,l,c),color:i.lowerColor})}if(""!==r.value){const e="number"===r.type?a:l+h*a/100;d.push({value:Fe(e,l,c),color:i.middleColor})}const u=[],g=[];d.sort(((e,t)=>e.value-t.value)).map((e=>{u.push(e.value),g.push(e.color)})),u.push(c),g.push(i.upperColor);const p=e.dataRange,f=h/30;let m=l-f,v=null,b=!1;if(void 0!==p){const e=t.getEvaluatedCell({sheetId:p.sheetId,col:p.zone.left,row:p.zone.top});e.type===di.number&&(m=Fe(e.value,l-f,c+f),v=()=>t.getRangeFormattedValues(p)[0],b=!0)}return o.options.valueLabel.display=b,o.options.valueLabel.formatter=v,o.data.datasets.push({data:u,minValue:Number(e.sectionRule.rangeMin),value:m,backgroundColor:g}),{chartJsConfig:o,background:t.getBackgroundOfSingleCellChart(e.background,p)}},validateChartDefinition:(e,t)=>rn.validateChartDefinition(e,t),transformDefinition:(e,t)=>rn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>rn.getDefinitionFromContextCreation(e),name:r("Gauge")});const wn=new Cn;wn.add("line",Yo),wn.add("bar",Yo),wn.add("pie",Yo),wn.add("gauge",Yo),wn.add("scorecard",ri);const yn=e=>({isVisible:()=>!0,isEnabled:()=>!0,isReadonlyAllowed:!1,description:"",action:!1,children:[],separator:!1,icon:!1,id:e});function xn(e,t){return Object.assign({},yn(e),t)}function In(e){return"function"!=typeof e}class Rn extends Cn{add(e,t){return this.content[e]=xn(e,t),this}addChild(e,t,o){const i=t.splice(0,1)[0];let n=this.content[i];if(!n)throw new Error(`Path ${i+":"+t.join(":")} not found`);for(let e of t)if(n=n.children.filter(In).find((t=>t.id===e)),!n)throw new Error(`Path ${i+":"+t.join(":")} not found`);return"function"!=typeof o?n.children.push(xn(e,o)):n.children.push(o),this}getAll(){return super.getAll().sort(((e,t)=>e.sequence-t.sequence))}}function Tn(){const e=t.useState({x:0,y:0,width:0,height:0});let o=document.querySelector(".o-spreadsheet");function i(){if(o||(o=document.querySelector(".o-spreadsheet")),o){const{top:t,left:i,width:n,height:r}=o.getBoundingClientRect();e.x=i,e.y=t,e.width=n,e.height=r}}return i(),t.onMounted(i),t.onPatched(i),e}function An(e){const o=t.useState({x:0,y:0,width:0,height:0});function i(){const t=e.el;if(null===t)return;const{top:i,left:n,width:r,height:s}=t.getBoundingClientRect();o.x=n,o.y=i,o.width=r,o.height=s}return t.onMounted(i),t.onPatched(i),o}function On(e,t){const o=[];for(const i of e.children)"function"==typeof i?o.push(...i(t)):o.push(i);return o.sort(((e,t)=>e.sequence-t.sequence))}function Mn(e,t){return"function"==typeof e.name?e.name(t):e.name}function Nn(){const e=document.querySelector(".o-grid-overlay");if(e){const{top:t,left:o}=null==e?void 0:e.getBoundingClientRect();return{top:t,left:o}}throw new Error("Can't find spreadsheet position")}function _n(e,t){return(o=Fo(Fn(e),Fn(t)))?{x:o.left,y:o.top,width:o.right-o.left,height:o.bottom-o.top}:void 0;var o}function Fn(e){return{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}Jo`
|
|
52
|
+
`;class ri extends t.Component{constructor(){super(...arguments),this.ctx=document.createElement("canvas").getContext("2d")}get runtime(){return this.env.model.getters.getChartRuntime(this.props.figure.id)}get title(){return this.runtime.title}get keyValue(){return this.runtime.keyValue}get baseline(){return this.runtime.baselineDisplay}get baselineDescr(){const e=this.runtime.baselineDescr||"";return this.baseline&&e?" "+e:e}get baselineArrowDirection(){return this.runtime.baselineArrow}get backgroundColor(){return this.runtime.background}get primaryFontColor(){return this.runtime.fontColor}get secondaryFontColor(){return pt(this.backgroundColor)>.3?"#525252":"#C8C8C8"}get figure(){return this.props.figure}get chartStyle(){return`\n padding:${this.chartPadding}px;\n background:${this.backgroundColor};\n `}get chartContentStyle(){return`\n height:${this.getDrawableHeight()}px;\n `}get chartPadding(){return.02*this.props.figure.width}getTextStyles(){const e=.96*this.props.figure.width,t=this.getWidestElement(),o=t.getElementMaxFontSize(this.getDrawableHeight(),this);let i=function(e,t,o,i=.25){let n=1;if(o(n)>e)return n;if(o(t)<e)return t;let r=(n+t)/2,s=o(r),a=0;for(;Math.abs(s-e)>i&&a<20;)s>=e?t=(n+t)/2:n=(n+t)/2,r=(n+t)/2,s=o(r),a++;return r}(e,o,(e=>t.getElementWidth(e,this.ctx,this)))/o;const n=(new ai).getElementMaxFontSize(this.getDrawableHeight(),this)*i,r=(new si).getElementMaxFontSize(this.getDrawableHeight(),this)*i;return{titleStyle:this.getTextStyle({fontSize:18,color:this.secondaryFontColor}),keyStyle:this.getTextStyle({fontSize:n,cellStyle:this.runtime.keyValueStyle,color:this.primaryFontColor}),baselineStyle:this.getTextStyle({fontSize:r}),baselineValueStyle:this.getTextStyle({fontSize:r,cellStyle:this.runtime.baselineStyle,color:this.runtime.baselineColor||this.secondaryFontColor}),baselineDescrStyle:this.getTextStyle({fontSize:.9*r,color:this.secondaryFontColor})}}getTextStyle(e){const t=oi(e.cellStyle);return t["font-size"]=`${e.fontSize}px`,t.display="inline-block",!t.color&&e.color&&(t.color=e.color),ii(t)}getDrawableHeight(){const e=2*this.chartPadding;let t=this.props.figure.height-e;return t-=this.title?18*ni:0,t}getWidestElement(){const e=new si,t=new ai;return e.getElementWidth(.35,this.ctx,this)>t.getElementWidth(.65,this.ctx,this)?e:t}}ri.template="o-spreadsheet-ScorecardChart";class si{getElementWidth(e,t,o){if(!o.runtime)return 0;const i=o.baseline,n="neutral"!==o.baselineArrowDirection?"A "+i:i;t.font=`${e}px ${G}`;let r=t.measureText(n).width;return t.font=`${.9*e}px ${G}`,r+=t.measureText(o.baselineDescr).width,r}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.35*e:0)/ni}}class ai{getElementWidth(e,t,o){if(!o.runtime)return 0;const i=o.keyValue||"";return t.font=`${e}px ${G}`,t.measureText(i).width}getElementMaxFontSize(e,t){if(!t.runtime)return 0;return(""!==t.baseline||t.baselineDescr?.65*e:e)/ni}}function li(e){return 8===(e=ht(e).replace("#","")).length?e.slice(6)+e.slice(0,6):e}ri.props={figure:Object};class ci{constructor(e,t,o){this.title=e.title,this.sheetId=t,this.getters=o}static validateChartDefinition(e,t){throw new Error("This method should be implemented by sub class")}static transformDefinition(e,t){throw new Error("This method should be implemented by sub class")}static getDefinitionFromContextCreation(e){throw new Error("This method should be implemented by sub class")}}function hi(e,t){return"REMOVE_COLUMNS_ROWS"===t.type?No(e,"COL"===t.dimension?"left":"top",t.elements):"ADD_COLUMNS_ROWS"===t.type?Ao(e,"COL"===t.dimension?"left":"top",t.base,t.position,t.quantity):{...e}}var di,ui;!function(e){e.boolean="boolean",e.number="number",e.text="text",e.empty="empty",e.error="error"}(di||(di={})),function(e){e.PlainText="text/plain",e.Html="text/html"}(ui||(ui={}));const gi=new Set(["RENAME_SHEET","DELETE_SHEET","CREATE_SHEET","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","DELETE_CELL","INSERT_CELL","UNDO","REDO"]),pi=new Set([...gi,"DUPLICATE_SHEET","EVALUATE_CELLS","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","MOVE_CONDITIONAL_FORMAT"]),fi=new Set(["START","ACTIVATE_SHEET","COPY","PREPARE_SELECTION_INPUT_EXPANSION","STOP_SELECTION_INPUT","RESIZE_SHEETVIEW","SET_VIEWPORT_OFFSET","SELECT_SEARCH_NEXT_MATCH","SELECT_SEARCH_PREVIOUS_MATCH","REFRESH_SEARCH","UPDATE_SEARCH","CLEAR_SEARCH","EVALUATE_CELLS","SET_CURRENT_CONTENT","SET_FORMULA_VISIBILITY","OPEN_CELL_POPOVER","CLOSE_CELL_POPOVER","UPDATE_FILTER"]),mi=new Set(["UPDATE_CELL","UPDATE_CELL_POSITION","CLEAR_CELL","DELETE_CONTENT","ADD_COLUMNS_ROWS","REMOVE_COLUMNS_ROWS","RESIZE_COLUMNS_ROWS","HIDE_COLUMNS_ROWS","UNHIDE_COLUMNS_ROWS","SET_GRID_LINES_VISIBILITY","UNFREEZE_COLUMNS","UNFREEZE_ROWS","FREEZE_COLUMNS","FREEZE_ROWS","UNFREEZE_COLUMNS_ROWS","ADD_MERGE","REMOVE_MERGE","CREATE_SHEET","DELETE_SHEET","DUPLICATE_SHEET","MOVE_SHEET","RENAME_SHEET","HIDE_SHEET","SHOW_SHEET","MOVE_RANGES","ADD_CONDITIONAL_FORMAT","REMOVE_CONDITIONAL_FORMAT","MOVE_CONDITIONAL_FORMAT","CREATE_FIGURE","DELETE_FIGURE","UPDATE_FIGURE","SET_FORMATTING","CLEAR_FORMATTING","SET_BORDER","CREATE_CHART","UPDATE_CHART","CREATE_FILTER_TABLE","REMOVE_FILTER_TABLE","CREATE_IMAGE"]);function vi(e){return mi.has(e.type)}class bi{constructor(e=[]){Array.isArray(e)||(e=[e]),e=[...new Set(e)],this.reasons=e.filter((e=>0!==e))}static get Success(){return new bi}get isSuccessful(){return 0===this.reasons.length}isCancelledBecause(e){return this.reasons.includes(e)}}var Si,Ci,Ei;function wi(e,t,o,i){let n=!1;const r=[];for(let i in o){let s=o[i];if(s.labelCell){const e=Ii(s.labelCell,t);s.labelCell!==e&&(n=!0,s={...s,labelCell:e})}const a=Ii(s.dataRange,t);void 0===a||e.getRangeString(a,a.sheetId)===X?(n=!0,s=void 0):a!==s.dataRange&&(n=!0,s={...s,dataRange:a}),r[i]=s}let s=i;const a=Ii(s,t);a!==s&&(n=!0,s=a);return{isStale:n,dataSets:r.filter(Qe),labelRange:s}}function yi(e,t,o){return o.map((o=>({dataRange:Co(e,t,o.dataRange),labelCell:o.labelCell?Co(e,t,o.labelCell):void 0})))}function xi(e,t,o){return o?Co(e,t,o):void 0}function Ii(e,t){if(!e)return;const o=t(e);switch(o.changeType){case"NONE":return e;case"REMOVE":return;default:return o.range}}function Ri(e,t,o,i){const n=[];for(const r of t){const t=e.getRangeFromSheetXC(o,r),{unboundedZone:s,sheetId:a,invalidSheetName:l}=t;if(!l)if(s.left!==s.right&&s.top!==s.bottom){if(void 0===s.right)continue;for(let t=s.left;t<=s.right;t++){const o={...s,left:t,right:t};n.push(Ti(e,a,o,i?{top:o.top,bottom:o.top,left:o.left,right:o.left}:void 0))}}else s.left===s.right&&s.top===s.bottom?i||n.push(Ti(e,a,s,void 0)):n.push(Ti(e,a,s,i?{top:s.top,bottom:s.top,left:s.left,right:s.left}:void 0))}return n}function Ti(e,t,o,i){if(o.left!==o.right&&o.top!==o.bottom)throw new Error(`Zone should be a single column or row: ${To(o)}`);if(i){const n=To(o),r=To(i);return{labelCell:e.getRangeFromSheetXC(t,r),dataRange:e.getRangeFromSheetXC(t,n)}}return{labelCell:void 0,dataRange:e.getRangeFromSheetXC(t,To(o))}}function Ai(e,t){var o;const i=null===(o=t.labelCell)||void 0===o?void 0:o.zone;let n=t.dataRange.zone;if(i){const{height:e,width:t}=Vo(n);1===e?n={...n,left:n.left+1}:1===t&&(n={...n,top:n.top+1})}const r=t.dataRange.clone({zone:n});return{label:t.labelCell?e.getRangeString(t.labelCell,"forceSheetReference"):void 0,range:e.getRangeString(r,"forceSheetReference")}}function Oi(e,t){let o;if(e.labelRange){const i=hi(xo(e.labelRange),t);o=i?To(i):void 0}const i=e.dataSets.map(xo).map((e=>hi(e,t))).filter(Qe).map(To);return{...e,labelRange:o,dataSets:i}}e.CommandResult=void 0,(Si=e.CommandResult||(e.CommandResult={}))[Si.Success=0]="Success",Si[Si.CancelledForUnknownReason=1]="CancelledForUnknownReason",Si[Si.WillRemoveExistingMerge=2]="WillRemoveExistingMerge",Si[Si.MergeIsDestructive=3]="MergeIsDestructive",Si[Si.CellIsMerged=4]="CellIsMerged",Si[Si.InvalidTarget=5]="InvalidTarget",Si[Si.EmptyUndoStack=6]="EmptyUndoStack",Si[Si.EmptyRedoStack=7]="EmptyRedoStack",Si[Si.NotEnoughElements=8]="NotEnoughElements",Si[Si.NotEnoughSheets=9]="NotEnoughSheets",Si[Si.MissingSheetName=10]="MissingSheetName",Si[Si.DuplicatedSheetName=11]="DuplicatedSheetName",Si[Si.DuplicatedSheetId=12]="DuplicatedSheetId",Si[Si.ForbiddenCharactersInSheetName=13]="ForbiddenCharactersInSheetName",Si[Si.WrongSheetMove=14]="WrongSheetMove",Si[Si.WrongSheetPosition=15]="WrongSheetPosition",Si[Si.InvalidAnchorZone=16]="InvalidAnchorZone",Si[Si.SelectionOutOfBound=17]="SelectionOutOfBound",Si[Si.TargetOutOfSheet=18]="TargetOutOfSheet",Si[Si.WrongCutSelection=19]="WrongCutSelection",Si[Si.WrongPasteSelection=20]="WrongPasteSelection",Si[Si.WrongPasteOption=21]="WrongPasteOption",Si[Si.WrongFigurePasteOption=22]="WrongFigurePasteOption",Si[Si.EmptyClipboard=23]="EmptyClipboard",Si[Si.EmptyRange=24]="EmptyRange",Si[Si.InvalidRange=25]="InvalidRange",Si[Si.InvalidZones=26]="InvalidZones",Si[Si.InvalidSheetId=27]="InvalidSheetId",Si[Si.InvalidFigureId=28]="InvalidFigureId",Si[Si.InputAlreadyFocused=29]="InputAlreadyFocused",Si[Si.MaximumRangesReached=30]="MaximumRangesReached",Si[Si.InvalidChartDefinition=31]="InvalidChartDefinition",Si[Si.InvalidDataSet=32]="InvalidDataSet",Si[Si.InvalidLabelRange=33]="InvalidLabelRange",Si[Si.InvalidScorecardKeyValue=34]="InvalidScorecardKeyValue",Si[Si.InvalidScorecardBaseline=35]="InvalidScorecardBaseline",Si[Si.InvalidGaugeDataRange=36]="InvalidGaugeDataRange",Si[Si.EmptyGaugeRangeMin=37]="EmptyGaugeRangeMin",Si[Si.GaugeRangeMinNaN=38]="GaugeRangeMinNaN",Si[Si.EmptyGaugeRangeMax=39]="EmptyGaugeRangeMax",Si[Si.GaugeRangeMaxNaN=40]="GaugeRangeMaxNaN",Si[Si.GaugeRangeMinBiggerThanRangeMax=41]="GaugeRangeMinBiggerThanRangeMax",Si[Si.GaugeLowerInflectionPointNaN=42]="GaugeLowerInflectionPointNaN",Si[Si.GaugeUpperInflectionPointNaN=43]="GaugeUpperInflectionPointNaN",Si[Si.GaugeLowerBiggerThanUpper=44]="GaugeLowerBiggerThanUpper",Si[Si.InvalidAutofillSelection=45]="InvalidAutofillSelection",Si[Si.WrongComposerSelection=46]="WrongComposerSelection",Si[Si.MinBiggerThanMax=47]="MinBiggerThanMax",Si[Si.LowerBiggerThanUpper=48]="LowerBiggerThanUpper",Si[Si.MidBiggerThanMax=49]="MidBiggerThanMax",Si[Si.MinBiggerThanMid=50]="MinBiggerThanMid",Si[Si.FirstArgMissing=51]="FirstArgMissing",Si[Si.SecondArgMissing=52]="SecondArgMissing",Si[Si.MinNaN=53]="MinNaN",Si[Si.MidNaN=54]="MidNaN",Si[Si.MaxNaN=55]="MaxNaN",Si[Si.ValueUpperInflectionNaN=56]="ValueUpperInflectionNaN",Si[Si.ValueLowerInflectionNaN=57]="ValueLowerInflectionNaN",Si[Si.MinInvalidFormula=58]="MinInvalidFormula",Si[Si.MidInvalidFormula=59]="MidInvalidFormula",Si[Si.MaxInvalidFormula=60]="MaxInvalidFormula",Si[Si.ValueUpperInvalidFormula=61]="ValueUpperInvalidFormula",Si[Si.ValueLowerInvalidFormula=62]="ValueLowerInvalidFormula",Si[Si.InvalidSortZone=63]="InvalidSortZone",Si[Si.WaitingSessionConfirmation=64]="WaitingSessionConfirmation",Si[Si.MergeOverlap=65]="MergeOverlap",Si[Si.TooManyHiddenElements=66]="TooManyHiddenElements",Si[Si.Readonly=67]="Readonly",Si[Si.InvalidViewportSize=68]="InvalidViewportSize",Si[Si.InvalidScrollingDirection=69]="InvalidScrollingDirection",Si[Si.FigureDoesNotExist=70]="FigureDoesNotExist",Si[Si.InvalidConditionalFormatId=71]="InvalidConditionalFormatId",Si[Si.InvalidCellPopover=72]="InvalidCellPopover",Si[Si.EmptyTarget=73]="EmptyTarget",Si[Si.InvalidFreezeQuantity=74]="InvalidFreezeQuantity",Si[Si.FrozenPaneOverlap=75]="FrozenPaneOverlap",Si[Si.ValuesNotChanged=76]="ValuesNotChanged",Si[Si.InvalidFilterZone=77]="InvalidFilterZone",Si[Si.FilterOverlap=78]="FilterOverlap",Si[Si.FilterNotFound=79]="FilterNotFound",Si[Si.MergeInFilter=80]="MergeInFilter",Si[Si.NonContinuousTargets=81]="NonContinuousTargets",Si[Si.DuplicatedFigureId=82]="DuplicatedFigureId",Si[Si.InvalidSelectionStep=83]="InvalidSelectionStep",Si[Si.DuplicatedChartId=84]="DuplicatedChartId",Si[Si.ChartDoesNotExist=85]="ChartDoesNotExist",function(e){e.UP="up",e.DOWN="down",e.LEFT="left",e.RIGHT="right"}(Ci||(Ci={})),function(e){e[e.Background=0]="Background",e[e.Highlights=1]="Highlights",e[e.Clipboard=2]="Clipboard",e[e.Search=3]="Search",e[e.Chart=4]="Chart",e[e.Autofill=5]="Autofill",e[e.Selection=6]="Selection",e[e.Headers=7]="Headers"}(Ei||(Ei={}));const Mi=["rgb(31,119,180)","rgb(255,127,14)","rgb(174,199,232)","rgb(255,187,120)","rgb(44,160,44)","rgb(152,223,138)","rgb(214,39,40)","rgb(255,152,150)","rgb(148,103,189)","rgb(197,176,213)","rgb(140,86,75)","rgb(196,156,148)","rgb(227,119,194)","rgb(247,182,210)","rgb(127,127,127)","rgb(199,199,199)","rgb(188,189,34)","rgb(219,219,141)","rgb(23,190,207)","rgb(158,218,229)"];class Ni{constructor(){this.graphColorIndex=0}next(){return Mi[this.graphColorIndex++%Mi.length]}}function _i(e){return e&&pt(e)<.3?"#FFFFFF":"#000000"}function Fi(e){if(e.dataSets){const t=void 0!==e.dataSets.find((e=>!xt.test(e)));if(t)return 32;if(e.dataSets.map(xo).some((e=>e.top!==e.bottom&&Zo(e))))return 32}return 0}function Di(e){if(e.labelRange){if(!xt.test(e.labelRange||""))return 33}return 0}function ki(e,t,o){if(e){if("text"===o||(null==t?void 0:t.type)!==di.number||e.type!==di.number)return e.formattedValue;{let i=t.value-e.value;if("percentage"===o&&0!==i&&(i=i/e.value*100),"percentage"!==o&&e.format)return oo(i,e.format);const n=Math.abs(parseFloat(i.toFixed(2))).toLocaleString();return"percentage"===o?n+"%":n}}return""}function $i(e,t,o,i,n){if("text"===t||(null==e?void 0:e.type)!==di.number||(null==o?void 0:o.type)!==di.number)return;const r=o.value-e.value;return r>0?i:r<0?n:void 0}function Pi(e,t,o){if("text"===o||(null==e?void 0:e.type)!==di.number||(null==t?void 0:t.type)!==di.number)return"neutral";const i=t.value-e.value;return i>0?"up":i<0?"down":"neutral"}const Li={Errors:{25:r("The range is invalid"),51:r("The argument is missing. Please provide a value"),52:r("The second argument is missing. Please provide a value"),53:r("The minpoint must be a number"),54:r("The midpoint must be a number"),55:r("The maxpoint must be a number"),56:r("The first value must be a number"),57:r("The second value must be a number"),47:r("Minimum must be smaller then Maximum"),50:r("Minimum must be smaller then Midpoint"),49:r("Midpoint must be smaller then Maximum"),48:r("Lower inflection point must be smaller than upper inflection point"),58:r("Invalid Minpoint formula"),60:r("Invalid Maxpoint formula"),59:r("Invalid Midpoint formula"),61:r("Invalid upper inflection point formula"),62:r("Invalid lower inflection point formula"),24:r("A range needs to be defined"),Unexpected:r("The rule is invalid for an unknown reason")},ColorScale:r("Color scale"),IconSet:r("Icon set")},Ui={IsEmpty:r("Is empty"),IsNotEmpty:r("Is not empty"),ContainsText:r("Contains"),NotContains:r("Does not contain"),BeginsWith:r("Starts with"),EndsWith:r("Ends with"),Equal:r("Is equal to"),NotEqual:r("Is not equal to"),GreaterThan:r("Is greater than"),GreaterThanOrEqual:r("Is greater than or equal to"),LessThan:r("Is less than"),LessThanOrEqual:r("Is less than or equal to"),Between:r("Is between"),NotBetween:r("Is not between")},Vi={Series:r("Series"),Errors:{Unexpected:r("The chart definition is invalid for an unknown reason"),32:r("The dataset is invalid"),33:r("Labels are invalid"),34:r("The key value is invalid"),35:r("The baseline value is invalid"),36:r("The data range is invalid"),37:r("A minimum range limit value is needed"),38:r("The minimum range limit value must be a number"),39:r("A maximum range limit value is needed"),40:r("The maximum range limit value must be a number"),41:r("Minimum range limit must be smaller than maximum range limit"),42:r("The lower inflection point value must be a number"),43:r("The upper inflection point value must be a number")}},zi={Automatic:r("Automatic"),Number:r("Number"),Percent:r("Percent"),Currency:r("Currency"),CurrencyRounded:r("Currency rounded"),Date:r("Date"),Time:r("Time"),DateTime:r("Date time"),Duration:r("Duration"),CustomCurrency:r("Custom currency")},Bi={Custom:r("Custom")},Hi=r("Merged cells are preventing this operation. Unmerge those cells and try again.");function Wi(e,t){if(t.dataRange){const o=t.labelCell?[To(t.labelCell.zone)]:[],i=Lo([To(t.dataRange.zone)],o)[0];if(void 0===i)return[];const n=e.getRangeFromSheetXC(t.dataRange.sheetId,i);return e.getRangeValues(n).map((e=>""===e?void 0:e))}return[]}function Gi(e,t){const o=Le(0,Math.max(e.length,...t.map((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.length)||0})))).filter((o=>{const i=e[o],n=t.map((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t[o]}));return i||n.some((e=>0===e||Boolean(e)))}));return{labels:o.map((t=>e[t]||"")),dataSetsValues:t.map((e=>({...e,data:o.map((t=>e.data[t]))})))}}function qi(e,t){const o=new Set(e),i={};o.forEach((e=>{i[e]=new Array(t.length).fill(0)}));for(const o of Le(0,e.length)){const r=e[o];for(const e of Le(0,t.length))i[r][e]+="number"==typeof(n=t[e].data[o])?n:0}var n;return{labels:Object.keys(i),dataSetsValues:t.map(((e,t)=>({...e,data:Object.values(i).map((e=>e[t]))})))}}function Zi(e){return e?e.length>K?e.substring(0,K)+"…":e:""}function ji(e,t,o){return{type:e.type,options:{responsive:!0,maintainAspectRatio:!1,layout:{padding:{left:20,right:20,top:e.title?10:25,bottom:10}},elements:{line:{fill:!1},point:{hitRadius:15}},animation:{duration:0},hover:{animationDuration:10},responsiveAnimationDuration:0,title:{display:!!e.title,fontSize:22,fontStyle:"normal",text:n(e.title),fontColor:o},legend:{onClick:void 0}},data:{labels:t.map(Zi),datasets:[]}}}function Xi(e,t,o){let i={values:[],formattedValues:[]};if(o)o.invalidXc||o.invalidSheetName||(i={formattedValues:e.getRangeFormattedValues(o),values:e.getRangeValues(o).map((e=>String(e)))});else if(1===t.length)for(let o=0;o<Wi(e,t[0]).length;o++)i.formattedValues.push(""),i.values.push("");else if(t[0]){i={formattedValues:Le(0,Wi(e,t[0]).length).map((e=>e.toString())),values:i.formattedValues}}return i}function Yi(e,t){const o=[];for(const[i,n]of Object.entries(t)){let t;if(n.labelCell){const o=n.labelCell,r=o?e.getEvaluatedCell({sheetId:o.sheetId,col:o.zone.left,row:o.zone.top}):void 0;t=r&&o?Zi(r.formattedValue):t=`${Vi.Series} ${parseInt(i)+1}`}else t=t=`${Vi.Series} ${parseInt(i)+1}`;let r=n.dataRange?Wi(e,n):[];o.push({data:r,label:t})}return o}function Ki(e){return 0===e?"origin":e-1}class Qi extends ci{constructor(e,t,o){super(e,t,o),this.type="bar",this.dataSets=Ri(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(o,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.stacked=e.stacked,this.aggregated=e.aggregated}static transformDefinition(e,t){return Oi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,stacked:!1,aggregated:!1,legendPosition:"top",title:e.title||"",type:"bar",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new Qi(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new Qi(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"bar",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,stacked:this.stacked,aggregated:this.aggregated}}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),dataSets:e}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new Qi(n,this.sheetId,this.getters)}}function Ji(e){return e.dataRange&&!xt.test(e.dataRange)?36:0}function en(e,t){return t((t=>t.sectionRule?e(t.sectionRule.rangeMin,"rangeMin"):0),(t=>t.sectionRule?e(t.sectionRule.rangeMax,"rangeMax"):0))}function tn(e){return e.sectionRule&&Number(e.sectionRule.rangeMin)>=Number(e.sectionRule.rangeMax)?41:0}function on(e,t){if(""===e)switch(t){case"rangeMin":return 37;case"rangeMax":return 39}return 0}function nn(e,t){if(isNaN(e))switch(t){case"rangeMin":return 38;case"rangeMax":return 40;case"lowerInflectionPointValue":return 42;case"upperInflectionPointValue":return 43}return 0}class rn extends ci{constructor(e,t,o){super(e,t,o),this.type="gauge",this.dataRange=Eo(this.getters,this.sheetId,e.dataRange),this.sectionRule=e.sectionRule,this.background=e.background}static validateChartDefinition(e,t){return e.checkValidations(t,Ji,e.chainValidations(en(on,e.batchValidations),en(nn,e.batchValidations),tn),e.chainValidations((o=nn,(0,e.batchValidations)((e=>e.sectionRule?o(e.sectionRule.lowerInflectionPoint.value,"lowerInflectionPointValue"):0),(e=>e.sectionRule?o(e.sectionRule.upperInflectionPoint.value,"upperInflectionPointValue"):0)))));var o}static transformDefinition(e,t){let o;return e.dataRange&&(o=hi(xo(e.dataRange),t)),{...e,dataRange:o?To(o):void 0}}static getDefinitionFromContextCreation(e){return{background:e.background,title:e.title||"",type:"gauge",dataRange:e.range?e.range[0]:void 0,sectionRule:{colors:{lowerColor:"#cc0000",middleColor:"#f1c232",upperColor:"#6aa84f"},rangeMin:"0",rangeMax:"100",lowerInflectionPoint:{type:"percentage",value:"15"},upperInflectionPoint:{type:"percentage",value:"40"}}}}copyForSheetId(e){const t=xi(this.sheetId,e,this.dataRange),o=this.getDefinitionWithSpecificRanges(t,e);return new rn(o,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.dataRange,e);return new rn(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.dataRange)}getDefinitionWithSpecificRanges(e,t){return{background:this.background,sectionRule:this.sectionRule,title:this.title,type:"gauge",dataRange:e?this.getters.getRangeString(e,t||this.sheetId):void 0}}getDefinitionForExcel(){}getContextCreation(){return{background:this.background,title:this.title,range:this.dataRange?[this.getters.getRangeString(this.dataRange,this.sheetId)]:void 0}}updateRanges(e){const t=Ii(this.dataRange,e);if(this.dataRange===t)return this;const o=this.getDefinitionWithSpecificRanges(t);return new rn(o,this.sheetId,this.getters)}}const sn={second:1e3,minute:6e4,hour:36e5,day:864e5,month:2592e6,year:31536e6},an={inSeconds:function(e){return Math.floor(e/sn.second)},inMinutes:function(e){return Math.floor(e/sn.minute)},inHours:function(e){return Math.floor(e/sn.hour)},inDays:function(e){return Math.floor(e/sn.day)},inMonths:function(e){return Math.floor(e/sn.month)},inYears:function(e){return Math.floor(e/sn.year)}},ln=/^((d|dd|m|mm|yyyy|yy|hh|h|ss|a)(-|:|\s|\/))*(d|dd|m|mm|yyyy|yy|hh|h|ss|a)$/i;function cn(e,t){const o=function(e){const t=(e=(e=e.replace(/y/g,"Y")).replace(/d/g,"D")).indexOf("h");e=t>=0?e.slice(0,t).replace(/m/g,"M")+e.slice(t):e.replace(/m/g,"M");e.includes("a")||(e=e.replace(/h/g,"H"));return e}(t),i=function(e,t){const o=e.map((e=>{var t;return null===(t=be(e))||void 0===t?void 0:t.jsDate}));if(o.some((e=>void 0===e))||e.length<2)return;const i=o.map((e=>e.getTime())),n=Math.max(...i)-Math.min(...i),r=function(e){if(e.includes("s"))return"second";if(e.includes("m"))return"minute";if(e.includes("h")||e.includes("H"))return"hour";if(e.includes("D"))return"day";if(e.includes("M"))return"month";return"year"}(t);if(sn.second>=sn[r]&&an.inSeconds(n)<180)return"second";if(sn.minute>=sn[r]&&an.inMinutes(n)<180)return"minute";if(sn.hour>=sn[r]&&an.inHours(n)<96)return"hour";if(sn.day>=sn[r]&&an.inDays(n)<90)return"day";if(sn.month>=sn[r]&&an.inMonths(n)<36)return"month";return"year"}(e,o),n={};return i&&(n[i]=o),{parser:o,displayFormats:n,unit:i}}class hn extends ci{constructor(e,t,o){super(e,t,o),this.type="line",this.dataSets=Ri(this.getters,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(this.getters,t,e.labelRange),this.background=e.background,this.verticalAxisPosition=e.verticalAxisPosition,this.legendPosition=e.legendPosition,this.labelsAsText=e.labelsAsText,this.stacked=e.stacked,this.aggregated=e.aggregated}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static transformDefinition(e,t){return Oi(e,t)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,labelsAsText:!1,legendPosition:"top",title:e.title||"",type:"line",verticalAxisPosition:"left",labelRange:e.auxiliaryRange||void 0,stacked:!1,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getDefinitionWithSpecificDataSets(e,t,o){return{type:"line",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,verticalAxisPosition:this.verticalAxisPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,labelsAsText:this.labelsAsText,stacked:this.stacked,aggregated:this.aggregated}}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new hn(n,this.sheetId,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),dataSets:e}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new hn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new hn(t,e,this.getters)}}function dn(e,t){return gn(e,t)||pn(e,t)}function un(e,t){return function(e,t){return!e.labelsAsText&&gn(e.labelRange,t)}(e,t)?"time":function(e,t){return!e.labelsAsText&&pn(e.labelRange,t)}(e,t)?"linear":"category"}function gn(e,t){if(!e||!pn(e,t))return!1;const o=t.getEvaluatedCell({sheetId:e.sheetId,col:e.zone.left,row:e.zone.top}).format;return Boolean(o&&ln.test(o))}function pn(e,t){if(!e)return!1;const o=t.getRangeValues(e);return!o.some((e=>isNaN(Number(e))&&e))&&!o.every((e=>!e))}class fn extends ci{constructor(e,t,o){super(e,t,o),this.type="pie",this.dataSets=Ri(o,e.dataSets,t,e.dataSetsHaveTitle),this.labelRange=Eo(o,t,e.labelRange),this.background=e.background,this.legendPosition=e.legendPosition,this.aggregated=e.aggregated}static transformDefinition(e,t){return Oi(e,t)}static validateChartDefinition(e,t){return e.checkValidations(t,Fi,Di)}static getDefinitionFromContextCreation(e){return{background:e.background,dataSets:e.range?e.range:[],dataSetsHaveTitle:!1,legendPosition:"top",title:e.title||"",type:"pie",labelRange:e.auxiliaryRange||void 0,aggregated:!1}}getDefinition(){return this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange)}getContextCreation(){return{background:this.background,title:this.title,range:this.dataSets.map((e=>this.getters.getRangeString(e.dataRange,this.sheetId))),auxiliaryRange:this.labelRange?this.getters.getRangeString(this.labelRange,this.sheetId):void 0}}getDefinitionWithSpecificDataSets(e,t,o){return{type:"pie",dataSetsHaveTitle:!!e.length&&Boolean(e[0].labelCell),background:this.background,dataSets:e.map((e=>this.getters.getRangeString(e.dataRange,o||this.sheetId))),legendPosition:this.legendPosition,labelRange:t?this.getters.getRangeString(t,o||this.sheetId):void 0,title:this.title,aggregated:this.aggregated}}copyForSheetId(e){const t=yi(this.sheetId,e,this.dataSets),o=xi(this.sheetId,e,this.labelRange),i=this.getDefinitionWithSpecificDataSets(t,o,e);return new fn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificDataSets(this.dataSets,this.labelRange,e);return new fn(t,e,this.getters)}getDefinitionForExcel(){if(this.aggregated)return;const e=this.dataSets.map((e=>Ai(this.getters,e))).filter((e=>""!==e.range));return{...this.getDefinition(),backgroundColor:li(this.background||w),fontColor:li(_i(this.background)),verticalAxisPosition:"left",dataSets:e}}updateRanges(e){const{dataSets:t,labelRange:o,isStale:i}=wi(this.getters,e,this.dataSets,this.labelRange);if(!i)return this;const n=this.getDefinitionWithSpecificDataSets(t,o);return new fn(n,this.sheetId,this.getters)}}function mn(e,t){const o=[],i=Math.max(...t.map((e=>e.data.length)));for(let t=0;t<=i;t++)o.push(e.next());return o}function vn(e){return e.keyValue&&!xt.test(e.keyValue)?34:0}function bn(e){return e.baseline&&!xt.test(e.baseline)?35:0}class Sn extends ci{constructor(e,t,o){super(e,t,o),this.type="scorecard",this.keyValue=Eo(o,t,e.keyValue),this.baseline=Eo(o,t,e.baseline),this.baselineMode=e.baselineMode,this.baselineDescr=e.baselineDescr,this.background=e.background,this.baselineColorUp=e.baselineColorUp,this.baselineColorDown=e.baselineColorDown}static validateChartDefinition(e,t){return e.checkValidations(t,vn,bn)}static getDefinitionFromContextCreation(e){return{background:e.background,type:"scorecard",keyValue:e.range?e.range[0]:void 0,title:e.title||"",baselineMode:J,baselineColorUp:ee,baselineColorDown:te,baseline:e.auxiliaryRange||""}}static transformDefinition(e,t){let o,i;return e.baseline&&(o=hi(xo(e.baseline),t)),e.keyValue&&(i=hi(xo(e.keyValue),t)),{...e,baseline:o?To(o):void 0,keyValue:i?To(i):void 0}}copyForSheetId(e){const t=xi(this.sheetId,e,this.baseline),o=xi(this.sheetId,e,this.keyValue),i=this.getDefinitionWithSpecificRanges(t,o,e);return new Sn(i,e,this.getters)}copyInSheetId(e){const t=this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue,e);return new Sn(t,e,this.getters)}getDefinition(){return this.getDefinitionWithSpecificRanges(this.baseline,this.keyValue)}getContextCreation(){return{background:this.background,title:this.title,range:this.keyValue?[this.getters.getRangeString(this.keyValue,this.sheetId)]:void 0,auxiliaryRange:this.baseline?this.getters.getRangeString(this.baseline,this.sheetId):void 0}}getDefinitionWithSpecificRanges(e,t,o){return{baselineColorDown:this.baselineColorDown,baselineColorUp:this.baselineColorUp,baselineMode:this.baselineMode,title:this.title,type:"scorecard",background:this.background,baseline:e?this.getters.getRangeString(e,o||this.sheetId):void 0,baselineDescr:this.baselineDescr,keyValue:t?this.getters.getRangeString(t,o||this.sheetId):void 0}}getDefinitionForExcel(){}updateRanges(e){const t=Ii(this.baseline,e),o=Ii(this.keyValue,e);if(this.baseline===t&&this.keyValue===o)return this;const i=this.getDefinitionWithSpecificRanges(t,o);return new Sn(i,this.sheetId,this.getters)}}class Cn{constructor(){this.content={}}add(e,t){return this.content[e]=t,this}get(e){const t=this.content[e];if(!t&&!(e in this.content))throw new Error(`Cannot find ${e} in this registry!`);return t}contains(e){return e in this.content}getAll(){return Object.values(this.content)}getKeys(){return Object.keys(this.content)}remove(e){delete this.content[e]}}const En=new Cn;En.add("bar",{match:e=>"bar"===e,createChart:(e,t,o)=>new Qi(e,t,o),getChartRuntime:function(e,t){let o=Xi(t,e.dataSets,e.labelRange).formattedValues,i=Yi(t,e.dataSets);({labels:o,dataSetsValues:i}=Gi(o,i)),e.aggregated&&({labels:o,dataSetsValues:i}=qi(o,i));const n=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={xAxes:[{ticks:{maxRotation:60,minRotation:15,padding:5,labelOffset:2,fontColor:i}}],yAxes:[{position:e.verticalAxisPosition,ticks:{fontColor:i,beginAtZero:!0}}]},e.stacked&&(n.options.scales.xAxes[0].stacked=!0,n.options.scales.yAxes[0].stacked=!0),n}(e,o),r=new Ni;for(let{label:e,data:t}of i){const o=r.next(),i={label:e,data:t,borderColor:o,backgroundColor:o};n.data.datasets.push(i)}return{chartJsConfig:n,background:e.background||w}},validateChartDefinition:(e,t)=>Qi.validateChartDefinition(e,t),transformDefinition:(e,t)=>Qi.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Qi.getDefinitionFromContextCreation(e),name:r("Bar")}),En.add("line",{match:e=>"line"===e,createChart:(e,t,o)=>new hn(e,t,o),getChartRuntime:function(e,t){const o=un(e,t),i=Xi(t,e.dataSets,e.labelRange);let n="linear"===o?i.values:i.formattedValues,r=Yi(t,e.dataSets);({labels:n,dataSetsValues:r}=Gi(n,r)),"time"===o&&({labels:n,dataSetsValues:r}=function(e,t){if(0===e.length||e.every((e=>!e)))return{labels:e,dataSetsValues:t};const o=[...e],i=Me(t);for(let e=0;e<o.length;e++)if(!o[e]){o[e]=it(o,e);for(let t of i)t.data[e]=void 0}return{labels:o,dataSetsValues:i}}(n,r)),e.aggregated&&({labels:n,dataSetsValues:r}=qi(n,r));const s=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i,generateLabels(e){const{data:t}=e,o=window.Chart.defaults.global.legend.labels.generateLabels(e);for(const[e,i]of o.entries())i.fillStyle=t.datasets[e].borderColor;return o}}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.scales={xAxes:[{ticks:{maxRotation:60,minRotation:15,padding:5,labelOffset:2,fontColor:i}}],yAxes:[{position:e.verticalAxisPosition,ticks:{fontColor:i,beginAtZero:!0}}]},e.stacked&&(n.options.scales.yAxes[0].stacked=!0),n}(e,n),a=function(e,t){if(t)return e.getEvaluatedCell({sheetId:t.sheetId,col:t.zone.left,row:t.zone.top}).format}(t,e.labelRange);"time"===o?(s.options.scales.xAxes[0].type="time",s.options.scales.xAxes[0].time=cn(n,a),s.options.scales.xAxes[0].ticks.maxTicksLimit=15):"linear"===o&&(s.options.scales.xAxes[0].type="linear",s.options.scales.xAxes[0].ticks.callback=e=>oo(e,a));const l=new Ni;for(let[t,{label:i,data:a}]of r.entries()){["linear","time"].includes(o)&&(a=a.map(((e,t)=>({x:n[t]||void 0,y:e}))));const r=l.next();let c=mt(r);e.stacked&&(c.a=oe);const h={label:i,data:a,lineTension:0,borderColor:r,backgroundColor:ft(c),pointBackgroundColor:r,fill:!!e.stacked&&Ki(t)};s.data.datasets.push(h)}return{chartJsConfig:s,background:e.background||w}},validateChartDefinition:(e,t)=>hn.validateChartDefinition(e,t),transformDefinition:(e,t)=>hn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>hn.getDefinitionFromContextCreation(e),name:r("Line")}),En.add("pie",{match:e=>"pie"===e,createChart:(e,t,o)=>new fn(e,t,o),getChartRuntime:function(e,t){let o=Xi(t,e.dataSets,e.labelRange).formattedValues,i=Yi(t,e.dataSets);({labels:o,dataSetsValues:i}=Gi(o,i)),e.aggregated&&({labels:o,dataSetsValues:i}=qi(o,i));const n=function(e,t){var o;const i=_i(e.background),n=ji(e,t,i),r={labels:{fontColor:i}};return!e.labelRange&&1===e.dataSets.length||"none"===e.legendPosition?r.display=!1:r.position=e.legendPosition,n.options.legend={...null===(o=n.options)||void 0===o?void 0:o.legend,...r},n.options.layout={padding:{left:20,right:20,top:e.title?10:25,bottom:10}},n.options.tooltips={callbacks:{title:function(e,t){return t.datasets[e[0].datasetIndex].label}}},n}(e,o),r=new Ni;for(let{label:e,data:t}of i){const o={label:e,data:t,borderColor:"#FFFFFF",backgroundColor:mn(r,i)};n.data.datasets.push(o)}return{chartJsConfig:n,background:e.background||w}},validateChartDefinition:(e,t)=>fn.validateChartDefinition(e,t),transformDefinition:(e,t)=>fn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>fn.getDefinitionFromContextCreation(e),name:r("Pie")}),En.add("scorecard",{match:e=>"scorecard"===e,createChart:(e,t,o)=>new Sn(e,t,o),getChartRuntime:function(e,t){let o,i,r="",s="";if(e.keyValue){const i={sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top};o=t.getEvaluatedCell(i),r=String(o.value),s=o.formattedValue}const a=e.baseline;if(a){const o={sheetId:e.baseline.sheetId,col:e.baseline.zone.left,row:e.baseline.zone.top};i=t.getEvaluatedCell(o)}const l=t.getBackgroundOfSingleCellChart(e.background,e.keyValue);return{title:n(e.title),keyValue:s||r,baselineDisplay:ki(i,o,e.baselineMode),baselineArrow:Pi(i,o,e.baselineMode),baselineColor:$i(i,e.baselineMode,o,e.baselineColorUp,e.baselineColorDown),baselineDescr:e.baselineDescr?n(e.baselineDescr):"",fontColor:_i(l),background:l,baselineStyle:"percentage"!==e.baselineMode&&a?t.getCellStyle({sheetId:a.sheetId,col:a.zone.left,row:a.zone.top}):void 0,keyValueStyle:e.keyValue?t.getCellStyle({sheetId:e.keyValue.sheetId,col:e.keyValue.zone.left,row:e.keyValue.zone.top}):void 0}},validateChartDefinition:(e,t)=>Sn.validateChartDefinition(e,t),transformDefinition:(e,t)=>Sn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>Sn.getDefinitionFromContextCreation(e),name:r("Scorecard")}),En.add("gauge",{match:e=>"gauge"===e,createChart:(e,t,o)=>new rn(e,t,o),getChartRuntime:function(e,t){const o=function(e){const t=ji(e,[],_i(e.background));return t.options.hover=void 0,t.options.events=[],t.options.layout={padding:{left:30,right:30,top:e.title?10:25,bottom:25}},t.options.needle={radiusPercentage:2,widthPercentage:3.2,lengthPercentage:80,color:"#000000"},t.options.valueLabel={display:!1,formatter:null,color:"#FFFFFF",backgroundColor:"#000000",fontSize:30,borderRadius:5,padding:{top:5,right:5,bottom:5,left:5},bottomMarginPercentage:5},t}(e),i=e.sectionRule.colors,n=e.sectionRule.lowerInflectionPoint,r=e.sectionRule.upperInflectionPoint,s=Number(n.value),a=Number(r.value),l=Number(e.sectionRule.rangeMin),c=Number(e.sectionRule.rangeMax),h=c-l,d=[];if(""!==n.value){const e="number"===n.type?s:l+h*s/100;d.push({value:Fe(e,l,c),color:i.lowerColor})}if(""!==r.value){const e="number"===r.type?a:l+h*a/100;d.push({value:Fe(e,l,c),color:i.middleColor})}const u=[],g=[];d.sort(((e,t)=>e.value-t.value)).map((e=>{u.push(e.value),g.push(e.color)})),u.push(c),g.push(i.upperColor);const p=e.dataRange,f=h/30;let m=l-f,v=null,b=!1;if(void 0!==p){const e=t.getEvaluatedCell({sheetId:p.sheetId,col:p.zone.left,row:p.zone.top});e.type===di.number&&(m=Fe(e.value,l-f,c+f),v=()=>t.getRangeFormattedValues(p)[0],b=!0)}return o.options.valueLabel.display=b,o.options.valueLabel.formatter=v,o.data.datasets.push({data:u,minValue:Number(e.sectionRule.rangeMin),value:m,backgroundColor:g}),{chartJsConfig:o,background:t.getBackgroundOfSingleCellChart(e.background,p)}},validateChartDefinition:(e,t)=>rn.validateChartDefinition(e,t),transformDefinition:(e,t)=>rn.transformDefinition(e,t),getChartDefinitionFromContextCreation:e=>rn.getDefinitionFromContextCreation(e),name:r("Gauge")});const wn=new Cn;wn.add("line",Yo),wn.add("bar",Yo),wn.add("pie",Yo),wn.add("gauge",Yo),wn.add("scorecard",ri);const yn=e=>({isVisible:()=>!0,isEnabled:()=>!0,isReadonlyAllowed:!1,description:"",action:!1,children:[],separator:!1,icon:!1,id:e});function xn(e,t){return Object.assign({},yn(e),t)}function In(e){return"function"!=typeof e}class Rn extends Cn{add(e,t){return this.content[e]=xn(e,t),this}addChild(e,t,o){const i=t.splice(0,1)[0];let n=this.content[i];if(!n)throw new Error(`Path ${i+":"+t.join(":")} not found`);for(let e of t)if(n=n.children.filter(In).find((t=>t.id===e)),!n)throw new Error(`Path ${i+":"+t.join(":")} not found`);return"function"!=typeof o?n.children.push(xn(e,o)):n.children.push(o),this}getAll(){return super.getAll().sort(((e,t)=>e.sequence-t.sequence))}}function Tn(){const e=t.useState({x:0,y:0,width:0,height:0});let o=document.querySelector(".o-spreadsheet");function i(){if(o||(o=document.querySelector(".o-spreadsheet")),o){const{top:t,left:i,width:n,height:r}=o.getBoundingClientRect();e.x=i,e.y=t,e.width=n,e.height=r}}return i(),t.onMounted(i),t.onPatched(i),e}function An(e){const o=t.useState({x:0,y:0,width:0,height:0});function i(){const t=e.el;if(null===t)return;const{top:i,left:n,width:r,height:s}=t.getBoundingClientRect();o.x=n,o.y=i,o.width=r,o.height=s}return t.onMounted(i),t.onPatched(i),o}function On(e,t){const o=[];for(const i of e.children)"function"==typeof i?o.push(...i(t)):o.push(i);return o.sort(((e,t)=>e.sequence-t.sequence))}function Mn(e,t){return"function"==typeof e.name?e.name(t):e.name}function Nn(){const e=document.querySelector(".o-grid-overlay");if(e){const{top:t,left:o}=null==e?void 0:e.getBoundingClientRect();return{top:t,left:o}}throw new Error("Can't find spreadsheet position")}function _n(e,t){return(o=Fo(Fn(e),Fn(t)))?{x:o.left,y:o.top,width:o.right-o.left,height:o.bottom-o.top}:void 0;var o}function Fn(e){return{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}Jo`
|
|
53
53
|
.o-popover {
|
|
54
54
|
position: absolute;
|
|
55
55
|
z-index: ${ae.Popover};
|
|
@@ -2451,4 +2451,4 @@
|
|
|
2451
2451
|
<tableParts count="${e.filterTables.length}">
|
|
2452
2452
|
${Om(a)}
|
|
2453
2453
|
</tableParts>
|
|
2454
|
-
`}var RS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(RS||(RS={}));const TS={},AS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:M,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:_,SCROLLBAR_WIDTH:F},OS={autofillModifiersRegistry:xg,autofillRulesRegistry:Ig,cellMenuRegistry:Tr,colMenuRegistry:Ar,linkMenuRegistry:Dg,functionRegistry:qd,featurePluginRegistry:ub,statefulUIPluginRegistry:gb,coreViewsPluginRegistry:pb,corePluginRegistry:db,rowMenuRegistry:Or,sidePanelRegistry:Sp,figureRegistry:Vg,sheetMenuRegistry:Wg,chartSidePanelComponentRegistry:hp,chartComponentRegistry:wn,chartRegistry:En,topbarMenuRegistry:qg,topbarComponentRegistry:Cp,clickableCellRegistry:fb,otRegistry:Zg,inverseCommandRegistry:zg,urlRegistry:cg,cellPopoverRegistry:Pg},MS={args:Pr,toBoolean:jr,toJsDate:Xr,toNumber:Hr,toString:Gr,toXC:Ft,toZone:Io,toCartesian:_t,numberToLetters:Mt,createFullMenuItem:xn,UuidGenerator:yo,formatValue:oo,computeTextWidth:ke,createEmptyWorkbookData:tv,createEmptySheet:ev,createEmptyExcelSheet:ov,getDefaultChartJsRuntime:ji,chartFontColor:_i,getMenuChildren:On,ChartColors:Ni,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ki,rgbaToHex:ft,colorToRGBA:mt,positionToZone:qo,isDefined:Qe},NS={isMarkdownLink:We,parseMarkdownLink:Ze,markdownLink:qe,openLink:pg,urlRepresentation:gg},_S={ChartPanel:dp,ChartFigure:Un,ChartJsComponent:Yo,Grid:Vp,GridOverlay:xp,ScorecardChart:ri,LineConfigPanel:sp,LineBarPieDesignPanel:op,BarConfigPanel:Kg,LineBarPieConfigPanel:Yg,GaugeChartConfigPanel:np,GaugeChartDesignPanel:rp,ScorecardChartConfigPanel:lp,ScorecardChartDesignPanel:cp};e.AbstractChart=ci,e.CorePlugin=iv,e.DATETIME_FORMAT=j,e.DispatchResult=bi,e.EvaluationError=c,e.Model=class extends zv{constructor(e={},o={},i=[],n=new yo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!fi.has(n.type)))return new bi(67);var n;if(!this.session.canApplyOptimisticUpdate())return new bi(64);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{vi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(vi(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(vi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return bi.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,bi.Success},i=Qm(e,i);const s=Ym(e,r);this.state=new zb,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new Lb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Cv(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new Vb(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of db.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of gb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of pb.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of ub.getAll())this.featurePlugins.push(this.setupUiPlugin(e));this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(i),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}get handlers(){return[this.range,...this.corePlugins,...this.allUIPlugins,this.history]}get allUIPlugins(){return[...this.statefulUIPlugins,...this.coreViewsPlugins,...this.featurePlugins]}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new Yv($b(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,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){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Tb;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new bi(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Me(t);for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=tv();for(let t of this.handlers)t instanceof iv&&t.export(e);return e.revisionId=this.session.getRevisionId()||Y,e=JSON.parse(JSON.stringify(e)),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...tv(),sheets:[ov(Xm,"Sheet1")]};for(let t of this.handlers)t instanceof Vu&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),xS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Cn,e.Revision=jv,e.SPREADSHEET_DIMENSIONS=AS,e.Spreadsheet=Rb,e.UIPlugin=zu,e.__info__=TS,e.addFunction=function(e,t){qd.add(e,t)},e.astToFormula=Eu,e.compile=ku,e.components=_S,e.convertAstNodes=Cu,e.coreTypes=mi,e.findCellInNewZone=Wo,e.functionCache=Du,e.helpers=MS,e.invalidateEvaluationCommands=gi,e.links=NS,e.load=Ym,e.parse=bu,e.readonlyAllowedCommands=fi,e.registries=OS,e.setTranslationMethod=function(e){o=e},e.tokenize=Yd,Object.defineProperty(e,"__esModule",{value:!0}),TS.version="16.1.
|
|
2454
|
+
`}var RS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(RS||(RS={}));const TS={},AS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:M,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:_,SCROLLBAR_WIDTH:F},OS={autofillModifiersRegistry:xg,autofillRulesRegistry:Ig,cellMenuRegistry:Tr,colMenuRegistry:Ar,linkMenuRegistry:Dg,functionRegistry:qd,featurePluginRegistry:ub,statefulUIPluginRegistry:gb,coreViewsPluginRegistry:pb,corePluginRegistry:db,rowMenuRegistry:Or,sidePanelRegistry:Sp,figureRegistry:Vg,sheetMenuRegistry:Wg,chartSidePanelComponentRegistry:hp,chartComponentRegistry:wn,chartRegistry:En,topbarMenuRegistry:qg,topbarComponentRegistry:Cp,clickableCellRegistry:fb,otRegistry:Zg,inverseCommandRegistry:zg,urlRegistry:cg,cellPopoverRegistry:Pg},MS={args:Pr,toBoolean:jr,toJsDate:Xr,toNumber:Hr,toString:Gr,toXC:Ft,toZone:Io,toCartesian:_t,numberToLetters:Mt,createFullMenuItem:xn,UuidGenerator:yo,formatValue:oo,computeTextWidth:ke,createEmptyWorkbookData:tv,createEmptySheet:ev,createEmptyExcelSheet:ov,getDefaultChartJsRuntime:ji,chartFontColor:_i,getMenuChildren:On,ChartColors:Ni,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ki,rgbaToHex:ft,colorToRGBA:mt,positionToZone:qo,isDefined:Qe},NS={isMarkdownLink:We,parseMarkdownLink:Ze,markdownLink:qe,openLink:pg,urlRepresentation:gg},_S={ChartPanel:dp,ChartFigure:Un,ChartJsComponent:Yo,Grid:Vp,GridOverlay:xp,ScorecardChart:ri,LineConfigPanel:sp,LineBarPieDesignPanel:op,BarConfigPanel:Kg,LineBarPieConfigPanel:Yg,GaugeChartConfigPanel:np,GaugeChartDesignPanel:rp,ScorecardChartConfigPanel:lp,ScorecardChartDesignPanel:cp};e.AbstractChart=ci,e.CorePlugin=iv,e.DATETIME_FORMAT=j,e.DispatchResult=bi,e.EvaluationError=c,e.Model=class extends zv{constructor(e={},o={},i=[],n=new yo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!fi.has(n.type)))return new bi(67);var n;if(!this.session.canApplyOptimisticUpdate())return new bi(64);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{vi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(vi(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(vi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return bi.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,bi.Success},i=Qm(e,i);const s=Ym(e,r);this.state=new zb,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new Lb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Cv(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new Vb(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of db.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of gb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of pb.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of ub.getAll())this.featurePlugins.push(this.setupUiPlugin(e));this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(i),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}get handlers(){return[this.range,...this.corePlugins,...this.allUIPlugins,this.history]}get allUIPlugins(){return[...this.statefulUIPlugins,...this.coreViewsPlugins,...this.featurePlugins]}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new Yv($b(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,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){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Tb;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new bi(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Me(t);for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=tv();for(let t of this.handlers)t instanceof iv&&t.export(e);return e.revisionId=this.session.getRevisionId()||Y,e=JSON.parse(JSON.stringify(e)),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...tv(),sheets:[ov(Xm,"Sheet1")]};for(let t of this.handlers)t instanceof Vu&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),xS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Cn,e.Revision=jv,e.SPREADSHEET_DIMENSIONS=AS,e.Spreadsheet=Rb,e.UIPlugin=zu,e.__info__=TS,e.addFunction=function(e,t){qd.add(e,t)},e.astToFormula=Eu,e.compile=ku,e.components=_S,e.convertAstNodes=Cu,e.coreTypes=mi,e.findCellInNewZone=Wo,e.functionCache=Du,e.helpers=MS,e.invalidateEvaluationCommands=gi,e.links=NS,e.load=Ym,e.parse=bu,e.readonlyAllowedCommands=fi,e.registries=OS,e.setTranslationMethod=function(e){o=e},e.tokenize=Yd,Object.defineProperty(e,"__esModule",{value:!0}),TS.version="16.1.5",TS.date="2023-03-16T12:12:08.747Z",TS.hash="12f7a8e"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odoo/o-spreadsheet",
|
|
3
|
-
"version": "16.1.
|
|
3
|
+
"version": "16.1.5",
|
|
4
4
|
"description": "A spreadsheet component",
|
|
5
5
|
"main": "dist/o-spreadsheet.cjs.js",
|
|
6
6
|
"browser": "dist/o-spreadsheet.iife.js",
|
|
@@ -133,6 +133,6 @@
|
|
|
133
133
|
"*": "prettier --write"
|
|
134
134
|
},
|
|
135
135
|
"publishConfig": {
|
|
136
|
-
"tag": "
|
|
136
|
+
"tag": "16-1"
|
|
137
137
|
}
|
|
138
138
|
}
|