@univerjs/core 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +4650 -4507
  3. package/lib/types/common/boolean.d.ts +16 -0
  4. package/lib/types/common/interceptor.d.ts +2 -2
  5. package/lib/types/common/number.d.ts +17 -0
  6. package/lib/types/{basics/index.d.ts → common/set.d.ts} +7 -5
  7. package/lib/types/common/type-util.d.ts +16 -0
  8. package/lib/types/common/unit.d.ts +9 -0
  9. package/lib/types/docs/data-model/document-data-model.d.ts +4 -1
  10. package/lib/types/index.d.ts +21 -9
  11. package/lib/types/services/command/command.service.d.ts +1 -0
  12. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +1 -1
  13. package/lib/types/services/instance/instance.service.d.ts +71 -94
  14. package/lib/types/services/lifecycle/lifecycle.service.d.ts +2 -2
  15. package/lib/types/services/permission/permission.service.d.ts +0 -1
  16. package/lib/types/services/permission/univer.permission.service.d.ts +2 -2
  17. package/lib/types/services/plugin/plugin-holder.d.ts +25 -0
  18. package/lib/types/services/plugin/plugin-override.d.ts +8 -0
  19. package/lib/types/{plugin → services/plugin}/plugin.d.ts +11 -16
  20. package/lib/types/services/plugin/plugin.service.d.ts +24 -0
  21. package/lib/types/services/resource-loader/resource-loader.service.d.ts +14 -0
  22. package/lib/types/services/resource-loader/type.d.ts +7 -0
  23. package/lib/types/services/resource-manager/resource-manager.service.d.ts +11 -17
  24. package/lib/types/services/resource-manager/type.d.ts +15 -18
  25. package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
  26. package/lib/types/shared/__tests__/ref-alias.spec.d.ts +16 -0
  27. package/lib/types/shared/clipboard.d.ts +5 -0
  28. package/lib/types/shared/color/color.d.ts +1 -1
  29. package/lib/types/shared/index.d.ts +2 -0
  30. package/lib/types/shared/lifecycle.d.ts +8 -3
  31. package/lib/types/shared/range.d.ts +3 -0
  32. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +2 -2
  33. package/lib/types/sheets/column-manager.d.ts +1 -1
  34. package/lib/types/sheets/row-manager.d.ts +4 -2
  35. package/lib/types/sheets/view-model.d.ts +18 -10
  36. package/lib/types/sheets/workbook.d.ts +3 -2
  37. package/lib/types/sheets/worksheet.d.ts +33 -8
  38. package/lib/types/slides/{domain/slide-model.d.ts → slide-model.d.ts} +7 -5
  39. package/lib/types/types/enum/index.d.ts +0 -1
  40. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -0
  41. package/lib/types/types/interfaces/i-cell-data.d.ts +4 -0
  42. package/lib/types/types/interfaces/i-range.d.ts +3 -0
  43. package/lib/types/types/interfaces/i-style-data.d.ts +6 -0
  44. package/lib/types/types/interfaces/i-univer-data.d.ts +2 -13
  45. package/lib/types/univer.d.ts +43 -0
  46. package/lib/umd/index.js +9 -9
  47. package/package.json +8 -8
  48. package/lib/types/basics/plugin-holder.d.ts +0 -16
  49. package/lib/types/basics/univer-doc.d.ts +0 -16
  50. package/lib/types/basics/univer-sheet.d.ts +0 -16
  51. package/lib/types/basics/univer-slide.d.ts +0 -16
  52. package/lib/types/basics/univer.d.ts +0 -46
  53. package/lib/types/slides/domain/index.d.ts +0 -16
  54. package/lib/types/types/enum/condition-type.d.ts +0 -49
  55. /package/lib/types/{basics → common}/registry.d.ts +0 -0
  56. /package/lib/types/shared/{__test__ → __tests__}/common.spec.d.ts +0 -0
  57. /package/lib/types/shared/{__test__ → __tests__}/object-matrix.spec.d.ts +0 -0
  58. /package/lib/types/shared/{__test__/rectangle.spec.d.ts → __tests__/range.spec.d.ts} +0 -0
  59. /package/lib/types/shared/{__test__/ref-alias.spec.d.ts → __tests__/rectangle.spec.d.ts} +0 -0
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var nr=Object.defineProperty;var rr=(t,s,e)=>s in t?nr(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var h=(t,s,e)=>(rr(t,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("@wendellhu/redi"),C=require("rxjs"),ir=require("rxjs/operators");function or(){cr()}const Ot=typeof global<"u"?global:typeof self<"u"?self:window;function cr(){typeof Ot.requestIdleCallback!="function"&&(Ot.requestIdleCallback=function(e){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Ot.cancelIdleCallback!="function"&&(Ot.cancelIdleCallback=function(e){clearTimeout(e)})}var p=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(p||{}),$=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))($||{});function ar(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const z=class z{static clone(s){return s.rangeType!==void 0?{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType}:{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn}}static equals(s,e){return s==null||e==null?!1:s.endRow===e.endRow&&s.endColumn===e.endColumn&&s.startRow===e.startRow&&s.startColumn===e.startColumn&&(s.rangeType===e.rangeType||s.rangeType===void 0&&e.rangeType===p.NORMAL||e.rangeType===void 0&&s.rangeType===p.NORMAL)}static intersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,u=e.startColumn,l=e.endColumn,_=Math.abs(i+o-u-l),d=Math.abs(i-o)+Math.abs(u-l),E=Math.abs(n+r-c-a),f=Math.abs(n-r)+Math.abs(c-a);return _<=d&&E<=f}static getIntersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,u=e.startColumn,l=e.endColumn;let _,d,E,f;if(c<=r)c>=n?d=c:d=n;else return null;if(a>=n)a>=r?f=r:f=a;else return null;if(u<=o)u>i?_=u:_=i;else return null;if(l>=i)l>=o?E=o:E=l;else return null;return{startRow:d,endRow:f,startColumn:_,endColumn:E,rangeType:p.NORMAL}}static contains(s,e){return s.startRow<=e.startRow&&s.endRow>=e.endRow&&s.startColumn<=e.startColumn&&s.endColumn>=e.endColumn}static realContain(s,e){return z.contains(s,e)&&(s.startRow<e.startRow||s.endRow>e.endRow||s.startColumn<e.startColumn||s.endColumn>e.endColumn)}static union(...s){return s.reduce((e,n)=>({startRow:Math.min(e.startRow,n.startRow),startColumn:Math.min(e.startColumn,n.startColumn),endRow:Math.max(e.endRow,n.endRow),endColumn:Math.max(e.endColumn,n.endColumn),rangeType:p.NORMAL}),s[0])}static subtract(s,e){if(e.startRow>s.endRow||e.endRow<s.startRow||e.startColumn>s.endColumn||e.endColumn<s.startColumn)return[s];const n=[];e.startRow>=s.startRow&&n.push({startRow:s.startRow,startColumn:s.startColumn,endRow:e.startRow-1,endColumn:s.endColumn}),e.endRow<=s.endRow&&n.push({startRow:e.endRow+1,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn});const r=Math.max(s.startRow,e.startRow),i=Math.min(s.endRow,e.endRow);return e.startColumn>=s.startColumn&&n.push({startRow:r,startColumn:s.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=s.endColumn&&n.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:s.endColumn}),n.filter(c=>c.startRow<=c.endRow&&c.startColumn<=c.endColumn)}};h(z,"getRelativeRange",(s,e)=>({startRow:s.startRow-e.startRow,endRow:s.endRow-s.startRow,startColumn:s.startColumn-e.startColumn,endColumn:s.endColumn-s.startColumn})),h(z,"getPositionRange",(s,e,n)=>({...n||{},startRow:n&&[$.ROW,$.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:s.startRow+e.startRow,endRow:n&&[$.ROW,$.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:s.endRow+s.startRow+e.startRow,startColumn:n&&[$.COLUMN,$.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:s.startColumn+e.startColumn,endColumn:n&&[$.COLUMN,$.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:s.endColumn+s.startColumn+e.startColumn})),h(z,"moveHorizontal",(s,e=0,n=0)=>({...s,startColumn:s.startColumn+e,endColumn:s.endColumn+e+n})),h(z,"moveVertical",(s,e=0,n=0)=>({...s,startRow:s.startRow+e,endRow:s.endRow+e+n})),h(z,"moveOffset",(s,e,n)=>({...s,startRow:s.startRow+n,endRow:s.endRow+n,startColumn:s.startColumn+e,endColumn:s.endColumn+e}));let Z=z;const lr=(t,s)=>s.length===t.length&&!t.some(e=>s.some(n=>!Z.equals(n,e))),ur=(t,s)=>s.length===t.length&&t.every((e,n)=>{const r=s[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Z.equals(e.range,r.range)});function hr(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||!t||typeof s!="object"||!s)return!1;const e=Object.keys(t),n=Object.keys(s);if(e.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(s);for(let i=0;i<e.length;i++){const o=e[i];if(!r(o))return!1;const c=t[o],a=s[o];if(c!==a)return!1}return!0}class _e{constructor(){h(this,"_data",[])}static create(){return new _e}add(s){this._data.indexOf(s)>-1||this._data.push(s)}delete(s){const e=this._data.indexOf(s);this._data.splice(e,1)}getData(){return this._data}}class de{constructor(){h(this,"_data",new Map)}static create(){return new de}add(s,e){this._data.has(s)||this._data.set(s,e)}delete(s){this._data.delete(s)}getData(){return this._data}}var T=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(T||{});class Ve{constructor(s){h(this,"_name");this._name=s}onStarting(s){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}h(Ve,"type",0);class _r{constructor(){h(this,"_plugins",[])}addPlugin(s){this._plugins.push(s)}removePlugins(){const s=this._plugins.slice();return this._plugins.length=0,s}forEachPlugin(s){this._plugins.forEach(s)}}class dr{constructor(){h(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(s,e){const n=s.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:s,options:e})}getRegisterPlugins(s){return this._pluginsRegisteredByBusiness.get(s)||[]}clearPluginsOfType(s){this._pluginsRegisteredByBusiness.delete(s)}}function q(t,s){const e=t.indexOf(s);return e>-1?(t.splice(e,1),!0):!1}function Er(t){const s=new Set,e=[];for(const n of t)s.has(n)||(s.add(n),e.push(n));return e}function fr(t,s){for(let e=t.length-1;e>-1;e--){const n=t[e];if(s(n,e))return n}return null}function gr(t,s){if(t.length===0)return t;const e=s%t.length;return t.slice(e).concat(t.slice(0,e))}function Rr(t,s){const e=new Map;return t.forEach(n=>{const r=s(n);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(n)}),e}async function je(t){for(const[s,e]of t.entries())try{if(!await e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function Ke(t){for(const[s,e]of t.entries())try{if(!e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function Me(t){var s=typeof Symbol=="function"&&Symbol.iterator,e=s&&t[s],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pe(t,s){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),r,i=[],o;try{for(;(s===void 0||s-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return i}function xe(t,s,e){if(e||arguments.length===2)for(var n=0,r=s.length,i;n<r;n++)(i||!(n in s))&&(i||(i=Array.prototype.slice.call(s,0,n)),i[n]=s[n]);return t.concat(i||Array.prototype.slice.call(s))}function _t(t){return typeof t=="function"}function mr(t){var s=function(n){Error.call(n),n.stack=new Error().stack},e=t(s);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Kt=mr(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
1
+ "use strict";var sr=Object.defineProperty;var nr=(t,s,e)=>s in t?sr(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var d=(t,s,e)=>(nr(t,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("rxjs"),A=require("@wendellhu/redi"),rr=require("rxjs/operators");function ir(){or()}const Ct=typeof global<"u"?global:typeof self<"u"?self:window;function or(){typeof Ct.requestIdleCallback!="function"&&(Ct.requestIdleCallback=function(e){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Ct.cancelIdleCallback!="function"&&(Ct.cancelIdleCallback=function(e){clearTimeout(e)})}function Ke(t,s){let e=0,n=t.length-1;for(;e<=n;){const r=Math.floor((n+e)/2);if(s<t[r]&&(r===0||s>=t[r-1]))return r;if(s>=t[r])e=r+1;else if(s<t[r])n=r-1;else return-1}return-1}function Ye(t,s){let e=0,n=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(n=t[o],o===0?r=0:r=t[o-1],s>=r&&s<=n){i=o;break}if(n=t[e],e===0?r=0:r=t[e-1],s>=r&&s<n){i=e;break}e++,o--}return i}function ar(t,s){let e=t.length-1;return s<0?-1:s<t[0]?0:s>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||s<=t[20]||s>=t[e-20]?e=Ye(t,s):e=Ke(t,s),e)}function lr(t){const s=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(s)}var ze=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(ze||{}),T=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(T||{}),ye=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(ye||{}),W=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(W||{}),Xe=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(Xe||{}),qe=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(qe||{}),Je=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Je||{}),Ze=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Ze||{}),Qe=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Qe||{});function ur(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var ts=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(ts||{}),es=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(es||{}),nt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(nt||{}),ss=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ss||{}),ns=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(ns||{}),rs=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(rs||{}),Ft=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Ft||{}),_t=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(_t||{}),is=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(is||{}),Z=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(Z||{}),rt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(rt||{}),ft=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ft||{}),Dt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Dt||{}),pt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(pt||{}),it=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(it||{}),C=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(C||{}),Q=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(Q||{}),H=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(H||{}),Wt=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(Wt||{});const os={[Wt.OFFICE]:{[H.ACCENT1]:"#4472C4",[H.ACCENT2]:"#ED7D31",[H.ACCENT3]:"#A5A5A5",[H.ACCENT4]:"#70AD47",[H.ACCENT5]:"#5B9BD5",[H.ACCENT6]:"#70AD47",[H.DARK1]:"#000000",[H.DARK2]:"#44546A",[H.LIGHT1]:"#FFFFFF",[H.LIGHT2]:"#E7E6E6",[H.HYPERLINK]:"#0563C1",[H.FOLLOWED_HYPERLINK]:"#954F72"}};class Bt{constructor(){d(this,"_themeValue",H.LIGHT1);d(this,"_themeColors");d(this,"_themeTint");d(this,"_rgbValue","");d(this,"_colorType");this._colorType=W.UNSUPPORTED,this._themeColors=Wt.OFFICE,this._themeTint=0}asRgbColor(){return new Mt(this._rgbValue,this)}asThemeColor(){return new Pt(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case W.THEME:return this.asThemeColor();case W.RGB:return this.asRgbColor();case W.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(s){return this._colorType=W.RGB,this._rgbValue=s,this}setThemeColors(s){this._colorType=W.THEME,this._themeColors=s}setThemeTint(s){this._colorType=W.THEME,this._themeTint=s}setThemeColor(s){return this._colorType=W.THEME,this._themeValue=s,this}getColorType(){return this._colorType}}class tt{constructor(s){d(this,"_builder");this._builder=s}static rgbColorToHexValue(s){return`#${((1<<24)+(s.getRed()<<16)+(s.getGreen()<<8)+s.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(s){s?s.indexOf("#")>-1&&(s=s.substring(1)):s="#000000";const e=+`0x${s[0]}${s[1]}`,n=+`0x${s[2]}${s[3]}`,r=+`0x${s[4]}${s[5]}`;return new Bt().setRgbColor(`rgb(${e},${n},${r})`).asRgbColor()}static hexToRgbString(s){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;s=s.replace(e,(i,o,a,l)=>o+o+a+a+l+l);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),a=Number.parseInt(n[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new tt(this._builder)}equals(s){return!1}}class as{constructor(s){d(this,"_saturation",0);d(this,"_hue",0);d(this,"_lightness",0);d(this,"_alpha",0);const e=s.getRed()/255,n=s.getGreen()/255,r=s.getBlue()/255,i=s.getAlpha()/255,o=Math.min(e,Math.min(n,r)),a=Math.max(e,Math.max(n,r)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),e===a&&(this._hue=(n-r)/l),n===a&&(this._hue=2+(r-e)/l),r===a&&(this._hue=4+(e-n)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const s=new Bt;if(this._saturation===0)return s.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),s.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,n,i),a=this.setColor(e,n,r),l=r-1/3,u=this.setColor(e,n,l);return s.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),s.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(s,e,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=e+(s-e)*6*n:2*n<1?r=s:3*n<2?r=e+(s-e)*(2/3-n)*6:r=e,r}setLightness(s){this._lightness=s}}const F=class F extends tt{constructor(e,n){super(n);d(this,"_cssString");d(this,"_red");d(this,"_green");d(this,"_blue");d(this,"_alpha");let r=e.match(F.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],l=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(r=e.match(F.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return tt.rgbColorToHexValue(this)}getRed(){let e=this._red+F.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+F.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+F.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return W.RGB}clone(){return new F(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof F?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};d(F,"RGB_COLOR_AMT",0),d(F,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),d(F,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Mt=F;const Y=class Y extends tt{constructor(e,n,r,i){super(i);d(this,"_themeColorType");d(this,"_themeTint");d(this,"_themeColors");this._themeColorType=e,this._themeTint=n,this._themeColors=r}lumValue(e,n){if(e==null)return n;let r;return e<0?r=n*(1+e):r=n*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=os[this._themeColors];if(e==null)throw new Error("not find themeColors type");const n=e[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(Y._cacheThemeColor.has(this._themeColors)){if(r=Y._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Y._cacheThemeColor.set(this._themeColors,r);const i=new as(tt.hexValueToRgbColor(n));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new Y(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(e){return e instanceof Y?e._themeColorType===this._themeColorType:!1}getColorType(){return W.THEME}getThemeColorType(){return this._themeColorType}};d(Y,"_cacheThemeColor",new Map);let Pt=Y;const cr="rgb(",hr="rgba(",te={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class k{constructor(s){d(this,"_color");d(this,"_rgbColor");d(this,"_isValid",!1);if(s==null){this._setNullColor();return}if(s instanceof k){this._color={...s._color},this._rgbColor={...s._rgbColor};return}const e=ls(s);if(e==null){this._setNullColor();return}this._color=e;const n=gr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(s,e,n){var u,c;n=Math.min(1,Math.max(0,n));const r=new k(s).toRgb(),i=new k(e).toRgb(),o=(u=r.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(a-o)*n+o};return new k(l)}static getContrastRatio(s,e){const n=new k(s).getLuminance(),r=new k(e).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:s,g:e,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${s},${e},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(s){const{r:e,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[Ot(Math.round(e).toString(16)),Ot(Math.round(n).toString(16)),Ot(Math.round(r).toString(16)),Ot(Math.round(i*255).toString(16))];return s&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Or(this.toRgb())}toHsl(){return Cr(this.toRgb())}lighten(s=10){const e=this.toHsl();return e.l+=s,e.l=Math.min(Math.max(e.l,0),100),new k(e)}darken(s=10){const e=this.toHsl();return e.l-=s,e.l=Math.min(Math.max(e.l,0),100),new k(e)}setAlpha(s){return new k({...this._rgbColor,a:s})}getLuminance(){let{r:s,g:e,b:n}=this.toRgb();return s=Xt(s),e=Xt(e),n=Xt(n),Number((.2126*s+.7152*e+.0722*n).toFixed(3))}getBrightness(){const{r:s,g:e,b:n}=this.toRgb();return(s*299+e*587+n*114)/1e3}getAlpha(){var s;return(s=this._color.a)!=null?s:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const Ot=t=>t.length===1?`0${t}`:t,Xt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),ls=t=>{if(Ar(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const s=t.trim();if(te[s]){const e=te[s],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(s.startsWith("#"))return dr(s);if(s.startsWith("rgb"))return _r(s);if(s.startsWith("hsl"))return fr(s);if(s.startsWith("hsv"))return Er(s)},dr=t=>{const s=t.substring(1),e=new RegExp(`.{1,${s.length>=6?2:1}}`,"g");let n=s.match(e);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:Number.parseInt(n[0],16),g:Number.parseInt(n[1],16),b:Number.parseInt(n[2],16)};return n.length>3&&(r.a=Number.parseInt(n[3],16)/255),r},_r=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},fr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Er=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},gr=t=>{const s=ls(t);if(s!=null)return"r"in s?s:"l"in s?Rr(s):mr(s)},qt=(t,s,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(s-t)*6*e:e<1/2?s:e<2/3?t+(s-t)*(2/3-e)*6:t),Rr=t=>{let{h:s,s:e,l:n}=t;s/=360,e/=100,n/=100;let r=0,i=0,o=0;if(e===0)r=i=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,u=2*n-l;r=qt(u,l,s+1/3),i=qt(u,l,s),o=qt(u,l,s-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},mr=t=>{let{h:s,s:e,v:n}=t;s=s/360*6,e/=100,n/=100;const r=Math.floor(s),i=s-r,o=n*(1-e),a=n*(1-i*e),l=n*(1-(1-i)*e),u=r%6,c=[n,a,o,o,l,n][u],h=[l,n,n,a,o,o][u],_=[o,o,l,n,n,a][u],f={r:c*255,g:h*255,b:_*255};return t.a!==void 0&&(f.a=t.a),f},Cr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n),o=(r+i)/2;let a,l;if(r===i)a=l=0;else{const c=r-i;switch(l=o>.5?c/(2-r-i):c/(r+i),r){case s:a=(e-n)/c+(e<n?6:0);break;case e:a=(n-s)/c+2;break;default:a=(s-e)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return t.a!==void 0&&(u.a=t.a),u},Or=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n);let o;const a=r,l=r-i,u=r===0?0:l/r;if(r===i)o=0;else{switch(r){case s:o=(e-n)/l+(e<n?6:0);break;case e:o=(n-s)/l+2;break;default:o=(s-e)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return t.a!==void 0&&(c.a=t.a),c},Ir=t=>t==null,Ar=t=>!Ir(t)&&typeof t=="object";function Nr(t){const s=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,n=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}function Sr(t){const s=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,n=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}var P=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(P||{});function Lr(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Tr(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return Q.STRING;if(typeof t.v=="number")return Q.NUMBER;if(typeof t.v=="boolean")return Q.BOOLEAN}function br(t){if(t==null)return!0;const{v:s,f:e,si:n,p:r,s:i}=t;return!(!(s==null||typeof s=="string"&&s.length===0)||e!=null&&e.length>0||n!=null&&n.length>0||r!=null)}function wr(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var us=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(us||{}),cs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(cs||{}),ut=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(ut||{}),K=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(K||{}),hs=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(hs||{}),ds=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(ds||{}),_s=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(_s||{}),fs=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(fs||{}),Es=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(Es||{}),gs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(gs||{}),Rs=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(Rs||{}),ms=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(ms||{}),Cs=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(Cs||{}),Os=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(Os||{}),Is=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Is||{}),As=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(As||{}),Ns=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Ns||{}),Ss=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Ss||{}),Ls=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(Ls||{}),Ts=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Ts||{}),bs=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(bs||{}),ws=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(ws||{}),vs=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(vs||{}),Us=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(Us||{}),Ds=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(Ds||{}),ps=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(ps||{}),Ms=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Ms||{}),x=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(x||{}),w=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(w||{});function vr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}var de=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(de||{}),Ps=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Ps||{}),xs=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(xs||{});const Ur="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Dr=t=>crypto.getRandomValues(new Uint8Array(t)),pr=(t,s,e)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*s/t.length);return(i=s)=>{let o="";for(;;){let a=e(r),l=r;for(;l--;)if(o+=t[a[l]&n]||"",o.length===i)return o}}},Mr=(t,s=21)=>pr(t,s,Dr),Pr=(t=21)=>{let s="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)s+=Ur[e[t]&63];return s};const xr=/^-ms-/,Hr=/-([a-z])/g,j=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class R{static stringAt(s){let e="",n=s;for(;n>=j.length;)n/=j.length,n-=1,e+=j[n%j.length];const r=s%j.length;return e+=j[r],e}static indexAt(s){let e=0;for(let n=0;n<s.length-1;n+=1){const r=s.charCodeAt(n)-65,i=s.length-1-n;e+=j.length**i+j.length*r}return e+=s.charCodeAt(s.length-1)-65,e}static deleteBlank(s){return R.isString(s)?s.replace(/\s/g,""):s}static getSystemType(){const s=navigator.userAgent,e=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!e&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(s.indexOf("Windows NT 5.0")>-1||s.indexOf("Windows 2000")>-1)return"Windows 2000";if(s.indexOf("Windows NT 5.1")>-1||s.indexOf("Windows XP")>-1)return"Windows XP";if(s.indexOf("Windows NT 5.2")>-1||s.indexOf("Windows 2003")>-1)return"Windows 2003";if(s.indexOf("Windows NT 6.0")>-1||s.indexOf("Windows Vista")>-1)return"Windows Vista";if(s.indexOf("Windows NT 6.1")>-1||s.indexOf("Windows 7")>-1)return"Windows 7";if(s.indexOf("Windows NT 10")>-1||s.indexOf("Windows 10")>-1)return"Windows 10";if(s.indexOf("Windows NT 11")>-1||s.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const s=navigator.userAgent,e=s.indexOf("Opera")>-1,n=s.indexOf("compatible")>-1&&s.indexOf("MSIE")>-1&&!e,r=s.indexOf("Trident")>-1&&s.indexOf("rv:11.0")>-1,i=s.indexOf("Edge")>-1,o=s.indexOf("Firefox")>-1,a=s.indexOf("Safari")>-1&&s.indexOf("Chrome")===-1,l=s.indexOf("Chrome")>-1&&s.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(s);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":e?"Opera":a?"Safari":l?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(s=21,e){return e?Mr(e,s)():Pr(s)}static getClassName(s){return s.constructor.name}static deepMerge(s,...e){e.forEach(o=>o&&i(o));function n(o,a){o.forEach((l,u)=>{var c,h;if(R.isArray(l)){const _=(c=a[u])!=null?c:[];a[u]=_,n(l,_);return}if(R.isObject(l)){const _=(h=a[u])!=null?h:{};a[u]=_,r(l,_);return}a[u]=l})}function r(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(R.isObject(u)){const _=(c=a[l])!=null?c:{};a[l]=_,r(u,_);return}if(R.isArray(u)){const _=(h=a[l])!=null?h:[];a[l]=_,n(u,_);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(R.isArray(l)){const h=(u=s[a])!=null?u:[];s[a]=h,n(l,h);return}if(R.isObject(l)){const h=(c=s[a])!=null?c:{};s[a]=h,r(l,h);return}s[a]=l})}return s}static numberFixed(s,e){return Number(Number(s).toFixed(e))}static diffValue(s,e){function n(o,a){const l=R.getValueType(o),u=R.getValueType(a);return l!==u?!1:R.isArray(o)?r(o,a):R.isObject(o)?i(o,a):R.isDate(o)?o.getTime()===a.getTime():R.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(s.length!==e.length)return!1;for(let l=0,u=o.length;l<u;l++){const c=o[l],h=a[l];if(!n(c,h))return!1}return!0}function i(o,a){const l=Object.keys(o),u=Object.keys(a);if(l.length!==u.length)return!1;for(const c of l){if(!u.includes(c))return!1;const h=o[c],_=a[c];if(!n(h,_))return!1}return!0}return n(s,e)}static deepClone(s){if(!this.isDefine(s))return s;if(this.isRegExp(s))return new RegExp(s);if(this.isDate(s))return new Date(s);if(this.isArray(s)){const e=[];return s.forEach((n,r)=>{e[r]=R.deepClone(n)}),e}if(this.isObject(s)){const e={};return Object.keys(s).forEach(n=>{const r=s[n];e[n]=R.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(s)),e}return s}static getLanguage(){const s="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||s}static getValueType(s){return Object.prototype.toString.apply(s)}static isDefine(s){return s!=null}static isBlank(s){return this.isDefine(s)?this.isString(s)?s.trim()==="":!1:!0}static isAssignableFrom(s,e){return s instanceof e}static isBoolean(s){return this.getValueType(s)==="[object Boolean]"}static isPlainObject(s){return this.isDefine(s)?Object.getPrototypeOf(s)===Object.getPrototypeOf({}):!1}static isFunction(s){return this.getValueType(s)==="[object Function]"}static isDate(s){return this.getValueType(s)==="[object Date]"}static isRegExp(s){return this.getValueType(s)==="[object RegExp]"}static isArray(s){return this.getValueType(s)==="[object Array]"}static isString(s){return this.getValueType(s)==="[object String]"}static isNumber(s){return this.getValueType(s)==="[object Number]"}static isStringNumber(s){return!isNaN(Number.parseFloat(s))&&isFinite(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isEmptyObject(s){for(const e in s)return!1;return!0}static isMobile(){let s=0,e=0;return document.body.clientWidth&&(s=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||s<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const s=navigator.userAgent.toLowerCase();return String(s.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const s=navigator.userAgent;return s.indexOf("Android")>-1||s.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(s){return e=>{for(let n=0;n<s;n++)e&&e()}}static hasLength(s,e){return R.isDefine(s)?R.isDefine(e)?s.length===e:s.length>0:!1}static capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}static fCamelCase(s,e){return e.toUpperCase()}static camelCase(s){return s.replace(xr,"ms-").replace(Hr,this.fCamelCase)}static removeNull(s){return this.isObject(s)&&Object.keys(s).forEach(e=>{const n=s[e];n==null?delete s[e]:R.removeNull(n)}),s}static fillTwoDimensionalArray(s,e,n){return new Array(s).fill(n).map(r=>new Array(e).fill(n))}static numToWord(s){let e="";for(;s>0;){let n=s%26;n=n===0?n=26:n,e=String.fromCharCode(96+n)+e,s=(s-n)/26}return e.toLocaleUpperCase()}static ABCatNum(s){if(s==null||s.length===0)return Number.NaN;const e=s.toLowerCase().split(""),n=e.length;let r=0,i=0;for(let o=0;o<n;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(s){let i="";for(;s>=0;)i=String.fromCharCode(s%26+97)+i,s=Math.floor(s/26)-1;return i.toUpperCase()}static randSort(s){for(let e=0,n=s.length;e<n;e++){const r=Number.parseInt((Math.random()*n).toString()),i=s[r];s[r]=s[e],s[e]=i}return s}static commonExtend(s,e){const n={};for(const r in s)n[r]=s[r];for(const r in e)e[r]!=null&&(n[r]=e[r]);return n}static commonExtend1(s,e){for(const n in s)e[n]==null&&(e[n]=s[n]);return e}static arrayToObject(s){const e={};return s.forEach((n,r)=>{e[r]={},n.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(s,e,n,r){return e>=n&&r>=s}static isStartValidPosition(s){return/^[A-Za-z_]/.test(s)}static isValidParameter(s){const e=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(s),n=s.length<=255;return!e&&n}}function Fr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:l,endX:u}=t,c=s,h=e,_=s,f=e;if(n&&i){const{startRow:E,startColumn:g,endRow:m,endColumn:N,startY:U,endY:M,startX:V,endX:er}=i;c=E,h=g,_=m,f=N,o=U,a=M,l=V,u=er}return r&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,_=i.endRow,f=i.endColumn),{startRow:c,startColumn:h,endRow:_,endColumn:f,startY:o,endY:a,startX:l,endX:u}}function Wr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:l}=t;let u=s,c=e,h=s,_=e;return(n||r)&&(u=i,c=o,h=a,_=l),{startRow:u,startColumn:c,endRow:h,endColumn:_}}function Br(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function $(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Bt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function kr(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function Gr(t){return R.isString(t)&&t.length>0}function $r(t){return""}function Vr(t,s=!1){var i;let e="";const n=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${$(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${$(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${$(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${$(t.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,_,f,E,g,m,N;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${It((a=t.bd)==null?void 0:a.b.s)} ${(l=$(t.bd.b.cl))!=null?l:""}; `),(u=t.bd)!=null&&u.t&&(e+=`border-top: ${It((c=t.bd)==null?void 0:c.t.s)} ${(h=$(t.bd.t.cl))!=null?h:""}; `),(_=t.bd)!=null&&_.r&&(e+=`border-right: ${It((f=t.bd)==null?void 0:f.r.s)} ${(E=$(t.bd.r.cl))!=null?E:""}; `),(g=t.bd)!=null&&g.l&&(e+=`border-left: ${It((m=t.bd)==null?void 0:m.l.s)} ${(N=$(t.bd.l.cl))!=null?N:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${$(t.cl)}; `)}],["va",()=>{t.va===it.SUBSCRIPT?e+="vertical-align: sub; ":t.va===it.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,a,l;t.tr&&(e+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(l=t.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{t.ht===Z.LEFT?e+="text-align: left; ":t.ht===Z.RIGHT?e+="text-align: right; ":t.ht===Z.CENTER?e+="text-align: center; ":t.ht===Z.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===rt.BOTTOM?e+="vertical-align: bottom; ":t.vt===rt.TOP?e+="vertical-align: top; ":t.vt===rt.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===ft.CLIP?e+="white-space: clip; ":t.tb===ft.WRAP&&(e+="white-space: normal;")}],["pd",()=>{var c,h,_,f,E,g,m,N;const o=`${(c=t.pd)==null?void 0:c.b}pt`,a=`${(h=t.pd)==null?void 0:h.t}pt`,l=`${(_=t.pd)==null?void 0:_.l}pt`,u=`${(f=t.pd)==null?void 0:f.r}pt`;(E=t.pd)!=null&&E.b&&(e+=`padding-bottom: ${o}; `),(g=t.pd)!=null&&g.t&&(e+=`padding-top: ${a}; `),(m=t.pd)!=null&&m.l&&(e+=`padding-left: ${l}; `),(N=t.pd)!=null&&N.r&&(e+=`padding-right: ${u}; `)}]]),r=["bd","tr","tb"];for(const o in t)s&&r.includes(o)||(i=n.get(o))==null||i();return e}function It(t){let s="";return t===T.NONE?s="none":t===T.THIN?s="0.5pt solid":t===T.HAIR?s="0.5pt double":t===T.DOTTED?s="0.5pt dotted":t===T.DASHED||t===T.DASH_DOT?s="0.5pt dashed":t===T.DASH_DOT_DOT?s="0.5pt dotted":t===T.DOUBLE?s="0.5pt double":t===T.MEDIUM?s="1pt solid":t===T.MEDIUM_DASHED||t===T.MEDIUM_DASH_DOT?s="1pt dashed":t===T.MEDIUM_DASH_DOT_DOT?s="1pt dotted":t===T.SLANT_DASH_DOT?s="0.5pt dashed":t===T.THICK&&(s="1.5pt solid"),s}function jr(t){let s=0;if(t=t.trim(),t==="none")s=T.NONE;else if(t==="0.5pt solid")s=T.THIN;else if(t==="0.5pt double")s=T.HAIR;else if(t==="0.5pt dotted")s=T.DOTTED;else if(t==="0.5pt dashed")s=T.DASHED;else if(t==="1pt solid")s=T.MEDIUM;else if(t==="1pt dashed")s=T.MEDIUM_DASHED;else if(t==="1pt dotted")s=T.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")s=T.THICK;else if(!t.includes("none"))s=T.THIN;else return T.NONE;return s}function St(t,s){let e=t.body;if(s){const{headers:n,footers:r}=t;n!=null&&n[s]?e=n[s].body:r!=null&&r[s]&&(e=r[s].body)}return e}function Kr(t){const{startRow:s,endRow:e,startColumn:n,endColumn:r,rangeType:i}=t;return!(s<0||n<0||e<0||r<0||!(Number.isNaN(s)&&Number.isNaN(e))&&i===x.COLUMN||!(Number.isNaN(n)&&Number.isNaN(r))&&i===x.ROW)}function Yr(t,s){return{startRow:t,endRow:t,startColumn:s,endColumn:s}}function _e(t,s){return Object.prototype.toString.call(t)===Object.prototype.toString.call(s)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(s).length?!1:Object.keys(t).every(e=>_e(t[e],s[e])):t===s:!1}function Hs(t,s){const e=t.ts||{},n=s.ts||{};return t.sId!==s.sId?!1:_e(e,n)}function zr(t,s){return s.some(e=>t.indexOf(e)>-1)}function fe(t,s,e,n){if(t>s&&([t,s]=[s,t]),e>n&&([e,n]=[n,e]),s<e||n<t)return[t,s];e<t&&(e=t),n>s&&(n=s);const r=n-e+1;let i=[];return t===e?i=[n+1-r,s-r]:s===n?i=[t,e-1]:i=[t,s-r],i}function yr(t){if(t==null)return!1;const s=t.bullet;return(s==null?void 0:s.listId)!=null}function Xr(t){if(t==null)return!1;const s=t.paragraphStyle;return Fs(s)}function Fs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Ws(t,s,e){return t.slice(0,s)+e+t.slice(s)}function Bs(t,s,e){return s>e?t:t.slice(0,s)+t.slice(e)}function qr(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Jr(t){let s=0;for(let e=0;e<t.length;e++)s=t.charCodeAt(e)+(s<<6)+(s<<16)-s;return s>>>0}function Me(t){var s=typeof Symbol=="function"&&Symbol.iterator,e=s&&t[s],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pe(t,s){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),r,i=[],o;try{for(;(s===void 0||s-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return i}function xe(t,s,e){if(e||arguments.length===2)for(var n=0,r=s.length,i;n<r;n++)(i||!(n in s))&&(i||(i=Array.prototype.slice.call(s,0,n)),i[n]=s[n]);return t.concat(i||Array.prototype.slice.call(s))}function ct(t){return typeof t=="function"}function Zr(t){var s=function(n){Error.call(n),n.stack=new Error().stack},e=t(s);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Jt=Zr(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
2
2
  `+e.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=e}});function pe(t,s){if(t){var e=t.indexOf(s);0<=e&&t.splice(e,1)}}var Ye=function(){function t(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var s,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var c=Me(o),a=c.next();!a.done;a=c.next()){var u=a.value;u.remove(this)}}catch(R){s={error:R}}finally{try{a&&!a.done&&(e=c.return)&&e.call(c)}finally{if(s)throw s.error}}else o.remove(this);var l=this.initialTeardown;if(_t(l))try{l()}catch(R){i=R instanceof Kt?R.errors:[R]}var _=this._finalizers;if(_){this._finalizers=null;try{for(var d=Me(_),E=d.next();!E.done;E=d.next()){var f=E.value;try{He(f)}catch(R){i=i!=null?i:[],R instanceof Kt?i=xe(xe([],Pe(i)),Pe(R.errors)):i.push(R)}}}catch(R){n={error:R}}finally{try{E&&!E.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(i)throw new Kt(i)}},t.prototype.add=function(s){var e;if(s&&s!==this)if(this.closed)He(s);else{if(s instanceof t){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(s)}},t.prototype._hasParent=function(s){var e=this._parentage;return e===s||Array.isArray(e)&&e.includes(s)},t.prototype._addParent=function(s){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(s),e):e?[e,s]:s},t.prototype._removeParent=function(s){var e=this._parentage;e===s?this._parentage=null:Array.isArray(e)&&pe(e,s)},t.prototype.remove=function(s){var e=this._finalizers;e&&pe(e,s),s instanceof t&&s._removeParent(this)},t.EMPTY=function(){var s=new t;return s.closed=!0,s}(),t}();Ye.EMPTY;function ze(t){return t instanceof Ye||t&&"closed"in t&&_t(t.remove)&&_t(t.add)&&_t(t.unsubscribe)}function He(t){_t(t)?t():t.unsubscribe()}class Xe{constructor(s=!1){h(this,"skipNextObservers");h(this,"lastReturnValue");h(this,"isStopPropagation",!1);this.initialize(s)}initialize(s=!1){return this.skipNextObservers=s,this}stopPropagation(){this.isStopPropagation=!0}}function qe(t){return t instanceof pt}class pt{constructor(s,e){h(this,"_willBeUnregistered",!1);h(this,"unregisterOnNextCall",!1);this.callback=s,this.observable=e}dispose(){this.observable.remove(this)}}class Ht{constructor(s){h(this,"_observers",new Array);h(this,"_eventState");h(this,"_onObserverAdded");this._eventState=new Xe,s&&(this._onObserverAdded=s)}get observers(){return this._observers}add(s,e=!1,n=!1){if(!s)return null;const r=new pt(s,this);return r.unregisterOnNextCall=n,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(s){return this.add(s,void 0,!0)}remove(s){return s&&this._observers.indexOf(s)!==-1?(this._deferUnregister(s),!0):!1}removeCallback(s){for(let e=0;e<this._observers.length;e++){const n=this._observers[e];if(!n._willBeUnregistered&&n.callback===s)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(s){this._remove(s),this._observers.unshift(s)}makeObserverBottomPriority(s){this._remove(s),this._observers.push(s)}notifyObservers(s){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=s,e.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(s,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(n=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(s){let e=Promise.resolve(s);if(!this._observers.length)return e;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(e=e.then(()=>i.callback(s,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>s)}notifyObserver(s,e){if(s._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,s.callback(e,n),s.unregisterOnNextCall&&this._deferUnregister(s),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const s=new Ht;return s._observers=this._observers.slice(0),s}_deferUnregister(s){s.unregisterOnNextCall=!1,s._willBeUnregistered=!0,setTimeout(()=>{this._remove(s)},0)}_remove(s){if(!s)return!1;const e=this._observers.indexOf(s);return e!==-1?(this._observers.splice(e,1),!0):!1}}function v(t){let s=!1;return ze(t)?{dispose:()=>{s||(s=!0,t.unsubscribe())}}:qe(t)?{dispose:()=>{s||(s=!0,t.dispose())}}:{dispose:()=>{s||(s=!0,t())}}}function Or(t){return v(()=>{t.unsubscribe()})}class Ee{constructor(){h(this,"_disposables",new Set)}add(s){return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(s=>{s.dispose()}),this._disposables.clear()}}class M{constructor(){h(this,"_disposed",!1);h(this,"_collection",new Ee)}disposeWithMe(s){const e=ze(s)?v(s):s;return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Ir extends M{constructor(){super(...arguments);h(this,"dispose$",new C.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const ot=I.createIdentifier("univer.context-service");class Qe extends M{constructor(){super(...arguments);h(this,"_contextChanged$",new C.Subject);h(this,"contextChanged$",this._contextChanged$.asObservable());h(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var n;return(n=this._contextMap.get(e))!=null?n:!1}setContextValue(e,n){this._contextMap.set(e,n),this._contextChanged$.next({[e]:n})}subscribeContextValue$(e){return new C.Observable(n=>{const r=this._contextChanged$.pipe(C.filter(i=>typeof i[e]<"u")).subscribe(i=>n.next(i[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var Je=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(Je||{});const y=I.createIdentifier("univer.log");class Ze extends M{constructor(){super(...arguments);h(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):e(...n)}}var Ar=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Nr=(t,s,e,n)=>{for(var r=n>1?void 0:n?Cr(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ar(s,e,r),r},Fe=(t,s)=>(e,n)=>s(e,n,t),Ft=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Ft||{});const Rt=I.createIdentifier("anywhere.command-service");class Sr{constructor(){h(this,"_commands",new Map)}registerCommand(s){if(this._commands.has(s.id))throw new Error(`[CommandRegistry]: command "${s.id}" has been registered before.`);return this._commands.set(s.id,s),v(()=>{var e;this._commands.delete(s.id),(e=s.onDispose)==null||e.call(s)})}hasCommand(s){return this._commands.has(s)}getCommand(s){return this._commands.has(s)?[this._commands.get(s)]:null}}const ye={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(s,e){h(this,"_commandRegistry");h(this,"_beforeCommandExecutionListeners",[]);h(this,"_commandExecutedListeners",[]);h(this,"_multiCommandDisposables",new Map);h(this,"_commandExecutingLevel",0);h(this,"_commandExecutionStack",[]);this._injector=s,this._logService=e,this._commandRegistry=new Sr,this._registerCommand(ye)}hasCommand(s){return this._commandRegistry.hasCommand(s)}registerCommand(s){return this._registerCommand(s)}registerMultipleCommand(s){return this._registerMultiCommand(s)}beforeCommandExecuted(s){if(this._beforeCommandExecutionListeners.indexOf(s)===-1)return this._beforeCommandExecutionListeners.push(s),v(()=>{const e=this._beforeCommandExecutionListeners.indexOf(s);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(s){if(this._commandExecutedListeners.indexOf(s)===-1)return this._commandExecutedListeners.push(s),v(()=>{const e=this._commandExecutedListeners.indexOf(s);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(s,e,n){const r=this._commandRegistry.getCommand(s);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},c=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(u=>u(o,n));const a=await this._execute(i,e,n);return this._commandExecutedListeners.forEach(u=>u(o,n)),c.dispose(),a}throw new Error(`[CommandService]: command "${s}" is not registered.`)}syncExecuteCommand(s,e,n){var i;const r=this._commandRegistry.getCommand(s);if(r){const[o]=r,c={id:o.id,type:o.type,params:e};if(o.type===2){const l=fr(this._commandExecutionStack,_=>_.type===0);l&&(c.params=(i=c.params)!=null?i:{},c.params.trigger=l.id)}const a=this._pushCommandExecutionStack(c);this._beforeCommandExecutionListeners.forEach(l=>l(c,n));const u=this._syncExecute(o,e,n);return this._commandExecutedListeners.forEach(l=>l(c,n)),a.dispose(),u}throw new Error(`[CommandService]: command "${s}" is not registered.`)}_pushCommandExecutionStack(s){return this._commandExecutionStack.push(s),v(()=>q(this._commandExecutionStack,s))}_registerCommand(s){return this._commandRegistry.registerCommand(s)}_registerMultiCommand(s){const e=this._commandRegistry.getCommand(s.id);let n;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");n=e[0]}else{const i=new Ee;n=new Lr(s.id),i.add(this._commandRegistry.registerCommand(n)),i.add(v(()=>{this._multiCommandDisposables.delete(s.id)})),this._multiCommandDisposables.set(s.id,i)}const r=n.registerImplementation(s);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(s.id))==null||i.dispose()})}async _execute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${s.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(s.handler,e,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${s.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(s.handler,e,n),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}};exports.CommandService=Nr([Fe(0,I.Inject(I.Injector)),Fe(1,y)],exports.CommandService);class Lr{constructor(s){h(this,"name");h(this,"multi",!0);h(this,"type",0);h(this,"priority",0);h(this,"_implementations",[]);h(this,"handler",async(s,e)=>{if(!this._implementations.length)return!1;const n=s.get(y),r=s.get(ot),i=s.get(I.Injector);for(const o of this._implementations){const c=o.command.preconditions;if((!c||c&&c(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=s,this.name=s}registerImplementation(s){const e={command:s};return this._implementations.push(e),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(e);this._implementations.splice(n,1),(r=s.onDispose)==null||r.call(s)})}hasImplementations(){return this._implementations.length>0}}function fe(t,s,e){const n=t.map(r=>()=>s.syncExecuteCommand(r.id,r.params,e));return Ke(n)}function vr(t,s,e){const n=t.map(r=>()=>s.executeCommand(r.id,r.params,e));return je(n)}const ts=I.createIdentifier("univer.config-service");class es{constructor(){h(this,"_config",new Map)}getConfig(s){return this._config.get(s)}setConfig(s,e){this._config.set(s,e)}deleteConfig(s){this._config.delete(s)}}class ss extends M{constructor(){super(...arguments);h(this,"_error$",new C.Subject);h(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const br="__default_document_sub_component_id20231101__";class ns{constructor(){h(this,"_managerInfo",new Map);h(this,"_remove$",new C.Subject);h(this,"remove$",this._remove$.asObservable());h(this,"_andOrUpdate$",new C.Subject);h(this,"andOrUpdate$",this._andOrUpdate$.asObservable());h(this,"_pluginUpdate$",new C.Subject);h(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(s){return this._getFloatingObject(s)}getFloatObjects(s){return this._getFloatingObjects(s)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(s){const e=this._clearByParam(s);this._remove$.next(e)}addOrUpdate(s){const e=this._addByParam(s);this._andOrUpdate$.next(e)}BatchAddOrUpdate(s){const e=[];s.forEach(n=>{e.push(...this._addByParam(n))}),this._andOrUpdate$.next(e)}remove(s){const e=this._removeByParam(s);this._remove$.next(e)}pluginUpdateRefresh(s){this._pluginUpdate$.next(s)}_getFloatingObjects(s){var r;if(s==null)return;const{unitId:e,subUnitId:n}=s;return(r=this._managerInfo.get(e))==null?void 0:r.get(n)}_getFloatingObject(s){var i,o;if(s==null)return;const{unitId:e,subUnitId:n,floatingObjectId:r}=s;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(s){const{unitId:e,subUnitId:n,floatingObject:r,floatingObjectId:i}=s;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:e,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(s){const e=this._getFloatingObjects(s),{unitId:n,subUnitId:r}=s,i=[];return e==null||e.forEach((o,c)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:c,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(s){const e=this._getFloatingObjects(s),n=e==null?void 0:e.get(s.floatingObjectId);return n==null?[]:(e==null||e.delete(s.floatingObjectId),[{...s,floatingObject:n}])}}const rs=I.createIdentifier("univer.floating-object.service");class is{constructor(){h(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(s){this.cursor+=s}moveCursorTo(s){this.cursor=s}}function os(t,s){let e=0,n=t.length-1;for(;e<=n;){const r=Math.floor((n+e)/2);if(s<t[r]&&(r===0||s>=t[r-1]))return r;if(s>=t[r])e=r+1;else if(s<t[r])n=r-1;else return-1}return-1}function cs(t,s){let e=0,n=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(n=t[o],o===0?r=0:r=t[o-1],s>=r&&s<=n){i=o;break}if(n=t[e],e===0?r=0:r=t[e-1],s>=r&&s<n){i=e;break}e++,o--}return i}function Tr(t,s){let e=t.length-1;return s<0?-1:s<t[0]?0:s>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||s<=t[20]||s>=t[e-20]?e=cs(t,s):e=os(t,s),e)}function wr(t){const s=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(s)}var as=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(as||{}),L=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(L||{}),ls=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(ls||{}),F=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(F||{}),us=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(us||{}),hs=(t=>(t[t.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",t[t.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",t[t.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",t[t.NUMBER_LESS=3]="NUMBER_LESS",t[t.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",t[t.NUMBER_EQ=5]="NUMBER_EQ",t[t.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",t[t.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",t[t.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",t[t.TEXT_CONTAINS=9]="TEXT_CONTAINS",t[t.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",t[t.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",t[t.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",t[t.TEXT_EQ=13]="TEXT_EQ",t[t.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",t[t.TEXT_IS_URL=15]="TEXT_IS_URL",t[t.DATE_EQ=16]="DATE_EQ",t[t.DATE_BEFORE=17]="DATE_BEFORE",t[t.DATE_AFTER=18]="DATE_AFTER",t[t.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",t[t.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",t[t.DATE_BETWEEN=21]="DATE_BETWEEN",t[t.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",t[t.DATE_IS_VALID=23]="DATE_IS_VALID",t[t.ONE_OF_RANGE=24]="ONE_OF_RANGE",t[t.ONE_OF_LIST=25]="ONE_OF_LIST",t[t.BLANK=26]="BLANK",t[t.NOT_BLANK=27]="NOT_BLANK",t[t.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",t[t.BOOLEAN=29]="BOOLEAN",t[t.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",t[t.DATE_NOT_EQ=31]="DATE_NOT_EQ",t))(hs||{}),_s=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(_s||{}),ds=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(ds||{}),Es=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Es||{}),fs=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(fs||{});function Dr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var gs=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(gs||{}),Rs=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(Rs||{}),nt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(nt||{}),ms=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ms||{}),Os=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(Os||{}),Is=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(Is||{}),Wt=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Wt||{}),ft=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(ft||{}),As=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(As||{}),J=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(J||{}),rt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(rt||{}),it=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(it||{}),bt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(bt||{}),Tt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(Tt||{}),wt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(wt||{}),m=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(m||{}),dt=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(dt||{}),x=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(x||{}),Bt=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(Bt||{});const Cs={[Bt.OFFICE]:{[x.ACCENT1]:"#4472C4",[x.ACCENT2]:"#ED7D31",[x.ACCENT3]:"#A5A5A5",[x.ACCENT4]:"#70AD47",[x.ACCENT5]:"#5B9BD5",[x.ACCENT6]:"#70AD47",[x.DARK1]:"#000000",[x.DARK2]:"#44546A",[x.LIGHT1]:"#FFFFFF",[x.LIGHT2]:"#E7E6E6",[x.HYPERLINK]:"#0563C1",[x.FOLLOWED_HYPERLINK]:"#954F72"}};class kt{constructor(){h(this,"_themeValue",x.LIGHT1);h(this,"_themeColors");h(this,"_themeTint");h(this,"_rgbValue","");h(this,"_colorType");this._colorType=F.UNSUPPORTED,this._themeColors=Bt.OFFICE,this._themeTint=0}asRgbColor(){return new Dt(this._rgbValue,this)}asThemeColor(){return new Ut(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case F.THEME:return this.asThemeColor();case F.RGB:return this.asRgbColor();case F.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(s){return this._colorType=F.RGB,this._rgbValue=s,this}setThemeColors(s){this._colorType=F.THEME,this._themeColors=s}setThemeTint(s){this._colorType=F.THEME,this._themeTint=s}setThemeColor(s){return this._colorType=F.THEME,this._themeValue=s,this}getColorType(){return this._colorType}}class tt{constructor(s){h(this,"_builder");this._builder=s}static rgbColorToHexValue(s){return`#${((1<<24)+(s.getRed()<<16)+(s.getGreen()<<8)+s.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(s){s?s.indexOf("#")>-1&&(s=s.substring(1)):s="#000000";const e=+`0x${s[0]}${s[1]}`,n=+`0x${s[2]}${s[3]}`,r=+`0x${s[4]}${s[5]}`;return new kt().setRgbColor(`rgb(${e},${n},${r})`).asRgbColor()}static hexToRgbString(s){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;s=s.replace(e,(i,o,c,a)=>o+o+c+c+a+a);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),c=Number.parseInt(n[3],16);r=`rgba(${i},${o},${c})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new tt(this._builder)}equals(s){return!1}}class Ns{constructor(s){h(this,"_saturation",0);h(this,"_hue",0);h(this,"_lightness",0);h(this,"_alpha",0);const e=s.getRed()/255,n=s.getGreen()/255,r=s.getBlue()/255,i=s.getAlpha()/255,o=Math.min(e,Math.min(n,r)),c=Math.max(e,Math.max(n,r)),a=c-o;if(c===o){this._hue=0,this._saturation=0,this._lightness=c;return}this._lightness=(o+c)/2,this._lightness<.5?this._saturation=a/(c+o):this._saturation=a/(2-c-o),e===c&&(this._hue=(n-r)/a),n===c&&(this._hue=2+(r-e)/a),r===c&&(this._hue=4+(e-n)/a),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const s=new kt;if(this._saturation===0)return s.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),s.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,n,i),c=this.setColor(e,n,r),a=r-1/3,u=this.setColor(e,n,a);return s.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(c*255)},${Math.round(u*255)},${this._alpha*255})`),s.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(s,e,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=e+(s-e)*6*n:2*n<1?r=s:3*n<2?r=e+(s-e)*(2/3-n)*6:r=e,r}setLightness(s){this._lightness=s}}const H=class H extends tt{constructor(e,n){super(n);h(this,"_cssString");h(this,"_red");h(this,"_green");h(this,"_blue");h(this,"_alpha");let r=e.match(H.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],c=+r[3],a=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=a;return}if(r=e.match(H.RGB_EXTRACT),r){const i=+r[1],o=+r[2],c=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return tt.rgbColorToHexValue(this)}getRed(){let e=this._red+H.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+H.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+H.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return F.RGB}clone(){return new H(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof H?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};h(H,"RGB_COLOR_AMT",0),h(H,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),h(H,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Dt=H;const X=class X extends tt{constructor(e,n,r,i){super(i);h(this,"_themeColorType");h(this,"_themeTint");h(this,"_themeColors");this._themeColorType=e,this._themeTint=n,this._themeColors=r}lumValue(e,n){if(e==null)return n;let r;return e<0?r=n*(1+e):r=n*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=Cs[this._themeColors];if(e==null)throw new Error("not find themeColors type");const n=e[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(X._cacheThemeColor.has(this._themeColors)){if(r=X._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,X._cacheThemeColor.set(this._themeColors,r);const i=new Ns(tt.hexValueToRgbColor(n));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new X(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(e){return e instanceof X?e._themeColorType===this._themeColorType:!1}getColorType(){return F.THEME}getThemeColorType(){return this._themeColorType}};h(X,"_cacheThemeColor",new Map);let Ut=X;const Ur="rgb(",Mr="rgba(",yt={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class B{constructor(s){h(this,"_color");h(this,"_rgbColor");h(this,"_isValid",!1);if(s==null){this._setNullColor();return}if(s instanceof B){this._color={...s._color},this._rgbColor={...s._rgbColor};return}const e=Ss(s);if(e==null){this._setNullColor();return}this._color=e;const n=Fr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(s,e,n){var u,l;n=Math.min(1,Math.max(0,n));const r=new B(s).toRgb(),i=new B(e).toRgb(),o=(u=r.a)!=null?u:1,c=(l=i.a)!=null?l:1,a={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(c-o)*n+o};return new B(a)}static getContrastRatio(s,e){const n=new B(s).getLuminance(),r=new B(e).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:s,g:e,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${s},${e},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(s){const{r:e,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,c=[It(Math.round(e).toString(16)),It(Math.round(n).toString(16)),It(Math.round(r).toString(16)),It(Math.round(i*255).toString(16))];return s&&c[0][0]===c[0][1]&&c[1][0]===c[1][1]&&c[2][0]===c[2][1]&&c[3][0]===c[3][1]?o?`#${c[0][0]}${c[1][0]}${c[2][0]}${c[3][0]}`:`#${c[0][0]}${c[1][0]}${c[2][0]}`:o?`#${c[0]}${c[1]}${c[2]}${c[3]}`:`#${c[0]}${c[1]}${c[2]}`}toHsv(){return Gr(this.toRgb())}toHsl(){return kr(this.toRgb())}lighten(s=10){const e=this.toHsl();return e.l+=s,e.l=Math.min(Math.max(e.l,0),100),new B(e)}darken(s=10){const e=this.toHsl();return e.l-=s,e.l=Math.min(Math.max(e.l,0),100),new B(e)}setAlpha(s){return new B({...this._rgbColor,a:s})}getLuminance(){let{r:s,g:e,b:n}=this.toRgb();return s=Yt(s),e=Yt(e),n=Yt(n),Number((.2126*s+.7152*e+.0722*n).toFixed(3))}getBrightness(){const{r:s,g:e,b:n}=this.toRgb();return(s*299+e*587+n*114)/1e3}getAlpha(){var s;return(s=this._color.a)!=null?s:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const It=t=>t.length===1?`0${t}`:t,Yt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Ss=t=>{if(Vr(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const s=t.trim();if(yt[s]){const e=yt[s],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(s.startsWith("#"))return Pr(s);if(s.startsWith("rgb"))return xr(s);if(s.startsWith("hsl"))return pr(s);if(s.startsWith("hsv"))return Hr(s)},Pr=t=>{const s=t.substring(1),e=new RegExp(`.{1,${s.length>=6?2:1}}`,"g");let n=s.match(e);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:Number.parseInt(n[0],16),g:Number.parseInt(n[1],16),b:Number.parseInt(n[2],16)};return n.length>3&&(r.a=Number.parseInt(n[3],16)/255),r},xr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},pr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Hr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Fr=t=>{const s=Ss(t);if(s!=null)return"r"in s?s:"l"in s?Wr(s):Br(s)},zt=(t,s,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(s-t)*6*e:e<1/2?s:e<2/3?t+(s-t)*(2/3-e)*6:t),Wr=t=>{let{h:s,s:e,l:n}=t;s/=360,e/=100,n/=100;let r=0,i=0,o=0;if(e===0)r=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,u=2*n-a;r=zt(u,a,s+1/3),i=zt(u,a,s),o=zt(u,a,s-1/3)}const c={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(c.a=t.a),c},Br=t=>{let{h:s,s:e,v:n}=t;s=s/360*6,e/=100,n/=100;const r=Math.floor(s),i=s-r,o=n*(1-e),c=n*(1-i*e),a=n*(1-(1-i)*e),u=r%6,l=[n,c,o,o,a,n][u],_=[a,n,n,c,o,o][u],d=[o,o,a,n,n,c][u],E={r:l*255,g:_*255,b:d*255};return t.a!==void 0&&(E.a=t.a),E},kr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n),o=(r+i)/2;let c,a;if(r===i)c=a=0;else{const l=r-i;switch(a=o>.5?l/(2-r-i):l/(r+i),r){case s:c=(e-n)/l+(e<n?6:0);break;case e:c=(n-s)/l+2;break;default:c=(s-e)/l+4;break}c/=6}const u={h:Math.round(c*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(u.a=t.a),u},Gr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n);let o;const c=r,a=r-i,u=r===0?0:a/r;if(r===i)o=0;else{switch(r){case s:o=(e-n)/a+(e<n?6:0);break;case e:o=(n-s)/a+2;break;default:o=(s-e)/a+4;break}o/=6}const l={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(c*100)};return t.a!==void 0&&(l.a=t.a),l},$r=t=>t==null,Vr=t=>!$r(t)&&typeof t=="object";function jr(t){const s=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,n=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}function Kr(t){const s=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,n=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}var U=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(U||{});const Yr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let zr=t=>crypto.getRandomValues(new Uint8Array(t)),Xr=(t,s,e)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*s/t.length);return(i=s)=>{let o="";for(;;){let c=e(r),a=r;for(;a--;)if(o+=t[c[a]&n]||"",o.length===i)return o}}},qr=(t,s=21)=>Xr(t,s,zr),Qr=(t=21)=>{let s="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)s+=Yr[e[t]&63];return s};const Jr=/^-ms-/,Zr=/-([a-z])/g,K=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class g{static stringAt(s){let e="",n=s;for(;n>=K.length;)n/=K.length,n-=1,e+=K[n%K.length];const r=s%K.length;return e+=K[r],e}static indexAt(s){let e=0;for(let n=0;n<s.length-1;n+=1){const r=s.charCodeAt(n)-65,i=s.length-1-n;e+=K.length**i+K.length*r}return e+=s.charCodeAt(s.length-1)-65,e}static deleteBlank(s){return g.isString(s)?s.replace(/\s/g,""):s}static getSystemType(){const s=navigator.userAgent,e=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!e&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(s.indexOf("Windows NT 5.0")>-1||s.indexOf("Windows 2000")>-1)return"Windows 2000";if(s.indexOf("Windows NT 5.1")>-1||s.indexOf("Windows XP")>-1)return"Windows XP";if(s.indexOf("Windows NT 5.2")>-1||s.indexOf("Windows 2003")>-1)return"Windows 2003";if(s.indexOf("Windows NT 6.0")>-1||s.indexOf("Windows Vista")>-1)return"Windows Vista";if(s.indexOf("Windows NT 6.1")>-1||s.indexOf("Windows 7")>-1)return"Windows 7";if(s.indexOf("Windows NT 10")>-1||s.indexOf("Windows 10")>-1)return"Windows 10";if(s.indexOf("Windows NT 11")>-1||s.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const s=navigator.userAgent,e=s.indexOf("Opera")>-1,n=s.indexOf("compatible")>-1&&s.indexOf("MSIE")>-1&&!e,r=s.indexOf("Trident")>-1&&s.indexOf("rv:11.0")>-1,i=s.indexOf("Edge")>-1,o=s.indexOf("Firefox")>-1,c=s.indexOf("Safari")>-1&&s.indexOf("Chrome")===-1,a=s.indexOf("Chrome")>-1&&s.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(s);const l=Number.parseFloat(RegExp.$1);return l===7?"IE7":l===8?"IE8":l===9?"IE9":l===10?"IE10":"0"}return o?"FF":e?"Opera":c?"Safari":a?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(s=21,e){return e?qr(e,s)():Qr(s)}static getClassName(s){return s.constructor.name}static deepMerge(s,...e){e.forEach(o=>o&&i(o));function n(o,c){o.forEach((a,u)=>{var l,_;if(g.isArray(a)){const d=(l=c[u])!=null?l:[];c[u]=d,n(a,d);return}if(g.isObject(a)){const d=(_=c[u])!=null?_:{};c[u]=d,r(a,d);return}c[u]=a})}function r(o,c){Object.keys(o).forEach(a=>{var l,_;const u=o[a];if(g.isObject(u)){const d=(l=c[a])!=null?l:{};c[a]=d,r(u,d);return}if(g.isArray(u)){const d=(_=c[a])!=null?_:[];c[a]=d,n(u,d);return}c[a]=u})}function i(o){Object.keys(o).forEach(c=>{var u,l;const a=o[c];if(g.isArray(a)){const _=(u=s[c])!=null?u:[];s[c]=_,n(a,_);return}if(g.isObject(a)){const _=(l=s[c])!=null?l:{};s[c]=_,r(a,_);return}s[c]=a})}return s}static numberFixed(s,e){return Number(Number(s).toFixed(e))}static diffValue(s,e){function n(o,c){const a=g.getValueType(o),u=g.getValueType(c);return a!==u?!1:g.isArray(o)?r(o,c):g.isObject(o)?i(o,c):g.isDate(o)?o.getTime()===c.getTime():g.isRegExp(o)?o.toString()===c.toString():o===c}function r(o,c){if(s.length!==e.length)return!1;for(let a=0,u=o.length;a<u;a++){const l=o[a],_=c[a];if(!n(l,_))return!1}return!0}function i(o,c){const a=Object.keys(o),u=Object.keys(c);if(a.length!==u.length)return!1;for(const l of a){if(!u.includes(l))return!1;const _=o[l],d=c[l];if(!n(_,d))return!1}return!0}return n(s,e)}static deepClone(s){if(!this.isDefine(s))return s;if(this.isRegExp(s))return new RegExp(s);if(this.isDate(s))return new Date(s);if(this.isArray(s)){const e=[];return s.forEach((n,r)=>{e[r]=g.deepClone(n)}),e}if(this.isObject(s)){const e={};return Object.keys(s).forEach(n=>{const r=s[n];e[n]=g.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(s)),e}return s}static getLanguage(){const s="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||s}static getValueType(s){return Object.prototype.toString.apply(s)}static isDefine(s){return s!=null}static isBlank(s){return this.isDefine(s)?this.isString(s)?s.trim()==="":!1:!0}static isAssignableFrom(s,e){return s instanceof e}static isBoolean(s){return this.getValueType(s)==="[object Boolean]"}static isPlainObject(s){return this.isDefine(s)?Object.getPrototypeOf(s)===Object.getPrototypeOf({}):!1}static isFunction(s){return this.getValueType(s)==="[object Function]"}static isDate(s){return this.getValueType(s)==="[object Date]"}static isRegExp(s){return this.getValueType(s)==="[object RegExp]"}static isArray(s){return this.getValueType(s)==="[object Array]"}static isString(s){return this.getValueType(s)==="[object String]"}static isNumber(s){return this.getValueType(s)==="[object Number]"}static isStringNumber(s){return!isNaN(Number.parseFloat(s))&&isFinite(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isEmptyObject(s){for(const e in s)return!1;return!0}static isMobile(){let s=0,e=0;return document.body.clientWidth&&(s=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||s<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const s=navigator.userAgent.toLowerCase();return String(s.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const s=navigator.userAgent;return s.indexOf("Android")>-1||s.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(s){return e=>{for(let n=0;n<s;n++)e&&e()}}static hasLength(s,e){return g.isDefine(s)?g.isDefine(e)?s.length===e:s.length>0:!1}static capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}static fCamelCase(s,e){return e.toUpperCase()}static camelCase(s){return s.replace(Jr,"ms-").replace(Zr,this.fCamelCase)}static removeNull(s){return this.isObject(s)&&Object.keys(s).forEach(e=>{const n=s[e];n==null?delete s[e]:g.removeNull(n)}),s}static fillTwoDimensionalArray(s,e,n){return new Array(s).fill(n).map(r=>new Array(e).fill(n))}static numToWord(s){let e="";for(;s>0;){let n=s%26;n=n===0?n=26:n,e=String.fromCharCode(96+n)+e,s=(s-n)/26}return e.toLocaleUpperCase()}static ABCatNum(s){if(s==null||s.length===0)return Number.NaN;const e=s.toLowerCase().split(""),n=e.length;let r=0,i=0;for(let o=0;o<n;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(s){let i="";for(;s>=0;)i=String.fromCharCode(s%26+97)+i,s=Math.floor(s/26)-1;return i.toUpperCase()}static randSort(s){for(let e=0,n=s.length;e<n;e++){const r=Number.parseInt((Math.random()*n).toString()),i=s[r];s[r]=s[e],s[e]=i}return s}static commonExtend(s,e){const n={};for(const r in s)n[r]=s[r];for(const r in e)e[r]!=null&&(n[r]=e[r]);return n}static commonExtend1(s,e){for(const n in s)e[n]==null&&(e[n]=s[n]);return e}static arrayToObject(s){const e={};return s.forEach((n,r)=>{e[r]={},n.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(s,e,n,r){return e>=n&&r>=s}static isStartValidPosition(s){return/^[A-Za-z_]/.test(s)}static isValidParameter(s){const e=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(s),n=s.length<=255;return!e&&n}}function yr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:c,startX:a,endX:u}=t,l=s,_=e,d=s,E=e;if(n&&i){const{startRow:f,startColumn:R,endRow:A,endColumn:N,startY:P,endY:D,startX:j,endX:sr}=i;l=f,_=R,d=A,E=N,o=P,c=D,a=j,u=sr}return r&&(o=i.startY,c=i.endY,a=i.startX,u=i.endX,d=i.endRow,E=i.endColumn),{startRow:l,startColumn:_,endRow:d,endColumn:E,startY:o,endY:c,startX:a,endX:u}}function ti(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:c,endColumn:a}=t;let u=s,l=e,_=s,d=e;return(n||r)&&(u=i,l=o,_=c,d=a),{startRow:u,startColumn:l,endRow:_,endColumn:d}}function ei(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function G(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new kt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function si(t){return g.isString(t)&&t.substring(0,1)==="="&&t.length>1}function ni(t){return g.isString(t)&&t.length>0}function ri(t){return""}function ii(t,s=!1){var i;let e="";const n=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${G(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${G(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${G(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${G(t.bg)}; `)}],["bd",()=>{var o,c,a,u,l,_,d,E,f,R,A,N;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${At((c=t.bd)==null?void 0:c.b.s)} ${(a=G(t.bd.b.cl))!=null?a:""}; `),(u=t.bd)!=null&&u.t&&(e+=`border-top: ${At((l=t.bd)==null?void 0:l.t.s)} ${(_=G(t.bd.t.cl))!=null?_:""}; `),(d=t.bd)!=null&&d.r&&(e+=`border-right: ${At((E=t.bd)==null?void 0:E.r.s)} ${(f=G(t.bd.r.cl))!=null?f:""}; `),(R=t.bd)!=null&&R.l&&(e+=`border-left: ${At((A=t.bd)==null?void 0:A.l.s)} ${(N=G(t.bd.l.cl))!=null?N:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${G(t.cl)}; `)}],["va",()=>{t.va===wt.SUBSCRIPT?e+="vertical-align: sub; ":t.va===wt.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===ft.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===ft.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,c,a;t.tr&&(e+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(c=t.tr)!=null&&c.v?` ,${(a=t.tr)==null?void 0:a.v}`:""});`)}],["ht",()=>{t.ht===J.LEFT?e+="text-align: left; ":t.ht===J.RIGHT?e+="text-align: right; ":t.ht===J.CENTER?e+="text-align: center; ":t.ht===J.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===rt.BOTTOM?e+="vertical-align: bottom; ":t.vt===rt.TOP?e+="vertical-align: top; ":t.vt===rt.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===it.CLIP?e+="text-overflow: clip; ":t.tb===it.OVERFLOW?e+="text-break: overflow; ":t.tb===it.WRAP&&(e+="word-wrap: break-word;")}],["pd",()=>{var l,_,d,E,f,R,A,N;const o=`${(l=t.pd)==null?void 0:l.b}pt`,c=`${(_=t.pd)==null?void 0:_.t}pt`,a=`${(d=t.pd)==null?void 0:d.l}pt`,u=`${(E=t.pd)==null?void 0:E.r}pt`;(f=t.pd)!=null&&f.b&&(e+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(e+=`padding-top: ${c}; `),(A=t.pd)!=null&&A.l&&(e+=`padding-left: ${a}; `),(N=t.pd)!=null&&N.r&&(e+=`padding-right: ${u}; `)}]]),r=["bd","tr","tb"];for(const o in t)s&&r.includes(o)||(i=n.get(o))==null||i();return e}function At(t){let s="";return t===L.NONE?s="none":t===L.THIN?s="0.5pt solid":t===L.HAIR?s="0.5pt double":t===L.DOTTED?s="0.5pt dotted":t===L.DASHED||t===L.DASH_DOT?s="0.5pt dashed":t===L.DASH_DOT_DOT?s="0.5pt dotted":t===L.DOUBLE?s="0.5pt double":t===L.MEDIUM?s="1pt solid":t===L.MEDIUM_DASHED||t===L.MEDIUM_DASH_DOT?s="1pt dashed":t===L.MEDIUM_DASH_DOT_DOT?s="1pt dotted":t===L.SLANT_DASH_DOT?s="0.5pt dashed":t===L.THICK&&(s="1.5pt solid"),s}function oi(t){let s=0;if(t=t.trim(),t==="none")s=L.NONE;else if(t==="0.5pt solid")s=L.THIN;else if(t==="0.5pt double")s=L.HAIR;else if(t==="0.5pt dotted")s=L.DOTTED;else if(t==="0.5pt dashed")s=L.DASHED;else if(t==="1pt solid")s=L.MEDIUM;else if(t==="1pt dashed")s=L.MEDIUM_DASHED;else if(t==="1pt dotted")s=L.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")s=L.THICK;else return L.NONE;return s}function Nt(t,s){let e=t.body;if(s){const{headers:n,footers:r}=t;n!=null&&n[s]?e=n[s].body:r!=null&&r[s]&&(e=r[s].body)}return e}function ci(t){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=t;return!(s<0||n<0||e<0||r<0||Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(n)||Number.isNaN(r))}function ai(t,s){return{startRow:t,endRow:t,startColumn:s,endColumn:s}}function ge(t,s){return Object.prototype.toString.call(t)===Object.prototype.toString.call(s)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(s).length?!1:Object.keys(t).every(e=>ge(t[e],s[e])):t===s:!1}function Ls(t,s){const e=t.ts||{},n=s.ts||{};return t.sId!==s.sId?!1:ge(e,n)}function li(t,s){return s.some(e=>t.indexOf(e)>-1)}function Re(t,s,e,n){if(t>s&&([t,s]=[s,t]),e>n&&([e,n]=[n,e]),s<e||n<t)return[t,s];e<t&&(e=t),n>s&&(n=s);const r=n-e+1;let i=[];return t===e?i=[n+1-r,s-r]:s===n?i=[t,e-1]:i=[t,s-r],i}function ui(t){if(t==null)return!1;const s=t.bullet;return(s==null?void 0:s.listId)!=null}function hi(t){if(t==null)return!1;const s=t.paragraphStyle;return vs(s)}function vs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function bs(t,s,e){return t.slice(0,s)+e+t.slice(s)}function Ts(t,s,e){return s>e?t:t.slice(0,s)+t.slice(e)}function _i(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function di(t){let s=0;for(let e=0;e<t.length;e++)s=t.charCodeAt(e)+(s<<6)+(s<<16)-s;return s>>>0}class lt{static hasLength(s,e){return s.length===e}static getValueType(s){return Object.prototype.toString.apply(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isIterable(s){return s[Symbol.iterator]!=null}static isNumber(s){return this.getValueType(s)==="[object Number]"}}const S=Symbol("newer"),w=Symbol("older");class ws{constructor(s){h(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:s.key}):{done:!0,value:void 0}}}class Ds{constructor(s){h(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:s.value}):{done:!0,value:void 0}}}class Us{constructor(s){h(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:[s.key,s.value]}):{done:!0,value:void 0}}}var Oc,Ic;class te{constructor(s,e){h(this,"key");h(this,"value");h(this,Oc);h(this,Ic);this.key=s,this.value=e,this[S]=void 0,this[w]=void 0}toJSON(){return{key:this.key,value:this.value}}}Oc=S,Ic=w;class Ms{constructor(...s){h(this,"_keymap");h(this,"size",0);h(this,"limit");h(this,"oldest");h(this,"newest");h(this,"_onShiftListeners",[]);if(lt.hasLength(s,1)){if(lt.isNumber(s[0])){const e=s[0];this._initialize(e,void 0);return}if(lt.isIterable(s[0])){const e=s[0];this._initialize(0,e);return}return}if(lt.hasLength(s,2)){const e=s[0],n=s[1];this._initialize(e,n)}}onShift(s){if(this._onShiftListeners.indexOf(s)===-1)return this._onShiftListeners.push(s),v(()=>q(this._onShiftListeners,s));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(s,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=s,this._keymap=new Map,e&&(this.assign(e),s<1&&(this.limit=this.size))}_markEntryAsUsed(s){s!==this.newest&&(s[S]&&(s===this.oldest&&(this.oldest=s[S]),s[S][w]=s[w]),s[w]&&(s[w][S]=s[S]),s[S]=void 0,s[w]=this.newest,this.newest&&(this.newest[S]=s),this.newest=s)}assign(s){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=s[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new te(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[S]=o,o[w]=e):this.oldest=o,e=o,n--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(s,e){let n=this._keymap.get(s);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(s,n=new te(s,e)),this.newest?(this.newest[S]=n,n[w]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const s=this.oldest;if(s)return this.oldest&&this.oldest[S]?(this.oldest=this.oldest[S],this.oldest[w]=void 0):(this.oldest=void 0,this.newest=void 0),s[S]=s[w]=void 0,this._keymap.delete(s.key),--this.size,this._onShiftListeners.forEach(e=>e(s)),[s.key,s.value]}get(s){const e=this._keymap.get(s);if(e)return this._markEntryAsUsed(e),e.value}has(s){return this._keymap.has(s)}find(s){const e=this._keymap.get(s);return e?e.value:void 0}delete(s){const e=this._keymap.get(s);if(e)return this._keymap.delete(e.key),e[S]&&e[w]?(e[w][S]=e[S],e[S][w]=e[w]):e[S]?(e[S][w]=void 0,this.oldest=e[S]):e[w]?(e[w][S]=void 0,this.newest=e[w]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new ws(this.oldest)}values(){return new Ds(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Us(this.oldest)}forEach(s,e){typeof e!="object"&&(e=this);let n=this.oldest;for(;n;)s.call(e,n.value,n.key,this),n=n[S]}toJSON(){const s=new Array(this.size);let e=0,n=this.oldest;for(;n;)s[e++]={key:n.key,value:n.value},n=n[S];return s}toString(){let s="",e=this.oldest;for(;e;)s+=`${String(e.key)}:${e.value}`,e=e[S],e&&(s+=" < ");return s}}function Q(t){let s=0;const e=Object.keys(t);for(const n of e){const r=Number(n);s=Math.max(s,r)}return s+1}function ee(t,s,e){const n=Q(e),r=e;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=s}function se(t,s,e){const n=Object.keys(e).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+s?delete e[r]:e[r]!==void 0&&(e[r-s]=e[r],delete e[r])}function Ei(t,s){const e=t,n=Object.keys(e),r=n.length,i=s,o=Object.keys(i),c=o.length,a={};let u=0;for(let l=0;l<r;l++,u++){const _=n[l];a[u]=e[_]}for(let l=0;l<c;l++,u++){const _=o[l];a[u]=i[_]}return a}function fi(t,s,e){const n=e;if(Q(e)>0){const i={};let o=0;for(let c=t;c<=s;c++)n[c]&&(i[o]=n[c],o++);return i}return{}}function ne(t,s,e,n){const r=t>e;if(!r&&t+s>e)throw new Error("Invalid move operation");r?gi(t,s,e,n):Ri(t,s,e,n)}function gi(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const c=r[o];r[o+s]=c,c===void 0&&delete r[o+s]}i.forEach((o,c)=>{r[e+c]=o,o===void 0&&delete r[e+c]})}function Ri(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t+s;o<e;o++){const c=r[o];r[o-s]=c,c===void 0&&delete r[o-s]}i.forEach((o,c)=>{r[e+c-s]=o,o===void 0&&delete r[e+c-s]})}class k{constructor(s={}){h(this,"_matrix");this._setOriginValue(s)}static MakeObjectMatrixSize(s){return new k({[s-1]:{}})}getMatrix(){return this._matrix}forEach(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,o)===!1)return this}return this}forRow(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,Object.keys(o).map(a=>Number(a)))===!1)return this}return this}forValue(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(!o)continue;const c=Object.keys(o);for(const a of c){const u=Number(a),l=o[Number(a)];if(s(i,u,l)===!1)return this}}return this}swapRow(s,e){const n=this._matrix[s],r=this._matrix[e];this._matrix[s]=r,this._matrix[e]=n}getRow(s){return this._matrix[s]}getRowOrCreate(s){let e=this.getRow(s);return e==null&&(e={},this._matrix[s]=e),e}reset(){this._setOriginValue({})}hasValue(){const s=this._matrix,e=Object.keys(s);if(e.length===0)return!1;for(const n of e){const r=Number(n),i=s[r];if(Object.keys(i).length>0)return!0}return!1}getValue(s,e){var n,r;return(r=(n=this._matrix)==null?void 0:n[s])==null?void 0:r[e]}setValue(s,e,n){const r=this.getRowOrCreate(s);r[e]=n}deleteValue(s,e){var n,r;(r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e]}realDeleteValue(s,e){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e],this.getRow(s)){const o=this.getRow(s);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[s])}}setRow(s,e){this._matrix[s]=e}moveRows(s,e,n){ne(s,e,n,this._matrix)}moveColumns(s,e,n){this.forEach((r,i)=>{ne(s,e,n,i)})}insertRows(s,e){for(let n=s;n<s+e;n++)ee(n,{},this._matrix)}insertColumns(s,e){for(let n=s;n<s+e;n++)this.forEach((r,i)=>{ee(n,void 0,i)})}removeRows(s,e){se(s,e,this._matrix)}removeColumns(s,e){this.forEach((n,r)=>{se(s,e,r)})}getFragment(s,e,n,r){const i=new k;let o=0;for(let c=s;c<=e;c++){const a={};let u=0;for(let l=n;l<=r;l++){const _=this.getValue(c,l);a[u]=_,u++}i.setRow(o,a),o++}return i}getSlice(s,e,n,r){const i=new k;for(let o=s;o<=e;o++)for(let c=n;c<=r;c++){const a=this.getValue(o,c);a&&i.setValue(o,c,g.deepClone(a))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Q(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const c=this.getRow(o);if(c){const a=Q(c)-1;r=a>r?a:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const s=new Array;return this.forValue((e,n,r)=>{s.push(r)}),s}toArray(){const s=[];return this.forRow((e,n)=>{s[e]==null&&(s[e]=[]),n.forEach(r=>{s[e][r]=this.getValue(e,r)})}),s}toFullArray(){const s=this.getRange(),{endColumn:e,endRow:n}=s,r=[];for(let i=0;i<=n;i++){const o=Array(e+1).fill(void 0);r.push(o)}return this.forValue((i,o,c)=>{r[i][o]=c}),r}toJSON(){return this._matrix}clone(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getData(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getArrayData(){let s=0,e=0,n=!1,r=!1;const i=new k;return this.forEach((o,c)=>{n||(n=!0,s=o),Object.keys(c).forEach(a=>{const u=Number(a);r?u<e&&(e=u):(r=!0,e=u);const l=this.getValue(o,u);i.setValue(o-s,u-e,l)})}),i.getData()}getDataRange(){let s=0,e=0,n=0,r=-1,i=!1,o=!1;return this.forEach((c,a)=>{i||(i=!0,s=c);const u=Q(a)-1;u>n&&(n=u),Object.keys(a).forEach(l=>{const _=Number(l);o?_<e&&(e=_):(o=!0,e=_)}),c>r&&(r=c)}),{startRow:s,startColumn:e,endRow:r,endColumn:n}}getDiscreteRanges(){const s=[];return this.forEach((e,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const c of s)if(e>=c.startRow&&e<=c.endRow+1&&i>=c.startColumn&&i<=c.endColumn+1){c.endRow=Math.max(e,c.endRow),c.endColumn=Math.max(i,c.endColumn),o=!0;break}o||s.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),s}merge(s){this.forValue((e,n)=>{const r=s.getValue(e,n);r!=null&&this.setValue(e,n,r)})}_setOriginValue(s={}){this._matrix=s}}var me=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(me||{});class Ps{constructor(){h(this,"status","init")}}const mi=t=>t.some(s=>s.status==="init")?"init":t.some(s=>s.status==="fetching")?"fetching":"done";class Oi{constructor(s,e){h(this,"_values",[]);h(this,"_keys",[]);h(this,"_keyMaps",new Map);this._values=s,this._keys=e,s.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(s){this._keys.forEach(e=>{const n=s[e],r=this._keyMaps.get(e)||new Map;r.set(n,s),this._keyMaps.set(e,r)})}getValue(s,e){const n=e||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(s))return i.get(s)}return null}hasValue(s){for(let e=0;e<this._keys.length;e++){const n=this._keyMaps.get(this._keys[e]);if(n!=null&&n.has(s))return!0}return!1}addValue(s){this._values.push(s),this._initKeyMap(s)}setValue(s,e,n){const r=this.getValue(s);r&&Object.keys(r).includes(e)&&(r[e]=n)}deleteValue(s){const e=this.getValue(s);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===e);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(s){var e;return[...((e=this._keyMaps.get(s))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function re(t,s,e,n){return{forEach(r){for(let i=t;i<=s;i++)for(let o=e;o<=n;o++)r(i,o)}}}function Ii(t){if(t==null||t.length===0)return Number.NaN;const s=t.toLowerCase().split(""),e=s.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=n(s[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const Mt=65,xs=90,Ai=97;function Ci(t){const s=xs-Mt+1;let e="";for(;t>=0;)e=String.fromCharCode(t%s+Mt)+e,t=Math.floor(t/s)-1;return e}function ps(t,s){let e="";for(;s>0;)e+=t,s--;return e}function Ni(t,s=!1){const e=xs-Mt+1;let n=Ai;s&&(n=Mt);const r=String.fromCharCode(t%e+n),i=Math.floor(t/e)+1;return ps(r,i)}function Si(t,s){return t.zIndex>s.zIndex?1:t.zIndex===s.zIndex?0:-1}function Li(t,s){return t.zIndex>s.zIndex?-1:t.zIndex===s.zIndex?0:1}function at(t="index",s=1){return(e,n)=>e[t]>n[t]?s:e[t]===n[t]?0:-s}function vi(t,s){let e;return function(...n){const r=this,i=function(){e=null,t.apply(r,n)};clearTimeout(e),e=setTimeout(i,s)}}const ut={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},bi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ti={startRow:0,startColumn:0,endRow:0,endColumn:0},wi={row:0,column:0},St={ff:"Arial",fs:11,it:m.FALSE,bl:m.FALSE,ul:{s:m.FALSE},st:{s:m.FALSE},ol:{s:m.FALSE},tr:{a:0,v:m.FALSE},td:ft.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:J.UNSPECIFIED,vt:rt.UNSPECIFIED,tb:it.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Hs={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Fs=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Fs||{});function Ct(t,s){const{textRuns:e=[]}=s;let n=0;for(const i of e){const{ts:o={},st:c,ed:a}=i;if(o[t]==null)return m.FALSE;switch(t){case"bl":case"it":{if(o[t]===m.FALSE)return m.FALSE;break}case"ul":case"st":{if(o[t].s===m.FALSE)return m.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}n+=a-c}return s.dataStream.indexOf(`\r
4
- `)===n?m.TRUE:m.FALSE}class et{constructor(s,e,n){h(this,"_range");h(this,"_worksheet");this._deps=n,this._range=e,this._worksheet=s}static foreach(s,e){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s;for(let c=n;c<=i;c++)for(let a=r;a<=o;a++)e(c,a)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=[];for(let o=s;o<=e;o++){const c=[];for(let a=n;a<=r;a++)c.push(this.getMatrix().getValue(o,a)||null);i.push(c)}return i}getMatrix(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new k;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c,a,i.getValue(c,a)||null);return o}getMatrixObject(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new k;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c-s,a-n,i.getValue(c,a)||{});return o}getA1Notation(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=g.numToWord(n+1)+(s+1),o=g.numToWord(r+1)+(e+1)):(i=g.numToWord(r+1)+(e+1),o=g.numToWord(n+1)+(s+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||St.bg.rgb}))}getCell(s,e){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,c={startRow:n+s,endRow:n+s,startColumn:i+e,endColumn:i+e};return new et(this._worksheet,c,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(s={}){return this.getObjectValues(s)[0][0]}getObjectValues(s={}){var c;const{startRow:e,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,n,r,i).getData();if(s.isIncludeStyle){const a=this._deps.getStyles();for(let u=0;u<=n-e;u++)for(let l=0;l<=i-r;l++){if(o==null||((c=o==null?void 0:o[u])==null?void 0:c[l])==null)continue;const _=o[u][l].s;_&&(o[u][l].s=a.get(_))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||St.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Ct("ul",s.body)===m.TRUE?{s:m.TRUE}:{s:m.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Ct("st",s.body)===m.TRUE?{s:m.TRUE}:{s:m.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?s.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...s.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Ct("it",s.body)===m.TRUE?bt.ITALIC:bt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Ct("bl",s.body)===m.TRUE?Tt.BOLD:Tt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:s,_worksheet:e}=this,{startRow:n,endRow:r}=s;let i=0;for(let o=0;o<=r-n;o++){const c=e.getRowHeight(o);i+=c}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:s,endColumn:e}=this._range;return e-s+1}getNumRows(){const{startRow:s,endRow:e}=this._range;return e-s+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(s=>s.map(e=>(e==null?void 0:e.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>s.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:s,_worksheet:e}=this,{startColumn:n,endColumn:r}=s;let i=0;for(let o=0;o<=r-n;o++)i+=e.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(s){et.foreach(this._range,s)}_getStyles(s){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[s]||St[s]}))}}function Di(t,s){if(t.length===0||t[0].length===0)return null;const e=new Array(t[0].length).fill(0);let n=0,r=null;for(let i=0;i<t.length;i++){for(let c=0;c<t[0].length;c++)e[c]=s(t[i][c])?e[c]+1:0;const o=Ui(e);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Ui(t){const s=[];let e=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(s.length===0||t[r]>=t[s[s.length-1]])s.push(r++);else{const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}for(;s.length>0;){const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}return n}function Mi(t,s){et.foreach(s,(e,n)=>{t[e][n]=void 0})}function Pi(t,s){const e=t.toFullArray(),n=[];for(;;){const r=Di(e,s);if(!r)break;n.push(r),Mi(e,r)}return n}var Ws=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(Ws||{}),Oe=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
5
- `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(Oe||{});function Ie(t){const s=[];for(const e of t){const{st:n,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,n===r||g.isEmptyObject(i)&&e.sId==null)continue;if(s.length===0){s.push(e);continue}const o=s.pop();Ls(e,o)&&g.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?s.push({...e,st:o.st,ed:r}):s.push(o,e)}return s}function Bs(t,s,e,n){var u;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let c=!1;const a=(u=s.textRuns)!=null?u:[];if(a.length)for(let l=0,_=a.length;l<_;l++){const d=a[l];d.st+=n,d.ed+=n}for(let l=0;l<o;l++){const _=r[l],{st:d,ed:E}=_;if(E<n)i.push(_);else if(n>=d&&n<=E)if(c)_.st+=e,_.ed+=e,i.push(_);else{c=!0,_.ed+=e;const f=[];if(a.length){const R={..._,st:d,ed:a[0].st};f.push(R),f.push(...a);const A=a[a.length-1],N={..._,st:A.ed,ed:E+e};f.push(N)}else f.push(_);i.push(...f)}else _.st+=e,_.ed+=e,c||(c=!0,i.push(...a)),i.push(_)}c||(c=!0,i.push(...a)),t.textRuns=Ie(i)}function Ae(t,s,e,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=s,c=[];let a=-1;for(let l=0,_=r.length;l<_;l++){const d=r[l],{startIndex:E}=d;E>=n&&(d.startIndex+=e),a===-1&&E>=n&&(a=l),c.push(d.startIndex)}let u=-1;if(i){for(let l=0,_=i.length;l<_;l++){const d=i[l];d.startIndex+=n;const E=d.startIndex;u=c.indexOf(E)}if(o===Oe.PARAGRAPH&&i.length===1){const l=r[a],_=i[0],d=l.paragraphStyle,E=l.bullet;l.paragraphStyle=_.paragraphStyle,l.bullet=_.bullet,_.paragraphStyle=d,_.bullet=E}u!==-1&&r.splice(u,1),r.push(...i),r.sort(at("startIndex"))}}function xi(t,s,e,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:u}=a;u>=n&&(a.startIndex+=e)}const i=s.sectionBreaks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function ks(t,s,e,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:u}=a;u>=n&&(a.startIndex+=e)}const i=s.customBlocks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Ce(t,s,e,n){const{tables:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:u,endIndex:l}=a;u>n?(a.startIndex+=e,a.endIndex+=e):l>=n-1&&(a.endIndex+=e)}const i=s.tables;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function pi(t,s,e,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:u,endIndex:l}=a;u>n?(a.startIndex+=e,a.endIndex+=e):l>=n-1&&(a.endIndex+=e)}const i=s.customRanges;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Gs(t,s,e){const{textRuns:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{st:_,ed:d}=l;if(r<=_&&i>=d){o.push({...l,st:_-r,ed:d-r});continue}else _<=r&&d>=i?(o.push({...l,st:r-r,ed:i-r}),l.ed-=s):r>=_&&r<d?(o.push({...l,st:r-r,ed:d-r}),l.ed=r):i>_&&i<=d?(o.push({...l,st:_-r,ed:i-r}),l.st=i-s,l.ed-=s):_>=i&&(l.st-=s,l.ed-=s);c.push(l)}t.textRuns=c}return o}function $s(t,s,e){const{paragraphs:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{startIndex:_}=l;if(_>=r&&_<i){o.push({...l,startIndex:_-e});continue}else _>=i&&(l.startIndex-=s);c.push(l)}t.paragraphs=c}return o}function Vs(t,s,e){const{sectionBreaks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{startIndex:_}=l;if(_>=r&&_<=i){o.push({...l,startIndex:_-e});continue}else _>i&&(l.startIndex-=s);c.push(l)}t.sectionBreaks=c}return o}function js(t,s,e){const{customBlocks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{startIndex:_}=l;if(_>=r&&_<=i){o.push({...l,startIndex:_-e});continue}else _>i&&(l.startIndex-=s);c.push(l)}t.customBlocks=c}return o}function Ks(t,s,e){const{tables:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{startIndex:_,endIndex:d}=l;if(r<=_&&i>=d){o.push({...l,startIndex:_-e,endIndex:d-e});continue}else if(_<=r&&d>=i){const E=Re(_,d,r,i);l.startIndex=E[0],l.endIndex=E[1]}else i<_&&(l.startIndex-=s,l.endIndex-=s);c.push(l)}t.tables=c}return o}function Ys(t,s,e){const{customRanges:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,u=n.length;a<u;a++){const l=n[a],{startIndex:_,endIndex:d}=l;if(r<=_&&i>=d){o.push({...l,startIndex:_-e,endIndex:d-e});continue}else if(_<=r&&d>=i){const E=Re(_,d,r,i);l.startIndex=E[0],l.endIndex=E[1]}else i<_&&(l.startIndex-=s,l.endIndex-=s);c.push(l)}t.customRanges=c}return o}function Hi(t,s,e){const{dataStream:n}=t,r=e,i=e+s,o=Gs(t,s,e),c=$s(t,s,e),a=Vs(t,s,e),u=js(t,s,e),l=Ks(t,s,e),_=Ys(t,s,e);let d="";return n&&(t.dataStream=Ts(n,r,i),d=n.slice(r,i)),{dataStream:d,textRuns:o,paragraphs:c,sectionBreaks:a,customBlocks:u,tables:l,customRanges:_}}function Fi(t,s,e,n){t.dataStream=bs(t.dataStream,n,s.dataStream),Bs(t,s,e,n),Ae(t,s,e,n),xi(t,s,e,n),ks(t,s,e,n),Ce(t,s,e,n),pi(t,s,e,n)}var zs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(zs||{}),Xs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Xs||{}),Et=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(Et||{}),Y=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Y||{}),qs=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(qs||{}),Qs=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Qs||{}),Js=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(Js||{}),Zs=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(Zs||{}),ys=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(ys||{}),tn=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(tn||{}),en=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(en||{}),sn=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(sn||{}),nn=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(nn||{}),rn=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(rn||{}),on=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(on||{}),cn=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(cn||{}),an=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(an||{}),ln=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(ln||{}),un=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(un||{}),hn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(hn||{}),_n=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(_n||{}),dn=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(dn||{}),En=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(En||{}),fn=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(fn||{}),gn=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(gn||{}),Rn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Rn||{}),mn=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(mn||{}),Pt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Pt||{});const Wi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:Y.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:Y.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:Y.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:Y.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:Y.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:Y.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:63}]}};function Bi(t,s,e,n,r){const i=ki(t,s,e,n,r),o=Gi(t,s,e,n,r),c=$i(t,s,e,n,r),a=Vi(t,s,e,n,r),u=ji(t,s,e,n,r),l=Ki(t,s,e,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:c,customBlocks:a,tables:u,customRanges:l}}function ki(t,s,e,n,r){const{textRuns:i}=t,{textRuns:o}=s;if(i==null||o==null)return;const c=Gs(t,e,n);if(r!==U.REPLACE){const a=On(o,c,r);s.textRuns=a}return Bs(t,s,e,n),c}function On(t,s,e){if(s.length===0)return t;t=g.deepClone(t),s=g.deepClone(s);const n=[],r=t.length,i=s.length;let o=0,c=0,a=null;function u(){return a?(n.push(a),a=null,!0):!1}for(;o<r&&c<i;){const{st:E,ed:f,ts:R}=t[o],{st:A,ed:N,ts:P,sId:D}=s[c];let j;e===U.COVER?j={...P,...R}:j={...R,...P},f<A?(u()||n.push(t[o]),o++):N<E?(u()||n.push(s[c]),c++):(n.push({st:Math.min(E,A),ed:Math.max(E,A),ts:E<A?{...R}:{...P},sId:E<A?void 0:D}),n.push({st:Math.max(E,A),ed:Math.min(f,N),ts:j,sId:D}),f<N?(o++,s[c].st=f):(c++,t[o].st=N),a={st:Math.min(f,N),ed:Math.max(f,N),ts:f<N?{...P}:{...R},sId:f<N?D:void 0})}u();const l=n[n.length-1],_=t[r-1],d=s[i-1];return l.ed!==Math.max(_.ed,d.ed)&&(_.ed>d.ed?n.push(_):n.push(d)),Ie(n)}function Gi(t,s,e,n,r){const{paragraphs:i}=t,{paragraphs:o}=s;if(i==null||o==null)return;const c=$s(t,e,n);if(r!==U.REPLACE){const a=[];for(const u of o){const{startIndex:l,paragraphStyle:_,bullet:d}=u;let E=[];for(const f of c){const{startIndex:R,paragraphStyle:A,bullet:N}=f;let P,D;if(r===U.COVER?(P={...A,..._},D={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...N,...d}):(P={..._,...A},D={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...N}),l===R){E.push({startIndex:l,paragraphStyle:P,bullet:D});break}}a.push(...E),E=[]}s.paragraphs=a}return Ae(t,s,e,n),c}function $i(t,s,e,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=s;if(i==null||o==null)return;const c=Vs(t,e,n);if(r!==U.REPLACE){const a=[];for(const u of o){const{startIndex:l}=u;let _=[];for(const d of c){const{startIndex:E}=d;if(l===E){r===U.COVER?_.push({...d,...u}):_.push({...u,...d});break}}a.push(..._),_=[]}s.sectionBreaks=a}return Ae(t,s,e,n),c}function Vi(t,s,e,n,r){const{customBlocks:i}=t,{customBlocks:o}=s;if(i==null||o==null)return;const c=js(t,e,n);if(r!==U.REPLACE){const a=[];for(const u of o){const{startIndex:l}=u;let _=[];for(const d of c){const{startIndex:E}=d;if(l===E){r===U.COVER?_.push({...d,...u}):_.push({...u,...d});break}}a.push(..._),_=[]}s.customBlocks=a}return ks(t,s,e,n),c}function ji(t,s,e,n,r){const{tables:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=Ks(t,e,n);if(r!==U.REPLACE){const a=[];for(const u of o){const{startIndex:l,endIndex:_}=u;let d=[];for(const E of c){const{startIndex:f,endIndex:R}=E;if(f>=l&&R<=_){r===U.COVER?d.push({...E,...u}):d.push({...u,...E});break}}a.push(...d),d=[]}s.tables=a}return Ce(t,s,e,n),c}function Ki(t,s,e,n,r){const{customRanges:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=Ys(t,e,n);if(r!==U.REPLACE){const a=[];for(const u of o){const{startIndex:l,endIndex:_}=u;let d=[];for(const E of c){const{startIndex:f,endIndex:R}=E;if(f>=l&&R<=_){r===U.COVER?d.push({...E,...u}):d.push({...u,...E});break}}a.push(...d),d=[]}s.customRanges=a}return Ce(t,s,e,n),c}var O=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(O||{});function Ne(t,s,e){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(s,e)},c=[];for(const u of r){const l=g.deepClone(u),{st:_,ed:d}=l;g.hasIntersectionBetweenTwoRanges(_,d,s,e)&&(s>=_&&s<=d?c.push({...l,st:s,ed:Math.min(e,d)}):e>=_&&e<=d?c.push({...l,st:Math.max(s,_),ed:e}):c.push(l))}c.length&&(o.textRuns=c.map(u=>{const{st:l,ed:_}=u;return{...u,st:l-s,ed:_-s}}));const a=[];for(const u of i){const{startIndex:l}=u;l>=s&&l<=e&&a.push(g.deepClone(u))}return a.length&&(o.paragraphs=a.map(u=>({...u,startIndex:u.startIndex-s}))),o}function ie(t,s,e=U.COVER){if(s.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:c=[]}=s,a=On(o,r,e);a.length&&(n.textRuns=a);const u=[];let l=0,_=0;for(;l<i.length&&_<c.length;){const d=i[l],E=c[_],{startIndex:f}=d,{startIndex:R}=E;f===R?(u.push(g.deepMerge(d,E)),l++,_++):f<R?(u.push(g.deepClone(d)),l++):(u.push(g.deepClone(E)),_++)}return l<i.length&&u.push(...i.slice(l)),_<c.length&&u.push(...c.slice(_)),u.length&&(n.paragraphs=u),n}function Yi(t){const{body:s}=t;if(s==null)return!0;const{textRuns:e=[],paragraphs:n=[]}=s;return e.length===0&&n.length===0}function zi(t=g.generateRandomId(6),s=nt.EN_US,e=""){return{id:t,locale:s,title:e,body:{dataStream:`\r
6
- `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const Se={id:"default_doc",documentStyle:{}};class Xi{constructor(s){h(this,"snapshot");this.snapshot={...Se,...s}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var s;return((s=this.snapshot.settings)==null?void 0:s.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(s){this.snapshot.id=s}updateDocumentRenderConfig(s){const{documentStyle:e}=this.snapshot;e.renderConfig==null?e.renderConfig=s:e.renderConfig={...e.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:e,l:n,b:r,r:i}=s,{documentStyle:o}=this.snapshot;e!=null&&(o.marginTop=e),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(s,e){const{documentStyle:n}=this.snapshot;if(!n.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,e=e!=null?e:Number.POSITIVE_INFINITY,n.pageSize={width:s,height:e};return}s!==void 0&&(n.pageSize.width=s),e!==void 0&&(n.pageSize.height=e)}updateDrawing(s,e){const{drawings:n}=this,{width:r,height:i,left:o,top:c}=e,a=n==null?void 0:n[s];if(!a)return;const u=a.objectTransform;u.size.width=r,u.size.height=i,u.positionH.posOffset=o,u.positionV.posOffset=c}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class st extends Xi{constructor(e){var r;super(g.isEmptyObject(e)?zi():e);h(this,"_unitId");h(this,"headerModelMap",new Map);h(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:g.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Se,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const n=[],r=new is;return r.reset(),e.forEach(i=>{if(i=g.deepClone(i),i.t===O.RETAIN){const{coverType:o,body:c,len:a,segmentId:u}=i;if(c!=null){const l=this._updateApply(c,a,r.cursor,o,u);n.push({...i,t:O.RETAIN,coverType:U.REPLACE,body:l})}else n.push({...i,t:O.RETAIN});r.moveCursor(a)}else if(i.t===O.INSERT){const{body:o,len:c,segmentId:a,line:u}=i;this._insertApply(o,c,r.cursor,a),r.moveCursor(c),n.push({t:O.DELETE,len:c,line:u,segmentId:a})}else if(i.t===O.DELETE){const{len:o,segmentId:c}=i,a=this._deleteApply(o,r.cursor,c);n.push({...i,t:O.INSERT,body:a})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(e,n){const r=this.getBody();if(r!=null)return Ne(r,e,n)}_updateApply(e,n,r,i=U.COVER,o){if(e==null)throw new Error("updateBody is none");const c=this.snapshot,a=Nt(c,o);if(a==null)throw new Error("no body has changed");return Bi(a,e,n,r,i)}_deleteApply(e,n,r){const i=this.snapshot,o=Nt(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:Hi(o,e,n)}_insertApply(e,n,r,i){const o=this.snapshot,c=Nt(o,i);if(n!==0){if(c==null)throw new Error("no body has changed");Fi(c,e,n,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:n}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new st(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new st(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}class In{constructor(s={}){h(this,"_styles");h(this,"_cacheMap",new Ms(1e5));this._styles=s,this._generateCacheMap()}each(s){return Object.entries(this._styles).forEach(s),this}search(s,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const n=this._getExistingStyleId(s);return n||"-1"}get(s){return typeof s!="string"?s:(s=String(s),this._styles[s])}add(s,e){const n=g.generateRandomId(6);return this._styles[n]=s,this._cacheMap.set(e,n),n}setValue(s){if(s==null)return;const e=JSON.stringify(s),n=this.search(s,e);return n!=="-1"?n:this.add(s,e)}toJSON(){return this._styles}getStyleByCell(s){let e;s&&g.isObject(s.s)?e=s.s:e=(s==null?void 0:s.s)&&this.get(s.s);const n=s==null?void 0:s.interceptorStyle;return n?{...e,...n}:e}_generateCacheMap(){const{_styles:s,_cacheMap:e}=this;for(const n in s){const r=JSON.stringify(s[n]);e.set(r,n)}}_getExistingStyleId(s){const{_styles:e}=this;for(const n in e)if(g.diffValue(e[n],s))return n;return null}}var W=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(W||{});function An(t){return!!(t&&t.code&&t.code!==W.OK&&t.code!=="OK")}var V=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(V||{}),oe=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(oe||{});function qi(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Qi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return dt.STRING;if(typeof t.v=="number")return dt.NUMBER;if(typeof t.v=="boolean")return dt.BOOLEAN}function Ji(t){if(t==null)return!0;const{v:s,f:e,si:n,p:r,s:i}=t;return!(!(s==null||typeof s=="string"&&s.length===0)||e!=null&&e.length>0||n!=null&&n.length>0||r!=null)}function Zi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Le=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(Le||{}),Cn=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Cn||{}),Nn=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Nn||{});class yi{constructor(s,e){h(this,"_columnData",{});this._config=s,this._columnData=e}getColumnData(){return this._columnData}getColVisible(s){const{_columnData:e}=this,n=e[s];return n?n.hd!==m.TRUE:!0}getHiddenCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&c?(r=!1,n.push({rangeType:p.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:p.COLUMN}),n}getVisibleCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&!c?(r=!1,n.push({rangeType:p.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&c&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:p.COLUMN}),n}getColumnDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return Q(this._columnData)}getColumnWidth(s){const{_columnData:e}=this,n=this._config;let r=0;return r=(e[s]||{hd:m.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(s){const e=this._columnData[s];if(e)return e}getColumnOrCreate(s){const{_columnData:e}=this,n=this._config,r=e[s];if(r)return r;const i={w:n.defaultColumnWidth,hd:m.FALSE};return this._columnData[s]=i,i}}class to{constructor(s,e){h(this,"_rowData");this._config=s,this._rowData=e}getRowData(){return this._rowData}getRowDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(s,e=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const c=n[o+s]||{hd:m.FALSE,h:r.defaultRowHeight},{ia:a,ah:u,h:l=r.defaultRowHeight}=c;i+=(a==null||a===m.TRUE)&&typeof u=="number"?u:l}return i}getRow(s){return this._rowData[s]}getRowOrCreate(s){const{_rowData:e}=this,n=e[s];if(n)return n;const r=this._config,i={hd:m.FALSE,h:r.defaultRowHeight};return e[s]=i,i}getHiddenRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:p.ROW})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:p.ROW}),n}getVisibleRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&!c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:p.ROW})):!r&&c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:p.ROW}),n}getRowVisible(s){const e=this.getRow(s);return e?e.hd!==m.TRUE:!0}getSize(){return Q(this._rowData)}}const eo="DEFAULT_WORKSHEET_ROW_COUNT",Sn=1e3,so="DEFAULT_WORKSHEET_COLUMN_COUNT",Ln=20,no="DEFAULT_WORKSHEET_ROW_HEIGHT",vn=19,ro="DEFAULT_WORKSHEET_COLUMN_WIDTH",bn=73,io="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Tn=46,oo="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",wn=20;function Dn(t){const s={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:m.FALSE,rowCount:Sn,columnCount:Ln,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:bn,defaultRowHeight:vn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:m.TRUE,rowHeader:{width:Tn,hidden:m.FALSE},columnHeader:{height:wn,hidden:m.FALSE},selections:["A1"],rightToLeft:m.FALSE};return Object.keys(s).forEach(e=>{const n=e;typeof t[n]>"u"&&(t[n]=s[n])}),t}class Un extends M{constructor(){super(...arguments);h(this,"_cellContentInterceptors",[]);h(this,"_rowFilteredInterceptors",[]);h(this,"_rowVisibleInterceptors",[]);h(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(e,n){for(const r of this._cellContentInterceptors){const i=r.getCell(e,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(e){if(this._cellContentInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(e),v(()=>q(this._cellContentInterceptors,e))}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(e),v(()=>q(this._rowFilteredInterceptors,e))}registerRowVisibleInterceptor(e){if(this._rowVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(e),v(()=>q(this._rowVisibleInterceptors,e))}registerColVisibleInterceptor(e){if(this._colVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(e),v(()=>q(this._colVisibleInterceptors,e))}}class gt{constructor(s,e){h(this,"_sheetId");h(this,"_snapshot");h(this,"_cellData");h(this,"_rowManager");h(this,"_columnManager");h(this,"_viewModel");var o;this._styles=e,this._snapshot=Dn(s);const{columnData:n,rowData:r,cellData:i}=this._snapshot;this._sheetId=(o=this._snapshot.id)!=null?o:g.generateRandomId(6),this._cellData=new k(i),this._rowManager=new to(this._snapshot,r),this._columnManager=new yi(this._snapshot,n),this._viewModel=new Un}__interceptViewModel(s){s(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const s=this.getCellMatrix(),e=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,c=!1,a=!1;return s.forEach((u,l)=>{Object.keys(l).forEach(_=>{const d=+_,E=s.getValue(u,d),f=E!=null&&E.s?this._styles.get(E.s):null,R=(f==null?void 0:f.bd)&&(f.bd.b||f.bd.l||f.bd.r||f.bd.t||f.bd.bc_tr||f.bd.bl_tr||f.bd.ml_tr||f.bd.tl_bc||f.bd.tl_br||f.bd.tl_mr);(E&&(E.v||E.p)||f!=null&&f.bg||R)&&(c?n=Math.min(n,u):(n=u,c=!0),r=Math.max(r,u),a?i=Math.min(i,d):(a=!0,i=d),o=Math.max(o,d))})}),e.forEach(u=>{c?n=Math.min(n,u.startRow):(n=u.startRow,c=!0),r=Math.max(r,u.endRow),a?i=Math.min(i,u.startColumn):(i=u.startColumn,c=!0),o=Math.max(o,u.endColumn)}),!c||!a?null:{startColumn:i,startRow:n,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:s}=this,e=g.deepClone(s);return new gt(e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(s,e){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(Z.intersects({startRow:s,startColumn:e,endRow:s,endColumn:e},i))return i}return null}getCell(s,e){return s<0||e<0?null:this._viewModel.getCell(s,e)}getCellRaw(s,e){return this.getCellMatrix().getValue(s,e)}getMatrixWithMergedCells(s,e,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(a=>Z.intersects({startRow:s,startColumn:e,endRow:n,endColumn:r},a)),c=new k;return re(s,n,e,r).forEach((a,u)=>{const l=i.getValue(a,u);l&&c.setValue(a,u,l)}),o.forEach(a=>{const{startColumn:u,startRow:l,endColumn:_,endRow:d}=a;re(l,d,u,_).forEach((E,f)=>{E===l&&f===u&&c.setValue(E,f,{...i.getValue(E,f),rowSpan:d-l+1,colSpan:_-u+1}),(E!==l||f!==u)&&c.realDeleteValue(E,f)})}),c}getRange(s,e,n,r){return typeof s=="object"?new et(this,s,{getStyles:()=>this._styles}):new et(this,{startRow:s,startColumn:e,endColumn:r||e,endRow:n||s},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:s}=this,{columnCount:e}=s;return e}getMaxRows(){const{_snapshot:s}=this,{rowCount:e}=s;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(s){this._snapshot.rowCount=s}getColumnCount(){return this._snapshot.columnCount}setColumnCount(s){this._snapshot.columnCount=s}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:s}=this,{showGridlines:e}=s;return e===0}getTabColor(){const{_snapshot:s}=this,{tabColor:e}=s;return e}getColumnWidth(s){return this.getColumnManager().getColumnWidth(s)}getRowHeight(s){return this.getRowManager().getRowHeight(s)}getRowVisible(s){return this.getRowManager().getRowVisible(s)}getHiddenRows(s,e){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(s,e);return r.forEach(i=>i.endColumn=n),r}getColVisible(s){return this._columnManager.getColVisible(s)}getHiddenCols(s,e){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(s,e);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const s=this.getRowCount();return this._rowManager.getVisibleRows(0,s-1)}getVisibleCols(){const s=this.getColumnCount();return this._columnManager.getVisibleCols(0,s-1)}isRightToLeft(){const{_snapshot:s}=this,{rightToLeft:e}=s;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(s){return s&&(s.v!==void 0||s.f!==void 0||s.p!==void 0)}iterateByRow(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(a>i&&(c+=1,a=n),c>r)return{done:!0,value:void 0};const u=o.getCell(c,a),l=o.getMergedCell(c,a);if(l&&(!u||c!==l.startRow||a!==l.startColumn))a=l.endColumn+1;else if(!u)a+=1;else{const _={row:c,col:a,value:u};return l&&(_.colSpan=l.endColumn-l.startColumn+1,_.rowSpan=l.endRow-l.startRow+1),a+=1,{done:!1,value:_}}}}}}iterateByColumn(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(c>r&&(a+=1,c=e),a>i)return{done:!0,value:void 0};const u=o.getCell(c,a),l=o.getMergedCell(c,a);if(l&&(!u||c!==l.startRow||a!==l.startColumn))c=l.endRow+1;else if(!u)c+=1;else{const _={row:c,col:a,value:u};return l&&(_.colSpan=l.endColumn-l.startColumn+1,_.rowSpan=l.endRow-l.startRow+1),c+=1,{done:!1,value:_}}}}}}}function co(t){var n,r;const s=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(s)return s;const e=t.v;return typeof e=="string"?t.t===oe.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===oe.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}const ao="0.1.7";function lo(t="",s=nt.ZH_CN,e=""){return{id:t,sheetOrder:[],name:e,appVersion:ao,locale:s,styles:{},sheets:{},resources:[]}}var uo=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,_o=(t,s,e,n)=>{for(var r=n>1?void 0:n?ho(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&uo(s,e,r),r},Eo=(t,s)=>(e,n)=>s(e,n,t);function fo(t,s){return`${t.getUnitId()}|${s.getSheetId()}`}exports.Workbook=class extends M{constructor(e={},n){super();h(this,"_sheetCreated$",new C.Subject);h(this,"sheetCreated$",this._sheetCreated$.asObservable());h(this,"_sheetDisposed$",new C.Subject);h(this,"sheetDisposed$",this._sheetDisposed$.asObservable());h(this,"_activeSheet$",new C.BehaviorSubject(null));h(this,"activeSheet$",this._activeSheet$.asObservable());h(this,"_worksheets");h(this,"_styles");h(this,"_snapshot");h(this,"_unitId");h(this,"_count");this._logService=n;const r=lo();g.isEmptyObject(e)?this._snapshot=r:this._snapshot=g.commonExtend(r,e);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=g.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new In(i),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return g.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(n,0,e);const c=new gt(r,this._styles);return this._worksheets.set(e,c),this._sheetCreated$.next(c),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const n=this._snapshot.sheetOrder;for(let i=0,o=n.length;i<o;i++){const c=this._worksheets.get(n[i]);if(c&&c.isSheetHidden()!==m.TRUE)return this.setActiveSheet(c),c}const r=this._worksheets.get(n[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:e}=this._snapshot,n=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===m.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const n=e;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:ut}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let n=e;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}generateNewSheetName(e){let n=e+this._count;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}_getCellRange(e){var l,_,d,E,f;let n="",r="";if(e.indexOf("!")>-1){const R=e.split("!");n=R[0],r=R[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=e;if(r.indexOf(":")===-1){const R=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,A=g.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(R)&&!Number.isNaN(A)?{sheetId:n,range:{startRow:R,endRow:R,startColumn:A,endColumn:A}}:ut}r=r.split(":");const i=[0,0],o=[0,0],c=((l=this.getSheetBySheetName(n))==null?void 0:l.getMaxRows())||((_=this.getActiveSheet())==null?void 0:_.getMaxRows()),a=((d=this.getSheetBySheetName(n))==null?void 0:d.getMaxColumns())||((E=this.getActiveSheet())==null?void 0:E.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=c),i[0]>i[1]||(o[0]=g.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=g.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=a),o[0]>o[1])?ut:{sheetId:((f=this.getSheetBySheetName(n))==null?void 0:f.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:n}=this,{sheets:r,sheetOrder:i}=e;if(g.isEmptyObject(r)){const o=g.generateRandomId();r[o]={id:o}}for(const o in r){const c=r[o],{name:a}=c;c.name=this.uniqueSheetName(a),c.name!==a&&this._logService.debug("[Workbook]",`The worksheet name ${a} is duplicated, we changed it to ${c.name}. Please fix the problem in your snapshot.`);const u=new gt(c,this._styles);n.set(o,u),i.includes(o)||i.push(o)}}};exports.Workbook=_o([Eo(1,y)],exports.Workbook);class ve{constructor(s){h(this,"_snapshot");h(this,"_unitId");var e;this._snapshot={...Hs,...s},this._unitId=(e=this._snapshot.id)!=null?e:g.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var s;return(s=this._snapshot.body)==null?void 0:s.pages}getPageOrder(){var s;return(s=this._snapshot.body)==null?void 0:s.pageOrder}getPage(s){const e=this.getPages();return e==null?void 0:e[s]}getElementsByPage(s){var e;return(e=this.getPage(s))==null?void 0:e.pageElements}getElement(s,e){var n;return(n=this.getElementsByPage(s))==null?void 0:n[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:Le.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const xt="FOCUSING_SHEET",ce="FOCUSING_DOC",ae="FOCUSING_SLIDE",go="FOCUSING_EDITOR_BUT_HIDDEN",Mn="EDITOR_ACTIVATED",Ro="FOCUSING_EDITOR_INPUT_FORMULA",Pn="FOCUSING_FORMULA_EDITOR",mo="FOCUSING_UNIVER_EDITOR",Oo="FOCUSING_EDITOR_INPUT_FORMULA",Io="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var Ao=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,No=(t,s,e,n)=>{for(var r=n>1?void 0:n?Co(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ao(s,e,r),r},So=(t,s)=>(e,n)=>s(e,n,t),xn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(xn||{});const ct=I.createIdentifier("univer.current");exports.UniverInstanceService=class extends M{constructor(e,n){super();h(this,"_focused",null);h(this,"_focused$",new C.BehaviorSubject(null));h(this,"focused$",this._focused$.asObservable());h(this,"_currentSheet$",new C.BehaviorSubject(null));h(this,"currentSheet$",this._currentSheet$.asObservable());h(this,"_currentDoc$",new C.BehaviorSubject(null));h(this,"currentDoc$",this._currentDoc$.asObservable());h(this,"_currentSlide$",new C.BehaviorSubject(null));h(this,"currentSlide$",this._currentSlide$.asObservable());h(this,"_sheetAdded$",new C.Subject);h(this,"sheetAdded$",this._sheetAdded$.asObservable());h(this,"_docAdded$",new C.Subject);h(this,"docAdded$",this._docAdded$.asObservable());h(this,"_slideAdded$",new C.Subject);h(this,"slideAdded$",this._slideAdded$.asObservable());h(this,"_sheetDisposed$",new C.Subject);h(this,"sheetDisposed$",this._sheetDisposed$.asObservable());h(this,"_docDisposed$",new C.Subject);h(this,"docDisposed$",this._docDisposed$.asObservable());h(this,"_slideDisposed$",new C.Subject);h(this,"slideDisposed$",this._slideDisposed$.asObservable());h(this,"_sheets",[]);h(this,"_docs",[]);h(this,"_slides",[]);this._handler=e,this._contextService=n}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,n){const r=this._docs.find(i=>i.getUnitId()===e);if(r!=null){const i=this._docs.indexOf(r);this._docs.splice(i,1)}this.addDoc(n)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(n=>n.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(n=>n.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(n=>n.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[ce,xt,ae].forEach(n=>this._contextService.setContextValue(n,!1)),this._focused instanceof exports.Workbook?this._contextService.setContextValue(xt,!0):this._focused instanceof st?this._contextService.setContextValue(ce,!0):this._focused instanceof ve&&this._contextService.setContextValue(ae,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitId ${e}`)}disposeDocument(e){const n=this.getUniverDocInstance(e);if(n){const o=this._docs.indexOf(n);return this._docs.splice(o,1),this._docDisposed$.next(n),!0}const r=this.getUniverSheetInstance(e);if(r){const o=this._sheets.indexOf(r);return this._sheets.splice(o,1),this._sheetDisposed$.next(r),!0}const i=this.getUniverSlideInstance(e);if(i){const o=this._slides.indexOf(i);return this._slides.splice(o,1),this._slideDisposed$.next(i),!0}return!1}};exports.UniverInstanceService=No([So(1,ot)],exports.UniverInstanceService);var b=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(b||{});const Lo={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Lt=new Map;function be(t,s){return function(r){Te(t,s)}}function Te(t,s){Lt.has(t)||Lt.set(t,[]),Lt.get(t).push(s)}var vo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,pn=(t,s,e,n)=>{for(var r=n>1?void 0:n?bo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&vo(s,e,r),r},le=(t,s)=>(e,n)=>s(e,n,t);exports.LifecycleService=class extends M{constructor(e){super();h(this,"_lifecycle$",new C.BehaviorSubject(b.Starting));h(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=e,this._reportProgress(b.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");e!==this.stage&&(this._reportProgress(e),this._lifecycle$.next(e))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new C.Observable(e=>(this.stage===b.Starting||(this.stage===b.Ready?e.next(b.Starting):this.stage===b.Rendered?(e.next(b.Starting),e.next(b.Ready)):(e.next(b.Starting),e.next(b.Ready),e.next(b.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Lo[e]}".`)}};exports.LifecycleService=pn([le(0,y)],exports.LifecycleService);exports.LifecycleInitializerService=class extends M{constructor(e,n){super();h(this,"_started",!1);this._lifecycleService=e,this._injector=n}start(){this._started||(this._started=!0,this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const n=Lt.get(e);n==null||n.forEach(r=>{this._injector.has(r)&&this._injector.get(r)})}};exports.LifecycleInitializerService=pn([le(0,I.Inject(exports.LifecycleService)),le(1,I.Inject(I.Injector))],exports.LifecycleInitializerService);class ht extends M{constructor(){super();h(this,"_currentLocale",nt.ZH_CN);h(this,"_locales",null);h(this,"localeChanged$",new C.Subject);h(this,"t",(e,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return n.forEach((c,a)=>{o=o.replace(`{${a}}`,c)}),o}else return e});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}load(e){var n;this._locales=g.deepMerge((n=this._locales)!=null?n:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,n){const r=n.shift();if(r&&e&&r in e){const i=e[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const we=I.createIdentifier("resource-manager-service"),Hn=I.createIdentifier("ResourcePersistenceService");Te(b.Ready,Hn);var To=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,Do=(t,s,e,n)=>{for(var r=n>1?void 0:n?wo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&To(s,e,r),r},We=(t,s)=>(e,n)=>s(e,n,t);const De=I.createIdentifier("univer.permission-service"),Be="PERMISSION";exports.PermissionService=class extends M{constructor(e,n){super();h(this,"_permissionPointMap",new Map);h(this,"deletePermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});h(this,"addPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(n.id)?!1:(r.set(n.id,new C.BehaviorSubject(n)),this._permissionPointMap.set(e,r),!0)});h(this,"updatePermissionPoint",(e,n,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(n);if(o){const c=o.getValue();c.value=r,c.status=me.DONE,o.next(c)}});h(this,"getPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=n}_init(){this.disposeWithMe(v(this._univerInstanceService.sheetAdded$.subscribe(e=>{this._resourceManagerService.registerPluginResource(e.getUnitId(),Be,{onChange:(n,r)=>{r.forEach(i=>{this.getPermissionPoint(n,i.id)?this.updatePermissionPoint(n,i.id,i.value):this.addPermissionPoint(n,i)})},toJson:n=>this._toJson(n),parseJson:n=>this._parseJson(n)})}))),this.disposeWithMe(v(this._univerInstanceService.sheetDisposed$.subscribe(e=>{this._resourceManagerService.disposePluginResource(e.getUnitId(),Be)})))}_toJson(e){const n=this._permissionPointMap.get(e);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const c=n.get(o);return c&&i.push(c.getValue()),i},[])),JSON.stringify(r)}_parseJson(e){return JSON.parse(e)}composePermission$(e,n){const r=this._permissionPointMap.get(e),i=n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.asObservable()});return C.combineLatest(i).pipe(ir.map(o=>(o.every(c=>this._permissionPointMap.get(c.id)),o)))}composePermission(e,n){const r=this._permissionPointMap.get(e);return n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.getValue()})}};exports.PermissionService=Do([be(b.Starting,exports.PermissionService),We(0,I.Inject(we)),We(1,I.Inject(ct))],exports.PermissionService);const Fn="univer.editable";class vt extends Ps{constructor(e){super();h(this,"id",Fn);h(this,"value",!0);h(this,"unitID");this.unitID=e}}var Uo=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,Po=(t,s,e,n)=>{for(var r=n>1?void 0:n?Mo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Uo(s,e,r),r},ke=(t,s)=>(e,n)=>s(e,n,t);exports.UniverPermissionService=class extends M{constructor(s,e){super(),this._permissionService=s,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(s=>{const e=new vt(s.getUnitId());this._permissionService.addPermissionPoint(s.getUnitId(),e)})}getEditable(s){let e=s;e||(e=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new vt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(s,e){const n=new vt(s);this._permissionService.updatePermissionPoint(s,n.id,e)}};exports.UniverPermissionService=Po([be(b.Starting,exports.UniverPermissionService),ke(0,I.Inject(De)),ke(1,I.Inject(ct))],exports.UniverPermissionService);class Wn extends M{constructor(){super(...arguments);h(this,"_resourceMap",new Map);h(this,"_register$",new C.Subject);h(this,"register$",this._register$.asObservable())}getAllResource(e){const n=this._resourceMap.get(e);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:e,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(e,n,r){const i=this._resourceMap.get(e)||new Map;if(i.has(n))throw new Error(`the pluginName is registered {${n}}`);return i.set(n,r),this._resourceMap.set(e,i),this._register$.next({unitID:e,resourceName:n,hook:r}),v(()=>i.delete(n))}disposePluginResource(e,n){const r=this._resourceMap.get(e);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class ue extends M{constructor(){super();h(this,"_currentTheme");h(this,"_currentTheme$",new C.BehaviorSubject({}));h(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(v(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const Bn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",kn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",xo=`\r
7
- `;function po(t){return`__internalEditorId__${t}`}function Ho(t){return t.startsWith("__")}var Fo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Bo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Wo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Fo(s,e,r),r},Xt=(t,s)=>(e,n)=>s(e,n,t);const Gt=I.createIdentifier("univer.undo-redo.service"),ko=20;class Gn{dispose(){}async dispatchToHandlers(){return!1}}const $n="univer.command.redo",Vn="univer.command.undo",jn=new class extends Gn{constructor(){super(...arguments);h(this,"type",Ft.COMMAND);h(this,"id",Vn)}async handler(s){const e=s.get(Gt),n=e.pitchTopUndoElement();if(!n)return!1;const r=s.get(Rt);return fe(n.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},Kn=new class extends Gn{constructor(){super(...arguments);h(this,"type",Ft.COMMAND);h(this,"id",$n)}async handler(s){const e=s.get(Gt),n=e.pitchTopRedoElement();if(!n)return!1;const r=s.get(Rt);return fe(n.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends M{constructor(e,n,r){super();h(this,"undoRedoStatus$");h(this,"_undoRedoStatus$",new C.BehaviorSubject({undos:0,redos:0}));h(this,"_undoStacks",new Map);h(this,"_redoStacks",new Map);h(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(this._commandService.registerCommand(Kn)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:n}=e,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const c=this._batchingStatus.get(e.unitID),a=this._pitchUndoElement(e.unitID);c===0||!a?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(a,e)}else o(e);function o(c){i.push(c),i.length>ko&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const n=this._getRedoStack(e);n&&(n.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const n=this._getUndoStack(e);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(e){const n=this._getRedoStack(e);return n!=null&&n.length?n[n.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),v(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUniverInstanceId(),n=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(e,n=!1){let r=this._undoStacks.get(e);return!r&&n&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,n=!1){let r=this._redoStacks.get(e);return!r&&n&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,n){e.redoMutations.push(...n.redoMutations),e.undoMutations.push(...n.undoMutations)}_getFocusedUniverInstanceId(){var o,c,a,u;let e="";const n=this._contextService.getContextValue(xt),r=this._contextService.getContextValue(Pn),i=this._contextService.getContextValue(Mn);return n?r?e=kn:i?e=Bn:e=(c=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?c:"":e=(u=(a=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:a.getUnitId())!=null?u:"",e}};exports.LocalUndoRedoService=Bo([Xt(0,ct),Xt(1,Rt),Xt(2,ot)],exports.LocalUndoRedoService);class $t extends M{constructor(){super(...arguments);h(this,"_started",!1)}addPlugins(e){if(this._started){const n=e.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,b.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n,!0))}else{const n=e.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(e,n=!1){this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===b.Starting||this._pluginsRunLifecycle(e,r)})))}_pluginsRunLifecycle(e,n){e.forEach(r=>{switch(n){case b.Starting:r.onStarting(this._injector);break;case b.Ready:r.onReady();break;case b.Rendered:r.onRendered();break;case b.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(e,n){return this._injector.createInstance(e,n)}}var Go=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Vo=(t,s,e,n)=>{for(var r=n>1?void 0:n?$o(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Go(s,e,r),r},qt=(t,s)=>(e,n)=>s(e,n,t);exports.UniverDoc=class extends $t{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createDoc(s){return this._injector.createInstance(st,s)}};exports.UniverDoc=Vo([qt(0,I.Inject(I.Injector)),qt(1,I.Inject(exports.LifecycleService)),qt(2,I.Inject(exports.LifecycleInitializerService))],exports.UniverDoc);var jo=Object.defineProperty,Ko=Object.getOwnPropertyDescriptor,Yo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ko(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&jo(s,e,r),r},Qt=(t,s)=>(e,n)=>s(e,n,t);exports.UniverSheet=class extends $t{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSheet(s){return this._injector.createInstance(exports.Workbook,s)}};exports.UniverSheet=Yo([Qt(0,I.Inject(I.Injector)),Qt(1,I.Inject(exports.LifecycleService)),Qt(2,I.Inject(exports.LifecycleInitializerService))],exports.UniverSheet);var zo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,qo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Xo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&zo(s,e,r),r},Jt=(t,s)=>(e,n)=>s(e,n,t);exports.UniverSlide=class extends $t{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSlide(s){return this._injector.createInstance(ve,s)}};exports.UniverSlide=qo([Jt(0,I.Inject(I.Injector)),Jt(1,I.Inject(exports.LifecycleService)),Jt(2,I.Inject(exports.LifecycleInitializerService))],exports.UniverSlide);const Qo=200;class Jo extends $t{constructor(e={}){super();h(this,"_injector");h(this,"_univerPluginStore",new _r);h(this,"_univerPluginRegistry",new dr);h(this,"_univerSheet",null);h(this,"_univerDoc",null);h(this,"_univerSlide",null);h(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=e;n&&this._injector.get(ue).setTheme(n),i&&this._injector.get(ht).load(i),r&&this._injector.get(ht).setLocale(r),o&&this._injector.get(y).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(ct)}get _lifecycleService(){return this._injector.get(exports.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(exports.LifecycleInitializerService)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(e){this._injector.get(ht).setLocale(e)}createUniverSheet(e){let n;const r=()=>{n=this._univerSheet.createSheet(e),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(exports.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(T.Sheet).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(T.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(e){let n;const r=()=>{n=this._univerDoc.createDoc(e),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(exports.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(T.Doc).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(T.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(e){let n;const r=()=>{n=this._univerSlide.createSlide(e),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(exports.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(T.Slide).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(T.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new I.Injector([[ct,{useFactory:e=>new exports.UniverInstanceService({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},e),deps:[ot]}],[ss],[ht],[ue],[exports.LifecycleService],[exports.LifecycleInitializerService],[De,{useClass:exports.PermissionService}],[exports.UniverPermissionService],[y,{useClass:Ze,lazy:!0}],[Rt,{useClass:exports.CommandService,lazy:!0}],[Gt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[ts,{useClass:es}],[ot,{useClass:Qe}],[rs,{useClass:ns,lazy:!0}],[we,{useClass:Wn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(exports.LifecycleInitializerService).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<b.Ready&&(this._injector.get(exports.LifecycleService).stage=b.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(e,n){if(e.type===T.Univer)this._registerUniverPlugin(e,n);else if(e.type===T.Sheet)this._registerSheetsPlugin(e,n);else if(e.type===T.Doc)this._registerDocsPlugin(e,n);else if(e.type===T.Slide)this._registerSlidesPlugin(e,n);else throw new Error(`Unimplemented plugin system for business: "${e.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),Qo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const e=this._univerPluginRegistry.getRegisterPlugins(T.Univer);if(e.length){this._univerPluginRegistry.clearPluginsOfType(T.Univer);const n=e.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(T.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(T.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(T.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(T.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(T.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(T.Slide))}}_registerUniverPlugin(e,n){if(this._started)this._univerPluginRegistry.registerPlugin(e,n);else{const r=this._injector.createInstance(e,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerDocsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerSlidesPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}}function Zo(t,s=16){let e=0,n=null;return function(...i){const o=Date.now();o-e<s?(n&&clearTimeout(n),n=setTimeout(()=>{e=o,t.apply(this,i)},s)):(e=o,t.apply(this,i))}}function yo(t){const s=new MessageChannel;let e=!1;return s.port1.onmessage=()=>{e||t()},s.port2.postMessage(null),()=>{e=!0}}var Yn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(Yn||{});class he{constructor(s){h(this,"_index",0);h(this,"_offset",0);this._actions=s}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(s){s||(s=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const n=this._offset,r=e.len;return s>=r-n?(s=r-n,this._index+=1,this._offset=0):this._offset+=s,e.t===O.DELETE||e.t===O.RETAIN&&e.body==null?g.deepClone({...e,len:s}):g.deepClone({...e,len:s,body:Ne(e.body,n,n+s)})}else return{t:O.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const s=this._actions[this._index];return s?s.t:O.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const s=this._offset,e=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=s,this._index=e,[n].concat(r)}}else return[]}}function Ge(t){return Object.keys(t).length===1}class Vt{constructor(){h(this,"_actions",[])}static compose(s,e){const n=new he(s),r=new he(e),i=new Vt;for(;n.hasNext()||r.hasNext();)if(r.peekType()===O.INSERT)i.push(r.next());else if(n.peekType()===O.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),c=n.next(o),a=r.next(o);c.t===O.INSERT&&a.t===O.RETAIN?a.body==null?i.push(c):i.push({...c,body:ie(c.body,a.body,a.coverType)}):c.t===O.RETAIN&&a.t===O.RETAIN?c.body==null&&a.body==null?i.push(c.len!==Number.POSITIVE_INFINITY?c:a):c.body&&a.body?i.push({...c,body:ie(c.body,a.body,a.coverType)}):i.push(c.body?c:a):c.t===O.RETAIN&&a.t===O.DELETE?i.push(a):c.t===O.INSERT&&(a.t,O.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(s,e,n=""){const r={t:O.INSERT,body:e,len:s,line:0,segmentId:n};return this.push(r),this}retain(s,e="",n,r){const i={t:O.RETAIN,len:s,segmentId:e};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(s,e=""){const n={t:O.DELETE,len:s,line:0,segmentId:e};return this.push(n),this}serialize(){return this._actions}push(...s){if(s.length>1){for(const i of s)this.push(i);return this}let e=this._actions.length,n=this._actions[e-1];const r=g.deepClone(s[0]);if(r.t===O.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===O.DELETE&&r.t===O.DELETE)return n.len+=r.len,this;if(n.t===O.DELETE&&r.t===O.INSERT&&(e-=1,n=this._actions[e-1],n==null))return this._actions.unshift(r),this;if(n.t===O.RETAIN&&r.t===O.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===O.INSERT&&Ge(n.body)&&r.t===O.INSERT&&Ge(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let s=this._actions[this._actions.length-1];for(;s&&s.t===O.RETAIN&&Yi(s);)this._actions.pop(),s=this._actions[this._actions.length-1];return this}}function tc(t,s,e){if(s==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new st(n),i=s.length;let o;for(;(o=r.getBody().dataStream.indexOf(s))>=0;){const a=new Vt;if(o>0&&a.retain(o),e.length>0){const l=r.sliceBody(o,o+i),_={dataStream:e};Array.isArray(l==null?void 0:l.textRuns)&&l.textRuns.length&&(_.textRuns=[{...l.textRuns[0],st:0,ed:e.length}]),a.insert(e.length,_)}a.delete(i);const u=a.serialize();r.apply(u)}const c=r.getBody();return r.dispose(),c}class ec extends Ht{add(s){if(!s)return null;const e=new pt(s,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const sc=I.createIdentifier("ILocalStorageService");function nc(t){return new C.Observable(s=>{const e=t((...n)=>s.next(n));return()=>e==null?void 0:e.dispose()})}const rc=t=>`sheet_interceptor_${t}`,zn=t=>function(s,e){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,e,r.bind(null,i+1))}return r(0,s)};class ic{constructor(s){h(this,"_interceptorsByName",new Map);h(this,"_interceptorPoints");this._interceptorPoints=s}fetchThroughInterceptors(s){const e=s,n=this._interceptorsByName.get(e);return zn(n||[])}intercept(s,e){const n=s;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(e),this._interceptorsByName.set(n,r.sort((i,o)=>{var c,a;return((c=o.priority)!=null?c:0)-((a=i.priority)!=null?a:0)})),()=>q(this._interceptorsByName.get(n),e)}getInterceptPoints(){return this._interceptorPoints}}const oc=I.createIdentifier("univer.snapshot-server-service");class cc{constructor(){h(this,"_sheetBlockCache",new Map)}getUnitOnRev(s,e){return Promise.resolve({snapshot:{unitID:"",type:V.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:W.OK,message:""}})}getSheetBlock(s,e){const n=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:n,error:{code:W.OK,message:""}})}fetchMissingChangesets(s,e){return Promise.resolve({changesets:[],error:{code:W.OK,message:""}})}getResourcesRequest(s,e){return Promise.resolve({resources:{},error:{code:W.OK,message:""}})}saveSnapshot(s,e){return Promise.resolve({error:{code:W.OK,message:""}})}saveSheetBlock(s,e){const{block:n}=e;return n?(this._sheetBlockCache.set(n.id,n),Promise.resolve({error:{code:W.OK,message:""},blockID:n.id})):Promise.resolve({error:{code:W.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(s,e){return Promise.resolve({error:{code:W.OK,message:""},concurrent:[]})}}function ac(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(s,e)=>String.fromCharCode(Number.parseInt(e,16))))}function Ue(t){return decodeURIComponent(Array.prototype.map.call(atob(t),s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const mt=new TextEncoder,jt=new TextDecoder;function Xn(t){const s=g.deepClone(t);return delete s.id,delete s.name,delete s.rowCount,delete s.columnCount,delete s.cellData,mt.encode(JSON.stringify(s))}function qn(t){const s=g.deepClone(t);return delete s.id,delete s.rev,delete s.name,delete s.sheetOrder,delete s.sheets,mt.encode(JSON.stringify(s))}function lc(t){const s=g.deepClone(t);return delete s.id,delete s.rev,delete s.title,delete s.resources,mt.encode(JSON.stringify(s))}function $e(t){return JSON.parse(jt.decode(t))}function uc(t){return JSON.parse(typeof t=="string"?Ue(t):jt.decode(t))}function hc(t){return JSON.parse(typeof t=="string"?Ue(t):jt.decode(t))}const Zt=256;function Qn(t,s){const e=new k(t),n=e.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+Zt,n-1),c=e.getSlice(i,Math.min(i+Zt,n-1),0,s),a=_c(c);r.push({id:g.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=Zt}return r}function _c(t){const s=t.getData();return mt.encode(JSON.stringify(s))}async function dc(t,s,e,n,r){const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([_,d])=>{const E={id:d.id,type:Wt.GRID,name:d.name,rowCount:d.rowCount,columnCount:d.columnCount,originalMeta:Xn(d)};if(o[_]=E,d.cellData){const f=Qn(d.cellData,d.rowCount),R=await Promise.all(f.map(A=>r.saveSheetBlock(t,{unitID:e,type:V.UNIVER_SHEET,block:A})));if(R.some(A=>{var N;return((N=A.error)==null?void 0:N.code)!==W.OK}))return!1;i[_]={sheetID:_,blocks:R.map(A=>A.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),u={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a};return{snapshotRes:{unitID:e,rev:u.rev,type:V.UNIVER_SHEET,workbook:u,doc:void 0}}}async function Ec(t,s,e,n,r){var d,E;const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([f,R])=>{const A={id:R.id,type:Wt.GRID,name:R.name,rowCount:R.rowCount,columnCount:R.columnCount,originalMeta:Xn(R)};if(o[f]=A,R.cellData){const N=Qn(R.cellData,R.rowCount),P=await Promise.all(N.map(D=>r.saveSheetBlock(t,{unitID:e,type:V.UNIVER_SHEET,block:D})));if(P.some(D=>{var j;return((j=D.error)==null?void 0:j.code)!==W.OK}))return!1;i[f]={sheetID:f,blocks:P.map(D=>D.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),u={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a},l={unitID:e,rev:u.rev,type:V.UNIVER_SHEET,workbook:u,doc:void 0},_=await r.saveSnapshot(t,{unitID:e,type:V.UNIVER_SHEET,snapshot:l});if(An(_.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
- ErrorCode: ${(d=_.error)==null?void 0:d.code}:${(E=_.error)==null?void 0:E.message}`);return{snapshot:l}}function fc(t,s,e){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([a,u])=>{const l=$e(u.originalMeta);r[a]={id:u.id,name:u.name,rowCount:u.rowCount,columnCount:u.columnCount,...l}});const i=new Map;s.forEach(a=>{i.set(a.id,a)}),n.blockMeta&&Object.entries(n.blockMeta).forEach(([a,u])=>{var d;const l=r[a];l.cellData={};const _=[];(d=u.blocks)==null||d.forEach(E=>{const f=i.get(E);if(f)_.push(f);else throw new Error("")}),_.forEach(E=>{const f=uc(E.data);Object.entries(f).forEach(([R,A])=>{const N=l.cellData[+R]={};Object.entries(A).forEach(([P,D])=>{N[+P]=D})})})});const o=$e(n.originalMeta);return{id:t.unitID,rev:n.rev,name:n.name,sheetOrder:n.sheetOrder,appVersion:"",locale:nt.EN_US,sheets:r,styles:{},resources:n.resources||[],...o}}function gc(t){const s=t.doc;if(s==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:n,name:r,originalMeta:i}=s,{body:o,documentStyle:c={},settings:a={}}=hc(i);return{id:e,rev:n,locale:nt.EN_US,title:r,body:o,documentStyle:c,settings:a}}async function Rc(t,s,e,n,r){var a,u,l;const i={unitID:s.id,rev:n,creator:"",name:(a=s.title)!=null?a:"",resources:s.resources||[],originalMeta:lc(s)},o={unitID:e,rev:i.rev,type:V.UNIVER_DOC,workbook:void 0,doc:i},c=await r.saveSnapshot(t,{unitID:e,type:V.UNIVER_DOC,snapshot:o});if(An(c.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
- ErrorCode: ${(u=c.error)==null?void 0:u.code}:${(l=c.error)==null?void 0:l.message}`);return{snapshot:o}}async function mc(t,s){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const c=o.blocks.map(async a=>{const u={unitID:e.unitID,type:V.UNIVER_SHEET,blockID:a},{block:l}=await s.getSheetBlock({},u);if(l)n.push(l);else throw new Error("Block not found")});r.push(...c)}),await Promise.all(r),n}var Jn=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(Jn||{}),Zn=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(Zn||{}),yn=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(yn||{}),tr=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(tr||{}),er=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(er||{});or();exports.ABCToNumber=Ii;exports.AbsoluteRefType=$;exports.ActionIterator=he;exports.AlignTypeH=fn;exports.AlignTypeV=gn;exports.AutoFillSeries=as;exports.BaselineOffset=wt;exports.BlockType=Qs;exports.BooleanNumber=m;exports.BorderStyleTypes=L;exports.BorderType=ls;exports.BulletAlignment=Y;exports.COLORS=yt;exports.CellValueType=dt;exports.ClientSnapshotServerService=cc;exports.Color=tt;exports.ColorBuilder=kt;exports.ColorKit=B;exports.ColorType=F;exports.ColumnSeparatorType=ys;exports.CommandType=Ft;exports.CommonHideTypes=us;exports.ConditionType=hs;exports.ConfigService=es;exports.ContentAlignment=un;exports.ContextService=Qe;exports.CopyPasteType=_s;exports.CustomRangeType=qs;exports.DEFAULT_CELL=wi;exports.DEFAULT_DOC=Se;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=br;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=xo;exports.DEFAULT_RANGE=bi;exports.DEFAULT_RANGE_ARRAY=ut;exports.DEFAULT_SELECTION=Ti;exports.DEFAULT_SLIDE=Hs;exports.DEFAULT_STYLES=St;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Ln;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=so;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=wn;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=oo;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=bn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=ro;exports.DEFAULT_WORKSHEET_ROW_COUNT=Sn;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=eo;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=vn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=no;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Tn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=io;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=kn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Bn;exports.DashStyleType=cn;exports.DataStreamTreeNodeType=Ws;exports.DataStreamTreeTokenType=Oe;exports.DataValidationErrorStyle=Jn;exports.DataValidationImeMode=Zn;exports.DataValidationOperator=yn;exports.DataValidationRenderMode=Yn;exports.DataValidationStatus=er;exports.DataValidationType=tr;exports.DesktopLogService=Ze;exports.DeveloperMetadataVisibility=ds;exports.Dimension=Es;exports.Direction=fs;exports.Disposable=M;exports.DisposableCollection=Ee;exports.DocStyleType=zs;exports.DocumentDataModel=st;exports.EDITOR_ACTIVATED=Mn;exports.EXTENSION_NAMES=Fs;exports.Entry=te;exports.EntryIterator=Us;exports.ErrorService=ss;exports.EventState=Xe;exports.FOCUSING_DOC=ce;exports.FOCUSING_EDITOR_BUT_HIDDEN=go;exports.FOCUSING_EDITOR_INPUT_FORMULA=Ro;exports.FOCUSING_EDITOR_STANDALONE=Oo;exports.FOCUSING_FORMULA_EDITOR=Pn;exports.FOCUSING_SHEET=xt;exports.FOCUSING_SLIDE=ae;exports.FOCUSING_UNIVER_EDITOR=mo;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Io;exports.FloatingObjectManagerService=ns;exports.FollowNumberWithType=Xs;exports.FontItalic=bt;exports.FontStyleType=hn;exports.FontWeight=Tt;exports.FormatType=gs;exports.GlyphType=Et;exports.GridType=Js;exports.HLSColor=Ns;exports.HorizontalAlign=J;exports.ICommandService=Rt;exports.IConfigService=ts;exports.IContextService=ot;exports.IFloatingObjectManagerService=rs;exports.ILocalStorageService=sc;exports.ILogService=y;exports.IPermissionService=De;exports.IResourceManagerService=we;exports.ISnapshotPersistenceService=Hn;exports.ISnapshotServerService=oc;exports.IUndoRedoService=Gt;exports.IUniverInstanceService=ct;exports.InterceptorManager=ic;exports.InterpolationPointType=Rs;exports.KeyIterator=ws;exports.LRUHelper=lt;exports.LRUMap=Ms;exports.LifecycleStages=b;exports.LocaleService=ht;exports.LocaleType=nt;exports.LogLevel=Je;exports.MemoryCursor=is;exports.NamedStyleType=rn;exports.NilCommand=ye;exports.NumberUnitType=En;exports.ObjectMatrix=k;exports.ObjectRelativeFromH=_n;exports.ObjectRelativeFromV=dn;exports.Observable=Ht;exports.ObservableHooks=ec;exports.Observer=pt;exports.OnLifecycle=be;exports.PRESET_LIST_TYPE=Wi;exports.PageElementType=Cn;exports.PageOrientType=mn;exports.PageType=Le;exports.ParagraphElementType=en;exports.PermissionPoint=Ps;exports.PermissionStatus=me;exports.Plugin=Ve;exports.PluginType=T;exports.PositionedObjectLayoutType=nn;exports.PresetListType=Pt;exports.ProtectionType=ms;exports.RANGE_TYPE=p;exports.RGBA_PAREN=Mr;exports.RGB_PAREN=Ur;exports.Range=et;exports.Rectangle=Z;exports.RedoCommand=Kn;exports.RedoCommandId=$n;exports.RefAlias=Oi;exports.Registry=_e;exports.RegistryAsMap=de;exports.RelativeDate=Os;exports.RelativeSlideLink=Nn;exports.ResourceManagerService=Wn;exports.RgbColor=Dt;exports.RxDisposable=Ir;exports.SectionType=Zs;exports.ShapeType=Is;exports.SheetTypes=Wt;exports.SheetViewModel=Un;exports.SlideDataModel=ve;exports.SpacingRule=on;exports.Styles=In;exports.THEME_COLORS=Cs;exports.TabStopAlignment=an;exports.TextDecoration=As;exports.TextDirection=ft;exports.TextDirectionType=tn;exports.TextX=Vt;exports.TextXActionType=O;exports.ThemeColor=Ut;exports.ThemeColorType=x;exports.ThemeColors=Bt;exports.ThemeService=ue;exports.Tools=g;exports.UndoCommand=jn;exports.UndoCommandId=Vn;exports.Univer=Jo;exports.UniverEditablePermission=vt;exports.UniverEditablePermissionPoint=Fn;exports.UniverInstanceType=xn;exports.UpdateDocsAttributeType=U;exports.ValueIterator=Ds;exports.VerticalAlign=rt;exports.WidthType=ln;exports.Worksheet=gt;exports.WrapStrategy=it;exports.WrapTextType=sn;exports.b64DecodeUnicode=Ue;exports.b64EncodeUnicode=ac;exports.binarySearchArray=os;exports.cellToRange=ai;exports.characterSpacingControlType=Rn;exports.checkForSubstrings=li;exports.checkParagraphHasBullet=ui;exports.checkParagraphHasIndent=hi;exports.checkParagraphHasIndentByStyle=vs;exports.codeToBlob=wr;exports.composeBody=ie;exports.composeInterceptors=zn;exports.concatMatrixArray=Ei;exports.createInterceptorKey=rc;exports.createInternalEditorID=po;exports.createRowColIter=re;exports.debounce=vi;exports.dedupe=Er;exports.deepCompare=ge;exports.deleteContent=Ts;exports.extractPureTextFromCell=co;exports.fromCallback=nc;exports.fromObservable=Or;exports.generateTemporarySnap=dc;exports.getArrayLength=Q;exports.getBodySlice=Ne;exports.getBorderStyleType=oi;exports.getCellValueType=Qi;exports.getColorStyle=G;exports.getDocsUpdateBody=Nt;exports.getReverseDirection=Dr;exports.getSheetBlocksFromSnapshot=mc;exports.getTypeFromPermissionItemList=mi;exports.getWorksheetUID=fo;exports.groupBy=Rr;exports.handleJsonToDom=ri;exports.handleStyleToString=ii;exports.hashAlgorithm=di;exports.horizontalLineSegmentsSubtraction=Re;exports.insertMatrixArray=ee;exports.insertTextToContent=bs;exports.isBlackColor=jr;exports.isCellV=Zi;exports.isEmptyCell=ei;exports.isFormulaId=ni;exports.isFormulaString=si;exports.isICellData=qi;exports.isInternalEditorID=Ho;exports.isNullCell=Ji;exports.isObserver=qe;exports.isRangesEqual=lr;exports.isRealNum=_i;exports.isSameStyleTextRun=Ls;exports.isUnitRangesEqual=ur;exports.isValidRange=ci;exports.isWhiteColor=Kr;exports.makeCellRangeToRangeData=ti;exports.makeCellToSelection=yr;exports.mergeWorksheetSnapshotWithDefault=Dn;exports.moveMatrixArray=ne;exports.normalizeTextRuns=Ie;exports.numberToABC=Ci;exports.numberToListABC=Ni;exports.orderSearchArray=cs;exports.queryObjectMatrix=Pi;exports.remove=q;exports.repeatStringNumTimes=ps;exports.replaceInDocumentBody=tc;exports.requestImmediateMacroTask=yo;exports.rotate=gr;exports.runOnLifecycle=Te;exports.searchArray=Tr;exports.selectionToArray=ar;exports.sequence=Ke;exports.sequenceAsync=je;exports.sequenceExecute=fe;exports.sequenceExecuteAsync=vr;exports.shallowEqual=hr;exports.sliceMatrixArray=fi;exports.sortRules=Si;exports.sortRulesByDesc=Li;exports.sortRulesFactory=at;exports.spliceArray=se;exports.textDecoder=jt;exports.textEncoder=mt;exports.throttle=Zo;exports.toDisposable=v;exports.transformDocumentDataToSnapshot=Rc;exports.transformSnapshotToDocumentData=gc;exports.transformSnapshotToWorkbookData=fc;exports.transformWorkbookDataToSnapshot=Ec;
3
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function He(t,s){if(t){var e=t.indexOf(s);0<=e&&t.splice(e,1)}}var ks=function(){function t(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var s,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Me(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(g){s={error:g}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(s)throw s.error}}else o.remove(this);var c=this.initialTeardown;if(ct(c))try{c()}catch(g){i=g instanceof Jt?g.errors:[g]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var _=Me(h),f=_.next();!f.done;f=_.next()){var E=f.value;try{Fe(E)}catch(g){i=i!=null?i:[],g instanceof Jt?i=xe(xe([],Pe(i)),Pe(g.errors)):i.push(g)}}}catch(g){n={error:g}}finally{try{f&&!f.done&&(r=_.return)&&r.call(_)}finally{if(n)throw n.error}}}if(i)throw new Jt(i)}},t.prototype.add=function(s){var e;if(s&&s!==this)if(this.closed)Fe(s);else{if(s instanceof t){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(s)}},t.prototype._hasParent=function(s){var e=this._parentage;return e===s||Array.isArray(e)&&e.includes(s)},t.prototype._addParent=function(s){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(s),e):e?[e,s]:s},t.prototype._removeParent=function(s){var e=this._parentage;e===s?this._parentage=null:Array.isArray(e)&&He(e,s)},t.prototype.remove=function(s){var e=this._finalizers;e&&He(e,s),s instanceof t&&s._removeParent(this)},t.EMPTY=function(){var s=new t;return s.closed=!0,s}(),t}();ks.EMPTY;function Qr(t){return t instanceof ks||t&&"closed"in t&&ct(t.remove)&&ct(t.add)&&ct(t.unsubscribe)}function Fe(t){ct(t)?t():t.unsubscribe()}class Gs{constructor(s=!1){d(this,"skipNextObservers");d(this,"lastReturnValue");d(this,"isStopPropagation",!1);this.initialize(s)}initialize(s=!1){return this.skipNextObservers=s,this}stopPropagation(){this.isStopPropagation=!0}}function $s(t){return t instanceof kt}class kt{constructor(s,e){d(this,"_willBeUnregistered",!1);d(this,"unregisterOnNextCall",!1);this.callback=s,this.observable=e}dispose(){this.observable.remove(this)}}class Gt{constructor(s){d(this,"_observers",new Array);d(this,"_eventState");d(this,"_onObserverAdded");this._eventState=new Gs,s&&(this._onObserverAdded=s)}get observers(){return this._observers}add(s,e=!1,n=!1){if(!s)return null;const r=new kt(s,this);return r.unregisterOnNextCall=n,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(s){return this.add(s,void 0,!0)}remove(s){return s&&this._observers.indexOf(s)!==-1?(this._deferUnregister(s),!0):!1}removeCallback(s){for(let e=0;e<this._observers.length;e++){const n=this._observers[e];if(!n._willBeUnregistered&&n.callback===s)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(s){this._remove(s),this._observers.unshift(s)}makeObserverBottomPriority(s){this._remove(s),this._observers.push(s)}notifyObservers(s){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=s,e.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(s,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(n=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(s){let e=Promise.resolve(s);if(!this._observers.length)return e;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(e=e.then(()=>i.callback(s,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>s)}notifyObserver(s,e){if(s._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,s.callback(e,n),s.unregisterOnNextCall&&this._deferUnregister(s),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const s=new Gt;return s._observers=this._observers.slice(0),s}_deferUnregister(s){s.unregisterOnNextCall=!1,s._willBeUnregistered=!0,setTimeout(()=>{this._remove(s)},0)}_remove(s){if(!s)return!1;const e=this._observers.indexOf(s);return e!==-1?(this._observers.splice(e,1),!0):!1}}function v(t){let s=!1;return t?Qr(t)?{dispose:()=>t.unsubscribe()}:$s(t)?{dispose:()=>{s||(s=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{s||(s=!0,t())}}:t:v(()=>{})}function ti(t){return v(()=>{t.unsubscribe()})}class Ee{constructor(){d(this,"_disposables",new Set)}add(s){const e=v(s);return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(s=>{s.dispose()}),this._disposables.clear()}}class p{constructor(){d(this,"_disposed",!1);d(this,"_collection",new Ee)}disposeWithMe(s){return this._collection.add(s)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class ei extends p{constructor(){super(...arguments);d(this,"dispose$",new L.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class at{static hasLength(s,e){return s.length===e}static getValueType(s){return Object.prototype.toString.apply(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isIterable(s){return s[Symbol.iterator]!=null}static isNumber(s){return this.getValueType(s)==="[object Number]"}}function $t(t,s){const e=t.indexOf(s);return e>-1?(t.splice(e,1),!0):!1}function si(t){const s=new Set,e=[];for(const n of t)s.has(n)||(s.add(n),e.push(n));return e}function ni(t,s){for(let e=t.length-1;e>-1;e--){const n=t[e];if(s(n,e))return n}return null}function ri(t,s){if(t.length===0)return t;const e=s%t.length;return t.slice(e).concat(t.slice(0,e))}function ii(t,s){const e=new Map;return t.forEach(n=>{const r=s(n);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(n)}),e}const S=Symbol("newer"),D=Symbol("older");class Vs{constructor(s){d(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:s.key}):{done:!0,value:void 0}}}class js{constructor(s){d(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:s.value}):{done:!0,value:void 0}}}class Ks{constructor(s){d(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[S],{done:!1,value:[s.key,s.value]}):{done:!0,value:void 0}}}var La,Ta;class ee{constructor(s,e){d(this,"key");d(this,"value");d(this,La);d(this,Ta);this.key=s,this.value=e,this[S]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}La=S,Ta=D;class Ys{constructor(...s){d(this,"_keymap");d(this,"size",0);d(this,"limit");d(this,"oldest");d(this,"newest");d(this,"_onShiftListeners",[]);if(at.hasLength(s,1)){if(at.isNumber(s[0])){const e=s[0];this._initialize(e,void 0);return}if(at.isIterable(s[0])){const e=s[0];this._initialize(0,e);return}return}if(at.hasLength(s,2)){const e=s[0],n=s[1];this._initialize(e,n)}}onShift(s){if(this._onShiftListeners.indexOf(s)===-1)return this._onShiftListeners.push(s),v(()=>$t(this._onShiftListeners,s));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(s,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=s,this._keymap=new Map,e&&(this.assign(e),s<1&&(this.limit=this.size))}_markEntryAsUsed(s){s!==this.newest&&(s[S]&&(s===this.oldest&&(this.oldest=s[S]),s[S][D]=s[D]),s[D]&&(s[D][S]=s[S]),s[S]=void 0,s[D]=this.newest,this.newest&&(this.newest[S]=s),this.newest=s)}assign(s){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=s[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new ee(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[S]=o,o[D]=e):this.oldest=o,e=o,n--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(s,e){let n=this._keymap.get(s);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(s,n=new ee(s,e)),this.newest?(this.newest[S]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const s=this.oldest;if(s)return this.oldest&&this.oldest[S]?(this.oldest=this.oldest[S],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),s[S]=s[D]=void 0,this._keymap.delete(s.key),--this.size,this._onShiftListeners.forEach(e=>e(s)),[s.key,s.value]}get(s){const e=this._keymap.get(s);if(e)return this._markEntryAsUsed(e),e.value}has(s){return this._keymap.has(s)}find(s){const e=this._keymap.get(s);return e?e.value:void 0}delete(s){const e=this._keymap.get(s);if(e)return this._keymap.delete(e.key),e[S]&&e[D]?(e[D][S]=e[S],e[S][D]=e[D]):e[S]?(e[S][D]=void 0,this.oldest=e[S]):e[D]?(e[D][S]=void 0,this.newest=e[D]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Vs(this.oldest)}values(){return new js(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Ks(this.oldest)}forEach(s,e){typeof e!="object"&&(e=this);let n=this.oldest;for(;n;)s.call(e,n.value,n.key,this),n=n[S]}toJSON(){const s=new Array(this.size);let e=0,n=this.oldest;for(;n;)s[e++]={key:n.key,value:n.value},n=n[S];return s}toString(){let s="",e=this.oldest;for(;e;)s+=`${String(e.key)}:${e.value}`,e=e[S],e&&(s+=" < ");return s}}function y(t){let s=0;const e=Object.keys(t);for(const n of e){const r=Number(n);s=Math.max(s,r)}return s+1}function se(t,s,e){const n=y(e),r=e;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=s}function ne(t,s,e){const n=Object.keys(e).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+s?delete e[r]:e[r]!==void 0&&(e[r-s]=e[r],delete e[r])}function oi(t,s){const e=t,n=Object.keys(e),r=n.length,i=s,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<r;c++,u++){const h=n[c];l[u]=e[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function ai(t,s,e){const n=e;if(y(e)>0){const i={};let o=0;for(let a=t;a<=s;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function re(t,s,e,n){const r=t>e;if(!r&&t+s>e)throw new Error("Invalid move operation");r?li(t,s,e,n):ui(t,s,e,n)}function li(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const a=r[o];r[o+s]=a,a===void 0&&delete r[o+s]}i.forEach((o,a)=>{r[e+a]=o,o===void 0&&delete r[e+a]})}function ui(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t+s;o<e;o++){const a=r[o];r[o-s]=a,a===void 0&&delete r[o-s]}i.forEach((o,a)=>{r[e+a-s]=o,o===void 0&&delete r[e+a-s]})}class G{constructor(s={}){d(this,"_matrix");this._setOriginValue(s)}static MakeObjectMatrixSize(s){return new G({[s-1]:{}})}getMatrix(){return this._matrix}forEach(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,o)===!1)return this}return this}forRow(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(!o)continue;const a=Object.keys(o);for(const l of a){const u=Number(l),c=o[Number(l)];if(s(i,u,c)===!1)return this}}return this}swapRow(s,e){const n=this._matrix[s],r=this._matrix[e];this._matrix[s]=r,this._matrix[e]=n}getRow(s){return this._matrix[s]}getRowOrCreate(s){let e=this.getRow(s);return e==null&&(e={},this._matrix[s]=e),e}reset(){this._setOriginValue({})}hasValue(){const s=this._matrix,e=Object.keys(s);if(e.length===0)return!1;for(const n of e){const r=Number(n),i=s[r];if(Object.keys(i).length>0)return!0}return!1}getValue(s,e){var n,r;return(r=(n=this._matrix)==null?void 0:n[s])==null?void 0:r[e]}setValue(s,e,n){const r=this.getRowOrCreate(s);r[e]=n}deleteValue(s,e){var n,r;(r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e]}realDeleteValue(s,e){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e],this.getRow(s)){const o=this.getRow(s);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[s])}}setRow(s,e){this._matrix[s]=e}moveRows(s,e,n){re(s,e,n,this._matrix)}moveColumns(s,e,n){this.forEach((r,i)=>{re(s,e,n,i)})}insertRows(s,e){for(let n=s;n<s+e;n++)se(n,{},this._matrix)}insertColumns(s,e){for(let n=s;n<s+e;n++)this.forEach((r,i)=>{se(n,void 0,i)})}removeRows(s,e){ne(s,e,this._matrix)}removeColumns(s,e){this.forEach((n,r)=>{ne(s,e,r)})}getFragment(s,e,n,r){const i=new G;let o=0;for(let a=s;a<=e;a++){const l={};let u=0;for(let c=n;c<=r;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(s,e,n,r){const i=new G;for(let o=s;o<=e;o++)for(let a=n;a<=r;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,R.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return y(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=y(a)-1;r=l>r?l:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const s=new Array;return this.forValue((e,n,r)=>{s.push(r)}),s}toArray(){const s=[];return this.forRow((e,n)=>{s[e]==null&&(s[e]=[]),n.forEach(r=>{s[e][r]=this.getValue(e,r)})}),s}toFullArray(){const s=this.getRange(),{endColumn:e,endRow:n}=s,r=[];for(let i=0;i<=n;i++){const o=Array(e+1).fill(void 0);r.push(o)}return this.forValue((i,o,a)=>{r[i][o]=a}),r}toJSON(){return this._matrix}clone(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getData(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getArrayData(){let s=0,e=0,n=!1,r=!1;const i=new G;return this.forEach((o,a)=>{n||(n=!0,s=o),Object.keys(a).forEach(l=>{const u=Number(l);r?u<e&&(e=u):(r=!0,e=u);const c=this.getValue(o,u);i.setValue(o-s,u-e,c)})}),i.getData()}getDataRange(){let s=0,e=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,s=a),l==null)return;const u=y(l)-1;u>n&&(n=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<e&&(e=h):(o=!0,e=h)}),a>r&&(r=a)}),{startRow:s,startColumn:e,endRow:r,endColumn:n}}getDiscreteRanges(){const s=[];return this.forEach((e,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of s)if(e>=a.startRow&&e<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(e,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||s.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),s}merge(s){this.forValue((e,n)=>{const r=s.getValue(e,n);r!=null&&this.setValue(e,n,r)})}_setOriginValue(s={}){this._matrix=s}}var ge=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(ge||{});class zs{constructor(){d(this,"status","init")}}const ci=t=>t.some(s=>s.status==="init")?"init":t.some(s=>s.status==="fetching")?"fetching":"done",z=class z{static clone(s){return s.rangeType!==void 0?{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType}:{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn}}static equals(s,e){return s==null||e==null?!1:s.endRow===e.endRow&&s.endColumn===e.endColumn&&s.startRow===e.startRow&&s.startColumn===e.startColumn&&(s.rangeType===e.rangeType||s.rangeType===void 0&&e.rangeType===x.NORMAL||e.rangeType===void 0&&s.rangeType===x.NORMAL)}static intersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,a=e.startRow,l=e.endRow,u=e.startColumn,c=e.endColumn,h=Math.abs(i+o-u-c),_=Math.abs(i-o)+Math.abs(u-c),f=Math.abs(n+r-a-l),E=Math.abs(n-r)+Math.abs(a-l);return h<=_&&f<=E}static getIntersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,a=e.startRow,l=e.endRow,u=e.startColumn,c=e.endColumn;let h,_,f,E;if(a<=r)a>=n?_=a:_=n;else return null;if(l>=n)l>=r?E=r:E=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:_,endRow:E,startColumn:h,endColumn:f,rangeType:x.NORMAL}}static contains(s,e){return s.startRow<=e.startRow&&s.endRow>=e.endRow&&s.startColumn<=e.startColumn&&s.endColumn>=e.endColumn}static realContain(s,e){return z.contains(s,e)&&(s.startRow<e.startRow||s.endRow>e.endRow||s.startColumn<e.startColumn||s.endColumn>e.endColumn)}static union(...s){return s.reduce((e,n)=>({startRow:Math.min(e.startRow,n.startRow),startColumn:Math.min(e.startColumn,n.startColumn),endRow:Math.max(e.endRow,n.endRow),endColumn:Math.max(e.endColumn,n.endColumn),rangeType:x.NORMAL}),s[0])}static subtract(s,e){if(e.startRow>s.endRow||e.endRow<s.startRow||e.startColumn>s.endColumn||e.endColumn<s.startColumn)return[s];const n=[];e.startRow>=s.startRow&&n.push({startRow:s.startRow,startColumn:s.startColumn,endRow:e.startRow-1,endColumn:s.endColumn}),e.endRow<=s.endRow&&n.push({startRow:e.endRow+1,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn});const r=Math.max(s.startRow,e.startRow),i=Math.min(s.endRow,e.endRow);return e.startColumn>=s.startColumn&&n.push({startRow:r,startColumn:s.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=s.endColumn&&n.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:s.endColumn}),n.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}};d(z,"getRelativeRange",(s,e)=>({startRow:s.startRow-e.startRow,endRow:s.endRow-s.startRow,startColumn:s.startColumn-e.startColumn,endColumn:s.endColumn-s.startColumn})),d(z,"getPositionRange",(s,e,n)=>({...n||{},startRow:n&&[w.ROW,w.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:s.startRow+e.startRow,endRow:n&&[w.ROW,w.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:s.endRow+s.startRow+e.startRow,startColumn:n&&[w.COLUMN,w.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:s.startColumn+e.startColumn,endColumn:n&&[w.COLUMN,w.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:s.endColumn+s.startColumn+e.startColumn})),d(z,"moveHorizontal",(s,e=0,n=0)=>({...s,startColumn:s.startColumn+e,endColumn:s.endColumn+e+n})),d(z,"moveVertical",(s,e=0,n=0)=>({...s,startRow:s.startRow+e,endRow:s.endRow+e+n})),d(z,"moveOffset",(s,e,n)=>({...s,startRow:s.startRow+n,endRow:s.endRow+n,startColumn:s.startColumn+e,endColumn:s.endColumn+e}));let X=z;class hi{constructor(s,e){d(this,"_values",[]);d(this,"_keys",[]);d(this,"_keyMaps",new Map);this._values=s,this._keys=e,s.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(s){this._keys.forEach(e=>{const n=s[e],r=this._keyMaps.get(e)||new Map;r.set(n,s),this._keyMaps.set(e,r)})}getValue(s,e){const n=e||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(s))return i.get(s)}return null}hasValue(s){for(let e=0;e<this._keys.length;e++){const n=this._keyMaps.get(this._keys[e]);if(n!=null&&n.has(s))return!0}return!1}addValue(s){this._values.push(s),this._initKeyMap(s)}setValue(s,e,n){const r=this.getValue(s);r&&Object.keys(r).includes(e)&&(r[e]=n)}deleteValue(s){const e=this.getValue(s);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===e);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(s){var e;return[...((e=this._keyMaps.get(s))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ie(t,s,e,n){return{forEach(r){for(let i=t;i<=s;i++)for(let o=e;o<=n;o++)r(i,o)}}}function di(t){if(t==null||t.length===0)return Number.NaN;const s=t.toLowerCase().split(""),e=s.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=n(s[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const xt=65,ys=90,_i=97;function fi(t){const s=ys-xt+1;let e="";for(;t>=0;)e=String.fromCharCode(t%s+xt)+e,t=Math.floor(t/s)-1;return e}function Xs(t,s){let e="";for(;s>0;)e+=t,s--;return e}function Ei(t,s=!1){const e=ys-xt+1;let n=_i;s&&(n=xt);const r=String.fromCharCode(t%e+n),i=Math.floor(t/e)+1;return Xs(r,i)}function gi(t,s){return t.zIndex>s.zIndex?1:t.zIndex===s.zIndex?0:-1}function Ri(t,s){return t.zIndex>s.zIndex?-1:t.zIndex===s.zIndex?0:1}function ot(t="index",s=1){return(e,n)=>e[t]>n[t]?s:e[t]===n[t]?0:-s}function mi(t,s){let e;return function(...n){const r=this,i=function(){e=null,t.apply(r,n)};clearTimeout(e),e=setTimeout(i,s)}}function Lt(t,s,e){const{dataStream:n,textRuns:r=[]}=t;let i=s;const o=[];for(const a of r){const{st:l,ed:u}=a;R.hasIntersectionBetweenTwoRanges(s,e,l,u)&&(l>i?(o.push(n.slice(i,l)),o.push(oe(n,{...a,ed:Math.min(u,e)}))):o.push(oe(n,{...a,st:i,ed:Math.min(u,e)}))),i=Math.max(s,Math.min(u,e))}return i!==e&&o.push(n.slice(i,e)),o.join("")}function Ci(t,s=!0){var e;if(s&&((e=t.paragraphs)!=null&&e.length)){const{dataStream:n,paragraphs:r=[]}=t;let i="",o=-1;for(const a of r){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:_}=u,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),_!=null&&f.push(`line-height: ${_}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${Lt(t,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==n.length&&(i+=Lt(t,o,n.length)),i}else return Lt(t,0,t.dataStream.length)}function oe(t,s){const{st:e,ed:n,ts:r={}}=s,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:_,cl:f,va:E}=r;let g=t.slice(e,n);const m=[];return a===C.TRUE&&(g=`<i>${g}</i>`),E===it.SUPERSCRIPT?g=`<sup>${g}</sup>`:E===it.SUBSCRIPT&&(g=`<sub>${g}</sub>`),(u==null?void 0:u.s)===C.TRUE&&(g=`<u>${g}</u>`),(c==null?void 0:c.s)===C.TRUE&&(g=`<s>${g}</s>`),l===C.TRUE&&(g=`<strong>${g}</strong>`),i&&m.push(`font-family: ${i}`),f&&m.push(`color: ${f.rgb}`),o&&m.push(`font-size: ${o}pt`),h&&m.push("text-decoration: overline"),_&&m.push(`background: ${_.rgb}`),m.length?`<span style="${m.join("; ")};">${g}</span>`:g}const lt={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Oi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ii={startRow:0,startColumn:0,endRow:0,endColumn:0},Ai={row:0,column:0},Tt={ff:"Arial",fs:11,it:C.FALSE,bl:C.FALSE,ul:{s:C.FALSE},st:{s:C.FALSE},ol:{s:C.FALSE},tr:{a:0,v:C.FALSE},td:_t.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Z.UNSPECIFIED,vt:rt.UNSPECIFIED,tb:ft.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},qs={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Js=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Js||{});function At(t,s){const{textRuns:e=[]}=s;let n=0;for(const i of e){const{ts:o={},st:a,ed:l}=i;if(o[t]==null)return C.FALSE;switch(t){case"bl":case"it":{if(o[t]===C.FALSE)return C.FALSE;break}case"ul":case"st":{if(o[t].s===C.FALSE)return C.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}n+=l-a}return s.dataStream.indexOf(`\r
4
+ `)===n?C.TRUE:C.FALSE}class et{constructor(s,e,n){d(this,"_range");d(this,"_worksheet");this._deps=n,this._range=e,this._worksheet=s}static foreach(s,e){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s;for(let a=n;a<=i;a++)for(let l=r;l<=o;l++)e(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=[];for(let o=s;o<=e;o++){const a=[];for(let l=n;l<=r;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=s;a<=e;a++)for(let l=n;l<=r;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=s;a<=e;a++)for(let l=n;l<=r;l++)o.setValue(a-s,l-n,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(s+1),o=R.numToWord(r+1)+(e+1)):(i=R.numToWord(r+1)+(e+1),o=R.numToWord(n+1)+(s+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Tt.bg.rgb}))}getCell(s,e){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+s,endRow:n+s,startColumn:i+e,endColumn:i+e};return new et(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(s={}){return this.getObjectValues(s)[0][0]}getObjectValues(s={}){var a;const{startRow:e,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,n,r,i).getData();if(s.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=n-e;u++)for(let c=0;c<=i-r;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Tt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?At("ul",s.body)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?At("st",s.body)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?s.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...s.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?At("it",s.body)===C.TRUE?Dt.ITALIC:Dt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?At("bl",s.body)===C.TRUE?pt.BOLD:pt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:s,_worksheet:e}=this,{startRow:n,endRow:r}=s;let i=0;for(let o=0;o<=r-n;o++){const a=e.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:s,endColumn:e}=this._range;return e-s+1}getNumRows(){const{startRow:s,endRow:e}=this._range;return e-s+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(s=>s.map(e=>(e==null?void 0:e.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>s.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:s,_worksheet:e}=this,{startColumn:n,endColumn:r}=s;let i=0;for(let o=0;o<=r-n;o++)i+=e.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(s){et.foreach(this._range,s)}_getStyles(s){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[s]||Tt[s]}))}}function Ni(t,s){if(t.length===0||t[0].length===0)return null;const e=new Array(t[0].length).fill(0);let n=0,r=null;for(let i=0;i<t.length;i++){for(let a=0;a<t[0].length;a++)e[a]=s(t[i][a])?e[a]+1:0;const o=Si(e);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Si(t){const s=[];let e=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(s.length===0||t[r]>=t[s[s.length-1]])s.push(r++);else{const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}for(;s.length>0;){const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}return n}function Li(t,s){et.foreach(s,(e,n)=>{t[e][n]=void 0})}function Ti(t,s){const e=t.toFullArray(),n=[];for(;;){const r=Ni(e,s);if(!r)break;n.push(r),Li(e,r)}return n}function bi(t,s,e,n=!1){let r={...t};const i=r.startAbsoluteRefType||w.NONE,o=r.endAbsoluteRefType||w.NONE;return!n&&i===w.ALL&&o===w.ALL?r:n||i===w.NONE&&o===w.NONE?X.moveOffset(r,s,e):(i===w.NONE?r={...r,startRow:r.startRow+e,startColumn:r.startColumn+s}:i===w.COLUMN?r={...r,startRow:r.startRow+e}:i===w.ROW&&(r={...r,startColumn:r.startColumn+s}),o===w.NONE?r={...r,endRow:r.endRow+e,endColumn:r.endColumn+s}:o===w.COLUMN?r={...r,endRow:r.endRow+e}:o===w.ROW&&(r={...r,endColumn:r.endColumn+s}),r)}var B=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(B||{});function Zs(t){return!!(t&&t.code&&t.code!==B.OK&&t.code!=="OK")}var O=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(O||{});class Vt extends p{}class Re{constructor(){d(this,"_data",[])}static create(){return new Re}add(s){this._data.indexOf(s)>-1||this._data.push(s)}delete(s){const e=this._data.indexOf(s);this._data.splice(e,1)}getData(){return this._data}}class me{constructor(){d(this,"_data",new Map)}static create(){return new me}add(s,e){this._data.has(s)||this._data.set(s,e)}delete(s){this._data.delete(s)}getData(){return this._data}}class Qs{constructor(){d(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(s){this.cursor+=s}moveCursorTo(s){this.cursor=s}}var tn=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(tn||{}),Ce=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
5
+ `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(Ce||{});function Oe(t){const s=[];for(const e of t){const{st:n,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,n===r||R.isEmptyObject(i)&&e.sId==null)continue;if(s.length===0){s.push(e);continue}const o=s.pop();Hs(e,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?s.push({...e,st:o.st,ed:r}):s.push(o,e)}return s}function en(t,s,e,n){var u;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const l=(u=s.textRuns)!=null?u:[];if(l.length)for(let c=0,h=l.length;c<h;c++){const _=l[c];_.st+=n,_.ed+=n}for(let c=0;c<o;c++){const h=r[c],{st:_,ed:f}=h;if(f<n)i.push(h);else if(n>=_&&n<=f)if(a)h.st+=e,h.ed+=e,i.push(h);else{a=!0,h.ed+=e;const E=[];if(l.length){const g={...h,st:_,ed:l[0].st};E.push(g),E.push(...l);const m=l[l.length-1],N={...h,st:m.ed,ed:f+e};E.push(N)}else E.push(h);i.push(...E)}else h.st+=e,h.ed+=e,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),t.textRuns=Oe(i)}function Ie(t,s,e,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=s,a=[];let l=-1;for(let c=0,h=r.length;c<h;c++){const _=r[c],{startIndex:f}=_;f>=n&&(_.startIndex+=e),l===-1&&f>=n&&(l=c),a.push(_.startIndex)}let u=-1;if(i){for(let c=0,h=i.length;c<h;c++){const _=i[c];_.startIndex+=n;const f=_.startIndex;u=a.indexOf(f)}if(o===Ce.PARAGRAPH&&i.length===1){const c=r[l],h=i[0],_=c.paragraphStyle,f=c.bullet;c.paragraphStyle=h.paragraphStyle,c.bullet=h.bullet,h.paragraphStyle=_,h.bullet=f}u!==-1&&r.splice(u,1),r.push(...i),r.sort(ot("startIndex"))}}function wi(t,s,e,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:u}=l;u>=n&&(l.startIndex+=e)}const i=s.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n}r.push(...i),r.sort(ot("startIndex"))}}function sn(t,s,e,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:u}=l;u>=n&&(l.startIndex+=e)}const i=s.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n}r.push(...i),r.sort(ot("startIndex"))}}function Ae(t,s,e,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:u,endIndex:c}=l;u>n?(l.startIndex+=e,l.endIndex+=e):c>=n-1&&(l.endIndex+=e)}const i=s.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n,l.endIndex+=n}r.push(...i),r.sort(ot("startIndex"))}}function vi(t,s,e,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:u,endIndex:c}=l;u>n?(l.startIndex+=e,l.endIndex+=e):c>=n-1&&(l.endIndex+=e)}const i=s.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n,l.endIndex+=n}r.push(...i),r.sort(ot("startIndex"))}}function nn(t,s,e){const{textRuns:n}=t,r=e,i=e+s,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{st:h,ed:_}=c;if(r<=h&&i>=_){o.push({...c,st:h-r,ed:_-r});continue}else h<=r&&_>=i?(o.push({...c,st:r-r,ed:i-r}),c.ed-=s):r>=h&&r<_?(o.push({...c,st:r-r,ed:_-r}),c.ed=r):i>h&&i<=_?(o.push({...c,st:h-r,ed:i-r}),c.st=i-s,c.ed-=s):h>=i&&(c.st-=s,c.ed-=s);a.push(c)}t.textRuns=a}return o}function rn(t,s,e){const{paragraphs:n}=t,r=e,i=e+s,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{startIndex:h}=c;if(h>=r&&h<i){o.push({...c,startIndex:h-e});continue}else h>=i&&(c.startIndex-=s);a.push(c)}t.paragraphs=a}return o}function on(t,s,e){const{sectionBreaks:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{startIndex:h}=c;if(h>=r&&h<=i){o.push({...c,startIndex:h-e});continue}else h>i&&(c.startIndex-=s);a.push(c)}t.sectionBreaks=a}return o}function an(t,s,e){const{customBlocks:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{startIndex:h}=c;if(h>=r&&h<=i){o.push({...c,startIndex:h-e});continue}else h>i&&(c.startIndex-=s);a.push(c)}t.customBlocks=a}return o}function ln(t,s,e){const{tables:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{startIndex:h,endIndex:_}=c;if(r<=h&&i>=_){o.push({...c,startIndex:h-e,endIndex:_-e});continue}else if(h<=r&&_>=i){const f=fe(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=s,c.endIndex-=s);a.push(c)}t.tables=a}return o}function un(t,s,e){const{customRanges:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let l=0,u=n.length;l<u;l++){const c=n[l],{startIndex:h,endIndex:_}=c;if(r<=h&&i>=_){o.push({...c,startIndex:h-e,endIndex:_-e});continue}else if(h<=r&&_>=i){const f=fe(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=s,c.endIndex-=s);a.push(c)}t.customRanges=a}return o}function Ui(t,s,e){const{dataStream:n}=t,r=e,i=e+s,o=nn(t,s,e),a=rn(t,s,e),l=on(t,s,e),u=an(t,s,e),c=ln(t,s,e),h=un(t,s,e);let _="";return n&&(t.dataStream=Bs(n,r,i),_=n.slice(r,i)),{dataStream:_,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h}}function Di(t,s,e,n){t.dataStream=Ws(t.dataStream,n,s.dataStream),en(t,s,e,n),Ie(t,s,e,n),wi(t,s,e,n),sn(t,s,e,n),Ae(t,s,e,n),vi(t,s,e,n)}var Ht=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Ht||{});const pi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:K.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:K.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:K.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:K.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:ut.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:K.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:ut.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:K.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:ut.DECIMAL,hanging:21,indentStart:63}]}};function Mi(t,s,e,n,r){const i=Pi(t,s,e,n,r),o=xi(t,s,e,n,r),a=Hi(t,s,e,n,r),l=Fi(t,s,e,n,r),u=Wi(t,s,e,n,r),c=Bi(t,s,e,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c}}function Pi(t,s,e,n,r){const{textRuns:i}=t,{textRuns:o}=s;if(i==null||o==null)return;const a=nn(t,e,n);if(r!==P.REPLACE){const l=cn(o,a,r);s.textRuns=l}return en(t,s,e,n),a}function cn(t,s,e){if(s.length===0)return t;t=R.deepClone(t),s=R.deepClone(s);const n=[],r=t.length,i=s.length;let o=0,a=0,l=null;function u(){return l?(n.push(l),l=null,!0):!1}for(;o<r&&a<i;){const{st:f,ed:E,ts:g}=t[o],{st:m,ed:N,ts:U,sId:M}=s[a];let V;e===P.COVER?V={...U,...g}:V={...g,...U},E<m?(u()||n.push(t[o]),o++):N<f?(u()||n.push(s[a]),a++):(n.push({st:Math.min(f,m),ed:Math.max(f,m),ts:f<m?{...g}:{...U},sId:f<m?void 0:M}),n.push({st:Math.max(f,m),ed:Math.min(E,N),ts:V,sId:M}),E<N?(o++,s[a].st=E):(a++,t[o].st=N),l={st:Math.min(E,N),ed:Math.max(E,N),ts:E<N?{...U}:{...g},sId:E<N?M:void 0})}u();const c=n[n.length-1],h=t[r-1],_=s[i-1];return c.ed!==Math.max(h.ed,_.ed)&&(h.ed>_.ed?n.push(h):n.push(_)),Oe(n)}function xi(t,s,e,n,r){const{paragraphs:i}=t,{paragraphs:o}=s;if(i==null||o==null)return;const a=rn(t,e,n);if(r!==P.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:_}=u;let f=[];for(const E of a){const{startIndex:g,paragraphStyle:m,bullet:N}=E;let U,M;if(r===P.COVER?(U={...m,...h},M={listId:"",listType:Ht.BULLET_LIST,nestingLevel:0,textStyle:{},...N,..._}):(U={...h,...m},M={listId:"",listType:Ht.BULLET_LIST,nestingLevel:0,textStyle:{},..._,...N}),c===g){f.push({startIndex:c,paragraphStyle:U,bullet:M});break}}l.push(...f),f=[]}s.paragraphs=l}return Ie(t,s,e,n),a}function Hi(t,s,e,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=s;if(i==null||o==null)return;const a=on(t,e,n);if(r!==P.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const _ of a){const{startIndex:f}=_;if(c===f){r===P.COVER?h.push({..._,...u}):h.push({...u,..._});break}}l.push(...h),h=[]}s.sectionBreaks=l}return Ie(t,s,e,n),a}function Fi(t,s,e,n,r){const{customBlocks:i}=t,{customBlocks:o}=s;if(i==null||o==null)return;const a=an(t,e,n);if(r!==P.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const _ of a){const{startIndex:f}=_;if(c===f){r===P.COVER?h.push({..._,...u}):h.push({...u,..._});break}}l.push(...h),h=[]}s.customBlocks=l}return sn(t,s,e,n),a}function Wi(t,s,e,n,r){const{tables:i}=t,{tables:o}=s;if(i==null||o==null)return;const a=ln(t,e,n);if(r!==P.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let _=[];for(const f of a){const{startIndex:E,endIndex:g}=f;if(E>=c&&g<=h){r===P.COVER?_.push({...f,...u}):_.push({...u,...f});break}}l.push(..._),_=[]}s.tables=l}return Ae(t,s,e,n),a}function Bi(t,s,e,n,r){const{customRanges:i}=t,{tables:o}=s;if(i==null||o==null)return;const a=un(t,e,n);if(r!==P.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let _=[];for(const f of a){const{startIndex:E,endIndex:g}=f;if(E>=c&&g<=h){r===P.COVER?_.push({...f,...u}):_.push({...u,...f});break}}l.push(..._),_=[]}s.customRanges=l}return Ae(t,s,e,n),a}var I=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(I||{});function Ne(t,s,e){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(s,e)},a=[];for(const u of r){const c=R.deepClone(u),{st:h,ed:_}=c;R.hasIntersectionBetweenTwoRanges(h,_,s,e)&&(s>=h&&s<=_?a.push({...c,st:s,ed:Math.min(e,_)}):e>=h&&e<=_?a.push({...c,st:Math.max(s,h),ed:e}):a.push(c))}a.length&&(o.textRuns=a.map(u=>{const{st:c,ed:h}=u;return{...u,st:c-s,ed:h-s}}));const l=[];for(const u of i){const{startIndex:c}=u;c>=s&&c<=e&&l.push(R.deepClone(u))}return l.length&&(o.paragraphs=l.map(u=>({...u,startIndex:u.startIndex-s}))),o}function ae(t,s,e=P.COVER){if(s.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:a=[]}=s,l=cn(o,r,e);l.length&&(n.textRuns=l);const u=[];let c=0,h=0;for(;c<i.length&&h<a.length;){const _=i[c],f=a[h],{startIndex:E}=_,{startIndex:g}=f;E===g?(u.push(R.deepMerge(_,f)),c++,h++):E<g?(u.push(R.deepClone(_)),c++):(u.push(R.deepClone(f)),h++)}return c<i.length&&u.push(...i.slice(c)),h<a.length&&u.push(...a.slice(h)),u.length&&(n.paragraphs=u),n}function ki(t){const{body:s}=t;if(s==null)return!0;const{textRuns:e=[],paragraphs:n=[]}=s;return e.length===0&&n.length===0}function Gi(t=R.generateRandomId(6),s=nt.EN_US,e=""){return{id:t,locale:s,title:e,body:{dataStream:`\r
6
+ `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const Se={id:"default_doc",documentStyle:{}};class $i extends Vt{constructor(e){super();d(this,"type",O.UNIVER_DOC);d(this,"snapshot");this.snapshot={...Se,...e}}getUnitId(){throw new Error("Method not implemented.")}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){const{documentStyle:n}=this.snapshot;n.renderConfig==null?n.renderConfig=e:n.renderConfig={...n.renderConfig,...e}}updateDocumentStyle(e){this.snapshot.documentStyle==null?this.snapshot.documentStyle=e:this.snapshot.documentStyle={...this.snapshot.documentStyle,...e}}updateDocumentDataMargin(e){const{t:n,l:r,b:i,r:o}=e,{documentStyle:a}=this.snapshot;n!=null&&(a.marginTop=n),r!=null&&(a.marginLeft=r),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(e,n){const{documentStyle:r}=this.snapshot;if(!r.pageSize){e=e!=null?e:Number.POSITIVE_INFINITY,n=n!=null?n:Number.POSITIVE_INFINITY,r.pageSize={width:e,height:n};return}e!==void 0&&(r.pageSize.width=e),n!==void 0&&(r.pageSize.height=n)}updateDrawing(e,n){const{drawings:r}=this,{width:i,height:o,left:a,top:l}=n,u=r==null?void 0:r[e];if(!u)return;const c=u.objectTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class st extends $i{constructor(e){var r;super(R.isEmptyObject(e)?Gi():e);d(this,"_unitId");d(this,"headerModelMap",new Map);d(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:R.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Se,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const n=[],r=new Qs;return r.reset(),e.forEach(i=>{if(i=R.deepClone(i),i.t===I.RETAIN){const{coverType:o,body:a,len:l,segmentId:u}=i;if(a!=null){const c=this._updateApply(a,l,r.cursor,o,u);n.push({...i,t:I.RETAIN,coverType:P.REPLACE,body:c})}else n.push({...i,t:I.RETAIN});r.moveCursor(l)}else if(i.t===I.INSERT){const{body:o,len:a,segmentId:l,line:u}=i;this._insertApply(o,a,r.cursor,l),r.moveCursor(a),n.push({t:I.DELETE,len:a,line:u,segmentId:l})}else if(i.t===I.DELETE){const{len:o,segmentId:a}=i,l=this._deleteApply(o,r.cursor,a);n.push({...i,t:I.INSERT,body:l})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(e,n){const r=this.getBody();if(r!=null)return Ne(r,e,n)}_updateApply(e,n,r,i=P.COVER,o){if(e==null)throw new Error("updateBody is none");const a=this.snapshot,l=St(a,o);if(l==null)throw new Error("no body has changed");return Mi(l,e,n,r,i)}_deleteApply(e,n,r){const i=this.snapshot,o=St(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:Ui(o,e,n)}_insertApply(e,n,r,i){const o=this.snapshot,a=St(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");Di(a,e,n,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:n}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new st(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new st(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}async function hn(t){for(const[s,e]of t.entries())try{if(!await e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function dn(t){for(const[s,e]of t.entries())try{if(!e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}const gt=A.createIdentifier("univer.context-service");class _n extends p{constructor(){super(...arguments);d(this,"_contextChanged$",new L.Subject);d(this,"contextChanged$",this._contextChanged$.asObservable());d(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var n;return(n=this._contextMap.get(e))!=null?n:!1}setContextValue(e,n){this._contextMap.set(e,n),this._contextChanged$.next({[e]:n})}subscribeContextValue$(e){return new L.Observable(n=>{const r=this._contextChanged$.pipe(L.filter(i=>typeof i[e]<"u")).subscribe(i=>n.next(i[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var fn=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(fn||{});const J=A.createIdentifier("univer.log");class En extends p{constructor(){super(...arguments);d(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):e(...n)}}var Vi=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,Ki=(t,s,e,n)=>{for(var r=n>1?void 0:n?ji(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Vi(s,e,r),r},We=(t,s)=>(e,n)=>s(e,n,t),jt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(jt||{});const Rt=A.createIdentifier("anywhere.command-service");class Yi{constructor(){d(this,"_commands",new Map)}registerCommand(s){if(this._commands.has(s.id))throw new Error(`[CommandRegistry]: command "${s.id}" has been registered before.`);return this._commands.set(s.id,s),v(()=>{var e;this._commands.delete(s.id),(e=s.onDispose)==null||e.call(s)})}hasCommand(s){return this._commands.has(s)}getCommand(s){return this._commands.has(s)?[this._commands.get(s)]:null}}const gn={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(s,e){d(this,"_commandRegistry");d(this,"_beforeCommandExecutionListeners",[]);d(this,"_commandExecutedListeners",[]);d(this,"_multiCommandDisposables",new Map);d(this,"_commandExecutingLevel",0);d(this,"_commandExecutionStack",[]);this._injector=s,this._logService=e,this._commandRegistry=new Yi,this._registerCommand(gn)}hasCommand(s){return this._commandRegistry.hasCommand(s)}registerCommand(s){return this._registerCommand(s)}registerMultipleCommand(s){return this._registerMultiCommand(s)}beforeCommandExecuted(s){if(this._beforeCommandExecutionListeners.indexOf(s)===-1)return this._beforeCommandExecutionListeners.push(s),v(()=>{const e=this._beforeCommandExecutionListeners.indexOf(s);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(s){if(this._commandExecutedListeners.indexOf(s)===-1)return this._commandExecutedListeners.push(s),v(()=>{const e=this._commandExecutedListeners.indexOf(s);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(s,e,n){const r=this._commandRegistry.getCommand(s);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(u=>u(o,n));const l=await this._execute(i,e,n);return this._commandExecutedListeners.forEach(u=>u(o,n)),a.dispose(),l}throw new Error(`[CommandService]: command "${s}" is not registered.`)}syncExecuteCommand(s,e,n){var i;const r=this._commandRegistry.getCommand(s);if(r){const[o]=r,a={id:o.id,type:o.type,params:e};if(o.type===2){const c=ni(this._commandExecutionStack,h=>h.type===0);c&&(a.params=(i=a.params)!=null?i:{},a.params.trigger=c.id)}const l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,n));const u=this._syncExecute(o,e,n);return this._commandExecutedListeners.forEach(c=>c(a,n)),l.dispose(),u}throw new Error(`[CommandService]: command "${s}" is not registered.`)}_pushCommandExecutionStack(s){return this._commandExecutionStack.push(s),v(()=>$t(this._commandExecutionStack,s))}_registerCommand(s){return this._commandRegistry.registerCommand(s)}_registerMultiCommand(s){const e=this._commandRegistry.getCommand(s.id);let n;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");n=e[0]}else{const i=new Ee;n=new zi(s.id),i.add(this._commandRegistry.registerCommand(n)),i.add(v(()=>{this._multiCommandDisposables.delete(s.id)})),this._multiCommandDisposables.set(s.id,i)}const r=n.registerImplementation(s);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(s.id))==null||i.dispose()})}async _execute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${s.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(s.handler,e,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${s.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(s.handler,e,n),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}};exports.CommandService=Ki([We(0,A.Inject(A.Injector)),We(1,J)],exports.CommandService);class zi{constructor(s){d(this,"name");d(this,"multi",!0);d(this,"type",0);d(this,"priority",0);d(this,"_implementations",[]);d(this,"handler",async(s,e)=>{if(!this._implementations.length)return!1;const n=s.get(J),r=s.get(gt),i=s.get(A.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=s,this.name=s}registerImplementation(s){const e={command:s};return this._implementations.push(e),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(e);this._implementations.splice(n,1),(r=s.onDispose)==null||r.call(s)})}hasImplementations(){return this._implementations.length>0}}function Le(t,s,e){const n=t.map(r=>()=>s.syncExecuteCommand(r.id,r.params,e));return dn(n)}function yi(t,s,e){const n=t.map(r=>()=>s.executeCommand(r.id,r.params,e));return hn(n)}const Rn=A.createIdentifier("univer.config-service");class mn{constructor(){d(this,"_config",new Map)}getConfig(s){return this._config.get(s)}setConfig(s,e){this._config.set(s,e)}deleteConfig(s){this._config.delete(s)}}class Cn extends p{constructor(){super(...arguments);d(this,"_error$",new L.Subject);d(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const Xi="__default_document_sub_component_id20231101__";class On{constructor(){d(this,"_managerInfo",new Map);d(this,"_remove$",new L.Subject);d(this,"remove$",this._remove$.asObservable());d(this,"_andOrUpdate$",new L.Subject);d(this,"andOrUpdate$",this._andOrUpdate$.asObservable());d(this,"_pluginUpdate$",new L.Subject);d(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(s){return this._getFloatingObject(s)}getFloatObjects(s){return this._getFloatingObjects(s)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(s){const e=this._clearByParam(s);this._remove$.next(e)}addOrUpdate(s){const e=this._addByParam(s);this._andOrUpdate$.next(e)}BatchAddOrUpdate(s){const e=[];s.forEach(n=>{e.push(...this._addByParam(n))}),this._andOrUpdate$.next(e)}remove(s){const e=this._removeByParam(s);this._remove$.next(e)}pluginUpdateRefresh(s){this._pluginUpdate$.next(s)}_getFloatingObjects(s){var r;if(s==null)return;const{unitId:e,subUnitId:n}=s;return(r=this._managerInfo.get(e))==null?void 0:r.get(n)}_getFloatingObject(s){var i,o;if(s==null)return;const{unitId:e,subUnitId:n,floatingObjectId:r}=s;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(s){const{unitId:e,subUnitId:n,floatingObject:r,floatingObjectId:i}=s;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:e,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(s){const e=this._getFloatingObjects(s),{unitId:n,subUnitId:r}=s,i=[];return e==null||e.forEach((o,a)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:a,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(s){const e=this._getFloatingObjects(s),n=e==null?void 0:e.get(s.floatingObjectId);return n==null?[]:(e==null||e.delete(s.floatingObjectId),[{...s,floatingObject:n}])}}const In=A.createIdentifier("univer.floating-object.service");class An{constructor(s={}){d(this,"_styles");d(this,"_cacheMap",new Ys(1e5));this._styles=s,this._generateCacheMap()}each(s){return Object.entries(this._styles).forEach(s),this}search(s,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const n=this._getExistingStyleId(s);return n||"-1"}get(s){return typeof s!="string"?s:(s=String(s),this._styles[s])}add(s,e){const n=R.generateRandomId(6);return this._styles[n]=s,this._cacheMap.set(e,n),n}setValue(s){if(s==null)return;const e=JSON.stringify(s),n=this.search(s,e);return n!=="-1"?n:this.add(s,e)}toJSON(){return this._styles}getStyleByCell(s){let e;s&&R.isObject(s.s)?e=s.s:e=(s==null?void 0:s.s)&&this.get(s.s);const n=s==null?void 0:s.interceptorStyle;return n?{...e,...n}:e}_generateCacheMap(){const{_styles:s,_cacheMap:e}=this;for(const n in s){const r=JSON.stringify(s[n]);e.set(r,n)}}_getExistingStyleId(s){const{_styles:e}=this;for(const n in e)if(R.diffValue(e[n],s))return n;return null}}class qi{constructor(s,e){d(this,"_columnData",{});this._config=s,this._columnData=e}getColumnData(){return this._columnData}getColVisible(s){const{_columnData:e}=this,n=e[s];return n?n.hd!==C.TRUE:!0}getHiddenCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getColVisible(o);r&&a?(r=!1,n.push({rangeType:x.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:x.COLUMN}),n}getVisibleCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getColVisible(o);r&&!a?(r=!1,n.push({rangeType:x.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:x.COLUMN}),n}getColumnDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return y(this._columnData)}getColumnWidth(s){const{_columnData:e}=this,n=this._config;let r=0;return r=(e[s]||{hd:C.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(s){const e=this._columnData[s];if(e)return e}getColumnOrCreate(s){const{_columnData:e}=this,n=this._config,r=e[s];if(r)return r;const i={w:n.defaultColumnWidth,hd:C.FALSE};return this._columnData[s]=i,i}}class Ji{constructor(s,e,n){d(this,"_rowData");this._config=s,this._viewModel=e,this._rowData=n}getRowData(){return this._rowData}getRowDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(s,e=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const a=n[o+s]||{hd:C.FALSE,h:r.defaultRowHeight},{ia:l,ah:u,h:c=r.defaultRowHeight}=a;i+=(l==null||l===C.TRUE)&&typeof u=="number"?u:c}return i}getRow(s){return this._rowData[s]}getRowOrCreate(s){const{_rowData:e}=this,n=e[s];if(n)return n;const r=this._config,i={hd:C.FALSE,h:r.defaultRowHeight};return e[s]=i,i}getHiddenRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getRowRawVisible(o);r&&a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:x.ROW})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getVisibleRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getRowRawVisible(o);r&&!a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:x.ROW})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getRowRawVisible(s){const e=this.getRow(s);return e?e.hd!==C.TRUE:!0}getSize(){return y(this._rowData)}}const Zi="DEFAULT_WORKSHEET_ROW_COUNT",Nn=1e3,Qi="DEFAULT_WORKSHEET_COLUMN_COUNT",Sn=20,to="DEFAULT_WORKSHEET_ROW_HEIGHT",Ln=19,eo="DEFAULT_WORKSHEET_COLUMN_WIDTH",Tn=73,so="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",bn=46,no="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",wn=20;function vn(t){const s={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:C.FALSE,rowCount:Nn,columnCount:Sn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Tn,defaultRowHeight:Ln,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:C.TRUE,rowHeader:{width:bn,hidden:C.FALSE},columnHeader:{height:wn,hidden:C.FALSE},selections:["A1"],rightToLeft:C.FALSE};return Object.keys(s).forEach(e=>{const n=e;typeof t[n]>"u"&&(t[n]=s[n])}),t}class Un extends p{constructor(e){super();d(this,"_cellContentInterceptor",null);d(this,"_rowFilteredInterceptor",null);this.getRawCell=e}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,n){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,n):this.getRawCell(e,n)}getRowFiltered(e){var n,r;return(r=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(e))!=null?r:!1}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=e,v(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=e,v(()=>this._rowFilteredInterceptor=null)}}class Et{constructor(s,e,n){d(this,"_sheetId");d(this,"_snapshot");d(this,"_cellData");d(this,"_rowManager");d(this,"_columnManager");d(this,"_viewModel");var a;this.unitId=s,this._styles=n,this._snapshot=vn(e);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:R.generateRandomId(6),this._cellData=new G(o),this._viewModel=new Un((l,u)=>this.getCellRaw(l,u)),this._rowManager=new Ji(this._snapshot,this._viewModel,i),this._columnManager=new qi(this._snapshot,r)}__interceptViewModel(s){s(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const s=this.getCellMatrix(),e=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,a=!1,l=!1;return s.forEach((u,c)=>{Object.keys(c).forEach(h=>{const _=+h,f=s.getValue(u,_),E=f!=null&&f.s?this._styles.get(f.s):null,g=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(f&&(f.v||f.p)||E!=null&&E.bg||g)&&(a?n=Math.min(n,u):(n=u,a=!0),r=Math.max(r,u),l?i=Math.min(i,_):(l=!0,i=_),o=Math.max(o,_))})}),e.forEach(u=>{a?n=Math.min(n,u.startRow):(n=u.startRow,a=!0),r=Math.max(r,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:n,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:s}=this,e=R.deepClone(s);return new Et(this.unitId,e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(s,e){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(X.intersects({startRow:s,startColumn:e,endRow:s,endColumn:e},i))return i}return null}getCell(s,e){return s<0||e<0?null:this._viewModel.getCell(s,e)}getCellRaw(s,e){return this.getCellMatrix().getValue(s,e)}getRowFiltered(s){return this._viewModel.getRowFiltered(s)}getMatrixWithMergedCells(s,e,n,r,i=!1){const o=this.getCellMatrix(),a=this._snapshot.mergeData.filter(u=>X.intersects({startRow:s,startColumn:e,endRow:n,endColumn:r},u)),l=new G;return ie(s,n,e,r).forEach((u,c)=>{const h=i?this.getCellRaw(u,c):this.getCell(u,c);h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:_,endRow:f}=u;ie(h,f,c,_).forEach((E,g)=>{E===h&&g===c&&l.setValue(E,g,{...o.getValue(E,g),rowSpan:f-h+1,colSpan:_-c+1}),(E!==h||g!==c)&&l.realDeleteValue(E,g)})}),l}getRange(s,e,n,r){return typeof s=="object"?new et(this,s,{getStyles:()=>this._styles}):new et(this,{startRow:s,startColumn:e,endColumn:r||e,endRow:n||s},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:s}=this,{columnCount:e}=s;return e}getMaxRows(){const{_snapshot:s}=this,{rowCount:e}=s;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(s){this._snapshot.rowCount=s}getColumnCount(){return this._snapshot.columnCount}setColumnCount(s){this._snapshot.columnCount=s}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:s}=this,{showGridlines:e}=s;return e===0}getTabColor(){const{_snapshot:s}=this,{tabColor:e}=s;return e}getColumnWidth(s){return this.getColumnManager().getColumnWidth(s)}getRowHeight(s){return this._viewModel.getRowFiltered(s)?0:this.getRowManager().getRowHeight(s)}getRowVisible(s){return this._viewModel.getRowFiltered(s)?!1:this.getRowRawVisible(s)}getRowRawVisible(s){return this.getRowManager().getRowRawVisible(s)}getHiddenRows(s,e){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(s,e);return r.forEach(i=>i.endColumn=n),r}getColVisible(s){return this._columnManager.getColVisible(s)}getHiddenCols(s,e){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(s,e);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const s=this.getRowCount();return this._rowManager.getVisibleRows(0,s-1)}getVisibleCols(){const s=this.getColumnCount();return this._columnManager.getVisibleCols(0,s-1)}isRightToLeft(){const{_snapshot:s}=this,{rightToLeft:e}=s;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(s){return s&&(s.v!==void 0||s.f!==void 0||s.p!==void 0)}iterateByRow(s,e=!0){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s,a=this;return{[Symbol.iterator]:()=>{let l=n,u=r;return{next(){for(;;){if(u>o&&(l+=1,u=r),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,_=a.getMergedCell(l,u);if(_){if(l!==_.startRow||u!==_.startColumn){u=_.endColumn+1;continue}if(h&&e){u=_.endColumn+1;continue}const E={row:l,col:u,value:c};return E.colSpan=_.endColumn-_.startColumn+1,E.rowSpan=_.endRow-_.startRow+1,u=_.endColumn+1,{done:!1,value:E}}if(h&&e)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(s,e=!0,n=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:a}=s,l=this;return{[Symbol.iterator]:()=>{let u=r,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=r),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const E=u!==h.startRow,g=E||c!==h.startColumn;if(n&&g||!n&&E){u=h.endRow+1;continue}const m=l.getCell(h.startRow,h.startColumn);if(!m&&e){u=h.endRow+1;continue}const U={row:u,col:h.startColumn,value:m};return U.colSpan=h.endColumn-h.startColumn+1,U.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:U}}const _=l.getCell(u,c);if(!_&&e)u+=1;else{const E={row:u,col:c,value:_};return u+=1,{done:!1,value:E}}}}}}}}}function ro(t){var n,r;if(!t)return"";const s=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(s)return s;const e=t.v;return typeof e=="string"?t.t===Q.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===Q.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}const io="0.1.9";function oo(t="",s=nt.ZH_CN,e=""){return{id:t,sheetOrder:[],name:e,appVersion:io,locale:s,styles:{},sheets:{},resources:[]}}var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(t,s,e,n)=>{for(var r=n>1?void 0:n?lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&ao(s,e,r),r},co=(t,s)=>(e,n)=>s(e,n,t);function ho(t,s){return`${t.getUnitId()}|${s.getSheetId()}`}exports.Workbook=class extends Vt{constructor(e={},n){super();d(this,"type",O.UNIVER_SHEET);d(this,"_sheetCreated$",new L.Subject);d(this,"sheetCreated$",this._sheetCreated$.asObservable());d(this,"_sheetDisposed$",new L.Subject);d(this,"sheetDisposed$",this._sheetDisposed$.asObservable());d(this,"_activeSheet$",new L.BehaviorSubject(null));d(this,"activeSheet$",this._activeSheet$.asObservable());d(this,"_worksheets");d(this,"_styles");d(this,"_snapshot");d(this,"_unitId");d(this,"_count");this._logService=n;const r=oo();R.isEmptyObject(e)?this._snapshot=r:this._snapshot=R.commonExtend(r,e);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=R.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new An(i),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return R.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(n,0,e);const a=new Et(this._unitId,r,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const n=this._snapshot.sheetOrder;for(let i=0,o=n.length;i<o;i++){const a=this._worksheets.get(n[i]);if(a&&a.isSheetHidden()!==C.TRUE)return this.setActiveSheet(a),a}const r=this._worksheets.get(n[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:e}=this._snapshot,n=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===C.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const n=e;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:lt}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let n=e;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}generateNewSheetName(e){let n=e+this._count;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}_getCellRange(e){var c,h,_,f,E;let n="",r="";if(e.indexOf("!")>-1){const g=e.split("!");n=g[0],r=g[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=e;if(r.indexOf(":")===-1){const g=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,m=R.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(g)&&!Number.isNaN(m)?{sheetId:n,range:{startRow:g,endRow:g,startColumn:m,endColumn:m}}:lt}r=r.split(":");const i=[0,0],o=[0,0],a=((c=this.getSheetBySheetName(n))==null?void 0:c.getMaxRows())||((h=this.getActiveSheet())==null?void 0:h.getMaxRows()),l=((_=this.getSheetBySheetName(n))==null?void 0:_.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=a),i[0]>i[1]||(o[0]=R.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=R.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=l),o[0]>o[1])?lt:{sheetId:((E=this.getSheetBySheetName(n))==null?void 0:E.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:n}=this,{sheets:r,sheetOrder:i}=e;if(R.isEmptyObject(r)){const o=R.generateRandomId();r[o]={id:o}}for(const o in r){const a=r[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new Et(this._unitId,a,this._styles);n.set(o,u),i.includes(o)||i.push(o)}}};exports.Workbook=uo([co(1,J)],exports.Workbook);class Te extends Vt{constructor(e){var n;super();d(this,"type",O.UNIVER_SLIDE);d(this,"_snapshot");d(this,"_unitId");this._snapshot={...qs,...e},this._unitId=(n=this._snapshot.id)!=null?n:R.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){const n=this.getPages();return n==null?void 0:n[e]}getElementsByPage(e){var n;return(n=this.getPage(e))==null?void 0:n.pageElements}getElement(e,n){var r;return(r=this.getElementsByPage(e))==null?void 0:r[n]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:de.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const ht="FOCUSING_SHEET",bt="FOCUSING_DOC",wt="FOCUSING_SLIDE",_o="FOCUSING_EDITOR_BUT_HIDDEN",Dn="EDITOR_ACTIVATED",fo="FOCUSING_EDITOR_INPUT_FORMULA",pn="FOCUSING_FORMULA_EDITOR",Eo="FOCUSING_UNIVER_EDITOR",go="FOCUSING_EDITOR_INPUT_FORMULA",Ro="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var mo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Oo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Co(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&mo(s,e,r),r},Be=(t,s)=>(e,n)=>s(e,n,t);const q=A.createIdentifier("univer.current");exports.UniverInstanceService=class extends p{constructor(e,n){super();d(this,"_unitsByType",new Map);d(this,"_createHandler");d(this,"_ctorByType",new Map);d(this,"_currentUnits$",new L.BehaviorSubject({}));d(this,"currentUnits$",this._currentUnits$.asObservable());d(this,"_unitAdded$",new L.Subject);d(this,"unitAdded$",this._unitAdded$.asObservable());d(this,"_unitDisposed$",new L.Subject);d(this,"unitDisposed$",this._unitDisposed$.asObservable());d(this,"_focused$",new L.BehaviorSubject(null));d(this,"focused$",this._focused$.asObservable());this._injector=e,this._contextService=n}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(e){this._createHandler=e}createUnit(e,n){return this._createHandler(e,n,this._ctorByType.get(e))}registerCtorForType(e,n){return this._ctorByType.set(e,n),{dispose:()=>{this._ctorByType.delete(e)}}}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe(L.map(n=>{var r;return(r=n[e])!=null?r:null}),L.distinctUntilChanged())}getCurrentUnitForType(e){return this._currentUnits$.getValue()[e]}setCurrentUnitForType(e){const n=this._getUnitById(e);if(!n)throw new Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits$.next({...this._currentUnits$.getValue(),[n[1]]:n[0]})}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe(L.filter(n=>n.type===e))}__addUnit(e){const n=e.type;this._unitsByType.has(n)||this._unitsByType.set(n,[]),this._unitsByType.get(n).push(e),this._unitAdded$.next(e),this._currentUnits$.next({...this._currentUnits$.getValue(),[n]:e})}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe(L.filter(n=>n.type===e))}getUnit(e,n){var i;const r=(i=this._getUnitById(e))==null?void 0:i[0];return n&&(r==null?void 0:r.type)!==n?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(O.UNIVER_DOC)}getUniverDocInstance(e){return this.getUnit(e,O.UNIVER_DOC)}getUniverSheetInstance(e){return this.getUnit(e,O.UNIVER_SHEET)}getAllUnitsForType(e){var n;return(n=this._unitsByType.get(e))!=null?n:[]}changeDoc(e,n){const r=this.getAllUnitsForType(O.UNIVER_DOC),i=r.find(o=>o.getUnitId()===e);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(n)}get focused(){var n;const e=this._focused$.getValue();return e?(n=this._getUnitById(e))==null?void 0:n[0]:null}focusUnit(e){this._focused$.next(e),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(bt,!1),this._contextService.setContextValue(ht,!0),this._contextService.setContextValue(wt,!1)):this.focused instanceof st?(this._contextService.setContextValue(bt,!0),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(wt,!1)):this.focused instanceof Te&&(this._contextService.setContextValue(bt,!1),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(wt,!0))}getFocusedUnit(){return this.focused}getUnitType(e){const n=this._getUnitById(e);if(!n)throw new Error(`[UniverInstanceService]: No document with unitId ${e}`);return n[1]}disposeUnit(e){const n=this._getUnitById(e);if(!n)return!1;const[r,i]=n,o=this._unitsByType.get(i),a=o.indexOf(r);return o.splice(a,1),this._unitDisposed$.next(r),this._currentUnits$.next({...this._currentUnits$.getValue(),[i]:null}),this._focused$.next(null),!0}_getUnitById(e){for(const[n,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===e);if(i)return[i,n]}}};exports.UniverInstanceService=Oo([Be(0,A.Inject(A.Injector)),Be(1,gt)],exports.UniverInstanceService);var b=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(b||{});const Io={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},vt=new Map;function be(t,s){return function(r){we(t,s)}}function we(t,s){vt.has(t)||vt.set(t,[]),vt.get(t).push(s)}var Ao=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Mn=(t,s,e,n)=>{for(var r=n>1?void 0:n?No(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ao(s,e,r),r},le=(t,s)=>(e,n)=>s(e,n,t);exports.LifecycleService=class extends p{constructor(e){super();d(this,"_lifecycle$",new L.BehaviorSubject(b.Starting));d(this,"lifecycle$",this._lifecycle$.asObservable());d(this,"_lock",!1);this._logService=e,this._reportProgress(b.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(e!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new L.Observable(e=>(this.stage===b.Starting||(this.stage===b.Ready?e.next(b.Starting):this.stage===b.Rendered?(e.next(b.Starting),e.next(b.Ready)):(e.next(b.Starting),e.next(b.Ready),e.next(b.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Io[e]}".`)}};exports.LifecycleService=Mn([le(0,J)],exports.LifecycleService);exports.LifecycleInitializerService=class extends p{constructor(e,n){super();d(this,"_seenTokens",new Set);this._lifecycleService=e,this._injector=n}initModulesOnStage(e){var n;(n=vt.get(e))==null||n.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}};exports.LifecycleInitializerService=Mn([le(0,A.Inject(exports.LifecycleService)),le(1,A.Inject(A.Injector))],exports.LifecycleInitializerService);class dt extends p{constructor(){super();d(this,"_currentLocale",nt.ZH_CN);d(this,"_locales",null);d(this,"localeChanged$",new L.Subject);d(this,"t",(e,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return n.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return e});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}load(e){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,n){const r=n.shift();if(r&&e&&r in e){const i=e[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Kt=A.createIdentifier("resource-manager-service");var So=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,To=(t,s,e,n)=>{for(var r=n>1?void 0:n?Lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&So(s,e,r),r},ke=(t,s)=>(e,n)=>s(e,n,t);const ve=A.createIdentifier("univer.permission-service");exports.PermissionService=class extends p{constructor(e,n){super();d(this,"_permissionPointMap",new Map);d(this,"deletePermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});d(this,"addPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(n.id)?!1:(r.set(n.id,new L.BehaviorSubject(n)),this._permissionPointMap.set(e,r),!0)});d(this,"updatePermissionPoint",(e,n,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=ge.DONE,o.next(a)}});d(this,"getPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=n}_toJson(e){const n=this._permissionPointMap.get(e);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(e){return JSON.parse(e)}composePermission$(e,n){const r=this._permissionPointMap.get(e),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return L.combineLatest(i).pipe(rr.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(e,n){const r=this._permissionPointMap.get(e);return n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}};exports.PermissionService=To([be(b.Starting,exports.PermissionService),ke(0,A.Inject(Kt)),ke(1,A.Inject(q))],exports.PermissionService);const Pn="univer.editable";class Ut extends zs{constructor(e){super();d(this,"id",Pn);d(this,"value",!0);d(this,"unitID");this.unitID=e}}var bo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,vo=(t,s,e,n)=>{for(var r=n>1?void 0:n?wo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&bo(s,e,r),r},Ge=(t,s)=>(e,n)=>s(e,n,t);exports.UniverPermissionService=class extends p{constructor(s,e){super(),this._permissionService=s,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.getTypeOfUnitAdded$(O.UNIVER_SHEET).subscribe(s=>{const e=new Ut(s.getUnitId());this._permissionService.addPermissionPoint(s.getUnitId(),e)})}getEditable(s=(e=>(e=this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET))==null?void 0:e.getUnitId())()){if(!s)return;const n=new Ut(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(s,e){const n=new Ut(s);this._permissionService.updatePermissionPoint(s,n.id,e)}};exports.UniverPermissionService=vo([be(b.Starting,exports.UniverPermissionService),Ge(0,A.Inject(ve)),Ge(1,A.Inject(q))],exports.UniverPermissionService);class xn extends p{constructor(){super(...arguments);d(this,"_resourceMap",new Map);d(this,"_register$",new L.Subject);d(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e){return this.getAllResourceHooks().map(i=>{const o=i.toJson(e);return{name:i.pluginName,data:o}})}registerPluginResource(e){const n=e.pluginName;if(this._resourceMap.has(n))throw new Error(`the pluginName is registered {${n}}`);return this._resourceMap.set(n,e),this._register$.next(e),v(()=>this._resourceMap.delete(n))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,n){this.getAllResourceHooks().forEach(r=>{var o;const i=(o=n==null?void 0:n.find(a=>a.name===r.pluginName))==null?void 0:o.data;if(i)try{const a=r.parseJson(i);r.onLoad(e,a)}catch{console.error("LoadResources Error!")}})}unloadResources(e){this.getAllResourceHooks().forEach(n=>{n.onUnLoad(e)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}var Uo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,po=(t,s,e,n)=>{for(var r=n>1?void 0:n?Do(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Uo(s,e,r),r},$e=(t,s)=>(e,n)=>s(e,n,t);let ue=class extends p{constructor(s,e){super();d(this,"saveWorkbook",s=>{const e=s.getUnitId(),n=this._resourceManagerService.getResources(e)||[],r=s.getSnapshot();return r.resources=n,r});this._resourceManagerService=s,this._univerInstanceService=e,this._init()}_init(){const s=n=>{n.businesses.forEach(r=>{switch(r){case O.UNRECOGNIZED:case O.UNIVER_UNKNOWN:case O.UNIVER_SLIDE:case O.UNIVER_DOC:break;case O.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(O.UNIVER_SHEET).forEach(i=>{const a=(i.getSnapshot().resources||[]).find(l=>l.name===n.pluginName);if(a)try{const l=n.parseJson(a.data);n.onLoad(i.getUnitId(),l)}catch{console.error(`Load Workbook{${i.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>{s(n)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>{s(n)})),this.disposeWithMe(v(this._univerInstanceService.getTypeOfUnitAdded$(O.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)}))),this.disposeWithMe(v(this._univerInstanceService.getTypeOfUnitDisposed$(O.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})))}};ue=po([$e(0,A.Inject(Kt)),$e(1,A.Inject(q))],ue);const Ue=A.createIdentifier("resource-loader-service");we(b.Ready,Ue);class De extends p{constructor(){super();d(this,"_currentTheme");d(this,"_currentTheme$",new L.BehaviorSubject({}));d(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(v(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const Hn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Fn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Mo=`\r
7
+ `;function Po(t){return`__internalEditorId__${t}`}function xo(t){return t.startsWith("__")}var Ho=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Wo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Fo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ho(s,e,r),r},Zt=(t,s)=>(e,n)=>s(e,n,t);const Yt=A.createIdentifier("univer.undo-redo.service"),Bo=20;class Wn{dispose(){}async dispatchToHandlers(){return!1}}const Bn="univer.command.redo",kn="univer.command.undo",Gn=new class extends Wn{constructor(){super(...arguments);d(this,"type",jt.COMMAND);d(this,"id",kn)}async handler(s){const e=s.get(Yt),n=e.pitchTopUndoElement();if(!n)return!1;const r=s.get(Rt);return Le(n.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},$n=new class extends Wn{constructor(){super(...arguments);d(this,"type",jt.COMMAND);d(this,"id",Bn)}async handler(s){const e=s.get(Yt),n=e.pitchTopRedoElement();if(!n)return!1;const r=s.get(Rt);return Le(n.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends p{constructor(e,n,r){super();d(this,"undoRedoStatus$");d(this,"_undoRedoStatus$",new L.BehaviorSubject({undos:0,redos:0}));d(this,"_undoStacks",new Map);d(this,"_redoStacks",new Map);d(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Gn)),this.disposeWithMe(this._commandService.registerCommand($n)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:n}=e,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const a=this._batchingStatus.get(e.unitID),l=this._pitchUndoElement(e.unitID);a===0||!l?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(l,e)}else o(e);function o(a){i.push(a),i.length>Bo&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const n=this._getRedoStack(e);n&&(n.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const n=this._getUndoStack(e);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(e){const n=this._getRedoStack(e);return n!=null&&n.length?n[n.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),v(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUnitId(),n=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(e,n=!1){let r=this._undoStacks.get(e);return!r&&n&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,n=!1){let r=this._redoStacks.get(e);return!r&&n&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUnitId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUnitId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,n){e.redoMutations.push(...n.redoMutations),e.undoMutations.push(...n.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let e="";const n=this._contextService.getContextValue(ht),r=this._contextService.getContextValue(pn),i=this._contextService.getContextValue(Dn);return n?r?e=Fn:i?e=Hn:e=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":e=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",e}};exports.LocalUndoRedoService=Wo([Zt(0,q),Zt(1,Rt),Zt(2,gt)],exports.LocalUndoRedoService);class ce extends p{onStarting(s){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}d(ce,"pluginName"),d(ce,"type",O.UNIVER_UNKNOWN);class ko{constructor(){d(this,"_plugins",[])}addPlugin(s){this._plugins.push(s)}removePlugins(){const s=this._plugins.slice();return this._plugins.length=0,s}forEachPlugin(s){this._plugins.forEach(s)}}class Go{constructor(){d(this,"_pluginsRegistered",[])}registerPlugin(s,e){this._pluginsRegistered.push({plugin:s,options:e})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var $o=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,jo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Vo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&$o(s,e,r),r},Nt=(t,s)=>(e,n)=>s(e,n,t);exports.PluginHolder=class extends p{constructor(e,n,r,i){super();d(this,"_started",!1);d(this,"_pluginRegistered",new Set);d(this,"_pluginStore",new ko);d(this,"_pluginRegistry",new Go);this._logService=e,this._injector=n,this._lifecycleService=r,this._lifecycleInitializerService=i}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(e=>e.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginRegistered.clear()}registerPlugin(e,n){const{pluginName:r}=e;if(this._pluginRegistered.has(r)){this._logService.warn("[PluginService]",`plugin ${r} has already been registered. This registration will be ignored.`);return}this._pluginRegistered.add(r),this._pluginRegistry.registerPlugin(e,n)}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const e=this._pluginRegistry.getRegisterPlugins().map(({plugin:r,options:i})=>this._initPlugin(r,i));this._pluginRegistry.removePlugins();const n=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{this._pluginsRunLifecycle(e,r),r===b.Steady&&n.dispose()}))}_pluginsRunLifecycle(e,n){e.forEach(r=>{switch(n){case b.Starting:r.onStarting(this._injector);break;case b.Ready:r.onReady();break;case b.Rendered:r.onRendered();break;case b.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(e,n){return this._injector.createInstance(e,n)}};exports.PluginHolder=jo([Nt(0,J),Nt(1,A.Inject(A.Injector)),Nt(2,A.Inject(exports.LifecycleService)),Nt(3,A.Inject(exports.LifecycleInitializerService))],exports.PluginHolder);var Ko=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,zo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Yo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ko(s,e,r),r},yo=(t,s)=>(e,n)=>s(e,n,t);const Xo=4;exports.PluginService=class{constructor(s){d(this,"_pluginHolderForUniver");d(this,"_pluginHoldersForTypes",new Map);d(this,"_flushTimer");this._injector=s,this._pluginHolderForUniver=this._injector.createInstance(exports.PluginHolder),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const s of this._pluginHoldersForTypes.values())s.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(s,e){this._assertPluginValid(s),this._scheduleInitPlugin();const{type:n}=s;n===O.UNIVER_UNKNOWN?(this._pluginHolderForUniver.registerPlugin(s,e),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(n).registerPlugin(s,e)}startPluginForType(s){this._ensurePluginHolderForType(s).start()}_ensurePluginHolderForType(s){if(!this._pluginHoldersForTypes.has(s)){const e=this._injector.createInstance(exports.PluginHolder);return this._pluginHoldersForTypes.set(s,e),e}return this._pluginHoldersForTypes.get(s)}_assertPluginValid(s){const{type:e,pluginName:n}=s;if(e===O.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${s}. Please assign a "type" to your plugin.`);if(n==="")throw new Error(`[PluginService]: no plugin name for ${s}. Please assign a "pluginName" to your plugin.`)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},Xo))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[s,e]of this._pluginHoldersForTypes)e.started&&e.flush()}};exports.PluginService=zo([yo(0,A.Inject(A.Injector))],exports.PluginService);function Vn(t,s){if(!s)return t;const e=[];for(const n of t){if(n.length===1){e.push(n);continue}const r=s.find(([i])=>i===n[0]);if(r){if(r[1]===null)continue;e.push([n[0],r[1]])}else e.push(n)}return e}class qo{constructor(s={},e){d(this,"_startedTypes",new Set);d(this,"_injector");const n=this._injector=Jo(e,s==null?void 0:s.override),{theme:r,locale:i,locales:o,logLevel:a}=s;r&&this._injector.get(De).setTheme(r),o&&this._injector.get(dt).load(o),i&&this._injector.get(dt).setLocale(i),a&&this._injector.get(J).setLogLevel(a),this._init(n),this._pluginService}get _univerInstanceService(){return this._injector.get(q)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(s){this._injector.get(dt).setLocale(s)}createUnit(s,e){return this._univerInstanceService.createUnit(s,e)}createUniverSheet(s){return this._univerInstanceService.createUnit(O.UNIVER_SHEET,s)}createUniverDoc(s){return this._univerInstanceService.createUnit(O.UNIVER_DOC,s)}createUniverSlide(s){return this._univerInstanceService.createUnit(O.UNIVER_SLIDE,s)}_init(s){this._univerInstanceService.registerCtorForType(O.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(O.UNIVER_DOC,st),this._univerInstanceService.registerCtorForType(O.UNIVER_SLIDE,Te);const e=s.get(q);e.__setCreateHandler((n,r,i)=>{if(!this._startedTypes.has(n)){this._pluginService.startPluginForType(n),this._startedTypes.add(n);const a=s.createInstance(i,r);return e.__addUnit(a),this._tryProgressToReady(),a}const o=s.createInstance(i,r);return e.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<b.Ready&&(this._injector.get(exports.LifecycleService).stage=b.Ready)}registerPlugin(s,e){this._pluginService.registerPlugin(s,e)}}function Jo(t,s){const e=Vn([[Cn],[dt],[De],[exports.LifecycleService],[exports.LifecycleInitializerService],[exports.UniverPermissionService],[exports.PluginService],[q,{useClass:exports.UniverInstanceService}],[ve,{useClass:exports.PermissionService}],[J,{useClass:En,lazy:!0}],[Rt,{useClass:exports.CommandService,lazy:!0}],[Yt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Rn,{useClass:mn}],[gt,{useClass:_n}],[In,{useClass:On,lazy:!0}],[Kt,{useClass:xn,lazy:!0}],[Ue,{useClass:ue,lazy:!0}]],s);return t?t.createChild(e):new A.Injector(e)}const Zo=(t,s)=>s.length===t.length&&!t.some(e=>s.some(n=>!X.equals(n,e))),Qo=(t,s)=>s.length===t.length&&t.every((e,n)=>{const r=s[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&X.equals(e.range,r.range)});function ta(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||!t||typeof s!="object"||!s)return!1;const e=Object.keys(t),n=Object.keys(s);if(e.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(s);for(let i=0;i<e.length;i++){const o=e[i];if(!r(o))return!1;const a=t[o],l=s[o];if(a!==l)return!1}return!0}function jn(t){return/^-?\d+(\.\d+)?$/.test(t)}function ea(t){return jn(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function sa(t){return["true","false"].includes(t.toLowerCase())}function na(t,s){return s.forEach(e=>t.add(e)),t}function ra(t,s=16){let e=0,n=null;return function(...i){const o=Date.now();o-e<s?(n&&clearTimeout(n),n=setTimeout(()=>{e=o,t.apply(this,i)},s)):(e=o,t.apply(this,i))}}function ia(t){const s=new MessageChannel;let e=!1;return s.port1.onmessage=()=>{e||t()},s.port2.postMessage(null),()=>{e=!0}}var Kn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(Kn||{});class he{constructor(s){d(this,"_index",0);d(this,"_offset",0);this._actions=s}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(s){s||(s=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const n=this._offset,r=e.len;return s>=r-n?(s=r-n,this._index+=1,this._offset=0):this._offset+=s,e.t===I.DELETE||e.t===I.RETAIN&&e.body==null?R.deepClone({...e,len:s}):R.deepClone({...e,len:s,body:Ne(e.body,n,n+s)})}else return{t:I.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const s=this._actions[this._index];return s?s.t:I.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const s=this._offset,e=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=s,this._index=e,[n].concat(r)}}else return[]}}function Ve(t){return Object.keys(t).length===1}class zt{constructor(){d(this,"_actions",[])}static compose(s,e){const n=new he(s),r=new he(e),i=new zt;for(;n.hasNext()||r.hasNext();)if(r.peekType()===I.INSERT)i.push(r.next());else if(n.peekType()===I.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),a=n.next(o),l=r.next(o);a.t===I.INSERT&&l.t===I.RETAIN?l.body==null?i.push(a):i.push({...a,body:ae(a.body,l.body,l.coverType)}):a.t===I.RETAIN&&l.t===I.RETAIN?a.body==null&&l.body==null?i.push(a.len!==Number.POSITIVE_INFINITY?a:l):a.body&&l.body?i.push({...a,body:ae(a.body,l.body,l.coverType)}):i.push(a.body?a:l):a.t===I.RETAIN&&l.t===I.DELETE?i.push(l):a.t===I.INSERT&&(l.t,I.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(s,e,n=""){const r={t:I.INSERT,body:e,len:s,line:0,segmentId:n};return this.push(r),this}retain(s,e="",n,r){const i={t:I.RETAIN,len:s,segmentId:e};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(s,e=""){const n={t:I.DELETE,len:s,line:0,segmentId:e};return this.push(n),this}serialize(){return this._actions}push(...s){if(s.length>1){for(const i of s)this.push(i);return this}let e=this._actions.length,n=this._actions[e-1];const r=R.deepClone(s[0]);if(r.t===I.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===I.DELETE&&r.t===I.DELETE)return n.len+=r.len,this;if(n.t===I.DELETE&&r.t===I.INSERT&&(e-=1,n=this._actions[e-1],n==null))return this._actions.unshift(r),this;if(n.t===I.RETAIN&&r.t===I.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===I.INSERT&&Ve(n.body)&&r.t===I.INSERT&&Ve(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let s=this._actions[this._actions.length-1];for(;s&&s.t===I.RETAIN&&ki(s);)this._actions.pop(),s=this._actions[this._actions.length-1];return this}}function oa(t,s,e){if(s==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new st(n),i=s.length;let o;for(;(o=r.getBody().dataStream.indexOf(s))>=0;){const l=new zt;if(o>0&&l.retain(o),e.length>0){const c=r.sliceBody(o,o+i),h={dataStream:e};Array.isArray(c==null?void 0:c.textRuns)&&c.textRuns.length&&(h.textRuns=[{...c.textRuns[0],st:0,ed:e.length}]),l.insert(e.length,h)}l.delete(i);const u=l.serialize();r.apply(u)}const a=r.getBody();return r.dispose(),a}class aa extends Gt{add(s){if(!s)return null;const e=new kt(s,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const la=A.createIdentifier("ILocalStorageService");function ua(t){return new L.Observable(s=>{const e=t((...n)=>s.next(n));return()=>e==null?void 0:e.dispose()})}function ca(t){return`sheet_interceptor_${t}`}const Yn=t=>function(s,e){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,e,r.bind(null,i+1))}return r(0,s)};class ha{constructor(s){d(this,"_interceptorsByName",new Map);d(this,"_interceptorPoints");this._interceptorPoints=s}fetchThroughInterceptors(s){const e=s,n=this._interceptorsByName.get(e);return Yn(n||[])}intercept(s,e){const n=s;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(e),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>$t(this._interceptorsByName.get(n),e)}getInterceptPoints(){return this._interceptorPoints}}const da=A.createIdentifier("univer.snapshot-server-service");class _a{constructor(){d(this,"_sheetBlockCache",new Map)}getUnitOnRev(s,e){return Promise.resolve({snapshot:{unitID:"",type:O.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:B.OK,message:""}})}getSheetBlock(s,e){const n=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:n,error:{code:B.OK,message:""}})}fetchMissingChangesets(s,e){return Promise.resolve({changesets:[],error:{code:B.OK,message:""}})}getResourcesRequest(s,e){return Promise.resolve({resources:{},error:{code:B.OK,message:""}})}saveSnapshot(s,e){return Promise.resolve({error:{code:B.OK,message:""}})}saveSheetBlock(s,e){const{block:n}=e;return n?(this._sheetBlockCache.set(n.id,n),Promise.resolve({error:{code:B.OK,message:""},blockID:n.id})):Promise.resolve({error:{code:B.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(s,e){return Promise.resolve({error:{code:B.OK,message:""},concurrent:[]})}}function fa(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(s,e)=>String.fromCharCode(Number.parseInt(e,16))))}function pe(t){return decodeURIComponent(Array.prototype.map.call(atob(t),s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const mt=new TextEncoder,yt=new TextDecoder;function zn(t){const s=R.deepClone(t);return delete s.id,delete s.name,delete s.rowCount,delete s.columnCount,delete s.cellData,mt.encode(JSON.stringify(s))}function yn(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.name,delete s.sheetOrder,delete s.sheets,mt.encode(JSON.stringify(s))}function Ea(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.title,delete s.resources,mt.encode(JSON.stringify(s))}function je(t){return JSON.parse(yt.decode(t))}function ga(t){return JSON.parse(typeof t=="string"?pe(t):yt.decode(t))}function Ra(t){return JSON.parse(typeof t=="string"?pe(t):yt.decode(t))}const Qt=256;function Xn(t,s){const e=new G(t),n=e.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+Qt,n-1),a=e.getSlice(i,Math.min(i+Qt,n-1),0,s),l=ma(a);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:l}),i+=Qt}return r}function ma(t){const s=t.getData();return mt.encode(JSON.stringify(s))}async function Ca(t,s,e,n,r){const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([h,_])=>{const f={id:_.id,type:Ft.GRID,name:_.name,rowCount:_.rowCount,columnCount:_.columnCount,originalMeta:zn(_)};if(o[h]=f,_.cellData){const E=Xn(_.cellData,_.rowCount),g=await Promise.all(E.map(m=>r.saveSheetBlock(t,{unitID:e,type:O.UNIVER_SHEET,block:m})));if(g.some(m=>{var N;return((N=m.error)==null?void 0:N.code)!==B.OK}))return!1;i[h]={sheetID:h,blocks:g.map(m=>m.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const l=yn(s),u={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:l};return{snapshotRes:{unitID:e,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0}}}async function Oa(t,s,e,n,r){var _,f;const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([E,g])=>{const m={id:g.id,type:Ft.GRID,name:g.name,rowCount:g.rowCount,columnCount:g.columnCount,originalMeta:zn(g)};if(o[E]=m,g.cellData){const N=Xn(g.cellData,g.rowCount),U=await Promise.all(N.map(M=>r.saveSheetBlock(t,{unitID:e,type:O.UNIVER_SHEET,block:M})));if(U.some(M=>{var V;return((V=M.error)==null?void 0:V.code)!==B.OK}))return!1;i[E]={sheetID:E,blocks:U.map(M=>M.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const l=yn(s),u={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:l},c={unitID:e,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0},h=await r.saveSnapshot(t,{unitID:e,type:O.UNIVER_SHEET,snapshot:c});if(Zs(h.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
+ ErrorCode: ${(_=h.error)==null?void 0:_.code}:${(f=h.error)==null?void 0:f.message}`);return{snapshot:c}}function Ia(t,s,e){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([l,u])=>{const c=je(u.originalMeta);r[l]={id:u.id,name:u.name,rowCount:u.rowCount,columnCount:u.columnCount,...c}});const i=new Map;s.forEach(l=>{i.set(l.id,l)}),n.blockMeta&&Object.entries(n.blockMeta).forEach(([l,u])=>{var _;const c=r[l];c.cellData={};const h=[];(_=u.blocks)==null||_.forEach(f=>{const E=i.get(f);if(E)h.push(E);else throw new Error("")}),h.forEach(f=>{const E=ga(f.data);Object.entries(E).forEach(([g,m])=>{const N=c.cellData[+g]={};Object.entries(m).forEach(([U,M])=>{N[+U]=M})})})});const o=je(n.originalMeta);return{id:t.unitID,rev:n.rev,name:n.name,sheetOrder:n.sheetOrder,appVersion:"",locale:nt.EN_US,sheets:r,styles:{},resources:n.resources||[],...o}}function Aa(t){const s=t.doc;if(s==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:n,name:r,originalMeta:i}=s,{body:o,documentStyle:a={},settings:l={}}=Ra(i);return{id:e,rev:n,locale:nt.EN_US,title:r,body:o,documentStyle:a,settings:l}}async function Na(t,s,e,n,r){var l,u,c;const i={unitID:s.id,rev:n,creator:"",name:(l=s.title)!=null?l:"",resources:s.resources||[],originalMeta:Ea(s)},o={unitID:e,rev:i.rev,type:O.UNIVER_DOC,workbook:void 0,doc:i},a=await r.saveSnapshot(t,{unitID:e,type:O.UNIVER_DOC,snapshot:o});if(Zs(a.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
+ ErrorCode: ${(u=a.error)==null?void 0:u.code}:${(c=a.error)==null?void 0:c.message}`);return{snapshot:o}}async function Sa(t,s){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const a=o.blocks.map(async l=>{const u={unitID:e.unitID,type:O.UNIVER_SHEET,blockID:l},{block:c}=await s.getSheetBlock({},u);if(c)n.push(c);else throw new Error("Block not found")});r.push(...a)}),await Promise.all(r),n}var qn=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(qn||{}),Jn=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(Jn||{}),Zn=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(Zn||{}),Qn=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(Qn||{}),tr=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(tr||{});ir();exports.ABCToNumber=di;exports.AbsoluteRefType=w;exports.ActionIterator=he;exports.AlignTypeH=Us;exports.AlignTypeV=Ds;exports.AutoFillSeries=ze;exports.BaselineOffset=it;exports.BlockType=ds;exports.BooleanNumber=C;exports.BorderStyleTypes=T;exports.BorderType=ye;exports.BulletAlignment=K;exports.COLORS=te;exports.CellValueType=Q;exports.ClientSnapshotServerService=_a;exports.Color=tt;exports.ColorBuilder=Bt;exports.ColorKit=k;exports.ColorType=W;exports.ColumnSeparatorType=Es;exports.CommandType=jt;exports.CommonHideTypes=Xe;exports.ConfigService=mn;exports.ContentAlignment=Ls;exports.ContextService=_n;exports.CopyPasteType=qe;exports.CustomRangeType=hs;exports.DEFAULT_CELL=Ai;exports.DEFAULT_DOC=Se;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Xi;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Mo;exports.DEFAULT_RANGE=Oi;exports.DEFAULT_RANGE_ARRAY=lt;exports.DEFAULT_SELECTION=Ii;exports.DEFAULT_SLIDE=qs;exports.DEFAULT_STYLES=Tt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Sn;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Qi;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=wn;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=no;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Tn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=eo;exports.DEFAULT_WORKSHEET_ROW_COUNT=Nn;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Zi;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Ln;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=to;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=bn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=so;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Fn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Hn;exports.DashStyleType=As;exports.DataStreamTreeNodeType=tn;exports.DataStreamTreeTokenType=Ce;exports.DataValidationErrorStyle=qn;exports.DataValidationImeMode=Jn;exports.DataValidationOperator=Zn;exports.DataValidationRenderMode=Kn;exports.DataValidationStatus=tr;exports.DataValidationType=Qn;exports.DesktopLogService=En;exports.DeveloperMetadataVisibility=Je;exports.Dimension=Ze;exports.Direction=Qe;exports.Disposable=p;exports.DisposableCollection=Ee;exports.DocStyleType=us;exports.DocumentDataModel=st;exports.EDITOR_ACTIVATED=Dn;exports.EXTENSION_NAMES=Js;exports.Entry=ee;exports.EntryIterator=Ks;exports.ErrorService=Cn;exports.EventState=Gs;exports.FOCUSING_DOC=bt;exports.FOCUSING_EDITOR_BUT_HIDDEN=_o;exports.FOCUSING_EDITOR_INPUT_FORMULA=fo;exports.FOCUSING_EDITOR_STANDALONE=go;exports.FOCUSING_FORMULA_EDITOR=pn;exports.FOCUSING_SHEET=ht;exports.FOCUSING_SLIDE=wt;exports.FOCUSING_UNIVER_EDITOR=Eo;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Ro;exports.FloatingObjectManagerService=On;exports.FollowNumberWithType=cs;exports.FontItalic=Dt;exports.FontStyleType=Ts;exports.FontWeight=pt;exports.FormatType=ts;exports.GlyphType=ut;exports.GridType=_s;exports.HLSColor=as;exports.HorizontalAlign=Z;exports.ICommandService=Rt;exports.IConfigService=Rn;exports.IContextService=gt;exports.IFloatingObjectManagerService=In;exports.ILocalStorageService=la;exports.ILogService=J;exports.IPermissionService=ve;exports.IResourceLoaderService=Ue;exports.IResourceManagerService=Kt;exports.ISnapshotServerService=da;exports.IUndoRedoService=Yt;exports.IUniverInstanceService=q;exports.InterceptorManager=ha;exports.InterpolationPointType=es;exports.KeyIterator=Vs;exports.LRUHelper=at;exports.LRUMap=Ys;exports.LifecycleStages=b;exports.LocaleService=dt;exports.LocaleType=nt;exports.LogLevel=fn;exports.MemoryCursor=Qs;exports.NamedStyleType=Os;exports.NilCommand=gn;exports.NumberUnitType=vs;exports.ObjectMatrix=G;exports.ObjectRelativeFromH=bs;exports.ObjectRelativeFromV=ws;exports.Observable=Gt;exports.ObservableHooks=aa;exports.Observer=kt;exports.OnLifecycle=be;exports.PRESET_LIST_TYPE=pi;exports.PageElementType=Ps;exports.PageOrientType=Ms;exports.PageType=de;exports.ParagraphElementType=Rs;exports.PermissionPoint=zs;exports.PermissionStatus=ge;exports.Plugin=ce;exports.PositionedObjectLayoutType=Cs;exports.PresetListType=Ht;exports.ProtectionType=ss;exports.RANGE_TYPE=x;exports.RGBA_PAREN=hr;exports.RGB_PAREN=cr;exports.Range=et;exports.Rectangle=X;exports.RedoCommand=$n;exports.RedoCommandId=Bn;exports.RefAlias=hi;exports.Registry=Re;exports.RegistryAsMap=me;exports.RelativeDate=ns;exports.RelativeSlideLink=xs;exports.ResourceManagerService=xn;exports.RgbColor=Mt;exports.RxDisposable=ei;exports.SectionType=fs;exports.ShapeType=rs;exports.SheetTypes=Ft;exports.SheetViewModel=Un;exports.SlideDataModel=Te;exports.SpacingRule=Is;exports.Styles=An;exports.THEME_COLORS=os;exports.TabStopAlignment=Ns;exports.TextDecoration=is;exports.TextDirection=_t;exports.TextDirectionType=gs;exports.TextX=zt;exports.TextXActionType=I;exports.ThemeColor=Pt;exports.ThemeColorType=H;exports.ThemeColors=Wt;exports.ThemeService=De;exports.Tools=R;exports.UndoCommand=Gn;exports.UndoCommandId=kn;exports.UnitModel=Vt;exports.Univer=qo;exports.UniverEditablePermission=Ut;exports.UniverEditablePermissionPoint=Pn;exports.UniverInstanceType=O;exports.UpdateDocsAttributeType=P;exports.ValueIterator=js;exports.VerticalAlign=rt;exports.WidthType=Ss;exports.Worksheet=Et;exports.WrapStrategy=ft;exports.WrapTextType=ms;exports.b64DecodeUnicode=pe;exports.b64EncodeUnicode=fa;exports.binarySearchArray=Ke;exports.cellToRange=Yr;exports.characterSpacingControlType=ps;exports.checkForSubstrings=zr;exports.checkParagraphHasBullet=yr;exports.checkParagraphHasIndent=Xr;exports.checkParagraphHasIndentByStyle=Fs;exports.codeToBlob=lr;exports.composeBody=ae;exports.composeInterceptors=Yn;exports.concatMatrixArray=oi;exports.convertBodyToHtml=Ci;exports.covertTextRunToHtml=oe;exports.createInterceptorKey=ca;exports.createInternalEditorID=Po;exports.createRowColIter=ie;exports.debounce=mi;exports.dedupe=si;exports.deepCompare=_e;exports.deleteContent=Bs;exports.extractPureTextFromCell=ro;exports.fromCallback=ua;exports.fromObservable=ti;exports.generateTemporarySnap=Ca;exports.getArrayLength=y;exports.getBodySlice=Ne;exports.getBodySliceHtml=Lt;exports.getBorderStyleType=jr;exports.getCellValueType=Tr;exports.getColorStyle=$;exports.getDocsUpdateBody=St;exports.getReverseDirection=ur;exports.getSheetBlocksFromSnapshot=Sa;exports.getTypeFromPermissionItemList=ci;exports.getWorksheetUID=ho;exports.groupBy=ii;exports.handleJsonToDom=$r;exports.handleStyleToString=Vr;exports.hashAlgorithm=Jr;exports.horizontalLineSegmentsSubtraction=fe;exports.insertMatrixArray=se;exports.insertTextToContent=Ws;exports.isBlackColor=Nr;exports.isBooleanString=sa;exports.isCellV=wr;exports.isEmptyCell=Br;exports.isFormulaId=Gr;exports.isFormulaString=kr;exports.isICellData=Lr;exports.isInternalEditorID=xo;exports.isNullCell=br;exports.isNumeric=jn;exports.isObserver=$s;exports.isRangesEqual=Zo;exports.isRealNum=qr;exports.isSafeNumeric=ea;exports.isSameStyleTextRun=Hs;exports.isUnitRangesEqual=Qo;exports.isValidRange=Kr;exports.isWhiteColor=Sr;exports.makeCellRangeToRangeData=Wr;exports.makeCellToSelection=Fr;exports.mergeOverrideWithDependencies=Vn;exports.mergeSets=na;exports.mergeWorksheetSnapshotWithDefault=vn;exports.moveMatrixArray=re;exports.moveRangeByOffset=bi;exports.normalizeTextRuns=Oe;exports.numberToABC=fi;exports.numberToListABC=Ei;exports.orderSearchArray=Ye;exports.queryObjectMatrix=Ti;exports.remove=$t;exports.repeatStringNumTimes=Xs;exports.replaceInDocumentBody=oa;exports.requestImmediateMacroTask=ia;exports.rotate=ri;exports.runOnLifecycle=we;exports.searchArray=ar;exports.selectionToArray=vr;exports.sequence=dn;exports.sequenceAsync=hn;exports.sequenceExecute=Le;exports.sequenceExecuteAsync=yi;exports.shallowEqual=ta;exports.sliceMatrixArray=ai;exports.sortRules=gi;exports.sortRulesByDesc=Ri;exports.sortRulesFactory=ot;exports.spliceArray=ne;exports.textDecoder=yt;exports.textEncoder=mt;exports.throttle=ra;exports.toDisposable=v;exports.transformDocumentDataToSnapshot=Na;exports.transformSnapshotToDocumentData=Aa;exports.transformSnapshotToWorkbookData=Ia;exports.transformWorkbookDataToSnapshot=Oa;