@univerjs/core 0.7.0 → 0.8.0-beta.1
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.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +8 -8
- package/lib/es/facade.js +135 -110
- package/lib/es/index.js +10280 -8605
- package/lib/facade.js +135 -110
- package/lib/index.js +10280 -8605
- package/lib/types/common/number.d.ts +6 -0
- package/lib/types/facade/f-univer.d.ts +32 -1
- package/lib/types/facade/f-util.d.ts +2 -2
- package/lib/types/index.d.ts +3 -4
- package/lib/types/services/log/log.service.d.ts +1 -0
- package/lib/types/services/resource-manager/resource-manager.service.d.ts +5 -2
- package/lib/types/services/user-manager/user-manager.service.d.ts +3 -16
- package/lib/types/shared/common.d.ts +15 -1
- package/lib/types/shared/index.d.ts +1 -1
- package/lib/types/shared/numfmt.d.ts +23 -3
- package/lib/types/shared/object-matrix.d.ts +2 -0
- package/lib/types/sheets/sheet-skeleton.d.ts +0 -4
- package/lib/types/sheets/util.d.ts +2 -2
- package/lib/types/sheets/worksheet.d.ts +11 -4
- package/lib/types/types/interfaces/i-style-data.d.ts +1 -9
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +8 -8
- package/package.json +5 -7
- package/lib/types/shared/types/numfmt.type.d.ts +0 -223
package/lib/umd/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(f,Ce){typeof exports=="object"&&typeof module<"u"?Ce(exports,require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi"),require("@univerjs/themes")):typeof define=="function"&&define.amd?define(["exports","rxjs","rxjs/operators","@wendellhu/redi","@univerjs/themes"],Ce):(f=typeof globalThis<"u"?globalThis:f||self,Ce(f.UniverCore={},f.rxjs,f.rxjs.operators,f["@wendellhu/redi"],f.UniverThemes))})(this,function(f,Ce,Ft,We,ac){"use strict";var o0=Object.defineProperty;var a0=(f,Ce,Ft)=>Ce in f?o0(f,Ce,{enumerable:!0,configurable:!0,writable:!0,value:Ft}):f[Ce]=Ft;var R=(f,Ce,Ft)=>a0(f,typeof Ce!="symbol"?Ce+"":Ce,Ft);var sc,ic;function lc(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const pr=typeof global<"u"?global:typeof self<"u"?self:window;function uc(){const t=new Map;let n=0;typeof pr.requestIdleCallback!="function"&&(pr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof pr.cancelIdleCallback!="function"&&(pr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function cc(){uc()}function Fn(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function hc(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function dc(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function fc(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function gc(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function mc(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function _c(e){return Array.isArray(e)?e:[e]}function pc(e,t){t.forEach(n=>e.add(n))}function Ui(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class ds extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class Ec extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Pi(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function ki(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function Cc(e){return e instanceof Ce.Subscription||e instanceof Ce.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function tt(e){let t=!1;return e?Cc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:tt(()=>{})}function Rc(e){return tt(()=>{e.unsubscribe()})}class Er{constructor(){R(this,"_disposables",new Set)}add(t){const n=tt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){R(this,"_disposed",!1);R(this,"_collection",new Er)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Ic extends st{constructor(){super(...arguments);R(this,"dispose$",new Ce.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class Sc extends st{constructor(n){super();R(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const _n=We.createIdentifier("univer.context-service");class Fi extends st{constructor(){super(...arguments);R(this,"_contextChanged$",new Ce.Subject);R(this,"contextChanged$",this._contextChanged$.asObservable());R(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new Ce.Observable(r=>{const s=this._contextChanged$.pipe(Ce.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var xi=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(xi||{});const wt=We.createIdentifier("univer.log");class Bi extends st{constructor(){super(...arguments);R(this,"_logLevel",3);R(this,"_deduction",new Set)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=vc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function vc(...e){return e.map(t=>JSON.stringify(t)).join("")}var Oc=Object.getOwnPropertyDescriptor,wc=(e,t,n,r)=>{for(var s=r>1?void 0:r?Oc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},$i=(e,t)=>(n,r)=>t(n,r,e),xn=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(xn||{});const Bn=We.createIdentifier("univer.core.command-service");class bc{constructor(){R(this,"_commands",new Map);R(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),tt(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Hi={id:"nil",type:0,handler:()=>!0};f.CommandService=class extends st{constructor(n,r){super();R(this,"_commandRegistry");R(this,"_beforeCommandExecutionListeners",[]);R(this,"_commandExecutedListeners",[]);R(this,"_multiCommandDisposables",new Map);R(this,"_commandExecutingLevel",0);R(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new bc,this.registerCommand(Hi)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),tt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),tt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof ds)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=fc(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof ds)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),tt(()=>Fn(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new Ac(n.id);const o=new Er;o.add(this._commandRegistry.registerCommand(s)),o.add(tt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return tt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}},f.CommandService=wc([$i(0,We.Inject(We.Injector)),$i(1,wt)],f.CommandService);class Ac{constructor(t){R(this,"name");R(this,"multi",!0);R(this,"type",0);R(this,"priority",0);R(this,"_implementations",[]);R(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(wt),s=t.get(_n),i=t.get(We.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),tt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Cr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return ki(r)}function Tc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Pi(r)}function Wi(e){return new Ce.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function fs(e){return function(n){return new Ce.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function yc(e=0){return t=>{let n=[];return t.pipe(Ce.tap(r=>n.push(r)),Ce.debounceTime(e),Ce.map(()=>n),Ce.tap(()=>n=[]))}}function Nc(e){const t=new Ce.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(Ce.take(1))}function Mc(e,t){const n=new Ce.BehaviorSubject(t);return e.subscribe(n),n}const Dc=e=>new Promise(t=>{Ce.merge(Wi(e.onCommandExecuted.bind(e)).pipe(Ft.filter(([n])=>n.type===xn.MUTATION)),Ce.timer(300)).pipe(Ft.debounceTime(16),Ft.first()).subscribe(()=>{t()})});function ji(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function Lc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Yi(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function $n(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=ji(e,t):r=Yi(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Uc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const Hn=2,zi=1;function Pc(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,g=u,E=i,I=s;return Math.abs(a-n)>Hn||Math.abs(l-r)>Hn||Math.abs(d-E)>Hn||Math.abs(g-I)>Hn||Math.abs(h-o)>zi}var Gi=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Gi||{}),qe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(qe||{}),Vi=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Vi||{}),Rt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(Rt||{}),Ki=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Ki||{}),Xi=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Xi||{}),qi=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(qi||{}),Ji=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Ji||{}),Zi=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Zi||{}),Qi=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Qi||{});function kc(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var eo=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(eo||{}),Wn=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(Wn||{}),Rr=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Rr||{}),to=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(to||{}),no=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(no||{}),ro=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(ro||{}),so=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(so||{}),io=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(io||{}),oo=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(oo||{}),ao=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(ao||{}),jn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(jn||{}),lo=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(lo||{}),bt=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(bt||{}),rn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(rn||{}),sn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(sn||{}),Ir=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Ir||{}),Sr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Sr||{}),xt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(xt||{}),ve=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ve||{}),zt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(zt||{}),ht=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ht||{}),vr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(vr||{});const Fc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let xc=e=>crypto.getRandomValues(new Uint8Array(e)),Bc=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},$c=(e,t=21)=>Bc(e,t|0,xc),Hc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Fc[n[e]&63];return t};const uo=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),Wc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function jc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Wc.test(e)){if(co(e))return!0;try{const r=new URL(ho(e)).hostname.split(".").pop();if(r&&uo.has(r))return!0}catch{return!1}}return!1}function co(e){return/^[a-zA-Z]+:\/\//.test(e)}function Yc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function ho(e){return co(e)?e:Yc(e)?`mailto://${e}`:`https://${e}`}const zc=/^-ms-/,Gc=/-([a-z])/g,Gt=["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"];function gs(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Vc(e,t):re.isObject(e)?Kc(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Vc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!gs(s,i))return!1}return!0}function Kc(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!gs(i,o))return!1}return!0}class re{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Gt.length;)r/=Gt.length,r-=1,n+=Gt[r%Gt.length];const s=t%Gt.length;return n+=Gt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Gt.length**i+Gt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return Bt(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return gs(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return jc(t)}static normalizeUrl(t){return ho(t)}static topLevelDomainCombiningString(){return[...uo].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(zc,"ms-").replace(Gc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function Bt(e=21,t){return t?$c(t,e)():Hc(e)}function ms(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const Xc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Or(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(_s(r,{...a,ed:Math.min(u,n)}))):o.push(_s(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function qc(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,g=[];c!=null&&(typeof c=="number"?g.push(`margin-top: ${c}px`):g.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?g.push(`margin-bottom: ${h}px`):g.push(`margin-bottom: ${h.v}px`)),d!=null&&g.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}>${Or(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=Or(e,o,r.length)),i}else return Or(e,0,e.dataStream.length)}function _s(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:g,va:E}=s;let I=e.slice(n,r);const b=[];return a===ve.TRUE&&(I=`<i>${I}</i>`),E===xt.SUPERSCRIPT?I=`<sup>${I}</sup>`:E===xt.SUBSCRIPT&&(I=`<sub>${I}</sub>`),(u==null?void 0:u.s)===ve.TRUE&&(I=`<u>${I}</u>`),(c==null?void 0:c.s)===ve.TRUE&&(I=`<s>${I}</s>`),l===ve.TRUE&&(I=`<strong>${I}</strong>`),i&&b.push(`font-family: ${i}`),g&&b.push(`color: ${g.rgb}`),o&&b.push(`font-size: ${o}pt`),h&&b.push("text-decoration: overline"),d&&b.push(`background: ${d.rgb}`),b.length?`<span style="${b.join("; ")};">${I}</span>`:I}const fo={[vr.OFFICE]:{[ht.ACCENT1]:"#4472C4",[ht.ACCENT2]:"#ED7D31",[ht.ACCENT3]:"#A5A5A5",[ht.ACCENT4]:"#70AD47",[ht.ACCENT5]:"#5B9BD5",[ht.ACCENT6]:"#70AD47",[ht.DARK1]:"#000000",[ht.DARK2]:"#44546A",[ht.LIGHT1]:"#FFFFFF",[ht.LIGHT2]:"#E7E6E6",[ht.HYPERLINK]:"#0563C1",[ht.FOLLOWED_HYPERLINK]:"#954F72"}};class wr{constructor(){R(this,"_themeValue",ht.LIGHT1);R(this,"_themeColors");R(this,"_themeTint");R(this,"_rgbValue","");R(this,"_colorType");this._colorType=Rt.UNSUPPORTED,this._themeColors=vr.OFFICE,this._themeTint=0}asRgbColor(){return new br(this._rgbValue,this)}asThemeColor(){return new Ar(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Rt.THEME:return this.asThemeColor();case Rt.RGB:return this.asRgbColor();case Rt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=Rt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Rt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Rt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Rt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class on{constructor(t){R(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new wr().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new on(this._builder)}equals(t){return!1}}class go{constructor(t){R(this,"_saturation",0);R(this,"_hue",0);R(this,"_lightness",0);R(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),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),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new wr;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const vt=class vt extends on{constructor(n,r){super(r);R(this,"_cssString");R(this,"_red");R(this,"_green");R(this,"_blue");R(this,"_alpha");let s=n.match(vt.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(vt.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return on.rgbColorToHexValue(this)}getRed(){let n=this._red+vt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+vt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+vt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return Rt.RGB}clone(){return new vt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof vt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};R(vt,"RGB_COLOR_AMT",0),R(vt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),R(vt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let br=vt;const en=class en extends on{constructor(n,r,s,i){super(i);R(this,"_themeColorType");R(this,"_themeTint");R(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=fo[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(en._cacheThemeColor.has(this._themeColors)){if(s=en._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,en._cacheThemeColor.set(this._themeColors,s);const i=new go(on.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new en(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof en?n._themeColorType===this._themeColorType:!1}getColorType(){return Rt.THEME}getThemeColorType(){return this._themeColorType}};R(en,"_cacheThemeColor",new Map);let Ar=en;const Jc="rgb(",Zc="rgba(",ps={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 At{constructor(t){R(this,"_color");R(this,"_rgbColor");R(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof At){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=mo(t);if(n==null){this._setNullColor();return}this._color=n;const r=rh(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new At(t).toRgb(),i=new At(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new At(l)}static getContrastRatio(t,n){const r=new At(t).getLuminance(),s=new At(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[Tr(Math.round(n).toString(16)),Tr(Math.round(r).toString(16)),Tr(Math.round(s).toString(16)),Tr(Math.round(i*255).toString(16))];return t&&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 ah(this.toRgb())}toHsl(){return oh(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new At(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new At(n)}setAlpha(t){return new At({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=Es(t),n=Es(n),r=Es(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t: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 Tr=e=>e.length===1?`0${e}`:e,Es=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),mo=e=>{if(uh(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ps[t]){const n=ps[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Qc(t);if(t.startsWith("rgb"))return eh(t);if(t.startsWith("hsl"))return th(t);if(t.startsWith("hsv"))return nh(t)},Qc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},eh=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},th=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},nh=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},rh=e=>{const t=mo(e);if(t!=null)return"r"in t?t:"l"in t?sh(t):ih(t)},Cs=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),sh=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=Cs(u,l,t+1/3),i=Cs(u,l,t),o=Cs(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},ih=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],g={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(g.a=e.a),g},oh=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},ah=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},lh=e=>e==null,uh=e=>!lh(e)&&typeof e=="object";function ch(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function hh(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var Pe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Pe||{});function dh(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function fh(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return zt.STRING;if(typeof e.v=="number")return zt.NUMBER;if(typeof e.v=="boolean")return zt.BOOLEAN}function gh(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function mh(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),nt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(nt||{});function _h(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var _o=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(_o||{}),po=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(po||{});function ph(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:g}=n[u];if(e===c&&t===d){i=h,o=g,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=g){i=h,o=g,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var pn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(pn||{});function Eo(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,g=n;if(r&&i){const{startRow:E,startColumn:I,endRow:b,endColumn:M,startY:V,endY:Y,startX:ie,endX:N}=i;c=E,h=I,d=b,g=M,o=V,a=Y,l=ie,u=N}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,g=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:g,startY:o,endY:a,startX:l,endX:u}}const Eh=Eo;function Ch(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function Co(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Rs(e){return Co(e)&&(e==null?void 0:e.coverable)!==!1}function Lt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new wr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function Rh(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function Ih(e){return re.isString(e)&&e.length>0}function Sh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Lt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Lt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Lt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Lt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,g,E,I,b,M;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${yr((a=e.bd)==null?void 0:a.b.s)} ${(l=Lt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${yr((c=e.bd)==null?void 0:c.t.s)} ${(h=Lt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${yr((g=e.bd)==null?void 0:g.r.s)} ${(E=Lt(e.bd.r.cl))!=null?E:""}; `),(I=e.bd)!=null&&I.l&&(n+=`border-left: ${yr((b=e.bd)==null?void 0:b.l.s)} ${(M=Lt(e.bd.l.cl))!=null?M:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Lt(e.cl)}; `)}],["va",()=>{e.va===xt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===xt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===jn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===jn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===bt.LEFT?n+="text-align: left; ":e.ht===bt.RIGHT?n+="text-align: right; ":e.ht===bt.CENTER?n+="text-align: center; ":e.ht===bt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===rn.BOTTOM?n+="vertical-align: bottom; ":e.vt===rn.TOP?n+="vertical-align: top; ":e.vt===rn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===sn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===sn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,g,E,I,b,M;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(g=e.pd)==null?void 0:g.r}pt`;(E=e.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(I=e.pd)!=null&&I.t&&(n+=`padding-top: ${a}; `),(b=e.pd)!=null&&b.l&&(n+=`padding-left: ${l}; `),(M=e.pd)!=null&&M.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function yr(e){let t="";return e===qe.NONE?t="none":e===qe.THIN?t="0.5pt solid":e===qe.HAIR?t="0.5pt double":e===qe.DOTTED?t="0.5pt dotted":e===qe.DASHED||e===qe.DASH_DOT?t="0.5pt dashed":e===qe.DASH_DOT_DOT?t="0.5pt dotted":e===qe.DOUBLE?t="0.5pt double":e===qe.MEDIUM?t="1pt solid":e===qe.MEDIUM_DASHED||e===qe.MEDIUM_DASH_DOT?t="1pt dashed":e===qe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===qe.SLANT_DASH_DOT?t="0.5pt dashed":e===qe.THICK&&(t="1.5pt solid"),t}function vh(e){let t=0;if(e=e.trim(),e==="none")t=qe.NONE;else if(e==="0.5pt solid")t=qe.THIN;else if(e==="0.5pt double")t=qe.HAIR;else if(e==="0.5pt dotted")t=qe.DOTTED;else if(e==="0.5pt dashed")t=qe.DASHED;else if(e==="1pt solid")t=qe.MEDIUM;else if(e==="1pt dashed")t=qe.MEDIUM_DASHED;else if(e==="1pt dotted")t=qe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=qe.THICK;else if(!e.includes("none"))t=qe.THIN;else return qe.NONE;return t}function Oh(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function wh(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function bh(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Is(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>Is(e[n],t[n])):e===t:!1}function Ro(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Is(n,r)}function Ah(e,t){return t.some(n=>e.indexOf(n)>-1)}function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nr={exports:{}},Th=Nr.exports,Io;function yh(){return Io||(Io=1,function(e,t){(function(n,r){e.exports=r()})(Th,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",g="year",E="date",I="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,M=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,V={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var A=["th","st","nd","rd"],w=L%100;return"["+L+(A[(w-20)%10]||A[w]||A[0])+"]"}},Y=function(L,A,w){var x=String(L);return!x||x.length>=A?L:""+Array(A+1-x.length).join(w)+L},ie={s:Y,z:function(L){var A=-L.utcOffset(),w=Math.abs(A),x=Math.floor(w/60),$=w%60;return(A<=0?"+":"-")+Y(x,2,"0")+":"+Y($,2,"0")},m:function L(A,w){if(A.date()<w.date())return-L(w,A);var x=12*(w.year()-A.year())+(w.month()-A.month()),$=A.clone().add(x,h),K=w-$<0,oe=A.clone().add(x+(K?-1:1),h);return+(-(x+(w-$)/(K?$-oe:oe-$))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:h,y:g,w:c,d:u,D:E,h:l,m:a,s:o,ms:i,Q:d}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},N="en",T={};T[N]=V;var j="$isDayjsObject",Q=function(L){return L instanceof W||!(!L||!L[j])},ge=function L(A,w,x){var $;if(!A)return N;if(typeof A=="string"){var K=A.toLowerCase();T[K]&&($=K),w&&(T[K]=w,$=K);var oe=A.split("-");if(!$&&oe.length>1)return L(oe[0])}else{var fe=A.name;T[fe]=A,$=fe}return!x&&$&&(N=$),$||!x&&N},ce=function(L,A){if(Q(L))return L.clone();var w=typeof A=="object"?A:{};return w.date=L,w.args=arguments,new W(w)},p=ie;p.l=ge,p.i=Q,p.w=function(L,A){return ce(L,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var W=function(){function L(w){this.$L=ge(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[j]=!0}var A=L.prototype;return A.parse=function(w){this.$d=function(x){var $=x.date,K=x.utc;if($===null)return new Date(NaN);if(p.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var oe=$.match(b);if(oe){var fe=oe[2]-1||0,me=(oe[7]||"0").substring(0,3);return K?new Date(Date.UTC(oe[1],fe,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,me)):new Date(oe[1],fe,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,me)}}return new Date($)}(w),this.init()},A.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},A.$utils=function(){return p},A.isValid=function(){return this.$d.toString()!==I},A.isSame=function(w,x){var $=ce(w);return this.startOf(x)<=$&&$<=this.endOf(x)},A.isAfter=function(w,x){return ce(w)<this.startOf(x)},A.isBefore=function(w,x){return this.endOf(x)<ce(w)},A.$g=function(w,x,$){return p.u(w)?this[x]:this.set($,w)},A.unix=function(){return Math.floor(this.valueOf()/1e3)},A.valueOf=function(){return this.$d.getTime()},A.startOf=function(w,x){var $=this,K=!!p.u(x)||x,oe=p.p(w),fe=function(G,z){var he=p.w($.$u?Date.UTC($.$y,z,G):new Date($.$y,z,G),$);return K?he:he.endOf(u)},me=function(G,z){return p.w($.toDate()[G].apply($.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(z)),$)},Me=this.$W,Te=this.$M,v=this.$D,B="set"+(this.$u?"UTC":"");switch(oe){case g:return K?fe(1,0):fe(31,11);case h:return K?fe(1,Te):fe(0,Te+1);case c:var X=this.$locale().weekStart||0,J=(Me<X?Me+7:Me)-X;return fe(K?v-J:v+(6-J),Te);case u:case E:return me(B+"Hours",0);case l:return me(B+"Minutes",1);case a:return me(B+"Seconds",2);case o:return me(B+"Milliseconds",3);default:return this.clone()}},A.endOf=function(w){return this.startOf(w,!1)},A.$set=function(w,x){var $,K=p.p(w),oe="set"+(this.$u?"UTC":""),fe=($={},$[u]=oe+"Date",$[E]=oe+"Date",$[h]=oe+"Month",$[g]=oe+"FullYear",$[l]=oe+"Hours",$[a]=oe+"Minutes",$[o]=oe+"Seconds",$[i]=oe+"Milliseconds",$)[K],me=K===u?this.$D+(x-this.$W):x;if(K===h||K===g){var Me=this.clone().set(E,1);Me.$d[fe](me),Me.init(),this.$d=Me.set(E,Math.min(this.$D,Me.daysInMonth())).$d}else fe&&this.$d[fe](me);return this.init(),this},A.set=function(w,x){return this.clone().$set(w,x)},A.get=function(w){return this[p.p(w)]()},A.add=function(w,x){var $,K=this;w=Number(w);var oe=p.p(x),fe=function(Te){var v=ce(K);return p.w(v.date(v.date()+Math.round(Te*w)),K)};if(oe===h)return this.set(h,this.$M+w);if(oe===g)return this.set(g,this.$y+w);if(oe===u)return fe(1);if(oe===c)return fe(7);var me=($={},$[a]=r,$[l]=s,$[o]=n,$)[oe]||1,Me=this.$d.getTime()+w*me;return p.w(Me,this)},A.subtract=function(w,x){return this.add(-1*w,x)},A.format=function(w){var x=this,$=this.$locale();if(!this.isValid())return $.invalidDate||I;var K=w||"YYYY-MM-DDTHH:mm:ssZ",oe=p.z(this),fe=this.$H,me=this.$m,Me=this.$M,Te=$.weekdays,v=$.months,B=$.meridiem,X=function(z,he,le,H){return z&&(z[he]||z(x,K))||le[he].slice(0,H)},J=function(z){return p.s(fe%12||12,z,"0")},G=B||function(z,he,le){var H=z<12?"AM":"PM";return le?H.toLowerCase():H};return K.replace(M,function(z,he){return he||function(le){switch(le){case"YY":return String(x.$y).slice(-2);case"YYYY":return p.s(x.$y,4,"0");case"M":return Me+1;case"MM":return p.s(Me+1,2,"0");case"MMM":return X($.monthsShort,Me,v,3);case"MMMM":return X(v,Me);case"D":return x.$D;case"DD":return p.s(x.$D,2,"0");case"d":return String(x.$W);case"dd":return X($.weekdaysMin,x.$W,Te,2);case"ddd":return X($.weekdaysShort,x.$W,Te,3);case"dddd":return Te[x.$W];case"H":return String(fe);case"HH":return p.s(fe,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return G(fe,me,!0);case"A":return G(fe,me,!1);case"m":return String(me);case"mm":return p.s(me,2,"0");case"s":return String(x.$s);case"ss":return p.s(x.$s,2,"0");case"SSS":return p.s(x.$ms,3,"0");case"Z":return oe}return null}(z)||oe.replace(":","")})},A.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},A.diff=function(w,x,$){var K,oe=this,fe=p.p(x),me=ce(w),Me=(me.utcOffset()-this.utcOffset())*r,Te=this-me,v=function(){return p.m(oe,me)};switch(fe){case g:K=v()/12;break;case h:K=v();break;case d:K=v()/3;break;case c:K=(Te-Me)/6048e5;break;case u:K=(Te-Me)/864e5;break;case l:K=Te/s;break;case a:K=Te/r;break;case o:K=Te/n;break;default:K=Te}return $?K:p.a(K)},A.daysInMonth=function(){return this.endOf(h).$D},A.$locale=function(){return T[this.$L]},A.locale=function(w,x){if(!w)return this.$L;var $=this.clone(),K=ge(w,x,!0);return K&&($.$L=K),$},A.clone=function(){return p.w(this.$d,this)},A.toDate=function(){return new Date(this.valueOf())},A.toJSON=function(){return this.isValid()?this.toISOString():null},A.toISOString=function(){return this.$d.toISOString()},A.toString=function(){return this.$d.toUTCString()},L}(),O=W.prototype;return ce.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",g],["$D",E]].forEach(function(L){O[L[1]]=function(A){return this.$g(A,L[0],L[1])}}),ce.extend=function(L,A){return L.$i||(L(A,W,ce),L.$i=!0),ce},ce.locale=ge,ce.isDayjs=Q,ce.unix=function(L){return ce(1e3*L)},ce.en=T[N],ce.Ls=T,ce.p={},ce})}(Nr)),Nr.exports}var Nh=yh();const $t=Et(Nh);var Mr={exports:{}},Mh=Mr.exports,So;function Dh(){return So||(So=1,function(e,t){(function(n,r){e.exports=r()})(Mh,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(Mr)),Mr.exports}var Lh=Dh();const Uh=Et(Lh);var Dr={exports:{}},Ph=Dr.exports,vo;function kh(){return vo||(vo=1,function(e,t){(function(n,r){e.exports=r()})(Ph,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(b){return(b=+b)+(b>68?1900:2e3)},c=function(b){return function(M){this[b]=+M}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(M){if(!M||M==="Z")return 0;var V=M.match(/([+-]|\d\d)/g),Y=60*V[1]+(+V[2]||0);return Y===0?0:V[0]==="+"?-Y:Y}(b)}],d=function(b){var M=l[b];return M&&(M.indexOf?M:M.s.concat(M.f))},g=function(b,M){var V,Y=l.meridiem;if(Y){for(var ie=1;ie<=24;ie+=1)if(b.indexOf(Y(ie,0,M))>-1){V=ie>12;break}}else V=b===(M?"pm":"PM");return V},E={A:[a,function(b){this.afternoon=g(b,!1)}],a:[a,function(b){this.afternoon=g(b,!0)}],Q:[s,function(b){this.month=3*(b-1)+1}],S:[s,function(b){this.milliseconds=100*+b}],SS:[i,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(b){var M=l.ordinal,V=b.match(/\d+/);if(this.day=V[0],M)for(var Y=1;Y<=31;Y+=1)M(Y).replace(/\[|\]/g,"")===b&&(this.day=Y)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(b){var M=d("months"),V=(d("monthsShort")||M.map(function(Y){return Y.slice(0,3)})).indexOf(b)+1;if(V<1)throw new Error;this.month=V%12||V}],MMMM:[a,function(b){var M=d("months").indexOf(b)+1;if(M<1)throw new Error;this.month=M%12||M}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(b){this.year=u(b)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function I(b){var M,V;M=b,V=l&&l.formats;for(var Y=(b=M.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(ce,p,W){var O=W&&W.toUpperCase();return p||V[W]||n[W]||V[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(L,A,w){return A||w.slice(1)})})).match(r),ie=Y.length,N=0;N<ie;N+=1){var T=Y[N],j=E[T],Q=j&&j[0],ge=j&&j[1];Y[N]=ge?{regex:Q,parser:ge}:T.replace(/^\[|\]$/g,"")}return function(ce){for(var p={},W=0,O=0;W<ie;W+=1){var L=Y[W];if(typeof L=="string")O+=L.length;else{var A=L.regex,w=L.parser,x=ce.slice(O),$=A.exec(x)[0];w.call(p,$),ce=ce.replace($,"")}}return function(K){var oe=K.afternoon;if(oe!==void 0){var fe=K.hours;oe?fe<12&&(K.hours+=12):fe===12&&(K.hours=0),delete K.afternoon}}(p),p}}return function(b,M,V){V.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(u=b.parseTwoDigitYear);var Y=M.prototype,ie=Y.parse;Y.parse=function(N){var T=N.date,j=N.utc,Q=N.args;this.$u=j;var ge=Q[1];if(typeof ge=="string"){var ce=Q[2]===!0,p=Q[3]===!0,W=ce||p,O=Q[2];p&&(O=Q[2]),l=this.$locale(),!ce&&O&&(l=V.Ls[O]),this.$d=function(x,$,K,oe){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*x);var fe=I($)(x),me=fe.year,Me=fe.month,Te=fe.day,v=fe.hours,B=fe.minutes,X=fe.seconds,J=fe.milliseconds,G=fe.zone,z=fe.week,he=new Date,le=Te||(me||Me?1:he.getDate()),H=me||he.getFullYear(),ne=0;me&&!Me||(ne=Me>0?Me-1:he.getMonth());var ae,_e=v||0,Ae=B||0,Ue=X||0,q=J||0;return G?new Date(Date.UTC(H,ne,le,_e,Ae,Ue,q+60*G.offset*1e3)):K?new Date(Date.UTC(H,ne,le,_e,Ae,Ue,q)):(ae=new Date(H,ne,le,_e,Ae,Ue,q),z&&(ae=oe(ae).week(z).toDate()),ae)}catch{return new Date("")}}(T,ge,j,V),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),W&&T!=this.format(ge)&&(this.$d=new Date("")),l={}}else if(ge instanceof Array)for(var L=ge.length,A=1;A<=L;A+=1){Q[1]=ge[A-1];var w=V.apply(this,Q);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}A===L&&(this.$d=new Date(""))}else ie.call(this,N)}}})}(Dr)),Dr.exports}var Fh=kh();const xh=Et(Fh);var Lr={exports:{}},Bh=Lr.exports,Oo;function $h(){return Oo||(Oo=1,function(e,t){(function(n,r){e.exports=r()})(Bh,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,g,E,I){var b=h.name?h:h.$locale(),M=o(b[d]),V=o(b[g]),Y=M||V.map(function(N){return N.slice(0,E)});if(!I)return Y;var ie=b.weekStart;return Y.map(function(N,T){return Y[(T+(ie||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(g){return g.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(E,I,b){return I||b.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Lr)),Lr.exports}var Hh=$h();const Wh=Et(Hh);var Ur={exports:{}},jh=Ur.exports,wo;function Yh(){return wo||(wo=1,function(e,t){(function(n,r){e.exports=r()})(jh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(g,E,I){var b=I&&I.toUpperCase();return E||d[I]||n[I]||d[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(M,V,Y){return V||Y.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Ur)),Ur.exports}var zh=Yh();const Gh=Et(zh);var Pr={exports:{}},Vh=Pr.exports,bo;function Kh(){return bo||(bo=1,function(e,t){(function(n,r){e.exports=r()})(Vh,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(I){var b={date:I,utc:!0,args:arguments};return new o(b)},l.utc=function(I){var b=a(this.toDate(),{locale:this.$L,utc:!0});return I?b.add(this.utcOffset(),n):b},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(I){I.utc&&(this.$u=!0),this.$utils().u(I.$offset)||(this.$offset=I.$offset),u.call(this,I)};var c=l.init;l.init=function(){if(this.$u){var I=this.$d;this.$y=I.getUTCFullYear(),this.$M=I.getUTCMonth(),this.$D=I.getUTCDate(),this.$W=I.getUTCDay(),this.$H=I.getUTCHours(),this.$m=I.getUTCMinutes(),this.$s=I.getUTCSeconds(),this.$ms=I.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(I,b){var M=this.$utils().u;if(M(I))return this.$u?0:M(this.$offset)?h.call(this):this.$offset;if(typeof I=="string"&&(I=function(N){N===void 0&&(N="");var T=N.match(r);if(!T)return null;var j=(""+T[0]).match(s)||["-",0,0],Q=j[0],ge=60*+j[1]+ +j[2];return ge===0?0:Q==="+"?ge:-ge}(I),I===null))return this;var V=Math.abs(I)<=16?60*I:I,Y=this;if(b)return Y.$offset=V,Y.$u=I===0,Y;if(I!==0){var ie=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(Y=this.local().add(V+ie,n)).$offset=V,Y.$x.$localOffset=ie}else Y=this.utc();return Y};var d=l.format;l.format=function(I){var b=I||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,b)},l.valueOf=function(){var I=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*I},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var g=l.toDate;l.toDate=function(I){return I==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var E=l.diff;l.diff=function(I,b,M){if(I&&this.$u===I.$u)return E.call(this,I,b,M);var V=this.local(),Y=a(I).local();return E.call(V,Y,b,M)}}})}(Pr)),Pr.exports}var Xh=Kh();const qh=Et(Xh);var kr={exports:{}},Jh=kr.exports,Ao;function Zh(){return Ao||(Ao=1,function(e,t){(function(n,r){e.exports=r()})(Jh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(kr)),kr.exports}var Qh=Zh();const ed=Et(Qh);var Fr={exports:{}},td=Fr.exports,To;function nd(){return To||(To=1,function(e,t){(function(n,r){e.exports=r()})(td,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),g=this.diff(d,n,!0);return g<0?o(this).startOf("week").week():Math.ceil(g)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(Fr)),Fr.exports}var rd=nd();const sd=Et(rd);var xr={exports:{}},id=xr.exports,yo;function od(){return yo||(yo=1,function(e,t){(function(n,r){e.exports=r()})(id,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(xr)),xr.exports}var ad=od();const ld=Et(ad);$t.extend(xh),$t.extend(Uh),$t.extend(ed),$t.extend(Wh),$t.extend(sd),$t.extend(ld),$t.extend(qh),$t.extend(Gh);function Br(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function ud(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function cd(e){if(e==null)return!1;const t=e.paragraphStyle;return No(t)}function No(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function Mo(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Do(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function hd(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function dd(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ge=Symbol("newer"),ot=Symbol("older");class fd{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:t.key}):{done:!0,value:void 0}}}class gd{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:t.value}):{done:!0,value:void 0}}}class md{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}ic=Ge,sc=ot;class Lo{constructor(t,n){R(this,"key");R(this,"value");R(this,ic);R(this,sc);this.key=t,this.value=n,this[Ge]=void 0,this[ot]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Yn{constructor(...t){R(this,"_keymap");R(this,"size",0);R(this,"limit");R(this,"oldest");R(this,"newest");R(this,"_onShiftListeners",[]);if(zn.hasLength(t,1)){if(zn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(zn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(zn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),tt(()=>Fn(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ge]&&(t===this.oldest&&(this.oldest=t[Ge]),t[Ge][ot]=t[ot]),t[ot]&&(t[ot][Ge]=t[Ge]),t[Ge]=void 0,t[ot]=this.newest,this.newest&&(this.newest[Ge]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new Lo(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ge]=o,o[ot]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new Lo(t,n)),this.newest?(this.newest[Ge]=r,r[ot]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ge]?(this.oldest=this.oldest[Ge],this.oldest[ot]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ge]=t[ot]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ge]&&n[ot]?(n[ot][Ge]=n[Ge],n[Ge][ot]=n[ot]):n[Ge]?(n[Ge][ot]=void 0,this.oldest=n[Ge]):n[ot]?(n[ot][Ge]=void 0,this.newest=n[ot]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new fd(this.oldest)}values(){return new gd(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new md(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ge]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ge];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ge],n&&(t+=" < ");return t}}class zn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var $r={exports:{}},_d=$r.exports,Uo;function pd(){return Uo||(Uo=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:_d,function(){return function(){var n={d:function(C,m){for(var _ in m)n.o(m,_)&&!n.o(C,_)&&Object.defineProperty(C,_,{enumerable:!0,get:m[_]})},o:function(C,m){return Object.prototype.hasOwnProperty.call(C,m)}},r={};n.d(r,{default:function(){return ft}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(C){const m=i.exec(C);if(!m)throw new SyntaxError("Malformed locale: ".concat(C));return{lang:m[1]+(m[2]?"_"+m[2]:""),language:m[1],territory:m[2]||"",codeset:m[3]||"",modifier:m[4]||""}}function u(C){if(typeof C=="number")return s[65535&C]||null;const m=parseInt(C,16);return isFinite(m)&&s[65535&m]?s[65535&m]||null:i.test(C)?C:null}function c(C){const m=u(C);let _=null;if(m){const y=l(m);_=o[y.lang]||o[y.language]||null}return _}function h(C){return Object.assign({},a,C)}function d(C,m){const _=typeof m=="object"?m:l(m);return o[_.lang]=h(C),_.language===_.lang||o[_.language]||(o[_.language]=h(C)),o[_.lang]}const g=h({group:","});function E(C,m){if(typeof C!="number")return C;if(C<0)return-E(-C,m);if(m){const _=10**(m||0)||1;return E(C*_,0)/_}return Math.round(C)}g.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function I(C,m,_){const y=C<0?-1:1,D=10**(m||2),k=10**(_||2);let P,F,S=Math.abs(C),ee=0,Ee=0,Z=0,pe=1;if((C=S)%1==0)F=[C*y,1];else if(C<1e-19)F=[y,1e19];else if(C>1e19)F=[1e19*y,1];else{do if(S=1/(S-Math.floor(S)),P=pe,pe=pe*Math.floor(S)+ee,ee=P,Ee=Z,Z=Math.floor(C*pe+.5),Z>=D||pe>=k)return[y*Ee,ee];while(Math.abs(C-Z/pe)>=1e-10&&S!==Math.floor(S));F=[y*Z,pe]}return F}const b={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},M=Object.assign({},b);function V(C){if(C===null&&(C=b),C){for(const m in C)if(m in b){const _=C[m];M[m]=_==null?b[m]:_}}return{...M}}const Y={"#":"",0:"0","?":" "},ie={"@":"text","-":"minus","+":"plus"},N=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],T=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+T.join("")+"]");function Q(C,m,_){return m[_+"_max"]=C.length,m[_+"_min"]=C.replace(/#/g,"").length,m}const ge={};function ce(C){if(!(C in ge)){const m=[],_=C.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,y=>"?".repeat(y.length));for(let y=0;y<_.length;y++){const D=_.charAt(y);m[y]=D in Y?Y[D]:D}ge[C]=m.join("")}return ge[C]}function p(C,m){typeof C=="string"&&(C={type:"string",value:C=C.replace(/ /g,Y["?"])}),m.push(C)}function W(C){const m=[],_={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:m};let y=C+"",D="int",k=!1,P=null;const F=[];let S,ee,Ee=!1;for(;y&&!k;){if(S=/^General/i.exec(y))_.general=!0,p({type:"general"},m);else if(D==="int"&&(S=/^[#?0]+(?:,[#?0]+)*/.exec(y))||D==="den"&&(S=/^[#?\d]+/.exec(y))||(S=/^[#?0]+/.exec(y)))_[D+"_pattern"].push(S[0]),P={type:D,num:S[0]},p(P,m);else if((S=/^\//.exec(y))&&_[D+"_pattern"].length){if(!P)throw new SyntaxError("Missing a numerator in pattern ".concat(C));_.fractions=!0,_.num_pattern.push(_[D+"_pattern"].pop()),P.type="num",D="den",p({type:"div"},m)}else if(S=/^,+/.exec(y)){const U=y.charAt(1)in Y;ee.slice(-1)in Y&&(S[0].length>1||!U)?_.scale=.001**S[0].length:_.dec_fractions||p(S[0],m)}else{if(S=/^;/.exec(y)){k=!0;break}if(S=/^[@+-]/.exec(y))S[0]==="@"&&(_.text=!0),p({type:ie[S[0]]},m);else if(S=/^(?:\[(h+|m+|s+)\])/i.exec(y)){const U=S[1].toLowerCase(),te=U[0],Ie={type:"",size:0,date:1,raw:S[0],pad:U.length};te==="h"?(Ie.size=16,Ie.type="hour-elap"):te==="m"?(Ie.size=32,Ie.type="min-elap"):(Ie.size=64,Ie.type="sec-elap"),_.date=_.date|Ie.size,F.push(Ie),p(Ie,m)}else if(S=/^(?:B2)/i.exec(y))Ee||(_.date_system=6);else if(S=/^(?:B1)/i.exec(y))Ee||(_.date_system=1);else if(S=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(y)){const U={type:"",size:0,date:1,raw:S[0]},te=S[0].toLowerCase(),Ie=te[0];if(te==="y"||te==="yy")U.size=2,U.type="year-short";else if(Ie==="y"||Ie==="e")U.size=2,U.type="year";else if(te==="b"||te==="bb")U.size=2,U.type="b-year-short";else if(Ie==="b")U.size=2,U.type="b-year";else if(te==="d"||te==="dd")U.size=8,U.type="day",U.pad=/dd/.test(te);else if(te==="ddd")U.size=8,U.type="weekday-short";else if(Ie==="d")U.size=8,U.type="weekday";else if(Ie==="h")U.size=16,U.type="hour",U.pad=/hh/i.test(te);else if(Ie==="m"){te.length===3?(U.size=4,U.type="monthname-short"):te.length===5?(U.size=4,U.type="monthname-single"):te.length>=4&&(U.size=4,U.type="monthname");const ye=F[F.length-1];!U.type&&ye&&!ye.used&&80&ye.size&&(ye.used=!0,U.size=32,U.type="min",U.pad=/mm/.test(te)),U.type||(U.size=4,U.type="month",U.pad=/mm/.test(te),U.indeterminate=!0)}else if(Ie==="s"){U.size=64,U.type="sec",U.pad=/ss/.test(te);const ye=F[F.length-1];ye&&32&ye.size?U.used=!0:ye&&ye.indeterminate&&(delete ye.indeterminate,ye.size=32,ye.type="min",U.used=!0)}_.date=_.date|U.size,_.date_eval=!0,F.push(U),p(U,m)}else if(S=/^(?:AM\/PM|am\/pm|A\/P)/.exec(y))_.clock=12,_.date=16|_.date,_.date_eval=!0,p({type:"am",short:S[0]==="A/P"},m);else if(_.date&&(S=/^\.0{1,3}/i.exec(y))){const U=S[0].length-1,te=[64,128,256,512][U];_.date=_.date|te,_.date_eval=!0,_.sec_decimals=Math.max(_.sec_decimals,U),p({type:"subsec",size:te,decimals:U,date:1,raw:S[0]},m)}else if((S=/^\\(.)/.exec(y))||(S=/^"([^"]*?)"/.exec(y)))p(S[1],m);else if(S=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(y))_.condition=[S[1],parseFloat(S[2],10)];else if(S=/^\[\$([^\]]+)\]/.exec(y)){const U=S[1].split("-"),te=U.length<2?"":U[U.length-1],Ie=U[0];Ie&&p(Ie,m);const ye=u(te);ye&&(_.locale=ye);const Fe=parseInt(te,16);isFinite(Fe)&&16711680&Fe&&(Fe>>16&255)===6&&(_.date_system=6),Ee=!0}else if(S=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(y))_.color=S[2]?N[parseInt(S[2],10)]||"#000":S[1].toLowerCase();else if(!(S=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(y))){if(S=/^%/.exec(y))_.scale=100,_.percent=!0,p("%",m);else if(S=/^_(\\.|.)/.exec(y))p(" ",m);else if(S=/^\./.exec(y))p({type:"point",value:S[0]},m),_.dec_fractions=!0,D="frac";else if(S=/^[Ee]([+-]?|(?=[0#?]))/.exec(y))_.exponential=!0,_.exp_plus=S[1]==="+",D="man",p({type:"exp",plus:S[1]==="+"},m);else if(!(S=/^\*(\\.|.)/.exec(y))){if(S=/^[BENn[]/.exec(y))throw new SyntaxError("Unexpected char ".concat(y.charAt(0)," in pattern ").concat(C));y[0]==="("&&(_.parens=!0),S=[y[0]],p(S[0],m)}}}ee=S[0],y=y.slice(S?S[0].length:1)}if(_.pattern=C.slice(0,C.length-y.length),/^((?:\[[^\]]+\])+)(;|$)/.test(_.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(_.pattern)&&p({type:"text"},m),_.fractions&&_.dec_fractions||_.fractions&&_.exponential)throw new SyntaxError("Invalid pattern: ".concat(_.pattern));const Z=_.int_pattern.join("");if(_.grouping=Z.indexOf(",")>=0,_.grouping){const U=Z.split(","),te=U.length;te===2?(_.group_pri=U[1].length,_.group_sec=_.group_pri):te>2&&(_.group_pri=U[te-1].length,_.group_sec=U[te-2].length)}else _.group_pri=0,_.group_sec=0;Q(Z.replace(/[,]/g,""),_,"int"),Q(_.frac_pattern.join(""),_,"frac"),Q(_.man_pattern.join(""),_,"man");let pe=_.num_pattern.join(""),be=_.den_pattern.join("");const de=/\?/.test(be)||/\?/.test(pe);return be=be.replace(/\d/g,de?"?":"#"),de&&(be=be.replace(/#$/g,"?")),Q(pe,_,"num"),Q(be,_,"den"),de&&(pe=pe.replace(/#$/g,"?")),_.int_padding=ce(_.int_pattern.join("")),_.man_padding=ce(_.man_pattern.join("")),_.num_padding=ce(pe),_.den_padding=ce(be),_.den_pattern.length&&(_.denominator=parseInt(_.den_pattern.join("").replace(/\D/g,""),10)),_.integer=!!_.int_pattern.join("").length,_.fractions&&m.forEach((U,te)=>{const Ie=m[te+1];U.type==="string"&&Ie&&(Ie.type==="num"?U.rule="num+int":Ie.type==="div"?U.rule="num":Ie.type==="den"&&(U.rule="den"))}),_}const O=C=>{const m=C.condition;m&&m[1]<0&&(m[0]==="<"||m[0]==="<="||m[0]==="=")||C.tokens.unshift({type:"minus",volatile:!0})};function L(C){const m=[];let _,y=!1,D=null,k=C,P=0,F=!1,S=0,ee=0;do{if(F=W(k),(F.date||F.general)&&(F.int_pattern.length||F.frac_pattern.length||F.scale!==1||F.text))throw new Error("Illegal format");if(F.condition&&(ee++,y=!0),F.text){if(D)throw new Error("Unexpected partition");D=F}F.locale&&(_=u(F.locale)),m.push(F),P=k.charAt(F.pattern.length)===";"?1:0,k=k.slice(F.pattern.length+P),S++}while(P&&S<4&&ee<3);if(P)throw new Error("Unexpected partition");if(ee>2)throw new Error("Unexpected condition");const Ee=m[3];if(Ee&&(Ee.int_pattern.length||Ee.frac_pattern.length||Ee.date))throw new Error("Unexpected partition");if(y){const Z=m.length;if(Z===1&&(m[1]=W("General"),m[1].generated=!0),Z<3){const pe=m[0],be=m[1];if(O(pe),be.condition)O(be);else{const de=pe.condition;(de[0]==="="||de[1]>=0&&(de[0]===">"||de[0]===">="))&&be.tokens.unshift({type:"minus",volatile:!0})}}else m.forEach(O)}else{if(m.length<4&&D)for(let Z=0,pe=m.length;Z<pe;Z++)m[Z]===D&&m.splice(Z,1);if(m.length<1&&D&&(m[0]=W("General"),m[0].generated=!0),m.length<2){const Z=W(m[0].pattern);Z.tokens.unshift({type:"minus",volatile:!0}),Z.generated=!0,m.push(Z)}if(m.length<3){const Z=W(m[0].pattern);Z.generated=!0,m.push(Z)}if(m.length<4)if(D)m.push(D);else{const Z=W("@");Z.generated=!0,m.push(Z)}m[0].condition=[">",0],m[1].condition=["<",0],m[2].condition=null}return{pattern:C,partitions:m,locale:_}}const A=Math.floor;function w(C){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&C>=0){if(C===0)return[1900,1,0];if(C===60)return[1900,2,29];if(C<60)return[1900,C<32?1:2,(C-1)%31+1]}let _=C+68569+2415019;const y=A(4*_/146097);_-=A((146097*y+3)/4);const D=A(4e3*(_+1)/1461001);_=_-A(1461*D/4)+31;const k=A(80*_/2447),P=_-A(2447*k/80);_=A(k/11);const F=k+2-12*_;return[0|100*(y-49)+D+_,0|F,0|P]}function x(C){return w(C+1462)}function $(C){if(C===60)throw new Error("#VALUE!");if(C<=1)return[1317,8,29];if(C<60)return[1317,C<32?9:10,1+(C-2)%30];const m=10631/30,_=.1335;let y=C+466935;const D=A(y/10631);y-=10631*D;const k=A((y-_)/m);y-=A(k*m+_);const P=A((y+28.5001)/29.5);return P===13?[30*D+k,12,30]:[30*D+k,P,y-A(29.5001*P-29)]}function K(C){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const y=A(C);return m===6?$(y):m===-1?x(y):w(y,_)}const oe=Math.floor,fe=86400;function me(C,m){let _=null;if(Array.isArray(C)){const[y,D,k,P,F,S]=C;_=Date.UTC(y,D==null?0:D-1,k!=null?k:1,P||0,F||0,S||0)}else if(C instanceof Date&&(_=1*C,!m||!m.ignoreTimezone)){const y=new Date;y.setUTCFullYear(C.getFullYear(),C.getMonth(),C.getDate()),y.setUTCHours(C.getHours(),C.getMinutes(),C.getSeconds(),C.getMilliseconds()),_=1*y}if(_!=null&&isFinite(_)){const y=_/864e5;return y-(y<=-25509?-25568:-25569)}return C}function Me(C,m){let _=0|C;const y=fe*(C-_);let D=oe(y);y-D>.9999&&(D+=1,D===fe&&(D=0,_+=1));const k=D<0?fe+D:D,[P,F,S]=K(C,0,m&&m.leap1900),ee=oe(k/60/60)%60,Ee=oe(k/60)%60,Z=oe(k)%60;if(m&&m.nativeDate){const pe=new Date(0);return pe.setUTCFullYear(P,F-1,S),pe.setUTCHours(ee,Ee,Z),pe}return[P,F,S,ee,Ee,Z]}function Te(C){return!!(C[0]&&C[0].percent||C[1]&&C[1].percent||C[2]&&C[2].percent||C[3]&&C[3].percent)}function v(C){return!!(C[0]&&C[0].date||C[1]&&C[1].date||C[2]&&C[2].date||C[3]&&C[3].date)}function B(C){const[m,_,y,D]=C;return!(m&&!m.generated||_&&!_.generated||y&&!y.generated||!D||!D.text||D.generated)}const X={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},J=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],G={total:1,sign:0,period:0,int:1,frac:0},z=(C,m)=>C.replace(/\./,m.decimal);function he(C,m,_,y){const D=0|_;if(typeof _=="string")C.push(_);else if(_===D)C.push(Math.abs(D));else{const k=Math.abs(_);let P=k?Math.floor(Math.log10(k)):0,F=P<0?k*10**-P:k/10**P;F===10&&(F=1,P++);const S=function(Ee){let Z=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const pe=Math.abs(Ee);if(!pe)return G;const be=Z&&Ee<0?1:0,de=Math.floor(pe),U=Math.floor(Math.log10(pe)+1);let te=0,Ie=0;if(de!==pe){te=1;const ye=String(E(U<0?pe*10**-U:pe/10**U,15));let Fe=ye.length,xe=!0,ze=0;for(;ze<=ye.length;){if(ye[ze]==="."){Fe--;break}ye[ze]==="0"&&xe?Fe--:xe=!1,ze++}Ie=Fe-U,Ie<0&&(Ie=0,te=0)}return{total:be+Math.max(U,1)+te+Ie,digits:Math.max(U,0)+Ie,sign:be,period:te,int:Math.max(U,1),frac:Ie}}(k),ee=()=>{const Ee=Math.abs(P);let Z;Z=F===1?F:E(F,5),C.push(z(Z+"",y),y.exponent,P<0?y.negative:y.positive,Ee<10?"0":"",Ee)};if(P>=-4&&P<=-1){const Ee=k.toPrecision(10+P).replace(/\.?0+$/,"");C.push(z(Ee,y))}else if(P===10){const Ee=k.toFixed(10).slice(0,12).replace(/\.$/,"");C.push(z(Ee,y))}else if(Math.abs(P)<=9)if(S.total<=11){const Ee=E(k,9).toFixed(S.frac);C.push(z(Ee,y))}else P===9?C.push(Math.floor(k)):P>=0&&P<9?C.push(E(k,9-P)):ee();else S.total>=12?ee():Math.floor(k)===k?C.push(Math.floor(k)):C.push(z(E(k,9).toFixed(S.frac),y))}return C}const le=86400,H={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},ne=function(C){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const _=Math.floor(Math.log10(C));return m>1?Math.floor(_/m)*m:_};function ae(C,m,_,y){let D="",k="",P="",F="",S="",ee=0,Ee=0|C,Z=0,pe=0,be=1,de=0,U=0,te=0,Ie=0,ye=0,Fe=0;const xe=y||g;if(!m.text&&isFinite(m.scale)&&m.scale!==1&&(C=function(Oe){if(Oe===0)return Oe;const De=Math.ceil(Math.log10(Oe<0?-Oe:Oe)),se=10**(16-Math.floor(De));return Math.round(Oe*se)/se}(C*m.scale)),m.exponential){let Oe=Math.abs(C);if(Oe){const De=10**-ne(Oe,m.int_max),se=E(Oe*De,m.frac_max)/De;ee=ne(se,m.int_max)}Oe/=10**ee,C=C<0?-Oe:Oe,D+=Math.abs(ee)}if(m.integer){const Oe=Math.abs(E(C,m.fractions?1:m.frac_max));S+=Oe<1?"":Math.floor(Oe)}if(m.grouping){let Oe="",De=S.length;for(De>m.group_pri&&(De-=m.group_pri,Oe=xe.group+S.slice(De,De+m.group_pri)+Oe);De>m.group_sec;)De-=m.group_sec,Oe=xe.group+S.slice(De,De+m.group_sec)+Oe;S=De?S.slice(0,De)+Oe:Oe}m.dec_fractions&&(F=String(E(C,m.frac_max)).split(".")[1]||"");let ze=!1;if(m.fractions){const Oe=Math.abs(m.integer?C%1:C);if(Oe)if(ze=!0,isFinite(m.denominator))P+=m.denominator,k+=E(Oe*m.denominator),k==="0"&&(k="",P="",ze=!1,S||(S="0"));else{const De=I(Oe,m.integer?m.num_max:1/0,m.den_max);k+=De[0],P+=De[1],m.integer&&k==="0"&&(S||(S="0"),k="",P="",ze=!1)}}if(m.date){Ee=Math.trunc(C);const Oe=le*(C-Ee);if(Z=Math.floor(Oe),Fe=Oe-Z,Math.abs(Fe)<1e-6?Fe=0:Fe>.9999&&(Fe=0,Z+=1,Z===le&&(Z=0,Ee+=1)),Fe){const De=512&m.date||256&m.date||128&m.date;(De===512&&Fe>.9995||De===256&&Fe>.995||De===128&&Fe>.95||!De&&Fe>=.5)&&(Z++,Fe=0)}if(Ee||m.date_system){const De=K(C,m.date_system,_.leap1900);pe=De[0],be=De[1],de=De[2]}if(Z){const De=Z<0?le+Z:Z;ye=Math.floor(De)%60,Ie=Math.floor(De/60)%60,te=Math.floor(De/60/60)%60}if(U=(6+Ee)%7,m.date_eval&&(gt=C,pt=Ee+Z/le,_.dateSpanLarge?gt<-694324||pt>=35830291:gt<0||pt>=2958466)){if(_.dateErrorThrows)throw new Error("Date out of bounds");return _.dateErrorNumber?he(C<0?[xe.negative]:[],0,C,xe).join(""):_.overflow}}var gt,pt;if(m.int_padding&&(S=m.int_padding.length===1?S||m.int_padding:m.int_padding.substring(0,m.int_padding.length-S.length)+S),m.num_padding&&(k=m.num_padding.length===1?k||m.num_padding:m.num_padding.substring(0,m.num_padding.length-k.length)+k),m.den_padding&&(P=m.den_padding.length===1?P||m.den_padding:P+m.den_padding.slice(P.length)),m.man_padding){const Oe=m.exp_plus?"+":"";D=m.man_padding.length===1?(ee<0?"-":Oe)+(D||m.man_padding):(ee<0?"-":Oe)+m.man_padding.slice(0,m.man_padding.length-D.length)+D}const Re=[];let et=0;const we={int:0,frac:0,man:0,num:0,den:0};for(let Oe=0,De=m.tokens.length;Oe<De;Oe++){const se=m.tokens[Oe],ct=se.num?se.num.length:0;if(se.type==="string")se.rule?se.rule==="num"?ze?Re.push(se.value):(m.num_min>0||m.den_min>0)&&Re.push(se.value.replace(/./g,Y["?"])):se.rule==="num+int"?ze&&S?Re.push(se.value):m.den_min>0&&(S||m.num_min)&&Re.push(se.value.replace(/./g,Y["?"])):se.rule==="den"&&(ze?Re.push(se.value):(m.den_min>0||m.den_min>0)&&Re.push(se.value.replace(/./g,Y["?"]))):Re.push(se.value);else if(se.type==="error")Re.push(_.invalid);else if(se.type==="point")Re.push(m.date?se.value:xe.decimal);else if(se.type==="general")he(Re,0,C,xe);else if(se.type==="exp")Re.push(xe.exponent);else if(se.type==="minus")se.volatile&&m.date||se.volatile&&(C>=0||typeof C!="number")||(se.volatile&&!m.fractions&&(m.integer||m.dec_fractions)?(C<0&&S&&S!=="0"||F)&&Re.push(xe.negative):Re.push(xe.negative));else if(se.type==="plus")Re.push(xe.positive);else if(se.type==="text")Re.push(C);else if(se.type==="div")ze?Re.push("/"):m.num_min>0||m.den_min>0?Re.push(Y["?"]):Re.push(Y["#"]);else if(se.type==="int")if(m.int_pattern.length===1)Re.push(S);else{const He=et?m.int_pattern.join("").length-we.int:1/0,kt=et===m.int_pattern.length-1?0:m.int_pattern.join("").length-(we.int+se.num.length);Re.push(S.substring(S.length-He,S.length-kt)),et++,we.int+=se.num.length}else if(se.type==="frac"){const He=we.frac;for(let kt=0;kt<ct;kt++)Re.push(F[kt+He]||Y[se.num[kt]]);we.frac+=ct}else if(se.type in H)m[se.type+"_pattern"].length===1?(se.type==="int"&&Re.push(S),se.type==="frac"&&Re.push(F),se.type==="man"&&Re.push(D),se.type==="num"&&Re.push(k),se.type==="den"&&Re.push(P)):(Re.push(H[se.type].slice(we[se.type],we[se.type]+ct)),we[se.type]+=ct);else if(se.type==="year")pe<0&&Re.push(xe.negative),Re.push(String(Math.abs(pe)).padStart(4,"0"));else if(se.type==="year-short"){const He=pe%100;Re.push(He<10?"0":"",He)}else if(se.type==="month")Re.push(se.pad&&be<10?"0":"",be);else if(se.type==="monthname-single")m.date_system===6?Re.push(xe.mmmm6[be-1].charAt(0)):Re.push(xe.mmmm[be-1].charAt(0));else if(se.type==="monthname-short")m.date_system===6?Re.push(xe.mmm6[be-1]):Re.push(xe.mmm[be-1]);else if(se.type==="monthname")m.date_system===6?Re.push(xe.mmmm6[be-1]):Re.push(xe.mmmm[be-1]);else if(se.type==="weekday-short")Re.push(xe.ddd[U]);else if(se.type==="weekday")Re.push(xe.dddd[U]);else if(se.type==="day")Re.push(se.pad&&de<10?"0":"",de);else if(se.type==="hour"){const He=te%m.clock||(m.clock<24?m.clock:0);Re.push(se.pad&&He<10?"0":"",He)}else if(se.type==="min")Re.push(se.pad&&Ie<10?"0":"",Ie);else if(se.type==="sec")Re.push(se.pad&&ye<10?"0":"",ye);else if(se.type==="subsec"){Re.push(xe.decimal);const He=Fe.toFixed(m.sec_decimals);Re.push(He.slice(2,2+se.decimals))}else if(se.type==="am"){const He=te<12?0:1;se.short&&!y?Re.push("AP"[He]):Re.push(xe.ampm[He])}else if(se.type==="hour-elap"){C<0&&Re.push(xe.negative);const He=24*Ee+Math.floor(Math.abs(Z)/3600);Re.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="min-elap"){C<0&&Re.push(xe.negative);const He=1440*Ee+Math.floor(Math.abs(Z)/60);Re.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="sec-elap"){C<0&&Re.push(xe.negative);const He=Ee*le+Math.abs(Z);Re.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="b-year")Re.push(pe+543);else if(se.type==="b-year-short"){const He=(pe+543)%100;Re.push(He<10?"0":"",He)}}return _.nbsp?Re.join(""):Re.join("").replace(/\u00a0/g," ")}function _e(C,m){for(let _=0;_<3;_++){const y=m[_];if(y){let D;if(y.condition){const k=y.condition[0],P=y.condition[1];k==="="?D=C===P:k===">"?D=C>P:k==="<"?D=C<P:k===">="?D=C>=P:k==="<="?D=C<=P:k==="<>"&&(D=C!==P)}else D=!0;if(D)return y}}}const Ae=W("@"),Ue="black",q={};function Se(C,m){if(C){const _=C[0];m[_]=m[_]||{},Se(C.slice(1),m[_])}else m.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(C=>{Se(C,q),Se(C+" x",q),Se(C+" l",q),Se(C+" l x",q),Se("l "+C,q),Se("l "+C+" x",q),Se(C+" D",q),Se(C+" D x",q),Se("D "+C,q),Se("D "+C+" x",q)});const Ve={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},je={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},ke={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},Ze=new Date().getUTCFullYear();function Ot(C){const m=new RegExp("^([\\s+%"+T.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+T.join("")+")]*)$").exec(C);if(m){const[,_,y,D,k,P]=m;let F=1,S="",ee=!1,Ee=!1,Z=!1,pe=!1,be=!1,de=null,U=!1,te=parseFloat(y.replace(/,/g,""));if(!isFinite(te))return null;for(let ye=0;ye<_.length;ye++){const Fe=_[ye];if(Fe==="-"){if(ee||Ee)return null;ee=!0,F=-1}else if(j.test(Fe)){if(be)return null;be=!0,de=Fe}else if(Fe==="("){if(Ee||ee)return null;Ee=!0,F=-1}else if(Fe==="%"){if(pe)return null;pe=!0}}for(let ye=0;ye<P.length;ye++){const Fe=P[ye];if(j.test(Fe)){if(be)return null;be=!0,de=Fe,U=!0}else if(Fe===")"){if(Z||!Ee)return null;Z=!0}else if(Fe==="%"){if(pe)return null;pe=!0}}if(k){if(pe||be)return null;S="0.00E+00"}else if(pe){if(be)return null;S=D.includes(".")?"0.00%":"0%",te*=.01}else if(be){const ye=D.includes(".")?"#,##0.00":"#,##0";S=U?ye+de:de+ye}else D.includes(",")&&(S=D.includes(".")?"#,##0.00":"#,##0");const Ie={v:te*F};return S&&(Ie.z=S),Ie}}const Ke=(C,m,_)=>{const y=_.path||"",D=Object.keys(m);for(let k=0;k<D.length;k++){let P;const F=D[k];if(m[F]){if(F==="$"||F==="€")C||(P=_);else if(F==="-"){const S=/^(\s*([./-]|,\s)\s*|\s+)/.exec(C);if(S){const ee=S[1]==="-"||S[1]==="/"||S[1]==="."?S[1]:" ";if(!_.sep||_.sep===ee){const Ee=S[0].replace(/\s+/g," ");P=Ke(C.slice(S[0].length),m[F],{..._,sep:ee,path:y+Ee})}}}else if(F===" "){const S=/^[,.]?\s+/.exec(C);if(S){const ee=S[0].replace(/\s+/g," ");P=Ke(C.slice(S[0].length),m[F],{..._,path:y+ee})}}else if(F==="j"||F==="d"){const S=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(C);S&&(P=Ke(C.slice(S[0].length),m[F],{..._,day:S[0],path:y+F}))}else if(F==="n"||F==="m"){const S=/^(0?[1-9]|1[012])\b/.exec(C);S&&(P=Ke(C.slice(S[0].length),m[F],{..._,month:+S[0],_mon:S[0],path:y+F}))}else if(F==="F"||F==="M"){const S=/^([a-z]{3,9})\b/i.exec(C),ee=S&&(F==="F"?je:Ve)[S[0].toLowerCase()];ee&&(P=Ke(C.slice(S[0].length),m[F],{..._,month:ee,_mon:S[0],path:y+F}))}else if(F==="l"||F==="D"){const S=/^([a-z]{3,9})\b/i.exec(C);(S&&ke[S[0].toLowerCase()])===F&&(P=Ke(C.slice(S[0].length),m[F],{..._,path:y+F}))}else if(F==="y"){const S=/^\d\d\b/.exec(C);if(S){const ee=+S[0]>=30?+S[0]+1900:+S[0]+2e3;P=Ke(C.slice(S[0].length),m[F],{..._,year:ee,path:y+F})}}else if(F==="Y"){const S=/^\d\d\d\d\b/.exec(C);S&&(P=Ke(C.slice(S[0].length),m[F],{..._,year:+S[0],path:y+F}))}else{if(F!=="x")throw new Error('Unknown date token "'.concat(F,'"'));{const S=Xe(C);S&&(P=Ke("",m[F],{..._,time:S.v,tf:S.z,path:y+F}))}}if(P)return P}}};function rt(C,m){const _=Ke(C.trim(),q,{path:""});if(_){var y;if(_.sep==="."&&_.path.length===3)return null;const D=+((y=_.year)!==null&&y!==void 0?y:Ze);if(_.day||(_.day=1),!function(F,S,ee){if(ee<1||S<1||S>12)return!1;if(S===2){if(ee>(F%4==0&&F%100!=0||F%400==0||F===1900?29:28))return!1}else if((S===4||S===6||S===9||S===11)&&ee>30||(S===1||S===3||S===5||S===7||S===8||S===10||S===12)&&ee>31)return!1;return!0}(D,_.month,_.day))return null;let k=-1/0;if(D<1900)return null;D<=1900&&_.month<=2?k=25568:D<1e4&&(k=25569);const P=Date.UTC(D,_.month-1,_.day)/864e5+k+(_.time||0);if(P>=0&&P<=2958465){const F=_._mon[0]==="0"||_.day[0]==="0"||_._mon.length===2&&_.day.length===2,S=_.path.replace(/[jdlDnmMFyYx-]/g,ee=>ee==="j"||ee==="d"?F?"dd":"d":ee==="D"?"ddd":ee==="l"?"dddd":ee==="n"||ee==="m"?F?"mm":"m":ee==="M"?"mmm":ee==="F"?"mmmm":ee==="y"?"yy":ee==="x"?_.tf||"":ee==="Y"?"yyyy":ee);return m&&m.nativeDate?{v:Me(P,m),z:S}:{v:P,z:S}}}return null}function Xe(C){const m=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(C);if(m){const[,_,y,D,k,P]=m;if(k&&!D||!P&&!y&&!D)return null;let F=1*(_||0);if(P){if(F>=13)return null;P[0]!=="p"&&P[0]!=="P"||(F+=12)}return{v:(60*F*60+60*(1*(y||0))+1*(D||0)+1*(k||0))/86400,z:(_.length===2?"hh":"h")+":mm"+(D?":ss":"")+(P?" AM/PM":"")}}return null}function dt(C){return/^\s*true\s*$/i.test(C)?{v:!0}:/^\s*false\s*$/i.test(C)?{v:!1}:null}const lt={};function Yt(C,m){const{pattern:_,partitions:y,locale:D}=C,k=S=>{const ee=Object.assign({},V(),m,S);return D&&(ee.locale=D),ee},P=(S,ee)=>{const Ee=k(ee);return function(Z,pe,be){const de=c(be.locale),U=pe[3]?pe[3]:Ae;if(typeof Z=="boolean"&&(Z=Z?"TRUE":"FALSE"),Z==null)return"";if(typeof Z!="number")return ae(Z,U,be,de);if(!isFinite(Z)){const Ie=de||g;return isNaN(Z)?Ie.nan:(Z<0?Ie.negative:"")+Ie.infinity}const te=_e(Z,pe);return te?ae(Z,te,be,de):be.overflow}(me(S,Ee),y,Ee)};P.color=(S,ee)=>function(Ee,Z){if(typeof Ee!="number"||!isFinite(Ee))return(Z[3]?Z[3].color:Ae.color)||Ue;const pe=_e(Ee,Z);return pe&&pe.color||Ue}(me(S,k(ee)),y);const F=function(S){var ee;let Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[Z,pe]=S,be=Z.frac_max,de={type:"general",isDate:v(S),isText:B(S),isPercent:Te(S),maxDecimals:Z.general?9:be,scale:(ee=Z.scale)!==null&&ee!==void 0?ee:1,color:0,parentheses:0,grouped:Z.grouping?1:0,_partitions:S},U=!de.isDate&&!de.isText&&!Z.error&&Z.tokens.some(xe=>xe.type==="string"&&(Ee?xe.value===Ee:j.test(xe.value)));let te="G",Ie=be>=0?Math.min(15,be):"",ye="",Fe="";if(pe&&pe.color&&(Fe="-",de.color=1),Z.parens&&(ye="()",de.parentheses=1),U)te="C",de.type="currency";else if(Z.error)de.type="error",de.maxDecimals=0;else if(de.isDate){let xe=0,ze=0,gt="";Z.tokens.forEach(Re=>{const et=Re.type;/^(b-)?year/.test(et)?(gt+="Y",ze++):et.startsWith("month")?(gt+="M",ze++):/^(week)?day/.test(et)?(gt+="D",ze++):et!=="hour"&&et!=="min"&&et!=="sec"&&et!=="am"||(gt+=et[0],xe++)}),de.type="date",ze&&xe?de.type="datetime":!ze&&xe&&(de.type="time");const pt=J.find(Re=>gt.startsWith(Re[0]));te=pt?"D":"G",Ie=pt?pt[1]:""}else de.isText?(te="G",de.type="text",Ie="",de.maxDecimals=0):Z.general?(te="G",de.type="general",Ie=""):Z.fractions?(te="G",de.type="fraction",Ie=""):Z.exponential?(te="S",de.type="scientific"):de.isPercent?(te="P",de.type="percent"):Z.grouping?(te=",",de.type="grouped"):(Z.int_max||be)&&(te="F",de.type="number");return de.code=te+Ie+Fe+ye,de.level=X[de.type],Object.freeze(de)}(y,(m||{}).currency)||new SyntaxError;return P.info=F,P.dateInfo=function(S){const[ee]=S;return{year:!!(2&ee.date),month:!!(4&ee.date),day:!!(8&ee.date),hours:!!(16&ee.date),minutes:!!(32&ee.date),seconds:!!(64&ee.date),clockType:ee.clock===12?12:24}}(y),P.isPercent=()=>!!F.isPercent,P.isDate=()=>!!F.isDate,P.isText=()=>!!F.isText,P.pattern=_,C.error&&(P.error=C.error),P.options=k,P.locale=D||m&&m.locale||"",Object.freeze(P)}function Be(C,m){C||(C="General");let _=null;return lt[C]?_=lt[C]:(_=Object.assign({},V(),m).throws?L(C):function(y){try{return L(y)}catch(D){const k={tokens:[{type:"error"}],error:D.message};return{pattern:y,partitions:[k,k,k,k],error:D.message,locale:null}}}(C),_.error||(lt[C]=_)),Yt(_,m)}Be.isDate=C=>Be(C,{throws:!1}).isDate(),Be.isPercent=C=>Be(C,{throws:!1}).isPercent(),Be.isText=C=>Be(C,{throws:!1}).isText(),Be.getInfo=(C,m)=>Be(C,{...m,throws:!1}).info,Be.getDateInfo=(C,m)=>Be(C,{...m,throws:!1}).dateInfo,Be.dateToSerial=me,Be.dateFromSerial=Me,Be.options=V,Be.dec2frac=I,Be.round=E,Be.codeToLocale=s,Be.parseLocale=l,Be.getLocale=c,Be.addLocale=(C,m)=>{const _=l(m);return delete lt[_.lang],delete lt[_.language],d(C,_)},Be.format=function(C,m,_){let y=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const D=_&&typeof _=="object"?_:{locale:_,throws:!y};return Be(C,D)(me(m,D),D)},Be.is_date=Be.isDate,Be.parseNumber=Ot,Be.parseDate=rt,Be.parseTime=Xe,Be.parseBool=dt,Be.parseValue=function(C,m){var _,y,D;return(_=(y=(D=Ot(C))!==null&&D!==void 0?D:rt(C,m))!==null&&y!==void 0?y:Xe(C))!==null&&_!==void 0?_:dt(C)};var ft=Be;return r=r.default}()})}($r)),$r.exports}var Ss,Po;function Ed(){return Po||(Po=1,Ss=pd()),Ss}var Cd=Ed();const Rd=Et(Cd);function Vt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function vs(e,t,n){const r=Vt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Os(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function Id(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function Sd(e,t,n){const r=n;if(Vt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function ws(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?vd(e,t,n,r):Od(e,t,n,r)}function vd(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function Od(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class Tt{constructor(t={}){R(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new Tt({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){ws(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{ws(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)vs(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&vs(r,void 0,i)})}removeRows(t,n){Os(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Os(t,n,s)})}getFragment(t,n,r,s){const i=new Tt;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new Tt;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Vt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Vt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new Tt;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=Vt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const Gn="__INTERNAL_EDITOR__",bs=`${Gn}DOCS_NORMAL`,As=`${Gn}DOCS_FORMULA_BAR`,ko=`${Gn}ZEN_EDITOR`,Fo=`\r
|
|
2
|
-
`,xo="isRowStylePrecedeColumnStyle",Bo=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function wd(e){return`${Gn}${e}`}function $o(e){return e.startsWith(Gn)}var Ho=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Ho||{}),Wo=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Wo||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),Vn=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Vn||{}),Kt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(Kt||{}),an=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(an||{}),jo=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(jo||{}),Ts=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(Ts||{}),Yo=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Yo||{}),zo=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(zo||{}),Go=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Go||{}),Vo=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Vo||{}),Ko=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Ko||{}),Xo=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Xo||{}),qo=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(qo||{}),it=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(it||{}),Jo=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Jo||{}),Zo=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Zo||{}),Qo=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Qo||{}),ea=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(ea||{}),ta=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(ta||{}),na=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(na||{}),ra=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(ra||{}),sa=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(sa||{}),ia=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(ia||{}),En=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(En||{}),oa=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(oa||{}),aa=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(aa||{}),la=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(la||{}),ua=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(ua||{}),ca=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(ca||{}),ha=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(ha||{}),da=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(da||{}),Ct=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(Ct||{});const bd=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var fa=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(fa||{}),ga=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(ga||{}),ys=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(ys||{}),ma=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(ma||{}),_a=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(_a||{});const Ad={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Td={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},yd={startRow:0,startColumn:0,endRow:0,endColumn:0},Nd={row:0,column:0},ut={ff:"Arial",fs:11,it:ve.FALSE,bl:ve.FALSE,ul:{s:ve.FALSE},st:{s:ve.FALSE},ol:{s:ve.FALSE},tr:{a:0,v:ve.FALSE},td:jn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:bt.UNSPECIFIED,vt:rn.UNSPECIFIED,tb:sn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},pa={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Md=[bs,ko,As],Dd={[it.HEADING_1]:{fs:20,bl:1},[it.HEADING_2]:{fs:18,bl:1},[it.HEADING_3]:{fs:16,bl:1},[it.HEADING_4]:{fs:14,bl:1},[it.HEADING_5]:{fs:12,bl:1},[it.NORMAL_TEXT]:null,[it.TITLE]:{fs:26,bl:1},[it.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[it.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Cn=4,Ld={[it.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+Cn}},[it.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+Cn}},[it.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+Cn}},[it.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+Cn}},[it.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+Cn}},[it.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[it.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+Cn}},[it.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[it.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Ud="univer-sheets-chart-print-chart",Pd="univer-docs-drawing-printing";var Ea=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(Ea||{});const kd={[Ct.A3]:{width:1123,height:1587},[Ct.A4]:{width:794,height:1124},[Ct.A5]:{width:559,height:794},[Ct.B4]:{width:944,height:1344},[Ct.B5]:{width:665,height:944},[Ct.Executive]:{width:696,height:1008},[Ct.Folio]:{width:816,height:1248},[Ct.Legal]:{width:816,height:1344},[Ct.Letter]:{width:816,height:1056},[Ct.Statement]:{width:528,height:816},[Ct.Tabloid]:{width:1056,height:1632}};function Hr(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ve.FALSE;switch(e){case"bl":case"it":{if(o[e]===ve.FALSE)return ve.FALSE;break}case"ul":case"st":{if(o[e].s===ve.FALSE)return ve.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
|
|
3
|
-
`)===r?ve.TRUE:ve.FALSE}const _r=class _r{constructor(t,n,r){R(this,"_range");R(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Tt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Tt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||ut.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new _r(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;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 t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Hr("ul",t.body)===ve.TRUE?{s:ve.TRUE}:{s:ve.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Hr("st",t.body)===ve.TRUE?{s:ve.TRUE}:{s:ve.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.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 n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Hr("it",t.body)===ve.TRUE?Ir.ITALIC:Ir.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Hr("bl",t.body)===ve.TRUE?Sr.BOLD:Sr.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.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:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.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 t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===sn.WRAP?ve.TRUE:ve.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){_r.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||ut[t]}))}};R(_r,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let Rn=_r;function Ca(e,t,n=0,r=e.length-1,s=Fd){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),g=Math.max(n,Math.floor(t-u*h/l+d)),E=Math.min(r,Math.floor(t+(l-u)*h/l+d));Ca(e,t,g,E,s)}const i=e[t];let o=n,a=r;for(Kn(e,n,t),s(e[r],i)>0&&Kn(e,n,r);o<a;){for(Kn(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Kn(e,n,a):(a++,Kn(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Kn(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Fd(e,t){return e<t?-1:e>t?1:0}class Wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!Yr(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;Yr(t,l)&&(n.leaf?r.push(a):Ms(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Yr(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(Yr(t,o)){if(n.leaf||Ms(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Sn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=xd(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&Ms(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=Sn(t.slice(n,r+1)),In(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Sn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));Ra(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);Ra(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const g=Math.min(d+l-1,h);a.children.push(this._build(t,d,g,s-1))}}return In(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=Ns(u),h=Hd(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),qn(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=Sn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,In(r,this.toBBox),In(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Sn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,In(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=Xn(t,0,a,this.toBBox),u=Xn(t,a,r,this.toBBox),c=Wd(l,u),h=Ns(l)+Ns(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Bd,i=t.leaf?this.compareMinY:$d,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=Xn(t,0,n,i),a=Xn(t,r-n,r,i);let l=jr(o)+jr(a);for(let u=n;u<r-n;u++){const c=t.children[u];qn(o,t.leaf?i(c):c),l+=jr(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];qn(a,t.leaf?i(c):c),l+=jr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)qn(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():In(t[n],this.toBBox)}}function xd(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function In(e,t){Xn(e,0,e.children.length,t,e)}function Xn(e,t,n,r,s){s||(s=Sn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];qn(s,e.leaf?r(o):o)}return s}function qn(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Bd(e,t){return e.minX-t.minX}function $d(e,t){return e.minY-t.minY}function Ns(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function jr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Hd(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Wd(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function Ms(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Yr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Sn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ra(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;Ca(e,o,t,n,s),i.push(t,o,o,n)}}function jd(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||nt.NONE,o=s.endAbsoluteRefType||nt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===nt.ALL&&o===nt.ALL)return s;const l=Ia(s.startRow,n,s.startColumn,t,a),u=Ia(s.endRow,n,s.endColumn,t,a);return r||i===nt.NONE&&o===nt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===nt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===nt.COLUMN?s={...s,startRow:l.row}:i===nt.ROW&&(s={...s,startColumn:l.column}),o===nt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===nt.COLUMN?s={...s,endRow:u.row}:o===nt.ROW&&(s={...s,endColumn:u.column}),s)}function Ia(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Ds(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function Yd(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function zd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function Gd(e){const t=Ds(e),n=Yd(t);return zd(n)}function Vd(e,t){const n=[];return e.forEach(r=>{n.push(...Xt.subtract(r,t))}),Xt.mergeRanges(n)}function Sa(e,t){const n=va(e.startRow,e.endRow,t.startRow,t.endRow),r=va(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Kd(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function va(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function Kd(e,t,n,r,s,i){const o=e!==void 0?e:Oa(n,r,s,i),a=t!==void 0?t:Oa(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function Oa(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const jt=class jt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),g=Math.abs(o-a)+Math.abs(c-h),E=Math.abs(s+i-l-u),I=Math.abs(s-i)+Math.abs(l-u);return d<=g&&E<=I}static doAnyRangesIntersect(t,n){const r=new Wr;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,g,E;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?E=s:E=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?g=o:g=c;else return null;return{startRow:d,endRow:E,startColumn:h,endColumn:g,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return jt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=jt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return Gd(t)}static splitIntoGrid(t){return Ds(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Vd(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};R(jt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),R(jt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[nt.ROW,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[nt.ROW,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[nt.COLUMN,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[nt.COLUMN,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),R(jt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),R(jt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),R(jt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Xt=jt;function Xd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=qd(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function qd(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Jd(e,t){Rn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Zd(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Xd(n,t);if(!s)break;r.push(s),Jd(n,s)}return r}class Qd{constructor(t,n){R(this,"_values",[]);R(this,"_keys",[]);R(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Ls(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function ef(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const zr=65,wa=90,tf=97;function nf(e){const t=wa-zr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+zr)+n,e=Math.floor(e/t)-1;return n}function ba(e,t){let n="";for(;t>0;)n+=e,t--;return n}function rf(e,t=!1){const n=wa-zr+1;let r=tf;t&&(r=zr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return ba(s,i)}function sf(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function of(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Jn(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var Aa=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Aa||{}),mt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
4
|
-
`,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(
|
|
5
|
-
`)?e.slice(0,-2):e;return lf.reduce((n,r)=>n.replaceAll(r,""),t)},uf=e=>e?Gr(e).replaceAll("\r","")==="":!0,cf=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=Bt(),d=`${c}`,g={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:Kt.HYPERLINK,properties:{url:e}};r.push(g),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var Ta=typeof global=="object"&&global&&global.Object===Object&&global,hf=typeof self=="object"&&self&&self.Object===Object&&self,ln=Ta||hf||Function("return this")(),vn=ln.Symbol,ya=Object.prototype,df=ya.hasOwnProperty,ff=ya.toString,Zn=vn?vn.toStringTag:void 0;function gf(e){var t=df.call(e,Zn),n=e[Zn];try{e[Zn]=void 0;var r=!0}catch{}var s=ff.call(e);return r&&(t?e[Zn]=n:delete e[Zn]),s}var mf=Object.prototype,_f=mf.toString;function pf(e){return _f.call(e)}var Ef="[object Null]",Cf="[object Undefined]",Na=vn?vn.toStringTag:void 0;function Qn(e){return e==null?e===void 0?Cf:Ef:Na&&Na in Object(e)?gf(e):pf(e)}function On(e){return e!=null&&typeof e=="object"}var Rf="[object Symbol]";function Vr(e){return typeof e=="symbol"||On(e)&&Qn(e)==Rf}function If(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var wn=Array.isArray,Ma=vn?vn.prototype:void 0,Da=Ma?Ma.toString:void 0;function La(e){if(typeof e=="string")return e;if(wn(e))return If(e,La)+"";if(Vr(e))return Da?Da.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Sf=/\s/;function vf(e){for(var t=e.length;t--&&Sf.test(e.charAt(t)););return t}var Of=/^\s+/;function wf(e){return e&&e.slice(0,vf(e)+1).replace(Of,"")}function It(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ua=NaN,bf=/^[-+]0x[0-9a-f]+$/i,Af=/^0b[01]+$/i,Tf=/^0o[0-7]+$/i,yf=parseInt;function Pa(e){if(typeof e=="number")return e;if(Vr(e))return Ua;if(It(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=It(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=wf(e);var n=Af.test(e);return n||Tf.test(e)?yf(e.slice(2),n?2:8):bf.test(e)?Ua:+e}function ka(e){return e}var Nf="[object AsyncFunction]",Mf="[object Function]",Df="[object GeneratorFunction]",Lf="[object Proxy]";function Us(e){if(!It(e))return!1;var t=Qn(e);return t==Mf||t==Df||t==Nf||t==Lf}var Ps=ln["__core-js_shared__"],Fa=function(){var e=/[^.]+$/.exec(Ps&&Ps.keys&&Ps.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Uf(e){return!!Fa&&Fa in e}var Pf=Function.prototype,kf=Pf.toString;function Ff(e){if(e!=null){try{return kf.call(e)}catch{}try{return e+""}catch{}}return""}var xf=/[\\^$.*+?()[\]{}|]/g,Bf=/^\[object .+?Constructor\]$/,$f=Function.prototype,Hf=Object.prototype,Wf=$f.toString,jf=Hf.hasOwnProperty,Yf=RegExp("^"+Wf.call(jf).replace(xf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zf(e){if(!It(e)||Uf(e))return!1;var t=Us(e)?Yf:Bf;return t.test(Ff(e))}function Gf(e,t){return e==null?void 0:e[t]}function ks(e,t){var n=Gf(e,t);return zf(n)?n:void 0}var xa=Object.create,Vf=function(){function e(){}return function(t){if(!It(t))return{};if(xa)return xa(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Kf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Xf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var qf=800,Jf=16,Zf=Date.now;function Qf(e){var t=0,n=0;return function(){var r=Zf(),s=Jf-(r-n);if(n=r,s>0){if(++t>=qf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function eg(e){return function(){return e}}var Kr=function(){try{var e=ks(Object,"defineProperty");return e({},"",{}),e}catch{}}(),tg=Kr?function(e,t){return Kr(e,"toString",{configurable:!0,enumerable:!1,value:eg(t),writable:!0})}:ka,ng=Qf(tg),rg=9007199254740991,sg=/^(?:0|[1-9]\d*)$/;function Fs(e,t){var n=typeof e;return t=t==null?rg:t,!!t&&(n=="number"||n!="symbol"&&sg.test(e))&&e>-1&&e%1==0&&e<t}function xs(e,t,n){t=="__proto__"&&Kr?Kr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Xr(e,t){return e===t||e!==e&&t!==t}var ig=Object.prototype,og=ig.hasOwnProperty;function Ba(e,t,n){var r=e[t];(!(og.call(e,t)&&Xr(r,n))||n===void 0&&!(t in e))&&xs(e,t,n)}function ag(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?xs(n,a,l):Ba(n,a,l)}return n}var $a=Math.max;function lg(e,t,n){return t=$a(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=$a(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Kf(e,this,a)}}function ug(e,t){return ng(lg(e,t,ka),e+"")}var cg=9007199254740991;function Ha(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=cg}function Bs(e){return e!=null&&Ha(e.length)&&!Us(e)}function hg(e,t,n){if(!It(n))return!1;var r=typeof t;return(r=="number"?Bs(n)&&Fs(t,n.length):r=="string"&&t in n)?Xr(n[t],e):!1}function Wa(e){return ug(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&hg(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var dg=Object.prototype;function ja(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||dg;return e===n}function fg(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var gg="[object Arguments]";function Ya(e){return On(e)&&Qn(e)==gg}var za=Object.prototype,mg=za.hasOwnProperty,_g=za.propertyIsEnumerable,$s=Ya(function(){return arguments}())?Ya:function(e){return On(e)&&mg.call(e,"callee")&&!_g.call(e,"callee")};function pg(){return!1}var Ga=typeof f=="object"&&f&&!f.nodeType&&f,Va=Ga&&typeof module=="object"&&module&&!module.nodeType&&module,Eg=Va&&Va.exports===Ga,Ka=Eg?ln.Buffer:void 0,Cg=Ka?Ka.isBuffer:void 0,Xa=Cg||pg,Rg="[object Arguments]",Ig="[object Array]",Sg="[object Boolean]",vg="[object Date]",Og="[object Error]",wg="[object Function]",bg="[object Map]",Ag="[object Number]",Tg="[object Object]",yg="[object RegExp]",Ng="[object Set]",Mg="[object String]",Dg="[object WeakMap]",Lg="[object ArrayBuffer]",Ug="[object DataView]",Pg="[object Float32Array]",kg="[object Float64Array]",Fg="[object Int8Array]",xg="[object Int16Array]",Bg="[object Int32Array]",$g="[object Uint8Array]",Hg="[object Uint8ClampedArray]",Wg="[object Uint16Array]",jg="[object Uint32Array]",Qe={};Qe[Pg]=Qe[kg]=Qe[Fg]=Qe[xg]=Qe[Bg]=Qe[$g]=Qe[Hg]=Qe[Wg]=Qe[jg]=!0,Qe[Rg]=Qe[Ig]=Qe[Lg]=Qe[Sg]=Qe[Ug]=Qe[vg]=Qe[Og]=Qe[wg]=Qe[bg]=Qe[Ag]=Qe[Tg]=Qe[yg]=Qe[Ng]=Qe[Mg]=Qe[Dg]=!1;function Yg(e){return On(e)&&Ha(e.length)&&!!Qe[Qn(e)]}function zg(e){return function(t){return e(t)}}var qa=typeof f=="object"&&f&&!f.nodeType&&f,er=qa&&typeof module=="object"&&module&&!module.nodeType&&module,Gg=er&&er.exports===qa,Hs=Gg&&Ta.process,Ja=function(){try{var e=er&&er.require&&er.require("util").types;return e||Hs&&Hs.binding&&Hs.binding("util")}catch{}}(),Za=Ja&&Ja.isTypedArray,Qa=Za?zg(Za):Yg;function Vg(e,t){var n=wn(e),r=!n&&$s(e),s=!n&&!r&&Xa(e),i=!n&&!r&&!s&&Qa(e),o=n||r||s||i,a=o?fg(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Fs(u,l))||a.push(u);return a}function Kg(e,t){return function(n){return e(t(n))}}function Xg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var qg=Object.prototype,Jg=qg.hasOwnProperty;function Zg(e){if(!It(e))return Xg(e);var t=ja(e),n=[];for(var r in e)r=="constructor"&&(t||!Jg.call(e,r))||n.push(r);return n}function el(e){return Bs(e)?Vg(e):Zg(e)}var Qg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,em=/^\w*$/;function tm(e,t){if(wn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Vr(e)?!0:em.test(e)||!Qg.test(e)||t!=null&&e in Object(t)}var tr=ks(Object,"create");function nm(){this.__data__=tr?tr(null):{},this.size=0}function rm(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var sm="__lodash_hash_undefined__",im=Object.prototype,om=im.hasOwnProperty;function am(e){var t=this.__data__;if(tr){var n=t[e];return n===sm?void 0:n}return om.call(t,e)?t[e]:void 0}var lm=Object.prototype,um=lm.hasOwnProperty;function cm(e){var t=this.__data__;return tr?t[e]!==void 0:um.call(t,e)}var hm="__lodash_hash_undefined__";function dm(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=tr&&t===void 0?hm:t,this}function un(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}un.prototype.clear=nm,un.prototype.delete=rm,un.prototype.get=am,un.prototype.has=cm,un.prototype.set=dm;function fm(){this.__data__=[],this.size=0}function qr(e,t){for(var n=e.length;n--;)if(Xr(e[n][0],t))return n;return-1}var gm=Array.prototype,mm=gm.splice;function _m(e){var t=this.__data__,n=qr(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():mm.call(t,n,1),--this.size,!0}function pm(e){var t=this.__data__,n=qr(t,e);return n<0?void 0:t[n][1]}function Em(e){return qr(this.__data__,e)>-1}function Cm(e,t){var n=this.__data__,r=qr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ht(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ht.prototype.clear=fm,Ht.prototype.delete=_m,Ht.prototype.get=pm,Ht.prototype.has=Em,Ht.prototype.set=Cm;var tl=ks(ln,"Map");function Rm(){this.size=0,this.__data__={hash:new un,map:new(tl||Ht),string:new un}}function Im(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Jr(e,t){var n=e.__data__;return Im(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Sm(e){var t=Jr(this,e).delete(e);return this.size-=t?1:0,t}function vm(e){return Jr(this,e).get(e)}function Om(e){return Jr(this,e).has(e)}function wm(e,t){var n=Jr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function qt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}qt.prototype.clear=Rm,qt.prototype.delete=Sm,qt.prototype.get=vm,qt.prototype.has=Om,qt.prototype.set=wm;var bm="Expected a function";function Ws(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(bm);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(Ws.Cache||qt),n}Ws.Cache=qt;var Am=500;function Tm(e){var t=Ws(e,function(r){return n.size===Am&&n.clear(),r}),n=t.cache;return t}var ym=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nm=/\\(\\)?/g,Mm=Tm(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(ym,function(n,r,s,i){t.push(s?i.replace(Nm,"$1"):r||n)}),t});function Dm(e){return e==null?"":La(e)}function nl(e,t){return wn(e)?e:tm(e,t)?[e]:Mm(Dm(e))}function rl(e){if(typeof e=="string"||Vr(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Lm(e,t){t=nl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[rl(t[n++])];return n&&n==r?e:void 0}function sl(e,t,n){var r=e==null?void 0:Lm(e,t);return r===void 0?n:r}var il=Kg(Object.getPrototypeOf,Object),Um="[object Object]",Pm=Function.prototype,km=Object.prototype,ol=Pm.toString,Fm=km.hasOwnProperty,xm=ol.call(Object);function Bm(e){if(!On(e)||Qn(e)!=Um)return!1;var t=il(e);if(t===null)return!0;var n=Fm.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ol.call(n)==xm}function $m(){this.__data__=new Ht,this.size=0}function Hm(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Wm(e){return this.__data__.get(e)}function jm(e){return this.__data__.has(e)}var Ym=200;function zm(e,t){var n=this.__data__;if(n instanceof Ht){var r=n.__data__;if(!tl||r.length<Ym-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qt(r)}return n.set(e,t),this.size=n.size,this}function bn(e){var t=this.__data__=new Ht(e);this.size=t.size}bn.prototype.clear=$m,bn.prototype.delete=Hm,bn.prototype.get=Wm,bn.prototype.has=jm,bn.prototype.set=zm;var al=typeof f=="object"&&f&&!f.nodeType&&f,ll=al&&typeof module=="object"&&module&&!module.nodeType&&module,Gm=ll&&ll.exports===al,ul=Gm?ln.Buffer:void 0;ul&&ul.allocUnsafe;function Vm(e,t){return e.slice()}var cl=ln.Uint8Array;function Km(e){var t=new e.constructor(e.byteLength);return new cl(t).set(new cl(e)),t}function Xm(e,t){var n=Km(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function qm(e){return typeof e.constructor=="function"&&!ja(e)?Vf(il(e)):{}}function Jm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Zm=Jm(),js=function(){return ln.Date.now()},Qm="Expected a function",e_=Math.max,t_=Math.min;function n_(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(Qm);t=Pa(t)||0,It(n)&&(c=!!n.leading,h="maxWait"in n,i=h?e_(Pa(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function g(T){var j=r,Q=s;return r=s=void 0,u=T,o=e.apply(Q,j),o}function E(T){return u=T,a=setTimeout(M,t),c?g(T):o}function I(T){var j=T-l,Q=T-u,ge=t-j;return h?t_(ge,i-Q):ge}function b(T){var j=T-l,Q=T-u;return l===void 0||j>=t||j<0||h&&Q>=i}function M(){var T=js();if(b(T))return V(T);a=setTimeout(M,I(T))}function V(T){return a=void 0,d&&r?g(T):(r=s=void 0,o)}function Y(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function ie(){return a===void 0?o:V(js())}function N(){var T=js(),j=b(T);if(r=arguments,s=this,l=T,j){if(a===void 0)return E(l);if(h)return clearTimeout(a),a=setTimeout(M,t),g(l)}return a===void 0&&(a=setTimeout(M,t)),o}return N.cancel=Y,N.flush=ie,N}function Ys(e,t,n){(n!==void 0&&!Xr(e[t],n)||n===void 0&&!(t in e))&&xs(e,t,n)}function r_(e){return On(e)&&Bs(e)}function zs(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function s_(e){return ag(e,el(e))}function i_(e,t,n,r,s,i,o){var a=zs(e,n),l=zs(t,n),u=o.get(l);if(u){Ys(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=wn(l),g=!d&&Xa(l),E=!d&&!g&&Qa(l);c=l,d||g||E?wn(a)?c=a:r_(a)?c=Xf(a):g?(h=!1,c=Vm(l)):E?(h=!1,c=Xm(l)):c=[]:Bm(l)||$s(l)?(c=a,$s(a)?c=s_(a):(!It(a)||Us(a))&&(c=qm(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),Ys(e,n,c)}function Gs(e,t,n,r,s){e!==t&&Zm(t,function(i,o){if(s||(s=new bn),It(i))i_(e,t,o,n,Gs,r,s);else{var a=r?r(zs(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ys(e,o,a)}},el)}var o_=Wa(function(e,t,n,r){Gs(e,t,n,r)}),Vs=Wa(function(e,t,n){Gs(e,t,n)});function a_(e,t,n,r){if(!It(e))return e;t=nl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=rl(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=It(c)?c:Fs(t[s+1])?[]:{})}Ba(a,l,u),a=a[l]}return e}function l_(e,t,n){return e==null?e:a_(e,t,n)}var Ks,hl;function u_(){if(hl)return Ks;hl=1;var e=-1,t=1,n=0;function r(p,W,O,L,A){if(p===W)return p?[[n,p]]:[];if(O!=null){var w=ge(p,W,O);if(w)return w}var x=a(p,W),$=p.substring(0,x);p=p.substring(x),W=W.substring(x),x=u(p,W);var K=p.substring(p.length-x);p=p.substring(0,p.length-x),W=W.substring(0,W.length-x);var oe=s(p,W);return $&&oe.unshift([n,$]),K&&oe.push([n,K]),V(oe,A),L&&h(oe),oe}function s(p,W){var O;if(!p)return[[t,W]];if(!W)return[[e,p]];var L=p.length>W.length?p:W,A=p.length>W.length?W:p,w=L.indexOf(A);if(w!==-1)return O=[[t,L.substring(0,w)],[n,A],[t,L.substring(w+A.length)]],p.length>W.length&&(O[0][0]=O[2][0]=e),O;if(A.length===1)return[[e,p],[t,W]];var x=c(p,W);if(x){var $=x[0],K=x[1],oe=x[2],fe=x[3],me=x[4],Me=r($,oe),Te=r(K,fe);return Me.concat([[n,me]],Te)}return i(p,W)}function i(p,W){for(var O=p.length,L=W.length,A=Math.ceil((O+L)/2),w=A,x=2*A,$=new Array(x),K=new Array(x),oe=0;oe<x;oe++)$[oe]=-1,K[oe]=-1;$[w+1]=0,K[w+1]=0;for(var fe=O-L,me=fe%2!==0,Me=0,Te=0,v=0,B=0,X=0;X<A;X++){for(var J=-X+Me;J<=X-Te;J+=2){var G=w+J,z;J===-X||J!==X&&$[G-1]<$[G+1]?z=$[G+1]:z=$[G-1]+1;for(var he=z-J;z<O&&he<L&&p.charAt(z)===W.charAt(he);)z++,he++;if($[G]=z,z>O)Te+=2;else if(he>L)Me+=2;else if(me){var le=w+fe-J;if(le>=0&&le<x&&K[le]!==-1){var H=O-K[le];if(z>=H)return o(p,W,z,he)}}}for(var ne=-X+v;ne<=X-B;ne+=2){var le=w+ne,H;ne===-X||ne!==X&&K[le-1]<K[le+1]?H=K[le+1]:H=K[le-1]+1;for(var ae=H-ne;H<O&&ae<L&&p.charAt(O-H-1)===W.charAt(L-ae-1);)H++,ae++;if(K[le]=H,H>O)B+=2;else if(ae>L)v+=2;else if(!me){var G=w+fe-ne;if(G>=0&&G<x&&$[G]!==-1){var z=$[G],he=w+z-G;if(H=O-H,z>=H)return o(p,W,z,he)}}}}return[[e,p],[t,W]]}function o(p,W,O,L){var A=p.substring(0,O),w=W.substring(0,L),x=p.substring(O),$=W.substring(L),K=r(A,w),oe=r(x,$);return K.concat(oe)}function a(p,W){if(!p||!W||p.charAt(0)!==W.charAt(0))return 0;for(var O=0,L=Math.min(p.length,W.length),A=L,w=0;O<A;)p.substring(w,A)==W.substring(w,A)?(O=A,w=O):L=A,A=Math.floor((L-O)/2+O);return Y(p.charCodeAt(A-1))&&A--,A}function l(p,W){var O=p.length,L=W.length;if(O==0||L==0)return 0;O>L?p=p.substring(O-L):O<L&&(W=W.substring(0,O));var A=Math.min(O,L);if(p==W)return A;for(var w=0,x=1;;){var $=p.substring(A-x),K=W.indexOf($);if(K==-1)return w;x+=K,(K==0||p.substring(A-x)==W.substring(0,x))&&(w=x,x++)}}function u(p,W){if(!p||!W||p.slice(-1)!==W.slice(-1))return 0;for(var O=0,L=Math.min(p.length,W.length),A=L,w=0;O<A;)p.substring(p.length-A,p.length-w)==W.substring(W.length-A,W.length-w)?(O=A,w=O):L=A,A=Math.floor((L-O)/2+O);return ie(p.charCodeAt(p.length-A))&&A--,A}function c(p,W){var O=p.length>W.length?p:W,L=p.length>W.length?W:p;if(O.length<4||L.length*2<O.length)return null;function A(Te,v,B){for(var X=Te.substring(B,B+Math.floor(Te.length/4)),J=-1,G="",z,he,le,H;(J=v.indexOf(X,J+1))!==-1;){var ne=a(Te.substring(B),v.substring(J)),ae=u(Te.substring(0,B),v.substring(0,J));G.length<ae+ne&&(G=v.substring(J-ae,J)+v.substring(J,J+ne),z=Te.substring(0,B-ae),he=Te.substring(B+ne),le=v.substring(0,J-ae),H=v.substring(J+ne))}return G.length*2>=Te.length?[z,he,le,H,G]:null}var w=A(O,L,Math.ceil(O.length/4)),x=A(O,L,Math.ceil(O.length/2)),$;if(!w&&!x)return null;x?w?$=w[4].length>x[4].length?w:x:$=x:$=w;var K,oe,fe,me;p.length>W.length?(K=$[0],oe=$[1],fe=$[2],me=$[3]):(fe=$[0],me=$[1],K=$[2],oe=$[3]);var Me=$[4];return[K,oe,fe,me,Me]}function h(p){for(var W=!1,O=[],L=0,A=null,w=0,x=0,$=0,K=0,oe=0;w<p.length;)p[w][0]==n?(O[L++]=w,x=K,$=oe,K=0,oe=0,A=p[w][1]):(p[w][0]==t?K+=p[w][1].length:oe+=p[w][1].length,A&&A.length<=Math.max(x,$)&&A.length<=Math.max(K,oe)&&(p.splice(O[L-1],0,[e,A]),p[O[L-1]+1][0]=t,L--,L--,w=L>0?O[L-1]:-1,x=0,$=0,K=0,oe=0,A=null,W=!0)),w++;for(W&&V(p),M(p),w=1;w<p.length;){if(p[w-1][0]==e&&p[w][0]==t){var fe=p[w-1][1],me=p[w][1],Me=l(fe,me),Te=l(me,fe);Me>=Te?(Me>=fe.length/2||Me>=me.length/2)&&(p.splice(w,0,[n,me.substring(0,Me)]),p[w-1][1]=fe.substring(0,fe.length-Me),p[w+1][1]=me.substring(Me),w++):(Te>=fe.length/2||Te>=me.length/2)&&(p.splice(w,0,[n,fe.substring(0,Te)]),p[w-1][0]=t,p[w-1][1]=me.substring(0,me.length-Te),p[w+1][0]=e,p[w+1][1]=fe.substring(Te),w++),w++}w++}}var d=/[^a-zA-Z0-9]/,g=/\s/,E=/[\r\n]/,I=/\n\r?\n$/,b=/^\r?\n\r?\n/;function M(p){function W(Te,v){if(!Te||!v)return 6;var B=Te.charAt(Te.length-1),X=v.charAt(0),J=B.match(d),G=X.match(d),z=J&&B.match(g),he=G&&X.match(g),le=z&&B.match(E),H=he&&X.match(E),ne=le&&Te.match(I),ae=H&&v.match(b);return ne||ae?5:le||H?4:J&&!z&&he?3:z||he?2:J||G?1:0}for(var O=1;O<p.length-1;){if(p[O-1][0]==n&&p[O+1][0]==n){var L=p[O-1][1],A=p[O][1],w=p[O+1][1],x=u(L,A);if(x){var $=A.substring(A.length-x);L=L.substring(0,L.length-x),A=$+A.substring(0,A.length-x),w=$+w}for(var K=L,oe=A,fe=w,me=W(L,A)+W(A,w);A.charAt(0)===w.charAt(0);){L+=A.charAt(0),A=A.substring(1)+w.charAt(0),w=w.substring(1);var Me=W(L,A)+W(A,w);Me>=me&&(me=Me,K=L,oe=A,fe=w)}p[O-1][1]!=K&&(K?p[O-1][1]=K:(p.splice(O-1,1),O--),p[O][1]=oe,fe?p[O+1][1]=fe:(p.splice(O+1,1),O--))}O++}}function V(p,W){p.push([n,""]);for(var O=0,L=0,A=0,w="",x="",$;O<p.length;){if(O<p.length-1&&!p[O][1]){p.splice(O,1);continue}switch(p[O][0]){case t:A++,x+=p[O][1],O++;break;case e:L++,w+=p[O][1],O++;break;case n:var K=O-A-L-1;if(W){if(K>=0&&T(p[K][1])){var oe=p[K][1].slice(-1);if(p[K][1]=p[K][1].slice(0,-1),w=oe+w,x=oe+x,!p[K][1]){p.splice(K,1),O--;var fe=K-1;p[fe]&&p[fe][0]===t&&(A++,x=p[fe][1]+x,fe--),p[fe]&&p[fe][0]===e&&(L++,w=p[fe][1]+w,fe--),K=fe}}if(N(p[O][1])){var oe=p[O][1].charAt(0);p[O][1]=p[O][1].slice(1),w+=oe,x+=oe}}if(O<p.length-1&&!p[O][1]){p.splice(O,1);break}if(w.length>0||x.length>0){w.length>0&&x.length>0&&($=a(x,w),$!==0&&(K>=0?p[K][1]+=x.substring(0,$):(p.splice(0,0,[n,x.substring(0,$)]),O++),x=x.substring($),w=w.substring($)),$=u(x,w),$!==0&&(p[O][1]=x.substring(x.length-$)+p[O][1],x=x.substring(0,x.length-$),w=w.substring(0,w.length-$)));var me=A+L;w.length===0&&x.length===0?(p.splice(O-me,me),O=O-me):w.length===0?(p.splice(O-me,me,[t,x]),O=O-me+1):x.length===0?(p.splice(O-me,me,[e,w]),O=O-me+1):(p.splice(O-me,me,[e,w],[t,x]),O=O-me+2)}O!==0&&p[O-1][0]===n?(p[O-1][1]+=p[O][1],p.splice(O,1)):O++,A=0,L=0,w="",x="";break}}p[p.length-1][1]===""&&p.pop();var Me=!1;for(O=1;O<p.length-1;)p[O-1][0]===n&&p[O+1][0]===n&&(p[O][1].substring(p[O][1].length-p[O-1][1].length)===p[O-1][1]?(p[O][1]=p[O-1][1]+p[O][1].substring(0,p[O][1].length-p[O-1][1].length),p[O+1][1]=p[O-1][1]+p[O+1][1],p.splice(O-1,1),Me=!0):p[O][1].substring(0,p[O+1][1].length)==p[O+1][1]&&(p[O-1][1]+=p[O+1][1],p[O][1]=p[O][1].substring(p[O+1][1].length)+p[O+1][1],p.splice(O+1,1),Me=!0)),O++;Me&&V(p,W)}function Y(p){return p>=55296&&p<=56319}function ie(p){return p>=56320&&p<=57343}function N(p){return ie(p.charCodeAt(0))}function T(p){return Y(p.charCodeAt(p.length-1))}function j(p){for(var W=[],O=0;O<p.length;O++)p[O][1].length>0&&W.push(p[O]);return W}function Q(p,W,O,L){return T(p)||N(L)?null:j([[n,p],[e,W],[t,O],[n,L]])}function ge(p,W,O){var L=typeof O=="number"?{index:O,length:0}:O.oldRange,A=typeof O=="number"?null:O.newRange,w=p.length,x=W.length;if(L.length===0&&(A===null||A.length===0)){var $=L.index,K=p.slice(0,$),oe=p.slice($),fe=A?A.index:null;e:{var me=$+x-w;if(fe!==null&&fe!==me||me<0||me>x)break e;var Me=W.slice(0,me),Te=W.slice(me);if(Te!==oe)break e;var v=Math.min($,me),B=K.slice(0,v),X=Me.slice(0,v);if(B!==X)break e;var J=K.slice(v),G=Me.slice(v);return Q(B,J,G,oe)}e:{if(fe!==null&&fe!==$)break e;var z=$,Me=W.slice(0,z),Te=W.slice(z);if(Me!==K)break e;var he=Math.min(w-z,x-z),le=oe.slice(oe.length-he),H=Te.slice(Te.length-he);if(le!==H)break e;var J=oe.slice(0,oe.length-he),G=Te.slice(0,Te.length-he);return Q(K,J,G,le)}}if(L.length>0&&A&&A.length===0)e:{var B=p.slice(0,L.index),le=p.slice(L.index+L.length),v=B.length,he=le.length;if(x<v+he)break e;var X=W.slice(0,v),H=W.slice(x-he);if(B!==X||le!==H)break e;var J=p.slice(v,w-he),G=W.slice(v,x-he);return Q(B,J,G,le)}return null}function ce(p,W,O,L){return r(p,W,O,L,!0)}return ce.INSERT=t,ce.DELETE=e,ce.EQUAL=n,Ks=ce,Ks}var c_=u_();const Xs=Et(c_),h_=new Set(["true","false"]);function d_(e){return h_.has(e.toLowerCase())}var qs,dl;function f_(){if(dl)return qs;dl=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(Y,ie){i=Y,o=ie})),s=s||{};var l=!1,u=null,c=null,h=null,d=this,g=function(Y,ie,N){c&&(clearTimeout(c),c=null),h&&(clearTimeout(h),h=null),Y&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?ie?o(ie):i(N):typeof r=="function"&&r(ie,N),l=!0),Y&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},E=function(Y){if(l)return g(Y);u&&(clearTimeout(u),u=null),d.domainReentrant&&Y&&(d.domains[t]=process.domain);var ie=s.maxExecutionTime||d.maxExecutionTime;if(ie&&(h=setTimeout(function(){d.queues[t]&&g(Y,new Error("Maximum execution time is exceeded "+t))},ie)),n.length===1){var N=!1;try{n(function(T,j){N||(N=!0,g(Y,T,j))})}catch(T){N||(N=!0,g(Y,T))}}else d._promiseTry(function(){return n()}).then(function(T){g(Y,void 0,T)},function(T){g(Y,T)})};d.domainReentrant&&process.domain&&(E=process.domain.bind(E));var I=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],E(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])E(!1);else if(d.queues[t].length>=I)g(!1,new Error("Too many pending tasks in queue "+t));else{var b=function(){E(!0)};s.skipQueue?d.queues[t].unshift(b):d.queues[t].push(b);var M=s.timeout||d.timeout;M&&(u=setTimeout(function(){u=null,g(!1,new Error("async-lock timed out in queue "+t))},M))}var V=s.maxOccupationTime||d.maxOccupationTime;if(V&&(c=setTimeout(function(){d.queues[t]&&g(!1,new Error("Maximum occupation time is exceeded in queue "+t))},V)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,u){return function(c){i.acquire(l,u,c,s)}},a=t.reduceRight(function(l,u){return o(u,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,u){a.length===1?a(function(c,h){c?u(c):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},qs=e,qs}var Js,fl;function g_(){return fl||(fl=1,Js=f_()),Js}var m_=g_();const __=Et(m_);function gl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var $e=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))($e||{}),Ut=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ut||{}),Zs=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Zs||{});class Zr extends st{}function p_(e=re.generateRandomId(6),t=Wn.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
6
|
-
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:Ts.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ve.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ve.TRUE,doNotHyphenateCaps:ve.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ve.FALSE,useFirstPageHeaderFooter:ve.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var cn={},nr={},Qr={},ml;function E_(){if(ml)return Qr;ml=1,Object.defineProperty(Qr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Qr.default=n,Qr}var es={},_l;function C_(){if(_l)return es;_l=1,Object.defineProperty(es,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return es.default=e,es}var Qs={},pl;function El(){return pl||(pl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const g=d;h.write(g,c[g])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,g=this.parents.length-1,E=this.idx;for(;E>=0;)h.unshift(d[E]),E===0?(E=this.indexes[g*2],d=this.parents[g--]):E-=n(d[E-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,g,E){this.container=h,this.idx=d,this.parents=g.slice(),this.indexes=E.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const g=this.getComponent();g&&d(g,h);for(const E of this)h&&h.descend(E),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(g,E)=>{g.p!=null&&d(g.p,E)})}eachDrop(h,d){this.traverse(h,(g,E)=>{g.d!=null&&d(g.d,E)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let g=this.idx+1;if(g<this.container.length&&n(this.container[g])&&g++,t(g===this.container.length||!n(this.container[g])),g===this.container.length)this.container.push(d),this.idx=g;else if(this.container[g]===d)this.idx=g;else{if(!Array.isArray(this.container[g])){const E=this.container.splice(g,this.container.length-g);this.container.push(E),this.lcIdx>-1&&(this.lcIdx=g)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),g=this.lcIdx+1,this.lcIdx=-1);g<this.container.length&&r(d,this.container[g][0]);)g++;if(this.indexes.push(g),this.idx=0,g<this.container.length&&this.container[g][0]===d)this.container=this.container[g];else{const E=[d];this.container.splice(g,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const g=this.getComponent();t(g[h]==null||g[h]===d,"Internal consistency error: Overwritten component. File a bug"),g[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const g=this.lcIdx,E=this.parents.length;let I=0;for(let b=0;b<h.length;b++){const M=h[b];typeof M=="string"||typeof M=="number"?(I++,this.descend(M)):Array.isArray(M)?this.mergeTree(M,d):typeof M=="object"&&d(M,this)}for(;I--;)this.ascend();this.lcIdx=this.parents.length===E?g:-1}at(h,d){this.descendPath(h),d(this);for(let g=0;g<h.length;g++)this.ascend();return this}writeAtPath(h,d,g){return this.at(h,()=>this.write(d,g)),this.reset(),this}writeMove(h,d,g=0){return this.writeAtPath(h,"p",g).writeAtPath(d,"d",g)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let g,E;E=g=c?c.descendFirst():!1;function I(b){let M;for(;E;){const V=M=c.getKey();if(b!=null){let Y=!1;if(h&&typeof V=="number"&&(M=h(V,c.getComponent()),M<0&&(M=~M,Y=!0)),r(M,b))return null;if(M===b&&!Y)return c}d&&typeof M=="number"&&d(M,c.getComponent()),E=c.nextSibling()}return null}return I.end=()=>{g&&c.ascend()},I}e.advancer=l;function u(c,h,d){let g,E,I,b;for(g=E=c&&c.descendFirst(),I=b=h&&h.descendFirst();g||I;){let M=g?c.getKey():null,V=I?h.getKey():null;M!==null&&V!==null&&(r(V,M)?V=null:M!==V&&(M=null)),d(M==null?V:M,M!=null?c:null,V!=null?h:null),M!=null&&g&&(g=c.nextSibling()),V!=null&&I&&(I=h.nextSibling())}E&&c.ascend(),b&&h.ascend()}e.eachChildOf=u}(Qs)),Qs}var ei={},Cl;function Rl(){return Cl||(Cl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(ei)),ei}var yt={},hn={},Il;function ti(){return Il||(Il=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.uniToStrPos=hn.strPosToUni=void 0,hn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},hn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),hn}var ni={},Sl;function ri(){return Sl||(Sl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=ti(),n=N=>{if(!Array.isArray(N))throw Error("Op must be an array of components");let T=null;for(let j=0;j<N.length;j++){const Q=N[j];switch(typeof Q){case"object":if(typeof Q.d!="number"&&typeof Q.d!="string")throw Error("Delete must be number or string");if(e.dlen(Q.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Q.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Q>0))throw Error("Skip components must be >0");if(typeof T=="number")throw Error("Adjacent skip components should be combined");break}T=Q}if(typeof T=="number")throw Error("Op has a trailing skip")};function r(N,T){let j=0,Q=0;for(let ge=0;ge<N.length;ge++){const ce=N[ge];switch(T(ce,j,Q),typeof ce){case"object":j+=e.dlen(ce.d);break;case"string":Q+=t.strPosToUni(ce);break;case"number":j+=ce,Q+=ce;break}}}e.eachOp=r;function s(N,T){const j=[],Q=a(j);return r(N,(ge,ce,p)=>{Q(T(ge,ce,p))}),h(j)}const i=N=>N,o=N=>s(N,i);e.dlen=N=>typeof N=="number"?N:t.strPosToUni(N);const a=N=>T=>{if(!(!T||T.d===0||T.d===""))if(N.length===0)N.push(T);else if(typeof T==typeof N[N.length-1])if(typeof T=="object"){const j=N[N.length-1];j.d=typeof j.d=="string"&&typeof T.d=="string"?j.d+T.d:e.dlen(j.d)+e.dlen(T.d)}else N[N.length-1]+=T;else N.push(T)},l=N=>typeof N=="number"?N:typeof N=="string"?t.strPosToUni(N):typeof N.d=="number"?N.d:t.strPosToUni(N.d);e.uniSlice=(N,T,j)=>{const Q=t.uniToStrPos(N,T),ge=j==null?1/0:t.uniToStrPos(N,j);return N.slice(Q,ge)};const u=(N,T,j)=>typeof N=="number"?j==null?N-T:Math.min(N,j)-T:e.uniSlice(N,T,j),c=N=>{let T=0,j=0;return{take:(ce,p)=>{if(T===N.length)return ce===-1?null:ce;const W=N[T];let O;if(typeof W=="number")return ce===-1||W-j<=ce?(O=W-j,++T,j=0,O):(j+=ce,ce);if(typeof W=="string"){if(ce===-1||p==="i"||t.strPosToUni(W.slice(j))<=ce)return O=W.slice(j),++T,j=0,O;{const L=j+t.uniToStrPos(W.slice(j),ce);return O=W.slice(j,L),j=L,O}}else{if(ce===-1||p==="d"||e.dlen(W.d)-j<=ce)return O={d:u(W.d,j)},++T,j=0,O;{let L=u(W.d,j,j+ce);return j+=ce,{d:L}}}},peek:()=>N[T]}},h=N=>(N.length>0&&typeof N[N.length-1]=="number"&&N.pop(),N);function d(N,T,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(N),n(T);const Q=[],ge=a(Q),{take:ce,peek:p}=c(N);for(let O=0;O<T.length;O++){const L=T[O];let A,w;switch(typeof L){case"number":for(A=L;A>0;)w=ce(A,"i"),ge(w),typeof w!="string"&&(A-=l(w));break;case"string":j==="left"&&typeof p()=="string"&&ge(ce(-1)),ge(t.strPosToUni(L));break;case"object":for(A=e.dlen(L.d);A>0;)switch(w=ce(A,"i"),typeof w){case"number":A-=w;break;case"string":ge(w);break;case"object":A-=e.dlen(w.d)}break}}let W;for(;W=ce(-1);)ge(W);return h(Q)}function g(N,T){n(N),n(T);const j=[],Q=a(j),{take:ge}=c(N);for(let p=0;p<T.length;p++){const W=T[p];let O,L;switch(typeof W){case"number":for(O=W;O>0;)L=ge(O,"d"),Q(L),typeof L!="object"&&(O-=l(L));break;case"string":Q(W);break;case"object":O=e.dlen(W.d);let A=0;for(;A<O;)switch(L=ge(O-A,"d"),typeof L){case"number":Q({d:u(W.d,A,A+L)}),A+=L;break;case"string":A+=t.strPosToUni(L);break;case"object":Q(L)}break}}let ce;for(;ce=ge(-1);)Q(ce);return h(j)}const E=(N,T)=>{let j=0;for(let Q=0;Q<T.length&&N>j;Q++){const ge=T[Q];switch(typeof ge){case"number":{j+=ge;break}case"string":const ce=t.strPosToUni(ge);j+=ce,N+=ce;break;case"object":N-=Math.min(e.dlen(ge.d),N-j);break}}return N},I=(N,T)=>typeof N=="number"?E(N,T):N.map(j=>E(j,T));function b(N,T,j){return s(N,(Q,ge)=>typeof Q=="object"&&typeof Q.d=="number"?{d:j.slice(T,ge,ge+Q.d)}:Q)}function M(N){return s(N,T=>{switch(typeof T){case"object":if(typeof T.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return T.d;case"string":return{d:T};case"number":return T}})}function V(N){return s(N,T=>typeof T=="object"&&typeof T.d=="string"?{d:t.strPosToUni(T.d)}:T)}function Y(N){let T=!0;return r(N,j=>{typeof j=="object"&&typeof j.d=="number"&&(T=!1)}),T}function ie(N){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(T=""){if(typeof T!="string")throw Error("Initial data must be a string");return N.create(T)},apply(T,j){n(j);const Q=N.builder(T);for(let ge=0;ge<j.length;ge++){const ce=j[ge];switch(typeof ce){case"number":Q.skip(ce);break;case"string":Q.append(ce);break;case"object":Q.del(e.dlen(ce.d));break}}return Q.build()},transform:d,compose:g,transformPosition:E,transformSelection:I,isInvertible:Y,makeInvertible(T,j){return b(T,j,N)},stripInvertible:V,invert:M,invertWithDoc(T,j){return M(b(T,j,N))},isNoop:T=>T.length===0}}e.default=ie}(ni)),ni}var ts={},vl;function R_(){if(vl)return ts;vl=1,Object.defineProperty(ts,"__esModule",{value:!0});const e=ri(),t=ti();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return ts.default=n,n.provides={text:!0},ts}var Ol;function I_(){return Ol||(Ol=1,function(e){var t=yt&&yt.__createBinding||(Object.create?function(d,g,E,I){I===void 0&&(I=E),Object.defineProperty(d,I,{enumerable:!0,get:function(){return g[E]}})}:function(d,g,E,I){I===void 0&&(I=E),d[I]=g[E]}),n=yt&&yt.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),r=yt&&yt.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var E in d)Object.hasOwnProperty.call(d,E)&&t(g,d,E);return n(g,d),g},s=yt&&yt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=ti(),o=r(ri()),a=s(R_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const g=[];return{skip(E){let I=i.uniToStrPos(d,E);if(I>d.length)throw Error("The op is too long for this document");g.push(d.slice(0,I)),d=d.slice(I)},append(E){g.push(E)},del(E){d=d.slice(i.uniToStrPos(d,E))},build(){return g.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,g)=>g.length===0?[]:d===0?[g]:[d,g],e.remove=(d,g)=>o.dlen(g)===0?[]:d===0?[{d:g}]:[d,{d:g}];var h=ri();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(yt)),yt}var wl;function S_(){return wl||(wl=1,function(e){var t=nr&&nr.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(E_()),r=t(C_()),s=El(),i=Rl();function o(v,B){if(!v)throw new Error(B)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:v=>v,isNoop:v=>v==null,setDebug(v){},registerSubtype:M,checkValidOp:ge,normalize:ce,apply:p,transformPosition:W,compose:O,tryTransform:K,transform:fe,makeInvertible:w,invert:L,invertWithDoc:x,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(v,B,X)=>Te(()=>!0,v,B,X),typeAllowingConflictsPred:v=>Object.assign(Object.assign({},e.type),{transform:(B,X,J)=>Te(v,B,X,J)})};const a=v=>v?v.getComponent():null;function l(v){return v&&typeof v=="object"&&!Array.isArray(v)}const u=v=>Array.isArray(v)?v.slice():v!==null&&typeof v=="object"?Object.assign({},v):v,c=v=>v&&(v.p!=null||v.r!==void 0),h=v=>v&&(v.d!=null||v.i!==void 0);function d(v,B){return o(v!=null),typeof B=="number"?(o(Array.isArray(v),"Invalid key - child is not an array"),(v=v.slice()).splice(B,1)):(o(l(v),"Invalid key - child is not an object"),delete(v=Object.assign({},v))[B]),v}function g(v,B,X){return typeof B=="number"?(o(v!=null,"Container is missing for key"),o(Array.isArray(v),"Cannot use numerical key for object container"),o(v.length>=B,"Cannot insert into out of bounds index"),v.splice(B,0,X)):(o(l(v),"Cannot insert into missing item"),o(v[B]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),v[B]=X),X}e.removeOp=(v,B=!0)=>s.writeCursor().writeAtPath(v,"r",B).get(),e.moveOp=(v,B)=>s.writeCursor().writeMove(v,B).get(),e.insertOp=(v,B)=>s.writeCursor().writeAtPath(v,"i",B).get(),e.replaceOp=(v,B,X)=>s.writeCursor().at(v,J=>{J.write("r",B),J.write("i",X)}).get(),e.editOp=(v,B,X,J=!1)=>s.writeCursor().at(v,G=>T(G,B,X,J)).get();const E=(v,B)=>v!=null&&(typeof B=="number"?Array.isArray(v):typeof v=="object"),I=(v,B)=>E(v,B)?v[B]:void 0,b={};function M(v){let B=v.type?v.type:v;B.name&&(b[B.name]=B),B.uri&&(b[B.uri]=B)}const V=v=>{const B=b[v];if(B)return B;throw Error("Missing type: "+v)};M(I_());const Y=(v,B)=>v+B;M({name:"number",apply:Y,compose:Y,invert:v=>-v,transform:v=>v});const ie=v=>v==null?null:v.et?V(v.et):v.es?b["text-unicode"]:v.ena!=null?b.number:null,N=v=>v.es?v.es:v.ena!=null?v.ena:v.e,T=(v,B,X,J=!1)=>{const[G,z]=typeof B=="string"?[V(B),B]:[B,B.name];!J&&G.isNoop&&G.isNoop(X)||(z==="number"?v.write("ena",X):z==="text-unicode"?v.write("es",X):(v.write("et",z),v.write("e",X)))};function j(v){o(typeof v=="number"),o(v>=0),o(v===(0|v))}function Q(v){typeof v=="number"?j(v):o(typeof v=="string")}function ge(v){if(v===null)return;const B=new Set,X=new Set,J=z=>{let he=!0,le=!1;for(let H in z){const ne=z[H];if(he=!1,o(H==="p"||H==="r"||H==="d"||H==="i"||H==="e"||H==="es"||H==="ena"||H==="et","Invalid component item '"+H+"'"),H==="p")j(ne),o(!B.has(ne)),B.add(ne),o(z.r===void 0);else if(H==="d")j(ne),o(!X.has(ne)),X.add(ne),o(z.i===void 0);else if(H==="e"||H==="es"||H==="ena"){o(!le),le=!0;const ae=ie(z);o(ae,"Missing type in edit"),ae.checkValidOp&&ae.checkValidOp(N(z))}}o(!he)},G=(z,he,le)=>{if(!Array.isArray(z))throw Error("Op must be null or a list");if(z.length===0)throw Error("Empty descent");he||Q(z[0]);let H=1,ne=0,ae=0;for(let _e=0;_e<z.length;_e++){const Ae=z[_e];if(o(Ae!=null),Array.isArray(Ae)){const Ue=G(Ae,!1);if(ne){const q=typeof ae,Se=typeof Ue;q===Se?o(ae<Ue,"descent keys are not in order"):o(q==="number"&&Se==="string")}ae=Ue,ne++,H=3}else typeof Ae=="object"?(o(H===1,`Prev not scalar - instead ${H}`),J(Ae),H=2):(o(H!==3),Q(Ae),o(s.isValidPathItem(Ae),"Invalid path key"),H=1)}return o(ne!==1,"Operation makes multiple descents. Remove some []"),o(H===2||H===3),z[0]};G(v,!0),o(B.size===X.size,"Mismatched picks and drops in op");for(let z=0;z<B.size;z++)o(B.has(z)),o(X.has(z))}function ce(v){let B=0,X=[];const J=s.writeCursor();return J.mergeTree(v,(G,z)=>{const he=ie(G);if(he){const H=N(G);T(z,he,he.normalize?he.normalize(H):H)}for(const H of["r","p","i","d"])if(G[H]!==void 0){const ne=H==="p"||H==="d"?(le=G[H],X[le]==null&&(X[le]=B++),X[le]):G[H];z.write(H,ne)}var le}),J.get()}function p(v,B){if(ge(B),B===null)return v;const X=[];return function J(G,z){let he=G,le=0,H={root:G},ne=0,ae=H,_e="root";function Ae(){for(;ne<le;ne++){let Ue=z[ne];typeof Ue!="object"&&(o(E(ae,_e)),ae=ae[_e]=u(ae[_e]),_e=Ue)}}for(;le<z.length;le++){const Ue=z[le];if(Array.isArray(Ue)){const q=J(he,Ue);q!==he&&q!==void 0&&(Ae(),he=ae[_e]=q)}else if(typeof Ue=="object"){Ue.d!=null?(Ae(),he=g(ae,_e,X[Ue.d])):Ue.i!==void 0&&(Ae(),he=g(ae,_e,Ue.i));const q=ie(Ue);if(q)Ae(),he=ae[_e]=q.apply(he,N(Ue));else if(Ue.e!==void 0)throw Error("Subtype "+Ue.et+" undefined")}else he=I(he,Ue)}return H.root}(v=function J(G,z){const he=[];let le=0;for(;le<z.length;le++){const _e=z[le];if(Array.isArray(_e))break;typeof _e!="object"&&(he.push(G),G=I(G,_e))}for(let _e=z.length-1;_e>=le;_e--)G=J(G,z[_e]);for(--le;le>=0;le--){const _e=z[le];if(typeof _e!="object"){const Ae=he.pop();G=G===I(Ae,_e)?Ae:G===void 0?d(Ae,_e):(ne=_e,ae=G,(H=u(H=Ae))[ne]=ae,H)}else c(_e)&&(o(G!==void 0,"Cannot pick up or remove undefined"),_e.p!=null&&(X[_e.p]=G),G=void 0)}var H,ne,ae;return G}(v,B),B)}function W(v,B){v=v.slice(),ge(B);const X=s.readCursor(B);let J,G,z=!1;const he=[];for(let H=0;;H++){const ne=v[H],ae=X.getComponent();if(ae&&(ae.r!==void 0?z=!0:ae.p!=null&&(z=!1,J=ae.p,G=H)),H>=v.length)break;let _e=0;const Ae=s.advancer(X,void 0,(q,Se)=>{c(Se)&&_e++});he.unshift(Ae);const Ue=Ae(ne);if(typeof ne=="number"&&(v[H]-=_e),!Ue)break}if(he.forEach(H=>H.end()),z)return null;const le=()=>{let H=0;if(J!=null){const ne=X.getPath();H=ne.length,v=ne.concat(v.slice(G))}for(;H<v.length;H++){const ne=v[H],ae=a(X),_e=ie(ae);if(_e){const q=N(ae);_e.transformPosition&&(v[H]=_e.transformPosition(v[H],q));break}let Ae=0;const Ue=s.advancer(X,(q,Se)=>h(Se)?~(q-Ae):q-Ae,(q,Se)=>{h(Se)&&Ae++})(ne);if(typeof ne=="number"&&(v[H]+=Ae),!Ue)break}};return J!=null?X.eachDrop(null,H=>{H===J&&le()}):le(),v}function O(v,B){if(ge(v),ge(B),v==null)return B;if(B==null)return v;let X=0;const J=s.readCursor(v),G=s.readCursor(B),z=s.writeCursor(),he=[],le=[],H=[],ne=[],ae=[],_e=[],Ae=new Set;J.traverse(null,q=>{q.p!=null&&(H[q.p]=J.clone())}),G.traverse(null,q=>{q.d!=null&&(ne[q.d]=G.clone())});const Ue=s.writeCursor();return function q(Se,Ve,je,ke,Ze,Ot,Ke,rt){o(Ve||je);const Xe=a(Ve),dt=a(je),lt=!!dt&&dt.r!==void 0,Yt=!!Xe&&Xe.i!==void 0,Be=Xe?Xe.d:null,ft=dt?dt.p:null,C=(Ot||lt)&&ft==null;if(ft!=null)ke=ne[ft],Ke=le[ft]=new s.WriteCursor;else if(dt&&dt.r!==void 0)ke=null;else{const U=a(ke);U&&U.d!=null&&(ke=null)}const m=a(ke);if(Be!=null)if(Se=H[Be],rt=he[Be]=new s.WriteCursor,C)Ot&&!lt&&rt.write("r",!0);else{const U=ae[Be]=X++;Ke.write("d",U)}else if(Xe&&Xe.i!==void 0)Se=null;else{const U=a(Se);U&&U.p!=null&&(Se=null)}let _;Yt?(o(Ze===void 0),_=Xe.i):_=Ze;const y=(ft==null?!Yt||Ot||lt:_===void 0)?null:Ke.getComponent();if(ft!=null){if(!(Ze!==void 0||Yt)){const U=Be!=null?ae[Be]:X++;_e[ft]=U,rt.write("p",U)}}else lt&&(Yt||Ze!==void 0||(dt.r,rt.write("r",dt.r)));const D=C?null:ie(Xe),k=ie(m);if((D||k)&&(D&&D.name,k&&k.name),D&&k){o(D===k);const U=N(Xe),te=N(m),Ie=D.compose(U,te);T(Ke,D,Ie),Ae.add(m)}else D?T(Ke,D,N(Xe)):k&&(T(Ke,k,N(m)),Ae.add(m));const P=typeof _=="object"&&_!=null;let F=!1,S=0,ee=0,Ee=0,Z=0,pe=0;const be=s.advancer(ke,(U,te)=>h(te)?Z-U-1:U-Z,(U,te)=>{h(te)&&Z++}),de=s.advancer(Se,(U,te)=>c(te)?S-U-1:U-S,(U,te)=>{c(te)&&S++});if(s.eachChildOf(Ve,je,(U,te,Ie)=>{let ye,Fe,xe=U,ze=U,gt=U;if(typeof U=="number"){let De=U+Ee;Fe=be(De),ze=De+Z;let se=U+ee;ye=de(se),h(a(Fe))&&(ye=null),xe=se+S,gt=U+pe,o(xe>=0,"p1PickKey is negative"),o(ze>=0,"p2DropKey is negative");const ct=h(a(te)),He=c(a(Ie));(ct||He&&!C)&&pe--,ct&&ee--,He&&Ee--}else ye=de(U),Fe=be(U);rt.descend(xe),Ke.descend(ze);const pt=P&&!h(a(te))?_[gt]:void 0,Re=q(ye,te,Ie,Fe,pt,C,Ke,rt);var et,we,Oe;P&&!C?pt!==Re&&(F||(_=Array.isArray(_)?_.slice():Object.assign({},_),F=!0),et=_,Oe=Re,typeof(we=gt)=="number"?(o(Array.isArray(et)),o(we<et.length)):(o(!Array.isArray(et)),o(et[we]!==void 0)),Oe===void 0?typeof we=="number"?et.splice(we,1):delete et[we]:et[we]=Oe):o(Re===void 0),Ke.ascend(),rt.ascend()}),de.end(),be.end(),y!=null)y.i=_;else if(!Ot&&!lt&&ft==null)return _}(J,J.clone(),G,G.clone(),void 0,!1,z,Ue),z.reset(),z.mergeTree(Ue.get()),z.reset(),z.get(),he.map(q=>q.get()),le.map(q=>q.get()),J.traverse(z,(q,Se)=>{const Ve=q.p;if(Ve!=null){const je=ae[Ve];je!=null&&Se.write("p",je);const ke=he[Ve];ke&&ke.get(),ke&&Se.mergeTree(ke.get())}else q.r!==void 0&&Se.write("r",q.r)}),z.reset(),z.get(),G.traverse(z,(q,Se)=>{const Ve=q.d;if(Ve!=null){const ke=_e[Ve];ke!=null&&Se.write("d",ke);const Ze=le[Ve];Ze&&Se.mergeTree(Ze.get())}else q.i!==void 0&&Se.write("i",q.i);const je=ie(q);je&&!Ae.has(q)&&T(Se,je,N(q))}),z.get()}function L(v){if(v==null)return null;const B=new s.ReadCursor(v),X=new s.WriteCursor;let J;const G=[],z=[];return function he(le,H,ne){const ae=le.getComponent();let _e,Ae=!1;if(ae){ae.p!=null&&(H.write("d",ae.p),G[ae.p]=le.clone()),ae.r!==void 0&&H.write("i",ae.r),ae.d!=null&&(H.write("p",ae.d),ne=void 0),ae.i!==void 0&&(ne=_e=ae.i);const q=ie(ae);q&&(ne===void 0?(J||(J=new Set),J.add(ae)):(N(ae),ne=q.apply(ne,N(ae)),Ae=!0))}let Ue=0;for(const q of le){H.descend(q);const Se=typeof q=="number"?q-Ue:q,Ve=I(ne,Se);h(le.getComponent())&&Ue++;const je=he(le,H,Ve);if(ne!==void 0&&je!==void 0){if(Ae||(Ae=!0,ne=u(ne)),!E(ne,Se))throw Error("Cannot modify child - invalid operation");ne[Se]=je}H.ascend()}if(_e===void 0)return Ae?ne:void 0;H.write("r",ne)}(B,X,void 0),J&&(X.reset(),function he(le,H,ne){const ae=H.getComponent();if(ae){const q=ae.d;if(q!=null&&(le=G[q],ne=z[q]=s.writeCursor()),J.has(ae)){const Se=ie(ae);if(!Se.invert)throw Error(`Cannot invert subtype ${Se.name}`);T(ne,Se,Se.invert(N(ae)))}}let _e=0,Ae=0;const Ue=s.advancer(le,(q,Se)=>c(Se)?_e-q-1:q-_e,(q,Se)=>{c(Se)&&_e++});for(const q of H)if(typeof q=="number"){const Se=q-Ae,Ve=Ue(Se),je=Se+_e;ne.descend(je),he(Ve,H,ne),h(H.getComponent())&&Ae++,ne.ascend()}else ne.descend(q),he(Ue(q),H,ne),ne.ascend();Ue.end()}(B.clone(),B,X),z.length&&(X.reset(),B.traverse(X,(he,le)=>{const H=he.p;if(H!=null){const ne=z[H];ne&&ne.get(),ne&&le.mergeTree(ne.get())}}))),X.get()}const A=(v,B)=>v.some(X=>typeof X=="object"&&(Array.isArray(X)?A(X,B):B(X)));function w(v,B){if(v==null||!A(v,H=>{var ne;return H.r!==void 0||((ne=ie(H))===null||ne===void 0?void 0:ne.makeInvertible)!=null}))return v;const X=new s.ReadCursor(v),J=new s.WriteCursor;let G=!1;const z=[],he=[],le=(H,ne,ae)=>{const _e=H.getComponent();let Ae=!1;if(_e){_e.d!=null&&ne.write("d",_e.d),_e.i!==void 0&&ne.write("i",_e.i);const q=_e.p;if(q!=null&&(z[q]=H.clone(),o(ae!==void 0,"Operation picks up at an invalid key"),he[q]=ae,ne.write("p",_e.p)),_e.r!==void 0&&ae===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Se=ie(_e);Se&&(Se.makeInvertible?G=!0:T(ne,Se,N(_e),!0))}let Ue=0;for(const q of H){ne.descend(q);const Se=typeof q=="number"?q-Ue:q,Ve=I(ae,Se),je=le(H,ne,Ve);Ve!==je&&(Ae||(Ae=!0,ae=u(ae)),je===void 0?(ae=d(ae,Se),typeof q=="number"&&Ue++):ae[Se]=je),ne.ascend()}return _e&&(_e.r!==void 0?(ne.write("r",r.default(ae)),ae=void 0):_e.p!=null&&(ae=void 0)),ae};return le(X,J,B),J.get(),G&&(J.reset(),function H(ne,ae,_e,Ae,Ue){const q=ae.getComponent();if(q){q.i!==void 0?(Ae=q.i,Ue=!0):q.d!=null&&(Ae=he[q.d],ne=z[q.d],Ue=!1,q.d);let ke=ie(q);if(ke&&ke.makeInvertible){const Ze=N(q);T(_e,ke,ke.makeInvertible(Ze,Ae),!0)}}let Se=0,Ve=0;const je=s.advancer(ne,(ke,Ze)=>c(Ze)?Se-ke-1:ke-Se,(ke,Ze)=>{c(Ze)&&Se++});for(const ke of ae)if(typeof ke=="number"){const Ze=ke-Ve,Ot=je(Ze),Ke=Ze+Se,rt=I(Ae,Ue?Ze:Ke);_e.descend(ke),H(Ot,ae,_e,rt,Ue),h(ae.getComponent())&&Ve++,_e.ascend()}else{const Ze=I(Ae,ke);_e.descend(ke),H(je(ke),ae,_e,Ze,Ue),_e.ascend()}je.end()}(X.clone(),X,J,B,!1)),J.get()}function x(v,B){return L(w(v,B))}const $=v=>{if(v==null)return null;const B=v.slice();for(let X=0;X<v.length;X++){const J=B[X];Array.isArray(J)&&(B[X]=$(J))}return B};function K(v,B,X){o(X==="left"||X==="right","Direction must be left or right");const J=X==="left"?0:1;if(B==null)return{ok:!0,result:v};ge(v),ge(B);let G=null;const z=[],he=[],le=[],H=[],ne=[],ae=[],_e=[],Ae=[],Ue=[],q=[],Se=[],Ve=[],je=[],ke=[],Ze=[];let Ot=0;const Ke=s.readCursor(v),rt=s.readCursor(B),Xe=s.writeCursor();if(function m(_,y=null,D){const k=a(y);k&&(k.r!==void 0?D=y.clone():k.p!=null&&(D=null,ae[k.p]=_.clone()));const P=_.getComponent();let F;P&&(F=P.p)!=null&&(ne[F]=y?y.clone():null,le[F]=_.clone(),D&&(q[F]=!0,Ue[F]=D),k&&k.p!=null&&(ke[F]=k.p));const S=s.advancer(y);for(const ee of _)m(_,S(ee),D);S.end()}(rt,Ke,null),function m(_,y,D,k,P){const F=D.getComponent();let S,ee=!1;F&&((S=F.d)!=null?(H[S]=D.clone(),k!=null&&(Ze[k]==null&&(Ze[k]=[]),Ze[k].push(S)),q[S],_=ne[S]||null,y=le[S]||null,q[S]?(P&&(Se[S]=!0),P=Ue[S]||null):!P||J!==1&&ke[S]!=null||G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(P.getPath()),op2:e.moveOp(y.getPath(),D.getPath())}),ee=!0):F.i!==void 0&&(_=y=null,ee=!0,P&&G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(P.getPath()),op2:e.insertOp(D.getPath(),F.i)})));const Ee=a(_);Ee&&(Ee.r!==void 0?P=_.clone():Ee.p!=null&&(Ee.p,k=Ee.p,P=null));const Z=ie(F);Z&&P&&G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(P.getPath()),op2:e.editOp(D.getPath(),Z,N(F),!0)});let pe=0,be=0;const de=s.advancer(y,(te,Ie)=>c(Ie)?pe-te-1:te-pe,(te,Ie)=>{c(Ie)&&pe++}),U=s.advancer(_);for(const te of D)if(typeof te=="number"){const Ie=te-be,ye=de(Ie);be+=+m(U(Ie+pe),ye,D,k,P)}else{const Ie=de(te);m(U(te),Ie,D,k,P)}return de.end(),U.end(),ee}(Ke,rt,rt.clone(),null,null),H.map(m=>m&&m.get()),G)return{ok:!1,conflict:G};Se.map(m=>!!m);const dt=[];let lt=null;(function m(_,y,D,k,P){let F=!1;const S=a(y);if(c(S)){const de=S.p;de!=null?(D=H[de],k=Ve[de]=s.writeCursor(),F=!0,P=null):(D=null,P=y.clone())}else h(a(D))&&(D=null);const ee=_.getComponent();if(ee){const de=ee.p;de!=null?(P&&(Ae[de]=P),dt[de]=P||J===1&&F?null:k.getComponent(),z[de]=_.clone(),D&&(_e[de]=D.clone())):ee.r!==void 0&&(P||k.write("r",!0),(P||F)&&(lt==null&&(lt=new Set),lt.add(ee)))}let Ee=0,Z=0;const pe=s.advancer(y,void 0,(de,U)=>{c(U)&&Ee++}),be=s.advancer(D,(de,U)=>h(U)?~(de-Z):de-Z,(de,U)=>{h(U)&&Z++});if(_)for(const de of _)if(typeof de=="string"){const U=pe(de),te=be(de);k.descend(de),m(_,U,te,k,P),k.ascend()}else{const U=pe(de),te=de-Ee,Ie=c(a(U))?null:be(te),ye=te+Z;o(ye>=0),k.descend(ye),m(_,U,Ie,k,P),k.ascend()}pe.end(),be.end()})(Ke,rt,rt.clone(),Xe,null),Xe.reset();let Yt=[];if(function m(_,y,D,k,P,F){o(y);const S=y.getComponent();let ee=a(k),Ee=!1;const Z=(we,Oe,De)=>we?e.moveOp(we.getPath(),Oe.getPath()):e.insertOp(Oe.getPath(),De.i);if(h(S)){const we=S.d;we!=null&&(he[we]=y.clone());const Oe=we!=null?dt[we]:null;let De=!1;if(S.i!==void 0||we!=null&&Oe){let se;ee&&(ee.i!==void 0||(se=ee.d)!=null&&!q[se])&&(De=se!=null?we!=null&&we===ke[se]:n.default(ee.i,S.i),De||se!=null&&J!==1&&ke[se]!=null||G==null&&(G={type:i.ConflictType.DROP_COLLISION,op1:Z(we!=null?z[we]:null,y,S),op2:Z(se!=null?le[se]:null,k,ee)})),De||(F?G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Z(we!=null?z[we]:null,y,S),op2:e.removeOp(F.getPath())}):(we!=null?(Yt[Ot]=we,P.write("d",Oe.p=Ot++)):P.write("i",r.default(S.i)),Ee=!0))}else if(we!=null&&!Oe){const se=Ae[we];se&&(F=se.clone())}we!=null?(_=z[we],D=ae[we],k=_e[we]):S.i!==void 0&&(_=D=null,De||(k=null))}else c(a(_))&&(_=D=k=null);const pe=a(_),be=a(D);if(c(be)){const we=be.p;be.r!==void 0&&(!pe||pe.r===void 0)||q[we]?(k=null,F=D.clone()):we!=null&&(k=H[we],J!==1&&ke[we]!=null||((P=je[we])||(P=je[we]=s.writeCursor()),P.reset(),F=null))}else!h(S)&&h(ee)&&(k=null);ee=k!=null?k.getComponent():null;const de=ie(S);if(de){const we=N(S);if(F)G==null&&(G={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(y.getPath(),de,we,!0),op2:e.removeOp(F.getPath())});else{const Oe=ie(ee);let De;if(Oe){if(de!==Oe)throw Error("Transforming incompatible types");const se=N(ee);De=de.transform(we,se,X)}else De=r.default(we);T(P,de,De)}}let U=0,te=0,Ie=0,ye=0,Fe=0,xe=0,ze=_!=null&&_.descendFirst(),gt=ze;const pt=s.advancer(D,void 0,(we,Oe)=>{c(Oe)&&Ie++});let Re=k!=null&&k.descendFirst(),et=Re;for(const we of y)if(typeof we=="number"){let Oe;const De=h(y.getComponent()),se=we-te;{let tn;for(;ze&&typeof(tn=_.getKey())=="number";){tn+=U;const Dt=_.getComponent(),kn=c(Dt);if(tn>se||tn===se&&(!kn||J===0&&De))break;if(kn){U--;const mn=Dt.p;ke.includes(mn),Dt.d,a(je[Dt.d]),c(a(je[Dt.d])),(Dt.r===void 0||lt&<.has(Dt))&&(mn==null||!dt[mn]||J!==1&&ke.includes(mn))||Fe--}ze=_.nextSibling()}Oe=ze&&tn===se?_:null}const ct=se-U;let He=pt(ct);const kt=ct-Ie;let hs=null;{let tn,Dt;for(;Re&&typeof(tn=k.getKey())=="number";){Dt=tn-ye;const kn=k.getComponent(),mn=h(kn);if(Dt>kt)break;if(Dt===kt){if(!mn){hs=k;break}{if(J===0&&De){hs=k;break}const nn=He&&c(He.getComponent());if(J===0&&nn)break}}if(mn){const nn=kn.d;q[nn],ke[nn],kn.i===void 0&&(q[nn]||ke[nn]!=null&&J!==1)?(q[nn]||ke[nn]!=null&&J===0)&&(ye++,xe--):ye++}Re=k.nextSibling()}}const oc=kt+ye+Fe+xe;o(oc>=0,"trying to descend to a negative index"),P.descend(oc),De&&(Oe=He=hs=null,te++),m(Oe,y,He,hs,P,F)&&xe++,P.ascend()}else{let Oe;for(;ze&&(Oe=_.getKey(),typeof Oe!="string"||!(Oe>we||Oe===we));)ze=_.nextSibling();const De=ze&&Oe===we?_:null,se=pt(we);let ct;for(;Re&&(ct=k.getKey(),typeof ct!="string"||!(ct>we||ct===we));)Re=k.nextSibling();const He=Re&&ct===we?k:null;P.descend(we),m(De,y,se,He,P,F),P.ascend()}return pt.end(),gt&&_.ascend(),et&&k.ascend(),Ee}(Ke,Ke.clone(),rt,rt.clone(),Xe,null),G)return{ok:!1,conflict:G};Xe.reset();const Be=(m,_,y)=>m.traverse(_,(D,k)=>{D.d!=null&&y(D.d,m,k)});(q.length||Ve.length)&&(Be(rt,Xe,(m,_,y)=>{q[m]&&!Se[m]&&y.write("r",!0),Ve[m]&&y.mergeTree(Ve[m].get())}),Xe.reset());const ft=[],C=[];if((je.length||q.length)&&!G){const m=s.readCursor($(Xe.get()));if(Be(m,null,(_,y)=>{ft[_]=y.clone()}),je.forEach(_=>{_&&Be(s.readCursor(_.get()),null,(y,D)=>{ft[y]=D.clone()})}),function _(y,D,k,P,F,S){const ee=a(D);if(ee&&c(ee))if(ee.p!=null){const U=ee.p;ft[U].getPath(),k=ft[U],P=C[U]=s.writeCursor()}else ee.r!==void 0&&(k=null);else h(a(k))&&(k=null);const Ee=y.getComponent();if(Ee){let U;if((U=Ee.d)!=null){const te=je[U];te&&(te.get(),P.mergeTree(te.get()),k=s.readCursor(te.get()))}}let Z=0,pe=0;const be=s.advancer(D,void 0,(U,te)=>{c(te)&&Z--}),de=s.advancer(k,(U,te)=>h(te)?-(U-pe)-1:U-pe,(U,te)=>{h(te)&&pe++});for(const U of y)if(typeof U=="number"){const te=be(U),Ie=U+Z,ye=de(Ie),Fe=Ie+pe;P.descend(Fe),_(y,te,ye,P),P.ascend()}else P.descend(U),_(y,be(U),de(U),P),P.ascend();be.end(),de.end()}(rt,m,m.clone(),Xe),Xe.reset(),G)return{ok:!1,conflict:G};if(Xe.get(),C.length){const _=C.map(D=>D?D.get():null),y=s.readCursor($(Xe.get()));if(Be(y,Xe,(D,k,P)=>{const F=_[D];F&&(P.mergeTree(F),_[D]=null)}),_.find(D=>D)){const D=s.writeCursor(),k=s.writeCursor();let P=0,F=0;_.forEach(S=>{S!=null&&Be(s.readCursor(S),null,ee=>{const Ee=Yt[ee];D.writeMove(z[Ee].getPath(),he[Ee].getPath(),P++);const Z=Ze[Ee];Z&&Z.forEach(pe=>{q[pe]||J!==1&&ke[pe]!=null||k.writeMove(le[pe].getPath(),H[pe].getPath(),F++)})})}),G={type:i.ConflictType.BLACKHOLE,op1:D.get(),op2:k.get()}}}}return G?{ok:!1,conflict:G}:{ok:!0,result:Xe.get()}}const oe=v=>{const B=new Error("Transform detected write conflict");throw B.conflict=v,B.type=B.name="writeConflict",B};function fe(v,B,X){const J=K(v,B,X);if(J.ok)return J.result;oe(J.conflict)}const me=v=>{const B=s.writeCursor();return s.readCursor(v).traverse(B,(X,J)=>{(h(X)||ie(X))&&J.write("r",!0)}),B.get()},Me=(v,B)=>{const{type:X,op1:J,op2:G}=v;switch(X){case i.ConflictType.DROP_COLLISION:return B==="left"?[null,me(G)]:[me(J),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let z=!1;return s.readCursor(J).traverse(null,he=>{he.r!==void 0&&(z=!0)}),z?[null,me(G)]:[me(J),null];case i.ConflictType.BLACKHOLE:return[me(J),me(G)];default:throw Error("Unrecognised conflict: "+X)}};function Te(v,B,X,J){let G=null;for(;;){const z=K(B,X,J);if(z.ok)return O(G,z.result);{const{conflict:he}=z;v(he)||oe(he);const[le,H]=Me(he,J);B=O(ce(B),le),X=O(ce(X),H),G=O(G,H)}}}}(nr)),nr}var bl;function v_(){return bl||(bl=1,function(e){var t=cn&&cn.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=cn&&cn.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(S_(),e);var r=El();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Rl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(cn)),cn}var _t=v_();const O_=lc({__proto__:null,default:Et(_t)},[_t]);var ue=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(ue||{});function rr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Ro(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Al(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:g}=h;if(g<=r)i.push(h);else if(r>d&&r<g){a=!0;const E={...h,ed:r};i.push(E),l.length&&i.push(...l);const I={...h,st:r+n,ed:g+n};i.push(I)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=rr(i)}function Tl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Jn("startIndex"))}}function yl(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Jn("startIndex"))}}function Nl(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Jn("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Ml(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Jn("startIndex"))}}const Dl="$",Ll=e=>e.split(Dl)[0];function si(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Ll(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Ll(i.rangeId),i.rangeId===n.rangeId&&gl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Dl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function ii(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Ul(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function oi(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function w_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;ii(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=si(s)}function b_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;oi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Ul(s)}function Pl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function kl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function Fl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function xl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Bl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const g=Br(h,d,s,i);if(g.length===0||(c.startIndex=g[0],c.endIndex=g[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function A_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const g=Br(h,d,s,i);if(g.length===0)continue;c.startIndex=g[0],c.endIndex=g[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=si(a)}return o}function T_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:g}=h;if(d>=i&&g<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,g)){const E=Br(d,g,i,o);if(E.length===0)continue;h.startIndex=E[0],h.endIndex=E[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var $l=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))($l||{}),Pt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Pt||{});const ns={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},An=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Tn=e=>e.map((t,n)=>({...t,bulletAlignment:Vn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Hl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Vn.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),sr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:An(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:An(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:An(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:An(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:An(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:An(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:Tn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:Tn([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:Tn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:Tn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:Tn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:Tn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Hl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Hl("☑",{st:{s:ve.TRUE}})}},rs=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(sr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},y_={ORDER_LIST_QUICK_2:rs(ns["a)"]),ORDER_LIST_QUICK_3:rs(ns["a."]),ORDER_LIST_QUICK_4:rs(ns["i."]),ORDER_LIST_QUICK_6:rs(ns["I."])};Object.assign(sr,y_);const N_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function M_(e,t,n,r,s){const i=D_(e,t,n,r,s),o=L_(e,t,n,r,s),a=U_(e,t,n,r,s),l=P_(e,t,n,r,s),u=k_(e,t,n,r,s),c=F_(e,t,n,r),h=x_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function D_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Pl(e,n,r);if(s!==Pe.REPLACE){const l=Wl(o,a,s);t.textRuns=l}return Al(e,t,n,r),a}function Wl(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:g,ed:E,ts:I}=e[o],{st:b,ed:M,ts:V,sId:Y}=t[a];let ie;if(n===Pe.COVER?ie={...V,...I}:ie={...I},E<b)u()||r.push(e[o]),o++;else if(M<g)u()||r.push(t[a]),a++;else{const N={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...I}:{...V},sId:g<b?void 0:Y};N.ed>N.st&&r.push(N),r.push({st:Math.max(g,b),ed:Math.min(E,M),ts:ie,sId:Y}),E<M?(o++,t[a].st=E,t[a].st===t[a].ed&&a++):(a++,e[o].st=M,e[o].st===e[o].ed&&o++);const T={st:Math.min(E,M),ed:Math.max(E,M),ts:E<M?{...V}:{...I},sId:E<M?Y:void 0};l=T.ed>T.st?T:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),rr(r)}function L_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=kl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let g=[];for(const E of a){const{startIndex:I,paragraphStyle:b,bullet:M}=E;let V,Y;if(s===Pe.COVER?(V={...b,...h},Y={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...M,...d}):(V={...h,...b},Y={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...M}),c===I){g.push({startIndex:c,paragraphStyle:V,bullet:Y});break}}l.push(...g),g=[]}t.paragraphs=l}return Tl(e,t,n,r),a}function U_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Fl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:g}=d;if(c===g){s===Pe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return yl(e,t,n,r),a}function P_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=xl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:g}=d;if(c===g){s===Pe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return Nl(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function k_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Bl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const g of a){const{startIndex:E,endIndex:I}=g;if(E>=c&&I<=h){s===Pe.COVER?d.push({...g,...u}):d.push({...u,...g});break}}l.push(...d),d=[]}t.tables=l}return Ml(e,t,n,r),a}function F_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),ii(e.customRanges,r),ii(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:g}=h;d>=i&&g<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:g}=h;l.push({...h,startIndex:d+r,endIndex:g+r})}),e.customRanges=si(l),c):[]}function x_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),oi(e.customDecorations,r),oi(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Pe.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===an.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=Ul(o),i}var ai=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(ai||{});function ss(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return rr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function jl(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Yl(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=re.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function B_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function zl(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Nt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=ss(e,t,n,r);const a=jl(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Yl(e,t,n),s===1){const u=Vl(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=Gl(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=zl(e,t,n),o}function $_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Gl(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Vl(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function H_(e,t,n){return e==null||t==null?e!=null?e:t:Wl(e,t,n)}function W_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Pe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function j_(e,t,n){return t.length===0||e.length===0||n===Pe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function li(e,t,n=Pe.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=H_(l,s,n),r.customRanges=W_(c,o,n);const d=j_(h,a,n);d.length&&(r.customDecorations=d);const g=[];let E=0,I=0;for(;E<i.length&&I<u.length;){const b=i[E],M=u[I],{startIndex:V}=b,{startIndex:Y}=M;V===Y?(g.push(re.deepMerge(b,M)),E++,I++):V<Y?(g.push(re.deepClone(b)),E++):(g.push(re.deepClone(M)),I++)}return E<i.length&&g.push(...i.slice(E)),I<u.length&&g.push(...u.slice(I)),g.length&&(r.paragraphs=g),r}function Y_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class yn{constructor(t){R(this,"_index",0);R(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===ue.DELETE||n.t===ue.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:Nt(n.body,r,r+t,!1)})}else return{t:ue.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 t=this._actions[this._index];return t?t.t:ue.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class dn{constructor(){R(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function Kl(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Pl(e,t,n),a=kl(e,t,n),l=Fl(e,t,n),u=xl(e,t,n),c=Bl(e,t,n),h=A_(e,t,n),d=T_(e,t,n);let g="";return r&&(e.dataStream=Do(r,s,i),g=r.slice(s,i)),{dataStream:g,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function Xl(e,t,n,r){e.dataStream=Mo(e.dataStream,r,t.dataStream),Al(e,t,n,r),Tl(e,t,n,r),yl(e,t,n,r),Nl(e,t,n,r),Ml(e,t,n,r),w_(e,t,n,r),b_(e,t,n,r)}function z_(e,t,n,r,s=Pe.COVER){return M_(e,t,n,r,s)}function G_(e,t,n){return t<=0?{dataStream:""}:Kl(e,t,n)}function V_(e,t,n,r){n!==0&&Xl(e,t,n,r)}function K_(e,t){const n=new dn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case ue.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&z_(e,o,a,n.cursor,i),n.moveCursor(a);break}case ue.INSERT:{const{body:i,len:o}=s;V_(e,i,o,n.cursor),n.moveCursor(o);break}case ue.DELETE:{const{len:i}=s;G_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function X_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:I,ed:b,ts:M}=t[l],{st:V,ed:Y,ts:ie,sId:N}=e[u];let T={};if(s===0)T={...M},n===Pe.COVER&&r===Pe.REPLACE&&ie&&(T=Object.assign({},ie,T));else if(T={...M},n===Pe.REPLACE){if(r===Pe.REPLACE)T={...ie};else if(M&&ie){const j=Object.keys(M);for(const Q of j)ie[Q]&&delete T[Q]}}else if(r===Pe.REPLACE){if(ie){const j=Object.keys(ie);for(const Q of j)ie[Q]!==void 0&&(T[Q]=ie[Q])}}else if(ie){const j=Object.keys(ie);for(const Q of j)T[Q]!==void 0&&delete T[Q]}if(b<V)h()||i.push(t[l]),l++;else if(Y<I)h()||i.push(e[u]),u++;else{const j={st:Math.min(I,V),ed:Math.max(I,V),ts:I<V?{...M}:{...ie}};j.ed>j.st&&i.push(),i.push({st:Math.max(I,V),ed:Math.min(b,Y),ts:T,sId:N}),b<Y?(l++,e[u].st=b,e[u].st===e[u].ed&&u++):(u++,t[l].st=Y,t[l].st===t[l].ed&&l++);const Q={st:Math.min(b,Y),ed:Math.max(b,Y),ts:b<Y?{...ie}:{...M},sId:b<Y?N:void 0};c=Q.ed>Q.st?Q:null}}h();const d=i[i.length-1],g=t[o-1],E=e[a-1];return d.ed!==Math.max(g.ed,E.ed)&&(g.ed>E.ed?i.push(g):i.push(E)),rr(i,!0)}function q_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Pe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===Pe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function ql(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Pe.REPLACE)if(r===Pe.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Pe.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Pe.REPLACE&&r===Pe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===Pe.REPLACE||r===Pe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function J_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===an.DELETED||i===an.DELETED)&&(o=!0,n.push({...r,type:an.DELETED}));break}o||n.push(r)}return n}function Z_(e,t,n=!1){const{body:r,coverType:s=Pe.COVER}=e,{body:i,coverType:o=Pe.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:g,paragraphs:E=[],customRanges:I,customDecorations:b}=i,M=X_(u,g,s,o,n?1:0);M&&(a.textRuns=M);const V=q_(h,I,s,o,n?1:0);V&&(a.customRanges=V);const Y=J_(d,b);Y&&(a.customDecorations=Y);const ie=[];let N=0,T=0;for(;N<c.length&&T<E.length;){const j=c[N],Q=E[T],{startIndex:ge}=j,{startIndex:ce}=Q;if(ge===ce){let p={startIndex:ge};n?p=ql(j,Q,s,o,1):p=ql(j,Q,s,o,0),ie.push(p),N++,T++}else ge<ce?N++:(ie.push(re.deepClone(Q)),T++)}return T<E.length&&ie.push(...E.slice(T)),ie.length&&(a.paragraphs=ie),{coverType:l,body:a}}function Jl(e){return Object.keys(e).length===1}const Un=class Un{constructor(){R(this,"_actions",[])}static apply(t,n){return K_(t,n)}static compose(t,n){const r=new yn(t),s=new yn(n),i=new Un;for(;r.hasNext()||s.hasNext();)if(s.peekType()===ue.INSERT)i.push(s.next());else if(r.peekType()===ue.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===ue.INSERT&&l.t===ue.RETAIN)l.body==null?i.push(a):i.push({...a,body:li(a.body,l.body,l.coverType)});else if(a.t===ue.RETAIN&&l.t===ue.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===Pe.REPLACE||l.coverType===Pe.REPLACE?Pe.REPLACE:Pe.COVER;i.push({...a,t:ue.RETAIN,coverType:u,body:li(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===ue.RETAIN&&l.t===ue.DELETE?i.push(l):a.t===ue.INSERT&&(l.t,ue.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new yn(t),i=new yn(n),o=new Un;for(;s.hasNext()||i.hasNext();)if(s.peekType()===ue.INSERT&&(r==="left"||i.peekType()!==ue.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===ue.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===ue.DELETE)continue;if(u.t===ue.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=Z_(l,u,r==="left");o.push({...u,t:ue.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new yn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===ue.DELETE){n-=Math.min(o,n-i);continue}else a===ue.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===ue.INSERT)n.push({t:ue.DELETE,len:r.len,body:r.body});else if(r.t===ue.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:ue.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:ue.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Pe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===ue.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Nt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===ue.RETAIN&&i.body!=null){const o=Nt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==ue.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:ue.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:ue.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:ue.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===ue.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===ue.DELETE&&s.t===ue.DELETE)return r.len+=s.len,this;if(r.t===ue.DELETE&&s.t===ue.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===ue.RETAIN&&s.t===ue.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===ue.INSERT&&Jl(r.body)&&s.t===ue.INSERT&&Jl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===ue.RETAIN&&Y_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};R(Un,"id","text-x"),R(Un,"uri","https://github.com/dream-num/univer#text-x");let Ye=Un;Object.defineProperty(Ye,"name",{value:"text-x"});const Pn=class Pn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ye.id||(this._subTypes.set(t.name,t),_t.type.registerSubtype(t))}static apply(t,n){if(!_t.type.isNoop(n))return _t.type.apply(t,n)}static compose(t,n){return _t.type.compose(t,n)}static transform(t,n,r){return _t.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ye.name?Ye.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return _t.type.invertWithDoc(t,n)}static isNoop(t){return _t.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Pn),this._instance}removeOp(t,n){return _t.removeOp(t,n)}moveOp(t,n){return _t.moveOp(t,n)}insertOp(t,n){return _t.insertOp(t,n)}replaceOp(t,n,r){return _t.replaceOp(t,n,r)}editOp(t,n=["body"]){return _t.editOp(n,Ye.name,t)}};R(Pn,"uri","https://github.com/dream-num/univer#json-x"),R(Pn,"_subTypes",new Map),R(Pn,"_instance",null);let Wt=Pn;Wt.registerSubtype(Ye);const ui={id:"default_doc",documentStyle:{}};class Q_ extends Zr{constructor(n){var r;super();R(this,"type",$e.UNIVER_DOC);R(this,"_name$",new Ce.BehaviorSubject(""));R(this,"name$",this._name$.asObservable());R(this,"snapshot");this.snapshot={...ui,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...sr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class Mt extends Q_{constructor(n){var s,i;super(re.isEmptyObject(n)?p_():n);R(this,"_unitId");R(this,"headerModelMap",new Map);R(this,"footerModelMap",new Map);R(this,"change$",new Ce.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...ui,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Wt.isNoop(n))return this.snapshot=Wt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=ai.copy){const i=this.getBody();if(i!=null)return Nt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new Mt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Mt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Gr((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function ep(e){const{ranges:t,id:n,type:r}=e,s=new Ye;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:ue.RETAIN,len:l-i}),s.push({t:ue.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function tp(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(g=>g.id===t);if(!i)return!1;const o=new Ye,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:ue.RETAIN,len:a}),o.push({t:ue.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:an.DELETED}]}}),o}function Zl(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function np(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Zl(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function rp(e){return{...re.deepClone(e),rangeId:Bt()}}function sp(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Ql(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function ip(e,t){var i,o,a,l,u;const n=Ql(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function op(e){var h,d,g;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(E=>E.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ye,u=a-o+1;l.push({t:ue.RETAIN,len:o}),l.push({t:ue.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:ue.INSERT,body:s,len:s.dataStream.length});const c=a+1+((g=s==null?void 0:s.dataStream.length)!=null?g:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function ap(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ye;let u=!1;return t.forEach(c=>{var Y,ie,N;const h=ip(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:g}=h,E=(Y=o.customRanges)!=null?Y:[],I=(T,j,Q)=>{var O,L,A,w;const ge=Ql(T,j,E,r),ce=Math.min((L=(O=ge[0])==null?void 0:O.startIndex)!=null?L:1/0,T),p=Math.max((w=(A=ge[ge.length-1])==null?void 0:A.endIndex)!=null?w:-1/0,j),W={rangeId:Q?`${n}$${Q}`:n,rangeType:r,startIndex:0,endIndex:p-ce,wholeEntity:s,properties:{...i}};l.push({t:ue.RETAIN,len:ce-a}),l.push({t:ue.RETAIN,len:p-ce+1,body:{dataStream:"",customRanges:[W]},coverType:Pe.COVER}),a=p+1},b=((ie=o.paragraphs)!=null?ie:[]).filter(T=>T.startIndex<g&&T.startIndex>d),M=((N=o.customBlocks)!=null?N:[]).filter(T=>T.startIndex<g&&T.startIndex>d);sp([d,g-1],[...b.map(T=>T.startIndex),...M.map(T=>T.startIndex)]).forEach(([T,j],Q)=>I(T,j,Q)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function eu(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:ue.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:ue.DELETE,len:h-l}),l=h)}),r&&i.push({t:ue.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:ue.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Pe.REPLACE}))}return i}function lp(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:ue.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:ue.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const up=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Nt(i,t.startOffset,t.endOffset),a=Xs(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,g])=>{switch(d){case 0:{const E={t:ue.RETAIN,body:{...Nt(n,l,l+g.length,!1),dataStream:""},len:g.length};return l+=g.length,E}case 1:{const E={t:ue.INSERT,body:Nt(n,l,l+g.length),len:g.length};return l+=g.length,E}default:return{t:ue.DELETE,len:g.length}}}),c=new Ye;return c.push({t:ue.RETAIN,len:t.startOffset}),c.push(...u),c};function cp(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const hp=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Nt(i,t.startOffset,t.endOffset),a=Xs(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,g])=>{switch(d){case 0:{const E=ss(n,l,l+g.length,!1),I=ss(o,l,l+g.length,!1),b={t:ue.RETAIN,body:cp(E,I)?void 0:{textRuns:E,dataStream:""},len:g.length};return l+=g.length,b}case 1:{const E={t:ue.INSERT,body:Nt(n,l,l+g.length),len:g.length};return l+=g.length,E}default:return{t:ue.DELETE,len:g.length}}});if(u.every(d=>d.t===ue.RETAIN&&!d.body))return!1;const c=new Ye;return c.push({t:ue.RETAIN,len:t.startOffset}),c.push(...u),c};function dp(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function fp(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const gp=e=>{var I,b,M,V;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ye,l=Wt.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(b=(I=n.getSnapshot().drawingsOrder)==null?void 0:I.length)!=null?b:0;let d=0;if(s)i>0&&a.push({t:ue.RETAIN,len:i});else{const Y=eu([t],c,0,null,!1);a.push(...Y);const ie=dp(c,[t]),N=(M=n.getDrawings())!=null?M:{},T=(V=n.getDrawingsOrder())!=null?V:[],j=ie.sort((Q,ge)=>T.indexOf(Q)>T.indexOf(ge)?-1:T.indexOf(Q)<T.indexOf(ge)?1:0);if(j.length>0)for(const Q of j){const ge=N[Q],ce=T.indexOf(Q);if(ge==null||ce<0)continue;const p=l.removeOp(["drawings",Q],ge),W=l.removeOp(["drawingsOrder",ce],Q);u.push(p),u.push(W),d++}}a.push({t:ue.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((Y,ie)=>({startIndex:ie,blockId:Y.drawingId}))},len:r.length});const g=fp(n,o),E=l.editOp(a.serialize(),g);u.push(E);for(const Y of r){const{drawingId:ie}=Y,N=l.insertOp(["drawings",ie],Y),T=l.insertOp(["drawingsOrder",h-d],ie);u.push(N),u.push(T)}return u.reduce((Y,ie)=>Wt.compose(Y,ie),null)};function mp(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function _p(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function pp(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function ci(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:di(t,n),a=[];let l=-1;for(let u=0;u<o.length;u++){const c=o[u],{startIndex:h}=c;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(c),l=h}return a}function hi(e,t,n){const r=[],s=di(t,n);for(const i of e){const o=ci(i,t,n,s);r.push(...o)}return r}const Ep=[mt.PARAGRAPH,mt.TABLE_START,mt.TABLE_END,mt.TABLE_ROW_START,mt.TABLE_CELL_START,mt.TABLE_CELL_END];function di(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!Ep.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const Cp=e=>{var h,d,g;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(E=>{var I;return((I=E.bullet)==null?void 0:I.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const E=i.indexOf(t[0]),I=i[E-1],b=i[E+1];I&&I.bullet&&I.bullet.listType.indexOf(s)===0?(l=I.bullet.listId,s!==Pt.CHECK_LIST&&(s=I.bullet.listType)):b&&b.bullet&&b.bullet.listType.indexOf(s)===0&&(l=b.bullet.listId,s!==Pt.CHECK_LIST&&(s=b.bullet.listType))}const u=new dn;u.reset();const c=new Ye;for(const E of t){const{startIndex:I,paragraphStyle:b={},bullet:M}=E;c.push({t:ue.RETAIN,len:I-u.cursor}),c.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:b,startIndex:0}:{startIndex:0,paragraphStyle:{...b},bullet:{nestingLevel:(g=M==null?void 0:M.nestingLevel)!=null?g:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Pe.REPLACE}),u.moveCursorTo(I+1)}return c},Rp=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Pt.CHECK_LIST)===-1)return!1;const o=new dn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Pt.CHECK_LIST?Pt.CHECK_LIST_CHECKED:Pt.CHECK_LIST;return a.push({t:ue.RETAIN,len:l-o.cursor}),a.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:Pe.REPLACE}),o.moveCursorTo(l+1),a},Ip=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new dn;l.reset();const u=new Ye;for(const d of t){const{startIndex:g,paragraphStyle:E={},bullet:I}=d;u.push({t:ue.RETAIN,len:g-l.cursor}),u.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:E,bullet:{nestingLevel:(h=I==null?void 0:I.nestingLevel)!=null?h:0,textStyle:(I==null?void 0:I.listType)===n?I.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Pe.REPLACE}),l.moveCursorTo(g+1)}return u};function Sp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const vp=e=>{var u,c,h;const{paragraphs:t,document:n,type:r}=e,s=new dn;s.reset();const i=new Ye,o=(u=n.getSnapshot().lists)!=null?u:{},a=(h=(c=n.getBody())==null?void 0:c.tables)!=null?h:[],l={...sr,...o};for(const d of t){const{startIndex:g,paragraphStyle:E={},bullet:I}=d,b=Sp(d,a);if(i.push({t:ue.RETAIN,len:g-s.cursor}),I){const M=I.listType;let V=l[M].nestingLevel.length-1;b&&(V=Math.min(V,2)),i.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...E},bullet:{...I,nestingLevel:Math.max(Math.min(I.nestingLevel+r,V),0)}}]},coverType:Pe.REPLACE})}else i.push({t:ue.RETAIN,len:1});s.moveCursorTo(g+1)}return i},Op=e=>{var b,M,V,Y;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,u=r.getSelfOrHeaderFooterModel(n),c=(M=(b=u.getBody())==null?void 0:b.paragraphs)!=null?M:[],h=(Y=(V=u.getBody())==null?void 0:V.dataStream)!=null?Y:"",d=hi(t,c,h),g=new dn;o&&g.moveCursorTo(o);const E=l!=null?l:new Ye;d.sort((ie,N)=>ie.startIndex-N.startIndex);const I=Math.max(0,d[0].paragraphStart-1);I>g.cursor&&(E.push({t:ue.RETAIN,len:I-g.cursor}),g.moveCursorTo(I)),a&&E.push({t:ue.DELETE,len:a});for(const ie of d){const{startIndex:N,paragraphStyle:T={}}=ie,j=N-g.cursor;E.push({t:ue.RETAIN,len:j,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:j}]},coverType:Pe.REPLACE}:null}),E.push({t:ue.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...T,...s}}]},coverType:Pe.REPLACE}),g.moveCursorTo(N+1)}return E};class at{}R(at,"customRange",{add:ap,delete:op,copyCustomRange:rp,getCustomRangesInterestsWithSelection:np,isIntersecting:Zl}),R(at,"customDecoration",{add:ep,delete:tp}),R(at,"selection",{replace:up,makeSelection:mp,normalizeSelection:_p,delete:eu,replaceTextRuns:hp,retain:lp}),R(at,"range",{isIntersects:pp,getParagraphsInRange:ci,getParagraphsInRanges:hi}),R(at,"transform",{getPlainText:Gr,fromPlainText:cf,isEmptyDocument:uf}),R(at,"paragraph",{bullet:{set:Ip,switch:Cp,toggleChecklist:Rp,changeNestLevel:vp},style:{set:Op},util:{transform:di,getParagraphsInRange:ci,getParagraphsInRanges:hi}}),R(at,"drawing",{add:gp});function wp(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function tu(e){var t;return e.body=wp((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class ir{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new ir(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ve.TRUE}get bold(){return this._style.bl===ve.TRUE}get underline(){return this._style.ul&&Zt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Zt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Zt.create(this._style.st)}get overline(){return this._style.ol&&Zt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return Jt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Jt extends ir{static create(t={}){return new Jt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Jt.create(re.deepClone(this._style))}build(){return this.getValue()}}class Zt{constructor(t={s:1}){R(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Zt(t)}get show(){return this._decoration.s===ve.TRUE}get followFontColor(){return this._decoration.c===ve.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return Zt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class or{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new or(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ve.TRUE}get keepNext(){return this._style.keepNext===ve.TRUE}get wordWrap(){return this._style.wordWrap===ve.TRUE}get widowControl(){return this._style.widowControl===ve.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ve.TRUE}copy(){return ar.create(re.deepClone(this._style))}getValue(){return this._style}}class ar extends or{static create(t={}){return new ar(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return ar.create(re.deepClone(this._style))}build(){return this.getValue()}}class Qt{constructor(t){R(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=tu(t)}static create(t){return new Qt(t)}static createByBody(t){return new Qt({body:t,id:"d",documentStyle:{}})}copy(){return fn.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return fn.create({...re.deepClone(s),body:Nt(r,t,n)})}toPlainText(){var t,n;return at.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
7
|
-
`)}getParagraphStyle(){var t,n;return
|
|
8
|
-
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new fn(n!=null?n:fn.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Jt?r.build():r:a=s instanceof Jt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=at.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Qt?n.getData():n:(s=Math.min(n,s),i=r instanceof Qt?r.getData():r);const o=at.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=at.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ye.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Jt?s.build():s,st:0,ed:r-n}]},o=at.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ye.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=at.customRange.add({rangeType:Kt.HYPERLINK,rangeId:Bt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=at.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=at.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Qt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=fn.createByBody({dataStream:i,customRanges:[{rangeType:Kt.HYPERLINK,rangeId:Bt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function bp(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var Nn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(Nn||{});function Ap(e){return`sheet_interceptor_${e}`}const nu=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class Tp{constructor(t){R(this,"_interceptorsByName",new Map);R(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),nu(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Fn(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function yp(e){return`sheet_async_interceptor_${e}`}const Np=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class Mp{constructor(t){R(this,"_asyncInterceptorsByName",new Map);R(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),Np(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Fn(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function Dp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function ru(e){return/^-?\d+(\.\d+)?$/.test(e)}function Lp(e){return ru(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class fi{constructor(){R(this,"_data",[])}static create(){return new fi}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class gi{constructor(){R(this,"_data",new Map)}static create(){return new gi}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function Up(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function Pp(e,t){return t.forEach(n=>e.add(n)),e}function kp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Mt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=Wt.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),g={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(g.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const E=d.customRanges[0];g.customRanges=[{...E,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,g)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const Fp="__default_document_sub_component_id20231101__";class su{constructor(){R(this,"skipNextObservers",!1);R(this,"lastReturnValue");R(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class xp extends Ce.Subject{constructor(){super(...arguments);R(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new su;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function Bp(e){return new Ce.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const is=We.createIdentifier("core.resource-manager.service"),mi={[Ut.Editor]:"Editor",[Ut.Owner]:"Owner",[Ut.Reader]:"Reader",[Ut.UNRECOGNIZED]:"UNRECOGNIZED"},os=e=>e?{userID:`${mi[e]}_${re.generateRandomId(8)}`,name:mi[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},$p=(e,t)=>e.startsWith(mi[t]);class lr{constructor(){R(this,"_model",new Map);R(this,"_userChange$",new Ce.Subject);R(this,"userChange$",this._userChange$.asObservable());R(this,"_currentUser$",new Ce.BehaviorSubject(os()));R(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var Hp=Object.getOwnPropertyDescriptor,Wp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Hp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},iu=(e,t)=>(n,r)=>t(n,r,e);f.AuthzIoLocalService=class{constructor(t,n){R(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(os(Ut.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?$p(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[$e.UNIVER_SHEET,$e.UNIVER_DOC,$e.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return Bt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Ut.Owner,shareScope:-1,scope:{read:Zs.AllCollaborator,edit:Zs.AllCollaborator},creator:os(Ut.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Ut.Owner)||this._getRole(Ut.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}},f.AuthzIoLocalService=Wp([iu(0,is),iu(1,We.Inject(lr))],f.AuthzIoLocalService);const ou=We.createIdentifier("IAuthzIoIoService");var jp=Object.getOwnPropertyDescriptor,Yp=(e,t,n,r)=>{for(var s=r>1?void 0:r?jp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},zp=(e,t)=>(n,r)=>t(n,r,e);f.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Rr.PERSON,mentions:[{objectType:Rr.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}},f.MentionIOLocalService=Yp([zp(0,We.Inject(lr))],f.MentionIOLocalService);const au=We.createIdentifier("univer.service.mention-io"),_i=We.createIdentifier("univer.config-service");class lu{constructor(){R(this,"_configChanged$",new Ce.Subject);R(this,"configChanged$",this._configChanged$.asObservable());R(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=Vs(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new Ce.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(Ce.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const ur="FOCUSING_UNIT",Mn="FOCUSING_SHEET",cr="FOCUSING_DOC",hr="FOCUSING_SLIDE",Gp="FOCUSING_EDITOR_BUT_HIDDEN",uu="EDITOR_ACTIVATED",Vp="FOCUSING_EDITOR_INPUT_FORMULA",cu="FOCUSING_FX_BAR_EDITOR",Kp="FOCUSING_UNIVER_EDITOR",Xp="FOCUSING_EDITOR_INPUT_FORMULA",qp="FOCUSING_PANEL_EDITOR",Jp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Zp="FOCUSING_COMMON_DRAWINGS",Qp="FORMULA_EDITOR_ACTIVATED";class hu extends st{constructor(){super(...arguments);R(this,"_error$",new Ce.Subject);R(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const eE={version:"0.7.0"};function tE(e="",t=Wn.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:eE.version,locale:t,styles:{},sheets:{},resources:[]}}class du{constructor(t={}){R(this,"_styles");R(this,"_cacheMap",new Yn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const nE=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Xt.equals(r,n))),rE=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Xt.equals(n.range,s.range)}),pi={t:0,b:2,l:2,r:2},sE=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),fu=90;function dr(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=bt.UNSPECIFIED,verticalAlign:a=rn.UNSPECIFIED,wrapStrategy:l=sn.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:g}=i||pi,{vertexAngle:E,centerAngle:I}=Eu(s),b={id:"d",body:{dataStream:`${e}${Fo}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:g,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:I,vertexAngle:E,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new Mt(b)}function iE(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function gu(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function mu(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===Kt.HYPERLINK))return;const s=at.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:Kt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function _u(e){return e!=null}const oE='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function pu(e){const t=ut.ff,n=ut.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=En.ITALIC;(e.it===0||e.it===void 0)&&(r=En.NORMAL);let s=En.BOLD;(e.bl===0||e.bl===void 0)&&(s=En.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===xt.SUBSCRIPT||a===xt.SUPERSCRIPT){const h=aE(o,l),{sbr:d,spr:g}=h;l*=a===xt.SUBSCRIPT?d:g}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${oE} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function aE(e,t){return sE(t)}function Eu(e){const{a:t=0,v:n=ve.FALSE}=e||{a:0,v:ve.FALSE};let r=0,s=t;return n===ve.TRUE&&(r=fu,s=fu),{centerAngle:r,vertexAngle:s}}class lE{constructor(t,n){R(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ve.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Vt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:ve.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class uE{constructor(t,n,r){R(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ve.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===ve.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ve.TRUE:!0}getSize(){return Vt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const cE="DEFAULT_WORKSHEET_ROW_COUNT",Cu=1e3,hE="DEFAULT_WORKSHEET_COLUMN_COUNT",Ru=20,dE="DEFAULT_WORKSHEET_ROW_HEIGHT",Iu=24,fE="DEFAULT_WORKSHEET_COLUMN_WIDTH",Su=88,gE="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",vu=46,mE="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ou=20;function wu(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ve.FALSE,rowCount:Cu,columnCount:Ru,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Su,defaultRowHeight:Iu,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ve.TRUE,rowHeader:{width:vu,hidden:ve.FALSE},columnHeader:{height:Ou,hidden:ve.FALSE},rightToLeft:ve.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class _E extends st{constructor(n){super();R(this,"_cellCache",new Map);R(this,"_rowCache",new Map);R(this,"_columnCache",new Map);R(this,"_hasRow",!1);R(this,"_hasColumn",!1);R(this,"_hasAll",!1);R(this,"_allIndex",-1);R(this,"_mergeData");R(this,"_rangeMap",new Yn(5e4));R(this,"_skeletonCache",new Yn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Xt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:g,endColumn:E}=a[c];for(let I=n;I<=s;I++){let b=!1;for(let M=r;M<=i;M++)if(I>=h&&I<=d&&M>=g&&M<=E){o.push({startRow:h,endRow:d,startColumn:g,endColumn:E}),u.push(c),b=!0;break}if(b)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class bu extends st{constructor(n){super();R(this,"_cellContentInterceptor",null);R(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Nn.Value|Nn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Nn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Nn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,tt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,tt(()=>this._rowFilteredInterceptor=null)}}const Au={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class fr{constructor(t,n,r){R(this,"_sheetId");R(this,"_snapshot");R(this,"_cellData");R(this,"_rowManager");R(this,"_columnManager");R(this,"_viewModel");R(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=wu(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new Tt(o),this._viewModel=new bu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new uE(this._snapshot,this._viewModel,i),this._columnManager=new lE(this._snapshot,s),this._spanModel=new _E(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r=!0){const s=this.getCellStyle(t,n),i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n);return r?ms(i,o,a,s):ms(i,a,o,s)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,g=t.getValue(u,d),E=g!=null&&g.s?this._styles.get(g.s):null,I=(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);(g&&(g.v||g.p)||E!=null&&E.bg||I)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,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:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new fr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:g}=r;t===c&&n===d?(o=h,a=g,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=g&&(o=h,a=g,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=pn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new Tt;return Ls(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===pn.Raw)h=this.getCellRaw(u,c);else if(i===pn.Intercepted)h=this.getCell(u,c);else if(i===pn.Both){const g=this.getCellRaw(u,c);if(g){h={...g};const E=(d=this.getCell(u,c))==null?void 0:d.v;_u(E)&&h&&(h.displayV=String(E))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:g}=u;Ls(h,g,c,d).forEach((E,I)=>{E===h&&I===c&&l.setValue(E,I,{...o.getValue(E,I),rowSpan:g-h+1,colSpan:d-c+1}),(E!==h||I!==c)&&l.realDeleteValue(E,I)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Rn(this,t,{getStyles:()=>this._styles}):new Rn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const E={row:l,col:u,value:c};return E.colSpan=d.endColumn-d.startColumn+1,E.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:E}}if(h&&n)u+=1;else{const g={row:l,col:u,value:c};return u+=1,{done:!1,value:g}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const E=u!==h.startRow,I=E||c!==h.startColumn;if(r&&I||!r&&E){u=h.endRow+1;continue}const b=l.getCell(h.startRow,h.startColumn);if(!b&&n){u=h.endRow+1;continue}const V={row:u,col:h.startColumn,value:b};return V.colSpan=h.endColumn-h.startColumn+1,V.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:V}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const E={row:u,col:c,value:d};return u+=1,{done:!1,value:E}}}}}}}}_getCellDocumentModel(t,n=Au){var I;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Au,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=iE(o),c=i?ut.tr:u.textRotation||ut.tr;let h=u.horizontalAlign||ut.ht;const d=u.verticalAlign||ut.vt,g=u.wrapStrategy||ut.tb,E=u.paddingData||pi;if(t.f&&s)a=dr(t.f.toString(),{},{verticalAlign:d}),h=ut.ht;else if(t.p){const{centerAngle:b,vertexAngle:M}=Eu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,E,{horizontalAlign:h,verticalAlign:d,centerAngle:b,vertexAngle:M,wrapStrategy:g,zeroWidthParagraphBreak:1})}else if(t.v!=null){const b=gu(o);l=pu(b).fontCache;let M=Tu(t);t.t===zt.FORCE_STRING&&s&&(M=`'${M}`),a=dr(M,b,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&mu(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:g,verticalAlign:d,horizontalAlign:h,paddingData:E,fill:(I=o==null?void 0:o.bg)==null?void 0:I.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new Mt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=gu(r);if(n!=null)return n.documentModel==null&&(n.documentModel=dr("",s)),n;const i="";let o="document";const a=ut.tr,l=ut.ht,u=ut.vt,c=ut.tb,h=pi;return o=pu({}).fontCache,{documentModel:dr(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Tu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return at.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===zt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===zt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function pE(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return at.transform.getPlainText(n)}return e==null?void 0:e.v}var EE=Object.getOwnPropertyDescriptor,CE=(e,t,n,r)=>{for(var s=r>1?void 0:r?EE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},RE=(e,t)=>(n,r)=>t(n,r,e);function IE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}f.Workbook=class extends Zr{constructor(n={},r){super();R(this,"type",$e.UNIVER_SHEET);R(this,"_sheetCreated$",new Ce.Subject);R(this,"sheetCreated$",this._sheetCreated$.asObservable());R(this,"_sheetDisposed$",new Ce.Subject);R(this,"sheetDisposed$",this._sheetDisposed$.asObservable());R(this,"_activeSheet$",new Ce.BehaviorSubject(null));R(this,"activeSheet$",this._activeSheet$.asObservable());R(this,"_worksheets");R(this,"_styles");R(this,"_snapshot");R(this,"_unitId");R(this,"_count");R(this,"_name$");R(this,"name$");this._logService=r;const s=tE();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new du(i),this._count=1,this._worksheets=new Map,this._name$=new Ce.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new fr(this._unitId,s,this._styles);return this._worksheets.set(n,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(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ve.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ve.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ve.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[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 fr(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}},f.Workbook=CE([RE(1,wt)],f.Workbook);class Ei extends Zr{constructor(n){var r;super();R(this,"type",$e.UNIVER_SLIDE);R(this,"_activePage$",new Ce.BehaviorSubject(null));R(this,"activePage$",this._activePage$.asObservable());R(this,"_name$");R(this,"name$");R(this,"_snapshot");R(this,"_unitId");this._snapshot={...pa,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new Ce.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:Bt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=Bt(6);return{id:n,pageType:ys.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var SE=Object.getOwnPropertyDescriptor,vE=(e,t,n,r)=>{for(var s=r>1?void 0:r?SE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},yu=(e,t)=>(n,r)=>t(n,r,e);const Dn=We.createIdentifier("univer.current");f.UniverInstanceService=class extends st{constructor(n,r){super();R(this,"_unitsByType",new Map);R(this,"_createHandler");R(this,"_ctorByType",new Map);R(this,"_currentUnits",new Map);R(this,"_currentUnits$",new Ce.BehaviorSubject(this._currentUnits));R(this,"currentUnits$",this._currentUnits$.asObservable());R(this,"_unitAdded$",new Ce.Subject);R(this,"unitAdded$",this._unitAdded$.asObservable());R(this,"_unitDisposed$",new Ce.Subject);R(this,"unitDisposed$",this._unitDisposed$.asObservable());R(this,"_focused$",new Ce.BehaviorSubject(null));R(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(Ce.map(r=>{var s;return(s=r.get(n))!=null?s:null}),Ce.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(Ce.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(Ce.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType($e.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,$e.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,$e.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType($e.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof f.Workbook?(this._contextService.setContextValue(ur,!0),this._contextService.setContextValue(cr,!1),this._contextService.setContextValue(Mn,!0),this._contextService.setContextValue(hr,!1),this.setCurrentUnitForType(n)):this.focused instanceof Mt?(this._contextService.setContextValue(ur,!0),this._contextService.setContextValue(cr,!0),this._contextService.setContextValue(Mn,!1),this._contextService.setContextValue(hr,!1),this.setCurrentUnitForType(n)):this.focused instanceof Ei?(this._contextService.setContextValue(ur,!0),this._contextService.setContextValue(cr,!1),this._contextService.setContextValue(Mn,!1),this._contextService.setContextValue(hr,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(ur,!1),this._contextService.setContextValue(cr,!1),this._contextService.setContextValue(Mn,!1),this._contextService.setContextValue(hr,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:$e.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}},f.UniverInstanceService=vE([yu(0,We.Inject(We.Injector)),yu(1,_n)],f.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const OE={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var wE=Object.getOwnPropertyDescriptor,bE=(e,t,n,r)=>{for(var s=r>1?void 0:r?wE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},AE=(e,t)=>(n,r)=>t(n,r,e);f.LifecycleService=class extends st{constructor(n){super();R(this,"_lifecycle$",new Ce.BehaviorSubject(Je.Starting));R(this,"lifecycle$",this._lifecycle$.asObservable());R(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return Ce.firstValueFrom(this.lifecycle$.pipe(Ce.filter(r=>r>=n),fs(r=>r===n),Ce.map(()=>{})))}subscribeWithPrevious(){return Ce.merge(Nu(this.stage),this._lifecycle$.pipe(Ce.skip(1))).pipe(fs(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${OE[n]}".`)}},f.LifecycleService=bE([AE(0,wt)],f.LifecycleService);function Nu(e){switch(e){case Je.Starting:return Ce.of(Je.Starting);case Je.Ready:return Ce.of(Je.Starting,Je.Ready);case Je.Rendered:return Ce.of(Je.Starting,Je.Ready,Je.Rendered);default:return Ce.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const TE=We.createIdentifier("ILocalStorageService");class gn extends st{constructor(){super();R(this,"_currentLocale$",new Ce.BehaviorSubject(Wn.ZH_CN));R(this,"currentLocale$",this._currentLocale$.asObservable());R(this,"_locales",null);R(this,"localeChanged$",new Ce.Subject);R(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(tt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Vs((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var Ci=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(Ci||{});const Mu=We.createIdentifier("univer.permission-service");class Du extends st{constructor(){super(...arguments);R(this,"_permissionPointMap",new Map);R(this,"_permissionPointUpdate$",new Ce.Subject);R(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());R(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof Ce.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new Ce.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=Ci.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return Ce.combineLatest(r).pipe(Ft.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var yE=Object.getOwnPropertyDescriptor,NE=(e,t,n,r)=>{for(var s=r>1?void 0:r?yE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ri=(e,t)=>(n,r)=>t(n,r,e);const ME=4,Lu=Symbol("DependentOn");class Ii extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}R(Ii,"pluginName"),R(Ii,"type",$e.UNIVER_UNKNOWN);class DE{constructor(){R(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function LE(...e){return function(t){t[Lu]=e}}f.PluginService=class{constructor(t,n,r){R(this,"_pluginRegistry",new Map);R(this,"_pluginStore",new DE);R(this,"_seenPlugins",new Set);R(this,"_loadedPlugins",new Set);R(this,"_loadedPluginTypes",new Set([$e.UNIVER_UNKNOWN]));R(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===$e.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===$e.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},ME))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Lu];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===$e.UNIVER_UNKNOWN&&c.type!==$e.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==$e.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Nu(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(Ce.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}},f.PluginService=NE([Ri(0,We.Inject(We.Injector)),Ri(1,We.Inject(f.LifecycleService)),Ri(2,wt)],f.PluginService);function Uu(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Si=We.createIdentifier("resource-loader-service");class Pu extends st{constructor(){super(...arguments);R(this,"_resourceMap",new Map);R(this,"_register$",new Ce.Subject);R(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),tt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class as extends st{constructor(){super();R(this,"_darkMode$",new Ce.BehaviorSubject(!1));R(this,"darkMode$",this._darkMode$.asObservable());R(this,"_currentTheme",ac.defaultTheme);R(this,"_currentTheme$",new Ce.BehaviorSubject(this._currentTheme));R(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(tt(()=>{this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return sl(this._currentTheme,n)}}var UE=Object.getOwnPropertyDescriptor,PE=(e,t,n,r)=>{for(var s=r>1?void 0:r?UE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vi=(e,t)=>(n,r)=>t(n,r,e);const ls=We.createIdentifier("univer.undo-redo.service"),kE=20;class ku{dispose(){}async dispatchToHandlers(){return!1}}const Fu="univer.command.redo",xu="univer.command.undo",Bu=new class extends ku{constructor(){super(...arguments);R(this,"type",xn.COMMAND);R(this,"id",xu)}handler(t){const n=t.get(ls),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Bn);return Cr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},$u=new class extends ku{constructor(){super(...arguments);R(this,"type",xn.COMMAND);R(this,"id",Fu)}handler(t){const n=t.get(ls),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Bn);return Cr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};f.LocalUndoRedoService=class extends st{constructor(n,r,s){super();R(this,"undoRedoStatus$");R(this,"_undoRedoStatus$",new Ce.BehaviorSubject({undos:0,redos:0}));R(this,"_undoStacks",new Map);R(this,"_redoStacks",new Map);R(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Bu)),this.disposeWithMe(this._commandService.registerCommand($u)),this.disposeWithMe(tt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(tt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>kE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Cr(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),tt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(Mn),s=this._contextService.getContextValue(cu),i=this._contextService.getContextValue(uu);return r?s?n=As:i?n=bs:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}},f.LocalUndoRedoService=PE([vi(0,Dn),vi(1,Bn),vi(2,_n)],f.LocalUndoRedoService);function FE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function xE(e){return new Promise(t=>setTimeout(t,e))}function BE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var Oi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Oi||{}),Hu=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Hu||{});const wi=We.createIdentifier("core.image-io.service");class Wu{constructor(t,n=100){R(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Yn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(wi)?this._injector.get(wi):null;if(t===Oi.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const $E=["script","style","meta","comment","link"];var ju=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(ju||{}),Yu=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Yu||{}),zu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(zu||{}),Gu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Gu||{}),Vu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Vu||{}),Ku=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Ku||{}),HE=Object.getOwnPropertyDescriptor,WE=(e,t,n,r)=>{for(var s=r>1?void 0:r?HE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},jE=(e,t)=>(n,r)=>t(n,r,e);f.Skeleton=class extends st{constructor(n){super();R(this,"_fontLocale");R(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}},f.Skeleton=WE([jE(0,We.Inject(gn))],f.Skeleton);var YE=Object.getOwnPropertyDescriptor,zE=(e,t,n,r)=>{for(var s=r>1?void 0:r?YE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},us=(e,t)=>(n,r)=>t(n,r,e);f.SheetSkeleton=class extends f.Skeleton{constructor(n,r,s,i,o,a){super(s);R(this,"_worksheetData");R(this,"_renderRawFormula",!1);R(this,"_cellData");R(this,"_imageCacheMap");R(this,"_isRowStylePrecedeColumnStyle",!1);R(this,"_skipAutoHeightForMergedCells",!0);R(this,"_rowTotalHeight",0);R(this,"_columnTotalWidth",0);R(this,"_rowHeaderWidth",0);R(this,"_columnHeaderHeight",0);R(this,"_rowHeightAccumulation",[]);R(this,"_columnWidthAccumulation",[]);R(this,"_marginTop",0);R(this,"_marginLeft",0);R(this,"_scaleX");R(this,"_scaleY");R(this,"_scrollX");R(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Wu(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Bo))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(xo))!=null?r:!1}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:g}=c;(g==null||g===ve.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===ve.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===ve.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=bt.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!Rs(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:g}=Ln(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===bt.CENTER&&c===r?a+=(g-d)/2:a+=g-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!Rs(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=Ln(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===bt.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:g}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ve.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==ve.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=g,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new Tt;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:g,endColumn:E}=a[c];if(u.getValue(h,d))continue;Sa({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:E,endRow:g})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,g),o=Math.max(o,E),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=Ln(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=Ln(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=qu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=$n(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Xu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=$n(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=Ln(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:g,startX:E,endX:I,mergeInfo:b}=u,M=a,V=l;return s===!1&&(M=0,V=0),d+=V,g+=V,E+=M,I+=M,b.startY+=V,b.endY+=V,b.startX+=M,b.endX+=M,{actualRow:n,actualColumn:r,startX:E,startY:d,endX:I,endY:g,isMerged:c,isMergedMainCell:h,mergeInfo:b}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=$n(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=$n(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new Mt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}},f.SheetSkeleton=zE([us(2,We.Inject(gn)),us(3,_n),us(4,_i),us(5,We.Inject(We.Injector))],f.SheetSkeleton);function bi(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function GE(e,t,n,r){return bi(e,t,n,r)}function Ln(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=bi(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:g,endColumn:E}=s;let I={startRow:h,startColumn:d,endRow:g,endColumn:E,startY:i,endY:o,startX:a,endX:l};const b=n.length-1,M=r.length-1;if(u&&h!==-1&&d!==-1){const V=n[h-1]||0,Y=n[g]||n[b],ie=r[d-1]||0,N=r[E]||r[M];I={...I,startY:V,endY:Y,startX:ie,endX:N}}else if(!u&&g!==-1&&E!==-1){const V=n[g]||n[b],Y=r[E]||r[M];I={...I,startY:i,endY:V,startX:a,endX:Y}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:I}}function Xu(e,t,n,r){const{x:s}=n;return e/t+s-r}function qu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Ju=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ai=1,gr=8;class Ti{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Ai)throw new Error(`Got v${s} data when expected v${Ai}.`);const i=Ju[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Ti(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Ju.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,gr,t),this.coords=new this.ArrayType(this.data,gr+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(gr+o+a+l),this.ids=new this.IndexArrayType(this.data,gr,t),this.coords=new this.ArrayType(this.data,gr+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Ai<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return yi(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let b=d;b<=h;b++){const M=o[2*b],V=o[2*b+1];M>=t&&M<=r&&V>=n&&V<=s&&u.push(i[b])}continue}const g=d+h>>1,E=o[2*g],I=o[2*g+1];E>=t&&E<=r&&I>=n&&I<=s&&u.push(i[g]),(c===0?t<=E:n<=I)&&(l.push(d),l.push(g-1),l.push(1-c)),(c===0?r>=E:s>=I)&&(l.push(g+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let b=d;b<=h;b++)Qu(i[2*b],i[2*b+1],t,n)<=u&&l.push(s[b]);continue}const g=d+h>>1,E=i[2*g],I=i[2*g+1];Qu(E,I,t,n)<=u&&l.push(s[g]),(c===0?t-r<=E:n-r<=I)&&(a.push(d),a.push(g-1),a.push(1-c)),(c===0?t+r>=E:n+r>=I)&&(a.push(g+1),a.push(h),a.push(1-c))}return l}}function yi(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;Zu(e,t,o,r,s,i),yi(e,t,n,r,o-1,1-i),yi(e,t,n,o+1,s,1-i)}function Zu(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),E=Math.max(r,Math.floor(n-c*d/u+g)),I=Math.min(s,Math.floor(n+(u-c)*d/u+g));Zu(e,t,n,E,I,i)}const o=t[2*n+i];let a=r,l=s;for(mr(e,t,r,n),t[2*s+i]>o&&mr(e,t,r,s);a<l;){for(mr(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?mr(e,t,r,l):(l++,mr(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function mr(e,t,n,r){Ni(e,n,r),Ni(t,2*n,2*r),Ni(t,2*n+1,2*r+1)}function Ni(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Qu(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class VE{constructor(t=!1){R(this,"_tree",new Map);R(this,"_oneCellCache",new Map);R(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Wr),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const g=a.get(d);if(g)for(let E=u;E<=h;E++){const I=g.get(E);I&&I.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var E;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(E=this._kdTree.get(n))==null?void 0:E.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),g=[];for(const I of d){const b=h[I];g.push(...Array.from(b.ids))}return g}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new Ti(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Wr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var KE=Object.getOwnPropertyDescriptor,XE=(e,t,n,r)=>{for(var s=r>1?void 0:r?KE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ec=(e,t)=>(n,r)=>t(n,r,e);let Mi=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case $e.UNRECOGNIZED:case $e.UNIVER_UNKNOWN:case $e.UNIVER_SLIDE:case $e.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType($e.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case $e.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType($e.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();$o(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Mi=XE([ec(0,We.Inject(is)),ec(1,We.Inject(Dn))],Mi);class qE{constructor(t={},n){R(this,"_startedTypes",new Set);R(this,"_injector");R(this,"_disposingCallbacks",new Er);const r=this._injector=JE(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l}=t;s&&this._injector.get(as).setTheme(s),i&&this._injector.get(as).setDarkMode(i),a&&this._injector.get(gn).load(a),o&&this._injector.get(gn).setLocale(o),l&&this._injector.get(wt).setLogLevel(l),this._init(r)}get _univerInstanceService(){return this._injector.get(Dn)}get _pluginService(){return this._injector.get(f.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(tt(t));return tt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(gn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(wt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType($e.UNIVER_SHEET,f.Workbook),this._univerInstanceService.registerCtorForType($e.UNIVER_DOC,Mt),this._univerInstanceService.registerCtorForType($e.UNIVER_SLIDE,Ei);const n=t.get(Dn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(f.LifecycleService).stage<Je.Ready&&(this._injector.get(f.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function JE(e,t){const n=Uu([[hu],[gn],[as],[f.LifecycleService],[f.PluginService],[lr],[Dn,{useClass:f.UniverInstanceService}],[Mu,{useClass:Du}],[wt,{useClass:Bi,lazy:!0}],[Bn,{useClass:f.CommandService}],[ls,{useClass:f.LocalUndoRedoService,lazy:!0}],[_i,{useClass:lu}],[_n,{useClass:Fi}],[is,{useClass:Pu,lazy:!0}],[Si,{useClass:Mi,lazy:!0}],[ou,{useClass:f.AuthzIoLocalService}],[au,{useClass:f.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new We.Injector(n);return Ui(r,[[lr],[Si]]),r}function tc(e){return e.map(t=>t/255)}function nc(e){return e.map(t=>Math.round(t*255))}const St=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function ZE(e){const t=e[0],n=e[1],r=e[2];let s=[St[0][0]*t+St[0][1]*n+St[0][2]*r+St[0][4],St[1][0]*t+St[1][1]*n+St[1][2]*r+St[1][4],St[2][0]*t+St[2][1]*n+St[2][2]*r+St[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function QE(e){return nc(ZE(tc(e)))}function e0([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function cs(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function rc(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function t0(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(u,c,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?u+(c-u)*6*d:d<.5?c:d<.6666666666666666?u+(c-u)*(.6666666666666666-d)*6:u},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const Di={r:1,g:1,b:1},Li={r:0,g:0,b:0},n0=cs(Di.r,Di.g,Di.b),r0=cs(Li.r,Li.g,Li.b);function s0(e){const t=cs(e[0],e[1],e[2]),n=rc(n0,t),r=e0(e);let s=1-r[2],i,o,a;do i=t0(r[0],r[1],s),o=cs(i[0],i[1],i[2]),a=rc(o,r0),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function i0(e){return nc(s0(tc(e)))}cc(),f.ABCToNumber=ef,f.AUTO_HEIGHT_FOR_MERGED_CELLS=Bo,f.AbsoluteRefType=nt,f.ActionIterator=yn,f.AlignTypeH=ua,f.AlignTypeV=ca,f.ArrangeTypeEnum=fa,f.ArrowsAndMarkersShapes=ro,f.AsyncInterceptorManager=Mp,f.AsyncLock=__,f.AutoFillSeries=Gi,f.BaselineOffset=xt,f.BasicShapes=no,f.BlockType=jo,f.BooleanNumber=ve,f.BorderStyleTypes=qe,f.BorderType=Vi,f.BuildTextUtils=at,f.BulletAlignment=Vn,f.COLORS=ps,f.CanceledError=Ec,f.CellModeEnum=pn,f.CellValueType=zt,f.Color=on,f.ColorBuilder=wr,f.ColorKit=At,f.ColorType=Rt,f.ColumnSeparatorType=Go,f.CommandType=xn,f.CommonHideTypes=Ki,f.ConfigService=lu,f.ContextService=Fi,f.CopyPasteType=Xi,f.CustomCommandExecutionError=ds,f.CustomDecorationType=an,f.CustomRangeType=Kt,f.DEFAULT_CELL=Nd,f.DEFAULT_DOC=ui,f.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Fp,f.DEFAULT_EMPTY_DOCUMENT_VALUE=Fo,f.DEFAULT_RANGE=Td,f.DEFAULT_RANGE_ARRAY=Ad,f.DEFAULT_SELECTION=yd,f.DEFAULT_SLIDE=pa,f.DEFAULT_STYLES=ut,f.DEFAULT_WORKSHEET_COLUMN_COUNT=Ru,f.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=hE,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ou,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=mE,f.DEFAULT_WORKSHEET_COLUMN_WIDTH=Su,f.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=fE,f.DEFAULT_WORKSHEET_ROW_COUNT=Cu,f.DEFAULT_WORKSHEET_ROW_COUNT_KEY=cE,f.DEFAULT_WORKSHEET_ROW_HEIGHT=Iu,f.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=dE,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=vu,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=gE,f.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=As,f.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=bs,f.DOCS_ZEN_EDITOR_UNIT_ID_KEY=ko,f.DOC_DRAWING_PRINTING_COMPONENT_KEY=Pd,f.DOC_RANGE_TYPE=po,f.DashStyleType=Zo,f.DataStreamTreeNodeType=Aa,f.DataStreamTreeTokenType=mt,f.DataValidationErrorStyle=ju,f.DataValidationImeMode=Yu,f.DataValidationOperator=zu,f.DataValidationRenderMode=Gu,f.DataValidationStatus=Vu,f.DataValidationType=Ku,f.DeleteDirection=qi,f.DependentOn=LE,f.DesktopLogService=Bi,f.DeveloperMetadataVisibility=Ji,f.Dimension=Zi,f.Direction=Qi,f.Disposable=st,f.DisposableCollection=Er,f.DocStyleType=Ho,f.DocumentDataModel=Mt,f.DocumentFlavor=Ts,f.DrawingTypeEnum=ga,f.EDITOR_ACTIVATED=uu,f.EXTENSION_NAMES=Ea,f.ErrorService=hu,f.EventState=su,f.EventSubject=xp,f.FOCUSING_COMMON_DRAWINGS=Zp,f.FOCUSING_DOC=cr,f.FOCUSING_EDITOR_BUT_HIDDEN=Gp,f.FOCUSING_EDITOR_INPUT_FORMULA=Vp,f.FOCUSING_EDITOR_STANDALONE=Xp,f.FOCUSING_FX_BAR_EDITOR=cu,f.FOCUSING_PANEL_EDITOR=qp,f.FOCUSING_SHEET=Mn,f.FOCUSING_SLIDE=hr,f.FOCUSING_UNIT=ur,f.FOCUSING_UNIVER_EDITOR=Kp,f.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Jp,f.FORMULA_EDITOR_ACTIVATED=Qp,f.FollowNumberWithType=Wo,f.FontItalic=Ir,f.FontStyleType=En,f.FontWeight=Sr,f.GridType=Yo,f.HLSColor=go,f.HorizontalAlign=bt,f.IAuthzIoService=ou,f.ICommandService=Bn,f.IConfigService=_i,f.IContextService=_n,f.IImageIoService=wi,f.ILocalStorageService=TE,f.ILogService=wt,f.IMentionIOService=au,f.IPermissionService=Mu,f.IResourceLoaderService=Si,f.IResourceManagerService=is,f.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=xo,f.IUndoRedoService=ls,f.IUniverInstanceService=Dn,f.ImageCacheMap=Wu,f.ImageSourceType=Oi,f.ImageUploadStatusType=Hu,f.InterceptorEffectEnum=Nn,f.InterceptorManager=Tp,f.InterpolationPointType=eo,f.JSON1=O_,f.JSONX=Wt,f.LRUHelper=zn,f.LRUMap=Yn,f.LifecycleStages=Je,f.ListGlyphType=Ne,f.LocaleService=gn,f.LocaleType=Wn,f.LogLevel=xi,f.MOVE_BUFFER_VALUE=Hn,f.MemoryCursor=dn,f.MentionType=Rr,f.NAMED_STYLE_MAP=Dd,f.NAMED_STYLE_SPACE_MAP=Ld,f.NamedStyleType=it,f.NilCommand=Hi,f.NumberUnitType=la,f.ObjectMatrix=Tt,f.ObjectRelativeFromH=oa,f.ObjectRelativeFromV=aa,f.OtherShapes=so,f.PAGE_SIZE=kd,f.PAPER_TYPES=bd,f.PRESET_LIST_TYPE=sr,f.PRINT_CHART_COMPONENT_KEY=Ud,f.PageElementType=ma,f.PageOrientType=da,f.PageType=ys,f.PaperType=Ct,f.ParagraphElementType=Ko,f.ParagraphStyleBuilder=ar,f.ParagraphStyleValue=or,f.PermissionService=Du,f.PermissionStatus=Ci,f.Plugin=Ii,f.PositionedObjectLayoutType=qo,f.PresetListType=Pt,f.ProtectionType=to,f.QuickListType=$l,f.QuickListTypeMap=N_,f.RANGE_DIRECTION=_o,f.RANGE_TYPE=Le,f.RBush=Wr,f.RCDisposable=Sc,f.RGBA_PAREN=Zc,f.RGB_PAREN=Jc,f.ROTATE_BUFFER_VALUE=zi,f.RTree=VE,f.Range=Rn,f.Rectangle=Xt,f.RedoCommand=$u,f.RedoCommandId=Fu,f.RefAlias=Qd,f.Registry=fi,f.RegistryAsMap=gi,f.RelativeDate=oo,f.RelativeSlideLink=_a,f.ResourceManagerService=Pu,f.RgbColor=br,f.RichTextBuilder=fn,f.RichTextValue=Qt,f.RxDisposable=Ic,f.SHEET_EDITOR_UNITS=Md,f.SectionType=zo,f.SheetTypes=ao,f.SheetViewModel=bu,f.SliceBodyType=ai,f.SlideDataModel=Ei,f.SpacingRule=Jo,f.SpecialShapes=io,f.Styles=du,f.THEME_COLORS=fo,f.TabStopAlignment=Qo,f.TableAlignmentType=ta,f.TableLayoutType=na,f.TableRowHeightRule=sa,f.TableSizeType=ea,f.TableTextWrapType=ra,f.TextDecoration=lo,f.TextDecorationBuilder=Zt,f.TextDirection=jn,f.TextDirectionType=Vo,f.TextStyleBuilder=Jt,f.TextStyleValue=ir,f.TextX=Ye,f.TextXActionType=ue,f.ThemeColor=Ar,f.ThemeColorType=ht,f.ThemeColors=vr,f.ThemeService=as,f.Tools=re,f.UndoCommand=Bu,f.UndoCommandId=xu,f.UnitModel=Zr,f.Univer=qE,f.UniverInstanceType=$e,f.UpdateDocsAttributeType=Pe,f.UserManagerService=lr,f.VerticalAlign=rn,f.VerticalAlignmentType=ia,f.Worksheet=fr,f.WrapStrategy=sn,f.WrapTextType=Xo,f.addLinkToDocumentModel=mu,f.afterInitApply=Dc,f.afterTime=Nc,f.awaitTime=xE,f.binSearchFirstGreaterThanTarget=Yi,f.binarySearchArray=Lc,f.bufferDebounceTime=yc,f.cellToRange=bh,f.characterSpacingControlType=ha,f.checkForSubstrings=Ah,f.checkIfMove=Pc,f.checkParagraphHasBullet=ud,f.checkParagraphHasIndent=cd,f.checkParagraphHasIndentByStyle=No,f.codeToBlob=Uc,f.composeBody=li,f.composeInterceptors=nu,f.composeStyles=ms,f.concatMatrixArray=Id,f.convertBodyToHtml=qc,f.convertCellToRange=Eo,f.convertObservableToBehaviorSubject=Mc,f.covertTextRunToHtml=_s,f.createAsyncInterceptorKey=yp,f.createDefaultUser=os,f.createDocumentModelWithStyle=dr,f.createInterceptorKey=Ap,f.createInternalEditorID=wd,f.createRowColIter=Ls,f.dayjs=$t,f.debounce=n_,f.dedupe=hc,f.dedupeBy=dc,f.deepCompare=Is,f.delayAnimationFrame=BE,f.deleteContent=Do,f.extractPureTextFromCell=Tu,f.fromCallback=Wi,f.fromEventSubject=Bp,f.fromObservable=Rc,f.generateRandomId=Bt,f.get=sl,f.getArrayLength=Vt,f.getBodySlice=Nt,f.getBodySliceHtml=Or,f.getBorderStyleType=vh,f.getCellCoordByIndexSimple=bi,f.getCellInfoInMergeData=ph,f.getCellPositionByIndexSimple=GE,f.getCellValueType=fh,f.getCellWithCoordByIndexCore=Ln,f.getColorStyle=Lt,f.getCustomBlockSlice=zl,f.getCustomDecorationSlice=Vl,f.getCustomRangeSlice=Gl,f.getDocsUpdateBody=Oh,f.getIntersectRange=Sa,f.getOriginCellValue=pE,f.getParagraphsSlice=Yl,f.getPlainText=Gr,f.getReverseDirection=kc,f.getSectionBreakSlice=B_,f.getTableSlice=jl,f.getTextRunSlice=ss,f.getTransformOffsetX=Xu,f.getTransformOffsetY=qu,f.getWorksheetUID=IE,f.groupBy=mc,f.handleStyleToString=Sh,f.hashAlgorithm=dd,f.horizontalLineSegmentsSubtraction=Br,f.insertMatrixArray=vs,f.insertTextToContent=Mo,f.invertColorByHSL=i0,f.invertColorByMatrix=QE,f.isBlackColor=ch,f.isBooleanString=d_,f.isCellCoverable=Rs,f.isCellV=mh,f.isEmptyCell=Co,f.isFormulaId=Ih,f.isFormulaString=Rh,f.isICellData=dh,f.isInternalEditorID=$o,f.isNodeEnv=Xc,f.isNotNullOrUndefined=_u,f.isNullCell=gh,f.isNumeric=ru,f.isRangesEqual=nE,f.isRealNum=hd,f.isSafeNumeric=Lp,f.isSameStyleTextRun=Ro,f.isUnitRangesEqual=rE,f.isValidRange=wh,f.isWhiteColor=hh,f.makeArray=_c,f.makeCellRangeToRangeData=Ch,f.makeCellToSelection=Eh,f.makeCustomRangeStream=af,f.merge=Vs,f.mergeOverrideWithDependencies=Uu,f.mergeSets=Pp,f.mergeWith=o_,f.mergeWorksheetSnapshotWithDefault=wu,f.mixinClass=Dp,f.moveMatrixArray=ws,f.moveRangeByOffset=jd,f.nameCharacterCheck=FE,f.normalizeBody=$_,f.normalizeTextRuns=rr,f.numberToABC=nf,f.numberToListABC=rf,f.numfmt=Rd,f.queryObjectMatrix=Zd,f.registerDependencies=pc,f.remove=Fn,f.repeatStringNumTimes=ba,f.replaceInDocumentBody=kp,f.requestImmediateMacroTask=Up,f.rotate=gc,f.searchArray=$n,f.searchInOrderedArray=ji,f.selectionToArray=_h,f.sequence=ki,f.sequenceAsync=Pi,f.sequenceExecute=Cr,f.sequenceExecuteAsync=Tc,f.set=l_,f.shallowEqual=gl,f.skipParseTagNames=$E,f.sliceMatrixArray=Sd,f.sortRules=sf,f.sortRulesByDesc=of,f.sortRulesFactory=Jn,f.spliceArray=Os,f.splitIntoGrid=Ds,f.takeAfter=fs,f.textDiff=Xs,f.throttle=bp,f.toDisposable=tt,f.touchDependencies=Ui,f.updateAttributeByDelete=Kl,f.updateAttributeByInsert=Xl,Object.keys(We).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(f,e)&&Object.defineProperty(f,e,{enumerable:!0,get:()=>We[e]})}),Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(f,se){typeof exports=="object"&&typeof module<"u"?se(exports,require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi"),require("@univerjs/themes")):typeof define=="function"&&define.amd?define(["exports","rxjs","rxjs/operators","@wendellhu/redi","@univerjs/themes"],se):(f=typeof globalThis<"u"?globalThis:f||self,se(f.UniverCore={},f.rxjs,f.rxjs.operators,f["@wendellhu/redi"],f.UniverThemes))})(this,function(f,se,xt,Te,da){"use strict";var iI=Object.defineProperty;var oI=(f,se,xt)=>se in f?iI(f,se,{enumerable:!0,configurable:!0,writable:!0,value:xt}):f[se]=xt;var C=(f,se,xt)=>oI(f,typeof se!="symbol"?se+"":se,xt);var fd,md;function _d(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const zr=typeof global<"u"?global:typeof self<"u"?self:window;function pd(){const t=new Map;let n=0;typeof zr.requestIdleCallback!="function"&&(zr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const c=Math.max(0,50-(Date.now()-i));s({didTimeout:c===0,timeRemaining(){return c}})},1);return t.set(o,a),o}),typeof zr.cancelIdleCallback!="function"&&(zr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function Ed(){pd()}function tr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Cd(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Rd(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function Id(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function Sd(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function Od(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function vd(e){return Array.isArray(e)?e:[e]}function wd(e,t){t.forEach(n=>e.add(n))}function fa(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class Zs extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class bd extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function ma(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function ga(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function Ad(e){return e instanceof se.Subscription||e instanceof se.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function We(e){let t=!1;return e?Ad(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:We(()=>{})}function Td(e){return We(()=>{e.unsubscribe()})}class Kr{constructor(){C(this,"_disposables",new Set)}add(t){const n=We(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class ze{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Kr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class yd extends ze{constructor(){super(...arguments);C(this,"dispose$",new se.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class Nd extends ze{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const bn=Te.createIdentifier("univer.context-service");class _a extends ze{constructor(){super(...arguments);C(this,"_contextChanged$",new se.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new se.Observable(r=>{const s=this._contextChanged$.pipe(se.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var pa=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(pa||{});const ft=Te.createIdentifier("univer.log");class Ea extends ze{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=Md(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function Md(...e){return e.map(t=>JSON.stringify(t)).join("")}var Dd=Object.getOwnPropertyDescriptor,Ld=(e,t,n,r)=>{for(var s=r>1?void 0:r?Dd(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ca=(e,t)=>(n,r)=>t(n,r,e),nr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(nr||{});const rr=Te.createIdentifier("univer.core.command-service");class Ud{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),We(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Ra={id:"nil",type:0,handler:()=>!0};f.CommandService=class extends ze{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new Ud,this.registerCommand(Ra)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),We(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),We(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(u=>u(a,s));const c=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(u=>u(a,s)),l.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof Zs)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=Id(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const c=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const u=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),c.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof Zs)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),We(()=>tr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new Pd(n.id);const o=new Kr;o.add(this._commandRegistry.registerCommand(s)),o.add(We(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return We(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}},f.CommandService=Ld([Ca(0,Te.Inject(Te.Injector)),Ca(1,ft)],f.CommandService);class Pd{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(ft),s=t.get(bn),i=t.get(Te.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),We(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Xr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return ga(r)}function kd(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return ma(r)}function Ia(e){return new se.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Js(e){return function(n){return new se.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Fd(e=0){return t=>{let n=[];return t.pipe(se.tap(r=>n.push(r)),se.debounceTime(e),se.map(()=>n),se.tap(()=>n=[]))}}function xd(e){const t=new se.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(se.take(1))}function Bd(e,t){const n=new se.BehaviorSubject(t);return e.subscribe(n),n}const $d=e=>new Promise(t=>{se.merge(Ia(e.onCommandExecuted.bind(e)).pipe(xt.filter(([n])=>n.type===nr.MUTATION)),se.timer(300)).pipe(xt.debounceTime(16),xt.first()).subscribe(()=>{t()})});function Sa(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function Hd(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Oa(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function sr(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=Sa(e,t):r=Oa(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Wd(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const ir=2,va=1;function jd(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:c=0,width:u=0,angle:h=0}=e,d=u,m=c,_=i,E=s;return Math.abs(a-n)>ir||Math.abs(l-r)>ir||Math.abs(d-_)>ir||Math.abs(m-E)>ir||Math.abs(h-o)>va}var wa=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(wa||{}),Le=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(Le||{}),ba=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(ba||{}),mt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(mt||{}),Aa=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Aa||{}),Ta=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Ta||{}),ya=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(ya||{}),Na=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Na||{}),Ma=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Ma||{}),Da=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Da||{});function Yd(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var La=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(La||{}),or=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(or||{}),qr=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(qr||{}),Ua=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(Ua||{}),Pa=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(Pa||{}),ka=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(ka||{}),Fa=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(Fa||{}),xa=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(xa||{}),Ba=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(Ba||{}),$a=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))($a||{}),ar=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(ar||{}),Ha=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(Ha||{}),St=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(St||{}),un=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(un||{}),hn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(hn||{}),Zr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Zr||{}),Jr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Jr||{}),Bt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Bt||{}),ae=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ae||{}),Xt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Xt||{}),it=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(it||{}),Qr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Qr||{});const Gd="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Vd=e=>crypto.getRandomValues(new Uint8Array(e)),zd=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Kd=(e,t=21)=>zd(e,t|0,Vd),Xd=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Gd[n[e]&63];return t};const Wa=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),qd=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function Zd(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(qd.test(e)){if(ja(e))return!0;try{const r=new URL(Ya(e)).hostname.split(".").pop();if(r&&Wa.has(r))return!0}catch{return!1}}return!1}function ja(e){return/^[a-zA-Z]+:\/\//.test(e)}function Jd(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Ya(e){return ja(e)?e:Jd(e)?`mailto://${e}`:`https://${e}`}const Qd=/^-ms-/,ef=/-([a-z])/g,qt=["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"];function Qs(e,t){const n=K.getValueType(e),r=K.getValueType(t);return n!==r?!1:K.isArray(e)?tf(e,t):K.isObject(e)?nf(e,t):K.isDate(e)?e.getTime()===t.getTime():K.isRegExp(e)?e.toString()===t.toString():e===t}function tf(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!Qs(s,i))return!1}return!0}function nf(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!Qs(i,o))return!1}return!0}class K{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=qt.length;)r/=qt.length,r-=1,n+=qt[r%qt.length];const s=t%qt.length;return n+=qt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=qt.length**i+qt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return K.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return $t(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,c)=>{var u,h;if(K.isArray(l)){const d=(u=a[c])!=null?u:[];a[c]=d,r(l,d);return}if(K.isObject(l)){const d=(h=a[c])!=null?h:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var u,h;const c=o[l];if(K.isObject(c)){const d=(u=a[l])!=null?u:{};a[l]=d,s(c,d);return}if(K.isArray(c)){const d=(h=a[l])!=null?h:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,u;const l=o[a];if(K.isArray(l)){const h=(c=t[a])!=null?c:[];t[a]=h,r(l,h);return}if(K.isObject(l)){const h=(u=t[a])!=null?u:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return Qs(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=K.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=K.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Zd(t)}static normalizeUrl(t){return Ya(t)}static topLevelDomainCombiningString(){return[...Wa].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return K.isDefine(t)?K.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Qd,"ms-").replace(ef,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:K.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function $t(e=21,t){return t?Kd(t,e)():Xd(e)}function ei(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const rf=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function es(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:c}=a;K.hasIntersectionBetweenTwoRanges(t,n,l,c)&&(l>i?(o.push(r.slice(i,l)),o.push(ti(r,{...a,ed:Math.min(c,n)}))):o.push(ti(r,{...a,st:i,ed:Math.min(c,n)}))),i=Math.max(t,Math.min(c,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function sf(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:c={}}=a,{spaceAbove:u,spaceBelow:h,lineSpacing:d}=c,m=[];u!=null&&(typeof u=="number"?m.push(`margin-top: ${u}px`):m.push(`margin-top: ${u.v}px`)),h!=null&&(typeof h=="number"?m.push(`margin-bottom: ${h}px`):m.push(`margin-bottom: ${h.v}px`)),d!=null&&m.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${m.length?`style="${m.join("; ")};"`:""}>${es(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${m.length?`style="${m.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=es(e,o,r.length)),i}else return es(e,0,e.dataStream.length)}function ti(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:c,st:u,ol:h,bg:d,cl:m,va:_}=s;let E=e.slice(n,r);const I=[];return a===ae.TRUE&&(E=`<i>${E}</i>`),_===Bt.SUPERSCRIPT?E=`<sup>${E}</sup>`:_===Bt.SUBSCRIPT&&(E=`<sub>${E}</sub>`),(c==null?void 0:c.s)===ae.TRUE&&(E=`<u>${E}</u>`),(u==null?void 0:u.s)===ae.TRUE&&(E=`<s>${E}</s>`),l===ae.TRUE&&(E=`<strong>${E}</strong>`),i&&I.push(`font-family: ${i}`),m&&I.push(`color: ${m.rgb}`),o&&I.push(`font-size: ${o}pt`),h&&I.push("text-decoration: overline"),d&&I.push(`background: ${d.rgb}`),I.length?`<span style="${I.join("; ")};">${E}</span>`:E}const Ga={[Qr.OFFICE]:{[it.ACCENT1]:"#4472C4",[it.ACCENT2]:"#ED7D31",[it.ACCENT3]:"#A5A5A5",[it.ACCENT4]:"#70AD47",[it.ACCENT5]:"#5B9BD5",[it.ACCENT6]:"#70AD47",[it.DARK1]:"#000000",[it.DARK2]:"#44546A",[it.LIGHT1]:"#FFFFFF",[it.LIGHT2]:"#E7E6E6",[it.HYPERLINK]:"#0563C1",[it.FOLLOWED_HYPERLINK]:"#954F72"}};class ts{constructor(){C(this,"_themeValue",it.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=mt.UNSUPPORTED,this._themeColors=Qr.OFFICE,this._themeTint=0}asRgbColor(){return new ns(this._rgbValue,this)}asThemeColor(){return new rs(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case mt.THEME:return this.asThemeColor();case mt.RGB:return this.asRgbColor();case mt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=mt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=mt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=mt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=mt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class dn{constructor(t){C(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new ts().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new dn(this._builder)}equals(t){return!1}}class Va{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),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),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new ts;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,c=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(c*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends dn{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return dn.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return mt.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(Ct,"RGB_COLOR_AMT",0),C(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let ns=Ct;const an=class an extends dn{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=Ga[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(an._cacheThemeColor.has(this._themeColors)){if(s=an._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,an._cacheThemeColor.set(this._themeColors,s);const i=new Va(dn.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new an(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof an?n._themeColorType===this._themeColorType:!1}getColorType(){return mt.THEME}getThemeColorType(){return this._themeColorType}};C(an,"_cacheThemeColor",new Map);let rs=an;const of="rgb(",af="rgba(",ni={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 Ot{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof Ot){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=za(t);if(n==null){this._setNullColor();return}this._color=n;const r=df(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,u;r=Math.min(1,Math.max(0,r));const s=new Ot(t).toRgb(),i=new Ot(n).toRgb(),o=(c=s.a)!=null?c:1,a=(u=i.a)!=null?u:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new Ot(l)}static getContrastRatio(t,n){const r=new Ot(t).getLuminance(),s=new Ot(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[ss(Math.round(n).toString(16)),ss(Math.round(r).toString(16)),ss(Math.round(s).toString(16)),ss(Math.round(i*255).toString(16))];return t&&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 _f(this.toRgb())}toHsl(){return gf(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new Ot(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new Ot(n)}setAlpha(t){return new Ot({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=ri(t),n=ri(n),r=ri(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t: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 ss=e=>e.length===1?`0${e}`:e,ri=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),za=e=>{if(Ef(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ni[t]){const n=ni[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return lf(t);if(t.startsWith("rgb"))return cf(t);if(t.startsWith("hsl"))return uf(t);if(t.startsWith("hsv"))return hf(t)},lf=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},cf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},uf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},hf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},df=e=>{const t=za(e);if(t!=null)return"r"in t?t:"l"in t?ff(t):mf(t)},si=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),ff=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;s=si(c,l,t+1/3),i=si(c,l,t),o=si(c,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},mf=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=s%6,u=[r,a,o,o,l,r][c],h=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],m={r:u*255,g:h*255,b:d*255};return e.a!==void 0&&(m.a=e.a),m},gf=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const u=s-i;switch(l=o>.5?u/(2-s-i):u/(s+i),s){case t:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-t)/u+2;break;default:a=(t-n)/u+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(c.a=e.a),c},_f=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,c=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(u.a=e.a),u},pf=e=>e==null,Ef=e=>!pf(e)&&typeof e=="object";function Cf(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function Rf(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^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!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var Ce=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Ce||{});function Ka(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function If(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Xt.STRING;if(typeof e.v=="number")return Xt.NUMBER;if(typeof e.v=="boolean")return Xt.BOOLEAN}function Sf(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function Xa(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var pe=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(pe||{}),Ye=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Ye||{});function Of(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var qa=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(qa||{}),Za=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Za||{});function vf(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let c=0;c<n.length;c++){const{startRow:u,endRow:h,startColumn:d,endColumn:m}=n[c];if(e===u&&t===d){i=h,o=m,a=u,l=d,s=!0;break}if(e>=u&&e<=h&&t>=d&&t<=m){i=h,o=m,a=u,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var An=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(An||{});function wf(e,t){const n={};for(const r in e){const s=Number(r),i=e[s];for(const o in i){const a=Number(o),l=i[a],c=t(s,a,l);c!==void 0&&(n[s]?n[s][a]=c:n[s]={[a]:c})}}return n}function Zt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function ii(e,t,n){const r=Zt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function oi(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function bf(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let c=0;for(let u=0;u<s;u++,c++){const h=r[u];l[c]=n[h]}for(let u=0;u<a;u++,c++){const h=o[u];l[c]=i[h]}return l}function Af(e,t,n){const r=n;if(Zt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function ai(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?Tf(e,t,n,r):yf(e,t,n,r)}function Tf(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function yf(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class lt{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new lt({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){ai(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{ai(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)ii(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&ii(r,void 0,i)})}removeRows(t,n){oi(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&oi(t,n,s)})}getFragment(t,n,r,s){const i=new lt;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let u=r;u<=s;u++){const h=this.getValue(a,u);l[c]=h,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new lt;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,K.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Zt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Zt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new lt;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const c=Number(l);s?c<n&&(n=c):(s=!0,n=c);const u=this.getValue(o,c);i.setValue(o-t,c-n,u)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const c=Zt(l)-1;c>r&&(r=c),Object.keys(l).forEach(u=>{const h=Number(u);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}merge(t){this.forValue((n,r)=>{const s=t.getValue(n,r);s!=null&&this.setValue(n,r,s)})}_setOriginValue(t={}){this._matrix=t}}function Ja(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,u=t,h=n,d=t,m=n;if(r&&i){const{startRow:_,startColumn:E,endRow:I,endColumn:A,startY:H,endY:x,startX:Y,endX:v}=i;u=_,h=E,d=I,m=A,o=H,a=x,l=Y,c=v}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,m=i.endColumn),{startRow:u,startColumn:h,endRow:d,endColumn:m,startY:o,endY:a,startX:l,endX:c}}const Nf=Ja;function Mf(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let c=t,u=n,h=t,d=n;return(r||s)&&(c=i,u=o,h=a,d=l),{startRow:c,startColumn:u,endRow:h,endColumn:d}}function Qa(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function li(e){return Qa(e)&&(e==null?void 0:e.coverable)!==!1}function Mt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new ts().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function el(e){return K.isString(e)&&e.substring(0,1)==="="&&e.length>1}function Df(e){return K.isString(e)&&e.length>0}function Lf(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Mt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Mt(e.bg)}; `)}],["bd",()=>{var o,a,l,c,u,h,d,m,_,E,I,A;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${is((a=e.bd)==null?void 0:a.b.s)} ${(l=Mt(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${is((u=e.bd)==null?void 0:u.t.s)} ${(h=Mt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${is((m=e.bd)==null?void 0:m.r.s)} ${(_=Mt(e.bd.r.cl))!=null?_:""}; `),(E=e.bd)!=null&&E.l&&(n+=`border-left: ${is((I=e.bd)==null?void 0:I.l.s)} ${(A=Mt(e.bd.l.cl))!=null?A:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Mt(e.cl)}; `)}],["va",()=>{e.va===Bt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Bt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===ar.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===ar.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===St.LEFT?n+="text-align: left; ":e.ht===St.RIGHT?n+="text-align: right; ":e.ht===St.CENTER?n+="text-align: center; ":e.ht===St.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===un.BOTTOM?n+="vertical-align: bottom; ":e.vt===un.TOP?n+="vertical-align: top; ":e.vt===un.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===hn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===hn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var u,h,d,m,_,E,I,A;const o=`${(u=e.pd)==null?void 0:u.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(m=e.pd)==null?void 0:m.r}pt`;(_=e.pd)!=null&&_.b&&(n+=`padding-bottom: ${o}; `),(E=e.pd)!=null&&E.t&&(n+=`padding-top: ${a}; `),(I=e.pd)!=null&&I.l&&(n+=`padding-left: ${l}; `),(A=e.pd)!=null&&A.r&&(n+=`padding-right: ${c}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function is(e){let t="";return e===Le.NONE?t="none":e===Le.THIN?t="0.5pt solid":e===Le.HAIR?t="0.5pt double":e===Le.DOTTED?t="0.5pt dotted":e===Le.DASHED||e===Le.DASH_DOT?t="0.5pt dashed":e===Le.DASH_DOT_DOT?t="0.5pt dotted":e===Le.DOUBLE?t="0.5pt double":e===Le.MEDIUM?t="1pt solid":e===Le.MEDIUM_DASHED||e===Le.MEDIUM_DASH_DOT?t="1pt dashed":e===Le.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===Le.SLANT_DASH_DOT?t="0.5pt dashed":e===Le.THICK&&(t="1.5pt solid"),t}function Uf(e){let t=0;if(e=e.trim(),e==="none")t=Le.NONE;else if(e==="0.5pt solid")t=Le.THIN;else if(e==="0.5pt double")t=Le.HAIR;else if(e==="0.5pt dotted")t=Le.DOTTED;else if(e==="0.5pt dashed")t=Le.DASHED;else if(e==="1pt solid")t=Le.MEDIUM;else if(e==="1pt dashed")t=Le.MEDIUM_DASHED;else if(e==="1pt dotted")t=Le.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=Le.THICK;else if(!e.includes("none"))t=Le.THIN;else return Le.NONE;return t}function Pf(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function kf(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===pe.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===pe.ROW||o!==pe.ROW&&o!==pe.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function Ff(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function ci(e){return el(e)?{f:e,v:null,p:null}:Xa(e)?{v:e,p:null,f:null}:(Ka(e),e)}function xf(e,t){const n=new lt,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(K.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,ci(e[a][l]));else new lt(e).forValue((l,c,u)=>{n.setValue(l,c,ci(u))});return n.getMatrix()}function ui(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>ui(e[n],t[n])):e===t:!1}function tl(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:ui(n,r)}function Bf(e,t){return t.some(n=>e.indexOf(n)>-1)}function gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={exports:{}},$f=os.exports,nl;function Hf(){return nl||(nl=1,function(e,t){(function(n,r){e.exports=r()})($f,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",d="quarter",m="year",_="date",E="Invalid Date",I=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,A=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,H={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var T=["th","st","nd","rd"],w=M%100;return"["+M+(T[(w-20)%10]||T[w]||T[0])+"]"}},x=function(M,T,w){var N=String(M);return!N||N.length>=T?M:""+Array(T+1-N.length).join(w)+M},Y={s:x,z:function(M){var T=-M.utcOffset(),w=Math.abs(T),N=Math.floor(w/60),D=w%60;return(T<=0?"+":"-")+x(N,2,"0")+":"+x(D,2,"0")},m:function M(T,w){if(T.date()<w.date())return-M(w,T);var N=12*(w.year()-T.year())+(w.month()-T.month()),D=T.clone().add(N,h),L=w-D<0,F=T.clone().add(N+(L?-1:1),h);return+(-(N+(w-D)/(L?D-F:F-D))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:m,w:u,d:c,D:_,h:l,m:a,s:o,ms:i,Q:d}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},v="en",R={};R[v]=H;var b="$isDayjsObject",y=function(M){return M instanceof P||!(!M||!M[b])},B=function M(T,w,N){var D;if(!T)return v;if(typeof T=="string"){var L=T.toLowerCase();R[L]&&(D=L),w&&(R[L]=w,D=L);var F=T.split("-");if(!D&&F.length>1)return M(F[0])}else{var Q=T.name;R[Q]=T,D=Q}return!N&&D&&(v=D),D||!N&&v},$=function(M,T){if(y(M))return M.clone();var w=typeof T=="object"?T:{};return w.date=M,w.args=arguments,new P(w)},g=Y;g.l=B,g.i=y,g.w=function(M,T){return $(M,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var P=function(){function M(w){this.$L=B(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[b]=!0}var T=M.prototype;return T.parse=function(w){this.$d=function(N){var D=N.date,L=N.utc;if(D===null)return new Date(NaN);if(g.u(D))return new Date;if(D instanceof Date)return new Date(D);if(typeof D=="string"&&!/Z$/i.test(D)){var F=D.match(I);if(F){var Q=F[2]-1||0,z=(F[7]||"0").substring(0,3);return L?new Date(Date.UTC(F[1],Q,F[3]||1,F[4]||0,F[5]||0,F[6]||0,z)):new Date(F[1],Q,F[3]||1,F[4]||0,F[5]||0,F[6]||0,z)}}return new Date(D)}(w),this.init()},T.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},T.$utils=function(){return g},T.isValid=function(){return this.$d.toString()!==E},T.isSame=function(w,N){var D=$(w);return this.startOf(N)<=D&&D<=this.endOf(N)},T.isAfter=function(w,N){return $(w)<this.startOf(N)},T.isBefore=function(w,N){return this.endOf(N)<$(w)},T.$g=function(w,N,D){return g.u(w)?this[N]:this.set(D,w)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(w,N){var D=this,L=!!g.u(N)||N,F=g.p(w),Q=function(W,j){var ee=g.w(D.$u?Date.UTC(D.$y,j,W):new Date(D.$y,j,W),D);return L?ee:ee.endOf(c)},z=function(W,j){return g.w(D.toDate()[W].apply(D.toDate("s"),(L?[0,0,0,0]:[23,59,59,999]).slice(j)),D)},le=this.$W,ue=this.$M,S=this.$D,U="set"+(this.$u?"UTC":"");switch(F){case m:return L?Q(1,0):Q(31,11);case h:return L?Q(1,ue):Q(0,ue+1);case u:var G=this.$locale().weekStart||0,V=(le<G?le+7:le)-G;return Q(L?S-V:S+(6-V),ue);case c:case _:return z(U+"Hours",0);case l:return z(U+"Minutes",1);case a:return z(U+"Seconds",2);case o:return z(U+"Milliseconds",3);default:return this.clone()}},T.endOf=function(w){return this.startOf(w,!1)},T.$set=function(w,N){var D,L=g.p(w),F="set"+(this.$u?"UTC":""),Q=(D={},D[c]=F+"Date",D[_]=F+"Date",D[h]=F+"Month",D[m]=F+"FullYear",D[l]=F+"Hours",D[a]=F+"Minutes",D[o]=F+"Seconds",D[i]=F+"Milliseconds",D)[L],z=L===c?this.$D+(N-this.$W):N;if(L===h||L===m){var le=this.clone().set(_,1);le.$d[Q](z),le.init(),this.$d=le.set(_,Math.min(this.$D,le.daysInMonth())).$d}else Q&&this.$d[Q](z);return this.init(),this},T.set=function(w,N){return this.clone().$set(w,N)},T.get=function(w){return this[g.p(w)]()},T.add=function(w,N){var D,L=this;w=Number(w);var F=g.p(N),Q=function(ue){var S=$(L);return g.w(S.date(S.date()+Math.round(ue*w)),L)};if(F===h)return this.set(h,this.$M+w);if(F===m)return this.set(m,this.$y+w);if(F===c)return Q(1);if(F===u)return Q(7);var z=(D={},D[a]=r,D[l]=s,D[o]=n,D)[F]||1,le=this.$d.getTime()+w*z;return g.w(le,this)},T.subtract=function(w,N){return this.add(-1*w,N)},T.format=function(w){var N=this,D=this.$locale();if(!this.isValid())return D.invalidDate||E;var L=w||"YYYY-MM-DDTHH:mm:ssZ",F=g.z(this),Q=this.$H,z=this.$m,le=this.$M,ue=D.weekdays,S=D.months,U=D.meridiem,G=function(j,ee,te,k){return j&&(j[ee]||j(N,L))||te[ee].slice(0,k)},V=function(j){return g.s(Q%12||12,j,"0")},W=U||function(j,ee,te){var k=j<12?"AM":"PM";return te?k.toLowerCase():k};return L.replace(A,function(j,ee){return ee||function(te){switch(te){case"YY":return String(N.$y).slice(-2);case"YYYY":return g.s(N.$y,4,"0");case"M":return le+1;case"MM":return g.s(le+1,2,"0");case"MMM":return G(D.monthsShort,le,S,3);case"MMMM":return G(S,le);case"D":return N.$D;case"DD":return g.s(N.$D,2,"0");case"d":return String(N.$W);case"dd":return G(D.weekdaysMin,N.$W,ue,2);case"ddd":return G(D.weekdaysShort,N.$W,ue,3);case"dddd":return ue[N.$W];case"H":return String(Q);case"HH":return g.s(Q,2,"0");case"h":return V(1);case"hh":return V(2);case"a":return W(Q,z,!0);case"A":return W(Q,z,!1);case"m":return String(z);case"mm":return g.s(z,2,"0");case"s":return String(N.$s);case"ss":return g.s(N.$s,2,"0");case"SSS":return g.s(N.$ms,3,"0");case"Z":return F}return null}(j)||F.replace(":","")})},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(w,N,D){var L,F=this,Q=g.p(N),z=$(w),le=(z.utcOffset()-this.utcOffset())*r,ue=this-z,S=function(){return g.m(F,z)};switch(Q){case m:L=S()/12;break;case h:L=S();break;case d:L=S()/3;break;case u:L=(ue-le)/6048e5;break;case c:L=(ue-le)/864e5;break;case l:L=ue/s;break;case a:L=ue/r;break;case o:L=ue/n;break;default:L=ue}return D?L:g.a(L)},T.daysInMonth=function(){return this.endOf(h).$D},T.$locale=function(){return R[this.$L]},T.locale=function(w,N){if(!w)return this.$L;var D=this.clone(),L=B(w,N,!0);return L&&(D.$L=L),D},T.clone=function(){return g.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},M}(),O=P.prototype;return $.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",m],["$D",_]].forEach(function(M){O[M[1]]=function(T){return this.$g(T,M[0],M[1])}}),$.extend=function(M,T){return M.$i||(M(T,P,$),M.$i=!0),$},$.locale=B,$.isDayjs=y,$.unix=function(M){return $(1e3*M)},$.en=R[v],$.Ls=R,$.p={},$})}(os)),os.exports}var Wf=Hf();const Ht=gt(Wf);var as={exports:{}},jf=as.exports,rl;function Yf(){return rl||(rl=1,function(e,t){(function(n,r){e.exports=r()})(jf,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var c=this.$utils(),u=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(u)}}})}(as)),as.exports}var Gf=Yf();const Vf=gt(Gf);var ls={exports:{}},zf=ls.exports,sl;function Kf(){return sl||(sl=1,function(e,t){(function(n,r){e.exports=r()})(zf,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(I){return(I=+I)+(I>68?1900:2e3)},u=function(I){return function(A){this[I]=+A}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(I){(this.zone||(this.zone={})).offset=function(A){if(!A||A==="Z")return 0;var H=A.match(/([+-]|\d\d)/g),x=60*H[1]+(+H[2]||0);return x===0?0:H[0]==="+"?-x:x}(I)}],d=function(I){var A=l[I];return A&&(A.indexOf?A:A.s.concat(A.f))},m=function(I,A){var H,x=l.meridiem;if(x){for(var Y=1;Y<=24;Y+=1)if(I.indexOf(x(Y,0,A))>-1){H=Y>12;break}}else H=I===(A?"pm":"PM");return H},_={A:[a,function(I){this.afternoon=m(I,!1)}],a:[a,function(I){this.afternoon=m(I,!0)}],Q:[s,function(I){this.month=3*(I-1)+1}],S:[s,function(I){this.milliseconds=100*+I}],SS:[i,function(I){this.milliseconds=10*+I}],SSS:[/\d{3}/,function(I){this.milliseconds=+I}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[i,u("day")],Do:[a,function(I){var A=l.ordinal,H=I.match(/\d+/);if(this.day=H[0],A)for(var x=1;x<=31;x+=1)A(x).replace(/\[|\]/g,"")===I&&(this.day=x)}],w:[o,u("week")],ww:[i,u("week")],M:[o,u("month")],MM:[i,u("month")],MMM:[a,function(I){var A=d("months"),H=(d("monthsShort")||A.map(function(x){return x.slice(0,3)})).indexOf(I)+1;if(H<1)throw new Error;this.month=H%12||H}],MMMM:[a,function(I){var A=d("months").indexOf(I)+1;if(A<1)throw new Error;this.month=A%12||A}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(I){this.year=c(I)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function E(I){var A,H;A=I,H=l&&l.formats;for(var x=(I=A.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function($,g,P){var O=P&&P.toUpperCase();return g||H[P]||n[P]||H[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(M,T,w){return T||w.slice(1)})})).match(r),Y=x.length,v=0;v<Y;v+=1){var R=x[v],b=_[R],y=b&&b[0],B=b&&b[1];x[v]=B?{regex:y,parser:B}:R.replace(/^\[|\]$/g,"")}return function($){for(var g={},P=0,O=0;P<Y;P+=1){var M=x[P];if(typeof M=="string")O+=M.length;else{var T=M.regex,w=M.parser,N=$.slice(O),D=T.exec(N)[0];w.call(g,D),$=$.replace(D,"")}}return function(L){var F=L.afternoon;if(F!==void 0){var Q=L.hours;F?Q<12&&(L.hours+=12):Q===12&&(L.hours=0),delete L.afternoon}}(g),g}}return function(I,A,H){H.p.customParseFormat=!0,I&&I.parseTwoDigitYear&&(c=I.parseTwoDigitYear);var x=A.prototype,Y=x.parse;x.parse=function(v){var R=v.date,b=v.utc,y=v.args;this.$u=b;var B=y[1];if(typeof B=="string"){var $=y[2]===!0,g=y[3]===!0,P=$||g,O=y[2];g&&(O=y[2]),l=this.$locale(),!$&&O&&(l=H.Ls[O]),this.$d=function(N,D,L,F){try{if(["x","X"].indexOf(D)>-1)return new Date((D==="X"?1e3:1)*N);var Q=E(D)(N),z=Q.year,le=Q.month,ue=Q.day,S=Q.hours,U=Q.minutes,G=Q.seconds,V=Q.milliseconds,W=Q.zone,j=Q.week,ee=new Date,te=ue||(z||le?1:ee.getDate()),k=z||ee.getFullYear(),X=0;z&&!le||(X=le>0?le-1:ee.getMonth());var Z,re=S||0,ge=U||0,Ee=G||0,q=V||0;return W?new Date(Date.UTC(k,X,te,re,ge,Ee,q+60*W.offset*1e3)):L?new Date(Date.UTC(k,X,te,re,ge,Ee,q)):(Z=new Date(k,X,te,re,ge,Ee,q),j&&(Z=F(Z).week(j).toDate()),Z)}catch{return new Date("")}}(R,B,b,H),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),P&&R!=this.format(B)&&(this.$d=new Date("")),l={}}else if(B instanceof Array)for(var M=B.length,T=1;T<=M;T+=1){y[1]=B[T-1];var w=H.apply(this,y);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}T===M&&(this.$d=new Date(""))}else Y.call(this,v)}}})}(ls)),ls.exports}var Xf=Kf();const qf=gt(Xf);var cs={exports:{}},Zf=cs.exports,il;function Jf(){return il||(il=1,function(e,t){(function(n,r){e.exports=r()})(Zf,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,m,_,E){var I=h.name?h:h.$locale(),A=o(I[d]),H=o(I[m]),x=A||H.map(function(v){return v.slice(0,_)});if(!E)return x;var Y=I.weekStart;return x.map(function(v,R){return x[(R+(Y||0))%7]})},l=function(){return s.Ls[s.locale()]},c=function(h,d){return h.formats[d]||function(m){return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(_,E,I){return E||I.slice(1)})}(h.formats[d.toUpperCase()])},u=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return c(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return c(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(cs)),cs.exports}var Qf=Jf();const em=gt(Qf);var us={exports:{}},tm=us.exports,ol;function nm(){return ol||(ol=1,function(e,t){(function(n,r){e.exports=r()})(tm,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var c=this.$locale().formats,u=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(m,_,E){var I=E&&E.toUpperCase();return _||d[E]||n[E]||d[I].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(A,H,x){return H||x.slice(1)})})}(l,c===void 0?{}:c);return a.call(this,u)}}})}(us)),us.exports}var rm=nm();const sm=gt(rm);var hs={exports:{}},im=hs.exports,al;function om(){return al||(al=1,function(e,t){(function(n,r){e.exports=r()})(im,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(E){var I={date:E,utc:!0,args:arguments};return new o(I)},l.utc=function(E){var I=a(this.toDate(),{locale:this.$L,utc:!0});return E?I.add(this.utcOffset(),n):I},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(E){E.utc&&(this.$u=!0),this.$utils().u(E.$offset)||(this.$offset=E.$offset),c.call(this,E)};var u=l.init;l.init=function(){if(this.$u){var E=this.$d;this.$y=E.getUTCFullYear(),this.$M=E.getUTCMonth(),this.$D=E.getUTCDate(),this.$W=E.getUTCDay(),this.$H=E.getUTCHours(),this.$m=E.getUTCMinutes(),this.$s=E.getUTCSeconds(),this.$ms=E.getUTCMilliseconds()}else u.call(this)};var h=l.utcOffset;l.utcOffset=function(E,I){var A=this.$utils().u;if(A(E))return this.$u?0:A(this.$offset)?h.call(this):this.$offset;if(typeof E=="string"&&(E=function(v){v===void 0&&(v="");var R=v.match(r);if(!R)return null;var b=(""+R[0]).match(s)||["-",0,0],y=b[0],B=60*+b[1]+ +b[2];return B===0?0:y==="+"?B:-B}(E),E===null))return this;var H=Math.abs(E)<=16?60*E:E,x=this;if(I)return x.$offset=H,x.$u=E===0,x;if(E!==0){var Y=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(x=this.local().add(H+Y,n)).$offset=H,x.$x.$localOffset=Y}else x=this.utc();return x};var d=l.format;l.format=function(E){var I=E||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,I)},l.valueOf=function(){var E=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*E},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var m=l.toDate;l.toDate=function(E){return E==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var _=l.diff;l.diff=function(E,I,A){if(E&&this.$u===E.$u)return _.call(this,E,I,A);var H=this.local(),x=a(E).local();return _.call(H,x,I,A)}}})}(hs)),hs.exports}var am=om();const lm=gt(am);var ds={exports:{}},cm=ds.exports,ll;function um(){return ll||(ll=1,function(e,t){(function(n,r){e.exports=r()})(cm,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(ds)),ds.exports}var hm=um();const dm=gt(hm);var fs={exports:{}},fm=fs.exports,cl;function mm(){return cl||(cl=1,function(e,t){(function(n,r){e.exports=r()})(fm,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=o(this).startOf(r).add(1,r).date(c),h=o(this).endOf(n);if(u.isBefore(h))return 1}var d=o(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),m=this.diff(d,n,!0);return m<0?o(this).startOf("week").week():Math.ceil(m)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(fs)),fs.exports}var gm=mm();const _m=gt(gm);var ms={exports:{}},pm=ms.exports,ul;function Em(){return ul||(ul=1,function(e,t){(function(n,r){e.exports=r()})(pm,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(ms)),ms.exports}var Cm=Em();const Rm=gt(Cm);Ht.extend(qf),Ht.extend(Vf),Ht.extend(dm),Ht.extend(em),Ht.extend(_m),Ht.extend(Rm),Ht.extend(lm),Ht.extend(sm);function gs(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function Im(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function Sm(e){if(e==null)return!1;const t=e.paragraphStyle;return hl(t)}function hl(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function dl(e,t,n){return e.slice(0,t)+n+e.slice(t)}function fl(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Om(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function vm(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const De=Symbol("newer"),Ze=Symbol("older");class wm{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[De],{done:!1,value:t.key}):{done:!0,value:void 0}}}class bm{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[De],{done:!1,value:t.value}):{done:!0,value:void 0}}}class Am{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[De],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}md=De,fd=Ze;class ml{constructor(t,n){C(this,"key");C(this,"value");C(this,md);C(this,fd);this.key=t,this.value=n,this[De]=void 0,this[Ze]=void 0}toJSON(){return{key:this.key,value:this.value}}}class lr{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(cr.hasLength(t,1)){if(cr.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(cr.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(cr.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),We(()=>tr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[De]&&(t===this.oldest&&(this.oldest=t[De]),t[De][Ze]=t[Ze]),t[Ze]&&(t[Ze][De]=t[De]),t[De]=void 0,t[Ze]=this.newest,this.newest&&(this.newest[De]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new ml(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[De]=o,o[Ze]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new ml(t,n)),this.newest?(this.newest[De]=r,r[Ze]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[De]?(this.oldest=this.oldest[De],this.oldest[Ze]=void 0):(this.oldest=void 0,this.newest=void 0),t[De]=t[Ze]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[De]&&n[Ze]?(n[Ze][De]=n[De],n[De][Ze]=n[Ze]):n[De]?(n[De][Ze]=void 0,this.oldest=n[De]):n[Ze]?(n[Ze][De]=void 0,this.newest=n[Ze]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new wm(this.oldest)}values(){return new bm(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Am(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[De]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[De];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[De],n&&(t+=" < ");return t}}class cr{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}const ur=2,hr=2**2,_s=2**3,dr=2**4,fr=2**5,mr=2**6,hi=2**7,di=2**8,fi=2**9,Tm=0,ym=2958466,Nm=-694324,Mm=35830291,Dm=-1,gl=1,Tn=6,mi="general",gi="hash",yn="zero",_i="qmark",pi="slash",gr="group",ps="scale",Ei="comma",Ci="break",Es="text",Ri="plus",Ii="minus",Cs="point",Si="space",Oi="percent",Rs="digit",vi="calendar",_r="error",wi="datetime",bi="duration",Ai="condition",Ti="dbnum",yi="natnum",Ni="locale",Mi="color",_l="modifier",Di="ampm",Li="escaped",Ui="string",Pi="skip",ki="exp",Fi="fill",xi="paren",Is="char",Lm=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],Bi=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],$i=new RegExp("["+Bi.join("")+"]"),Hi=Object.freeze({1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"}),pl=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,Nn={},p=(e,t="")=>e.replace(/~/g,t).split(";"),Ue=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(r=>{const s=r.slice(0,t%10);return s+(t<10||r===s?"":".")})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(r=>{const s=r.slice(0,n%10);return s+(n<10||r===s?"":".")})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),Um={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:p("AM;PM"),mmmm6:p("Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah"),mmm6:p("Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H."),mmmm:p("January;February;March;April;May;June;July;August;September;October;November;December"),mmm:p("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"),dddd:p("Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"),ddd:p("Sun;Mon;Tue;Wed;Thu;Fri;Sat"),bool:p("TRUE;FALSE"),preferMDY:!1};function Wi(e){const t=pl.exec(e);if(!t)throw new SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?"_"+t[2]:""),language:t[1],territory:t[2]||""}}function ji(e){if(typeof e=="number")return Hi[e&65535]||null;const t=parseInt(e,16);return isFinite(t)&&Hi[t&65535]?Hi[t&65535]||null:pl.test(e)?e:null}function Mn(e){const t=ji(e);let n=null;if(t){const r=Wi(t);n=Nn[r.lang]||Nn[r.language]||null}return n}function Yi(e){return Object.assign({},Um,e)}function ne(e,t){const n=typeof t=="object"?t:Wi(t);return Nn[n.lang]=Yi(e),n.language!==n.lang&&!Nn[n.language]&&(Nn[n.language]=Yi(e)),Nn[n.lang]}const Jt=Yi({group:",",preferMDY:!0});Jt.isDefault=!0,ne({group:",",ampm:p("上午;下午"),mmmm:p("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),mmm:p("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:p("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:p("周日;周一;周二;周三;周四;周五;周六")},"zh_CN");const Gi={group:",",ampm:p("上午;下午"),mmmm:p("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),mmm:p("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:p("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:p("周日;周一;周二;周三;周四;周五;周六")};ne({...Gi,nan:"非數值",dddd:p("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_TW"),ne({...Gi,dddd:p("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_HK"),ne({...Gi,ampm:p("午前;午後"),dddd:p("日~;月~;火~;水~;木~;金~;土~","曜日"),ddd:p("日;月;火;水;木;金;土")},"ja"),ne({group:",",ampm:p("오전;오후"),mmmm:p("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),mmm:p("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),dddd:p("일요일;월요일;화요일;수요일;목요일;금요일;토요일"),ddd:p("일;월;화;수;목;금;토")},"ko"),ne({group:",",ampm:p("ก่อนเที่ยง;หลังเที่ยง"),mmmm:p("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~","าคม"),mmm:p("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),dddd:p("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),ddd:p("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")},"th"),ne(Ue({decimal:",",ampm:p("dop.;odp."),mmmm:p("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),mmm:p("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),dddd:p("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),bool:p("PRAVDA;NEPRAVDA")},-1,2),"cs"),ne(Ue({group:".",decimal:",",mmmm:p("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),dddd:p("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:p("SAND;FALSK")},13,13),"da"),ne(Ue({group:".",decimal:",",ampm:p("a.m.;p.m."),mmmm:p("januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december"),mmm:p("jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec."),dddd:p("zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag"),bool:p("WAAR;ONWAAR")},-1,2),"nl"),ne({group:",",preferMDY:!0},"en"),ne({group:",",preferMDY:!0},"en_US"),ne({group:","},"en_AU"),ne({group:","},"en_CA"),ne({group:","},"en_GB"),ne({group:",",mmm:p("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")},"en_IE"),ne(Ue({decimal:",",nan:"epäluku",ampm:p("ap.;ip."),mmmm:p("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~","kuuta"),mmm:p("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),dddd:p("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~","taina"),bool:p("TOSI;EPÄTOSI")},-1,2),"fi");const Vi=Ue({group:" ",decimal:",",mmmm:p("janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre"),mmm:p("janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc."),dddd:p("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~","di"),bool:p("VRAI;FAUX")},-1,13);ne({...Vi},"fr"),ne({...Vi,mmm:p("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")},"fr_CA"),ne({group:"'",decimal:".",...Vi},"fr_CH");const El=Ue({mmmm:p("Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember"),mmm:p("Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez."),dddd:p("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~","tag"),bool:p("WAHR;FALSCH")},-1,12);ne({group:".",decimal:",",...El},"de"),ne({group:"'",decimal:".",...El},"de_CH"),ne(Ue({group:".",decimal:",",ampm:p("π.μ.;μ.μ."),mmmm:p("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~","ίου"),mmm:p("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),dddd:p("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")},-1,3),"el"),ne({decimal:",",ampm:p("de.;du."),mmmm:p("január;február;március;április;május;június;július;augusztus;szeptember;október;november;december"),mmm:p("jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec."),dddd:p("vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat"),ddd:p("V;H;K;Sze;Cs;P;Szo"),bool:p("IGAZ;HAMIS")},"hu"),ne(Ue({group:".",decimal:",",ampm:p("f.h.;e.h."),mmmm:p("janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember"),dddd:p("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~","dagur")},13,13),"is"),ne(Ue({group:".",decimal:",",mmmm:p("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),dddd:p("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")},3,3),"id");const Cl=Ue({mmmm:p("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),dddd:p("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),bool:p("VERO;FALSO")},3,3);ne({group:".",decimal:",",...Cl},"it"),ne({group:"'",decimal:".",...Cl},"it_CH");const Rl={decimal:",",ampm:p("a.m.;p.m."),mmmm:p("januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember"),mmm:p("jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des."),dddd:p("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:p("SANN;USANN")};ne(Ue({...Rl},-1,13),"nb"),ne(Ue({...Rl},-1,13),"no"),ne(Ue({decimal:",",mmmm:p("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),dddd:p("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),ddd:p("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),bool:p("PRAWDA;FAŁSZ")},3,-1),"pl");const Il={group:".",decimal:",",mmmm:p("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),dddd:p("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),bool:p("VERDADEIRO;FALSO")};ne(Ue(Il,13,13),"pt"),ne(Ue(Il,13,13),"pt_BR"),ne({decimal:",",nan:"не число",mmmm:p("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),mmm:p("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),dddd:p("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),ddd:p("вс;пн;вт;ср;чт;пт;сб"),mmmm6:p("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),mmm6:p("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),bool:p("ИСТИНА;ЛОЖЬ")},"ru"),ne(Ue({decimal:",",mmmm:p("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),dddd:p("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")},3,2),"sk");const Dt={group:".",decimal:",",ampm:p("a. m.;p. m."),mmmm:p("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~","bre"),mmm:p("ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic"),dddd:p("domingo;lunes;martes;miércoles;jueves;viernes;sábado"),ddd:p("dom;lun;mar;mié;jue;vie;sáb"),bool:p("VERDADERO;FALSO")},Pm=p("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic"),zi=p("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");ne({...Dt},"es"),ne({...Dt},"es_AR"),ne({...Dt},"es_BO"),ne({...Dt},"es_CL"),ne({...Dt},"es_CO"),ne({...Dt},"es_EC"),ne({...Dt,mmm:Pm,ampm:p("a.m.;p.m.")},"es_MX"),ne({...Dt,mmm:zi},"es_PY"),ne({...Dt,mmm:zi},"es_UY"),ne({...Dt,mmm:zi,mmmm:p("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")},"es_VE"),ne({decimal:",",ampm:p("fm;em"),mmmm:p("januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december"),mmm:p("jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec."),dddd:p("sön~;mån~;tis~;ons~;tors~;fre~;lör~","dag"),ddd:p("sön;mån;tis;ons;tors;fre;lör")},"sv"),ne(Ue({group:".",decimal:",",ampm:p("ÖÖ;ÖS"),mmmm:p("Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık"),mmm:p("Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara"),dddd:p("Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi"),ddd:p("Paz;Pzt;Sal;Çar;Per;Cum;Cmt"),bool:p("DOĞRU;YANLIŞ")},3,-1),"tr"),ne({group:",",ampm:p("yb;yh"),mmmm:p("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),mmm:p("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),dddd:p("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),ddd:p("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")},"cy"),ne({group:".",decimal:",",mmmm:p("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),mmm:p("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),dddd:p("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),ddd:p("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")},"az"),ne(Ue({decimal:",",mmmm:p("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),dddd:p("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),ddd:p("нд;пн;аў;ср;чц;пт;сб")},3,-1),"be"),ne({decimal:",",ampm:p("пр.об.;сл.об."),mmmm:p("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),mmm:p("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),dddd:p("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),ddd:p("нд;пн;вт;ср;чт;пт;сб"),bool:p("ИСТИНА;ЛОЖЬ")},"bg"),ne({group:".",decimal:",",mmmm:p("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),mmm:p("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),dddd:p("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),ddd:p("dg.;dl.;dt.;dc.;dj.;dv.;ds."),ampm:p("a. m.;p. m.")},"ca"),ne(Ue({group:",",decimal:".",mmmm:p("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),dddd:p("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")},3,3),"fil"),ne({group:",",decimal:".",mmmm:p("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),mmm:p("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),dddd:p("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~","વાર"),ddd:p("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")},"gu"),ne({group:",",decimal:".",ampm:p("לפנה״צ;אחה״צ"),dddd:p("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת","יום "),ddd:p("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת","יום "),mmmm:p("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),mmm:p("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),mmmm6:p("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),mmm6:p("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")},"he"),ne(Ue({group:".",decimal:",",mmmm:p("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),mmm:p("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),dddd:p("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")},-1,3),"hr"),ne({decimal:",",mmmm:p("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),mmm:p("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),dddd:p("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),ddd:p("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")},"hy"),ne(Ue({decimal:",",mmmm:p("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),dddd:p("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")},3,3),"ka"),ne(Ue({decimal:",",mmmm:p("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),dddd:p("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),ddd:p("жс;дс;сс;ср;бс;жм;сб")},13,-1),"kk"),ne({group:",",mmmm:p("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),mmm:p("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),dddd:p("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~","ವಾರ"),ddd:p("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),ampm:p("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")},"kn"),ne({decimal:",",mmmm:p("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),mmm:p("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),dddd:p("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),ddd:p("sk;pr;an;tr;kt;pn;št"),ampm:p("priešpiet;popiet")},"lt"),ne({decimal:",",mmmm:p("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),mmm:p("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),dddd:p("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),ddd:p("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),ampm:p("priekšpusdienā;pēcpusdienā")},"lv"),ne({group:",",decimal:".",mmmm:p("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ"),mmm:p("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),dddd:p("ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച"),ddd:p("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")},"ml"),ne({group:",",decimal:".",mmmm:p("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~","р сар"),mmm:p("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~","-р сар"),dddd:p("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),ddd:p("Ня;Да;Мя;Лх;Пү;Ба;Бя"),ampm:p("ү.ө.;ү.х.")},"mn"),ne({group:",",decimal:".",mmmm:p("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),mmm:p("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),dddd:p("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:p("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")},"mr"),ne(Ue({group:",",decimal:".",mmmm:p("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),mmm:p("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),dddd:p("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),ampm:p("နံနက်;ညနေ")},-1,0),"my"),ne({group:",",decimal:".",mmmm:p("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),mmm:p("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),dddd:p("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),ddd:p("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),ampm:p("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")},"pa"),ne({group:".",decimal:",",mmmm:p("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~","brie"),mmm:p("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),dddd:p("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),ddd:p("dum.;lun.;mar.;mie.;joi;vin.;sâm."),ampm:p("a.m.;p.m.")},"ro"),ne(Ue({group:".",decimal:",",mmmm:p("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),mmm:p("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),dddd:p("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),ampm:p("dop.;pop.")},-1,13),"sl"),ne(Ue({group:".",decimal:",",mmmm:p("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),dddd:p("недеља;понедељак;уторак;среда;четвртак;петак;субота")},3,3),"sr"),ne({group:",",decimal:".",mmmm:p("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),mmm:p("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),dddd:p("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),ddd:p("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")},"ta"),ne({group:",",decimal:".",mmmm:p("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),mmm:p("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),dddd:p("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),ddd:p("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")},"te"),ne({decimal:",",mmmm:p("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),mmm:p("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),dddd:p("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),ddd:p("нд;пн;вт;ср;чт;пт;сб"),ampm:p("дп;пп")},"uk"),ne({group:".",decimal:",",mmmm:p("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","tháng "),mmm:p("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","thg "),dddd:p("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),ddd:p("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),ampm:p("SA;CH")},"vi"),ne(Ue({group:"٬",decimal:"٫",ampm:p("ص;م"),mmmm:p("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),dddd:p("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),mmmm6:p("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")},0,0),"ar"),ne({group:",",decimal:".",mmmm:p("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),mmm:p("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),dddd:p("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),ddd:p("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")},"bn"),ne({group:",",decimal:".",mmmm:p("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),mmm:p("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),dddd:p("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:p("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),ampm:p("am;pm")},"hi");const Sl={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:"",repeatChar:""};function _t(e,t=0){if(typeof e!="number")return e;if(e<0)return-_t(-e,t);if(t){const n=10**t||1;return _t(e*n,0)/n}return Math.round(e)}const km=1e-13;function Ol(e,t=2,n=2){const r=e<0?-1:1,s=10**(t||2),i=10**(n||2);let o=Math.abs(e),a=0,l=0,c=0,u=1,h,d;if(e=o,e%1===0)d=[e*r,1];else if(e<1e-19)d=[r,1e19];else if(e>1e19)d=[1e19*r,1];else{do if(o=1/(o-Math.floor(o)),h=u,u=u*Math.floor(o)+a,a=h,l=c,c=Math.floor(e*u+.5),c>=s||u>=i)return[r*l,a];while(Math.abs(e-c/u)>=km&&o!==Math.floor(o));d=[r*c,u]}return d}const ct=Math.floor;function vl(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019;const r=ct(4*n/146097);n=n-ct((146097*r+3)/4);const s=ct(4e3*(n+1)/1461001);n=n-ct(1461*s/4)+31;const i=ct(80*n/2447),o=n-ct(2447*i/80);n=ct(i/11);const a=i+2-12*n;return[100*(r-49)+s+n|0,a|0,o|0]}function Fm(e){return vl(e+1462)}function xm(e){if(e===60)throw new Error("#VALUE!");if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];const t=10631/30,n=8.01/60;let r=e+466935;const s=ct(r/10631);r=r-10631*s;const i=ct((r-n)/t);r=r-ct(i*t+n);const o=ct((r+28.5001)/29.5);return o===13?[30*s+i,12,30]:[30*s+i,o,r-ct(29.5001*o-29)]}function wl(e,t=0,n=!0){const r=ct(e);return t===Tn?xm(r):t===Dm?Fm(r):vl(r,n)}const Ss=Math.floor,Ki=86400;function Xi(e,t){let n=null;if(Array.isArray(e)){const[r,s,i,o,a,l]=e;n=Date.UTC(r,s==null?0:s-1,i!=null?i:1,o||0,a||0,l||0)}else if(e instanceof Date&&(n=e*1,!t||!t.ignoreTimezone)){const r=new Date;r.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=r*1}if(n!=null&&isFinite(n)){const r=n/864e5;return r-(r<=-25509?-25568:-25569)}return null}function Bm(e,t){let n=e|0;const r=Ki*(e-n);let s=Ss(r);r-s>.9999&&(s+=1,s===Ki&&(s=0,n+=1));const i=s<0?Ki+s:s,[o,a,l]=wl(e,0,t&&t.leap1900),c=Ss(i/60/60)%60,u=Ss(i/60)%60,h=Ss(i)%60;return[o,a,l,c,u,h]}const $m=["!d-m-y","!d-m-Y","!j-m-y","!j-m-Y","!d-n-y","!d-n-Y","!j-n-y","!j-n-Y","?m-d-y","?m-d-Y","?m-j-y","?m-j-Y","?n-d-y","?n-d-Y","?n-j-y","?n-j-Y","d-M-y","d-M-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","d-F-y","d-F-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"],Hm={j:"d",d:"d",D:"ddd",l:"dddd",n:"m",m:"m",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Wm={j:"dd",d:"dd",D:"ddd",l:"dddd",n:"mm",m:"mm",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},bl={},Al={};function ut(e,t,n=1){if(e){const r=e[0],s=e.slice(1);r==="!"?ut(s,t,4):r==="?"?ut(s,t,2):(t[r]=t[r]||{},ut(s,t[r],n))}else t.$=n}function Tl(e,t){ut(e,t),ut(e+" x",t),ut(e+" l",t),ut(e+" l x",t),ut("l "+e,t),ut("l "+e+" x",t),ut(e+" D",t),ut(e+" D x",t),ut("D "+e,t),ut("D "+e+" x",t)}$m.forEach(e=>{e[0]!=="?"&&Tl(e,bl),e[0]!=="!"&&Tl(e,Al)});const jm=new Date().getUTCFullYear(),yl=".",Ym=",",qi=" ",pr=" ",Er=" ",Os="'",vs="٬",Gm={".":[Ym,pr,Er,Os,vs],",":[yl,pr,Er,Os,vs],"٫":[yl,pr,Er,Os,vs]},Zi=e=>e&&e.length===1&&e>="0"&&e<="9";function Nl(e,t={}){const n=Mn(t.locale||"")||Jt,r=n.decimal,s=[...Gm[r]||[Os,vs]];!s.includes(n.group)&&n.group!==qi&&n.group!==r&&s.push(n.group);let i="",o="",a=1,l="",c=!1,u=!1,h=!1,d=!1,m=!1,_=null,E=!1,I=0;const A=[qi,pr,Er,"+","%","(","-"].concat(Bi);for(;A.includes(e[I]);){const b=e[I];if(b==="-"){if(c||u)return null;c=!0,a=-1}else if($i.test(b)){if(m)return null;m=!0,_=b}else if(b==="("){if(u||c)return null;u=!0,a=-1}else if(b==="%"){if(d)return null;d=!0}I++}let H=!1,x;if(e[I]===r||Zi(e[I]))for(;I<e.length;){const b=e[I];if(!x&&s.includes(b))x=b;else if(!(x&&x===b))if(b===r){if(H)break;i+=".",H=!0}else if(Zi(b))i+=b;else break;I++}if(e[I]==="e"||e[I]==="E"){o+=e[I],I++,(e[I]==="+"||e[I]==="-")&&(o+=e[I],I++);const b=I;for(;Zi(e[I]);)o+=e[I],I++;if(b===I)return null}const Y=[qi,pr,Er,"%","$",")"].concat(Bi);for(;Y.includes(e[I]);){const b=e[I];if($i.test(b)){if(m)return null;m=!0,_=b,E=!0}else if(b===")"){if(h||!u)return null;h=!0}else if(b==="%"){if(d)return null;d=!0}I++}if(I!==e.length)return null;let v=parseFloat(i+o);if(!isFinite(v))return null;if(o){if(d||m)return null;l="0.00E+00"}else if(d){if(m)return null;l=i.includes(".")?"0.00%":"0%",v*=.01}else if(m){const b=i.includes(".")?"#,##0.00":"#,##0";E?l=b+_:l=_+b}else x&&(l=i.includes(".")?"#,##0.00":"#,##0");const R={v:v*a};return l&&(R.z=l),R}function Vm(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){const s=e%4===0&&e%100!==0||e%400===0||e===1900?29:28;if(n>s)return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}const Ml=(e,t,n=!1)=>{for(const r of t)if(e.startsWith(r[0])){let s=r[0].length;return n&&(r[2]==="D"||r[2]==="M")&&e[s]==="."&&s++,[e.slice(0,s),r]}return["",null]},Lt=(e,t,n,r)=>{const s=n.path||"",i=Object.keys(t);for(let o=0;o<i.length;o++){let a;const l=i[o];if(t[l]){if(l==="$"||l==="€")e||(a=n);else if(l==="-"){const c=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(c){const u=c[1]==="-"||c[1]==="/"||c[1]==="."?c[1]:" ";if(!n.sep||n.sep===u){const h=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,sep:u,path:s+h},r)}}}else if(l===" "){const c=/^[,.]?\s+/.exec(e);if(c){const u=c[0].replace(/\s+/g," ");a=Lt(e.slice(c[0].length),t[l],{...n,path:s+u},r)}}else if(l==="j"||l==="d"){const c=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,day:c[0],path:s+l},r))}else if(l==="n"||l==="m"){const c=/^(0?[1-9]|1[012])\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,month:+c[0],_mon:c[0],path:s+l},r))}else if(l==="F"||l==="M"){const[c,u]=Ml(e,r.mon,r.mp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,month:u[1],_mon:c,path:s+l},r))}else if(l==="l"||l==="D"){const[c,u]=Ml(e,r.day,r.dp);u&&u[2]===l&&(a=Lt(e.slice(c.length),t[l],{...n,path:s+l},r))}else if(l==="y"){const c=/^\d\d\b/.exec(e);if(c){const u=+c[0]>=30?+c[0]+1900:+c[0]+2e3;a=Lt(e.slice(c[0].length),t[l],{...n,year:u,path:s+l},r)}}else if(l==="Y"){const c=/^\d\d\d\d\b/.exec(e);c&&(a=Lt(e.slice(c[0].length),t[l],{...n,year:+c[0],path:s+l},r))}else if(l==="x"){const c=Qi(e,{locale:r.locale});c&&(a=Lt("",t[l],{...n,time:c.v,tf:c.z,path:s+l},r))}else throw new Error(`Unknown date token "${l}"`);if(a&&Vm(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},Dl=e=>e.replace(/\s+/g," ").trim().replace(/’/,"'").replace(/\.$/,"").toLowerCase(),ws=(e,t)=>{const n=e.map((r,s)=>[Dl(r),s+1,t]);return n.sort((r,s)=>s[0].length-r[0].length),n};function Ll(e,t={}){var i;const n=Mn(t.locale||"")||Jt,r={mon:ws(n.mmmm,"F").concat(ws(n.mmm,"M")),mp:n.mmm[0].at(-1)===".",day:ws(n.dddd,"l").concat(ws(n.ddd,"D")),dp:n.ddd[0].at(-1)===".",locale:t.locale},s=Lt(Dl(e),n.preferMDY?Al:bl,{path:""},r);if(s){if(s.sep==="."&&s.path.length===3)return null;const o=+((i=s.year)!=null?i:jm);s.day||(s.day=1);let a=-1/0;if(o<1900)return null;o<=1900&&s.month<=2?a=25568:o<1e4&&(a=25569);const l=Date.UTC(o,s.month-1,s.day)/864e5+a+(s.time||0);if(l>=0&&l<=2958465){const c=s._mon[0]==="0"||s.day[0]==="0"||s._mon.length===2&&s.day.length===2,u=s.path.replace(/[jdlDnmMFyYx]/g,h=>h==="x"?s.tf||"":(c?Wm[h]:Hm[h])||h);return{v:l,z:u}}}return null}const Ji=e=>e.replace(/\s+/g,"").trim().replace(/\./g,"").toLowerCase();function Qi(e,t={}){const n=Mn(t.locale||"")||Jt,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e);let s="";if(r){const i=Ji(e.slice(r[0].length));if(i===Ji(n.ampm[0])||i==="a"||i==="am")s="a";else if(i===Ji(n.ampm[1])||i==="p"||i==="pm")s="p";else if(i)return null}if(r){const[,i,o,a,l]=r;if(l&&!a||!s&&!o&&!a)return null;let c=+(i||0)*1;if(s){if(c>=13)return null;s==="p"&&(c+=12)}const u=+(o||0)*1,h=+(a||0)*1,d=+(l||0)*1;return{v:(c*60*60+u*60+h+d)/(60*60*24),z:(i.length===2?"hh":"h")+":mm"+(a?":ss":"")+(s?" AM/PM":"")}}return null}function Ul(e,t={}){const n=Mn(t.locale||"")||Jt,r=e.trim().toLowerCase(),s=n.bool[0].toLowerCase();if(r==="true"||r===s)return{v:!0};const i=n.bool[1].toLowerCase();return r==="false"||r===i?{v:!1}:null}function zm(e,t){var n,r,s;return(s=(r=(n=Nl(e,t))!=null?n:Ll(e,t))!=null?r:Qi(e,t))!=null?s:Ul(e,t)}function fn(e,t,n){return t[n+"_max"]=e.length,t[n+"_min"]=e.replace(/#/g,"").length,t}function Ge(e,t){typeof e=="string"?t.push({type:"string",value:e}):t.push(e)}function Pl(e,t){const n=e&&e.type;return n===gi||n===yn||n===_i||n===Rs&&t==="den"}function Cr(e){var x,Y,v;const t=[],n={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:gl,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t};let r="int",s=null;const i=[];let o,a=!1,l=-1,c=!1,u="",h=!1;for(;++l<e.length&&!c;){const R=e[l],b=R.type||_r;if(u+=R.raw,b===mi)n.general=!0,Ge(R,t);else if(Pl(R,r)){const y=n[r+"_pattern"];Pl(o,r)||(o==null?void 0:o.type)===gr?(y.push((y.pop()||"")+R.value),s.num+=R.value):(y.push(R.value),s={type:r,num:R.value},Ge(s,t))}else if(b===xi)R.value==="("&&(n.parens=!0),Ge(R.value,t);else if(b===Rs)Ge(R.value,t);else if(b===pi)if(h=!0,n[r+"_pattern"].length){if(!s)throw new SyntaxError("Format pattern is missing a numerator");n.fractions=!0,n.num_pattern.push(n[r+"_pattern"].pop()),s.type="num",r="den",Ge({type:"div"},t)}else Ge(R.value,t);else if(b===Ei)Ge(",",t);else if(b===ps)n.scale=.001**R.raw.length;else if(b===gr){if(r==="int"&&(n.grouping=!0),r==="den")throw new SyntaxError("Cannot group denominator digits")}else if(b===Si)Ge(R,t);else if(b===Ci){c=!0;break}else if(b===Es)n.text=!0,Ge(R,t);else if(b===Ri||b===Ii)Ge(R,t);else if(b===bi){const y=R.value.toLowerCase(),B=y[0],$={type:"",size:0,date:1,pad:y.length};B==="h"?($.size=dr,$.type="hour-elap"):B==="m"?($.size=fr,$.type="min-elap"):($.size=mr,$.type="sec-elap"),n.date=n.date|$.size,i.push($),Ge($,t)}else if(n.date&&b===Cs&&((x=e[l+1])==null?void 0:x.type)===yn){let y=1;l++;let B="0";((Y=e[l+1])==null?void 0:Y.type)===yn&&(B+="0",y=2,l++),((v=e[l+1])==null?void 0:v.type)===yn&&(B+="0",y=3,l++),u+=B;const $=[mr,hi,di,fi][y];n.date=n.date|$,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,y),Ge({type:"subsec",size:$,decimals:y,date:1},t)}else if(b===vi)a||(R.value==="B2"||R.value==="b2"?n.date_system=Tn:n.date_system=gl);else if(b===wi){const y={type:"",size:0,date:1},B=R.value.toLowerCase(),$=B[0];if(B==="y"||B==="yy")y.size=ur,y.type="year-short";else if($==="y"||$==="e")y.size=ur,y.type="year";else if(B==="b"||B==="bb")y.size=ur,y.type="b-year-short";else if($==="b")y.size=ur,y.type="b-year";else if(B==="d"||B==="dd")y.size=_s,y.type="day",y.pad=/dd/.test(B);else if(B==="ddd"||B==="aaa")y.size=_s,y.type="weekday-short";else if($==="d"||$==="a")y.size=_s,y.type="weekday";else if($==="h")y.size=dr,y.type="hour",y.pad=/hh/i.test(B);else if($==="m"){B.length===3?(y.size=hr,y.type="monthname-short"):B.length===5?(y.size=hr,y.type="monthname-single"):B.length>=4&&(y.size=hr,y.type="monthname");const g=i[i.length-1];!y.type&&g&&!g.used&&g.size&(dr|mr)&&(g.used=!0,y.size=fr,y.type="min",y.pad=/mm/.test(B)),y.type||(y.size=hr,y.type="month",y.pad=/mm/.test(B),y.indeterminate=!0)}else if($==="s"){y.size=mr,y.type="sec",y.pad=/ss/.test(B);const g=i[i.length-1];g&&g.size&fr?y.used=!0:g&&g.indeterminate&&(delete g.indeterminate,g.size=fr,g.type="min",y.used=!0)}n.date=n.date|y.size,n.date_eval=!0,i.push(y),Ge(y,t)}else if(b===Di)n.clock=12,n.date=n.date|dr,n.date_eval=!0,R.short=R.value==="A/P",Ge(R,t);else if(b===Ui||b===Li||b===Is)Ge(R.value,t);else if(b===Ai)n.condition=[R.value[0],parseFloat(R.value[1])];else if(b===Ni){const y=R.value.split("-"),B=y.length<2?"":y.slice(1).join("-"),$=y[0];$&&Ge($,t);const g=ji(B);g&&(n.locale=g);const P=parseInt(B,16);isFinite(P)&&P&16711680&&(P>>16&255)===6&&(n.date_system=Tn),a=!0}else if(b===Mi){let y,B=R.value.toLowerCase();(y=/^color\s*(\d+)$/i.exec(B))&&(B=parseInt(y[1],10)),n.color=B}else if(b===Oi)n.scale=100,n.percent=!0,Ge("%",t);else if(b===Cs)Ge(R,t),n.date||(n.dec_fractions=!0,r="frac");else if(b===ki)n.exponential=!0,n.exp_plus=R.value.includes("+"),r="man",Ge({type:"exp",plus:n.exp_plus},t);else if(b===Pi)Ge(R,t);else if(b===Fi)Ge(R,t);else if(!(b===Ti||b===yi))throw b===_r?new SyntaxError(`Illegal character: ${u}`):new SyntaxError(`Unknown token ${b} in ${u}`);o=R}if(n.tokensUsed=l,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&Ge({type:"text"},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||h&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw new SyntaxError(`Invalid pattern: ${u}`);const d=n.int_pattern.join(""),m=n.man_pattern.join(""),_=n.frac_pattern.join("");fn(d,n,"int");let E=0;for(let R=0;R<d.length;R++){const b=d[d.length-1-R];/^[0-9?]/.test(b)&&(E=R+1)}n.int_min=E,fn(_,n,"frac"),fn(m,n,"man");let I=n.num_pattern.join(""),A=n.den_pattern[0]||"";if(A.includes("?")||I.includes("?")?(A=A.replace(/\d/g,"?"),A=A.replace(/#$/g,"?"),fn(I,n,"num"),fn(A,n,"den"),I=I.replace(/#$/g,"?")):(fn(I,n,"num"),fn(A,n,"den")),n.int_p=d,n.man_p=m,n.num_p=I,n.den_p=A,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join("").replace(/\D/g,""),10)),n.integer=!!d.length,!n.integer&&!n.exponential&&_.length){const R=n.tokens.findIndex(b=>b.type==="point");n.tokens.splice(R,0,{type:"int",value:"#"}),n.integer=!0,n.int_pattern=["#"],n.int_p="#"}if(n.fractions)for(let R=0;R<t.length-1;R++){const b=t[R];if(b.type!=="string"&&b.type!=="space")continue;const y=t[R+1].type;y==="num"?b.rule="num+int":y==="div"?b.rule="num":y==="den"&&(b.rule="den")}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Km(e){if(e===0)return e;const t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}const Xm={total:1,sign:0,period:0,int:1,frac:0};function qm(e,t=!0){const n=Math.abs(e);if(!n)return Xm;const r=t&&e<0?1:0,s=Math.floor(n),i=Math.floor(Math.log10(n)+1);let o=0,a=0;if(s!==n){o=1;const l=String(_t(n*10**-i,15));let c=l.length,u=!0,h=0;for(;h<=l.length;){if(l[h]==="."){c--;break}else l[h]==="0"&&u?c--:u=!1;h++}a=c-i,a<0&&(a=0,o=0)}return{total:r+Math.max(i,1)+o+a,digits:Math.max(i,0)+a,sign:r,period:o,int:Math.max(i,1),frac:a}}const Dn=(e,t)=>e.replace(/\./,t.decimal),kl=(e,t,n)=>{const r=Math.abs(t);let s;return e===1?s=e:s=_t(e,5),[Dn(s+"",n),n.exponent,t<0?n.negative:n.positive,r<10?"0":"",r]};function Fl(e,t,n,r){const s=n|0;if(typeof n=="string")e.push(n);else if(n===s)e.push(Math.abs(s));else{const i=Math.abs(n);let o=i?Math.floor(Math.log10(i)):0,a=i*10**-o;a===10&&(a=1,o++);const l=qm(i);if(o>=-4&&o<=-1){const c=i.toPrecision(10+o).replace(/\.?0+$/,"");e.push(Dn(c,r))}else if(o===10){const c=i.toFixed(10).slice(0,12).replace(/\.$/,"");e.push(Dn(c,r))}else if(Math.abs(o)<=9)if(l.total<=11){const c=_t(i,9).toFixed(l.frac);e.push(Dn(c,r))}else o===9?e.push(Math.floor(i)):o>=0&&o<9?e.push(Dn(String(_t(i,9-o)),r)):e.push(...kl(a,o,r));else l.total>=12?e.push(...kl(a,o,r)):e.push(Dn(_t(i,9).toFixed(l.frac),r))}return e}function mn(e,t=!1){return e==="0"?"0":e==="?"?t?" ":" ":""}const Rr=86400,xl=(e,t=0)=>{const n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n},Zm=(e,t,n)=>n?e<Nm||t>=Mm:e<Tm||t>=ym;function Bl(e,t,n,r){var T,w;let s="",i="",o="",a="",l="",c="",u=0,h=0;if(typeof e=="bigint"){if(e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER)e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;h=e}else h=Math.trunc(e);let d=0,m=0,_=1,E=0,I=0,A=0,H=0,x=0,Y=0;const v=r||Jt;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=Km(e*t.scale)),t.exponential){let N=Math.abs(e);if(N){const D=10**-xl(N,t.int_max),L=_t(N*D,t.frac_max)/D;u=xl(L,t.int_max)}e&&!t.integer&&u++,N=N*10**-u,e=e<0?-N:N,s+=Math.abs(u)}if(t.integer){const N=Math.abs(_t(e,t.fractions?1:t.frac_max));c+=N<1?"":Math.floor(N)}const R=(T=n.grouping[0])!=null?T:3,b=(w=n.grouping[1])!=null?w:R;t.dec_fractions&&(l=String(_t(e,t.frac_max)).split(".")[1]||"");const y=!t.error&&(t.num_p.includes("0")||t.den_p.includes("0"));let B=y;if(t.fractions){B=y||!!(e%1);const N=Math.abs(t.integer?e%1:e);if(N)if(B=!0,t.denominator&&isFinite(t.denominator))a+=t.denominator,o+=_t(N*t.denominator),o==="0"&&(o="",a="",B=y);else{const D=Ol(N,1/0,t.den_max);o+=D[0],a+=D[1],t.integer&&o==="0"&&(o="",a="",B=y)}else!e&&!t.integer&&(B=!0,o="0",a="1");t.integer&&!B&&!Math.trunc(e)&&(c="0")}if(t.date){h=Math.trunc(e);const N=Rr*(e-h);if(d=Math.floor(N),Y=N-d,Math.abs(Y)<1e-6?Y=0:Y>.9999&&(Y=0,d+=1,d===Rr&&(d=0,h+=1)),Y){const D=t.date&fi||t.date&di||t.date&hi;(D===fi&&Y>.9995||D===di&&Y>.995||D===hi&&Y>.95||!D&&Y>=.5)&&(d++,Y=0)}if(h||t.date_system){const D=wl(e,t.date_system,n.leap1900);m=D[0],_=D[1],E=D[2]}if(d){const D=d<0?Rr+d:d;x=Math.floor(D)%60,H=Math.floor(D/60)%60,A=Math.floor(D/60/60)%60}if(I=(6+h)%7,t.date_eval&&Zm(e,h+d/Rr,n.dateSpanLarge)){if(n.dateErrorThrows)throw new Error("Date out of bounds");if(n.dateErrorNumber){const D=e<0?[v.negative]:[];return Fl(D,{},e,v).join("")}return n.overflow}}const $=mn("?",n.nbsp);u<0?i="-":t.exp_plus&&(i="+");const g=[],P=(N,D,L,F)=>{const Q=!F&&N.length>D.length?L.length+N.length-D.length:L.length;N.length<D.length&&(F+=N.length-D.length);for(let z=0;z<Q;z++)g.push(N[z+F]||mn(L[z],n.nbsp));return Q};let O=!1;const M={int:0,frac:0,man:0,num:0,den:0};for(let N=0,D=t.tokens.length;N<D;N++){const L=t.tokens[N],F=L.type,Q=L.num?L.num.length:0;if(F==="string")L.rule?L.rule==="num"?B?g.push(L.value.replace(/ /g,$)):(t.num_min>0||t.den_min>0)&&g.push(L.value.replace(/./g,$)):L.rule==="num+int"?B&&c?g.push(L.value.replace(/ /g,$)):t.den_min>0&&(c||t.num_min)&&g.push(L.value.replace(/./g,$)):L.rule==="den"&&(B?g.push(L.value.replace(/ /g,$)):(t.den_min>0||t.den_min>0)&&g.push(L.value.replace(/./g,$))):g.push(L.value.replace(/ /g,$));else if(F==="space")L.rule==="num+int"?(B||t.num_min||t.den_min)&&(c||t.num_min)&&g.push($):g.push($);else if(F==="error")g.push(n.invalid);else if(F==="point")g.push(t.date?L.value:v.decimal);else if(F==="general")Fl(g,t,e,v);else if(F==="exp")g.push(v.exponent);else if(F==="minus")L.volatile&&t.date||L.volatile&&(e>=0||typeof e!="number")||(L.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&c&&c!=="0"||l)&&g.push(v.negative):g.push(v.negative));else if(F==="plus")g.push(v.positive);else if(F==="text")g.push(e);else if(F==="fill")n.fillChar&&g.push(n.fillChar,L.value);else if(F==="skip")n.skipChar?g.push(n.skipChar,L.value):g.push(n.nbsp?" ":" ");else if(F==="div")B?g.push("/"):t.num_min>0||t.den_min>0?g.push($):g.push(mn("#",n.nbsp));else if(F==="int")if(t.int_pattern.length===1){const z=t.int_p,le=Math.max(t.int_min,c.length);let ue="";for(let S=le;S>0;S--){const U=c.charAt(c.length-S),G=U?"":z.charAt(z.length-S)||z[0];let V="";if(t.grouping){const W=S-1-R;W>=0&&!(W%b)&&(V=U||G==="0"?v.group:mn("?",n.nbsp))}ue+=(U||mn(G,n.nbsp))+V}g.push(ue)}else M.int+=P(c,t.int_p,L.num,M.int);else if(F==="frac"){const z=M.frac;for(let le=0;le<Q;le++)g.push(l[le+z]||mn(L.num[le],n.nbsp));M.frac+=Q}else if(F==="man")!M[F]&&!M.man&&g.push(i),M.man+=P(s,t.man_p,L.num,M.man);else if(F==="num")M.num+=P(o,t.num_p,L.num,M.num);else if(F==="den"){const z=M.den;for(let le=0;le<Q;le++){let ue=a[le+z];if(!ue){const S=L.num[le];"123456789".includes(S)||O&&S==="0"?(O=!0,ue=n.nbsp?" ":" "):!O&&le===Q-1&&S==="0"&&!a?ue="1":ue=mn(S,n.nbsp)}g.push(ue)}M.den+=Q}else if(F==="year")m<0&&g.push(v.negative),g.push(String(Math.abs(m)).padStart(4,"0"));else if(F==="year-short"){const z=m%100;g.push(z<10?"0":"",z)}else if(F==="month")g.push(L.pad&&_<10?"0":"",_);else if(F==="monthname-single")t.date_system===Tn?g.push(v.mmmm6[_-1].charAt(0)):g.push(v.mmmm[_-1].charAt(0));else if(F==="monthname-short")t.date_system===Tn?g.push(v.mmm6[_-1]):g.push(v.mmm[_-1]);else if(F==="monthname")t.date_system===Tn?g.push(v.mmmm6[_-1]):g.push(v.mmmm[_-1]);else if(L.type==="weekday-short")g.push(v.ddd[I]);else if(F==="weekday")g.push(v.dddd[I]);else if(F==="day")g.push(L.pad&&E<10?"0":"",E);else if(F==="hour"){const z=A%t.clock||(t.clock<24?t.clock:0);g.push(L.pad&&z<10?"0":"",z)}else if(F==="min")g.push(L.pad&&H<10?"0":"",H);else if(F==="sec")g.push(L.pad&&x<10?"0":"",x);else if(F==="subsec"){g.push(v.decimal);const z=Y.toFixed(t.sec_decimals);g.push(z.slice(2,2+L.decimals))}else if(F==="ampm"){const z=A<12?0:1;L.short&&!r?g.push("AP"[z]):g.push(v.ampm[z])}else if(F==="hour-elap"){e<0&&g.push(v.negative);const z=h*24+Math.floor(Math.abs(d)/(60*60));g.push(String(Math.abs(z)).padStart(L.pad,"0"))}else if(F==="min-elap"){e<0&&g.push(v.negative);const z=h*1440+Math.floor(Math.abs(d)/60);g.push(String(Math.abs(z)).padStart(L.pad,"0"))}else if(F==="sec-elap"){e<0&&g.push(v.negative);const z=h*Rr+Math.abs(d);g.push(String(Math.abs(z)).padStart(L.pad,"0"))}else if(F==="b-year")g.push(m+543);else if(F==="b-year-short"){const z=(m+543)%100;g.push(z<10?"0":"",z)}}return g.join("")}const Jm=Cr([{type:Es,value:"@",raw:"@"}]);function $l(e,t){for(let n=0;n<3;n++){const r=t[n];if(r){let s;if(r.condition){const i=r.condition[0],o=r.condition[1];i==="="?s=e===o:i===">"?s=e>o:i==="<"?s=e<o:i===">="?s=e>=o:i==="<="?s=e<=o:i==="<>"&&(s=e!==o)}else s=!0;if(s)return r}}}function Qm(e,t,n){const r=t.partitions;let s=r[3],i=null;return(typeof e=="number"||typeof e=="bigint")&&isFinite(e)&&(s=$l(e,r)),s&&s.color&&(i=s.color),i&&typeof i=="number"&&n.indexColors&&(i=Lm[i-1]||"#000"),i}function eg(e,t,n){const r=t.partitions,s=Mn(t.locale||n.locale),i=r[3]?r[3]:Jm;if(typeof e=="boolean"&&(e=(s||Jt).bool[e?0:1]),e==null)return"";const o=typeof e=="bigint";if(typeof e!="number"&&!o)return Bl(e,i,n,s);if(!o&&!isFinite(e)){const l=s||Jt;return isNaN(e)?l.nan:(e<0?l.negative:"")+l.infinity}const a=$l(e,r);return a?Bl(e,a,n,s):n.overflow}function Hl(e){return!!(e[0]&&e[0].percent||e[1]&&e[1].percent||e[2]&&e[2].percent||e[3]&&e[3].percent)}function Wl(e){return!!(e[0]&&e[0].date||e[1]&&e[1].date||e[2]&&e[2].date||e[3]&&e[3].date)}function jl(e){const[t,n,r,s]=e;return!!((!t||t.generated)&&(!n||n.generated)&&(!r||r.generated)&&s&&s.text&&!s.generated)}const tg={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},ng=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]];function rg(e,t=null){var h;const[n,r]=e,s=n.frac_max,i={type:"general",isDate:Wl(e),isText:jl(e),isPercent:Hl(e),maxDecimals:n.general?9:s,scale:(h=n.scale)!=null?h:1,color:0,parentheses:0,grouped:n.grouping?1:0},o=!i.isDate&&!i.isText&&!n.error&&n.tokens.some(d=>d.type==="string"&&(t?d.value===t:$i.test(d.value)));let a="G",l=s>=0?Math.min(15,s):"",c="",u="";if(r&&r.color&&(u="-",i.color=1),n.parens&&(c="()",i.parentheses=1),o)a="C",i.type="currency";else if(n.error)i.type="error",i.maxDecimals=0;else if(i.isDate){let d=0,m=0,_="";n.tokens.forEach(I=>{const A=I.type;/^(b-)?year/.test(A)?(_+="Y",m++):A.startsWith("month")?(_+="M",m++):/^(week)?day/.test(A)?(_+="D",m++):(A==="hour"||A==="min"||A==="sec"||A==="ampm")&&(_+=A[0],d++)}),i.type="date",m&&d?i.type="datetime":!m&&d&&(i.type="time");const E=ng.find(I=>_.startsWith(I[0]));a=E?"D":"G",l=E?E[1]:""}else i.isText?(a="G",i.type="text",l="",i.maxDecimals=0):n.general?(a="G",i.type="general",l=""):n.fractions?(a="G",i.type="fraction",l=""):n.exponential?(a="S",i.type="scientific"):i.isPercent?(a="P",i.type="percent"):n.grouping?(a=",",i.type="grouped"):(n.int_max||s)&&(a="F",i.type="number");return i.code=a+l+u+c,i.level=tg[i.type],Object.freeze(i)}function sg(e){const[t]=e;return{year:!!(t.date&ur),month:!!(t.date&hr),day:!!(t.date&_s),hours:!!(t.date&dr),minutes:!!(t.date&fr),seconds:!!(t.date&mr),clockType:t.clock===12?12:24}}const ig=[[mi,/^General/i,0],[gi,/^#/,0],[yn,/^0/,0],[_i,/^\?/,0],[pi,/^\//,0],[Ci,/^;/,0],[Es,/^@/,0],[Ri,/^\+/,0],[Ii,/^-/,0],[Cs,/^\./,0],[Si,/^ /,0],[Oi,/^%/,0],[Rs,/^[1-9]/,0],[vi,/^(?:B[12])/i,0],[_r,/^B$/,0],[wi,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[bi,/^(?:\[(h+|m+|s+)\])/i,1],[Ai,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[Ti,/^\[(DBNum[0-4]?\d)\]/i,1],[yi,/^\[(NatNum[0-4]?\d)\]/i,1],[Ni,/^\[\$([^\]]+)\]/,1],[Mi,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[_l,/^\[([^\]]+)\]/,1],[Di,/^(?:AM\/PM|am\/pm|A\/P)/,0],[Li,/^\\(.)/,1],[Ui,/^"([^"]*?)"/,1],[Pi,/^_(\\.|.)/,1],[ki,/^[Ee]([+-])/,1],[Fi,/^\*(\\.|.)/,1],[xi,/^[()]/,0],[_r,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Is,/^./,0]],og=63,ag=35,lg=48,cg=57,eo=e=>{const t=(e||"\0").charCodeAt(0);return t===og||t===ag||t>=lg&&t<=cg};function Ln(e){let t=0;const n=[],r=[];for(;t<e.length;){const s=e.slice(t);let i=0;const o=/^(,+)(.)?/.exec(s);if(o){const a=o[1];i=a.length;const l=e[t-1]||"";let c=!1,u=!1;eo(l)?(c=!0,u=!0):l==="."&&(u=!0);const h=o[2]||"";if(c&&(!h||h===";")&&(c=!1),u&&eo(h)&&(u=!1),c&&!u)n.push({type:gr,value:",",raw:a});else if(!c&&u)n.push({type:ps,value:",",raw:a});else if(c&&u){const d={type:ps,value:",",raw:a};n.push(d),r.push(d)}else n.push({type:Ei,value:",",raw:a})}else{let a;for(const[l,c,u]of ig){const h=c.exec(s);if(h){const d=Array.isArray(u)?u.map(m=>h[m]):h[u||0];a={type:l,value:d,raw:h[0]},n.push(a),i=h[0].length;break}}r.length&&a.raw===";"&&(r.length=0),r.length&&eo(a.raw)&&(r.forEach(l=>l.type=gr),r.length=0)}if(!i){const a=s[0];i=1,n.push({type:Is,value:a,raw:a})}t+=i}return n}const to=e=>{const t=e.condition;t&&t[1]<0&&(t[0]==="<"||t[0]==="<="||t[0]==="=")||e.tokens.unshift({type:"minus",volatile:!0})},Yl=(e,t=null)=>{const n={};for(const r in e)Array.isArray(e[r])?n[r]=[...e[r]]:n[r]=e[r];return t&&n.tokens.unshift(t),n.generated=!0,n};function ug(e){var h;const t=[];let n=!1,r,s=null,i=0,o=!1,a=0,l=0,c=Ln(e);do{if(o=Cr(c),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw new Error("Illegal format");if(o.condition&&(l++,n=!0),o.text){if(s)throw new Error("Unexpected partition");s=o}o.locale&&(r=ji(o.locale)),t.push(o),i=((h=c[o.tokensUsed])==null?void 0:h.type)==="break"?1:0,c=c.slice(o.tokensUsed+i),a++}while(i&&a<4&&l<3);if(i)throw new Error("Unexpected partition");if(l>2)throw new Error("Unexpected condition");const u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw new Error("Unexpected partition");if(n){const d=t.length;if(d===1&&(t[1]=Cr(Ln("General")),t[1].generated=!0),d<3){const m=t[0],_=t[1];if(to(m),_.condition)to(_);else{const E=m.condition;(E[0]==="="||E[1]>=0&&(E[0]===">"||E[0]===">="))&&_.tokens.unshift({type:"minus",volatile:!0})}}else t.forEach(to)}else{if(t.length<4&&s)for(let d=0,m=t.length;d<m;d++)t[d]===s&&t.splice(d,1);if(t.length<1&&s&&(t[0]=Cr(Ln("General")),t[0].generated=!0),t.length<2){const d={type:"minus",volatile:!0};t.push(Yl(t[0],d))}if(t.length<3&&t.push(Yl(t[0])),t.length<4)if(s)t.push(s);else{const d=Cr(Ln("@"));d.generated=!0,t.push(d)}t[0].condition=[">",0],t[1].condition=["<",0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}const Gl=Object.create({});function Qt(e,t=!1){e||(e="General");let n=Gl[e];if(!n)try{n=ug(e),Gl[e]=n}catch(r){if(t)throw r;const s={tokens:[{type:"error"}],error:r.message};n={pattern:e,partitions:[s,s,s,s],error:r.message,locale:null}}return n}function hg(e,t,n={}){var o;const r=Object.assign({},Sl,n),s=Qt(e,r.throws),i=(o=Xi(t,r))!=null?o:t;return eg(i,s,r)}function dg(e,t,n){var o;const r=Object.assign({},Sl,n),s=Qt(e,r.throws),i=(o=Xi(t,r))!=null?o:t;return Qm(i,s,r)}function fg(e){const t=Qt(e,!1);return Wl(t.partitions)}function mg(e){const t=Qt(e,!1);return Hl(t.partitions)}function gg(e){const t=Qt(e,!1);return jl(t.partitions)}function _g(e){try{return Qt(e,!0),!0}catch{return!1}}function pg(e,t={}){const n=Qt(e,!1);return n.info||(n.info=rg(n.partitions,t==null?void 0:t.currency)),n.info}function Eg(e){const t=Qt(e,!1);return t.dateInfo||(t.dateInfo=sg(t.partitions)),t.dateInfo}const Un=Object.freeze({AMPM:Di,BREAK:Ci,CALENDAR:vi,CHAR:Is,COLOR:Mi,COMMA:Ei,CONDITION:Ai,DATETIME:wi,DBNUM:Ti,DIGIT:Rs,DURATION:bi,ERROR:_r,ESCAPED:Li,EXP:ki,FILL:Fi,GENERAL:mi,GROUP:gr,HASH:gi,LOCALE:Ni,MINUS:Ii,MODIFIER:_l,NATNUM:yi,PAREN:xi,PERCENT:Oi,PLUS:Ri,POINT:Cs,QMARK:_i,SCALE:ps,SKIP:Pi,SLASH:pi,SPACE:Si,STRING:Ui,TEXT:Es,ZERO:yn}),Cg=Object.freeze(Object.defineProperty({__proto__:null,addLocale:ne,dateFromSerial:Bm,dateToSerial:Xi,dec2frac:Ol,format:hg,formatColor:dg,getFormatDateInfo:Eg,getFormatInfo:pg,getLocale:Mn,isDateFormat:fg,isPercentFormat:mg,isTextFormat:gg,isValidFormat:_g,parseBool:Ul,parseDate:Ll,parseLocale:Wi,parseNumber:Nl,parseTime:Qi,parseValue:zm,round:_t,tokenTypes:Un,tokenize:Ln},Symbol.toStringTag,{value:"Module"})),Rg=(e,t)=>{if(e&&!t||!e&&t)return!1;const n=i=>{const o=Ln(i);let a="",l=!1,c=!1;for(const u of o){if(u.type===Un.POINT){l=!0;continue}if(!(c&&u.type===Un.MINUS)&&u.type!==Un.SKIP){if(u.type===Un.COLOR){c=!0;continue}else c=!1;l&&u.type===Un.ZERO||(l=!1,l||(a+=u.value||""))}}return a},r=n(e),s=n(t);return r===s},Ir="__INTERNAL_EDITOR__",no=`${Ir}DOCS_NORMAL`,ro=`${Ir}DOCS_FORMULA_BAR`,Vl=`${Ir}ZEN_EDITOR`,zl=`\r
|
|
2
|
+
`,Kl="isRowStylePrecedeColumnStyle",Xl=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Ig(e){return`${Ir}${e}`}function ql(e){return e.startsWith(Ir)}var Zl=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Zl||{}),Jl=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Jl||{}),fe=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(fe||{}),Sr=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Sr||{}),en=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(en||{}),gn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(gn||{}),Ql=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Ql||{}),so=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(so||{}),ec=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(ec||{}),tc=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(tc||{}),nc=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(nc||{}),rc=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(rc||{}),sc=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(sc||{}),ic=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(ic||{}),oc=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(oc||{}),qe=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(qe||{}),ac=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(ac||{}),lc=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(lc||{}),cc=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(cc||{}),uc=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(uc||{}),hc=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(hc||{}),dc=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(dc||{}),fc=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(fc||{}),mc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(mc||{}),gc=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(gc||{}),Pn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Pn||{}),_c=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(_c||{}),pc=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(pc||{}),Ec=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Ec||{}),Cc=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(Cc||{}),Rc=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(Rc||{}),Ic=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(Ic||{}),Sc=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(Sc||{}),ht=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(ht||{});const Sg=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var Oc=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(Oc||{}),vc=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(vc||{}),io=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(io||{}),wc=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(wc||{}),bc=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(bc||{});const Og={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},vg={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},wg={startRow:0,startColumn:0,endRow:0,endColumn:0},bg={row:0,column:0},rt={ff:"Arial",fs:11,it:ae.FALSE,bl:ae.FALSE,ul:{s:ae.FALSE},st:{s:ae.FALSE},ol:{s:ae.FALSE},tr:{a:0,v:ae.FALSE},td:ar.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:St.UNSPECIFIED,vt:un.UNSPECIFIED,tb:hn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},Ac={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Ag=[no,Vl,ro],Tg={[qe.HEADING_1]:{fs:20,bl:1},[qe.HEADING_2]:{fs:18,bl:1},[qe.HEADING_3]:{fs:16,bl:1},[qe.HEADING_4]:{fs:14,bl:1},[qe.HEADING_5]:{fs:12,bl:1},[qe.NORMAL_TEXT]:null,[qe.TITLE]:{fs:26,bl:1},[qe.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},kn=4,yg={[qe.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+kn}},[qe.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+kn}},[qe.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+kn}},[qe.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+kn}},[qe.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+kn}},[qe.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[qe.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+kn}},[qe.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},Ng="univer-sheets-chart-print-chart",Mg="univer-docs-drawing-printing";var Tc=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(Tc||{});const Dg={[ht.A3]:{width:1123,height:1587},[ht.A4]:{width:794,height:1124},[ht.A5]:{width:559,height:794},[ht.B4]:{width:944,height:1344},[ht.B5]:{width:665,height:944},[ht.Executive]:{width:696,height:1008},[ht.Folio]:{width:816,height:1248},[ht.Legal]:{width:816,height:1344},[ht.Letter]:{width:816,height:1056},[ht.Statement]:{width:528,height:816},[ht.Tabloid]:{width:1056,height:1632}};function bs(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ae.FALSE;switch(e){case"bl":case"it":{if(o[e]===ae.FALSE)return ae.FALSE;break}case"ul":case"st":{if(o[e].s===ae.FALSE)return ae.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
|
|
3
|
+
`)===r?ae.TRUE:ae.FALSE}const Gr=class Gr{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new lt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new lt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=K.numToWord(r+1)+(t+1),o=K.numToWord(s+1)+(n+1)):(i=K.numToWord(s+1)+(n+1),o=K.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||rt.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Gr(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let c=0;c<=r-n;c++)for(let u=0;u<=i-s;u++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[u])==null)continue;const h=o[c][u].s;h&&(o[c][u].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||rt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?bs("ul",t.body)===ae.TRUE?{s:ae.TRUE}:{s:ae.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?bs("st",t.body)===ae.TRUE?{s:ae.TRUE}:{s:ae.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.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 n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?bs("it",t.body)===ae.TRUE?Zr.ITALIC:Zr.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?bs("bl",t.body)===ae.TRUE?Jr.BOLD:Jr.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.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:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.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 t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===hn.WRAP?ae.TRUE:ae.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Gr.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||rt[t]}))}};C(Gr,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===pe.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===pe.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===pe.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let Fn=Gr;function yc(e,t,n=0,r=e.length-1,s=Lg){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1),m=Math.max(n,Math.floor(t-c*h/l+d)),_=Math.min(r,Math.floor(t+(l-c)*h/l+d));yc(e,t,m,_,s)}const i=e[t];let o=n,a=r;for(Or(e,n,t),s(e[r],i)>0&&Or(e,n,r);o<a;){for(Or(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Or(e,n,a):(a++,Or(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Or(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Lg(e,t){return e<t?-1:e>t?1:0}class As{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!ys(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;ys(t,l)&&(n.leaf?r.push(a):ao(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!ys(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(ys(t,o)){if(n.leaf||ao(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Bn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),c=!0),r.leaf){const u=Ug(t,r.children,n);if(u!==-1)return r.children.splice(u,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&ao(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],c=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=Bn(t.slice(n,r+1)),xn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Bn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));Nc(t,n,r,c,this.compareMinX);for(let u=n;u<=r;u+=c){const h=Math.min(u+c-1,r);Nc(t,u,h,l,this.compareMinY);for(let d=u;d<=h;d+=l){const m=Math.min(d+l-1,h);a.children.push(this._build(t,d,m,s-1))}}return xn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const c=n.children[l],u=oo(c),h=Fg(t,c)-u;h<o?(o=h,i=u<i?u:i,a=c):h===o&&u<i&&(i=u,a=c)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),wr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=Bn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,xn(r,this.toBBox),xn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Bn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,xn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=vr(t,0,a,this.toBBox),c=vr(t,a,r,this.toBBox),u=xg(l,c),h=oo(l)+oo(c);u<i?(i=u,s=a,o=h<o?h:o):u===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Pg,i=t.leaf?this.compareMinY:kg,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=vr(t,0,n,i),a=vr(t,r-n,r,i);let l=Ts(o)+Ts(a);for(let c=n;c<r-n;c++){const u=t.children[c];wr(o,t.leaf?i(u):u),l+=Ts(o)}for(let c=r-n-1;c>=n;c--){const u=t.children[c];wr(a,t.leaf?i(u):u),l+=Ts(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)wr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():xn(t[n],this.toBBox)}}function Ug(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function xn(e,t){vr(e,0,e.children.length,t,e)}function vr(e,t,n,r,s){s||(s=Bn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];wr(s,e.leaf?r(o):o)}return s}function wr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Pg(e,t){return e.minX-t.minX}function kg(e,t){return e.minY-t.minY}function oo(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Ts(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Fg(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function xg(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function ao(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function ys(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Bn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Nc(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;yc(e,o,t,n,s),i.push(t,o,o,n)}}function Bg(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||Ye.NONE,o=s.endAbsoluteRefType||Ye.NONE,a=s.rangeType||pe.NORMAL;if(!r&&i===Ye.ALL&&o===Ye.ALL)return s;const l=Mc(s.startRow,n,s.startColumn,t,a),c=Mc(s.endRow,n,s.endColumn,t,a);return r||i===Ye.NONE&&o===Ye.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===Ye.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===Ye.COLUMN?s={...s,startRow:l.row}:i===Ye.ROW&&(s={...s,startColumn:l.column}),o===Ye.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===Ye.COLUMN?s={...s,endRow:c.row}:o===Ye.ROW&&(s={...s,endColumn:c.column}),s)}function Mc(e,t,n,r,s){return s===pe.NORMAL?{row:e+t,column:n+r}:s===pe.ROW?{row:e+t,column:n}:s===pe.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function lo(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],c=r[a+1]-1,u=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=u&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:u,endRow:h});break}}}return i}function $g(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function Hg(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function Wg(e){const t=lo(e),n=$g(t);return Hg(n)}function jg(e,t){const n=[];return e.forEach(r=>{n.push(...tn.subtract(r,t))}),tn.mergeRanges(n)}function Dc(e,t){const n=Lc(e.startRow,e.endRow,t.startRow,t.endRow),r=Lc(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Yg(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Lc(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),c=Math.min(i,a);if(l<=c){const u=l===-1/0?Number.NaN:l,h=c===1/0?Number.NaN:c;return[u,h]}else return null}function Yg(e,t,n,r,s,i){const o=e!==void 0?e:Uc(n,r,s,i),a=t!==void 0?t:Uc(n,r,s,i);return o===pe.ALL||a===pe.ALL?o===a?o:o===pe.ALL?a:o:o===a?o:(o===pe.NORMAL||a===pe.NORMAL,pe.NORMAL)}function Uc(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?pe.NORMAL:s?pe.ROW:i?pe.COLUMN:pe.ALL}const Yt=class Yt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===pe.NORMAL||n.rangeType===void 0&&t.rangeType===pe.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:u}=n,h=r<=l&&s>=a,d=i<=u&&o>=c;return h&&d}static intersects(t,n){if(t.rangeType===pe.ROW&&n.rangeType===pe.COLUMN||t.rangeType===pe.COLUMN&&n.rangeType===pe.ROW)return!0;if(t.rangeType===pe.ROW&&n.rangeType===pe.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===pe.COLUMN&&n.rangeType===pe.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,c=Number.isNaN(n.endRow)?r:n.endRow,u=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-u-h),m=Math.abs(o-a)+Math.abs(u-h),_=Math.abs(s+i-l-c),E=Math.abs(s-i)+Math.abs(l-c);return d<=m&&_<=E}static doAnyRangesIntersect(t,n){const r=new As;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,c=n.startColumn,u=n.endColumn;let h,d,m,_;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?_=s:_=l;else return null;if(c<=o)c>i?h=c:h=i;else return null;if(u>=i)u>=o?m=o:m=u;else return null;return{startRow:d,endRow:_,startColumn:h,endColumn:m,rangeType:pe.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Yt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:pe.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===pe.COLUMN),r=t.some(i=>i.rangeType===pe.ROW),s=Yt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?pe.ROW:n?pe.COLUMN:pe.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return Wg(t)}static splitIntoGrid(t){return lo(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=jg(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(Yt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(Yt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[Ye.ROW,Ye.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[Ye.ROW,Ye.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[Ye.COLUMN,Ye.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[Ye.COLUMN,Ye.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(Yt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(Yt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(Yt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let tn=Yt;function Gg(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=Vg(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Vg(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function zg(e,t){Fn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Kg(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Gg(n,t);if(!s)break;r.push(s),zg(n,s)}return r}class Xg{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function co(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function qg(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Ns=65,Pc=90,Zg=97;function Jg(e){const t=Pc-Ns+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Ns)+n,e=Math.floor(e/t)-1;return n}function kc(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Qg(e,t=!1){const n=Pc-Ns+1;let r=Zg;t&&(r=Ns);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return kc(s,i)}function e_(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function t_(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function br(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var Fc=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Fc||{}),ot=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
4
|
+
`,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(ot||{});function n_(e){return`${e}`}const r_=[ot.TABLE_START,ot.TABLE_ROW_START,ot.TABLE_CELL_START,ot.TABLE_CELL_END,ot.TABLE_ROW_END,ot.TABLE_END],Ms=e=>{const t=e.endsWith(`\r
|
|
5
|
+
`)?e.slice(0,-2):e;return r_.reduce((n,r)=>n.replaceAll(r,""),t)},s_=e=>e?Ms(e).replaceAll("\r","")==="":!0,i_=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const u=t.slice(s,l);if(K.isLegalUrl(u)){const h=$t(),d=`${u}`,m={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:en.HYPERLINK,properties:{url:e}};r.push(m),i+=d,s=l+1,c&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,c&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var xc=typeof global=="object"&&global&&global.Object===Object&&global,o_=typeof self=="object"&&self&&self.Object===Object&&self,_n=xc||o_||Function("return this")(),$n=_n.Symbol,Bc=Object.prototype,a_=Bc.hasOwnProperty,l_=Bc.toString,Ar=$n?$n.toStringTag:void 0;function c_(e){var t=a_.call(e,Ar),n=e[Ar];try{e[Ar]=void 0;var r=!0}catch{}var s=l_.call(e);return r&&(t?e[Ar]=n:delete e[Ar]),s}var u_=Object.prototype,h_=u_.toString;function d_(e){return h_.call(e)}var f_="[object Null]",m_="[object Undefined]",$c=$n?$n.toStringTag:void 0;function Tr(e){return e==null?e===void 0?m_:f_:$c&&$c in Object(e)?c_(e):d_(e)}function Hn(e){return e!=null&&typeof e=="object"}var g_="[object Symbol]";function Ds(e){return typeof e=="symbol"||Hn(e)&&Tr(e)==g_}function __(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var Wn=Array.isArray,Hc=$n?$n.prototype:void 0,Wc=Hc?Hc.toString:void 0;function jc(e){if(typeof e=="string")return e;if(Wn(e))return __(e,jc)+"";if(Ds(e))return Wc?Wc.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var p_=/\s/;function E_(e){for(var t=e.length;t--&&p_.test(e.charAt(t)););return t}var C_=/^\s+/;function R_(e){return e&&e.slice(0,E_(e)+1).replace(C_,"")}function pt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Yc=NaN,I_=/^[-+]0x[0-9a-f]+$/i,S_=/^0b[01]+$/i,O_=/^0o[0-7]+$/i,v_=parseInt;function Gc(e){if(typeof e=="number")return e;if(Ds(e))return Yc;if(pt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=pt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=R_(e);var n=S_.test(e);return n||O_.test(e)?v_(e.slice(2),n?2:8):I_.test(e)?Yc:+e}function Vc(e){return e}var w_="[object AsyncFunction]",b_="[object Function]",A_="[object GeneratorFunction]",T_="[object Proxy]";function uo(e){if(!pt(e))return!1;var t=Tr(e);return t==b_||t==A_||t==w_||t==T_}var ho=_n["__core-js_shared__"],zc=function(){var e=/[^.]+$/.exec(ho&&ho.keys&&ho.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function y_(e){return!!zc&&zc in e}var N_=Function.prototype,M_=N_.toString;function D_(e){if(e!=null){try{return M_.call(e)}catch{}try{return e+""}catch{}}return""}var L_=/[\\^$.*+?()[\]{}|]/g,U_=/^\[object .+?Constructor\]$/,P_=Function.prototype,k_=Object.prototype,F_=P_.toString,x_=k_.hasOwnProperty,B_=RegExp("^"+F_.call(x_).replace(L_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function $_(e){if(!pt(e)||y_(e))return!1;var t=uo(e)?B_:U_;return t.test(D_(e))}function H_(e,t){return e==null?void 0:e[t]}function fo(e,t){var n=H_(e,t);return $_(n)?n:void 0}var Kc=Object.create,W_=function(){function e(){}return function(t){if(!pt(t))return{};if(Kc)return Kc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function j_(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Y_(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var G_=800,V_=16,z_=Date.now;function K_(e){var t=0,n=0;return function(){var r=z_(),s=V_-(r-n);if(n=r,s>0){if(++t>=G_)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function X_(e){return function(){return e}}var Ls=function(){try{var e=fo(Object,"defineProperty");return e({},"",{}),e}catch{}}(),q_=Ls?function(e,t){return Ls(e,"toString",{configurable:!0,enumerable:!1,value:X_(t),writable:!0})}:Vc,Z_=K_(q_),J_=9007199254740991,Q_=/^(?:0|[1-9]\d*)$/;function mo(e,t){var n=typeof e;return t=t==null?J_:t,!!t&&(n=="number"||n!="symbol"&&Q_.test(e))&&e>-1&&e%1==0&&e<t}function go(e,t,n){t=="__proto__"&&Ls?Ls(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Us(e,t){return e===t||e!==e&&t!==t}var ep=Object.prototype,tp=ep.hasOwnProperty;function Xc(e,t,n){var r=e[t];(!(tp.call(e,t)&&Us(r,n))||n===void 0&&!(t in e))&&go(e,t,n)}function np(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?go(n,a,l):Xc(n,a,l)}return n}var qc=Math.max;function rp(e,t,n){return t=qc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=qc(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),j_(e,this,a)}}function sp(e,t){return Z_(rp(e,t,Vc),e+"")}var ip=9007199254740991;function Zc(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ip}function _o(e){return e!=null&&Zc(e.length)&&!uo(e)}function op(e,t,n){if(!pt(n))return!1;var r=typeof t;return(r=="number"?_o(n)&&mo(t,n.length):r=="string"&&t in n)?Us(n[t],e):!1}function Jc(e){return sp(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&op(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var ap=Object.prototype;function Qc(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ap;return e===n}function lp(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var cp="[object Arguments]";function eu(e){return Hn(e)&&Tr(e)==cp}var tu=Object.prototype,up=tu.hasOwnProperty,hp=tu.propertyIsEnumerable,po=eu(function(){return arguments}())?eu:function(e){return Hn(e)&&up.call(e,"callee")&&!hp.call(e,"callee")};function dp(){return!1}var nu=typeof f=="object"&&f&&!f.nodeType&&f,ru=nu&&typeof module=="object"&&module&&!module.nodeType&&module,fp=ru&&ru.exports===nu,su=fp?_n.Buffer:void 0,mp=su?su.isBuffer:void 0,iu=mp||dp,gp="[object Arguments]",_p="[object Array]",pp="[object Boolean]",Ep="[object Date]",Cp="[object Error]",Rp="[object Function]",Ip="[object Map]",Sp="[object Number]",Op="[object Object]",vp="[object RegExp]",wp="[object Set]",bp="[object String]",Ap="[object WeakMap]",Tp="[object ArrayBuffer]",yp="[object DataView]",Np="[object Float32Array]",Mp="[object Float64Array]",Dp="[object Int8Array]",Lp="[object Int16Array]",Up="[object Int32Array]",Pp="[object Uint8Array]",kp="[object Uint8ClampedArray]",Fp="[object Uint16Array]",xp="[object Uint32Array]",Fe={};Fe[Np]=Fe[Mp]=Fe[Dp]=Fe[Lp]=Fe[Up]=Fe[Pp]=Fe[kp]=Fe[Fp]=Fe[xp]=!0,Fe[gp]=Fe[_p]=Fe[Tp]=Fe[pp]=Fe[yp]=Fe[Ep]=Fe[Cp]=Fe[Rp]=Fe[Ip]=Fe[Sp]=Fe[Op]=Fe[vp]=Fe[wp]=Fe[bp]=Fe[Ap]=!1;function Bp(e){return Hn(e)&&Zc(e.length)&&!!Fe[Tr(e)]}function $p(e){return function(t){return e(t)}}var ou=typeof f=="object"&&f&&!f.nodeType&&f,yr=ou&&typeof module=="object"&&module&&!module.nodeType&&module,Hp=yr&&yr.exports===ou,Eo=Hp&&xc.process,au=function(){try{var e=yr&&yr.require&&yr.require("util").types;return e||Eo&&Eo.binding&&Eo.binding("util")}catch{}}(),lu=au&&au.isTypedArray,cu=lu?$p(lu):Bp;function Wp(e,t){var n=Wn(e),r=!n&&po(e),s=!n&&!r&&iu(e),i=!n&&!r&&!s&&cu(e),o=n||r||s||i,a=o?lp(e.length,String):[],l=a.length;for(var c in e)o&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||mo(c,l))||a.push(c);return a}function jp(e,t){return function(n){return e(t(n))}}function Yp(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Gp=Object.prototype,Vp=Gp.hasOwnProperty;function zp(e){if(!pt(e))return Yp(e);var t=Qc(e),n=[];for(var r in e)r=="constructor"&&(t||!Vp.call(e,r))||n.push(r);return n}function uu(e){return _o(e)?Wp(e):zp(e)}var Kp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xp=/^\w*$/;function qp(e,t){if(Wn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Ds(e)?!0:Xp.test(e)||!Kp.test(e)||t!=null&&e in Object(t)}var Nr=fo(Object,"create");function Zp(){this.__data__=Nr?Nr(null):{},this.size=0}function Jp(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Qp="__lodash_hash_undefined__",eE=Object.prototype,tE=eE.hasOwnProperty;function nE(e){var t=this.__data__;if(Nr){var n=t[e];return n===Qp?void 0:n}return tE.call(t,e)?t[e]:void 0}var rE=Object.prototype,sE=rE.hasOwnProperty;function iE(e){var t=this.__data__;return Nr?t[e]!==void 0:sE.call(t,e)}var oE="__lodash_hash_undefined__";function aE(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Nr&&t===void 0?oE:t,this}function pn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pn.prototype.clear=Zp,pn.prototype.delete=Jp,pn.prototype.get=nE,pn.prototype.has=iE,pn.prototype.set=aE;function lE(){this.__data__=[],this.size=0}function Ps(e,t){for(var n=e.length;n--;)if(Us(e[n][0],t))return n;return-1}var cE=Array.prototype,uE=cE.splice;function hE(e){var t=this.__data__,n=Ps(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():uE.call(t,n,1),--this.size,!0}function dE(e){var t=this.__data__,n=Ps(t,e);return n<0?void 0:t[n][1]}function fE(e){return Ps(this.__data__,e)>-1}function mE(e,t){var n=this.__data__,r=Ps(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Wt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Wt.prototype.clear=lE,Wt.prototype.delete=hE,Wt.prototype.get=dE,Wt.prototype.has=fE,Wt.prototype.set=mE;var hu=fo(_n,"Map");function gE(){this.size=0,this.__data__={hash:new pn,map:new(hu||Wt),string:new pn}}function _E(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ks(e,t){var n=e.__data__;return _E(t)?n[typeof t=="string"?"string":"hash"]:n.map}function pE(e){var t=ks(this,e).delete(e);return this.size-=t?1:0,t}function EE(e){return ks(this,e).get(e)}function CE(e){return ks(this,e).has(e)}function RE(e,t){var n=ks(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function nn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}nn.prototype.clear=gE,nn.prototype.delete=pE,nn.prototype.get=EE,nn.prototype.has=CE,nn.prototype.set=RE;var IE="Expected a function";function Co(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(IE);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(Co.Cache||nn),n}Co.Cache=nn;var SE=500;function OE(e){var t=Co(e,function(r){return n.size===SE&&n.clear(),r}),n=t.cache;return t}var vE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,wE=/\\(\\)?/g,bE=OE(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vE,function(n,r,s,i){t.push(s?i.replace(wE,"$1"):r||n)}),t});function AE(e){return e==null?"":jc(e)}function du(e,t){return Wn(e)?e:qp(e,t)?[e]:bE(AE(e))}function fu(e){if(typeof e=="string"||Ds(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function TE(e,t){t=du(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[fu(t[n++])];return n&&n==r?e:void 0}function mu(e,t,n){var r=e==null?void 0:TE(e,t);return r===void 0?n:r}var gu=jp(Object.getPrototypeOf,Object),yE="[object Object]",NE=Function.prototype,ME=Object.prototype,_u=NE.toString,DE=ME.hasOwnProperty,LE=_u.call(Object);function UE(e){if(!Hn(e)||Tr(e)!=yE)return!1;var t=gu(e);if(t===null)return!0;var n=DE.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&_u.call(n)==LE}function PE(){this.__data__=new Wt,this.size=0}function kE(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function FE(e){return this.__data__.get(e)}function xE(e){return this.__data__.has(e)}var BE=200;function $E(e,t){var n=this.__data__;if(n instanceof Wt){var r=n.__data__;if(!hu||r.length<BE-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new nn(r)}return n.set(e,t),this.size=n.size,this}function jn(e){var t=this.__data__=new Wt(e);this.size=t.size}jn.prototype.clear=PE,jn.prototype.delete=kE,jn.prototype.get=FE,jn.prototype.has=xE,jn.prototype.set=$E;var pu=typeof f=="object"&&f&&!f.nodeType&&f,Eu=pu&&typeof module=="object"&&module&&!module.nodeType&&module,HE=Eu&&Eu.exports===pu,Cu=HE?_n.Buffer:void 0;Cu&&Cu.allocUnsafe;function WE(e,t){return e.slice()}var Ru=_n.Uint8Array;function jE(e){var t=new e.constructor(e.byteLength);return new Ru(t).set(new Ru(e)),t}function YE(e,t){var n=jE(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function GE(e){return typeof e.constructor=="function"&&!Qc(e)?W_(gu(e)):{}}function VE(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var zE=VE(),Ro=function(){return _n.Date.now()},KE="Expected a function",XE=Math.max,qE=Math.min;function ZE(e,t,n){var r,s,i,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(KE);t=Gc(t)||0,pt(n)&&(u=!!n.leading,h="maxWait"in n,i=h?XE(Gc(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function m(R){var b=r,y=s;return r=s=void 0,c=R,o=e.apply(y,b),o}function _(R){return c=R,a=setTimeout(A,t),u?m(R):o}function E(R){var b=R-l,y=R-c,B=t-b;return h?qE(B,i-y):B}function I(R){var b=R-l,y=R-c;return l===void 0||b>=t||b<0||h&&y>=i}function A(){var R=Ro();if(I(R))return H(R);a=setTimeout(A,E(R))}function H(R){return a=void 0,d&&r?m(R):(r=s=void 0,o)}function x(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function Y(){return a===void 0?o:H(Ro())}function v(){var R=Ro(),b=I(R);if(r=arguments,s=this,l=R,b){if(a===void 0)return _(l);if(h)return clearTimeout(a),a=setTimeout(A,t),m(l)}return a===void 0&&(a=setTimeout(A,t)),o}return v.cancel=x,v.flush=Y,v}function Io(e,t,n){(n!==void 0&&!Us(e[t],n)||n===void 0&&!(t in e))&&go(e,t,n)}function JE(e){return Hn(e)&&_o(e)}function So(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function QE(e){return np(e,uu(e))}function e0(e,t,n,r,s,i,o){var a=So(e,n),l=So(t,n),c=o.get(l);if(c){Io(e,n,c);return}var u=i?i(a,l,n+"",e,t,o):void 0,h=u===void 0;if(h){var d=Wn(l),m=!d&&iu(l),_=!d&&!m&&cu(l);u=l,d||m||_?Wn(a)?u=a:JE(a)?u=Y_(a):m?(h=!1,u=WE(l)):_?(h=!1,u=YE(l)):u=[]:UE(l)||po(l)?(u=a,po(a)?u=QE(a):(!pt(a)||uo(a))&&(u=GE(l))):h=!1}h&&(o.set(l,u),s(u,l,r,i,o),o.delete(l)),Io(e,n,u)}function Oo(e,t,n,r,s){e!==t&&zE(t,function(i,o){if(s||(s=new jn),pt(i))e0(e,t,o,n,Oo,r,s);else{var a=r?r(So(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Io(e,o,a)}},uu)}var t0=Jc(function(e,t,n,r){Oo(e,t,n,r)}),vo=Jc(function(e,t,n){Oo(e,t,n)});function n0(e,t,n,r){if(!pt(e))return e;t=du(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=fu(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var u=a[l];c=void 0,c===void 0&&(c=pt(u)?u:mo(t[s+1])?[]:{})}Xc(a,l,c),a=a[l]}return e}function r0(e,t,n){return e==null?e:n0(e,t,n)}var wo,Iu;function s0(){if(Iu)return wo;Iu=1;var e=-1,t=1,n=0;function r(g,P,O,M,T){if(g===P)return g?[[n,g]]:[];if(O!=null){var w=B(g,P,O);if(w)return w}var N=a(g,P),D=g.substring(0,N);g=g.substring(N),P=P.substring(N),N=c(g,P);var L=g.substring(g.length-N);g=g.substring(0,g.length-N),P=P.substring(0,P.length-N);var F=s(g,P);return D&&F.unshift([n,D]),L&&F.push([n,L]),H(F,T),M&&h(F),F}function s(g,P){var O;if(!g)return[[t,P]];if(!P)return[[e,g]];var M=g.length>P.length?g:P,T=g.length>P.length?P:g,w=M.indexOf(T);if(w!==-1)return O=[[t,M.substring(0,w)],[n,T],[t,M.substring(w+T.length)]],g.length>P.length&&(O[0][0]=O[2][0]=e),O;if(T.length===1)return[[e,g],[t,P]];var N=u(g,P);if(N){var D=N[0],L=N[1],F=N[2],Q=N[3],z=N[4],le=r(D,F),ue=r(L,Q);return le.concat([[n,z]],ue)}return i(g,P)}function i(g,P){for(var O=g.length,M=P.length,T=Math.ceil((O+M)/2),w=T,N=2*T,D=new Array(N),L=new Array(N),F=0;F<N;F++)D[F]=-1,L[F]=-1;D[w+1]=0,L[w+1]=0;for(var Q=O-M,z=Q%2!==0,le=0,ue=0,S=0,U=0,G=0;G<T;G++){for(var V=-G+le;V<=G-ue;V+=2){var W=w+V,j;V===-G||V!==G&&D[W-1]<D[W+1]?j=D[W+1]:j=D[W-1]+1;for(var ee=j-V;j<O&&ee<M&&g.charAt(j)===P.charAt(ee);)j++,ee++;if(D[W]=j,j>O)ue+=2;else if(ee>M)le+=2;else if(z){var te=w+Q-V;if(te>=0&&te<N&&L[te]!==-1){var k=O-L[te];if(j>=k)return o(g,P,j,ee)}}}for(var X=-G+S;X<=G-U;X+=2){var te=w+X,k;X===-G||X!==G&&L[te-1]<L[te+1]?k=L[te+1]:k=L[te-1]+1;for(var Z=k-X;k<O&&Z<M&&g.charAt(O-k-1)===P.charAt(M-Z-1);)k++,Z++;if(L[te]=k,k>O)U+=2;else if(Z>M)S+=2;else if(!z){var W=w+Q-X;if(W>=0&&W<N&&D[W]!==-1){var j=D[W],ee=w+j-W;if(k=O-k,j>=k)return o(g,P,j,ee)}}}}return[[e,g],[t,P]]}function o(g,P,O,M){var T=g.substring(0,O),w=P.substring(0,M),N=g.substring(O),D=P.substring(M),L=r(T,w),F=r(N,D);return L.concat(F)}function a(g,P){if(!g||!P||g.charAt(0)!==P.charAt(0))return 0;for(var O=0,M=Math.min(g.length,P.length),T=M,w=0;O<T;)g.substring(w,T)==P.substring(w,T)?(O=T,w=O):M=T,T=Math.floor((M-O)/2+O);return x(g.charCodeAt(T-1))&&T--,T}function l(g,P){var O=g.length,M=P.length;if(O==0||M==0)return 0;O>M?g=g.substring(O-M):O<M&&(P=P.substring(0,O));var T=Math.min(O,M);if(g==P)return T;for(var w=0,N=1;;){var D=g.substring(T-N),L=P.indexOf(D);if(L==-1)return w;N+=L,(L==0||g.substring(T-N)==P.substring(0,N))&&(w=N,N++)}}function c(g,P){if(!g||!P||g.slice(-1)!==P.slice(-1))return 0;for(var O=0,M=Math.min(g.length,P.length),T=M,w=0;O<T;)g.substring(g.length-T,g.length-w)==P.substring(P.length-T,P.length-w)?(O=T,w=O):M=T,T=Math.floor((M-O)/2+O);return Y(g.charCodeAt(g.length-T))&&T--,T}function u(g,P){var O=g.length>P.length?g:P,M=g.length>P.length?P:g;if(O.length<4||M.length*2<O.length)return null;function T(ue,S,U){for(var G=ue.substring(U,U+Math.floor(ue.length/4)),V=-1,W="",j,ee,te,k;(V=S.indexOf(G,V+1))!==-1;){var X=a(ue.substring(U),S.substring(V)),Z=c(ue.substring(0,U),S.substring(0,V));W.length<Z+X&&(W=S.substring(V-Z,V)+S.substring(V,V+X),j=ue.substring(0,U-Z),ee=ue.substring(U+X),te=S.substring(0,V-Z),k=S.substring(V+X))}return W.length*2>=ue.length?[j,ee,te,k,W]:null}var w=T(O,M,Math.ceil(O.length/4)),N=T(O,M,Math.ceil(O.length/2)),D;if(!w&&!N)return null;N?w?D=w[4].length>N[4].length?w:N:D=N:D=w;var L,F,Q,z;g.length>P.length?(L=D[0],F=D[1],Q=D[2],z=D[3]):(Q=D[0],z=D[1],L=D[2],F=D[3]);var le=D[4];return[L,F,Q,z,le]}function h(g){for(var P=!1,O=[],M=0,T=null,w=0,N=0,D=0,L=0,F=0;w<g.length;)g[w][0]==n?(O[M++]=w,N=L,D=F,L=0,F=0,T=g[w][1]):(g[w][0]==t?L+=g[w][1].length:F+=g[w][1].length,T&&T.length<=Math.max(N,D)&&T.length<=Math.max(L,F)&&(g.splice(O[M-1],0,[e,T]),g[O[M-1]+1][0]=t,M--,M--,w=M>0?O[M-1]:-1,N=0,D=0,L=0,F=0,T=null,P=!0)),w++;for(P&&H(g),A(g),w=1;w<g.length;){if(g[w-1][0]==e&&g[w][0]==t){var Q=g[w-1][1],z=g[w][1],le=l(Q,z),ue=l(z,Q);le>=ue?(le>=Q.length/2||le>=z.length/2)&&(g.splice(w,0,[n,z.substring(0,le)]),g[w-1][1]=Q.substring(0,Q.length-le),g[w+1][1]=z.substring(le),w++):(ue>=Q.length/2||ue>=z.length/2)&&(g.splice(w,0,[n,Q.substring(0,ue)]),g[w-1][0]=t,g[w-1][1]=z.substring(0,z.length-ue),g[w+1][0]=e,g[w+1][1]=Q.substring(ue),w++),w++}w++}}var d=/[^a-zA-Z0-9]/,m=/\s/,_=/[\r\n]/,E=/\n\r?\n$/,I=/^\r?\n\r?\n/;function A(g){function P(ue,S){if(!ue||!S)return 6;var U=ue.charAt(ue.length-1),G=S.charAt(0),V=U.match(d),W=G.match(d),j=V&&U.match(m),ee=W&&G.match(m),te=j&&U.match(_),k=ee&&G.match(_),X=te&&ue.match(E),Z=k&&S.match(I);return X||Z?5:te||k?4:V&&!j&&ee?3:j||ee?2:V||W?1:0}for(var O=1;O<g.length-1;){if(g[O-1][0]==n&&g[O+1][0]==n){var M=g[O-1][1],T=g[O][1],w=g[O+1][1],N=c(M,T);if(N){var D=T.substring(T.length-N);M=M.substring(0,M.length-N),T=D+T.substring(0,T.length-N),w=D+w}for(var L=M,F=T,Q=w,z=P(M,T)+P(T,w);T.charAt(0)===w.charAt(0);){M+=T.charAt(0),T=T.substring(1)+w.charAt(0),w=w.substring(1);var le=P(M,T)+P(T,w);le>=z&&(z=le,L=M,F=T,Q=w)}g[O-1][1]!=L&&(L?g[O-1][1]=L:(g.splice(O-1,1),O--),g[O][1]=F,Q?g[O+1][1]=Q:(g.splice(O+1,1),O--))}O++}}function H(g,P){g.push([n,""]);for(var O=0,M=0,T=0,w="",N="",D;O<g.length;){if(O<g.length-1&&!g[O][1]){g.splice(O,1);continue}switch(g[O][0]){case t:T++,N+=g[O][1],O++;break;case e:M++,w+=g[O][1],O++;break;case n:var L=O-T-M-1;if(P){if(L>=0&&R(g[L][1])){var F=g[L][1].slice(-1);if(g[L][1]=g[L][1].slice(0,-1),w=F+w,N=F+N,!g[L][1]){g.splice(L,1),O--;var Q=L-1;g[Q]&&g[Q][0]===t&&(T++,N=g[Q][1]+N,Q--),g[Q]&&g[Q][0]===e&&(M++,w=g[Q][1]+w,Q--),L=Q}}if(v(g[O][1])){var F=g[O][1].charAt(0);g[O][1]=g[O][1].slice(1),w+=F,N+=F}}if(O<g.length-1&&!g[O][1]){g.splice(O,1);break}if(w.length>0||N.length>0){w.length>0&&N.length>0&&(D=a(N,w),D!==0&&(L>=0?g[L][1]+=N.substring(0,D):(g.splice(0,0,[n,N.substring(0,D)]),O++),N=N.substring(D),w=w.substring(D)),D=c(N,w),D!==0&&(g[O][1]=N.substring(N.length-D)+g[O][1],N=N.substring(0,N.length-D),w=w.substring(0,w.length-D)));var z=T+M;w.length===0&&N.length===0?(g.splice(O-z,z),O=O-z):w.length===0?(g.splice(O-z,z,[t,N]),O=O-z+1):N.length===0?(g.splice(O-z,z,[e,w]),O=O-z+1):(g.splice(O-z,z,[e,w],[t,N]),O=O-z+2)}O!==0&&g[O-1][0]===n?(g[O-1][1]+=g[O][1],g.splice(O,1)):O++,T=0,M=0,w="",N="";break}}g[g.length-1][1]===""&&g.pop();var le=!1;for(O=1;O<g.length-1;)g[O-1][0]===n&&g[O+1][0]===n&&(g[O][1].substring(g[O][1].length-g[O-1][1].length)===g[O-1][1]?(g[O][1]=g[O-1][1]+g[O][1].substring(0,g[O][1].length-g[O-1][1].length),g[O+1][1]=g[O-1][1]+g[O+1][1],g.splice(O-1,1),le=!0):g[O][1].substring(0,g[O+1][1].length)==g[O+1][1]&&(g[O-1][1]+=g[O+1][1],g[O][1]=g[O][1].substring(g[O+1][1].length)+g[O+1][1],g.splice(O+1,1),le=!0)),O++;le&&H(g,P)}function x(g){return g>=55296&&g<=56319}function Y(g){return g>=56320&&g<=57343}function v(g){return Y(g.charCodeAt(0))}function R(g){return x(g.charCodeAt(g.length-1))}function b(g){for(var P=[],O=0;O<g.length;O++)g[O][1].length>0&&P.push(g[O]);return P}function y(g,P,O,M){return R(g)||v(M)?null:b([[n,g],[e,P],[t,O],[n,M]])}function B(g,P,O){var M=typeof O=="number"?{index:O,length:0}:O.oldRange,T=typeof O=="number"?null:O.newRange,w=g.length,N=P.length;if(M.length===0&&(T===null||T.length===0)){var D=M.index,L=g.slice(0,D),F=g.slice(D),Q=T?T.index:null;e:{var z=D+N-w;if(Q!==null&&Q!==z||z<0||z>N)break e;var le=P.slice(0,z),ue=P.slice(z);if(ue!==F)break e;var S=Math.min(D,z),U=L.slice(0,S),G=le.slice(0,S);if(U!==G)break e;var V=L.slice(S),W=le.slice(S);return y(U,V,W,F)}e:{if(Q!==null&&Q!==D)break e;var j=D,le=P.slice(0,j),ue=P.slice(j);if(le!==L)break e;var ee=Math.min(w-j,N-j),te=F.slice(F.length-ee),k=ue.slice(ue.length-ee);if(te!==k)break e;var V=F.slice(0,F.length-ee),W=ue.slice(0,ue.length-ee);return y(L,V,W,te)}}if(M.length>0&&T&&T.length===0)e:{var U=g.slice(0,M.index),te=g.slice(M.index+M.length),S=U.length,ee=te.length;if(N<S+ee)break e;var G=P.slice(0,S),k=P.slice(N-ee);if(U!==G||te!==k)break e;var V=g.slice(S,w-ee),W=P.slice(S,N-ee);return y(U,V,W,te)}return null}function $(g,P,O,M){return r(g,P,O,M,!0)}return $.INSERT=t,$.DELETE=e,$.EQUAL=n,wo=$,wo}var i0=s0();const bo=gt(i0),o0=new Set(["true","false"]);function a0(e){return o0.has(e.toLowerCase())}var Ao,Su;function l0(){if(Su)return Ao;Su=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(x,Y){i=x,o=Y})),s=s||{};var l=!1,c=null,u=null,h=null,d=this,m=function(x,Y,v){u&&(clearTimeout(u),u=null),h&&(clearTimeout(h),h=null),x&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?Y?o(Y):i(v):typeof r=="function"&&r(Y,v),l=!0),x&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},_=function(x){if(l)return m(x);c&&(clearTimeout(c),c=null),d.domainReentrant&&x&&(d.domains[t]=process.domain);var Y=s.maxExecutionTime||d.maxExecutionTime;if(Y&&(h=setTimeout(function(){d.queues[t]&&m(x,new Error("Maximum execution time is exceeded "+t))},Y)),n.length===1){var v=!1;try{n(function(R,b){v||(v=!0,m(x,R,b))})}catch(R){v||(v=!0,m(x,R))}}else d._promiseTry(function(){return n()}).then(function(R){m(x,void 0,R)},function(R){m(x,R)})};d.domainReentrant&&process.domain&&(_=process.domain.bind(_));var E=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],_(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])_(!1);else if(d.queues[t].length>=E)m(!1,new Error("Too many pending tasks in queue "+t));else{var I=function(){_(!0)};s.skipQueue?d.queues[t].unshift(I):d.queues[t].push(I);var A=s.timeout||d.timeout;A&&(c=setTimeout(function(){c=null,m(!1,new Error("async-lock timed out in queue "+t))},A))}var H=s.maxOccupationTime||d.maxOccupationTime;if(H&&(u=setTimeout(function(){d.queues[t]&&m(!1,new Error("Maximum occupation time is exceeded in queue "+t))},H)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,c){return function(u){i.acquire(l,c,u,s)}},a=t.reduceRight(function(l,c){return o(c,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,c){a.length===1?a(function(u,h){u?c(u):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},Ao=e,Ao}var To,Ou;function c0(){return Ou||(Ou=1,To=l0()),To}var u0=c0();const h0=gt(u0);function vu(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var ve=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ve||{}),Ut=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ut||{}),yo=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(yo||{});class Fs extends ze{}function d0(e=K.generateRandomId(6),t=or.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
6
|
+
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:so.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ae.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ae.TRUE,doNotHyphenateCaps:ae.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ae.FALSE,useFirstPageHeaderFooter:ae.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var En={},Mr={},xs={},wu;function f0(){if(wu)return xs;wu=1,Object.defineProperty(xs,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return xs.default=n,xs}var Bs={},bu;function m0(){if(bu)return Bs;bu=1,Object.defineProperty(Bs,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Bs.default=e,Bs}var No={},Au;function Tu(){return Au||(Au=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(u,h){if(!u)throw new Error(h)}const n=u=>u!=null&&typeof u=="object"&&!Array.isArray(u),r=(u,h)=>typeof u==typeof h?u>h:typeof u=="string"&&typeof h=="number";function s(u,h){for(let d in u){const m=d;h.write(m,u[m])}}e.isValidPathItem=u=>typeof u=="number"||typeof u=="string"&&u!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,m=this.parents.length-1,_=this.idx;for(;_>=0;)h.unshift(d[_]),_===0?(_=this.indexes[m*2],d=this.parents[m--]):_-=n(d[_-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,m,_){this.container=h,this.idx=d,this.parents=m.slice(),this.indexes=_.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const m=this.getComponent();m&&d(m,h);for(const _ of this)h&&h.descend(_),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(m,_)=>{m.p!=null&&d(m.p,_)})}eachDrop(h,d){this.traverse(h,(m,_)=>{m.d!=null&&d(m.d,_)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let m=this.idx+1;if(m<this.container.length&&n(this.container[m])&&m++,t(m===this.container.length||!n(this.container[m])),m===this.container.length)this.container.push(d),this.idx=m;else if(this.container[m]===d)this.idx=m;else{if(!Array.isArray(this.container[m])){const _=this.container.splice(m,this.container.length-m);this.container.push(_),this.lcIdx>-1&&(this.lcIdx=m)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),m=this.lcIdx+1,this.lcIdx=-1);m<this.container.length&&r(d,this.container[m][0]);)m++;if(this.indexes.push(m),this.idx=0,m<this.container.length&&this.container[m][0]===d)this.container=this.container[m];else{const _=[d];this.container.splice(m,0,_),this.container=_}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const m=this.getComponent();t(m[h]==null||m[h]===d,"Internal consistency error: Overwritten component. File a bug"),m[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const m=this.lcIdx,_=this.parents.length;let E=0;for(let I=0;I<h.length;I++){const A=h[I];typeof A=="string"||typeof A=="number"?(E++,this.descend(A)):Array.isArray(A)?this.mergeTree(A,d):typeof A=="object"&&d(A,this)}for(;E--;)this.ascend();this.lcIdx=this.parents.length===_?m:-1}at(h,d){this.descendPath(h),d(this);for(let m=0;m<h.length;m++)this.ascend();return this}writeAtPath(h,d,m){return this.at(h,()=>this.write(d,m)),this.reset(),this}writeMove(h,d,m=0){return this.writeAtPath(h,"p",m).writeAtPath(d,"d",m)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=u=>new o(u);function l(u,h,d){let m,_;_=m=u?u.descendFirst():!1;function E(I){let A;for(;_;){const H=A=u.getKey();if(I!=null){let x=!1;if(h&&typeof H=="number"&&(A=h(H,u.getComponent()),A<0&&(A=~A,x=!0)),r(A,I))return null;if(A===I&&!x)return u}d&&typeof A=="number"&&d(A,u.getComponent()),_=u.nextSibling()}return null}return E.end=()=>{m&&u.ascend()},E}e.advancer=l;function c(u,h,d){let m,_,E,I;for(m=_=u&&u.descendFirst(),E=I=h&&h.descendFirst();m||E;){let A=m?u.getKey():null,H=E?h.getKey():null;A!==null&&H!==null&&(r(H,A)?H=null:A!==H&&(A=null)),d(A==null?H:A,A!=null?u:null,H!=null?h:null),A!=null&&m&&(m=u.nextSibling()),H!=null&&E&&(E=h.nextSibling())}_&&u.ascend(),I&&h.ascend()}e.eachChildOf=c}(No)),No}var Mo={},yu;function Nu(){return yu||(yu=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(Mo)),Mo}var vt={},Cn={},Mu;function Do(){return Mu||(Mu=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.uniToStrPos=Cn.strPosToUni=void 0,Cn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},Cn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),Cn}var Lo={},Du;function Uo(){return Du||(Du=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Do(),n=v=>{if(!Array.isArray(v))throw Error("Op must be an array of components");let R=null;for(let b=0;b<v.length;b++){const y=v[b];switch(typeof y){case"object":if(typeof y.d!="number"&&typeof y.d!="string")throw Error("Delete must be number or string");if(e.dlen(y.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(y.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(y>0))throw Error("Skip components must be >0");if(typeof R=="number")throw Error("Adjacent skip components should be combined");break}R=y}if(typeof R=="number")throw Error("Op has a trailing skip")};function r(v,R){let b=0,y=0;for(let B=0;B<v.length;B++){const $=v[B];switch(R($,b,y),typeof $){case"object":b+=e.dlen($.d);break;case"string":y+=t.strPosToUni($);break;case"number":b+=$,y+=$;break}}}e.eachOp=r;function s(v,R){const b=[],y=a(b);return r(v,(B,$,g)=>{y(R(B,$,g))}),h(b)}const i=v=>v,o=v=>s(v,i);e.dlen=v=>typeof v=="number"?v:t.strPosToUni(v);const a=v=>R=>{if(!(!R||R.d===0||R.d===""))if(v.length===0)v.push(R);else if(typeof R==typeof v[v.length-1])if(typeof R=="object"){const b=v[v.length-1];b.d=typeof b.d=="string"&&typeof R.d=="string"?b.d+R.d:e.dlen(b.d)+e.dlen(R.d)}else v[v.length-1]+=R;else v.push(R)},l=v=>typeof v=="number"?v:typeof v=="string"?t.strPosToUni(v):typeof v.d=="number"?v.d:t.strPosToUni(v.d);e.uniSlice=(v,R,b)=>{const y=t.uniToStrPos(v,R),B=b==null?1/0:t.uniToStrPos(v,b);return v.slice(y,B)};const c=(v,R,b)=>typeof v=="number"?b==null?v-R:Math.min(v,b)-R:e.uniSlice(v,R,b),u=v=>{let R=0,b=0;return{take:($,g)=>{if(R===v.length)return $===-1?null:$;const P=v[R];let O;if(typeof P=="number")return $===-1||P-b<=$?(O=P-b,++R,b=0,O):(b+=$,$);if(typeof P=="string"){if($===-1||g==="i"||t.strPosToUni(P.slice(b))<=$)return O=P.slice(b),++R,b=0,O;{const M=b+t.uniToStrPos(P.slice(b),$);return O=P.slice(b,M),b=M,O}}else{if($===-1||g==="d"||e.dlen(P.d)-b<=$)return O={d:c(P.d,b)},++R,b=0,O;{let M=c(P.d,b,b+$);return b+=$,{d:M}}}},peek:()=>v[R]}},h=v=>(v.length>0&&typeof v[v.length-1]=="number"&&v.pop(),v);function d(v,R,b){if(b!=="left"&&b!=="right")throw Error("side ("+b+") must be 'left' or 'right'");n(v),n(R);const y=[],B=a(y),{take:$,peek:g}=u(v);for(let O=0;O<R.length;O++){const M=R[O];let T,w;switch(typeof M){case"number":for(T=M;T>0;)w=$(T,"i"),B(w),typeof w!="string"&&(T-=l(w));break;case"string":b==="left"&&typeof g()=="string"&&B($(-1)),B(t.strPosToUni(M));break;case"object":for(T=e.dlen(M.d);T>0;)switch(w=$(T,"i"),typeof w){case"number":T-=w;break;case"string":B(w);break;case"object":T-=e.dlen(w.d)}break}}let P;for(;P=$(-1);)B(P);return h(y)}function m(v,R){n(v),n(R);const b=[],y=a(b),{take:B}=u(v);for(let g=0;g<R.length;g++){const P=R[g];let O,M;switch(typeof P){case"number":for(O=P;O>0;)M=B(O,"d"),y(M),typeof M!="object"&&(O-=l(M));break;case"string":y(P);break;case"object":O=e.dlen(P.d);let T=0;for(;T<O;)switch(M=B(O-T,"d"),typeof M){case"number":y({d:c(P.d,T,T+M)}),T+=M;break;case"string":T+=t.strPosToUni(M);break;case"object":y(M)}break}}let $;for(;$=B(-1);)y($);return h(b)}const _=(v,R)=>{let b=0;for(let y=0;y<R.length&&v>b;y++){const B=R[y];switch(typeof B){case"number":{b+=B;break}case"string":const $=t.strPosToUni(B);b+=$,v+=$;break;case"object":v-=Math.min(e.dlen(B.d),v-b);break}}return v},E=(v,R)=>typeof v=="number"?_(v,R):v.map(b=>_(b,R));function I(v,R,b){return s(v,(y,B)=>typeof y=="object"&&typeof y.d=="number"?{d:b.slice(R,B,B+y.d)}:y)}function A(v){return s(v,R=>{switch(typeof R){case"object":if(typeof R.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return R.d;case"string":return{d:R};case"number":return R}})}function H(v){return s(v,R=>typeof R=="object"&&typeof R.d=="string"?{d:t.strPosToUni(R.d)}:R)}function x(v){let R=!0;return r(v,b=>{typeof b=="object"&&typeof b.d=="number"&&(R=!1)}),R}function Y(v){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(R=""){if(typeof R!="string")throw Error("Initial data must be a string");return v.create(R)},apply(R,b){n(b);const y=v.builder(R);for(let B=0;B<b.length;B++){const $=b[B];switch(typeof $){case"number":y.skip($);break;case"string":y.append($);break;case"object":y.del(e.dlen($.d));break}}return y.build()},transform:d,compose:m,transformPosition:_,transformSelection:E,isInvertible:x,makeInvertible(R,b){return I(R,b,v)},stripInvertible:H,invert:A,invertWithDoc(R,b){return A(I(R,b,v))},isNoop:R=>R.length===0}}e.default=Y}(Lo)),Lo}var $s={},Lu;function g0(){if(Lu)return $s;Lu=1,Object.defineProperty($s,"__esModule",{value:!0});const e=Uo(),t=Do();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const c=e.dlen(o.d);this.onRemove&&this.onRemove(l,c)}})},onInsert:null,onRemove:null}}return $s.default=n,n.provides={text:!0},$s}var Uu;function _0(){return Uu||(Uu=1,function(e){var t=vt&&vt.__createBinding||(Object.create?function(d,m,_,E){E===void 0&&(E=_),Object.defineProperty(d,E,{enumerable:!0,get:function(){return m[_]}})}:function(d,m,_,E){E===void 0&&(E=_),d[E]=m[_]}),n=vt&&vt.__setModuleDefault||(Object.create?function(d,m){Object.defineProperty(d,"default",{enumerable:!0,value:m})}:function(d,m){d.default=m}),r=vt&&vt.__importStar||function(d){if(d&&d.__esModule)return d;var m={};if(d!=null)for(var _ in d)Object.hasOwnProperty.call(d,_)&&t(m,d,_);return n(m,d),m},s=vt&&vt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=Do(),o=r(Uo()),a=s(g0()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const m=[];return{skip(_){let E=i.uniToStrPos(d,_);if(E>d.length)throw Error("The op is too long for this document");m.push(d.slice(0,E)),d=d.slice(E)},append(_){m.push(_)},del(_){d=d.slice(i.uniToStrPos(d,_))},build(){return m.join("")+d}}},slice:o.uniSlice},c=o.default(l),u=Object.assign(Object.assign({},c),{api:a.default});e.type=u,e.insert=(d,m)=>m.length===0?[]:d===0?[m]:[d,m],e.remove=(d,m)=>o.dlen(m)===0?[]:d===0?[{d:m}]:[d,{d:m}];var h=Uo();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(vt)),vt}var Pu;function p0(){return Pu||(Pu=1,function(e){var t=Mr&&Mr.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(f0()),r=t(m0()),s=Tu(),i=Nu();function o(S,U){if(!S)throw new Error(U)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:S=>S,isNoop:S=>S==null,setDebug(S){},registerSubtype:A,checkValidOp:B,normalize:$,apply:g,transformPosition:P,compose:O,tryTransform:L,transform:Q,makeInvertible:w,invert:M,invertWithDoc:N,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(S,U,G)=>ue(()=>!0,S,U,G),typeAllowingConflictsPred:S=>Object.assign(Object.assign({},e.type),{transform:(U,G,V)=>ue(S,U,G,V)})};const a=S=>S?S.getComponent():null;function l(S){return S&&typeof S=="object"&&!Array.isArray(S)}const c=S=>Array.isArray(S)?S.slice():S!==null&&typeof S=="object"?Object.assign({},S):S,u=S=>S&&(S.p!=null||S.r!==void 0),h=S=>S&&(S.d!=null||S.i!==void 0);function d(S,U){return o(S!=null),typeof U=="number"?(o(Array.isArray(S),"Invalid key - child is not an array"),(S=S.slice()).splice(U,1)):(o(l(S),"Invalid key - child is not an object"),delete(S=Object.assign({},S))[U]),S}function m(S,U,G){return typeof U=="number"?(o(S!=null,"Container is missing for key"),o(Array.isArray(S),"Cannot use numerical key for object container"),o(S.length>=U,"Cannot insert into out of bounds index"),S.splice(U,0,G)):(o(l(S),"Cannot insert into missing item"),o(S[U]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),S[U]=G),G}e.removeOp=(S,U=!0)=>s.writeCursor().writeAtPath(S,"r",U).get(),e.moveOp=(S,U)=>s.writeCursor().writeMove(S,U).get(),e.insertOp=(S,U)=>s.writeCursor().writeAtPath(S,"i",U).get(),e.replaceOp=(S,U,G)=>s.writeCursor().at(S,V=>{V.write("r",U),V.write("i",G)}).get(),e.editOp=(S,U,G,V=!1)=>s.writeCursor().at(S,W=>R(W,U,G,V)).get();const _=(S,U)=>S!=null&&(typeof U=="number"?Array.isArray(S):typeof S=="object"),E=(S,U)=>_(S,U)?S[U]:void 0,I={};function A(S){let U=S.type?S.type:S;U.name&&(I[U.name]=U),U.uri&&(I[U.uri]=U)}const H=S=>{const U=I[S];if(U)return U;throw Error("Missing type: "+S)};A(_0());const x=(S,U)=>S+U;A({name:"number",apply:x,compose:x,invert:S=>-S,transform:S=>S});const Y=S=>S==null?null:S.et?H(S.et):S.es?I["text-unicode"]:S.ena!=null?I.number:null,v=S=>S.es?S.es:S.ena!=null?S.ena:S.e,R=(S,U,G,V=!1)=>{const[W,j]=typeof U=="string"?[H(U),U]:[U,U.name];!V&&W.isNoop&&W.isNoop(G)||(j==="number"?S.write("ena",G):j==="text-unicode"?S.write("es",G):(S.write("et",j),S.write("e",G)))};function b(S){o(typeof S=="number"),o(S>=0),o(S===(0|S))}function y(S){typeof S=="number"?b(S):o(typeof S=="string")}function B(S){if(S===null)return;const U=new Set,G=new Set,V=j=>{let ee=!0,te=!1;for(let k in j){const X=j[k];if(ee=!1,o(k==="p"||k==="r"||k==="d"||k==="i"||k==="e"||k==="es"||k==="ena"||k==="et","Invalid component item '"+k+"'"),k==="p")b(X),o(!U.has(X)),U.add(X),o(j.r===void 0);else if(k==="d")b(X),o(!G.has(X)),G.add(X),o(j.i===void 0);else if(k==="e"||k==="es"||k==="ena"){o(!te),te=!0;const Z=Y(j);o(Z,"Missing type in edit"),Z.checkValidOp&&Z.checkValidOp(v(j))}}o(!ee)},W=(j,ee,te)=>{if(!Array.isArray(j))throw Error("Op must be null or a list");if(j.length===0)throw Error("Empty descent");ee||y(j[0]);let k=1,X=0,Z=0;for(let re=0;re<j.length;re++){const ge=j[re];if(o(ge!=null),Array.isArray(ge)){const Ee=W(ge,!1);if(X){const q=typeof Z,de=typeof Ee;q===de?o(Z<Ee,"descent keys are not in order"):o(q==="number"&&de==="string")}Z=Ee,X++,k=3}else typeof ge=="object"?(o(k===1,`Prev not scalar - instead ${k}`),V(ge),k=2):(o(k!==3),y(ge),o(s.isValidPathItem(ge),"Invalid path key"),k=1)}return o(X!==1,"Operation makes multiple descents. Remove some []"),o(k===2||k===3),j[0]};W(S,!0),o(U.size===G.size,"Mismatched picks and drops in op");for(let j=0;j<U.size;j++)o(U.has(j)),o(G.has(j))}function $(S){let U=0,G=[];const V=s.writeCursor();return V.mergeTree(S,(W,j)=>{const ee=Y(W);if(ee){const k=v(W);R(j,ee,ee.normalize?ee.normalize(k):k)}for(const k of["r","p","i","d"])if(W[k]!==void 0){const X=k==="p"||k==="d"?(te=W[k],G[te]==null&&(G[te]=U++),G[te]):W[k];j.write(k,X)}var te}),V.get()}function g(S,U){if(B(U),U===null)return S;const G=[];return function V(W,j){let ee=W,te=0,k={root:W},X=0,Z=k,re="root";function ge(){for(;X<te;X++){let Ee=j[X];typeof Ee!="object"&&(o(_(Z,re)),Z=Z[re]=c(Z[re]),re=Ee)}}for(;te<j.length;te++){const Ee=j[te];if(Array.isArray(Ee)){const q=V(ee,Ee);q!==ee&&q!==void 0&&(ge(),ee=Z[re]=q)}else if(typeof Ee=="object"){Ee.d!=null?(ge(),ee=m(Z,re,G[Ee.d])):Ee.i!==void 0&&(ge(),ee=m(Z,re,Ee.i));const q=Y(Ee);if(q)ge(),ee=Z[re]=q.apply(ee,v(Ee));else if(Ee.e!==void 0)throw Error("Subtype "+Ee.et+" undefined")}else ee=E(ee,Ee)}return k.root}(S=function V(W,j){const ee=[];let te=0;for(;te<j.length;te++){const re=j[te];if(Array.isArray(re))break;typeof re!="object"&&(ee.push(W),W=E(W,re))}for(let re=j.length-1;re>=te;re--)W=V(W,j[re]);for(--te;te>=0;te--){const re=j[te];if(typeof re!="object"){const ge=ee.pop();W=W===E(ge,re)?ge:W===void 0?d(ge,re):(X=re,Z=W,(k=c(k=ge))[X]=Z,k)}else u(re)&&(o(W!==void 0,"Cannot pick up or remove undefined"),re.p!=null&&(G[re.p]=W),W=void 0)}var k,X,Z;return W}(S,U),U)}function P(S,U){S=S.slice(),B(U);const G=s.readCursor(U);let V,W,j=!1;const ee=[];for(let k=0;;k++){const X=S[k],Z=G.getComponent();if(Z&&(Z.r!==void 0?j=!0:Z.p!=null&&(j=!1,V=Z.p,W=k)),k>=S.length)break;let re=0;const ge=s.advancer(G,void 0,(q,de)=>{u(de)&&re++});ee.unshift(ge);const Ee=ge(X);if(typeof X=="number"&&(S[k]-=re),!Ee)break}if(ee.forEach(k=>k.end()),j)return null;const te=()=>{let k=0;if(V!=null){const X=G.getPath();k=X.length,S=X.concat(S.slice(W))}for(;k<S.length;k++){const X=S[k],Z=a(G),re=Y(Z);if(re){const q=v(Z);re.transformPosition&&(S[k]=re.transformPosition(S[k],q));break}let ge=0;const Ee=s.advancer(G,(q,de)=>h(de)?~(q-ge):q-ge,(q,de)=>{h(de)&&ge++})(X);if(typeof X=="number"&&(S[k]+=ge),!Ee)break}};return V!=null?G.eachDrop(null,k=>{k===V&&te()}):te(),S}function O(S,U){if(B(S),B(U),S==null)return U;if(U==null)return S;let G=0;const V=s.readCursor(S),W=s.readCursor(U),j=s.writeCursor(),ee=[],te=[],k=[],X=[],Z=[],re=[],ge=new Set;V.traverse(null,q=>{q.p!=null&&(k[q.p]=V.clone())}),W.traverse(null,q=>{q.d!=null&&(X[q.d]=W.clone())});const Ee=s.writeCursor();return function q(de,ke,Me,Se,Be,Gt,nt,Qe){o(ke||Me);const $e=a(ke),Rt=a(Me),At=!!Rt&&Rt.r!==void 0,On=!!$e&&$e.i!==void 0,It=$e?$e.d:null,dt=Rt?Rt.p:null,Vt=(Gt||At)&&dt==null;if(dt!=null)Se=X[dt],nt=te[dt]=new s.WriteCursor;else if(Rt&&Rt.r!==void 0)Se=null;else{const oe=a(Se);oe&&oe.d!=null&&(Se=null)}const Ae=a(Se);if(It!=null)if(de=k[It],Qe=ee[It]=new s.WriteCursor,Vt)Gt&&!At&&Qe.write("r",!0);else{const oe=Z[It]=G++;nt.write("d",oe)}else if($e&&$e.i!==void 0)de=null;else{const oe=a(de);oe&&oe.p!=null&&(de=null)}let ce;On?(o(Be===void 0),ce=$e.i):ce=Be;const Re=(dt==null?!On||Gt||At:ce===void 0)?null:nt.getComponent();if(dt!=null){if(!(Be!==void 0||On)){const oe=It!=null?Z[It]:G++;re[dt]=oe,Qe.write("p",oe)}}else At&&(On||Be!==void 0||(Rt.r,Qe.write("r",Rt.r)));const he=Vt?null:Y($e),ie=Y(Ae);if((he||ie)&&(he&&he.name,ie&&ie.name),he&&ie){o(he===ie);const oe=v($e),Ie=v(Ae),Xe=he.compose(oe,Ie);R(nt,he,Xe),ge.add(Ae)}else he?R(nt,he,v($e)):ie&&(R(nt,ie,v(Ae)),ge.add(Ae));const me=typeof ce=="object"&&ce!=null;let be=!1,we=0,ye=0,Ke=0,Ve=0,He=0;const tt=s.advancer(Se,(oe,Ie)=>h(Ie)?Ve-oe-1:oe-Ve,(oe,Ie)=>{h(Ie)&&Ve++}),Oe=s.advancer(de,(oe,Ie)=>u(Ie)?we-oe-1:oe-we,(oe,Ie)=>{u(Ie)&&we++});if(s.eachChildOf(ke,Me,(oe,Ie,Xe)=>{let st,zt,vn=oe,Tt=oe,Vr=oe;if(typeof oe=="number"){let et=oe+Ke;zt=tt(et),Tt=et+Ve;let je=oe+ye;st=Oe(je),h(a(zt))&&(st=null),vn=je+we,Vr=oe+He,o(vn>=0,"p1PickKey is negative"),o(Tt>=0,"p2DropKey is negative");const yt=h(a(Ie)),Kt=u(a(Xe));(yt||Kt&&!Vt)&&He--,yt&&ye--,Kt&&Ke--}else st=Oe(oe),zt=tt(oe);Qe.descend(vn),nt.descend(Tt);const Qn=me&&!h(a(Ie))?ce[Vr]:void 0,kt=q(st,Ie,Xe,zt,Qn,Vt,nt,Qe);var Ft,_e,xe;me&&!Vt?Qn!==kt&&(be||(ce=Array.isArray(ce)?ce.slice():Object.assign({},ce),be=!0),Ft=ce,xe=kt,typeof(_e=Vr)=="number"?(o(Array.isArray(Ft)),o(_e<Ft.length)):(o(!Array.isArray(Ft)),o(Ft[_e]!==void 0)),xe===void 0?typeof _e=="number"?Ft.splice(_e,1):delete Ft[_e]:Ft[_e]=xe):o(kt===void 0),nt.ascend(),Qe.ascend()}),Oe.end(),tt.end(),Re!=null)Re.i=ce;else if(!Gt&&!At&&dt==null)return ce}(V,V.clone(),W,W.clone(),void 0,!1,j,Ee),j.reset(),j.mergeTree(Ee.get()),j.reset(),j.get(),ee.map(q=>q.get()),te.map(q=>q.get()),V.traverse(j,(q,de)=>{const ke=q.p;if(ke!=null){const Me=Z[ke];Me!=null&&de.write("p",Me);const Se=ee[ke];Se&&Se.get(),Se&&de.mergeTree(Se.get())}else q.r!==void 0&&de.write("r",q.r)}),j.reset(),j.get(),W.traverse(j,(q,de)=>{const ke=q.d;if(ke!=null){const Se=re[ke];Se!=null&&de.write("d",Se);const Be=te[ke];Be&&de.mergeTree(Be.get())}else q.i!==void 0&&de.write("i",q.i);const Me=Y(q);Me&&!ge.has(q)&&R(de,Me,v(q))}),j.get()}function M(S){if(S==null)return null;const U=new s.ReadCursor(S),G=new s.WriteCursor;let V;const W=[],j=[];return function ee(te,k,X){const Z=te.getComponent();let re,ge=!1;if(Z){Z.p!=null&&(k.write("d",Z.p),W[Z.p]=te.clone()),Z.r!==void 0&&k.write("i",Z.r),Z.d!=null&&(k.write("p",Z.d),X=void 0),Z.i!==void 0&&(X=re=Z.i);const q=Y(Z);q&&(X===void 0?(V||(V=new Set),V.add(Z)):(v(Z),X=q.apply(X,v(Z)),ge=!0))}let Ee=0;for(const q of te){k.descend(q);const de=typeof q=="number"?q-Ee:q,ke=E(X,de);h(te.getComponent())&&Ee++;const Me=ee(te,k,ke);if(X!==void 0&&Me!==void 0){if(ge||(ge=!0,X=c(X)),!_(X,de))throw Error("Cannot modify child - invalid operation");X[de]=Me}k.ascend()}if(re===void 0)return ge?X:void 0;k.write("r",X)}(U,G,void 0),V&&(G.reset(),function ee(te,k,X){const Z=k.getComponent();if(Z){const q=Z.d;if(q!=null&&(te=W[q],X=j[q]=s.writeCursor()),V.has(Z)){const de=Y(Z);if(!de.invert)throw Error(`Cannot invert subtype ${de.name}`);R(X,de,de.invert(v(Z)))}}let re=0,ge=0;const Ee=s.advancer(te,(q,de)=>u(de)?re-q-1:q-re,(q,de)=>{u(de)&&re++});for(const q of k)if(typeof q=="number"){const de=q-ge,ke=Ee(de),Me=de+re;X.descend(Me),ee(ke,k,X),h(k.getComponent())&&ge++,X.ascend()}else X.descend(q),ee(Ee(q),k,X),X.ascend();Ee.end()}(U.clone(),U,G),j.length&&(G.reset(),U.traverse(G,(ee,te)=>{const k=ee.p;if(k!=null){const X=j[k];X&&X.get(),X&&te.mergeTree(X.get())}}))),G.get()}const T=(S,U)=>S.some(G=>typeof G=="object"&&(Array.isArray(G)?T(G,U):U(G)));function w(S,U){if(S==null||!T(S,k=>{var X;return k.r!==void 0||((X=Y(k))===null||X===void 0?void 0:X.makeInvertible)!=null}))return S;const G=new s.ReadCursor(S),V=new s.WriteCursor;let W=!1;const j=[],ee=[],te=(k,X,Z)=>{const re=k.getComponent();let ge=!1;if(re){re.d!=null&&X.write("d",re.d),re.i!==void 0&&X.write("i",re.i);const q=re.p;if(q!=null&&(j[q]=k.clone(),o(Z!==void 0,"Operation picks up at an invalid key"),ee[q]=Z,X.write("p",re.p)),re.r!==void 0&&Z===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const de=Y(re);de&&(de.makeInvertible?W=!0:R(X,de,v(re),!0))}let Ee=0;for(const q of k){X.descend(q);const de=typeof q=="number"?q-Ee:q,ke=E(Z,de),Me=te(k,X,ke);ke!==Me&&(ge||(ge=!0,Z=c(Z)),Me===void 0?(Z=d(Z,de),typeof q=="number"&&Ee++):Z[de]=Me),X.ascend()}return re&&(re.r!==void 0?(X.write("r",r.default(Z)),Z=void 0):re.p!=null&&(Z=void 0)),Z};return te(G,V,U),V.get(),W&&(V.reset(),function k(X,Z,re,ge,Ee){const q=Z.getComponent();if(q){q.i!==void 0?(ge=q.i,Ee=!0):q.d!=null&&(ge=ee[q.d],X=j[q.d],Ee=!1,q.d);let Se=Y(q);if(Se&&Se.makeInvertible){const Be=v(q);R(re,Se,Se.makeInvertible(Be,ge),!0)}}let de=0,ke=0;const Me=s.advancer(X,(Se,Be)=>u(Be)?de-Se-1:Se-de,(Se,Be)=>{u(Be)&&de++});for(const Se of Z)if(typeof Se=="number"){const Be=Se-ke,Gt=Me(Be),nt=Be+de,Qe=E(ge,Ee?Be:nt);re.descend(Se),k(Gt,Z,re,Qe,Ee),h(Z.getComponent())&&ke++,re.ascend()}else{const Be=E(ge,Se);re.descend(Se),k(Me(Se),Z,re,Be,Ee),re.ascend()}Me.end()}(G.clone(),G,V,U,!1)),V.get()}function N(S,U){return M(w(S,U))}const D=S=>{if(S==null)return null;const U=S.slice();for(let G=0;G<S.length;G++){const V=U[G];Array.isArray(V)&&(U[G]=D(V))}return U};function L(S,U,G){o(G==="left"||G==="right","Direction must be left or right");const V=G==="left"?0:1;if(U==null)return{ok:!0,result:S};B(S),B(U);let W=null;const j=[],ee=[],te=[],k=[],X=[],Z=[],re=[],ge=[],Ee=[],q=[],de=[],ke=[],Me=[],Se=[],Be=[];let Gt=0;const nt=s.readCursor(S),Qe=s.readCursor(U),$e=s.writeCursor();if(function Ae(ce,Re=null,he){const ie=a(Re);ie&&(ie.r!==void 0?he=Re.clone():ie.p!=null&&(he=null,Z[ie.p]=ce.clone()));const me=ce.getComponent();let be;me&&(be=me.p)!=null&&(X[be]=Re?Re.clone():null,te[be]=ce.clone(),he&&(q[be]=!0,Ee[be]=he),ie&&ie.p!=null&&(Se[be]=ie.p));const we=s.advancer(Re);for(const ye of ce)Ae(ce,we(ye),he);we.end()}(Qe,nt,null),function Ae(ce,Re,he,ie,me){const be=he.getComponent();let we,ye=!1;be&&((we=be.d)!=null?(k[we]=he.clone(),ie!=null&&(Be[ie]==null&&(Be[ie]=[]),Be[ie].push(we)),q[we],ce=X[we]||null,Re=te[we]||null,q[we]?(me&&(de[we]=!0),me=Ee[we]||null):!me||V!==1&&Se[we]!=null||W==null&&(W={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(me.getPath()),op2:e.moveOp(Re.getPath(),he.getPath())}),ye=!0):be.i!==void 0&&(ce=Re=null,ye=!0,me&&W==null&&(W={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(me.getPath()),op2:e.insertOp(he.getPath(),be.i)})));const Ke=a(ce);Ke&&(Ke.r!==void 0?me=ce.clone():Ke.p!=null&&(Ke.p,ie=Ke.p,me=null));const Ve=Y(be);Ve&&me&&W==null&&(W={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(me.getPath()),op2:e.editOp(he.getPath(),Ve,v(be),!0)});let He=0,tt=0;const Oe=s.advancer(Re,(Ie,Xe)=>u(Xe)?He-Ie-1:Ie-He,(Ie,Xe)=>{u(Xe)&&He++}),oe=s.advancer(ce);for(const Ie of he)if(typeof Ie=="number"){const Xe=Ie-tt,st=Oe(Xe);tt+=+Ae(oe(Xe+He),st,he,ie,me)}else{const Xe=Oe(Ie);Ae(oe(Ie),Xe,he,ie,me)}return Oe.end(),oe.end(),ye}(nt,Qe,Qe.clone(),null,null),k.map(Ae=>Ae&&Ae.get()),W)return{ok:!1,conflict:W};de.map(Ae=>!!Ae);const Rt=[];let At=null;(function Ae(ce,Re,he,ie,me){let be=!1;const we=a(Re);if(u(we)){const Oe=we.p;Oe!=null?(he=k[Oe],ie=ke[Oe]=s.writeCursor(),be=!0,me=null):(he=null,me=Re.clone())}else h(a(he))&&(he=null);const ye=ce.getComponent();if(ye){const Oe=ye.p;Oe!=null?(me&&(ge[Oe]=me),Rt[Oe]=me||V===1&&be?null:ie.getComponent(),j[Oe]=ce.clone(),he&&(re[Oe]=he.clone())):ye.r!==void 0&&(me||ie.write("r",!0),(me||be)&&(At==null&&(At=new Set),At.add(ye)))}let Ke=0,Ve=0;const He=s.advancer(Re,void 0,(Oe,oe)=>{u(oe)&&Ke++}),tt=s.advancer(he,(Oe,oe)=>h(oe)?~(Oe-Ve):Oe-Ve,(Oe,oe)=>{h(oe)&&Ve++});if(ce)for(const Oe of ce)if(typeof Oe=="string"){const oe=He(Oe),Ie=tt(Oe);ie.descend(Oe),Ae(ce,oe,Ie,ie,me),ie.ascend()}else{const oe=He(Oe),Ie=Oe-Ke,Xe=u(a(oe))?null:tt(Ie),st=Ie+Ve;o(st>=0),ie.descend(st),Ae(ce,oe,Xe,ie,me),ie.ascend()}He.end(),tt.end()})(nt,Qe,Qe.clone(),$e,null),$e.reset();let On=[];if(function Ae(ce,Re,he,ie,me,be){o(Re);const we=Re.getComponent();let ye=a(ie),Ke=!1;const Ve=(_e,xe,et)=>_e?e.moveOp(_e.getPath(),xe.getPath()):e.insertOp(xe.getPath(),et.i);if(h(we)){const _e=we.d;_e!=null&&(ee[_e]=Re.clone());const xe=_e!=null?Rt[_e]:null;let et=!1;if(we.i!==void 0||_e!=null&&xe){let je;ye&&(ye.i!==void 0||(je=ye.d)!=null&&!q[je])&&(et=je!=null?_e!=null&&_e===Se[je]:n.default(ye.i,we.i),et||je!=null&&V!==1&&Se[je]!=null||W==null&&(W={type:i.ConflictType.DROP_COLLISION,op1:Ve(_e!=null?j[_e]:null,Re,we),op2:Ve(je!=null?te[je]:null,ie,ye)})),et||(be?W==null&&(W={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Ve(_e!=null?j[_e]:null,Re,we),op2:e.removeOp(be.getPath())}):(_e!=null?(On[Gt]=_e,me.write("d",xe.p=Gt++)):me.write("i",r.default(we.i)),Ke=!0))}else if(_e!=null&&!xe){const je=ge[_e];je&&(be=je.clone())}_e!=null?(ce=j[_e],he=Z[_e],ie=re[_e]):we.i!==void 0&&(ce=he=null,et||(ie=null))}else u(a(ce))&&(ce=he=ie=null);const He=a(ce),tt=a(he);if(u(tt)){const _e=tt.p;tt.r!==void 0&&(!He||He.r===void 0)||q[_e]?(ie=null,be=he.clone()):_e!=null&&(ie=k[_e],V!==1&&Se[_e]!=null||((me=Me[_e])||(me=Me[_e]=s.writeCursor()),me.reset(),be=null))}else!h(we)&&h(ye)&&(ie=null);ye=ie!=null?ie.getComponent():null;const Oe=Y(we);if(Oe){const _e=v(we);if(be)W==null&&(W={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(Re.getPath(),Oe,_e,!0),op2:e.removeOp(be.getPath())});else{const xe=Y(ye);let et;if(xe){if(Oe!==xe)throw Error("Transforming incompatible types");const je=v(ye);et=Oe.transform(_e,je,G)}else et=r.default(_e);R(me,Oe,et)}}let oe=0,Ie=0,Xe=0,st=0,zt=0,vn=0,Tt=ce!=null&&ce.descendFirst(),Vr=Tt;const Qn=s.advancer(he,void 0,(_e,xe)=>{u(xe)&&Xe++});let kt=ie!=null&&ie.descendFirst(),Ft=kt;for(const _e of Re)if(typeof _e=="number"){let xe;const et=h(Re.getComponent()),je=_e-Ie;{let ln;for(;Tt&&typeof(ln=ce.getKey())=="number";){ln+=oe;const Nt=ce.getComponent(),er=u(Nt);if(ln>je||ln===je&&(!er||V===0&&et))break;if(er){oe--;const wn=Nt.p;Se.includes(wn),Nt.d,a(Me[Nt.d]),u(a(Me[Nt.d])),(Nt.r===void 0||At&&At.has(Nt))&&(wn==null||!Rt[wn]||V!==1&&Se.includes(wn))||zt--}Tt=ce.nextSibling()}xe=Tt&&ln===je?ce:null}const yt=je-oe;let Kt=Qn(yt);const ha=yt-Xe;let qs=null;{let ln,Nt;for(;kt&&typeof(ln=ie.getKey())=="number";){Nt=ln-st;const er=ie.getComponent(),wn=h(er);if(Nt>ha)break;if(Nt===ha){if(!wn){qs=ie;break}{if(V===0&&et){qs=ie;break}const cn=Kt&&u(Kt.getComponent());if(V===0&&cn)break}}if(wn){const cn=er.d;q[cn],Se[cn],er.i===void 0&&(q[cn]||Se[cn]!=null&&V!==1)?(q[cn]||Se[cn]!=null&&V===0)&&(st++,vn--):st++}kt=ie.nextSibling()}}const gd=ha+st+zt+vn;o(gd>=0,"trying to descend to a negative index"),me.descend(gd),et&&(xe=Kt=qs=null,Ie++),Ae(xe,Re,Kt,qs,me,be)&&vn++,me.ascend()}else{let xe;for(;Tt&&(xe=ce.getKey(),typeof xe!="string"||!(xe>_e||xe===_e));)Tt=ce.nextSibling();const et=Tt&&xe===_e?ce:null,je=Qn(_e);let yt;for(;kt&&(yt=ie.getKey(),typeof yt!="string"||!(yt>_e||yt===_e));)kt=ie.nextSibling();const Kt=kt&&yt===_e?ie:null;me.descend(_e),Ae(et,Re,je,Kt,me,be),me.ascend()}return Qn.end(),Vr&&ce.ascend(),Ft&&ie.ascend(),Ke}(nt,nt.clone(),Qe,Qe.clone(),$e,null),W)return{ok:!1,conflict:W};$e.reset();const It=(Ae,ce,Re)=>Ae.traverse(ce,(he,ie)=>{he.d!=null&&Re(he.d,Ae,ie)});(q.length||ke.length)&&(It(Qe,$e,(Ae,ce,Re)=>{q[Ae]&&!de[Ae]&&Re.write("r",!0),ke[Ae]&&Re.mergeTree(ke[Ae].get())}),$e.reset());const dt=[],Vt=[];if((Me.length||q.length)&&!W){const Ae=s.readCursor(D($e.get()));if(It(Ae,null,(ce,Re)=>{dt[ce]=Re.clone()}),Me.forEach(ce=>{ce&&It(s.readCursor(ce.get()),null,(Re,he)=>{dt[Re]=he.clone()})}),function ce(Re,he,ie,me,be,we){const ye=a(he);if(ye&&u(ye))if(ye.p!=null){const oe=ye.p;dt[oe].getPath(),ie=dt[oe],me=Vt[oe]=s.writeCursor()}else ye.r!==void 0&&(ie=null);else h(a(ie))&&(ie=null);const Ke=Re.getComponent();if(Ke){let oe;if((oe=Ke.d)!=null){const Ie=Me[oe];Ie&&(Ie.get(),me.mergeTree(Ie.get()),ie=s.readCursor(Ie.get()))}}let Ve=0,He=0;const tt=s.advancer(he,void 0,(oe,Ie)=>{u(Ie)&&Ve--}),Oe=s.advancer(ie,(oe,Ie)=>h(Ie)?-(oe-He)-1:oe-He,(oe,Ie)=>{h(Ie)&&He++});for(const oe of Re)if(typeof oe=="number"){const Ie=tt(oe),Xe=oe+Ve,st=Oe(Xe),zt=Xe+He;me.descend(zt),ce(Re,Ie,st,me),me.ascend()}else me.descend(oe),ce(Re,tt(oe),Oe(oe),me),me.ascend();tt.end(),Oe.end()}(Qe,Ae,Ae.clone(),$e),$e.reset(),W)return{ok:!1,conflict:W};if($e.get(),Vt.length){const ce=Vt.map(he=>he?he.get():null),Re=s.readCursor(D($e.get()));if(It(Re,$e,(he,ie,me)=>{const be=ce[he];be&&(me.mergeTree(be),ce[he]=null)}),ce.find(he=>he)){const he=s.writeCursor(),ie=s.writeCursor();let me=0,be=0;ce.forEach(we=>{we!=null&&It(s.readCursor(we),null,ye=>{const Ke=On[ye];he.writeMove(j[Ke].getPath(),ee[Ke].getPath(),me++);const Ve=Be[Ke];Ve&&Ve.forEach(He=>{q[He]||V!==1&&Se[He]!=null||ie.writeMove(te[He].getPath(),k[He].getPath(),be++)})})}),W={type:i.ConflictType.BLACKHOLE,op1:he.get(),op2:ie.get()}}}}return W?{ok:!1,conflict:W}:{ok:!0,result:$e.get()}}const F=S=>{const U=new Error("Transform detected write conflict");throw U.conflict=S,U.type=U.name="writeConflict",U};function Q(S,U,G){const V=L(S,U,G);if(V.ok)return V.result;F(V.conflict)}const z=S=>{const U=s.writeCursor();return s.readCursor(S).traverse(U,(G,V)=>{(h(G)||Y(G))&&V.write("r",!0)}),U.get()},le=(S,U)=>{const{type:G,op1:V,op2:W}=S;switch(G){case i.ConflictType.DROP_COLLISION:return U==="left"?[null,z(W)]:[z(V),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let j=!1;return s.readCursor(V).traverse(null,ee=>{ee.r!==void 0&&(j=!0)}),j?[null,z(W)]:[z(V),null];case i.ConflictType.BLACKHOLE:return[z(V),z(W)];default:throw Error("Unrecognised conflict: "+G)}};function ue(S,U,G,V){let W=null;for(;;){const j=L(U,G,V);if(j.ok)return O(W,j.result);{const{conflict:ee}=j;S(ee)||F(ee);const[te,k]=le(ee,V);U=O($(U),te),G=O($(G),k),W=O(W,k)}}}}(Mr)),Mr}var ku;function E0(){return ku||(ku=1,function(e){var t=En&&En.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=En&&En.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(p0(),e);var r=Tu();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Nu();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(En)),En}var at=E0();const C0=_d({__proto__:null,default:gt(at)},[at]);var J=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(J||{});function Dr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&K.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();tl(r,a)&&K.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Fu(e,t,n,r){var c;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(c=t.textRuns)!=null?c:[];if(l.length)for(const u of l)u.st+=r,u.ed+=r;for(let u=0;u<o;u++){const h=s[u],{st:d,ed:m}=h;if(m<=r)i.push(h);else if(r>d&&r<m){a=!0;const _={...h,ed:r};i.push(_),l.length&&i.push(...l);const E={...h,st:r+n,ed:m+n};i.push(E)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=Dr(i)}function xu(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,c=s.length;l<c;l++){const u=s[l],{startIndex:h}=u;h>=r&&(u.startIndex+=n),o.push(u.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const u=i[l];u.startIndex+=r;const h=u.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(br("startIndex"))}}function Bu(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(br("startIndex"))}}function $u(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(br("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Hu(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c,endIndex:u}=l;c>r?(l.startIndex+=n,l.endIndex+=n):u>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(br("startIndex"))}}const Wu="$",ju=e=>e.split(Wu)[0];function Po(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=ju(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=ju(i.rangeId),i.rangeId===n.rangeId&&vu(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Wu}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function ko(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Yu(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Fo(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function R0(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;ko(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=Po(s)}function I0(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Fo(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Yu(s)}function Gu(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{st:h,ed:d}=u;if(s<=h&&i>=d){o.push({...u,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...u,st:s-s,ed:i-s}),u.ed-=t):s>=h&&s<d?(o.push({...u,st:s-s,ed:d-s}),u.ed=s):i>h&&i<=d?(o.push({...u,st:h-s,ed:i-s}),u.st=i-t,u.ed-=t):h>=i&&(u.st-=t,u.ed-=t);a.push(u)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Vu(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<i){o.push({...u,startIndex:h-n});continue}else h>=i&&(u.startIndex-=t);a.push(u)}e.paragraphs=a}return o}function zu(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.sectionBreaks=a}return o}function Ku(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Xu(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(s<=h&&i>=d){o.push({...u,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const m=gs(h,d,s,i);if(m.length===0||(u.startIndex=m[0],u.endIndex=m[1],u.startIndex===u.endIndex))continue}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.tables=a}return o}function S0(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(h>=s&&d<=i){o.push(u);continue}else if(Math.max(s,h)<=Math.min(i,d)){const m=gs(h,d,s,i);if(m.length===0)continue;u.startIndex=m[0],u.endIndex=m[1]}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.customRanges=Po(a)}return o}function O0(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,u=s.length;c<u;c++){const h=s[c],{startIndex:d,endIndex:m}=h;if(d>=i&&m<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,m)){const _=gs(d,m,i,o);if(_.length===0)continue;h.startIndex=_[0],h.endIndex=_[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var qu=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(qu||{}),Pt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Pt||{});const Hs={"a)":{glyphFormat:"%1)",glyphType:fe.DECIMAL},"1.":{glyphType:fe.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:fe.LOWER_LETTER},"A.":{glyphType:fe.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:fe.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER}},Yn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Sr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Gn=e=>e.map((t,n)=>({...t,bulletAlignment:Sr.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Zu=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Sr.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),Lr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Yn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Yn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Yn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Yn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Yn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Yn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:Gn([{glyphFormat:"%1.",glyphType:fe.DECIMAL},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:Gn([{glyphFormat:"%1)",glyphType:fe.DECIMAL},{glyphFormat:"%2)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:fe.DECIMAL},{glyphFormat:"%5)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:fe.DECIMAL},{glyphFormat:"%8)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9)",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:Gn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:fe.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:Gn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:Gn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.DECIMAL},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.DECIMAL},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.DECIMAL},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:Gn([{glyphFormat:"%1.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Zu("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Zu("☑",{st:{s:ae.TRUE}})}},Ws=e=>{const{glyphFormat:t,glyphType:n}=e,r=K.deepClone(Lr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},v0={ORDER_LIST_QUICK_2:Ws(Hs["a)"]),ORDER_LIST_QUICK_3:Ws(Hs["a."]),ORDER_LIST_QUICK_4:Ws(Hs["i."]),ORDER_LIST_QUICK_6:Ws(Hs["I."])};Object.assign(Lr,v0);const w0={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function b0(e,t,n,r,s){const i=A0(e,t,n,r,s),o=T0(e,t,n,r,s),a=y0(e,t,n,r,s),l=N0(e,t,n,r,s),c=M0(e,t,n,r,s),u=D0(e,t,n,r),h=L0(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:u,customDecorations:h}}function A0(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Gu(e,n,r);if(s!==Ce.REPLACE){const l=Ju(o,a,s);t.textRuns=l}return Fu(e,t,n,r),a}function Ju(e,t,n){if(t.length===0)return e;e=K.deepClone(e),t=K.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function c(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:m,ed:_,ts:E}=e[o],{st:I,ed:A,ts:H,sId:x}=t[a];let Y;if(n===Ce.COVER?Y={...H,...E}:Y={...E},_<I)c()||r.push(e[o]),o++;else if(A<m)c()||r.push(t[a]),a++;else{const v={st:Math.min(m,I),ed:Math.max(m,I),ts:m<I?{...E}:{...H},sId:m<I?void 0:x};v.ed>v.st&&r.push(v),r.push({st:Math.max(m,I),ed:Math.min(_,A),ts:Y,sId:x}),_<A?(o++,t[a].st=_,t[a].st===t[a].ed&&a++):(a++,e[o].st=A,e[o].st===e[o].ed&&o++);const R={st:Math.min(_,A),ed:Math.max(_,A),ts:_<A?{...H}:{...E},sId:_<A?x:void 0};l=R.ed>R.st?R:null}}c();const u=r[r.length-1],h=e[s-1],d=t[i-1];return u&&u.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),Dr(r)}function T0(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Vu(e,n,r);if(s!==Ce.REPLACE){const l=[];for(const c of o){const{startIndex:u,paragraphStyle:h,bullet:d}=c;let m=[];for(const _ of a){const{startIndex:E,paragraphStyle:I,bullet:A}=_;let H,x;if(s===Ce.COVER?(H={...I,...h},x={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...A,...d}):(H={...h,...I},x={listId:"",listType:Pt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...A}),u===E){m.push({startIndex:u,paragraphStyle:H,bullet:x});break}}l.push(...m),m=[]}t.paragraphs=l}return xu(e,t,n,r),a}function y0(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=zu(e,n,r);if(s!==Ce.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:m}=d;if(u===m){s===Ce.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Bu(e,t,n,r),a}function N0(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Ku(e,n,r);if(s!==Ce.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:m}=d;if(u===m){s===Ce.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return $u(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function M0(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Xu(e,n,r);if(s!==Ce.REPLACE){const l=[];for(const c of o){const{startIndex:u,endIndex:h}=c;let d=[];for(const m of a){const{startIndex:_,endIndex:E}=m;if(_>=u&&E<=h){s===Ce.COVER?d.push({...m,...c}):d.push({...c,...m});break}}l.push(...d),d=[]}t.tables=l}return Hu(e,t,n,r),a}function D0(e,t,n,r,s){e.customRanges||(e.customRanges=[]),ko(e.customRanges,r),ko(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:m}=h;d>=i&&m<=o?c.set(h.rangeId,h):l.push(h)});const u=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:m}=h;l.push({...h,startIndex:d+r,endIndex:m+r})}),e.customRanges=Po(l),u):[]}function L0(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Fo(e.customDecorations,r),Fo(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Ce.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:u,endIndex:h}=c;u>=r&&h<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:u}=l;o.push({...l,startIndex:c+r,endIndex:u+r})})}else for(const l of a){const{id:c}=l;if(l.type===gn.DELETED){const u=o.filter(h=>h.id===c);u.length&&i.push(...u)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,u=o.findIndex(h=>h.id===c);u!==-1&&o.splice(u,1)}return e.customDecorations=Yu(o),i}var xo=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(xo||{});function js(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=K.deepClone(o),{st:l,ed:c}=a;K.hasIntersectionBetweenTwoRanges(l,c,t,n)&&(t>=l&&t<=c?i.push({...a,st:t,ed:Math.min(n,c)}):n>=l&&n<=c?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return Dr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Qu(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=K.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function eh(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=K.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function U0(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(K.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function th(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(K.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function wt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=js(e,t,n,r);const a=Qu(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=eh(e,t,n),s===1){const c=rh(e,t,n);c?o.customDecorations=c:r&&(o.customDecorations=[])}const{customRanges:l}=nh(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=th(e,t,n),o}function P0(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(u=>{u.startIndex<0&&(a=Math.max(a,-u.startIndex)),u.endIndex>t.length-1&&(l=Math.max(l,u.endIndex-t.length+1))});const c=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(u=>{u.st+=a,u.ed+=a}),r==null||r.forEach(u=>{u.startIndex+=a}),s==null||s.forEach(u=>{u.startIndex+=a,u.endIndex+=a}),i==null||i.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),o==null||o.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function nh(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function rh(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=K.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function k0(e,t,n){return e==null||t==null?e!=null?e:t:Ju(e,t,n)}function F0(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Ce.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function x0(e,t,n){return t.length===0||e.length===0||n===Ce.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Bo(e,t,n=Ce.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:c=[],customRanges:u,customDecorations:h=[]}=t;r.textRuns=k0(l,s,n),r.customRanges=F0(u,o,n);const d=x0(h,a,n);d.length&&(r.customDecorations=d);const m=[];let _=0,E=0;for(;_<i.length&&E<c.length;){const I=i[_],A=c[E],{startIndex:H}=I,{startIndex:x}=A;H===x?(m.push(K.deepMerge(I,A)),_++,E++):H<x?(m.push(K.deepClone(I)),_++):(m.push(K.deepClone(A)),E++)}return _<i.length&&m.push(...i.slice(_)),E<c.length&&m.push(...c.slice(E)),m.length&&(r.paragraphs=m),r}function B0(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Vn{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===J.DELETE||n.t===J.RETAIN&&n.body==null?K.deepClone({...n,len:t}):K.deepClone({...n,len:t,body:wt(n.body,r,r+t,!1)})}else return{t:J.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 t=this._actions[this._index];return t?t.t:J.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class Rn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function sh(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Gu(e,t,n),a=Vu(e,t,n),l=zu(e,t,n),c=Ku(e,t,n),u=Xu(e,t,n),h=S0(e,t,n),d=O0(e,t,n);let m="";return r&&(e.dataStream=fl(r,s,i),m=r.slice(s,i)),{dataStream:m,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:u,customRanges:h,customDecorations:d}}function ih(e,t,n,r){e.dataStream=dl(e.dataStream,r,t.dataStream),Fu(e,t,n,r),xu(e,t,n,r),Bu(e,t,n,r),$u(e,t,n,r),Hu(e,t,n,r),R0(e,t,n,r),I0(e,t,n,r)}function $0(e,t,n,r,s=Ce.COVER){return b0(e,t,n,r,s)}function H0(e,t,n){return t<=0?{dataStream:""}:sh(e,t,n)}function W0(e,t,n,r){n!==0&&ih(e,t,n,r)}function j0(e,t){const n=new Rn;return n.reset(),t.forEach(r=>{const s=K.deepClone(r);switch(s.t){case J.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&$0(e,o,a,n.cursor,i),n.moveCursor(a);break}case J.INSERT:{const{body:i,len:o}=s;W0(e,i,o,n.cursor),n.moveCursor(o);break}case J.DELETE:{const{len:i}=s;H0(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function Y0(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=K.deepClone(t),e=K.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,u=null;function h(){return u?(i.push(u),u=null,!0):!1}for(;l<o&&c<a;){const{st:E,ed:I,ts:A}=t[l],{st:H,ed:x,ts:Y,sId:v}=e[c];let R={};if(s===0)R={...A},n===Ce.COVER&&r===Ce.REPLACE&&Y&&(R=Object.assign({},Y,R));else if(R={...A},n===Ce.REPLACE){if(r===Ce.REPLACE)R={...Y};else if(A&&Y){const b=Object.keys(A);for(const y of b)Y[y]&&delete R[y]}}else if(r===Ce.REPLACE){if(Y){const b=Object.keys(Y);for(const y of b)Y[y]!==void 0&&(R[y]=Y[y])}}else if(Y){const b=Object.keys(Y);for(const y of b)R[y]!==void 0&&delete R[y]}if(I<H)h()||i.push(t[l]),l++;else if(x<E)h()||i.push(e[c]),c++;else{const b={st:Math.min(E,H),ed:Math.max(E,H),ts:E<H?{...A}:{...Y}};b.ed>b.st&&i.push(),i.push({st:Math.max(E,H),ed:Math.min(I,x),ts:R,sId:v}),I<x?(l++,e[c].st=I,e[c].st===e[c].ed&&c++):(c++,t[l].st=x,t[l].st===t[l].ed&&l++);const y={st:Math.min(I,x),ed:Math.max(I,x),ts:I<x?{...Y}:{...A},sId:I<x?v:void 0};u=y.ed>y.st?y:null}}h();const d=i[i.length-1],m=t[o-1],_=e[a-1];return d.ed!==Math.max(m.ed,_.ed)&&(m.ed>_.ed?i.push(m):i.push(_)),Dr(i,!0)}function G0(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Ce.REPLACE)return s===1?[K.deepClone(i)]:[K.deepClone(o)];if(r===Ce.REPLACE){const a=K.deepClone(o);return s===1&&Object.assign(a,K.deepClone(i)),[a]}else{const a=K.deepClone(o);return s===1&&Object.assign(a,K.deepClone(i)),[a]}}function oh(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=K.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Ce.REPLACE)if(r===Ce.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Ce.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Ce.REPLACE&&r===Ce.REPLACE?i.bullet=s===1?K.deepClone(e.bullet):K.deepClone(t.bullet):e.bullet===void 0?i.bullet=K.deepClone(t.bullet):n===Ce.REPLACE||r===Ce.REPLACE?i.bullet=s===0&&t.bullet?K.deepClone(t.bullet):K.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=K.deepClone(t.bullet)),i}function V0(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return K.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===gn.DELETED||i===gn.DELETED)&&(o=!0,n.push({...r,type:gn.DELETED}));break}o||n.push(r)}return n}function z0(e,t,n=!1){const{body:r,coverType:s=Ce.COVER}=e,{body:i,coverType:o=Ce.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:c,paragraphs:u=[],customRanges:h,customDecorations:d}=r,{textRuns:m,paragraphs:_=[],customRanges:E,customDecorations:I}=i,A=Y0(c,m,s,o,n?1:0);A&&(a.textRuns=A);const H=G0(h,E,s,o,n?1:0);H&&(a.customRanges=H);const x=V0(d,I);x&&(a.customDecorations=x);const Y=[];let v=0,R=0;for(;v<u.length&&R<_.length;){const b=u[v],y=_[R],{startIndex:B}=b,{startIndex:$}=y;if(B===$){let g={startIndex:B};n?g=oh(b,y,s,o,1):g=oh(b,y,s,o,0),Y.push(g),v++,R++}else B<$?v++:(Y.push(K.deepClone(y)),R++)}return R<_.length&&Y.push(..._.slice(R)),Y.length&&(a.paragraphs=Y),{coverType:l,body:a}}function ah(e){return Object.keys(e).length===1}const Zn=class Zn{constructor(){C(this,"_actions",[])}static apply(t,n){return j0(t,n)}static compose(t,n){const r=new Vn(t),s=new Vn(n),i=new Zn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===J.INSERT)i.push(s.next());else if(r.peekType()===J.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===J.INSERT&&l.t===J.RETAIN)l.body==null?i.push(a):i.push({...a,body:Bo(a.body,l.body,l.coverType)});else if(a.t===J.RETAIN&&l.t===J.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const c=a.coverType===Ce.REPLACE||l.coverType===Ce.REPLACE?Ce.REPLACE:Ce.COVER;i.push({...a,t:J.RETAIN,coverType:c,body:Bo(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===J.RETAIN&&l.t===J.DELETE?i.push(l):a.t===J.INSERT&&(l.t,J.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Vn(t),i=new Vn(n),o=new Zn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===J.INSERT&&(r==="left"||i.peekType()!==J.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===J.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),c=i.next(a);if(l.t===J.DELETE)continue;if(c.t===J.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:u,body:h}=z0(l,c,r==="left");o.push({...c,t:J.RETAIN,coverType:u,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Vn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===J.DELETE){n-=Math.min(o,n-i);continue}else a===J.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===J.INSERT)n.push({t:J.DELETE,len:r.len,body:r.body});else if(r.t===J.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:J.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:J.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Ce.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===J.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=wt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===J.RETAIN&&i.body!=null){const o=wt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==J.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:J.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:J.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:J.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=K.deepClone(t[0]);if(s.t===J.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===J.DELETE&&s.t===J.DELETE)return r.len+=s.len,this;if(r.t===J.DELETE&&s.t===J.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===J.RETAIN&&s.t===J.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===J.INSERT&&ah(r.body)&&s.t===J.INSERT&&ah(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===J.RETAIN&&B0(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(Zn,"id","text-x"),C(Zn,"uri","https://github.com/dream-num/univer#text-x");let Ne=Zn;Object.defineProperty(Ne,"name",{value:"text-x"});const Jn=class Jn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ne.id||(this._subTypes.set(t.name,t),at.type.registerSubtype(t))}static apply(t,n){if(!at.type.isNoop(n))return at.type.apply(t,n)}static compose(t,n){return at.type.compose(t,n)}static transform(t,n,r){return at.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ne.name?Ne.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return at.type.invertWithDoc(t,n)}static isNoop(t){return at.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Jn),this._instance}removeOp(t,n){return at.removeOp(t,n)}moveOp(t,n){return at.moveOp(t,n)}insertOp(t,n){return at.insertOp(t,n)}replaceOp(t,n,r){return at.replaceOp(t,n,r)}editOp(t,n=["body"]){return at.editOp(n,Ne.name,t)}};C(Jn,"uri","https://github.com/dream-num/univer#json-x"),C(Jn,"_subTypes",new Map),C(Jn,"_instance",null);let jt=Jn;jt.registerSubtype(Ne);const $o={id:"default_doc",documentStyle:{}};class K0 extends Fs{constructor(n){var r;super();C(this,"type",ve.UNIVER_DOC);C(this,"_name$",new se.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...$o,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...Lr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,c=s==null?void 0:s[n];if(!c)return;const u=c.docTransform;u.size.width=i,u.size.height=o,u.positionH.posOffset=a,u.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class bt extends K0{constructor(n){var s,i;super(K.isEmptyObject(n)?d0():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new se.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:K.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...$o,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!jt.isNoop(n))return this.snapshot=jt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=xo.copy){const i=this.getBody();if(i!=null)return wt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new bt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new bt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Ms((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function X0(e){const{ranges:t,id:n,type:r}=e,s=new Ne;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:c}=a;l>0&&s.push({t:J.RETAIN,len:l-i}),s.push({t:J.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function q0(e){var u,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(u=r.getSelfOrHeaderFooterModel(n))==null?void 0:u.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(m=>m.id===t);if(!i)return!1;const o=new Ne,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:J.RETAIN,len:a}),o.push({t:J.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:gn.DELETED}]}}),o}function lh(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function Z0(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):lh(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function J0(e){return{...K.deepClone(e),rangeId:$t()}}function Q0(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function ch(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function eC(e,t){var i,o,a,l,c;const n=ch(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((c=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?c:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function tC(e){var h,d,m;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(_=>_.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ne,c=a-o+1;l.push({t:J.RETAIN,len:o}),l.push({t:J.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:J.INSERT,body:s,len:s.dataStream.length});const u=a+1+((m=s==null?void 0:s.dataStream.length)!=null?m:0);return l.selections=[{startOffset:u,endOffset:u,collapsed:!0}],l}function nC(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ne;let c=!1;return t.forEach(u=>{var x,Y,v;const h=eC(u,o);if(!h||!o)return!1;const{startOffset:d,endOffset:m}=h,_=(x=o.customRanges)!=null?x:[],E=(R,b,y)=>{var O,M,T,w;const B=ch(R,b,_,r),$=Math.min((M=(O=B[0])==null?void 0:O.startIndex)!=null?M:1/0,R),g=Math.max((w=(T=B[B.length-1])==null?void 0:T.endIndex)!=null?w:-1/0,b),P={rangeId:y?`${n}$${y}`:n,rangeType:r,startIndex:0,endIndex:g-$,wholeEntity:s,properties:{...i}};l.push({t:J.RETAIN,len:$-a}),l.push({t:J.RETAIN,len:g-$+1,body:{dataStream:"",customRanges:[P]},coverType:Ce.COVER}),a=g+1},I=((Y=o.paragraphs)!=null?Y:[]).filter(R=>R.startIndex<m&&R.startIndex>d),A=((v=o.customBlocks)!=null?v:[]).filter(R=>R.startIndex<m&&R.startIndex>d);Q0([d,m-1],[...I.map(R=>R.startIndex),...A.map(R=>R.startIndex)]).forEach(([R,b],y)=>E(R,b,y)),c=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),c?l:!1}function uh(e,t,n=0,r=null,s=!0){e.sort((c,u)=>c.startOffset-u.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(c=>c.startIndex>=e[0].startOffset&&c.startIndex<e[0].endOffset);let l=n;if(e.forEach(c=>{const{startOffset:u,endOffset:h}=c;u>l&&(i.push({t:J.RETAIN,len:u-l}),l=u),l<h&&(i.push({t:J.DELETE,len:h-l}),l=h)}),r&&i.push({t:J.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(u=>u.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:J.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Ce.REPLACE}))}return i}function rC(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:J.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:J.RETAIN,len:a-s,body:{...K.deepClone(t),dataStream:""}}),s=a)}),r}const sC=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:wt(i,t.startOffset,t.endOffset),a=bo(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,m])=>{switch(d){case 0:{const _={t:J.RETAIN,body:{...wt(n,l,l+m.length,!1),dataStream:""},len:m.length};return l+=m.length,_}case 1:{const _={t:J.INSERT,body:wt(n,l,l+m.length),len:m.length};return l+=m.length,_}default:return{t:J.DELETE,len:m.length}}}),u=new Ne;return u.push({t:J.RETAIN,len:t.startOffset}),u.push(...c),u};function iC(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const oC=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:wt(i,t.startOffset,t.endOffset),a=bo(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,m])=>{switch(d){case 0:{const _=js(n,l,l+m.length,!1),E=js(o,l,l+m.length,!1),I={t:J.RETAIN,body:iC(_,E)?void 0:{textRuns:_,dataStream:""},len:m.length};return l+=m.length,I}case 1:{const _={t:J.INSERT,body:wt(n,l,l+m.length),len:m.length};return l+=m.length,_}default:return{t:J.DELETE,len:m.length}}});if(c.every(d=>d.t===J.RETAIN&&!d.body))return!1;const u=new Ne;return u.push({t:J.RETAIN,len:t.startOffset}),u.push(...c),u};function aC(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function lC(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const cC=e=>{var E,I,A,H;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ne,l=jt.getInstance(),c=[],u=n.getSelfOrHeaderFooterModel(o).getBody();if(!u)return!1;const h=(I=(E=n.getSnapshot().drawingsOrder)==null?void 0:E.length)!=null?I:0;let d=0;if(s)i>0&&a.push({t:J.RETAIN,len:i});else{const x=uh([t],u,0,null,!1);a.push(...x);const Y=aC(u,[t]),v=(A=n.getDrawings())!=null?A:{},R=(H=n.getDrawingsOrder())!=null?H:[],b=Y.sort((y,B)=>R.indexOf(y)>R.indexOf(B)?-1:R.indexOf(y)<R.indexOf(B)?1:0);if(b.length>0)for(const y of b){const B=v[y],$=R.indexOf(y);if(B==null||$<0)continue;const g=l.removeOp(["drawings",y],B),P=l.removeOp(["drawingsOrder",$],y);c.push(g),c.push(P),d++}}a.push({t:J.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((x,Y)=>({startIndex:Y,blockId:x.drawingId}))},len:r.length});const m=lC(n,o),_=l.editOp(a.serialize(),m);c.push(_);for(const x of r){const{drawingId:Y}=x,v=l.insertOp(["drawings",Y],x),R=l.insertOp(["drawingsOrder",h-d],Y);c.push(v),c.push(R)}return c.reduce((x,Y)=>jt.compose(x,Y),null)};function uC(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function hC(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function dC(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Ho(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:jo(t,n),a=[];let l=-1;for(let c=0;c<o.length;c++){const u=o[c],{startIndex:h}=u;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(u),l=h}return a}function Wo(e,t,n){const r=[],s=jo(t,n);for(const i of e){const o=Ho(i,t,n,s);r.push(...o)}return r}const fC=[ot.PARAGRAPH,ot.TABLE_START,ot.TABLE_END,ot.TABLE_ROW_START,ot.TABLE_CELL_START,ot.TABLE_CELL_END];function jo(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!fC.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const mC=e=>{var h,d,m;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(_=>{var E;return((E=_.bullet)==null?void 0:E.listType.indexOf(s))===0});let l=K.generateRandomId(6);if(t.length===1){const _=i.indexOf(t[0]),E=i[_-1],I=i[_+1];E&&E.bullet&&E.bullet.listType.indexOf(s)===0?(l=E.bullet.listId,s!==Pt.CHECK_LIST&&(s=E.bullet.listType)):I&&I.bullet&&I.bullet.listType.indexOf(s)===0&&(l=I.bullet.listId,s!==Pt.CHECK_LIST&&(s=I.bullet.listType))}const c=new Rn;c.reset();const u=new Ne;for(const _ of t){const{startIndex:E,paragraphStyle:I={},bullet:A}=_;u.push({t:J.RETAIN,len:E-c.cursor}),u.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:I,startIndex:0}:{startIndex:0,paragraphStyle:{...I},bullet:{nestingLevel:(m=A==null?void 0:A.nestingLevel)!=null?m:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Ce.REPLACE}),c.moveCursorTo(E+1)}return u},gC=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Pt.CHECK_LIST)===-1)return!1;const o=new Rn;o.reset();const a=new Ne,{startIndex:l,paragraphStyle:c={}}=i,u=i.bullet.listType===Pt.CHECK_LIST?Pt.CHECK_LIST_CHECKED:Pt.CHECK_LIST;return a.push({t:J.RETAIN,len:l-o.cursor}),a.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:u}}]},coverType:Ce.REPLACE}),o.moveCursorTo(l+1),a},_C=e=>{var u,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((u=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:u.paragraphs)==null)return!1;const a=K.generateRandomId(6),l=new Rn;l.reset();const c=new Ne;for(const d of t){const{startIndex:m,paragraphStyle:_={},bullet:E}=d;c.push({t:J.RETAIN,len:m-l.cursor}),c.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:_,bullet:{nestingLevel:(h=E==null?void 0:E.nestingLevel)!=null?h:0,textStyle:(E==null?void 0:E.listType)===n?E.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Ce.REPLACE}),l.moveCursorTo(m+1)}return c};function pC(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const EC=e=>{var c,u,h;const{paragraphs:t,document:n,type:r}=e,s=new Rn;s.reset();const i=new Ne,o=(c=n.getSnapshot().lists)!=null?c:{},a=(h=(u=n.getBody())==null?void 0:u.tables)!=null?h:[],l={...Lr,...o};for(const d of t){const{startIndex:m,paragraphStyle:_={},bullet:E}=d,I=pC(d,a);if(i.push({t:J.RETAIN,len:m-s.cursor}),E){const A=E.listType;let H=l[A].nestingLevel.length-1;I&&(H=Math.min(H,2)),i.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{..._},bullet:{...E,nestingLevel:Math.max(Math.min(E.nestingLevel+r,H),0)}}]},coverType:Ce.REPLACE})}else i.push({t:J.RETAIN,len:1});s.moveCursorTo(m+1)}return i},CC=e=>{var I,A,H,x;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,c=r.getSelfOrHeaderFooterModel(n),u=(A=(I=c.getBody())==null?void 0:I.paragraphs)!=null?A:[],h=(x=(H=c.getBody())==null?void 0:H.dataStream)!=null?x:"",d=Wo(t,u,h),m=new Rn;o&&m.moveCursorTo(o);const _=l!=null?l:new Ne;d.sort((Y,v)=>Y.startIndex-v.startIndex);const E=Math.max(0,d[0].paragraphStart-1);E>m.cursor&&(_.push({t:J.RETAIN,len:E-m.cursor}),m.moveCursorTo(E)),a&&_.push({t:J.DELETE,len:a});for(const Y of d){const{startIndex:v,paragraphStyle:R={}}=Y,b=v-m.cursor;_.push({t:J.RETAIN,len:b,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:b}]},coverType:Ce.REPLACE}:null}),_.push({t:J.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...R,...s}}]},coverType:Ce.REPLACE}),m.moveCursorTo(v+1)}return _};class Je{}C(Je,"customRange",{add:nC,delete:tC,copyCustomRange:J0,getCustomRangesInterestsWithSelection:Z0,isIntersecting:lh}),C(Je,"customDecoration",{add:X0,delete:q0}),C(Je,"selection",{replace:sC,makeSelection:uC,normalizeSelection:hC,delete:uh,replaceTextRuns:oC,retain:rC}),C(Je,"range",{isIntersects:dC,getParagraphsInRange:Ho,getParagraphsInRanges:Wo}),C(Je,"transform",{getPlainText:Ms,fromPlainText:i_,isEmptyDocument:s_}),C(Je,"paragraph",{bullet:{set:_C,switch:mC,toggleChecklist:gC,changeNestLevel:EC},style:{set:CC},util:{transform:jo,getParagraphsInRange:Ho,getParagraphsInRanges:Wo}}),C(Je,"drawing",{add:cC});function RC(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function hh(e){var t;return e.body=RC((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Ur{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Ur(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ae.TRUE}get bold(){return this._style.bl===ae.TRUE}get underline(){return this._style.ul&&sn.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&sn.create(this._style.bbl)}get strikethrough(){return this._style.st&&sn.create(this._style.st)}get overline(){return this._style.ol&&sn.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return rn.create(K.deepClone(this._style))}getValue(){return{...this._style}}}class rn extends Ur{static create(t={}){return new rn(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return rn.create(K.deepClone(this._style))}build(){return this.getValue()}}class sn{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new sn(t)}get show(){return this._decoration.s===ae.TRUE}get followFontColor(){return this._decoration.c===ae.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return sn.create(K.deepClone(this._decoration))}build(){return{...this._decoration}}}class Pr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Pr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ae.TRUE}get keepNext(){return this._style.keepNext===ae.TRUE}get wordWrap(){return this._style.wordWrap===ae.TRUE}get widowControl(){return this._style.widowControl===ae.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ae.TRUE}copy(){return kr.create(K.deepClone(this._style))}getValue(){return this._style}}class kr extends Pr{static create(t={}){return new kr(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return kr.create(K.deepClone(this._style))}build(){return this.getValue()}}class on{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=hh(t)}static create(t){return new on(t)}static createByBody(t){return new on({body:t,id:"d",documentStyle:{}})}copy(){return In.create(K.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return In.create({...K.deepClone(s),body:wt(r,t,n)})}toPlainText(){var t,n;return Je.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
7
|
+
`)}getParagraphStyle(){var t,n;return Pr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Ur.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===en.HYPERLINK))!=null?r:[]}getData(){return this._data}}class In extends on{constructor(n){super(n);C(this,"_doc");this._doc=new bt(n)}static newEmptyData(){return hh({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
8
|
+
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new In(n!=null?n:In.newEmptyData())}insertText(n,r,s){var u,h;let i=((h=(u=this._data.body)==null?void 0:u.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof rn?r.build():r:a=s instanceof rn?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=Je.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!c)throw new Error("Insert text failed, please check.");return Ne.apply(this._doc.getBody(),c.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof on?n.getData():n:(s=Math.min(n,s),i=r instanceof on?r.getData():r);const o=Je.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ne.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=Je.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ne.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof rn?s.build():s,st:0,ed:r-n}]},o=Je.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ne.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=Je.customRange.add({rangeType:en.HYPERLINK,rangeId:$t(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ne.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=Je.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ne.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=Je.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ne.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,on.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=In.createByBody({dataStream:i,customRanges:[{rangeType:en.HYPERLINK,rangeId:$t(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function IC(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var zn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(zn||{});function SC(e){return`sheet_interceptor_${e}`}const dh=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class OC{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),dh(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function vC(e){return`sheet_async_interceptor_${e}`}const wC=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class bC{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),wC(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function AC(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function fh(e){return/^-?\d+(\.\d+)?$/.test(e)}function TC(e){return fh(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function yC(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class Yo{constructor(){C(this,"_data",[])}static create(){return new Yo}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class Go{constructor(){C(this,"_data",new Map)}static create(){return new Go}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function NC(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function MC(e,t){return t.forEach(n=>e.add(n)),e}function DC(e,t,n,r){var c;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new bt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const u=new Ne,h=jt.getInstance();if(a>0&&u.retain(a),n.length>0){const d=i.sliceBody(a,a+o),m={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(m.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(c=d==null?void 0:d.customRanges)!=null&&c.length){const _=d.customRanges[0];m.customRanges=[{..._,startIndex:0,endIndex:n.length-1}]}u.insert(n.length,m)}u.delete(o),i.apply(h.editOp(u.serialize()))}const l=i.getBody();return i.dispose(),l}const LC="__default_document_sub_component_id20231101__";class mh{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class UC extends se.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new mh;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function PC(e){return new se.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const Ys=Te.createIdentifier("core.resource-manager.service"),Vo={[Ut.Editor]:"Editor",[Ut.Owner]:"Owner",[Ut.Reader]:"Reader",[Ut.UNRECOGNIZED]:"UNRECOGNIZED"},Gs=e=>e?{userID:`${Vo[e]}_${K.generateRandomId(8)}`,name:Vo[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},kC=(e,t)=>e.startsWith(Vo[t]);class Fr extends ze{constructor(){super(...arguments);C(this,"_model",new Map);C(this,"_userChange$",new se.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new se.BehaviorSubject(Gs()));C(this,"currentUser$",this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(n){this.addUser(n),this._currentUser$.next(n)}addUser(n){this._model.set(n.userID,n),this._userChange$.next({type:"add",user:n})}getUser(n,r){const s=this._model.get(n);if(s)return s;r&&r()}delete(n){const r=this.getUser(n);this._model.delete(n),r&&this._userChange$.next({type:"delete",user:r})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var FC=Object.getOwnPropertyDescriptor,xC=(e,t,n,r)=>{for(var s=r>1?void 0:r?FC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},gh=(e,t)=>(n,r)=>t(n,r,e);f.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Gs(Ut.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?kC(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[ve.UNIVER_SHEET,ve.UNIVER_DOC,ve.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return $t(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Ut.Owner,shareScope:-1,scope:{read:yo.AllCollaborator,edit:yo.AllCollaborator},creator:Gs(Ut.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Ut.Owner)||this._getRole(Ut.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}},f.AuthzIoLocalService=xC([gh(0,Ys),gh(1,Te.Inject(Fr))],f.AuthzIoLocalService);const _h=Te.createIdentifier("IAuthzIoIoService");var BC=Object.getOwnPropertyDescriptor,$C=(e,t,n,r)=>{for(var s=r>1?void 0:r?BC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},HC=(e,t)=>(n,r)=>t(n,r,e);f.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:qr.PERSON,mentions:[{objectType:qr.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}},f.MentionIOLocalService=$C([HC(0,Te.Inject(Fr))],f.MentionIOLocalService);const ph=Te.createIdentifier("univer.service.mention-io"),zo=Te.createIdentifier("univer.config-service");class Eh{constructor(){C(this,"_configChanged$",new se.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=vo(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new se.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(se.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const xr="FOCUSING_UNIT",Kn="FOCUSING_SHEET",Br="FOCUSING_DOC",$r="FOCUSING_SLIDE",WC="FOCUSING_EDITOR_BUT_HIDDEN",Ch="EDITOR_ACTIVATED",jC="FOCUSING_EDITOR_INPUT_FORMULA",Rh="FOCUSING_FX_BAR_EDITOR",YC="FOCUSING_UNIVER_EDITOR",GC="FOCUSING_EDITOR_INPUT_FORMULA",VC="FOCUSING_PANEL_EDITOR",zC="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",KC="FOCUSING_COMMON_DRAWINGS",XC="FORMULA_EDITOR_ACTIVATED";class Ih extends ze{constructor(){super(...arguments);C(this,"_error$",new se.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const qC={version:"0.8.0-beta.1"};function ZC(e="",t=or.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:qC.version,locale:t,styles:{},sheets:{},resources:[]}}class Sh{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new lr(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=K.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&K.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(K.diffValue(n[r],t))return r;return null}}const JC=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!tn.equals(r,n))),QC=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&tn.equals(n.range,s.range)}),Ko={t:0,b:2,l:2,r:2},eR=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Oh=90;function Hr(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=St.UNSPECIFIED,verticalAlign:a=un.UNSPECIFIED,wrapStrategy:l=hn.UNSPECIFIED,cellValueType:c}=n,{t:u,r:h,b:d,l:m}=i||Ko,{vertexAngle:_,centerAngle:E}=Th(s),I={id:"d",body:{dataStream:`${e}${zl}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:u,marginBottom:d,marginRight:h,marginLeft:m,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:E,vertexAngle:_,wrapStrategy:l,cellValueType:c,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new bt(I)}function tR(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function vh(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,c={};return t&&(c.ff=t),n&&(c.fs=n),r&&(c.it=r),s&&(c.bl=s),i&&(c.ul=i),o&&(c.st=o),a&&(c.ol=a),l&&(c.cl=l),c}function wh(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===en.HYPERLINK))return;const s=Je.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:en.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ne.apply(r,s.serialize())}function bh(e){return e!=null}const nR='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Ah(e){const t=rt.ff,n=rt.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Pn.ITALIC;(e.it===0||e.it===void 0)&&(r=Pn.NORMAL);let s=Pn.BOLD;(e.bl===0||e.bl===void 0)&&(s=Pn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Bt.SUBSCRIPT||a===Bt.SUPERSCRIPT){const h=rR(o,l),{sbr:d,spr:m}=h;l*=a===Bt.SUBSCRIPT?d:m}const c=`${r} ${s} ${l}pt ${o}`,u=`${c}, ${nR} `;return{fontCache:c,fontString:u,fontSize:l,originFontSize:i,fontFamily:o}}function rR(e,t){return eR(t)}function Th(e){const{a:t=0,v:n=ae.FALSE}=e||{a:0,v:ae.FALSE};let r=0,s=t;return n===ae.TRUE&&(r=Oh,s=Oh),{centerAngle:r,vertexAngle:s}}class sR{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ae.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:pe.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:pe.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:pe.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:pe.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Zt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:ae.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class iR{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ae.FALSE,h:s.defaultRowHeight},{ia:l,ah:c,h:u=s.defaultRowHeight}=a;i+=(l==null||l===ae.TRUE)&&typeof c=="number"?c:u}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:pe.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:pe.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:pe.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:pe.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ae.TRUE:!0}getSize(){return Zt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const oR="DEFAULT_WORKSHEET_ROW_COUNT",yh=1e3,aR="DEFAULT_WORKSHEET_COLUMN_COUNT",Nh=20,lR="DEFAULT_WORKSHEET_ROW_HEIGHT",Mh=24,cR="DEFAULT_WORKSHEET_COLUMN_WIDTH",Dh=88,uR="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Lh=46,hR="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Uh=20;function Ph(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ae.FALSE,rowCount:yh,columnCount:Nh,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Dh,defaultRowHeight:Mh,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ae.TRUE,rowHeader:{width:Lh,hidden:ae.FALSE},columnHeader:{height:Uh,hidden:ae.FALSE},rightToLeft:ae.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class dR extends ze{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new lr(5e4));C(this,"_skeletonCache",new lr(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===pe.ROW?this._createRowCache(s,r):i===pe.COLUMN?this._createColumnCache(s,r):i===pe.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!K.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!K.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const c=[];for(const u of this._mergeData||[])tn.intersects(u,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...u}),c.push(l)),l++;return this._rangeMap.set(a,c),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const c=[];for(let u=0;u<a.length;u++){const{startRow:h,endRow:d,startColumn:m,endColumn:_}=a[u];for(let E=n;E<=s;E++){let I=!1;for(let A=r;A<=i;A++)if(E>=h&&E<=d&&A>=m&&A<=_){o.push({startRow:h,endRow:d,startColumn:m,endColumn:_}),c.push(u),I=!0;break}if(I)break}}return this._skeletonCache.set(l,c),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class kh extends ze{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,zn.Value|zn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,zn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,zn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,We(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,We(()=>this._rowFilteredInterceptor=null)}}const Fh={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Wr{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");C(this,"_isRowStylePrecedeColumnStyle",!0);C(this,"_getCellHeight");var a;this.unitId=t,this._styles=r,this._snapshot=Ph(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:K.generateRandomId(6),this._cellData=new lt(o),this._viewModel=new kh((l,c)=>this.getCellRaw(l,c)),this._rowManager=new iR(this._snapshot,this._viewModel,i),this._columnManager=new sR(this._snapshot,s),this._spanModel=new dR(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}__registerGetCellHeight(t){return this._getCellHeight=t,We(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(t,n){return this._getCellHeight?this._getCellHeight(t,n):this._snapshot.defaultRowHeight}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(t){this._isRowStylePrecedeColumnStyle=t}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r){const s=this.getDefaultCellStyleInternal(),i=this.getRowStyle(t),o=this.getColumnStyle(n),a=this.getCell(t,n),l=this._styles.getStyleByCell(a);return(r!=null?r:this._isRowStylePrecedeColumnStyle)?ei(s,o,i,a==null?void 0:a.themeStyle,l):ei(s,i,o,a==null?void 0:a.themeStyle,l)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((c,u)=>{Object.keys(u).forEach(h=>{const d=+h,m=t.getValue(c,d),_=m!=null&&m.s?this._styles.get(m.s):null,E=(_==null?void 0:_.bd)&&(_.bd.b||_.bd.l||_.bd.r||_.bd.t||_.bd.bc_tr||_.bd.bl_tr||_.bd.ml_tr||_.bd.tl_bc||_.bd.tl_br||_.bd.tl_mr);(m&&(m.v||m.p)||_!=null&&_.bg||E)&&(a?r=Math.min(r,c):(r=c,a=!0),s=Math.max(s,c),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(c=>{a?r=Math.min(r,c.startRow):(r=c.startRow,a=!0),s=Math.max(s,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=K.deepClone(t);return new Wr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,c=n;if(r){const{startRow:u,endRow:h,startColumn:d,endColumn:m}=r;t===u&&n===d?(o=h,a=m,l=u,c=d,i=!0):t>=u&&t<=h&&n>=d&&n<=m&&(o=h,a=m,l=u,c=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:c}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=An.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new lt;return co(t,r,n,s).forEach((c,u)=>{var d;let h;if(i===An.Raw)h=this.getCellRaw(c,u);else if(i===An.Intercepted)h=this.getCell(c,u);else if(i===An.Both){const m=this.getCellRaw(c,u);if(m){h={...m};const _=(d=this.getCell(c,u))==null?void 0:d.v;bh(_)&&h&&(h.displayV=String(_))}}h&&l.setValue(c,u,h)}),a.forEach(c=>{const{startColumn:u,startRow:h,endColumn:d,endRow:m}=c;co(h,m,u,d).forEach((_,E)=>{_===h&&E===u&&l.setValue(_,E,{...o.getValue(_,E),rowSpan:m-h+1,colSpan:d-u+1}),(_!==h||E!==u)&&l.realDeleteValue(_,E)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Fn(this,t,{getStyles:()=>this._styles}):new Fn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,c=s;return{next(){for(;;){if(c>o&&(l+=1,c=s),l>i)return{done:!0,value:void 0};const u=a.getCell(l,c),h=!u,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(h&&n){c=d.endColumn+1;continue}const _={row:l,col:c,value:u};return _.colSpan=d.endColumn-d.startColumn+1,_.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:_}}if(h&&n)c+=1;else{const m={row:l,col:c,value:u};return c+=1,{done:!1,value:m}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let c=s,u=i;return{next(){for(;;){if(c>o&&(u+=1,c=s),u>a)return{done:!0,value:void 0};const h=l.getMergedCell(c,u);if(h){const _=c!==h.startRow,E=_||u!==h.startColumn;if(r&&E||!r&&_){c=h.endRow+1;continue}const I=l.getCell(h.startRow,h.startColumn);if(!I&&n){c=h.endRow+1;continue}const H={row:c,col:h.startColumn,value:I};return H.colSpan=h.endColumn-h.startColumn+1,H.rowSpan=h.endRow-h.startRow+1,c=h.endRow+1,{done:!1,value:H}}const d=l.getCell(c,u);if(!d&&n)c+=1;else{const _={row:c,col:u,value:d};return c+=1,{done:!1,value:_}}}}}}}}getCellDocumentModel(t,n,r=Fh){var E;if(!t)return;const{isDeepClone:s,displayRawFormula:i,ignoreTextRotation:o}={...Fh,...r};let a,l="document";const c=tR(n),u=o?rt.tr:c.textRotation||rt.tr;let h=c.horizontalAlign||rt.ht;const d=c.verticalAlign||rt.vt,m=c.wrapStrategy||rt.tb,_=c.paddingData||Ko;if(t.f&&i)a=Hr(t.f.toString(),{},{verticalAlign:d}),h=rt.ht;else if(t.p){const{centerAngle:I,vertexAngle:A}=Th(u);a=this._updateConfigAndGetDocumentModel(s?K.deepClone(t.p):t.p,h,_,{horizontalAlign:h,verticalAlign:d,centerAngle:I,vertexAngle:A,wrapStrategy:m,zeroWidthParagraphBreak:1})}else if(t.v!=null){const I=vh(n);l=Ah(I).fontCache;let A=xh(t);t.t===Xt.FORCE_STRING&&i&&(A=`'${A}`),a=Hr(A,I,{...c,textRotation:u,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&wh(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:u,wrapStrategy:m,verticalAlign:d,horizontalAlign:h,paddingData:_,fill:(E=n==null?void 0:n.bg)==null?void 0:E.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,u;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(c=r.l)!=null?c:2,t.documentStyle.marginRight=(u=r.r)!=null?u:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new bt(t)}getBlankCellDocumentModel(t,n,r){const s=this.getComposedCellStyle(n,r),i=vh(s),o=this.getCellDocumentModel(t,s,{ignoreTextRotation:!0});if(o!=null)return o.documentModel==null&&(o.documentModel=Hr("",i)),o;const a="";let l="document";const c=rt.tr,u=rt.ht,h=rt.vt,d=rt.tb,m=Ko;return l=Ah({}).fontCache,{documentModel:Hr(a,i),fontString:l,textRotation:c,wrapStrategy:d,verticalAlign:h,horizontalAlign:u,paddingData:m}}getCellDocumentModelWithFormula(t,n,r){const s=this.getComposedCellStyle(n,r);return this.getCellDocumentModel(t,s,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function xh(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return Je.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Xt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Xt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function fR(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return Je.transform.getPlainText(n)}return e==null?void 0:e.v}var mR=Object.getOwnPropertyDescriptor,gR=(e,t,n,r)=>{for(var s=r>1?void 0:r?mR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},_R=(e,t)=>(n,r)=>t(n,r,e);function pR(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}f.Workbook=class extends Fs{constructor(n={},r){super();C(this,"type",ve.UNIVER_SHEET);C(this,"_sheetCreated$",new se.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new se.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new se.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=ZC();K.isEmptyObject(n)?this._snapshot=s:this._snapshot=K.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=K.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Sh(i),this._count=1,this._worksheets=new Map,this._name$=new se.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return K.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new Wr(this._unitId,s,this._styles);return this._worksheets.set(n,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(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ae.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ae.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ae.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(K.isEmptyObject(s)){const o=K.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[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 c=new Wr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}},f.Workbook=gR([_R(1,ft)],f.Workbook);class Xo extends Fs{constructor(n){var r;super();C(this,"type",ve.UNIVER_SLIDE);C(this,"_activePage$",new se.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...Ac,...n},this._unitId=(r=this._snapshot.id)!=null?r:K.generateRandomId(6),this._name$=new se.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:$t(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=$t(6);return{id:n,pageType:io.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var ER=Object.getOwnPropertyDescriptor,CR=(e,t,n,r)=>{for(var s=r>1?void 0:r?ER(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Bh=(e,t)=>(n,r)=>t(n,r,e);const Xn=Te.createIdentifier("univer.current");f.UniverInstanceService=class extends ze{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new se.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new se.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new se.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new se.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(se.map(r=>{var s;return(s=r.get(n))!=null?s:null}),se.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(se.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(se.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(ve.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,ve.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,ve.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(ve.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof f.Workbook?(this._contextService.setContextValue(xr,!0),this._contextService.setContextValue(Br,!1),this._contextService.setContextValue(Kn,!0),this._contextService.setContextValue($r,!1),this.setCurrentUnitForType(n)):this.focused instanceof bt?(this._contextService.setContextValue(xr,!0),this._contextService.setContextValue(Br,!0),this._contextService.setContextValue(Kn,!1),this._contextService.setContextValue($r,!1),this.setCurrentUnitForType(n)):this.focused instanceof Xo?(this._contextService.setContextValue(xr,!0),this._contextService.setContextValue(Br,!1),this._contextService.setContextValue(Kn,!1),this._contextService.setContextValue($r,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(xr,!1),this._contextService.setContextValue(Br,!1),this._contextService.setContextValue(Kn,!1),this._contextService.setContextValue($r,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:ve.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}},f.UniverInstanceService=CR([Bh(0,Te.Inject(Te.Injector)),Bh(1,bn)],f.UniverInstanceService);var Pe=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Pe||{});const RR={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var IR=Object.getOwnPropertyDescriptor,SR=(e,t,n,r)=>{for(var s=r>1?void 0:r?IR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},OR=(e,t)=>(n,r)=>t(n,r,e);f.LifecycleService=class extends ze{constructor(n){super();C(this,"_lifecycle$",new se.BehaviorSubject(Pe.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Pe.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return se.firstValueFrom(this.lifecycle$.pipe(se.filter(r=>r>=n),Js(r=>r===n),se.map(()=>{})))}subscribeWithPrevious(){return se.merge($h(this.stage),this._lifecycle$.pipe(se.skip(1))).pipe(Js(n=>n===Pe.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${RR[n]}".`)}},f.LifecycleService=SR([OR(0,ft)],f.LifecycleService);function $h(e){switch(e){case Pe.Starting:return se.of(Pe.Starting);case Pe.Ready:return se.of(Pe.Starting,Pe.Ready);case Pe.Rendered:return se.of(Pe.Starting,Pe.Ready,Pe.Rendered);default:return se.of(Pe.Starting,Pe.Ready,Pe.Rendered,Pe.Steady)}}const vR=Te.createIdentifier("ILocalStorageService");class Sn extends ze{constructor(){super();C(this,"_currentLocale$",new se.BehaviorSubject(or.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new se.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(We(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=vo((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var qo=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(qo||{});const Hh=Te.createIdentifier("univer.permission-service");class Wh extends ze{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new se.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof se.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new se.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=qo.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return se.combineLatest(r).pipe(xt.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var wR=Object.getOwnPropertyDescriptor,bR=(e,t,n,r)=>{for(var s=r>1?void 0:r?wR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Zo=(e,t)=>(n,r)=>t(n,r,e);const AR=4,jh=Symbol("DependentOn");class Jo extends ze{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(Jo,"pluginName"),C(Jo,"type",ve.UNIVER_UNKNOWN);class TR{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function yR(...e){return function(t){t[jh]=e}}f.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new TR);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([ve.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===ve.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===ve.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},AR))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const c=a[jh];c&&c.forEach(u=>{const h=this._pluginRegistry.get(u.pluginName);if(h)s(h);else if(!this._seenPlugins.has(u.pluginName)&&!r.has(u.pluginName)){if(a.type===ve.UNIVER_UNKNOWN&&u.type!==ve.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${u.pluginName}.`);a.type!==u.type&&u.type!==ve.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(u),s({plugin:u,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if($h(n).subscribe(r=>this._runStage(t,r)),n!==Pe.Steady){const r=this._lifecycleService.lifecycle$.pipe(se.skip(1)).subscribe(s=>{this._runStage(t,s),s===Pe.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Pe.Starting:r.onStarting();break;case Pe.Ready:r.onReady();break;case Pe.Rendered:r.onRendered();break;case Pe.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}},f.PluginService=bR([Zo(0,Te.Inject(Te.Injector)),Zo(1,Te.Inject(f.LifecycleService)),Zo(2,ft)],f.PluginService);function Yh(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Qo=Te.createIdentifier("resource-loader-service");var NR=Object.getOwnPropertyDescriptor,MR=(e,t,n,r)=>{for(var s=r>1?void 0:r?NR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},DR=(e,t)=>(n,r)=>t(n,r,e);f.ResourceManagerService=class extends ze{constructor(n){super();C(this,"_resourceMap",new Map);C(this,"_register$",new se.Subject);C(this,"register$",this._register$.asObservable());this._logService=n}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),We(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}},f.ResourceManagerService=MR([DR(0,ft)],f.ResourceManagerService);class Vs extends ze{constructor(){super();C(this,"_darkMode$",new se.BehaviorSubject(!1));C(this,"darkMode$",this._darkMode$.asObservable());C(this,"_currentTheme",da.defaultTheme);C(this,"_currentTheme$",new se.BehaviorSubject(this._currentTheme));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(We(()=>{this._currentTheme=da.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return mu(this._currentTheme,n)}}var LR=Object.getOwnPropertyDescriptor,UR=(e,t,n,r)=>{for(var s=r>1?void 0:r?LR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ea=(e,t)=>(n,r)=>t(n,r,e);const zs=Te.createIdentifier("univer.undo-redo.service"),PR=20;class Gh{dispose(){}async dispatchToHandlers(){return!1}}const Vh="univer.command.redo",zh="univer.command.undo",Kh=new class extends Gh{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",zh)}handler(t){const n=t.get(zs),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Xh=new class extends Gh{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",Vh)}handler(t){const n=t.get(zs),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};f.LocalUndoRedoService=class extends ze{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new se.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Kh)),this.disposeWithMe(this._commandService.registerCommand(Xh)),this.disposeWithMe(We(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(We(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>PR&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Xr(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),We(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,c;let n="";const r=this._contextService.getContextValue(Kn),s=this._contextService.getContextValue(Rh),i=this._contextService.getContextValue(Ch);return r?s?n=ro:i?n=no:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",n}},f.LocalUndoRedoService=UR([ea(0,Xn),ea(1,rr),ea(2,bn)],f.LocalUndoRedoService);function kR(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function FR(e){return new Promise(t=>setTimeout(t,e))}function xR(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var ta=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(ta||{}),qh=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(qh||{});const na=Te.createIdentifier("core.image-io.service");class Zh{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new lr(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(na)?this._injector.get(na):null;if(t===ta.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const BR=["script","style","meta","comment","link"];var Jh=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Jh||{}),Qh=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Qh||{}),ed=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(ed||{}),td=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(td||{}),nd=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(nd||{}),rd=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(rd||{}),$R=Object.getOwnPropertyDescriptor,HR=(e,t,n,r)=>{for(var s=r>1?void 0:r?$R(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},WR=(e,t)=>(n,r)=>t(n,r,e);f.Skeleton=class extends ze{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}},f.Skeleton=HR([WR(0,Te.Inject(Sn))],f.Skeleton);var jR=Object.getOwnPropertyDescriptor,YR=(e,t,n,r)=>{for(var s=r>1?void 0:r?jR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ks=(e,t)=>(n,r)=>t(n,r,e);f.SheetSkeleton=class extends f.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Zh(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Xl))!=null&&n),this.worksheet.setIsRowStylePrecedeColumnStyle((r=this._configService.getConfig(Kl))!=null?r:!1)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){K.isDefine(n)&&(this._scrollX=n),K.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(this.worksheet.getRowFiltered(l))c=0;else if(a[l]!=null){const u=a[l];if(!u)continue;const{h=s,ah:d,ia:m}=u;(m==null||m===ae.TRUE)&&typeof d=="number"?c=d:c=h,u.hd===ae.TRUE&&(c=0)}i+=c,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(a[l]!=null){const u=a[l];if(!u)continue;u.w!=null&&(c=u.w),u.hd===ae.TRUE&&(c=0)}i+=c,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=St.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let c=r;c>=s;c--){const u=c,h=this.worksheet.getCell(n,u);if(!li(h)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u+1>l?l:u+1;const{startX:d,endX:m}=qn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&u===r?a+=(m-d)/2:a+=m-d,i<a)return u}return r}for(let l=r;l<=s;l++){const c=l,u=this.worksheet.getCell(n,c);if(!li(u)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c-1<0?0:c-1;const{startX:h,endX:d}=qn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&c===r?a+=(d-h)/2:a+=d-h,i<a)return c}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:c}=this._worksheetData,{rowTotalHeight:u,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:m}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ae.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=c.hidden!==ae.TRUE?c.height:0,this._rowTotalHeight=u,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=m,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const c=new lt;for(;l;){l=!1;for(let u=0;u<a.length;u++){const{startRow:h,startColumn:d,endRow:m,endColumn:_}=a[u];if(c.getValue(h,d))continue;Dc({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:_,endRow:m})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,m),o=Math.max(o,_),c.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:c,endY:u,startX:h,endX:d}=qn(n,r,i,o);return s&&(c+=l,u+=l,h+=a,d+=a),{startY:c,endY:u,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:c}=qn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:c}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=id(n,r,s,this.columnHeaderHeightAndMarginTop);let a=sr(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var c;const o=sd(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=sr(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((c=a[l-1])!=null?c:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),c=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:c}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,c=qn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:u,isMergedMainCell:h}=c;let{startY:d,endY:m,startX:_,endX:E,mergeInfo:I}=c,A=a,H=l;return s===!1&&(A=0,H=0),d+=H,m+=H,_+=A,E+=A,I.startY+=H,I.endY+=H,I.startX+=A,I.endX+=A,{actualRow:n,actualColumn:r,startX:_,startY:d,endX:E,endY:m,isMerged:u,isMergedMainCell:h,mergeInfo:I}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:c}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,c)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=sr(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=sr(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,c,u,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(c=s.b)!=null?c:2,n.documentStyle.marginLeft=(u=s.l)!=null?u:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new bt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}},f.SheetSkeleton=YR([Ks(2,Te.Inject(Sn)),Ks(3,bn),Ks(4,zo),Ks(5,Te.Inject(Te.Injector))],f.SheetSkeleton);function ra(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let c=r[t];return c==null&&(c=r[r.length-1]),{startY:o,endY:a,startX:l,endX:c}}function GR(e,t,n,r){return ra(e,t,n,r)}function qn(e,t,n,r,s){e=K.clamp(e,0,n.length-1),t=K.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=ra(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:c,isMergedMainCell:u,startRow:h,startColumn:d,endRow:m,endColumn:_}=s;let E={startRow:h,startColumn:d,endRow:m,endColumn:_,startY:i,endY:o,startX:a,endX:l};const I=n.length-1,A=r.length-1;if(c&&h!==-1&&d!==-1){const H=n[h-1]||0,x=n[m]||n[I],Y=r[d-1]||0,v=r[_]||r[A];E={...E,startY:H,endY:x,startX:Y,endX:v}}else if(!c&&m!==-1&&_!==-1){const H=n[m]||n[I],x=r[_]||r[A];E={...E,startY:i,endY:H,startX:a,endX:x}}return{isMerged:c,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:E}}function sd(e,t,n,r){const{x:s}=n;return e/t+s-r}function id(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const od=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],sa=1,jr=8;class ia{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==sa)throw new Error(`Got v${s} data when expected v${sa}.`);const i=od[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new ia(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=od.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,jr,t),this.coords=new this.ArrayType(this.data,jr+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(jr+o+a+l),this.ids=new this.IndexArrayType(this.data,jr,t),this.coords=new this.ArrayType(this.data,jr+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(sa<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return oa(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let I=d;I<=h;I++){const A=o[2*I],H=o[2*I+1];A>=t&&A<=r&&H>=n&&H<=s&&c.push(i[I])}continue}const m=d+h>>1,_=o[2*m],E=o[2*m+1];_>=t&&_<=r&&E>=n&&E<=s&&c.push(i[m]),(u===0?t<=_:n<=E)&&(l.push(d),l.push(m-1),l.push(1-u)),(u===0?r>=_:s>=E)&&(l.push(m+1),l.push(h),l.push(1-u))}return c}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],c=r*r;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let I=d;I<=h;I++)ld(i[2*I],i[2*I+1],t,n)<=c&&l.push(s[I]);continue}const m=d+h>>1,_=i[2*m],E=i[2*m+1];ld(_,E,t,n)<=c&&l.push(s[m]),(u===0?t-r<=_:n-r<=E)&&(a.push(d),a.push(m-1),a.push(1-u)),(u===0?t+r>=_:n+r>=E)&&(a.push(m+1),a.push(h),a.push(1-u))}return l}}function oa(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;ad(e,t,o,r,s,i),oa(e,t,n,r,o-1,1-i),oa(e,t,n,o+1,s,1-i)}function ad(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,u=n-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),m=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),_=Math.max(r,Math.floor(n-u*d/c+m)),E=Math.min(s,Math.floor(n+(c-u)*d/c+m));ad(e,t,n,_,E,i)}const o=t[2*n+i];let a=r,l=s;for(Yr(e,t,r,n),t[2*s+i]>o&&Yr(e,t,r,s);a<l;){for(Yr(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Yr(e,t,r,l):(l++,Yr(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Yr(e,t,n,r){aa(e,n,r),aa(t,2*n,2*r),aa(t,2*n+1,2*r+1)}function aa(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function ld(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class VR{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new As),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const c=l.get(s);c&&c.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:c,endRow:u,endColumn:h}=s;for(let d=l;d<=u;d++){const m=a.get(d);if(m)for(let _=c;_<=h;_++){const E=m.get(_);E&&E.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var _;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(_=this._kdTree.get(n))==null?void 0:_.get(r);if(!c)return[];const{tree:u,items:h}=c,d=u.range(o,i,l,a),m=[];for(const E of d){const I=h[E];m.push(...Array.from(I.ids))}return m}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new ia(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:c}=s;if(this._enableOneCellCache&&o===a&&l===c){this._insertOneCellCache(n,r,o,l,i);return}const u=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(c)&&(c=Number.POSITIVE_INFINITY),u.insert({minX:l,minY:o,maxX:c,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const c of l)yield c}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:c}=s;this._enableOneCellCache?o===l&&a===c?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new As;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var zR=Object.getOwnPropertyDescriptor,KR=(e,t,n,r)=>{for(var s=r>1?void 0:r?zR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},cd=(e,t)=>(n,r)=>t(n,r,e);let la=class extends ze{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case ve.UNRECOGNIZED:case ve.UNIVER_UNKNOWN:case ve.UNIVER_SLIDE:case ve.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(ve.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case ve.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(ve.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(ve.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();ql(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=K.deepClone(t.getSnapshot());return r.resources=n,r}};la=KR([cd(0,Te.Inject(Ys)),cd(1,Te.Inject(Xn))],la);class XR{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Kr);const r=this._injector=qR(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l}=t;s&&this._injector.get(Vs).setTheme(s),i&&this._injector.get(Vs).setDarkMode(i),a&&this._injector.get(Sn).load(a),o&&this._injector.get(Sn).setLocale(o),l&&this._injector.get(ft).setLogLevel(l),this._init(r)}get _univerInstanceService(){return this._injector.get(Xn)}get _pluginService(){return this._injector.get(f.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(We(t));return We(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(Sn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(ft).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(ft).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(ft).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(ve.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(ve.UNIVER_SHEET,f.Workbook),this._univerInstanceService.registerCtorForType(ve.UNIVER_DOC,bt),this._univerInstanceService.registerCtorForType(ve.UNIVER_SLIDE,Xo);const n=t.get(Xn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(f.LifecycleService).stage<Pe.Ready&&(this._injector.get(f.LifecycleService).stage=Pe.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function qR(e,t){const n=Yh([[Ih],[Sn],[Vs],[f.LifecycleService],[f.PluginService],[Fr],[Xn,{useClass:f.UniverInstanceService}],[Hh,{useClass:Wh}],[ft,{useClass:Ea,lazy:!0}],[rr,{useClass:f.CommandService}],[zs,{useClass:f.LocalUndoRedoService,lazy:!0}],[zo,{useClass:Eh}],[bn,{useClass:_a}],[Ys,{useClass:f.ResourceManagerService,lazy:!0}],[Qo,{useClass:la,lazy:!0}],[_h,{useClass:f.AuthzIoLocalService}],[ph,{useClass:f.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new Te.Injector(n);return fa(r,[[Fr],[Qo]]),r}function ud(e){return e.map(t=>t/255)}function hd(e){return e.map(t=>Math.round(t*255))}const Et=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function ZR(e){const t=e[0],n=e[1],r=e[2];let s=[Et[0][0]*t+Et[0][1]*n+Et[0][2]*r+Et[0][4],Et[1][0]*t+Et[1][1]*n+Et[1][2]*r+Et[1][4],Et[2][0]*t+Et[2][1]*n+Et[2][2]*r+Et[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function JR(e){return hd(ZR(ud(e)))}function QR([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function Xs(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function dd(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function eI(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(c,u,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?c+(u-c)*6*d:d<.5?u:d<.6666666666666666?c+(u-c)*(.6666666666666666-d)*6:c},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const ca={r:1,g:1,b:1},ua={r:0,g:0,b:0},tI=Xs(ca.r,ca.g,ca.b),nI=Xs(ua.r,ua.g,ua.b);function rI(e){const t=Xs(e[0],e[1],e[2]),n=dd(tI,t),r=QR(e);let s=1-r[2],i,o,a;do i=eI(r[0],r[1],s),o=Xs(i[0],i[1],i[2]),a=dd(o,nI),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function sI(e){return hd(rI(ud(e)))}Ed(),f.ABCToNumber=qg,f.AUTO_HEIGHT_FOR_MERGED_CELLS=Xl,f.AbsoluteRefType=Ye,f.ActionIterator=Vn,f.AlignTypeH=Cc,f.AlignTypeV=Rc,f.ArrangeTypeEnum=Oc,f.ArrowsAndMarkersShapes=ka,f.AsyncInterceptorManager=bC,f.AsyncLock=h0,f.AutoFillSeries=wa,f.BaselineOffset=Bt,f.BasicShapes=Pa,f.BlockType=Ql,f.BooleanNumber=ae,f.BorderStyleTypes=Le,f.BorderType=ba,f.BuildTextUtils=Je,f.BulletAlignment=Sr,f.COLORS=ni,f.CanceledError=bd,f.CellModeEnum=An,f.CellValueType=Xt,f.Color=dn,f.ColorBuilder=ts,f.ColorKit=Ot,f.ColorType=mt,f.ColumnSeparatorType=nc,f.CommandType=nr,f.CommonHideTypes=Aa,f.ConfigService=Eh,f.ContextService=_a,f.CopyPasteType=Ta,f.CustomCommandExecutionError=Zs,f.CustomDecorationType=gn,f.CustomRangeType=en,f.DEFAULT_CELL=bg,f.DEFAULT_DOC=$o,f.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=LC,f.DEFAULT_EMPTY_DOCUMENT_VALUE=zl,f.DEFAULT_RANGE=vg,f.DEFAULT_RANGE_ARRAY=Og,f.DEFAULT_SELECTION=wg,f.DEFAULT_SLIDE=Ac,f.DEFAULT_STYLES=rt,f.DEFAULT_WORKSHEET_COLUMN_COUNT=Nh,f.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=aR,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Uh,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=hR,f.DEFAULT_WORKSHEET_COLUMN_WIDTH=Dh,f.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=cR,f.DEFAULT_WORKSHEET_ROW_COUNT=yh,f.DEFAULT_WORKSHEET_ROW_COUNT_KEY=oR,f.DEFAULT_WORKSHEET_ROW_HEIGHT=Mh,f.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=lR,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Lh,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=uR,f.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ro,f.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=no,f.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Vl,f.DOC_DRAWING_PRINTING_COMPONENT_KEY=Mg,f.DOC_RANGE_TYPE=Za,f.DashStyleType=lc,f.DataStreamTreeNodeType=Fc,f.DataStreamTreeTokenType=ot,f.DataValidationErrorStyle=Jh,f.DataValidationImeMode=Qh,f.DataValidationOperator=ed,f.DataValidationRenderMode=td,f.DataValidationStatus=nd,f.DataValidationType=rd,f.DeleteDirection=ya,f.DependentOn=yR,f.DesktopLogService=Ea,f.DeveloperMetadataVisibility=Na,f.Dimension=Ma,f.Direction=Da,f.Disposable=ze,f.DisposableCollection=Kr,f.DocStyleType=Zl,f.DocumentDataModel=bt,f.DocumentFlavor=so,f.DrawingTypeEnum=vc,f.EDITOR_ACTIVATED=Ch,f.EXTENSION_NAMES=Tc,f.ErrorService=Ih,f.EventState=mh,f.EventSubject=UC,f.FOCUSING_COMMON_DRAWINGS=KC,f.FOCUSING_DOC=Br,f.FOCUSING_EDITOR_BUT_HIDDEN=WC,f.FOCUSING_EDITOR_INPUT_FORMULA=jC,f.FOCUSING_EDITOR_STANDALONE=GC,f.FOCUSING_FX_BAR_EDITOR=Rh,f.FOCUSING_PANEL_EDITOR=VC,f.FOCUSING_SHEET=Kn,f.FOCUSING_SLIDE=$r,f.FOCUSING_UNIT=xr,f.FOCUSING_UNIVER_EDITOR=YC,f.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=zC,f.FORMULA_EDITOR_ACTIVATED=XC,f.FollowNumberWithType=Jl,f.FontItalic=Zr,f.FontStyleType=Pn,f.FontWeight=Jr,f.GridType=ec,f.HLSColor=Va,f.HorizontalAlign=St,f.IAuthzIoService=_h,f.ICommandService=rr,f.IConfigService=zo,f.IContextService=bn,f.IImageIoService=na,f.ILocalStorageService=vR,f.ILogService=ft,f.IMentionIOService=ph,f.IPermissionService=Hh,f.IResourceLoaderService=Qo,f.IResourceManagerService=Ys,f.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Kl,f.IUndoRedoService=zs,f.IUniverInstanceService=Xn,f.ImageCacheMap=Zh,f.ImageSourceType=ta,f.ImageUploadStatusType=qh,f.InterceptorEffectEnum=zn,f.InterceptorManager=OC,f.InterpolationPointType=La,f.JSON1=C0,f.JSONX=jt,f.LRUHelper=cr,f.LRUMap=lr,f.LifecycleStages=Pe,f.ListGlyphType=fe,f.LocaleService=Sn,f.LocaleType=or,f.LogLevel=pa,f.MOVE_BUFFER_VALUE=ir,f.MemoryCursor=Rn,f.MentionType=qr,f.NAMED_STYLE_MAP=Tg,f.NAMED_STYLE_SPACE_MAP=yg,f.NamedStyleType=qe,f.NilCommand=Ra,f.NumberUnitType=Ec,f.ObjectMatrix=lt,f.ObjectRelativeFromH=_c,f.ObjectRelativeFromV=pc,f.OtherShapes=Fa,f.PAGE_SIZE=Dg,f.PAPER_TYPES=Sg,f.PRESET_LIST_TYPE=Lr,f.PRINT_CHART_COMPONENT_KEY=Ng,f.PageElementType=wc,f.PageOrientType=Sc,f.PageType=io,f.PaperType=ht,f.ParagraphElementType=sc,f.ParagraphStyleBuilder=kr,f.ParagraphStyleValue=Pr,f.PermissionService=Wh,f.PermissionStatus=qo,f.Plugin=Jo,f.PositionedObjectLayoutType=oc,f.PresetListType=Pt,f.ProtectionType=Ua,f.QuickListType=qu,f.QuickListTypeMap=w0,f.RANGE_DIRECTION=qa,f.RANGE_TYPE=pe,f.RBush=As,f.RCDisposable=Nd,f.RGBA_PAREN=af,f.RGB_PAREN=of,f.ROTATE_BUFFER_VALUE=va,f.RTree=VR,f.Range=Fn,f.Rectangle=tn,f.RedoCommand=Xh,f.RedoCommandId=Vh,f.RefAlias=Xg,f.Registry=Yo,f.RegistryAsMap=Go,f.RelativeDate=Ba,f.RelativeSlideLink=bc,f.RgbColor=ns,f.RichTextBuilder=In,f.RichTextValue=on,f.RxDisposable=yd,f.SHEET_EDITOR_UNITS=Ag,f.SectionType=tc,f.SheetTypes=$a,f.SheetViewModel=kh,f.SliceBodyType=xo,f.SlideDataModel=Xo,f.SpacingRule=ac,f.SpecialShapes=xa,f.Styles=Sh,f.THEME_COLORS=Ga,f.TabStopAlignment=cc,f.TableAlignmentType=hc,f.TableLayoutType=dc,f.TableRowHeightRule=mc,f.TableSizeType=uc,f.TableTextWrapType=fc,f.TextDecoration=Ha,f.TextDecorationBuilder=sn,f.TextDirection=ar,f.TextDirectionType=rc,f.TextStyleBuilder=rn,f.TextStyleValue=Ur,f.TextX=Ne,f.TextXActionType=J,f.ThemeColor=rs,f.ThemeColorType=it,f.ThemeColors=Qr,f.ThemeService=Vs,f.Tools=K,f.UndoCommand=Kh,f.UndoCommandId=zh,f.UnitModel=Fs,f.Univer=XR,f.UniverInstanceType=ve,f.UpdateDocsAttributeType=Ce,f.UserManagerService=Fr,f.VerticalAlign=un,f.VerticalAlignmentType=gc,f.Worksheet=Wr,f.WrapStrategy=hn,f.WrapTextType=ic,f.addLinkToDocumentModel=wh,f.afterInitApply=$d,f.afterTime=xd,f.awaitTime=FR,f.binSearchFirstGreaterThanTarget=Oa,f.binarySearchArray=Hd,f.bufferDebounceTime=Fd,f.cellToRange=Ff,f.characterSpacingControlType=Ic,f.checkForSubstrings=Bf,f.checkIfMove=jd,f.checkParagraphHasBullet=Im,f.checkParagraphHasIndent=Sm,f.checkParagraphHasIndentByStyle=hl,f.codeToBlob=Wd,f.composeBody=Bo,f.composeInterceptors=dh,f.composeStyles=ei,f.concatMatrixArray=bf,f.convertBodyToHtml=sf,f.convertCellToRange=Ja,f.convertObservableToBehaviorSubject=Bd,f.covertCellValue=ci,f.covertCellValues=xf,f.covertTextRunToHtml=ti,f.createAsyncInterceptorKey=vC,f.createDefaultUser=Gs,f.createDocumentModelWithStyle=Hr,f.createInterceptorKey=SC,f.createInternalEditorID=Ig,f.createRowColIter=co,f.dayjs=Ht,f.debounce=ZE,f.dedupe=Cd,f.dedupeBy=Rd,f.deepCompare=ui,f.delayAnimationFrame=xR,f.deleteContent=fl,f.extractPureTextFromCell=xh,f.fromCallback=Ia,f.fromEventSubject=PC,f.fromObservable=Td,f.generateRandomId=$t,f.get=mu,f.getArrayLength=Zt,f.getBodySlice=wt,f.getBodySliceHtml=es,f.getBorderStyleType=Uf,f.getCellCoordByIndexSimple=ra,f.getCellInfoInMergeData=vf,f.getCellPositionByIndexSimple=GR,f.getCellValueType=If,f.getCellWithCoordByIndexCore=qn,f.getColorStyle=Mt,f.getCustomBlockSlice=th,f.getCustomDecorationSlice=rh,f.getCustomRangeSlice=nh,f.getDocsUpdateBody=Pf,f.getIntersectRange=Dc,f.getOriginCellValue=fR,f.getParagraphsSlice=eh,f.getPlainText=Ms,f.getReverseDirection=Yd,f.getSectionBreakSlice=U0,f.getTableSlice=Qu,f.getTextRunSlice=js,f.getTransformOffsetX=sd,f.getTransformOffsetY=id,f.getWorksheetUID=pR,f.groupBy=Od,f.handleStyleToString=Lf,f.hashAlgorithm=vm,f.horizontalLineSegmentsSubtraction=gs,f.insertMatrixArray=ii,f.insertTextToContent=dl,f.invertColorByHSL=sI,f.invertColorByMatrix=JR,f.isBlackColor=Cf,f.isBooleanString=a0,f.isCellCoverable=li,f.isCellV=Xa,f.isEmptyCell=Qa,f.isFormulaId=Df,f.isFormulaString=el,f.isICellData=Ka,f.isInternalEditorID=ql,f.isNodeEnv=rf,f.isNotNullOrUndefined=bh,f.isNullCell=Sf,f.isNumeric=fh,f.isPatternEqualWithoutDecimal=Rg,f.isRangesEqual=JC,f.isRealNum=Om,f.isSafeNumeric=TC,f.isSameStyleTextRun=tl,f.isUnitRangesEqual=QC,f.isValidRange=kf,f.isWhiteColor=Rf,f.makeArray=vd,f.makeCellRangeToRangeData=Mf,f.makeCellToSelection=Nf,f.makeCustomRangeStream=n_,f.mapObjectMatrix=wf,f.merge=vo,f.mergeOverrideWithDependencies=Yh,f.mergeSets=MC,f.mergeWith=t0,f.mergeWorksheetSnapshotWithDefault=Ph,f.mixinClass=AC,f.moveMatrixArray=ai,f.moveRangeByOffset=Bg,f.nameCharacterCheck=kR,f.normalizeBody=P0,f.normalizeTextRuns=Dr,f.numberToABC=Jg,f.numberToListABC=Qg,f.numfmt=Cg,f.queryObjectMatrix=Kg,f.registerDependencies=wd,f.remove=tr,f.repeatStringNumTimes=kc,f.replaceInDocumentBody=DC,f.requestImmediateMacroTask=NC,f.rotate=Sd,f.searchArray=sr,f.searchInOrderedArray=Sa,f.selectionToArray=Of,f.sequence=ga,f.sequenceAsync=ma,f.sequenceExecute=Xr,f.sequenceExecuteAsync=kd,f.set=r0,f.shallowEqual=vu,f.skipParseTagNames=BR,f.sliceMatrixArray=Af,f.sortRules=e_,f.sortRulesByDesc=t_,f.sortRulesFactory=br,f.spliceArray=oi,f.splitIntoGrid=lo,f.takeAfter=Js,f.textDiff=bo,f.throttle=IC,f.toDisposable=We,f.touchDependencies=fa,f.updateAttributeByDelete=sh,f.updateAttributeByInsert=ih,f.willLoseNumericPrecision=yC,Object.keys(Te).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(f,e)&&Object.defineProperty(f,e,{enumerable:!0,get:()=>Te[e]})}),Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|