@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/cjs/index.js CHANGED
@@ -1,11 +1,5 @@
1
- "use strict";var sr=Object.defineProperty;var nr=(t,e,s)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var f=(t,e,s)=>(nr(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@wendellhu/redi"),N=require("rxjs"),rr=require("rxjs/operators");function ir(){or()}const Lt=typeof global<"u"?global:typeof self<"u"?self:window;function or(){typeof Lt.requestIdleCallback!="function"&&(Lt.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 Lt.cancelIdleCallback!="function"&&(Lt.cancelIdleCallback=function(s){clearTimeout(s)})}class Ae{constructor(){f(this,"_data",[])}static create(){return new Ae}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 Ie{constructor(){f(this,"_data",new Map)}static create(){return new Ie}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 ye{constructor(e){f(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}f(ye,"type",0);class ar{constructor(){f(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 lr{constructor(){f(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 tt(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function ur(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function cr(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 ts(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 es(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 Ge(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 ke(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 Ve(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ot(t){return typeof t=="function"}function hr(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 te=hr(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
1
+ "use strict";var Bn=Object.defineProperty;var Gn=(t,e,s)=>e in t?Bn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var c=(t,e,s)=>(Gn(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("@wendellhu/redi"),A=require("rxjs"),$n=require("rxjs/operators");function kn(){Vn()}const gt=typeof global<"u"?global:typeof self<"u"?self:window;function Vn(){typeof gt.requestIdleCallback!="function"&&(gt.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 gt.cancelIdleCallback!="function"&&(gt.cancelIdleCallback=function(s){clearTimeout(s)})}class oe{constructor(){c(this,"_data",[])}static create(){return new oe}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 ae{constructor(){c(this,"_data",new Map)}static create(){return new ae}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}var b=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(b||{});class He{constructor(e){c(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}c(He,"type",0);class jn{constructor(){c(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 Yn{constructor(){c(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 K(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function Kn(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function zn(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 We(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 Be(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 we(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 be(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 De(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function ut(t){return typeof t=="function"}function Xn(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 Gt=Xn(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
2
2
  `+s.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=s}});function je(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var ss=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=Ge(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(E){e={error:E}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(Ot(u))try{u()}catch(E){i=E instanceof te?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var _=Ge(h),d=_.next();!d.done;d=_.next()){var g=d.value;try{ze(g)}catch(E){i=i??[],E instanceof te?i=Ve(Ve([],ke(i)),ke(E.errors)):i.push(E)}}}catch(E){n={error:E}}finally{try{d&&!d.done&&(r=_.return)&&r.call(_)}finally{if(n)throw n.error}}}if(i)throw new te(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)ze(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)&&je(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&je(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();ss.EMPTY;function ns(t){return t instanceof ss||t&&"closed"in t&&Ot(t.remove)&&Ot(t.add)&&Ot(t.unsubscribe)}function ze(t){Ot(t)?t():t.unsubscribe()}class rs{constructor(e=!1){f(this,"skipNextObservers");f(this,"lastReturnValue");f(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function is(t){return t instanceof jt}class jt{constructor(e,s){f(this,"_willBeUnregistered",!1);f(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class zt{constructor(e){f(this,"_observers",new Array);f(this,"_eventState");f(this,"_onObserverAdded");this._eventState=new rs,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new jt(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 zt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function v(t){let e=!1;return ns(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:is(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function dr(t){return v(()=>{t.unsubscribe()})}class Ce{constructor(){f(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(){f(this,"_disposed",!1);f(this,"_collection",new Ce)}disposeWithMe(e){const s=ns(e)?v(e):e;return this._collection.add(s)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class _r extends T{constructor(){super(...arguments);f(this,"dispose$",new N.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const ht=C.createIdentifier("univer.context-service");class os extends T{constructor(){super(...arguments);f(this,"_contextChanged$",new N.Subject);f(this,"contextChanged$",this._contextChanged$.asObservable());f(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){return this._contextMap.get(s)??!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next()}}var as=(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))(as||{});const it=C.createIdentifier("univer.log");class ls extends T{constructor(){super(...arguments);f(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 fr=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Er=(t,e,s,n)=>{for(var r=n>1?void 0:n?gr(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&&fr(e,s,r),r},Ye=(t,e)=>(s,n)=>e(s,n,t),Yt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Yt||{});const bt=C.createIdentifier("anywhere.command-service");class Rr{constructor(){f(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),v(()=>{var s;this._commands.delete(e.id),(s=e.onDispose)==null||s.call(e)})}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}exports.CommandService=class{constructor(e,s){f(this,"_commandRegistry");f(this,"_beforeCommandExecutionListeners",[]);f(this,"_commandExecutedListeners",[]);f(this,"_multiCommandDisposables",new Map);f(this,"_commandExecutingLevel",0);f(this,"_commandExecutionStack",[]);this._injector=e,this._logService=s,this._commandRegistry=new Rr}registerCommand(e){return this._registerCommand(e)}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),v(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),v(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(l=>l(o,n));const c=await this._execute(i,s);return this._commandExecutedListeners.forEach(l=>l(o,n)),a.dispose(),c}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s};if(i.type===2){const l=cr(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,n));const c=this._syncExecute(i,s);return this._commandExecutedListeners.forEach(l=>l(o,n)),a.dispose(),c}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),v(()=>tt(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 Ce;n=new mr(e.id),i.add(this._commandRegistry.registerCommand(n)),i.add(v(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,i)}const r=n.registerImplementation(e);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s){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 Error("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}};exports.CommandService=Er([Ye(0,C.Inject(C.Injector)),Ye(1,it)],exports.CommandService);class mr{constructor(e){f(this,"name");f(this,"multi",!0);f(this,"type",0);f(this,"priority",0);f(this,"_implementations",[]);f(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(it),r=e.get(ht),i=e.get(C.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function Se(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return es(n)}function Or(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return ts(n)}const us=C.createIdentifier("univer.config-service");class Ar{constructor(){f(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 cs extends T{constructor(){super(...arguments);f(this,"_error$",new N.Subject);f(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const Ir="__default_document_sub_component_id20231101__";class hs{constructor(){f(this,"_managerInfo",new Map);f(this,"_remove$",new N.Subject);f(this,"remove$",this._remove$.asObservable());f(this,"_andOrUpdate$",new N.Subject);f(this,"andOrUpdate$",this._andOrUpdate$.asObservable());f(this,"_pluginUpdate$",new N.Subject);f(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 ds=C.createIdentifier("univer.floating-object.service");class _s{constructor(){f(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function fs(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 gs(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 Cr(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=gs(t,e):s=fs(t,e),s)}function Sr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var Es=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(Es||{}),b=(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))(b||{}),Rs=(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))(Rs||{}),$=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))($||{}),ms=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(ms||{}),Os=(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))(Os||{}),As=(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))(As||{}),Is=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Is||{}),Cs=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(Cs||{}),Ss=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Ss||{});function Nr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Ns=(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))(Ns||{}),bs=(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))(bs||{}),Kt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(Kt||{}),Ls=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Ls||{}),ws=(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))(ws||{}),vs=(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))(vs||{}),Ne=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Ne||{}),St=(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))(St||{}),Ds=(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))(Ds||{}),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||{}),lt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(lt||{}),ut=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ut||{}),xt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(xt||{}),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||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),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||{}),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||{}),Xt=(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))(Xt||{});const Ms={[Xt.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 qt{constructor(){f(this,"_themeValue",p.LIGHT1);f(this,"_themeColors");f(this,"_themeTint");f(this,"_rgbValue","");f(this,"_colorType");this._colorType=$.UNSUPPORTED,this._themeColors=Xt.OFFICE,this._themeTint=0}asRgbColor(){return new Ht(this._rgbValue,this)}asThemeColor(){return new Bt(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case $.THEME:return this.asThemeColor();case $.RGB:return this.asRgbColor();case $.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(e){return this._colorType=$.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=$.THEME,this._themeColors=e}setThemeTint(e){this._colorType=$.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=$.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class ot{constructor(e){f(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 qt().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,c)=>o+o+a+a+c+c);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(n){const i=parseInt(n[1],16),o=parseInt(n[2],16),a=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 ot(this._builder)}equals(e){return!1}}class Us{constructor(e){f(this,"_saturation",0);f(this,"_hue",0);f(this,"_lightness",0);f(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)),c=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=c/(a+o):this._saturation=c/(2-a-o),s===a&&(this._hue=(n-r)/c),n===a&&(this._hue=2+(r-s)/c),r===a&&(this._hue=4+(s-n)/c),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new qt;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),c=r-1/3,l=this.setColor(s,n,c);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,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 ot{constructor(s,n){super(n);f(this,"_cssString");f(this,"_red");f(this,"_green");f(this,"_blue");f(this,"_alpha");let r=s.match(W.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],c=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=c;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 ot.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 $.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}};f(W,"RGB_COLOR_AMT",0),f(W,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),f(W,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Ht=W;const J=class J extends ot{constructor(s,n,r,i){super(i);f(this,"_themeColorType");f(this,"_themeTint");f(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=Ms[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(J._cacheThemeColor.has(this._themeColors)){if(r=J._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,J._cacheThemeColor.set(this._themeColors,r);const i=new Us(ot.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 J(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(s){return s instanceof J?s._themeColorType===this._themeColorType:!1}getColorType(){return $.THEME}getThemeColorType(){return this._themeColorType}};f(J,"_cacheThemeColor",new Map);let Bt=J;const br="rgb(",Lr="rgba(",ue={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class k{constructor(e){f(this,"_color");f(this,"_rgbColor");f(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof k){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=Ts(e);if(s==null){this._setNullColor();return}this._color=s;const n=Ur(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){n=Math.min(1,Math.max(0,n));const r=new k(e).toRgb(),i=new k(s).toRgb(),o=r.a??1,a=i.a??1,c={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(a-o)*n+o};return new k(c)}static getContrastRatio(e,s){const n=new k(e).getLuminance(),r=new k(s).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:s,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${s},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:s,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[wt(Math.round(s).toString(16)),wt(Math.round(n).toString(16)),wt(Math.round(r).toString(16)),wt(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 pr(this.toRgb())}toHsl(){return xr(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new k(s)}setAlpha(e){return new k({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=ee(e),s=ee(s),n=ee(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(){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 wt=t=>t.length===1?`0${t}`:t,ee=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Ts=t=>{if(Hr(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(ue[e]){const s=ue[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 wr(e);if(e.startsWith("rgb"))return vr(e);if(e.startsWith("hsl"))return Dr(e);if(e.startsWith("hsv"))return Mr(e)},wr=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},vr=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},Dr=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},Mr=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},Ur=t=>{const e=Ts(t);if(e!=null)return"r"in e?e:"l"in e?Tr(e):Pr(e)},se=(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),Tr=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 c=n<.5?n*(1+s):n+s-n*s,l=2*n-c;r=se(l,c,e+1/3),i=se(l,c,e),o=se(l,c,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},Pr=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),c=n*(1-(1-i)*s),l=r%6,u=[n,a,o,o,c,n][l],h=[c,n,n,a,o,o][l],_=[o,o,c,n,n,a][l],d={r:u*255,g:h*255,b:_*255};return t.a!==void 0&&(d.a=t.a),d},xr=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,c;if(r===i)a=c=0;else{const u=r-i;switch(c=o>.5?u/(2-r-i):u/(r+i),r){case e:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-e)/u+2;break;default:a=(e-s)/u+4;break}a/=6}const l={h:Math.round(a*360),s:Math.round(c*100),l:Math.round(o*100)};return t.a!==void 0&&(l.a=t.a),l},pr=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,c=r-i,l=r===0?0:c/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/c+(s<n?6:0);break;case s:o=(n-e)/c+2;break;default:o=(e-s)/c+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},Fr=t=>t==null,Hr=t=>!Fr(t)&&typeof t=="object";var P=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(P||{});let Br=(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 Wr=/^-ms-/,$r=/-([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 m{static stringAt(e){let s="",n=e;for(;n>=q.length;)n/=q.length,n-=1,s+=q[n%q.length];const r=e%q.length;return s+=q[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+=q.length**i+q.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return m.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,c=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){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":s?"Opera":a?"Safari":c?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Br(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.forEach(o=>o&&i(o));function n(o,a){o.forEach((c,l)=>{if(m.isArray(c)){const u=a[l]??[];a[l]=u,n(c,u);return}if(m.isObject(c)){const u=a[l]??{};a[l]=u,r(c,u);return}a[l]=c})}function r(o,a){Object.keys(o).forEach(c=>{const l=o[c];if(m.isObject(l)){const u=a[c]??{};a[c]=u,r(l,u);return}if(m.isArray(l)){const u=a[c]??[];a[c]=u,n(l,u);return}a[c]=l})}function i(o){Object.keys(o).forEach(a=>{const c=o[a];if(m.isArray(c)){const l=e[a]??[];e[a]=l,n(c,l);return}if(m.isObject(c)){const l=e[a]??{};e[a]=l,r(c,l);return}e[a]=c})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){function n(o,a){const c=m.getValueType(o),l=m.getValueType(a);return c!==l?!1:m.isArray(o)?r(o,a):m.isObject(o)?i(o,a):m.isDate(o)?o.getTime()===a.getTime():m.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(e.length!==s.length)return!1;for(let c=0,l=o.length;c<l;c++){const u=o[c],h=a[c];if(!n(u,h))return!1}return!0}function i(o,a){const c=Object.keys(o),l=Object.keys(a);if(c.length!==l.length)return!1;for(const u of c){if(!l.includes(u))return!1;const h=o[u],_=a[u];if(!n(h,_))return!1}return!0}return n(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=m.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=m.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 m.isDefine(e)?m.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(Wr,"ms-").replace($r,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:m.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 Gr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:c,endX:l}=t,u=e,h=s,_=e,d=s;if(n&&i){const{startRow:g,startColumn:E,endRow:R,endColumn:O,startY:A,endY:L,startX:H,endX:x}=i;u=g,h=E,_=R,d=O,o=A,a=L,c=H,l=x}return r&&(o=i.startY,a=i.endY,c=i.startX,l=i.endX,_=i.endRow,d=i.endColumn),{startRow:u,startColumn:h,endRow:_,endColumn:d,startY:o,endY:a,startX:c,endX:l}}function kr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:c}=t;let l=e,u=s,h=e,_=s;return(n||r)&&(l=i,u=o,h=a,_=c),{startRow:l,startColumn:u,endRow:h,endColumn:_}}function Vr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function z(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new qt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function jr(t){return m.isString(t)&&t.substring(0,1)==="="&&t.length>1}function zr(t){return m.isString(t)&&t.indexOf("=")===-1&&t.length===6}function Yr(t){return""}function Kr(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${z(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(new RegExp("(?<=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: ${z(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(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${z(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${z(t.bg)}; `)}],["bd",()=>{var o,a,c,l,u,h,_,d;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${vt((a=t.bd)==null?void 0:a.b.s)} ${z(t.bd.b.cl)??""}; `),(c=t.bd)!=null&&c.t&&(s+=`border-top: ${vt((l=t.bd)==null?void 0:l.t.s)} ${z(t.bd.t.cl)??""}; `),(u=t.bd)!=null&&u.r&&(s+=`border-right: ${vt((h=t.bd)==null?void 0:h.r.s)} ${z(t.bd.r.cl)??""}; `),(_=t.bd)!=null&&_.l&&(s+=`border-left: ${vt((d=t.bd)==null?void 0:d.l.s)} ${z(t.bd.l.cl)??""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${z(t.cl)}; `)}],["va",()=>{t.va===Ft.SUBSCRIPT?s+="vertical-align: sub; ":t.va===Ft.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===St.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===St.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,c;t.tr&&(s+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(c=t.tr)==null?void 0:c.v}`:""});`)}],["ht",()=>{t.ht===rt.LEFT?s+="text-align: left; ":t.ht===rt.RIGHT?s+="text-align: right; ":t.ht===rt.CENTER?s+="text-align: center; ":t.ht===rt.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===lt.BOTTOM?s+="vertical-align: bottom; ":t.vt===lt.TOP?s+="vertical-align: top; ":t.vt===lt.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===ut.CLIP?s+="text-overflow: clip; ":t.tb===ut.OVERFLOW?s+="text-break: overflow; ":t.tb===ut.WRAP&&(s+="word-wrap: break-word;")}],["pd",()=>{var u,h,_,d,g,E,R,O;const o=`${(u=t.pd)==null?void 0:u.b}pt`,a=`${(h=t.pd)==null?void 0:h.t}pt`,c=`${(_=t.pd)==null?void 0:_.l}pt`,l=`${(d=t.pd)==null?void 0:d.r}pt`;(g=t.pd)!=null&&g.b&&(s+=`padding-bottom: ${o}; `),(E=t.pd)!=null&&E.t&&(s+=`padding-top: ${a}; `),(R=t.pd)!=null&&R.l&&(s+=`padding-left: ${c}; `),(O=t.pd)!=null&&O.r&&(s+=`padding-right: ${l}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function vt(t){let e="";return t===b.NONE?e="none":t===b.THIN?e="0.5pt solid":t===b.HAIR?e="0.5pt double":t===b.DOTTED?e="0.5pt dotted":t===b.DASHED||t===b.DASH_DOT?e="0.5pt dashed":t===b.DASH_DOT_DOT?e="0.5pt dotted":t===b.DOUBLE?e="0.5pt double":t===b.MEDIUM?e="1pt solid":t===b.MEDIUM_DASHED||t===b.MEDIUM_DASH_DOT?e="1pt dashed":t===b.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===b.SLANT_DASH_DOT?e="0.5pt dashed":t===b.THICK&&(e="1.5pt solid"),e}function Xr(t){let e=0;if(t=t.trim(),t==="none")e=b.NONE;else if(t==="0.5pt solid")e=b.THIN;else if(t==="0.5pt double")e=b.HAIR;else if(t==="0.5pt dotted")e=b.DOTTED;else if(t==="0.5pt dashed")e=b.DASHED;else if(t==="1pt solid")e=b.MEDIUM;else if(t==="1pt dashed")e=b.MEDIUM_DASHED;else if(t==="1pt dotted")e=b.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=b.THICK;else return b.NONE;return e}function Mt(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 qr(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=t;return!(e<0||n<0||s<0||r<0)}function be(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=>be(t[s],e[s])):t===e:!1}function Ps(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:be(s,n)}function Le(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function Qr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Zr(t){if(t==null)return!1;const e=t.paragraphStyle;return xs(e)}function xs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function ps(t,e,s){return t.slice(0,e)+s+t.slice(e)}function Fs(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Hs={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,s){t.exports?t.exports=s():e.numeral=s()})(Jr,function(){var e,s,n="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 c(l,u){this._input=l,this._value=u}return e=function(l){var u,h,_,d;if(e.isNumeral(l))u=l.value();else if(l===0||typeof l>"u")u=0;else if(l===null||s.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(h in r)if(d=typeof r[h].regexps.unformat=="function"?r[h].regexps.unformat():r[h].regexps.unformat,d&&l.match(d)){_=r[h].unformat;break}_=_||e._.stringToNumber,u=_(l)}else u=Number(l)||null;return new c(l,u)},e.version=n,e.isNumeral=function(l){return l instanceof c},e._=s={numberToFormat:function(l,u,h){var _=i[e.options.currentLocale],d=!1,g=!1,E=0,R="",O=1e12,A=1e9,L=1e6,H=1e3,x="",at=!1,B,X,U,G,yt,We,K;if(l=l||0,X=Math.abs(l),e._.includes(u,"(")?(d=!0,u=u.replace(/[\(|\)]/g,"")):(e._.includes(u,"+")||e._.includes(u,"-"))&&(yt=e._.includes(u,"+")?u.indexOf("+"):l<0?u.indexOf("-"):-1,u=u.replace(/[\+|\-]/g,"")),e._.includes(u,"a")&&(B=u.match(/a(k|m|b|t)?/),B=B?B[1]:!1,e._.includes(u," a")&&(R=" "),u=u.replace(new RegExp(R+"a[kmbt]?"),""),X>=O&&!B||B==="t"?(R+=_.abbreviations.trillion,l=l/O):X<O&&X>=A&&!B||B==="b"?(R+=_.abbreviations.billion,l=l/A):X<A&&X>=L&&!B||B==="m"?(R+=_.abbreviations.million,l=l/L):(X<L&&X>=H&&!B||B==="k")&&(R+=_.abbreviations.thousand,l=l/H)),e._.includes(u,"[.]")&&(g=!0,u=u.replace("[.]",".")),U=l.toString().split(".")[0],G=u.split(".")[1],We=u.indexOf(","),E=(u.split(".")[0].split(",")[0].match(/0/g)||[]).length,G?(e._.includes(G,"[")?(G=G.replace("]",""),G=G.split("["),x=e._.toFixed(l,G[0].length+G[1].length,h,G[1].length)):x=e._.toFixed(l,G.length,h),U=x.split(".")[0],e._.includes(x,".")?x=_.delimiters.decimal+x.split(".")[1]:x="",g&&Number(x.slice(1))===0&&(x="")):U=e._.toFixed(l,0,h),R&&!B&&Number(U)>=1e3&&R!==_.abbreviations.trillion)switch(U=String(Number(U)/1e3),R){case _.abbreviations.thousand:R=_.abbreviations.million;break;case _.abbreviations.million:R=_.abbreviations.billion;break;case _.abbreviations.billion:R=_.abbreviations.trillion;break}if(e._.includes(U,"-")&&(U=U.slice(1),at=!0),U.length<E)for(var $e=E-U.length;$e>0;$e--)U="0"+U;return We>-1&&(U=U.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+_.delimiters.thousands)),u.indexOf(".")===0&&(U=""),K=U+x+(R||""),d?K=(d&&at?"(":"")+K+(d&&at?")":""):yt>=0?K=yt===0?(at?"-":"+")+K:K+(at?"-":"+"):at&&(K="-"+K),K},stringToNumber:function(l){var u=i[a.currentLocale],h=l,_={thousand:3,million:6,billion:9,trillion:12},d,g,E;if(a.zeroFormat&&l===a.zeroFormat)g=0;else if(a.nullFormat&&l===a.nullFormat||!l.replace(/[^0-9]+/g,"").length)g=null;else{g=1,u.delimiters.decimal!=="."&&(l=l.replace(/\./g,"").replace(u.delimiters.decimal,"."));for(d in _)if(E=new RegExp("[^a-zA-Z]"+u.abbreviations[d]+"(?:\\)|(\\"+u.currency.symbol+")?(?:\\))?)?$"),h.match(E)){g*=Math.pow(10,_[d]);break}g*=(l.split("-").length+Math.min(l.split("(").length-1,l.split(")").length-1))%2?1:-1,l=l.replace(/[^0-9\.]+/g,""),g*=Number(l)}return g},isNaN:function(l){return typeof l=="number"&&isNaN(l)},includes:function(l,u){return l.indexOf(u)!==-1},insert:function(l,u,h){return l.slice(0,h)+u+l.slice(h)},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 h=Object(l),_=h.length>>>0,d=0,g;if(arguments.length===3)g=arguments[2];else{for(;d<_&&!(d in h);)d++;if(d>=_)throw new TypeError("Reduce of empty array with no initial value");g=h[d++]}for(;d<_;d++)d in h&&(g=u(g,h[d],d,h));return g},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,h){var _=s.multiplier(h);return u>_?u:_},1)},toFixed:function(l,u,h,_){var d=l.toString().split("."),g=u-(_||0),E,R,O,A;return d.length===2?E=Math.min(Math.max(d[1].length,g),u):E=g,O=Math.pow(10,E),A=(h(l+"e+"+E)/O).toFixed(E),_>u-E&&(R=new RegExp("\\.?0{1,"+(_-(u-E))+"}$"),A=A.replace(R,"")),A}},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,h){if(u=u.toLowerCase(),this[l+"s"][u])throw new TypeError(u+" "+l+" already registered.");return this[l+"s"][u]=h,h},e.validate=function(l,u){var h,_,d,g,E,R,O,A;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{O=e.localeData(u)}catch{O=e.localeData(e.locale())}return d=O.currency.symbol,E=O.abbreviations,h=O.delimiters.decimal,O.delimiters.thousands==="."?_="\\.":_=O.delimiters.thousands,A=l.match(/^[^\d]+/),A!==null&&(l=l.substr(1),A[0]!==d)||(A=l.match(/[^\d]+$/),A!==null&&(l=l.slice(0,-1),A[0]!==E.thousand&&A[0]!==E.million&&A[0]!==E.billion&&A[0]!==E.trillion))?!1:(R=new RegExp(_+"{2}"),l.match(/[^\d.,]/g)?!1:(g=l.split(h),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R):g[0].length===1?!!g[0].match(/^\d+$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/)))},e.fn=c.prototype={clone:function(){return e(this)},format:function(l,u){var h=this._value,_=l||a.defaultFormat,d,g,E;if(u=u||Math.round,h===0&&a.zeroFormat!==null)g=a.zeroFormat;else if(h===null&&a.nullFormat!==null)g=a.nullFormat;else{for(d in r)if(_.match(r[d].regexps.format)){E=r[d].format;break}E=E||e._.numberToFormat,g=E(h,_,u)}return g},value:function(){return this._value},input:function(){return this._input},set:function(l){return this._value=Number(l),this},add:function(l){var u=s.correctionFactor.call(null,this._value,l);function h(_,d,g,E){return _+Math.round(u*d)}return this._value=s.reduce([this._value,l],h,0)/u,this},subtract:function(l){var u=s.correctionFactor.call(null,this._value,l);function h(_,d,g,E){return _-Math.round(u*d)}return this._value=s.reduce([l],h,Math.round(this._value*u))/u,this},multiply:function(l){function u(h,_,d,g){var E=s.correctionFactor(h,_);return Math.round(h*E)*Math.round(_*E)/Math.round(E*E)}return this._value=s.reduce([this._value,l],u,1),this},divide:function(l){function u(h,_,d,g){var E=s.correctionFactor(h,_);return Math.round(h*E)/Math.round(_*E)}return this._value=s.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,h){var _=e._.includes(u," BPS")?" ":"",d;return l=l*1e4,u=u.replace(/\s?BPS/,""),d=e._.numberToFormat(l,u,h),e._.includes(d,")")?(d=d.split(""),d.splice(-1,0,_+"BPS"),d=d.join("")):d=d+_+"BPS",d},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"]},h=l.suffixes.concat(u.suffixes.filter(function(d){return l.suffixes.indexOf(d)<0})),_=h.join("|");_="("+_.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(_)},format:function(d,g,E){var R,O=e._.includes(g,"ib")?u:l,A=e._.includes(g," b")||e._.includes(g," ib")?" ":"",L,H,x;for(g=g.replace(/\s?i?b/,""),L=0;L<=O.suffixes.length;L++)if(H=Math.pow(O.base,L),x=Math.pow(O.base,L+1),d===null||d===0||d>=H&&d<x){A+=O.suffixes[L],H>0&&(d=d/H);break}return R=e._.numberToFormat(d,g,E),R+A},unformat:function(d){var g=e._.stringToNumber(d),E,R;if(g){for(E=l.suffixes.length-1;E>=0;E--){if(e._.includes(d,l.suffixes[E])){R=Math.pow(l.base,E);break}if(e._.includes(d,u.suffixes[E])){R=Math.pow(u.base,E);break}}g*=R||1}return g}})}(),function(){e.register("format","currency",{regexps:{format:/(\$)/},format:function(l,u,h){var _=e.locales[e.options.currentLocale],d={before:u.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:u.match(/([\+|\-|\)|\s|\$]*)$/)[0]},g,E,R;for(u=u.replace(/\s?\$\s?/,""),g=e._.numberToFormat(l,u,h),l>=0?(d.before=d.before.replace(/[\-\(]/,""),d.after=d.after.replace(/[\-\)]/,"")):l<0&&!e._.includes(d.before,"-")&&!e._.includes(d.before,"(")&&(d.before="-"+d.before),R=0;R<d.before.length;R++)switch(E=d.before[R],E){case"$":g=e._.insert(g,_.currency.symbol,R);break;case" ":g=e._.insert(g," ",R+_.currency.symbol.length-1);break}for(R=d.after.length-1;R>=0;R--)switch(E=d.after[R],E){case"$":g=R===d.after.length-1?g+_.currency.symbol:e._.insert(g,_.currency.symbol,-(d.after.length-(1+R)));break;case" ":g=R===d.after.length-1?g+" ":e._.insert(g," ",-(d.after.length-(1+R)+_.currency.symbol.length-1));break}return g}})}(),function(){e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(l,u,h){var _,d=typeof l=="number"&&!e._.isNaN(l)?l.toExponential():"0e+0",g=d.split("e");return u=u.replace(/e[\+|\-]{1}0/,""),_=e._.numberToFormat(Number(g[0]),u,h),_+"e"+g[1]},unformat:function(l){var u=e._.includes(l,"e+")?l.split("e+"):l.split("e-"),h=Number(u[0]),_=Number(u[1]);_=e._.includes(l,"e-")?_*=-1:_;function d(g,E,R,O){var A=e._.correctionFactor(g,E),L=g*A*(E*A)/(A*A);return L}return e._.reduce([h,Math.pow(10,_)],d,1)}})}(),function(){e.register("format","ordinal",{regexps:{format:/(o)/},format:function(l,u,h){var _=e.locales[e.options.currentLocale],d,g=e._.includes(u," o")?" ":"";return u=u.replace(/\s?o/,""),g+=_.ordinal(l),d=e._.numberToFormat(l,u,h),d+g}})}(),function(){e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(l,u,h){var _=e._.includes(u," %")?" ":"",d;return e.options.scalePercentBy100&&(l=l*100),u=u.replace(/\s?\%/,""),d=e._.numberToFormat(l,u,h),e._.includes(d,")")?(d=d.split(""),d.splice(-1,0,_+"%"),d=d.join("")):d=d+_+"%",d},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,h){var _=Math.floor(l/60/60),d=Math.floor((l-_*60*60)/60),g=Math.round(l-_*60*60-d*60);return _+":"+(d<10?"0"+d:d)+":"+(g<10?"0"+g:g)},unformat:function(l){var u=l.split(":"),h=0;return u.length===3?(h=h+Number(u[0])*60*60,h=h+Number(u[1])*60,h=h+Number(u[2])):u.length===2&&(h=h+Number(u[0])*60,h=h+Number(u[1])),Number(h)}})}(),e})})(Hs);var ti=Hs.exports;const st=yr(ti),ce={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function ei(t){let e=!1;for(const s in ce)if(t===ce[s]){e=!0;break}return e}function nt(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function si(t){if(t===null||t.toString().length<5)return!1;if(e(t))return!0;return!1;function e(s){const n=/^(\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(!n.test(s)&&!r.test(s))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 Wt=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(Wt.getFullYear())&&(Wt=new Date("2/19/17"));const ni=Wt.getFullYear()===2017;function ri(t,e){const s=new Date(t);if(ni)return e>0?s.setTime(s.getTime()+s.getTimezoneOffset()*60*1e3):e<0&&s.setTime(s.getTime()-s.getTimezoneOffset()*60*1e3),s;if(t instanceof Date)return t;if(Wt.getFullYear()===1917&&!Number.isNaN(s.getFullYear())){const i=s.getFullYear();return t.indexOf(`${i}`)>-1||s.setFullYear(s.getFullYear()+100),s}const n=t.match(/\d+/g)||["2017","2","19","0","0","0"];let r=new Date(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);return t.indexOf("Z")>-1&&(r=new Date(r.getTime()-r.getTimezoneOffset()*60*1e3)),r}const ii=new Date(1900,2,1,0,0,0);function Bs(t,e){let s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const n=Date.UTC(1899,11,31,0,0,0);return e?s-=1461*24*60*60*1e3:t>=ii&&(s+=24*60*60*1e3),(s-n)/(24*60*60*1e3)}function oi(t){let e=null,s={},n=t;if(t===null)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,n=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}s={fa:r,t:"n"}}else if(t.toString().substr(0,1)==="'")e=t.toString().substr(1),s={fa:"@",t:"s"};else if(t.toString().toUpperCase()==="TRUE")e="TRUE",s={fa:"General",t:"b"},n=!0;else if(t.toString().toUpperCase()==="FALSE")e="FALSE",s={fa:"General",t:"b"},n=!1;else if(ei(t))e=t.toString(),s={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(),s={fa:"@",t:"s"};else if(nt(t)&&Math.abs(parseFloat(t))>0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){n=st(t).value();const r=n.toExponential();if(r.indexOf(".")>-1){let i=r.split(".")[1].split("e")[0].length;i>5&&(i=5),s={fa:`#0.${new Array(i+1).join("0")}E+00`,t:"n"}}else s={fa:"#0.E+00",t:"n"};e=Q.format(s.fa,n)}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&&nt(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 h=a.split(",");for(let _=1;_<h.length;_++)if(h[_].length<3){u=!1;break}u?(s={fa:`#,##0.${new Array(l+1).join("0")}%`,t:"n"},n=st(t).value(),e=Q.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:`0.${new Array(l+1).join("0")}%`,t:"n"},n=st(t).value(),e=Q.format(s.fa,n)}else e=t.toString(),s={fa:"@",t:"s"};else if(i.indexOf(",")>-1){let a=!0;const c=i.split(",");for(let l=1;l<c.length;l++)if(c[l].length<3){a=!1;break}a?(s={fa:"#,##0%",t:"n"},n=st(t).value(),e=Q.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:"0%",t:"n"},n=st(t).value(),e=Q.format(s.fa,n);else e=t.toString(),s={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 c=r.split(",");for(let l=1;l<c.length;l++)if(!nt(c[l])||c[l].length<3){a=!1;break}a?(s={fa:`#,##0.${new Array(o+1).join("0")}`,t:"n"},n=st(t).value(),e=Q.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else nt(r)&&nt(i)?(s={fa:`0.${new Array(o+1).join("0")}`,t:"n"},n=st(t).value(),e=Q.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else e=t.toString(),s={fa:"@",t:"s"};else nt(t)?(e=t.toString(),s={fa:"General",t:"n"},n=parseFloat(t)):si(t)&&(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(n=Bs(ri(t.toString().replace(/-/g,"/"))),n.toString().indexOf(".")>-1?t.toString().length>18?s.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?s.fa="yyyy-MM-dd hh:mm":s.fa="yyyy-MM-dd":s.fa="yyyy-MM-dd",s.t="d",e=Q.format(s.fa,n)):(e=t,s.fa="General",s.t="g");return[e,s,n]}const Q={format(t,e){}},ai=(t,e)=>{};function li(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 Et{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 S=Symbol("newer"),M=Symbol("older");class Ws{constructor(e){f(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:e.key}):{done:!0,value:void 0}}}class $s{constructor(e){f(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Gs{constructor(e){f(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var ko,Vo;class he{constructor(e,s){f(this,"key");f(this,"value");f(this,ko);f(this,Vo);this.key=e,this.value=s,this[S]=void 0,this[M]=void 0}toJSON(){return{key:this.key,value:this.value}}}ko=S,Vo=M;class ks{constructor(...e){f(this,"_keymap");f(this,"size",0);f(this,"limit");f(this,"oldest");f(this,"newest");f(this,"_onShiftListeners",[]);if(Et.hasLength(e,1)){if(Et.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(Et.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(Et.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),v(()=>tt(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[S]&&(e===this.oldest&&(this.oldest=e[S]),e[S][M]=e[M]),e[M]&&(e[M][S]=e[S]),e[S]=void 0,e[M]=this.newest,this.newest&&(this.newest[S]=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 he(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[S]=o,o[M]=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 he(e,s)),this.newest?(this.newest[S]=n,n[M]=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[S]?(this.oldest=this.oldest[S],this.oldest[M]=void 0):(this.oldest=void 0,this.newest=void 0),e[S]=e[M]=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[S]&&s[M]?(s[M][S]=s[S],s[S][M]=s[M]):s[S]?(s[S][M]=void 0,this.oldest=s[S]):s[M]?(s[M][S]=void 0,this.newest=s[M]):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 Ws(this.oldest)}values(){return new $s(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Gs(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[S]}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[S];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[S],s&&(e+=" < ");return e}}function j(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 ui(t,e,s){const n=j(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function ci(t,e,s){const n=t+e,r=j(s),i=s;let o=0;const a={};for(let u=t;u<n;u++){const h=i[u];h!==void 0&&(delete i[u],a[o]=h,o++)}const c=n-t,l=r;for(let u=n;u<l;u++)i[u]!==void 0&&(i[u-c]=i[u],delete i[u])}function hi(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,o=Object.keys(i),a=o.length,c={};let l=0;for(let u=0;u<r;u++,l++){const h=n[u];c[l]=s[h]}for(let u=0;u<a;u++,l++){const h=o[u];c[l]=i[h]}return c}function di(t,e,s){const n=s;if(j(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 de(t,e,s,n){const r=t>s;if(!r&&t+e>s)throw new Error("Invalid move operation");r?_i(t,e,s,n):fi(t,e,s,n)}function _i(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 fi(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 Y{constructor(e={}){f(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new Y({[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(c=>Number(c)))===!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 c of a){const l=Number(c),u=o[Number(c)];if(e(i,l,u)===!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){de(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{de(e,s,n,i)})}getFragment(e,s,n,r){const i=new Y;let o=0;for(let a=e;a<=s;a++){const c={};let l=0;for(let u=n;u<=r;u++){const h=this.getValue(a,u);c[l]=h,l++}i.setRow(o,c),o++}return i}getSlice(e,s,n,r){const i=new Y;for(let o=e;o<=s;o++)for(let a=n;a<=r;a++){const c=this.getValue(o,a);c&&i.setValue(o,a,m.deepClone(c))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return j(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 c=j(a)-1;r=c>r?c: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 Y;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(c=>{const l=Number(c);r?l<s&&(s=l):(r=!0,s=l);const u=this.getValue(o,l);i.setValue(o-e,l-s,u)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,c)=>{i||(i=!0,e=a);const l=j(c)-1;l>n&&(n=l),Object.keys(c).forEach(u=>{const h=Number(u);o?h<s&&(s=h):(o=!0,s=h)}),a>r&&(r=a)}),{startRow:e,startColumn:s,endRow:r,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)if(s>=a.startRow&&s<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(s,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e}}var we=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(we||{});class Vs{constructor(){f(this,"status","init")}}const gi=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||{}),V=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(V||{});function Ei(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const y=class y{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,s){return e==null||s==null?!1:e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===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,c=s.endRow,l=s.startColumn,u=s.endColumn,h=Math.abs(i+o-l-u),_=Math.abs(i-o)+Math.abs(l-u),d=Math.abs(n+r-a-c),g=Math.abs(n-r)+Math.abs(a-c);return h<=_&&d<=g}static getIntersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,c=s.endRow,l=s.startColumn,u=s.endColumn;let h,_,d,g;if(a<=r)a>=n?_=a:_=n;else return null;if(c>=n)c>=r?g=r:g=c;else return null;if(l<=o)l>i?h=l:h=i;else return null;if(u>=i)u>=o?d=o:d=u;else return null;return{startRow:_,endRow:g,startColumn:h,endColumn:d,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 y.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType: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}};f(y,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),f(y,"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})),f(y,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),f(y,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),f(y,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let ct=y;class Ri{constructor(e,s){f(this,"_values",[]);f(this,"_keys",[]);f(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 _e(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 mi(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 $t=65,js=90,Oi=97;function Ai(t){const e=js-$t+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+$t)+s,t=Math.floor(t/e)-1;return s}function zs(t,e){let s="";for(;e>0;)s+=t,e--;return s}function Ii(t,e=!1){const s=js-$t+1;let n=Oi;e&&(n=$t);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return zs(r,i)}function Ci(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Si(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function gt(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}var Ys=(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))(Ys||{}),ve=(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))(ve||{});function De(t){const e=[];for(const s of t){const{st:n,ed:r}=s;if(n===r)continue;if(e.length===0){e.push(s);continue}const i=e.pop();Ps(s,i)&&m.hasIntersectionBetweenTwoRanges(i.st,i.ed,s.st,s.ed)?e.push({...s,st:i.st,ed:r}):e.push(i,s)}return e}function Ks(t,e,s,n){const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const c=e.textRuns??[];if(c.length)for(let l=0,u=c.length;l<u;l++){const h=c[l];h.st+=n,h.ed+=n}for(let l=0;l<o;l++){const u=r[l],{st:h,ed:_}=u;if(_<n)i.push(u);else if(n>=h&&n<=_)if(a)u.st+=s,u.ed+=s,i.push(u);else{a=!0,u.ed+=s;const d=[];if(c.length){const g={...u,st:h,ed:c[0].st};d.push(g),d.push(...c);const E=c[c.length-1],R={...u,st:E.ed,ed:_+s};d.push(R)}else d.push(u);i.push(...d)}else u.st+=s,u.ed+=s,a||(a=!0,i.push(...c)),i.push(u)}a||(a=!0,i.push(...c)),t.textRuns=De(i)}function Me(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let c=-1;for(let u=0,h=r.length;u<h;u++){const _=r[u],{startIndex:d}=_;d>=n&&(_.startIndex+=s),c===-1&&d>=n&&(c=u),a.push(_.startIndex)}let l=-1;if(i){for(let u=0,h=i.length;u<h;u++){const _=i[u];_.startIndex+=n;const d=_.startIndex;l=a.indexOf(d)}if(o===ve.PARAGRAPH&&i.length===1){const u=r[c],h=i[0],_=u.paragraphStyle,d=u.bullet;u.paragraphStyle=h.paragraphStyle,u.bullet=h.bullet,h.paragraphStyle=_,h.bullet=d}l!==-1&&r.splice(l,1),r.push(...i),r.sort(gt("startIndex"))}}function Ni(t,e,s,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l}=c;l>=n&&(c.startIndex+=s)}const i=e.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Xs(t,e,s,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l}=c;l>=n&&(c.startIndex+=s)}const i=e.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Ue(t,e,s,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l,endIndex:u}=c;l>n?(c.startIndex+=s,c.endIndex+=s):u>=n-1&&(c.endIndex+=s)}const i=e.tables;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n,c.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function bi(t,e,s,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l,endIndex:u}=c;l>n?(c.startIndex+=s,c.endIndex+=s):u>=n-1&&(c.endIndex+=s)}const i=e.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n,c.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function qs(t,e,s){const{textRuns:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{st:h,ed:_}=u;if(r<=h&&i>=_){o.push({...u,st:h-r,ed:_-r});continue}else h<=r&&_>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=e):r>=h&&r<_?(o.push({...u,st:r-r,ed:_-r}),u.ed=r):i>h&&i<=_?(o.push({...u,st:h-r,ed:i-r}),u.st=i-e,u.ed-=e):h>=i&&(u.st-=e,u.ed-=e);a.push(u)}t.textRuns=a}return o}function Qs(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<i){o.push({...u,startIndex:h-s});continue}else h>=i&&(u.startIndex-=e);a.push(u)}t.paragraphs=a}return o}function Zs(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<=i){o.push({...u,startIndex:h-s});continue}else h>i&&(u.startIndex-=e);a.push(u)}t.sectionBreaks=a}return o}function Js(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<=i){o.push({...u,startIndex:h-s});continue}else h>i&&(u.startIndex-=e);a.push(u)}t.customBlocks=a}return o}function ys(t,e,s){const{tables:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h,endIndex:_}=u;if(r<=h&&i>=_){o.push({...u,startIndex:h-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const d=Le(h,_,r,i);u.startIndex=d[0],u.endIndex=d[1]}else i<h&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.tables=a}return o}function tn(t,e,s){const{customRanges:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h,endIndex:_}=u;if(r<=h&&i>=_){o.push({...u,startIndex:h-s,endIndex:_-s});continue}else if(h<=r&&_>=i){const d=Le(h,_,r,i);u.startIndex=d[0],u.endIndex=d[1]}else i<h&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.customRanges=a}return o}function Li(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=qs(t,e,s),a=Qs(t,e,s),c=Zs(t,e,s),l=Js(t,e,s),u=ys(t,e,s),h=tn(t,e,s);let _="";return n&&(t.dataStream=Fs(n,r,i),_=n.slice(r,i)),{dataStream:_,textRuns:o,paragraphs:a,sectionBreaks:c,customBlocks:l,tables:u,customRanges:h}}function wi(t,e,s,n){t.dataStream=ps(t.dataStream,n,e.dataStream),Ks(t,e,s,n),Me(t,e,s,n),Ni(t,e,s,n),Xs(t,e,s,n),Ue(t,e,s,n),bi(t,e,s,n)}var en=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(en||{}),sn=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(sn||{}),It=(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))(It||{}),Z=(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))(Z||{}),nn=(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))(nn||{}),rn=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(rn||{}),on=(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))(on||{}),an=(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))(an||{}),ln=(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))(ln||{}),un=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(un||{}),cn=(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))(cn||{}),hn=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(hn||{}),dn=(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))(dn||{}),_n=(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))(_n||{}),fn=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(fn||{}),gn=(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))(gn||{}),En=(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))(En||{}),Rn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Rn||{}),mn=(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))(mn||{}),On=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(On||{}),An=(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))(An||{}),In=(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))(In||{}),Cn=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Cn||{}),Sn=(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))(Sn||{}),Nn=(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))(Nn||{}),bn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(bn||{}),Ln=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Ln||{}),Gt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Gt||{});const vi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:Z.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:Z.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:Z.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:Z.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:Z.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:Z.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:63}]}};function Di(t,e,s,n,r){const i=Mi(t,e,s,n,r),o=Ti(t,e,s,n,r),a=Pi(t,e,s,n,r),c=xi(t,e,s,n,r),l=pi(t,e,s,n,r),u=Fi(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:c,tables:l,customRanges:u}}function Mi(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=qs(t,s,n);if(r!==P.REPLACE){const c=Ui(o,a,r);e.textRuns=c}return Ks(t,e,s,n),a}function Ui(t,e,s){if(e.length===0)return t;t=m.deepClone(t),e=m.deepClone(e);const n=[],r=t.length,i=e.length;let o=0,a=0,c=null;function l(){return c?(n.push(c),c=null,!0):!1}for(;o<r&&a<i;){const{st:d,ed:g,ts:E}=t[o],{st:R,ed:O,ts:A,sId:L}=e[a];let H;s===P.COVER?H={...A,...E}:H={...E,...A},g<R?(l()||n.push(t[o]),o++):O<d?(l()||n.push(e[a]),a++):(n.push({st:Math.min(d,R),ed:Math.max(d,R),ts:d<R?{...E}:{...A},sId:d<R?void 0:L}),n.push({st:Math.max(d,R),ed:Math.min(g,O),ts:H,sId:L}),g<O?(o++,e[a].st=g):(a++,t[o].st=O),c={st:Math.min(g,O),ed:Math.max(g,O),ts:g<O?{...A}:{...E},sId:g<O?L:void 0})}l();const u=n[n.length-1],h=t[r-1],_=e[i-1];return u.ed!==Math.max(h.ed,_.ed)&&(h.ed>_.ed?n.push(h):n.push(_)),De(n)}function Ti(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=Qs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,paragraphStyle:h,bullet:_}=l;let d=[];for(const g of a){const{startIndex:E,paragraphStyle:R,bullet:O}=g;let A,L;if(r===P.COVER?(A={...R,...h},L={listId:"",listType:Gt.BULLET_LIST,nestingLevel:0,textStyle:{},...O,..._}):(A={...h,...R},L={listId:"",listType:Gt.BULLET_LIST,nestingLevel:0,textStyle:{},..._,...O}),u===E){d.push({startIndex:u,paragraphStyle:A,bullet:L});break}}c.push(...d),d=[]}e.paragraphs=c}return Me(t,e,s,n),a}function Pi(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=Zs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u}=l;let h=[];for(const _ of a){const{startIndex:d}=_;if(u===d){r===P.COVER?h.push({..._,...l}):h.push({...l,..._});break}}c.push(...h),h=[]}e.sectionBreaks=c}return Me(t,e,s,n),a}function xi(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=Js(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u}=l;let h=[];for(const _ of a){const{startIndex:d}=_;if(u===d){r===P.COVER?h.push({..._,...l}):h.push({...l,..._});break}}c.push(...h),h=[]}e.customBlocks=c}return Xs(t,e,s,n),a}function pi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=ys(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,endIndex:h}=l;let _=[];for(const d of a){const{startIndex:g,endIndex:E}=d;if(g>=u&&E<=h){r===P.COVER?_.push({...d,...l}):_.push({...l,...d});break}}c.push(..._),_=[]}e.tables=c}return Ue(t,e,s,n),a}function Fi(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=tn(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,endIndex:h}=l;let _=[];for(const d of a){const{startIndex:g,endIndex:E}=d;if(g>=u&&E<=h){r===P.COVER?_.push({...d,...l}):_.push({...l,...d});break}}c.push(..._),_=[]}e.customRanges=c}return Ue(t,e,s,n),a}const Te={id:"default_doc",documentStyle:{}};class Hi{constructor(e){f(this,"snapshot");this.snapshot={...Te,...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??1/0,s=s??1/0,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,c=n==null?void 0:n[e];if(!c)return;const l=c.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 dt extends Hi{constructor(s){super(s);f(this,"_unitId");f(this,"headerModelMap",new Map);f(this,"footerModelMap",new Map);const n=6;this._unitId=this.snapshot.id??m.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){return this.snapshot.rev??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={...Te,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new _s;return r.reset(),s.forEach(i=>{if(i=m.deepClone(i),i.t==="r"){const{coverType:o,body:a,len:c,segmentId:l}=i;if(a!=null){const u=this._updateApply(a,c,r.cursor,o,l);n.push({...i,t:"r",coverType:P.REPLACE,body:u})}else n.push({...i,t:"r"});r.moveCursor(c)}else if(i.t==="i"){const{body:o,len:a,segmentId:c,line:l}=i;this._insertApply(o,a,r.cursor,c),r.moveCursor(a),n.push({t:"d",len:a,line:l,segmentId:c})}else if(i.t==="d"){const{len:o,segmentId:a}=i,c=this._deleteApply(o,r.cursor,a);n.push({...i,t:"i",body:c})}else throw new Error(`Unknown mutation type for mutation: ${i}.`)}),n}sliceBody(s,n){const r=this.getBody();if(r==null)return;const{dataStream:i,textRuns:o=[],paragraphs:a=[]}=r,c={dataStream:i.slice(s,n)},l=[];for(const h of o){const _=m.deepClone(h),{st:d,ed:g}=_;m.hasIntersectionBetweenTwoRanges(d,g,s,n)&&(s>=d&&s<=g?l.push({..._,st:s,ed:Math.min(n,g)}):n>=d&&n<=g?l.push({..._,st:Math.max(s,d),ed:n}):l.push(_))}l.length&&(c.textRuns=l.map(h=>{const{st:_,ed:d}=h;return{...h,st:_-s,ed:d-s}}));const u=[];for(const h of a){const{startIndex:_}=h;_>=s&&_<=n&&u.push(m.deepClone(h))}return u.length&&(c.paragraphs=u.map(h=>({...h,startIndex:h.startIndex-s}))),c}_updateApply(s,n,r,i=P.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,c=Mt(a,o);if(c==null)throw new Error("no body has changed");return Di(c,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Mt(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Li(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Mt(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");wi(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 dt(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new dt(i))}}updateDocumentId(s){super.updateDocumentId(s),this._unitId=s}}const Rt={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Bi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Wi={startRow:0,startColumn:0,endRow:0,endColumn:0},$i={row:0,column:0},wn={id:"",sheetOrder:[],name:"",appVersion:"",locale:Kt.ZH_CN,styles:{},sheets:{},resources:[]},vn=1e3,Dn=20,Mn=19,Un=73,Tn=46,Pn=20,kt={type:Ne.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:vn,columnCount:Dn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Un,defaultRowHeight:Mn,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:I.FALSE,showGridlines:I.TRUE,rowHeader:{width:Tn,hidden:I.FALSE},columnHeader:{height:Pn,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{}},Ut={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:St.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:rt.UNSPECIFIED,vt:lt.UNSPECIFIED,tb:ut.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},xn={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var pn=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(pn||{});class Fn{constructor(e={}){f(this,"_styles");f(this,"_cacheMap",new ks(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=m.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&&m.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(m.diffValue(s[n],e))return n;return null}}function Gi(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 ki(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 Vi(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 ji(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Pe=(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))(Pe||{}),Hn=(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))(Hn||{}),Bn=(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))(Bn||{});class zi{constructor(e,s){f(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=j(this._columnData)-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 j(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 Dt(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 _t{constructor(e,s,n){f(this,"_range");f(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 c=r;c<=o;c++)s(a,c)}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 c=n;c<=r;c++)a.push(this.getMatrix().getValue(o,c)||null);i.push(a)}return i}getMatrix(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new Y;for(let a=e;a<=s;a++)for(let c=n;c<=r;c++)o.setValue(a,c,i.getValue(a,c)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new Y;for(let a=e;a<=s;a++)for(let c=n;c<=r;c++)o.setValue(a-e,c-n,i.getValue(a,c)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=m.numToWord(n+1)+(e+1),o=m.numToWord(r+1)+(s+1)):(i=m.numToWord(r+1)+(s+1),o=m.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)||Ut.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 _t(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 c=this._deps.getStyles();for(let l=0;l<=n-s;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 h=o[l][u].s;h&&(o[l][u].s=c.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("ul",(n=e.body)==null?void 0:n.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;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("st",(n=e.body)==null?void 0:n.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;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("it",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?xt.ITALIC:xt.NORMAL:this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("bl",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?pt.BOLD:pt.NORMAL:this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const a=s.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){_t.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]||Ut[e]}))}}class Yi{constructor(e,s){f(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},{isAutoHeight:c,ah:l,h:u=r.defaultRowHeight}=a;i+=(c==null||c)&&typeof l=="number"?l:u}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=j(this._rowData)-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 j(this._rowData)}}class Wn extends T{constructor(){super(...arguments);f(this,"_cellContentInterceptors",[]);f(this,"_rowFilteredInterceptors",[]);f(this,"_rowVisibleInterceptors",[]);f(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),v(()=>tt(this._cellContentInterceptors,s))}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(s),v(()=>tt(this._rowFilteredInterceptors,s))}registerRowVisibleInterceptor(s){if(this._rowVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(s),v(()=>tt(this._rowVisibleInterceptors,s))}registerColVisibleInterceptor(s){if(this._colVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(s),v(()=>tt(this._colVisibleInterceptors,s))}}class Nt{constructor(e,s){f(this,"_initialized");f(this,"_sheetId");f(this,"_snapshot");f(this,"_cellData");f(this,"_rowManager");f(this,"_columnManager");f(this,"_viewModel");this._styles=s;const n={...kt,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=this._snapshot.id??m.generateRandomId(6),this._initialized=!1,this._cellData=new Y(o),this._rowManager=new Yi(this._snapshot,i),this._columnManager=new zi(this._snapshot,r),this._viewModel=new Wn}__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=m.deepClone(e);return new Nt(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];ct.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(ct.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(c=>ct.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},c)),a=new Y;return _e(e,n,s,r).forEach((c,l)=>{const u=i.getValue(c,l);u&&a.setValue(c,l,u)}),o.forEach(c=>{const{startColumn:l,startRow:u,endColumn:h,endRow:_}=c;_e(u,_,l,h).forEach((d,g)=>{d===u&&g===l&&a.setValue(d,g,{...i.getValue(d,g),rowSpan:_-u+1,colSpan:h-l+1}),(d!==u||g!==l)&&a.realDeleteValue(d,g)})}),a}getRange(e,s,n,r){return typeof e=="object"?new _t(this,e,{getStyles:()=>this._styles}):new _t(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}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 Ki=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&&Ki(e,s,r),r},Qi=(t,e)=>(s,n)=>e(s,n,t);function Zi(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends T{constructor(s={},n){super();f(this,"_sheetCreated$",new N.Subject);f(this,"sheetCreated$",this._sheetCreated$.asObservable());f(this,"_sheetDisposed$",new N.Subject);f(this,"sheetDisposed$",this._sheetDisposed$.asObservable());f(this,"_activeSheet$",new N.BehaviorSubject(null));f(this,"activeSheet$",this._activeSheet$.asObservable());f(this,"_worksheets");f(this,"_styles");f(this,"_snapshot");f(this,"_unitId");f(this,"_count");this._log=n,this._snapshot=m.commonExtend(wn,s);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=m.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Fn(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 m.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(){return this._snapshot.rev??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 Nt(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}:Rt}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 u,h,_,d,g;let n="",r="";if(s.indexOf("!")>-1){const E=s.split("!");n=E[0],r=E[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 E=parseInt(r.replace(/[^0-9]/g,""),10)-1,R=m.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(E)&&!Number.isNaN(R)?{sheetId:n,range:{startRow:E,endRow:E,startColumn:R,endColumn:R}}:Rt}r=r.split(":");const i=[0,0],o=[0,0],a=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((h=this.getActiveSheet())==null?void 0:h.getMaxRows()),c=((_=this.getSheetBySheetName(n))==null?void 0:_.getMaxColumns())||((d=this.getActiveSheet())==null?void 0:d.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]=m.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=m.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=c),o[0]>o[1])?Rt:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.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;m.isEmptyObject(r)&&(r[kt.id]=Object.assign(kt,{status:I.TRUE}));for(const o in r){const a=r[o],{name:c}=a;a.name=this.uniqueSheetName(c),a.name!==c&&this._log.warn(`The worksheet name ${c} is duplicated, we change it to ${a.name}`);const l=new Nt(a,this._styles);n.set(o,l),i.includes(o)||i.push(o)}}};exports.Workbook=qi([Qi(1,it)],exports.Workbook);class xe{constructor(e){f(this,"_snapshot");f(this,"_unitId");this._snapshot={...xn,...e},this._unitId=this._snapshot.id??m.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:Pe.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Vt="FOCUSING_SHEET",fe="FOCUSING_DOC",ge="FOCUSING_SLIDE",Ji="FOCUSING_EDITOR_BUT_HIDDEN",$n="FOCUSING_EDITOR",yi="FOCUSING_EDITOR_INPUT_FORMULA",Gn="FOCUSING_FORMULA_EDITOR";var to=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,so=(t,e,s,n)=>{for(var r=n>1?void 0:n?eo(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&&to(e,s,r),r},no=(t,e)=>(s,n)=>e(s,n,t),kn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(kn||{});const ft=C.createIdentifier("univer.current");let Ee=class extends T{constructor(e,s){super();f(this,"_focused",null);f(this,"_focused$",new N.BehaviorSubject(null));f(this,"focused$",this._focused$.asObservable());f(this,"_currentSheet$",new N.BehaviorSubject(null));f(this,"currentSheet$",this._currentSheet$.asObservable());f(this,"_currentDoc$",new N.BehaviorSubject(null));f(this,"currentDoc$",this._currentDoc$.asObservable());f(this,"_currentSlide$",new N.BehaviorSubject(null));f(this,"currentSlide$",this._currentSlide$.asObservable());f(this,"_sheetAdded$",new N.Subject);f(this,"sheetAdded$",this._sheetAdded$.asObservable());f(this,"_docAdded$",new N.Subject);f(this,"docAdded$",this._docAdded$.asObservable());f(this,"_slideAdded$",new N.Subject);f(this,"slideAdded$",this._slideAdded$.asObservable());f(this,"_sheetDisposed$",new N.Subject);f(this,"sheetDisposed$",this._sheetDisposed$.asObservable());f(this,"_docDisposed$",new N.Subject);f(this,"docDisposed$",this._docDisposed$.asObservable());f(this,"_slideDisposed$",new N.Subject);f(this,"slideDisposed$",this._slideDisposed$.asObservable());f(this,"_sheets",[]);f(this,"_docs",[]);f(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),[fe,Vt,ge].forEach(s=>this._contextService.setContextValue(s,!1)),this._focused instanceof exports.Workbook?this._contextService.setContextValue(Vt,!0):this._focused instanceof dt?this._contextService.setContextValue(fe,!0):this._focused instanceof xe&&this._contextService.setContextValue(ge,!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}};Ee=so([no(1,ht)],Ee);var w=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(w||{});const ro={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Tt=new Map;function pe(t,e){return function(r){Fe(t,e)}}function Fe(t,e){Tt.has(t)||Tt.set(t,[]),Tt.get(t).push(e)}var io=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,Vn=(t,e,s,n)=>{for(var r=n>1?void 0:n?oo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&io(e,s,r),r},Re=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends T{constructor(s){super();f(this,"_lifecycle$",new N.BehaviorSubject(w.Starting));f(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=s,this._reportProgress(w.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 N.Observable(s=>(this.stage===w.Starting||(this.stage===w.Ready?s.next(w.Starting):this.stage===w.Rendered?(s.next(w.Starting),s.next(w.Ready)):(s.next(w.Starting),s.next(w.Ready),s.next(w.Rendered))),this._lifecycle$.subscribe(s)))}_reportProgress(s){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${ro[s]}".`)}};exports.LifecycleService=Vn([Re(0,it)],exports.LifecycleService);let et=class extends T{constructor(e,s){super();f(this,"_started",!1);this._lifecycleService=e,this._injector=s}start(){this._started||(this._started=!0,this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const s=Tt.get(e);s==null||s.forEach(n=>{this._injector.has(n)&&this._injector.get(n)})}};et=Vn([Re(0,C.Inject(exports.LifecycleService)),Re(1,C.Inject(C.Injector))],et);function ao(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 mt extends T{constructor(){super();f(this,"currentLocale",Kt.ZH_CN);f(this,"locales",null);f(this,"localeChanged$",new N.Subject);f(this,"t",s=>{if(!this.locales)throw new Error("Locale not initialized");return ao(this.locales[this.currentLocale],s)??s});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}load(s){this.locales=m.deepMerge(this.locales??{},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 He=C.createIdentifier("resource-manager-service"),jn=C.createIdentifier("ResourcePersistenceService");Fe(w.Ready,jn);var lo=Object.defineProperty,uo=Object.getOwnPropertyDescriptor,co=(t,e,s,n)=>{for(var r=n>1?void 0:n?uo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&lo(e,s,r),r},Ke=(t,e)=>(s,n)=>e(s,n,t);const Be=C.createIdentifier("univer.permission-service"),Xe="PERMISSION";exports.PermissionService=class extends T{constructor(s,n){super();f(this,"_permissionPointMap",new Map);f(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});f(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new N.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});f(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=we.DONE,o.next(a)}});f(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(v(this._univerInstanceService.sheetAdded$.subscribe(s=>{this._resourceManagerService.registerPluginResource(s.getUnitId(),Xe,{onChange:(n,r)=>{r.forEach(i=>{this.getPermissionPoint(n,i.id)?this.updatePermissionPoint(n,i.id,i.value):this.addPermissionPoint(n,i)})},toJson:n=>this._toJson(n),parseJson:n=>this._parseJson(n)})}))),this.disposeWithMe(v(this._univerInstanceService.sheetDisposed$.subscribe(s=>{this._resourceManagerService.disposePluginResource(s.getUnitId(),Xe)})))}_toJson(s){const n=this._permissionPointMap.get(s);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return N.combineLatest(i).pipe(rr.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);return n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}};exports.PermissionService=co([pe(w.Starting,exports.PermissionService),Ke(0,C.Inject(He)),Ke(1,C.Inject(ft))],exports.PermissionService);const zn="univer.editable";class Pt extends Vs{constructor(s){super();f(this,"id",zn);f(this,"value",!0);f(this,"unitID");this.unitID=s}}var ho=Object.defineProperty,_o=Object.getOwnPropertyDescriptor,fo=(t,e,s,n)=>{for(var r=n>1?void 0:n?_o(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&&ho(e,s,r),r},qe=(t,e)=>(s,n)=>e(s,n,t);exports.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 Pt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e){let s=e;s||(s=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Pt(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new Pt(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=fo([pe(w.Starting,exports.UniverPermissionService),qe(0,C.Inject(Be)),qe(1,C.Inject(ft))],exports.UniverPermissionService);class Yn extends T{constructor(){super(...arguments);f(this,"_resourceMap",new Map);f(this,"_register$",new N.Subject);f(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}),v(()=>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 me extends T{constructor(){super();f(this,"_currentTheme");f(this,"_currentTheme$",new N.BehaviorSubject({}));f(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(v(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Kn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Xn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",go=`\r
11
- `;var Eo=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,mo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ro(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&&Eo(e,s,r),r},ne=(t,e)=>(s,n)=>e(s,n,t);const Qt=C.createIdentifier("univer.undo-redo.service"),Oo=20;exports.LocalUndoRedoService=class extends T{constructor(s,n,r){super();f(this,"undoRedoStatus$");f(this,"_undoRedoStatus$",new N.BehaviorSubject({undos:0,redos:0}));f(this,"_undoStacks",new Map);f(this,"_redoStacks",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Qn)),this.disposeWithMe(this._commandService.registerCommand(Zn)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);r.length=0,i.push(s),i.length>Oo&&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;let s="";const n=this._contextService.getContextValue(Vt),r=this._contextService.getContextValue(Gn),i=this._contextService.getContextValue($n);return n?r?s=Xn:i?s=Kn:s=((o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())??"":s=((a=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:a.getUnitId())??"",s}};exports.LocalUndoRedoService=mo([ne(0,ft),ne(1,bt),ne(2,ht)],exports.LocalUndoRedoService);class qn{dispose(){}async dispatchToHandlers(){return!1}}const Qn=new class extends qn{constructor(){super(...arguments);f(this,"type",Yt.COMMAND);f(this,"id","univer.command.undo")}async handler(e){const s=e.get(Qt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(bt);return(n.undo?await n.undo(n.undoMutations):Se(n.undoMutations,r))?(s.popUndoToRedo(),!0):!1}},Zn=new class extends qn{constructor(){super(...arguments);f(this,"type",Yt.COMMAND);f(this,"id","univer.command.redo")}async handler(e){const s=e.get(Qt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(bt);return(n.redo?await n.redo(n.redoMutations):Se(n.redoMutations,r))?(s.popRedoToUndo(),!0):!1}};class Zt extends T{constructor(){super(...arguments);f(this,"_started",!1)}addPlugins(s){if(this._started){const n=s.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,w.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n))}else{const n=s.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(s,n=!1){this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===w.Starting||this._pluginsRunLifecycle(s,r)})))}_pluginsRunLifecycle(s,n){s.forEach(r=>{switch(n){case w.Starting:r.onStarting(this._injector);break;case w.Ready:r.onReady();break;case w.Rendered:r.onRendered();break;case w.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(s,n){return this._injector.createInstance(s,n)}}var Ao=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,Co=(t,e,s,n)=>{for(var r=n>1?void 0:n?Io(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&&Ao(e,s,r),r},re=(t,e)=>(s,n)=>e(s,n,t);exports.UniverDoc=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createDoc(e){return this._injector.createInstance(dt,e)}};exports.UniverDoc=Co([re(0,C.Inject(C.Injector)),re(1,C.Inject(exports.LifecycleService)),re(2,C.Inject(et))],exports.UniverDoc);var So=Object.defineProperty,No=Object.getOwnPropertyDescriptor,bo=(t,e,s,n)=>{for(var r=n>1?void 0:n?No(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&&So(e,s,r),r},ie=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSheet=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSheet(e){return this._injector.createInstance(exports.Workbook,e)}};exports.UniverSheet=bo([ie(0,C.Inject(C.Injector)),ie(1,C.Inject(exports.LifecycleService)),ie(2,C.Inject(et))],exports.UniverSheet);var Lo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,vo=(t,e,s,n)=>{for(var r=n>1?void 0:n?wo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Lo(e,s,r),r},oe=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSlide=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSlide(e){return this._injector.createInstance(xe,e)}};exports.UniverSlide=vo([oe(0,C.Inject(C.Injector)),oe(1,C.Inject(exports.LifecycleService)),oe(2,C.Inject(et))],exports.UniverSlide);const Do=200;class Mo extends Zt{constructor(s={}){super();f(this,"_injector");f(this,"_univerPluginStore",new ar);f(this,"_univerPluginRegistry",new lr);f(this,"_univerSheet",null);f(this,"_univerDoc",null);f(this,"_univerSlide",null);f(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=s;n&&this._injector.get(me).setTheme(n),i&&this._injector.get(mt).load(i),r&&this._injector.get(mt).setLocale(r),o&&this._injector.get(it).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(ft)}get _lifecycleService(){return this._injector.get(exports.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(et)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(s){this._injector.get(mt).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(exports.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(exports.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(exports.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 C.Injector([[ft,{useFactory:s=>new Ee({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},s),deps:[ht]}],[cs],[mt],[me],[exports.LifecycleService],[et],[Be,{useClass:exports.PermissionService}],[exports.UniverPermissionService],[it,{useClass:ls,lazy:!0}],[bt,{useClass:exports.CommandService,lazy:!0}],[Qt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[us,{useClass:Ar}],[ht,{useClass:os}],[ds,{useClass:hs,lazy:!0}],[He,{useClass:Yn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(et).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<w.Ready&&(this._injector.get(exports.LifecycleService).stage=w.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(),Do))}_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 Uo(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}class To extends zt{add(e){if(!e)return null;const s=new jt(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Po=C.createIdentifier("ILocalStorageService"),Oe=`'?\\[((?![\\/?:"<>|*\\\\]).)*?\\]`,xo=/[^0-9]/g,po=/[^A-Za-z]/g;function Ct(t){const e=t[0]==="$",n=t.substring(1).indexOf("$")>-1;return e&&n?V.ALL:e?V.COLUMN:n?V.ROW:V.NONE}function Fo(t){const e=t.split("!");e.length>1&&(t=e[e.length-1]);const s=t.split(":");return s.length>1?{startAbsoluteRefType:Ct(s[0]),endAbsoluteRefType:Ct(s[1])}:{startAbsoluteRefType:Ct(s[0])}}function Qe(t=V.NONE){let e="",s="";return t===V.ROW?e="$":t===V.COLUMN?s="$":t===V.ALL&&(e="$",s="$"),{rowAbsoluteString:e,columnAbsoluteString:s}}function Jt(t){const{startColumn:e,startRow:s,endColumn:n,endRow:r,startAbsoluteRefType:i,endAbsoluteRefType:o,rangeType:a=F.NORMAL}=t,c=Qe(i),l=Qe(o);if(a===F.ROW||a===F.ALL){const _=`${c.rowAbsoluteString}${s+1}`,d=`${l.rowAbsoluteString}${r+1}`;return`${_}:${d}`}if(a===F.COLUMN){const _=`${c.columnAbsoluteString}${m.chatAtABC(e)}`,d=`${l.columnAbsoluteString}${m.chatAtABC(n)}`;return`${_}:${d}`}const u=`${c.columnAbsoluteString}${m.chatAtABC(e)}${c.rowAbsoluteString}${s+1}`,h=`${l.columnAbsoluteString}${m.chatAtABC(n)}${l.rowAbsoluteString}${r+1}`;return u===h?u:`${u}:${h}`}function Jn(t,e){return`${t}!${Jt(e)}`}function yn(t,e,s){return`[${t}]${e}!${Jt(s)}`}function Ho(t){const{unitId:e,sheetName:s,range:n}=t;return e!=null&&e.length>0&&s!=null&&s.length>0?yn(e,s,n):s!=null&&s.length>0?Jn(s,n):Jt(n)}function ae(t){const e=parseInt(t.replace(xo,""))-1,s=m.ABCatNum(t.replace(po,"")),n=Ct(t);return{row:e,column:s,absoluteRefType:n}}function tr(t){const e=new RegExp(Oe).exec(t);let s="";e!=null&&(s=e[0].trim(),s=s.slice(1,s.length-1),t=t.replace(new RegExp(Oe),""));const n=t.indexOf("!");let r="",i="";return n>-1?(r=t.substring(0,n),r[0]==="'"&&r[r.length-1]==="'"&&(r=r.substring(1,r.length-1)),i=t.substring(n)):i=t,{refBody:i,sheetName:r,unitId:s}}function Bo(t){const{refBody:e,sheetName:s,unitId:n}=tr(t),r=e.indexOf(":");if(r===-1){const d=ae(e),g=d.row,E=d.column,R=d.absoluteRefType;return{unitId:n,sheetName:s,range:{startRow:g,startColumn:E,endRow:g,endColumn:E,startAbsoluteRefType:R,endAbsoluteRefType:R}}}const i=e.substring(0,r),o=e.substring(r+1),a=ae(i),c=ae(o),l=a.row,u=a.column,h=c.row,_=c.column;return{unitId:n,sheetName:s,range:{startRow:l,startColumn:u,endRow:h,endColumn:_,startAbsoluteRefType:a.absoluteRefType,endAbsoluteRefType:c.absoluteRefType}}}const Ze=/[\[\]]/g;function Je(t,e){if(Ze.test(t)){const s=Number(t.replace(Ze,""));return e+s}return Number(t)-1}function le(t,e=0,s=0){t=t.toLocaleUpperCase();const n=t.split(/[RC]/),r=n[1],i=n[2],o=Je(r,e),a=Je(i,s);return{row:o,column:a,absoluteRefType:V.NONE}}function Wo(t,e=0,s=0){const{refBody:n,sheetName:r,unitId:i}=tr(t),o=n.indexOf(":");if(o===-1){const E=le(n,e,s),R=E.row,O=E.column,A=E.absoluteRefType;return{unitId:i,sheetName:r,range:{startRow:R,startColumn:O,endRow:R,endColumn:O,startAbsoluteRefType:A,endAbsoluteRefType:A}}}const a=n.substring(0,o),c=n.substring(o+1),l=le(a,e,s),u=le(c,e,s),h=l.row,_=l.column,d=u.row,g=u.column;return{unitId:i,sheetName:r,range:{startRow:h,startColumn:_,endRow:d,endColumn:g,startAbsoluteRefType:l.absoluteRefType,endAbsoluteRefType:u.absoluteRefType}}}const $o=t=>`sheet_interceptor_${t}`,er=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 Go{constructor(e){f(this,"_interceptorsByName",new Map);f(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return er(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)=>(o.priority??0)-(i.priority??0))),()=>tt(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}ir();exports.ABCToNumber=mi;exports.AbsoluteRefType=V;exports.AlignTypeH=Sn;exports.AlignTypeV=Nn;exports.AutoFillSeries=Es;exports.BaselineOffset=Ft;exports.BlockType=rn;exports.BooleanNumber=I;exports.BorderStyleTypes=b;exports.BorderType=Rs;exports.BulletAlignment=Z;exports.COLORS=ue;exports.CellValueType=At;exports.Color=ot;exports.ColorBuilder=qt;exports.ColorKit=k;exports.ColorType=$;exports.ColumnSeparatorType=ln;exports.CommandType=Yt;exports.CommonHideTypes=ms;exports.ConditionType=Os;exports.ContentAlignment=mn;exports.ContextService=os;exports.CopyPasteType=As;exports.CustomRangeType=nn;exports.DEFAULT_CELL=$i;exports.DEFAULT_DOC=Te;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Ir;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=go;exports.DEFAULT_RANGE=Bi;exports.DEFAULT_RANGE_ARRAY=Rt;exports.DEFAULT_SELECTION=Wi;exports.DEFAULT_SLIDE=xn;exports.DEFAULT_STYLES=Ut;exports.DEFAULT_WORKBOOK=wn;exports.DEFAULT_WORKSHEET=kt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Dn;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Pn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Un;exports.DEFAULT_WORKSHEET_ROW_COUNT=vn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Mn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Tn;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Xn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Kn;exports.DashStyleType=gn;exports.DataStreamTreeNodeType=Ys;exports.DataStreamTreeTokenType=ve;exports.DesktopLogService=ls;exports.DeveloperMetadataVisibility=Is;exports.Dimension=Cs;exports.Direction=Ss;exports.Disposable=T;exports.DisposableCollection=Ce;exports.DocStyleType=en;exports.DocumentDataModel=dt;exports.EXTENSION_NAMES=pn;exports.Entry=he;exports.EntryIterator=Gs;exports.ErrorService=cs;exports.EventState=rs;exports.FOCUSING_DOC=fe;exports.FOCUSING_EDITOR=$n;exports.FOCUSING_EDITOR_BUT_HIDDEN=Ji;exports.FOCUSING_EDITOR_INPUT_FORMULA=yi;exports.FOCUSING_FORMULA_EDITOR=Gn;exports.FOCUSING_SHEET=Vt;exports.FOCUSING_SLIDE=ge;exports.FloatingObjectManagerService=hs;exports.FollowNumberWithType=sn;exports.FontItalic=xt;exports.FontStyleType=On;exports.FontWeight=pt;exports.FormatType=Ns;exports.GlyphType=It;exports.GridType=on;exports.HLSColor=Us;exports.HorizontalAlign=rt;exports.ICommandService=bt;exports.IConfigService=us;exports.IContextService=ht;exports.IFloatingObjectManagerService=ds;exports.ILocalStorageService=Po;exports.ILogService=it;exports.IPermissionService=Be;exports.IResourceManagerService=He;exports.ISnapshotPersistenceService=jn;exports.IUndoRedoService=Qt;exports.IUniverInstanceService=ft;exports.InterceptorManager=Go;exports.InterpolationPointType=bs;exports.KeyIterator=Ws;exports.LRUHelper=Et;exports.LRUMap=ks;exports.LifecycleStages=w;exports.LocaleService=mt;exports.LocaleType=Kt;exports.LogLevel=as;exports.MemoryCursor=_s;exports.NamedStyleType=_n;exports.NumberUnitType=Cn;exports.ObjectMatrix=Y;exports.ObjectRelativeFromH=An;exports.ObjectRelativeFromV=In;exports.Observable=zt;exports.ObservableHooks=To;exports.Observer=jt;exports.OnLifecycle=pe;exports.PRESET_LIST_TYPE=vi;exports.PageElementType=Hn;exports.PageOrientType=Ln;exports.PageType=Pe;exports.ParagraphElementType=cn;exports.PermissionPoint=Vs;exports.PermissionStatus=we;exports.Plugin=ye;exports.PluginType=D;exports.PositionedObjectLayoutType=dn;exports.PresetListType=Gt;exports.ProtectionType=Ls;exports.RANGE_TYPE=F;exports.RGBA_PAREN=Lr;exports.RGB_PAREN=br;exports.Range=_t;exports.Rectangle=ct;exports.RedoCommand=Zn;exports.RefAlias=Ri;exports.Registry=Ae;exports.RegistryAsMap=Ie;exports.RelativeDate=ws;exports.RelativeSlideLink=Bn;exports.ResourceManagerService=Yn;exports.RgbColor=Ht;exports.RxDisposable=_r;exports.SectionType=an;exports.ShapeType=vs;exports.SheetTypes=Ne;exports.SheetViewModel=Wn;exports.Slide=xe;exports.SpacingRule=fn;exports.Styles=Fn;exports.THEME_COLORS=Ms;exports.TabStopAlignment=En;exports.TextDecoration=Ds;exports.TextDirection=St;exports.TextDirectionType=un;exports.ThemeColor=Bt;exports.ThemeColorType=p;exports.ThemeColors=Xt;exports.ThemeService=me;exports.Tools=m;exports.UNIT_NAME_REGEX=Oe;exports.UndoCommand=Qn;exports.Univer=Mo;exports.UniverEditablePermission=Pt;exports.UniverEditablePermissionPoint=zn;exports.UniverInstanceType=kn;exports.UpdateDocsAttributeType=P;exports.ValueIterator=$s;exports.VerticalAlign=lt;exports.WidthType=Rn;exports.Worksheet=Nt;exports.WrapStrategy=ut;exports.WrapTextType=hn;exports.binarySearchArray=fs;exports.characterSpacingControlType=bn;exports.checkParagraphHasBullet=Qr;exports.checkParagraphHasIndent=Zr;exports.checkParagraphHasIndentByStyle=xs;exports.codeToBlob=Sr;exports.composeInterceptors=er;exports.concatMatrixArray=hi;exports.createInterceptorKey=$o;exports.createRowColIter=_e;exports.datenum_local=Bs;exports.dedupe=ur;exports.deepCompare=be;exports.deleteContent=Fs;exports.deserializeRangeForR1C1=Wo;exports.deserializeRangeWithSheet=Bo;exports.error=ce;exports.fromObservable=dr;exports.generate=oi;exports.getAbsoluteRefTypeWitString=Fo;exports.getAbsoluteRefTypeWithSingleString=Ct;exports.getArrayLength=j;exports.getBorderStyleType=Xr;exports.getCellValueType=ki;exports.getColorStyle=z;exports.getDocsUpdateBody=Mt;exports.getReverseDirection=Nr;exports.getTypeFromPermissionItemList=gi;exports.getWorksheetUID=Zi;exports.handleJsonToDom=Yr;exports.handleStyleToString=Kr;exports.hashAlgorithm=li;exports.horizontalLineSegmentsSubtraction=Le;exports.insertMatrixArray=ui;exports.insertTextToContent=ps;exports.isCellV=ji;exports.isEmptyCell=Vr;exports.isFormulaId=zr;exports.isFormulaString=jr;exports.isICellData=Gi;exports.isNullCell=Vi;exports.isObserver=is;exports.isRealNum=nt;exports.isSameStyleTextRun=Ps;exports.isValidRange=qr;exports.makeCellRangeToRangeData=kr;exports.makeCellToSelection=Gr;exports.moveMatrixArray=de;exports.normalizeTextRuns=De;exports.numberToABC=Ai;exports.numberToListABC=Ii;exports.orderSearchArray=gs;exports.remove=tt;exports.repeatStringNumTimes=zs;exports.requestImmediateMacroTask=Uo;exports.runOnLifecycle=Fe;exports.searchArray=Cr;exports.selectionToArray=Ei;exports.sequence=es;exports.sequenceAsync=ts;exports.sequenceExecute=Se;exports.sequenceExecuteAsync=Or;exports.serializeRange=Jt;exports.serializeRangeToRefString=Ho;exports.serializeRangeWithSheet=Jn;exports.serializeRangeWithSpreadsheet=yn;exports.sliceMatrixArray=di;exports.sortRules=Ci;exports.sortRulesByDesc=Si;exports.sortRulesFactory=gt;exports.spliceArray=ci;exports.toDisposable=v;exports.update=ai;
3
+ `):"",this.name="UnsubscriptionError",this.errors=s}});function Ue(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var Ge=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=we(o),l=a.next();!l.done;l=a.next()){var h=l.value;h.remove(this)}}catch(R){e={error:R}}finally{try{l&&!l.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(ut(u))try{u()}catch(R){i=R instanceof Gt?R.errors:[R]}var _=this._finalizers;if(_){this._finalizers=null;try{for(var d=we(_),f=d.next();!f.done;f=d.next()){var E=f.value;try{Te(E)}catch(R){i=i!=null?i:[],R instanceof Gt?i=De(De([],be(i)),be(R.errors)):i.push(R)}}}catch(R){n={error:R}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(i)throw new Gt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)Te(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)&&Ue(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&Ue(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Ge.EMPTY;function $e(t){return t instanceof Ge||t&&"closed"in t&&ut(t.remove)&&ut(t.add)&&ut(t.unsubscribe)}function Te(t){ut(t)?t():t.unsubscribe()}class ke{constructor(e=!1){c(this,"skipNextObservers");c(this,"lastReturnValue");c(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function Ve(t){return t instanceof Mt}class Mt{constructor(e,s){c(this,"_willBeUnregistered",!1);c(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class Pt{constructor(e){c(this,"_observers",new Array);c(this,"_eventState");c(this,"_onObserverAdded");this._eventState=new ke,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new Mt(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 Pt;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 $e(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:Ve(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function qn(t){return L(()=>{t.unsubscribe()})}class le{constructor(){c(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(){c(this,"_disposed",!1);c(this,"_collection",new le)}disposeWithMe(e){const s=$e(e)?L(e):e;return this._collection.add(s)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Qn extends T{constructor(){super(...arguments);c(this,"dispose$",new A.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const tt=I.createIdentifier("univer.context-service");class je extends T{constructor(){super(...arguments);c(this,"_contextChanged$",new A.Subject);c(this,"contextChanged$",this._contextChanged$.asObservable());c(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){var n;return(n=this._contextMap.get(s))!=null?n:!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next({[s]:n})}subscribeContextValue$(s){return new A.Observable(n=>{const r=this._contextChanged$.pipe(A.filter(i=>typeof i[s]<"u")).subscribe(i=>n.next(i[s]));return this._contextMap.has(s)&&n.next(this._contextMap.get(s)),()=>r.unsubscribe()})}}var 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 q=I.createIdentifier("univer.log");class Ke extends T{constructor(){super(...arguments);c(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 Jn=Object.defineProperty,Zn=Object.getOwnPropertyDescriptor,yn=(t,e,s,n)=>{for(var r=n>1?void 0:n?Zn(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&&Jn(e,s,r),r},Me=(t,e)=>(s,n)=>e(s,n,t),xt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(xt||{});const ft=I.createIdentifier("anywhere.command-service");class tr{constructor(){c(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}}exports.CommandService=class{constructor(e,s){c(this,"_commandRegistry");c(this,"_beforeCommandExecutionListeners",[]);c(this,"_commandExecutedListeners",[]);c(this,"_multiCommandDisposables",new Map);c(this,"_commandExecutingLevel",0);c(this,"_commandExecutionStack",[]);this._injector=e,this._logService=s,this._commandRegistry=new tr,this._registerCommand(ze)}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(h=>h(o,n));const l=await this._execute(i,s);return this._commandExecutedListeners.forEach(h=>h(o,n)),a.dispose(),l}throw new Error(`[CommandService]: command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){var i;const r=this._commandRegistry.getCommand(e);if(r){const[o]=r,a={id:o.id,type:o.type,params:s};if(o.type===2){const u=zn(this._commandExecutionStack,_=>_.type===0);u&&(a.params=(i=a.params)!=null?i:{},a.params.trigger=u.id)}const l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(u=>u(a,n));const h=this._syncExecute(o,s);return this._commandExecutedListeners.forEach(u=>u(a,n)),l.dispose(),h}throw new Error(`[CommandService]: command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),L(()=>K(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 le;n=new er(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}};exports.CommandService=yn([Me(0,I.Inject(I.Injector)),Me(1,q)],exports.CommandService);class er{constructor(e){c(this,"name");c(this,"multi",!0);c(this,"type",0);c(this,"priority",0);c(this,"_implementations",[]);c(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(q),r=e.get(tt),i=e.get(I.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 ue(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return Be(n)}function sr(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return We(n)}const ze={id:"nil",type:0,handler:()=>!0},Xe=I.createIdentifier("univer.config-service");class nr{constructor(){c(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 qe extends T{constructor(){super(...arguments);c(this,"_error$",new A.Subject);c(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const rr="__default_document_sub_component_id20231101__";class Qe{constructor(){c(this,"_managerInfo",new Map);c(this,"_remove$",new A.Subject);c(this,"remove$",this._remove$.asObservable());c(this,"_andOrUpdate$",new A.Subject);c(this,"andOrUpdate$",this._andOrUpdate$.asObservable());c(this,"_pluginUpdate$",new A.Subject);c(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 Je=I.createIdentifier("univer.floating-object.service");class Ze{constructor(){c(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function ye(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function ts(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 ir(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=ts(t,e):s=ye(t,e),s)}function or(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var es=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(es||{}),N=(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))(N||{}),ss=(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))(ss||{}),p=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(p||{}),ns=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(ns||{}),rs=(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))(rs||{}),is=(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))(is||{}),os=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(os||{}),as=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(as||{}),ls=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(ls||{});function ar(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var us=(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))(us||{}),cs=(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))(cs||{}),pt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(pt||{}),hs=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(hs||{}),_s=(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))(_s||{}),ds=(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))(ds||{}),ce=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(ce||{}),_t=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(_t||{}),fs=(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))(fs||{}),X=(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))(X||{}),J=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(J||{}),Z=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(Z||{}),Nt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Nt||{}),St=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(St||{}),Lt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(Lt||{}),m=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(m||{}),ct=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(ct||{}),M=(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))(M||{}),Ft=(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))(Ft||{});const gs={[Ft.OFFICE]:{[M.ACCENT1]:"#4472C4",[M.ACCENT2]:"#ED7D31",[M.ACCENT3]:"#A5A5A5",[M.ACCENT4]:"#70AD47",[M.ACCENT5]:"#5B9BD5",[M.ACCENT6]:"#70AD47",[M.DARK1]:"#000000",[M.DARK2]:"#44546A",[M.LIGHT1]:"#FFFFFF",[M.LIGHT2]:"#E7E6E6",[M.HYPERLINK]:"#0563C1",[M.FOLLOWED_HYPERLINK]:"#954F72"}};class Ht{constructor(){c(this,"_themeValue",M.LIGHT1);c(this,"_themeColors");c(this,"_themeTint");c(this,"_rgbValue","");c(this,"_colorType");this._colorType=p.UNSUPPORTED,this._themeColors=Ft.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 p.THEME:return this.asThemeColor();case p.RGB:return this.asRgbColor();case p.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(e){return this._colorType=p.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=p.THEME,this._themeColors=e}setThemeTint(e){this._colorType=p.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=p.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class Q{constructor(e){c(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 Ht().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(i,o,a,l)=>o+o+a+a+l+l);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),a=Number.parseInt(n[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new Q(this._builder)}equals(e){return!1}}class Es{constructor(e){c(this,"_saturation",0);c(this,"_hue",0);c(this,"_lightness",0);c(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),a=Math.max(s,Math.max(n,r)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),s===a&&(this._hue=(n-r)/l),n===a&&(this._hue=2+(r-s)/l),r===a&&(this._hue=4+(s-n)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Ht;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),a=this.setColor(s,n,r),l=r-1/3,h=this.setColor(s,n,l);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(h*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 x=class x extends Q{constructor(s,n){super(n);c(this,"_cssString");c(this,"_red");c(this,"_green");c(this,"_blue");c(this,"_alpha");let r=s.match(x.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],l=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(r=s.match(x.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 Q.rgbColorToHexValue(this)}getRed(){let s=this._red+x.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+x.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+x.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getAlpha(){return this._alpha}getColorType(){return p.RGB}clone(){return new x(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(s){return s instanceof x?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._alpha===this._alpha:!1}getCssString(){return this._cssString}};c(x,"RGB_COLOR_AMT",0),c(x,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),c(x,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let vt=x;const j=class j extends Q{constructor(s,n,r,i){super(i);c(this,"_themeColorType");c(this,"_themeTint");c(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=gs[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(j._cacheThemeColor.has(this._themeColors)){if(r=j._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,j._cacheThemeColor.set(this._themeColors,r);const i=new Es(Q.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 j(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(s){return s instanceof j?s._themeColorType===this._themeColorType:!1}getColorType(){return p.THEME}getThemeColorType(){return this._themeColorType}};c(j,"_cacheThemeColor",new Map);let wt=j;const lr="rgb(",ur="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 F{constructor(e){c(this,"_color");c(this,"_rgbColor");c(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof F){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=Rs(e);if(s==null){this._setNullColor();return}this._color=s;const n=fr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){var h,u;n=Math.min(1,Math.max(0,n));const r=new F(e).toRgb(),i=new F(s).toRgb(),o=(h=r.a)!=null?h:1,a=(u=i.a)!=null?u:1,l={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(a-o)*n+o};return new F(l)}static getContrastRatio(e,s){const n=new F(e).getLuminance(),r=new F(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=[Et(Math.round(s).toString(16)),Et(Math.round(n).toString(16)),Et(Math.round(r).toString(16)),Et(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 mr(this.toRgb())}toHsl(){return Rr(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new F(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new F(s)}setAlpha(e){return new F({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=$t(e),s=$t(s),n=$t(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 Et=t=>t.length===1?`0${t}`:t,$t=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Rs=t=>{if(Ir(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 cr(e);if(e.startsWith("rgb"))return hr(e);if(e.startsWith("hsl"))return _r(e);if(e.startsWith("hsv"))return dr(e)},cr=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},hr=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},_r=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},dr=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},fr=t=>{const e=Rs(t);if(e!=null)return"r"in e?e:"l"in e?gr(e):Er(e)},kt=(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),gr=t=>{let{h:e,s,l:n}=t;e/=360,s/=100,n/=100;let r=0,i=0,o=0;if(s===0)r=i=o=n;else{const l=n<.5?n*(1+s):n+s-n*s,h=2*n-l;r=kt(h,l,e+1/3),i=kt(h,l,e),o=kt(h,l,e-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},Er=t=>{let{h:e,s,v:n}=t;e=e/360*6,s/=100,n/=100;const r=Math.floor(e),i=e-r,o=n*(1-s),a=n*(1-i*s),l=n*(1-(1-i)*s),h=r%6,u=[n,a,o,o,l,n][h],_=[l,n,n,a,o,o][h],d=[o,o,l,n,n,a][h],f={r:u*255,g:_*255,b:d*255};return t.a!==void 0&&(f.a=t.a),f},Rr=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n),o=(r+i)/2;let a,l;if(r===i)a=l=0;else{const u=r-i;switch(l=o>.5?u/(2-r-i):u/(r+i),r){case e:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-e)/u+2;break;default:a=(e-s)/u+4;break}a/=6}const h={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},mr=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n);let o;const a=r,l=r-i,h=r===0?0:l/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/l+(s<n?6:0);break;case s:o=(n-e)/l+2;break;default:o=(e-s)/l+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(h*100),v:Math.round(a*100)};return t.a!==void 0&&(u.a=t.a),u},Or=t=>t==null,Ir=t=>!Or(t)&&typeof t=="object";var U=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(U||{});let Ar=(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 Cr=/^-ms-/,Nr=/-([a-z])/g,k=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class g{static stringAt(e){let s="",n=e;for(;n>=k.length;)n/=k.length,n-=1,s+=k[n%k.length];const r=e%k.length;return s+=k[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+=k.length**i+k.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return g.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,l=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const u=parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":s?"Opera":a?"Safari":l?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Ar(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.forEach(o=>o&&i(o));function n(o,a){o.forEach((l,h)=>{var u,_;if(g.isArray(l)){const d=(u=a[h])!=null?u:[];a[h]=d,n(l,d);return}if(g.isObject(l)){const d=(_=a[h])!=null?_:{};a[h]=d,r(l,d);return}a[h]=l})}function r(o,a){Object.keys(o).forEach(l=>{var u,_;const h=o[l];if(g.isObject(h)){const d=(u=a[l])!=null?u:{};a[l]=d,r(h,d);return}if(g.isArray(h)){const d=(_=a[l])!=null?_:[];a[l]=d,n(h,d);return}a[l]=h})}function i(o){Object.keys(o).forEach(a=>{var h,u;const l=o[a];if(g.isArray(l)){const _=(h=e[a])!=null?h:[];e[a]=_,n(l,_);return}if(g.isObject(l)){const _=(u=e[a])!=null?u:{};e[a]=_,r(l,_);return}e[a]=l})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){function n(o,a){const l=g.getValueType(o),h=g.getValueType(a);return l!==h?!1:g.isArray(o)?r(o,a):g.isObject(o)?i(o,a):g.isDate(o)?o.getTime()===a.getTime():g.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(e.length!==s.length)return!1;for(let l=0,h=o.length;l<h;l++){const u=o[l],_=a[l];if(!n(u,_))return!1}return!0}function i(o,a){const l=Object.keys(o),h=Object.keys(a);if(l.length!==h.length)return!1;for(const u of l){if(!h.includes(u))return!1;const _=o[u],d=a[u];if(!n(_,d))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]=g.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=g.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 g.isDefine(e)?g.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(Cr,"ms-").replace(Nr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:g.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 Sr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:l,endX:h}=t,u=e,_=s,d=e,f=s;if(n&&i){const{startRow:E,startColumn:R,endRow:v,endColumn:w,startY:H,endY:$,startX:it,endX:Wn}=i;u=E,_=R,d=v,f=w,o=H,a=$,l=it,h=Wn}return r&&(o=i.startY,a=i.endY,l=i.startX,h=i.endX,d=i.endRow,f=i.endColumn),{startRow:u,startColumn:_,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:h}}function Lr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:l}=t;let h=e,u=s,_=e,d=s;return(n||r)&&(h=i,u=o,_=a,d=l),{startRow:h,startColumn:u,endRow:_,endColumn:d}}function vr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function W(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Ht().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function wr(t){return g.isString(t)&&t.substring(0,1)==="="&&t.length>1}function br(t){return g.isString(t)&&t.indexOf("=")===-1&&t.length===6}function Dr(t){return""}function Ur(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: ${W(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: ${W(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: ${W(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${W(t.bg)}; `)}],["bd",()=>{var o,a,l,h,u,_,d,f,E,R,v,w;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${Rt((a=t.bd)==null?void 0:a.b.s)} ${(l=W(t.bd.b.cl))!=null?l:""}; `),(h=t.bd)!=null&&h.t&&(s+=`border-top: ${Rt((u=t.bd)==null?void 0:u.t.s)} ${(_=W(t.bd.t.cl))!=null?_:""}; `),(d=t.bd)!=null&&d.r&&(s+=`border-right: ${Rt((f=t.bd)==null?void 0:f.r.s)} ${(E=W(t.bd.r.cl))!=null?E:""}; `),(R=t.bd)!=null&&R.l&&(s+=`border-left: ${Rt((v=t.bd)==null?void 0:v.l.s)} ${(w=W(t.bd.l.cl))!=null?w:""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${W(t.cl)}; `)}],["va",()=>{t.va===Lt.SUBSCRIPT?s+="vertical-align: sub; ":t.va===Lt.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,l;t.tr&&(s+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(l=t.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{t.ht===X.LEFT?s+="text-align: left; ":t.ht===X.RIGHT?s+="text-align: right; ":t.ht===X.CENTER?s+="text-align: center; ":t.ht===X.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===J.BOTTOM?s+="vertical-align: bottom; ":t.vt===J.TOP?s+="vertical-align: top; ":t.vt===J.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===Z.CLIP?s+="text-overflow: clip; ":t.tb===Z.OVERFLOW?s+="text-break: overflow; ":t.tb===Z.WRAP&&(s+="word-wrap: break-word;")}],["pd",()=>{var u,_,d,f,E,R,v,w;const o=`${(u=t.pd)==null?void 0:u.b}pt`,a=`${(_=t.pd)==null?void 0:_.t}pt`,l=`${(d=t.pd)==null?void 0:d.l}pt`,h=`${(f=t.pd)==null?void 0:f.r}pt`;(E=t.pd)!=null&&E.b&&(s+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(s+=`padding-top: ${a}; `),(v=t.pd)!=null&&v.l&&(s+=`padding-left: ${l}; `),(w=t.pd)!=null&&w.r&&(s+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function Rt(t){let e="";return t===N.NONE?e="none":t===N.THIN?e="0.5pt solid":t===N.HAIR?e="0.5pt double":t===N.DOTTED?e="0.5pt dotted":t===N.DASHED||t===N.DASH_DOT?e="0.5pt dashed":t===N.DASH_DOT_DOT?e="0.5pt dotted":t===N.DOUBLE?e="0.5pt double":t===N.MEDIUM?e="1pt solid":t===N.MEDIUM_DASHED||t===N.MEDIUM_DASH_DOT?e="1pt dashed":t===N.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===N.SLANT_DASH_DOT?e="0.5pt dashed":t===N.THICK&&(e="1.5pt solid"),e}function Tr(t){let e=0;if(t=t.trim(),t==="none")e=N.NONE;else if(t==="0.5pt solid")e=N.THIN;else if(t==="0.5pt double")e=N.HAIR;else if(t==="0.5pt dotted")e=N.DOTTED;else if(t==="0.5pt dashed")e=N.DASHED;else if(t==="1pt solid")e=N.MEDIUM;else if(t==="1pt dashed")e=N.MEDIUM_DASHED;else if(t==="1pt dotted")e=N.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=N.THICK;else return N.NONE;return e}function Ot(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 Mr(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=t;return!(e<0||n<0||s<0||r<0)}function he(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=>he(t[s],e[s])):t===e:!1}function ms(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:he(s,n)}function _e(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 Pr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function xr(t){if(t==null)return!1;const e=t.paragraphStyle;return Os(e)}function Os(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Is(t,e,s){return t.slice(0,e)+s+t.slice(e)}function As(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 ot{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 C=Symbol("newer"),D=Symbol("older");class Cs{constructor(e){c(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[C],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Ns{constructor(e){c(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[C],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Ss{constructor(e){c(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[C],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var uo,co;class Xt{constructor(e,s){c(this,"key");c(this,"value");c(this,uo);c(this,co);this.key=e,this.value=s,this[C]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}uo=C,co=D;class Ls{constructor(...e){c(this,"_keymap");c(this,"size",0);c(this,"limit");c(this,"oldest");c(this,"newest");c(this,"_onShiftListeners",[]);if(ot.hasLength(e,1)){if(ot.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(ot.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(ot.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(()=>K(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[C]&&(e===this.oldest&&(this.oldest=e[C]),e[C][D]=e[D]),e[D]&&(e[D][C]=e[C]),e[C]=void 0,e[D]=this.newest,this.newest&&(this.newest[C]=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 Xt(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[C]=o,o[D]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new Xt(e,s)),this.newest?(this.newest[C]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[C]?(this.oldest=this.oldest[C],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),e[C]=e[D]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[C]&&s[D]?(s[D][C]=s[C],s[C][D]=s[D]):s[C]?(s[C][D]=void 0,this.oldest=s[C]):s[D]?(s[D][C]=void 0,this.newest=s[D]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Cs(this.oldest)}values(){return new Ns(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Ss(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[C]}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[C];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[C],s&&(e+=" < ");return e}}function G(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 qt(t,e,s){const n=G(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function Qt(t,e,s,n){const r=t+e,i=G(s),o=s;let a=0;const l={};for(let d=t;d<r;d++){const f=o[d];f!==void 0&&(delete o[d],l[a]=f,a++)}const h=n?G(n):0,u=t-r+h,_=i;if(u>0)for(let d=_-1;d>=r;d--)o[d]!==void 0&&(o[d+u]=o[d],delete o[d]);else if(u<0)for(let d=r;d<_;d++)o[d]!==void 0&&(o[d+u]=o[d],delete o[d]);if(n)for(let d=0;d<h;d++)o[t+d]=n[d];return l}function Hr(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,o=Object.keys(i),a=o.length,l={};let h=0;for(let u=0;u<r;u++,h++){const _=n[u];l[h]=s[_]}for(let u=0;u<a;u++,h++){const _=o[u];l[h]=i[_]}return l}function Wr(t,e,s){const n=s;if(G(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 Jt(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 B{constructor(e={}){c(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new B({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,o)===!1)return this}return this}forRow(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(!o)continue;const a=Object.keys(o);for(const l of a){const h=Number(l),u=o[Number(l)];if(e(i,h,u)===!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){Jt(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{Jt(e,s,n,i)})}insertRows(e,s){for(let n=e;n<e+s;n++)qt(n,{},this._matrix)}insertColumns(e,s){for(let n=e;n<e+s;n++)this.forEach((r,i)=>{qt(n,void 0,i)})}removeRows(e,s){Qt(e,s,this._matrix)}removeColumns(e,s){this.forEach((n,r)=>{Qt(e,s,r)})}getFragment(e,s,n,r){const i=new B;let o=0;for(let a=e;a<=s;a++){const l={};let h=0;for(let u=n;u<=r;u++){const _=this.getValue(a,u);l[h]=_,h++}i.setRow(o,l),o++}return i}getSlice(e,s,n,r){const i=new B;for(let o=e;o<=s;o++)for(let a=n;a<=r;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,g.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return G(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=G(a)-1;r=l>r?l:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((s,n)=>{e[s]==null&&(e[s]=[]),n.forEach(r=>{e[s][r]=this.getValue(s,r)})}),e}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 B;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(l=>{const h=Number(l);r?h<s&&(s=h):(r=!0,s=h);const u=this.getValue(o,h);i.setValue(o-e,h-s,u)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,l)=>{i||(i=!0,e=a);const h=G(l)-1;h>n&&(n=h),Object.keys(l).forEach(u=>{const _=Number(u);o?_<s&&(s=_):(o=!0,s=_)}),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 de=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(de||{});class vs{constructor(){c(this,"status","init")}}const $r=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done";var P=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(P||{}),ws=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(ws||{});function kr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const Y=class Y{static clone(e){return e.rangeType!==void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}static equals(e,s){return e==null||s==null?!1:e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===P.NORMAL||s.rangeType===void 0&&e.rangeType===P.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,h=s.startColumn,u=s.endColumn,_=Math.abs(i+o-h-u),d=Math.abs(i-o)+Math.abs(h-u),f=Math.abs(n+r-a-l),E=Math.abs(n-r)+Math.abs(a-l);return _<=d&&f<=E}static getIntersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,l=s.endRow,h=s.startColumn,u=s.endColumn;let _,d,f,E;if(a<=r)a>=n?d=a:d=n;else return null;if(l>=n)l>=r?E=r:E=l;else return null;if(h<=o)h>i?_=h:_=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:d,endRow:E,startColumn:_,endColumn:f,rangeType:P.NORMAL}}static contains(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return Y.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:P.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}};c(Y,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),c(Y,"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})),c(Y,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),c(Y,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),c(Y,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let y=Y;class Vr{constructor(e,s){c(this,"_values",[]);c(this,"_keys",[]);c(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 Zt(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 jr(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 bt=65,bs=90,Yr=97;function Kr(t){const e=bs-bt+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+bt)+s,t=Math.floor(t/e)-1;return s}function Ds(t,e){let s="";for(;e>0;)s+=t,e--;return s}function zr(t,e=!1){const s=bs-bt+1;let n=Yr;e&&(n=bt);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return Ds(r,i)}function Xr(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function qr(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function rt(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}var Us=(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))(Us||{}),fe=(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))(fe||{});function ge(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||g.isEmptyObject(i)&&s.sId==null)continue;if(e.length===0){e.push(s);continue}const o=e.pop();ms(s,o)&&g.hasIntersectionBetweenTwoRanges(o.st,o.ed,s.st,s.ed)?e.push({...s,st:o.st,ed:r}):e.push(o,s)}return e}function Ts(t,e,s,n){var h;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const l=(h=e.textRuns)!=null?h:[];if(l.length)for(let u=0,_=l.length;u<_;u++){const d=l[u];d.st+=n,d.ed+=n}for(let u=0;u<o;u++){const _=r[u],{st:d,ed:f}=_;if(f<n)i.push(_);else if(n>=d&&n<=f)if(a)_.st+=s,_.ed+=s,i.push(_);else{a=!0,_.ed+=s;const E=[];if(l.length){const R={..._,st:d,ed:l[0].st};E.push(R),E.push(...l);const v=l[l.length-1],w={..._,st:v.ed,ed:f+s};E.push(w)}else E.push(_);i.push(...E)}else _.st+=s,_.ed+=s,a||(a=!0,i.push(...l)),i.push(_)}a||(a=!0,i.push(...l)),t.textRuns=ge(i)}function Ee(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let l=-1;for(let u=0,_=r.length;u<_;u++){const d=r[u],{startIndex:f}=d;f>=n&&(d.startIndex+=s),l===-1&&f>=n&&(l=u),a.push(d.startIndex)}let h=-1;if(i){for(let u=0,_=i.length;u<_;u++){const d=i[u];d.startIndex+=n;const f=d.startIndex;h=a.indexOf(f)}if(o===fe.PARAGRAPH&&i.length===1){const u=r[l],_=i[0],d=u.paragraphStyle,f=u.bullet;u.paragraphStyle=_.paragraphStyle,u.bullet=_.bullet,_.paragraphStyle=d,_.bullet=f}h!==-1&&r.splice(h,1),r.push(...i),r.sort(rt("startIndex"))}}function Qr(t,e,s,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:h}=l;h>=n&&(l.startIndex+=s)}const i=e.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n}r.push(...i),r.sort(rt("startIndex"))}}function Ms(t,e,s,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:h}=l;h>=n&&(l.startIndex+=s)}const i=e.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n}r.push(...i),r.sort(rt("startIndex"))}}function Re(t,e,s,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:h,endIndex:u}=l;h>n?(l.startIndex+=s,l.endIndex+=s):u>=n-1&&(l.endIndex+=s)}const i=e.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n,l.endIndex+=n}r.push(...i),r.sort(rt("startIndex"))}}function Jr(t,e,s,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:h,endIndex:u}=l;h>n?(l.startIndex+=s,l.endIndex+=s):u>=n-1&&(l.endIndex+=s)}const i=e.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=n,l.endIndex+=n}r.push(...i),r.sort(rt("startIndex"))}}function Ps(t,e,s){const{textRuns:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{st:_,ed:d}=u;if(r<=_&&i>=d){o.push({...u,st:_-r,ed:d-r});continue}else _<=r&&d>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=e):r>=_&&r<d?(o.push({...u,st:r-r,ed:d-r}),u.ed=r):i>_&&i<=d?(o.push({...u,st:_-r,ed:i-r}),u.st=i-e,u.ed-=e):_>=i&&(u.st-=e,u.ed-=e);a.push(u)}t.textRuns=a}return o}function xs(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{startIndex:_}=u;if(_>=r&&_<i){o.push({...u,startIndex:_-s});continue}else _>=i&&(u.startIndex-=e);a.push(u)}t.paragraphs=a}return o}function ps(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{startIndex:_}=u;if(_>=r&&_<=i){o.push({...u,startIndex:_-s});continue}else _>i&&(u.startIndex-=e);a.push(u)}t.sectionBreaks=a}return o}function Fs(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{startIndex:_}=u;if(_>=r&&_<=i){o.push({...u,startIndex:_-s});continue}else _>i&&(u.startIndex-=e);a.push(u)}t.customBlocks=a}return o}function Hs(t,e,s){const{tables:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{startIndex:_,endIndex:d}=u;if(r<=_&&i>=d){o.push({...u,startIndex:_-s,endIndex:d-s});continue}else if(_<=r&&d>=i){const f=_e(_,d,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<_&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.tables=a}return o}function Ws(t,e,s){const{customRanges:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let l=0,h=n.length;l<h;l++){const u=n[l],{startIndex:_,endIndex:d}=u;if(r<=_&&i>=d){o.push({...u,startIndex:_-s,endIndex:d-s});continue}else if(_<=r&&d>=i){const f=_e(_,d,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<_&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.customRanges=a}return o}function Zr(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=Ps(t,e,s),a=xs(t,e,s),l=ps(t,e,s),h=Fs(t,e,s),u=Hs(t,e,s),_=Ws(t,e,s);let d="";return n&&(t.dataStream=As(n,r,i),d=n.slice(r,i)),{dataStream:d,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:h,tables:u,customRanges:_}}function yr(t,e,s,n){t.dataStream=Is(t.dataStream,n,e.dataStream),Ts(t,e,s,n),Ee(t,e,s,n),Qr(t,e,s,n),Ms(t,e,s,n),Re(t,e,s,n),Jr(t,e,s,n)}var Bs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Bs||{}),Gs=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Gs||{}),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||{}),V=(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))(V||{}),$s=(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))($s||{}),ks=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(ks||{}),Vs=(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))(Vs||{}),js=(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))(js||{}),Ys=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(Ys||{}),Ks=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Ks||{}),zs=(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))(zs||{}),Xs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Xs||{}),qs=(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))(qs||{}),Qs=(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))(Qs||{}),Js=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Js||{}),Zs=(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))(Zs||{}),ys=(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))(ys||{}),tn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(tn||{}),en=(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))(en||{}),sn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(sn||{}),nn=(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))(nn||{}),rn=(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))(rn||{}),on=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(on||{}),an=(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))(an||{}),ln=(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))(ln||{}),un=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(un||{}),cn=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(cn||{}),Dt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Dt||{});const ti={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:V.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:V.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:V.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:V.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:V.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:V.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:ht.DECIMAL,hanging:21,indentStart:63}]}};function ei(t,e,s,n,r){const i=si(t,e,s,n,r),o=ni(t,e,s,n,r),a=ri(t,e,s,n,r),l=ii(t,e,s,n,r),h=oi(t,e,s,n,r),u=ai(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:h,customRanges:u}}function si(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=Ps(t,s,n);if(r!==U.REPLACE){const l=hn(o,a,r);e.textRuns=l}return Ts(t,e,s,n),a}function hn(t,e,s){if(e.length===0)return t;t=g.deepClone(t),e=g.deepClone(e);const n=[],r=t.length,i=e.length;let o=0,a=0,l=null;function h(){return l?(n.push(l),l=null,!0):!1}for(;o<r&&a<i;){const{st:f,ed:E,ts:R}=t[o],{st:v,ed:w,ts:H,sId:$}=e[a];let it;s===U.COVER?it={...H,...R}:it={...R,...H},E<v?(h()||n.push(t[o]),o++):w<f?(h()||n.push(e[a]),a++):(n.push({st:Math.min(f,v),ed:Math.max(f,v),ts:f<v?{...R}:{...H},sId:f<v?void 0:$}),n.push({st:Math.max(f,v),ed:Math.min(E,w),ts:it,sId:$}),E<w?(o++,e[a].st=E):(a++,t[o].st=w),l={st:Math.min(E,w),ed:Math.max(E,w),ts:E<w?{...H}:{...R},sId:E<w?$:void 0})}h();const u=n[n.length-1],_=t[r-1],d=e[i-1];return u.ed!==Math.max(_.ed,d.ed)&&(_.ed>d.ed?n.push(_):n.push(d)),ge(n)}function ni(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=xs(t,s,n);if(r!==U.REPLACE){const l=[];for(const h of o){const{startIndex:u,paragraphStyle:_,bullet:d}=h;let f=[];for(const E of a){const{startIndex:R,paragraphStyle:v,bullet:w}=E;let H,$;if(r===U.COVER?(H={...v,..._},$={listId:"",listType:Dt.BULLET_LIST,nestingLevel:0,textStyle:{},...w,...d}):(H={..._,...v},$={listId:"",listType:Dt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...w}),u===R){f.push({startIndex:u,paragraphStyle:H,bullet:$});break}}l.push(...f),f=[]}e.paragraphs=l}return Ee(t,e,s,n),a}function ri(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=ps(t,s,n);if(r!==U.REPLACE){const l=[];for(const h of o){const{startIndex:u}=h;let _=[];for(const d of a){const{startIndex:f}=d;if(u===f){r===U.COVER?_.push({...d,...h}):_.push({...h,...d});break}}l.push(..._),_=[]}e.sectionBreaks=l}return Ee(t,e,s,n),a}function ii(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=Fs(t,s,n);if(r!==U.REPLACE){const l=[];for(const h of o){const{startIndex:u}=h;let _=[];for(const d of a){const{startIndex:f}=d;if(u===f){r===U.COVER?_.push({...d,...h}):_.push({...h,...d});break}}l.push(..._),_=[]}e.customBlocks=l}return Ms(t,e,s,n),a}function oi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Hs(t,s,n);if(r!==U.REPLACE){const l=[];for(const h of o){const{startIndex:u,endIndex:_}=h;let d=[];for(const f of a){const{startIndex:E,endIndex:R}=f;if(E>=u&&R<=_){r===U.COVER?d.push({...f,...h}):d.push({...h,...f});break}}l.push(...d),d=[]}e.tables=l}return Re(t,e,s,n),a}function ai(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Ws(t,s,n);if(r!==U.REPLACE){const l=[];for(const h of o){const{startIndex:u,endIndex:_}=h;let d=[];for(const f of a){const{startIndex:E,endIndex:R}=f;if(E>=u&&R<=_){r===U.COVER?d.push({...f,...h}):d.push({...h,...f});break}}l.push(...d),d=[]}e.customRanges=l}return Re(t,e,s,n),a}var O=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(O||{});function me(t,e,s){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(e,s)},a=[];for(const h of r){const u=g.deepClone(h),{st:_,ed:d}=u;g.hasIntersectionBetweenTwoRanges(_,d,e,s)&&(e>=_&&e<=d?a.push({...u,st:e,ed:Math.min(s,d)}):s>=_&&s<=d?a.push({...u,st:Math.max(e,_),ed:s}):a.push(u))}a.length&&(o.textRuns=a.map(h=>{const{st:u,ed:_}=h;return{...h,st:u-e,ed:_-e}}));const l=[];for(const h of i){const{startIndex:u}=h;u>=e&&u<=s&&l.push(g.deepClone(h))}return l.length&&(o.paragraphs=l.map(h=>({...h,startIndex:h.startIndex-e}))),o}function yt(t,e,s=U.COVER){if(e.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:a=[]}=e,l=hn(o,r,s);l.length&&(n.textRuns=l);const h=[];let u=0,_=0;for(;u<i.length&&_<a.length;){const d=i[u],f=a[_],{startIndex:E}=d,{startIndex:R}=f;E===R?(h.push(g.deepMerge(d,f)),u++,_++):E<R?(h.push(g.deepClone(d)),u++):(h.push(g.deepClone(f)),_++)}return u<i.length&&h.push(...i.slice(u)),_<a.length&&h.push(...a.slice(_)),h.length&&(n.paragraphs=h),n}function li(t){const{body:e}=t;if(e==null)return!0;const{textRuns:s=[],paragraphs:n=[]}=e;return s.length===0&&n.length===0}const Oe={id:"default_doc",documentStyle:{}};class ui{constructor(e){c(this,"snapshot");this.snapshot={...Oe,...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,l=n==null?void 0:n[e];if(!l)return;const h=l.objectTransform;h.size.width=r,h.size.height=i,h.positionH.posOffset=o,h.positionV.posOffset=a}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class et extends ui{constructor(s){var r;super(s);c(this,"_unitId");c(this,"headerModelMap",new Map);c(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:g.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={...Oe,...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 Ze;return r.reset(),s.forEach(i=>{if(i=g.deepClone(i),i.t===O.RETAIN){const{coverType:o,body:a,len:l,segmentId:h}=i;if(a!=null){const u=this._updateApply(a,l,r.cursor,o,h);n.push({...i,t:O.RETAIN,coverType:U.REPLACE,body:u})}else n.push({...i,t:O.RETAIN});r.moveCursor(l)}else if(i.t===O.INSERT){const{body:o,len:a,segmentId:l,line:h}=i;this._insertApply(o,a,r.cursor,l),r.moveCursor(a),n.push({t:O.DELETE,len:a,line:h,segmentId:l})}else if(i.t===O.DELETE){const{len:o,segmentId:a}=i,l=this._deleteApply(o,r.cursor,a);n.push({...i,t:O.INSERT,body:l})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(s,n){const r=this.getBody();if(r!=null)return me(r,s,n)}_updateApply(s,n,r,i=U.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,l=Ot(a,o);if(l==null)throw new Error("no body has changed");return ei(l,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Ot(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Zr(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Ot(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");yr(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 et(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new et(i))}}updateDocumentId(s){super.updateDocumentId(s),this._unitId=s}}const at={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},ci={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},hi={startRow:0,startColumn:0,endRow:0,endColumn:0},_i={row:0,column:0},_n={id:"",sheetOrder:[],name:"",appVersion:"",locale:pt.ZH_CN,styles:{},sheets:{},resources:[]},dn=1e3,fn=20,gn=19,En=73,Rn=46,mn=20,Ut={type:ce.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:m.FALSE,rowCount:dn,columnCount:fn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:En,defaultRowHeight:gn,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:m.FALSE,showGridlines:m.TRUE,rowHeader:{width:Rn,hidden:m.FALSE},columnHeader:{height:mn,hidden:m.FALSE},selections:["A1"],rightToLeft:m.FALSE,pluginMeta:{}},It={ff:"Times New Roman",fs:14,it:m.FALSE,bl:m.FALSE,ul:{s:m.FALSE},st:{s:m.FALSE},ol:{s:m.FALSE},tr:{a:0,v:m.FALSE},td:_t.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:X.UNSPECIFIED,vt:J.UNSPECIFIED,tb:Z.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},On={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var In=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(In||{});class An{constructor(e={}){c(this,"_styles");c(this,"_cacheMap",new Ls(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=g.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&&g.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(g.diffValue(s[n],e))return n;return null}}function di(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 fi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return ct.STRING;if(typeof t.v=="number")return ct.NUMBER;if(typeof t.v=="boolean")return ct.BOOLEAN}function gi(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 Ei(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||{}),Cn=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Cn||{}),Nn=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Nn||{});class Ri{constructor(e,s){c(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!==m.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:P.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:P.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:P.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:P.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 G(this._columnData)}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=(s[e]||{hd:m.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:m.FALSE};return this._columnData[e]=i,i}}function mt(t,e){for(const s of e){const{ts:n={}}=s;if(n[t]==null)return m.FALSE;switch(t){case"bl":case"it":{if(n[t]===m.FALSE)return m.FALSE;break}case"ul":case"st":{if(n[t].s===m.FALSE)return m.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}}return m.TRUE}class st{constructor(e,s,n){c(this,"_range");c(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let a=n;a<=i;a++)for(let l=r;l<=o;l++)s(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;o++){const a=[];for(let l=n;l<=r;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new B;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new B;for(let a=e;a<=s;a++)for(let l=n;l<=r;l++)o.setValue(a-e,l-n,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=g.numToWord(n+1)+(e+1),o=g.numToWord(r+1)+(s+1)):(i=g.numToWord(r+1)+(s+1),o=g.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)||It.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 st(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const l=this._deps.getStyles();for(let h=0;h<=n-s;h++)for(let u=0;u<=i-r;u++){if(o==null||((a=o==null?void 0:o[h])==null?void 0:a[u])==null)continue;const _=o[h][u].s;_&&(o[h][u].s=l.get(_))}}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)||It.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)?mt("ul",(r=e.body)==null?void 0:r.textRuns)===m.TRUE?{s:m.TRUE}:{s:m.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var s,n,r;const{p:e}=(s=this.getValue())!=null?s:{};return e&&Array.isArray((n=e.body)==null?void 0:n.textRuns)?mt("st",(r=e.body)==null?void 0:r.textRuns)===m.TRUE?{s:m.TRUE}:{s:m.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)?mt("it",(r=e.body)==null?void 0:r.textRuns)===m.TRUE?Nt.ITALIC:Nt.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)?mt("bl",(r=e.body)==null?void 0:r.textRuns)===m.TRUE?St.BOLD:St.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){st.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]||It[e]}))}}class mi{constructor(e,s){c(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:m.FALSE,h:r.defaultRowHeight},{ia:l,ah:h,h:u=r.defaultRowHeight}=a;i+=(l==null||l===m.TRUE)&&typeof h=="number"?h:u}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:m.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:P.ROW})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:P.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:P.ROW})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:P.ROW}),n}getRowVisible(e){const s=this.getRow(e);return s?s.hd!==m.TRUE:!0}getSize(){return G(this._rowData)}}class Sn extends T{constructor(){super(...arguments);c(this,"_cellContentInterceptors",[]);c(this,"_rowFilteredInterceptors",[]);c(this,"_rowVisibleInterceptors",[]);c(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(()=>K(this._cellContentInterceptors,s))}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(s),L(()=>K(this._rowFilteredInterceptors,s))}registerRowVisibleInterceptor(s){if(this._rowVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(s),L(()=>K(this._rowVisibleInterceptors,s))}registerColVisibleInterceptor(s){if(this._colVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(s),L(()=>K(this._colVisibleInterceptors,s))}}class dt{constructor(e,s){c(this,"_initialized");c(this,"_sheetId");c(this,"_snapshot");c(this,"_cellData");c(this,"_rowManager");c(this,"_columnManager");c(this,"_viewModel");var a;this._styles=s;const n={...Ut,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},rowHeader:{width:46,hidden:m.FALSE},columnHeader:{height:20,hidden:m.FALSE},selections:["A1"],rightToLeft:m.FALSE,pluginMeta:{},...e};this._snapshot=n;const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:g.generateRandomId(6),this._initialized=!1,this._cellData=new B(o),this._rowManager=new mi(this._snapshot,i),this._columnManager=new Ri(this._snapshot,r),this._viewModel=new Sn}__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=g.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];y.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(y.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(l=>y.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},l)),a=new B;return Zt(e,n,s,r).forEach((l,h)=>{const u=i.getValue(l,h);u&&a.setValue(l,h,u)}),o.forEach(l=>{const{startColumn:h,startRow:u,endColumn:_,endRow:d}=l;Zt(u,d,h,_).forEach((f,E)=>{f===u&&E===h&&a.setValue(f,E,{...i.getValue(f,E),rowSpan:d-u+1,colSpan:_-h+1}),(f!==u||E!==h)&&a.realDeleteValue(f,E)})}),a}getRange(e,s,n,r){return typeof e=="object"?new st(this,e,{getStyles:()=>this._styles}):new st(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 Oi=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,Ai=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ii(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&&Oi(e,s,r),r},Ci=(t,e)=>(s,n)=>e(s,n,t);function Ni(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends T{constructor(s={},n){super();c(this,"_sheetCreated$",new A.Subject);c(this,"sheetCreated$",this._sheetCreated$.asObservable());c(this,"_sheetDisposed$",new A.Subject);c(this,"sheetDisposed$",this._sheetDisposed$.asObservable());c(this,"_activeSheet$",new A.BehaviorSubject(null));c(this,"activeSheet$",this._activeSheet$.asObservable());c(this,"_worksheets");c(this,"_styles");c(this,"_snapshot");c(this,"_unitId");c(this,"_count");this._log=n,this._snapshot=g.commonExtend(_n,s);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=g.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new An(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 g.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()===m.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===m.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}:at}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 u,_,d,f,E;let n="",r="";if(s.indexOf("!")>-1){const R=s.split("!");n=R[0],r=R[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=s;if(r.indexOf(":")===-1){const R=parseInt(r.replace(/[^0-9]/g,""),10)-1,v=g.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(R)&&!Number.isNaN(v)?{sheetId:n,range:{startRow:R,endRow:R,startColumn:v,endColumn:v}}:at}r=r.split(":");const i=[0,0],o=[0,0],a=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((_=this.getActiveSheet())==null?void 0:_.getMaxRows()),l=((d=this.getSheetBySheetName(n))==null?void 0:d.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.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]=g.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=g.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=l),o[0]>o[1])?at:{sheetId:((E=this.getSheetBySheetName(n))==null?void 0:E.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;g.isEmptyObject(r)&&(r[Ut.id]=Object.assign(Ut,{status:m.TRUE}));for(const o in r){const a=r[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._log.warn(`The worksheet name ${l} is duplicated, we change it to ${a.name}`);const h=new dt(a,this._styles);n.set(o,h),i.includes(o)||i.push(o)}}};exports.Workbook=Ai([Ci(1,q)],exports.Workbook);class Ae{constructor(e){c(this,"_snapshot");c(this,"_unitId");var s;this._snapshot={...On,...e},this._unitId=(s=this._snapshot.id)!=null?s:g.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:Ie.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Tt="FOCUSING_SHEET",te="FOCUSING_DOC",ee="FOCUSING_SLIDE",Si="FOCUSING_EDITOR_BUT_HIDDEN",Ln="EDITOR_ACTIVATED",Li="FOCUSING_EDITOR_INPUT_FORMULA",vn="FOCUSING_FORMULA_EDITOR",vi="FOCUSING_UNIVER_EDITOR";var wi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,Di=(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},Ui=(t,e)=>(s,n)=>e(s,n,t),wn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(wn||{});const nt=I.createIdentifier("univer.current");let se=class extends T{constructor(e,s){super();c(this,"_focused",null);c(this,"_focused$",new A.BehaviorSubject(null));c(this,"focused$",this._focused$.asObservable());c(this,"_currentSheet$",new A.BehaviorSubject(null));c(this,"currentSheet$",this._currentSheet$.asObservable());c(this,"_currentDoc$",new A.BehaviorSubject(null));c(this,"currentDoc$",this._currentDoc$.asObservable());c(this,"_currentSlide$",new A.BehaviorSubject(null));c(this,"currentSlide$",this._currentSlide$.asObservable());c(this,"_sheetAdded$",new A.Subject);c(this,"sheetAdded$",this._sheetAdded$.asObservable());c(this,"_docAdded$",new A.Subject);c(this,"docAdded$",this._docAdded$.asObservable());c(this,"_slideAdded$",new A.Subject);c(this,"slideAdded$",this._slideAdded$.asObservable());c(this,"_sheetDisposed$",new A.Subject);c(this,"sheetDisposed$",this._sheetDisposed$.asObservable());c(this,"_docDisposed$",new A.Subject);c(this,"docDisposed$",this._docDisposed$.asObservable());c(this,"_slideDisposed$",new A.Subject);c(this,"slideDisposed$",this._slideDisposed$.asObservable());c(this,"_sheets",[]);c(this,"_docs",[]);c(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),[te,Tt,ee].forEach(s=>this._contextService.setContextValue(s,!1)),this._focused instanceof exports.Workbook?this._contextService.setContextValue(Tt,!0):this._focused instanceof et?this._contextService.setContextValue(te,!0):this._focused instanceof Ae&&this._contextService.setContextValue(ee,!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}};se=Di([Ui(1,tt)],se);var S=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(S||{});const Ti={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},At=new Map;function Ce(t,e){return function(r){Ne(t,e)}}function Ne(t,e){At.has(t)||At.set(t,[]),At.get(t).push(e)}var Mi=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,bn=(t,e,s,n)=>{for(var r=n>1?void 0:n?Pi(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&&Mi(e,s,r),r},ne=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends T{constructor(s){super();c(this,"_lifecycle$",new A.BehaviorSubject(S.Starting));c(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=s,this._reportProgress(S.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 A.Observable(s=>(this.stage===S.Starting||(this.stage===S.Ready?s.next(S.Starting):this.stage===S.Rendered?(s.next(S.Starting),s.next(S.Ready)):(s.next(S.Starting),s.next(S.Ready),s.next(S.Rendered))),this._lifecycle$.subscribe(s)))}_reportProgress(s){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Ti[s]}".`)}};exports.LifecycleService=bn([ne(0,q)],exports.LifecycleService);let z=class extends T{constructor(e,s){super();c(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=At.get(e);s==null||s.forEach(n=>{this._injector.has(n)&&this._injector.get(n)})}};z=bn([ne(0,I.Inject(exports.LifecycleService)),ne(1,I.Inject(I.Injector))],z);function xi(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 lt extends T{constructor(){super();c(this,"_currentLocale",pt.ZH_CN);c(this,"_locales",null);c(this,"localeChanged$",new A.Subject);c(this,"t",s=>{var n;if(!this._locales)throw new Error("Locale not initialized");return(n=xi(this._locales[this._currentLocale],s))!=null?n:s});this.disposeWithMe(L(()=>this.localeChanged$.complete()))}load(s){var n;this._locales=g.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 Se=I.createIdentifier("resource-manager-service"),Dn=I.createIdentifier("ResourcePersistenceService");Ne(S.Ready,Dn);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},Pe=(t,e)=>(s,n)=>e(s,n,t);const Le=I.createIdentifier("univer.permission-service"),xe="PERMISSION";exports.PermissionService=class extends T{constructor(s,n){super();c(this,"_permissionPointMap",new Map);c(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});c(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new A.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});c(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=de.DONE,o.next(a)}});c(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(),xe,{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(),xe)})))}_toJson(s){const n=this._permissionPointMap.get(s);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return A.combineLatest(i).pipe($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()})}};exports.PermissionService=Hi([Ce(S.Starting,exports.PermissionService),Pe(0,I.Inject(Se)),Pe(1,I.Inject(nt))],exports.PermissionService);const Un="univer.editable";class Ct extends vs{constructor(s){super();c(this,"id",Un);c(this,"value",!0);c(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},pe=(t,e)=>(s,n)=>e(s,n,t);exports.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 Ct(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e){let s=e;s||(s=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Ct(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new Ct(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=Gi([Ce(S.Starting,exports.UniverPermissionService),pe(0,I.Inject(Le)),pe(1,I.Inject(nt))],exports.UniverPermissionService);class Tn extends T{constructor(){super(...arguments);c(this,"_resourceMap",new Map);c(this,"_register$",new A.Subject);c(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 re extends T{constructor(){super();c(this,"_currentTheme");c(this,"_currentTheme$",new A.BehaviorSubject({}));c(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,ji=(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},Vt=(t,e)=>(s,n)=>e(s,n,t);const Wt=I.createIdentifier("univer.undo-redo.service"),Yi=20;exports.LocalUndoRedoService=class extends T{constructor(s,n,r){super();c(this,"undoRedoStatus$");c(this,"_undoRedoStatus$",new A.BehaviorSubject({undos:0,redos:0}));c(this,"_undoStacks",new Map);c(this,"_redoStacks",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(pn)),this.disposeWithMe(this._commandService.registerCommand(Fn)),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>Yi&&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,l,h;let s="";const n=this._contextService.getContextValue(Tt),r=this._contextService.getContextValue(vn),i=this._contextService.getContextValue(Ln);return n?r?s=Pn:i?s=Mn:s=(a=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?a:"":s=(h=(l=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:l.getUnitId())!=null?h:"",s}};exports.LocalUndoRedoService=ji([Vt(0,nt),Vt(1,ft),Vt(2,tt)],exports.LocalUndoRedoService);class xn{dispose(){}async dispatchToHandlers(){return!1}}const pn=new class extends xn{constructor(){super(...arguments);c(this,"type",xt.COMMAND);c(this,"id","univer.command.undo")}async handler(e){const s=e.get(Wt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(ft);return(n.undo?await n.undo(n.undoMutations):ue(n.undoMutations,r))?(s.popUndoToRedo(),!0):!1}},Fn=new class extends xn{constructor(){super(...arguments);c(this,"type",xt.COMMAND);c(this,"id","univer.command.redo")}async handler(e){const s=e.get(Wt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(ft);return(n.redo?await n.redo(n.redoMutations):ue(n.redoMutations,r))?(s.popRedoToUndo(),!0):!1}};class Bt extends T{constructor(){super(...arguments);c(this,"_started",!1)}addPlugins(s){if(this._started){const n=s.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,S.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===S.Starting||this._pluginsRunLifecycle(s,r)})))}_pluginsRunLifecycle(s,n){s.forEach(r=>{switch(n){case S.Starting:r.onStarting(this._injector);break;case S.Ready:r.onReady();break;case S.Rendered:r.onRendered();break;case S.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(s,n){return this._injector.createInstance(s,n)}}var Ki=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Xi=(t,e,s,n)=>{for(var r=n>1?void 0:n?zi(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},jt=(t,e)=>(s,n)=>e(s,n,t);exports.UniverDoc=class extends Bt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createDoc(e){return this._injector.createInstance(et,e)}};exports.UniverDoc=Xi([jt(0,I.Inject(I.Injector)),jt(1,I.Inject(exports.LifecycleService)),jt(2,I.Inject(z))],exports.UniverDoc);var qi=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,Ji=(t,e,s,n)=>{for(var r=n>1?void 0:n?Qi(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},Yt=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSheet=class extends Bt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSheet(e){return this._injector.createInstance(exports.Workbook,e)}};exports.UniverSheet=Ji([Yt(0,I.Inject(I.Injector)),Yt(1,I.Inject(exports.LifecycleService)),Yt(2,I.Inject(z))],exports.UniverSheet);var Zi=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,to=(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&&Zi(e,s,r),r},Kt=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSlide=class extends Bt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSlide(e){return this._injector.createInstance(Ae,e)}};exports.UniverSlide=to([Kt(0,I.Inject(I.Injector)),Kt(1,I.Inject(exports.LifecycleService)),Kt(2,I.Inject(z))],exports.UniverSlide);const eo=200;class so extends Bt{constructor(s={}){super();c(this,"_injector");c(this,"_univerPluginStore",new jn);c(this,"_univerPluginRegistry",new Yn);c(this,"_univerSheet",null);c(this,"_univerDoc",null);c(this,"_univerSlide",null);c(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=s;n&&this._injector.get(re).setTheme(n),i&&this._injector.get(lt).load(i),r&&this._injector.get(lt).setLocale(r),o&&this._injector.get(q).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(nt)}get _lifecycleService(){return this._injector.get(exports.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(z)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(s){this._injector.get(lt).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(exports.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(b.Sheet).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(b.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(exports.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(b.Doc).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(b.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(exports.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(b.Slide).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(b.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new I.Injector([[nt,{useFactory:s=>new se({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},s),deps:[tt]}],[qe],[lt],[re],[exports.LifecycleService],[z],[Le,{useClass:exports.PermissionService}],[exports.UniverPermissionService],[q,{useClass:Ke,lazy:!0}],[ft,{useClass:exports.CommandService,lazy:!0}],[Wt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Xe,{useClass:nr}],[tt,{useClass:je}],[Je,{useClass:Qe,lazy:!0}],[Se,{useClass:Tn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(z).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<S.Ready&&(this._injector.get(exports.LifecycleService).stage=S.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(s,n){if(s.type===b.Univer)this._registerUniverPlugin(s,n);else if(s.type===b.Sheet)this._registerSheetsPlugin(s,n);else if(s.type===b.Doc)this._registerDocsPlugin(s,n);else if(s.type===b.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(),eo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const s=this._univerPluginRegistry.getRegisterPlugins(b.Univer);if(s.length){this._univerPluginRegistry.clearPluginsOfType(b.Univer);const n=s.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(b.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(b.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(b.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(b.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(b.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(b.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 no(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 ro(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}class ie{constructor(e){c(this,"_index",0);c(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===O.DELETE||s.t===O.RETAIN&&s.body==null?g.deepClone({...s,len:e}):g.deepClone({...s,len:e,body:me(s.body,n,n+e)})}else return{t:O.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const e=this._actions[this._index];return e?e.t:O.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 Fe(t){return Object.keys(t).length===1}class ve{constructor(){c(this,"_actions",[])}static compose(e,s){const n=new ie(e),r=new ie(s),i=new ve;for(;n.hasNext()||r.hasNext();)if(r.peekType()===O.INSERT)i.push(r.next());else if(n.peekType()===O.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),a=n.next(o),l=r.next(o);a.t===O.INSERT&&l.t===O.RETAIN?l.body==null?i.push(a):i.push({...a,body:yt(a.body,l.body,l.coverType)}):a.t===O.RETAIN&&l.t===O.RETAIN?a.body==null&&l.body==null?i.push(a.len!==Number.POSITIVE_INFINITY?a:l):a.body&&l.body?i.push({...a,body:yt(a.body,l.body,l.coverType)}):i.push(a.body?a:l):a.t===O.RETAIN&&l.t===O.DELETE?i.push(l):a.t===O.INSERT&&(l.t,O.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(e,s,n){const r={t:O.INSERT,body:s,len:e,line:0,segmentId:n};return this.push(r),this}retain(e,s,n,r){const i={t:O.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:O.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=g.deepClone(e[0]);if(r.t===O.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===O.DELETE&&r.t===O.DELETE)return n.len+=r.len,this;if(n.t===O.DELETE&&r.t===O.INSERT&&(s-=1,n=this._actions[s-1],n==null))return this._actions.unshift(r),this;if(n.t===O.RETAIN&&r.t===O.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===O.INSERT&&Fe(n.body)&&r.t===O.INSERT&&Fe(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===O.RETAIN&&li(e);)this._actions.pop(),e=this._actions[this._actions.length-1];return this}}class io extends Pt{add(e){if(!e)return null;const s=new Mt(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const oo=I.createIdentifier("ILocalStorageService"),ao=t=>`sheet_interceptor_${t}`,Hn=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 lo{constructor(e){c(this,"_interceptorsByName",new Map);c(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return Hn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>K(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}kn();exports.ABCToNumber=jr;exports.AbsoluteRefType=ws;exports.ActionIterator=ie;exports.AlignTypeH=an;exports.AlignTypeV=ln;exports.AutoFillSeries=es;exports.BaselineOffset=Lt;exports.BlockType=ks;exports.BooleanNumber=m;exports.BorderStyleTypes=N;exports.BorderType=ss;exports.BulletAlignment=V;exports.COLORS=zt;exports.CellValueType=ct;exports.Color=Q;exports.ColorBuilder=Ht;exports.ColorKit=F;exports.ColorType=p;exports.ColumnSeparatorType=Ys;exports.CommandType=xt;exports.CommonHideTypes=ns;exports.ConditionType=rs;exports.ContentAlignment=en;exports.ContextService=je;exports.CopyPasteType=is;exports.CustomRangeType=$s;exports.DEFAULT_CELL=_i;exports.DEFAULT_DOC=Oe;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=rr;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=$i;exports.DEFAULT_RANGE=ci;exports.DEFAULT_RANGE_ARRAY=at;exports.DEFAULT_SELECTION=hi;exports.DEFAULT_SLIDE=On;exports.DEFAULT_STYLES=It;exports.DEFAULT_WORKBOOK=_n;exports.DEFAULT_WORKSHEET=Ut;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=fn;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=mn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=En;exports.DEFAULT_WORKSHEET_ROW_COUNT=dn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=gn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Rn;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Pn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Mn;exports.DashStyleType=Zs;exports.DataStreamTreeNodeType=Us;exports.DataStreamTreeTokenType=fe;exports.DesktopLogService=Ke;exports.DeveloperMetadataVisibility=os;exports.Dimension=as;exports.Direction=ls;exports.Disposable=T;exports.DisposableCollection=le;exports.DocStyleType=Bs;exports.DocumentDataModel=et;exports.EDITOR_ACTIVATED=Ln;exports.EXTENSION_NAMES=In;exports.Entry=Xt;exports.EntryIterator=Ss;exports.ErrorService=qe;exports.EventState=ke;exports.FOCUSING_DOC=te;exports.FOCUSING_EDITOR_BUT_HIDDEN=Si;exports.FOCUSING_EDITOR_INPUT_FORMULA=Li;exports.FOCUSING_FORMULA_EDITOR=vn;exports.FOCUSING_SHEET=Tt;exports.FOCUSING_SLIDE=ee;exports.FOCUSING_UNIVER_EDITOR=vi;exports.FloatingObjectManagerService=Qe;exports.FollowNumberWithType=Gs;exports.FontItalic=Nt;exports.FontStyleType=sn;exports.FontWeight=St;exports.FormatType=us;exports.GlyphType=ht;exports.GridType=Vs;exports.HLSColor=Es;exports.HorizontalAlign=X;exports.ICommandService=ft;exports.IConfigService=Xe;exports.IContextService=tt;exports.IFloatingObjectManagerService=Je;exports.ILocalStorageService=oo;exports.ILogService=q;exports.IPermissionService=Le;exports.IResourceManagerService=Se;exports.ISnapshotPersistenceService=Dn;exports.IUndoRedoService=Wt;exports.IUniverInstanceService=nt;exports.InterceptorManager=lo;exports.InterpolationPointType=cs;exports.KeyIterator=Cs;exports.LRUHelper=ot;exports.LRUMap=Ls;exports.LifecycleStages=S;exports.LocaleService=lt;exports.LocaleType=pt;exports.LogLevel=Ye;exports.MemoryCursor=Ze;exports.NamedStyleType=Qs;exports.NilCommand=ze;exports.NumberUnitType=on;exports.ObjectMatrix=B;exports.ObjectRelativeFromH=nn;exports.ObjectRelativeFromV=rn;exports.Observable=Pt;exports.ObservableHooks=io;exports.Observer=Mt;exports.OnLifecycle=Ce;exports.PRESET_LIST_TYPE=ti;exports.PageElementType=Cn;exports.PageOrientType=cn;exports.PageType=Ie;exports.ParagraphElementType=zs;exports.PermissionPoint=vs;exports.PermissionStatus=de;exports.Plugin=He;exports.PluginType=b;exports.PositionedObjectLayoutType=qs;exports.PresetListType=Dt;exports.ProtectionType=hs;exports.RANGE_TYPE=P;exports.RGBA_PAREN=ur;exports.RGB_PAREN=lr;exports.Range=st;exports.Rectangle=y;exports.RedoCommand=Fn;exports.RefAlias=Vr;exports.Registry=oe;exports.RegistryAsMap=ae;exports.RelativeDate=_s;exports.RelativeSlideLink=Nn;exports.ResourceManagerService=Tn;exports.RgbColor=vt;exports.RxDisposable=Qn;exports.SectionType=js;exports.ShapeType=ds;exports.SheetTypes=ce;exports.SheetViewModel=Sn;exports.Slide=Ae;exports.SpacingRule=Js;exports.Styles=An;exports.THEME_COLORS=gs;exports.TabStopAlignment=ys;exports.TextDecoration=fs;exports.TextDirection=_t;exports.TextDirectionType=Ks;exports.TextX=ve;exports.TextXActionType=O;exports.ThemeColor=wt;exports.ThemeColorType=M;exports.ThemeColors=Ft;exports.ThemeService=re;exports.Tools=g;exports.UndoCommand=pn;exports.Univer=so;exports.UniverEditablePermission=Ct;exports.UniverEditablePermissionPoint=Un;exports.UniverInstanceType=wn;exports.UpdateDocsAttributeType=U;exports.ValueIterator=Ns;exports.VerticalAlign=J;exports.WidthType=tn;exports.Worksheet=dt;exports.WrapStrategy=Z;exports.WrapTextType=Xs;exports.binarySearchArray=ye;exports.characterSpacingControlType=un;exports.checkParagraphHasBullet=Pr;exports.checkParagraphHasIndent=xr;exports.checkParagraphHasIndentByStyle=Os;exports.codeToBlob=or;exports.composeBody=yt;exports.composeInterceptors=Hn;exports.concatMatrixArray=Hr;exports.createInterceptorKey=ao;exports.createRowColIter=Zt;exports.dedupe=Kn;exports.deepCompare=he;exports.deleteContent=As;exports.fromObservable=qn;exports.getArrayLength=G;exports.getBodySlice=me;exports.getBorderStyleType=Tr;exports.getCellValueType=fi;exports.getColorStyle=W;exports.getDocsUpdateBody=Ot;exports.getReverseDirection=ar;exports.getTypeFromPermissionItemList=$r;exports.getWorksheetUID=Ni;exports.handleJsonToDom=Dr;exports.handleStyleToString=Ur;exports.hashAlgorithm=Fr;exports.horizontalLineSegmentsSubtraction=_e;exports.insertMatrixArray=qt;exports.insertTextToContent=Is;exports.isCellV=Ei;exports.isEmptyCell=vr;exports.isFormulaId=br;exports.isFormulaString=wr;exports.isICellData=di;exports.isNullCell=gi;exports.isObserver=Ve;exports.isRealNum=pr;exports.isSameStyleTextRun=ms;exports.isValidRange=Mr;exports.makeCellRangeToRangeData=Lr;exports.makeCellToSelection=Sr;exports.moveMatrixArray=Jt;exports.normalizeTextRuns=ge;exports.numberToABC=Kr;exports.numberToListABC=zr;exports.orderSearchArray=ts;exports.remove=K;exports.repeatStringNumTimes=Ds;exports.requestImmediateMacroTask=ro;exports.runOnLifecycle=Ne;exports.searchArray=ir;exports.selectionToArray=kr;exports.sequence=Be;exports.sequenceAsync=We;exports.sequenceExecute=ue;exports.sequenceExecuteAsync=sr;exports.sliceMatrixArray=Wr;exports.sortRules=Xr;exports.sortRulesByDesc=qr;exports.sortRulesFactory=rt;exports.spliceArray=Qt;exports.throttle=no;exports.toDisposable=L;