@univerjs/core 0.1.0-beta.2 → 0.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/{LICENSE.txt → LICENSE} +0 -2
  2. package/lib/cjs/index.js +4 -10
  3. package/lib/es/index.js +2124 -2563
  4. package/lib/types/{sheets/r1c1-reference.d.ts → common/function.d.ts} +1 -2
  5. package/lib/types/docs/data-model/{mutation-types.d.ts → action-types.d.ts} +13 -8
  6. package/lib/types/docs/data-model/document-data-model.d.ts +3 -3
  7. package/lib/types/docs/data-model/text-x/__tests__/compose.spec.d.ts +16 -0
  8. package/lib/types/docs/data-model/text-x/__tests__/text-x.spec.d.ts +16 -0
  9. package/lib/types/docs/data-model/text-x/__tests__/utils.spec.d.ts +16 -0
  10. package/lib/types/docs/data-model/text-x/action-iterator.d.ts +29 -0
  11. package/lib/types/docs/data-model/text-x/text-x.d.ts +28 -0
  12. package/lib/types/docs/data-model/text-x/utils.d.ts +21 -0
  13. package/lib/types/docs/data-model/types.d.ts +1 -1
  14. package/lib/types/index.d.ts +6 -4
  15. package/lib/types/services/command/command.service.d.ts +1 -0
  16. package/lib/types/services/context/__tests__/context.service.spec.d.ts +16 -0
  17. package/lib/types/services/context/context.d.ts +3 -1
  18. package/lib/types/services/context/context.service.d.ts +9 -3
  19. package/lib/types/services/locale/locale.service.d.ts +2 -2
  20. package/lib/types/shared/generate.d.ts +5 -5
  21. package/lib/types/shared/object-matrix.d.ts +5 -1
  22. package/lib/types/sheets/column-manager.d.ts +13 -0
  23. package/lib/types/sheets/row-manager.d.ts +13 -0
  24. package/lib/types/sheets/worksheet.d.ts +10 -0
  25. package/lib/types/types/enum/text-style.d.ts +9 -15
  26. package/lib/types/types/interfaces/i-cell-data.d.ts +3 -3
  27. package/lib/types/types/interfaces/i-row-data.d.ts +1 -1
  28. package/lib/umd/index.js +5 -11
  29. package/package.json +31 -28
  30. package/lib/types/sheets/reference.d.ts +0 -64
  31. /package/lib/types/{sheets/__tests__/r1c1-reference.spec.d.ts → docs/data-model/__tests__/common.spec.d.ts} +0 -0
  32. /package/lib/types/{sheets/__tests__/reference.spec.d.ts → docs/data-model/text-x/__tests__/action-iterator.spec.d.ts} +0 -0
package/lib/umd/index.js CHANGED
@@ -1,11 +1,5 @@
1
- (function(c,A){typeof exports=="object"&&typeof module<"u"?A(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],A):(c=typeof globalThis<"u"?globalThis:c||self,A(c.UniverCore={},c["@wendellhu/redi"],c.rxjs,c.rxjs.operators))})(this,function(c,A,N,sr){"use strict";var Vo=Object.defineProperty;var jo=(c,A,N)=>A in c?Vo(c,A,{enumerable:!0,configurable:!0,writable:!0,value:N}):c[A]=N;var g=(c,A,N)=>(jo(c,typeof A!="symbol"?A+"":A,N),N);var xo,po;function rr(){ir()}const wt=typeof global<"u"?global:typeof self<"u"?self:window;function ir(){typeof wt.requestIdleCallback!="function"&&(wt.requestIdleCallback=function(n){const s=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-s));n({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof wt.cancelIdleCallback!="function"&&(wt.cancelIdleCallback=function(n){clearTimeout(n)})}class te{constructor(){g(this,"_data",[])}static create(){return new te}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const n=this._data.indexOf(e);this._data.splice(n,1)}getData(){return this._data}}class ee{constructor(){g(this,"_data",new Map)}static create(){return new ee}add(e,n){this._data.has(e)||this._data.set(e,n)}delete(e){this._data.delete(e)}getData(){return this._data}}var M=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(M||{});class ke{constructor(e){g(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}g(ke,"type",0);class or{constructor(){g(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class ar{constructor(){g(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(e,n){const s=e.type;this._pluginsRegisteredByBusiness.has(s)||this._pluginsRegisteredByBusiness.set(s,[]),this._pluginsRegisteredByBusiness.get(s).push({plugin:e,options:n})}getRegisterPlugins(e){return this._pluginsRegisteredByBusiness.get(e)||[]}clearPluginsOfType(e){this._pluginsRegisteredByBusiness.delete(e)}}function q(t,e){const n=t.indexOf(e);return n>-1?(t.splice(n,1),!0):!1}function lr(t){const e=new Set,n=[];for(const s of t)e.has(s)||(e.add(s),n.push(s));return n}function ur(t,e){for(let n=t.length-1;n>-1;n--){const s=t[n];if(e(s,n))return s}return null}async function xe(t){for(const[e,n]of t.entries())try{if(!await n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}function pe(t){for(const[e,n]of t.entries())try{if(!n())return{index:e,result:!1}}catch(s){return{index:e,result:!1,error:s}}return{result:!0,index:-1}}function Ve(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function je(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}function ze(t,e,n){if(n||arguments.length===2)for(var s=0,r=e.length,i;s<r;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;function Rt(t){return typeof t=="function"}function cr(t){var e=function(s){Error.call(s),s.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ne=cr(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
- `+n.map(function(s,r){return r+1+") "+s.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function Ye(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Ke=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,s,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Ve(o),h=a.next();!h.done;h=a.next()){var l=h.value;l.remove(this)}}catch(R){e={error:R}}finally{try{h&&!h.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(Rt(u))try{u()}catch(R){i=R instanceof ne?R.errors:[R]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Ve(d),_=f.next();!_.done;_=f.next()){var E=_.value;try{qe(E)}catch(R){i=i??[],R instanceof ne?i=ze(ze([],je(i)),je(R.errors)):i.push(R)}}}catch(R){s={error:R}}finally{try{_&&!_.done&&(r=f.return)&&r.call(f)}finally{if(s)throw s.error}}}if(i)throw new ne(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)qe(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&Ye(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&Ye(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Ke.EMPTY;function Xe(t){return t instanceof Ke||t&&"closed"in t&&Rt(t.remove)&&Rt(t.add)&&Rt(t.unsubscribe)}function qe(t){Rt(t)?t():t.unsubscribe()}class Qe{constructor(e=!1){g(this,"skipNextObservers");g(this,"lastReturnValue");g(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function Ze(t){return t instanceof vt}class vt{constructor(e,n){g(this,"_willBeUnregistered",!1);g(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=n}dispose(){this.observable.remove(this)}}class Dt{constructor(e){g(this,"_observers",new Array);g(this,"_eventState");g(this,"_onObserverAdded");this._eventState=new Qe,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,n=!1,s=!1){if(!e)return null;const r=new vt(e,this);return r.unregisterOnNextCall=s,n?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let n=0;n<this._observers.length;n++){const s=this._observers[n];if(!s._willBeUnregistered&&s.callback===e)return this._deferUnregister(s),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const n=this._eventState;n.skipNextObservers=!1,n.lastReturnValue=e,n.isStopPropagation=!1;let s=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(n.lastReturnValue=i.callback(e,n),i.unregisterOnNextCall&&this._deferUnregister(i),n.isStopPropagation&&(s=!0),n.skipNextObservers))return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}return{lastReturnValue:n.lastReturnValue,stopPropagation:s}}notifyObserversWithPromise(e){let n=Promise.resolve(e);if(!this._observers.length)return n;const s=this._eventState;s.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];s.skipNextObservers||i._willBeUnregistered||(n=n.then(()=>i.callback(e,s)),i.unregisterOnNextCall&&this._deferUnregister(i))}return n.then(()=>e)}notifyObserver(e,n){if(e._willBeUnregistered)return;const s=this._eventState;return s.skipNextObservers=!1,e.callback(n,s),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new Dt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const n=this._observers.indexOf(e);return n!==-1?(this._observers.splice(n,1),!0):!1}}function w(t){let e=!1;return Xe(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:Ze(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function hr(t){return w(()=>{t.unsubscribe()})}class se{constructor(){g(this,"_disposables",new Set)}add(e){return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(e=>{e.dispose(),this._disposables.delete(e)})}}class T{constructor(){g(this,"_disposed",!1);g(this,"_collection",new se)}disposeWithMe(e){const n=Xe(e)?w(e):e;return this._collection.add(n)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class dr extends T{constructor(){super(...arguments);g(this,"dispose$",new N.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const lt=A.createIdentifier("univer.context-service");class Je extends T{constructor(){super(...arguments);g(this,"_contextChanged$",new N.Subject);g(this,"contextChanged$",this._contextChanged$.asObservable());g(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){return this._contextMap.get(n)??!1}setContextValue(n,s){this._contextMap.set(n,s),this._contextChanged$.next()}}var ye=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(ye||{});const st=A.createIdentifier("univer.log");class tn extends T{constructor(){super(...arguments);g(this,"_logLevel",3)}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)}setLogLevel(n){this._logLevel=n}_log(n,...s){const r=s[0];/^\[(.*?)\]/g.test(r)?n(`\x1B[97;104m${r}\x1B[0m:`,...s.slice(1)):n(...s)}}var _r=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,gr=(t,e,n,s)=>{for(var r=s>1?void 0:s?fr(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&_r(e,n,r),r},en=(t,e)=>(n,s)=>e(n,s,t),Mt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Mt||{});const mt=A.createIdentifier("anywhere.command-service");class Er{constructor(){g(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),w(()=>{var n;this._commands.delete(e.id),(n=e.onDispose)==null||n.call(e)})}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}c.CommandService=class{constructor(e,n){g(this,"_commandRegistry");g(this,"_beforeCommandExecutionListeners",[]);g(this,"_commandExecutedListeners",[]);g(this,"_multiCommandDisposables",new Map);g(this,"_commandExecutingLevel",0);g(this,"_commandExecutionStack",[]);this._injector=e,this._logService=n,this._commandRegistry=new Er}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),w(()=>{const n=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),w(()=>{const n=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(n,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,n,s){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:n},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(l=>l(o,s));const h=await this._execute(i,n);return this._commandExecutedListeners.forEach(l=>l(o,s)),a.dispose(),h}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,n,s){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:n};if(i.type===2){const l=ur(this._commandExecutionStack,u=>u.type===0);l&&(o.params=o.params??{},o.params.trigger=l.id)}const a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(l=>l(o,s));const h=this._syncExecute(i,n);return this._commandExecutedListeners.forEach(l=>l(o,s)),a.dispose(),h}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),w(()=>q(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const n=this._commandRegistry.getCommand(e.id);let s;if(n){if(n[0].multi!==!0)throw new Error("Command has registered as a single command.");s=n[0]}else{const i=new se;s=new Rr(e.id),i.add(this._commandRegistry.registerCommand(s)),i.add(w(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=s.registerImplementation(e);return w(()=>{var i;r.dispose(),s.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let s;try{s=await this._injector.invoke(e.handler,n),this._commandExecutingLevel--}catch(r){throw s=!1,this._commandExecutingLevel=0,r}return s}_syncExecute(e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let s;try{if(s=this._injector.invoke(e.handler,n),s instanceof Promise)throw new Error("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(r){throw s=!1,this._commandExecutingLevel=0,r}return s}},c.CommandService=gr([en(0,A.Inject(A.Injector)),en(1,st)],c.CommandService);class Rr{constructor(e){g(this,"name");g(this,"multi",!0);g(this,"type",0);g(this,"priority",0);g(this,"_implementations",[]);g(this,"handler",async(e,n)=>{if(!this._implementations.length)return!1;const s=e.get(st),r=e.get(lt),i=e.get(A.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(s.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const n={command:e};return this._implementations.push(n),this._implementations.sort((s,r)=>r.command.priority-s.command.priority),w(()=>{var r;const s=this._implementations.indexOf(n);this._implementations.splice(s,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function re(t,e,n){const s=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,n));return pe(s)}function mr(t,e,n){const s=t.map(r=>()=>e.executeCommand(r.id,r.params,n));return xe(s)}const nn=A.createIdentifier("univer.config-service");class Or{constructor(){g(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,n){this._config.set(e,n)}deleteConfig(e){this._config.delete(e)}}class sn extends T{constructor(){super(...arguments);g(this,"_error$",new N.Subject);g(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const Ar="__default_document_sub_component_id20231101__";class rn{constructor(){g(this,"_managerInfo",new Map);g(this,"_remove$",new N.Subject);g(this,"remove$",this._remove$.asObservable());g(this,"_andOrUpdate$",new N.Subject);g(this,"andOrUpdate$",this._andOrUpdate$.asObservable());g(this,"_pluginUpdate$",new N.Subject);g(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const n=this._clearByParam(e);this._remove$.next(n)}addOrUpdate(e){const n=this._addByParam(e);this._andOrUpdate$.next(n)}BatchAddOrUpdate(e){const n=[];e.forEach(s=>{n.push(...this._addByParam(s))}),this._andOrUpdate$.next(n)}remove(e){const n=this._removeByParam(e);this._remove$.next(n)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:n,subUnitId:s}=e;return(r=this._managerInfo.get(n))==null?void 0:r.get(s)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:n,subUnitId:s,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(n))==null?void 0:i.get(s))==null?void 0:o.get(r)}_addByParam(e){const{unitId:n,subUnitId:s,floatingObject:r,floatingObjectId:i}=e;this._managerInfo.has(n)||this._managerInfo.set(n,new Map);const o=this._managerInfo.get(n);return o.has(s)||o.set(s,new Map),o.get(s).set(i,r),[{unitId:n,subUnitId:s,floatingObjectId:i,floatingObject:r}]}_clearByParam(e){const n=this._getFloatingObjects(e),{unitId:s,subUnitId:r}=e,i=[];return n==null||n.forEach((o,a)=>{i.push({unitId:s,subUnitId:r,floatingObjectId:a,floatingObject:o})}),n==null||n.clear(),i}_removeByParam(e){const n=this._getFloatingObjects(e),s=n==null?void 0:n.get(e.floatingObjectId);return s==null?[]:(n==null||n.delete(e.floatingObjectId),[{...e,floatingObject:s}])}}const on=A.createIdentifier("univer.floating-object.service");class an{constructor(){g(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function ln(t,e){let n=0,s=t.length-1;for(;n<=s;){const r=Math.floor((s+n)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])n=r+1;else if(e<t[r])s=r-1;else return-1}return-1}function un(t,e){let n=0,s=0,r=0,i=-1,o=t.length-1;for(;n<t.length&&o>=0&&o>=n;){if(s=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=s){i=o;break}if(s=t[n],n===0?r=0:r=t[n-1],e>=r&&e<s){i=n;break}n++,o--}return i}function Ir(t,e){let n=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?1/0:(t.length<40||e<=t[20]||e>=t[n-20]?n=un(t,e):n=ln(t,e),n)}function Cr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var cn=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(cn||{}),L=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(L||{}),hn=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(hn||{}),k=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(k||{}),dn=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(dn||{}),_n=(t=>(t[t.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",t[t.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",t[t.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",t[t.NUMBER_LESS=3]="NUMBER_LESS",t[t.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",t[t.NUMBER_EQ=5]="NUMBER_EQ",t[t.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",t[t.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",t[t.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",t[t.TEXT_CONTAINS=9]="TEXT_CONTAINS",t[t.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",t[t.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",t[t.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",t[t.TEXT_EQ=13]="TEXT_EQ",t[t.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",t[t.TEXT_IS_URL=15]="TEXT_IS_URL",t[t.DATE_EQ=16]="DATE_EQ",t[t.DATE_BEFORE=17]="DATE_BEFORE",t[t.DATE_AFTER=18]="DATE_AFTER",t[t.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",t[t.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",t[t.DATE_BETWEEN=21]="DATE_BETWEEN",t[t.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",t[t.DATE_IS_VALID=23]="DATE_IS_VALID",t[t.ONE_OF_RANGE=24]="ONE_OF_RANGE",t[t.ONE_OF_LIST=25]="ONE_OF_LIST",t[t.BLANK=26]="BLANK",t[t.NOT_BLANK=27]="NOT_BLANK",t[t.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",t[t.BOOLEAN=29]="BOOLEAN",t[t.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",t[t.DATE_NOT_EQ=31]="DATE_NOT_EQ",t))(_n||{}),fn=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(fn||{}),gn=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(gn||{}),En=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(En||{}),Rn=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Rn||{});function Sr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var mn=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(mn||{}),On=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(On||{}),Ut=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(Ut||{}),An=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(An||{}),In=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(In||{}),Cn=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(Cn||{}),ie=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(ie||{}),Ot=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(Ot||{}),Sn=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(Sn||{}),rt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(rt||{}),ut=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(ut||{}),ct=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ct||{}),Tt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Tt||{}),Pt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(Pt||{}),Ft=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(Ft||{}),C=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(C||{}),At=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(At||{}),H=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(H||{}),Ht=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(Ht||{});const Nn={[Ht.OFFICE]:{[H.ACCENT1]:"#4472C4",[H.ACCENT2]:"#ED7D31",[H.ACCENT3]:"#A5A5A5",[H.ACCENT4]:"#70AD47",[H.ACCENT5]:"#5B9BD5",[H.ACCENT6]:"#70AD47",[H.DARK1]:"#000000",[H.DARK2]:"#44546A",[H.LIGHT1]:"#FFFFFF",[H.LIGHT2]:"#E7E6E6",[H.HYPERLINK]:"#0563C1",[H.FOLLOWED_HYPERLINK]:"#954F72"}};class Bt{constructor(){g(this,"_themeValue",H.LIGHT1);g(this,"_themeColors");g(this,"_themeTint");g(this,"_rgbValue","");g(this,"_colorType");this._colorType=k.UNSUPPORTED,this._themeColors=Ht.OFFICE,this._themeTint=0}asRgbColor(){return new Wt(this._rgbValue,this)}asThemeColor(){return new $t(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case k.THEME:return this.asThemeColor();case k.RGB:return this.asRgbColor();case k.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(e){return this._colorType=k.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=k.THEME,this._themeColors=e}setThemeTint(e){this._colorType=k.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=k.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class it{constructor(e){g(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const n=+`0x${e[0]}${e[1]}`,s=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Bt().setRgbColor(`rgb(${n},${s},${r})`).asRgbColor()}static hexToRgbString(e){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(n,(i,o,a,h)=>o+o+a+a+h+h);const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(s){const i=parseInt(s[1],16),o=parseInt(s[2],16),a=parseInt(s[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new it(this._builder)}equals(e){return!1}}class bn{constructor(e){g(this,"_saturation",0);g(this,"_hue",0);g(this,"_lightness",0);g(this,"_alpha",0);const n=e.getRed()/255,s=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(n,Math.min(s,r)),a=Math.max(n,Math.max(s,r)),h=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=h/(a+o):this._saturation=h/(2-a-o),n===a&&(this._hue=(s-r)/h),s===a&&(this._hue=2+(r-n)/h),r===a&&(this._hue=4+(n-s)/h),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Bt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const s=2*this._lightness-n,r=this._hue/360,i=r+1/3,o=this.setColor(n,s,i),a=this.setColor(n,s,r),h=r-1/3,l=this.setColor(n,s,h);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(l*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,n,s){s<0&&(s+=1),s>1&&(s-=1);let r;return 6*s<1?r=n+(e-n)*6*s:2*s<1?r=e:3*s<2?r=n+(e-n)*(2/3-s)*6:r=n,r}setLightness(e){this._lightness=e}}const x=class x extends it{constructor(n,s){super(s);g(this,"_cssString");g(this,"_red");g(this,"_green");g(this,"_blue");g(this,"_alpha");let r=n.match(x.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],h=+r[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=h;return}if(r=n.match(x.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[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 it.rgbColorToHexValue(this)}getRed(){let n=this._red+x.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+x.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+x.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return k.RGB}clone(){return new x(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof x?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};g(x,"RGB_COLOR_AMT",0),g(x,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),g(x,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Wt=x;const tt=class tt extends it{constructor(n,s,r,i){super(i);g(this,"_themeColorType");g(this,"_themeTint");g(this,"_themeColors");this._themeColorType=n,this._themeTint=s,this._themeColors=r}lumValue(n,s){if(n==null)return s;let r;return n<0?r=s*(1+n):r=s*(1-n)+(255-255*(1-n)),r}asRgbColor(){const n=Nn[this._themeColors];if(n==null)throw new Error("not find themeColors type");const s=n[this._themeColorType];if(s==null)throw new Error("not find themeColors value");let r;if(tt._cacheThemeColor.has(this._themeColors)){if(r=tt._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,tt._cacheThemeColor.set(this._themeColors,r);const i=new bn(it.hexValueToRgbColor(s));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new tt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof tt?n._themeColorType===this._themeColorType:!1}getColorType(){return k.THEME}getThemeColorType(){return this._themeColorType}};g(tt,"_cacheThemeColor",new Map);let $t=tt;const Nr="rgb(",br="rgba(",oe={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 p{constructor(e){g(this,"_color");g(this,"_rgbColor");g(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof p){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const n=Ln(e);if(n==null){this._setNullColor();return}this._color=n;const s=Mr(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(e,n,s){s=Math.min(1,Math.max(0,s));const r=new p(e).toRgb(),i=new p(n).toRgb(),o=r.a??1,a=i.a??1,h={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(a-o)*s+o};return new p(h)}static getContrastRatio(e,n){const s=new p(e).getLuminance(),r=new p(n).getLuminance();return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:n,b:s,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${n},${s}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:n,g:s,b:r,a:i=1}=this.toRgb(),o=i<1,a=[Gt(Math.round(n).toString(16)),Gt(Math.round(s).toString(16)),Gt(Math.round(r).toString(16)),Gt(Math.round(i*255).toString(16))];return e&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Fr(this.toRgb())}toHsl(){return Pr(this.toRgb())}lighten(e=10){const n=this.toHsl();return n.l+=e,n.l=Math.min(Math.max(n.l,0),100),new p(n)}darken(e=10){const n=this.toHsl();return n.l-=e,n.l=Math.min(Math.max(n.l,0),100),new p(n)}setAlpha(e){return new p({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:n,b:s}=this.toRgb();return e=ae(e),n=ae(n),s=ae(s),Number((.2126*e+.7152*n+.0722*s).toFixed(3))}getBrightness(){const{r:e,g:n,b:s}=this.toRgb();return(e*299+n*587+s*114)/1e3}getAlpha(){return this._color.a??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 Gt=t=>t.length===1?`0${t}`:t,ae=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Ln=t=>{if(Br(t)){if("r"in t){const s={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(s.a=t.a),s}if("l"in t){const s={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(s.a=t.a),s}const n={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(n.a=t.a),n}const e=t.trim();if(oe[e]){const n=oe[e],s={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return s.a=n[3]||1,s}if(e.startsWith("#"))return Lr(e);if(e.startsWith("rgb"))return wr(e);if(e.startsWith("hsl"))return vr(e);if(e.startsWith("hsv"))return Dr(e)},Lr=t=>{const e=t.substring(1),n=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let s=e.match(n);if(!s||s.length<3)throw new Error(`The color '${t}' is illegal hex color`);s[0].length===1&&(s=s.map(i=>i+i));const r={r:parseInt(s[0],16),g:parseInt(s[1],16),b:parseInt(s[2],16)};return s.length>3&&(r.a=parseInt(s[3],16)/255),r},wr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const s={r:parseInt(n[0],10),g:parseInt(n[1],10),b:parseInt(n[2],10)};return n.length>3&&(s.a=parseFloat(n[3])),s},vr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const s={h:parseInt(n[0],10),s:parseFloat(n[1]),l:parseFloat(n[2])};return n.length>3&&(s.a=parseFloat(n[3])),s},Dr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const n=t.substring(e+1,t.length-1).split(",");if(n.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const s={h:parseInt(n[0],10),s:parseFloat(n[1]),v:parseFloat(n[2])};return n.length>3&&(s.a=parseFloat(n[3])),s},Mr=t=>{const e=Ln(t);if(e!=null)return"r"in e?e:"l"in e?Ur(e):Tr(e)},le=(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),Ur=t=>{let{h:e,s:n,l:s}=t;e/=360,n/=100,s/=100;let r=0,i=0,o=0;if(n===0)r=i=o=s;else{const h=s<.5?s*(1+n):s+n-s*n,l=2*s-h;r=le(l,h,e+1/3),i=le(l,h,e),o=le(l,h,e-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},Tr=t=>{let{h:e,s:n,v:s}=t;e=e/360*6,n/=100,s/=100;const r=Math.floor(e),i=e-r,o=s*(1-n),a=s*(1-i*n),h=s*(1-(1-i)*n),l=r%6,u=[s,a,o,o,h,s][l],d=[h,s,s,a,o,o][l],f=[o,o,h,s,s,a][l],_={r:u*255,g:d*255,b:f*255};return t.a!==void 0&&(_.a=t.a),_},Pr=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s),o=(r+i)/2;let a,h;if(r===i)a=h=0;else{const u=r-i;switch(h=o>.5?u/(2-r-i):u/(r+i),r){case e:a=(n-s)/u+(n<s?6:0);break;case n:a=(s-e)/u+2;break;default:a=(e-n)/u+4;break}a/=6}const l={h:Math.round(a*360),s:Math.round(h*100),l:Math.round(o*100)};return t.a!==void 0&&(l.a=t.a),l},Fr=t=>{let{r:e,g:n,b:s}=t;e/=255,n/=255,s/=255;const r=Math.max(e,n,s),i=Math.min(e,n,s);let o;const a=r,h=r-i,l=r===0?0:h/r;if(r===i)o=0;else{switch(r){case e:o=(n-s)/h+(n<s?6:0);break;case n:o=(s-e)/h+2;break;default:o=(e-n)/h+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(a*100)};return t.a!==void 0&&(u.a=t.a),u},Hr=t=>t==null,Br=t=>!Hr(t)&&typeof t=="object";var F=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(F||{});let Wr=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,n)=>(n&=63,n<36?e+=n.toString(36):n<62?e+=(n-26).toString(36).toUpperCase():n>62?e+="-":e+="_",e),"");const $r=/^-ms-/,Gr=/-([a-z])/g,Q=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class O{static stringAt(e){let n="",s=e;for(;s>=Q.length;)s/=Q.length,s-=1,n+=Q[s%Q.length];const r=e%Q.length;return n+=Q[r],n}static indexAt(e){let n=0;for(let s=0;s<e.length-1;s+=1){const r=e.charCodeAt(s)-65,i=e.length-1-s;n+=Q.length**i+Q.length*r}return n+=e.charCodeAt(e.length-1)-65,n}static deleteBlank(e){return O.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",s=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(s)return"Mac";if(navigator.platform==="X11"&&!n&&!s)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,n=e.indexOf("Opera")>-1,s=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!n,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,h=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(s){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const u=parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":h?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Wr(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...n){n.forEach(o=>o&&i(o));function s(o,a){o.forEach((h,l)=>{if(O.isArray(h)){const u=a[l]??[];a[l]=u,s(h,u);return}if(O.isObject(h)){const u=a[l]??{};a[l]=u,r(h,u);return}a[l]=h})}function r(o,a){Object.keys(o).forEach(h=>{const l=o[h];if(O.isObject(l)){const u=a[h]??{};a[h]=u,r(l,u);return}if(O.isArray(l)){const u=a[h]??[];a[h]=u,s(l,u);return}a[h]=l})}function i(o){Object.keys(o).forEach(a=>{const h=o[a];if(O.isArray(h)){const l=e[a]??[];e[a]=l,s(h,l);return}if(O.isObject(h)){const l=e[a]??{};e[a]=l,r(h,l);return}e[a]=h})}return e}static numberFixed(e,n){return Number(Number(e).toFixed(n))}static diffValue(e,n){function s(o,a){const h=O.getValueType(o),l=O.getValueType(a);return h!==l?!1:O.isArray(o)?r(o,a):O.isObject(o)?i(o,a):O.isDate(o)?o.getTime()===a.getTime():O.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(e.length!==n.length)return!1;for(let h=0,l=o.length;h<l;h++){const u=o[h],d=a[h];if(!s(u,d))return!1}return!0}function i(o,a){const h=Object.keys(o),l=Object.keys(a);if(h.length!==l.length)return!1;for(const u of h){if(!l.includes(u))return!1;const d=o[u],f=a[u];if(!s(d,f))return!1}return!0}return s(e,n)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const n=[];return e.forEach((s,r)=>{n[r]=O.deepClone(s)}),n}if(this.isObject(e)){const n={};return Object.keys(e).forEach(s=>{const r=e[s];n[s]=O.deepClone(r)}),Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,n){return e instanceof n}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const n in e)return!1;return!0}static isMobile(){let e=0,n=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<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 e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return n=>{for(let s=0;s<e;s++)n&&n()}}static hasLength(e,n){return O.isDefine(e)?O.isDefine(n)?e.length===n:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,n){return n.toUpperCase()}static camelCase(e){return e.replace($r,"ms-").replace(Gr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(n=>{const s=e[n];s==null?delete e[n]:O.removeNull(s)}),e}static fillTwoDimensionalArray(e,n,s){return new Array(e).fill(s).map(r=>new Array(n).fill(s))}static numToWord(e){let n="";for(;e>0;){let s=e%26;s=s===0?s=26:s,n=String.fromCharCode(96+s)+n,e=(e-s)/26}return n.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;const n=e.toLowerCase().split(""),s=n.length;let r=0,i=0;for(let o=0;o<s;o++)i=n[o].charCodeAt(0)-96,r+=i*26**(s-o-1);return r===0?NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let n=0,s=e.length;n<s;n++){const r=parseInt((Math.random()*s).toString()),i=e[r];e[r]=e[n],e[n]=i}return e}static commonExtend(e,n){const s={};for(const r in e)s[r]=e[r];for(const r in n)n[r]!=null&&(s[r]=n[r]);return s}static commonExtend1(e,n){for(const s in e)n[s]==null&&(n[s]=e[s]);return n}static arrayToObject(e){const n={};return e.forEach((s,r)=>{n[r]={},s.forEach((i,o)=>{n[r][o]=i})}),n}static hasIntersectionBetweenTwoRanges(e,n,s,r){return n>=s&&r>=e}}function kr(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:h,endX:l}=t,u=e,d=n,f=e,_=n;if(s&&i){const{startRow:E,startColumn:R,endRow:m,endColumn:I,startY:S,endY:D,startX:$,endX:B}=i;u=E,d=R,f=m,_=I,o=S,a=D,h=$,l=B}return r&&(o=i.startY,a=i.endY,h=i.startX,l=i.endX,f=i.endRow,_=i.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:_,startY:o,endY:a,startX:h,endX:l}}function xr(t){if(!t)return;const{actualRow:e,actualColumn:n,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:h}=t;let l=e,u=n,d=e,f=n;return(s||r)&&(l=i,u=o,d=a,f=h),{startRow:l,startColumn:u,endRow:d,endColumn:f}}function pr(t){var n;return!t||(((n=t==null?void 0:t.v)==null?void 0:n.toString())||"").length===0&&!t.p}function Y(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Bt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Vr(t){return O.isString(t)&&t.substring(0,1)==="="&&t.length>1}function jr(t){return O.isString(t)&&t.indexOf("=")===-1&&t.length===6}function zr(t){return""}function Yr(t,e=!1){var i;let n="";const s=new Map([["ff",()=>{t.ff&&(n+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(n+="font-style: italic; ")}],["bl",()=>{t.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," underline"):n+="text-decoration-line: underline; ",t.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Y(t.ul.cl)}; `),t.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," line-through"):n+="text-decoration-line: line-through; ",t.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Y(t.st.cl)}; `),t.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," overline"):n+="text-decoration-line: overline; ",t.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Y(t.ol.cl)}; `),t.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(n+=`background: ${Y(t.bg)}; `)}],["bd",()=>{var o,a,h,l,u,d,f,_;(o=t.bd)!=null&&o.b&&(n+=`border-bottom: ${kt((a=t.bd)==null?void 0:a.b.s)} ${Y(t.bd.b.cl)??""}; `),(h=t.bd)!=null&&h.t&&(n+=`border-top: ${kt((l=t.bd)==null?void 0:l.t.s)} ${Y(t.bd.t.cl)??""}; `),(u=t.bd)!=null&&u.r&&(n+=`border-right: ${kt((d=t.bd)==null?void 0:d.r.s)} ${Y(t.bd.r.cl)??""}; `),(f=t.bd)!=null&&f.l&&(n+=`border-left: ${kt((_=t.bd)==null?void 0:_.l.s)} ${Y(t.bd.l.cl)??""}; `)}],["cl",()=>{t.cl&&(n+=`color: ${Y(t.cl)}; `)}],["va",()=>{t.va===Ft.SUBSCRIPT?n+="vertical-align: sub; ":t.va===Ft.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{t.td===Ot.LEFT_TO_RIGHT?n+="direction: ltr; ":t.td===Ot.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,h;t.tr&&(n+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(h=t.tr)==null?void 0:h.v}`:""});`)}],["ht",()=>{t.ht===rt.LEFT?n+="text-align: left; ":t.ht===rt.RIGHT?n+="text-align: right; ":t.ht===rt.CENTER?n+="text-align: center; ":t.ht===rt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{t.vt===ut.BOTTOM?n+="vertical-align: bottom; ":t.vt===ut.TOP?n+="vertical-align: top; ":t.vt===ut.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{t.tb===ct.CLIP?n+="text-overflow: clip; ":t.tb===ct.OVERFLOW?n+="text-break: overflow; ":t.tb===ct.WRAP&&(n+="word-wrap: break-word;")}],["pd",()=>{var u,d,f,_,E,R,m,I;const o=`${(u=t.pd)==null?void 0:u.b}pt`,a=`${(d=t.pd)==null?void 0:d.t}pt`,h=`${(f=t.pd)==null?void 0:f.l}pt`,l=`${(_=t.pd)==null?void 0:_.r}pt`;(E=t.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(m=t.pd)!=null&&m.l&&(n+=`padding-left: ${h}; `),(I=t.pd)!=null&&I.r&&(n+=`padding-right: ${l}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=s.get(o))==null||i();return n}function kt(t){let e="";return t===L.NONE?e="none":t===L.THIN?e="0.5pt solid":t===L.HAIR?e="0.5pt double":t===L.DOTTED?e="0.5pt dotted":t===L.DASHED||t===L.DASH_DOT?e="0.5pt dashed":t===L.DASH_DOT_DOT?e="0.5pt dotted":t===L.DOUBLE?e="0.5pt double":t===L.MEDIUM?e="1pt solid":t===L.MEDIUM_DASHED||t===L.MEDIUM_DASH_DOT?e="1pt dashed":t===L.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===L.SLANT_DASH_DOT?e="0.5pt dashed":t===L.THICK&&(e="1.5pt solid"),e}function Kr(t){let e=0;if(t=t.trim(),t==="none")e=L.NONE;else if(t==="0.5pt solid")e=L.THIN;else if(t==="0.5pt double")e=L.HAIR;else if(t==="0.5pt dotted")e=L.DOTTED;else if(t==="0.5pt dashed")e=L.DASHED;else if(t==="1pt solid")e=L.MEDIUM;else if(t==="1pt dashed")e=L.MEDIUM_DASHED;else if(t==="1pt dotted")e=L.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=L.THICK;else return L.NONE;return e}function xt(t,e){let n=t.body;if(e){const{headers:s,footers:r}=t;s!=null&&s[e]?n=s[e].body:r!=null&&r[e]&&(n=r[e].body)}return n}function Xr(t){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=t;return!(e<0||s<0||n<0||r<0)}function ue(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(n=>ue(t[n],e[n])):t===e:!1}function wn(t,e){const n=t.ts||{},s=e.ts||{};return t.sId!==e.sId?!1:ue(n,s)}function ce(t,e,n,s){if(t>e&&([t,e]=[e,t]),n>s&&([n,s]=[s,n]),e<n||s<t)return[t,e];n<t&&(n=t),s>e&&(s=e);const r=s-n+1;let i=[];return t===n?i=[s+1-r,e-r]:e===s?i=[t,n-1]:i=[t,e-r],i}function qr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Qr(t){if(t==null)return!1;const e=t.paragraphStyle;return vn(e)}function vn(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Dn(t,e,n){return t.slice(0,e)+n+t.slice(e)}function Mn(t,e,n){return e>n?t:t.slice(0,e)+t.slice(n)}var Zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Un={exports:{}};/*! @preserve
4
- * numeral.js
5
- * version : 2.0.6
6
- * author : Adam Draper
7
- * license : MIT
8
- * http://adamwdraper.github.com/Numeral-js/
9
- */(function(t){(function(e,n){t.exports?t.exports=n():e.numeral=n()})(Zr,function(){var e,n,s="2.0.6",r={},i={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},a={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function h(l,u){this._input=l,this._value=u}return e=function(l){var u,d,f,_;if(e.isNumeral(l))u=l.value();else if(l===0||typeof l>"u")u=0;else if(l===null||n.isNaN(l))u=null;else if(typeof l=="string")if(a.zeroFormat&&l===a.zeroFormat)u=0;else if(a.nullFormat&&l===a.nullFormat||!l.replace(/[^0-9]+/g,"").length)u=null;else{for(d in r)if(_=typeof r[d].regexps.unformat=="function"?r[d].regexps.unformat():r[d].regexps.unformat,_&&l.match(_)){f=r[d].unformat;break}f=f||e._.stringToNumber,u=f(l)}else u=Number(l)||null;return new h(l,u)},e.version=s,e.isNumeral=function(l){return l instanceof h},e._=n={numberToFormat:function(l,u,d){var f=i[e.options.currentLocale],_=!1,E=!1,R=0,m="",I=1e12,S=1e9,D=1e6,$=1e3,B="",Et=!1,G,nt,P,z,Ge,er,X;if(l=l||0,nt=Math.abs(l),e._.includes(u,"(")?(_=!0,u=u.replace(/[\(|\)]/g,"")):(e._.includes(u,"+")||e._.includes(u,"-"))&&(Ge=e._.includes(u,"+")?u.indexOf("+"):l<0?u.indexOf("-"):-1,u=u.replace(/[\+|\-]/g,"")),e._.includes(u,"a")&&(G=u.match(/a(k|m|b|t)?/),G=G?G[1]:!1,e._.includes(u," a")&&(m=" "),u=u.replace(new RegExp(m+"a[kmbt]?"),""),nt>=I&&!G||G==="t"?(m+=f.abbreviations.trillion,l=l/I):nt<I&&nt>=S&&!G||G==="b"?(m+=f.abbreviations.billion,l=l/S):nt<S&&nt>=D&&!G||G==="m"?(m+=f.abbreviations.million,l=l/D):(nt<D&&nt>=$&&!G||G==="k")&&(m+=f.abbreviations.thousand,l=l/$)),e._.includes(u,"[.]")&&(E=!0,u=u.replace("[.]",".")),P=l.toString().split(".")[0],z=u.split(".")[1],er=u.indexOf(","),R=(u.split(".")[0].split(",")[0].match(/0/g)||[]).length,z?(e._.includes(z,"[")?(z=z.replace("]",""),z=z.split("["),B=e._.toFixed(l,z[0].length+z[1].length,d,z[1].length)):B=e._.toFixed(l,z.length,d),P=B.split(".")[0],e._.includes(B,".")?B=f.delimiters.decimal+B.split(".")[1]:B="",E&&Number(B.slice(1))===0&&(B="")):P=e._.toFixed(l,0,d),m&&!G&&Number(P)>=1e3&&m!==f.abbreviations.trillion)switch(P=String(Number(P)/1e3),m){case f.abbreviations.thousand:m=f.abbreviations.million;break;case f.abbreviations.million:m=f.abbreviations.billion;break;case f.abbreviations.billion:m=f.abbreviations.trillion;break}if(e._.includes(P,"-")&&(P=P.slice(1),Et=!0),P.length<R)for(var nr=R-P.length;nr>0;nr--)P="0"+P;return er>-1&&(P=P.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),u.indexOf(".")===0&&(P=""),X=P+B+(m||""),_?X=(_&&Et?"(":"")+X+(_&&Et?")":""):Ge>=0?X=Ge===0?(Et?"-":"+")+X:X+(Et?"-":"+"):Et&&(X="-"+X),X},stringToNumber:function(l){var u=i[a.currentLocale],d=l,f={thousand:3,million:6,billion:9,trillion:12},_,E,R;if(a.zeroFormat&&l===a.zeroFormat)E=0;else if(a.nullFormat&&l===a.nullFormat||!l.replace(/[^0-9]+/g,"").length)E=null;else{E=1,u.delimiters.decimal!=="."&&(l=l.replace(/\./g,"").replace(u.delimiters.decimal,"."));for(_ in f)if(R=new RegExp("[^a-zA-Z]"+u.abbreviations[_]+"(?:\\)|(\\"+u.currency.symbol+")?(?:\\))?)?$"),d.match(R)){E*=Math.pow(10,f[_]);break}E*=(l.split("-").length+Math.min(l.split("(").length-1,l.split(")").length-1))%2?1:-1,l=l.replace(/[^0-9\.]+/g,""),E*=Number(l)}return E},isNaN:function(l){return typeof l=="number"&&isNaN(l)},includes:function(l,u){return l.indexOf(u)!==-1},insert:function(l,u,d){return l.slice(0,d)+u+l.slice(d)},reduce:function(l,u){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof u!="function")throw new TypeError(u+" is not a function");var d=Object(l),f=d.length>>>0,_=0,E;if(arguments.length===3)E=arguments[2];else{for(;_<f&&!(_ in d);)_++;if(_>=f)throw new TypeError("Reduce of empty array with no initial value");E=d[_++]}for(;_<f;_++)_ in d&&(E=u(E,d[_],_,d));return E},multiplier:function(l){var u=l.toString().split(".");return u.length<2?1:Math.pow(10,u[1].length)},correctionFactor:function(){var l=Array.prototype.slice.call(arguments);return l.reduce(function(u,d){var f=n.multiplier(d);return u>f?u:f},1)},toFixed:function(l,u,d,f){var _=l.toString().split("."),E=u-(f||0),R,m,I,S;return _.length===2?R=Math.min(Math.max(_[1].length,E),u):R=E,I=Math.pow(10,R),S=(d(l+"e+"+R)/I).toFixed(R),f>u-R&&(m=new RegExp("\\.?0{1,"+(f-(u-R))+"}$"),S=S.replace(m,"")),S}},e.options=a,e.formats=r,e.locales=i,e.locale=function(l){return l&&(a.currentLocale=l.toLowerCase()),a.currentLocale},e.localeData=function(l){if(!l)return i[a.currentLocale];if(l=l.toLowerCase(),!i[l])throw new Error("Unknown locale : "+l);return i[l]},e.reset=function(){for(var l in o)a[l]=o[l]},e.zeroFormat=function(l){a.zeroFormat=typeof l=="string"?l:null},e.nullFormat=function(l){a.nullFormat=typeof l=="string"?l:null},e.defaultFormat=function(l){a.defaultFormat=typeof l=="string"?l:"0.0"},e.register=function(l,u,d){if(u=u.toLowerCase(),this[l+"s"][u])throw new TypeError(u+" "+l+" already registered.");return this[l+"s"][u]=d,d},e.validate=function(l,u){var d,f,_,E,R,m,I,S;if(typeof l!="string"&&(l+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",l)),l=l.trim(),l.match(/^\d+$/))return!0;if(l==="")return!1;try{I=e.localeData(u)}catch{I=e.localeData(e.locale())}return _=I.currency.symbol,R=I.abbreviations,d=I.delimiters.decimal,I.delimiters.thousands==="."?f="\\.":f=I.delimiters.thousands,S=l.match(/^[^\d]+/),S!==null&&(l=l.substr(1),S[0]!==_)||(S=l.match(/[^\d]+$/),S!==null&&(l=l.slice(0,-1),S[0]!==R.thousand&&S[0]!==R.million&&S[0]!==R.billion&&S[0]!==R.trillion))?!1:(m=new RegExp(f+"{2}"),l.match(/[^\d.,]/g)?!1:(E=l.split(d),E.length>2?!1:E.length<2?!!E[0].match(/^\d+.*\d$/)&&!E[0].match(m):E[0].length===1?!!E[0].match(/^\d+$/)&&!E[0].match(m)&&!!E[1].match(/^\d+$/):!!E[0].match(/^\d+.*\d$/)&&!E[0].match(m)&&!!E[1].match(/^\d+$/)))},e.fn=h.prototype={clone:function(){return e(this)},format:function(l,u){var d=this._value,f=l||a.defaultFormat,_,E,R;if(u=u||Math.round,d===0&&a.zeroFormat!==null)E=a.zeroFormat;else if(d===null&&a.nullFormat!==null)E=a.nullFormat;else{for(_ in r)if(f.match(r[_].regexps.format)){R=r[_].format;break}R=R||e._.numberToFormat,E=R(d,f,u)}return E},value:function(){return this._value},input:function(){return this._input},set:function(l){return this._value=Number(l),this},add:function(l){var u=n.correctionFactor.call(null,this._value,l);function d(f,_,E,R){return f+Math.round(u*_)}return this._value=n.reduce([this._value,l],d,0)/u,this},subtract:function(l){var u=n.correctionFactor.call(null,this._value,l);function d(f,_,E,R){return f-Math.round(u*_)}return this._value=n.reduce([l],d,Math.round(this._value*u))/u,this},multiply:function(l){function u(d,f,_,E){var R=n.correctionFactor(d,f);return Math.round(d*R)*Math.round(f*R)/Math.round(R*R)}return this._value=n.reduce([this._value,l],u,1),this},divide:function(l){function u(d,f,_,E){var R=n.correctionFactor(d,f);return Math.round(d*R)/Math.round(f*R)}return this._value=n.reduce([this._value,l],u),this},difference:function(l){return Math.abs(e(this._value).subtract(l).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(l){var u=l%10;return~~(l%100/10)===1?"th":u===1?"st":u===2?"nd":u===3?"rd":"th"},currency:{symbol:"$"}}),function(){e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(l,u,d){var f=e._.includes(u," BPS")?" ":"",_;return l=l*1e4,u=u.replace(/\s?BPS/,""),_=e._.numberToFormat(l,u,d),e._.includes(_,")")?(_=_.split(""),_.splice(-1,0,f+"BPS"),_=_.join("")):_=_+f+"BPS",_},unformat:function(l){return+(e._.stringToNumber(l)*1e-4).toFixed(15)}})}(),function(){var l={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},u={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},d=l.suffixes.concat(u.suffixes.filter(function(_){return l.suffixes.indexOf(_)<0})),f=d.join("|");f="("+f.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(_,E,R){var m,I=e._.includes(E,"ib")?u:l,S=e._.includes(E," b")||e._.includes(E," ib")?" ":"",D,$,B;for(E=E.replace(/\s?i?b/,""),D=0;D<=I.suffixes.length;D++)if($=Math.pow(I.base,D),B=Math.pow(I.base,D+1),_===null||_===0||_>=$&&_<B){S+=I.suffixes[D],$>0&&(_=_/$);break}return m=e._.numberToFormat(_,E,R),m+S},unformat:function(_){var E=e._.stringToNumber(_),R,m;if(E){for(R=l.suffixes.length-1;R>=0;R--){if(e._.includes(_,l.suffixes[R])){m=Math.pow(l.base,R);break}if(e._.includes(_,u.suffixes[R])){m=Math.pow(u.base,R);break}}E*=m||1}return E}})}(),function(){e.register("format","currency",{regexps:{format:/(\$)/},format:function(l,u,d){var f=e.locales[e.options.currentLocale],_={before:u.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:u.match(/([\+|\-|\)|\s|\$]*)$/)[0]},E,R,m;for(u=u.replace(/\s?\$\s?/,""),E=e._.numberToFormat(l,u,d),l>=0?(_.before=_.before.replace(/[\-\(]/,""),_.after=_.after.replace(/[\-\)]/,"")):l<0&&!e._.includes(_.before,"-")&&!e._.includes(_.before,"(")&&(_.before="-"+_.before),m=0;m<_.before.length;m++)switch(R=_.before[m],R){case"$":E=e._.insert(E,f.currency.symbol,m);break;case" ":E=e._.insert(E," ",m+f.currency.symbol.length-1);break}for(m=_.after.length-1;m>=0;m--)switch(R=_.after[m],R){case"$":E=m===_.after.length-1?E+f.currency.symbol:e._.insert(E,f.currency.symbol,-(_.after.length-(1+m)));break;case" ":E=m===_.after.length-1?E+" ":e._.insert(E," ",-(_.after.length-(1+m)+f.currency.symbol.length-1));break}return E}})}(),function(){e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(l,u,d){var f,_=typeof l=="number"&&!e._.isNaN(l)?l.toExponential():"0e+0",E=_.split("e");return u=u.replace(/e[\+|\-]{1}0/,""),f=e._.numberToFormat(Number(E[0]),u,d),f+"e"+E[1]},unformat:function(l){var u=e._.includes(l,"e+")?l.split("e+"):l.split("e-"),d=Number(u[0]),f=Number(u[1]);f=e._.includes(l,"e-")?f*=-1:f;function _(E,R,m,I){var S=e._.correctionFactor(E,R),D=E*S*(R*S)/(S*S);return D}return e._.reduce([d,Math.pow(10,f)],_,1)}})}(),function(){e.register("format","ordinal",{regexps:{format:/(o)/},format:function(l,u,d){var f=e.locales[e.options.currentLocale],_,E=e._.includes(u," o")?" ":"";return u=u.replace(/\s?o/,""),E+=f.ordinal(l),_=e._.numberToFormat(l,u,d),_+E}})}(),function(){e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(l,u,d){var f=e._.includes(u," %")?" ":"",_;return e.options.scalePercentBy100&&(l=l*100),u=u.replace(/\s?\%/,""),_=e._.numberToFormat(l,u,d),e._.includes(_,")")?(_=_.split(""),_.splice(-1,0,f+"%"),_=_.join("")):_=_+f+"%",_},unformat:function(l){var u=e._.stringToNumber(l);return e.options.scalePercentBy100?u*.01:u}})}(),function(){e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(l,u,d){var f=Math.floor(l/60/60),_=Math.floor((l-f*60*60)/60),E=Math.round(l-f*60*60-_*60);return f+":"+(_<10?"0"+_:_)+":"+(E<10?"0"+E:E)},unformat:function(l){var u=l.split(":"),d=0;return u.length===3?(d=d+Number(u[0])*60*60,d=d+Number(u[1])*60,d=d+Number(u[2])):u.length===2&&(d=d+Number(u[0])*60,d=d+Number(u[1])),Number(d)}})}(),e})})(Un);var yr=Un.exports;const ot=Jr(yr),he={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function ti(t){let e=!1;for(const n in he)if(t===he[n]){e=!0;break}return e}function at(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function ei(t){if(t===null||t.toString().length<5)return!1;if(e(t))return!0;return!1;function e(n){const s=/^(\d{4})-(\d{1,2})-(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/,r=/^(\d{4})\/(\d{1,2})\/(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/;if(!s.test(n)&&!r.test(n))return!1;const i=RegExp.$1,o=RegExp.$2,a=RegExp.$3;return!(i<1900||o>12||a>31||o===2&&(new Date(i,1,29).getDate()===29&&a>29||new Date(i,1,29).getDate()!==29&&a>28))}}let pt=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(pt.getFullYear())&&(pt=new Date("2/19/17"));const ni=pt.getFullYear()===2017;function si(t,e){const n=new Date(t);if(ni)return e>0?n.setTime(n.getTime()+n.getTimezoneOffset()*60*1e3):e<0&&n.setTime(n.getTime()-n.getTimezoneOffset()*60*1e3),n;if(t instanceof Date)return t;if(pt.getFullYear()===1917&&!Number.isNaN(n.getFullYear())){const i=n.getFullYear();return t.indexOf(`${i}`)>-1||n.setFullYear(n.getFullYear()+100),n}const s=t.match(/\d+/g)||["2017","2","19","0","0","0"];let r=new Date(+s[0],+s[1]-1,+s[2],+s[3]||0,+s[4]||0,+s[5]||0);return t.indexOf("Z")>-1&&(r=new Date(r.getTime()-r.getTimezoneOffset()*60*1e3)),r}const ri=new Date(1900,2,1,0,0,0);function Tn(t,e){let n=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const s=Date.UTC(1899,11,31,0,0,0);return e?n-=1461*24*60*60*1e3:t>=ri&&(n+=24*60*60*1e3),(n-s)/(24*60*60*1e3)}function ii(t){let e=null,n={},s=t;if(t===null)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,s=Number(t.split(".")[0].replace(",",""));let r="#,##0";if(t.split(".")[1]){r="#,##0.";for(let i=0;i<t.split(".")[1].length;i++)r+=0}n={fa:r,t:"n"}}else if(t.toString().substr(0,1)==="'")e=t.toString().substr(1),n={fa:"@",t:"s"};else if(t.toString().toUpperCase()==="TRUE")e="TRUE",n={fa:"General",t:"b"},s=!0;else if(t.toString().toUpperCase()==="FALSE")e="FALSE",n={fa:"General",t:"b"},s=!1;else if(ti(t))e=t.toString(),n={fa:"General",t:"e"};else if(/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(t))e=t.toString(),n={fa:"@",t:"s"};else if(at(t)&&Math.abs(parseFloat(t))>0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){s=ot(t).value();const r=s.toExponential();if(r.indexOf(".")>-1){let i=r.split(".")[1].split("e")[0].length;i>5&&(i=5),n={fa:`#0.${new Array(i+1).join("0")}E+00`,t:"n"}}else n={fa:"#0.E+00",t:"n"};e=Z.format(n.fa,s)}else if(t.toString().indexOf("%")>-1){const r=t.toString().indexOf("%"),i=t.toString().substr(0,r),o=i.replace(/,/g,"");if(r===t.toString().length-1&&at(o))if(i.indexOf(".")>-1)if(i.indexOf(".")===i.lastIndexOf(".")){const a=i.split(".")[0];let l=i.split(".")[1].length;if(l>9&&(l=9),a.indexOf(",")>-1){let u=!0;const d=a.split(",");for(let f=1;f<d.length;f++)if(d[f].length<3){u=!1;break}u?(n={fa:`#,##0.${new Array(l+1).join("0")}%`,t:"n"},s=ot(t).value(),e=Z.format(n.fa,s)):(e=t.toString(),n={fa:"@",t:"s"})}else n={fa:`0.${new Array(l+1).join("0")}%`,t:"n"},s=ot(t).value(),e=Z.format(n.fa,s)}else e=t.toString(),n={fa:"@",t:"s"};else if(i.indexOf(",")>-1){let a=!0;const h=i.split(",");for(let l=1;l<h.length;l++)if(h[l].length<3){a=!1;break}a?(n={fa:"#,##0%",t:"n"},s=ot(t).value(),e=Z.format(n.fa,s)):(e=t.toString(),n={fa:"@",t:"s"})}else n={fa:"0%",t:"n"},s=ot(t).value(),e=Z.format(n.fa,s);else e=t.toString(),n={fa:"@",t:"s"}}else if(t.toString().indexOf(".")>-1)if(t.toString().indexOf(".")===t.toString().lastIndexOf(".")){const r=t.toString().split(".")[0],i=t.toString().split(".")[1];let o=i.length;if(o>9&&(o=9),r.indexOf(",")>-1){let a=!0;const h=r.split(",");for(let l=1;l<h.length;l++)if(!at(h[l])||h[l].length<3){a=!1;break}a?(n={fa:`#,##0.${new Array(o+1).join("0")}`,t:"n"},s=ot(t).value(),e=Z.format(n.fa,s)):(e=t.toString(),n={fa:"@",t:"s"})}else at(r)&&at(i)?(n={fa:`0.${new Array(o+1).join("0")}`,t:"n"},s=ot(t).value(),e=Z.format(n.fa,s)):(e=t.toString(),n={fa:"@",t:"s"})}else e=t.toString(),n={fa:"@",t:"s"};else at(t)?(e=t.toString(),n={fa:"General",t:"n"},s=parseFloat(t)):ei(t)&&(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(s=Tn(si(t.toString().replace(/-/g,"/"))),s.toString().indexOf(".")>-1?t.toString().length>18?n.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?n.fa="yyyy-MM-dd hh:mm":n.fa="yyyy-MM-dd":n.fa="yyyy-MM-dd",n.t="d",e=Z.format(n.fa,s)):(e=t,n.fa="General",n.t="g");return[e,n,s]}const Z={format(t,e){}},oi=(t,e)=>{};function ai(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+(e<<6)+(e<<16)-e;return e>>>0}class It{static hasLength(e,n){return e.length===n}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}const b=Symbol("newer"),U=Symbol("older");class Pn{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[b],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Fn{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[b],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Hn{constructor(e){g(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[b],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}class de{constructor(e,n){g(this,"key");g(this,"value");g(this,xo);g(this,po);this.key=e,this.value=n,this[b]=void 0,this[U]=void 0}toJSON(){return{key:this.key,value:this.value}}}xo=b,po=U;class Bn{constructor(...e){g(this,"_keymap");g(this,"size",0);g(this,"limit");g(this,"oldest");g(this,"newest");g(this,"_onShiftListeners",[]);if(It.hasLength(e,1)){if(It.isNumber(e[0])){const n=e[0];this._initialize(n,void 0);return}if(It.isIterable(e[0])){const n=e[0];this._initialize(0,n);return}return}if(It.hasLength(e,2)){const n=e[0],s=e[1];this._initialize(n,s)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),w(()=>q(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,n&&(this.assign(n),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[b]&&(e===this.oldest&&(this.oldest=e[b]),e[b][U]=e[U]),e[U]&&(e[U][b]=e[b]),e[b]=void 0,e[U]=this.newest,this.newest&&(this.newest[b]=e),this.newest=e)}assign(e){let n,s=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new de(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[b]=o,o[U]=n):this.oldest=o,n=o,s--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(e,n){let s=this._keymap.get(e);return s?(s.value=n,this._markEntryAsUsed(s),this):(this._keymap.set(e,s=new de(e,n)),this.newest?(this.newest[b]=s,s[U]=this.newest):this.oldest=s,this.newest=s,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[b]?(this.oldest=this.oldest[b],this.oldest[U]=void 0):(this.oldest=void 0,this.newest=void 0),e[b]=e[U]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(n=>n(e)),[e.key,e.value]}get(e){const n=this._keymap.get(e);if(n)return this._markEntryAsUsed(n),n.value}has(e){return this._keymap.has(e)}find(e){const n=this._keymap.get(e);return n?n.value:void 0}delete(e){const n=this._keymap.get(e);if(n)return this._keymap.delete(n.key),n[b]&&n[U]?(n[U][b]=n[b],n[b][U]=n[U]):n[b]?(n[b][U]=void 0,this.oldest=n[b]):n[U]?(n[U][b]=void 0,this.newest=n[U]):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 Pn(this.oldest)}values(){return new Fn(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Hn(this.oldest)}forEach(e,n){typeof n!="object"&&(n=this);let s=this.oldest;for(;s;)e.call(n,s.value,s.key,this),s=s[b]}toJSON(){const e=new Array(this.size);let n=0,s=this.oldest;for(;s;)e[n++]={key:s.key,value:s.value},s=s[b];return e}toString(){let e="",n=this.oldest;for(;n;)e+=`${String(n.key)}:${n.value}`,n=n[b],n&&(e+=" < ");return e}}function V(t){let e=0;const n=Object.keys(t);for(const s of n){const r=Number(s);e=Math.max(e,r)}return e+1}function li(t,e,n){const s=V(n),r=n;for(let i=s-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function ui(t,e,n){const s=t+e,r=V(n),i=n;let o=0;const a={};for(let u=t;u<s;u++){const d=i[u];d!==void 0&&(delete i[u],a[o]=d,o++)}const h=s-t,l=r;for(let u=s;u<l;u++)i[u]!==void 0&&(i[u-h]=i[u],delete i[u])}function ci(t,e){const n=t,s=Object.keys(n),r=s.length,i=e,o=Object.keys(i),a=o.length,h={};let l=0;for(let u=0;u<r;u++,l++){const d=s[u];h[l]=n[d]}for(let u=0;u<a;u++,l++){const d=o[u];h[l]=i[d]}return h}function hi(t,e,n){const s=n;if(V(n)>0){const i={};let o=0;for(let a=t;a<=e;a++)s[a]&&(i[o]=s[a],o++);return i}return{}}function _e(t,e,n,s){const r=t>n;if(!r&&t+e>n)throw new Error("Invalid move operation");r?di(t,e,n,s):_i(t,e,n,s)}function di(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=n;o--){const a=r[o];r[o+e]=a,a==null&&delete r[o+e]}i.forEach((o,a)=>{r[n+a]=o,o==null&&delete r[n+a]})}function _i(t,e,n,s){const r=s,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<n;o++){const a=r[o];r[o-e]=a,a==null&&delete r[o-e]}i.forEach((o,a)=>{r[n+a-e]=o,o==null&&delete r[n+a-e]})}class K{constructor(e={}){g(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new K({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,o)===!1)return this}return this}forRow(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(e(i,Object.keys(o).map(h=>Number(h)))===!1)return this}return this}forValue(e){const n=this._matrix,s=Object.keys(n);for(const r of s){const i=Number(r),o=n[i];if(!o)continue;const a=Object.keys(o);for(const h of a){const l=Number(h),u=o[Number(h)];if(e(i,l,u)===!1)return this}}return this}swapRow(e,n){const s=this._matrix[e],r=this._matrix[n];this._matrix[e]=r,this._matrix[n]=s}getRow(e){return this._matrix[e]}getRowOrCreate(e){let n=this.getRow(e);return n==null&&(n={},this._matrix[e]=n),n}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,n=Object.keys(e);if(n.length===0)return!1;for(const s of n){const r=Number(s),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,n){var s,r;return(r=(s=this._matrix)==null?void 0:s[e])==null?void 0:r[n]}setValue(e,n,s){const r=this.getRowOrCreate(e);r[n]=s}deleteValue(e,n){var s,r;(r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n]}realDeleteValue(e,n){var s,r,i;if((r=(s=this._matrix)==null?void 0:s[e])==null||delete r[n],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,n){this._matrix[e]=n}moveRows(e,n,s){_e(e,n,s,this._matrix)}moveColumns(e,n,s){this.forEach((r,i)=>{_e(e,n,s,i)})}getFragment(e,n,s,r){const i=new K;let o=0;for(let a=e;a<=n;a++){const h={};let l=0;for(let u=s;u<=r;u++){const d=this.getValue(a,u);h[l]=d,l++}i.setRow(o,h),o++}return i}getSlice(e,n,s,r){const i=new K;for(let o=e;o<=n;o++)for(let a=s;a<=r;a++){const h=this.getValue(o,a);h&&i.setValue(o,a,O.deepClone(h))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return V(this._matrix)}getRange(){const s=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const h=V(a)-1;r=h>r?h:r}}return{startRow:0,startColumn:0,endRow:s,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((n,s,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((n,s)=>{e[n]==null&&(e[n]=[]),s.forEach(r=>{e[n][r]=this.getValue(n,r)})}),e}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,n=0,s=!1,r=!1;const i=new K;return this.forEach((o,a)=>{s||(s=!0,e=o),Object.keys(a).forEach(h=>{const l=Number(h);r?l<n&&(n=l):(r=!0,n=l);const u=this.getValue(o,l);i.setValue(o-e,l-n,u)})}),i.getData()}getDataRange(){let e=0,n=0,s=0,r=-1,i=!1,o=!1;return this.forEach((a,h)=>{i||(i=!0,e=a);const l=V(h)-1;l>s&&(s=l),Object.keys(h).forEach(u=>{const d=Number(u);o?d<n&&(n=d):(o=!0,n=d)}),a>r&&(r=a)}),{startRow:e,startColumn:n,endRow:r,endColumn:s}}getDiscreteRanges(){const e=[];return this.forEach((n,s)=>{Object.keys(s).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)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||e.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((n,s)=>{const r=e.getValue(n,s);r!=null&&this.setValue(n,s,r)})}_setOriginValue(e={}){this._matrix=e}}var fe=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(fe||{});class Wn{constructor(){g(this,"status","init")}}const fi=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done";var W=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(W||{}),j=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(j||{});function gi(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const et=class et{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,n){return e==null||n==null?!1:e.endRow===n.endRow&&e.endColumn===n.endColumn&&e.startRow===n.startRow&&e.startColumn===n.startColumn&&(e.rangeType===n.rangeType||e.rangeType===void 0&&n.rangeType===W.NORMAL||n.rangeType===void 0&&e.rangeType===W.NORMAL)}static intersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=n.startRow,h=n.endRow,l=n.startColumn,u=n.endColumn,d=Math.abs(i+o-l-u),f=Math.abs(i-o)+Math.abs(l-u),_=Math.abs(s+r-a-h),E=Math.abs(s-r)+Math.abs(a-h);return d<=f&&_<=E}static getIntersects(e,n){const s=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=n.startRow,h=n.endRow,l=n.startColumn,u=n.endColumn;let d,f,_,E;if(a<=r)a>=s?f=a:f=s;else return null;if(h>=s)h>=r?E=r:E=h;else return null;if(l<=o)l>i?d=l:d=i;else return null;if(u>=i)u>=o?_=o:_=u;else return null;return{startRow:f,endRow:E,startColumn:d,endColumn:_,rangeType:W.NORMAL}}static contains(e,n){return e.startRow<=n.startRow&&e.endRow>=n.endRow&&e.startColumn<=n.startColumn&&e.endColumn>=n.endColumn}static realContain(e,n){return et.contains(e,n)&&(e.startRow<n.startRow||e.endRow>n.endRow||e.startColumn<n.startColumn||e.endColumn>n.endColumn)}static union(...e){return e.reduce((n,s)=>({startRow:Math.min(n.startRow,s.startRow),startColumn:Math.min(n.startColumn,s.startColumn),endRow:Math.max(n.endRow,s.endRow),endColumn:Math.max(n.endColumn,s.endColumn),rangeType:W.NORMAL}),e[0])}static subtract(e,n){if(n.startRow>=e.endRow||n.endRow<=e.startRow||n.startColumn>=e.endColumn||n.endColumn<=e.startColumn)return[e];const s=[];n.startRow>e.startRow&&s.push({startRow:e.startRow,startColumn:e.startColumn,endRow:n.startRow,endColumn:e.endColumn}),n.endRow<e.endRow&&s.push({startRow:n.endRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,n.startRow),i=Math.min(e.endRow,n.endRow);return n.startColumn>e.startColumn&&s.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:n.startColumn}),n.endColumn<e.endColumn&&s.push({startRow:r,startColumn:n.endColumn,endRow:i,endColumn:e.endColumn}),s}};g(et,"getRelativeRange",(e,n)=>({startRow:e.startRow-n.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-n.startColumn,endColumn:e.endColumn-e.startColumn})),g(et,"getPositionRange",(e,n)=>({startRow:e.startRow+n.startRow,endRow:e.endRow+e.startRow+n.startRow,startColumn:e.startColumn+n.startColumn,endColumn:e.endColumn+e.startColumn+n.startColumn})),g(et,"moveHorizontal",(e,n=0,s=0)=>({...e,startColumn:e.startColumn+n,endColumn:e.endColumn+n+s})),g(et,"moveVertical",(e,n=0,s=0)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n+s})),g(et,"moveOffset",(e,n,s)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s,startColumn:e.startColumn+n,endColumn:e.endColumn+n}));let ht=et;class Ei{constructor(e,n){g(this,"_values",[]);g(this,"_keys",[]);g(this,"_keyMaps",new Map);this._values=e,this._keys=n,e.forEach(s=>{this._initKeyMap(s)})}_initKeyMap(e){this._keys.forEach(n=>{const s=e[n],r=this._keyMaps.get(n)||new Map;r.set(s,e),this._keyMaps.set(n,r)})}getValue(e){for(let n=0;n<this._keys.length;n++){const s=this._keyMaps.get(this._keys[n]);if(s!=null&&s.has(e))return s.get(e)}return null}hasValue(e){for(let n=0;n<this._keys.length;n++){const s=this._keyMaps.get(this._keys[n]);if(s!=null&&s.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,n,s){const r=this.getValue(e);r&&Object.keys(r).includes(n)&&(r[n]=s)}deleteValue(e){const n=this.getValue(e);if(n){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=n[r];i==null||i.delete(o)});const s=this._values.findIndex(r=>r===n);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(e){var n;return[...((n=this._keyMaps.get(e))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ge(t,e,n,s){return{forEach(r){for(let i=t;i<=e;i++)for(let o=n;o<=s;o++)r(i,o)}}}function Ri(t){if(t==null||t.length===0)return NaN;const e=t.toLowerCase().split(""),n=e.length,s=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<n;o++)i=s(e[o]),r+=i*26**(n-o-1);return r===0?NaN:r-1}const Vt=65,$n=90,mi=97;function Oi(t){const e=$n-Vt+1;let n="";for(;t>=0;)n=String.fromCharCode(t%e+Vt)+n,t=Math.floor(t/e)-1;return n}function Gn(t,e){let n="";for(;e>0;)n+=t,e--;return n}function Ai(t,e=!1){const n=$n-Vt+1;let s=mi;e&&(s=Vt);const r=String.fromCharCode(t%n+s),i=Math.floor(t/n)+1;return Gn(r,i)}function Ii(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Ci(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function dt(t="index",e=1){return(n,s)=>n[t]>s[t]?e:n[t]===s[t]?0:-e}var kn=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(kn||{}),Ee=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
10
- `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(Ee||{});function Re(t){const e=[];for(const n of t){const{st:s,ed:r}=n;if(s===r)continue;if(e.length===0){e.push(n);continue}const i=e.pop();wn(n,i)&&O.hasIntersectionBetweenTwoRanges(i.st,i.ed,n.st,n.ed)?e.push({...n,st:i.st,ed:r}):e.push(i,n)}return e}function xn(t,e,n,s){const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const h=e.textRuns??[];if(h.length)for(let l=0,u=h.length;l<u;l++){const d=h[l];d.st+=s,d.ed+=s}for(let l=0;l<o;l++){const u=r[l],{st:d,ed:f}=u;if(f<s)i.push(u);else if(s>=d&&s<=f)if(a)u.st+=n,u.ed+=n,i.push(u);else{a=!0,u.ed+=n;const _=[];if(h.length){const E={...u,st:d,ed:h[0].st};_.push(E),_.push(...h);const R=h[h.length-1],m={...u,st:R.ed,ed:f+n};_.push(m)}else _.push(u);i.push(..._)}else u.st+=n,u.ed+=n,a||(a=!0,i.push(...h)),i.push(u)}a||(a=!0,i.push(...h)),t.textRuns=Re(i)}function me(t,e,n,s){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let h=-1;for(let u=0,d=r.length;u<d;u++){const f=r[u],{startIndex:_}=f;_>=s&&(f.startIndex+=n),h===-1&&_>=s&&(h=u),a.push(f.startIndex)}let l=-1;if(i){for(let u=0,d=i.length;u<d;u++){const f=i[u];f.startIndex+=s;const _=f.startIndex;l=a.indexOf(_)}if(o===Ee.PARAGRAPH&&i.length===1){const u=r[h],d=i[0],f=u.paragraphStyle,_=u.bullet;u.paragraphStyle=d.paragraphStyle,u.bullet=d.bullet,d.paragraphStyle=f,d.bullet=_}l!==-1&&r.splice(l,1),r.push(...i),r.sort(dt("startIndex"))}}function Si(t,e,n,s){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const h=r[o],{startIndex:l}=h;l>=s&&(h.startIndex+=n)}const i=e.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const h=i[o];h.startIndex+=s}r.push(...i),r.sort(dt("startIndex"))}}function pn(t,e,n,s){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const h=r[o],{startIndex:l}=h;l>=s&&(h.startIndex+=n)}const i=e.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const h=i[o];h.startIndex+=s}r.push(...i),r.sort(dt("startIndex"))}}function Oe(t,e,n,s){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const h=r[o],{startIndex:l,endIndex:u}=h;l>s?(h.startIndex+=n,h.endIndex+=n):u>=s-1&&(h.endIndex+=n)}const i=e.tables;if(i){for(let o=0,a=i.length;o<a;o++){const h=i[o];h.startIndex+=s,h.endIndex+=s}r.push(...i),r.sort(dt("startIndex"))}}function Ni(t,e,n,s){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const h=r[o],{startIndex:l,endIndex:u}=h;l>s?(h.startIndex+=n,h.endIndex+=n):u>=s-1&&(h.endIndex+=n)}const i=e.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const h=i[o];h.startIndex+=s,h.endIndex+=s}r.push(...i),r.sort(dt("startIndex"))}}function Vn(t,e,n){const{textRuns:s}=t,r=n,i=n+e,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{st:d,ed:f}=u;if(r<=d&&i>=f){o.push({...u,st:d-r,ed:f-r});continue}else d<=r&&f>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=e):r>=d&&r<f?(o.push({...u,st:r-r,ed:f-r}),u.ed=r):i>d&&i<=f?(o.push({...u,st:d-r,ed:i-r}),u.st=i-e,u.ed-=e):d>=i&&(u.st-=e,u.ed-=e);a.push(u)}t.textRuns=a}return o}function jn(t,e,n){const{paragraphs:s}=t,r=n,i=n+e,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{startIndex:d}=u;if(d>=r&&d<i){o.push({...u,startIndex:d-n});continue}else d>=i&&(u.startIndex-=e);a.push(u)}t.paragraphs=a}return o}function zn(t,e,n){const{sectionBreaks:s}=t,r=n,i=n+e-1,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-n});continue}else d>i&&(u.startIndex-=e);a.push(u)}t.sectionBreaks=a}return o}function Yn(t,e,n){const{customBlocks:s}=t,r=n,i=n+e-1,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-n});continue}else d>i&&(u.startIndex-=e);a.push(u)}t.customBlocks=a}return o}function Kn(t,e,n){const{tables:s}=t,r=n,i=n+e-1,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{startIndex:d,endIndex:f}=u;if(r<=d&&i>=f){o.push({...u,startIndex:d-n,endIndex:f-n});continue}else if(d<=r&&f>=i){const _=ce(d,f,r,i);u.startIndex=_[0],u.endIndex=_[1]}else i<d&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.tables=a}return o}function Xn(t,e,n){const{customRanges:s}=t,r=n,i=n+e-1,o=[];if(s){const a=[];for(let h=0,l=s.length;h<l;h++){const u=s[h],{startIndex:d,endIndex:f}=u;if(r<=d&&i>=f){o.push({...u,startIndex:d-n,endIndex:f-n});continue}else if(d<=r&&f>=i){const _=ce(d,f,r,i);u.startIndex=_[0],u.endIndex=_[1]}else i<d&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.customRanges=a}return o}function bi(t,e,n){const{dataStream:s}=t,r=n,i=n+e,o=Vn(t,e,n),a=jn(t,e,n),h=zn(t,e,n),l=Yn(t,e,n),u=Kn(t,e,n),d=Xn(t,e,n);let f="";return s&&(t.dataStream=Mn(s,r,i),f=s.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:h,customBlocks:l,tables:u,customRanges:d}}function Li(t,e,n,s){t.dataStream=Dn(t.dataStream,s,e.dataStream),xn(t,e,n,s),me(t,e,n,s),Si(t,e,n,s),pn(t,e,n,s),Oe(t,e,n,s),Ni(t,e,n,s)}var qn=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(qn||{}),Qn=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Qn||{}),Ct=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(Ct||{}),J=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(J||{}),Zn=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(Zn||{}),Jn=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Jn||{}),yn=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(yn||{}),ts=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(ts||{}),es=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(es||{}),ns=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(ns||{}),ss=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(ss||{}),rs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(rs||{}),is=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(is||{}),os=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(os||{}),as=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(as||{}),ls=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(ls||{}),us=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(us||{}),cs=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(cs||{}),hs=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(hs||{}),ds=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(ds||{}),_s=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(_s||{}),fs=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(fs||{}),gs=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(gs||{}),Es=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(Es||{}),Rs=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(Rs||{}),ms=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(ms||{}),Os=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Os||{}),jt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(jt||{});const wi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:J.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:J.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:J.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:J.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:Ct.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:J.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Ct.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:J.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Ct.DECIMAL,hanging:21,indentStart:63}]}};function vi(t,e,n,s,r){const i=Di(t,e,n,s,r),o=Ui(t,e,n,s,r),a=Ti(t,e,n,s,r),h=Pi(t,e,n,s,r),l=Fi(t,e,n,s,r),u=Hi(t,e,n,s,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:h,tables:l,customRanges:u}}function Di(t,e,n,s,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=Vn(t,n,s);if(r!==F.REPLACE){const h=Mi(o,a,r);e.textRuns=h}return xn(t,e,n,s),a}function Mi(t,e,n){if(e.length===0)return t;t=O.deepClone(t),e=O.deepClone(e);const s=[],r=t.length,i=e.length;let o=0,a=0,h=null;function l(){return h?(s.push(h),h=null,!0):!1}for(;o<r&&a<i;){const{st:_,ed:E,ts:R}=t[o],{st:m,ed:I,ts:S,sId:D}=e[a];let $;n===F.COVER?$={...S,...R}:$={...R,...S},E<m?(l()||s.push(t[o]),o++):I<_?(l()||s.push(e[a]),a++):(s.push({st:Math.min(_,m),ed:Math.max(_,m),ts:_<m?{...R}:{...S},sId:_<m?void 0:D}),s.push({st:Math.max(_,m),ed:Math.min(E,I),ts:$,sId:D}),E<I?(o++,e[a].st=E):(a++,t[o].st=I),h={st:Math.min(E,I),ed:Math.max(E,I),ts:E<I?{...S}:{...R},sId:E<I?D:void 0})}l();const u=s[s.length-1],d=t[r-1],f=e[i-1];return u.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?s.push(d):s.push(f)),Re(s)}function Ui(t,e,n,s,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=jn(t,n,s);if(r!==F.REPLACE){const h=[];for(const l of o){const{startIndex:u,paragraphStyle:d,bullet:f}=l;let _=[];for(const E of a){const{startIndex:R,paragraphStyle:m,bullet:I}=E;let S,D;if(r===F.COVER?(S={...m,...d},D={listId:"",listType:jt.BULLET_LIST,nestingLevel:0,textStyle:{},...I,...f}):(S={...d,...m},D={listId:"",listType:jt.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...I}),u===R){_.push({startIndex:u,paragraphStyle:S,bullet:D});break}}h.push(..._),_=[]}e.paragraphs=h}return me(t,e,n,s),a}function Ti(t,e,n,s,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=zn(t,n,s);if(r!==F.REPLACE){const h=[];for(const l of o){const{startIndex:u}=l;let d=[];for(const f of a){const{startIndex:_}=f;if(u===_){r===F.COVER?d.push({...f,...l}):d.push({...l,...f});break}}h.push(...d),d=[]}e.sectionBreaks=h}return me(t,e,n,s),a}function Pi(t,e,n,s,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=Yn(t,n,s);if(r!==F.REPLACE){const h=[];for(const l of o){const{startIndex:u}=l;let d=[];for(const f of a){const{startIndex:_}=f;if(u===_){r===F.COVER?d.push({...f,...l}):d.push({...l,...f});break}}h.push(...d),d=[]}e.customBlocks=h}return pn(t,e,n,s),a}function Fi(t,e,n,s,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Kn(t,n,s);if(r!==F.REPLACE){const h=[];for(const l of o){const{startIndex:u,endIndex:d}=l;let f=[];for(const _ of a){const{startIndex:E,endIndex:R}=_;if(E>=u&&R<=d){r===F.COVER?f.push({..._,...l}):f.push({...l,..._});break}}h.push(...f),f=[]}e.tables=h}return Oe(t,e,n,s),a}function Hi(t,e,n,s,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Xn(t,n,s);if(r!==F.REPLACE){const h=[];for(const l of o){const{startIndex:u,endIndex:d}=l;let f=[];for(const _ of a){const{startIndex:E,endIndex:R}=_;if(E>=u&&R<=d){r===F.COVER?f.push({..._,...l}):f.push({...l,..._});break}}h.push(...f),f=[]}e.customRanges=h}return Oe(t,e,n,s),a}const Ae={id:"default_doc",documentStyle:{}};class Bi{constructor(e){g(this,"snapshot");this.snapshot={...Ae,...e}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){const{documentStyle:n}=this.snapshot;n.renderConfig==null?n.renderConfig=e:n.renderConfig={...n.renderConfig,...e}}updateDocumentDataMargin(e){const{t:n,l:s,b:r,r:i}=e,{documentStyle:o}=this.snapshot;n!=null&&(o.marginTop=n),s!=null&&(o.marginLeft=s),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(e,n){const{documentStyle:s}=this.snapshot;if(!s.pageSize){e=e??1/0,n=n??1/0,s.pageSize={width:e,height:n};return}e!==void 0&&(s.pageSize.width=e),n!==void 0&&(s.pageSize.height=n)}updateDrawing(e,n){const{drawings:s}=this,{width:r,height:i,left:o,top:a}=n,h=s==null?void 0:s[e];if(!h)return;const l=h.objectTransform;l.size.width=r,l.size.height=i,l.positionH.posOffset=o,l.positionV.posOffset=a}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class _t extends Bi{constructor(n){super(n);g(this,"_unitId");g(this,"headerModelMap",new Map);g(this,"footerModelMap",new Map);const s=6;this._unitId=this.snapshot.id??O.generateRandomId(s),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()})}getRev(){return this.snapshot.rev??0}incrementRev(){this.snapshot.rev=this.getRev()+1}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={...Ae,...n},this._initializeHeaderFooterModel()}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){const s=[],r=new an;return r.reset(),n.forEach(i=>{if(i=O.deepClone(i),i.t==="r"){const{coverType:o,body:a,len:h,segmentId:l}=i;if(a!=null){const u=this._updateApply(a,h,r.cursor,o,l);s.push({...i,t:"r",coverType:F.REPLACE,body:u})}else s.push({...i,t:"r"});r.moveCursor(h)}else if(i.t==="i"){const{body:o,len:a,segmentId:h,line:l}=i;this._insertApply(o,a,r.cursor,h),r.moveCursor(a),s.push({t:"d",len:a,line:l,segmentId:h})}else if(i.t==="d"){const{len:o,segmentId:a}=i,h=this._deleteApply(o,r.cursor,a);s.push({...i,t:"i",body:h})}else throw new Error(`Unknown mutation type for mutation: ${i}.`)}),s}sliceBody(n,s){const r=this.getBody();if(r==null)return;const{dataStream:i,textRuns:o=[],paragraphs:a=[]}=r,h={dataStream:i.slice(n,s)},l=[];for(const d of o){const f=O.deepClone(d),{st:_,ed:E}=f;O.hasIntersectionBetweenTwoRanges(_,E,n,s)&&(n>=_&&n<=E?l.push({...f,st:n,ed:Math.min(s,E)}):s>=_&&s<=E?l.push({...f,st:Math.max(n,_),ed:s}):l.push(f))}l.length&&(h.textRuns=l.map(d=>{const{st:f,ed:_}=d;return{...d,st:f-n,ed:_-n}}));const u=[];for(const d of a){const{startIndex:f}=d;f>=n&&f<=s&&u.push(O.deepClone(d))}return u.length&&(h.paragraphs=u.map(d=>({...d,startIndex:d.startIndex-n}))),h}_updateApply(n,s,r,i=F.COVER,o){if(n==null)throw new Error("updateBody is none");const a=this.snapshot,h=xt(a,o);if(h==null)throw new Error("no body has changed");return vi(h,n,s,r,i)}_deleteApply(n,s,r){const i=this.snapshot,o=xt(i,r);if(o==null)throw new Error("no body has changed");return n<=0?{dataStream:""}:bi(o,n,s)}_insertApply(n,s,r,i){const o=this.snapshot,a=xt(o,i);if(s!==0){if(a==null)throw new Error("no body has changed");Li(a,n,s,r)}}_initializeHeaderFooterModel(){const{headers:n,footers:s}=this.getSnapshot();if(n)for(const r in n){const i=n[r];this.headerModelMap.set(r,new _t(i))}if(s)for(const r in s){const i=s[r];this.footerModelMap.set(r,new _t(i))}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}const St={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Wi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},$i={startRow:0,startColumn:0,endRow:0,endColumn:0},Gi={row:0,column:0},As={id:"",sheetOrder:[],name:"",appVersion:"",locale:Ut.ZH_CN,styles:{},sheets:{},resources:[]},Is=1e3,Cs=20,Ss=19,Ns=73,bs=46,Ls=20,zt={type:ie.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:C.FALSE,rowCount:Is,columnCount:Cs,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Ns,defaultRowHeight:Ss,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:C.FALSE,showGridlines:C.TRUE,rowHeader:{width:bs,hidden:C.FALSE},columnHeader:{height:Ls,hidden:C.FALSE},selections:["A1"],rightToLeft:C.FALSE,pluginMeta:{}},Yt={ff:"Times New Roman",fs:14,it:C.FALSE,bl:C.FALSE,ul:{s:C.FALSE},st:{s:C.FALSE},ol:{s:C.FALSE},tr:{a:0,v:C.FALSE},td:Ot.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:rt.UNSPECIFIED,vt:ut.UNSPECIFIED,tb:ct.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},ws={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var vs=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(vs||{});class Ds{constructor(e={}){g(this,"_styles");g(this,"_cacheMap",new Bn(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const s=this._getExistingStyleId(e);return s||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,n){const s=O.generateRandomId(6);return this._styles[s]=e,this._cacheMap.set(n,s),s}setValue(e){if(e==null)return;const n=JSON.stringify(e),s=this.search(e,n);return s!=="-1"?s:this.add(e,n)}toJSON(){return this._styles}getStyleByCell(e){let n;e&&O.isObject(e.s)?n=e.s:n=(e==null?void 0:e.s)&&this.get(e.s);const s=e==null?void 0:e.interceptorStyle;return s?{...n,...s}:n}_generateCacheMap(){const{_styles:e,_cacheMap:n}=this;for(const s in e){const r=JSON.stringify(e[s]);n.set(r,s)}}_getExistingStyleId(e){const{_styles:n}=this;for(const s in n)if(O.diffValue(n[s],e))return s;return null}}function ki(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function xi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return At.STRING;if(typeof t.v=="number")return At.NUMBER;if(typeof t.v=="boolean")return At.BOOLEAN}function pi(t){if(t==null)return!0;const{v:e,f:n,si:s,p:r,s:i}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||n!=null&&n.length>0||s!=null&&s.length>0||r!=null)}function Vi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Ie=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(Ie||{}),Ms=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Ms||{}),Us=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Us||{});class ji{constructor(e,n){g(this,"_columnData",{});this._config=e,this._columnData=n}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:n}=this,s=n[e];return s?s.hd!==C.TRUE:!0}getHiddenCols(e=0,n=V(this._columnData)-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const a=this.getColVisible(o);r&&a?(r=!1,s.push({rangeType:W.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:W.COLUMN}),s}getColumnDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getColumnOrCreate(i);s[r]=o,r++}return s}getSize(){return V(this._columnData)}getColumnWidth(e){const{_columnData:n}=this,s=this._config;let r=0;return r=(n[e]||{hd:C.FALSE,w:s.defaultColumnWidth}).w||s.defaultColumnWidth,r}getColumn(e){const n=this._columnData[e];if(n)return n}getColumnOrCreate(e){const{_columnData:n}=this,s=this._config,r=n[e];if(r)return r;const i={w:s.defaultColumnWidth,hd:C.FALSE};return this._columnData[e]=i,i}}function Kt(t,e){for(const n of e){const{ts:s={}}=n;if(s[t]==null)return C.FALSE;switch(t){case"bl":case"it":{if(s[t]===C.FALSE)return C.FALSE;break}case"ul":case"st":{if(s[t].s===C.FALSE)return C.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}}return C.TRUE}class ft{constructor(e,n,s){g(this,"_range");g(this,"_worksheet");this._deps=s,this._range=n,this._worksheet=e}static foreach(e,n){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=e;for(let a=s;a<=i;a++)for(let h=r;h<=o;h++)n(a,h)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=[];for(let o=e;o<=n;o++){const a=[];for(let h=s;h<=r;h++)a.push(this.getMatrix().getValue(o,h)||null);i.push(a)}return i}getMatrix(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new K;for(let a=e;a<=n;a++)for(let h=s;h<=r;h++)o.setValue(a,h,i.getValue(a,h)||null);return o}getMatrixObject(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new K;for(let a=e;a<=n;a++)for(let h=s;h<=r;h++)o.setValue(a-e,h-s,i.getValue(a,h)||{});return o}getA1Notation(){const{startRow:e,endRow:n,startColumn:s,endColumn:r}=this._range;let i,o;return s<r?(i=O.numToWord(s+1)+(e+1),o=O.numToWord(r+1)+(n+1)):(i=O.numToWord(r+1)+(n+1),o=O.numToWord(s+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Yt.bg.rgb}))}getCell(e,n){const{startRow:s,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:s+e,endRow:s+e,startColumn:i+n,endColumn:i+n};return new ft(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:n,endRow:s,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,s,r,i).getData();if(e.isIncludeStyle){const h=this._deps.getStyles();for(let l=0;l<=s-n;l++)for(let u=0;u<=i-r;u++){if(o==null||((a=o==null?void 0:o[l])==null?void 0:a[u])==null)continue;const d=o[l][u].s;d&&(o[l][u].s=h.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>{var i;const r=e.getStyleByCell(s);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Yt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,s;const{p:e}=this.getValue()??{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Kt("ul",(s=e.body)==null?void 0:s.textRuns)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,s;const{p:e}=this.getValue()??{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Kt("st",(s=e.body)==null?void 0:s.textRuns)===C.TRUE?{s:C.TRUE}:{s:C.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,s;const{p:e}=this.getValue()??{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Kt("it",(s=e.body)==null?void 0:s.textRuns)===C.TRUE?Tt.ITALIC:Tt.NORMAL:this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,s;const{p:e}=this.getValue()??{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Kt("bl",(s=e.body)==null?void 0:s.textRuns)===C.TRUE?Pt.BOLD:Pt.NORMAL:this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:n}=this,{startRow:s,endRow:r}=e;let i=0;for(let o=0;o<=r-s;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:e,endColumn:n}=this._range;return n-e+1}getNumRows(){const{startRow:e,endRow:n}=this._range;return n-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.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 e=this._deps.getStyles();return this.getValues().map(n=>n.map(s=>e.getStyleByCell(s)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:n}=this,{startColumn:s,endColumn:r}=e;let i=0;for(let o=0;o<=r-s;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){ft.foreach(this._range,e)}_getStyles(e){const n=this._deps.getStyles();return this.getValues().map(s=>s.map(r=>{const i=n&&n.getStyleByCell(r);return i&&i[e]||Yt[e]}))}}class zi{constructor(e,n){g(this,"_rowData");this._config=e,this._rowData=n}getRowData(){return this._rowData}getRowDatas(e,n){const s={};let r=0;for(let i=e;i<e+n;i++){const o=this.getRowOrCreate(i);s[r]=o,r++}return s}getRowHeight(e,n=1){const{_rowData:s}=this,r=this._config;let i=0;for(let o=0;o<n;o++){const a=s[o+e]||{hd:C.FALSE,h:r.defaultRowHeight},{isAutoHeight:h,ah:l,h:u=r.defaultRowHeight}=a;i+=(h==null||h)&&typeof l=="number"?l:u}return i}getRow(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:n}=this,s=n[e];if(s)return s;const r=this._config,i={hd:C.FALSE,h:r.defaultRowHeight};return n[e]=i,i}getHiddenRows(e=0,n=V(this._rowData)-1){const s=[];let r=!1,i=-1;for(let o=e;o<=n;o++){const a=this.getRowVisible(o);r&&a?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&!a&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:W.ROW}),s}getRowVisible(e){const n=this.getRow(e);return n?n.hd!==C.TRUE:!0}getSize(){return V(this._rowData)}}class Ts extends T{constructor(){super(...arguments);g(this,"_cellContentInterceptors",[]);g(this,"_rowFilteredInterceptors",[]);g(this,"_rowVisibleInterceptors",[]);g(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(n,s){for(const r of this._cellContentInterceptors){const i=r.getCell(n,s);if(typeof i<"u")return i}return null}registerCellContentInterceptor(n){if(this._cellContentInterceptors.includes(n))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(n),w(()=>q(this._cellContentInterceptors,n))}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptors.includes(n))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(n),w(()=>q(this._rowFilteredInterceptors,n))}registerRowVisibleInterceptor(n){if(this._rowVisibleInterceptors.includes(n))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(n),w(()=>q(this._rowVisibleInterceptors,n))}registerColVisibleInterceptor(n){if(this._colVisibleInterceptors.includes(n))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(n),w(()=>q(this._colVisibleInterceptors,n))}}class Nt{constructor(e,n){g(this,"_initialized");g(this,"_sheetId");g(this,"_snapshot");g(this,"_cellData");g(this,"_rowManager");g(this,"_columnManager");g(this,"_viewModel");this._styles=n;const s={...zt,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},rowHeader:{width:46,hidden:C.FALSE},columnHeader:{height:20,hidden:C.FALSE},selections:["A1"],rightToLeft:C.FALSE,pluginMeta:{},...e};this._snapshot=s;const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=this._snapshot.id??O.generateRandomId(6),this._initialized=!1,this._cellData=new K(o),this._rowManager=new zi(this._snapshot,i),this._columnManager=new ji(this._snapshot,r),this._viewModel=new Ts}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,n=O.deepClone(e);return new Nt(n,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCells(e,n){const s=this._snapshot.mergeData,r=[];for(let i=0;i<s.length;i++){const o=s[i];ht.intersects({startRow:e,startColumn:n,endRow:e,endColumn:n},o)&&r.push(o)}return r.length?r:null}getMergedCell(e,n){const s=this._snapshot.mergeData;for(let r=0;r<s.length;r++){const i=s[r];if(ht.intersects({startRow:e,startColumn:n,endRow:e,endColumn:n},i))return i}return null}getCell(e,n){return e<0||n<0?null:this._viewModel.getCell(e,n)}getCellRaw(e,n){return this.getCellMatrix().getValue(e,n)}getMatrixWithMergedCells(e,n,s,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(h=>ht.intersects({startRow:e,startColumn:n,endRow:s,endColumn:r},h)),a=new K;return ge(e,s,n,r).forEach((h,l)=>{const u=i.getValue(h,l);u&&a.setValue(h,l,u)}),o.forEach(h=>{const{startColumn:l,startRow:u,endColumn:d,endRow:f}=h;ge(u,f,l,d).forEach((_,E)=>{_===u&&E===l&&a.setValue(_,E,{...i.getValue(_,E),rowSpan:f-u+1,colSpan:d-l+1}),(_!==u||E!==l)&&a.realDeleteValue(_,E)})}),a}getRange(e,n,s,r){return typeof e=="object"?new ft(this,e,{getStyles:()=>this._styles}):new ft(this,{startRow:e,startColumn:n,endColumn:r||n,endRow:s||e},{getStyles:()=>this._styles})}getStatus(){const{_snapshot:e}=this;return e.status}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:n}=e;return n}getMaxRows(){const{_snapshot:e}=this,{rowCount:n}=e;return n}getType(){const{_snapshot:e}=this,{type:n}=e;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:n}=e;return n===0}getTabColor(){const{_snapshot:e}=this,{tabColor:n}=e;return n}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this.getRowManager().getRowHeight(e)}getRowVisible(e){return this.getRowManager().getRowVisible(e)}getHiddenRows(e,n){const s=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,n);return r.forEach(i=>i.endColumn=s),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,n){const s=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,n);return r.forEach(i=>i.endRow=s),r}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:n}=e;return n}getPluginMeta(e){return this._snapshot.pluginMeta[e]}setPluginMeta(e,n){this._snapshot.pluginMeta[e]=n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}}var Yi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,Xi=(t,e,n,s)=>{for(var r=s>1?void 0:s?Ki(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Yi(e,n,r),r},qi=(t,e)=>(n,s)=>e(n,s,t);function Qi(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}c.Workbook=class extends T{constructor(n={},s){super();g(this,"_sheetCreated$",new N.Subject);g(this,"sheetCreated$",this._sheetCreated$.asObservable());g(this,"_sheetDisposed$",new N.Subject);g(this,"sheetDisposed$",this._sheetDisposed$.asObservable());g(this,"_activeSheet$",new N.BehaviorSubject(null));g(this,"activeSheet$",this._activeSheet$.asObservable());g(this,"_worksheets");g(this,"_styles");g(this,"_snapshot");g(this,"_unitId");g(this,"_count");this._log=s,this._snapshot=O.commonExtend(As,n);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=O.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Ds(r),this._count=1,this._worksheets=new Map,this._getDefaultWorkSheet()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return O.deepClone(this._snapshot)}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){return this._snapshot.rev??1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(n,s,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=r,o.splice(s,0,n);const a=new Nt(r,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>r===n)}getRawActiveSheet(){const{sheetOrder:n}=this._snapshot;return n.find(r=>this._worksheets.get(r).getStatus()===C.TRUE)}getActiveSheet(){const{sheetOrder:n}=this._snapshot,s=this.getRawActiveSheet();return s?this._worksheets.get(s):this._worksheets.get(n[0])}__setActiveSheet(n){this._activeSheet$.next(n)}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(s=>this._worksheets.get(s).getStatus()===1)}getSheetSize(){return this._snapshot.sheetOrder.length}flush(){}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(s=>this._worksheets.get(s))}getSheetsName(){const{sheetOrder:n}=this._snapshot,s=[];return n.forEach(r=>{const i=this._worksheets.get(r);i&&s.push(i.getName())}),s}getSheetIndex(n){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>n.getSheetId()===r)}getSheetBySheetName(n){const{sheetOrder:s}=this._snapshot,r=s.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(r)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:s}=this._snapshot;return this._worksheets.get(s[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===C.TRUE).map(n=>n.getConfig().id)}transformRangeType(n){if(typeof n=="string")return this._getCellRange(n);if(typeof n!="string"&&"row"in n){const s=n;return{sheetId:"",range:{startRow:s.row[0],startColumn:s.column[0],endRow:s.row[1],endColumn:s.column[1]}}}return typeof n!="string"&&"startRow"in n?{sheetId:"",range:n}:St}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let s=n;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}generateNewSheetName(n){let s=n+this._count;for(;this.checkSheetName(s);)s=n+this._count,this._count++;return s}_getCellRange(n){var u,d,f,_,E;let s="",r="";if(n.indexOf("!")>-1){const R=n.split("!");s=R[0],r=R[1],s=s.replace(/\\'/g,"'").replace(/''/g,"'"),s.substring(0,1)==="'"&&s.substring(s.length-1,1)==="'"&&(s=s.substring(1,s.length-1))}else r=n;if(r.indexOf(":")===-1){const R=parseInt(r.replace(/[^0-9]/g,""),10)-1,m=O.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(R)&&!Number.isNaN(m)?{sheetId:s,range:{startRow:R,endRow:R,startColumn:m,endColumn:m}}:St}r=r.split(":");const i=[0,0],o=[0,0],a=((u=this.getSheetBySheetName(s))==null?void 0:u.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),h=((f=this.getSheetBySheetName(s))==null?void 0:f.getMaxColumns())||((_=this.getActiveSheet())==null?void 0:_.getMaxColumns());return i[0]=parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=a),i[0]>i[1]||(o[0]=O.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=O.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=h),o[0]>o[1])?St:{sheetId:((E=this.getSheetBySheetName(s))==null?void 0:E.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_getDefaultWorkSheet(){const{_snapshot:n,_worksheets:s}=this,{sheets:r,sheetOrder:i}=n;O.isEmptyObject(r)&&(r[zt.id]=Object.assign(zt,{status:C.TRUE}));for(const o in r){const a=r[o],{name:h}=a;a.name=this.uniqueSheetName(h),a.name!==h&&this._log.warn(`The worksheet name ${h} is duplicated, we change it to ${a.name}`);const l=new Nt(a,this._styles);s.set(o,l),i.includes(o)||i.push(o)}}},c.Workbook=Xi([qi(1,st)],c.Workbook);class Ce{constructor(e){g(this,"_snapshot");g(this,"_unitId");this._snapshot={...ws,...e},this._unitId=this._snapshot.id??O.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){const n=this.getPages();return n==null?void 0:n[e]}getElementsByPage(e){var n;return(n=this.getPage(e))==null?void 0:n.pageElements}getElement(e,n){var s;return(s=this.getElementsByPage(e))==null?void 0:s[n]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:Ie.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Xt="FOCUSING_SHEET",Se="FOCUSING_DOC",Ne="FOCUSING_SLIDE",Zi="FOCUSING_EDITOR_BUT_HIDDEN",Ps="FOCUSING_EDITOR",Ji="FOCUSING_EDITOR_INPUT_FORMULA",Fs="FOCUSING_FORMULA_EDITOR";var yi=Object.defineProperty,to=Object.getOwnPropertyDescriptor,eo=(t,e,n,s)=>{for(var r=s>1?void 0:s?to(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&yi(e,n,r),r},no=(t,e)=>(n,s)=>e(n,s,t),Hs=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(Hs||{});const gt=A.createIdentifier("univer.current");let be=class extends T{constructor(e,n){super();g(this,"_focused",null);g(this,"_focused$",new N.BehaviorSubject(null));g(this,"focused$",this._focused$.asObservable());g(this,"_currentSheet$",new N.BehaviorSubject(null));g(this,"currentSheet$",this._currentSheet$.asObservable());g(this,"_currentDoc$",new N.BehaviorSubject(null));g(this,"currentDoc$",this._currentDoc$.asObservable());g(this,"_currentSlide$",new N.BehaviorSubject(null));g(this,"currentSlide$",this._currentSlide$.asObservable());g(this,"_sheetAdded$",new N.Subject);g(this,"sheetAdded$",this._sheetAdded$.asObservable());g(this,"_docAdded$",new N.Subject);g(this,"docAdded$",this._docAdded$.asObservable());g(this,"_slideAdded$",new N.Subject);g(this,"slideAdded$",this._slideAdded$.asObservable());g(this,"_sheetDisposed$",new N.Subject);g(this,"sheetDisposed$",this._sheetDisposed$.asObservable());g(this,"_docDisposed$",new N.Subject);g(this,"docDisposed$",this._docDisposed$.asObservable());g(this,"_slideDisposed$",new N.Subject);g(this,"slideDisposed$",this._slideDisposed$.asObservable());g(this,"_sheets",[]);g(this,"_docs",[]);g(this,"_slides",[]);this._handler=e,this._contextService=n}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,n){const s=this._docs.find(r=>r.getUnitId()===e);if(s!=null){const r=this._docs.indexOf(s);this._docs.splice(r,1)}this.addDoc(n)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(n=>n.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(n=>n.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(n=>n.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[Se,Xt,Ne].forEach(n=>this._contextService.setContextValue(n,!1)),this._focused instanceof c.Workbook?this._contextService.setContextValue(Xt,!0):this._focused instanceof _t?this._contextService.setContextValue(Se,!0):this._focused instanceof Ce&&this._contextService.setContextValue(Ne,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitId ${e}`)}disposeDocument(e){const n=this.getUniverDocInstance(e);if(n){const i=this._docs.indexOf(n);return this._docs.splice(i,1),this._docDisposed$.next(n),this.focusUniverInstance(null),!0}const s=this.getUniverSheetInstance(e);if(s){const i=this._sheets.indexOf(s);return this._sheets.splice(i,1),this._sheetDisposed$.next(s),this.focusUniverInstance(null),!0}const r=this.getUniverSlideInstance(e);if(r){const i=this._slides.indexOf(r);return this._slides.splice(i,1),this._slideDisposed$.next(r),this.focusUniverInstance(null),!0}return!1}};be=eo([no(1,lt)],be);var v=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(v||{});const so={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},qt=new Map;function Le(t,e){return function(r){we(t,e)}}function we(t,e){qt.has(t)||qt.set(t,[]),qt.get(t).push(e)}var ro=Object.defineProperty,io=Object.getOwnPropertyDescriptor,Bs=(t,e,n,s)=>{for(var r=s>1?void 0:s?io(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&ro(e,n,r),r},ve=(t,e)=>(n,s)=>e(n,s,t);c.LifecycleService=class extends T{constructor(n){super();g(this,"_lifecycle$",new N.BehaviorSubject(v.Starting));g(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=n,this._reportProgress(v.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._reportProgress(n),this._lifecycle$.next(n))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new N.Observable(n=>(this.stage===v.Starting||(this.stage===v.Ready?n.next(v.Starting):this.stage===v.Rendered?(n.next(v.Starting),n.next(v.Ready)):(n.next(v.Starting),n.next(v.Ready),n.next(v.Rendered))),this._lifecycle$.subscribe(n)))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${so[n]}".`)}},c.LifecycleService=Bs([ve(0,st)],c.LifecycleService);let y=class extends T{constructor(e,n){super();g(this,"_started",!1);this._lifecycleService=e,this._injector=n}start(){this._started||(this._started=!0,this.disposeWithMe(w(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const n=qt.get(e);n==null||n.forEach(s=>{this._injector.has(s)&&this._injector.get(s)})}};y=Bs([ve(0,A.Inject(c.LifecycleService)),ve(1,A.Inject(A.Injector))],y);function oo(t,e){if(t)try{return t[e]?t[e]:e.split(".").reduce((n,s)=>n[s],t)}catch{return console.warn("Key %s not found",e),e}}class bt extends T{constructor(){super();g(this,"currentLocale",Ut.ZH_CN);g(this,"locales",null);g(this,"localeChanged$",new N.Subject);g(this,"t",n=>{if(!this.locales)throw new Error("Locale not initialized");return oo(this.locales[this.currentLocale],n)??n});this.disposeWithMe(w(()=>this.localeChanged$.complete()))}load(n){this.locales=O.deepMerge(this.locales??{},n)}setLocale(n){this.currentLocale=n,this.localeChanged$.next()}getLocales(){var n;return(n=this.locales)==null?void 0:n[this.currentLocale]}getCurrentLocale(){return this.currentLocale}}const De=A.createIdentifier("resource-manager-service"),Ws=A.createIdentifier("ResourcePersistenceService");we(v.Ready,Ws);var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(t,e,n,s)=>{for(var r=s>1?void 0:s?lo(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&ao(e,n,r),r},$s=(t,e)=>(n,s)=>e(n,s,t);const Me=A.createIdentifier("univer.permission-service"),Gs="PERMISSION";c.PermissionService=class extends T{constructor(n,s){super();g(this,"_permissionPointMap",new Map);g(this,"deletePermissionPoint",(n,s)=>{const r=this._permissionPointMap.get(n);if(r){const i=r.get(s);i&&(i.complete(),this._permissionPointMap.delete(s))}});g(this,"addPermissionPoint",(n,s)=>{const r=this._permissionPointMap.get(n)||new Map;return r.has(s.id)?!1:(r.set(s.id,new N.BehaviorSubject(s)),this._permissionPointMap.set(n,r),!0)});g(this,"updatePermissionPoint",(n,s,r)=>{const i=this._permissionPointMap.get(n);if(!i)return;const o=i.get(s);if(o){const a=o.getValue();a.value=r,a.status=fe.DONE,o.next(a)}});g(this,"getPermissionPoint",(n,s)=>{const r=this._permissionPointMap.get(n);if(!r)return;const i=r.get(s);if(i)return i.getValue()});this._resourceManagerService=n,this._univerInstanceService=s}_init(){this.disposeWithMe(w(this._univerInstanceService.sheetAdded$.subscribe(n=>{this._resourceManagerService.registerPluginResource(n.getUnitId(),Gs,{onChange:(s,r)=>{r.forEach(i=>{this.getPermissionPoint(s,i.id)?this.updatePermissionPoint(s,i.id,i.value):this.addPermissionPoint(s,i)})},toJson:s=>this._toJson(s),parseJson:s=>this._parseJson(s)})}))),this.disposeWithMe(w(this._univerInstanceService.sheetDisposed$.subscribe(n=>{this._resourceManagerService.disposePluginResource(n.getUnitId(),Gs)})))}_toJson(n){const s=this._permissionPointMap.get(n);let r=[];return s&&(r=[...s.keys()].reduce((i,o)=>{const a=s.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(n){return JSON.parse(n)}composePermission$(n,s){const r=this._permissionPointMap.get(n),i=s.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return N.combineLatest(i).pipe(sr.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(n,s){const r=this._permissionPointMap.get(n);return s.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}},c.PermissionService=uo([Le(v.Starting,c.PermissionService),$s(0,A.Inject(De)),$s(1,A.Inject(gt))],c.PermissionService);const ks="univer.editable";class Qt extends Wn{constructor(n){super();g(this,"id",ks);g(this,"value",!0);g(this,"unitID");this.unitID=n}}var co=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,_o=(t,e,n,s)=>{for(var r=s>1?void 0:s?ho(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&co(e,n,r),r},xs=(t,e)=>(n,s)=>e(n,s,t);c.UniverPermissionService=class extends T{constructor(e,n){super(),this._permissionService=e,this._univerInstanceService=n,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(e=>{const n=new Qt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),n)})}getEditable(e){let n=e;n||(n=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const s=new Qt(n),r=this._permissionService.getPermissionPoint(n,s.id);return r==null?void 0:r.value}setEditable(e,n){const s=new Qt(e);this._permissionService.updatePermissionPoint(e,s.id,n)}},c.UniverPermissionService=_o([Le(v.Starting,c.UniverPermissionService),xs(0,A.Inject(Me)),xs(1,A.Inject(gt))],c.UniverPermissionService);class ps extends T{constructor(){super(...arguments);g(this,"_resourceMap",new Map);g(this,"_register$",new N.Subject);g(this,"register$",this._register$.asObservable())}getAllResource(n){const s=this._resourceMap.get(n);return s?[...s.keys()].reduce((r,i)=>{const o=s.get(i);return o&&r.push({unitID:n,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(n,s,r){const i=this._resourceMap.get(n)||new Map;if(i.has(s))throw new Error("the pluginName is registered");return i.set(s,r),this._resourceMap.set(n,i),this._register$.next({unitID:n,resourceName:s,hook:r}),w(()=>i.delete(s))}disposePluginResource(n,s){const r=this._resourceMap.get(n);r==null||r.delete(s)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Ue extends T{constructor(){super();g(this,"_currentTheme");g(this,"_currentTheme$",new N.BehaviorSubject({}));g(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(w(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}const Vs="__defaultDocumentNormalEditorSpecialUnitId_20231006__",js="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",fo=`\r
11
- `;var go=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,Ro=(t,e,n,s)=>{for(var r=s>1?void 0:s?Eo(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&go(e,n,r),r},Te=(t,e)=>(n,s)=>e(n,s,t);const Zt=A.createIdentifier("univer.undo-redo.service"),mo=20;c.LocalUndoRedoService=class extends T{constructor(n,s,r){super();g(this,"undoRedoStatus$");g(this,"_undoRedoStatus$",new N.BehaviorSubject({undos:0,redos:0}));g(this,"_undoStacks",new Map);g(this,"_redoStacks",new Map);this._univerInstanceService=n,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Ys)),this.disposeWithMe(this._commandService.registerCommand(Ks)),this.disposeWithMe(w(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(w(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:s}=n,r=this._getRedoStack(s,!0),i=this._getUndoStack(s,!0);r.length=0,i.push(n),i.length>mo&&i.splice(0,1),this._updateStatus()}clearUndoRedo(n){const s=this._getRedoStack(n);s&&(s.length=0);const r=this._getUndoStack(n);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getUndoStackForFocused();return n.length?n[n.length-1]:null}pitchTopRedoElement(){const n=this._getRedoStackForFocused();return n.length?n[n.length-1]:null}popUndoToRedo(){const s=this._getUndoStackForFocused().pop();s&&(this._getRedoStackForFocused().push(s),this._updateStatus())}popRedoToUndo(){const s=this._getRedoStackForFocused().pop();s&&(this._getUndoStackForFocused().push(s),this._updateStatus())}_updateStatus(){var i,o;const n=this._getFocusedUniverInstanceId(),s=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,r=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:s,redos:r})}_getUndoStack(n,s=!1){let r=this._undoStacks.get(n);return!r&&s&&(r=[],this._undoStacks.set(n,r)),r||null}_getRedoStack(n,s=!1){let r=this._redoStacks.get(n);return!r&&s&&(r=[],this._redoStacks.set(n,r)),r||null}_getUndoStackForFocused(){const n=this._getFocusedUniverInstanceId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUniverInstanceId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_getFocusedUniverInstanceId(){var o,a;let n="";const s=this._contextService.getContextValue(Xt),r=this._contextService.getContextValue(Fs),i=this._contextService.getContextValue(Ps);return s?r?n=js:i?n=Vs:n=((o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())??"":n=((a=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:a.getUnitId())??"",n}},c.LocalUndoRedoService=Ro([Te(0,gt),Te(1,mt),Te(2,lt)],c.LocalUndoRedoService);class zs{dispose(){}async dispatchToHandlers(){return!1}}const Ys=new class extends zs{constructor(){super(...arguments);g(this,"type",Mt.COMMAND);g(this,"id","univer.command.undo")}async handler(e){const n=e.get(Zt),s=n.pitchTopUndoElement();if(!s)return!1;const r=e.get(mt);return(s.undo?await s.undo(s.undoMutations):re(s.undoMutations,r))?(n.popUndoToRedo(),!0):!1}},Ks=new class extends zs{constructor(){super(...arguments);g(this,"type",Mt.COMMAND);g(this,"id","univer.command.redo")}async handler(e){const n=e.get(Zt),s=n.pitchTopRedoElement();if(!s)return!1;const r=e.get(mt);return(s.redo?await s.redo(s.redoMutations):re(s.redoMutations,r))?(n.popRedoToUndo(),!0):!1}};class Jt extends T{constructor(){super(...arguments);g(this,"_started",!1)}addPlugins(n){if(this._started){const s=n.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(s,v.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(s))}else{const s=n.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(s),this._started=!0}}_takePluginsThroughLifecycle(n,s=!1){this.disposeWithMe(w(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{s&&r===v.Starting||this._pluginsRunLifecycle(n,r)})))}_pluginsRunLifecycle(n,s){n.forEach(r=>{switch(s){case v.Starting:r.onStarting(this._injector);break;case v.Ready:r.onReady();break;case v.Rendered:r.onRendered();break;case v.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(s)}_initPlugin(n,s){return this._injector.createInstance(n,s)}}var Oo=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Io=(t,e,n,s)=>{for(var r=s>1?void 0:s?Ao(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Oo(e,n,r),r},Pe=(t,e)=>(n,s)=>e(n,s,t);c.UniverDoc=class extends Jt{constructor(e,n,s){super(),this._injector=e,this._lifecycleService=n,this._lifecycleInitializerService=s}createDoc(e){return this._injector.createInstance(_t,e)}},c.UniverDoc=Io([Pe(0,A.Inject(A.Injector)),Pe(1,A.Inject(c.LifecycleService)),Pe(2,A.Inject(y))],c.UniverDoc);var Co=Object.defineProperty,So=Object.getOwnPropertyDescriptor,No=(t,e,n,s)=>{for(var r=s>1?void 0:s?So(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&Co(e,n,r),r},Fe=(t,e)=>(n,s)=>e(n,s,t);c.UniverSheet=class extends Jt{constructor(e,n,s){super(),this._injector=e,this._lifecycleService=n,this._lifecycleInitializerService=s}createSheet(e){return this._injector.createInstance(c.Workbook,e)}},c.UniverSheet=No([Fe(0,A.Inject(A.Injector)),Fe(1,A.Inject(c.LifecycleService)),Fe(2,A.Inject(y))],c.UniverSheet);var bo=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,wo=(t,e,n,s)=>{for(var r=s>1?void 0:s?Lo(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(e,n,r):o(r))||r);return s&&r&&bo(e,n,r),r},He=(t,e)=>(n,s)=>e(n,s,t);c.UniverSlide=class extends Jt{constructor(e,n,s){super(),this._injector=e,this._lifecycleService=n,this._lifecycleInitializerService=s}createSlide(e){return this._injector.createInstance(Ce,e)}},c.UniverSlide=wo([He(0,A.Inject(A.Injector)),He(1,A.Inject(c.LifecycleService)),He(2,A.Inject(y))],c.UniverSlide);const vo=200;class Do extends Jt{constructor(n={}){super();g(this,"_injector");g(this,"_univerPluginStore",new or);g(this,"_univerPluginRegistry",new ar);g(this,"_univerSheet",null);g(this,"_univerDoc",null);g(this,"_univerSlide",null);g(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:s,locale:r,locales:i,logLevel:o}=n;s&&this._injector.get(Ue).setTheme(s),i&&this._injector.get(bt).load(i),r&&this._injector.get(bt).setLocale(r),o&&this._injector.get(st).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(gt)}get _lifecycleService(){return this._injector.get(c.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(y)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(n){this._injector.get(bt).setLocale(n)}createUniverSheet(n){let s;const r=()=>{s=this._univerSheet.createSheet(n),this._univerInstanceService.addSheet(s)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(c.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(M.Sheet).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(M.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return s}createUniverDoc(n){let s;const r=()=>{s=this._univerDoc.createDoc(n),this._univerInstanceService.addDoc(s)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(c.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(M.Doc).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(M.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return s}createUniverSlide(n){let s;const r=()=>{s=this._univerSlide.createSlide(n),this._univerInstanceService.addSlide(s)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(c.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(M.Slide).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(M.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return s}_initDependencies(){return new A.Injector([[gt,{useFactory:n=>new be({createUniverDoc:s=>this.createUniverDoc(s),createUniverSheet:s=>this.createUniverSheet(s),createUniverSlide:s=>this.createUniverSlide(s)},n),deps:[lt]}],[sn],[bt],[Ue],[c.LifecycleService],[y],[Me,{useClass:c.PermissionService}],[c.UniverPermissionService],[st,{useClass:tn,lazy:!0}],[mt,{useClass:c.CommandService,lazy:!0}],[Zt,{useClass:c.LocalUndoRedoService,lazy:!0}],[nn,{useClass:Or}],[lt,{useClass:Je}],[on,{useClass:rn,lazy:!0}],[De,{useClass:ps,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(y).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(c.LifecycleService).stage<v.Ready&&(this._injector.get(c.LifecycleService).stage=v.Ready,this._univerPluginStore.forEachPlugin(s=>s.onReady()))}registerPlugin(n,s){if(n.type===M.Univer)this._registerUniverPlugin(n,s);else if(n.type===M.Sheet)this._registerSheetsPlugin(n,s);else if(n.type===M.Doc)this._registerDocsPlugin(n,s);else if(n.type===M.Slide)this._registerSlidesPlugin(n,s);else throw new Error(`Unimplemented plugin system for business: "${n.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),vo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const n=this._univerPluginRegistry.getRegisterPlugins(M.Univer);if(n.length){this._univerPluginRegistry.clearPluginsOfType(M.Univer);const s=n.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(s)}if(this._univerSheet){const s=this._univerPluginRegistry.getRegisterPlugins(M.Sheet).map(r=>[r.plugin,r.options]);s.length&&(this._univerSheet.addPlugins(s),this._univerPluginRegistry.clearPluginsOfType(M.Sheet))}if(this._univerDoc){const s=this._univerPluginRegistry.getRegisterPlugins(M.Doc).map(r=>[r.plugin,r.options]);s.length&&(this._univerDoc.addPlugins(s),this._univerPluginRegistry.clearPluginsOfType(M.Doc))}if(this._univerSlide){const s=this._univerPluginRegistry.getRegisterPlugins(M.Slide).map(r=>[r.plugin,r.options]);s.length&&(this._univerSlide.addPlugins(s),this._univerPluginRegistry.clearPluginsOfType(M.Slide))}}_registerUniverPlugin(n,s){if(this._started)this._univerPluginRegistry.registerPlugin(n,s);else{const r=this._injector.createInstance(n,s);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(n,s){this._univerPluginRegistry.registerPlugin(n,s)}_registerDocsPlugin(n,s){this._univerPluginRegistry.registerPlugin(n,s)}_registerSlidesPlugin(n,s){this._univerPluginRegistry.registerPlugin(n,s)}}function Mo(t){const e=new MessageChannel;let n=!1;return e.port1.onmessage=()=>{n||t()},e.port2.postMessage(null),()=>{n=!0}}class Uo extends Dt{add(e){if(!e)return null;const n=new vt(e,this);return this._observers=[n],this._onObserverAdded&&this._onObserverAdded(n),n}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const To=A.createIdentifier("ILocalStorageService"),Be=`'?\\[((?![\\/?:"<>|*\\\\]).)*?\\]`,Po=/[^0-9]/g,Fo=/[^A-Za-z]/g;function Lt(t){const e=t[0]==="$",s=t.substring(1).indexOf("$")>-1;return e&&s?j.ALL:e?j.COLUMN:s?j.ROW:j.NONE}function Ho(t){const e=t.split("!");e.length>1&&(t=e[e.length-1]);const n=t.split(":");return n.length>1?{startAbsoluteRefType:Lt(n[0]),endAbsoluteRefType:Lt(n[1])}:{startAbsoluteRefType:Lt(n[0])}}function Xs(t=j.NONE){let e="",n="";return t===j.ROW?e="$":t===j.COLUMN?n="$":t===j.ALL&&(e="$",n="$"),{rowAbsoluteString:e,columnAbsoluteString:n}}function yt(t){const{startColumn:e,startRow:n,endColumn:s,endRow:r,startAbsoluteRefType:i,endAbsoluteRefType:o,rangeType:a=W.NORMAL}=t,h=Xs(i),l=Xs(o);if(a===W.ROW||a===W.ALL){const f=`${h.rowAbsoluteString}${n+1}`,_=`${l.rowAbsoluteString}${r+1}`;return`${f}:${_}`}if(a===W.COLUMN){const f=`${h.columnAbsoluteString}${O.chatAtABC(e)}`,_=`${l.columnAbsoluteString}${O.chatAtABC(s)}`;return`${f}:${_}`}const u=`${h.columnAbsoluteString}${O.chatAtABC(e)}${h.rowAbsoluteString}${n+1}`,d=`${l.columnAbsoluteString}${O.chatAtABC(s)}${l.rowAbsoluteString}${r+1}`;return u===d?u:`${u}:${d}`}function qs(t,e){return`${t}!${yt(e)}`}function Qs(t,e,n){return`[${t}]${e}!${yt(n)}`}function Bo(t){const{unitId:e,sheetName:n,range:s}=t;return e!=null&&e.length>0&&n!=null&&n.length>0?Qs(e,n,s):n!=null&&n.length>0?qs(n,s):yt(s)}function We(t){const e=parseInt(t.replace(Po,""))-1,n=O.ABCatNum(t.replace(Fo,"")),s=Lt(t);return{row:e,column:n,absoluteRefType:s}}function Zs(t){const e=new RegExp(Be).exec(t);let n="";e!=null&&(n=e[0].trim(),n=n.slice(1,n.length-1),t=t.replace(new RegExp(Be),""));const s=t.indexOf("!");let r="",i="";return s>-1?(r=t.substring(0,s),r[0]==="'"&&r[r.length-1]==="'"&&(r=r.substring(1,r.length-1)),i=t.substring(s)):i=t,{refBody:i,sheetName:r,unitId:n}}function Wo(t){const{refBody:e,sheetName:n,unitId:s}=Zs(t),r=e.indexOf(":");if(r===-1){const _=We(e),E=_.row,R=_.column,m=_.absoluteRefType;return{unitId:s,sheetName:n,range:{startRow:E,startColumn:R,endRow:E,endColumn:R,startAbsoluteRefType:m,endAbsoluteRefType:m}}}const i=e.substring(0,r),o=e.substring(r+1),a=We(i),h=We(o),l=a.row,u=a.column,d=h.row,f=h.column;return{unitId:s,sheetName:n,range:{startRow:l,startColumn:u,endRow:d,endColumn:f,startAbsoluteRefType:a.absoluteRefType,endAbsoluteRefType:h.absoluteRefType}}}const Js=/[\[\]]/g;function ys(t,e){if(Js.test(t)){const n=Number(t.replace(Js,""));return e+n}return Number(t)-1}function $e(t,e=0,n=0){t=t.toLocaleUpperCase();const s=t.split(/[RC]/),r=s[1],i=s[2],o=ys(r,e),a=ys(i,n);return{row:o,column:a,absoluteRefType:j.NONE}}function $o(t,e=0,n=0){const{refBody:s,sheetName:r,unitId:i}=Zs(t),o=s.indexOf(":");if(o===-1){const R=$e(s,e,n),m=R.row,I=R.column,S=R.absoluteRefType;return{unitId:i,sheetName:r,range:{startRow:m,startColumn:I,endRow:m,endColumn:I,startAbsoluteRefType:S,endAbsoluteRefType:S}}}const a=s.substring(0,o),h=s.substring(o+1),l=$e(a,e,n),u=$e(h,e,n),d=l.row,f=l.column,_=u.row,E=u.column;return{unitId:i,sheetName:r,range:{startRow:d,startColumn:f,endRow:_,endColumn:E,startAbsoluteRefType:l.absoluteRefType,endAbsoluteRefType:u.absoluteRefType}}}const Go=t=>`sheet_interceptor_${t}`,tr=t=>function(e,n){let s=-1;function r(i,o){if(i<=s)throw new Error("[SheetInterceptorService]: next() called multiple times!");return s=i,i===t.length?o:t[i].handler(o,n,r.bind(null,i+1))}return r(0,e)};class ko{constructor(e){g(this,"_interceptorsByName",new Map);g(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const n=e,s=this._interceptorsByName.get(n);return tr(s||[])}intercept(e,n){const s=e;this._interceptorsByName.has(s)||this._interceptorsByName.set(s,[]);const r=this._interceptorsByName.get(s);return r.push(n),this._interceptorsByName.set(s,r.sort((i,o)=>(o.priority??0)-(i.priority??0))),()=>q(this._interceptorsByName.get(s),n)}getInterceptPoints(){return this._interceptorPoints}}rr(),c.ABCToNumber=Ri,c.AbsoluteRefType=j,c.AlignTypeH=Es,c.AlignTypeV=Rs,c.AutoFillSeries=cn,c.BaselineOffset=Ft,c.BlockType=Jn,c.BooleanNumber=C,c.BorderStyleTypes=L,c.BorderType=hn,c.BulletAlignment=J,c.COLORS=oe,c.CellValueType=At,c.Color=it,c.ColorBuilder=Bt,c.ColorKit=p,c.ColorType=k,c.ColumnSeparatorType=es,c.CommandType=Mt,c.CommonHideTypes=dn,c.ConditionType=_n,c.ContentAlignment=hs,c.ContextService=Je,c.CopyPasteType=fn,c.CustomRangeType=Zn,c.DEFAULT_CELL=Gi,c.DEFAULT_DOC=Ae,c.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Ar,c.DEFAULT_EMPTY_DOCUMENT_VALUE=fo,c.DEFAULT_RANGE=Wi,c.DEFAULT_RANGE_ARRAY=St,c.DEFAULT_SELECTION=$i,c.DEFAULT_SLIDE=ws,c.DEFAULT_STYLES=Yt,c.DEFAULT_WORKBOOK=As,c.DEFAULT_WORKSHEET=zt,c.DEFAULT_WORKSHEET_COLUMN_COUNT=Cs,c.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ls,c.DEFAULT_WORKSHEET_COLUMN_WIDTH=Ns,c.DEFAULT_WORKSHEET_ROW_COUNT=Is,c.DEFAULT_WORKSHEET_ROW_HEIGHT=Ss,c.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=bs,c.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=js,c.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Vs,c.DashStyleType=ls,c.DataStreamTreeNodeType=kn,c.DataStreamTreeTokenType=Ee,c.DesktopLogService=tn,c.DeveloperMetadataVisibility=gn,c.Dimension=En,c.Direction=Rn,c.Disposable=T,c.DisposableCollection=se,c.DocStyleType=qn,c.DocumentDataModel=_t,c.EXTENSION_NAMES=vs,c.Entry=de,c.EntryIterator=Hn,c.ErrorService=sn,c.EventState=Qe,c.FOCUSING_DOC=Se,c.FOCUSING_EDITOR=Ps,c.FOCUSING_EDITOR_BUT_HIDDEN=Zi,c.FOCUSING_EDITOR_INPUT_FORMULA=Ji,c.FOCUSING_FORMULA_EDITOR=Fs,c.FOCUSING_SHEET=Xt,c.FOCUSING_SLIDE=Ne,c.FloatingObjectManagerService=rn,c.FollowNumberWithType=Qn,c.FontItalic=Tt,c.FontStyleType=ds,c.FontWeight=Pt,c.FormatType=mn,c.GlyphType=Ct,c.GridType=yn,c.HLSColor=bn,c.HorizontalAlign=rt,c.ICommandService=mt,c.IConfigService=nn,c.IContextService=lt,c.IFloatingObjectManagerService=on,c.ILocalStorageService=To,c.ILogService=st,c.IPermissionService=Me,c.IResourceManagerService=De,c.ISnapshotPersistenceService=Ws,c.IUndoRedoService=Zt,c.IUniverInstanceService=gt,c.InterceptorManager=ko,c.InterpolationPointType=On,c.KeyIterator=Pn,c.LRUHelper=It,c.LRUMap=Bn,c.LifecycleStages=v,c.LocaleService=bt,c.LocaleType=Ut,c.LogLevel=ye,c.MemoryCursor=an,c.NamedStyleType=os,c.NumberUnitType=gs,c.ObjectMatrix=K,c.ObjectRelativeFromH=_s,c.ObjectRelativeFromV=fs,c.Observable=Dt,c.ObservableHooks=Uo,c.Observer=vt,c.OnLifecycle=Le,c.PRESET_LIST_TYPE=wi,c.PageElementType=Ms,c.PageOrientType=Os,c.PageType=Ie,c.ParagraphElementType=ss,c.PermissionPoint=Wn,c.PermissionStatus=fe,c.Plugin=ke,c.PluginType=M,c.PositionedObjectLayoutType=is,c.PresetListType=jt,c.ProtectionType=An,c.RANGE_TYPE=W,c.RGBA_PAREN=br,c.RGB_PAREN=Nr,c.Range=ft,c.Rectangle=ht,c.RedoCommand=Ks,c.RefAlias=Ei,c.Registry=te,c.RegistryAsMap=ee,c.RelativeDate=In,c.RelativeSlideLink=Us,c.ResourceManagerService=ps,c.RgbColor=Wt,c.RxDisposable=dr,c.SectionType=ts,c.ShapeType=Cn,c.SheetTypes=ie,c.SheetViewModel=Ts,c.Slide=Ce,c.SpacingRule=as,c.Styles=Ds,c.THEME_COLORS=Nn,c.TabStopAlignment=us,c.TextDecoration=Sn,c.TextDirection=Ot,c.TextDirectionType=ns,c.ThemeColor=$t,c.ThemeColorType=H,c.ThemeColors=Ht,c.ThemeService=Ue,c.Tools=O,c.UNIT_NAME_REGEX=Be,c.UndoCommand=Ys,c.Univer=Do,c.UniverEditablePermission=Qt,c.UniverEditablePermissionPoint=ks,c.UniverInstanceType=Hs,c.UpdateDocsAttributeType=F,c.ValueIterator=Fn,c.VerticalAlign=ut,c.WidthType=cs,c.Worksheet=Nt,c.WrapStrategy=ct,c.WrapTextType=rs,c.binarySearchArray=ln,c.characterSpacingControlType=ms,c.checkParagraphHasBullet=qr,c.checkParagraphHasIndent=Qr,c.checkParagraphHasIndentByStyle=vn,c.codeToBlob=Cr,c.composeInterceptors=tr,c.concatMatrixArray=ci,c.createInterceptorKey=Go,c.createRowColIter=ge,c.datenum_local=Tn,c.dedupe=lr,c.deepCompare=ue,c.deleteContent=Mn,c.deserializeRangeForR1C1=$o,c.deserializeRangeWithSheet=Wo,c.error=he,c.fromObservable=hr,c.generate=ii,c.getAbsoluteRefTypeWitString=Ho,c.getAbsoluteRefTypeWithSingleString=Lt,c.getArrayLength=V,c.getBorderStyleType=Kr,c.getCellValueType=xi,c.getColorStyle=Y,c.getDocsUpdateBody=xt,c.getReverseDirection=Sr,c.getTypeFromPermissionItemList=fi,c.getWorksheetUID=Qi,c.handleJsonToDom=zr,c.handleStyleToString=Yr,c.hashAlgorithm=ai,c.horizontalLineSegmentsSubtraction=ce,c.insertMatrixArray=li,c.insertTextToContent=Dn,c.isCellV=Vi,c.isEmptyCell=pr,c.isFormulaId=jr,c.isFormulaString=Vr,c.isICellData=ki,c.isNullCell=pi,c.isObserver=Ze,c.isRealNum=at,c.isSameStyleTextRun=wn,c.isValidRange=Xr,c.makeCellRangeToRangeData=xr,c.makeCellToSelection=kr,c.moveMatrixArray=_e,c.normalizeTextRuns=Re,c.numberToABC=Oi,c.numberToListABC=Ai,c.orderSearchArray=un,c.remove=q,c.repeatStringNumTimes=Gn,c.requestImmediateMacroTask=Mo,c.runOnLifecycle=we,c.searchArray=Ir,c.selectionToArray=gi,c.sequence=pe,c.sequenceAsync=xe,c.sequenceExecute=re,c.sequenceExecuteAsync=mr,c.serializeRange=yt,c.serializeRangeToRefString=Bo,c.serializeRangeWithSheet=qs,c.serializeRangeWithSpreadsheet=Qs,c.sliceMatrixArray=hi,c.sortRules=Ii,c.sortRulesByDesc=Ci,c.sortRulesFactory=dt,c.spliceArray=ui,c.toDisposable=w,c.update=oi,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.UniverCore={},l["@wendellhu/redi"],l.rxjs,l.rxjs.operators))})(this,function(l,m,C,$n){"use strict";var co=Object.defineProperty;var ho=(l,m,C)=>m in l?co(l,m,{enumerable:!0,configurable:!0,writable:!0,value:C}):l[m]=C;var h=(l,m,C)=>(ho(l,typeof m!="symbol"?m+"":m,C),C);var ao,uo;function kn(){Vn()}const Et=typeof global<"u"?global:typeof self<"u"?self:window;function Vn(){typeof Et.requestIdleCallback!="function"&&(Et.requestIdleCallback=function(s){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));s({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Et.cancelIdleCallback!="function"&&(Et.cancelIdleCallback=function(s){clearTimeout(s)})}class Vt{constructor(){h(this,"_data",[])}static create(){return new Vt}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const s=this._data.indexOf(e);this._data.splice(s,1)}getData(){return this._data}}class xt{constructor(){h(this,"_data",new Map)}static create(){return new xt}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}var D=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(D||{});class be{constructor(e){h(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}h(be,"type",0);class xn{constructor(){h(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class jn{constructor(){h(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(e,s){const n=e.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:e,options:s})}getRegisterPlugins(e){return this._pluginsRegisteredByBusiness.get(e)||[]}clearPluginsOfType(e){this._pluginsRegisteredByBusiness.delete(e)}}function j(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function pn(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function Yn(t,e){for(let s=t.length-1;s>-1;s--){const n=t[s];if(e(n,s))return n}return null}async function De(t){for(const[e,s]of t.entries())try{if(!await s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function Ue(t){for(const[e,s]of t.entries())try{if(!s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function Te(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],n=0;if(s)return s.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Me(t,e){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}}return i}function Pe(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;function ot(t){return typeof t=="function"}function Kn(t){var e=function(n){Error.call(n),n.stack=new Error().stack},s=t(e);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var jt=Kn(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
2
+ `+s.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
+ `):"",this.name="UnsubscriptionError",this.errors=s}});function Fe(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var He=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,s,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Te(o),u=a.next();!u.done;u=a.next()){var _=u.value;_.remove(this)}}catch(O){e={error:O}}finally{try{u&&!u.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(ot(c))try{c()}catch(O){i=O instanceof jt?O.errors:[O]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Te(d),g=f.next();!g.done;g=f.next()){var R=g.value;try{Be(R)}catch(O){i=i!=null?i:[],O instanceof jt?i=Pe(Pe([],Me(i)),Me(O.errors)):i.push(O)}}}catch(O){n={error:O}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(i)throw new jt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)Be(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(e)}},t.prototype._hasParent=function(e){var s=this._parentage;return s===e||Array.isArray(s)&&s.includes(e)},t.prototype._addParent=function(e){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(e),s):s?[s,e]:e},t.prototype._removeParent=function(e){var s=this._parentage;s===e?this._parentage=null:Array.isArray(s)&&Fe(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&Fe(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();He.EMPTY;function We(t){return t instanceof He||t&&"closed"in t&&ot(t.remove)&&ot(t.add)&&ot(t.unsubscribe)}function Be(t){ot(t)?t():t.unsubscribe()}class Ge{constructor(e=!1){h(this,"skipNextObservers");h(this,"lastReturnValue");h(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function $e(t){return t instanceof Rt}class Rt{constructor(e,s){h(this,"_willBeUnregistered",!1);h(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class mt{constructor(e){h(this,"_observers",new Array);h(this,"_eventState");h(this,"_onObserverAdded");this._eventState=new Ge,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new Rt(e,this);return r.unregisterOnNextCall=n,s?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let s=0;s<this._observers.length;s++){const n=this._observers[s];if(!n._willBeUnregistered&&n.callback===e)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const s=this._eventState;s.skipNextObservers=!1,s.lastReturnValue=e,s.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i),s.isStopPropagation&&(n=!0),s.skipNextObservers))return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(e){let s=Promise.resolve(e);if(!this._observers.length)return s;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(s=s.then(()=>i.callback(e,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return s.then(()=>e)}notifyObserver(e,s){if(e._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,e.callback(s,n),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new mt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function L(t){let e=!1;return We(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:$e(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function zn(t){return L(()=>{t.unsubscribe()})}class pt{constructor(){h(this,"_disposables",new Set)}add(e){return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(e=>{e.dispose(),this._disposables.delete(e)})}}class T{constructor(){h(this,"_disposed",!1);h(this,"_collection",new pt)}disposeWithMe(e){const s=We(e)?L(e):e;return this._collection.add(s)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Xn extends T{constructor(){super(...arguments);h(this,"dispose$",new C.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const Z=m.createIdentifier("univer.context-service");class ke extends T{constructor(){super(...arguments);h(this,"_contextChanged$",new C.Subject);h(this,"contextChanged$",this._contextChanged$.asObservable());h(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){var n;return(n=this._contextMap.get(s))!=null?n:!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next({[s]:n})}subscribeContextValue$(s){return new C.Observable(n=>{const r=this._contextChanged$.pipe(C.filter(i=>typeof i[s]<"u")).subscribe(i=>n.next(i[s]));return this._contextMap.has(s)&&n.next(this._contextMap.get(s)),()=>r.unsubscribe()})}}var Ve=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(Ve||{});const q=m.createIdentifier("univer.log");class xe extends T{constructor(){super(...arguments);h(this,"_logLevel",3)}debug(...s){this._logLevel>=4&&this._log(console.debug,...s)}log(...s){this._logLevel>=3&&this._log(console.log,...s)}warn(...s){this._logLevel>=2&&this._log(console.warn,...s)}error(...s){this._logLevel>=1&&this._log(console.error,...s)}setLogLevel(s){this._logLevel=s}_log(s,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?s(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):s(...n)}}var qn=Object.defineProperty,Qn=Object.getOwnPropertyDescriptor,Jn=(t,e,s,n)=>{for(var r=n>1?void 0:n?Qn(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&qn(e,s,r),r},je=(t,e)=>(s,n)=>e(s,n,t),Ot=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Ot||{});const at=m.createIdentifier("anywhere.command-service");class Zn{constructor(){h(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),L(()=>{var s;this._commands.delete(e.id),(s=e.onDispose)==null||s.call(e)})}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}l.CommandService=class{constructor(e,s){h(this,"_commandRegistry");h(this,"_beforeCommandExecutionListeners",[]);h(this,"_commandExecutedListeners",[]);h(this,"_multiCommandDisposables",new Map);h(this,"_commandExecutingLevel",0);h(this,"_commandExecutionStack",[]);this._injector=e,this._logService=s,this._commandRegistry=new Zn,this._registerCommand(pe)}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),L(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),L(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(_=>_(o,n));const u=await this._execute(i,s);return this._commandExecutedListeners.forEach(_=>_(o,n)),a.dispose(),u}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,a={id:o.id,type:o.type,params:s};if(o.type===2){const c=Yn(this._commandExecutionStack,d=>d.type===0);c&&(a.params=(i=a.params)!=null?i:{},a.params.trigger=c.id)}const u=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,n));const _=this._syncExecute(o,s);return this._commandExecutedListeners.forEach(c=>c(a,n)),u.dispose(),_}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),L(()=>j(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const s=this._commandRegistry.getCommand(e.id);let n;if(s){if(s[0].multi!==!0)throw new Error("Command has registered as a single command.");n=s[0]}else{const i=new pt;n=new yn(e.id),i.add(this._commandRegistry.registerCommand(n)),i.add(L(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=n.registerImplementation(e);return L(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let n;try{n=await this._injector.invoke(e.handler,s),this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}_syncExecute(e,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let n;try{if(n=this._injector.invoke(e.handler,s),n instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}},l.CommandService=Jn([je(0,m.Inject(m.Injector)),je(1,q)],l.CommandService);class yn{constructor(e){h(this,"name");h(this,"multi",!0);h(this,"type",0);h(this,"priority",0);h(this,"_implementations",[]);h(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(q),r=e.get(Z),i=e.get(m.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),L(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function Yt(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return Ue(n)}function tr(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return De(n)}const pe={id:"nil",type:0,handler:()=>!0},Ye=m.createIdentifier("univer.config-service");class er{constructor(){h(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,s){this._config.set(e,s)}deleteConfig(e){this._config.delete(e)}}class Ke extends T{constructor(){super(...arguments);h(this,"_error$",new C.Subject);h(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const sr="__default_document_sub_component_id20231101__";class ze{constructor(){h(this,"_managerInfo",new Map);h(this,"_remove$",new C.Subject);h(this,"remove$",this._remove$.asObservable());h(this,"_andOrUpdate$",new C.Subject);h(this,"andOrUpdate$",this._andOrUpdate$.asObservable());h(this,"_pluginUpdate$",new C.Subject);h(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const s=this._clearByParam(e);this._remove$.next(s)}addOrUpdate(e){const s=this._addByParam(e);this._andOrUpdate$.next(s)}BatchAddOrUpdate(e){const s=[];e.forEach(n=>{s.push(...this._addByParam(n))}),this._andOrUpdate$.next(s)}remove(e){const s=this._removeByParam(e);this._remove$.next(s)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:s,subUnitId:n}=e;return(r=this._managerInfo.get(s))==null?void 0:r.get(n)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:s,subUnitId:n,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(s))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(e){const{unitId:s,subUnitId:n,floatingObject:r,floatingObjectId:i}=e;this._managerInfo.has(s)||this._managerInfo.set(s,new Map);const o=this._managerInfo.get(s);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:s,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(e){const s=this._getFloatingObjects(e),{unitId:n,subUnitId:r}=e,i=[];return s==null||s.forEach((o,a)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:a,floatingObject:o})}),s==null||s.clear(),i}_removeByParam(e){const s=this._getFloatingObjects(e),n=s==null?void 0:s.get(e.floatingObjectId);return n==null?[]:(s==null||s.delete(e.floatingObjectId),[{...e,floatingObject:n}])}}const Xe=m.createIdentifier("univer.floating-object.service");class qe{constructor(){h(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function Qe(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function Je(t,e){let s=0,n=0,r=0,i=-1,o=t.length-1;for(;s<t.length&&o>=0&&o>=s;){if(n=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=n){i=o;break}if(n=t[s],s===0?r=0:r=t[s-1],e>=r&&e<n){i=s;break}s++,o--}return i}function nr(t,e){let s=t.length-1;return e<0?-1:e<t[0]?0:e>t[t.length-1]?1/0:(t.length<40||e<=t[20]||e>=t[s-20]?s=Je(t,e):s=Qe(t,e),s)}function rr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var Ze=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(Ze||{}),S=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(S||{}),ye=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(ye||{}),H=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(H||{}),ts=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(ts||{}),es=(t=>(t[t.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",t[t.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",t[t.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",t[t.NUMBER_LESS=3]="NUMBER_LESS",t[t.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",t[t.NUMBER_EQ=5]="NUMBER_EQ",t[t.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",t[t.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",t[t.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",t[t.TEXT_CONTAINS=9]="TEXT_CONTAINS",t[t.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",t[t.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",t[t.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",t[t.TEXT_EQ=13]="TEXT_EQ",t[t.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",t[t.TEXT_IS_URL=15]="TEXT_IS_URL",t[t.DATE_EQ=16]="DATE_EQ",t[t.DATE_BEFORE=17]="DATE_BEFORE",t[t.DATE_AFTER=18]="DATE_AFTER",t[t.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",t[t.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",t[t.DATE_BETWEEN=21]="DATE_BETWEEN",t[t.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",t[t.DATE_IS_VALID=23]="DATE_IS_VALID",t[t.ONE_OF_RANGE=24]="ONE_OF_RANGE",t[t.ONE_OF_LIST=25]="ONE_OF_LIST",t[t.BLANK=26]="BLANK",t[t.NOT_BLANK=27]="NOT_BLANK",t[t.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",t[t.BOOLEAN=29]="BOOLEAN",t[t.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",t[t.DATE_NOT_EQ=31]="DATE_NOT_EQ",t))(es||{}),ss=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(ss||{}),ns=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(ns||{}),rs=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(rs||{}),is=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(is||{});function ir(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var os=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(os||{}),as=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(as||{}),It=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(It||{}),us=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(us||{}),ls=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(ls||{}),cs=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(cs||{}),Kt=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Kt||{}),ut=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(ut||{}),hs=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(hs||{}),Q=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(Q||{}),y=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(y||{}),tt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(tt||{}),At=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(At||{}),Ct=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(Ct||{}),Nt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(Nt||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),lt=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(lt||{}),P=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(P||{}),St=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(St||{});const _s={[St.OFFICE]:{[P.ACCENT1]:"#4472C4",[P.ACCENT2]:"#ED7D31",[P.ACCENT3]:"#A5A5A5",[P.ACCENT4]:"#70AD47",[P.ACCENT5]:"#5B9BD5",[P.ACCENT6]:"#70AD47",[P.DARK1]:"#000000",[P.DARK2]:"#44546A",[P.LIGHT1]:"#FFFFFF",[P.LIGHT2]:"#E7E6E6",[P.HYPERLINK]:"#0563C1",[P.FOLLOWED_HYPERLINK]:"#954F72"}};class Lt{constructor(){h(this,"_themeValue",P.LIGHT1);h(this,"_themeColors");h(this,"_themeTint");h(this,"_rgbValue","");h(this,"_colorType");this._colorType=H.UNSUPPORTED,this._themeColors=St.OFFICE,this._themeTint=0}asRgbColor(){return new vt(this._rgbValue,this)}asThemeColor(){return new wt(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case H.THEME:return this.asThemeColor();case H.RGB:return this.asRgbColor();case H.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=H.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=H.THEME,this._themeColors=e}setThemeTint(e){this._colorType=H.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=H.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class J{constructor(e){h(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const s=+`0x${e[0]}${e[1]}`,n=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Lt().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(i,o,a,u)=>o+o+a+a+u+u);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),a=Number.parseInt(n[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new J(this._builder)}equals(e){return!1}}class ds{constructor(e){h(this,"_saturation",0);h(this,"_hue",0);h(this,"_lightness",0);h(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),a=Math.max(s,Math.max(n,r)),u=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=u/(a+o):this._saturation=u/(2-a-o),s===a&&(this._hue=(n-r)/u),n===a&&(this._hue=2+(r-s)/u),r===a&&(this._hue=4+(s-n)/u),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Lt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),a=this.setColor(s,n,r),u=r-1/3,_=this.setColor(s,n,u);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(_*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,s,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=s+(e-s)*6*n:2*n<1?r=e:3*n<2?r=s+(e-s)*(2/3-n)*6:r=s,r}setLightness(e){this._lightness=e}}const W=class W extends J{constructor(s,n){super(n);h(this,"_cssString");h(this,"_red");h(this,"_green");h(this,"_blue");h(this,"_alpha");let r=s.match(W.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],u=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=u;return}if(r=s.match(W.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return J.rgbColorToHexValue(this)}getRed(){let s=this._red+W.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+W.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+W.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getAlpha(){return this._alpha}getColorType(){return H.RGB}clone(){return new W(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(s){return s instanceof W?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._alpha===this._alpha:!1}getCssString(){return this._cssString}};h(W,"RGB_COLOR_AMT",0),h(W,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),h(W,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let vt=W;const z=class z extends J{constructor(s,n,r,i){super(i);h(this,"_themeColorType");h(this,"_themeTint");h(this,"_themeColors");this._themeColorType=s,this._themeTint=n,this._themeColors=r}lumValue(s,n){if(s==null)return n;let r;return s<0?r=n*(1+s):r=n*(1-s)+(255-255*(1-s)),r}asRgbColor(){const s=_s[this._themeColors];if(s==null)throw new Error("not find themeColors type");const n=s[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(z._cacheThemeColor.has(this._themeColors)){if(r=z._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,z._cacheThemeColor.set(this._themeColors,r);const i=new ds(J.hexValueToRgbColor(n));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new z(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(s){return s instanceof z?s._themeColorType===this._themeColorType:!1}getColorType(){return H.THEME}getThemeColorType(){return this._themeColorType}};h(z,"_cacheThemeColor",new Map);let wt=z;const or="rgb(",ar="rgba(",zt={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class B{constructor(e){h(this,"_color");h(this,"_rgbColor");h(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof B){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=fs(e);if(s==null){this._setNullColor();return}this._color=s;const n=_r(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){var _,c;n=Math.min(1,Math.max(0,n));const r=new B(e).toRgb(),i=new B(s).toRgb(),o=(_=r.a)!=null?_:1,a=(c=i.a)!=null?c:1,u={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(a-o)*n+o};return new B(u)}static getContrastRatio(e,s){const n=new B(e).getLuminance(),r=new B(s).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:s,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${s},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:s,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[bt(Math.round(s).toString(16)),bt(Math.round(n).toString(16)),bt(Math.round(r).toString(16)),bt(Math.round(i*255).toString(16))];return e&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Er(this.toRgb())}toHsl(){return gr(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new B(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new B(s)}setAlpha(e){return new B({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=Xt(e),s=Xt(s),n=Xt(n),Number((.2126*e+.7152*s+.0722*n).toFixed(3))}getBrightness(){const{r:e,g:s,b:n}=this.toRgb();return(e*299+s*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)!=null?e:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const bt=t=>t.length===1?`0${t}`:t,Xt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),fs=t=>{if(mr(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const s={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(s.a=t.a),s}const e=t.trim();if(zt[e]){const s=zt[e],n={r:Math.round(s[0]),g:Math.round(s[1]),b:Math.round(s[2])};return n.a=s[3]||1,n}if(e.startsWith("#"))return ur(e);if(e.startsWith("rgb"))return lr(e);if(e.startsWith("hsl"))return cr(e);if(e.startsWith("hsv"))return hr(e)},ur=t=>{const e=t.substring(1),s=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(s);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:parseInt(n[0],16),g:parseInt(n[1],16),b:parseInt(n[2],16)};return n.length>3&&(r.a=parseInt(n[3],16)/255),r},lr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:parseInt(s[0],10),g:parseInt(s[1],10),b:parseInt(s[2],10)};return s.length>3&&(n.a=parseFloat(s[3])),n},cr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:parseInt(s[0],10),s:parseFloat(s[1]),l:parseFloat(s[2])};return s.length>3&&(n.a=parseFloat(s[3])),n},hr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:parseInt(s[0],10),s:parseFloat(s[1]),v:parseFloat(s[2])};return s.length>3&&(n.a=parseFloat(s[3])),n},_r=t=>{const e=fs(t);if(e!=null)return"r"in e?e:"l"in e?dr(e):fr(e)},qt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t),dr=t=>{let{h:e,s,l:n}=t;e/=360,s/=100,n/=100;let r=0,i=0,o=0;if(s===0)r=i=o=n;else{const u=n<.5?n*(1+s):n+s-n*s,_=2*n-u;r=qt(_,u,e+1/3),i=qt(_,u,e),o=qt(_,u,e-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},fr=t=>{let{h:e,s,v:n}=t;e=e/360*6,s/=100,n/=100;const r=Math.floor(e),i=e-r,o=n*(1-s),a=n*(1-i*s),u=n*(1-(1-i)*s),_=r%6,c=[n,a,o,o,u,n][_],d=[u,n,n,a,o,o][_],f=[o,o,u,n,n,a][_],g={r:c*255,g:d*255,b:f*255};return t.a!==void 0&&(g.a=t.a),g},gr=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n),o=(r+i)/2;let a,u;if(r===i)a=u=0;else{const c=r-i;switch(u=o>.5?c/(2-r-i):c/(r+i),r){case e:a=(s-n)/c+(s<n?6:0);break;case s:a=(n-e)/c+2;break;default:a=(e-s)/c+4;break}a/=6}const _={h:Math.round(a*360),s:Math.round(u*100),l:Math.round(o*100)};return t.a!==void 0&&(_.a=t.a),_},Er=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n);let o;const a=r,u=r-i,_=r===0?0:u/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/u+(s<n?6:0);break;case s:o=(n-e)/u+2;break;default:o=(e-s)/u+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(_*100),v:Math.round(a*100)};return t.a!==void 0&&(c.a=t.a),c},Rr=t=>t==null,mr=t=>!Rr(t)&&typeof t=="object";var M=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(M||{});let Or=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const Ir=/^-ms-/,Ar=/-([a-z])/g,p=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class E{static stringAt(e){let s="",n=e;for(;n>=p.length;)n/=p.length,n-=1,s+=p[n%p.length];const r=e%p.length;return s+=p[r],s}static indexAt(e){let s=0;for(let n=0;n<e.length-1;n+=1){const r=e.charCodeAt(n)-65,i=e.length-1-n;s+=p.length**i+p.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return E.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,u=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const c=parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":s?"Opera":a?"Safari":u?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Or(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.forEach(o=>o&&i(o));function n(o,a){o.forEach((u,_)=>{var c,d;if(E.isArray(u)){const f=(c=a[_])!=null?c:[];a[_]=f,n(u,f);return}if(E.isObject(u)){const f=(d=a[_])!=null?d:{};a[_]=f,r(u,f);return}a[_]=u})}function r(o,a){Object.keys(o).forEach(u=>{var c,d;const _=o[u];if(E.isObject(_)){const f=(c=a[u])!=null?c:{};a[u]=f,r(_,f);return}if(E.isArray(_)){const f=(d=a[u])!=null?d:[];a[u]=f,n(_,f);return}a[u]=_})}function i(o){Object.keys(o).forEach(a=>{var _,c;const u=o[a];if(E.isArray(u)){const d=(_=e[a])!=null?_:[];e[a]=d,n(u,d);return}if(E.isObject(u)){const d=(c=e[a])!=null?c:{};e[a]=d,r(u,d);return}e[a]=u})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){function n(o,a){const u=E.getValueType(o),_=E.getValueType(a);return u!==_?!1:E.isArray(o)?r(o,a):E.isObject(o)?i(o,a):E.isDate(o)?o.getTime()===a.getTime():E.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(e.length!==s.length)return!1;for(let u=0,_=o.length;u<_;u++){const c=o[u],d=a[u];if(!n(c,d))return!1}return!0}function i(o,a){const u=Object.keys(o),_=Object.keys(a);if(u.length!==_.length)return!1;for(const c of u){if(!_.includes(c))return!1;const d=o[c],f=a[c];if(!n(d,f))return!1}return!0}return n(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=E.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=E.deepClone(r)}),Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,s){return e instanceof s}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const s in e)return!1;return!0}static isMobile(){let e=0,s=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(s=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&s<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return s=>{for(let n=0;n<e;n++)s&&s()}}static hasLength(e,s){return E.isDefine(e)?E.isDefine(s)?e.length===s:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,s){return s.toUpperCase()}static camelCase(e){return e.replace(Ir,"ms-").replace(Ar,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:E.removeNull(n)}),e}static fillTwoDimensionalArray(e,s,n){return new Array(e).fill(n).map(r=>new Array(s).fill(n))}static numToWord(e){let s="";for(;e>0;){let n=e%26;n=n===0?n=26:n,s=String.fromCharCode(96+n)+s,e=(e-n)/26}return s.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;const s=e.toLowerCase().split(""),n=s.length;let r=0,i=0;for(let o=0;o<n;o++)i=s[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let s=0,n=e.length;s<n;s++){const r=parseInt((Math.random()*n).toString()),i=e[r];e[r]=e[s],e[s]=i}return e}static commonExtend(e,s){const n={};for(const r in e)n[r]=e[r];for(const r in s)s[r]!=null&&(n[r]=s[r]);return n}static commonExtend1(e,s){for(const n in e)s[n]==null&&(s[n]=e[n]);return s}static arrayToObject(e){const s={};return e.forEach((n,r)=>{s[r]={},n.forEach((i,o)=>{s[r][o]=i})}),s}static hasIntersectionBetweenTwoRanges(e,s,n,r){return s>=n&&r>=e}}function Cr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:u,endX:_}=t,c=e,d=s,f=e,g=s;if(n&&i){const{startRow:R,startColumn:O,endRow:w,endColumn:b,startY:V,endY:x,startX:gt,endX:lo}=i;c=R,d=O,f=w,g=b,o=V,a=x,u=gt,_=lo}return r&&(o=i.startY,a=i.endY,u=i.startX,_=i.endX,f=i.endRow,g=i.endColumn),{startRow:c,startColumn:d,endRow:f,endColumn:g,startY:o,endY:a,startX:u,endX:_}}function Nr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:u}=t;let _=e,c=s,d=e,f=s;return(n||r)&&(_=i,c=o,d=a,f=u),{startRow:_,startColumn:c,endRow:d,endColumn:f}}function Sr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function G(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Lt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Lr(t){return E.isString(t)&&t.substring(0,1)==="="&&t.length>1}function vr(t){return E.isString(t)&&t.indexOf("=")===-1&&t.length===6}function wr(t){return""}function br(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${G(t.ul.cl)}; `),t.ul.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," line-through"):s+="text-decoration-line: line-through; ",t.st.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${G(t.st.cl)}; `),t.st.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${G(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${G(t.bg)}; `)}],["bd",()=>{var o,a,u,_,c,d,f,g,R,O,w,b;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${Dt((a=t.bd)==null?void 0:a.b.s)} ${(u=G(t.bd.b.cl))!=null?u:""}; `),(_=t.bd)!=null&&_.t&&(s+=`border-top: ${Dt((c=t.bd)==null?void 0:c.t.s)} ${(d=G(t.bd.t.cl))!=null?d:""}; `),(f=t.bd)!=null&&f.r&&(s+=`border-right: ${Dt((g=t.bd)==null?void 0:g.r.s)} ${(R=G(t.bd.r.cl))!=null?R:""}; `),(O=t.bd)!=null&&O.l&&(s+=`border-left: ${Dt((w=t.bd)==null?void 0:w.l.s)} ${(b=G(t.bd.l.cl))!=null?b:""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${G(t.cl)}; `)}],["va",()=>{t.va===Nt.SUBSCRIPT?s+="vertical-align: sub; ":t.va===Nt.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===ut.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===ut.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,u;t.tr&&(s+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(u=t.tr)==null?void 0:u.v}`:""});`)}],["ht",()=>{t.ht===Q.LEFT?s+="text-align: left; ":t.ht===Q.RIGHT?s+="text-align: right; ":t.ht===Q.CENTER?s+="text-align: center; ":t.ht===Q.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===y.BOTTOM?s+="vertical-align: bottom; ":t.vt===y.TOP?s+="vertical-align: top; ":t.vt===y.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===tt.CLIP?s+="text-overflow: clip; ":t.tb===tt.OVERFLOW?s+="text-break: overflow; ":t.tb===tt.WRAP&&(s+="word-wrap: break-word;")}],["pd",()=>{var c,d,f,g,R,O,w,b;const o=`${(c=t.pd)==null?void 0:c.b}pt`,a=`${(d=t.pd)==null?void 0:d.t}pt`,u=`${(f=t.pd)==null?void 0:f.l}pt`,_=`${(g=t.pd)==null?void 0:g.r}pt`;(R=t.pd)!=null&&R.b&&(s+=`padding-bottom: ${o}; `),(O=t.pd)!=null&&O.t&&(s+=`padding-top: ${a}; `),(w=t.pd)!=null&&w.l&&(s+=`padding-left: ${u}; `),(b=t.pd)!=null&&b.r&&(s+=`padding-right: ${_}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function Dt(t){let e="";return t===S.NONE?e="none":t===S.THIN?e="0.5pt solid":t===S.HAIR?e="0.5pt double":t===S.DOTTED?e="0.5pt dotted":t===S.DASHED||t===S.DASH_DOT?e="0.5pt dashed":t===S.DASH_DOT_DOT?e="0.5pt dotted":t===S.DOUBLE?e="0.5pt double":t===S.MEDIUM?e="1pt solid":t===S.MEDIUM_DASHED||t===S.MEDIUM_DASH_DOT?e="1pt dashed":t===S.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===S.SLANT_DASH_DOT?e="0.5pt dashed":t===S.THICK&&(e="1.5pt solid"),e}function Dr(t){let e=0;if(t=t.trim(),t==="none")e=S.NONE;else if(t==="0.5pt solid")e=S.THIN;else if(t==="0.5pt double")e=S.HAIR;else if(t==="0.5pt dotted")e=S.DOTTED;else if(t==="0.5pt dashed")e=S.DASHED;else if(t==="1pt solid")e=S.MEDIUM;else if(t==="1pt dashed")e=S.MEDIUM_DASHED;else if(t==="1pt dotted")e=S.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=S.THICK;else return S.NONE;return e}function Ut(t,e){let s=t.body;if(e){const{headers:n,footers:r}=t;n!=null&&n[e]?s=n[e].body:r!=null&&r[e]&&(s=r[e].body)}return s}function Ur(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=t;return!(e<0||n<0||s<0||r<0)}function Qt(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(s=>Qt(t[s],e[s])):t===e:!1}function gs(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:Qt(s,n)}function Jt(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function Tr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Mr(t){if(t==null)return!1;const e=t.paragraphStyle;return Es(e)}function Es(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Rs(t,e,s){return t.slice(0,e)+s+t.slice(e)}function ms(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}function Pr(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Fr(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+(e<<6)+(e<<16)-e;return e>>>0}class ct{static hasLength(e,s){return e.length===s}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}const N=Symbol("newer"),U=Symbol("older");class Os{constructor(e){h(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Is{constructor(e){h(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:e.value}):{done:!0,value:void 0}}}class As{constructor(e){h(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}class Zt{constructor(e,s){h(this,"key");h(this,"value");h(this,ao);h(this,uo);this.key=e,this.value=s,this[N]=void 0,this[U]=void 0}toJSON(){return{key:this.key,value:this.value}}}ao=N,uo=U;class Cs{constructor(...e){h(this,"_keymap");h(this,"size",0);h(this,"limit");h(this,"oldest");h(this,"newest");h(this,"_onShiftListeners",[]);if(ct.hasLength(e,1)){if(ct.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(ct.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(ct.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),L(()=>j(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,s){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,s&&(this.assign(s),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[N]&&(e===this.oldest&&(this.oldest=e[N]),e[N][U]=e[U]),e[U]&&(e[U][N]=e[N]),e[N]=void 0,e[U]=this.newest,this.newest&&(this.newest[N]=e),this.newest=e)}assign(e){let s,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new Zt(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[N]=o,o[U]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new Zt(e,s)),this.newest?(this.newest[N]=n,n[U]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[N]?(this.oldest=this.oldest[N],this.oldest[U]=void 0):(this.oldest=void 0,this.newest=void 0),e[N]=e[U]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[N]&&s[U]?(s[U][N]=s[N],s[N][U]=s[U]):s[N]?(s[N][U]=void 0,this.oldest=s[N]):s[U]?(s[U][N]=void 0,this.newest=s[U]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Os(this.oldest)}values(){return new Is(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new As(this.oldest)}forEach(e,s){typeof s!="object"&&(s=this);let n=this.oldest;for(;n;)e.call(s,n.value,n.key,this),n=n[N]}toJSON(){const e=new Array(this.size);let s=0,n=this.oldest;for(;n;)e[s++]={key:n.key,value:n.value},n=n[N];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[N],s&&(e+=" < ");return e}}function $(t){let e=0;const s=Object.keys(t);for(const n of s){const r=Number(n);e=Math.max(e,r)}return e+1}function yt(t,e,s){const n=$(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function te(t,e,s,n){const r=t+e,i=$(s),o=s;let a=0;const u={};for(let f=t;f<r;f++){const g=o[f];g!==void 0&&(delete o[f],u[a]=g,a++)}const _=n?$(n):0,c=t-r+_,d=i;if(c>0)for(let f=d-1;f>=r;f--)o[f]!==void 0&&(o[f+c]=o[f],delete o[f]);else if(c<0)for(let f=r;f<d;f++)o[f]!==void 0&&(o[f+c]=o[f],delete o[f]);if(n)for(let f=0;f<_;f++)o[t+f]=n[f];return u}function Hr(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,o=Object.keys(i),a=o.length,u={};let _=0;for(let c=0;c<r;c++,_++){const d=n[c];u[_]=s[d]}for(let c=0;c<a;c++,_++){const d=o[c];u[_]=i[d]}return u}function Wr(t,e,s){const n=s;if($(s)>0){const i={};let o=0;for(let a=t;a<=e;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function ee(t,e,s,n){const r=t>s;if(!r&&t+e>s)throw new Error("Invalid move operation");r?Br(t,e,s,n):Gr(t,e,s,n)}function Br(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=s;o--){const a=r[o];r[o+e]=a,a==null&&delete r[o+e]}i.forEach((o,a)=>{r[s+a]=o,o==null&&delete r[s+a]})}function Gr(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<s;o++){const a=r[o];r[o-e]=a,a==null&&delete r[o-e]}i.forEach((o,a)=>{r[s+a-e]=o,o==null&&delete r[s+a-e]})}class k{constructor(e={}){h(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new k({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,o)===!1)return this}return this}forRow(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,Object.keys(o).map(u=>Number(u)))===!1)return this}return this}forValue(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(!o)continue;const a=Object.keys(o);for(const u of a){const _=Number(u),c=o[Number(u)];if(e(i,_,c)===!1)return this}}return this}swapRow(e,s){const n=this._matrix[e],r=this._matrix[s];this._matrix[e]=r,this._matrix[s]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let s=this.getRow(e);return s==null&&(s={},this._matrix[e]=s),s}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,s=Object.keys(e);if(s.length===0)return!1;for(const n of s){const r=Number(n),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,s){var n,r;return(r=(n=this._matrix)==null?void 0:n[e])==null?void 0:r[s]}setValue(e,s,n){const r=this.getRowOrCreate(e);r[s]=n}deleteValue(e,s){var n,r;(r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s]}realDeleteValue(e,s){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,s){this._matrix[e]=s}moveRows(e,s,n){ee(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{ee(e,s,n,i)})}insertRows(e,s){for(let n=e;n<e+s;n++)yt(n,{},this._matrix)}insertColumns(e,s){for(let n=e;n<e+s;n++)this.forEach((r,i)=>{yt(n,void 0,i)})}removeRows(e,s){te(e,s,this._matrix)}removeColumns(e,s){this.forEach((n,r)=>{te(e,s,r)})}getFragment(e,s,n,r){const i=new k;let o=0;for(let a=e;a<=s;a++){const u={};let _=0;for(let c=n;c<=r;c++){const d=this.getValue(a,c);u[_]=d,_++}i.setRow(o,u),o++}return i}getSlice(e,s,n,r){const i=new k;for(let o=e;o<=s;o++)for(let a=n;a<=r;a++){const u=this.getValue(o,a);u&&i.setValue(o,a,E.deepClone(u))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return $(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const u=$(a)-1;r=u>r?u:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((s,n)=>{e[s]==null&&(e[s]=[]),n.forEach(r=>{e[s][r]=this.getValue(s,r)})}),e}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,s=0,n=!1,r=!1;const i=new k;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(u=>{const _=Number(u);r?_<s&&(s=_):(r=!0,s=_);const c=this.getValue(o,_);i.setValue(o-e,_-s,c)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,u)=>{i||(i=!0,e=a);const _=$(u)-1;_>n&&(n=_),Object.keys(u).forEach(c=>{const d=Number(c);o?d<s&&(s=d):(o=!0,s=d)}),a>r&&(r=a)}),{startRow:e,startColumn:s,endRow:r,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)if(s>=a.startRow&&s<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(s,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e}}var se=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(se||{});class Ns{constructor(){h(this,"status","init")}}const $r=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done";var F=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(F||{}),Ss=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(Ss||{});function kr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const X=class X{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,s){return e==null||s==null?!1:e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===F.NORMAL||s.rangeType===void 0&&e.rangeType===F.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,u=s.endRow,_=s.startColumn,c=s.endColumn,d=Math.abs(i+o-_-c),f=Math.abs(i-o)+Math.abs(_-c),g=Math.abs(n+r-a-u),R=Math.abs(n-r)+Math.abs(a-u);return d<=f&&g<=R}static getIntersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,u=s.endRow,_=s.startColumn,c=s.endColumn;let d,f,g,R;if(a<=r)a>=n?f=a:f=n;else return null;if(u>=n)u>=r?R=r:R=u;else return null;if(_<=o)_>i?d=_:d=i;else return null;if(c>=i)c>=o?g=o:g=c;else return null;return{startRow:f,endRow:R,startColumn:d,endColumn:g,rangeType:F.NORMAL}}static contains(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return X.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:F.NORMAL}),e[0])}static subtract(e,s){if(s.startRow>=e.endRow||s.endRow<=e.startRow||s.startColumn>=e.endColumn||s.endColumn<=e.startColumn)return[e];const n=[];s.startRow>e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:s.startRow,endColumn:e.endColumn}),s.endRow<e.endRow&&n.push({startRow:s.endRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,s.startRow),i=Math.min(e.endRow,s.endRow);return s.startColumn>e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:s.startColumn}),s.endColumn<e.endColumn&&n.push({startRow:r,startColumn:s.endColumn,endRow:i,endColumn:e.endColumn}),n}};h(X,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),h(X,"getPositionRange",(e,s)=>({startRow:e.startRow+s.startRow,endRow:e.endRow+e.startRow+s.startRow,startColumn:e.startColumn+s.startColumn,endColumn:e.endColumn+e.startColumn+s.startColumn})),h(X,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),h(X,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),h(X,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let et=X;class Vr{constructor(e,s){h(this,"_values",[]);h(this,"_keys",[]);h(this,"_keyMaps",new Map);this._values=e,this._keys=s,e.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(e){this._keys.forEach(s=>{const n=e[s],r=this._keyMaps.get(s)||new Map;r.set(n,e),this._keyMaps.set(s,r)})}getValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return n.get(e)}return null}hasValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,s,n){const r=this.getValue(e);r&&Object.keys(r).includes(s)&&(r[s]=n)}deleteValue(e){const s=this.getValue(e);if(s){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=s[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===s);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(e){var s;return[...((s=this._keyMaps.get(e))==null?void 0:s.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ne(t,e,s,n){return{forEach(r){for(let i=t;i<=e;i++)for(let o=s;o<=n;o++)r(i,o)}}}function xr(t){if(t==null||t.length===0)return NaN;const e=t.toLowerCase().split(""),s=e.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<s;o++)i=n(e[o]),r+=i*26**(s-o-1);return r===0?NaN:r-1}const Tt=65,Ls=90,jr=97;function pr(t){const e=Ls-Tt+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+Tt)+s,t=Math.floor(t/e)-1;return s}function vs(t,e){let s="";for(;e>0;)s+=t,e--;return s}function Yr(t,e=!1){const s=Ls-Tt+1;let n=jr;e&&(n=Tt);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return vs(r,i)}function Kr(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function zr(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function st(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}var ws=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(ws||{}),re=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
4
+ `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(re||{});function ie(t){const e=[];for(const s of t){const{st:n,ed:r,ts:i}=s;if(s.sId===void 0&&delete s.sId,n===r||E.isEmptyObject(i)&&s.sId==null)continue;if(e.length===0){e.push(s);continue}const o=e.pop();gs(s,o)&&E.hasIntersectionBetweenTwoRanges(o.st,o.ed,s.st,s.ed)?e.push({...s,st:o.st,ed:r}):e.push(o,s)}return e}function bs(t,e,s,n){var _;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const u=(_=e.textRuns)!=null?_:[];if(u.length)for(let c=0,d=u.length;c<d;c++){const f=u[c];f.st+=n,f.ed+=n}for(let c=0;c<o;c++){const d=r[c],{st:f,ed:g}=d;if(g<n)i.push(d);else if(n>=f&&n<=g)if(a)d.st+=s,d.ed+=s,i.push(d);else{a=!0,d.ed+=s;const R=[];if(u.length){const O={...d,st:f,ed:u[0].st};R.push(O),R.push(...u);const w=u[u.length-1],b={...d,st:w.ed,ed:g+s};R.push(b)}else R.push(d);i.push(...R)}else d.st+=s,d.ed+=s,a||(a=!0,i.push(...u)),i.push(d)}a||(a=!0,i.push(...u)),t.textRuns=ie(i)}function oe(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let u=-1;for(let c=0,d=r.length;c<d;c++){const f=r[c],{startIndex:g}=f;g>=n&&(f.startIndex+=s),u===-1&&g>=n&&(u=c),a.push(f.startIndex)}let _=-1;if(i){for(let c=0,d=i.length;c<d;c++){const f=i[c];f.startIndex+=n;const g=f.startIndex;_=a.indexOf(g)}if(o===re.PARAGRAPH&&i.length===1){const c=r[u],d=i[0],f=c.paragraphStyle,g=c.bullet;c.paragraphStyle=d.paragraphStyle,c.bullet=d.bullet,d.paragraphStyle=f,d.bullet=g}_!==-1&&r.splice(_,1),r.push(...i),r.sort(st("startIndex"))}}function Xr(t,e,s,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const u=r[o],{startIndex:_}=u;_>=n&&(u.startIndex+=s)}const i=e.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const u=i[o];u.startIndex+=n}r.push(...i),r.sort(st("startIndex"))}}function Ds(t,e,s,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const u=r[o],{startIndex:_}=u;_>=n&&(u.startIndex+=s)}const i=e.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const u=i[o];u.startIndex+=n}r.push(...i),r.sort(st("startIndex"))}}function ae(t,e,s,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const u=r[o],{startIndex:_,endIndex:c}=u;_>n?(u.startIndex+=s,u.endIndex+=s):c>=n-1&&(u.endIndex+=s)}const i=e.tables;if(i){for(let o=0,a=i.length;o<a;o++){const u=i[o];u.startIndex+=n,u.endIndex+=n}r.push(...i),r.sort(st("startIndex"))}}function qr(t,e,s,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const u=r[o],{startIndex:_,endIndex:c}=u;_>n?(u.startIndex+=s,u.endIndex+=s):c>=n-1&&(u.endIndex+=s)}const i=e.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const u=i[o];u.startIndex+=n,u.endIndex+=n}r.push(...i),r.sort(st("startIndex"))}}function Us(t,e,s){const{textRuns:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{st:d,ed:f}=c;if(r<=d&&i>=f){o.push({...c,st:d-r,ed:f-r});continue}else d<=r&&f>=i?(o.push({...c,st:r-r,ed:i-r}),c.ed-=e):r>=d&&r<f?(o.push({...c,st:r-r,ed:f-r}),c.ed=r):i>d&&i<=f?(o.push({...c,st:d-r,ed:i-r}),c.st=i-e,c.ed-=e):d>=i&&(c.st-=e,c.ed-=e);a.push(c)}t.textRuns=a}return o}function Ts(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{startIndex:d}=c;if(d>=r&&d<i){o.push({...c,startIndex:d-s});continue}else d>=i&&(c.startIndex-=e);a.push(c)}t.paragraphs=a}return o}function Ms(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{startIndex:d}=c;if(d>=r&&d<=i){o.push({...c,startIndex:d-s});continue}else d>i&&(c.startIndex-=e);a.push(c)}t.sectionBreaks=a}return o}function Ps(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{startIndex:d}=c;if(d>=r&&d<=i){o.push({...c,startIndex:d-s});continue}else d>i&&(c.startIndex-=e);a.push(c)}t.customBlocks=a}return o}function Fs(t,e,s){const{tables:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{startIndex:d,endIndex:f}=c;if(r<=d&&i>=f){o.push({...c,startIndex:d-s,endIndex:f-s});continue}else if(d<=r&&f>=i){const g=Jt(d,f,r,i);c.startIndex=g[0],c.endIndex=g[1]}else i<d&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.tables=a}return o}function Hs(t,e,s){const{customRanges:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let u=0,_=n.length;u<_;u++){const c=n[u],{startIndex:d,endIndex:f}=c;if(r<=d&&i>=f){o.push({...c,startIndex:d-s,endIndex:f-s});continue}else if(d<=r&&f>=i){const g=Jt(d,f,r,i);c.startIndex=g[0],c.endIndex=g[1]}else i<d&&(c.startIndex-=e,c.endIndex-=e);a.push(c)}t.customRanges=a}return o}function Qr(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=Us(t,e,s),a=Ts(t,e,s),u=Ms(t,e,s),_=Ps(t,e,s),c=Fs(t,e,s),d=Hs(t,e,s);let f="";return n&&(t.dataStream=ms(n,r,i),f=n.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:u,customBlocks:_,tables:c,customRanges:d}}function Jr(t,e,s,n){t.dataStream=Rs(t.dataStream,n,e.dataStream),bs(t,e,s,n),oe(t,e,s,n),Xr(t,e,s,n),Ds(t,e,s,n),ae(t,e,s,n),qr(t,e,s,n)}var Ws=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Ws||{}),Bs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Bs||{}),ht=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(ht||{}),Y=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Y||{}),Gs=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(Gs||{}),$s=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))($s||{}),ks=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(ks||{}),Vs=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(Vs||{}),xs=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(xs||{}),js=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(js||{}),ps=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(ps||{}),Ys=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Ys||{}),Ks=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(Ks||{}),zs=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(zs||{}),Xs=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Xs||{}),qs=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(qs||{}),Qs=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(Qs||{}),Js=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Js||{}),Zs=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(Zs||{}),ys=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(ys||{}),tn=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(tn||{}),en=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(en||{}),sn=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(sn||{}),nn=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(nn||{}),rn=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(rn||{}),on=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(on||{}),an=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(an||{}),Mt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Mt||{});const Zr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:Y.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:Y.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:Y.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:Y.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:Y.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:Y.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:63}]}};function yr(t,e,s,n,r){const i=ti(t,e,s,n,r),o=ei(t,e,s,n,r),a=si(t,e,s,n,r),u=ni(t,e,s,n,r),_=ri(t,e,s,n,r),c=ii(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:u,tables:_,customRanges:c}}function ti(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=Us(t,s,n);if(r!==M.REPLACE){const u=un(o,a,r);e.textRuns=u}return bs(t,e,s,n),a}function un(t,e,s){if(e.length===0)return t;t=E.deepClone(t),e=E.deepClone(e);const n=[],r=t.length,i=e.length;let o=0,a=0,u=null;function _(){return u?(n.push(u),u=null,!0):!1}for(;o<r&&a<i;){const{st:g,ed:R,ts:O}=t[o],{st:w,ed:b,ts:V,sId:x}=e[a];let gt;s===M.COVER?gt={...V,...O}:gt={...O,...V},R<w?(_()||n.push(t[o]),o++):b<g?(_()||n.push(e[a]),a++):(n.push({st:Math.min(g,w),ed:Math.max(g,w),ts:g<w?{...O}:{...V},sId:g<w?void 0:x}),n.push({st:Math.max(g,w),ed:Math.min(R,b),ts:gt,sId:x}),R<b?(o++,e[a].st=R):(a++,t[o].st=b),u={st:Math.min(R,b),ed:Math.max(R,b),ts:R<b?{...V}:{...O},sId:R<b?x:void 0})}_();const c=n[n.length-1],d=t[r-1],f=e[i-1];return c.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?n.push(d):n.push(f)),ie(n)}function ei(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=Ts(t,s,n);if(r!==M.REPLACE){const u=[];for(const _ of o){const{startIndex:c,paragraphStyle:d,bullet:f}=_;let g=[];for(const R of a){const{startIndex:O,paragraphStyle:w,bullet:b}=R;let V,x;if(r===M.COVER?(V={...w,...d},x={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...b,...f}):(V={...d,...w},x={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...b}),c===O){g.push({startIndex:c,paragraphStyle:V,bullet:x});break}}u.push(...g),g=[]}e.paragraphs=u}return oe(t,e,s,n),a}function si(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=Ms(t,s,n);if(r!==M.REPLACE){const u=[];for(const _ of o){const{startIndex:c}=_;let d=[];for(const f of a){const{startIndex:g}=f;if(c===g){r===M.COVER?d.push({...f,..._}):d.push({..._,...f});break}}u.push(...d),d=[]}e.sectionBreaks=u}return oe(t,e,s,n),a}function ni(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=Ps(t,s,n);if(r!==M.REPLACE){const u=[];for(const _ of o){const{startIndex:c}=_;let d=[];for(const f of a){const{startIndex:g}=f;if(c===g){r===M.COVER?d.push({...f,..._}):d.push({..._,...f});break}}u.push(...d),d=[]}e.customBlocks=u}return Ds(t,e,s,n),a}function ri(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Fs(t,s,n);if(r!==M.REPLACE){const u=[];for(const _ of o){const{startIndex:c,endIndex:d}=_;let f=[];for(const g of a){const{startIndex:R,endIndex:O}=g;if(R>=c&&O<=d){r===M.COVER?f.push({...g,..._}):f.push({..._,...g});break}}u.push(...f),f=[]}e.tables=u}return ae(t,e,s,n),a}function ii(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Hs(t,s,n);if(r!==M.REPLACE){const u=[];for(const _ of o){const{startIndex:c,endIndex:d}=_;let f=[];for(const g of a){const{startIndex:R,endIndex:O}=g;if(R>=c&&O<=d){r===M.COVER?f.push({...g,..._}):f.push({..._,...g});break}}u.push(...f),f=[]}e.customRanges=u}return ae(t,e,s,n),a}var A=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(A||{});function ue(t,e,s){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(e,s)},a=[];for(const _ of r){const c=E.deepClone(_),{st:d,ed:f}=c;E.hasIntersectionBetweenTwoRanges(d,f,e,s)&&(e>=d&&e<=f?a.push({...c,st:e,ed:Math.min(s,f)}):s>=d&&s<=f?a.push({...c,st:Math.max(e,d),ed:s}):a.push(c))}a.length&&(o.textRuns=a.map(_=>{const{st:c,ed:d}=_;return{..._,st:c-e,ed:d-e}}));const u=[];for(const _ of i){const{startIndex:c}=_;c>=e&&c<=s&&u.push(E.deepClone(_))}return u.length&&(o.paragraphs=u.map(_=>({..._,startIndex:_.startIndex-e}))),o}function le(t,e,s=M.COVER){if(e.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:a=[]}=e,u=un(o,r,s);u.length&&(n.textRuns=u);const _=[];let c=0,d=0;for(;c<i.length&&d<a.length;){const f=i[c],g=a[d],{startIndex:R}=f,{startIndex:O}=g;R===O?(_.push(E.deepMerge(f,g)),c++,d++):R<O?(_.push(E.deepClone(f)),c++):(_.push(E.deepClone(g)),d++)}return c<i.length&&_.push(...i.slice(c)),d<a.length&&_.push(...a.slice(d)),_.length&&(n.paragraphs=_),n}function oi(t){const{body:e}=t;if(e==null)return!0;const{textRuns:s=[],paragraphs:n=[]}=e;return s.length===0&&n.length===0}const ce={id:"default_doc",documentStyle:{}};class ai{constructor(e){h(this,"snapshot");this.snapshot={...ce,...e}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){const{documentStyle:s}=this.snapshot;s.renderConfig==null?s.renderConfig=e:s.renderConfig={...s.renderConfig,...e}}updateDocumentDataMargin(e){const{t:s,l:n,b:r,r:i}=e,{documentStyle:o}=this.snapshot;s!=null&&(o.marginTop=s),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(e,s){const{documentStyle:n}=this.snapshot;if(!n.pageSize){e=e!=null?e:Number.POSITIVE_INFINITY,s=s!=null?s:Number.POSITIVE_INFINITY,n.pageSize={width:e,height:s};return}e!==void 0&&(n.pageSize.width=e),s!==void 0&&(n.pageSize.height=s)}updateDrawing(e,s){const{drawings:n}=this,{width:r,height:i,left:o,top:a}=s,u=n==null?void 0:n[e];if(!u)return;const _=u.objectTransform;_.size.width=r,_.size.height=i,_.positionH.posOffset=o,_.positionV.posOffset=a}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class nt extends ai{constructor(s){var r;super(s);h(this,"_unitId");h(this,"headerModelMap",new Map);h(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:E.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){var s;return(s=this.snapshot.rev)!=null?s:0}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(s){if(s.id&&s.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...ce,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new qe;return r.reset(),s.forEach(i=>{if(i=E.deepClone(i),i.t===A.RETAIN){const{coverType:o,body:a,len:u,segmentId:_}=i;if(a!=null){const c=this._updateApply(a,u,r.cursor,o,_);n.push({...i,t:A.RETAIN,coverType:M.REPLACE,body:c})}else n.push({...i,t:A.RETAIN});r.moveCursor(u)}else if(i.t===A.INSERT){const{body:o,len:a,segmentId:u,line:_}=i;this._insertApply(o,a,r.cursor,u),r.moveCursor(a),n.push({t:A.DELETE,len:a,line:_,segmentId:u})}else if(i.t===A.DELETE){const{len:o,segmentId:a}=i,u=this._deleteApply(o,r.cursor,a);n.push({...i,t:A.INSERT,body:u})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(s,n){const r=this.getBody();if(r!=null)return ue(r,s,n)}_updateApply(s,n,r,i=M.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,u=Ut(a,o);if(u==null)throw new Error("no body has changed");return yr(u,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Ut(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Qr(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Ut(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");Jr(a,s,n,r)}}_initializeHeaderFooterModel(){const{headers:s,footers:n}=this.getSnapshot();if(s)for(const r in s){const i=s[r];this.headerModelMap.set(r,new nt(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new nt(i))}}updateDocumentId(s){super.updateDocumentId(s),this._unitId=s}}const _t={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},ui={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},li={startRow:0,startColumn:0,endRow:0,endColumn:0},ci={row:0,column:0},ln={id:"",sheetOrder:[],name:"",appVersion:"",locale:It.ZH_CN,styles:{},sheets:{},resources:[]},cn=1e3,hn=20,_n=19,dn=73,fn=46,gn=20,Pt={type:Kt.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:cn,columnCount:hn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:dn,defaultRowHeight:_n,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:I.FALSE,showGridlines:I.TRUE,rowHeader:{width:fn,hidden:I.FALSE},columnHeader:{height:gn,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{}},Ft={ff:"Times New Roman",fs:14,it:I.FALSE,bl:I.FALSE,ul:{s:I.FALSE},st:{s:I.FALSE},ol:{s:I.FALSE},tr:{a:0,v:I.FALSE},td:ut.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:Q.UNSPECIFIED,vt:y.UNSPECIFIED,tb:tt.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},En={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Rn=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Rn||{});class mn{constructor(e={}){h(this,"_styles");h(this,"_cacheMap",new Cs(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,s){if(this._cacheMap.has(s))return this._cacheMap.get(s);const n=this._getExistingStyleId(e);return n||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,s){const n=E.generateRandomId(6);return this._styles[n]=e,this._cacheMap.set(s,n),n}setValue(e){if(e==null)return;const s=JSON.stringify(e),n=this.search(e,s);return n!=="-1"?n:this.add(e,s)}toJSON(){return this._styles}getStyleByCell(e){let s;e&&E.isObject(e.s)?s=e.s:s=(e==null?void 0:e.s)&&this.get(e.s);const n=e==null?void 0:e.interceptorStyle;return n?{...s,...n}:s}_generateCacheMap(){const{_styles:e,_cacheMap:s}=this;for(const n in e){const r=JSON.stringify(e[n]);s.set(r,n)}}_getExistingStyleId(e){const{_styles:s}=this;for(const n in s)if(E.diffValue(s[n],e))return n;return null}}function hi(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function _i(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return lt.STRING;if(typeof t.v=="number")return lt.NUMBER;if(typeof t.v=="boolean")return lt.BOOLEAN}function di(t){if(t==null)return!0;const{v:e,f:s,si:n,p:r,s:i}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||s!=null&&s.length>0||n!=null&&n.length>0||r!=null)}function fi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var he=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(he||{}),On=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(On||{}),In=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(In||{});class gi{constructor(e,s){h(this,"_columnData",{});this._config=e,this._columnData=s}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:s}=this,n=s[e];return n?n.hd!==I.TRUE:!0}getHiddenCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getColVisible(o);r&&a?(r=!1,n.push({rangeType:F.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:s,rangeType:F.COLUMN}),n}getVisibleCols(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getColVisible(o);r&&!a?(r=!1,n.push({rangeType:F.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:s,rangeType:F.COLUMN}),n}getColumnDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return $(this._columnData)}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=(s[e]||{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(e){const s=this._columnData[e];if(s)return s}getColumnOrCreate(e){const{_columnData:s}=this,n=this._config,r=s[e];if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData[e]=i,i}}function Ht(t,e){for(const s of e){const{ts:n={}}=s;if(n[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(n[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(n[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}}return I.TRUE}class rt{constructor(e,s,n){h(this,"_range");h(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let a=n;a<=i;a++)for(let u=r;u<=o;u++)s(a,u)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;o++){const a=[];for(let u=n;u<=r;u++)a.push(this.getMatrix().getValue(o,u)||null);i.push(a)}return i}getMatrix(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new k;for(let a=e;a<=s;a++)for(let u=n;u<=r;u++)o.setValue(a,u,i.getValue(a,u)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new k;for(let a=e;a<=s;a++)for(let u=n;u<=r;u++)o.setValue(a-e,u-n,i.getValue(a,u)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=E.numToWord(n+1)+(e+1),o=E.numToWord(r+1)+(s+1)):(i=E.numToWord(r+1)+(s+1),o=E.numToWord(n+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Ft.bg.rgb}))}getCell(e,s){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+e,endRow:n+e,startColumn:i+s,endColumn:i+s};return new rt(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const u=this._deps.getStyles();for(let _=0;_<=n-s;_++)for(let c=0;c<=i-r;c++){if(o==null||((a=o==null?void 0:o[_])==null?void 0:a[c])==null)continue;const d=o[_][c].s;d&&(o[_][c].s=u.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Ft.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n,r;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Ht("ul",(r=e.body)==null?void 0:r.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var s,n,r;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Ht("st",(r=e.body)==null?void 0:r.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var s,n,r;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Ht("it",(r=e.body)==null?void 0:r.textRuns)===I.TRUE?At.ITALIC:At.NORMAL:this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n,r;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?Ht("bl",(r=e.body)==null?void 0:r.textRuns)===I.TRUE?Ct.BOLD:Ct.NORMAL:this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const a=s.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){rt.foreach(this._range,e)}_getStyles(e){const s=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=s&&s.getStyleByCell(r);return i&&i[e]||Ft[e]}))}}class Ei{constructor(e,s){h(this,"_rowData");this._config=e,this._rowData=s}getRowData(){return this._rowData}getRowDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(e,s=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<s;o++){const a=n[o+e]||{hd:I.FALSE,h:r.defaultRowHeight},{ia:u,ah:_,h:c=r.defaultRowHeight}=a;i+=(u==null||u===I.TRUE)&&typeof _=="number"?_:c}return i}getRow(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:s}=this,n=s[e];if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return s[e]=i,i}getHiddenRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getRowVisible(o);r&&a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:F.ROW})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:F.ROW}),n}getVisibleRows(e=0,s=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getRowVisible(o);r&&!a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:F.ROW})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:F.ROW}),n}getRowVisible(e){const s=this.getRow(e);return s?s.hd!==I.TRUE:!0}getSize(){return $(this._rowData)}}class An extends T{constructor(){super(...arguments);h(this,"_cellContentInterceptors",[]);h(this,"_rowFilteredInterceptors",[]);h(this,"_rowVisibleInterceptors",[]);h(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(s,n){for(const r of this._cellContentInterceptors){const i=r.getCell(s,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(s){if(this._cellContentInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(s),L(()=>j(this._cellContentInterceptors,s))}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(s),L(()=>j(this._rowFilteredInterceptors,s))}registerRowVisibleInterceptor(s){if(this._rowVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(s),L(()=>j(this._rowVisibleInterceptors,s))}registerColVisibleInterceptor(s){if(this._colVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(s),L(()=>j(this._colVisibleInterceptors,s))}}class dt{constructor(e,s){h(this,"_initialized");h(this,"_sheetId");h(this,"_snapshot");h(this,"_cellData");h(this,"_rowManager");h(this,"_columnManager");h(this,"_viewModel");var a;this._styles=s;const n={...Pt,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},rowHeader:{width:46,hidden:I.FALSE},columnHeader:{height:20,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{},...e};this._snapshot=n;const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:E.generateRandomId(6),this._initialized=!1,this._cellData=new k(o),this._rowManager=new Ei(this._snapshot,i),this._columnManager=new gi(this._snapshot,r),this._viewModel=new An}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,s=E.deepClone(e);return new dt(s,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCells(e,s){const n=this._snapshot.mergeData,r=[];for(let i=0;i<n.length;i++){const o=n[i];et.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},o)&&r.push(o)}return r.length?r:null}getMergedCell(e,s){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(et.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},i))return i}return null}getCell(e,s){return e<0||s<0?null:this._viewModel.getCell(e,s)}getCellRaw(e,s){return this.getCellMatrix().getValue(e,s)}getMatrixWithMergedCells(e,s,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(u=>et.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},u)),a=new k;return ne(e,n,s,r).forEach((u,_)=>{const c=i.getValue(u,_);c&&a.setValue(u,_,c)}),o.forEach(u=>{const{startColumn:_,startRow:c,endColumn:d,endRow:f}=u;ne(c,f,_,d).forEach((g,R)=>{g===c&&R===_&&a.setValue(g,R,{...i.getValue(g,R),rowSpan:f-c+1,colSpan:d-_+1}),(g!==c||R!==_)&&a.realDeleteValue(g,R)})}),a}getRange(e,s,n,r){return typeof e=="object"?new rt(this,e,{getStyles:()=>this._styles}):new rt(this,{startRow:e,startColumn:s,endColumn:r||s,endRow:n||e},{getStyles:()=>this._styles})}getStatus(){const{_snapshot:e}=this;return e.status}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:s}=e;return s}getMaxRows(){const{_snapshot:e}=this,{rowCount:s}=e;return s}getType(){const{_snapshot:e}=this,{type:s}=e;return s}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:s}=e;return s===0}getTabColor(){const{_snapshot:e}=this,{tabColor:s}=e;return s}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this.getRowManager().getRowHeight(e)}getRowVisible(e){return this.getRowManager().getRowVisible(e)}getHiddenRows(e,s){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,s);return r.forEach(i=>i.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,s){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,s);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){const e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:s}=e;return s}getPluginMeta(e){return this._snapshot.pluginMeta[e]}setPluginMeta(e,s){this._snapshot.pluginMeta[e]=s}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}}var Ri=Object.defineProperty,mi=Object.getOwnPropertyDescriptor,Oi=(t,e,s,n)=>{for(var r=n>1?void 0:n?mi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ri(e,s,r),r},Ii=(t,e)=>(s,n)=>e(s,n,t);function Ai(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}l.Workbook=class extends T{constructor(s={},n){super();h(this,"_sheetCreated$",new C.Subject);h(this,"sheetCreated$",this._sheetCreated$.asObservable());h(this,"_sheetDisposed$",new C.Subject);h(this,"sheetDisposed$",this._sheetDisposed$.asObservable());h(this,"_activeSheet$",new C.BehaviorSubject(null));h(this,"activeSheet$",this._activeSheet$.asObservable());h(this,"_worksheets");h(this,"_styles");h(this,"_snapshot");h(this,"_unitId");h(this,"_count");this._log=n,this._snapshot=E.commonExtend(ln,s);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=E.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new mn(r),this._count=1,this._worksheets=new Map,this._getDefaultWorkSheet()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return E.deepClone(this._snapshot)}static isIRangeType(s){return typeof s=="string"||"startRow"in s||"row"in s}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var s;return(s=this._snapshot.rev)!=null?s:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(s,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[s])return!1;i[s]=r,o.splice(n,0,s);const a=new dt(r,this._styles);return this._worksheets.set(s,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===s)}getRawActiveSheet(){const{sheetOrder:s}=this._snapshot;return s.find(r=>this._worksheets.get(r).getStatus()===I.TRUE)}getActiveSheet(){const{sheetOrder:s}=this._snapshot,n=this.getRawActiveSheet();return n?this._worksheets.get(n):this._worksheets.get(s[0])}__setActiveSheet(s){this._activeSheet$.next(s)}getActiveSheetIndex(){const{sheetOrder:s}=this._snapshot;return s.findIndex(n=>this._worksheets.get(n).getStatus()===1)}getSheetSize(){return this._snapshot.sheetOrder.length}flush(){}getSheets(){const{sheetOrder:s}=this._snapshot;return s.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:s}=this._snapshot,n=[];return s.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>s.getSheetId()===r)}getSheetBySheetName(s){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===s);return this._worksheets.get(r)}getSheetBySheetId(s){return this._worksheets.get(s)}getSheetByIndex(s){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[s])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===I.TRUE).map(s=>s.getConfig().id)}transformRangeType(s){if(typeof s=="string")return this._getCellRange(s);if(typeof s!="string"&&"row"in s){const n=s;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof s!="string"&&"startRow"in s?{sheetId:"",range:s}:_t}load(s){this._snapshot=s}checkSheetName(s){return this.getSheetsName().includes(s)}uniqueSheetName(s="Sheet1"){let n=s;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}generateNewSheetName(s){let n=s+this._count;for(;this.checkSheetName(n);)n=s+this._count,this._count++;return n}_getCellRange(s){var c,d,f,g,R;let n="",r="";if(s.indexOf("!")>-1){const O=s.split("!");n=O[0],r=O[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=s;if(r.indexOf(":")===-1){const O=parseInt(r.replace(/[^0-9]/g,""),10)-1,w=E.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(O)&&!Number.isNaN(w)?{sheetId:n,range:{startRow:O,endRow:O,startColumn:w,endColumn:w}}:_t}r=r.split(":");const i=[0,0],o=[0,0],a=((c=this.getSheetBySheetName(n))==null?void 0:c.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),u=((f=this.getSheetBySheetName(n))==null?void 0:f.getMaxColumns())||((g=this.getActiveSheet())==null?void 0:g.getMaxColumns());return i[0]=parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=a),i[0]>i[1]||(o[0]=E.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=E.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=u),o[0]>o[1])?_t:{sheetId:((R=this.getSheetBySheetName(n))==null?void 0:R.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_getDefaultWorkSheet(){const{_snapshot:s,_worksheets:n}=this,{sheets:r,sheetOrder:i}=s;E.isEmptyObject(r)&&(r[Pt.id]=Object.assign(Pt,{status:I.TRUE}));for(const o in r){const a=r[o],{name:u}=a;a.name=this.uniqueSheetName(u),a.name!==u&&this._log.warn(`The worksheet name ${u} is duplicated, we change it to ${a.name}`);const _=new dt(a,this._styles);n.set(o,_),i.includes(o)||i.push(o)}}},l.Workbook=Oi([Ii(1,q)],l.Workbook);class _e{constructor(e){h(this,"_snapshot");h(this,"_unitId");var s;this._snapshot={...En,...e},this._unitId=(s=this._snapshot.id)!=null?s:E.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){const s=this.getPages();return s==null?void 0:s[e]}getElementsByPage(e){var s;return(s=this.getPage(e))==null?void 0:s.pageElements}getElement(e,s){var n;return(n=this.getElementsByPage(e))==null?void 0:n[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:he.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Wt="FOCUSING_SHEET",de="FOCUSING_DOC",fe="FOCUSING_SLIDE",Ci="FOCUSING_EDITOR_BUT_HIDDEN",Cn="EDITOR_ACTIVATED",Ni="FOCUSING_EDITOR_INPUT_FORMULA",Nn="FOCUSING_FORMULA_EDITOR",Si="FOCUSING_UNIVER_EDITOR";var Li=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,wi=(t,e,s,n)=>{for(var r=n>1?void 0:n?vi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Li(e,s,r),r},bi=(t,e)=>(s,n)=>e(s,n,t),Sn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(Sn||{});const it=m.createIdentifier("univer.current");let ge=class extends T{constructor(e,s){super();h(this,"_focused",null);h(this,"_focused$",new C.BehaviorSubject(null));h(this,"focused$",this._focused$.asObservable());h(this,"_currentSheet$",new C.BehaviorSubject(null));h(this,"currentSheet$",this._currentSheet$.asObservable());h(this,"_currentDoc$",new C.BehaviorSubject(null));h(this,"currentDoc$",this._currentDoc$.asObservable());h(this,"_currentSlide$",new C.BehaviorSubject(null));h(this,"currentSlide$",this._currentSlide$.asObservable());h(this,"_sheetAdded$",new C.Subject);h(this,"sheetAdded$",this._sheetAdded$.asObservable());h(this,"_docAdded$",new C.Subject);h(this,"docAdded$",this._docAdded$.asObservable());h(this,"_slideAdded$",new C.Subject);h(this,"slideAdded$",this._slideAdded$.asObservable());h(this,"_sheetDisposed$",new C.Subject);h(this,"sheetDisposed$",this._sheetDisposed$.asObservable());h(this,"_docDisposed$",new C.Subject);h(this,"docDisposed$",this._docDisposed$.asObservable());h(this,"_slideDisposed$",new C.Subject);h(this,"slideDisposed$",this._slideDisposed$.asObservable());h(this,"_sheets",[]);h(this,"_docs",[]);h(this,"_slides",[]);this._handler=e,this._contextService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,s){const n=this._docs.find(r=>r.getUnitId()===e);if(n!=null){const r=this._docs.indexOf(n);this._docs.splice(r,1)}this.addDoc(s)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(s=>s.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(s=>s.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(s=>s.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[de,Wt,fe].forEach(s=>this._contextService.setContextValue(s,!1)),this._focused instanceof l.Workbook?this._contextService.setContextValue(Wt,!0):this._focused instanceof nt?this._contextService.setContextValue(de,!0):this._focused instanceof _e&&this._contextService.setContextValue(fe,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitId ${e}`)}disposeDocument(e){const s=this.getUniverDocInstance(e);if(s){const i=this._docs.indexOf(s);return this._docs.splice(i,1),this._docDisposed$.next(s),this.focusUniverInstance(null),!0}const n=this.getUniverSheetInstance(e);if(n){const i=this._sheets.indexOf(n);return this._sheets.splice(i,1),this._sheetDisposed$.next(n),this.focusUniverInstance(null),!0}const r=this.getUniverSlideInstance(e);if(r){const i=this._slides.indexOf(r);return this._slides.splice(i,1),this._slideDisposed$.next(r),this.focusUniverInstance(null),!0}return!1}};ge=wi([bi(1,Z)],ge);var v=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(v||{});const Di={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Bt=new Map;function Ee(t,e){return function(r){Re(t,e)}}function Re(t,e){Bt.has(t)||Bt.set(t,[]),Bt.get(t).push(e)}var Ui=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Ln=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ti(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ui(e,s,r),r},me=(t,e)=>(s,n)=>e(s,n,t);l.LifecycleService=class extends T{constructor(s){super();h(this,"_lifecycle$",new C.BehaviorSubject(v.Starting));h(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=s,this._reportProgress(v.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(s){if(s<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");s!==this.stage&&(this._reportProgress(s),this._lifecycle$.next(s))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new C.Observable(s=>(this.stage===v.Starting||(this.stage===v.Ready?s.next(v.Starting):this.stage===v.Rendered?(s.next(v.Starting),s.next(v.Ready)):(s.next(v.Starting),s.next(v.Ready),s.next(v.Rendered))),this._lifecycle$.subscribe(s)))}_reportProgress(s){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Di[s]}".`)}},l.LifecycleService=Ln([me(0,q)],l.LifecycleService);let K=class extends T{constructor(e,s){super();h(this,"_started",!1);this._lifecycleService=e,this._injector=s}start(){this._started||(this._started=!0,this.disposeWithMe(L(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const s=Bt.get(e);s==null||s.forEach(n=>{this._injector.has(n)&&this._injector.get(n)})}};K=Ln([me(0,m.Inject(l.LifecycleService)),me(1,m.Inject(m.Injector))],K);function Mi(t,e){if(t)try{return t[e]?t[e]:e.split(".").reduce((s,n)=>s[n],t)}catch{return console.warn("Key %s not found",e),e}}class ft extends T{constructor(){super();h(this,"_currentLocale",It.ZH_CN);h(this,"_locales",null);h(this,"localeChanged$",new C.Subject);h(this,"t",s=>{var n;if(!this._locales)throw new Error("Locale not initialized");return(n=Mi(this._locales[this._currentLocale],s))!=null?n:s});this.disposeWithMe(L(()=>this.localeChanged$.complete()))}load(s){var n;this._locales=E.deepMerge((n=this._locales)!=null?n:{},s)}setLocale(s){this._currentLocale=s,this.localeChanged$.next()}getLocales(){var s;return(s=this._locales)==null?void 0:s[this._currentLocale]}getCurrentLocale(){return this._currentLocale}}const Oe=m.createIdentifier("resource-manager-service"),vn=m.createIdentifier("ResourcePersistenceService");Re(v.Ready,vn);var Pi=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,Hi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Fi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Pi(e,s,r),r},wn=(t,e)=>(s,n)=>e(s,n,t);const Ie=m.createIdentifier("univer.permission-service"),bn="PERMISSION";l.PermissionService=class extends T{constructor(s,n){super();h(this,"_permissionPointMap",new Map);h(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});h(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new C.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});h(this,"updatePermissionPoint",(s,n,r)=>{const i=this._permissionPointMap.get(s);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=se.DONE,o.next(a)}});h(this,"getPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=s,this._univerInstanceService=n}_init(){this.disposeWithMe(L(this._univerInstanceService.sheetAdded$.subscribe(s=>{this._resourceManagerService.registerPluginResource(s.getUnitId(),bn,{onChange:(n,r)=>{r.forEach(i=>{this.getPermissionPoint(n,i.id)?this.updatePermissionPoint(n,i.id,i.value):this.addPermissionPoint(n,i)})},toJson:n=>this._toJson(n),parseJson:n=>this._parseJson(n)})}))),this.disposeWithMe(L(this._univerInstanceService.sheetDisposed$.subscribe(s=>{this._resourceManagerService.disposePluginResource(s.getUnitId(),bn)})))}_toJson(s){const n=this._permissionPointMap.get(s);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return C.combineLatest(i).pipe($n.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);return n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}},l.PermissionService=Hi([Ee(v.Starting,l.PermissionService),wn(0,m.Inject(Oe)),wn(1,m.Inject(it))],l.PermissionService);const Dn="univer.editable";class Gt extends Ns{constructor(s){super();h(this,"id",Dn);h(this,"value",!0);h(this,"unitID");this.unitID=s}}var Wi=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Gi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Bi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Wi(e,s,r),r},Un=(t,e)=>(s,n)=>e(s,n,t);l.UniverPermissionService=class extends T{constructor(e,s){super(),this._permissionService=e,this._univerInstanceService=s,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(e=>{const s=new Gt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e){let s=e;s||(s=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Gt(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new Gt(e);this._permissionService.updatePermissionPoint(e,n.id,s)}},l.UniverPermissionService=Gi([Ee(v.Starting,l.UniverPermissionService),Un(0,m.Inject(Ie)),Un(1,m.Inject(it))],l.UniverPermissionService);class Tn extends T{constructor(){super(...arguments);h(this,"_resourceMap",new Map);h(this,"_register$",new C.Subject);h(this,"register$",this._register$.asObservable())}getAllResource(s){const n=this._resourceMap.get(s);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:s,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(s,n,r){const i=this._resourceMap.get(s)||new Map;if(i.has(n))throw new Error("the pluginName is registered");return i.set(n,r),this._resourceMap.set(s,i),this._register$.next({unitID:s,resourceName:n,hook:r}),L(()=>i.delete(n))}disposePluginResource(s,n){const r=this._resourceMap.get(s);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Ae extends T{constructor(){super();h(this,"_currentTheme");h(this,"_currentTheme$",new C.BehaviorSubject({}));h(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(L(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Mn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Pn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",$i=`\r
5
+ `;var ki=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,xi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Vi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ki(e,s,r),r},Ce=(t,e)=>(s,n)=>e(s,n,t);const $t=m.createIdentifier("univer.undo-redo.service"),ji=20;l.LocalUndoRedoService=class extends T{constructor(s,n,r){super();h(this,"undoRedoStatus$");h(this,"_undoRedoStatus$",new C.BehaviorSubject({undos:0,redos:0}));h(this,"_undoStacks",new Map);h(this,"_redoStacks",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Hn)),this.disposeWithMe(this._commandService.registerCommand(Wn)),this.disposeWithMe(L(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(L(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);r.length=0,i.push(s),i.length>ji&&i.splice(0,1),this._updateStatus()}clearUndoRedo(s){const n=this._getRedoStack(s);n&&(n.length=0);const r=this._getUndoStack(s);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const s=this._getUndoStackForFocused();return s.length?s[s.length-1]:null}pitchTopRedoElement(){const s=this._getRedoStackForFocused();return s.length?s[s.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}_updateStatus(){var i,o;const s=this._getFocusedUniverInstanceId(),n=s&&((i=this._undoStacks.get(s))==null?void 0:i.length)||0,r=s&&((o=this._redoStacks.get(s))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(s,n=!1){let r=this._undoStacks.get(s);return!r&&n&&(r=[],this._undoStacks.set(s,r)),r||null}_getRedoStack(s,n=!1){let r=this._redoStacks.get(s);return!r&&n&&(r=[],this._redoStacks.set(s,r)),r||null}_getUndoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getUndoStack(s,!0)}_getRedoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getRedoStack(s,!0)}_getFocusedUniverInstanceId(){var o,a,u,_;let s="";const n=this._contextService.getContextValue(Wt),r=this._contextService.getContextValue(Nn),i=this._contextService.getContextValue(Cn);return n?r?s=Pn:i?s=Mn:s=(a=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?a:"":s=(_=(u=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:u.getUnitId())!=null?_:"",s}},l.LocalUndoRedoService=xi([Ce(0,it),Ce(1,at),Ce(2,Z)],l.LocalUndoRedoService);class Fn{dispose(){}async dispatchToHandlers(){return!1}}const Hn=new class extends Fn{constructor(){super(...arguments);h(this,"type",Ot.COMMAND);h(this,"id","univer.command.undo")}async handler(e){const s=e.get($t),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(at);return(n.undo?await n.undo(n.undoMutations):Yt(n.undoMutations,r))?(s.popUndoToRedo(),!0):!1}},Wn=new class extends Fn{constructor(){super(...arguments);h(this,"type",Ot.COMMAND);h(this,"id","univer.command.redo")}async handler(e){const s=e.get($t),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(at);return(n.redo?await n.redo(n.redoMutations):Yt(n.redoMutations,r))?(s.popRedoToUndo(),!0):!1}};class kt extends T{constructor(){super(...arguments);h(this,"_started",!1)}addPlugins(s){if(this._started){const n=s.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,v.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n,!0))}else{const n=s.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(s,n=!1){this.disposeWithMe(L(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===v.Starting||this._pluginsRunLifecycle(s,r)})))}_pluginsRunLifecycle(s,n){s.forEach(r=>{switch(n){case v.Starting:r.onStarting(this._injector);break;case v.Ready:r.onReady();break;case v.Rendered:r.onRendered();break;case v.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(s,n){return this._injector.createInstance(s,n)}}var pi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,Ki=(t,e,s,n)=>{for(var r=n>1?void 0:n?Yi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&pi(e,s,r),r},Ne=(t,e)=>(s,n)=>e(s,n,t);l.UniverDoc=class extends kt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createDoc(e){return this._injector.createInstance(nt,e)}},l.UniverDoc=Ki([Ne(0,m.Inject(m.Injector)),Ne(1,m.Inject(l.LifecycleService)),Ne(2,m.Inject(K))],l.UniverDoc);var zi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,qi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Xi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&zi(e,s,r),r},Se=(t,e)=>(s,n)=>e(s,n,t);l.UniverSheet=class extends kt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSheet(e){return this._injector.createInstance(l.Workbook,e)}},l.UniverSheet=qi([Se(0,m.Inject(m.Injector)),Se(1,m.Inject(l.LifecycleService)),Se(2,m.Inject(K))],l.UniverSheet);var Qi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Zi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ji(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Qi(e,s,r),r},Le=(t,e)=>(s,n)=>e(s,n,t);l.UniverSlide=class extends kt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSlide(e){return this._injector.createInstance(_e,e)}},l.UniverSlide=Zi([Le(0,m.Inject(m.Injector)),Le(1,m.Inject(l.LifecycleService)),Le(2,m.Inject(K))],l.UniverSlide);const yi=200;class to extends kt{constructor(s={}){super();h(this,"_injector");h(this,"_univerPluginStore",new xn);h(this,"_univerPluginRegistry",new jn);h(this,"_univerSheet",null);h(this,"_univerDoc",null);h(this,"_univerSlide",null);h(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=s;n&&this._injector.get(Ae).setTheme(n),i&&this._injector.get(ft).load(i),r&&this._injector.get(ft).setLocale(r),o&&this._injector.get(q).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(it)}get _lifecycleService(){return this._injector.get(l.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(K)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(s){this._injector.get(ft).setLocale(s)}createUniverSheet(s){let n;const r=()=>{n=this._univerSheet.createSheet(s),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(l.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(D.Sheet).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(s){let n;const r=()=>{n=this._univerDoc.createDoc(s),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(l.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(D.Doc).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(s){let n;const r=()=>{n=this._univerSlide.createSlide(s),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(l.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(D.Slide).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new m.Injector([[it,{useFactory:s=>new ge({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},s),deps:[Z]}],[Ke],[ft],[Ae],[l.LifecycleService],[K],[Ie,{useClass:l.PermissionService}],[l.UniverPermissionService],[q,{useClass:xe,lazy:!0}],[at,{useClass:l.CommandService,lazy:!0}],[$t,{useClass:l.LocalUndoRedoService,lazy:!0}],[Ye,{useClass:er}],[Z,{useClass:ke}],[Xe,{useClass:ze,lazy:!0}],[Oe,{useClass:Tn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(K).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(l.LifecycleService).stage<v.Ready&&(this._injector.get(l.LifecycleService).stage=v.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(s,n){if(s.type===D.Univer)this._registerUniverPlugin(s,n);else if(s.type===D.Sheet)this._registerSheetsPlugin(s,n);else if(s.type===D.Doc)this._registerDocsPlugin(s,n);else if(s.type===D.Slide)this._registerSlidesPlugin(s,n);else throw new Error(`Unimplemented plugin system for business: "${s.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),yi))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const s=this._univerPluginRegistry.getRegisterPlugins(D.Univer);if(s.length){this._univerPluginRegistry.clearPluginsOfType(D.Univer);const n=s.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(D.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(D.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(D.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Slide))}}_registerUniverPlugin(s,n){if(this._started)this._univerPluginRegistry.registerPlugin(s,n);else{const r=this._injector.createInstance(s,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}_registerDocsPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}_registerSlidesPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}}function eo(t,e=16){let s=0,n=null;return function(...i){const o=Date.now();o-s<e?(n&&clearTimeout(n),n=setTimeout(()=>{s=o,t.apply(this,i)},e)):(s=o,t.apply(this,i))}}function so(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}class ve{constructor(e){h(this,"_index",0);h(this,"_offset",0);this._actions=e}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(e){e||(e=Number.POSITIVE_INFINITY);const s=this._actions[this._index];if(s){const n=this._offset,r=s.len;return e>=r-n?(e=r-n,this._index+=1,this._offset=0):this._offset+=e,s.t===A.DELETE||s.t===A.RETAIN&&s.body==null?E.deepClone({...s,len:e}):E.deepClone({...s,len:e,body:ue(s.body,n,n+e)})}else return{t:A.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const e=this._actions[this._index];return e?e.t:A.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const e=this._offset,s=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=e,this._index=s,[n].concat(r)}}else return[]}}function Bn(t){return Object.keys(t).length===1}class we{constructor(){h(this,"_actions",[])}static compose(e,s){const n=new ve(e),r=new ve(s),i=new we;for(;n.hasNext()||r.hasNext();)if(r.peekType()===A.INSERT)i.push(r.next());else if(n.peekType()===A.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),a=n.next(o),u=r.next(o);a.t===A.INSERT&&u.t===A.RETAIN?u.body==null?i.push(a):i.push({...a,body:le(a.body,u.body,u.coverType)}):a.t===A.RETAIN&&u.t===A.RETAIN?a.body==null&&u.body==null?i.push(a.len!==Number.POSITIVE_INFINITY?a:u):a.body&&u.body?i.push({...a,body:le(a.body,u.body,u.coverType)}):i.push(a.body?a:u):a.t===A.RETAIN&&u.t===A.DELETE?i.push(u):a.t===A.INSERT&&(u.t,A.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(e,s,n){const r={t:A.INSERT,body:s,len:e,line:0,segmentId:n};return this.push(r),this}retain(e,s,n,r){const i={t:A.RETAIN,len:e,segmentId:s};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(e,s){const n={t:A.DELETE,len:e,line:0,segmentId:s};return this.push(n),this}serialize(){return this._actions}push(...e){if(e.length>1){for(const i of e)this.push(i);return this}let s=this._actions.length,n=this._actions[s-1];const r=E.deepClone(e[0]);if(r.t===A.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===A.DELETE&&r.t===A.DELETE)return n.len+=r.len,this;if(n.t===A.DELETE&&r.t===A.INSERT&&(s-=1,n=this._actions[s-1],n==null))return this._actions.unshift(r),this;if(n.t===A.RETAIN&&r.t===A.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===A.INSERT&&Bn(n.body)&&r.t===A.INSERT&&Bn(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return s===this._actions.length?this._actions.push(r):this._actions.splice(s,0,r),this}trimEndUselessRetainAction(){let e=this._actions[this._actions.length-1];for(;e&&e.t===A.RETAIN&&oi(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}}class no extends mt{add(e){if(!e)return null;const s=new Rt(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const ro=m.createIdentifier("ILocalStorageService"),io=t=>`sheet_interceptor_${t}`,Gn=t=>function(e,s){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,s,r.bind(null,i+1))}return r(0,e)};class oo{constructor(e){h(this,"_interceptorsByName",new Map);h(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return Gn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,u;return((a=o.priority)!=null?a:0)-((u=i.priority)!=null?u:0)})),()=>j(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}kn(),l.ABCToNumber=xr,l.AbsoluteRefType=Ss,l.ActionIterator=ve,l.AlignTypeH=nn,l.AlignTypeV=rn,l.AutoFillSeries=Ze,l.BaselineOffset=Nt,l.BlockType=$s,l.BooleanNumber=I,l.BorderStyleTypes=S,l.BorderType=ye,l.BulletAlignment=Y,l.COLORS=zt,l.CellValueType=lt,l.Color=J,l.ColorBuilder=Lt,l.ColorKit=B,l.ColorType=H,l.ColumnSeparatorType=xs,l.CommandType=Ot,l.CommonHideTypes=ts,l.ConditionType=es,l.ContentAlignment=Zs,l.ContextService=ke,l.CopyPasteType=ss,l.CustomRangeType=Gs,l.DEFAULT_CELL=ci,l.DEFAULT_DOC=ce,l.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=sr,l.DEFAULT_EMPTY_DOCUMENT_VALUE=$i,l.DEFAULT_RANGE=ui,l.DEFAULT_RANGE_ARRAY=_t,l.DEFAULT_SELECTION=li,l.DEFAULT_SLIDE=En,l.DEFAULT_STYLES=Ft,l.DEFAULT_WORKBOOK=ln,l.DEFAULT_WORKSHEET=Pt,l.DEFAULT_WORKSHEET_COLUMN_COUNT=hn,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=gn,l.DEFAULT_WORKSHEET_COLUMN_WIDTH=dn,l.DEFAULT_WORKSHEET_ROW_COUNT=cn,l.DEFAULT_WORKSHEET_ROW_HEIGHT=_n,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=fn,l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Pn,l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Mn,l.DashStyleType=qs,l.DataStreamTreeNodeType=ws,l.DataStreamTreeTokenType=re,l.DesktopLogService=xe,l.DeveloperMetadataVisibility=ns,l.Dimension=rs,l.Direction=is,l.Disposable=T,l.DisposableCollection=pt,l.DocStyleType=Ws,l.DocumentDataModel=nt,l.EDITOR_ACTIVATED=Cn,l.EXTENSION_NAMES=Rn,l.Entry=Zt,l.EntryIterator=As,l.ErrorService=Ke,l.EventState=Ge,l.FOCUSING_DOC=de,l.FOCUSING_EDITOR_BUT_HIDDEN=Ci,l.FOCUSING_EDITOR_INPUT_FORMULA=Ni,l.FOCUSING_FORMULA_EDITOR=Nn,l.FOCUSING_SHEET=Wt,l.FOCUSING_SLIDE=fe,l.FOCUSING_UNIVER_EDITOR=Si,l.FloatingObjectManagerService=ze,l.FollowNumberWithType=Bs,l.FontItalic=At,l.FontStyleType=ys,l.FontWeight=Ct,l.FormatType=os,l.GlyphType=ht,l.GridType=ks,l.HLSColor=ds,l.HorizontalAlign=Q,l.ICommandService=at,l.IConfigService=Ye,l.IContextService=Z,l.IFloatingObjectManagerService=Xe,l.ILocalStorageService=ro,l.ILogService=q,l.IPermissionService=Ie,l.IResourceManagerService=Oe,l.ISnapshotPersistenceService=vn,l.IUndoRedoService=$t,l.IUniverInstanceService=it,l.InterceptorManager=oo,l.InterpolationPointType=as,l.KeyIterator=Os,l.LRUHelper=ct,l.LRUMap=Cs,l.LifecycleStages=v,l.LocaleService=ft,l.LocaleType=It,l.LogLevel=Ve,l.MemoryCursor=qe,l.NamedStyleType=zs,l.NilCommand=pe,l.NumberUnitType=sn,l.ObjectMatrix=k,l.ObjectRelativeFromH=tn,l.ObjectRelativeFromV=en,l.Observable=mt,l.ObservableHooks=no,l.Observer=Rt,l.OnLifecycle=Ee,l.PRESET_LIST_TYPE=Zr,l.PageElementType=On,l.PageOrientType=an,l.PageType=he,l.ParagraphElementType=ps,l.PermissionPoint=Ns,l.PermissionStatus=se,l.Plugin=be,l.PluginType=D,l.PositionedObjectLayoutType=Ks,l.PresetListType=Mt,l.ProtectionType=us,l.RANGE_TYPE=F,l.RGBA_PAREN=ar,l.RGB_PAREN=or,l.Range=rt,l.Rectangle=et,l.RedoCommand=Wn,l.RefAlias=Vr,l.Registry=Vt,l.RegistryAsMap=xt,l.RelativeDate=ls,l.RelativeSlideLink=In,l.ResourceManagerService=Tn,l.RgbColor=vt,l.RxDisposable=Xn,l.SectionType=Vs,l.ShapeType=cs,l.SheetTypes=Kt,l.SheetViewModel=An,l.Slide=_e,l.SpacingRule=Xs,l.Styles=mn,l.THEME_COLORS=_s,l.TabStopAlignment=Qs,l.TextDecoration=hs,l.TextDirection=ut,l.TextDirectionType=js,l.TextX=we,l.TextXActionType=A,l.ThemeColor=wt,l.ThemeColorType=P,l.ThemeColors=St,l.ThemeService=Ae,l.Tools=E,l.UndoCommand=Hn,l.Univer=to,l.UniverEditablePermission=Gt,l.UniverEditablePermissionPoint=Dn,l.UniverInstanceType=Sn,l.UpdateDocsAttributeType=M,l.ValueIterator=Is,l.VerticalAlign=y,l.WidthType=Js,l.Worksheet=dt,l.WrapStrategy=tt,l.WrapTextType=Ys,l.binarySearchArray=Qe,l.characterSpacingControlType=on,l.checkParagraphHasBullet=Tr,l.checkParagraphHasIndent=Mr,l.checkParagraphHasIndentByStyle=Es,l.codeToBlob=rr,l.composeBody=le,l.composeInterceptors=Gn,l.concatMatrixArray=Hr,l.createInterceptorKey=io,l.createRowColIter=ne,l.dedupe=pn,l.deepCompare=Qt,l.deleteContent=ms,l.fromObservable=zn,l.getArrayLength=$,l.getBodySlice=ue,l.getBorderStyleType=Dr,l.getCellValueType=_i,l.getColorStyle=G,l.getDocsUpdateBody=Ut,l.getReverseDirection=ir,l.getTypeFromPermissionItemList=$r,l.getWorksheetUID=Ai,l.handleJsonToDom=wr,l.handleStyleToString=br,l.hashAlgorithm=Fr,l.horizontalLineSegmentsSubtraction=Jt,l.insertMatrixArray=yt,l.insertTextToContent=Rs,l.isCellV=fi,l.isEmptyCell=Sr,l.isFormulaId=vr,l.isFormulaString=Lr,l.isICellData=hi,l.isNullCell=di,l.isObserver=$e,l.isRealNum=Pr,l.isSameStyleTextRun=gs,l.isValidRange=Ur,l.makeCellRangeToRangeData=Nr,l.makeCellToSelection=Cr,l.moveMatrixArray=ee,l.normalizeTextRuns=ie,l.numberToABC=pr,l.numberToListABC=Yr,l.orderSearchArray=Je,l.remove=j,l.repeatStringNumTimes=vs,l.requestImmediateMacroTask=so,l.runOnLifecycle=Re,l.searchArray=nr,l.selectionToArray=kr,l.sequence=Ue,l.sequenceAsync=De,l.sequenceExecute=Yt,l.sequenceExecuteAsync=tr,l.sliceMatrixArray=Wr,l.sortRules=Kr,l.sortRulesByDesc=zr,l.sortRulesFactory=st,l.spliceArray=te,l.throttle=eo,l.toDisposable=L,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});