@univerjs/core 0.1.10 → 0.1.12

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 (66) hide show
  1. package/lib/cjs/index.js +7 -7
  2. package/lib/es/index.js +670 -650
  3. package/lib/types/common/unit.d.ts +1 -1
  4. package/lib/types/docs/data-model/action-types.d.ts +1 -1
  5. package/lib/types/docs/data-model/apply-utils/update-apply.d.ts +1 -1
  6. package/lib/types/docs/data-model/document-data-model.d.ts +4 -5
  7. package/lib/types/docs/data-model/empty-snapshot.d.ts +1 -1
  8. package/lib/types/docs/data-model/text-x/text-x.d.ts +2 -2
  9. package/lib/types/docs/data-model/text-x/utils.d.ts +2 -2
  10. package/lib/types/observer/observable-hooks.d.ts +1 -1
  11. package/lib/types/services/command/command.service.d.ts +5 -3
  12. package/lib/types/services/context/context.service.d.ts +1 -1
  13. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +3 -3
  14. package/lib/types/services/instance/instance.service.d.ts +7 -7
  15. package/lib/types/services/lifecycle/lifecycle.service.d.ts +4 -4
  16. package/lib/types/services/locale/locale.service.d.ts +6 -4
  17. package/lib/types/services/permission/permission.service.d.ts +4 -4
  18. package/lib/types/services/permission/univer.permission.service.d.ts +2 -2
  19. package/lib/types/services/plugin/plugin-holder.d.ts +5 -5
  20. package/lib/types/services/plugin/plugin.d.ts +3 -3
  21. package/lib/types/services/plugin/plugin.service.d.ts +3 -3
  22. package/lib/types/services/resource-loader/resource-loader.service.d.ts +5 -5
  23. package/lib/types/services/resource-loader/type.d.ts +1 -1
  24. package/lib/types/services/resource-manager/resource-manager.service.d.ts +2 -2
  25. package/lib/types/services/resource-manager/type.d.ts +3 -3
  26. package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +3 -3
  27. package/lib/types/services/snapshot/snapshot-server.service.d.ts +1 -1
  28. package/lib/types/services/snapshot/snapshot-transform.d.ts +4 -4
  29. package/lib/types/services/snapshot/snapshot-utils.d.ts +5 -5
  30. package/lib/types/services/theme/theme.service.d.ts +1 -1
  31. package/lib/types/services/undoredo/undoredo.service.d.ts +6 -6
  32. package/lib/types/services/user-manager/user-manager.service.d.ts +5 -0
  33. package/lib/types/shared/color/color.d.ts +1 -1
  34. package/lib/types/shared/common.d.ts +5 -5
  35. package/lib/types/shared/lifecycle.d.ts +3 -3
  36. package/lib/types/shared/object-matrix-query.d.ts +1 -1
  37. package/lib/types/shared/object-matrix.d.ts +1 -1
  38. package/lib/types/shared/rectangle.d.ts +1 -1
  39. package/lib/types/shared/rxjs.d.ts +1 -1
  40. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +1 -1
  41. package/lib/types/sheets/column-manager.d.ts +2 -2
  42. package/lib/types/sheets/empty-snapshot.d.ts +1 -1
  43. package/lib/types/sheets/range.d.ts +4 -4
  44. package/lib/types/sheets/row-manager.d.ts +3 -3
  45. package/lib/types/sheets/styles.d.ts +1 -1
  46. package/lib/types/sheets/view-model.d.ts +3 -3
  47. package/lib/types/sheets/workbook.d.ts +6 -6
  48. package/lib/types/sheets/worksheet.d.ts +7 -7
  49. package/lib/types/slides/slide-model.d.ts +1 -2
  50. package/lib/types/types/enum/locale-type.d.ts +2 -1
  51. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +3 -3
  52. package/lib/types/types/interfaces/i-cell-data.d.ts +5 -5
  53. package/lib/types/types/interfaces/i-cell-validation-data.d.ts +1 -1
  54. package/lib/types/types/interfaces/i-data-validation.d.ts +5 -5
  55. package/lib/types/types/interfaces/i-document-data.d.ts +10 -4
  56. package/lib/types/types/interfaces/i-extra-model-data.d.ts +0 -6
  57. package/lib/types/types/interfaces/i-selection-data.d.ts +1 -1
  58. package/lib/types/types/interfaces/i-shape-properties.d.ts +1 -1
  59. package/lib/types/types/interfaces/i-slide-data.d.ts +10 -10
  60. package/lib/types/types/interfaces/i-style-data.d.ts +3 -3
  61. package/lib/types/types/interfaces/i-univer-data.d.ts +4 -4
  62. package/lib/types/types/interfaces/i-workbook-data.d.ts +4 -4
  63. package/lib/types/types/interfaces/i-worksheet-data.d.ts +6 -6
  64. package/lib/types/univer.d.ts +7 -7
  65. package/lib/umd/index.js +9 -9
  66. package/package.json +8 -8
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";var ir=Object.defineProperty;var or=(t,e,s)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var d=(t,e,s)=>(or(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("rxjs"),Lt=require("rxjs/operators"),A=require("@wendellhu/redi");function ar(){lr()}const Ot=typeof global<"u"?global:typeof self<"u"?self:window;function lr(){typeof Ot.requestIdleCallback!="function"&&(Ot.requestIdleCallback=function(s){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));s({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Ot.cancelIdleCallback!="function"&&(Ot.cancelIdleCallback=function(s){clearTimeout(s)})}function Ye(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function ze(t,e){let s=0,n=0,r=0,i=-1,o=t.length-1;for(;s<t.length&&o>=0&&o>=s;){if(n=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=n){i=o;break}if(n=t[s],s===0?r=0:r=t[s-1],e>=r&&e<n){i=s;break}s++,o--}return i}function ur(t,e){let s=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||e<=t[20]||e>=t[s-20]?s=ze(t,e):s=Ye(t,e),s)}function cr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var ye=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(ye||{}),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||{}),Xe=(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))(Xe||{}),W=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(W||{}),qe=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(qe||{}),Je=(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))(Je||{}),Ze=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Ze||{}),Qe=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Qe||{}),ts=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(ts||{});function hr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var es=(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))(es||{}),ss=(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))(ss||{}),nt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(nt||{}),ns=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ns||{}),rs=(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))(rs||{}),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||{}),Bt=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Bt||{}),_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||{}),os=(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))(os||{}),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||{}),Mt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Mt||{}),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||{}),kt=(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))(kt||{});const as={[kt.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 Gt{constructor(){d(this,"_themeValue",H.LIGHT1);d(this,"_themeColors");d(this,"_themeTint");d(this,"_rgbValue","");d(this,"_colorType");this._colorType=W.UNSUPPORTED,this._themeColors=kt.OFFICE,this._themeTint=0}asRgbColor(){return new xt(this._rgbValue,this)}asThemeColor(){return new Ht(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(e){return this._colorType=W.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=W.THEME,this._themeColors=e}setThemeTint(e){this._colorType=W.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=W.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class tt{constructor(e){d(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const s=+`0x${e[0]}${e[1]}`,n=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Gt().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(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(e);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(e){return!1}}class ls{constructor(e){d(this,"_saturation",0);d(this,"_hue",0);d(this,"_lightness",0);d(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),a=Math.max(s,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),s===a&&(this._hue=(n-r)/l),n===a&&(this._hue=2+(r-s)/l),r===a&&(this._hue=4+(s-n)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Gt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),a=this.setColor(s,n,r),l=r-1/3,u=this.setColor(s,n,l);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,s,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=s+(e-s)*6*n:2*n<1?r=e:3*n<2?r=s+(e-s)*(2/3-n)*6:r=s,r}setLightness(e){this._lightness=e}}const F=class F extends tt{constructor(s,n){super(n);d(this,"_cssString");d(this,"_red");d(this,"_green");d(this,"_blue");d(this,"_alpha");let r=s.match(F.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],l=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(r=s.match(F.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=s,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 s=this._red+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}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(s){return s instanceof F?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._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 xt=F;const Y=class Y extends tt{constructor(s,n,r,i){super(i);d(this,"_themeColorType");d(this,"_themeTint");d(this,"_themeColors");this._themeColorType=s,this._themeTint=n,this._themeColors=r}lumValue(s,n){if(s==null)return n;let r;return s<0?r=n*(1+s):r=n*(1-s)+(255-255*(1-s)),r}asRgbColor(){const s=as[this._themeColors];if(s==null)throw new Error("not find themeColors type");const n=s[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 ls(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(s){return s instanceof Y?s._themeColorType===this._themeColorType:!1}getColorType(){return W.THEME}getThemeColorType(){return this._themeColorType}};d(Y,"_cacheThemeColor",new Map);let Ht=Y;const dr="rgb(",_r="rgba(",ee={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(e){d(this,"_color");d(this,"_rgbColor");d(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof k){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=us(e);if(s==null){this._setNullColor();return}this._color=s;const n=mr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){var u,c;n=Math.min(1,Math.max(0,n));const r=new k(e).toRgb(),i=new k(s).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(e,s){const n=new k(e).getLuminance(),r=new k(s).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:s,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${s},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:s,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[It(Math.round(s).toString(16)),It(Math.round(n).toString(16)),It(Math.round(r).toString(16)),It(Math.round(i*255).toString(16))];return e&&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 Ar(this.toRgb())}toHsl(){return Ir(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}setAlpha(e){return new k({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=qt(e),s=qt(s),n=qt(n),Number((.2126*e+.7152*s+.0722*n).toFixed(3))}getBrightness(){const{r:e,g:s,b:n}=this.toRgb();return(e*299+s*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)!=null?e: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,qt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),us=t=>{if(Sr(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 s={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(s.a=t.a),s}const e=t.trim();if(ee[e]){const s=ee[e],n={r:Math.round(s[0]),g:Math.round(s[1]),b:Math.round(s[2])};return n.a=s[3]||1,n}if(e.startsWith("#"))return fr(e);if(e.startsWith("rgb"))return Er(e);if(e.startsWith("hsl"))return gr(e);if(e.startsWith("hsv"))return Rr(e)},fr=t=>{const e=t.substring(1),s=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(s);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},Er=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(s[0],10),g:Number.parseInt(s[1],10),b:Number.parseInt(s[2],10)};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},gr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(s[0],10),s:Number.parseFloat(s[1]),l:Number.parseFloat(s[2])};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},Rr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(s[0],10),s:Number.parseFloat(s[1]),v:Number.parseFloat(s[2])};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},mr=t=>{const e=us(t);if(e!=null)return"r"in e?e:"l"in e?Cr(e):Or(e)},Jt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t),Cr=t=>{let{h:e,s,l:n}=t;e/=360,s/=100,n/=100;let r=0,i=0,o=0;if(s===0)r=i=o=n;else{const l=n<.5?n*(1+s):n+s-n*s,u=2*n-l;r=Jt(u,l,e+1/3),i=Jt(u,l,e),o=Jt(u,l,e-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},Or=t=>{let{h:e,s,v:n}=t;e=e/360*6,s/=100,n/=100;const r=Math.floor(e),i=e-r,o=n*(1-s),a=n*(1-i*s),l=n*(1-(1-i)*s),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},Ir=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,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 e:a=(s-n)/c+(s<n?6:0);break;case s:a=(n-e)/c+2;break;default:a=(e-s)/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},Ar=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n);let o;const a=r,l=r-i,u=r===0?0:l/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/l+(s<n?6:0);break;case s:o=(n-e)/l+2;break;default:o=(e-s)/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},Nr=t=>t==null,Sr=t=>!Nr(t)&&typeof t=="object";function Lr(t){const e=/^#(?:[0]{3}|[0]{6})\b/,s=/^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!!(e.test(t)||s.test(t)||n.test(t)||r.test(t)||i.test(t))}function Tr(t){const e=/^#(?:[Ff]{3}|[Ff]{6})\b/,s=/^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!!(e.test(t)||s.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 br(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 wr(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 vr(t){if(t==null)return!0;const{v:e,f:s,si:n,p:r,s:i}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||s!=null&&s.length>0||n!=null&&n.length>0||r!=null)}function Ur(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var cs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(cs||{}),hs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(hs||{}),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||{}),ds=(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))(ds||{}),_s=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(_s||{}),fs=(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))(fs||{}),Es=(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))(Es||{}),gs=(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))(gs||{}),Rs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Rs||{}),ms=(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))(ms||{}),Cs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Cs||{}),Os=(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))(Os||{}),Is=(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))(Is||{}),As=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(As||{}),Ns=(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))(Ns||{}),Ss=(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))(Ss||{}),Ls=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Ls||{}),Ts=(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))(Ts||{}),bs=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(bs||{}),ws=(t=>(t[t.PAGE=0]="PAGE",t[t.COLUMN=1]="COLUMN",t[t.CHARACTER=2]="CHARACTER",t[t.MARGIN=3]="MARGIN",t[t.INSIDE_MARGIN=4]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.LEFT_MARGIN=6]="LEFT_MARGIN",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(ws||{}),vs=(t=>(t[t.PAGE=0]="PAGE",t[t.PARAGRAPH=1]="PARAGRAPH",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.TOP_MARGIN=4]="TOP_MARGIN",t[t.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=6]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",t))(vs||{}),Us=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Us||{}),Ds=(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))(Ds||{}),ps=(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))(ps||{}),Ms=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Ms||{}),Ps=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Ps||{}),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 Dr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}var _e=(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))(_e||{}),xs=(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))(xs||{}),Hs=(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))(Hs||{});const pr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mr=t=>crypto.getRandomValues(new Uint8Array(t)),Pr=(t,e,s)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*e/t.length);return(i=e)=>{let o="";for(;;){let a=s(r),l=r;for(;l--;)if(o+=t[a[l]&n]||"",o.length===i)return o}}},xr=(t,e=21)=>Pr(t,e,Mr),Hr=(t=21)=>{let e="",s=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=pr[s[t]&63];return e};const Fr=/^-ms-/,Wr=/-([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(e){let s="",n=e;for(;n>=j.length;)n/=j.length,n-=1,s+=j[n%j.length];const r=e%j.length;return s+=j[r],s}static indexAt(e){let s=0;for(let n=0;n<e.length-1;n+=1){const r=e.charCodeAt(n)-65,i=e.length-1-n;s+=j.length**i+j.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return R.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=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"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,l=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":s?"Opera":a?"Safari":l?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21,s){return s?xr(s,e)():Hr(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.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=e[a])!=null?u:[];e[a]=h,n(l,h);return}if(R.isObject(l)){const h=(c=e[a])!=null?c:{};e[a]=h,r(l,h);return}e[a]=l})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){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(e.length!==s.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(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=R.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=R.deepClone(r)}),Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,s){return e instanceof s}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const s in e)return!1;return!0}static isMobile(){let e=0,s=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(s=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&s<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return s=>{for(let n=0;n<e;n++)s&&s()}}static hasLength(e,s){return R.isDefine(e)?R.isDefine(s)?e.length===s:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,s){return s.toUpperCase()}static camelCase(e){return e.replace(Fr,"ms-").replace(Wr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:R.removeNull(n)}),e}static fillTwoDimensionalArray(e,s,n){return new Array(e).fill(n).map(r=>new Array(s).fill(n))}static numToWord(e){let s="";for(;e>0;){let n=e%26;n=n===0?n=26:n,s=String.fromCharCode(96+n)+s,e=(e-n)/26}return s.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return Number.NaN;const s=e.toLowerCase().split(""),n=s.length;let r=0,i=0;for(let o=0;o<n;o++)i=s[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let s=0,n=e.length;s<n;s++){const r=Number.parseInt((Math.random()*n).toString()),i=e[r];e[r]=e[s],e[s]=i}return e}static commonExtend(e,s){const n={};for(const r in e)n[r]=e[r];for(const r in s)s[r]!=null&&(n[r]=s[r]);return n}static commonExtend1(e,s){for(const n in e)s[n]==null&&(s[n]=e[n]);return s}static arrayToObject(e){const s={};return e.forEach((n,r)=>{s[r]={},n.forEach((i,o)=>{s[r][o]=i})}),s}static hasIntersectionBetweenTwoRanges(e,s,n,r){return s>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-z_]/.test(e)}static isValidParameter(e){const s=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!s&&n}}function Br(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:l,endX:u}=t,c=e,h=s,_=e,f=s;if(n&&i){const{startRow:E,startColumn:g,endRow:m,endColumn:S,startY:U,endY:M,startX:V,endX:rr}=i;c=E,h=g,_=m,f=S,o=U,a=M,l=V,u=rr}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 kr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:l}=t;let u=e,c=s,h=e,_=s;return(n||r)&&(u=i,c=o,h=a,_=l),{startRow:u,startColumn:c,endRow:h,endColumn:_}}function Gr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function $(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Gt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function $r(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function Vr(t){return R.isString(t)&&t.length>0}function jr(t){return""}function Kr(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.ul.cl)}; `),t.ul.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):s+="text-decoration-line: line-through; ",t.st.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.st.cl)}; `),t.st.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${$(t.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,_,f,E,g,m,S;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${At((a=t.bd)==null?void 0:a.b.s)} ${(l=$(t.bd.b.cl))!=null?l:""}; `),(u=t.bd)!=null&&u.t&&(s+=`border-top: ${At((c=t.bd)==null?void 0:c.t.s)} ${(h=$(t.bd.t.cl))!=null?h:""}; `),(_=t.bd)!=null&&_.r&&(s+=`border-right: ${At((f=t.bd)==null?void 0:f.r.s)} ${(E=$(t.bd.r.cl))!=null?E:""}; `),(g=t.bd)!=null&&g.l&&(s+=`border-left: ${At((m=t.bd)==null?void 0:m.l.s)} ${(S=$(t.bd.l.cl))!=null?S:""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${$(t.cl)}; `)}],["va",()=>{t.va===it.SUBSCRIPT?s+="vertical-align: sub; ":t.va===it.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,l;t.tr&&(s+=`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?s+="text-align: left; ":t.ht===Z.RIGHT?s+="text-align: right; ":t.ht===Z.CENTER?s+="text-align: center; ":t.ht===Z.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===rt.BOTTOM?s+="vertical-align: bottom; ":t.vt===rt.TOP?s+="vertical-align: top; ":t.vt===rt.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===ft.CLIP?s+="white-space: clip; ":t.tb===ft.WRAP&&(s+="white-space: normal;")}],["pd",()=>{var c,h,_,f,E,g,m,S;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&&(s+=`padding-bottom: ${o}; `),(g=t.pd)!=null&&g.t&&(s+=`padding-top: ${a}; `),(m=t.pd)!=null&&m.l&&(s+=`padding-left: ${l}; `),(S=t.pd)!=null&&S.r&&(s+=`padding-right: ${u}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function At(t){let e="";return t===T.NONE?e="none":t===T.THIN?e="0.5pt solid":t===T.HAIR?e="0.5pt double":t===T.DOTTED?e="0.5pt dotted":t===T.DASHED||t===T.DASH_DOT?e="0.5pt dashed":t===T.DASH_DOT_DOT?e="0.5pt dotted":t===T.DOUBLE?e="0.5pt double":t===T.MEDIUM?e="1pt solid":t===T.MEDIUM_DASHED||t===T.MEDIUM_DASH_DOT?e="1pt dashed":t===T.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===T.SLANT_DASH_DOT?e="0.5pt dashed":t===T.THICK&&(e="1.5pt solid"),e}function Yr(t){let e=0;if(t=t.trim(),t==="none")e=T.NONE;else if(t==="0.5pt solid")e=T.THIN;else if(t==="0.5pt double")e=T.HAIR;else if(t==="0.5pt dotted")e=T.DOTTED;else if(t==="0.5pt dashed")e=T.DASHED;else if(t==="1pt solid")e=T.MEDIUM;else if(t==="1pt dashed")e=T.MEDIUM_DASHED;else if(t==="1pt dotted")e=T.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=T.THICK;else if(!t.includes("none"))e=T.THIN;else return T.NONE;return e}function Tt(t,e){let s=t.body;if(e){const{headers:n,footers:r}=t;n!=null&&n[e]?s=n[e].body:r!=null&&r[e]&&(s=r[e].body)}return s}function zr(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r,rangeType:i}=t;return!(e<0||n<0||s<0||r<0||!(Number.isNaN(e)&&Number.isNaN(s))&&i===x.COLUMN||!(Number.isNaN(n)&&Number.isNaN(r))&&i===x.ROW)}function yr(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function fe(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(s=>fe(t[s],e[s])):t===e:!1}function Fs(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:fe(s,n)}function Xr(t,e){return e.some(s=>t.indexOf(s)>-1)}function Ee(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function qr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Jr(t){if(t==null)return!1;const e=t.paragraphStyle;return Ws(e)}function Ws(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Bs(t,e,s){return t.slice(0,e)+s+t.slice(e)}function ks(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}function Zr(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Qr(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+(e<<6)+(e<<16)-e;return e>>>0}function Pe(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],n=0;if(s)return s.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(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xe(t,e){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}}return i}function He(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function ct(t){return typeof t=="function"}function ti(t){var e=function(n){Error.call(n),n.stack=new Error().stack},s=t(e);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var Zt=ti(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
1
+ "use strict";var ir=Object.defineProperty;var or=(t,e,s)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var d=(t,e,s)=>(or(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("rxjs"),Lt=require("rxjs/operators"),N=require("@wendellhu/redi");function ar(){lr()}const Ot=typeof global<"u"?global:typeof self<"u"?self:window;function lr(){typeof Ot.requestIdleCallback!="function"&&(Ot.requestIdleCallback=function(s){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));s({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Ot.cancelIdleCallback!="function"&&(Ot.cancelIdleCallback=function(s){clearTimeout(s)})}function Ye(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function ye(t,e){let s=0,n=0,r=0,i=-1,o=t.length-1;for(;s<t.length&&o>=0&&o>=s;){if(n=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=n){i=o;break}if(n=t[s],s===0?r=0:r=t[s-1],e>=r&&e<n){i=s;break}s++,o--}return i}function ur(t,e){let s=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||e<=t[20]||e>=t[s-20]?s=ye(t,e):s=Ye(t,e),s)}function cr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}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||{}),Xe=(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))(Xe||{}),W=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(W||{}),qe=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(qe||{}),Je=(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))(Je||{}),Ze=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Ze||{}),Qe=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Qe||{}),ts=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(ts||{});function hr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var es=(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))(es||{}),ss=(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))(ss||{}),nt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t.RU_RU="ruRU",t))(nt||{}),ns=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(ns||{}),rs=(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))(rs||{}),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||{}),Bt=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Bt||{}),_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||{}),os=(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))(os||{}),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||{}),Mt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Mt||{}),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||{}),kt=(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))(kt||{});const as={[kt.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 Gt{constructor(){d(this,"_themeValue",H.LIGHT1);d(this,"_themeColors");d(this,"_themeTint");d(this,"_rgbValue","");d(this,"_colorType");this._colorType=W.UNSUPPORTED,this._themeColors=kt.OFFICE,this._themeTint=0}asRgbColor(){return new xt(this._rgbValue,this)}asThemeColor(){return new Ht(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(e){return this._colorType=W.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=W.THEME,this._themeColors=e}setThemeTint(e){this._colorType=W.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=W.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class tt{constructor(e){d(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const s=+`0x${e[0]}${e[1]}`,n=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Gt().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(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(e);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(e){return!1}}class ls{constructor(e){d(this,"_saturation",0);d(this,"_hue",0);d(this,"_lightness",0);d(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),a=Math.max(s,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),s===a&&(this._hue=(n-r)/l),n===a&&(this._hue=2+(r-s)/l),r===a&&(this._hue=4+(s-n)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Gt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),a=this.setColor(s,n,r),l=r-1/3,u=this.setColor(s,n,l);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,s,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=s+(e-s)*6*n:2*n<1?r=e:3*n<2?r=s+(e-s)*(2/3-n)*6:r=s,r}setLightness(e){this._lightness=e}}const F=class F extends tt{constructor(s,n){super(n);d(this,"_cssString");d(this,"_red");d(this,"_green");d(this,"_blue");d(this,"_alpha");let r=s.match(F.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],l=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(r=s.match(F.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=s,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 s=this._red+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+F.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}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(s){return s instanceof F?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._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 xt=F;const Y=class Y extends tt{constructor(s,n,r,i){super(i);d(this,"_themeColorType");d(this,"_themeTint");d(this,"_themeColors");this._themeColorType=s,this._themeTint=n,this._themeColors=r}lumValue(s,n){if(s==null)return n;let r;return s<0?r=n*(1+s):r=n*(1-s)+(255-255*(1-s)),r}asRgbColor(){const s=as[this._themeColors];if(s==null)throw new Error("not find themeColors type");const n=s[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 ls(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(s){return s instanceof Y?s._themeColorType===this._themeColorType:!1}getColorType(){return W.THEME}getThemeColorType(){return this._themeColorType}};d(Y,"_cacheThemeColor",new Map);let Ht=Y;const dr="rgb(",_r="rgba(",ee={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(e){d(this,"_color");d(this,"_rgbColor");d(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof k){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=us(e);if(s==null){this._setNullColor();return}this._color=s;const n=mr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){var u,c;n=Math.min(1,Math.max(0,n));const r=new k(e).toRgb(),i=new k(s).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(e,s){const n=new k(e).getLuminance(),r=new k(s).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:s,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${s},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:s,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[It(Math.round(s).toString(16)),It(Math.round(n).toString(16)),It(Math.round(r).toString(16)),It(Math.round(i*255).toString(16))];return e&&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 Ar(this.toRgb())}toHsl(){return Ir(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}setAlpha(e){return new k({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=qt(e),s=qt(s),n=qt(n),Number((.2126*e+.7152*s+.0722*n).toFixed(3))}getBrightness(){const{r:e,g:s,b:n}=this.toRgb();return(e*299+s*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)!=null?e: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,qt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),us=t=>{if(Sr(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 s={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(s.a=t.a),s}const e=t.trim();if(ee[e]){const s=ee[e],n={r:Math.round(s[0]),g:Math.round(s[1]),b:Math.round(s[2])};return n.a=s[3]||1,n}if(e.startsWith("#"))return fr(e);if(e.startsWith("rgb"))return Er(e);if(e.startsWith("hsl"))return gr(e);if(e.startsWith("hsv"))return Rr(e)},fr=t=>{const e=t.substring(1),s=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(s);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},Er=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(s[0],10),g:Number.parseInt(s[1],10),b:Number.parseInt(s[2],10)};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},gr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(s[0],10),s:Number.parseFloat(s[1]),l:Number.parseFloat(s[2])};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},Rr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(s[0],10),s:Number.parseFloat(s[1]),v:Number.parseFloat(s[2])};return s.length>3&&(n.a=Number.parseFloat(s[3])),n},mr=t=>{const e=us(t);if(e!=null)return"r"in e?e:"l"in e?Cr(e):Or(e)},Jt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t),Cr=t=>{let{h:e,s,l:n}=t;e/=360,s/=100,n/=100;let r=0,i=0,o=0;if(s===0)r=i=o=n;else{const l=n<.5?n*(1+s):n+s-n*s,u=2*n-l;r=Jt(u,l,e+1/3),i=Jt(u,l,e),o=Jt(u,l,e-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},Or=t=>{let{h:e,s,v:n}=t;e=e/360*6,s/=100,n/=100;const r=Math.floor(e),i=e-r,o=n*(1-s),a=n*(1-i*s),l=n*(1-(1-i)*s),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},Ir=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,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 e:a=(s-n)/c+(s<n?6:0);break;case s:a=(n-e)/c+2;break;default:a=(e-s)/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},Ar=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n);let o;const a=r,l=r-i,u=r===0?0:l/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/l+(s<n?6:0);break;case s:o=(n-e)/l+2;break;default:o=(e-s)/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},Nr=t=>t==null,Sr=t=>!Nr(t)&&typeof t=="object";function Lr(t){const e=/^#(?:[0]{3}|[0]{6})\b/,s=/^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!!(e.test(t)||s.test(t)||n.test(t)||r.test(t)||i.test(t))}function Tr(t){const e=/^#(?:[Ff]{3}|[Ff]{6})\b/,s=/^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!!(e.test(t)||s.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 br(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 wr(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 vr(t){if(t==null)return!0;const{v:e,f:s,si:n,p:r,s:i,custom:o}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||s!=null&&s.length>0||n!=null&&n.length>0||r!=null||o!=null)}function Ur(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var cs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(cs||{}),hs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(hs||{}),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||{}),ds=(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[t.MENTION=6]="MENTION",t))(ds||{}),_s=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(_s||{}),fs=(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))(fs||{}),Es=(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))(Es||{}),gs=(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))(gs||{}),Rs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Rs||{}),ms=(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))(ms||{}),Cs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Cs||{}),Os=(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))(Os||{}),Is=(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))(Is||{}),As=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(As||{}),Ns=(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))(Ns||{}),Ss=(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))(Ss||{}),Ls=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Ls||{}),Ts=(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))(Ts||{}),bs=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(bs||{}),ws=(t=>(t[t.PAGE=0]="PAGE",t[t.COLUMN=1]="COLUMN",t[t.CHARACTER=2]="CHARACTER",t[t.MARGIN=3]="MARGIN",t[t.INSIDE_MARGIN=4]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.LEFT_MARGIN=6]="LEFT_MARGIN",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(ws||{}),vs=(t=>(t[t.PAGE=0]="PAGE",t[t.PARAGRAPH=1]="PARAGRAPH",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.TOP_MARGIN=4]="TOP_MARGIN",t[t.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=6]="INSIDE_MARGIN",t[t.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",t))(vs||{}),Us=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Us||{}),Ds=(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))(Ds||{}),ps=(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))(ps||{}),Ms=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Ms||{}),Ps=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Ps||{}),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 Dr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}var _e=(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))(_e||{}),xs=(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))(xs||{}),Hs=(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))(Hs||{});const pr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mr=t=>crypto.getRandomValues(new Uint8Array(t)),Pr=(t,e,s)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*e/t.length);return(i=e)=>{let o="";for(;;){let a=s(r),l=r;for(;l--;)if(o+=t[a[l]&n]||"",o.length===i)return o}}},xr=(t,e=21)=>Pr(t,e,Mr),Hr=(t=21)=>{let e="",s=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=pr[s[t]&63];return e};const Fr=/^-ms-/,Wr=/-([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(e){let s="",n=e;for(;n>=j.length;)n/=j.length,n-=1,s+=j[n%j.length];const r=e%j.length;return s+=j[r],s}static indexAt(e){let s=0;for(let n=0;n<e.length-1;n+=1){const r=e.charCodeAt(n)-65,i=e.length-1-n;s+=j.length**i+j.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return R.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=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"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,l=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":s?"Opera":a?"Safari":l?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21,s){return s?xr(s,e)():Hr(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.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=e[a])!=null?u:[];e[a]=h,n(l,h);return}if(R.isObject(l)){const h=(c=e[a])!=null?c:{};e[a]=h,r(l,h);return}e[a]=l})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){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(e.length!==s.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(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=R.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=R.deepClone(r)}),Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,s){return e instanceof s}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const s in e)return!1;return!0}static isMobile(){let e=0,s=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(s=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&s<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return s=>{for(let n=0;n<e;n++)s&&s()}}static hasLength(e,s){return R.isDefine(e)?R.isDefine(s)?e.length===s:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,s){return s.toUpperCase()}static camelCase(e){return e.replace(Fr,"ms-").replace(Wr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:R.removeNull(n)}),e}static fillTwoDimensionalArray(e,s,n){return new Array(e).fill(n).map(r=>new Array(s).fill(n))}static numToWord(e){let s="";for(;e>0;){let n=e%26;n=n===0?n=26:n,s=String.fromCharCode(96+n)+s,e=(e-n)/26}return s.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return Number.NaN;const s=e.toLowerCase().split(""),n=s.length;let r=0,i=0;for(let o=0;o<n;o++)i=s[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let s=0,n=e.length;s<n;s++){const r=Number.parseInt((Math.random()*n).toString()),i=e[r];e[r]=e[s],e[s]=i}return e}static commonExtend(e,s){const n={};for(const r in e)n[r]=e[r];for(const r in s)s[r]!=null&&(n[r]=s[r]);return n}static commonExtend1(e,s){for(const n in e)s[n]==null&&(s[n]=e[n]);return s}static arrayToObject(e){const s={};return e.forEach((n,r)=>{s[r]={},n.forEach((i,o)=>{s[r][o]=i})}),s}static hasIntersectionBetweenTwoRanges(e,s,n,r){return s>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-z_]/.test(e)}static isValidParameter(e){const s=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!s&&n}}function Br(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:l,endX:u}=t,c=e,h=s,_=e,f=s;if(n&&i){const{startRow:E,startColumn:g,endRow:m,endColumn:S,startY:U,endY:M,startX:V,endX:rr}=i;c=E,h=g,_=m,f=S,o=U,a=M,l=V,u=rr}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 kr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:l}=t;let u=e,c=s,h=e,_=s;return(n||r)&&(u=i,c=o,h=a,_=l),{startRow:u,startColumn:c,endRow:h,endColumn:_}}function Gr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function $(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Gt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function $r(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function Vr(t){return R.isString(t)&&t.length>0}function jr(t){return""}function Kr(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.ul.cl)}; `),t.ul.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):s+="text-decoration-line: line-through; ",t.st.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.st.cl)}; `),t.st.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${$(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${$(t.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,_,f,E,g,m,S;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${At((a=t.bd)==null?void 0:a.b.s)} ${(l=$(t.bd.b.cl))!=null?l:""}; `),(u=t.bd)!=null&&u.t&&(s+=`border-top: ${At((c=t.bd)==null?void 0:c.t.s)} ${(h=$(t.bd.t.cl))!=null?h:""}; `),(_=t.bd)!=null&&_.r&&(s+=`border-right: ${At((f=t.bd)==null?void 0:f.r.s)} ${(E=$(t.bd.r.cl))!=null?E:""}; `),(g=t.bd)!=null&&g.l&&(s+=`border-left: ${At((m=t.bd)==null?void 0:m.l.s)} ${(S=$(t.bd.l.cl))!=null?S:""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${$(t.cl)}; `)}],["va",()=>{t.va===it.SUBSCRIPT?s+="vertical-align: sub; ":t.va===it.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,l;t.tr&&(s+=`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?s+="text-align: left; ":t.ht===Z.RIGHT?s+="text-align: right; ":t.ht===Z.CENTER?s+="text-align: center; ":t.ht===Z.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===rt.BOTTOM?s+="vertical-align: bottom; ":t.vt===rt.TOP?s+="vertical-align: top; ":t.vt===rt.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===ft.CLIP?s+="white-space: clip; ":t.tb===ft.WRAP&&(s+="white-space: normal;")}],["pd",()=>{var c,h,_,f,E,g,m,S;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&&(s+=`padding-bottom: ${o}; `),(g=t.pd)!=null&&g.t&&(s+=`padding-top: ${a}; `),(m=t.pd)!=null&&m.l&&(s+=`padding-left: ${l}; `),(S=t.pd)!=null&&S.r&&(s+=`padding-right: ${u}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function At(t){let e="";return t===T.NONE?e="none":t===T.THIN?e="0.5pt solid":t===T.HAIR?e="0.5pt double":t===T.DOTTED?e="0.5pt dotted":t===T.DASHED||t===T.DASH_DOT?e="0.5pt dashed":t===T.DASH_DOT_DOT?e="0.5pt dotted":t===T.DOUBLE?e="0.5pt double":t===T.MEDIUM?e="1pt solid":t===T.MEDIUM_DASHED||t===T.MEDIUM_DASH_DOT?e="1pt dashed":t===T.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===T.SLANT_DASH_DOT?e="0.5pt dashed":t===T.THICK&&(e="1.5pt solid"),e}function Yr(t){let e=0;if(t=t.trim(),t==="none")e=T.NONE;else if(t==="0.5pt solid")e=T.THIN;else if(t==="0.5pt double")e=T.HAIR;else if(t==="0.5pt dotted")e=T.DOTTED;else if(t==="0.5pt dashed")e=T.DASHED;else if(t==="1pt solid")e=T.MEDIUM;else if(t==="1pt dashed")e=T.MEDIUM_DASHED;else if(t==="1pt dotted")e=T.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=T.THICK;else if(!t.includes("none"))e=T.THIN;else return T.NONE;return e}function Tt(t,e){let s=t.body;if(e){const{headers:n,footers:r}=t;n!=null&&n[e]?s=n[e].body:r!=null&&r[e]&&(s=r[e].body)}return s}function yr(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r,rangeType:i}=t;return!(e<0||n<0||s<0||r<0||!(Number.isNaN(e)&&Number.isNaN(s))&&i===x.COLUMN||!(Number.isNaN(n)&&Number.isNaN(r))&&i===x.ROW)}function zr(t,e){return{startRow:t,endRow:t,startColumn:e,endColumn:e}}function fe(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(s=>fe(t[s],e[s])):t===e:!1}function Fs(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:fe(s,n)}function Xr(t,e){return e.some(s=>t.indexOf(s)>-1)}function Ee(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function qr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Jr(t){if(t==null)return!1;const e=t.paragraphStyle;return Ws(e)}function Ws(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Bs(t,e,s){return t.slice(0,e)+s+t.slice(e)}function ks(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}function Zr(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Qr(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+(e<<6)+(e<<16)-e;return e>>>0}function Pe(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],n=0;if(s)return s.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(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xe(t,e){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}}return i}function He(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function ct(t){return typeof t=="function"}function ti(t){var e=function(n){Error.call(n),n.stack=new Error().stack},s=t(e);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var Zt=ti(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
2
2
  `+s.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=s}});function Fe(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var Gs=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,s,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=Pe(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(g){e={error:g}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(ct(c))try{c()}catch(g){i=g instanceof Zt?g.errors:[g]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var _=Pe(h),f=_.next();!f.done;f=_.next()){var E=f.value;try{We(E)}catch(g){i=i!=null?i:[],g instanceof Zt?i=He(He([],xe(i)),xe(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 Zt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)We(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(e)}},t.prototype._hasParent=function(e){var s=this._parentage;return s===e||Array.isArray(s)&&s.includes(e)},t.prototype._addParent=function(e){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(e),s):s?[s,e]:e},t.prototype._removeParent=function(e){var s=this._parentage;s===e?this._parentage=null:Array.isArray(s)&&Fe(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&Fe(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Gs.EMPTY;function ei(t){return t instanceof Gs||t&&"closed"in t&&ct(t.remove)&&ct(t.add)&&ct(t.unsubscribe)}function We(t){ct(t)?t():t.unsubscribe()}class $s{constructor(e=!1){d(this,"skipNextObservers");d(this,"lastReturnValue");d(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function Vs(t){return t instanceof $t}class $t{constructor(e,s){d(this,"_willBeUnregistered",!1);d(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class Vt{constructor(e){d(this,"_observers",new Array);d(this,"_eventState");d(this,"_onObserverAdded");this._eventState=new $s,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new $t(e,this);return r.unregisterOnNextCall=n,s?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let s=0;s<this._observers.length;s++){const n=this._observers[s];if(!n._willBeUnregistered&&n.callback===e)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const s=this._eventState;s.skipNextObservers=!1,s.lastReturnValue=e,s.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i),s.isStopPropagation&&(n=!0),s.skipNextObservers))return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(e){let s=Promise.resolve(e);if(!this._observers.length)return s;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||(s=s.then(()=>i.callback(e,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return s.then(()=>e)}notifyObserver(e,s){if(e._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,e.callback(s,n),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new Vt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function v(t){let e=!1;return t?ei(t)?{dispose:()=>t.unsubscribe()}:Vs(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:v(()=>{})}function si(t){return v(()=>{t.unsubscribe()})}class ge{constructor(){d(this,"_disposables",new Set)}add(e){const s=v(e);return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}}class p{constructor(){d(this,"_disposed",!1);d(this,"_collection",new ge)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class ni extends p{constructor(){super(...arguments);d(this,"dispose$",new N.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class at{static hasLength(e,s){return e.length===s}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}function jt(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function ri(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function ii(t,e){for(let s=t.length-1;s>-1;s--){const n=t[s];if(e(n,s))return n}return null}function oi(t,e){if(t.length===0)return t;const s=e%t.length;return t.slice(s).concat(t.slice(0,s))}function ai(t,e){const s=new Map;return t.forEach(n=>{const r=e(n);let i=s.get(r);s.has(r)||(i=[],s.set(r,i)),i.push(n)}),s}const L=Symbol("newer"),D=Symbol("older");class js{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Ks{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Ys{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var ba,wa;class se{constructor(e,s){d(this,"key");d(this,"value");d(this,ba);d(this,wa);this.key=e,this.value=s,this[L]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}ba=L,wa=D;class zs{constructor(...e){d(this,"_keymap");d(this,"size",0);d(this,"limit");d(this,"oldest");d(this,"newest");d(this,"_onShiftListeners",[]);if(at.hasLength(e,1)){if(at.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(at.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(at.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),v(()=>jt(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,s){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,s&&(this.assign(s),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[L]&&(e===this.oldest&&(this.oldest=e[L]),e[L][D]=e[D]),e[D]&&(e[D][L]=e[L]),e[L]=void 0,e[D]=this.newest,this.newest&&(this.newest[L]=e),this.newest=e)}assign(e){let s,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new se(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[L]=o,o[D]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new se(e,s)),this.newest?(this.newest[L]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[L]?(this.oldest=this.oldest[L],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),e[L]=e[D]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[L]&&s[D]?(s[D][L]=s[L],s[L][D]=s[D]):s[L]?(s[L][D]=void 0,this.oldest=s[L]):s[D]?(s[D][L]=void 0,this.newest=s[D]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new js(this.oldest)}values(){return new Ks(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Ys(this.oldest)}forEach(e,s){typeof s!="object"&&(s=this);let n=this.oldest;for(;n;)e.call(s,n.value,n.key,this),n=n[L]}toJSON(){const e=new Array(this.size);let s=0,n=this.oldest;for(;n;)e[s++]={key:n.key,value:n.value},n=n[L];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[L],s&&(e+=" < ");return e}}function y(t){let e=0;const s=Object.keys(t);for(const n of s){const r=Number(n);e=Math.max(e,r)}return e+1}function ne(t,e,s){const n=y(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function re(t,e,s){const n=Object.keys(s).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+e?delete s[r]:s[r]!==void 0&&(s[r-e]=s[r],delete s[r])}function li(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,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]=s[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function ui(t,e,s){const n=s;if(y(s)>0){const i={};let o=0;for(let a=t;a<=e;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function ie(t,e,s,n){const r=t>s;if(!r&&t+e>s)throw new Error("Invalid move operation");r?ci(t,e,s,n):hi(t,e,s,n)}function ci(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=s;o--){const a=r[o];r[o+e]=a,a===void 0&&delete r[o+e]}i.forEach((o,a)=>{r[s+a]=o,o===void 0&&delete r[s+a]})}function hi(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<s;o++){const a=r[o];r[o-e]=a,a===void 0&&delete r[o-e]}i.forEach((o,a)=>{r[s+a-e]=o,o===void 0&&delete r[s+a-e]})}class G{constructor(e={}){d(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new G({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,o)===!1)return this}return this}forRow(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(!o)continue;const a=Object.keys(o);for(const l of a){const u=Number(l),c=o[Number(l)];if(e(i,u,c)===!1)return this}}return this}swapRow(e,s){const n=this._matrix[e],r=this._matrix[s];this._matrix[e]=r,this._matrix[s]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let s=this.getRow(e);return s==null&&(s={},this._matrix[e]=s),s}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,s=Object.keys(e);if(s.length===0)return!1;for(const n of s){const r=Number(n),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,s){var n,r;return(r=(n=this._matrix)==null?void 0:n[e])==null?void 0:r[s]}setValue(e,s,n){const r=this.getRowOrCreate(e);r[s]=n}deleteValue(e,s){var n,r;(r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s]}realDeleteValue(e,s){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,s){this._matrix[e]=s}moveRows(e,s,n){ie(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{ie(e,s,n,i)})}insertRows(e,s){for(let n=e;n<e+s;n++)ne(n,{},this._matrix)}insertColumns(e,s){for(let n=e;n<e+s;n++)this.forEach((r,i)=>{ne(n,void 0,i)})}removeRows(e,s){re(e,s,this._matrix)}removeColumns(e,s){this.forEach((n,r)=>{re(e,s,r)})}getFragment(e,s,n,r){const i=new G;let o=0;for(let a=e;a<=s;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(e,s,n,r){const i=new G;for(let o=e;o<=s;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 e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((s,n)=>{e[s]==null&&(e[s]=[]),n.forEach(r=>{e[s][r]=this.getValue(s,r)})}),e}toFullArray(){const e=this.getRange(),{endColumn:s,endRow:n}=e,r=[];for(let i=0;i<=n;i++){const o=Array(s+1).fill(void 0);r.push(o)}return this.forValue((i,o,a)=>{r[i][o]=a}),r}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,s=0,n=!1,r=!1;const i=new G;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(l=>{const u=Number(l);r?u<s&&(s=u):(r=!0,s=u);const c=this.getValue(o,u);i.setValue(o-e,u-s,c)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,e=a),l==null)return;const u=y(l)-1;u>n&&(n=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<s&&(s=h):(o=!0,s=h)}),a>r&&(r=a)}),{startRow:e,startColumn:s,endRow:r,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)if(s>=a.startRow&&s<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(s,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e}}var Re=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Re||{});class ys{constructor(){d(this,"status","init")}}const di=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done",z=class z{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,s){return e==null||s==null?!1:e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===x.NORMAL||s.rangeType===void 0&&e.rangeType===x.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,u=s.startColumn,c=s.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(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,u=s.startColumn,c=s.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(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return z.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:x.NORMAL}),e[0])}static subtract(e,s){if(s.startRow>e.endRow||s.endRow<e.startRow||s.startColumn>e.endColumn||s.endColumn<e.startColumn)return[e];const n=[];s.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:s.startRow-1,endColumn:e.endColumn}),s.endRow<=e.endRow&&n.push({startRow:s.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,s.startRow),i=Math.min(e.endRow,s.endRow);return s.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:s.startColumn-1}),s.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:s.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}};d(z,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),d(z,"getPositionRange",(e,s,n)=>({...n||{},startRow:n&&[w.ROW,w.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+s.startRow,endRow:n&&[w.ROW,w.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+s.startRow,startColumn:n&&[w.COLUMN,w.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+s.startColumn,endColumn:n&&[w.COLUMN,w.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+s.startColumn})),d(z,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),d(z,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),d(z,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let X=z;class _i{constructor(e,s){d(this,"_values",[]);d(this,"_keys",[]);d(this,"_keyMaps",new Map);this._values=e,this._keys=s,e.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(e){this._keys.forEach(s=>{const n=e[s],r=this._keyMaps.get(s)||new Map;r.set(n,e),this._keyMaps.set(s,r)})}getValue(e,s){const n=s||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(e))return i.get(e)}return null}hasValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,s,n){const r=this.getValue(e);r&&Object.keys(r).includes(s)&&(r[s]=n)}deleteValue(e){const s=this.getValue(e);if(s){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=s[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===s);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(e){var s;return[...((s=this._keyMaps.get(e))==null?void 0:s.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function oe(t,e,s,n){return{forEach(r){for(let i=t;i<=e;i++)for(let o=s;o<=n;o++)r(i,o)}}}function fi(t){if(t==null||t.length===0)return Number.NaN;const e=t.toLowerCase().split(""),s=e.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<s;o++)i=n(e[o]),r+=i*26**(s-o-1);return r===0?Number.NaN:r-1}const Ft=65,Xs=90,Ei=97;function gi(t){const e=Xs-Ft+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+Ft)+s,t=Math.floor(t/e)-1;return s}function qs(t,e){let s="";for(;e>0;)s+=t,e--;return s}function Ri(t,e=!1){const s=Xs-Ft+1;let n=Ei;e&&(n=Ft);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return qs(r,i)}function mi(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Ci(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function ot(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}function Oi(t,e){let s;return function(...n){const r=this,i=function(){s=null,t.apply(r,n)};clearTimeout(s),s=setTimeout(i,e)}}function bt(t,e,s){const{dataStream:n,textRuns:r=[]}=t;let i=e;const o=[];for(const a of r){const{st:l,ed:u}=a;R.hasIntersectionBetweenTwoRanges(e,s,l,u)&&(l>i?(o.push(n.slice(i,l)),o.push(ae(n,{...a,ed:Math.min(u,s)}))):o.push(ae(n,{...a,st:i,ed:Math.min(u,s)}))),i=Math.max(e,Math.min(u,s))}return i!==s&&o.push(n.slice(i,s)),o.join("")}function Ii(t,e=!0){var s;if(e&&((s=t.paragraphs)!=null&&s.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("; ")};"`:""}>${bt(t,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==n.length&&(i+=bt(t,o,n.length)),i}else return bt(t,0,t.dataStream.length)}function ae(t,e){const{st:s,ed:n,ts:r={}}=e,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:_,cl:f,va:E}=r;let g=t.slice(s,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}},Ai={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ni={startRow:0,startColumn:0,endRow:0,endColumn:0},Si={row:0,column:0},wt={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}},Js={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Zs=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Zs||{});function Nt(t,e){const{textRuns:s=[]}=e;let n=0;for(const i of s){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 e.dataStream.indexOf(`\r
4
- `)===n?C.TRUE:C.FALSE}class et{constructor(e,s,n){d(this,"_range");d(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let a=n;a<=i;a++)for(let l=r;l<=o;l++)s(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;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:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a-e,l-n,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(e+1),o=R.numToWord(r+1)+(s+1)):(i=R.numToWord(r+1)+(s+1),o=R.numToWord(n+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||wt.bg.rgb}))}getCell(e,s){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+e,endRow:n+e,startColumn:i+s,endColumn:i+s};return new et(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=n-s;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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||wt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("ul",e.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 s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("st",e.body)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?e.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...e.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 s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("it",e.body)===C.TRUE?Mt.ITALIC:Mt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("bl",e.body)===C.TRUE?Pt.BOLD:Pt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const a=s.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:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.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(e){et.foreach(this._range,e)}_getStyles(e){const s=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=s&&s.getStyleByCell(r);return i&&i[e]||wt[e]}))}}function Li(t,e){if(t.length===0||t[0].length===0)return null;const s=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++)s[a]=e(t[i][a])?s[a]+1:0;const o=Ti(s);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Ti(t){const e=[];let s=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(e.length===0||t[r]>=t[e[e.length-1]])e.push(r++);else{const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>s&&(s=i*o,n={area:s,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}for(;e.length>0;){const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>s&&(s=i*o,n={area:s,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}return n}function bi(t,e){et.foreach(e,(s,n)=>{t[s][n]=void 0})}function wi(t,e){const s=t.toFullArray(),n=[];for(;;){const r=Li(s,e);if(!r)break;n.push(r),bi(s,r)}return n}function vi(t,e,s,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,e,s):(i===w.NONE?r={...r,startRow:r.startRow+s,startColumn:r.startColumn+e}:i===w.COLUMN?r={...r,startRow:r.startRow+s}:i===w.ROW&&(r={...r,startColumn:r.startColumn+e}),o===w.NONE?r={...r,endRow:r.endRow+s,endColumn:r.endColumn+e}:o===w.COLUMN?r={...r,endRow:r.endRow+s}:o===w.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function Qs(t){for(const[e,s]of t.entries())try{if(!await s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function tn(t){for(const[e,s]of t.entries())try{if(!s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}const gt=A.createIdentifier("univer.context-service");class en extends p{constructor(){super(...arguments);d(this,"_contextChanged$",new N.Subject);d(this,"contextChanged$",this._contextChanged$.asObservable());d(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){var n;return(n=this._contextMap.get(s))!=null?n:!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next({[s]:n})}subscribeContextValue$(s){return new N.Observable(n=>{const r=this._contextChanged$.pipe(N.filter(i=>typeof i[s]<"u")).subscribe(i=>n.next(i[s]));return this._contextMap.has(s)&&n.next(this._contextMap.get(s)),()=>r.unsubscribe()})}}var sn=(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))(sn||{});const J=A.createIdentifier("univer.log");class nn extends p{constructor(){super(...arguments);d(this,"_logLevel",3)}debug(...s){this._logLevel>=4&&this._log(console.debug,...s)}log(...s){this._logLevel>=3&&this._log(console.log,...s)}warn(...s){this._logLevel>=2&&this._log(console.warn,...s)}error(...s){this._logLevel>=1&&this._log(console.error,...s)}setLogLevel(s){this._logLevel=s}_log(s,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?s(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):s(...n)}}var Ui=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,pi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Di(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ui(e,s,r),r},Be=(t,e)=>(s,n)=>e(s,n,t),Rt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Rt||{});const mt=A.createIdentifier("anywhere.command-service");class Mi{constructor(){d(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),v(()=>{var s;this._commands.delete(e.id),(s=e.onDispose)==null||s.call(e)})}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}const rn={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(e,s){d(this,"_commandRegistry");d(this,"_beforeCommandExecutionListeners",[]);d(this,"_commandExecutedListeners",[]);d(this,"_multiCommandDisposables",new Map);d(this,"_commandExecutingLevel",0);d(this,"_commandExecutionStack",[]);this._injector=e,this._logService=s,this._commandRegistry=new Mi,this._registerCommand(rn)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),v(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),v(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(u=>u(o,n));const l=await this._execute(i,s,n);return this._commandExecutedListeners.forEach(u=>u(o,n)),a.dispose(),l}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,a={id:o.id,type:o.type,params:s};if(o.type===2){const c=ii(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,s,n);return this._commandExecutedListeners.forEach(c=>c(a,n)),l.dispose(),u}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),v(()=>jt(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const s=this._commandRegistry.getCommand(e.id);let n;if(s){if(s[0].multi!==!0)throw new Error("Command has registered as a single command.");n=s[0]}else{const i=new ge;n=new Pi(e.id),i.add(this._commandRegistry.registerCommand(n)),i.add(v(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=n.registerImplementation(e);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,s,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(e,s,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,s,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=pi([Be(0,A.Inject(A.Injector)),Be(1,J)],exports.CommandService);class Pi{constructor(e){d(this,"name");d(this,"multi",!0);d(this,"type",0);d(this,"priority",0);d(this,"_implementations",[]);d(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(J),r=e.get(gt),i=e.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,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function me(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return tn(n)}function xi(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return Qs(n)}function on(t){return new N.Observable(e=>{const s=t((...n)=>e.next(n));return()=>s==null?void 0:s.dispose()})}const Hi=t=>new Promise(e=>{N.merge(on(t.onCommandExecuted).pipe(Lt.filter(([s])=>s.type===Rt.MUTATION)),N.timer(300)).pipe(Lt.debounceTime(16),Lt.first()).subscribe(()=>{e()})});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 an(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 Kt extends p{}class Ce{constructor(){d(this,"_data",[])}static create(){return new Ce}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const s=this._data.indexOf(e);this._data.splice(s,1)}getData(){return this._data}}class Oe{constructor(){d(this,"_data",new Map)}static create(){return new Oe}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}class ln{constructor(){d(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}var un=(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[t.CUSTOM_BLOCK=5]="CUSTOM_BLOCK",t))(un||{}),Ie=(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))(Ie||{});function Ae(t){const e=[];for(const s of t){const{st:n,ed:r,ts:i}=s;if(s.sId===void 0&&delete s.sId,n===r||R.isEmptyObject(i)&&s.sId==null)continue;if(e.length===0){e.push(s);continue}const o=e.pop();Fs(s,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,s.st,s.ed)?e.push({...s,st:o.st,ed:r}):e.push(o,s)}return e}function cn(t,e,s,n){var u;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const l=(u=e.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+=s,h.ed+=s,i.push(h);else{a=!0,h.ed+=s;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],S={...h,st:m.ed,ed:f+s};E.push(S)}else E.push(h);i.push(...E)}else h.st+=s,h.ed+=s,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),t.textRuns=Ae(i)}function Ne(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let l=-1;for(let c=0,h=r.length;c<h;c++){const _=r[c],{startIndex:f}=_;f>=n&&(_.startIndex+=s),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===Ie.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 Fi(t,e,s,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+=s)}const i=e.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 hn(t,e,s,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+=s)}const i=e.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 Se(t,e,s,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+=s,l.endIndex+=s):c>=n-1&&(l.endIndex+=s)}const i=e.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 Wi(t,e,s,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+=s,l.endIndex+=s):c>=n-1&&(l.endIndex+=s)}const i=e.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 dn(t,e,s){const{textRuns:n}=t,r=s,i=s+e,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-=e):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-e,c.ed-=e):h>=i&&(c.st-=e,c.ed-=e);a.push(c)}t.textRuns=a}return o}function _n(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,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-s});continue}else h>=i&&(c.startIndex-=e);a.push(c)}t.paragraphs=a}return o}function fn(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-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-s});continue}else h>i&&(c.startIndex-=e);a.push(c)}t.sectionBreaks=a}return o}function En(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-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-s});continue}else h>i&&(c.startIndex-=e);a.push(c)}t.customBlocks=a}return o}function gn(t,e,s){const{tables:n}=t,r=s,i=s+e-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-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const f=Ee(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.tables=a}return o}function Rn(t,e,s){const{customRanges:n}=t,r=s,i=s+e-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-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const f=Ee(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.customRanges=a}return o}function Bi(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=dn(t,e,s),a=_n(t,e,s),l=fn(t,e,s),u=En(t,e,s),c=gn(t,e,s),h=Rn(t,e,s);let _="";return n&&(t.dataStream=ks(n,r,i),_=n.slice(r,i)),{dataStream:_,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h}}function ki(t,e,s,n){t.dataStream=Bs(t.dataStream,n,e.dataStream),cn(t,e,s,n),Ne(t,e,s,n),Fi(t,e,s,n),hn(t,e,s,n),Se(t,e,s,n),Wi(t,e,s,n)}var Wt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Wt||{});const Gi={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 $i(t,e,s,n,r){const i=Vi(t,e,s,n,r),o=ji(t,e,s,n,r),a=Ki(t,e,s,n,r),l=Yi(t,e,s,n,r),u=zi(t,e,s,n,r),c=yi(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c}}function Vi(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=dn(t,s,n);if(r!==P.REPLACE){const l=mn(o,a,r);e.textRuns=l}return cn(t,e,s,n),a}function mn(t,e,s){if(e.length===0)return t;t=R.deepClone(t),e=R.deepClone(e);const n=[],r=t.length,i=e.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:S,ts:U,sId:M}=e[a];let V;s===P.COVER?V={...U,...g}:V={...g,...U},E<m?(u()||n.push(t[o]),o++):S<f?(u()||n.push(e[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,S),ts:V,sId:M}),E<S?(o++,e[a].st=E):(a++,t[o].st=S),l={st:Math.min(E,S),ed:Math.max(E,S),ts:E<S?{...U}:{...g},sId:E<S?M:void 0})}u();const c=n[n.length-1],h=t[r-1],_=e[i-1];return c.ed!==Math.max(h.ed,_.ed)&&(h.ed>_.ed?n.push(h):n.push(_)),Ae(n)}function ji(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=_n(t,s,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:S}=E;let U,M;if(r===P.COVER?(U={...m,...h},M={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},...S,..._}):(U={...h,...m},M={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},..._,...S}),c===g){f.push({startIndex:c,paragraphStyle:U,bullet:M});break}}l.push(...f),f=[]}e.paragraphs=l}return Ne(t,e,s,n),a}function Ki(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=fn(t,s,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=[]}e.sectionBreaks=l}return Ne(t,e,s,n),a}function Yi(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=En(t,s,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=[]}e.customBlocks=l}return hn(t,e,s,n),a}function zi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=gn(t,s,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(..._),_=[]}e.tables=l}return Se(t,e,s,n),a}function yi(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Rn(t,s,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(..._),_=[]}e.customRanges=l}return Se(t,e,s,n),a}var I=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(I||{});function Le(t,e,s){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(e,s)},a=[];for(const u of r){const c=R.deepClone(u),{st:h,ed:_}=c;R.hasIntersectionBetweenTwoRanges(h,_,e,s)&&(e>=h&&e<=_?a.push({...c,st:e,ed:Math.min(s,_)}):s>=h&&s<=_?a.push({...c,st:Math.max(e,h),ed:s}):a.push(c))}a.length&&(o.textRuns=a.map(u=>{const{st:c,ed:h}=u;return{...u,st:c-e,ed:h-e}}));const l=[];for(const u of i){const{startIndex:c}=u;c>=e&&c<=s&&l.push(R.deepClone(u))}return l.length&&(o.paragraphs=l.map(u=>({...u,startIndex:u.startIndex-e}))),o}function le(t,e,s=P.COVER){if(e.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=[]}=e,l=mn(o,r,s);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 Xi(t){const{body:e}=t;if(e==null)return!0;const{textRuns:s=[],paragraphs:n=[]}=e;return s.length===0&&n.length===0}function qi(t=R.generateRandomId(6),e=nt.EN_US,s=""){return{id:t,locale:e,title:s,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 Te={id:"default_doc",documentStyle:{}};class Ji extends Kt{constructor(s){super();d(this,"type",O.UNIVER_DOC);d(this,"snapshot");this.snapshot={...Te,...s}}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 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:n}=this.snapshot;n.renderConfig==null?n.renderConfig=s:n.renderConfig={...n.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:n,l:r,b:i,r:o}=s,{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(s,n){const{documentStyle:r}=this.snapshot;if(!r.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,n=n!=null?n:Number.POSITIVE_INFINITY,r.pageSize={width:s,height:n};return}s!==void 0&&(r.pageSize.width=s),n!==void 0&&(r.pageSize.height=n)}updateDrawing(s,n){const{drawings:r}=this,{width:i,height:o,left:a,top:l}=n,u=r==null?void 0:r[s];if(!u)return;const c=u.objectTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class st extends Ji{constructor(s){var r;super(R.isEmptyObject(s)?qi():s);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(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){var s;return(s=this.snapshot.rev)!=null?s:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(s){if(s.id&&s.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Te,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new ln;return r.reset(),s.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(s,n){const r=this.getBody();if(r!=null)return Le(r,s,n)}_updateApply(s,n,r,i=P.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,l=Tt(a,o);if(l==null)throw new Error("no body has changed");return $i(l,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Tt(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Bi(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Tt(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");ki(a,s,n,r)}}_initializeHeaderFooterModel(){const{headers:s,footers:n}=this.getSnapshot();if(s)for(const r in s){const i=s[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(s){super.updateDocumentId(s),this._unitId=s}}const Cn=A.createIdentifier("univer.config-service");class On{constructor(){d(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,s){this._config.set(e,s)}deleteConfig(e){this._config.delete(e)}}class In extends p{constructor(){super(...arguments);d(this,"_error$",new N.Subject);d(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const Zi="__default_document_sub_component_id20231101__";class An{constructor(){d(this,"_managerInfo",new Map);d(this,"_remove$",new N.Subject);d(this,"remove$",this._remove$.asObservable());d(this,"_andOrUpdate$",new N.Subject);d(this,"andOrUpdate$",this._andOrUpdate$.asObservable());d(this,"_pluginUpdate$",new N.Subject);d(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const s=this._clearByParam(e);this._remove$.next(s)}addOrUpdate(e){const s=this._addByParam(e);this._andOrUpdate$.next(s)}batchAddOrUpdate(e){const s=[];e.forEach(n=>{s.push(...this._addByParam(n))}),this._andOrUpdate$.next(s)}remove(e){const s=this._removeByParam(e);this._remove$.next(s)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:s,subUnitId:n}=e;return(r=this._managerInfo.get(s))==null?void 0:r.get(n)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:s,subUnitId:n,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(s))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(e){const{unitId:s,subUnitId:n,floatingObject:r,floatingObjectId:i,behindText:o}=e;this._managerInfo.has(s)||this._managerInfo.set(s,new Map);const a=this._managerInfo.get(s);return a.has(n)||a.set(n,new Map),a.get(n).set(i,r),[{unitId:s,subUnitId:n,floatingObjectId:i,floatingObject:r,behindText:o}]}_clearByParam(e){const s=this._getFloatingObjects(e),{unitId:n,subUnitId:r}=e,i=[];return s==null||s.forEach((o,a)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:a,floatingObject:o})}),s==null||s.clear(),i}_removeByParam(e){const s=this._getFloatingObjects(e),n=s==null?void 0:s.get(e.floatingObjectId);return n==null?[]:(s==null||s.delete(e.floatingObjectId),[{...e,floatingObject:n}])}}const Nn=A.createIdentifier("univer.floating-object.service");class Sn{constructor(e={}){d(this,"_styles");d(this,"_cacheMap",new zs(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,s){if(this._cacheMap.has(s))return this._cacheMap.get(s);const n=this._getExistingStyleId(e);return n||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,s){const n=R.generateRandomId(6);return this._styles[n]=e,this._cacheMap.set(s,n),n}setValue(e){if(e==null)return;const s=JSON.stringify(e),n=this.search(e,s);return n!=="-1"?n:this.add(e,s)}toJSON(){return this._styles}getStyleByCell(e){let s;e&&R.isObject(e.s)?s=e.s:s=(e==null?void 0:e.s)&&this.get(e.s);const n=e==null?void 0:e.interceptorStyle;return n?{...s,...n}:s}_generateCacheMap(){const{_styles:e,_cacheMap:s}=this;for(const n in e){const r=JSON.stringify(e[n]);s.set(r,n)}}_getExistingStyleId(e){const{_styles:s}=this;for(const n in s)if(R.diffValue(s[n],e))return n;return null}}class Qi{constructor(e,s){d(this,"_columnData",{});this._config=e,this._columnData=s}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:s}=this,n=s[e];return n?n.hd!==C.TRUE:!0}getHiddenCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,rangeType:x.COLUMN}),n}getVisibleCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,rangeType:x.COLUMN}),n}getColumnDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return y(this._columnData)}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=(s[e]||{hd:C.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(e){const s=this._columnData[e];if(s)return s}getColumnOrCreate(e){const{_columnData:s}=this,n=this._config,r=s[e];if(r)return r;const i={w:n.defaultColumnWidth,hd:C.FALSE};return this._columnData[e]=i,i}}class to{constructor(e,s,n){d(this,"_rowData");this._config=e,this._viewModel=s,this._rowData=n}getRowData(){return this._rowData}getRowDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(e,s=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<s;o++){const a=n[o+e]||{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(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:s}=this,n=s[e];if(n)return n;const r=this._config,i={hd:C.FALSE,h:r.defaultRowHeight};return s[e]=i,i}getHiddenRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getVisibleRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getRowRawVisible(e){const s=this.getRow(e);return s?s.hd!==C.TRUE:!0}getSize(){return y(this._rowData)}}const eo="DEFAULT_WORKSHEET_ROW_COUNT",Ln=1e3,so="DEFAULT_WORKSHEET_COLUMN_COUNT",Tn=20,no="DEFAULT_WORKSHEET_ROW_HEIGHT",bn=19,ro="DEFAULT_WORKSHEET_COLUMN_WIDTH",wn=73,io="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",vn=46,oo="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Un=20;function Dn(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:C.FALSE,rowCount:Ln,columnCount:Tn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:wn,defaultRowHeight:bn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:C.TRUE,rowHeader:{width:vn,hidden:C.FALSE},columnHeader:{height:Un,hidden:C.FALSE},selections:["A1"],rightToLeft:C.FALSE};return Object.keys(e).forEach(s=>{const n=s;typeof t[n]>"u"&&(t[n]=e[n])}),t}class pn extends p{constructor(s){super();d(this,"_cellContentInterceptor",null);d(this,"_rowFilteredInterceptor",null);this.getRawCell=s}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(s,n){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(s,n):this.getRawCell(s,n)}getRowFiltered(s){var n,r;return(r=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(s))!=null?r:!1}registerCellContentInterceptor(s){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=s,v(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=s,v(()=>this._rowFilteredInterceptor=null)}}class Et{constructor(e,s,n){d(this,"_sheetId");d(this,"_snapshot");d(this,"_cellData");d(this,"_rowManager");d(this,"_columnManager");d(this,"_viewModel");var a;this.unitId=e,this._styles=n,this._snapshot=Dn(s);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 pn((l,u)=>this.getCellRaw(l,u)),this._rowManager=new to(this._snapshot,this._viewModel,i),this._columnManager=new Qi(this._snapshot,r)}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const e=this.getCellMatrix(),s=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,a=!1,l=!1;return e.forEach((u,c)=>{Object.keys(c).forEach(h=>{const _=+h,f=e.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,_))})}),s.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:e}=this,s=R.deepClone(e);return new Et(this.unitId,s,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(e,s){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(X.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},i))return i}return null}getCell(e,s){return e<0||s<0?null:this._viewModel.getCell(e,s)}getCellRaw(e,s){return this.getCellMatrix().getValue(e,s)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getMatrixWithMergedCells(e,s,n,r,i=!1){const o=this.getCellMatrix(),a=this._snapshot.mergeData.filter(u=>X.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},u)),l=new G;return oe(e,n,s,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;oe(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(e,s,n,r){return typeof e=="object"?new et(this,e,{getStyles:()=>this._styles}):new et(this,{startRow:e,startColumn:s,endColumn:r||s,endRow:n||e},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:s}=e;return s}getMaxRows(){const{_snapshot:e}=this,{rowCount:s}=e;return s}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:s}=e;return s===0}getTabColor(){const{_snapshot:e}=this,{tabColor:s}=e;return s}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}getRowVisible(e){return this._viewModel.getRowFiltered(e)?!1:this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,s){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,s);return r.forEach(i=>i.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,s){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,s);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){const e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:s}=e;return s}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,s=!0){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e,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&&s){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&&s)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(e,s=!0,n=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:a}=e,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&&s){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(!_&&s)u+=1;else{const E={row:u,col:c,value:_};return u+=1,{done:!1,value:E}}}}}}}}}function ao(t){var n,r;if(!t)return"";const e=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(e)return e;const s=t.v;return typeof s=="string"?t.t===Q.BOOLEAN?s.toUpperCase():s:typeof s=="number"?t.t===Q.BOOLEAN?s?"TRUE":"FALSE":s.toString():typeof s=="boolean"?s?"TRUE":"FALSE":""}const lo="0.1.10";function uo(t="",e=nt.ZH_CN,s=""){return{id:t,sheetOrder:[],name:s,appVersion:lo,locale:e,styles:{},sheets:{},resources:[]}}var co=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,_o=(t,e,s,n)=>{for(var r=n>1?void 0:n?ho(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&co(e,s,r),r},fo=(t,e)=>(s,n)=>e(s,n,t);function Eo(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends Kt{constructor(s={},n){super();d(this,"type",O.UNIVER_SHEET);d(this,"_sheetCreated$",new N.Subject);d(this,"sheetCreated$",this._sheetCreated$.asObservable());d(this,"_sheetDisposed$",new N.Subject);d(this,"sheetDisposed$",this._sheetDisposed$.asObservable());d(this,"_activeSheet$",new N.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=uo();R.isEmptyObject(s)?this._snapshot=r:this._snapshot=R.commonExtend(r,s);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 Sn(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(s){return typeof s=="string"||"startRow"in s||"row"in s}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var s;return(s=this._snapshot.rev)!=null?s:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(s,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[s])return!1;i[s]=r,o.splice(n,0,s);const a=new Et(this._unitId,r,this._styles);return this._worksheets.set(s,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(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===s)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const s=this.getRawActiveSheet();if(s)return s;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(s){this._activeSheet$.next(s)}removeSheet(s){var r;return this._worksheets.get(s)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===s&&this.setActiveSheet(null),this._worksheets.delete(s),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(s),1),delete this._snapshot.sheets[s],!0):!1}getActiveSheetIndex(){const{sheetOrder:s}=this._snapshot;return s.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:s}=this._snapshot;return s.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:s}=this._snapshot,n=[];return s.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>s.getSheetId()===r)}getSheetBySheetName(s){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===s);return this._worksheets.get(r)}getSheetBySheetId(s){return this._worksheets.get(s)}getSheetByIndex(s){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[s])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===C.TRUE).map(s=>s.getConfig().id)}transformRangeType(s){if(typeof s=="string")return this._getCellRange(s);if(typeof s!="string"&&"row"in s){const n=s;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof s!="string"&&"startRow"in s?{sheetId:"",range:s}:lt}load(s){this._snapshot=s}checkSheetName(s){return this.getSheetsName().includes(s)}uniqueSheetName(s="Sheet1"){let n=s;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}generateNewSheetName(s){let n=s+this._count;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}_getCellRange(s){var c,h,_,f,E;let n="",r="";if(s.indexOf("!")>-1){const g=s.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=s;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:s,_worksheets:n}=this,{sheets:r,sheetOrder:i}=s;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=_o([fo(1,J)],exports.Workbook);class be extends Kt{constructor(s){var n;super();d(this,"type",O.UNIVER_SLIDE);d(this,"_snapshot");d(this,"_unitId");this._snapshot={...Js,...s},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 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 n=this.getPages();return n==null?void 0:n[s]}getElementsByPage(s){var n;return(n=this.getPage(s))==null?void 0:n.pageElements}getElement(s,n){var r;return(r=this.getElementsByPage(s))==null?void 0:r[n]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:_e.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const ht="FOCUSING_SHEET",vt="FOCUSING_DOC",Ut="FOCUSING_SLIDE",go="FOCUSING_EDITOR_BUT_HIDDEN",Mn="EDITOR_ACTIVATED",Ro="FOCUSING_EDITOR_INPUT_FORMULA",Pn="FOCUSING_FORMULA_EDITOR",mo="FOCUSING_UNIVER_EDITOR",Co="FOCUSING_EDITOR_INPUT_FORMULA",Oo="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var Io=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,No=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ao(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Io(e,s,r),r},ke=(t,e)=>(s,n)=>e(s,n,t);const q=A.createIdentifier("univer.current");exports.UniverInstanceService=class extends p{constructor(s,n){super();d(this,"_unitsByType",new Map);d(this,"_createHandler");d(this,"_ctorByType",new Map);d(this,"_currentUnits$",new N.BehaviorSubject({}));d(this,"currentUnits$",this._currentUnits$.asObservable());d(this,"_unitAdded$",new N.Subject);d(this,"unitAdded$",this._unitAdded$.asObservable());d(this,"_unitDisposed$",new N.Subject);d(this,"unitDisposed$",this._unitDisposed$.asObservable());d(this,"_focused$",new N.BehaviorSubject(null));d(this,"focused$",this._focused$.asObservable());this._injector=s,this._contextService=n}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(s){this._createHandler=s}createUnit(s,n){return this._createHandler(s,n,this._ctorByType.get(s))}registerCtorForType(s,n){return this._ctorByType.set(s,n),{dispose:()=>{this._ctorByType.delete(s)}}}getCurrentTypeOfUnit$(s){return this.currentUnits$.pipe(N.map(n=>{var r;return(r=n[s])!=null?r:null}),N.distinctUntilChanged())}getCurrentUnitForType(s){return this._currentUnits$.getValue()[s]}setCurrentUnitForType(s){const n=this._getUnitById(s);if(!n)throw new Error(`[UniverInstanceService]: no document with unitId ${s}!`);this._currentUnits$.next({...this._currentUnits$.getValue(),[n[1]]:n[0]})}getTypeOfUnitAdded$(s){return this._unitAdded$.pipe(N.filter(n=>n.type===s))}__addUnit(s){const n=s.type;this._unitsByType.has(n)||this._unitsByType.set(n,[]),this._unitsByType.get(n).push(s),this._unitAdded$.next(s),this._currentUnits$.next({...this._currentUnits$.getValue(),[n]:s})}getTypeOfUnitDisposed$(s){return this.unitDisposed$.pipe(N.filter(n=>n.type===s))}getUnit(s,n){var i;const r=(i=this._getUnitById(s))==null?void 0:i[0];return n&&(r==null?void 0:r.type)!==n?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(O.UNIVER_DOC)}getUniverDocInstance(s){return this.getUnit(s,O.UNIVER_DOC)}getUniverSheetInstance(s){return this.getUnit(s,O.UNIVER_SHEET)}getAllUnitsForType(s){var n;return(n=this._unitsByType.get(s))!=null?n:[]}changeDoc(s,n){const r=this.getAllUnitsForType(O.UNIVER_DOC),i=r.find(o=>o.getUnitId()===s);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(n)}get focused(){var n;const s=this._focused$.getValue();return s?(n=this._getUnitById(s))==null?void 0:n[0]:null}focusUnit(s){this._focused$.next(s),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(vt,!1),this._contextService.setContextValue(ht,!0),this._contextService.setContextValue(Ut,!1)):this.focused instanceof st?(this._contextService.setContextValue(vt,!0),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(Ut,!1)):this.focused instanceof be&&(this._contextService.setContextValue(vt,!1),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(Ut,!0))}getFocusedUnit(){return this.focused}getUnitType(s){const n=this._getUnitById(s);if(!n)throw new Error(`[UniverInstanceService]: No document with unitId ${s}`);return n[1]}disposeUnit(s){const n=this._getUnitById(s);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(s){for(const[n,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===s);if(i)return[i,n]}}};exports.UniverInstanceService=No([ke(0,A.Inject(A.Injector)),ke(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 So={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Dt=new Map;function we(t,e){return function(r){ve(t,e)}}function ve(t,e){Dt.has(t)||Dt.set(t,[]),Dt.get(t).push(e)}var Lo=Object.defineProperty,To=Object.getOwnPropertyDescriptor,xn=(t,e,s,n)=>{for(var r=n>1?void 0:n?To(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Lo(e,s,r),r},ue=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends p{constructor(s){super();d(this,"_lifecycle$",new N.BehaviorSubject(b.Starting));d(this,"lifecycle$",this._lifecycle$.asObservable());d(this,"_lock",!1);this._logService=s,this._reportProgress(b.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(s){if(s<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(s!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(s),this._lifecycle$.next(s),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new N.Observable(s=>(this.stage===b.Starting||(this.stage===b.Ready?s.next(b.Starting):this.stage===b.Rendered?(s.next(b.Starting),s.next(b.Ready)):(s.next(b.Starting),s.next(b.Ready),s.next(b.Rendered))),this._lifecycle$.subscribe(s)))}_reportProgress(s){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${So[s]}".`)}};exports.LifecycleService=xn([ue(0,J)],exports.LifecycleService);exports.LifecycleInitializerService=class extends p{constructor(s,n){super();d(this,"_seenTokens",new Set);this._lifecycleService=s,this._injector=n}initModulesOnStage(s){var n;(n=Dt.get(s))==null||n.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}};exports.LifecycleInitializerService=xn([ue(0,A.Inject(exports.LifecycleService)),ue(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 N.Subject);d(this,"t",(s,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=s.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 s});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}load(s){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},s)}setLocale(s){this._currentLocale=s,this.localeChanged$.next()}getLocales(){var s;return(s=this._locales)==null?void 0:s[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(s,n){const r=n.shift();if(r&&s&&r in s){const i=s[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Yt=A.createIdentifier("resource-manager-service");var bo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,vo=(t,e,s,n)=>{for(var r=n>1?void 0:n?wo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&bo(e,s,r),r},Ge=(t,e)=>(s,n)=>e(s,n,t);const Ue=A.createIdentifier("univer.permission-service");exports.PermissionService=class extends p{constructor(s,n){super();d(this,"_permissionPointMap",new Map);d(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});d(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new N.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});d(this,"updatePermissionPoint",(s,n,r)=>{const i=this._permissionPointMap.get(s);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=Re.DONE,o.next(a)}});d(this,"getPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=s,this._univerInstanceService=n}_toJson(s){const n=this._permissionPointMap.get(s);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(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),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 N.combineLatest(i).pipe(Lt.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);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=vo([we(b.Starting,exports.PermissionService),Ge(0,A.Inject(Yt)),Ge(1,A.Inject(q))],exports.PermissionService);const Hn="univer.editable";class pt extends ys{constructor(s){super();d(this,"id",Hn);d(this,"value",!0);d(this,"unitID");this.unitID=s}}var Uo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,po=(t,e,s,n)=>{for(var r=n>1?void 0:n?Do(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Uo(e,s,r),r},$e=(t,e)=>(s,n)=>e(s,n,t);exports.UniverPermissionService=class extends p{constructor(e,s){super(),this._permissionService=e,this._univerInstanceService=s,this._init()}_init(){this._univerInstanceService.getTypeOfUnitAdded$(O.UNIVER_SHEET).subscribe(e=>{const s=new pt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e=(s=>(s=this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET))==null?void 0:s.getUnitId())()){if(!e)return;const n=new pt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new pt(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=po([we(b.Starting,exports.UniverPermissionService),$e(0,A.Inject(Ue)),$e(1,A.Inject(q))],exports.UniverPermissionService);class Fn extends p{constructor(){super(...arguments);d(this,"_resourceMap",new Map);d(this,"_register$",new N.Subject);d(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(s){return this.getAllResourceHooks().map(i=>{const o=i.toJson(s);return{name:i.pluginName,data:o}})}registerPluginResource(s){const n=s.pluginName;if(this._resourceMap.has(n))throw new Error(`the pluginName is registered {${n}}`);return this._resourceMap.set(n,s),this._register$.next(s),v(()=>this._resourceMap.delete(n))}disposePluginResource(s){this._resourceMap.delete(s)}loadResources(s,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(s,a)}catch{console.error("LoadResources Error!")}})}unloadResources(s){this.getAllResourceHooks().forEach(n=>{n.onUnLoad(s)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}var Mo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,xo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Po(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Mo(e,s,r),r},Ve=(t,e)=>(s,n)=>e(s,n,t);let ce=class extends p{constructor(e,s){super();d(this,"saveWorkbook",e=>{const s=e.getUnitId(),n=this._resourceManagerService.getResources(s)||[],r=e.getSnapshot();return r.resources=n,r});this._resourceManagerService=e,this._univerInstanceService=s,this._init()}_init(){const e=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=>{e(n)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>{e(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())})))}};ce=xo([Ve(0,A.Inject(Yt)),Ve(1,A.Inject(q))],ce);const De=A.createIdentifier("resource-loader-service");ve(b.Ready,De);class pe extends p{constructor(){super();d(this,"_currentTheme");d(this,"_currentTheme$",new N.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(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Wn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Bn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Ho=`\r
7
- `;function Fo(t){return`__internalEditorId__${t}`}function Wo(t){return t.startsWith("__")}var Bo=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Go=(t,e,s,n)=>{for(var r=n>1?void 0:n?ko(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Bo(e,s,r),r},Qt=(t,e)=>(s,n)=>e(s,n,t);const zt=A.createIdentifier("univer.undo-redo.service"),$o=20;class kn{dispose(){}async dispatchToHandlers(){return!1}}const Gn="univer.command.redo",$n="univer.command.undo",Vn=new class extends kn{constructor(){super(...arguments);d(this,"type",Rt.COMMAND);d(this,"id",$n)}async handler(e){const s=e.get(zt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(mt);return me(n.undoMutations,r)?(s.popUndoToRedo(),!0):!1}},jn=new class extends kn{constructor(){super(...arguments);d(this,"type",Rt.COMMAND);d(this,"id",Gn)}async handler(e){const s=e.get(zt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(mt);return me(n.redoMutations,r)?(s.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends p{constructor(s,n,r){super();d(this,"undoRedoStatus$");d(this,"_undoRedoStatus$",new N.BehaviorSubject({undos:0,redos:0}));d(this,"_undoStacks",new Map);d(this,"_redoStacks",new Map);d(this,"_batchingStatus",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Vn)),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(s.unitID)){const a=this._batchingStatus.get(s.unitID),l=this._pitchUndoElement(s.unitID);a===0||!l?(o(s),this._batchingStatus.set(s.unitID,1)):this._tryBatchingElements(l,s)}else o(s);function o(a){i.push(a),i.length>$o&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(s){const n=this._getRedoStack(s);n&&(n.length=0);const r=this._getUndoStack(s);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const s=this._getFocusedUnitId();return this._pitchUndoElement(s)}pitchTopRedoElement(){const s=this._getFocusedUnitId();return this._pitchRedoElement(s)}_pitchUndoElement(s){const n=this._getUndoStack(s);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(s){const n=this._getRedoStack(s);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(s){if(this._batchingStatus.has(s))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(s,0),v(()=>this._batchingStatus.delete(s))}_updateStatus(){var i,o;const s=this._getFocusedUnitId(),n=s&&((i=this._undoStacks.get(s))==null?void 0:i.length)||0,r=s&&((o=this._redoStacks.get(s))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(s,n=!1){let r=this._undoStacks.get(s);return!r&&n&&(r=[],this._undoStacks.set(s,r)),r||null}_getRedoStack(s,n=!1){let r=this._redoStacks.get(s);return!r&&n&&(r=[],this._redoStacks.set(s,r)),r||null}_getUndoStackForFocused(){const s=this._getFocusedUnitId();if(!s)throw new Error("No focused univer instance!");return this._getUndoStack(s,!0)}_getRedoStackForFocused(){const s=this._getFocusedUnitId();if(!s)throw new Error("No focused univer instance!");return this._getRedoStack(s,!0)}_tryBatchingElements(s,n){s.redoMutations.push(...n.redoMutations),s.undoMutations.push(...n.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let s="";const n=this._contextService.getContextValue(ht),r=this._contextService.getContextValue(Pn),i=this._contextService.getContextValue(Mn);return n?r?s=Bn:i?s=Wn:s=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":s=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",s}};exports.LocalUndoRedoService=Go([Qt(0,q),Qt(1,mt),Qt(2,gt)],exports.LocalUndoRedoService);class he extends p{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}d(he,"pluginName"),d(he,"type",O.UNIVER_UNKNOWN);class Vo{constructor(){d(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class jo{constructor(){d(this,"_pluginsRegistered",[])}registerPlugin(e,s){this._pluginsRegistered.push({plugin:e,options:s})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var Ko=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,zo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Yo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ko(e,s,r),r},St=(t,e)=>(s,n)=>e(s,n,t);exports.PluginHolder=class extends p{constructor(s,n,r,i){super();d(this,"_started",!1);d(this,"_pluginRegistered",new Set);d(this,"_pluginStore",new Vo);d(this,"_pluginRegistry",new jo);this._logService=s,this._injector=n,this._lifecycleService=r,this._lifecycleInitializerService=i}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(s=>s.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginRegistered.clear()}registerPlugin(s,n){const{pluginName:r}=s;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(s,n)}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const s=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(s,r),r===b.Steady&&n.dispose()}))}_pluginsRunLifecycle(s,n){s.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(s,n){return this._injector.createInstance(s,n)}};exports.PluginHolder=zo([St(0,J),St(1,A.Inject(A.Injector)),St(2,A.Inject(exports.LifecycleService)),St(3,A.Inject(exports.LifecycleInitializerService))],exports.PluginHolder);var yo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,qo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Xo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&yo(e,s,r),r},Jo=(t,e)=>(s,n)=>e(s,n,t);const Zo=4;exports.PluginService=class{constructor(e){d(this,"_pluginHolderForUniver");d(this,"_pluginHoldersForTypes",new Map);d(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(exports.PluginHolder),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const e of this._pluginHoldersForTypes.values())e.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(e,s){this._assertPluginValid(e),this._scheduleInitPlugin();const{type:n}=e;n===O.UNIVER_UNKNOWN?(this._pluginHolderForUniver.registerPlugin(e,s),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(n).registerPlugin(e,s)}startPluginForType(e){this._ensurePluginHolderForType(e).start()}_ensurePluginHolderForType(e){if(!this._pluginHoldersForTypes.has(e)){const s=this._injector.createInstance(exports.PluginHolder);return this._pluginHoldersForTypes.set(e,s),s}return this._pluginHoldersForTypes.get(e)}_assertPluginValid(e){const{type:s,pluginName:n}=e;if(s===O.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${e}. Please assign a "type" to your plugin.`);if(n==="")throw new Error(`[PluginService]: no plugin name for ${e}. 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()},Zo))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[e,s]of this._pluginHoldersForTypes)s.started&&s.flush()}};exports.PluginService=qo([Jo(0,A.Inject(A.Injector))],exports.PluginService);function Kn(t,e){if(!e)return t;const s=[];for(const n of t){const r=e.find(([i])=>i===n[0]);if(r){if(r[1]===null)continue;s.push([n[0],r[1]])}else s.push(n)}return s}class Yn{constructor(){d(this,"_model",new Map);d(this,"_userChange$",new N.Subject);d(this,"userChange$",this._userChange$.asObservable())}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:"add",user:e})}getUser(e,s){const n=this._model.get(e);if(n)return n;s&&s()}delete(e){const s=this.getUser(e);this._model.delete(e),s&&this._userChange$.next({type:"delete",user:s})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}}class Qo{constructor(e={},s){d(this,"_startedTypes",new Set);d(this,"_injector");const n=this._injector=ta(s,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:a}=e;r&&this._injector.get(pe).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(e){this._injector.get(dt).setLocale(e)}createUnit(e,s){return this._univerInstanceService.createUnit(e,s)}createUniverSheet(e){return this._univerInstanceService.createUnit(O.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(O.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(O.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(O.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(O.UNIVER_DOC,st),this._univerInstanceService.registerCtorForType(O.UNIVER_SLIDE,be);const s=e.get(q);s.__setCreateHandler((n,r,i)=>{if(!this._startedTypes.has(n)){this._pluginService.startPluginForType(n),this._startedTypes.add(n);const a=e.createInstance(i,r);return s.__addUnit(a),this._tryProgressToReady(),a}const o=e.createInstance(i,r);return s.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<b.Ready&&(this._injector.get(exports.LifecycleService).stage=b.Ready)}registerPlugin(e,s){this._pluginService.registerPlugin(e,s)}}function ta(t,e){const s=Kn([[In],[dt],[pe],[exports.LifecycleService],[exports.LifecycleInitializerService],[exports.UniverPermissionService],[exports.PluginService],[Yn],[q,{useClass:exports.UniverInstanceService}],[Ue,{useClass:exports.PermissionService}],[J,{useClass:nn,lazy:!0}],[mt,{useClass:exports.CommandService,lazy:!0}],[zt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Cn,{useClass:On}],[gt,{useClass:en}],[Nn,{useClass:An,lazy:!0}],[Yt,{useClass:Fn,lazy:!0}],[De,{useClass:ce,lazy:!0}]],e);return t?t.createChild(s):new A.Injector(s)}const ea=(t,e)=>e.length===t.length&&!t.some(s=>e.some(n=>!X.equals(n,s))),sa=(t,e)=>e.length===t.length&&t.every((s,n)=>{const r=e[n];return r.unitId===s.unitId&&r.sheetId===s.sheetId&&X.equals(s.range,r.range)});function na(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const s=Object.keys(t),n=Object.keys(e);if(s.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(e);for(let i=0;i<s.length;i++){const o=s[i];if(!r(o))return!1;const a=t[o],l=e[o];if(a!==l)return!1}return!0}function zn(t){return/^-?\d+(\.\d+)?$/.test(t)}function ra(t){return zn(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function ia(t){return["true","false"].includes(t.toLowerCase())}function oa(t,e){return e.forEach(s=>t.add(s)),t}function aa(t,e=16){let s=0,n=null;return function(...i){const o=Date.now();o-s<e?(n&&clearTimeout(n),n=setTimeout(()=>{s=o,t.apply(this,i)},e)):(s=o,t.apply(this,i))}}function la(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}var yn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(yn||{});class de{constructor(e){d(this,"_index",0);d(this,"_offset",0);this._actions=e}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(e){e||(e=Number.POSITIVE_INFINITY);const s=this._actions[this._index];if(s){const n=this._offset,r=s.len;return e>=r-n?(e=r-n,this._index+=1,this._offset=0):this._offset+=e,s.t===I.DELETE||s.t===I.RETAIN&&s.body==null?R.deepClone({...s,len:e}):R.deepClone({...s,len:e,body:Le(s.body,n,n+e)})}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 e=this._actions[this._index];return e?e.t:I.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const e=this._offset,s=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=s,[n].concat(r)}}else return[]}}function je(t){return Object.keys(t).length===1}class yt{constructor(){d(this,"_actions",[])}static compose(e,s){const n=new de(e),r=new de(s),i=new yt;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:le(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:le(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(e,s,n=""){const r={t:I.INSERT,body:s,len:e,line:0,segmentId:n};return this.push(r),this}retain(e,s="",n,r){const i={t:I.RETAIN,len:e,segmentId:s};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(e,s=""){const n={t:I.DELETE,len:e,line:0,segmentId:s};return this.push(n),this}serialize(){return this._actions}push(...e){if(e.length>1){for(const i of e)this.push(i);return this}let s=this._actions.length,n=this._actions[s-1];const r=R.deepClone(e[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&&(s-=1,n=this._actions[s-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&&je(n.body)&&r.t===I.INSERT&&je(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return s===this._actions.length?this._actions.push(r):this._actions.splice(s,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===I.RETAIN&&Xi(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}}function ua(t,e,s){if(e==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new st(n),i=e.length;let o;for(;(o=r.getBody().dataStream.indexOf(e))>=0;){const l=new yt;if(o>0&&l.retain(o),s.length>0){const c=r.sliceBody(o,o+i),h={dataStream:s};Array.isArray(c==null?void 0:c.textRuns)&&c.textRuns.length&&(h.textRuns=[{...c.textRuns[0],st:0,ed:s.length}]),l.insert(s.length,h)}l.delete(i);const u=l.serialize();r.apply(u)}const a=r.getBody();return r.dispose(),a}class ca extends Vt{add(e){if(!e)return null;const s=new $t(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const ha=A.createIdentifier("ILocalStorageService");function da(t){return`sheet_interceptor_${t}`}const Xn=t=>function(e,s){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,s,r.bind(null,i+1))}return r(0,e)};class _a{constructor(e){d(this,"_interceptorsByName",new Map);d(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return Xn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>jt(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}const fa=A.createIdentifier("univer.snapshot-server-service");class Ea{constructor(){d(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,s){return Promise.resolve({snapshot:{unitID:"",type:O.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:B.OK,message:""}})}getSheetBlock(e,s){const n=this._sheetBlockCache.get(s.blockID);return Promise.resolve({block:n,error:{code:B.OK,message:""}})}fetchMissingChangesets(e,s){return Promise.resolve({changesets:[],error:{code:B.OK,message:""}})}getResourcesRequest(e,s){return Promise.resolve({resources:{},error:{code:B.OK,message:""}})}saveSnapshot(e,s){return Promise.resolve({error:{code:B.OK,message:""}})}saveSheetBlock(e,s){const{block:n}=s;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(e,s){return Promise.resolve({error:{code:B.OK,message:""},concurrent:[]})}}function ga(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,s)=>String.fromCharCode(Number.parseInt(s,16))))}function Me(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ct=new TextEncoder,Xt=new TextDecoder;function qn(t){const e=R.deepClone(t);return delete e.id,delete e.name,delete e.rowCount,delete e.columnCount,delete e.cellData,Ct.encode(JSON.stringify(e))}function Jn(t){const e=R.deepClone(t);return delete e.id,delete e.rev,delete e.name,delete e.sheetOrder,delete e.sheets,Ct.encode(JSON.stringify(e))}function Ra(t){const e=R.deepClone(t);return delete e.id,delete e.rev,delete e.title,delete e.resources,Ct.encode(JSON.stringify(e))}function Ke(t){return JSON.parse(Xt.decode(t))}function ma(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}function Ca(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}const te=256;function Zn(t,e){const s=new G(t),n=s.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+te,n-1),a=s.getSlice(i,Math.min(i+te,n-1),0,e),l=Oa(a);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:l}),i+=te}return r}function Oa(t){const e=t.getData();return Ct.encode(JSON.stringify(e))}async function Ia(t,e,s,n,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([h,_])=>{const f={id:_.id,type:Bt.GRID,name:_.name,rowCount:_.rowCount,columnCount:_.columnCount,originalMeta:qn(_)};if(o[h]=f,_.cellData){const E=Zn(_.cellData,_.rowCount),g=await Promise.all(E.map(m=>r.saveSheetBlock(t,{unitID:s,type:O.UNIVER_SHEET,block:m})));if(g.some(m=>{var S;return((S=m.error)==null?void 0:S.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=Jn(e),u={unitID:e.id,rev:n,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:l};return{snapshotRes:{unitID:s,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0}}}async function Aa(t,e,s,n,r){var _,f;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([E,g])=>{const m={id:g.id,type:Bt.GRID,name:g.name,rowCount:g.rowCount,columnCount:g.columnCount,originalMeta:qn(g)};if(o[E]=m,g.cellData){const S=Zn(g.cellData,g.rowCount),U=await Promise.all(S.map(M=>r.saveSheetBlock(t,{unitID:s,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=Jn(e),u={unitID:e.id,rev:n,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:l},c={unitID:s,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0},h=await r.saveSnapshot(t,{unitID:s,type:O.UNIVER_SHEET,snapshot:c});if(an(h.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
3
+ `):"",this.name="UnsubscriptionError",this.errors=s}});function Fe(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var Gs=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,s,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=Pe(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(g){e={error:g}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(ct(c))try{c()}catch(g){i=g instanceof Zt?g.errors:[g]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var _=Pe(h),f=_.next();!f.done;f=_.next()){var E=f.value;try{We(E)}catch(g){i=i!=null?i:[],g instanceof Zt?i=He(He([],xe(i)),xe(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 Zt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)We(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(e)}},t.prototype._hasParent=function(e){var s=this._parentage;return s===e||Array.isArray(s)&&s.includes(e)},t.prototype._addParent=function(e){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(e),s):s?[s,e]:e},t.prototype._removeParent=function(e){var s=this._parentage;s===e?this._parentage=null:Array.isArray(s)&&Fe(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&Fe(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Gs.EMPTY;function ei(t){return t instanceof Gs||t&&"closed"in t&&ct(t.remove)&&ct(t.add)&&ct(t.unsubscribe)}function We(t){ct(t)?t():t.unsubscribe()}class $s{constructor(e=!1){d(this,"skipNextObservers");d(this,"lastReturnValue");d(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function Vs(t){return t instanceof $t}class $t{constructor(e,s){d(this,"_willBeUnregistered",!1);d(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class Vt{constructor(e){d(this,"_observers",new Array);d(this,"_eventState");d(this,"_onObserverAdded");this._eventState=new $s,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new $t(e,this);return r.unregisterOnNextCall=n,s?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let s=0;s<this._observers.length;s++){const n=this._observers[s];if(!n._willBeUnregistered&&n.callback===e)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const s=this._eventState;s.skipNextObservers=!1,s.lastReturnValue=e,s.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i),s.isStopPropagation&&(n=!0),s.skipNextObservers))return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(e){let s=Promise.resolve(e);if(!this._observers.length)return s;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||(s=s.then(()=>i.callback(e,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return s.then(()=>e)}notifyObserver(e,s){if(e._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,e.callback(s,n),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new Vt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function v(t){let e=!1;return t?ei(t)?{dispose:()=>t.unsubscribe()}:Vs(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{e||(e=!0,t())}}:t:v(()=>{})}function si(t){return v(()=>{t.unsubscribe()})}class ge{constructor(){d(this,"_disposables",new Set)}add(e){const s=v(e);return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}}class p{constructor(){d(this,"_disposed",!1);d(this,"_collection",new ge)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class ni extends p{constructor(){super(...arguments);d(this,"dispose$",new A.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class at{static hasLength(e,s){return e.length===s}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}function jt(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function ri(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function ii(t,e){for(let s=t.length-1;s>-1;s--){const n=t[s];if(e(n,s))return n}return null}function oi(t,e){if(t.length===0)return t;const s=e%t.length;return t.slice(s).concat(t.slice(0,s))}function ai(t,e){const s=new Map;return t.forEach(n=>{const r=e(n);let i=s.get(r);s.has(r)||(i=[],s.set(r,i)),i.push(n)}),s}const L=Symbol("newer"),D=Symbol("older");class js{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Ks{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Ys{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[L],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var ba,wa;class se{constructor(e,s){d(this,"key");d(this,"value");d(this,ba);d(this,wa);this.key=e,this.value=s,this[L]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}ba=L,wa=D;class ys{constructor(...e){d(this,"_keymap");d(this,"size",0);d(this,"limit");d(this,"oldest");d(this,"newest");d(this,"_onShiftListeners",[]);if(at.hasLength(e,1)){if(at.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(at.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(at.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),v(()=>jt(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,s){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,s&&(this.assign(s),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[L]&&(e===this.oldest&&(this.oldest=e[L]),e[L][D]=e[D]),e[D]&&(e[D][L]=e[L]),e[L]=void 0,e[D]=this.newest,this.newest&&(this.newest[L]=e),this.newest=e)}assign(e){let s,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new se(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[L]=o,o[D]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new se(e,s)),this.newest?(this.newest[L]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[L]?(this.oldest=this.oldest[L],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),e[L]=e[D]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[L]&&s[D]?(s[D][L]=s[L],s[L][D]=s[D]):s[L]?(s[L][D]=void 0,this.oldest=s[L]):s[D]?(s[D][L]=void 0,this.newest=s[D]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new js(this.oldest)}values(){return new Ks(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Ys(this.oldest)}forEach(e,s){typeof s!="object"&&(s=this);let n=this.oldest;for(;n;)e.call(s,n.value,n.key,this),n=n[L]}toJSON(){const e=new Array(this.size);let s=0,n=this.oldest;for(;n;)e[s++]={key:n.key,value:n.value},n=n[L];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[L],s&&(e+=" < ");return e}}function z(t){let e=0;const s=Object.keys(t);for(const n of s){const r=Number(n);e=Math.max(e,r)}return e+1}function ne(t,e,s){const n=z(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function re(t,e,s){const n=Object.keys(s).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+e?delete s[r]:s[r]!==void 0&&(s[r-e]=s[r],delete s[r])}function li(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,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]=s[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function ui(t,e,s){const n=s;if(z(s)>0){const i={};let o=0;for(let a=t;a<=e;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function ie(t,e,s,n){const r=t>s;if(!r&&t+e>s)throw new Error("Invalid move operation");r?ci(t,e,s,n):hi(t,e,s,n)}function ci(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=s;o--){const a=r[o];r[o+e]=a,a===void 0&&delete r[o+e]}i.forEach((o,a)=>{r[s+a]=o,o===void 0&&delete r[s+a]})}function hi(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<s;o++){const a=r[o];r[o-e]=a,a===void 0&&delete r[o-e]}i.forEach((o,a)=>{r[s+a-e]=o,o===void 0&&delete r[s+a-e]})}class G{constructor(e={}){d(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new G({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,o)===!1)return this}return this}forRow(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(!o)continue;const a=Object.keys(o);for(const l of a){const u=Number(l),c=o[Number(l)];if(e(i,u,c)===!1)return this}}return this}swapRow(e,s){const n=this._matrix[e],r=this._matrix[s];this._matrix[e]=r,this._matrix[s]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let s=this.getRow(e);return s==null&&(s={},this._matrix[e]=s),s}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,s=Object.keys(e);if(s.length===0)return!1;for(const n of s){const r=Number(n),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,s){var n,r;return(r=(n=this._matrix)==null?void 0:n[e])==null?void 0:r[s]}setValue(e,s,n){const r=this.getRowOrCreate(e);r[s]=n}deleteValue(e,s){var n,r;(r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s]}realDeleteValue(e,s){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,s){this._matrix[e]=s}moveRows(e,s,n){ie(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{ie(e,s,n,i)})}insertRows(e,s){for(let n=e;n<e+s;n++)ne(n,{},this._matrix)}insertColumns(e,s){for(let n=e;n<e+s;n++)this.forEach((r,i)=>{ne(n,void 0,i)})}removeRows(e,s){re(e,s,this._matrix)}removeColumns(e,s){this.forEach((n,r)=>{re(e,s,r)})}getFragment(e,s,n,r){const i=new G;let o=0;for(let a=e;a<=s;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(e,s,n,r){const i=new G;for(let o=e;o<=s;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 z(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=z(a)-1;r=l>r?l:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((s,n)=>{e[s]==null&&(e[s]=[]),n.forEach(r=>{e[s][r]=this.getValue(s,r)})}),e}toFullArray(){const e=this.getRange(),{endColumn:s,endRow:n}=e,r=[];for(let i=0;i<=n;i++){const o=Array(s+1).fill(void 0);r.push(o)}return this.forValue((i,o,a)=>{r[i][o]=a}),r}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,s=0,n=!1,r=!1;const i=new G;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(l=>{const u=Number(l);r?u<s&&(s=u):(r=!0,s=u);const c=this.getValue(o,u);i.setValue(o-e,u-s,c)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,e=a),l==null)return;const u=z(l)-1;u>n&&(n=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<s&&(s=h):(o=!0,s=h)}),a>r&&(r=a)}),{startRow:e,startColumn:s,endRow:r,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)if(s>=a.startRow&&s<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(s,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e}}var Re=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Re||{});class zs{constructor(){d(this,"status","init")}}const di=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done",y=class y{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,s){return e==null||s==null?!1:e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===x.NORMAL||s.rangeType===void 0&&e.rangeType===x.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,u=s.startColumn,c=s.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(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,u=s.startColumn,c=s.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(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return y.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:x.NORMAL}),e[0])}static subtract(e,s){if(s.startRow>e.endRow||s.endRow<e.startRow||s.startColumn>e.endColumn||s.endColumn<e.startColumn)return[e];const n=[];s.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:s.startRow-1,endColumn:e.endColumn}),s.endRow<=e.endRow&&n.push({startRow:s.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,s.startRow),i=Math.min(e.endRow,s.endRow);return s.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:s.startColumn-1}),s.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:s.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}};d(y,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),d(y,"getPositionRange",(e,s,n)=>({...n||{},startRow:n&&[w.ROW,w.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+s.startRow,endRow:n&&[w.ROW,w.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+s.startRow,startColumn:n&&[w.COLUMN,w.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+s.startColumn,endColumn:n&&[w.COLUMN,w.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+s.startColumn})),d(y,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),d(y,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),d(y,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let X=y;class _i{constructor(e,s){d(this,"_values",[]);d(this,"_keys",[]);d(this,"_keyMaps",new Map);this._values=e,this._keys=s,e.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(e){this._keys.forEach(s=>{const n=e[s],r=this._keyMaps.get(s)||new Map;r.set(n,e),this._keyMaps.set(s,r)})}getValue(e,s){const n=s||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(e))return i.get(e)}return null}hasValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,s,n){const r=this.getValue(e);r&&Object.keys(r).includes(s)&&(r[s]=n)}deleteValue(e){const s=this.getValue(e);if(s){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=s[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===s);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(e){var s;return[...((s=this._keyMaps.get(e))==null?void 0:s.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function oe(t,e,s,n){return{forEach(r){for(let i=t;i<=e;i++)for(let o=s;o<=n;o++)r(i,o)}}}function fi(t){if(t==null||t.length===0)return Number.NaN;const e=t.toLowerCase().split(""),s=e.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<s;o++)i=n(e[o]),r+=i*26**(s-o-1);return r===0?Number.NaN:r-1}const Ft=65,Xs=90,Ei=97;function gi(t){const e=Xs-Ft+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+Ft)+s,t=Math.floor(t/e)-1;return s}function qs(t,e){let s="";for(;e>0;)s+=t,e--;return s}function Ri(t,e=!1){const s=Xs-Ft+1;let n=Ei;e&&(n=Ft);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return qs(r,i)}function mi(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Ci(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function ot(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}function Oi(t,e){let s;return function(...n){const r=this,i=function(){s=null,t.apply(r,n)};clearTimeout(s),s=setTimeout(i,e)}}function bt(t,e,s){const{dataStream:n,textRuns:r=[]}=t;let i=e;const o=[];for(const a of r){const{st:l,ed:u}=a;R.hasIntersectionBetweenTwoRanges(e,s,l,u)&&(l>i?(o.push(n.slice(i,l)),o.push(ae(n,{...a,ed:Math.min(u,s)}))):o.push(ae(n,{...a,st:i,ed:Math.min(u,s)}))),i=Math.max(e,Math.min(u,s))}return i!==s&&o.push(n.slice(i,s)),o.join("")}function Ii(t,e=!0){var s;if(e&&((s=t.paragraphs)!=null&&s.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("; ")};"`:""}>${bt(t,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==n.length&&(i+=bt(t,o,n.length)),i}else return bt(t,0,t.dataStream.length)}function ae(t,e){const{st:s,ed:n,ts:r={}}=e,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:_,cl:f,va:E}=r;let g=t.slice(s,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}},Ai={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ni={startRow:0,startColumn:0,endRow:0,endColumn:0},Si={row:0,column:0},wt={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}},Js={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Zs=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Zs||{});function Nt(t,e){const{textRuns:s=[]}=e;let n=0;for(const i of s){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 e.dataStream.indexOf(`\r
4
+ `)===n?C.TRUE:C.FALSE}class et{constructor(e,s,n){d(this,"_range");d(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let a=n;a<=i;a++)for(let l=r;l<=o;l++)s(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;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:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new G;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a-e,l-n,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(e+1),o=R.numToWord(r+1)+(s+1)):(i=R.numToWord(r+1)+(s+1),o=R.numToWord(n+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||wt.bg.rgb}))}getCell(e,s){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+e,endRow:n+e,startColumn:i+s,endColumn:i+s};return new et(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=n-s;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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||wt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("ul",e.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 s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("st",e.body)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?e.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...e.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 s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("it",e.body)===C.TRUE?Mt.ITALIC:Mt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)&&e.body.textRuns.length>0?Nt("bl",e.body)===C.TRUE?Pt.BOLD:Pt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const a=s.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:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.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(e){et.foreach(this._range,e)}_getStyles(e){const s=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=s&&s.getStyleByCell(r);return i&&i[e]||wt[e]}))}}function Li(t,e){if(t.length===0||t[0].length===0)return null;const s=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++)s[a]=e(t[i][a])?s[a]+1:0;const o=Ti(s);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Ti(t){const e=[];let s=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(e.length===0||t[r]>=t[e[e.length-1]])e.push(r++);else{const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>s&&(s=i*o,n={area:s,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}for(;e.length>0;){const i=t[e.pop()],o=e.length===0?r:r-e[e.length-1]-1;i*o>s&&(s=i*o,n={area:s,height:i,start:e.length===0?0:e[e.length-1]+1,end:r-1})}return n}function bi(t,e){et.foreach(e,(s,n)=>{t[s][n]=void 0})}function wi(t,e){const s=t.toFullArray(),n=[];for(;;){const r=Li(s,e);if(!r)break;n.push(r),bi(s,r)}return n}function vi(t,e,s,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,e,s):(i===w.NONE?r={...r,startRow:r.startRow+s,startColumn:r.startColumn+e}:i===w.COLUMN?r={...r,startRow:r.startRow+s}:i===w.ROW&&(r={...r,startColumn:r.startColumn+e}),o===w.NONE?r={...r,endRow:r.endRow+s,endColumn:r.endColumn+e}:o===w.COLUMN?r={...r,endRow:r.endRow+s}:o===w.ROW&&(r={...r,endColumn:r.endColumn+e}),r)}async function Qs(t){for(const[e,s]of t.entries())try{if(!await s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function tn(t){for(const[e,s]of t.entries())try{if(!s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}const gt=N.createIdentifier("univer.context-service");class en extends p{constructor(){super(...arguments);d(this,"_contextChanged$",new A.Subject);d(this,"contextChanged$",this._contextChanged$.asObservable());d(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){var n;return(n=this._contextMap.get(s))!=null?n:!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next({[s]:n})}subscribeContextValue$(s){return new A.Observable(n=>{const r=this._contextChanged$.pipe(A.filter(i=>typeof i[s]<"u")).subscribe(i=>n.next(i[s]));return this._contextMap.has(s)&&n.next(this._contextMap.get(s)),()=>r.unsubscribe()})}}var sn=(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))(sn||{});const J=N.createIdentifier("univer.log");class nn extends p{constructor(){super(...arguments);d(this,"_logLevel",3)}debug(...s){this._logLevel>=4&&this._log(console.debug,...s)}log(...s){this._logLevel>=3&&this._log(console.log,...s)}warn(...s){this._logLevel>=2&&this._log(console.warn,...s)}error(...s){this._logLevel>=1&&this._log(console.error,...s)}setLogLevel(s){this._logLevel=s}_log(s,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?s(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):s(...n)}}var Ui=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,pi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Di(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ui(e,s,r),r},Be=(t,e)=>(s,n)=>e(s,n,t),Rt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Rt||{});const mt=N.createIdentifier("anywhere.command-service");class Mi{constructor(){d(this,"_commands",new Map);d(this,"_commandTypes",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),v(()=>{var s;this._commands.delete(e.id),this._commandTypes.delete(e.id),(s=e.onDispose)==null||s.call(e)})}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}}const rn={id:"nil",type:0,handler:()=>!0};exports.CommandService=class{constructor(e,s){d(this,"_commandRegistry");d(this,"_beforeCommandExecutionListeners",[]);d(this,"_commandExecutedListeners",[]);d(this,"_multiCommandDisposables",new Map);d(this,"_commandExecutingLevel",0);d(this,"_commandExecutionStack",[]);this._injector=e,this._logService=s,this._commandRegistry=new Mi,this._registerCommand(rn)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),v(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),v(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(u=>u(o,n));const l=await this._execute(i,s,n);return this._commandExecutedListeners.forEach(u=>u(o,n)),a.dispose(),l}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,a={id:o.id,type:o.type,params:s};if(o.type===2){const c=ii(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,s,n);return this._commandExecutedListeners.forEach(c=>c(a,n)),l.dispose(),u}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),v(()=>jt(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const s=this._commandRegistry.getCommand(e.id);let n;if(s){if(s[0].multi!==!0)throw new Error("Command has registered as a single command.");n=s[0]}else{const i=new ge;n=new Pi(e.id),i.add(this._commandRegistry.registerCommand(n)),i.add(v(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=n.registerImplementation(e);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,s,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(e,s,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,s,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=pi([Be(0,N.Inject(N.Injector)),Be(1,J)],exports.CommandService);class Pi{constructor(e){d(this,"name");d(this,"multi",!0);d(this,"type",0);d(this,"priority",0);d(this,"_implementations",[]);d(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(J),r=e.get(gt),i=e.get(N.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,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function me(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return tn(n)}function xi(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return Qs(n)}function on(t){return new A.Observable(e=>{const s=t((...n)=>e.next(n));return()=>s==null?void 0:s.dispose()})}const Hi=t=>new Promise(e=>{A.merge(on(t.onCommandExecuted).pipe(Lt.filter(([s])=>s.type===Rt.MUTATION)),A.timer(300)).pipe(Lt.debounceTime(16),Lt.first()).subscribe(()=>{e()})});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.APPLY_PERMISSION_DENIED=7004]="APPLY_PERMISSION_DENIED",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 an(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 Kt extends p{}class Ce{constructor(){d(this,"_data",[])}static create(){return new Ce}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const s=this._data.indexOf(e);this._data.splice(s,1)}getData(){return this._data}}class Oe{constructor(){d(this,"_data",new Map)}static create(){return new Oe}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}class ln{constructor(){d(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}var un=(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[t.CUSTOM_BLOCK=5]="CUSTOM_BLOCK",t))(un||{}),Ie=(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))(Ie||{});function Ae(t){const e=[];for(const s of t){const{st:n,ed:r,ts:i}=s;if(s.sId===void 0&&delete s.sId,n===r||R.isEmptyObject(i)&&s.sId==null)continue;if(e.length===0){e.push(s);continue}const o=e.pop();Fs(s,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,s.st,s.ed)?e.push({...s,st:o.st,ed:r}):e.push(o,s)}return e}function cn(t,e,s,n){var u;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const l=(u=e.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+=s,h.ed+=s,i.push(h);else{a=!0,h.ed+=s;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],S={...h,st:m.ed,ed:f+s};E.push(S)}else E.push(h);i.push(...E)}else h.st+=s,h.ed+=s,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),t.textRuns=Ae(i)}function Ne(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let l=-1;for(let c=0,h=r.length;c<h;c++){const _=r[c],{startIndex:f}=_;f>=n&&(_.startIndex+=s),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===Ie.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 Fi(t,e,s,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+=s)}const i=e.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 hn(t,e,s,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+=s)}const i=e.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 Se(t,e,s,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+=s,l.endIndex+=s):c>=n-1&&(l.endIndex+=s)}const i=e.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 Wi(t,e,s,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+=s,l.endIndex+=s):c>=n-1&&(l.endIndex+=s)}const i=e.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 dn(t,e,s){const{textRuns:n}=t,r=s,i=s+e,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-=e):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-e,c.ed-=e):h>=i&&(c.st-=e,c.ed-=e);a.push(c)}t.textRuns=a}return o.length===0&&o.push({st:0,ed:e,ts:{}}),o}function _n(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,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-s});continue}else h>=i&&(c.startIndex-=e);a.push(c)}t.paragraphs=a}return o}function fn(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-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-s});continue}else h>i&&(c.startIndex-=e);a.push(c)}t.sectionBreaks=a}return o}function En(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-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-s});continue}else h>i&&(c.startIndex-=e);a.push(c)}t.customBlocks=a}return o}function gn(t,e,s){const{tables:n}=t,r=s,i=s+e-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-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const f=Ee(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.tables=a}return o}function Rn(t,e,s){const{customRanges:n}=t,r=s,i=s+e-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-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const f=Ee(h,_,r,i);c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.customRanges=a}return o}function Bi(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=dn(t,e,s),a=_n(t,e,s),l=fn(t,e,s),u=En(t,e,s),c=gn(t,e,s),h=Rn(t,e,s);let _="";return n&&(t.dataStream=ks(n,r,i),_=n.slice(r,i)),{dataStream:_,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h}}function ki(t,e,s,n){t.dataStream=Bs(t.dataStream,n,e.dataStream),cn(t,e,s,n),Ne(t,e,s,n),Fi(t,e,s,n),hn(t,e,s,n),Se(t,e,s,n),Wi(t,e,s,n)}var Wt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Wt||{});const Gi={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 $i(t,e,s,n,r){const i=Vi(t,e,s,n,r),o=ji(t,e,s,n,r),a=Ki(t,e,s,n,r),l=Yi(t,e,s,n,r),u=yi(t,e,s,n,r),c=zi(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c}}function Vi(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=dn(t,s,n);if(r!==P.REPLACE){const l=mn(o,a,r);e.textRuns=l}return cn(t,e,s,n),a}function mn(t,e,s){if(e.length===0)return t;t=R.deepClone(t),e=R.deepClone(e);const n=[],r=t.length,i=e.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:S,ts:U,sId:M}=e[a];let V;s===P.COVER?V={...U,...g}:V={...g,...U},E<m?(u()||n.push(t[o]),o++):S<f?(u()||n.push(e[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,S),ts:V,sId:M}),E<S?(o++,e[a].st=E):(a++,t[o].st=S),l={st:Math.min(E,S),ed:Math.max(E,S),ts:E<S?{...U}:{...g},sId:E<S?M:void 0})}u();const c=n[n.length-1],h=t[r-1],_=e[i-1];return c.ed!==Math.max(h.ed,_.ed)&&(h.ed>_.ed?n.push(h):n.push(_)),Ae(n)}function ji(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=_n(t,s,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:S}=E;let U,M;if(r===P.COVER?(U={...m,...h},M={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},...S,..._}):(U={...h,...m},M={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},..._,...S}),c===g){f.push({startIndex:c,paragraphStyle:U,bullet:M});break}}l.push(...f),f=[]}e.paragraphs=l}return Ne(t,e,s,n),a}function Ki(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=fn(t,s,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=[]}e.sectionBreaks=l}return Ne(t,e,s,n),a}function Yi(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=En(t,s,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=[]}e.customBlocks=l}return hn(t,e,s,n),a}function yi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=gn(t,s,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(..._),_=[]}e.tables=l}return Se(t,e,s,n),a}function zi(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Rn(t,s,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(..._),_=[]}e.customRanges=l}return Se(t,e,s,n),a}var I=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(I||{});function Le(t,e,s){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(e,s)},a=[];for(const u of r){const c=R.deepClone(u),{st:h,ed:_}=c;R.hasIntersectionBetweenTwoRanges(h,_,e,s)&&(e>=h&&e<=_?a.push({...c,st:e,ed:Math.min(s,_)}):s>=h&&s<=_?a.push({...c,st:Math.max(e,h),ed:s}):a.push(c))}a.length&&(o.textRuns=a.map(u=>{const{st:c,ed:h}=u;return{...u,st:c-e,ed:h-e}}));const l=[];for(const u of i){const{startIndex:c}=u;c>=e&&c<=s&&l.push(R.deepClone(u))}return l.length&&(o.paragraphs=l.map(u=>({...u,startIndex:u.startIndex-e}))),o}function le(t,e,s=P.COVER){if(e.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=[]}=e,l=mn(o,r,s);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 Xi(t){const{body:e}=t;if(e==null)return!0;const{textRuns:s=[],paragraphs:n=[]}=e;return s.length===0&&n.length===0}function qi(t=R.generateRandomId(6),e=nt.EN_US,s=""){return{id:t,locale:e,title:s,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 Te={id:"default_doc",documentStyle:{}};class Ji extends Kt{constructor(s){super();d(this,"type",O.UNIVER_DOC);d(this,"snapshot");this.snapshot={...Te,...s}}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 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}getSnapshot(){return this.snapshot}updateDocumentId(s){this.snapshot.id=s}updateDocumentRenderConfig(s){const{documentStyle:n}=this.snapshot;n.renderConfig==null?n.renderConfig=s:n.renderConfig={...n.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:n,l:r,b:i,r:o}=s,{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(s,n){const{documentStyle:r}=this.snapshot;if(!r.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,n=n!=null?n:Number.POSITIVE_INFINITY,r.pageSize={width:s,height:n};return}s!==void 0&&(r.pageSize.width=s),n!==void 0&&(r.pageSize.height=n)}updateDrawing(s,n){const{drawings:r}=this,{width:i,height:o,left:a,top:l}=n,u=r==null?void 0:r[s];if(!u)return;const c=u.objectTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class st extends Ji{constructor(s){var r;super(R.isEmptyObject(s)?qi():s);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(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){var s;return(s=this.snapshot.rev)!=null?s:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(s){if(s.id&&s.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Te,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new ln;return r.reset(),s.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(s,n){const r=this.getBody();if(r!=null)return Le(r,s,n)}_updateApply(s,n,r,i=P.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,l=Tt(a,o);if(l==null)throw new Error("no body has changed");return $i(l,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Tt(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Bi(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Tt(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");ki(a,s,n,r)}}_initializeHeaderFooterModel(){const{headers:s,footers:n}=this.getSnapshot();if(s)for(const r in s){const i=s[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(s){super.updateDocumentId(s),this._unitId=s}}const Cn=N.createIdentifier("univer.config-service");class On{constructor(){d(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,s){this._config.set(e,s)}deleteConfig(e){this._config.delete(e)}}class In extends p{constructor(){super(...arguments);d(this,"_error$",new A.Subject);d(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const Zi="__default_document_sub_component_id20231101__";class An{constructor(){d(this,"_managerInfo",new Map);d(this,"_remove$",new A.Subject);d(this,"remove$",this._remove$.asObservable());d(this,"_andOrUpdate$",new A.Subject);d(this,"andOrUpdate$",this._andOrUpdate$.asObservable());d(this,"_pluginUpdate$",new A.Subject);d(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const s=this._clearByParam(e);this._remove$.next(s)}addOrUpdate(e){const s=this._addByParam(e);this._andOrUpdate$.next(s)}batchAddOrUpdate(e){const s=[];e.forEach(n=>{s.push(...this._addByParam(n))}),this._andOrUpdate$.next(s)}remove(e){const s=this._removeByParam(e);this._remove$.next(s)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:s,subUnitId:n}=e;return(r=this._managerInfo.get(s))==null?void 0:r.get(n)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:s,subUnitId:n,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(s))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(e){const{unitId:s,subUnitId:n,floatingObject:r,floatingObjectId:i,behindText:o}=e;this._managerInfo.has(s)||this._managerInfo.set(s,new Map);const a=this._managerInfo.get(s);return a.has(n)||a.set(n,new Map),a.get(n).set(i,r),[{unitId:s,subUnitId:n,floatingObjectId:i,floatingObject:r,behindText:o}]}_clearByParam(e){const s=this._getFloatingObjects(e),{unitId:n,subUnitId:r}=e,i=[];return s==null||s.forEach((o,a)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:a,floatingObject:o})}),s==null||s.clear(),i}_removeByParam(e){const s=this._getFloatingObjects(e),n=s==null?void 0:s.get(e.floatingObjectId);return n==null?[]:(s==null||s.delete(e.floatingObjectId),[{...e,floatingObject:n}])}}const Nn=N.createIdentifier("univer.floating-object.service");class Sn{constructor(e={}){d(this,"_styles");d(this,"_cacheMap",new ys(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,s){if(this._cacheMap.has(s))return this._cacheMap.get(s);const n=this._getExistingStyleId(e);return n||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,s){const n=R.generateRandomId(6);return this._styles[n]=e,this._cacheMap.set(s,n),n}setValue(e){if(e==null)return;const s=JSON.stringify(e),n=this.search(e,s);return n!=="-1"?n:this.add(e,s)}toJSON(){return this._styles}getStyleByCell(e){let s;e&&R.isObject(e.s)?s=e.s:s=(e==null?void 0:e.s)&&this.get(e.s);const n=e==null?void 0:e.interceptorStyle;return n?{...s,...n}:s}_generateCacheMap(){const{_styles:e,_cacheMap:s}=this;for(const n in e){const r=JSON.stringify(e[n]);s.set(r,n)}}_getExistingStyleId(e){const{_styles:s}=this;for(const n in s)if(R.diffValue(s[n],e))return n;return null}}class Qi{constructor(e,s){d(this,"_columnData",{});this._config=e,this._columnData=s}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:s}=this,n=s[e];return n?n.hd!==C.TRUE:!0}getHiddenCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,rangeType:x.COLUMN}),n}getVisibleCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,rangeType:x.COLUMN}),n}getColumnDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return z(this._columnData)}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=(s[e]||{hd:C.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(e){const s=this._columnData[e];if(s)return s}getColumnOrCreate(e){const{_columnData:s}=this,n=this._config,r=s[e];if(r)return r;const i={w:n.defaultColumnWidth,hd:C.FALSE};return this._columnData[e]=i,i}}class to{constructor(e,s,n){d(this,"_rowData");this._config=e,this._viewModel=s,this._rowData=n}getRowData(){return this._rowData}getRowDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(e,s=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<s;o++){const a=n[o+e]||{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(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:s}=this,n=s[e];if(n)return n;const r=this._config,i={hd:C.FALSE,h:r.defaultRowHeight};return s[e]=i,i}getHiddenRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getVisibleRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;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:s,startColumn:0,endColumn:0,rangeType:x.ROW}),n}getRowRawVisible(e){const s=this.getRow(e);return s?s.hd!==C.TRUE:!0}getSize(){return z(this._rowData)}}const eo="DEFAULT_WORKSHEET_ROW_COUNT",Ln=1e3,so="DEFAULT_WORKSHEET_COLUMN_COUNT",Tn=20,no="DEFAULT_WORKSHEET_ROW_HEIGHT",bn=19,ro="DEFAULT_WORKSHEET_COLUMN_WIDTH",wn=73,io="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",vn=46,oo="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Un=20;function Dn(t){const e={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:C.FALSE,rowCount:Ln,columnCount:Tn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:wn,defaultRowHeight:bn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:C.TRUE,rowHeader:{width:vn,hidden:C.FALSE},columnHeader:{height:Un,hidden:C.FALSE},selections:["A1"],rightToLeft:C.FALSE};return Object.keys(e).forEach(s=>{const n=s;typeof t[n]>"u"&&(t[n]=e[n])}),t}class pn extends p{constructor(s){super();d(this,"_cellContentInterceptor",null);d(this,"_rowFilteredInterceptor",null);this.getRawCell=s}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(s,n){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(s,n):this.getRawCell(s,n)}getRowFiltered(s){var n,r;return(r=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(s))!=null?r:!1}registerCellContentInterceptor(s){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=s,v(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=s,v(()=>this._rowFilteredInterceptor=null)}}class Et{constructor(e,s,n){d(this,"_sheetId");d(this,"_snapshot");d(this,"_cellData");d(this,"_rowManager");d(this,"_columnManager");d(this,"_viewModel");var a;this.unitId=e,this._styles=n,this._snapshot=Dn(s);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 pn((l,u)=>this.getCellRaw(l,u)),this._rowManager=new to(this._snapshot,this._viewModel,i),this._columnManager=new Qi(this._snapshot,r)}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const e=this.getCellMatrix(),s=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,a=!1,l=!1;return e.forEach((u,c)=>{Object.keys(c).forEach(h=>{const _=+h,f=e.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,_))})}),s.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:e}=this,s=R.deepClone(e);return new Et(this.unitId,s,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(e,s){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(X.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},i))return i}return null}getCell(e,s){return e<0||s<0?null:this._viewModel.getCell(e,s)}getCellRaw(e,s){return this.getCellMatrix().getValue(e,s)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getMatrixWithMergedCells(e,s,n,r,i=!1){const o=this.getCellMatrix(),a=this._snapshot.mergeData.filter(u=>X.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},u)),l=new G;return oe(e,n,s,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;oe(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(e,s,n,r){return typeof e=="object"?new et(this,e,{getStyles:()=>this._styles}):new et(this,{startRow:e,startColumn:s,endColumn:r||s,endRow:n||e},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:s}=e;return s}getMaxRows(){const{_snapshot:e}=this,{rowCount:s}=e;return s}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:s}=e;return s===0}getTabColor(){const{_snapshot:e}=this,{tabColor:s}=e;return s}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}getRowVisible(e){return this._viewModel.getRowFiltered(e)?!1:this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,s){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,s);return r.forEach(i=>i.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,s){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,s);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){const e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:s}=e;return s}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,s=!0){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e,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&&s){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&&s)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(e,s=!0,n=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:a}=e,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&&s){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(!_&&s)u+=1;else{const E={row:u,col:c,value:_};return u+=1,{done:!1,value:E}}}}}}}}}function ao(t){var n,r;if(!t)return"";const e=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(e)return e;const s=t.v;return typeof s=="string"?t.t===Q.BOOLEAN?s.toUpperCase():s:typeof s=="number"?t.t===Q.BOOLEAN?s?"TRUE":"FALSE":s.toString():typeof s=="boolean"?s?"TRUE":"FALSE":""}const lo="0.1.12";function uo(t="",e=nt.ZH_CN,s=""){return{id:t,sheetOrder:[],name:s,appVersion:lo,locale:e,styles:{},sheets:{},resources:[]}}var co=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,_o=(t,e,s,n)=>{for(var r=n>1?void 0:n?ho(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&co(e,s,r),r},fo=(t,e)=>(s,n)=>e(s,n,t);function Eo(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends Kt{constructor(s={},n){super();d(this,"type",O.UNIVER_SHEET);d(this,"_sheetCreated$",new A.Subject);d(this,"sheetCreated$",this._sheetCreated$.asObservable());d(this,"_sheetDisposed$",new A.Subject);d(this,"sheetDisposed$",this._sheetDisposed$.asObservable());d(this,"_activeSheet$",new A.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=uo();R.isEmptyObject(s)?this._snapshot=r:this._snapshot=R.commonExtend(r,s);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 Sn(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(s){return typeof s=="string"||"startRow"in s||"row"in s}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(s){this._snapshot.name=s}getUnitId(){return this._unitId}getRev(){var s;return(s=this._snapshot.rev)!=null?s:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(s,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[s])return!1;i[s]=r,o.splice(n,0,s);const a=new Et(this._unitId,r,this._styles);return this._worksheets.set(s,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===s)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const s=this.getRawActiveSheet();if(s)return s;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(s){this._activeSheet$.next(s)}removeSheet(s){var r;return this._worksheets.get(s)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===s&&this.setActiveSheet(null),this._worksheets.delete(s),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(s),1),delete this._snapshot.sheets[s],!0):!1}getActiveSheetIndex(){const{sheetOrder:s}=this._snapshot;return s.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:s}=this._snapshot;return s.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:s}=this._snapshot,n=[];return s.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>s.getSheetId()===r)}getSheetBySheetName(s){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===s);return this._worksheets.get(r)}getSheetBySheetId(s){return this._worksheets.get(s)}getSheetByIndex(s){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[s])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===C.TRUE).map(s=>s.getConfig().id)}transformRangeType(s){if(typeof s=="string")return this._getCellRange(s);if(typeof s!="string"&&"row"in s){const n=s;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof s!="string"&&"startRow"in s?{sheetId:"",range:s}:lt}load(s){this._snapshot=s}checkSheetName(s){return this.getSheetsName().includes(s)}uniqueSheetName(s="Sheet1"){let n=s;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}generateNewSheetName(s){let n=s+this._count;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}_getCellRange(s){var c,h,_,f,E;let n="",r="";if(s.indexOf("!")>-1){const g=s.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=s;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:s,_worksheets:n}=this,{sheets:r,sheetOrder:i}=s;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=_o([fo(1,J)],exports.Workbook);class be extends Kt{constructor(s){var n;super();d(this,"type",O.UNIVER_SLIDE);d(this,"_snapshot");d(this,"_unitId");this._snapshot={...Js,...s},this._unitId=(n=this._snapshot.id)!=null?n:R.generateRandomId(6)}getContainer(){return this._snapshot.container}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 n=this.getPages();return n==null?void 0:n[s]}getElementsByPage(s){var n;return(n=this.getPage(s))==null?void 0:n.pageElements}getElement(s,n){var r;return(r=this.getElementsByPage(s))==null?void 0:r[n]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:_e.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const ht="FOCUSING_SHEET",vt="FOCUSING_DOC",Ut="FOCUSING_SLIDE",go="FOCUSING_EDITOR_BUT_HIDDEN",Mn="EDITOR_ACTIVATED",Ro="FOCUSING_EDITOR_INPUT_FORMULA",Pn="FOCUSING_FORMULA_EDITOR",mo="FOCUSING_UNIVER_EDITOR",Co="FOCUSING_EDITOR_INPUT_FORMULA",Oo="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var Io=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,No=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ao(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Io(e,s,r),r},ke=(t,e)=>(s,n)=>e(s,n,t);const q=N.createIdentifier("univer.current");exports.UniverInstanceService=class extends p{constructor(s,n){super();d(this,"_unitsByType",new Map);d(this,"_createHandler");d(this,"_ctorByType",new Map);d(this,"_currentUnits$",new A.BehaviorSubject({}));d(this,"currentUnits$",this._currentUnits$.asObservable());d(this,"_unitAdded$",new A.Subject);d(this,"unitAdded$",this._unitAdded$.asObservable());d(this,"_unitDisposed$",new A.Subject);d(this,"unitDisposed$",this._unitDisposed$.asObservable());d(this,"_focused$",new A.BehaviorSubject(null));d(this,"focused$",this._focused$.asObservable());this._injector=s,this._contextService=n}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(s){this._createHandler=s}createUnit(s,n){return this._createHandler(s,n,this._ctorByType.get(s))}registerCtorForType(s,n){return this._ctorByType.set(s,n),{dispose:()=>{this._ctorByType.delete(s)}}}getCurrentTypeOfUnit$(s){return this.currentUnits$.pipe(A.map(n=>{var r;return(r=n[s])!=null?r:null}),A.distinctUntilChanged())}getCurrentUnitForType(s){return this._currentUnits$.getValue()[s]}setCurrentUnitForType(s){const n=this._getUnitById(s);if(!n)throw new Error(`[UniverInstanceService]: no document with unitId ${s}!`);this._currentUnits$.next({...this._currentUnits$.getValue(),[n[1]]:n[0]})}getTypeOfUnitAdded$(s){return this._unitAdded$.pipe(A.filter(n=>n.type===s))}__addUnit(s){const n=s.type;this._unitsByType.has(n)||this._unitsByType.set(n,[]),this._unitsByType.get(n).push(s),this._currentUnits$.next({...this._currentUnits$.getValue(),[n]:s}),this._unitAdded$.next(s)}getTypeOfUnitDisposed$(s){return this.unitDisposed$.pipe(A.filter(n=>n.type===s))}getUnit(s,n){var i;const r=(i=this._getUnitById(s))==null?void 0:i[0];return n&&(r==null?void 0:r.type)!==n?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(O.UNIVER_DOC)}getUniverDocInstance(s){return this.getUnit(s,O.UNIVER_DOC)}getUniverSheetInstance(s){return this.getUnit(s,O.UNIVER_SHEET)}getAllUnitsForType(s){var n;return(n=this._unitsByType.get(s))!=null?n:[]}changeDoc(s,n){const r=this.getAllUnitsForType(O.UNIVER_DOC),i=r.find(o=>o.getUnitId()===s);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(n)}get focused(){var n;const s=this._focused$.getValue();return s?(n=this._getUnitById(s))==null?void 0:n[0]:null}focusUnit(s){this._focused$.next(s),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(vt,!1),this._contextService.setContextValue(ht,!0),this._contextService.setContextValue(Ut,!1)):this.focused instanceof st?(this._contextService.setContextValue(vt,!0),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(Ut,!1)):this.focused instanceof be&&(this._contextService.setContextValue(vt,!1),this._contextService.setContextValue(ht,!1),this._contextService.setContextValue(Ut,!0))}getFocusedUnit(){return this.focused}getUnitType(s){const n=this._getUnitById(s);if(!n)throw new Error(`[UniverInstanceService]: No document with unitId ${s}`);return n[1]}disposeUnit(s){const n=this._getUnitById(s);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(s){for(const[n,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===s);if(i)return[i,n]}}};exports.UniverInstanceService=No([ke(0,N.Inject(N.Injector)),ke(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 So={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Dt=new Map;function we(t,e){return function(r){ve(t,e)}}function ve(t,e){Dt.has(t)||Dt.set(t,[]),Dt.get(t).push(e)}var Lo=Object.defineProperty,To=Object.getOwnPropertyDescriptor,xn=(t,e,s,n)=>{for(var r=n>1?void 0:n?To(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Lo(e,s,r),r},ue=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends p{constructor(s){super();d(this,"_lifecycle$",new A.BehaviorSubject(b.Starting));d(this,"lifecycle$",this._lifecycle$.asObservable());d(this,"_lock",!1);this._logService=s,this._reportProgress(b.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(s){if(s<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(s!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(s),this._lifecycle$.next(s),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new A.Observable(s=>{this.stage===b.Starting||(this.stage===b.Ready?s.next(b.Starting):this.stage===b.Rendered?(s.next(b.Starting),s.next(b.Ready)):(s.next(b.Starting),s.next(b.Ready),s.next(b.Rendered))),this._lifecycle$.subscribe(n=>{s.next(n),n===b.Steady&&s.complete()})})}_reportProgress(s){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${So[s]}".`)}};exports.LifecycleService=xn([ue(0,J)],exports.LifecycleService);exports.LifecycleInitializerService=class extends p{constructor(s,n){super();d(this,"_seenTokens",new Set);this._lifecycleService=s,this._injector=n}initModulesOnStage(s){var n;(n=Dt.get(s))==null||n.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}};exports.LifecycleInitializerService=xn([ue(0,N.Inject(exports.LifecycleService)),ue(1,N.Inject(N.Injector))],exports.LifecycleInitializerService);class dt extends p{constructor(){super();d(this,"_currentLocale$",new A.BehaviorSubject(nt.ZH_CN));d(this,"currentLocale$",this._currentLocale$.asObservable());d(this,"_locales",null);d(this,"localeChanged$",new A.Subject);d(this,"t",(s,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=s.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 s});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(s){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},s)}setLocale(s){this._currentLocale$.next(s),this.localeChanged$.next()}getLocales(){var s;return(s=this._locales)==null?void 0:s[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(s,n){const r=n.shift();if(r&&s&&r in s){const i=s[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Yt=N.createIdentifier("resource-manager-service");var bo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,vo=(t,e,s,n)=>{for(var r=n>1?void 0:n?wo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&bo(e,s,r),r},Ge=(t,e)=>(s,n)=>e(s,n,t);const Ue=N.createIdentifier("univer.permission-service");exports.PermissionService=class extends p{constructor(s,n){super();d(this,"_permissionPointMap",new Map);d(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});d(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new A.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});d(this,"updatePermissionPoint",(s,n,r)=>{const i=this._permissionPointMap.get(s);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=Re.DONE,o.next(a)}});d(this,"getPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=s,this._univerInstanceService=n}_toJson(s){const n=this._permissionPointMap.get(s);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(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),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 A.combineLatest(i).pipe(Lt.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);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=vo([we(b.Starting,exports.PermissionService),Ge(0,N.Inject(Yt)),Ge(1,N.Inject(q))],exports.PermissionService);const Hn="univer.editable";class pt extends zs{constructor(s){super();d(this,"id",Hn);d(this,"value",!0);d(this,"unitID");this.unitID=s}}var Uo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,po=(t,e,s,n)=>{for(var r=n>1?void 0:n?Do(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Uo(e,s,r),r},$e=(t,e)=>(s,n)=>e(s,n,t);exports.UniverPermissionService=class extends p{constructor(e,s){super(),this._permissionService=e,this._univerInstanceService=s,this._init()}_init(){this._univerInstanceService.getTypeOfUnitAdded$(O.UNIVER_SHEET).subscribe(e=>{const s=new pt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e=(s=>(s=this._univerInstanceService.getCurrentUnitForType(O.UNIVER_SHEET))==null?void 0:s.getUnitId())()){if(!e)return;const n=new pt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new pt(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=po([we(b.Starting,exports.UniverPermissionService),$e(0,N.Inject(Ue)),$e(1,N.Inject(q))],exports.UniverPermissionService);class Fn extends p{constructor(){super(...arguments);d(this,"_resourceMap",new Map);d(this,"_register$",new A.Subject);d(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(s){return this.getAllResourceHooks().map(i=>{const o=i.toJson(s);return{name:i.pluginName,data:o}})}registerPluginResource(s){const n=s.pluginName;if(this._resourceMap.has(n))throw new Error(`the pluginName is registered {${n}}`);return this._resourceMap.set(n,s),this._register$.next(s),v(()=>this._resourceMap.delete(n))}disposePluginResource(s){this._resourceMap.delete(s)}loadResources(s,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(s,a)}catch{console.error("LoadResources Error!")}})}unloadResources(s){this.getAllResourceHooks().forEach(n=>{n.onUnLoad(s)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}var Mo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,xo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Po(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Mo(e,s,r),r},Ve=(t,e)=>(s,n)=>e(s,n,t);let ce=class extends p{constructor(e,s){super();d(this,"saveWorkbook",e=>{const s=e.getUnitId(),n=this._resourceManagerService.getResources(s)||[],r=e.getSnapshot();return r.resources=n,r});this._resourceManagerService=e,this._univerInstanceService=s,this._init()}_init(){const e=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=>{e(n)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>{e(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())})))}};ce=xo([Ve(0,N.Inject(Yt)),Ve(1,N.Inject(q))],ce);const De=N.createIdentifier("resource-loader-service");ve(b.Ready,De);class pe extends p{constructor(){super();d(this,"_currentTheme");d(this,"_currentTheme$",new A.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(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Wn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Bn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Ho=`\r
7
+ `;function Fo(t){return`__internalEditorId__${t}`}function Wo(t){return t.startsWith("__")}var Bo=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Go=(t,e,s,n)=>{for(var r=n>1?void 0:n?ko(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Bo(e,s,r),r},Qt=(t,e)=>(s,n)=>e(s,n,t);const yt=N.createIdentifier("univer.undo-redo.service"),$o=20;class kn{dispose(){}async dispatchToHandlers(){return!1}}const Gn="univer.command.redo",$n="univer.command.undo",Vn=new class extends kn{constructor(){super(...arguments);d(this,"type",Rt.COMMAND);d(this,"id",$n)}async handler(e){const s=e.get(yt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(mt);return me(n.undoMutations,r)?(s.popUndoToRedo(),!0):!1}},jn=new class extends kn{constructor(){super(...arguments);d(this,"type",Rt.COMMAND);d(this,"id",Gn)}async handler(e){const s=e.get(yt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(mt);return me(n.redoMutations,r)?(s.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends p{constructor(s,n,r){super();d(this,"undoRedoStatus$");d(this,"_undoRedoStatus$",new A.BehaviorSubject({undos:0,redos:0}));d(this,"_undoStacks",new Map);d(this,"_redoStacks",new Map);d(this,"_batchingStatus",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Vn)),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(s.unitID)){const a=this._batchingStatus.get(s.unitID),l=this._pitchUndoElement(s.unitID);a===0||!l?(o(s),this._batchingStatus.set(s.unitID,1)):this._tryBatchingElements(l,s)}else o(s);function o(a){i.push(a),i.length>$o&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(s){const n=this._getRedoStack(s);n&&(n.length=0);const r=this._getUndoStack(s);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const s=this._getFocusedUnitId();return this._pitchUndoElement(s)}pitchTopRedoElement(){const s=this._getFocusedUnitId();return this._pitchRedoElement(s)}_pitchUndoElement(s){const n=this._getUndoStack(s);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(s){const n=this._getRedoStack(s);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(s){if(this._batchingStatus.has(s))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(s,0),v(()=>this._batchingStatus.delete(s))}_updateStatus(){var i,o;const s=this._getFocusedUnitId(),n=s&&((i=this._undoStacks.get(s))==null?void 0:i.length)||0,r=s&&((o=this._redoStacks.get(s))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(s,n=!1){let r=this._undoStacks.get(s);return!r&&n&&(r=[],this._undoStacks.set(s,r)),r||null}_getRedoStack(s,n=!1){let r=this._redoStacks.get(s);return!r&&n&&(r=[],this._redoStacks.set(s,r)),r||null}_getUndoStackForFocused(){const s=this._getFocusedUnitId();if(!s)throw new Error("No focused univer instance!");return this._getUndoStack(s,!0)}_getRedoStackForFocused(){const s=this._getFocusedUnitId();if(!s)throw new Error("No focused univer instance!");return this._getRedoStack(s,!0)}_tryBatchingElements(s,n){s.redoMutations.push(...n.redoMutations),s.undoMutations.push(...n.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let s="";const n=this._contextService.getContextValue(ht),r=this._contextService.getContextValue(Pn),i=this._contextService.getContextValue(Mn);return n?r?s=Bn:i?s=Wn:s=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":s=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",s}};exports.LocalUndoRedoService=Go([Qt(0,q),Qt(1,mt),Qt(2,gt)],exports.LocalUndoRedoService);class he extends p{onStarting(e){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}d(he,"pluginName"),d(he,"type",O.UNIVER_UNKNOWN);class Vo{constructor(){d(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class jo{constructor(){d(this,"_pluginsRegistered",[])}registerPlugin(e,s){this._pluginsRegistered.push({plugin:e,options:s})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var Ko=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,yo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Yo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ko(e,s,r),r},St=(t,e)=>(s,n)=>e(s,n,t);exports.PluginHolder=class extends p{constructor(s,n,r,i){super();d(this,"_started",!1);d(this,"_pluginRegistered",new Set);d(this,"_pluginStore",new Vo);d(this,"_pluginRegistry",new jo);this._logService=s,this._injector=n,this._lifecycleService=r,this._lifecycleInitializerService=i}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(s=>s.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginRegistered.clear()}registerPlugin(s,n){const{pluginName:r}=s;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(s,n)}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const s=this._pluginRegistry.getRegisterPlugins().map(({plugin:r,options:i})=>this._initPlugin(r,i));this._pluginRegistry.removePlugins();const n=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().pipe(A.finalize(()=>{Promise.resolve().then(()=>n.dispose())})).subscribe(r=>{this._pluginsRunLifecycle(s,r)}))}_pluginsRunLifecycle(s,n){s.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(s,n){return this._injector.createInstance(s,n)}};exports.PluginHolder=yo([St(0,J),St(1,N.Inject(N.Injector)),St(2,N.Inject(exports.LifecycleService)),St(3,N.Inject(exports.LifecycleInitializerService))],exports.PluginHolder);var zo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,qo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Xo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&zo(e,s,r),r},Jo=(t,e)=>(s,n)=>e(s,n,t);const Zo=4;exports.PluginService=class{constructor(e){d(this,"_pluginHolderForUniver");d(this,"_pluginHoldersForTypes",new Map);d(this,"_flushTimer");this._injector=e,this._pluginHolderForUniver=this._injector.createInstance(exports.PluginHolder),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const e of this._pluginHoldersForTypes.values())e.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(e,s){this._assertPluginValid(e),this._scheduleInitPlugin();const{type:n}=e;n===O.UNIVER_UNKNOWN?(this._pluginHolderForUniver.registerPlugin(e,s),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(n).registerPlugin(e,s)}startPluginForType(e){this._ensurePluginHolderForType(e).start()}_ensurePluginHolderForType(e){if(!this._pluginHoldersForTypes.has(e)){const s=this._injector.createInstance(exports.PluginHolder);return this._pluginHoldersForTypes.set(e,s),s}return this._pluginHoldersForTypes.get(e)}_assertPluginValid(e){const{type:s,pluginName:n}=e;if(s===O.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${e}. Please assign a "type" to your plugin.`);if(n==="")throw new Error(`[PluginService]: no plugin name for ${e}. 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()},Zo))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[e,s]of this._pluginHoldersForTypes)s.started&&s.flush()}};exports.PluginService=qo([Jo(0,N.Inject(N.Injector))],exports.PluginService);function Kn(t,e){if(!e)return t;const s=[];for(const n of t){const r=e.find(([i])=>i===n[0]);if(r){if(r[1]===null)continue;s.push([n[0],r[1]])}else s.push(n)}return s}class Yn{constructor(){d(this,"_model",new Map);d(this,"_userChange$",new A.Subject);d(this,"userChange$",this._userChange$.asObservable());d(this,"_currentUser");d(this,"_currentUser$",new A.BehaviorSubject(null));d(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser}setCurrentUser(e){this._currentUser=e,this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:"add",user:e})}getUser(e,s){const n=this._model.get(e);if(n)return n;s&&s()}delete(e){const s=this.getUser(e);this._model.delete(e),s&&this._userChange$.next({type:"delete",user:s})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}}class Qo{constructor(e={},s){d(this,"_startedTypes",new Set);d(this,"_injector");const n=this._injector=ta(s,e==null?void 0:e.override),{theme:r,locale:i,locales:o,logLevel:a}=e;r&&this._injector.get(pe).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(e){this._injector.get(dt).setLocale(e)}createUnit(e,s){return this._univerInstanceService.createUnit(e,s)}createUniverSheet(e){return this._univerInstanceService.createUnit(O.UNIVER_SHEET,e)}createUniverDoc(e){return this._univerInstanceService.createUnit(O.UNIVER_DOC,e)}createUniverSlide(e){return this._univerInstanceService.createUnit(O.UNIVER_SLIDE,e)}_init(e){this._univerInstanceService.registerCtorForType(O.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(O.UNIVER_DOC,st),this._univerInstanceService.registerCtorForType(O.UNIVER_SLIDE,be);const s=e.get(q);s.__setCreateHandler((n,r,i)=>{if(!this._startedTypes.has(n)){this._pluginService.startPluginForType(n),this._startedTypes.add(n);const a=e.createInstance(i,r);return s.__addUnit(a),this._tryProgressToReady(),a}const o=e.createInstance(i,r);return s.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<b.Ready&&(this._injector.get(exports.LifecycleService).stage=b.Ready)}registerPlugin(e,s){this._pluginService.registerPlugin(e,s)}}function ta(t,e){const s=Kn([[In],[dt],[pe],[exports.LifecycleService],[exports.LifecycleInitializerService],[exports.UniverPermissionService],[exports.PluginService],[Yn],[q,{useClass:exports.UniverInstanceService}],[Ue,{useClass:exports.PermissionService}],[J,{useClass:nn,lazy:!0}],[mt,{useClass:exports.CommandService,lazy:!0}],[yt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Cn,{useClass:On}],[gt,{useClass:en}],[Nn,{useClass:An,lazy:!0}],[Yt,{useClass:Fn,lazy:!0}],[De,{useClass:ce,lazy:!0}]],e);return t?t.createChild(s):new N.Injector(s)}const ea=(t,e)=>e.length===t.length&&!t.some(s=>e.some(n=>!X.equals(n,s))),sa=(t,e)=>e.length===t.length&&t.every((s,n)=>{const r=e[n];return r.unitId===s.unitId&&r.sheetId===s.sheetId&&X.equals(s.range,r.range)});function na(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const s=Object.keys(t),n=Object.keys(e);if(s.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(e);for(let i=0;i<s.length;i++){const o=s[i];if(!r(o))return!1;const a=t[o],l=e[o];if(a!==l)return!1}return!0}function yn(t){return/^-?\d+(\.\d+)?$/.test(t)}function ra(t){return yn(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function ia(t){return["true","false"].includes(t.toLowerCase())}function oa(t,e){return e.forEach(s=>t.add(s)),t}function aa(t,e=16){let s=0,n=null;return function(...i){const o=Date.now();o-s<e?(n&&clearTimeout(n),n=setTimeout(()=>{s=o,t.apply(this,i)},e)):(s=o,t.apply(this,i))}}function la(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}var zn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(zn||{});class de{constructor(e){d(this,"_index",0);d(this,"_offset",0);this._actions=e}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(e){e||(e=Number.POSITIVE_INFINITY);const s=this._actions[this._index];if(s){const n=this._offset,r=s.len;return e>=r-n?(e=r-n,this._index+=1,this._offset=0):this._offset+=e,s.t===I.DELETE||s.t===I.RETAIN&&s.body==null?R.deepClone({...s,len:e}):R.deepClone({...s,len:e,body:Le(s.body,n,n+e)})}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 e=this._actions[this._index];return e?e.t:I.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const e=this._offset,s=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=s,[n].concat(r)}}else return[]}}function je(t){return Object.keys(t).length===1}class zt{constructor(){d(this,"_actions",[])}static compose(e,s){const n=new de(e),r=new de(s),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:le(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:le(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(e,s,n=""){const r={t:I.INSERT,body:s,len:e,line:0,segmentId:n};return this.push(r),this}retain(e,s="",n,r){const i={t:I.RETAIN,len:e,segmentId:s};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(e,s=""){const n={t:I.DELETE,len:e,line:0,segmentId:s};return this.push(n),this}serialize(){return this._actions}push(...e){if(e.length>1){for(const i of e)this.push(i);return this}let s=this._actions.length,n=this._actions[s-1];const r=R.deepClone(e[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&&(s-=1,n=this._actions[s-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&&je(n.body)&&r.t===I.INSERT&&je(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return s===this._actions.length?this._actions.push(r):this._actions.splice(s,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===I.RETAIN&&Xi(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}}function ua(t,e,s){if(e==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new st(n),i=e.length;let o;for(;(o=r.getBody().dataStream.indexOf(e))>=0;){const l=new zt;if(o>0&&l.retain(o),s.length>0){const c=r.sliceBody(o,o+i),h={dataStream:s};Array.isArray(c==null?void 0:c.textRuns)&&c.textRuns.length&&(h.textRuns=[{...c.textRuns[0],st:0,ed:s.length}]),l.insert(s.length,h)}l.delete(i);const u=l.serialize();r.apply(u)}const a=r.getBody();return r.dispose(),a}class ca extends Vt{add(e){if(!e)return null;const s=new $t(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const ha=N.createIdentifier("ILocalStorageService");function da(t){return`sheet_interceptor_${t}`}const Xn=t=>function(e,s){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,s,r.bind(null,i+1))}return r(0,e)};class _a{constructor(e){d(this,"_interceptorsByName",new Map);d(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return Xn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>jt(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}const fa=N.createIdentifier("univer.snapshot-server-service");class Ea{constructor(){d(this,"_sheetBlockCache",new Map)}getUnitOnRev(e,s){return Promise.resolve({snapshot:{unitID:"",type:O.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:B.OK,message:""}})}getSheetBlock(e,s){const n=this._sheetBlockCache.get(s.blockID);return Promise.resolve({block:n,error:{code:B.OK,message:""}})}fetchMissingChangesets(e,s){return Promise.resolve({changesets:[],error:{code:B.OK,message:""}})}getResourcesRequest(e,s){return Promise.resolve({resources:{},error:{code:B.OK,message:""}})}saveSnapshot(e,s){return Promise.resolve({error:{code:B.OK,message:""}})}saveSheetBlock(e,s){const{block:n}=s;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(e,s){return Promise.resolve({error:{code:B.OK,message:""},concurrent:[]})}}function ga(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(e,s)=>String.fromCharCode(Number.parseInt(s,16))))}function Me(t){return decodeURIComponent(Array.prototype.map.call(atob(t),e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ct=new TextEncoder,Xt=new TextDecoder;function qn(t){const e=R.deepClone(t);return delete e.id,delete e.name,delete e.rowCount,delete e.columnCount,delete e.cellData,Ct.encode(JSON.stringify(e))}function Jn(t){const e=R.deepClone(t);return delete e.id,delete e.rev,delete e.name,delete e.sheetOrder,delete e.sheets,Ct.encode(JSON.stringify(e))}function Ra(t){const e=R.deepClone(t);return delete e.id,delete e.rev,delete e.title,delete e.resources,Ct.encode(JSON.stringify(e))}function Ke(t){return JSON.parse(Xt.decode(t))}function ma(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}function Ca(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}const te=256;function Zn(t,e){const s=new G(t),n=s.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+te,n-1),a=s.getSlice(i,Math.min(i+te,n-1),0,e),l=Oa(a);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:l}),i+=te}return r}function Oa(t){const e=t.getData();return Ct.encode(JSON.stringify(e))}async function Ia(t,e,s,n,r){const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([h,_])=>{const f={id:_.id,type:Bt.GRID,name:_.name,rowCount:_.rowCount,columnCount:_.columnCount,originalMeta:qn(_)};if(o[h]=f,_.cellData){const E=Zn(_.cellData,_.rowCount),g=await Promise.all(E.map(m=>r.saveSheetBlock(t,{unitID:s,type:O.UNIVER_SHEET,block:m})));if(g.some(m=>{var S;return((S=m.error)==null?void 0:S.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=Jn(e),u={unitID:e.id,rev:n,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:l};return{snapshotRes:{unitID:s,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0}}}async function Aa(t,e,s,n,r){var _,f;const i={},o={};if(!await Promise.all(Object.entries(e.sheets).map(async([E,g])=>{const m={id:g.id,type:Bt.GRID,name:g.name,rowCount:g.rowCount,columnCount:g.columnCount,originalMeta:qn(g)};if(o[E]=m,g.cellData){const S=Zn(g.cellData,g.rowCount),U=await Promise.all(S.map(M=>r.saveSheetBlock(t,{unitID:s,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=Jn(e),u={unitID:e.id,rev:n,creator:"",name:e.name,sheetOrder:e.sheetOrder,sheets:o,blockMeta:i,resources:e.resources||[],originalMeta:l},c={unitID:s,rev:u.rev,type:O.UNIVER_SHEET,workbook:u,doc:void 0},h=await r.saveSnapshot(t,{unitID:s,type:O.UNIVER_SHEET,snapshot:c});if(an(h.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
8
  ErrorCode: ${(_=h.error)==null?void 0:_.code}:${(f=h.error)==null?void 0:f.message}`);return{snapshot:c}}function Na(t,e,s){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([l,u])=>{const c=Ke(u.originalMeta);r[l]={id:u.id,name:u.name,rowCount:u.rowCount,columnCount:u.columnCount,...c}});const i=new Map;e.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=ma(f.data);Object.entries(E).forEach(([g,m])=>{const S=c.cellData[+g]={};Object.entries(m).forEach(([U,M])=>{S[+U]=M})})})});const o=Ke(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 Sa(t){const e=t.doc;if(e==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:s,rev:n,name:r,originalMeta:i}=e,{body:o,documentStyle:a={},settings:l={}}=Ca(i);return{id:s,rev:n,locale:nt.EN_US,title:r,body:o,documentStyle:a,settings:l}}async function La(t,e,s,n,r){var l,u,c;const i={unitID:e.id,rev:n,creator:"",name:(l=e.title)!=null?l:"",resources:e.resources||[],originalMeta:Ra(e)},o={unitID:s,rev:i.rev,type:O.UNIVER_DOC,workbook:void 0,doc:i},a=await r.saveSnapshot(t,{unitID:s,type:O.UNIVER_DOC,snapshot:o});if(an(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 Ta(t,e){const s=t.workbook;if(!s)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(s.blockMeta).forEach(([i,o])=>{const a=o.blocks.map(async l=>{const u={unitID:s.unitID,type:O.UNIVER_SHEET,blockID:l},{block:c}=await e.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||{}),tr=(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))(tr||{}),er=(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))(er||{}),sr=(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))(sr||{}),nr=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(nr||{});ar();exports.ABCToNumber=fi;exports.AbsoluteRefType=w;exports.ActionIterator=de;exports.AlignTypeH=Ds;exports.AlignTypeV=ps;exports.AutoFillSeries=ye;exports.BaselineOffset=it;exports.BlockType=_s;exports.BooleanNumber=C;exports.BorderStyleTypes=T;exports.BorderType=Xe;exports.BulletAlignment=K;exports.COLORS=ee;exports.CellValueType=Q;exports.ClientSnapshotServerService=Ea;exports.Color=tt;exports.ColorBuilder=Gt;exports.ColorKit=k;exports.ColorType=W;exports.ColumnSeparatorType=gs;exports.CommandType=Rt;exports.CommonHideTypes=qe;exports.ConfigService=On;exports.ContentAlignment=Ts;exports.ContextService=en;exports.CopyPasteType=Je;exports.CustomRangeType=ds;exports.DEFAULT_CELL=Si;exports.DEFAULT_DOC=Te;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Zi;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Ho;exports.DEFAULT_RANGE=Ai;exports.DEFAULT_RANGE_ARRAY=lt;exports.DEFAULT_SELECTION=Ni;exports.DEFAULT_SLIDE=Js;exports.DEFAULT_STYLES=wt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Tn;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=so;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Un;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=oo;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=wn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=ro;exports.DEFAULT_WORKSHEET_ROW_COUNT=Ln;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=eo;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=bn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=no;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=vn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=io;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Bn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Wn;exports.DashStyleType=Ns;exports.DataStreamTreeNodeType=un;exports.DataStreamTreeTokenType=Ie;exports.DataValidationErrorStyle=Qn;exports.DataValidationImeMode=tr;exports.DataValidationOperator=er;exports.DataValidationRenderMode=yn;exports.DataValidationStatus=nr;exports.DataValidationType=sr;exports.DesktopLogService=nn;exports.DeveloperMetadataVisibility=Ze;exports.Dimension=Qe;exports.Direction=ts;exports.Disposable=p;exports.DisposableCollection=ge;exports.DocStyleType=cs;exports.DocumentDataModel=st;exports.EDITOR_ACTIVATED=Mn;exports.EXTENSION_NAMES=Zs;exports.Entry=se;exports.EntryIterator=Ys;exports.ErrorService=In;exports.EventState=$s;exports.FOCUSING_DOC=vt;exports.FOCUSING_EDITOR_BUT_HIDDEN=go;exports.FOCUSING_EDITOR_INPUT_FORMULA=Ro;exports.FOCUSING_EDITOR_STANDALONE=Co;exports.FOCUSING_FORMULA_EDITOR=Pn;exports.FOCUSING_SHEET=ht;exports.FOCUSING_SLIDE=Ut;exports.FOCUSING_UNIVER_EDITOR=mo;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Oo;exports.FloatingObjectManagerService=An;exports.FollowNumberWithType=hs;exports.FontItalic=Mt;exports.FontStyleType=bs;exports.FontWeight=Pt;exports.FormatType=es;exports.GlyphType=ut;exports.GridType=fs;exports.HLSColor=ls;exports.HorizontalAlign=Z;exports.ICommandService=mt;exports.IConfigService=Cn;exports.IContextService=gt;exports.IFloatingObjectManagerService=Nn;exports.ILocalStorageService=ha;exports.ILogService=J;exports.IPermissionService=Ue;exports.IResourceLoaderService=De;exports.IResourceManagerService=Yt;exports.ISnapshotServerService=fa;exports.IUndoRedoService=zt;exports.IUniverInstanceService=q;exports.InterceptorManager=_a;exports.InterpolationPointType=ss;exports.KeyIterator=js;exports.LRUHelper=at;exports.LRUMap=zs;exports.LifecycleStages=b;exports.LocaleService=dt;exports.LocaleType=nt;exports.LogLevel=sn;exports.MemoryCursor=ln;exports.NamedStyleType=Is;exports.NilCommand=rn;exports.NumberUnitType=Us;exports.ObjectMatrix=G;exports.ObjectRelativeFromH=ws;exports.ObjectRelativeFromV=vs;exports.Observable=Vt;exports.ObservableHooks=ca;exports.Observer=$t;exports.OnLifecycle=we;exports.PRESET_LIST_TYPE=Gi;exports.PageElementType=xs;exports.PageOrientType=Ps;exports.PageType=_e;exports.ParagraphElementType=ms;exports.PermissionPoint=ys;exports.PermissionStatus=Re;exports.Plugin=he;exports.PositionedObjectLayoutType=Os;exports.PresetListType=Wt;exports.ProtectionType=ns;exports.RANGE_TYPE=x;exports.RGBA_PAREN=_r;exports.RGB_PAREN=dr;exports.Range=et;exports.Rectangle=X;exports.RedoCommand=jn;exports.RedoCommandId=Gn;exports.RefAlias=_i;exports.Registry=Ce;exports.RegistryAsMap=Oe;exports.RelativeDate=rs;exports.RelativeSlideLink=Hs;exports.ResourceManagerService=Fn;exports.RgbColor=xt;exports.RxDisposable=ni;exports.SectionType=Es;exports.ShapeType=is;exports.SheetTypes=Bt;exports.SheetViewModel=pn;exports.SlideDataModel=be;exports.SpacingRule=As;exports.Styles=Sn;exports.THEME_COLORS=as;exports.TabStopAlignment=Ss;exports.TextDecoration=os;exports.TextDirection=_t;exports.TextDirectionType=Rs;exports.TextX=yt;exports.TextXActionType=I;exports.ThemeColor=Ht;exports.ThemeColorType=H;exports.ThemeColors=kt;exports.ThemeService=pe;exports.Tools=R;exports.UndoCommand=Vn;exports.UndoCommandId=$n;exports.UnitModel=Kt;exports.Univer=Qo;exports.UniverEditablePermission=pt;exports.UniverEditablePermissionPoint=Hn;exports.UniverInstanceType=O;exports.UpdateDocsAttributeType=P;exports.UserManagerService=Yn;exports.ValueIterator=Ks;exports.VerticalAlign=rt;exports.WidthType=Ls;exports.Worksheet=Et;exports.WrapStrategy=ft;exports.WrapTextType=Cs;exports.afterInitApply=Hi;exports.b64DecodeUnicode=Me;exports.b64EncodeUnicode=ga;exports.binarySearchArray=Ye;exports.cellToRange=yr;exports.characterSpacingControlType=Ms;exports.checkForSubstrings=Xr;exports.checkParagraphHasBullet=qr;exports.checkParagraphHasIndent=Jr;exports.checkParagraphHasIndentByStyle=Ws;exports.codeToBlob=cr;exports.composeBody=le;exports.composeInterceptors=Xn;exports.concatMatrixArray=li;exports.convertBodyToHtml=Ii;exports.covertTextRunToHtml=ae;exports.createInterceptorKey=da;exports.createInternalEditorID=Fo;exports.createRowColIter=oe;exports.debounce=Oi;exports.dedupe=ri;exports.deepCompare=fe;exports.deleteContent=ks;exports.extractPureTextFromCell=ao;exports.fromCallback=on;exports.fromObservable=si;exports.generateTemporarySnap=Ia;exports.getArrayLength=y;exports.getBodySlice=Le;exports.getBodySliceHtml=bt;exports.getBorderStyleType=Yr;exports.getCellValueType=wr;exports.getColorStyle=$;exports.getDocsUpdateBody=Tt;exports.getReverseDirection=hr;exports.getSheetBlocksFromSnapshot=Ta;exports.getTypeFromPermissionItemList=di;exports.getWorksheetUID=Eo;exports.groupBy=ai;exports.handleJsonToDom=jr;exports.handleStyleToString=Kr;exports.hashAlgorithm=Qr;exports.horizontalLineSegmentsSubtraction=Ee;exports.insertMatrixArray=ne;exports.insertTextToContent=Bs;exports.isBlackColor=Lr;exports.isBooleanString=ia;exports.isCellV=Ur;exports.isEmptyCell=Gr;exports.isFormulaId=Vr;exports.isFormulaString=$r;exports.isICellData=br;exports.isInternalEditorID=Wo;exports.isNullCell=vr;exports.isNumeric=zn;exports.isObserver=Vs;exports.isRangesEqual=ea;exports.isRealNum=Zr;exports.isSafeNumeric=ra;exports.isSameStyleTextRun=Fs;exports.isUnitRangesEqual=sa;exports.isValidRange=zr;exports.isWhiteColor=Tr;exports.makeCellRangeToRangeData=kr;exports.makeCellToSelection=Br;exports.mergeOverrideWithDependencies=Kn;exports.mergeSets=oa;exports.mergeWorksheetSnapshotWithDefault=Dn;exports.moveMatrixArray=ie;exports.moveRangeByOffset=vi;exports.normalizeTextRuns=Ae;exports.numberToABC=gi;exports.numberToListABC=Ri;exports.orderSearchArray=ze;exports.queryObjectMatrix=wi;exports.remove=jt;exports.repeatStringNumTimes=qs;exports.replaceInDocumentBody=ua;exports.requestImmediateMacroTask=la;exports.rotate=oi;exports.runOnLifecycle=ve;exports.searchArray=ur;exports.selectionToArray=Dr;exports.sequence=tn;exports.sequenceAsync=Qs;exports.sequenceExecute=me;exports.sequenceExecuteAsync=xi;exports.shallowEqual=na;exports.sliceMatrixArray=ui;exports.sortRules=mi;exports.sortRulesByDesc=Ci;exports.sortRulesFactory=ot;exports.spliceArray=re;exports.textDecoder=Xt;exports.textEncoder=Ct;exports.throttle=aa;exports.toDisposable=v;exports.transformDocumentDataToSnapshot=La;exports.transformSnapshotToDocumentData=Sa;exports.transformSnapshotToWorkbookData=Na;exports.transformWorkbookDataToSnapshot=Aa;
9
+ ErrorCode: ${(u=a.error)==null?void 0:u.code}:${(c=a.error)==null?void 0:c.message}`);return{snapshot:o}}async function Ta(t,e){const s=t.workbook;if(!s)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(s.blockMeta).forEach(([i,o])=>{const a=o.blocks.map(async l=>{const u={unitID:s.unitID,type:O.UNIVER_SHEET,blockID:l},{block:c}=await e.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||{}),tr=(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))(tr||{}),er=(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))(er||{}),sr=(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))(sr||{}),nr=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(nr||{});ar();exports.ABCToNumber=fi;exports.AbsoluteRefType=w;exports.ActionIterator=de;exports.AlignTypeH=Ds;exports.AlignTypeV=ps;exports.AutoFillSeries=ze;exports.BaselineOffset=it;exports.BlockType=_s;exports.BooleanNumber=C;exports.BorderStyleTypes=T;exports.BorderType=Xe;exports.BulletAlignment=K;exports.COLORS=ee;exports.CellValueType=Q;exports.ClientSnapshotServerService=Ea;exports.Color=tt;exports.ColorBuilder=Gt;exports.ColorKit=k;exports.ColorType=W;exports.ColumnSeparatorType=gs;exports.CommandType=Rt;exports.CommonHideTypes=qe;exports.ConfigService=On;exports.ContentAlignment=Ts;exports.ContextService=en;exports.CopyPasteType=Je;exports.CustomRangeType=ds;exports.DEFAULT_CELL=Si;exports.DEFAULT_DOC=Te;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Zi;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Ho;exports.DEFAULT_RANGE=Ai;exports.DEFAULT_RANGE_ARRAY=lt;exports.DEFAULT_SELECTION=Ni;exports.DEFAULT_SLIDE=Js;exports.DEFAULT_STYLES=wt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Tn;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=so;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Un;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=oo;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=wn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=ro;exports.DEFAULT_WORKSHEET_ROW_COUNT=Ln;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=eo;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=bn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=no;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=vn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=io;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Bn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Wn;exports.DashStyleType=Ns;exports.DataStreamTreeNodeType=un;exports.DataStreamTreeTokenType=Ie;exports.DataValidationErrorStyle=Qn;exports.DataValidationImeMode=tr;exports.DataValidationOperator=er;exports.DataValidationRenderMode=zn;exports.DataValidationStatus=nr;exports.DataValidationType=sr;exports.DesktopLogService=nn;exports.DeveloperMetadataVisibility=Ze;exports.Dimension=Qe;exports.Direction=ts;exports.Disposable=p;exports.DisposableCollection=ge;exports.DocStyleType=cs;exports.DocumentDataModel=st;exports.EDITOR_ACTIVATED=Mn;exports.EXTENSION_NAMES=Zs;exports.Entry=se;exports.EntryIterator=Ys;exports.ErrorService=In;exports.EventState=$s;exports.FOCUSING_DOC=vt;exports.FOCUSING_EDITOR_BUT_HIDDEN=go;exports.FOCUSING_EDITOR_INPUT_FORMULA=Ro;exports.FOCUSING_EDITOR_STANDALONE=Co;exports.FOCUSING_FORMULA_EDITOR=Pn;exports.FOCUSING_SHEET=ht;exports.FOCUSING_SLIDE=Ut;exports.FOCUSING_UNIVER_EDITOR=mo;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Oo;exports.FloatingObjectManagerService=An;exports.FollowNumberWithType=hs;exports.FontItalic=Mt;exports.FontStyleType=bs;exports.FontWeight=Pt;exports.FormatType=es;exports.GlyphType=ut;exports.GridType=fs;exports.HLSColor=ls;exports.HorizontalAlign=Z;exports.ICommandService=mt;exports.IConfigService=Cn;exports.IContextService=gt;exports.IFloatingObjectManagerService=Nn;exports.ILocalStorageService=ha;exports.ILogService=J;exports.IPermissionService=Ue;exports.IResourceLoaderService=De;exports.IResourceManagerService=Yt;exports.ISnapshotServerService=fa;exports.IUndoRedoService=yt;exports.IUniverInstanceService=q;exports.InterceptorManager=_a;exports.InterpolationPointType=ss;exports.KeyIterator=js;exports.LRUHelper=at;exports.LRUMap=ys;exports.LifecycleStages=b;exports.LocaleService=dt;exports.LocaleType=nt;exports.LogLevel=sn;exports.MemoryCursor=ln;exports.NamedStyleType=Is;exports.NilCommand=rn;exports.NumberUnitType=Us;exports.ObjectMatrix=G;exports.ObjectRelativeFromH=ws;exports.ObjectRelativeFromV=vs;exports.Observable=Vt;exports.ObservableHooks=ca;exports.Observer=$t;exports.OnLifecycle=we;exports.PRESET_LIST_TYPE=Gi;exports.PageElementType=xs;exports.PageOrientType=Ps;exports.PageType=_e;exports.ParagraphElementType=ms;exports.PermissionPoint=zs;exports.PermissionStatus=Re;exports.Plugin=he;exports.PositionedObjectLayoutType=Os;exports.PresetListType=Wt;exports.ProtectionType=ns;exports.RANGE_TYPE=x;exports.RGBA_PAREN=_r;exports.RGB_PAREN=dr;exports.Range=et;exports.Rectangle=X;exports.RedoCommand=jn;exports.RedoCommandId=Gn;exports.RefAlias=_i;exports.Registry=Ce;exports.RegistryAsMap=Oe;exports.RelativeDate=rs;exports.RelativeSlideLink=Hs;exports.ResourceManagerService=Fn;exports.RgbColor=xt;exports.RxDisposable=ni;exports.SectionType=Es;exports.ShapeType=is;exports.SheetTypes=Bt;exports.SheetViewModel=pn;exports.SlideDataModel=be;exports.SpacingRule=As;exports.Styles=Sn;exports.THEME_COLORS=as;exports.TabStopAlignment=Ss;exports.TextDecoration=os;exports.TextDirection=_t;exports.TextDirectionType=Rs;exports.TextX=zt;exports.TextXActionType=I;exports.ThemeColor=Ht;exports.ThemeColorType=H;exports.ThemeColors=kt;exports.ThemeService=pe;exports.Tools=R;exports.UndoCommand=Vn;exports.UndoCommandId=$n;exports.UnitModel=Kt;exports.Univer=Qo;exports.UniverEditablePermission=pt;exports.UniverEditablePermissionPoint=Hn;exports.UniverInstanceType=O;exports.UpdateDocsAttributeType=P;exports.UserManagerService=Yn;exports.ValueIterator=Ks;exports.VerticalAlign=rt;exports.WidthType=Ls;exports.Worksheet=Et;exports.WrapStrategy=ft;exports.WrapTextType=Cs;exports.afterInitApply=Hi;exports.b64DecodeUnicode=Me;exports.b64EncodeUnicode=ga;exports.binarySearchArray=Ye;exports.cellToRange=zr;exports.characterSpacingControlType=Ms;exports.checkForSubstrings=Xr;exports.checkParagraphHasBullet=qr;exports.checkParagraphHasIndent=Jr;exports.checkParagraphHasIndentByStyle=Ws;exports.codeToBlob=cr;exports.composeBody=le;exports.composeInterceptors=Xn;exports.concatMatrixArray=li;exports.convertBodyToHtml=Ii;exports.covertTextRunToHtml=ae;exports.createInterceptorKey=da;exports.createInternalEditorID=Fo;exports.createRowColIter=oe;exports.debounce=Oi;exports.dedupe=ri;exports.deepCompare=fe;exports.deleteContent=ks;exports.extractPureTextFromCell=ao;exports.fromCallback=on;exports.fromObservable=si;exports.generateTemporarySnap=Ia;exports.getArrayLength=z;exports.getBodySlice=Le;exports.getBodySliceHtml=bt;exports.getBorderStyleType=Yr;exports.getCellValueType=wr;exports.getColorStyle=$;exports.getDocsUpdateBody=Tt;exports.getReverseDirection=hr;exports.getSheetBlocksFromSnapshot=Ta;exports.getTypeFromPermissionItemList=di;exports.getWorksheetUID=Eo;exports.groupBy=ai;exports.handleJsonToDom=jr;exports.handleStyleToString=Kr;exports.hashAlgorithm=Qr;exports.horizontalLineSegmentsSubtraction=Ee;exports.insertMatrixArray=ne;exports.insertTextToContent=Bs;exports.isBlackColor=Lr;exports.isBooleanString=ia;exports.isCellV=Ur;exports.isEmptyCell=Gr;exports.isFormulaId=Vr;exports.isFormulaString=$r;exports.isICellData=br;exports.isInternalEditorID=Wo;exports.isNullCell=vr;exports.isNumeric=yn;exports.isObserver=Vs;exports.isRangesEqual=ea;exports.isRealNum=Zr;exports.isSafeNumeric=ra;exports.isSameStyleTextRun=Fs;exports.isUnitRangesEqual=sa;exports.isValidRange=yr;exports.isWhiteColor=Tr;exports.makeCellRangeToRangeData=kr;exports.makeCellToSelection=Br;exports.mergeOverrideWithDependencies=Kn;exports.mergeSets=oa;exports.mergeWorksheetSnapshotWithDefault=Dn;exports.moveMatrixArray=ie;exports.moveRangeByOffset=vi;exports.normalizeTextRuns=Ae;exports.numberToABC=gi;exports.numberToListABC=Ri;exports.orderSearchArray=ye;exports.queryObjectMatrix=wi;exports.remove=jt;exports.repeatStringNumTimes=qs;exports.replaceInDocumentBody=ua;exports.requestImmediateMacroTask=la;exports.rotate=oi;exports.runOnLifecycle=ve;exports.searchArray=ur;exports.selectionToArray=Dr;exports.sequence=tn;exports.sequenceAsync=Qs;exports.sequenceExecute=me;exports.sequenceExecuteAsync=xi;exports.shallowEqual=na;exports.sliceMatrixArray=ui;exports.sortRules=mi;exports.sortRulesByDesc=Ci;exports.sortRulesFactory=ot;exports.spliceArray=re;exports.textDecoder=Xt;exports.textEncoder=Ct;exports.throttle=aa;exports.toDisposable=v;exports.transformDocumentDataToSnapshot=La;exports.transformSnapshotToDocumentData=Sa;exports.transformSnapshotToWorkbookData=Na;exports.transformWorkbookDataToSnapshot=Aa;