@univerjs/core 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/umd/index.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(l,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],O):(l=typeof globalThis<"u"?globalThis:l||self,O(l.UniverCore={},l["@wendellhu/redi"],l.rxjs,l.rxjs.operators))})(this,function(l,O,A,Zn){"use strict";var ia=Object.defineProperty;var oa=(l,O,A)=>O in l?ia(l,O,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[O]=A;var _=(l,O,A)=>(oa(l,typeof O!="symbol"?O+"":O,A),A);var sa,na;function yn(){tr()}const It=typeof global<"u"?global:typeof self<"u"?self:window;function tr(){typeof It.requestIdleCallback!="function"&&(It.requestIdleCallback=function(e){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof It.cancelIdleCallback!="function"&&(It.cancelIdleCallback=function(e){clearTimeout(e)})}class Yt{constructor(){_(this,"_data",[])}static create(){return new Yt}add(s){this._data.indexOf(s)>-1||this._data.push(s)}delete(s){const e=this._data.indexOf(s);this._data.splice(e,1)}getData(){return this._data}}class zt{constructor(){_(this,"_data",new Map)}static create(){return new zt}add(s,e){this._data.has(s)||this._data.set(s,e)}delete(s){this._data.delete(s)}getData(){return this._data}}var w=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(w||{});class Pe{constructor(s){_(this,"_name");this._name=s}onStarting(s){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}_(Pe,"type",0);class er{constructor(){_(this,"_plugins",[])}addPlugin(s){this._plugins.push(s)}removePlugins(){const s=this._plugins.slice();return this._plugins.length=0,s}forEachPlugin(s){this._plugins.forEach(s)}}class sr{constructor(){_(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(s,e){const n=s.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:s,options:e})}getRegisterPlugins(s){return this._pluginsRegisteredByBusiness.get(s)||[]}clearPluginsOfType(s){this._pluginsRegisteredByBusiness.delete(s)}}function Y(t,s){const e=t.indexOf(s);return e>-1?(t.splice(e,1),!0):!1}function nr(t){const s=new Set,e=[];for(const n of t)s.has(n)||(s.add(n),e.push(n));return e}function rr(t,s){for(let e=t.length-1;e>-1;e--){const n=t[e];if(s(n,e))return n}return null}function ir(t,s){if(t.length===0)return t;const e=s%t.length;return t.slice(e).concat(t.slice(0,e))}function or(t,s){const e=new Map;return t.forEach(n=>{const r=s(n);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(n)}),e}async function Fe(t){for(const[s,e]of t.entries())try{if(!await e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function He(t){for(const[s,e]of t.entries())try{if(!e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function We(t){var s=typeof Symbol=="function"&&Symbol.iterator,e=s&&t[s],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,s){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),r,i=[],o;try{for(;(s===void 0||s-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return i}function ke(t,s,e){if(e||arguments.length===2)for(var n=0,r=s.length,i;n<r;n++)(i||!(n in s))&&(i||(i=Array.prototype.slice.call(s,0,n)),i[n]=s[n]);return t.concat(i||Array.prototype.slice.call(s))}typeof SuppressedError=="function"&&SuppressedError;function lt(t){return typeof t=="function"}function ar(t){var s=function(n){Error.call(n),n.stack=new Error().stack},e=t(s);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Xt=ar(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
1
+ (function(l,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],O):(l=typeof globalThis<"u"?globalThis:l||self,O(l.UniverCore={},l["@wendellhu/redi"],l.rxjs,l.rxjs.operators))})(this,function(l,O,A,nr){"use strict";var mc=Object.defineProperty;var Oc=(l,O,A)=>O in l?mc(l,O,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[O]=A;var _=(l,O,A)=>(Oc(l,typeof O!="symbol"?O+"":O,A),A);var fc,gc;function rr(){ir()}const It=typeof global<"u"?global:typeof self<"u"?self:window;function ir(){typeof It.requestIdleCallback!="function"&&(It.requestIdleCallback=function(e){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof It.cancelIdleCallback!="function"&&(It.cancelIdleCallback=function(e){clearTimeout(e)})}var W=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(W||{}),p=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(p||{});function or(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const q=class q{static clone(s){return s.rangeType!==void 0?{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType}:{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn}}static equals(s,e){return s==null||e==null?!1:s.endRow===e.endRow&&s.endColumn===e.endColumn&&s.startRow===e.startRow&&s.startColumn===e.startColumn&&(s.rangeType===e.rangeType||s.rangeType===void 0&&e.rangeType===W.NORMAL||e.rangeType===void 0&&s.rangeType===W.NORMAL)}static intersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,h=e.startColumn,u=e.endColumn,d=Math.abs(i+o-h-u),E=Math.abs(i-o)+Math.abs(h-u),f=Math.abs(n+r-c-a),g=Math.abs(n-r)+Math.abs(c-a);return d<=E&&f<=g}static getIntersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,h=e.startColumn,u=e.endColumn;let d,E,f,g;if(c<=r)c>=n?E=c:E=n;else return null;if(a>=n)a>=r?g=r:g=a;else return null;if(h<=o)h>i?d=h:d=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:E,endRow:g,startColumn:d,endColumn:f,rangeType:W.NORMAL}}static contains(s,e){return s.startRow<=e.startRow&&s.endRow>=e.endRow&&s.startColumn<=e.startColumn&&s.endColumn>=e.endColumn}static realContain(s,e){return q.contains(s,e)&&(s.startRow<e.startRow||s.endRow>e.endRow||s.startColumn<e.startColumn||s.endColumn>e.endColumn)}static union(...s){return s.reduce((e,n)=>({startRow:Math.min(e.startRow,n.startRow),startColumn:Math.min(e.startColumn,n.startColumn),endRow:Math.max(e.endRow,n.endRow),endColumn:Math.max(e.endColumn,n.endColumn),rangeType:W.NORMAL}),s[0])}static subtract(s,e){if(e.startRow>s.endRow||e.endRow<s.startRow||e.startColumn>s.endColumn||e.endColumn<s.startColumn)return[s];const n=[];e.startRow>=s.startRow&&n.push({startRow:s.startRow,startColumn:s.startColumn,endRow:e.startRow-1,endColumn:s.endColumn}),e.endRow<=s.endRow&&n.push({startRow:e.endRow+1,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn});const r=Math.max(s.startRow,e.startRow),i=Math.min(s.endRow,e.endRow);return e.startColumn>=s.startColumn&&n.push({startRow:r,startColumn:s.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=s.endColumn&&n.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:s.endColumn}),n.filter(c=>c.startRow<=c.endRow&&c.startColumn<=c.endColumn)}};_(q,"getRelativeRange",(s,e)=>({startRow:s.startRow-e.startRow,endRow:s.endRow-s.startRow,startColumn:s.startColumn-e.startColumn,endColumn:s.endColumn-s.startColumn})),_(q,"getPositionRange",(s,e,n)=>({...n||{},startRow:n&&[p.ROW,p.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:s.startRow+e.startRow,endRow:n&&[p.ROW,p.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:s.endRow+s.startRow+e.startRow,startColumn:n&&[p.COLUMN,p.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:s.startColumn+e.startColumn,endColumn:n&&[p.COLUMN,p.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:s.endColumn+s.startColumn+e.startColumn})),_(q,"moveHorizontal",(s,e=0,n=0)=>({...s,startColumn:s.startColumn+e,endColumn:s.endColumn+e+n})),_(q,"moveVertical",(s,e=0,n=0)=>({...s,startRow:s.startRow+e,endRow:s.endRow+e+n})),_(q,"moveOffset",(s,e,n)=>({...s,startRow:s.startRow+n,endRow:s.endRow+n,startColumn:s.startColumn+e,endColumn:s.endColumn+e}));let Z=q;const cr=(t,s)=>s.length===t.length&&!t.some(e=>s.some(n=>!Z.equals(n,e))),ar=(t,s)=>s.length===t.length&&t.every((e,n)=>{const r=s[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Z.equals(e.range,r.range)});function lr(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||!t||typeof s!="object"||!s)return!1;const e=Object.keys(t),n=Object.keys(s);if(e.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(s);for(let i=0;i<e.length;i++){const o=e[i];if(!r(o))return!1;const c=t[o],a=s[o];if(c!==a)return!1}return!0}class Yt{constructor(){_(this,"_data",[])}static create(){return new Yt}add(s){this._data.indexOf(s)>-1||this._data.push(s)}delete(s){const e=this._data.indexOf(s);this._data.splice(e,1)}getData(){return this._data}}class zt{constructor(){_(this,"_data",new Map)}static create(){return new zt}add(s,e){this._data.has(s)||this._data.set(s,e)}delete(s){this._data.delete(s)}getData(){return this._data}}var w=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(w||{});class Pe{constructor(s){_(this,"_name");this._name=s}onStarting(s){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}_(Pe,"type",0);class ur{constructor(){_(this,"_plugins",[])}addPlugin(s){this._plugins.push(s)}removePlugins(){const s=this._plugins.slice();return this._plugins.length=0,s}forEachPlugin(s){this._plugins.forEach(s)}}class hr{constructor(){_(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(s,e){const n=s.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:s,options:e})}getRegisterPlugins(s){return this._pluginsRegisteredByBusiness.get(s)||[]}clearPluginsOfType(s){this._pluginsRegisteredByBusiness.delete(s)}}function K(t,s){const e=t.indexOf(s);return e>-1?(t.splice(e,1),!0):!1}function _r(t){const s=new Set,e=[];for(const n of t)s.has(n)||(s.add(n),e.push(n));return e}function dr(t,s){for(let e=t.length-1;e>-1;e--){const n=t[e];if(s(n,e))return n}return null}function Er(t,s){if(t.length===0)return t;const e=s%t.length;return t.slice(e).concat(t.slice(0,e))}function fr(t,s){const e=new Map;return t.forEach(n=>{const r=s(n);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(n)}),e}async function He(t){for(const[s,e]of t.entries())try{if(!await e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function Fe(t){for(const[s,e]of t.entries())try{if(!e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function We(t){var s=typeof Symbol=="function"&&Symbol.iterator,e=s&&t[s],n=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,s){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),r,i=[],o;try{for(;(s===void 0||s-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return i}function ke(t,s,e){if(e||arguments.length===2)for(var n=0,r=s.length,i;n<r;n++)(i||!(n in s))&&(i||(i=Array.prototype.slice.call(s,0,n)),i[n]=s[n]);return t.concat(i||Array.prototype.slice.call(s))}typeof SuppressedError=="function"&&SuppressedError;function ut(t){return typeof t=="function"}function gr(t){var s=function(n){Error.call(n),n.stack=new Error().stack},e=t(s);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Xt=gr(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
2
2
  `+e.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=e}});function Ge(t,s){if(t){var e=t.indexOf(s);0<=e&&t.splice(e,1)}}var $e=function(){function t(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var s,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=We(o),c=a.next();!c.done;c=a.next()){var h=c.value;h.remove(this)}}catch(m){s={error:m}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(s)throw s.error}}else o.remove(this);var u=this.initialTeardown;if(lt(u))try{u()}catch(m){i=m instanceof Xt?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=We(d),E=f.next();!E.done;E=f.next()){var g=E.value;try{pe(g)}catch(m){i=i!=null?i:[],m instanceof Xt?i=ke(ke([],Be(i)),Be(m.errors)):i.push(m)}}}catch(m){n={error:m}}finally{try{E&&!E.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(i)throw new Xt(i)}},t.prototype.add=function(s){var e;if(s&&s!==this)if(this.closed)pe(s);else{if(s instanceof t){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(s)}},t.prototype._hasParent=function(s){var e=this._parentage;return e===s||Array.isArray(e)&&e.includes(s)},t.prototype._addParent=function(s){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(s),e):e?[e,s]:s},t.prototype._removeParent=function(s){var e=this._parentage;e===s?this._parentage=null:Array.isArray(e)&&Ge(e,s)},t.prototype.remove=function(s){var e=this._finalizers;e&&Ge(e,s),s instanceof t&&s._removeParent(this)},t.EMPTY=function(){var s=new t;return s.closed=!0,s}(),t}();$e.EMPTY;function Ve(t){return t instanceof $e||t&&"closed"in t&&lt(t.remove)&&lt(t.add)&&lt(t.unsubscribe)}function pe(t){lt(t)?t():t.unsubscribe()}class xe{constructor(s=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(s)}initialize(s=!1){return this.skipNextObservers=s,this}stopPropagation(){this.isStopPropagation=!0}}function je(t){return t instanceof At}class At{constructor(s,e){_(this,"_willBeUnregistered",!1);_(this,"unregisterOnNextCall",!1);this.callback=s,this.observable=e}dispose(){this.observable.remove(this)}}class Ct{constructor(s){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new xe,s&&(this._onObserverAdded=s)}get observers(){return this._observers}add(s,e=!1,n=!1){if(!s)return null;const r=new At(s,this);return r.unregisterOnNextCall=n,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(s){return this.add(s,void 0,!0)}remove(s){return s&&this._observers.indexOf(s)!==-1?(this._deferUnregister(s),!0):!1}removeCallback(s){for(let e=0;e<this._observers.length;e++){const n=this._observers[e];if(!n._willBeUnregistered&&n.callback===s)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(s){this._remove(s),this._observers.unshift(s)}makeObserverBottomPriority(s){this._remove(s),this._observers.push(s)}notifyObservers(s){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=s,e.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(s,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(n=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(s){let e=Promise.resolve(s);if(!this._observers.length)return e;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(e=e.then(()=>i.callback(s,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>s)}notifyObserver(s,e){if(s._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,s.callback(e,n),s.unregisterOnNextCall&&this._deferUnregister(s),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const s=new Ct;return s._observers=this._observers.slice(0),s}_deferUnregister(s){s.unregisterOnNextCall=!1,s._willBeUnregistered=!0,setTimeout(()=>{this._remove(s)},0)}_remove(s){if(!s)return!1;const e=this._observers.indexOf(s);return e!==-1?(this._observers.splice(e,1),!0):!1}}function b(t){let s=!1;return Ve(t)?{dispose:()=>{s||(s=!0,t.unsubscribe())}}:je(t)?{dispose:()=>{s||(s=!0,t.dispose())}}:{dispose:()=>{s||(s=!0,t())}}}function cr(t){return b(()=>{t.unsubscribe()})}class Jt{constructor(){_(this,"_disposables",new Set)}add(s){return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(s=>{s.dispose(),this._disposables.delete(s)})}}class U{constructor(){_(this,"_disposed",!1);_(this,"_collection",new Jt)}disposeWithMe(s){const e=Ve(s)?b(s):s;return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class lr extends U{constructor(){super(...arguments);_(this,"dispose$",new A.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const nt=O.createIdentifier("univer.context-service");class Ke extends U{constructor(){super(...arguments);_(this,"_contextChanged$",new A.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var n;return(n=this._contextMap.get(e))!=null?n:!1}setContextValue(e,n){this._contextMap.set(e,n),this._contextChanged$.next({[e]:n})}subscribeContextValue$(e){return new A.Observable(n=>{const r=this._contextChanged$.pipe(A.filter(i=>typeof i[e]<"u")).subscribe(i=>n.next(i[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var 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 Z=O.createIdentifier("univer.log");class ze extends U{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):e(...n)}}var ur=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,_r=(t,s,e,n)=>{for(var r=n>1?void 0:n?hr(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&ur(s,e,r),r},Xe=(t,s)=>(e,n)=>s(e,n,t),Nt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Nt||{});const ut=O.createIdentifier("anywhere.command-service");class dr{constructor(){_(this,"_commands",new Map)}registerCommand(s){if(this._commands.has(s.id))throw new Error(`[CommandRegistry]: command "${s.id}" has been registered before.`);return this._commands.set(s.id,s),b(()=>{var e;this._commands.delete(s.id),(e=s.onDispose)==null||e.call(s)})}getCommand(s){return this._commands.has(s)?[this._commands.get(s)]:null}}l.CommandService=class{constructor(s,e){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=s,this._logService=e,this._commandRegistry=new dr,this._registerCommand(Je)}registerCommand(s){return this._registerCommand(s)}registerMultipleCommand(s){return this._registerMultiCommand(s)}beforeCommandExecuted(s){if(this._beforeCommandExecutionListeners.indexOf(s)===-1)return this._beforeCommandExecutionListeners.push(s),b(()=>{const e=this._beforeCommandExecutionListeners.indexOf(s);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(s){if(this._commandExecutedListeners.indexOf(s)===-1)return this._commandExecutedListeners.push(s),b(()=>{const e=this._commandExecutedListeners.indexOf(s);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(s,e,n){const r=this._commandRegistry.getCommand(s);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(h=>h(o,n));const c=await this._execute(i,e,n);return this._commandExecutedListeners.forEach(h=>h(o,n)),a.dispose(),c}throw new Error(`[CommandService]: command "${s}" is not registered.`)}syncExecuteCommand(s,e,n){var i;const r=this._commandRegistry.getCommand(s);if(r){const[o]=r,a={id:o.id,type:o.type,params:e};if(o.type===2){const u=rr(this._commandExecutionStack,d=>d.type===0);u&&(a.params=(i=a.params)!=null?i:{},a.params.trigger=u.id)}const c=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(u=>u(a,n));const h=this._syncExecute(o,e,n);return this._commandExecutedListeners.forEach(u=>u(a,n)),c.dispose(),h}throw new Error(`[CommandService]: command "${s}" is not registered.`)}_pushCommandExecutionStack(s){return this._commandExecutionStack.push(s),b(()=>Y(this._commandExecutionStack,s))}_registerCommand(s){return this._commandRegistry.registerCommand(s)}_registerMultiCommand(s){const e=this._commandRegistry.getCommand(s.id);let n;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");n=e[0]}else{const i=new Jt;n=new fr(s.id),i.add(this._commandRegistry.registerCommand(n)),i.add(b(()=>{this._multiCommandDisposables.delete(s.id)})),this._multiCommandDisposables.set(s.id,i)}const r=n.registerImplementation(s);return b(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(s.id))==null||i.dispose()})}async _execute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${s.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(s.handler,e,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${s.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(s.handler,e,n),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}},l.CommandService=_r([Xe(0,O.Inject(O.Injector)),Xe(1,Z)],l.CommandService);class fr{constructor(s){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(s,e)=>{if(!this._implementations.length)return!1;const n=s.get(Z),r=s.get(nt),i=s.get(O.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=s,this.name=s}registerImplementation(s){const e={command:s};return this._implementations.push(e),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),b(()=>{var r;const n=this._implementations.indexOf(e);this._implementations.splice(n,1),(r=s.onDispose)==null||r.call(s)})}hasImplementations(){return this._implementations.length>0}}function Qt(t,s,e){const n=t.map(r=>()=>s.syncExecuteCommand(r.id,r.params,e));return He(n)}function Er(t,s,e){const n=t.map(r=>()=>s.executeCommand(r.id,r.params,e));return Fe(n)}const Je={id:"nil",type:0,handler:()=>!0},Qe=O.createIdentifier("univer.config-service");class qe{constructor(){_(this,"_config",new Map)}getConfig(s){return this._config.get(s)}setConfig(s,e){this._config.set(s,e)}deleteConfig(s){this._config.delete(s)}}class Ze extends U{constructor(){super(...arguments);_(this,"_error$",new A.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const gr="__default_document_sub_component_id20231101__";class ye{constructor(){_(this,"_managerInfo",new Map);_(this,"_remove$",new A.Subject);_(this,"remove$",this._remove$.asObservable());_(this,"_andOrUpdate$",new A.Subject);_(this,"andOrUpdate$",this._andOrUpdate$.asObservable());_(this,"_pluginUpdate$",new A.Subject);_(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(s){return this._getFloatingObject(s)}getFloatObjects(s){return this._getFloatingObjects(s)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(s){const e=this._clearByParam(s);this._remove$.next(e)}addOrUpdate(s){const e=this._addByParam(s);this._andOrUpdate$.next(e)}BatchAddOrUpdate(s){const e=[];s.forEach(n=>{e.push(...this._addByParam(n))}),this._andOrUpdate$.next(e)}remove(s){const e=this._removeByParam(s);this._remove$.next(e)}pluginUpdateRefresh(s){this._pluginUpdate$.next(s)}_getFloatingObjects(s){var r;if(s==null)return;const{unitId:e,subUnitId:n}=s;return(r=this._managerInfo.get(e))==null?void 0:r.get(n)}_getFloatingObject(s){var i,o;if(s==null)return;const{unitId:e,subUnitId:n,floatingObjectId:r}=s;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(s){const{unitId:e,subUnitId:n,floatingObject:r,floatingObjectId:i}=s;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:e,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(s){const e=this._getFloatingObjects(s),{unitId:n,subUnitId:r}=s,i=[];return e==null||e.forEach((o,a)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:a,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(s){const e=this._getFloatingObjects(s),n=e==null?void 0:e.get(s.floatingObjectId);return n==null?[]:(e==null||e.delete(s.floatingObjectId),[{...s,floatingObject:n}])}}const ts=O.createIdentifier("univer.floating-object.service");class es{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(s){this.cursor+=s}moveCursorTo(s){this.cursor=s}}function ss(t,s){let e=0,n=t.length-1;for(;e<=n;){const r=Math.floor((n+e)/2);if(s<t[r]&&(r===0||s>=t[r-1]))return r;if(s>=t[r])e=r+1;else if(s<t[r])n=r-1;else return-1}return-1}function ns(t,s){let e=0,n=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(n=t[o],o===0?r=0:r=t[o-1],s>=r&&s<=n){i=o;break}if(n=t[e],e===0?r=0:r=t[e-1],s>=r&&s<n){i=e;break}e++,o--}return i}function Rr(t,s){let e=t.length-1;return s<0?-1:s<t[0]?0:s>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||s<=t[20]||s>=t[e-20]?e=ns(t,s):e=ss(t,s),e)}function mr(t){const s=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(s)}var rs=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(rs||{}),v=(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))(v||{}),is=(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))(is||{}),B=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(B||{}),os=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(os||{}),as=(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))(as||{}),cs=(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))(cs||{}),ls=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(ls||{}),us=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(us||{}),hs=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(hs||{});function Or(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var _s=(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))(_s||{}),ds=(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))(ds||{}),y=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(y||{}),fs=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(fs||{}),Es=(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))(Es||{}),gs=(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))(gs||{}),St=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(St||{}),ht=(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))(ht||{}),Rs=(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))(Rs||{}),tt=(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))(tt||{}),rt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(rt||{}),it=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(it||{}),Lt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Lt||{}),vt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(vt||{}),bt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(bt||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),_t=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(_t||{}),F=(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))(F||{}),Dt=(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))(Dt||{});const ms={[Dt.OFFICE]:{[F.ACCENT1]:"#4472C4",[F.ACCENT2]:"#ED7D31",[F.ACCENT3]:"#A5A5A5",[F.ACCENT4]:"#70AD47",[F.ACCENT5]:"#5B9BD5",[F.ACCENT6]:"#70AD47",[F.DARK1]:"#000000",[F.DARK2]:"#44546A",[F.LIGHT1]:"#FFFFFF",[F.LIGHT2]:"#E7E6E6",[F.HYPERLINK]:"#0563C1",[F.FOLLOWED_HYPERLINK]:"#954F72"}};class wt{constructor(){_(this,"_themeValue",F.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=B.UNSUPPORTED,this._themeColors=Dt.OFFICE,this._themeTint=0}asRgbColor(){return new Tt(this._rgbValue,this)}asThemeColor(){return new Ut(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case B.THEME:return this.asThemeColor();case B.RGB:return this.asRgbColor();case B.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(s){return this._colorType=B.RGB,this._rgbValue=s,this}setThemeColors(s){this._colorType=B.THEME,this._themeColors=s}setThemeTint(s){this._colorType=B.THEME,this._themeTint=s}setThemeColor(s){return this._colorType=B.THEME,this._themeValue=s,this}getColorType(){return this._colorType}}class et{constructor(s){_(this,"_builder");this._builder=s}static rgbColorToHexValue(s){return`#${((1<<24)+(s.getRed()<<16)+(s.getGreen()<<8)+s.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(s){s?s.indexOf("#")>-1&&(s=s.substring(1)):s="#000000";const e=+`0x${s[0]}${s[1]}`,n=+`0x${s[2]}${s[3]}`,r=+`0x${s[4]}${s[5]}`;return new wt().setRgbColor(`rgb(${e},${n},${r})`).asRgbColor()}static hexToRgbString(s){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;s=s.replace(e,(i,o,a,c)=>o+o+a+a+c+c);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),a=Number.parseInt(n[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new et(this._builder)}equals(s){return!1}}class Os{constructor(s){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const e=s.getRed()/255,n=s.getGreen()/255,r=s.getBlue()/255,i=s.getAlpha()/255,o=Math.min(e,Math.min(n,r)),a=Math.max(e,Math.max(n,r)),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),e===a&&(this._hue=(n-r)/c),n===a&&(this._hue=2+(r-e)/c),r===a&&(this._hue=4+(e-n)/c),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const s=new wt;if(this._saturation===0)return s.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),s.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,n,i),a=this.setColor(e,n,r),c=r-1/3,h=this.setColor(e,n,c);return s.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(h*255)},${this._alpha*255})`),s.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(s,e,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=e+(s-e)*6*n:2*n<1?r=s:3*n<2?r=e+(s-e)*(2/3-n)*6:r=e,r}setLightness(s){this._lightness=s}}const G=class G extends et{constructor(e,n){super(n);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=e.match(G.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],c=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=c;return}if(r=e.match(G.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return et.rgbColorToHexValue(this)}getRed(){let e=this._red+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return B.RGB}clone(){return new G(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof G?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(G,"RGB_COLOR_AMT",0),_(G,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(G,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Tt=G;const J=class J extends et{constructor(e,n,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=e,this._themeTint=n,this._themeColors=r}lumValue(e,n){if(e==null)return n;let r;return e<0?r=n*(1+e):r=n*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=ms[this._themeColors];if(e==null)throw new Error("not find themeColors type");const n=e[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(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 Os(et.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(e){return e instanceof J?e._themeColorType===this._themeColorType:!1}getColorType(){return B.THEME}getThemeColorType(){return this._themeColorType}};_(J,"_cacheThemeColor",new Map);let Ut=J;const Ir="rgb(",Ar="rgba(",qt={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 ${constructor(s){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(s==null){this._setNullColor();return}if(s instanceof $){this._color={...s._color},this._rgbColor={...s._rgbColor};return}const e=Is(s);if(e==null){this._setNullColor();return}this._color=e;const n=vr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(s,e,n){var h,u;n=Math.min(1,Math.max(0,n));const r=new $(s).toRgb(),i=new $(e).toRgb(),o=(h=r.a)!=null?h:1,a=(u=i.a)!=null?u: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 $(c)}static getContrastRatio(s,e){const n=new $(s).getLuminance(),r=new $(e).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:s,g:e,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${s},${e},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(s){const{r:e,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(r).toString(16)),Mt(Math.round(i*255).toString(16))];return s&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Tr(this.toRgb())}toHsl(){return wr(this.toRgb())}lighten(s=10){const e=this.toHsl();return e.l+=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}darken(s=10){const e=this.toHsl();return e.l-=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}setAlpha(s){return new $({...this._rgbColor,a:s})}getLuminance(){let{r:s,g:e,b:n}=this.toRgb();return s=Zt(s),e=Zt(e),n=Zt(n),Number((.2126*s+.7152*e+.0722*n).toFixed(3))}getBrightness(){const{r:s,g:e,b:n}=this.toRgb();return(s*299+e*587+n*114)/1e3}getAlpha(){var s;return(s=this._color.a)!=null?s:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const Mt=t=>t.length===1?`0${t}`:t,Zt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Is=t=>{if(Mr(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const s=t.trim();if(qt[s]){const e=qt[s],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(s.startsWith("#"))return Cr(s);if(s.startsWith("rgb"))return Nr(s);if(s.startsWith("hsl"))return Sr(s);if(s.startsWith("hsv"))return Lr(s)},Cr=t=>{const s=t.substring(1),e=new RegExp(`.{1,${s.length>=6?2:1}}`,"g");let n=s.match(e);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:Number.parseInt(n[0],16),g:Number.parseInt(n[1],16),b:Number.parseInt(n[2],16)};return n.length>3&&(r.a=Number.parseInt(n[3],16)/255),r},Nr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Sr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Lr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},vr=t=>{const s=Is(t);if(s!=null)return"r"in s?s:"l"in s?br(s):Dr(s)},yt=(t,s,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(s-t)*6*e:e<1/2?s:e<2/3?t+(s-t)*(2/3-e)*6:t),br=t=>{let{h:s,s:e,l:n}=t;s/=360,e/=100,n/=100;let r=0,i=0,o=0;if(e===0)r=i=o=n;else{const c=n<.5?n*(1+e):n+e-n*e,h=2*n-c;r=yt(h,c,s+1/3),i=yt(h,c,s),o=yt(h,c,s-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},Dr=t=>{let{h:s,s:e,v:n}=t;s=s/360*6,e/=100,n/=100;const r=Math.floor(s),i=s-r,o=n*(1-e),a=n*(1-i*e),c=n*(1-(1-i)*e),h=r%6,u=[n,a,o,o,c,n][h],d=[c,n,n,a,o,o][h],f=[o,o,c,n,n,a][h],E={r:u*255,g:d*255,b:f*255};return t.a!==void 0&&(E.a=t.a),E},wr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n),o=(r+i)/2;let a,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 s:a=(e-n)/u+(e<n?6:0);break;case e:a=(n-s)/u+2;break;default:a=(s-e)/u+4;break}a/=6}const h={h:Math.round(a*360),s:Math.round(c*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},Tr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n);let o;const a=r,c=r-i,h=r===0?0:c/r;if(r===i)o=0;else{switch(r){case s:o=(e-n)/c+(e<n?6:0);break;case e:o=(n-s)/c+2;break;default:o=(s-e)/c+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},Ur=t=>t==null,Mr=t=>!Ur(t)&&typeof t=="object";function Pr(t){const s=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,n=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}function Fr(t){const s=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,n=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}var M=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(M||{});const Hr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Wr=t=>crypto.getRandomValues(new Uint8Array(t)),Br=(t,s,e)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*s/t.length);return(i=s)=>{let o="";for(;;){let a=e(r),c=r;for(;c--;)if(o+=t[a[c]&n]||"",o.length===i)return o}}},kr=(t,s=21)=>Br(t,s,Wr),Gr=(t=21)=>{let s="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)s+=Hr[e[t]&63];return s};const $r=/^-ms-/,Vr=/-([a-z])/g,z=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class R{static stringAt(s){let e="",n=s;for(;n>=z.length;)n/=z.length,n-=1,e+=z[n%z.length];const r=s%z.length;return e+=z[r],e}static indexAt(s){let e=0;for(let n=0;n<s.length-1;n+=1){const r=s.charCodeAt(n)-65,i=s.length-1-n;e+=z.length**i+z.length*r}return e+=s.charCodeAt(s.length-1)-65,e}static deleteBlank(s){return R.isString(s)?s.replace(/\s/g,""):s}static getSystemType(){const s=navigator.userAgent,e=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!e&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(s.indexOf("Windows NT 5.0")>-1||s.indexOf("Windows 2000")>-1)return"Windows 2000";if(s.indexOf("Windows NT 5.1")>-1||s.indexOf("Windows XP")>-1)return"Windows XP";if(s.indexOf("Windows NT 5.2")>-1||s.indexOf("Windows 2003")>-1)return"Windows 2003";if(s.indexOf("Windows NT 6.0")>-1||s.indexOf("Windows Vista")>-1)return"Windows Vista";if(s.indexOf("Windows NT 6.1")>-1||s.indexOf("Windows 7")>-1)return"Windows 7";if(s.indexOf("Windows NT 10")>-1||s.indexOf("Windows 10")>-1)return"Windows 10";if(s.indexOf("Windows NT 11")>-1||s.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const s=navigator.userAgent,e=s.indexOf("Opera")>-1,n=s.indexOf("compatible")>-1&&s.indexOf("MSIE")>-1&&!e,r=s.indexOf("Trident")>-1&&s.indexOf("rv:11.0")>-1,i=s.indexOf("Edge")>-1,o=s.indexOf("Firefox")>-1,a=s.indexOf("Safari")>-1&&s.indexOf("Chrome")===-1,c=s.indexOf("Chrome")>-1&&s.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(s);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":e?"Opera":a?"Safari":c?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(s=21,e){return e?kr(e,s)():Gr(s)}static getClassName(s){return s.constructor.name}static deepMerge(s,...e){e.forEach(o=>o&&i(o));function n(o,a){o.forEach((c,h)=>{var u,d;if(R.isArray(c)){const f=(u=a[h])!=null?u:[];a[h]=f,n(c,f);return}if(R.isObject(c)){const f=(d=a[h])!=null?d:{};a[h]=f,r(c,f);return}a[h]=c})}function r(o,a){Object.keys(o).forEach(c=>{var u,d;const h=o[c];if(R.isObject(h)){const f=(u=a[c])!=null?u:{};a[c]=f,r(h,f);return}if(R.isArray(h)){const f=(d=a[c])!=null?d:[];a[c]=f,n(h,f);return}a[c]=h})}function i(o){Object.keys(o).forEach(a=>{var h,u;const c=o[a];if(R.isArray(c)){const d=(h=s[a])!=null?h:[];s[a]=d,n(c,d);return}if(R.isObject(c)){const d=(u=s[a])!=null?u:{};s[a]=d,r(c,d);return}s[a]=c})}return s}static numberFixed(s,e){return Number(Number(s).toFixed(e))}static diffValue(s,e){function n(o,a){const c=R.getValueType(o),h=R.getValueType(a);return c!==h?!1:R.isArray(o)?r(o,a):R.isObject(o)?i(o,a):R.isDate(o)?o.getTime()===a.getTime():R.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(s.length!==e.length)return!1;for(let c=0,h=o.length;c<h;c++){const u=o[c],d=a[c];if(!n(u,d))return!1}return!0}function i(o,a){const c=Object.keys(o),h=Object.keys(a);if(c.length!==h.length)return!1;for(const u of c){if(!h.includes(u))return!1;const d=o[u],f=a[u];if(!n(d,f))return!1}return!0}return n(s,e)}static deepClone(s){if(!this.isDefine(s))return s;if(this.isRegExp(s))return new RegExp(s);if(this.isDate(s))return new Date(s);if(this.isArray(s)){const e=[];return s.forEach((n,r)=>{e[r]=R.deepClone(n)}),e}if(this.isObject(s)){const e={};return Object.keys(s).forEach(n=>{const r=s[n];e[n]=R.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(s)),e}return s}static getLanguage(){const s="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||s}static getValueType(s){return Object.prototype.toString.apply(s)}static isDefine(s){return s!=null}static isBlank(s){return this.isDefine(s)?this.isString(s)?s.trim()==="":!1:!0}static isAssignableFrom(s,e){return s instanceof e}static isBoolean(s){return this.getValueType(s)==="[object Boolean]"}static isPlainObject(s){return this.isDefine(s)?Object.getPrototypeOf(s)===Object.getPrototypeOf({}):!1}static isFunction(s){return this.getValueType(s)==="[object Function]"}static isDate(s){return this.getValueType(s)==="[object Date]"}static isRegExp(s){return this.getValueType(s)==="[object RegExp]"}static isArray(s){return this.getValueType(s)==="[object Array]"}static isString(s){return this.getValueType(s)==="[object String]"}static isNumber(s){return this.getValueType(s)==="[object Number]"}static isStringNumber(s){return!isNaN(Number.parseFloat(s))&&isFinite(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isEmptyObject(s){for(const e in s)return!1;return!0}static isMobile(){let s=0,e=0;return document.body.clientWidth&&(s=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||s<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const s=navigator.userAgent.toLowerCase();return String(s.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const s=navigator.userAgent;return s.indexOf("Android")>-1||s.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(s){return e=>{for(let n=0;n<s;n++)e&&e()}}static hasLength(s,e){return R.isDefine(s)?R.isDefine(e)?s.length===e:s.length>0:!1}static capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}static fCamelCase(s,e){return e.toUpperCase()}static camelCase(s){return s.replace($r,"ms-").replace(Vr,this.fCamelCase)}static removeNull(s){return this.isObject(s)&&Object.keys(s).forEach(e=>{const n=s[e];n==null?delete s[e]:R.removeNull(n)}),s}static fillTwoDimensionalArray(s,e,n){return new Array(s).fill(n).map(r=>new Array(e).fill(n))}static numToWord(s){let e="";for(;s>0;){let n=s%26;n=n===0?n=26:n,e=String.fromCharCode(96+n)+e,s=(s-n)/26}return e.toLocaleUpperCase()}static ABCatNum(s){if(s==null||s.length===0)return Number.NaN;const e=s.toLowerCase().split(""),n=e.length;let r=0,i=0;for(let o=0;o<n;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(s){let i="";for(;s>=0;)i=String.fromCharCode(s%26+97)+i,s=Math.floor(s/26)-1;return i.toUpperCase()}static randSort(s){for(let e=0,n=s.length;e<n;e++){const r=Number.parseInt((Math.random()*n).toString()),i=s[r];s[r]=s[e],s[e]=i}return s}static commonExtend(s,e){const n={};for(const r in s)n[r]=s[r];for(const r in e)e[r]!=null&&(n[r]=e[r]);return n}static commonExtend1(s,e){for(const n in s)e[n]==null&&(e[n]=s[n]);return e}static arrayToObject(s){const e={};return s.forEach((n,r)=>{e[r]={},n.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(s,e,n,r){return e>=n&&r>=s}}function pr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:c,endX:h}=t,u=s,d=e,f=s,E=e;if(n&&i){const{startRow:g,startColumn:m,endRow:N,endColumn:S,startY:H,endY:P,startX:q,endX:ra}=i;u=g,d=m,f=N,E=S,o=H,a=P,c=q,h=ra}return r&&(o=i.startY,a=i.endY,c=i.startX,h=i.endX,f=i.endRow,E=i.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:E,startY:o,endY:a,startX:c,endX:h}}function xr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:c}=t;let h=s,u=e,d=s,f=e;return(n||r)&&(h=i,u=o,d=a,f=c),{startRow:h,startColumn:u,endRow:d,endColumn:f}}function jr(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function p(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new wt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Kr(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function Yr(t){return R.isString(t)&&t.indexOf("=")===-1&&t.length===6}function zr(t){return""}function Xr(t,s=!1){var i;let e="";const n=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,c)=>`${c} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${p(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,c)=>`${c} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${p(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,c)=>`${c} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${p(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${p(t.bg)}; `)}],["bd",()=>{var o,a,c,h,u,d,f,E,g,m,N,S;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${Pt((a=t.bd)==null?void 0:a.b.s)} ${(c=p(t.bd.b.cl))!=null?c:""}; `),(h=t.bd)!=null&&h.t&&(e+=`border-top: ${Pt((u=t.bd)==null?void 0:u.t.s)} ${(d=p(t.bd.t.cl))!=null?d:""}; `),(f=t.bd)!=null&&f.r&&(e+=`border-right: ${Pt((E=t.bd)==null?void 0:E.r.s)} ${(g=p(t.bd.r.cl))!=null?g:""}; `),(m=t.bd)!=null&&m.l&&(e+=`border-left: ${Pt((N=t.bd)==null?void 0:N.l.s)} ${(S=p(t.bd.l.cl))!=null?S:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${p(t.cl)}; `)}],["va",()=>{t.va===bt.SUBSCRIPT?e+="vertical-align: sub; ":t.va===bt.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===ht.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===ht.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,a,c;t.tr&&(e+=`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===tt.LEFT?e+="text-align: left; ":t.ht===tt.RIGHT?e+="text-align: right; ":t.ht===tt.CENTER?e+="text-align: center; ":t.ht===tt.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===rt.BOTTOM?e+="vertical-align: bottom; ":t.vt===rt.TOP?e+="vertical-align: top; ":t.vt===rt.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===it.CLIP?e+="text-overflow: clip; ":t.tb===it.OVERFLOW?e+="text-break: overflow; ":t.tb===it.WRAP&&(e+="word-wrap: break-word;")}],["pd",()=>{var u,d,f,E,g,m,N,S;const o=`${(u=t.pd)==null?void 0:u.b}pt`,a=`${(d=t.pd)==null?void 0:d.t}pt`,c=`${(f=t.pd)==null?void 0:f.l}pt`,h=`${(E=t.pd)==null?void 0:E.r}pt`;(g=t.pd)!=null&&g.b&&(e+=`padding-bottom: ${o}; `),(m=t.pd)!=null&&m.t&&(e+=`padding-top: ${a}; `),(N=t.pd)!=null&&N.l&&(e+=`padding-left: ${c}; `),(S=t.pd)!=null&&S.r&&(e+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)s&&r.includes(o)||(i=n.get(o))==null||i();return e}function Pt(t){let s="";return t===v.NONE?s="none":t===v.THIN?s="0.5pt solid":t===v.HAIR?s="0.5pt double":t===v.DOTTED?s="0.5pt dotted":t===v.DASHED||t===v.DASH_DOT?s="0.5pt dashed":t===v.DASH_DOT_DOT?s="0.5pt dotted":t===v.DOUBLE?s="0.5pt double":t===v.MEDIUM?s="1pt solid":t===v.MEDIUM_DASHED||t===v.MEDIUM_DASH_DOT?s="1pt dashed":t===v.MEDIUM_DASH_DOT_DOT?s="1pt dotted":t===v.SLANT_DASH_DOT?s="0.5pt dashed":t===v.THICK&&(s="1.5pt solid"),s}function Jr(t){let s=0;if(t=t.trim(),t==="none")s=v.NONE;else if(t==="0.5pt solid")s=v.THIN;else if(t==="0.5pt double")s=v.HAIR;else if(t==="0.5pt dotted")s=v.DOTTED;else if(t==="0.5pt dashed")s=v.DASHED;else if(t==="1pt solid")s=v.MEDIUM;else if(t==="1pt dashed")s=v.MEDIUM_DASHED;else if(t==="1pt dotted")s=v.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")s=v.THICK;else return v.NONE;return s}function Ft(t,s){let e=t.body;if(s){const{headers:n,footers:r}=t;n!=null&&n[s]?e=n[s].body:r!=null&&r[s]&&(e=r[s].body)}return e}function Qr(t){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=t;return!(s<0||n<0||e<0||r<0)}function qr(t,s){return{startRow:t,endRow:t,startColumn:s,endColumn:s}}function te(t,s){return Object.prototype.toString.call(t)===Object.prototype.toString.call(s)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(s).length?!1:Object.keys(t).every(e=>te(t[e],s[e])):t===s:!1}function As(t,s){const e=t.ts||{},n=s.ts||{};return t.sId!==s.sId?!1:te(e,n)}function Zr(t,s){return s.some(e=>t.indexOf(e)>-1)}function ee(t,s,e,n){if(t>s&&([t,s]=[s,t]),e>n&&([e,n]=[n,e]),s<e||n<t)return[t,s];e<t&&(e=t),n>s&&(n=s);const r=n-e+1;let i=[];return t===e?i=[n+1-r,s-r]:s===n?i=[t,e-1]:i=[t,s-r],i}function yr(t){if(t==null)return!1;const s=t.bullet;return(s==null?void 0:s.listId)!=null}function ti(t){if(t==null)return!1;const s=t.paragraphStyle;return Cs(s)}function Cs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Ns(t,s,e){return t.slice(0,s)+e+t.slice(s)}function Ss(t,s,e){return s>e?t:t.slice(0,s)+t.slice(e)}function ei(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function si(t){let s=0;for(let e=0;e<t.length;e++)s=t.charCodeAt(e)+(s<<6)+(s<<16)-s;return s>>>0}class dt{static hasLength(s,e){return s.length===e}static getValueType(s){return Object.prototype.toString.apply(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isIterable(s){return s[Symbol.iterator]!=null}static isNumber(s){return this.getValueType(s)==="[object Number]"}}const L=Symbol("newer"),T=Symbol("older");class Ls{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.key}):{done:!0,value:void 0}}}class vs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.value}):{done:!0,value:void 0}}}class bs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:[s.key,s.value]}):{done:!0,value:void 0}}}class se{constructor(s,e){_(this,"key");_(this,"value");_(this,sa);_(this,na);this.key=s,this.value=e,this[L]=void 0,this[T]=void 0}toJSON(){return{key:this.key,value:this.value}}}sa=L,na=T;class Ds{constructor(...s){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(dt.hasLength(s,1)){if(dt.isNumber(s[0])){const e=s[0];this._initialize(e,void 0);return}if(dt.isIterable(s[0])){const e=s[0];this._initialize(0,e);return}return}if(dt.hasLength(s,2)){const e=s[0],n=s[1];this._initialize(e,n)}}onShift(s){if(this._onShiftListeners.indexOf(s)===-1)return this._onShiftListeners.push(s),b(()=>Y(this._onShiftListeners,s));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(s,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=s,this._keymap=new Map,e&&(this.assign(e),s<1&&(this.limit=this.size))}_markEntryAsUsed(s){s!==this.newest&&(s[L]&&(s===this.oldest&&(this.oldest=s[L]),s[L][T]=s[T]),s[T]&&(s[T][L]=s[L]),s[L]=void 0,s[T]=this.newest,this.newest&&(this.newest[L]=s),this.newest=s)}assign(s){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=s[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new se(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[L]=o,o[T]=e):this.oldest=o,e=o,n--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(s,e){let n=this._keymap.get(s);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(s,n=new se(s,e)),this.newest?(this.newest[L]=n,n[T]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const s=this.oldest;if(s)return this.oldest&&this.oldest[L]?(this.oldest=this.oldest[L],this.oldest[T]=void 0):(this.oldest=void 0,this.newest=void 0),s[L]=s[T]=void 0,this._keymap.delete(s.key),--this.size,this._onShiftListeners.forEach(e=>e(s)),[s.key,s.value]}get(s){const e=this._keymap.get(s);if(e)return this._markEntryAsUsed(e),e.value}has(s){return this._keymap.has(s)}find(s){const e=this._keymap.get(s);return e?e.value:void 0}delete(s){const e=this._keymap.get(s);if(e)return this._keymap.delete(e.key),e[L]&&e[T]?(e[T][L]=e[L],e[L][T]=e[T]):e[L]?(e[L][T]=void 0,this.oldest=e[L]):e[T]?(e[T][L]=void 0,this.newest=e[T]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Ls(this.oldest)}values(){return new vs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bs(this.oldest)}forEach(s,e){typeof e!="object"&&(e=this);let n=this.oldest;for(;n;)s.call(e,n.value,n.key,this),n=n[L]}toJSON(){const s=new Array(this.size);let e=0,n=this.oldest;for(;n;)s[e++]={key:n.key,value:n.value},n=n[L];return s}toString(){let s="",e=this.oldest;for(;e;)s+=`${String(e.key)}:${e.value}`,e=e[L],e&&(s+=" < ");return s}}function x(t){let s=0;const e=Object.keys(t);for(const n of e){const r=Number(n);s=Math.max(s,r)}return s+1}function ne(t,s,e){const n=x(e),r=e;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=s}function re(t,s,e,n){const r=t+s,i=x(e),o=e;let a=0;const c={};for(let f=t;f<r;f++){const E=o[f];E!==void 0&&(delete o[f],c[a]=E,a++)}const h=n?x(n):0,u=t-r+h,d=i;if(u>0)for(let f=d-1;f>=r;f--)o[f]!==void 0&&(o[f+u]=o[f],delete o[f]);else if(u<0)for(let f=r;f<d;f++)o[f]!==void 0&&(o[f+u]=o[f],delete o[f]);if(n)for(let f=0;f<h;f++)o[t+f]=n[f];return c}function ni(t,s){const e=t,n=Object.keys(e),r=n.length,i=s,o=Object.keys(i),a=o.length,c={};let h=0;for(let u=0;u<r;u++,h++){const d=n[u];c[h]=e[d]}for(let u=0;u<a;u++,h++){const d=o[u];c[h]=i[d]}return c}function ri(t,s,e){const n=e;if(x(e)>0){const i={};let o=0;for(let a=t;a<=s;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function ie(t,s,e,n){const r=t>e;if(!r&&t+s>e)throw new Error("Invalid move operation");r?ii(t,s,e,n):oi(t,s,e,n)}function ii(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const a=r[o];r[o+s]=a,a===void 0&&delete r[o+s]}i.forEach((o,a)=>{r[e+a]=o,o===void 0&&delete r[e+a]})}function oi(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t+s;o<e;o++){const a=r[o];r[o-s]=a,a===void 0&&delete r[o-s]}i.forEach((o,a)=>{r[e+a-s]=o,o===void 0&&delete r[e+a-s]})}class V{constructor(s={}){_(this,"_matrix");this._setOriginValue(s)}static MakeObjectMatrixSize(s){return new V({[s-1]:{}})}getMatrix(){return this._matrix}forEach(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,o)===!1)return this}return this}forRow(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,Object.keys(o).map(c=>Number(c)))===!1)return this}return this}forValue(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(!o)continue;const a=Object.keys(o);for(const c of a){const h=Number(c),u=o[Number(c)];if(s(i,h,u)===!1)return this}}return this}swapRow(s,e){const n=this._matrix[s],r=this._matrix[e];this._matrix[s]=r,this._matrix[e]=n}getRow(s){return this._matrix[s]}getRowOrCreate(s){let e=this.getRow(s);return e==null&&(e={},this._matrix[s]=e),e}reset(){this._setOriginValue({})}hasValue(){const s=this._matrix,e=Object.keys(s);if(e.length===0)return!1;for(const n of e){const r=Number(n),i=s[r];if(Object.keys(i).length>0)return!0}return!1}getValue(s,e){var n,r;return(r=(n=this._matrix)==null?void 0:n[s])==null?void 0:r[e]}setValue(s,e,n){const r=this.getRowOrCreate(s);r[e]=n}deleteValue(s,e){var n,r;(r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e]}realDeleteValue(s,e){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e],this.getRow(s)){const o=this.getRow(s);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[s])}}setRow(s,e){this._matrix[s]=e}moveRows(s,e,n){ie(s,e,n,this._matrix)}moveColumns(s,e,n){this.forEach((r,i)=>{ie(s,e,n,i)})}insertRows(s,e){for(let n=s;n<s+e;n++)ne(n,{},this._matrix)}insertColumns(s,e){for(let n=s;n<s+e;n++)this.forEach((r,i)=>{ne(n,void 0,i)})}removeRows(s,e){re(s,e,this._matrix)}removeColumns(s,e){this.forEach((n,r)=>{re(s,e,r)})}getFragment(s,e,n,r){const i=new V;let o=0;for(let a=s;a<=e;a++){const c={};let h=0;for(let u=n;u<=r;u++){const d=this.getValue(a,u);c[h]=d,h++}i.setRow(o,c),o++}return i}getSlice(s,e,n,r){const i=new V;for(let o=s;o<=e;o++)for(let a=n;a<=r;a++){const c=this.getValue(o,a);c&&i.setValue(o,a,R.deepClone(c))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return x(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=x(a)-1;r=c>r?c:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const s=new Array;return this.forValue((e,n,r)=>{s.push(r)}),s}toArray(){const s=[];return this.forRow((e,n)=>{s[e]==null&&(s[e]=[]),n.forEach(r=>{s[e][r]=this.getValue(e,r)})}),s}toJSON(){return this._matrix}clone(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getData(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getArrayData(){let s=0,e=0,n=!1,r=!1;const i=new V;return this.forEach((o,a)=>{n||(n=!0,s=o),Object.keys(a).forEach(c=>{const h=Number(c);r?h<e&&(e=h):(r=!0,e=h);const u=this.getValue(o,h);i.setValue(o-s,h-e,u)})}),i.getData()}getDataRange(){let s=0,e=0,n=0,r=-1,i=!1,o=!1;return this.forEach((a,c)=>{i||(i=!0,s=a);const h=x(c)-1;h>n&&(n=h),Object.keys(c).forEach(u=>{const d=Number(u);o?d<e&&(e=d):(o=!0,e=d)}),a>r&&(r=a)}),{startRow:s,startColumn:e,endRow:r,endColumn:n}}getDiscreteRanges(){const s=[];return this.forEach((e,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of s)if(e>=a.startRow&&e<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(e,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||s.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),s}merge(s){this.forValue((e,n)=>{const r=s.getValue(e,n);r!=null&&this.setValue(e,n,r)})}_setOriginValue(s={}){this._matrix=s}}var oe=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(oe||{});class ws{constructor(){_(this,"status","init")}}const ai=t=>t.some(s=>s.status==="init")?"init":t.some(s=>s.status==="fetching")?"fetching":"done";var W=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(W||{}),j=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(j||{});function ci(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const Q=class Q{static clone(s){return s.rangeType!==void 0?{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType}:{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn}}static equals(s,e){return s==null||e==null?!1:s.endRow===e.endRow&&s.endColumn===e.endColumn&&s.startRow===e.startRow&&s.startColumn===e.startColumn&&(s.rangeType===e.rangeType||s.rangeType===void 0&&e.rangeType===W.NORMAL||e.rangeType===void 0&&s.rangeType===W.NORMAL)}static intersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,a=e.startRow,c=e.endRow,h=e.startColumn,u=e.endColumn,d=Math.abs(i+o-h-u),f=Math.abs(i-o)+Math.abs(h-u),E=Math.abs(n+r-a-c),g=Math.abs(n-r)+Math.abs(a-c);return d<=f&&E<=g}static getIntersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,a=e.startRow,c=e.endRow,h=e.startColumn,u=e.endColumn;let d,f,E,g;if(a<=r)a>=n?f=a:f=n;else return null;if(c>=n)c>=r?g=r:g=c;else return null;if(h<=o)h>i?d=h:d=i;else return null;if(u>=i)u>=o?E=o:E=u;else return null;return{startRow:f,endRow:g,startColumn:d,endColumn:E,rangeType:W.NORMAL}}static contains(s,e){return s.startRow<=e.startRow&&s.endRow>=e.endRow&&s.startColumn<=e.startColumn&&s.endColumn>=e.endColumn}static realContain(s,e){return Q.contains(s,e)&&(s.startRow<e.startRow||s.endRow>e.endRow||s.startColumn<e.startColumn||s.endColumn>e.endColumn)}static union(...s){return s.reduce((e,n)=>({startRow:Math.min(e.startRow,n.startRow),startColumn:Math.min(e.startColumn,n.startColumn),endRow:Math.max(e.endRow,n.endRow),endColumn:Math.max(e.endColumn,n.endColumn),rangeType:W.NORMAL}),s[0])}static subtract(s,e){if(e.startRow>s.endRow||e.endRow<s.startRow||e.startColumn>s.endColumn||e.endColumn<s.startColumn)return[s];const n=[];e.startRow>=s.startRow&&n.push({startRow:s.startRow,startColumn:s.startColumn,endRow:e.startRow-1,endColumn:s.endColumn}),e.endRow<=s.endRow&&n.push({startRow:e.endRow+1,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn});const r=Math.max(s.startRow,e.startRow),i=Math.min(s.endRow,e.endRow);return e.startColumn>=s.startColumn&&n.push({startRow:r,startColumn:s.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=s.endColumn&&n.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:s.endColumn}),n.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}};_(Q,"getRelativeRange",(s,e)=>({startRow:s.startRow-e.startRow,endRow:s.endRow-s.startRow,startColumn:s.startColumn-e.startColumn,endColumn:s.endColumn-s.startColumn})),_(Q,"getPositionRange",(s,e,n)=>({...n||{},startRow:n&&[j.ROW,j.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:s.startRow+e.startRow,endRow:n&&[j.ROW,j.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:s.endRow+s.startRow+e.startRow,startColumn:n&&[j.COLUMN,j.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:s.startColumn+e.startColumn,endColumn:n&&[j.COLUMN,j.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:s.endColumn+s.startColumn+e.startColumn})),_(Q,"moveHorizontal",(s,e=0,n=0)=>({...s,startColumn:s.startColumn+e,endColumn:s.endColumn+e+n})),_(Q,"moveVertical",(s,e=0,n=0)=>({...s,startRow:s.startRow+e,endRow:s.endRow+e+n})),_(Q,"moveOffset",(s,e,n)=>({...s,startRow:s.startRow+n,endRow:s.endRow+n,startColumn:s.startColumn+e,endColumn:s.endColumn+e}));let ft=Q;class li{constructor(s,e){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=s,this._keys=e,s.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(s){this._keys.forEach(e=>{const n=s[e],r=this._keyMaps.get(e)||new Map;r.set(n,s),this._keyMaps.set(e,r)})}getValue(s,e){const n=e||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(s))return i.get(s)}return null}hasValue(s){for(let e=0;e<this._keys.length;e++){const n=this._keyMaps.get(this._keys[e]);if(n!=null&&n.has(s))return!0}return!1}addValue(s){this._values.push(s),this._initKeyMap(s)}setValue(s,e,n){const r=this.getValue(s);r&&Object.keys(r).includes(e)&&(r[e]=n)}deleteValue(s){const e=this.getValue(s);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===e);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(s){var e;return[...((e=this._keyMaps.get(s))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ae(t,s,e,n){return{forEach(r){for(let i=t;i<=s;i++)for(let o=e;o<=n;o++)r(i,o)}}}function ui(t){if(t==null||t.length===0)return Number.NaN;const s=t.toLowerCase().split(""),e=s.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=n(s[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const Ht=65,Ts=90,hi=97;function _i(t){const s=Ts-Ht+1;let e="";for(;t>=0;)e=String.fromCharCode(t%s+Ht)+e,t=Math.floor(t/s)-1;return e}function Us(t,s){let e="";for(;s>0;)e+=t,s--;return e}function di(t,s=!1){const e=Ts-Ht+1;let n=hi;s&&(n=Ht);const r=String.fromCharCode(t%e+n),i=Math.floor(t/e)+1;return Us(r,i)}function fi(t,s){return t.zIndex>s.zIndex?1:t.zIndex===s.zIndex?0:-1}function Ei(t,s){return t.zIndex>s.zIndex?-1:t.zIndex===s.zIndex?0:1}function ot(t="index",s=1){return(e,n)=>e[t]>n[t]?s:e[t]===n[t]?0:-s}function gi(t,s){let e;return function(...n){const r=this,i=function(){e=null,t.apply(r,n)};clearTimeout(e),e=setTimeout(i,s)}}var Ms=(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))(Ms||{}),ce=(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))(ce||{});function le(t){const s=[];for(const e of t){const{st:n,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,n===r||R.isEmptyObject(i)&&e.sId==null)continue;if(s.length===0){s.push(e);continue}const o=s.pop();As(e,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?s.push({...e,st:o.st,ed:r}):s.push(o,e)}return s}function Ps(t,s,e,n){var h;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const c=(h=s.textRuns)!=null?h:[];if(c.length)for(let u=0,d=c.length;u<d;u++){const f=c[u];f.st+=n,f.ed+=n}for(let u=0;u<o;u++){const d=r[u],{st:f,ed:E}=d;if(E<n)i.push(d);else if(n>=f&&n<=E)if(a)d.st+=e,d.ed+=e,i.push(d);else{a=!0,d.ed+=e;const g=[];if(c.length){const m={...d,st:f,ed:c[0].st};g.push(m),g.push(...c);const N=c[c.length-1],S={...d,st:N.ed,ed:E+e};g.push(S)}else g.push(d);i.push(...g)}else d.st+=e,d.ed+=e,a||(a=!0,i.push(...c)),i.push(d)}a||(a=!0,i.push(...c)),t.textRuns=le(i)}function ue(t,s,e,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=s,a=[];let c=-1;for(let u=0,d=r.length;u<d;u++){const f=r[u],{startIndex:E}=f;E>=n&&(f.startIndex+=e),c===-1&&E>=n&&(c=u),a.push(f.startIndex)}let h=-1;if(i){for(let u=0,d=i.length;u<d;u++){const f=i[u];f.startIndex+=n;const E=f.startIndex;h=a.indexOf(E)}if(o===ce.PARAGRAPH&&i.length===1){const u=r[c],d=i[0],f=u.paragraphStyle,E=u.bullet;u.paragraphStyle=d.paragraphStyle,u.bullet=d.bullet,d.paragraphStyle=f,d.bullet=E}h!==-1&&r.splice(h,1),r.push(...i),r.sort(ot("startIndex"))}}function Ri(t,s,e,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:h}=c;h>=n&&(c.startIndex+=e)}const i=s.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(ot("startIndex"))}}function Fs(t,s,e,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:h}=c;h>=n&&(c.startIndex+=e)}const i=s.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(ot("startIndex"))}}function he(t,s,e,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:h,endIndex:u}=c;h>n?(c.startIndex+=e,c.endIndex+=e):u>=n-1&&(c.endIndex+=e)}const i=s.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(ot("startIndex"))}}function mi(t,s,e,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:h,endIndex:u}=c;h>n?(c.startIndex+=e,c.endIndex+=e):u>=n-1&&(c.endIndex+=e)}const i=s.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(ot("startIndex"))}}function Hs(t,s,e){const{textRuns:n}=t,r=e,i=e+s,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{st:d,ed:f}=u;if(r<=d&&i>=f){o.push({...u,st:d-r,ed:f-r});continue}else d<=r&&f>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=s):r>=d&&r<f?(o.push({...u,st:r-r,ed:f-r}),u.ed=r):i>d&&i<=f?(o.push({...u,st:d-r,ed:i-r}),u.st=i-s,u.ed-=s):d>=i&&(u.st-=s,u.ed-=s);a.push(u)}t.textRuns=a}return o}function Ws(t,s,e){const{paragraphs:n}=t,r=e,i=e+s,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{startIndex:d}=u;if(d>=r&&d<i){o.push({...u,startIndex:d-e});continue}else d>=i&&(u.startIndex-=s);a.push(u)}t.paragraphs=a}return o}function Bs(t,s,e){const{sectionBreaks:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);a.push(u)}t.sectionBreaks=a}return o}function ks(t,s,e){const{customBlocks:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);a.push(u)}t.customBlocks=a}return o}function Gs(t,s,e){const{tables:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{startIndex:d,endIndex:f}=u;if(r<=d&&i>=f){o.push({...u,startIndex:d-e,endIndex:f-e});continue}else if(d<=r&&f>=i){const E=ee(d,f,r,i);u.startIndex=E[0],u.endIndex=E[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);a.push(u)}t.tables=a}return o}function $s(t,s,e){const{customRanges:n}=t,r=e,i=e+s-1,o=[];if(n){const a=[];for(let c=0,h=n.length;c<h;c++){const u=n[c],{startIndex:d,endIndex:f}=u;if(r<=d&&i>=f){o.push({...u,startIndex:d-e,endIndex:f-e});continue}else if(d<=r&&f>=i){const E=ee(d,f,r,i);u.startIndex=E[0],u.endIndex=E[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);a.push(u)}t.customRanges=a}return o}function Oi(t,s,e){const{dataStream:n}=t,r=e,i=e+s,o=Hs(t,s,e),a=Ws(t,s,e),c=Bs(t,s,e),h=ks(t,s,e),u=Gs(t,s,e),d=$s(t,s,e);let f="";return n&&(t.dataStream=Ss(n,r,i),f=n.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:c,customBlocks:h,tables:u,customRanges:d}}function Ii(t,s,e,n){t.dataStream=Ns(t.dataStream,n,s.dataStream),Ps(t,s,e,n),ue(t,s,e,n),Ri(t,s,e,n),Fs(t,s,e,n),he(t,s,e,n),mi(t,s,e,n)}var Vs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Vs||{}),ps=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(ps||{}),Et=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(Et||{}),X=(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))(X||{}),xs=(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))(xs||{}),js=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(js||{}),Ks=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(Ks||{}),Ys=(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))(Ys||{}),zs=(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))(zs||{}),Xs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Xs||{}),Js=(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))(Js||{}),Qs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Qs||{}),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||{}),Zs=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(Zs||{}),ys=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(ys||{}),tn=(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))(tn||{}),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||{}),sn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(sn||{}),nn=(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))(nn||{}),rn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(rn||{}),on=(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))(on||{}),an=(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))(an||{}),cn=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(cn||{}),ln=(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))(ln||{}),un=(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))(un||{}),hn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(hn||{}),_n=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(_n||{}),Wt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(Wt||{});const Ai={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:Et.DECIMAL,hanging:21,indentStart:63}]}};function Ci(t,s,e,n,r){const i=Ni(t,s,e,n,r),o=Si(t,s,e,n,r),a=Li(t,s,e,n,r),c=vi(t,s,e,n,r),h=bi(t,s,e,n,r),u=Di(t,s,e,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:c,tables:h,customRanges:u}}function Ni(t,s,e,n,r){const{textRuns:i}=t,{textRuns:o}=s;if(i==null||o==null)return;const a=Hs(t,e,n);if(r!==M.REPLACE){const c=dn(o,a,r);s.textRuns=c}return Ps(t,s,e,n),a}function dn(t,s,e){if(s.length===0)return t;t=R.deepClone(t),s=R.deepClone(s);const n=[],r=t.length,i=s.length;let o=0,a=0,c=null;function h(){return c?(n.push(c),c=null,!0):!1}for(;o<r&&a<i;){const{st:E,ed:g,ts:m}=t[o],{st:N,ed:S,ts:H,sId:P}=s[a];let q;e===M.COVER?q={...H,...m}:q={...m,...H},g<N?(h()||n.push(t[o]),o++):S<E?(h()||n.push(s[a]),a++):(n.push({st:Math.min(E,N),ed:Math.max(E,N),ts:E<N?{...m}:{...H},sId:E<N?void 0:P}),n.push({st:Math.max(E,N),ed:Math.min(g,S),ts:q,sId:P}),g<S?(o++,s[a].st=g):(a++,t[o].st=S),c={st:Math.min(g,S),ed:Math.max(g,S),ts:g<S?{...H}:{...m},sId:g<S?P:void 0})}h();const u=n[n.length-1],d=t[r-1],f=s[i-1];return u.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?n.push(d):n.push(f)),le(n)}function Si(t,s,e,n,r){const{paragraphs:i}=t,{paragraphs:o}=s;if(i==null||o==null)return;const a=Ws(t,e,n);if(r!==M.REPLACE){const c=[];for(const h of o){const{startIndex:u,paragraphStyle:d,bullet:f}=h;let E=[];for(const g of a){const{startIndex:m,paragraphStyle:N,bullet:S}=g;let H,P;if(r===M.COVER?(H={...N,...d},P={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},...S,...f}):(H={...d,...N},P={listId:"",listType:Wt.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...S}),u===m){E.push({startIndex:u,paragraphStyle:H,bullet:P});break}}c.push(...E),E=[]}s.paragraphs=c}return ue(t,s,e,n),a}function Li(t,s,e,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=s;if(i==null||o==null)return;const a=Bs(t,e,n);if(r!==M.REPLACE){const c=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const f of a){const{startIndex:E}=f;if(u===E){r===M.COVER?d.push({...f,...h}):d.push({...h,...f});break}}c.push(...d),d=[]}s.sectionBreaks=c}return ue(t,s,e,n),a}function vi(t,s,e,n,r){const{customBlocks:i}=t,{customBlocks:o}=s;if(i==null||o==null)return;const a=ks(t,e,n);if(r!==M.REPLACE){const c=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const f of a){const{startIndex:E}=f;if(u===E){r===M.COVER?d.push({...f,...h}):d.push({...h,...f});break}}c.push(...d),d=[]}s.customBlocks=c}return Fs(t,s,e,n),a}function bi(t,s,e,n,r){const{tables:i}=t,{tables:o}=s;if(i==null||o==null)return;const a=Gs(t,e,n);if(r!==M.REPLACE){const c=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let f=[];for(const E of a){const{startIndex:g,endIndex:m}=E;if(g>=u&&m<=d){r===M.COVER?f.push({...E,...h}):f.push({...h,...E});break}}c.push(...f),f=[]}s.tables=c}return he(t,s,e,n),a}function Di(t,s,e,n,r){const{customRanges:i}=t,{tables:o}=s;if(i==null||o==null)return;const a=$s(t,e,n);if(r!==M.REPLACE){const c=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let f=[];for(const E of a){const{startIndex:g,endIndex:m}=E;if(g>=u&&m<=d){r===M.COVER?f.push({...E,...h}):f.push({...h,...E});break}}c.push(...f),f=[]}s.customRanges=c}return he(t,s,e,n),a}var C=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(C||{});function _e(t,s,e){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(s,e)},a=[];for(const h of r){const u=R.deepClone(h),{st:d,ed:f}=u;R.hasIntersectionBetweenTwoRanges(d,f,s,e)&&(s>=d&&s<=f?a.push({...u,st:s,ed:Math.min(e,f)}):e>=d&&e<=f?a.push({...u,st:Math.max(s,d),ed:e}):a.push(u))}a.length&&(o.textRuns=a.map(h=>{const{st:u,ed:d}=h;return{...h,st:u-s,ed:d-s}}));const c=[];for(const h of i){const{startIndex:u}=h;u>=s&&u<=e&&c.push(R.deepClone(h))}return c.length&&(o.paragraphs=c.map(h=>({...h,startIndex:h.startIndex-s}))),o}function de(t,s,e=M.COVER){if(s.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:a=[]}=s,c=dn(o,r,e);c.length&&(n.textRuns=c);const h=[];let u=0,d=0;for(;u<i.length&&d<a.length;){const f=i[u],E=a[d],{startIndex:g}=f,{startIndex:m}=E;g===m?(h.push(R.deepMerge(f,E)),u++,d++):g<m?(h.push(R.deepClone(f)),u++):(h.push(R.deepClone(E)),d++)}return u<i.length&&h.push(...i.slice(u)),d<a.length&&h.push(...a.slice(d)),h.length&&(n.paragraphs=h),n}function wi(t){const{body:s}=t;if(s==null)return!0;const{textRuns:e=[],paragraphs:n=[]}=s;return e.length===0&&n.length===0}function Ti(t=R.generateRandomId(6),s=y.EN_US,e=""){return{id:t,locale:s,title:e,body:{dataStream:`\r
5
- `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const fe={id:"default_doc",documentStyle:{}};class Ui{constructor(s){_(this,"snapshot");this.snapshot={...fe,...s}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var s;return((s=this.snapshot.settings)==null?void 0:s.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(s){this.snapshot.id=s}updateDocumentRenderConfig(s){const{documentStyle:e}=this.snapshot;e.renderConfig==null?e.renderConfig=s:e.renderConfig={...e.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:e,l:n,b:r,r:i}=s,{documentStyle:o}=this.snapshot;e!=null&&(o.marginTop=e),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(s,e){const{documentStyle:n}=this.snapshot;if(!n.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,e=e!=null?e:Number.POSITIVE_INFINITY,n.pageSize={width:s,height:e};return}s!==void 0&&(n.pageSize.width=s),e!==void 0&&(n.pageSize.height=e)}updateDrawing(s,e){const{drawings:n}=this,{width:r,height:i,left:o,top:a}=e,c=n==null?void 0:n[s];if(!c)return;const h=c.objectTransform;h.size.width=r,h.size.height=i,h.positionH.posOffset=o,h.positionV.posOffset=a}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class st extends Ui{constructor(e){var r;R.isEmptyObject(e)&&(e=Ti());super(e);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:R.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...fe,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const n=[],r=new es;return r.reset(),e.forEach(i=>{if(i=R.deepClone(i),i.t===C.RETAIN){const{coverType:o,body:a,len:c,segmentId:h}=i;if(a!=null){const u=this._updateApply(a,c,r.cursor,o,h);n.push({...i,t:C.RETAIN,coverType:M.REPLACE,body:u})}else n.push({...i,t:C.RETAIN});r.moveCursor(c)}else if(i.t===C.INSERT){const{body:o,len:a,segmentId:c,line:h}=i;this._insertApply(o,a,r.cursor,c),r.moveCursor(a),n.push({t:C.DELETE,len:a,line:h,segmentId:c})}else if(i.t===C.DELETE){const{len:o,segmentId:a}=i,c=this._deleteApply(o,r.cursor,a);n.push({...i,t:C.INSERT,body:c})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(e,n){const r=this.getBody();if(r!=null)return _e(r,e,n)}_updateApply(e,n,r,i=M.COVER,o){if(e==null)throw new Error("updateBody is none");const a=this.snapshot,c=Ft(a,o);if(c==null)throw new Error("no body has changed");return Ci(c,e,n,r,i)}_deleteApply(e,n,r){const i=this.snapshot,o=Ft(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:Oi(o,e,n)}_insertApply(e,n,r,i){const o=this.snapshot,a=Ft(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");Ii(a,e,n,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:n}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new st(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new st(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}const Mi="0.1.5",gt={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Pi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Fi={startRow:0,startColumn:0,endRow:0,endColumn:0},Hi={row:0,column:0},fn={id:"",sheetOrder:[],name:"",appVersion:Mi,locale:y.ZH_CN,styles:{},sheets:{},resources:[]},Bt={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:ht.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:tt.UNSPECIFIED,vt:rt.UNSPECIFIED,tb:it.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},En={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var gn=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(gn||{});class Rn{constructor(s={}){_(this,"_styles");_(this,"_cacheMap",new Ds(1e5));this._styles=s,this._generateCacheMap()}each(s){return Object.entries(this._styles).forEach(s),this}search(s,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const n=this._getExistingStyleId(s);return n||"-1"}get(s){return typeof s!="string"?s:(s=String(s),this._styles[s])}add(s,e){const n=R.generateRandomId(6);return this._styles[n]=s,this._cacheMap.set(e,n),n}setValue(s){if(s==null)return;const e=JSON.stringify(s),n=this.search(s,e);return n!=="-1"?n:this.add(s,e)}toJSON(){return this._styles}getStyleByCell(s){let e;s&&R.isObject(s.s)?e=s.s:e=(s==null?void 0:s.s)&&this.get(s.s);const n=s==null?void 0:s.interceptorStyle;return n?{...e,...n}:e}_generateCacheMap(){const{_styles:s,_cacheMap:e}=this;for(const n in s){const r=JSON.stringify(s[n]);e.set(r,n)}}_getExistingStyleId(s){const{_styles:e}=this;for(const n in e)if(R.diffValue(e[n],s))return n;return null}}var k=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(k||{});function mn(t){return!!(t&&t.code&&t.code!==k.OK&&t.code!=="OK")}var K=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(K||{}),Ee=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(Ee||{});function Wi(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 Bi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return _t.STRING;if(typeof t.v=="number")return _t.NUMBER;if(typeof t.v=="boolean")return _t.BOOLEAN}function ki(t){if(t==null)return!0;const{v:s,f:e,si:n,p:r,s:i}=t;return!(!(s==null||typeof s=="string"&&s.length===0)||e!=null&&e.length>0||n!=null&&n.length>0||r!=null)}function Gi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var ge=(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))(ge||{}),On=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(On||{}),In=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(In||{});class $i{constructor(s,e){_(this,"_columnData",{});this._config=s,this._columnData=e}getColumnData(){return this._columnData}getColVisible(s){const{_columnData:e}=this,n=e[s];return n?n.hd!==I.TRUE:!0}getHiddenCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getColVisible(o);r&&a?(r=!1,n.push({rangeType:W.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:W.COLUMN}),n}getVisibleCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getColVisible(o);r&&!a?(r=!1,n.push({rangeType:W.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:W.COLUMN}),n}getColumnDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return x(this._columnData)}getColumnWidth(s){const{_columnData:e}=this,n=this._config;let r=0;return r=(e[s]||{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(s){const e=this._columnData[s];if(e)return e}getColumnOrCreate(s){const{_columnData:e}=this,n=this._config,r=e[s];if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData[s]=i,i}}function kt(t,s){const{textRuns:e=[]}=s;let n=0;for(const i of e){const{ts:o={},st:a,ed:c}=i;if(o[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(o[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(o[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}n+=c-a}return s.dataStream.indexOf(`\r
6
- `)===n?I.TRUE:I.FALSE}class at{constructor(s,e,n){_(this,"_range");_(this,"_worksheet");this._deps=n,this._range=e,this._worksheet=s}static foreach(s,e){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s;for(let a=n;a<=i;a++)for(let c=r;c<=o;c++)e(a,c)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=[];for(let o=s;o<=e;o++){const a=[];for(let c=n;c<=r;c++)a.push(this.getMatrix().getValue(o,c)||null);i.push(a)}return i}getMatrix(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=s;a<=e;a++)for(let c=n;c<=r;c++)o.setValue(a,c,i.getValue(a,c)||null);return o}getMatrixObject(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=s;a<=e;a++)for(let c=n;c<=r;c++)o.setValue(a-s,c-n,i.getValue(a,c)||{});return o}getA1Notation(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(s+1),o=R.numToWord(r+1)+(e+1)):(i=R.numToWord(r+1)+(e+1),o=R.numToWord(n+1)+(s+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Bt.bg.rgb}))}getCell(s,e){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+s,endRow:n+s,startColumn:i+e,endColumn:i+e};return new at(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(s={}){return this.getObjectValues(s)[0][0]}getObjectValues(s={}){var a;const{startRow:e,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,n,r,i).getData();if(s.isIncludeStyle){const c=this._deps.getStyles();for(let h=0;h<=n-e;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 d=o[h][u].s;d&&(o[h][u].s=c.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Bt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?kt("ul",s.body)===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 e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?kt("st",s.body)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?s.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...s.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?kt("it",s.body)===I.TRUE?Lt.ITALIC:Lt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?kt("bl",s.body)===I.TRUE?vt.BOLD:vt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:s,_worksheet:e}=this,{startRow:n,endRow:r}=s;let i=0;for(let o=0;o<=r-n;o++){const a=e.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:s,endColumn:e}=this._range;return e-s+1}getNumRows(){const{startRow:s,endRow:e}=this._range;return e-s+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(s=>s.map(e=>(e==null?void 0:e.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>s.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:s,_worksheet:e}=this,{startColumn:n,endColumn:r}=s;let i=0;for(let o=0;o<=r-n;o++)i+=e.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(s){at.foreach(this._range,s)}_getStyles(s){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[s]||Bt[s]}))}}class Vi{constructor(s,e){_(this,"_rowData");this._config=s,this._rowData=e}getRowData(){return this._rowData}getRowDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(s,e=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const a=n[o+s]||{hd:I.FALSE,h:r.defaultRowHeight},{ia:c,ah:h,h:u=r.defaultRowHeight}=a;i+=(c==null||c===I.TRUE)&&typeof h=="number"?h:u}return i}getRow(s){return this._rowData[s]}getRowOrCreate(s){const{_rowData:e}=this,n=e[s];if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return e[s]=i,i}getHiddenRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getRowVisible(o);r&&a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getVisibleRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const a=this.getRowVisible(o);r&&!a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getRowVisible(s){const e=this.getRow(s);return e?e.hd!==I.TRUE:!0}getSize(){return x(this._rowData)}}const pi="DEFAULT_WORKSHEET_ROW_COUNT",An=1e3,xi="DEFAULT_WORKSHEET_COLUMN_COUNT",Cn=20,ji="DEFAULT_WORKSHEET_ROW_HEIGHT",Nn=19,Ki="DEFAULT_WORKSHEET_COLUMN_WIDTH",Sn=73,Yi="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Ln=46,zi="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",vn=20;function bn(t){const s={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:An,columnCount:Cn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Sn,defaultRowHeight:Nn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:I.TRUE,rowHeader:{width:Ln,hidden:I.FALSE},columnHeader:{height:vn,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE};return Object.keys(s).forEach(e=>{const n=e;typeof t[n]>"u"&&(t[n]=s[n])}),t}class Dn extends U{constructor(){super(...arguments);_(this,"_cellContentInterceptors",[]);_(this,"_rowFilteredInterceptors",[]);_(this,"_rowVisibleInterceptors",[]);_(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(e,n){for(const r of this._cellContentInterceptors){const i=r.getCell(e,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(e){if(this._cellContentInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(e),b(()=>Y(this._cellContentInterceptors,e))}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(e),b(()=>Y(this._rowFilteredInterceptors,e))}registerRowVisibleInterceptor(e){if(this._rowVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(e),b(()=>Y(this._rowVisibleInterceptors,e))}registerColVisibleInterceptor(e){if(this._colVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(e),b(()=>Y(this._colVisibleInterceptors,e))}}class Rt{constructor(s,e){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var o;this._styles=e,this._snapshot=bn(s);const{columnData:n,rowData:r,cellData:i}=this._snapshot;this._sheetId=(o=this._snapshot.id)!=null?o:R.generateRandomId(6),this._cellData=new V(i),this._rowManager=new Vi(this._snapshot,r),this._columnManager=new $i(this._snapshot,n),this._viewModel=new Dn}__interceptViewModel(s){s(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const s=this.getCellMatrix(),e=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,a=!1,c=!1;return s.forEach((h,u)=>{Object.keys(u).forEach(d=>{const f=+d,E=s.getValue(h,f),g=E!=null&&E.s?this._styles.get(E.s):null,m=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(E&&(E.v||E.p)||g!=null&&g.bg||m)&&(a?n=Math.min(n,h):(n=h,a=!0),r=Math.max(r,h),c?i=Math.min(i,f):(c=!0,i=f),o=Math.max(o,f))})}),e.forEach(h=>{a?n=Math.min(n,h.startRow):(n=h.startRow,a=!0),r=Math.max(r,h.endRow),c?i=Math.min(i,h.startColumn):(i=h.startColumn,a=!0),o=Math.max(o,h.endColumn)}),!a||!c?null:{startColumn:i,startRow:n,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:s}=this,e=R.deepClone(s);return new Rt(e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(s,e){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(ft.intersects({startRow:s,startColumn:e,endRow:s,endColumn:e},i))return i}return null}getCell(s,e){return s<0||e<0?null:this._viewModel.getCell(s,e)}getCellRaw(s,e){return this.getCellMatrix().getValue(s,e)}getMatrixWithMergedCells(s,e,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(c=>ft.intersects({startRow:s,startColumn:e,endRow:n,endColumn:r},c)),a=new V;return ae(s,n,e,r).forEach((c,h)=>{const u=i.getValue(c,h);u&&a.setValue(c,h,u)}),o.forEach(c=>{const{startColumn:h,startRow:u,endColumn:d,endRow:f}=c;ae(u,f,h,d).forEach((E,g)=>{E===u&&g===h&&a.setValue(E,g,{...i.getValue(E,g),rowSpan:f-u+1,colSpan:d-h+1}),(E!==u||g!==h)&&a.realDeleteValue(E,g)})}),a}getRange(s,e,n,r){return typeof s=="object"?new at(this,s,{getStyles:()=>this._styles}):new at(this,{startRow:s,startColumn:e,endColumn:r||e,endRow:n||s},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:s}=this,{columnCount:e}=s;return e}getMaxRows(){const{_snapshot:s}=this,{rowCount:e}=s;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(s){this._snapshot.rowCount=s}getColumnCount(){return this._snapshot.columnCount}setColumnCount(s){this._snapshot.columnCount=s}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:s}=this,{showGridlines:e}=s;return e===0}getTabColor(){const{_snapshot:s}=this,{tabColor:e}=s;return e}getColumnWidth(s){return this.getColumnManager().getColumnWidth(s)}getRowHeight(s){return this.getRowManager().getRowHeight(s)}getRowVisible(s){return this.getRowManager().getRowVisible(s)}getHiddenRows(s,e){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(s,e);return r.forEach(i=>i.endColumn=n),r}getColVisible(s){return this._columnManager.getColVisible(s)}getHiddenCols(s,e){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(s,e);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const s=this.getRowCount();return this._rowManager.getVisibleRows(0,s-1)}getVisibleCols(){const s=this.getColumnCount();return this._columnManager.getVisibleCols(0,s-1)}isRightToLeft(){const{_snapshot:s}=this,{rightToLeft:e}=s;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(s){return s&&(s.v!==void 0||s.f!==void 0||s.p!==void 0)}iterateByRow(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let a=e,c=n;return{next(){for(;;){if(c>i&&(a+=1,c=n),a>r)return{done:!0,value:void 0};const h=o.getCell(a,c),u=o.getMergedCell(a,c);if(u&&(!h||a!==u.startRow||c!==u.startColumn))c=u.endColumn+1;else if(!h)c+=1;else{const d={row:a,col:c,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),c+=1,{done:!1,value:d}}}}}}iterateByColumn(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let a=e,c=n;return{next(){for(;;){if(a>r&&(c+=1,a=e),c>i)return{done:!0,value:void 0};const h=o.getCell(a,c),u=o.getMergedCell(a,c);if(u&&(!h||a!==u.startRow||c!==u.startColumn))a=u.endRow+1;else if(!h)a+=1;else{const d={row:a,col:c,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),a+=1,{done:!1,value:d}}}}}}}function Xi(t){var n,r;const s=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(s)return s;const e=t.v;return typeof e=="string"?t.t===Ee.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===Ee.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}var Ji=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,qi=(t,s,e,n)=>{for(var r=n>1?void 0:n?Qi(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ji(s,e,r),r},Zi=(t,s)=>(e,n)=>s(e,n,t);function yi(t,s){return`${t.getUnitId()}|${s.getSheetId()}`}l.Workbook=class extends U{constructor(e={},n){super();_(this,"_sheetCreated$",new A.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new A.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");this._logService=n,this._snapshot=R.commonExtend(fn,e);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=R.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Rn(r),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return R.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(n,0,e);const a=new Rt(r,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const n=this._snapshot.sheetOrder;for(let i=0,o=n.length;i<o;i++){const a=this._worksheets.get(n[i]);if(a&&a.isSheetHidden()!==I.TRUE)return this.setActiveSheet(a),a}const r=this._worksheets.get(n[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:e}=this._snapshot,n=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===I.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const n=e;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:gt}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let n=e;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}generateNewSheetName(e){let n=e+this._count;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}_getCellRange(e){var u,d,f,E,g;let n="",r="";if(e.indexOf("!")>-1){const m=e.split("!");n=m[0],r=m[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=e;if(r.indexOf(":")===-1){const m=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,N=R.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(m)&&!Number.isNaN(N)?{sheetId:n,range:{startRow:m,endRow:m,startColumn:N,endColumn:N}}:gt}r=r.split(":");const i=[0,0],o=[0,0],a=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),c=((f=this.getSheetBySheetName(n))==null?void 0:f.getMaxColumns())||((E=this.getActiveSheet())==null?void 0:E.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=a),i[0]>i[1]||(o[0]=R.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=R.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=c),o[0]>o[1])?gt:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:n}=this,{sheets:r,sheetOrder:i}=e;if(R.isEmptyObject(r)){const o=R.generateRandomId();r[o]={id:o}}for(const o in r){const a=r[o],{name:c}=a;a.name=this.uniqueSheetName(c),a.name!==c&&this._logService.debug("[Workbook]",`The worksheet name ${c} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const h=new Rt(a,this._styles);n.set(o,h),i.includes(o)||i.push(o)}}},l.Workbook=qi([Zi(1,Z)],l.Workbook);class Re{constructor(s){_(this,"_snapshot");_(this,"_unitId");var e;this._snapshot={...En,...s},this._unitId=(e=this._snapshot.id)!=null?e:R.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var s;return(s=this._snapshot.body)==null?void 0:s.pages}getPageOrder(){var s;return(s=this._snapshot.body)==null?void 0:s.pageOrder}getPage(s){const e=this.getPages();return e==null?void 0:e[s]}getElementsByPage(s){var e;return(e=this.getPage(s))==null?void 0:e.pageElements}getElement(s,e){var n;return(n=this.getElementsByPage(s))==null?void 0:n[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:ge.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Gt="FOCUSING_SHEET",me="FOCUSING_DOC",Oe="FOCUSING_SLIDE",to="FOCUSING_EDITOR_BUT_HIDDEN",wn="EDITOR_ACTIVATED",eo="FOCUSING_EDITOR_INPUT_FORMULA",Tn="FOCUSING_FORMULA_EDITOR",so="FOCUSING_UNIVER_EDITOR",no="FOCUSING_EDITOR_INPUT_FORMULA",ro="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var io=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,ao=(t,s,e,n)=>{for(var r=n>1?void 0:n?oo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&io(s,e,r),r},co=(t,s)=>(e,n)=>s(e,n,t),Un=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(Un||{});const ct=O.createIdentifier("univer.current");l.UniverInstanceService=class extends U{constructor(e,n){super();_(this,"_focused",null);_(this,"_focused$",new A.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());_(this,"_currentSheet$",new A.BehaviorSubject(null));_(this,"currentSheet$",this._currentSheet$.asObservable());_(this,"_currentDoc$",new A.BehaviorSubject(null));_(this,"currentDoc$",this._currentDoc$.asObservable());_(this,"_currentSlide$",new A.BehaviorSubject(null));_(this,"currentSlide$",this._currentSlide$.asObservable());_(this,"_sheetAdded$",new A.Subject);_(this,"sheetAdded$",this._sheetAdded$.asObservable());_(this,"_docAdded$",new A.Subject);_(this,"docAdded$",this._docAdded$.asObservable());_(this,"_slideAdded$",new A.Subject);_(this,"slideAdded$",this._slideAdded$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_docDisposed$",new A.Subject);_(this,"docDisposed$",this._docDisposed$.asObservable());_(this,"_slideDisposed$",new A.Subject);_(this,"slideDisposed$",this._slideDisposed$.asObservable());_(this,"_sheets",[]);_(this,"_docs",[]);_(this,"_slides",[]);this._handler=e,this._contextService=n}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,n){const r=this._docs.find(i=>i.getUnitId()===e);if(r!=null){const i=this._docs.indexOf(r);this._docs.splice(i,1)}this.addDoc(n)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(n=>n.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(n=>n.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(n=>n.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[me,Gt,Oe].forEach(n=>this._contextService.setContextValue(n,!1)),this._focused instanceof l.Workbook?this._contextService.setContextValue(Gt,!0):this._focused instanceof st?this._contextService.setContextValue(me,!0):this._focused instanceof Re&&this._contextService.setContextValue(Oe,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitId ${e}`)}disposeDocument(e){const n=this.getUniverDocInstance(e);if(n){const o=this._docs.indexOf(n);return this._docs.splice(o,1),this._docDisposed$.next(n),!0}const r=this.getUniverSheetInstance(e);if(r){const o=this._sheets.indexOf(r);return this._sheets.splice(o,1),this._sheetDisposed$.next(r),!0}const i=this.getUniverSlideInstance(e);if(i){const o=this._slides.indexOf(i);return this._slides.splice(o,1),this._slideDisposed$.next(i),!0}return!1}},l.UniverInstanceService=ao([co(1,nt)],l.UniverInstanceService);var D=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(D||{});const lo={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},$t=new Map;function Ie(t,s){return function(r){Ae(t,s)}}function Ae(t,s){$t.has(t)||$t.set(t,[]),$t.get(t).push(s)}var uo=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,Mn=(t,s,e,n)=>{for(var r=n>1?void 0:n?ho(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&uo(s,e,r),r},Ce=(t,s)=>(e,n)=>s(e,n,t);l.LifecycleService=class extends U{constructor(e){super();_(this,"_lifecycle$",new A.BehaviorSubject(D.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=e,this._reportProgress(D.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");e!==this.stage&&(this._reportProgress(e),this._lifecycle$.next(e))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new A.Observable(e=>(this.stage===D.Starting||(this.stage===D.Ready?e.next(D.Starting):this.stage===D.Rendered?(e.next(D.Starting),e.next(D.Ready)):(e.next(D.Starting),e.next(D.Ready),e.next(D.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${lo[e]}".`)}},l.LifecycleService=Mn([Ce(0,Z)],l.LifecycleService),l.LifecycleInitializerService=class extends U{constructor(e,n){super();_(this,"_started",!1);this._lifecycleService=e,this._injector=n}start(){this._started||(this._started=!0,this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const n=$t.get(e);n==null||n.forEach(r=>{this._injector.has(r)&&this._injector.get(r)})}},l.LifecycleInitializerService=Mn([Ce(0,O.Inject(l.LifecycleService)),Ce(1,O.Inject(O.Injector))],l.LifecycleInitializerService);class mt extends U{constructor(){super();_(this,"_currentLocale",y.ZH_CN);_(this,"_locales",null);_(this,"localeChanged$",new A.Subject);_(this,"t",(e,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return n.forEach((a,c)=>{o=o.replace(`{${c}}`,a)}),o}else return e});this.disposeWithMe(b(()=>this.localeChanged$.complete()))}load(e){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,n){const r=n.shift();if(r&&e&&r in e){const i=e[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Ne=O.createIdentifier("resource-manager-service"),Pn=O.createIdentifier("ResourcePersistenceService");Ae(D.Ready,Pn);var _o=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,Eo=(t,s,e,n)=>{for(var r=n>1?void 0:n?fo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&_o(s,e,r),r},Fn=(t,s)=>(e,n)=>s(e,n,t);const Se=O.createIdentifier("univer.permission-service"),Hn="PERMISSION";l.PermissionService=class extends U{constructor(e,n){super();_(this,"_permissionPointMap",new Map);_(this,"deletePermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});_(this,"addPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(n.id)?!1:(r.set(n.id,new A.BehaviorSubject(n)),this._permissionPointMap.set(e,r),!0)});_(this,"updatePermissionPoint",(e,n,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=oe.DONE,o.next(a)}});_(this,"getPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=n}_init(){this.disposeWithMe(b(this._univerInstanceService.sheetAdded$.subscribe(e=>{this._resourceManagerService.registerPluginResource(e.getUnitId(),Hn,{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(b(this._univerInstanceService.sheetDisposed$.subscribe(e=>{this._resourceManagerService.disposePluginResource(e.getUnitId(),Hn)})))}_toJson(e){const n=this._permissionPointMap.get(e);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(e){return JSON.parse(e)}composePermission$(e,n){const r=this._permissionPointMap.get(e),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return A.combineLatest(i).pipe(Zn.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(e,n){const r=this._permissionPointMap.get(e);return n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}},l.PermissionService=Eo([Ie(D.Starting,l.PermissionService),Fn(0,O.Inject(Ne)),Fn(1,O.Inject(ct))],l.PermissionService);const Wn="univer.editable";class Vt extends ws{constructor(e){super();_(this,"id",Wn);_(this,"value",!0);_(this,"unitID");this.unitID=e}}var go=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,mo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ro(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&go(s,e,r),r},Bn=(t,s)=>(e,n)=>s(e,n,t);l.UniverPermissionService=class extends U{constructor(s,e){super(),this._permissionService=s,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(s=>{const e=new Vt(s.getUnitId());this._permissionService.addPermissionPoint(s.getUnitId(),e)})}getEditable(s){let e=s;e||(e=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Vt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(s,e){const n=new Vt(s);this._permissionService.updatePermissionPoint(s,n.id,e)}},l.UniverPermissionService=mo([Ie(D.Starting,l.UniverPermissionService),Bn(0,O.Inject(Se)),Bn(1,O.Inject(ct))],l.UniverPermissionService);class kn extends U{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new A.Subject);_(this,"register$",this._register$.asObservable())}getAllResource(e){const n=this._resourceMap.get(e);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:e,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(e,n,r){const i=this._resourceMap.get(e)||new Map;if(i.has(n))throw new Error(`the pluginName is registered {${n}}`);return i.set(n,r),this._resourceMap.set(e,i),this._register$.next({unitID:e,resourceName:n,hook:r}),b(()=>i.delete(n))}disposePluginResource(e,n){const r=this._resourceMap.get(e);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Le extends U{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new A.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(b(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const Gn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",$n="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Oo=`\r
7
- `;var Io=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Co=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ao(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Io(s,e,r),r},ve=(t,s)=>(e,n)=>s(e,n,t);const pt=O.createIdentifier("univer.undo-redo.service"),No=20;class Vn{dispose(){}async dispatchToHandlers(){return!1}}const pn="univer.command.redo",xn="univer.command.undo",jn=new class extends Vn{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",xn)}async handler(s){const e=s.get(pt),n=e.pitchTopUndoElement();if(!n)return!1;const r=s.get(ut);return Qt(n.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},Kn=new class extends Vn{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",pn)}async handler(s){const e=s.get(pt),n=e.pitchTopRedoElement();if(!n)return!1;const r=s.get(ut);return Qt(n.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};l.LocalUndoRedoService=class extends U{constructor(e,n,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new A.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(this._commandService.registerCommand(Kn)),this.disposeWithMe(b(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(b(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:n}=e,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const a=this._batchingStatus.get(e.unitID),c=this._pitchUndoElement(e.unitID);a===0||!c?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(c,e)}else o(e);function o(a){i.push(a),i.length>No&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const n=this._getRedoStack(e);n&&(n.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const n=this._getUndoStack(e);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(e){const n=this._getRedoStack(e);return n!=null&&n.length?n[n.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),b(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUniverInstanceId(),n=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(e,n=!1){let r=this._undoStacks.get(e);return!r&&n&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,n=!1){let r=this._redoStacks.get(e);return!r&&n&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,n){e.redoMutations.push(...n.redoMutations),e.undoMutations.push(...n.undoMutations)}_getFocusedUniverInstanceId(){var o,a,c,h;let e="";const n=this._contextService.getContextValue(Gt),r=this._contextService.getContextValue(Tn),i=this._contextService.getContextValue(wn);return n?r?e=$n:i?e=Gn:e=(a=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?a:"":e=(h=(c=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:c.getUnitId())!=null?h:"",e}},l.LocalUndoRedoService=Co([ve(0,ct),ve(1,ut),ve(2,nt)],l.LocalUndoRedoService);class xt extends U{constructor(){super(...arguments);_(this,"_started",!1)}addPlugins(e){if(this._started){const n=e.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,D.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n,!0))}else{const n=e.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(e,n=!1){this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===D.Starting||this._pluginsRunLifecycle(e,r)})))}_pluginsRunLifecycle(e,n){e.forEach(r=>{switch(n){case D.Starting:r.onStarting(this._injector);break;case D.Ready:r.onReady();break;case D.Rendered:r.onRendered();break;case D.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(e,n){return this._injector.createInstance(e,n)}}var So=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,vo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&So(s,e,r),r},be=(t,s)=>(e,n)=>s(e,n,t);l.UniverDoc=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createDoc(s){return this._injector.createInstance(st,s)}},l.UniverDoc=vo([be(0,O.Inject(O.Injector)),be(1,O.Inject(l.LifecycleService)),be(2,O.Inject(l.LifecycleInitializerService))],l.UniverDoc);var bo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,wo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Do(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&bo(s,e,r),r},De=(t,s)=>(e,n)=>s(e,n,t);l.UniverSheet=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSheet(s){return this._injector.createInstance(l.Workbook,s)}},l.UniverSheet=wo([De(0,O.Inject(O.Injector)),De(1,O.Inject(l.LifecycleService)),De(2,O.Inject(l.LifecycleInitializerService))],l.UniverSheet);var To=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,Mo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Uo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&To(s,e,r),r},we=(t,s)=>(e,n)=>s(e,n,t);l.UniverSlide=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSlide(s){return this._injector.createInstance(Re,s)}},l.UniverSlide=Mo([we(0,O.Inject(O.Injector)),we(1,O.Inject(l.LifecycleService)),we(2,O.Inject(l.LifecycleInitializerService))],l.UniverSlide);const Po=200;class Fo extends xt{constructor(e={}){super();_(this,"_injector");_(this,"_univerPluginStore",new er);_(this,"_univerPluginRegistry",new sr);_(this,"_univerSheet",null);_(this,"_univerDoc",null);_(this,"_univerSlide",null);_(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=e;n&&this._injector.get(Le).setTheme(n),i&&this._injector.get(mt).load(i),r&&this._injector.get(mt).setLocale(r),o&&this._injector.get(Z).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(ct)}get _lifecycleService(){return this._injector.get(l.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(l.LifecycleInitializerService)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(e){this._injector.get(mt).setLocale(e)}createUniverSheet(e){let n;const r=()=>{n=this._univerSheet.createSheet(e),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(l.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(w.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(e){let n;const r=()=>{n=this._univerDoc.createDoc(e),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(l.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(w.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(e){let n;const r=()=>{n=this._univerSlide.createSlide(e),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(l.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(w.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new O.Injector([[ct,{useFactory:e=>new l.UniverInstanceService({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},e),deps:[nt]}],[Ze],[mt],[Le],[l.LifecycleService],[l.LifecycleInitializerService],[Se,{useClass:l.PermissionService}],[l.UniverPermissionService],[Z,{useClass:ze,lazy:!0}],[ut,{useClass:l.CommandService,lazy:!0}],[pt,{useClass:l.LocalUndoRedoService,lazy:!0}],[Qe,{useClass:qe}],[nt,{useClass:Ke}],[ts,{useClass:ye,lazy:!0}],[Ne,{useClass:kn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(l.LifecycleInitializerService).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(l.LifecycleService).stage<D.Ready&&(this._injector.get(l.LifecycleService).stage=D.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(e,n){if(e.type===w.Univer)this._registerUniverPlugin(e,n);else if(e.type===w.Sheet)this._registerSheetsPlugin(e,n);else if(e.type===w.Doc)this._registerDocsPlugin(e,n);else if(e.type===w.Slide)this._registerSlidesPlugin(e,n);else throw new Error(`Unimplemented plugin system for business: "${e.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),Po))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const e=this._univerPluginRegistry.getRegisterPlugins(w.Univer);if(e.length){this._univerPluginRegistry.clearPluginsOfType(w.Univer);const n=e.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Slide))}}_registerUniverPlugin(e,n){if(this._started)this._univerPluginRegistry.registerPlugin(e,n);else{const r=this._injector.createInstance(e,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerDocsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerSlidesPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}}function Ho(t,s=16){let e=0,n=null;return function(...i){const o=Date.now();o-e<s?(n&&clearTimeout(n),n=setTimeout(()=>{e=o,t.apply(this,i)},s)):(e=o,t.apply(this,i))}}function Wo(t){const s=new MessageChannel;let e=!1;return s.port1.onmessage=()=>{e||t()},s.port2.postMessage(null),()=>{e=!0}}class Te{constructor(s){_(this,"_index",0);_(this,"_offset",0);this._actions=s}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(s){s||(s=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const n=this._offset,r=e.len;return s>=r-n?(s=r-n,this._index+=1,this._offset=0):this._offset+=s,e.t===C.DELETE||e.t===C.RETAIN&&e.body==null?R.deepClone({...e,len:s}):R.deepClone({...e,len:s,body:_e(e.body,n,n+s)})}else return{t:C.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const s=this._actions[this._index];return s?s.t:C.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const s=this._offset,e=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=s,this._index=e,[n].concat(r)}}else return[]}}function Yn(t){return Object.keys(t).length===1}class jt{constructor(){_(this,"_actions",[])}static compose(s,e){const n=new Te(s),r=new Te(e),i=new jt;for(;n.hasNext()||r.hasNext();)if(r.peekType()===C.INSERT)i.push(r.next());else if(n.peekType()===C.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),a=n.next(o),c=r.next(o);a.t===C.INSERT&&c.t===C.RETAIN?c.body==null?i.push(a):i.push({...a,body:de(a.body,c.body,c.coverType)}):a.t===C.RETAIN&&c.t===C.RETAIN?a.body==null&&c.body==null?i.push(a.len!==Number.POSITIVE_INFINITY?a:c):a.body&&c.body?i.push({...a,body:de(a.body,c.body,c.coverType)}):i.push(a.body?a:c):a.t===C.RETAIN&&c.t===C.DELETE?i.push(c):a.t===C.INSERT&&(c.t,C.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(s,e,n=""){const r={t:C.INSERT,body:e,len:s,line:0,segmentId:n};return this.push(r),this}retain(s,e="",n,r){const i={t:C.RETAIN,len:s,segmentId:e};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(s,e=""){const n={t:C.DELETE,len:s,line:0,segmentId:e};return this.push(n),this}serialize(){return this._actions}push(...s){if(s.length>1){for(const i of s)this.push(i);return this}let e=this._actions.length,n=this._actions[e-1];const r=R.deepClone(s[0]);if(r.t===C.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===C.DELETE&&r.t===C.DELETE)return n.len+=r.len,this;if(n.t===C.DELETE&&r.t===C.INSERT&&(e-=1,n=this._actions[e-1],n==null))return this._actions.unshift(r),this;if(n.t===C.RETAIN&&r.t===C.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===C.INSERT&&Yn(n.body)&&r.t===C.INSERT&&Yn(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let s=this._actions[this._actions.length-1];for(;s&&s.t===C.RETAIN&&wi(s);)this._actions.pop(),s=this._actions[this._actions.length-1];return this}}function Bo(t,s,e){if(s==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new st(n),i=s.length;let o;for(;(o=r.getBody().dataStream.indexOf(s))>=0;){const c=new jt;if(o>0&&c.retain(o),e.length>0){const u=r.sliceBody(o,o+i),d={dataStream:e};Array.isArray(u==null?void 0:u.textRuns)&&u.textRuns.length&&(d.textRuns=[{...u.textRuns[0],st:0,ed:e.length}]),c.insert(e.length,d)}c.delete(i);const h=c.serialize();r.apply(h)}const a=r.getBody();return r.dispose(),a}class ko extends Ct{add(s){if(!s)return null;const e=new At(s,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Go=O.createIdentifier("ILocalStorageService");function $o(t){return new A.Observable(s=>{const e=t((...n)=>s.next(n));return()=>e==null?void 0:e.dispose()})}const Vo=t=>`sheet_interceptor_${t}`,zn=t=>function(s,e){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,e,r.bind(null,i+1))}return r(0,s)};class po{constructor(s){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=s}fetchThroughInterceptors(s){const e=s,n=this._interceptorsByName.get(e);return zn(n||[])}intercept(s,e){const n=s;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(e),this._interceptorsByName.set(n,r.sort((i,o)=>{var a,c;return((a=o.priority)!=null?a:0)-((c=i.priority)!=null?c:0)})),()=>Y(this._interceptorsByName.get(n),e)}getInterceptPoints(){return this._interceptorPoints}}const xo=O.createIdentifier("univer.snapshot-server-service");class jo{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(s,e){return Promise.resolve({snapshot:{unitID:"",type:K.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:k.OK,message:""}})}getSheetBlock(s,e){const n=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:n,error:{code:k.OK,message:""}})}fetchMissingChangesets(s,e){return Promise.resolve({changesets:[],error:{code:k.OK,message:""}})}getResourcesRequest(s,e){return Promise.resolve({resources:{},error:{code:k.OK,message:""}})}saveSnapshot(s,e){return Promise.resolve({error:{code:k.OK,message:""}})}saveSheetBlock(s,e){const{block:n}=e;return n?(this._sheetBlockCache.set(n.id,n),Promise.resolve({error:{code:k.OK,message:""},blockID:n.id})):Promise.resolve({error:{code:k.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(s,e){return Promise.resolve({error:{code:k.OK,message:""},concurrent:[]})}}function Ko(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(s,e)=>String.fromCharCode(Number.parseInt(e,16))))}function Ue(t){return decodeURIComponent(Array.prototype.map.call(atob(t),s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ot=new TextEncoder,Kt=new TextDecoder;function Xn(t){const s=R.deepClone(t);return delete s.id,delete s.name,delete s.rowCount,delete s.columnCount,delete s.cellData,Ot.encode(JSON.stringify(s))}function Jn(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.name,delete s.sheetOrder,delete s.sheets,Ot.encode(JSON.stringify(s))}function Yo(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.title,delete s.resources,Ot.encode(JSON.stringify(s))}function Qn(t){return JSON.parse(Kt.decode(t))}function zo(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}function Xo(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}const Me=256;function qn(t,s){const e=new V(t),n=e.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+Me,n-1),a=e.getSlice(i,Math.min(i+Me,n-1),0,s),c=Jo(a);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:c}),i+=Me}return r}function Jo(t){const s=t.getData();return Ot.encode(JSON.stringify(s))}async function Qo(t,s,e,n,r){const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([d,f])=>{const E={id:f.id,type:St.GRID,name:f.name,rowCount:f.rowCount,columnCount:f.columnCount,originalMeta:Xn(f)};if(o[d]=E,f.cellData){const g=qn(f.cellData,f.rowCount),m=await Promise.all(g.map(N=>r.saveSheetBlock(t,{unitID:e,type:K.UNIVER_SHEET,block:N})));if(m.some(N=>{var S;return((S=N.error)==null?void 0:S.code)!==k.OK}))return!1;i[d]={sheetID:d,blocks:m.map(N=>N.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const c=Jn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:c};return{snapshotRes:{unitID:e,rev:h.rev,type:K.UNIVER_SHEET,workbook:h,doc:void 0}}}async function qo(t,s,e,n,r){var f,E;const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([g,m])=>{const N={id:m.id,type:St.GRID,name:m.name,rowCount:m.rowCount,columnCount:m.columnCount,originalMeta:Xn(m)};if(o[g]=N,m.cellData){const S=qn(m.cellData,m.rowCount),H=await Promise.all(S.map(P=>r.saveSheetBlock(t,{unitID:e,type:K.UNIVER_SHEET,block:P})));if(H.some(P=>{var q;return((q=P.error)==null?void 0:q.code)!==k.OK}))return!1;i[g]={sheetID:g,blocks:H.map(P=>P.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const c=Jn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:c},u={unitID:e,rev:h.rev,type:K.UNIVER_SHEET,workbook:h,doc:void 0},d=await r.saveSnapshot(t,{unitID:e,type:K.UNIVER_SHEET,snapshot:u});if(mn(d.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
- ErrorCode: ${(f=d.error)==null?void 0:f.code}:${(E=d.error)==null?void 0:E.message}`);return{snapshot:u}}function Zo(t,s,e){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([c,h])=>{const u=Qn(h.originalMeta);r[c]={id:h.id,name:h.name,rowCount:h.rowCount,columnCount:h.columnCount,...u}});const i=new Map;s.forEach(c=>{i.set(c.id,c)}),n.blockMeta&&Object.entries(n.blockMeta).forEach(([c,h])=>{var f;const u=r[c];u.cellData={};const d=[];(f=h.blocks)==null||f.forEach(E=>{const g=i.get(E);if(g)d.push(g);else throw new Error("")}),d.forEach(E=>{const g=zo(E.data);Object.entries(g).forEach(([m,N])=>{const S=u.cellData[+m]={};Object.entries(N).forEach(([H,P])=>{S[+H]=P})})})});const o=Qn(n.originalMeta);return{id:t.unitID,rev:n.rev,name:n.name,sheetOrder:n.sheetOrder,appVersion:"",locale:y.EN_US,sheets:r,styles:{},resources:n.resources||[],...o}}function yo(t){const s=t.doc;if(s==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:n,name:r,originalMeta:i}=s,{body:o,documentStyle:a={},settings:c={}}=Xo(i);return{id:e,rev:n,locale:y.EN_US,title:r,body:o,documentStyle:a,settings:c}}async function ta(t,s,e,n,r){var c,h,u;const i={unitID:s.id,rev:n,creator:"",name:(c=s.title)!=null?c:"",resources:s.resources||[],originalMeta:Yo(s)},o={unitID:e,rev:i.rev,type:K.UNIVER_DOC,workbook:void 0,doc:i},a=await r.saveSnapshot(t,{unitID:e,type:K.UNIVER_DOC,snapshot:o});if(mn(a.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
- ErrorCode: ${(h=a.error)==null?void 0:h.code}:${(u=a.error)==null?void 0:u.message}`);return{snapshot:o}}async function ea(t,s){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const a=o.blocks.map(async c=>{const h={unitID:e.unitID,type:K.UNIVER_SHEET,blockID:c},{block:u}=await s.getSheetBlock({},h);if(u)n.push(u);else throw new Error("Block not found")});r.push(...a)}),await Promise.all(r),n}yn(),l.ABCToNumber=ui,l.AbsoluteRefType=j,l.ActionIterator=Te,l.AlignTypeH=ln,l.AlignTypeV=un,l.AutoFillSeries=rs,l.BaselineOffset=bt,l.BlockType=js,l.BooleanNumber=I,l.BorderStyleTypes=v,l.BorderType=is,l.BulletAlignment=X,l.COLORS=qt,l.CellValueType=_t,l.ClientSnapshotServerService=jo,l.Color=et,l.ColorBuilder=wt,l.ColorKit=$,l.ColorType=B,l.ColumnSeparatorType=zs,l.CommandType=Nt,l.CommonHideTypes=os,l.ConditionType=as,l.ConfigService=qe,l.ContentAlignment=nn,l.ContextService=Ke,l.CopyPasteType=cs,l.CustomRangeType=xs,l.DEFAULT_CELL=Hi,l.DEFAULT_DOC=fe,l.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=gr,l.DEFAULT_EMPTY_DOCUMENT_VALUE=Oo,l.DEFAULT_RANGE=Pi,l.DEFAULT_RANGE_ARRAY=gt,l.DEFAULT_SELECTION=Fi,l.DEFAULT_SLIDE=En,l.DEFAULT_STYLES=Bt,l.DEFAULT_WORKBOOK=fn,l.DEFAULT_WORKSHEET_COLUMN_COUNT=Cn,l.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=xi,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=vn,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=zi,l.DEFAULT_WORKSHEET_COLUMN_WIDTH=Sn,l.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=Ki,l.DEFAULT_WORKSHEET_ROW_COUNT=An,l.DEFAULT_WORKSHEET_ROW_COUNT_KEY=pi,l.DEFAULT_WORKSHEET_ROW_HEIGHT=Nn,l.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=ji,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Ln,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Yi,l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=$n,l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Gn,l.DashStyleType=tn,l.DataStreamTreeNodeType=Ms,l.DataStreamTreeTokenType=ce,l.DesktopLogService=ze,l.DeveloperMetadataVisibility=ls,l.Dimension=us,l.Direction=hs,l.Disposable=U,l.DisposableCollection=Jt,l.DocStyleType=Vs,l.DocumentDataModel=st,l.EDITOR_ACTIVATED=wn,l.EXTENSION_NAMES=gn,l.Entry=se,l.EntryIterator=bs,l.ErrorService=Ze,l.EventState=xe,l.FOCUSING_DOC=me,l.FOCUSING_EDITOR_BUT_HIDDEN=to,l.FOCUSING_EDITOR_INPUT_FORMULA=eo,l.FOCUSING_EDITOR_STANDALONE=no,l.FOCUSING_FORMULA_EDITOR=Tn,l.FOCUSING_SHEET=Gt,l.FOCUSING_SLIDE=Oe,l.FOCUSING_UNIVER_EDITOR=so,l.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=ro,l.FloatingObjectManagerService=ye,l.FollowNumberWithType=ps,l.FontItalic=Lt,l.FontStyleType=rn,l.FontWeight=vt,l.FormatType=_s,l.GlyphType=Et,l.GridType=Ks,l.HLSColor=Os,l.HorizontalAlign=tt,l.ICommandService=ut,l.IConfigService=Qe,l.IContextService=nt,l.IFloatingObjectManagerService=ts,l.ILocalStorageService=Go,l.ILogService=Z,l.IPermissionService=Se,l.IResourceManagerService=Ne,l.ISnapshotPersistenceService=Pn,l.ISnapshotServerService=xo,l.IUndoRedoService=pt,l.IUniverInstanceService=ct,l.InterceptorManager=po,l.InterpolationPointType=ds,l.KeyIterator=Ls,l.LRUHelper=dt,l.LRUMap=Ds,l.LifecycleStages=D,l.LocaleService=mt,l.LocaleType=y,l.LogLevel=Ye,l.MemoryCursor=es,l.NamedStyleType=Zs,l.NilCommand=Je,l.NumberUnitType=cn,l.ObjectMatrix=V,l.ObjectRelativeFromH=on,l.ObjectRelativeFromV=an,l.Observable=Ct,l.ObservableHooks=ko,l.Observer=At,l.OnLifecycle=Ie,l.PRESET_LIST_TYPE=Ai,l.PageElementType=On,l.PageOrientType=_n,l.PageType=ge,l.ParagraphElementType=Js,l.PermissionPoint=ws,l.PermissionStatus=oe,l.Plugin=Pe,l.PluginType=w,l.PositionedObjectLayoutType=qs,l.PresetListType=Wt,l.ProtectionType=fs,l.RANGE_TYPE=W,l.RGBA_PAREN=Ar,l.RGB_PAREN=Ir,l.Range=at,l.Rectangle=ft,l.RedoCommand=Kn,l.RedoCommandId=pn,l.RefAlias=li,l.Registry=Yt,l.RegistryAsMap=zt,l.RelativeDate=Es,l.RelativeSlideLink=In,l.ResourceManagerService=kn,l.RgbColor=Tt,l.RxDisposable=lr,l.SectionType=Ys,l.ShapeType=gs,l.SheetTypes=St,l.SheetViewModel=Dn,l.SlideDataModel=Re,l.SpacingRule=ys,l.Styles=Rn,l.THEME_COLORS=ms,l.TabStopAlignment=en,l.TextDecoration=Rs,l.TextDirection=ht,l.TextDirectionType=Xs,l.TextX=jt,l.TextXActionType=C,l.ThemeColor=Ut,l.ThemeColorType=F,l.ThemeColors=Dt,l.ThemeService=Le,l.Tools=R,l.UndoCommand=jn,l.UndoCommandId=xn,l.Univer=Fo,l.UniverEditablePermission=Vt,l.UniverEditablePermissionPoint=Wn,l.UniverInstanceType=Un,l.UpdateDocsAttributeType=M,l.ValueIterator=vs,l.VerticalAlign=rt,l.WidthType=sn,l.Worksheet=Rt,l.WrapStrategy=it,l.WrapTextType=Qs,l.b64DecodeUnicode=Ue,l.b64EncodeUnicode=Ko,l.binarySearchArray=ss,l.cellToRange=qr,l.characterSpacingControlType=hn,l.checkForSubstrings=Zr,l.checkParagraphHasBullet=yr,l.checkParagraphHasIndent=ti,l.checkParagraphHasIndentByStyle=Cs,l.codeToBlob=mr,l.composeBody=de,l.composeInterceptors=zn,l.concatMatrixArray=ni,l.createInterceptorKey=Vo,l.createRowColIter=ae,l.debounce=gi,l.dedupe=nr,l.deepCompare=te,l.deleteContent=Ss,l.extractPureTextFromCell=Xi,l.fromCallback=$o,l.fromObservable=cr,l.generateTemporarySnap=Qo,l.getArrayLength=x,l.getBodySlice=_e,l.getBorderStyleType=Jr,l.getCellValueType=Bi,l.getColorStyle=p,l.getDocsUpdateBody=Ft,l.getReverseDirection=Or,l.getSheetBlocksFromSnapshot=ea,l.getTypeFromPermissionItemList=ai,l.getWorksheetUID=yi,l.groupBy=or,l.handleJsonToDom=zr,l.handleStyleToString=Xr,l.hashAlgorithm=si,l.horizontalLineSegmentsSubtraction=ee,l.insertMatrixArray=ne,l.insertTextToContent=Ns,l.isBlackColor=Pr,l.isCellV=Gi,l.isEmptyCell=jr,l.isFormulaId=Yr,l.isFormulaString=Kr,l.isICellData=Wi,l.isNullCell=ki,l.isObserver=je,l.isRealNum=ei,l.isSameStyleTextRun=As,l.isValidRange=Qr,l.isWhiteColor=Fr,l.makeCellRangeToRangeData=xr,l.makeCellToSelection=pr,l.mergeWorksheetSnapshotWithDefault=bn,l.moveMatrixArray=ie,l.normalizeTextRuns=le,l.numberToABC=_i,l.numberToListABC=di,l.orderSearchArray=ns,l.remove=Y,l.repeatStringNumTimes=Us,l.replaceInDocumentBody=Bo,l.requestImmediateMacroTask=Wo,l.rotate=ir,l.runOnLifecycle=Ae,l.searchArray=Rr,l.selectionToArray=ci,l.sequence=He,l.sequenceAsync=Fe,l.sequenceExecute=Qt,l.sequenceExecuteAsync=Er,l.sliceMatrixArray=ri,l.sortRules=fi,l.sortRulesByDesc=Ei,l.sortRulesFactory=ot,l.spliceArray=re,l.textDecoder=Kt,l.textEncoder=Ot,l.throttle=Ho,l.toDisposable=b,l.transformDocumentDataToSnapshot=ta,l.transformSnapshotToDocumentData=yo,l.transformSnapshotToWorkbookData=Zo,l.transformWorkbookDataToSnapshot=qo,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
3
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function Ge(t,s){if(t){var e=t.indexOf(s);0<=e&&t.splice(e,1)}}var $e=function(){function t(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var s,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var c=We(o),a=c.next();!a.done;a=c.next()){var h=a.value;h.remove(this)}}catch(m){s={error:m}}finally{try{a&&!a.done&&(e=c.return)&&e.call(c)}finally{if(s)throw s.error}}else o.remove(this);var u=this.initialTeardown;if(ut(u))try{u()}catch(m){i=m instanceof Xt?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var E=We(d),f=E.next();!f.done;f=E.next()){var g=f.value;try{pe(g)}catch(m){i=i!=null?i:[],m instanceof Xt?i=ke(ke([],Be(i)),Be(m.errors)):i.push(m)}}}catch(m){n={error:m}}finally{try{f&&!f.done&&(r=E.return)&&r.call(E)}finally{if(n)throw n.error}}}if(i)throw new Xt(i)}},t.prototype.add=function(s){var e;if(s&&s!==this)if(this.closed)pe(s);else{if(s instanceof t){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(s)}},t.prototype._hasParent=function(s){var e=this._parentage;return e===s||Array.isArray(e)&&e.includes(s)},t.prototype._addParent=function(s){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(s),e):e?[e,s]:s},t.prototype._removeParent=function(s){var e=this._parentage;e===s?this._parentage=null:Array.isArray(e)&&Ge(e,s)},t.prototype.remove=function(s){var e=this._finalizers;e&&Ge(e,s),s instanceof t&&s._removeParent(this)},t.EMPTY=function(){var s=new t;return s.closed=!0,s}(),t}();$e.EMPTY;function Ve(t){return t instanceof $e||t&&"closed"in t&&ut(t.remove)&&ut(t.add)&&ut(t.unsubscribe)}function pe(t){ut(t)?t():t.unsubscribe()}class xe{constructor(s=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(s)}initialize(s=!1){return this.skipNextObservers=s,this}stopPropagation(){this.isStopPropagation=!0}}function je(t){return t instanceof At}class At{constructor(s,e){_(this,"_willBeUnregistered",!1);_(this,"unregisterOnNextCall",!1);this.callback=s,this.observable=e}dispose(){this.observable.remove(this)}}class Ct{constructor(s){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new xe,s&&(this._onObserverAdded=s)}get observers(){return this._observers}add(s,e=!1,n=!1){if(!s)return null;const r=new At(s,this);return r.unregisterOnNextCall=n,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(s){return this.add(s,void 0,!0)}remove(s){return s&&this._observers.indexOf(s)!==-1?(this._deferUnregister(s),!0):!1}removeCallback(s){for(let e=0;e<this._observers.length;e++){const n=this._observers[e];if(!n._willBeUnregistered&&n.callback===s)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(s){this._remove(s),this._observers.unshift(s)}makeObserverBottomPriority(s){this._remove(s),this._observers.push(s)}notifyObservers(s){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=s,e.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(s,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(n=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(s){let e=Promise.resolve(s);if(!this._observers.length)return e;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(e=e.then(()=>i.callback(s,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>s)}notifyObserver(s,e){if(s._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,s.callback(e,n),s.unregisterOnNextCall&&this._deferUnregister(s),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const s=new Ct;return s._observers=this._observers.slice(0),s}_deferUnregister(s){s.unregisterOnNextCall=!1,s._willBeUnregistered=!0,setTimeout(()=>{this._remove(s)},0)}_remove(s){if(!s)return!1;const e=this._observers.indexOf(s);return e!==-1?(this._observers.splice(e,1),!0):!1}}function b(t){let s=!1;return Ve(t)?{dispose:()=>{s||(s=!0,t.unsubscribe())}}:je(t)?{dispose:()=>{s||(s=!0,t.dispose())}}:{dispose:()=>{s||(s=!0,t())}}}function Rr(t){return b(()=>{t.unsubscribe()})}class qt{constructor(){_(this,"_disposables",new Set)}add(s){return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(s=>{s.dispose(),this._disposables.delete(s)})}}class U{constructor(){_(this,"_disposed",!1);_(this,"_collection",new qt)}disposeWithMe(s){const e=Ve(s)?b(s):s;return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class mr extends U{constructor(){super(...arguments);_(this,"dispose$",new A.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const it=O.createIdentifier("univer.context-service");class Ke extends U{constructor(){super(...arguments);_(this,"_contextChanged$",new A.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var n;return(n=this._contextMap.get(e))!=null?n:!1}setContextValue(e,n){this._contextMap.set(e,n),this._contextChanged$.next({[e]:n})}subscribeContextValue$(e){return new A.Observable(n=>{const r=this._contextChanged$.pipe(A.filter(i=>typeof i[e]<"u")).subscribe(i=>n.next(i[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var 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 y=O.createIdentifier("univer.log");class ze extends U{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):e(...n)}}var Or=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,Ar=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ir(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Or(s,e,r),r},Xe=(t,s)=>(e,n)=>s(e,n,t),Nt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Nt||{});const ht=O.createIdentifier("anywhere.command-service");class Cr{constructor(){_(this,"_commands",new Map)}registerCommand(s){if(this._commands.has(s.id))throw new Error(`[CommandRegistry]: command "${s.id}" has been registered before.`);return this._commands.set(s.id,s),b(()=>{var e;this._commands.delete(s.id),(e=s.onDispose)==null||e.call(s)})}getCommand(s){return this._commands.has(s)?[this._commands.get(s)]:null}}l.CommandService=class{constructor(s,e){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=s,this._logService=e,this._commandRegistry=new Cr,this._registerCommand(qe)}registerCommand(s){return this._registerCommand(s)}registerMultipleCommand(s){return this._registerMultiCommand(s)}beforeCommandExecuted(s){if(this._beforeCommandExecutionListeners.indexOf(s)===-1)return this._beforeCommandExecutionListeners.push(s),b(()=>{const e=this._beforeCommandExecutionListeners.indexOf(s);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(s){if(this._commandExecutedListeners.indexOf(s)===-1)return this._commandExecutedListeners.push(s),b(()=>{const e=this._commandExecutedListeners.indexOf(s);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(s,e,n){const r=this._commandRegistry.getCommand(s);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},c=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(h=>h(o,n));const a=await this._execute(i,e,n);return this._commandExecutedListeners.forEach(h=>h(o,n)),c.dispose(),a}throw new Error(`[CommandService]: command "${s}" is not registered.`)}syncExecuteCommand(s,e,n){var i;const r=this._commandRegistry.getCommand(s);if(r){const[o]=r,c={id:o.id,type:o.type,params:e};if(o.type===2){const u=dr(this._commandExecutionStack,d=>d.type===0);u&&(c.params=(i=c.params)!=null?i:{},c.params.trigger=u.id)}const a=this._pushCommandExecutionStack(c);this._beforeCommandExecutionListeners.forEach(u=>u(c,n));const h=this._syncExecute(o,e,n);return this._commandExecutedListeners.forEach(u=>u(c,n)),a.dispose(),h}throw new Error(`[CommandService]: command "${s}" is not registered.`)}_pushCommandExecutionStack(s){return this._commandExecutionStack.push(s),b(()=>K(this._commandExecutionStack,s))}_registerCommand(s){return this._commandRegistry.registerCommand(s)}_registerMultiCommand(s){const e=this._commandRegistry.getCommand(s.id);let n;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");n=e[0]}else{const i=new qt;n=new Nr(s.id),i.add(this._commandRegistry.registerCommand(n)),i.add(b(()=>{this._multiCommandDisposables.delete(s.id)})),this._multiCommandDisposables.set(s.id,i)}const r=n.registerImplementation(s);return b(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(s.id))==null||i.dispose()})}async _execute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${s.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(s.handler,e,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${s.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(s.handler,e,n),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}},l.CommandService=Ar([Xe(0,O.Inject(O.Injector)),Xe(1,y)],l.CommandService);class Nr{constructor(s){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(s,e)=>{if(!this._implementations.length)return!1;const n=s.get(y),r=s.get(it),i=s.get(O.Injector);for(const o of this._implementations){const c=o.command.preconditions;if((!c||c&&c(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=s,this.name=s}registerImplementation(s){const e={command:s};return this._implementations.push(e),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),b(()=>{var r;const n=this._implementations.indexOf(e);this._implementations.splice(n,1),(r=s.onDispose)==null||r.call(s)})}hasImplementations(){return this._implementations.length>0}}function Qt(t,s,e){const n=t.map(r=>()=>s.syncExecuteCommand(r.id,r.params,e));return Fe(n)}function Sr(t,s,e){const n=t.map(r=>()=>s.executeCommand(r.id,r.params,e));return He(n)}const qe={id:"nil",type:0,handler:()=>!0},Qe=O.createIdentifier("univer.config-service");class Je{constructor(){_(this,"_config",new Map)}getConfig(s){return this._config.get(s)}setConfig(s,e){this._config.set(s,e)}deleteConfig(s){this._config.delete(s)}}class Ze extends U{constructor(){super(...arguments);_(this,"_error$",new A.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const Lr="__default_document_sub_component_id20231101__";class ye{constructor(){_(this,"_managerInfo",new Map);_(this,"_remove$",new A.Subject);_(this,"remove$",this._remove$.asObservable());_(this,"_andOrUpdate$",new A.Subject);_(this,"andOrUpdate$",this._andOrUpdate$.asObservable());_(this,"_pluginUpdate$",new A.Subject);_(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(s){return this._getFloatingObject(s)}getFloatObjects(s){return this._getFloatingObjects(s)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(s){const e=this._clearByParam(s);this._remove$.next(e)}addOrUpdate(s){const e=this._addByParam(s);this._andOrUpdate$.next(e)}BatchAddOrUpdate(s){const e=[];s.forEach(n=>{e.push(...this._addByParam(n))}),this._andOrUpdate$.next(e)}remove(s){const e=this._removeByParam(s);this._remove$.next(e)}pluginUpdateRefresh(s){this._pluginUpdate$.next(s)}_getFloatingObjects(s){var r;if(s==null)return;const{unitId:e,subUnitId:n}=s;return(r=this._managerInfo.get(e))==null?void 0:r.get(n)}_getFloatingObject(s){var i,o;if(s==null)return;const{unitId:e,subUnitId:n,floatingObjectId:r}=s;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(s){const{unitId:e,subUnitId:n,floatingObject:r,floatingObjectId:i}=s;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:e,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(s){const e=this._getFloatingObjects(s),{unitId:n,subUnitId:r}=s,i=[];return e==null||e.forEach((o,c)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:c,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(s){const e=this._getFloatingObjects(s),n=e==null?void 0:e.get(s.floatingObjectId);return n==null?[]:(e==null||e.delete(s.floatingObjectId),[{...s,floatingObject:n}])}}const ts=O.createIdentifier("univer.floating-object.service");class es{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(s){this.cursor+=s}moveCursorTo(s){this.cursor=s}}function ss(t,s){let e=0,n=t.length-1;for(;e<=n;){const r=Math.floor((n+e)/2);if(s<t[r]&&(r===0||s>=t[r-1]))return r;if(s>=t[r])e=r+1;else if(s<t[r])n=r-1;else return-1}return-1}function ns(t,s){let e=0,n=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(n=t[o],o===0?r=0:r=t[o-1],s>=r&&s<=n){i=o;break}if(n=t[e],e===0?r=0:r=t[e-1],s>=r&&s<n){i=e;break}e++,o--}return i}function vr(t,s){let e=t.length-1;return s<0?-1:s<t[0]?0:s>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||s<=t[20]||s>=t[e-20]?e=ns(t,s):e=ss(t,s),e)}function br(t){const s=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(s)}var rs=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(rs||{}),v=(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))(v||{}),is=(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))(is||{}),B=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(B||{}),os=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(os||{}),cs=(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))(cs||{}),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||{}),ls=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(ls||{}),us=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(us||{}),hs=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(hs||{});function Tr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var _s=(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))(_s||{}),ds=(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))(ds||{}),tt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(tt||{}),Es=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Es||{}),fs=(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))(fs||{}),gs=(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))(gs||{}),St=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(St||{}),_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||{}),Rs=(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))(Rs||{}),et=(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))(et||{}),ot=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(ot||{}),ct=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ct||{}),Lt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Lt||{}),vt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(vt||{}),bt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(bt||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),dt=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(dt||{}),H=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(H||{}),Tt=(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))(Tt||{});const ms={[Tt.OFFICE]:{[H.ACCENT1]:"#4472C4",[H.ACCENT2]:"#ED7D31",[H.ACCENT3]:"#A5A5A5",[H.ACCENT4]:"#70AD47",[H.ACCENT5]:"#5B9BD5",[H.ACCENT6]:"#70AD47",[H.DARK1]:"#000000",[H.DARK2]:"#44546A",[H.LIGHT1]:"#FFFFFF",[H.LIGHT2]:"#E7E6E6",[H.HYPERLINK]:"#0563C1",[H.FOLLOWED_HYPERLINK]:"#954F72"}};class wt{constructor(){_(this,"_themeValue",H.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=B.UNSUPPORTED,this._themeColors=Tt.OFFICE,this._themeTint=0}asRgbColor(){return new Dt(this._rgbValue,this)}asThemeColor(){return new Ut(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case B.THEME:return this.asThemeColor();case B.RGB:return this.asRgbColor();case B.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(s){return this._colorType=B.RGB,this._rgbValue=s,this}setThemeColors(s){this._colorType=B.THEME,this._themeColors=s}setThemeTint(s){this._colorType=B.THEME,this._themeTint=s}setThemeColor(s){return this._colorType=B.THEME,this._themeValue=s,this}getColorType(){return this._colorType}}class st{constructor(s){_(this,"_builder");this._builder=s}static rgbColorToHexValue(s){return`#${((1<<24)+(s.getRed()<<16)+(s.getGreen()<<8)+s.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(s){s?s.indexOf("#")>-1&&(s=s.substring(1)):s="#000000";const e=+`0x${s[0]}${s[1]}`,n=+`0x${s[2]}${s[3]}`,r=+`0x${s[4]}${s[5]}`;return new wt().setRgbColor(`rgb(${e},${n},${r})`).asRgbColor()}static hexToRgbString(s){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;s=s.replace(e,(i,o,c,a)=>o+o+c+c+a+a);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),c=Number.parseInt(n[3],16);r=`rgba(${i},${o},${c})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new st(this._builder)}equals(s){return!1}}class Os{constructor(s){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const e=s.getRed()/255,n=s.getGreen()/255,r=s.getBlue()/255,i=s.getAlpha()/255,o=Math.min(e,Math.min(n,r)),c=Math.max(e,Math.max(n,r)),a=c-o;if(c===o){this._hue=0,this._saturation=0,this._lightness=c;return}this._lightness=(o+c)/2,this._lightness<.5?this._saturation=a/(c+o):this._saturation=a/(2-c-o),e===c&&(this._hue=(n-r)/a),n===c&&(this._hue=2+(r-e)/a),r===c&&(this._hue=4+(e-n)/a),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const s=new wt;if(this._saturation===0)return s.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),s.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,n,i),c=this.setColor(e,n,r),a=r-1/3,h=this.setColor(e,n,a);return s.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(c*255)},${Math.round(h*255)},${this._alpha*255})`),s.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(s,e,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=e+(s-e)*6*n:2*n<1?r=s:3*n<2?r=e+(s-e)*(2/3-n)*6:r=e,r}setLightness(s){this._lightness=s}}const G=class G extends st{constructor(e,n){super(n);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=e.match(G.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],c=+r[3],a=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=a;return}if(r=e.match(G.RGB_EXTRACT),r){const i=+r[1],o=+r[2],c=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return st.rgbColorToHexValue(this)}getRed(){let e=this._red+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return B.RGB}clone(){return new G(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof G?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(G,"RGB_COLOR_AMT",0),_(G,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(G,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Dt=G;const Q=class Q extends st{constructor(e,n,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=e,this._themeTint=n,this._themeColors=r}lumValue(e,n){if(e==null)return n;let r;return e<0?r=n*(1+e):r=n*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=ms[this._themeColors];if(e==null)throw new Error("not find themeColors type");const n=e[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(Q._cacheThemeColor.has(this._themeColors)){if(r=Q._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Q._cacheThemeColor.set(this._themeColors,r);const i=new Os(st.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 Q(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(e){return e instanceof Q?e._themeColorType===this._themeColorType:!1}getColorType(){return B.THEME}getThemeColorType(){return this._themeColorType}};_(Q,"_cacheThemeColor",new Map);let Ut=Q;const wr="rgb(",Dr="rgba(",Jt={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 ${constructor(s){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(s==null){this._setNullColor();return}if(s instanceof $){this._color={...s._color},this._rgbColor={...s._rgbColor};return}const e=Is(s);if(e==null){this._setNullColor();return}this._color=e;const n=Fr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(s,e,n){var h,u;n=Math.min(1,Math.max(0,n));const r=new $(s).toRgb(),i=new $(e).toRgb(),o=(h=r.a)!=null?h:1,c=(u=i.a)!=null?u:1,a={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(c-o)*n+o};return new $(a)}static getContrastRatio(s,e){const n=new $(s).getLuminance(),r=new $(e).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:s,g:e,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${s},${e},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(s){const{r:e,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,c=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(r).toString(16)),Mt(Math.round(i*255).toString(16))];return s&&c[0][0]===c[0][1]&&c[1][0]===c[1][1]&&c[2][0]===c[2][1]&&c[3][0]===c[3][1]?o?`#${c[0][0]}${c[1][0]}${c[2][0]}${c[3][0]}`:`#${c[0][0]}${c[1][0]}${c[2][0]}`:o?`#${c[0]}${c[1]}${c[2]}${c[3]}`:`#${c[0]}${c[1]}${c[2]}`}toHsv(){return Gr(this.toRgb())}toHsl(){return kr(this.toRgb())}lighten(s=10){const e=this.toHsl();return e.l+=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}darken(s=10){const e=this.toHsl();return e.l-=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}setAlpha(s){return new $({...this._rgbColor,a:s})}getLuminance(){let{r:s,g:e,b:n}=this.toRgb();return s=Zt(s),e=Zt(e),n=Zt(n),Number((.2126*s+.7152*e+.0722*n).toFixed(3))}getBrightness(){const{r:s,g:e,b:n}=this.toRgb();return(s*299+e*587+n*114)/1e3}getAlpha(){var s;return(s=this._color.a)!=null?s:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const Mt=t=>t.length===1?`0${t}`:t,Zt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Is=t=>{if(Vr(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const s=t.trim();if(Jt[s]){const e=Jt[s],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(s.startsWith("#"))return Ur(s);if(s.startsWith("rgb"))return Mr(s);if(s.startsWith("hsl"))return Pr(s);if(s.startsWith("hsv"))return Hr(s)},Ur=t=>{const s=t.substring(1),e=new RegExp(`.{1,${s.length>=6?2:1}}`,"g");let n=s.match(e);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:Number.parseInt(n[0],16),g:Number.parseInt(n[1],16),b:Number.parseInt(n[2],16)};return n.length>3&&(r.a=Number.parseInt(n[3],16)/255),r},Mr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Pr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Hr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Fr=t=>{const s=Is(t);if(s!=null)return"r"in s?s:"l"in s?Wr(s):Br(s)},yt=(t,s,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(s-t)*6*e:e<1/2?s:e<2/3?t+(s-t)*(2/3-e)*6:t),Wr=t=>{let{h:s,s:e,l:n}=t;s/=360,e/=100,n/=100;let r=0,i=0,o=0;if(e===0)r=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,h=2*n-a;r=yt(h,a,s+1/3),i=yt(h,a,s),o=yt(h,a,s-1/3)}const c={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(c.a=t.a),c},Br=t=>{let{h:s,s:e,v:n}=t;s=s/360*6,e/=100,n/=100;const r=Math.floor(s),i=s-r,o=n*(1-e),c=n*(1-i*e),a=n*(1-(1-i)*e),h=r%6,u=[n,c,o,o,a,n][h],d=[a,n,n,c,o,o][h],E=[o,o,a,n,n,c][h],f={r:u*255,g:d*255,b:E*255};return t.a!==void 0&&(f.a=t.a),f},kr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n),o=(r+i)/2;let c,a;if(r===i)c=a=0;else{const u=r-i;switch(a=o>.5?u/(2-r-i):u/(r+i),r){case s:c=(e-n)/u+(e<n?6:0);break;case e:c=(n-s)/u+2;break;default:c=(s-e)/u+4;break}c/=6}const h={h:Math.round(c*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},Gr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n);let o;const c=r,a=r-i,h=r===0?0:a/r;if(r===i)o=0;else{switch(r){case s:o=(e-n)/a+(e<n?6:0);break;case e:o=(n-s)/a+2;break;default:o=(s-e)/a+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(h*100),v:Math.round(c*100)};return t.a!==void 0&&(u.a=t.a),u},$r=t=>t==null,Vr=t=>!$r(t)&&typeof t=="object";function pr(t){const s=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,n=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}function xr(t){const s=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,n=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}var M=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(M||{});const jr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Kr=t=>crypto.getRandomValues(new Uint8Array(t)),Yr=(t,s,e)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*s/t.length);return(i=s)=>{let o="";for(;;){let c=e(r),a=r;for(;a--;)if(o+=t[c[a]&n]||"",o.length===i)return o}}},zr=(t,s=21)=>Yr(t,s,Kr),Xr=(t=21)=>{let s="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)s+=jr[e[t]&63];return s};const qr=/^-ms-/,Qr=/-([a-z])/g,Y=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];class R{static stringAt(s){let e="",n=s;for(;n>=Y.length;)n/=Y.length,n-=1,e+=Y[n%Y.length];const r=s%Y.length;return e+=Y[r],e}static indexAt(s){let e=0;for(let n=0;n<s.length-1;n+=1){const r=s.charCodeAt(n)-65,i=s.length-1-n;e+=Y.length**i+Y.length*r}return e+=s.charCodeAt(s.length-1)-65,e}static deleteBlank(s){return R.isString(s)?s.replace(/\s/g,""):s}static getSystemType(){const s=navigator.userAgent,e=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!e&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(s.indexOf("Windows NT 5.0")>-1||s.indexOf("Windows 2000")>-1)return"Windows 2000";if(s.indexOf("Windows NT 5.1")>-1||s.indexOf("Windows XP")>-1)return"Windows XP";if(s.indexOf("Windows NT 5.2")>-1||s.indexOf("Windows 2003")>-1)return"Windows 2003";if(s.indexOf("Windows NT 6.0")>-1||s.indexOf("Windows Vista")>-1)return"Windows Vista";if(s.indexOf("Windows NT 6.1")>-1||s.indexOf("Windows 7")>-1)return"Windows 7";if(s.indexOf("Windows NT 10")>-1||s.indexOf("Windows 10")>-1)return"Windows 10";if(s.indexOf("Windows NT 11")>-1||s.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const s=navigator.userAgent,e=s.indexOf("Opera")>-1,n=s.indexOf("compatible")>-1&&s.indexOf("MSIE")>-1&&!e,r=s.indexOf("Trident")>-1&&s.indexOf("rv:11.0")>-1,i=s.indexOf("Edge")>-1,o=s.indexOf("Firefox")>-1,c=s.indexOf("Safari")>-1&&s.indexOf("Chrome")===-1,a=s.indexOf("Chrome")>-1&&s.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(s);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":e?"Opera":c?"Safari":a?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(s=21,e){return e?zr(e,s)():Xr(s)}static getClassName(s){return s.constructor.name}static deepMerge(s,...e){e.forEach(o=>o&&i(o));function n(o,c){o.forEach((a,h)=>{var u,d;if(R.isArray(a)){const E=(u=c[h])!=null?u:[];c[h]=E,n(a,E);return}if(R.isObject(a)){const E=(d=c[h])!=null?d:{};c[h]=E,r(a,E);return}c[h]=a})}function r(o,c){Object.keys(o).forEach(a=>{var u,d;const h=o[a];if(R.isObject(h)){const E=(u=c[a])!=null?u:{};c[a]=E,r(h,E);return}if(R.isArray(h)){const E=(d=c[a])!=null?d:[];c[a]=E,n(h,E);return}c[a]=h})}function i(o){Object.keys(o).forEach(c=>{var h,u;const a=o[c];if(R.isArray(a)){const d=(h=s[c])!=null?h:[];s[c]=d,n(a,d);return}if(R.isObject(a)){const d=(u=s[c])!=null?u:{};s[c]=d,r(a,d);return}s[c]=a})}return s}static numberFixed(s,e){return Number(Number(s).toFixed(e))}static diffValue(s,e){function n(o,c){const a=R.getValueType(o),h=R.getValueType(c);return a!==h?!1:R.isArray(o)?r(o,c):R.isObject(o)?i(o,c):R.isDate(o)?o.getTime()===c.getTime():R.isRegExp(o)?o.toString()===c.toString():o===c}function r(o,c){if(s.length!==e.length)return!1;for(let a=0,h=o.length;a<h;a++){const u=o[a],d=c[a];if(!n(u,d))return!1}return!0}function i(o,c){const a=Object.keys(o),h=Object.keys(c);if(a.length!==h.length)return!1;for(const u of a){if(!h.includes(u))return!1;const d=o[u],E=c[u];if(!n(d,E))return!1}return!0}return n(s,e)}static deepClone(s){if(!this.isDefine(s))return s;if(this.isRegExp(s))return new RegExp(s);if(this.isDate(s))return new Date(s);if(this.isArray(s)){const e=[];return s.forEach((n,r)=>{e[r]=R.deepClone(n)}),e}if(this.isObject(s)){const e={};return Object.keys(s).forEach(n=>{const r=s[n];e[n]=R.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(s)),e}return s}static getLanguage(){const s="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||s}static getValueType(s){return Object.prototype.toString.apply(s)}static isDefine(s){return s!=null}static isBlank(s){return this.isDefine(s)?this.isString(s)?s.trim()==="":!1:!0}static isAssignableFrom(s,e){return s instanceof e}static isBoolean(s){return this.getValueType(s)==="[object Boolean]"}static isPlainObject(s){return this.isDefine(s)?Object.getPrototypeOf(s)===Object.getPrototypeOf({}):!1}static isFunction(s){return this.getValueType(s)==="[object Function]"}static isDate(s){return this.getValueType(s)==="[object Date]"}static isRegExp(s){return this.getValueType(s)==="[object RegExp]"}static isArray(s){return this.getValueType(s)==="[object Array]"}static isString(s){return this.getValueType(s)==="[object String]"}static isNumber(s){return this.getValueType(s)==="[object Number]"}static isStringNumber(s){return!isNaN(Number.parseFloat(s))&&isFinite(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isEmptyObject(s){for(const e in s)return!1;return!0}static isMobile(){let s=0,e=0;return document.body.clientWidth&&(s=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||s<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const s=navigator.userAgent.toLowerCase();return String(s.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const s=navigator.userAgent;return s.indexOf("Android")>-1||s.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(s){return e=>{for(let n=0;n<s;n++)e&&e()}}static hasLength(s,e){return R.isDefine(s)?R.isDefine(e)?s.length===e:s.length>0:!1}static capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}static fCamelCase(s,e){return e.toUpperCase()}static camelCase(s){return s.replace(qr,"ms-").replace(Qr,this.fCamelCase)}static removeNull(s){return this.isObject(s)&&Object.keys(s).forEach(e=>{const n=s[e];n==null?delete s[e]:R.removeNull(n)}),s}static fillTwoDimensionalArray(s,e,n){return new Array(s).fill(n).map(r=>new Array(e).fill(n))}static numToWord(s){let e="";for(;s>0;){let n=s%26;n=n===0?n=26:n,e=String.fromCharCode(96+n)+e,s=(s-n)/26}return e.toLocaleUpperCase()}static ABCatNum(s){if(s==null||s.length===0)return Number.NaN;const e=s.toLowerCase().split(""),n=e.length;let r=0,i=0;for(let o=0;o<n;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(s){let i="";for(;s>=0;)i=String.fromCharCode(s%26+97)+i,s=Math.floor(s/26)-1;return i.toUpperCase()}static randSort(s){for(let e=0,n=s.length;e<n;e++){const r=Number.parseInt((Math.random()*n).toString()),i=s[r];s[r]=s[e],s[e]=i}return s}static commonExtend(s,e){const n={};for(const r in s)n[r]=s[r];for(const r in e)e[r]!=null&&(n[r]=e[r]);return n}static commonExtend1(s,e){for(const n in s)e[n]==null&&(e[n]=s[n]);return e}static arrayToObject(s){const e={};return s.forEach((n,r)=>{e[r]={},n.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(s,e,n,r){return e>=n&&r>=s}static isStartValidPosition(s){return/^[A-Za-z_]/.test(s)}static isValidParameter(s){const e=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(s),n=s.length<=255;return!e&&n}}function Jr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:c,startX:a,endX:h}=t,u=s,d=e,E=s,f=e;if(n&&i){const{startRow:g,startColumn:m,endRow:N,endColumn:S,startY:F,endY:P,startX:J,endX:Rc}=i;u=g,d=m,E=N,f=S,o=F,c=P,a=J,h=Rc}return r&&(o=i.startY,c=i.endY,a=i.startX,h=i.endX,E=i.endRow,f=i.endColumn),{startRow:u,startColumn:d,endRow:E,endColumn:f,startY:o,endY:c,startX:a,endX:h}}function Zr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:c,endColumn:a}=t;let h=s,u=e,d=s,E=e;return(n||r)&&(h=i,u=o,d=c,E=a),{startRow:h,startColumn:u,endRow:d,endColumn:E}}function yr(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function x(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new wt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function ti(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function ei(t){return R.isString(t)&&t.indexOf("=")===-1&&t.length===6}function si(t){return""}function ni(t,s=!1){var i;let e="";const n=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${x(t.bg)}; `)}],["bd",()=>{var o,c,a,h,u,d,E,f,g,m,N,S;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${Pt((c=t.bd)==null?void 0:c.b.s)} ${(a=x(t.bd.b.cl))!=null?a:""}; `),(h=t.bd)!=null&&h.t&&(e+=`border-top: ${Pt((u=t.bd)==null?void 0:u.t.s)} ${(d=x(t.bd.t.cl))!=null?d:""}; `),(E=t.bd)!=null&&E.r&&(e+=`border-right: ${Pt((f=t.bd)==null?void 0:f.r.s)} ${(g=x(t.bd.r.cl))!=null?g:""}; `),(m=t.bd)!=null&&m.l&&(e+=`border-left: ${Pt((N=t.bd)==null?void 0:N.l.s)} ${(S=x(t.bd.l.cl))!=null?S:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${x(t.cl)}; `)}],["va",()=>{t.va===bt.SUBSCRIPT?e+="vertical-align: sub; ":t.va===bt.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,c,a;t.tr&&(e+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(c=t.tr)!=null&&c.v?` ,${(a=t.tr)==null?void 0:a.v}`:""});`)}],["ht",()=>{t.ht===et.LEFT?e+="text-align: left; ":t.ht===et.RIGHT?e+="text-align: right; ":t.ht===et.CENTER?e+="text-align: center; ":t.ht===et.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===ot.BOTTOM?e+="vertical-align: bottom; ":t.vt===ot.TOP?e+="vertical-align: top; ":t.vt===ot.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===ct.CLIP?e+="text-overflow: clip; ":t.tb===ct.OVERFLOW?e+="text-break: overflow; ":t.tb===ct.WRAP&&(e+="word-wrap: break-word;")}],["pd",()=>{var u,d,E,f,g,m,N,S;const o=`${(u=t.pd)==null?void 0:u.b}pt`,c=`${(d=t.pd)==null?void 0:d.t}pt`,a=`${(E=t.pd)==null?void 0:E.l}pt`,h=`${(f=t.pd)==null?void 0:f.r}pt`;(g=t.pd)!=null&&g.b&&(e+=`padding-bottom: ${o}; `),(m=t.pd)!=null&&m.t&&(e+=`padding-top: ${c}; `),(N=t.pd)!=null&&N.l&&(e+=`padding-left: ${a}; `),(S=t.pd)!=null&&S.r&&(e+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)s&&r.includes(o)||(i=n.get(o))==null||i();return e}function Pt(t){let s="";return t===v.NONE?s="none":t===v.THIN?s="0.5pt solid":t===v.HAIR?s="0.5pt double":t===v.DOTTED?s="0.5pt dotted":t===v.DASHED||t===v.DASH_DOT?s="0.5pt dashed":t===v.DASH_DOT_DOT?s="0.5pt dotted":t===v.DOUBLE?s="0.5pt double":t===v.MEDIUM?s="1pt solid":t===v.MEDIUM_DASHED||t===v.MEDIUM_DASH_DOT?s="1pt dashed":t===v.MEDIUM_DASH_DOT_DOT?s="1pt dotted":t===v.SLANT_DASH_DOT?s="0.5pt dashed":t===v.THICK&&(s="1.5pt solid"),s}function ri(t){let s=0;if(t=t.trim(),t==="none")s=v.NONE;else if(t==="0.5pt solid")s=v.THIN;else if(t==="0.5pt double")s=v.HAIR;else if(t==="0.5pt dotted")s=v.DOTTED;else if(t==="0.5pt dashed")s=v.DASHED;else if(t==="1pt solid")s=v.MEDIUM;else if(t==="1pt dashed")s=v.MEDIUM_DASHED;else if(t==="1pt dotted")s=v.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")s=v.THICK;else return v.NONE;return s}function Ht(t,s){let e=t.body;if(s){const{headers:n,footers:r}=t;n!=null&&n[s]?e=n[s].body:r!=null&&r[s]&&(e=r[s].body)}return e}function ii(t){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=t;return!(s<0||n<0||e<0||r<0||Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(n)||Number.isNaN(r))}function oi(t,s){return{startRow:t,endRow:t,startColumn:s,endColumn:s}}function te(t,s){return Object.prototype.toString.call(t)===Object.prototype.toString.call(s)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(s).length?!1:Object.keys(t).every(e=>te(t[e],s[e])):t===s:!1}function As(t,s){const e=t.ts||{},n=s.ts||{};return t.sId!==s.sId?!1:te(e,n)}function ci(t,s){return s.some(e=>t.indexOf(e)>-1)}function ee(t,s,e,n){if(t>s&&([t,s]=[s,t]),e>n&&([e,n]=[n,e]),s<e||n<t)return[t,s];e<t&&(e=t),n>s&&(n=s);const r=n-e+1;let i=[];return t===e?i=[n+1-r,s-r]:s===n?i=[t,e-1]:i=[t,s-r],i}function ai(t){if(t==null)return!1;const s=t.bullet;return(s==null?void 0:s.listId)!=null}function li(t){if(t==null)return!1;const s=t.paragraphStyle;return Cs(s)}function Cs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Ns(t,s,e){return t.slice(0,s)+e+t.slice(s)}function Ss(t,s,e){return s>e?t:t.slice(0,s)+t.slice(e)}function ui(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function hi(t){let s=0;for(let e=0;e<t.length;e++)s=t.charCodeAt(e)+(s<<6)+(s<<16)-s;return s>>>0}class Et{static hasLength(s,e){return s.length===e}static getValueType(s){return Object.prototype.toString.apply(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isIterable(s){return s[Symbol.iterator]!=null}static isNumber(s){return this.getValueType(s)==="[object Number]"}}const L=Symbol("newer"),D=Symbol("older");class Ls{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.key}):{done:!0,value:void 0}}}class vs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.value}):{done:!0,value:void 0}}}class bs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:[s.key,s.value]}):{done:!0,value:void 0}}}class se{constructor(s,e){_(this,"key");_(this,"value");_(this,fc);_(this,gc);this.key=s,this.value=e,this[L]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}fc=L,gc=D;class Ts{constructor(...s){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(Et.hasLength(s,1)){if(Et.isNumber(s[0])){const e=s[0];this._initialize(e,void 0);return}if(Et.isIterable(s[0])){const e=s[0];this._initialize(0,e);return}return}if(Et.hasLength(s,2)){const e=s[0],n=s[1];this._initialize(e,n)}}onShift(s){if(this._onShiftListeners.indexOf(s)===-1)return this._onShiftListeners.push(s),b(()=>K(this._onShiftListeners,s));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(s,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=s,this._keymap=new Map,e&&(this.assign(e),s<1&&(this.limit=this.size))}_markEntryAsUsed(s){s!==this.newest&&(s[L]&&(s===this.oldest&&(this.oldest=s[L]),s[L][D]=s[D]),s[D]&&(s[D][L]=s[L]),s[L]=void 0,s[D]=this.newest,this.newest&&(this.newest[L]=s),this.newest=s)}assign(s){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=s[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new se(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[L]=o,o[D]=e):this.oldest=o,e=o,n--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(s,e){let n=this._keymap.get(s);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(s,n=new se(s,e)),this.newest?(this.newest[L]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const s=this.oldest;if(s)return this.oldest&&this.oldest[L]?(this.oldest=this.oldest[L],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),s[L]=s[D]=void 0,this._keymap.delete(s.key),--this.size,this._onShiftListeners.forEach(e=>e(s)),[s.key,s.value]}get(s){const e=this._keymap.get(s);if(e)return this._markEntryAsUsed(e),e.value}has(s){return this._keymap.has(s)}find(s){const e=this._keymap.get(s);return e?e.value:void 0}delete(s){const e=this._keymap.get(s);if(e)return this._keymap.delete(e.key),e[L]&&e[D]?(e[D][L]=e[L],e[L][D]=e[D]):e[L]?(e[L][D]=void 0,this.oldest=e[L]):e[D]?(e[D][L]=void 0,this.newest=e[D]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Ls(this.oldest)}values(){return new vs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bs(this.oldest)}forEach(s,e){typeof e!="object"&&(e=this);let n=this.oldest;for(;n;)s.call(e,n.value,n.key,this),n=n[L]}toJSON(){const s=new Array(this.size);let e=0,n=this.oldest;for(;n;)s[e++]={key:n.key,value:n.value},n=n[L];return s}toString(){let s="",e=this.oldest;for(;e;)s+=`${String(e.key)}:${e.value}`,e=e[L],e&&(s+=" < ");return s}}function z(t){let s=0;const e=Object.keys(t);for(const n of e){const r=Number(n);s=Math.max(s,r)}return s+1}function ne(t,s,e){const n=z(e),r=e;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=s}function re(t,s,e){const n=Object.keys(e).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+s?delete e[r]:e[r]!==void 0&&(e[r-s]=e[r],delete e[r])}function _i(t,s){const e=t,n=Object.keys(e),r=n.length,i=s,o=Object.keys(i),c=o.length,a={};let h=0;for(let u=0;u<r;u++,h++){const d=n[u];a[h]=e[d]}for(let u=0;u<c;u++,h++){const d=o[u];a[h]=i[d]}return a}function di(t,s,e){const n=e;if(z(e)>0){const i={};let o=0;for(let c=t;c<=s;c++)n[c]&&(i[o]=n[c],o++);return i}return{}}function ie(t,s,e,n){const r=t>e;if(!r&&t+s>e)throw new Error("Invalid move operation");r?Ei(t,s,e,n):fi(t,s,e,n)}function Ei(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const c=r[o];r[o+s]=c,c===void 0&&delete r[o+s]}i.forEach((o,c)=>{r[e+c]=o,o===void 0&&delete r[e+c]})}function fi(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t+s;o<e;o++){const c=r[o];r[o-s]=c,c===void 0&&delete r[o-s]}i.forEach((o,c)=>{r[e+c-s]=o,o===void 0&&delete r[e+c-s]})}class V{constructor(s={}){_(this,"_matrix");this._setOriginValue(s)}static MakeObjectMatrixSize(s){return new V({[s-1]:{}})}getMatrix(){return this._matrix}forEach(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,o)===!1)return this}return this}forRow(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,Object.keys(o).map(a=>Number(a)))===!1)return this}return this}forValue(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(!o)continue;const c=Object.keys(o);for(const a of c){const h=Number(a),u=o[Number(a)];if(s(i,h,u)===!1)return this}}return this}swapRow(s,e){const n=this._matrix[s],r=this._matrix[e];this._matrix[s]=r,this._matrix[e]=n}getRow(s){return this._matrix[s]}getRowOrCreate(s){let e=this.getRow(s);return e==null&&(e={},this._matrix[s]=e),e}reset(){this._setOriginValue({})}hasValue(){const s=this._matrix,e=Object.keys(s);if(e.length===0)return!1;for(const n of e){const r=Number(n),i=s[r];if(Object.keys(i).length>0)return!0}return!1}getValue(s,e){var n,r;return(r=(n=this._matrix)==null?void 0:n[s])==null?void 0:r[e]}setValue(s,e,n){const r=this.getRowOrCreate(s);r[e]=n}deleteValue(s,e){var n,r;(r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e]}realDeleteValue(s,e){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e],this.getRow(s)){const o=this.getRow(s);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[s])}}setRow(s,e){this._matrix[s]=e}moveRows(s,e,n){ie(s,e,n,this._matrix)}moveColumns(s,e,n){this.forEach((r,i)=>{ie(s,e,n,i)})}insertRows(s,e){for(let n=s;n<s+e;n++)ne(n,{},this._matrix)}insertColumns(s,e){for(let n=s;n<s+e;n++)this.forEach((r,i)=>{ne(n,void 0,i)})}removeRows(s,e){re(s,e,this._matrix)}removeColumns(s,e){this.forEach((n,r)=>{re(s,e,r)})}getFragment(s,e,n,r){const i=new V;let o=0;for(let c=s;c<=e;c++){const a={};let h=0;for(let u=n;u<=r;u++){const d=this.getValue(c,u);a[h]=d,h++}i.setRow(o,a),o++}return i}getSlice(s,e,n,r){const i=new V;for(let o=s;o<=e;o++)for(let c=n;c<=r;c++){const a=this.getValue(o,c);a&&i.setValue(o,c,R.deepClone(a))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return z(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const c=this.getRow(o);if(c){const a=z(c)-1;r=a>r?a:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const s=new Array;return this.forValue((e,n,r)=>{s.push(r)}),s}toArray(){const s=[];return this.forRow((e,n)=>{s[e]==null&&(s[e]=[]),n.forEach(r=>{s[e][r]=this.getValue(e,r)})}),s}toFullArray(){const s=this.getRange(),{endColumn:e,endRow:n}=s,r=[];for(let i=0;i<=n;i++){const o=Array(e+1).fill(void 0);r.push(o)}return this.forValue((i,o,c)=>{r[i][o]=c}),r}toJSON(){return this._matrix}clone(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getData(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getArrayData(){let s=0,e=0,n=!1,r=!1;const i=new V;return this.forEach((o,c)=>{n||(n=!0,s=o),Object.keys(c).forEach(a=>{const h=Number(a);r?h<e&&(e=h):(r=!0,e=h);const u=this.getValue(o,h);i.setValue(o-s,h-e,u)})}),i.getData()}getDataRange(){let s=0,e=0,n=0,r=-1,i=!1,o=!1;return this.forEach((c,a)=>{i||(i=!0,s=c);const h=z(a)-1;h>n&&(n=h),Object.keys(a).forEach(u=>{const d=Number(u);o?d<e&&(e=d):(o=!0,e=d)}),c>r&&(r=c)}),{startRow:s,startColumn:e,endRow:r,endColumn:n}}getDiscreteRanges(){const s=[];return this.forEach((e,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const c of s)if(e>=c.startRow&&e<=c.endRow+1&&i>=c.startColumn&&i<=c.endColumn+1){c.endRow=Math.max(e,c.endRow),c.endColumn=Math.max(i,c.endColumn),o=!0;break}o||s.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),s}merge(s){this.forValue((e,n)=>{const r=s.getValue(e,n);r!=null&&this.setValue(e,n,r)})}_setOriginValue(s={}){this._matrix=s}}var oe=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(oe||{});class ws{constructor(){_(this,"status","init")}}const gi=t=>t.some(s=>s.status==="init")?"init":t.some(s=>s.status==="fetching")?"fetching":"done";class Ri{constructor(s,e){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=s,this._keys=e,s.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(s){this._keys.forEach(e=>{const n=s[e],r=this._keyMaps.get(e)||new Map;r.set(n,s),this._keyMaps.set(e,r)})}getValue(s,e){const n=e||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(s))return i.get(s)}return null}hasValue(s){for(let e=0;e<this._keys.length;e++){const n=this._keyMaps.get(this._keys[e]);if(n!=null&&n.has(s))return!0}return!1}addValue(s){this._values.push(s),this._initKeyMap(s)}setValue(s,e,n){const r=this.getValue(s);r&&Object.keys(r).includes(e)&&(r[e]=n)}deleteValue(s){const e=this.getValue(s);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===e);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(s){var e;return[...((e=this._keyMaps.get(s))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ce(t,s,e,n){return{forEach(r){for(let i=t;i<=s;i++)for(let o=e;o<=n;o++)r(i,o)}}}function mi(t){if(t==null||t.length===0)return Number.NaN;const s=t.toLowerCase().split(""),e=s.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=n(s[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const Ft=65,Ds=90,Oi=97;function Ii(t){const s=Ds-Ft+1;let e="";for(;t>=0;)e=String.fromCharCode(t%s+Ft)+e,t=Math.floor(t/s)-1;return e}function Us(t,s){let e="";for(;s>0;)e+=t,s--;return e}function Ai(t,s=!1){const e=Ds-Ft+1;let n=Oi;s&&(n=Ft);const r=String.fromCharCode(t%e+n),i=Math.floor(t/e)+1;return Us(r,i)}function Ci(t,s){return t.zIndex>s.zIndex?1:t.zIndex===s.zIndex?0:-1}function Ni(t,s){return t.zIndex>s.zIndex?-1:t.zIndex===s.zIndex?0:1}function at(t="index",s=1){return(e,n)=>e[t]>n[t]?s:e[t]===n[t]?0:-s}function Si(t,s){let e;return function(...n){const r=this,i=function(){e=null,t.apply(r,n)};clearTimeout(e),e=setTimeout(i,s)}}const ft={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Li={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},vi={startRow:0,startColumn:0,endRow:0,endColumn:0},bi={row:0,column:0},Wt={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:_t.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:et.UNSPECIFIED,vt:ot.UNSPECIFIED,tb:ct.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Ms={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Ps=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Ps||{});function Bt(t,s){const{textRuns:e=[]}=s;let n=0;for(const i of e){const{ts:o={},st:c,ed:a}=i;if(o[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(o[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(o[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}n+=a-c}return s.dataStream.indexOf(`\r
4
+ `)===n?I.TRUE:I.FALSE}class nt{constructor(s,e,n){_(this,"_range");_(this,"_worksheet");this._deps=n,this._range=e,this._worksheet=s}static foreach(s,e){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s;for(let c=n;c<=i;c++)for(let a=r;a<=o;a++)e(c,a)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=[];for(let o=s;o<=e;o++){const c=[];for(let a=n;a<=r;a++)c.push(this.getMatrix().getValue(o,a)||null);i.push(c)}return i}getMatrix(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c,a,i.getValue(c,a)||null);return o}getMatrixObject(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c-s,a-n,i.getValue(c,a)||{});return o}getA1Notation(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(s+1),o=R.numToWord(r+1)+(e+1)):(i=R.numToWord(r+1)+(e+1),o=R.numToWord(n+1)+(s+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Wt.bg.rgb}))}getCell(s,e){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,c={startRow:n+s,endRow:n+s,startColumn:i+e,endColumn:i+e};return new nt(this._worksheet,c,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(s={}){return this.getObjectValues(s)[0][0]}getObjectValues(s={}){var c;const{startRow:e,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,n,r,i).getData();if(s.isIncludeStyle){const a=this._deps.getStyles();for(let h=0;h<=n-e;h++)for(let u=0;u<=i-r;u++){if(o==null||((c=o==null?void 0:o[h])==null?void 0:c[u])==null)continue;const d=o[h][u].s;d&&(o[h][u].s=a.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Wt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("ul",s.body)===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 e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("st",s.body)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?s.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...s.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("it",s.body)===I.TRUE?Lt.ITALIC:Lt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("bl",s.body)===I.TRUE?vt.BOLD:vt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:s,_worksheet:e}=this,{startRow:n,endRow:r}=s;let i=0;for(let o=0;o<=r-n;o++){const c=e.getRowHeight(o);i+=c}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:s,endColumn:e}=this._range;return e-s+1}getNumRows(){const{startRow:s,endRow:e}=this._range;return e-s+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(s=>s.map(e=>(e==null?void 0:e.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>s.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:s,_worksheet:e}=this,{startColumn:n,endColumn:r}=s;let i=0;for(let o=0;o<=r-n;o++)i+=e.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(s){nt.foreach(this._range,s)}_getStyles(s){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[s]||Wt[s]}))}}function Ti(t,s){if(t.length===0||t[0].length===0)return null;const e=new Array(t[0].length).fill(0);let n=0,r=null;for(let i=0;i<t.length;i++){for(let c=0;c<t[0].length;c++)e[c]=s(t[i][c])?e[c]+1:0;const o=wi(e);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function wi(t){const s=[];let e=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(s.length===0||t[r]>=t[s[s.length-1]])s.push(r++);else{const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}for(;s.length>0;){const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}return n}function Di(t,s){nt.foreach(s,(e,n)=>{t[e][n]=void 0})}function Ui(t,s){const e=t.toFullArray(),n=[];for(;;){const r=Ti(e,s);if(!r)break;n.push(r),Di(e,r)}return n}var Hs=(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))(Hs||{}),ae=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
5
+ `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(ae||{});function le(t){const s=[];for(const e of t){const{st:n,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,n===r||R.isEmptyObject(i)&&e.sId==null)continue;if(s.length===0){s.push(e);continue}const o=s.pop();As(e,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?s.push({...e,st:o.st,ed:r}):s.push(o,e)}return s}function Fs(t,s,e,n){var h;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let c=!1;const a=(h=s.textRuns)!=null?h:[];if(a.length)for(let u=0,d=a.length;u<d;u++){const E=a[u];E.st+=n,E.ed+=n}for(let u=0;u<o;u++){const d=r[u],{st:E,ed:f}=d;if(f<n)i.push(d);else if(n>=E&&n<=f)if(c)d.st+=e,d.ed+=e,i.push(d);else{c=!0,d.ed+=e;const g=[];if(a.length){const m={...d,st:E,ed:a[0].st};g.push(m),g.push(...a);const N=a[a.length-1],S={...d,st:N.ed,ed:f+e};g.push(S)}else g.push(d);i.push(...g)}else d.st+=e,d.ed+=e,c||(c=!0,i.push(...a)),i.push(d)}c||(c=!0,i.push(...a)),t.textRuns=le(i)}function ue(t,s,e,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=s,c=[];let a=-1;for(let u=0,d=r.length;u<d;u++){const E=r[u],{startIndex:f}=E;f>=n&&(E.startIndex+=e),a===-1&&f>=n&&(a=u),c.push(E.startIndex)}let h=-1;if(i){for(let u=0,d=i.length;u<d;u++){const E=i[u];E.startIndex+=n;const f=E.startIndex;h=c.indexOf(f)}if(o===ae.PARAGRAPH&&i.length===1){const u=r[a],d=i[0],E=u.paragraphStyle,f=u.bullet;u.paragraphStyle=d.paragraphStyle,u.bullet=d.bullet,d.paragraphStyle=E,d.bullet=f}h!==-1&&r.splice(h,1),r.push(...i),r.sort(at("startIndex"))}}function Mi(t,s,e,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h}=a;h>=n&&(a.startIndex+=e)}const i=s.sectionBreaks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Ws(t,s,e,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h}=a;h>=n&&(a.startIndex+=e)}const i=s.customBlocks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function he(t,s,e,n){const{tables:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h,endIndex:u}=a;h>n?(a.startIndex+=e,a.endIndex+=e):u>=n-1&&(a.endIndex+=e)}const i=s.tables;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Pi(t,s,e,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h,endIndex:u}=a;h>n?(a.startIndex+=e,a.endIndex+=e):u>=n-1&&(a.endIndex+=e)}const i=s.customRanges;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Bs(t,s,e){const{textRuns:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{st:d,ed:E}=u;if(r<=d&&i>=E){o.push({...u,st:d-r,ed:E-r});continue}else d<=r&&E>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=s):r>=d&&r<E?(o.push({...u,st:r-r,ed:E-r}),u.ed=r):i>d&&i<=E?(o.push({...u,st:d-r,ed:i-r}),u.st=i-s,u.ed-=s):d>=i&&(u.st-=s,u.ed-=s);c.push(u)}t.textRuns=c}return o}function ks(t,s,e){const{paragraphs:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<i){o.push({...u,startIndex:d-e});continue}else d>=i&&(u.startIndex-=s);c.push(u)}t.paragraphs=c}return o}function Gs(t,s,e){const{sectionBreaks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);c.push(u)}t.sectionBreaks=c}return o}function $s(t,s,e){const{customBlocks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);c.push(u)}t.customBlocks=c}return o}function Vs(t,s,e){const{tables:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d,endIndex:E}=u;if(r<=d&&i>=E){o.push({...u,startIndex:d-e,endIndex:E-e});continue}else if(d<=r&&E>=i){const f=ee(d,E,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);c.push(u)}t.tables=c}return o}function ps(t,s,e){const{customRanges:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d,endIndex:E}=u;if(r<=d&&i>=E){o.push({...u,startIndex:d-e,endIndex:E-e});continue}else if(d<=r&&E>=i){const f=ee(d,E,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);c.push(u)}t.customRanges=c}return o}function Hi(t,s,e){const{dataStream:n}=t,r=e,i=e+s,o=Bs(t,s,e),c=ks(t,s,e),a=Gs(t,s,e),h=$s(t,s,e),u=Vs(t,s,e),d=ps(t,s,e);let E="";return n&&(t.dataStream=Ss(n,r,i),E=n.slice(r,i)),{dataStream:E,textRuns:o,paragraphs:c,sectionBreaks:a,customBlocks:h,tables:u,customRanges:d}}function Fi(t,s,e,n){t.dataStream=Ns(t.dataStream,n,s.dataStream),Fs(t,s,e,n),ue(t,s,e,n),Mi(t,s,e,n),Ws(t,s,e,n),he(t,s,e,n),Pi(t,s,e,n)}var xs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(xs||{}),js=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(js||{}),gt=(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))(gt||{}),X=(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))(X||{}),Ks=(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))(Ks||{}),Ys=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Ys||{}),zs=(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))(zs||{}),Xs=(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))(Xs||{}),qs=(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))(qs||{}),Qs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Qs||{}),Js=(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))(Js||{}),Zs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Zs||{}),ys=(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))(ys||{}),tn=(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))(tn||{}),en=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(en||{}),sn=(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))(sn||{}),nn=(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))(nn||{}),rn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(rn||{}),on=(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))(on||{}),cn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(cn||{}),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||{}),ln=(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))(ln||{}),un=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(un||{}),hn=(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))(hn||{}),_n=(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))(_n||{}),dn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(dn||{}),En=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(En||{}),kt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(kt||{});const Wi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:63}]}};function Bi(t,s,e,n,r){const i=ki(t,s,e,n,r),o=Gi(t,s,e,n,r),c=$i(t,s,e,n,r),a=Vi(t,s,e,n,r),h=pi(t,s,e,n,r),u=xi(t,s,e,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:c,customBlocks:a,tables:h,customRanges:u}}function ki(t,s,e,n,r){const{textRuns:i}=t,{textRuns:o}=s;if(i==null||o==null)return;const c=Bs(t,e,n);if(r!==M.REPLACE){const a=fn(o,c,r);s.textRuns=a}return Fs(t,s,e,n),c}function fn(t,s,e){if(s.length===0)return t;t=R.deepClone(t),s=R.deepClone(s);const n=[],r=t.length,i=s.length;let o=0,c=0,a=null;function h(){return a?(n.push(a),a=null,!0):!1}for(;o<r&&c<i;){const{st:f,ed:g,ts:m}=t[o],{st:N,ed:S,ts:F,sId:P}=s[c];let J;e===M.COVER?J={...F,...m}:J={...m,...F},g<N?(h()||n.push(t[o]),o++):S<f?(h()||n.push(s[c]),c++):(n.push({st:Math.min(f,N),ed:Math.max(f,N),ts:f<N?{...m}:{...F},sId:f<N?void 0:P}),n.push({st:Math.max(f,N),ed:Math.min(g,S),ts:J,sId:P}),g<S?(o++,s[c].st=g):(c++,t[o].st=S),a={st:Math.min(g,S),ed:Math.max(g,S),ts:g<S?{...F}:{...m},sId:g<S?P:void 0})}h();const u=n[n.length-1],d=t[r-1],E=s[i-1];return u.ed!==Math.max(d.ed,E.ed)&&(d.ed>E.ed?n.push(d):n.push(E)),le(n)}function Gi(t,s,e,n,r){const{paragraphs:i}=t,{paragraphs:o}=s;if(i==null||o==null)return;const c=ks(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,paragraphStyle:d,bullet:E}=h;let f=[];for(const g of c){const{startIndex:m,paragraphStyle:N,bullet:S}=g;let F,P;if(r===M.COVER?(F={...N,...d},P={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...S,...E}):(F={...d,...N},P={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...E,...S}),u===m){f.push({startIndex:u,paragraphStyle:F,bullet:P});break}}a.push(...f),f=[]}s.paragraphs=a}return ue(t,s,e,n),c}function $i(t,s,e,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=s;if(i==null||o==null)return;const c=Gs(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const E of c){const{startIndex:f}=E;if(u===f){r===M.COVER?d.push({...E,...h}):d.push({...h,...E});break}}a.push(...d),d=[]}s.sectionBreaks=a}return ue(t,s,e,n),c}function Vi(t,s,e,n,r){const{customBlocks:i}=t,{customBlocks:o}=s;if(i==null||o==null)return;const c=$s(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const E of c){const{startIndex:f}=E;if(u===f){r===M.COVER?d.push({...E,...h}):d.push({...h,...E});break}}a.push(...d),d=[]}s.customBlocks=a}return Ws(t,s,e,n),c}function pi(t,s,e,n,r){const{tables:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=Vs(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let E=[];for(const f of c){const{startIndex:g,endIndex:m}=f;if(g>=u&&m<=d){r===M.COVER?E.push({...f,...h}):E.push({...h,...f});break}}a.push(...E),E=[]}s.tables=a}return he(t,s,e,n),c}function xi(t,s,e,n,r){const{customRanges:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=ps(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let E=[];for(const f of c){const{startIndex:g,endIndex:m}=f;if(g>=u&&m<=d){r===M.COVER?E.push({...f,...h}):E.push({...h,...f});break}}a.push(...E),E=[]}s.customRanges=a}return he(t,s,e,n),c}var C=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(C||{});function _e(t,s,e){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(s,e)},c=[];for(const h of r){const u=R.deepClone(h),{st:d,ed:E}=u;R.hasIntersectionBetweenTwoRanges(d,E,s,e)&&(s>=d&&s<=E?c.push({...u,st:s,ed:Math.min(e,E)}):e>=d&&e<=E?c.push({...u,st:Math.max(s,d),ed:e}):c.push(u))}c.length&&(o.textRuns=c.map(h=>{const{st:u,ed:d}=h;return{...h,st:u-s,ed:d-s}}));const a=[];for(const h of i){const{startIndex:u}=h;u>=s&&u<=e&&a.push(R.deepClone(h))}return a.length&&(o.paragraphs=a.map(h=>({...h,startIndex:h.startIndex-s}))),o}function de(t,s,e=M.COVER){if(s.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:c=[]}=s,a=fn(o,r,e);a.length&&(n.textRuns=a);const h=[];let u=0,d=0;for(;u<i.length&&d<c.length;){const E=i[u],f=c[d],{startIndex:g}=E,{startIndex:m}=f;g===m?(h.push(R.deepMerge(E,f)),u++,d++):g<m?(h.push(R.deepClone(E)),u++):(h.push(R.deepClone(f)),d++)}return u<i.length&&h.push(...i.slice(u)),d<c.length&&h.push(...c.slice(d)),h.length&&(n.paragraphs=h),n}function ji(t){const{body:s}=t;if(s==null)return!0;const{textRuns:e=[],paragraphs:n=[]}=s;return e.length===0&&n.length===0}function Ki(t=R.generateRandomId(6),s=tt.EN_US,e=""){return{id:t,locale:s,title:e,body:{dataStream:`\r
6
+ `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const Ee={id:"default_doc",documentStyle:{}};class Yi{constructor(s){_(this,"snapshot");this.snapshot={...Ee,...s}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var s;return((s=this.snapshot.settings)==null?void 0:s.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(s){this.snapshot.id=s}updateDocumentRenderConfig(s){const{documentStyle:e}=this.snapshot;e.renderConfig==null?e.renderConfig=s:e.renderConfig={...e.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:e,l:n,b:r,r:i}=s,{documentStyle:o}=this.snapshot;e!=null&&(o.marginTop=e),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(s,e){const{documentStyle:n}=this.snapshot;if(!n.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,e=e!=null?e:Number.POSITIVE_INFINITY,n.pageSize={width:s,height:e};return}s!==void 0&&(n.pageSize.width=s),e!==void 0&&(n.pageSize.height=e)}updateDrawing(s,e){const{drawings:n}=this,{width:r,height:i,left:o,top:c}=e,a=n==null?void 0:n[s];if(!a)return;const h=a.objectTransform;h.size.width=r,h.size.height=i,h.positionH.posOffset=o,h.positionV.posOffset=c}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class rt extends Yi{constructor(e){var r;super(R.isEmptyObject(e)?Ki():e);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:R.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Ee,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const n=[],r=new es;return r.reset(),e.forEach(i=>{if(i=R.deepClone(i),i.t===C.RETAIN){const{coverType:o,body:c,len:a,segmentId:h}=i;if(c!=null){const u=this._updateApply(c,a,r.cursor,o,h);n.push({...i,t:C.RETAIN,coverType:M.REPLACE,body:u})}else n.push({...i,t:C.RETAIN});r.moveCursor(a)}else if(i.t===C.INSERT){const{body:o,len:c,segmentId:a,line:h}=i;this._insertApply(o,c,r.cursor,a),r.moveCursor(c),n.push({t:C.DELETE,len:c,line:h,segmentId:a})}else if(i.t===C.DELETE){const{len:o,segmentId:c}=i,a=this._deleteApply(o,r.cursor,c);n.push({...i,t:C.INSERT,body:a})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(e,n){const r=this.getBody();if(r!=null)return _e(r,e,n)}_updateApply(e,n,r,i=M.COVER,o){if(e==null)throw new Error("updateBody is none");const c=this.snapshot,a=Ht(c,o);if(a==null)throw new Error("no body has changed");return Bi(a,e,n,r,i)}_deleteApply(e,n,r){const i=this.snapshot,o=Ht(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:Hi(o,e,n)}_insertApply(e,n,r,i){const o=this.snapshot,c=Ht(o,i);if(n!==0){if(c==null)throw new Error("no body has changed");Fi(c,e,n,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:n}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new rt(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new rt(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}class gn{constructor(s={}){_(this,"_styles");_(this,"_cacheMap",new Ts(1e5));this._styles=s,this._generateCacheMap()}each(s){return Object.entries(this._styles).forEach(s),this}search(s,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const n=this._getExistingStyleId(s);return n||"-1"}get(s){return typeof s!="string"?s:(s=String(s),this._styles[s])}add(s,e){const n=R.generateRandomId(6);return this._styles[n]=s,this._cacheMap.set(e,n),n}setValue(s){if(s==null)return;const e=JSON.stringify(s),n=this.search(s,e);return n!=="-1"?n:this.add(s,e)}toJSON(){return this._styles}getStyleByCell(s){let e;s&&R.isObject(s.s)?e=s.s:e=(s==null?void 0:s.s)&&this.get(s.s);const n=s==null?void 0:s.interceptorStyle;return n?{...e,...n}:e}_generateCacheMap(){const{_styles:s,_cacheMap:e}=this;for(const n in s){const r=JSON.stringify(s[n]);e.set(r,n)}}_getExistingStyleId(s){const{_styles:e}=this;for(const n in e)if(R.diffValue(e[n],s))return n;return null}}var k=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(k||{});function Rn(t){return!!(t&&t.code&&t.code!==k.OK&&t.code!=="OK")}var j=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(j||{}),fe=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(fe||{});function zi(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Xi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return dt.STRING;if(typeof t.v=="number")return dt.NUMBER;if(typeof t.v=="boolean")return dt.BOOLEAN}function qi(t){if(t==null)return!0;const{v:s,f:e,si:n,p:r,s:i}=t;return!(!(s==null||typeof s=="string"&&s.length===0)||e!=null&&e.length>0||n!=null&&n.length>0||r!=null)}function Qi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var ge=(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))(ge||{}),mn=(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))(mn||{}),On=(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))(On||{});class Ji{constructor(s,e){_(this,"_columnData",{});this._config=s,this._columnData=e}getColumnData(){return this._columnData}getColVisible(s){const{_columnData:e}=this,n=e[s];return n?n.hd!==I.TRUE:!0}getHiddenCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&c?(r=!1,n.push({rangeType:W.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:W.COLUMN}),n}getVisibleCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&!c?(r=!1,n.push({rangeType:W.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&c&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:W.COLUMN}),n}getColumnDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return z(this._columnData)}getColumnWidth(s){const{_columnData:e}=this,n=this._config;let r=0;return r=(e[s]||{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(s){const e=this._columnData[s];if(e)return e}getColumnOrCreate(s){const{_columnData:e}=this,n=this._config,r=e[s];if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData[s]=i,i}}class Zi{constructor(s,e){_(this,"_rowData");this._config=s,this._rowData=e}getRowData(){return this._rowData}getRowDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(s,e=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const c=n[o+s]||{hd:I.FALSE,h:r.defaultRowHeight},{ia:a,ah:h,h:u=r.defaultRowHeight}=c;i+=(a==null||a===I.TRUE)&&typeof h=="number"?h:u}return i}getRow(s){return this._rowData[s]}getRowOrCreate(s){const{_rowData:e}=this,n=e[s];if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return e[s]=i,i}getHiddenRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getVisibleRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&!c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getRowVisible(s){const e=this.getRow(s);return e?e.hd!==I.TRUE:!0}getSize(){return z(this._rowData)}}const yi="DEFAULT_WORKSHEET_ROW_COUNT",In=1e3,to="DEFAULT_WORKSHEET_COLUMN_COUNT",An=20,eo="DEFAULT_WORKSHEET_ROW_HEIGHT",Cn=19,so="DEFAULT_WORKSHEET_COLUMN_WIDTH",Nn=73,no="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Sn=46,ro="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ln=20;function vn(t){const s={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:In,columnCount:An,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Nn,defaultRowHeight:Cn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:I.TRUE,rowHeader:{width:Sn,hidden:I.FALSE},columnHeader:{height:Ln,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE};return Object.keys(s).forEach(e=>{const n=e;typeof t[n]>"u"&&(t[n]=s[n])}),t}class bn extends U{constructor(){super(...arguments);_(this,"_cellContentInterceptors",[]);_(this,"_rowFilteredInterceptors",[]);_(this,"_rowVisibleInterceptors",[]);_(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(e,n){for(const r of this._cellContentInterceptors){const i=r.getCell(e,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(e){if(this._cellContentInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(e),b(()=>K(this._cellContentInterceptors,e))}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(e),b(()=>K(this._rowFilteredInterceptors,e))}registerRowVisibleInterceptor(e){if(this._rowVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(e),b(()=>K(this._rowVisibleInterceptors,e))}registerColVisibleInterceptor(e){if(this._colVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(e),b(()=>K(this._colVisibleInterceptors,e))}}class Rt{constructor(s,e){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var o;this._styles=e,this._snapshot=vn(s);const{columnData:n,rowData:r,cellData:i}=this._snapshot;this._sheetId=(o=this._snapshot.id)!=null?o:R.generateRandomId(6),this._cellData=new V(i),this._rowManager=new Zi(this._snapshot,r),this._columnManager=new Ji(this._snapshot,n),this._viewModel=new bn}__interceptViewModel(s){s(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const s=this.getCellMatrix(),e=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,c=!1,a=!1;return s.forEach((h,u)=>{Object.keys(u).forEach(d=>{const E=+d,f=s.getValue(h,E),g=f!=null&&f.s?this._styles.get(f.s):null,m=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v||f.p)||g!=null&&g.bg||m)&&(c?n=Math.min(n,h):(n=h,c=!0),r=Math.max(r,h),a?i=Math.min(i,E):(a=!0,i=E),o=Math.max(o,E))})}),e.forEach(h=>{c?n=Math.min(n,h.startRow):(n=h.startRow,c=!0),r=Math.max(r,h.endRow),a?i=Math.min(i,h.startColumn):(i=h.startColumn,c=!0),o=Math.max(o,h.endColumn)}),!c||!a?null:{startColumn:i,startRow:n,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:s}=this,e=R.deepClone(s);return new Rt(e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(s,e){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(Z.intersects({startRow:s,startColumn:e,endRow:s,endColumn:e},i))return i}return null}getCell(s,e){return s<0||e<0?null:this._viewModel.getCell(s,e)}getCellRaw(s,e){return this.getCellMatrix().getValue(s,e)}getMatrixWithMergedCells(s,e,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(a=>Z.intersects({startRow:s,startColumn:e,endRow:n,endColumn:r},a)),c=new V;return ce(s,n,e,r).forEach((a,h)=>{const u=i.getValue(a,h);u&&c.setValue(a,h,u)}),o.forEach(a=>{const{startColumn:h,startRow:u,endColumn:d,endRow:E}=a;ce(u,E,h,d).forEach((f,g)=>{f===u&&g===h&&c.setValue(f,g,{...i.getValue(f,g),rowSpan:E-u+1,colSpan:d-h+1}),(f!==u||g!==h)&&c.realDeleteValue(f,g)})}),c}getRange(s,e,n,r){return typeof s=="object"?new nt(this,s,{getStyles:()=>this._styles}):new nt(this,{startRow:s,startColumn:e,endColumn:r||e,endRow:n||s},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:s}=this,{columnCount:e}=s;return e}getMaxRows(){const{_snapshot:s}=this,{rowCount:e}=s;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(s){this._snapshot.rowCount=s}getColumnCount(){return this._snapshot.columnCount}setColumnCount(s){this._snapshot.columnCount=s}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:s}=this,{showGridlines:e}=s;return e===0}getTabColor(){const{_snapshot:s}=this,{tabColor:e}=s;return e}getColumnWidth(s){return this.getColumnManager().getColumnWidth(s)}getRowHeight(s){return this.getRowManager().getRowHeight(s)}getRowVisible(s){return this.getRowManager().getRowVisible(s)}getHiddenRows(s,e){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(s,e);return r.forEach(i=>i.endColumn=n),r}getColVisible(s){return this._columnManager.getColVisible(s)}getHiddenCols(s,e){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(s,e);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const s=this.getRowCount();return this._rowManager.getVisibleRows(0,s-1)}getVisibleCols(){const s=this.getColumnCount();return this._columnManager.getVisibleCols(0,s-1)}isRightToLeft(){const{_snapshot:s}=this,{rightToLeft:e}=s;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(s){return s&&(s.v!==void 0||s.f!==void 0||s.p!==void 0)}iterateByRow(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(a>i&&(c+=1,a=n),c>r)return{done:!0,value:void 0};const h=o.getCell(c,a),u=o.getMergedCell(c,a);if(u&&(!h||c!==u.startRow||a!==u.startColumn))a=u.endColumn+1;else if(!h)a+=1;else{const d={row:c,col:a,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),a+=1,{done:!1,value:d}}}}}}iterateByColumn(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(c>r&&(a+=1,c=e),a>i)return{done:!0,value:void 0};const h=o.getCell(c,a),u=o.getMergedCell(c,a);if(u&&(!h||c!==u.startRow||a!==u.startColumn))c=u.endRow+1;else if(!h)c+=1;else{const d={row:c,col:a,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),c+=1,{done:!1,value:d}}}}}}}function io(t){var n,r;const s=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(s)return s;const e=t.v;return typeof e=="string"?t.t===fe.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===fe.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}const oo="0.1.6";function co(t="",s=tt.ZH_CN,e=""){return{id:t,sheetOrder:[],name:e,appVersion:oo,locale:s,styles:{},sheets:{},resources:[]}}var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(t,s,e,n)=>{for(var r=n>1?void 0:n?lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&ao(s,e,r),r},ho=(t,s)=>(e,n)=>s(e,n,t);function _o(t,s){return`${t.getUnitId()}|${s.getSheetId()}`}l.Workbook=class extends U{constructor(e={},n){super();_(this,"_sheetCreated$",new A.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new A.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");this._logService=n;const r=co();R.isEmptyObject(e)?this._snapshot=r:this._snapshot=R.commonExtend(r,e);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=R.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new gn(i),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return R.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(n,0,e);const c=new Rt(r,this._styles);return this._worksheets.set(e,c),this._sheetCreated$.next(c),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const n=this._snapshot.sheetOrder;for(let i=0,o=n.length;i<o;i++){const c=this._worksheets.get(n[i]);if(c&&c.isSheetHidden()!==I.TRUE)return this.setActiveSheet(c),c}const r=this._worksheets.get(n[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:e}=this._snapshot,n=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===I.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const n=e;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:ft}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let n=e;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}generateNewSheetName(e){let n=e+this._count;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}_getCellRange(e){var u,d,E,f,g;let n="",r="";if(e.indexOf("!")>-1){const m=e.split("!");n=m[0],r=m[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=e;if(r.indexOf(":")===-1){const m=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,N=R.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(m)&&!Number.isNaN(N)?{sheetId:n,range:{startRow:m,endRow:m,startColumn:N,endColumn:N}}:ft}r=r.split(":");const i=[0,0],o=[0,0],c=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),a=((E=this.getSheetBySheetName(n))==null?void 0:E.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=c),i[0]>i[1]||(o[0]=R.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=R.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=a),o[0]>o[1])?ft:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:n}=this,{sheets:r,sheetOrder:i}=e;if(R.isEmptyObject(r)){const o=R.generateRandomId();r[o]={id:o}}for(const o in r){const c=r[o],{name:a}=c;c.name=this.uniqueSheetName(a),c.name!==a&&this._logService.debug("[Workbook]",`The worksheet name ${a} is duplicated, we changed it to ${c.name}. Please fix the problem in your snapshot.`);const h=new Rt(c,this._styles);n.set(o,h),i.includes(o)||i.push(o)}}},l.Workbook=uo([ho(1,y)],l.Workbook);class Re{constructor(s){_(this,"_snapshot");_(this,"_unitId");var e;this._snapshot={...Ms,...s},this._unitId=(e=this._snapshot.id)!=null?e:R.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var s;return(s=this._snapshot.body)==null?void 0:s.pages}getPageOrder(){var s;return(s=this._snapshot.body)==null?void 0:s.pageOrder}getPage(s){const e=this.getPages();return e==null?void 0:e[s]}getElementsByPage(s){var e;return(e=this.getPage(s))==null?void 0:e.pageElements}getElement(s,e){var n;return(n=this.getElementsByPage(s))==null?void 0:n[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:ge.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Gt="FOCUSING_SHEET",me="FOCUSING_DOC",Oe="FOCUSING_SLIDE",Eo="FOCUSING_EDITOR_BUT_HIDDEN",Tn="EDITOR_ACTIVATED",fo="FOCUSING_EDITOR_INPUT_FORMULA",wn="FOCUSING_FORMULA_EDITOR",go="FOCUSING_UNIVER_EDITOR",Ro="FOCUSING_EDITOR_INPUT_FORMULA",mo="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var Oo=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,Ao=(t,s,e,n)=>{for(var r=n>1?void 0:n?Io(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Oo(s,e,r),r},Co=(t,s)=>(e,n)=>s(e,n,t),Dn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(Dn||{});const lt=O.createIdentifier("univer.current");l.UniverInstanceService=class extends U{constructor(e,n){super();_(this,"_focused",null);_(this,"_focused$",new A.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());_(this,"_currentSheet$",new A.BehaviorSubject(null));_(this,"currentSheet$",this._currentSheet$.asObservable());_(this,"_currentDoc$",new A.BehaviorSubject(null));_(this,"currentDoc$",this._currentDoc$.asObservable());_(this,"_currentSlide$",new A.BehaviorSubject(null));_(this,"currentSlide$",this._currentSlide$.asObservable());_(this,"_sheetAdded$",new A.Subject);_(this,"sheetAdded$",this._sheetAdded$.asObservable());_(this,"_docAdded$",new A.Subject);_(this,"docAdded$",this._docAdded$.asObservable());_(this,"_slideAdded$",new A.Subject);_(this,"slideAdded$",this._slideAdded$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_docDisposed$",new A.Subject);_(this,"docDisposed$",this._docDisposed$.asObservable());_(this,"_slideDisposed$",new A.Subject);_(this,"slideDisposed$",this._slideDisposed$.asObservable());_(this,"_sheets",[]);_(this,"_docs",[]);_(this,"_slides",[]);this._handler=e,this._contextService=n}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,n){const r=this._docs.find(i=>i.getUnitId()===e);if(r!=null){const i=this._docs.indexOf(r);this._docs.splice(i,1)}this.addDoc(n)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(n=>n.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(n=>n.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(n=>n.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[me,Gt,Oe].forEach(n=>this._contextService.setContextValue(n,!1)),this._focused instanceof l.Workbook?this._contextService.setContextValue(Gt,!0):this._focused instanceof rt?this._contextService.setContextValue(me,!0):this._focused instanceof Re&&this._contextService.setContextValue(Oe,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitId ${e}`)}disposeDocument(e){const n=this.getUniverDocInstance(e);if(n){const o=this._docs.indexOf(n);return this._docs.splice(o,1),this._docDisposed$.next(n),!0}const r=this.getUniverSheetInstance(e);if(r){const o=this._sheets.indexOf(r);return this._sheets.splice(o,1),this._sheetDisposed$.next(r),!0}const i=this.getUniverSlideInstance(e);if(i){const o=this._slides.indexOf(i);return this._slides.splice(o,1),this._slideDisposed$.next(i),!0}return!1}},l.UniverInstanceService=Ao([Co(1,it)],l.UniverInstanceService);var T=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(T||{});const No={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},$t=new Map;function Ie(t,s){return function(r){Ae(t,s)}}function Ae(t,s){$t.has(t)||$t.set(t,[]),$t.get(t).push(s)}var So=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Un=(t,s,e,n)=>{for(var r=n>1?void 0:n?Lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&So(s,e,r),r},Ce=(t,s)=>(e,n)=>s(e,n,t);l.LifecycleService=class extends U{constructor(e){super();_(this,"_lifecycle$",new A.BehaviorSubject(T.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=e,this._reportProgress(T.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");e!==this.stage&&(this._reportProgress(e),this._lifecycle$.next(e))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new A.Observable(e=>(this.stage===T.Starting||(this.stage===T.Ready?e.next(T.Starting):this.stage===T.Rendered?(e.next(T.Starting),e.next(T.Ready)):(e.next(T.Starting),e.next(T.Ready),e.next(T.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${No[e]}".`)}},l.LifecycleService=Un([Ce(0,y)],l.LifecycleService),l.LifecycleInitializerService=class extends U{constructor(e,n){super();_(this,"_started",!1);this._lifecycleService=e,this._injector=n}start(){this._started||(this._started=!0,this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const n=$t.get(e);n==null||n.forEach(r=>{this._injector.has(r)&&this._injector.get(r)})}},l.LifecycleInitializerService=Un([Ce(0,O.Inject(l.LifecycleService)),Ce(1,O.Inject(O.Injector))],l.LifecycleInitializerService);class mt extends U{constructor(){super();_(this,"_currentLocale",tt.ZH_CN);_(this,"_locales",null);_(this,"localeChanged$",new A.Subject);_(this,"t",(e,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return n.forEach((c,a)=>{o=o.replace(`{${a}}`,c)}),o}else return e});this.disposeWithMe(b(()=>this.localeChanged$.complete()))}load(e){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,n){const r=n.shift();if(r&&e&&r in e){const i=e[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Ne=O.createIdentifier("resource-manager-service"),Mn=O.createIdentifier("ResourcePersistenceService");Ae(T.Ready,Mn);var vo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,To=(t,s,e,n)=>{for(var r=n>1?void 0:n?bo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&vo(s,e,r),r},Pn=(t,s)=>(e,n)=>s(e,n,t);const Se=O.createIdentifier("univer.permission-service"),Hn="PERMISSION";l.PermissionService=class extends U{constructor(e,n){super();_(this,"_permissionPointMap",new Map);_(this,"deletePermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});_(this,"addPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(n.id)?!1:(r.set(n.id,new A.BehaviorSubject(n)),this._permissionPointMap.set(e,r),!0)});_(this,"updatePermissionPoint",(e,n,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(n);if(o){const c=o.getValue();c.value=r,c.status=oe.DONE,o.next(c)}});_(this,"getPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=n}_init(){this.disposeWithMe(b(this._univerInstanceService.sheetAdded$.subscribe(e=>{this._resourceManagerService.registerPluginResource(e.getUnitId(),Hn,{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(b(this._univerInstanceService.sheetDisposed$.subscribe(e=>{this._resourceManagerService.disposePluginResource(e.getUnitId(),Hn)})))}_toJson(e){const n=this._permissionPointMap.get(e);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const c=n.get(o);return c&&i.push(c.getValue()),i},[])),JSON.stringify(r)}_parseJson(e){return JSON.parse(e)}composePermission$(e,n){const r=this._permissionPointMap.get(e),i=n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.asObservable()});return A.combineLatest(i).pipe(nr.map(o=>(o.every(c=>this._permissionPointMap.get(c.id)),o)))}composePermission(e,n){const r=this._permissionPointMap.get(e);return n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.getValue()})}},l.PermissionService=To([Ie(T.Starting,l.PermissionService),Pn(0,O.Inject(Ne)),Pn(1,O.Inject(lt))],l.PermissionService);const Fn="univer.editable";class Vt extends ws{constructor(e){super();_(this,"id",Fn);_(this,"value",!0);_(this,"unitID");this.unitID=e}}var wo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Uo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Do(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&wo(s,e,r),r},Wn=(t,s)=>(e,n)=>s(e,n,t);l.UniverPermissionService=class extends U{constructor(s,e){super(),this._permissionService=s,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(s=>{const e=new Vt(s.getUnitId());this._permissionService.addPermissionPoint(s.getUnitId(),e)})}getEditable(s){let e=s;e||(e=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Vt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(s,e){const n=new Vt(s);this._permissionService.updatePermissionPoint(s,n.id,e)}},l.UniverPermissionService=Uo([Ie(T.Starting,l.UniverPermissionService),Wn(0,O.Inject(Se)),Wn(1,O.Inject(lt))],l.UniverPermissionService);class Bn extends U{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new A.Subject);_(this,"register$",this._register$.asObservable())}getAllResource(e){const n=this._resourceMap.get(e);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:e,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(e,n,r){const i=this._resourceMap.get(e)||new Map;if(i.has(n))throw new Error(`the pluginName is registered {${n}}`);return i.set(n,r),this._resourceMap.set(e,i),this._register$.next({unitID:e,resourceName:n,hook:r}),b(()=>i.delete(n))}disposePluginResource(e,n){const r=this._resourceMap.get(e);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Le extends U{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new A.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(b(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const kn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Gn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Mo=`\r
7
+ `;var Po=Object.defineProperty,Ho=Object.getOwnPropertyDescriptor,Fo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ho(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Po(s,e,r),r},ve=(t,s)=>(e,n)=>s(e,n,t);const pt=O.createIdentifier("univer.undo-redo.service"),Wo=20;class $n{dispose(){}async dispatchToHandlers(){return!1}}const Vn="univer.command.redo",pn="univer.command.undo",xn=new class extends $n{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",pn)}async handler(s){const e=s.get(pt),n=e.pitchTopUndoElement();if(!n)return!1;const r=s.get(ht);return Qt(n.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},jn=new class extends $n{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",Vn)}async handler(s){const e=s.get(pt),n=e.pitchTopRedoElement();if(!n)return!1;const r=s.get(ht);return Qt(n.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};l.LocalUndoRedoService=class extends U{constructor(e,n,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new A.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(xn)),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(b(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(b(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:n}=e,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const c=this._batchingStatus.get(e.unitID),a=this._pitchUndoElement(e.unitID);c===0||!a?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(a,e)}else o(e);function o(c){i.push(c),i.length>Wo&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const n=this._getRedoStack(e);n&&(n.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const n=this._getUndoStack(e);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(e){const n=this._getRedoStack(e);return n!=null&&n.length?n[n.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),b(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUniverInstanceId(),n=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(e,n=!1){let r=this._undoStacks.get(e);return!r&&n&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,n=!1){let r=this._redoStacks.get(e);return!r&&n&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,n){e.redoMutations.push(...n.redoMutations),e.undoMutations.push(...n.undoMutations)}_getFocusedUniverInstanceId(){var o,c,a,h;let e="";const n=this._contextService.getContextValue(Gt),r=this._contextService.getContextValue(wn),i=this._contextService.getContextValue(Tn);return n?r?e=Gn:i?e=kn:e=(c=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?c:"":e=(h=(a=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:a.getUnitId())!=null?h:"",e}},l.LocalUndoRedoService=Fo([ve(0,lt),ve(1,ht),ve(2,it)],l.LocalUndoRedoService);class xt extends U{constructor(){super(...arguments);_(this,"_started",!1)}addPlugins(e){if(this._started){const n=e.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,T.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n,!0))}else{const n=e.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(e,n=!1){this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===T.Starting||this._pluginsRunLifecycle(e,r)})))}_pluginsRunLifecycle(e,n){e.forEach(r=>{switch(n){case T.Starting:r.onStarting(this._injector);break;case T.Ready:r.onReady();break;case T.Rendered:r.onRendered();break;case T.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(e,n){return this._injector.createInstance(e,n)}}var Bo=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Go=(t,s,e,n)=>{for(var r=n>1?void 0:n?ko(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Bo(s,e,r),r},be=(t,s)=>(e,n)=>s(e,n,t);l.UniverDoc=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createDoc(s){return this._injector.createInstance(rt,s)}},l.UniverDoc=Go([be(0,O.Inject(O.Injector)),be(1,O.Inject(l.LifecycleService)),be(2,O.Inject(l.LifecycleInitializerService))],l.UniverDoc);var $o=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,po=(t,s,e,n)=>{for(var r=n>1?void 0:n?Vo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&$o(s,e,r),r},Te=(t,s)=>(e,n)=>s(e,n,t);l.UniverSheet=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSheet(s){return this._injector.createInstance(l.Workbook,s)}},l.UniverSheet=po([Te(0,O.Inject(O.Injector)),Te(1,O.Inject(l.LifecycleService)),Te(2,O.Inject(l.LifecycleInitializerService))],l.UniverSheet);var xo=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Ko=(t,s,e,n)=>{for(var r=n>1?void 0:n?jo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&xo(s,e,r),r},we=(t,s)=>(e,n)=>s(e,n,t);l.UniverSlide=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSlide(s){return this._injector.createInstance(Re,s)}},l.UniverSlide=Ko([we(0,O.Inject(O.Injector)),we(1,O.Inject(l.LifecycleService)),we(2,O.Inject(l.LifecycleInitializerService))],l.UniverSlide);const Yo=200;class zo extends xt{constructor(e={}){super();_(this,"_injector");_(this,"_univerPluginStore",new ur);_(this,"_univerPluginRegistry",new hr);_(this,"_univerSheet",null);_(this,"_univerDoc",null);_(this,"_univerSlide",null);_(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=e;n&&this._injector.get(Le).setTheme(n),i&&this._injector.get(mt).load(i),r&&this._injector.get(mt).setLocale(r),o&&this._injector.get(y).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(lt)}get _lifecycleService(){return this._injector.get(l.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(l.LifecycleInitializerService)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(e){this._injector.get(mt).setLocale(e)}createUniverSheet(e){let n;const r=()=>{n=this._univerSheet.createSheet(e),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(l.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(e){let n;const r=()=>{n=this._univerDoc.createDoc(e),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(l.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(e){let n;const r=()=>{n=this._univerSlide.createSlide(e),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(l.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new O.Injector([[lt,{useFactory:e=>new l.UniverInstanceService({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},e),deps:[it]}],[Ze],[mt],[Le],[l.LifecycleService],[l.LifecycleInitializerService],[Se,{useClass:l.PermissionService}],[l.UniverPermissionService],[y,{useClass:ze,lazy:!0}],[ht,{useClass:l.CommandService,lazy:!0}],[pt,{useClass:l.LocalUndoRedoService,lazy:!0}],[Qe,{useClass:Je}],[it,{useClass:Ke}],[ts,{useClass:ye,lazy:!0}],[Ne,{useClass:Bn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(l.LifecycleInitializerService).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(l.LifecycleService).stage<T.Ready&&(this._injector.get(l.LifecycleService).stage=T.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(e,n){if(e.type===w.Univer)this._registerUniverPlugin(e,n);else if(e.type===w.Sheet)this._registerSheetsPlugin(e,n);else if(e.type===w.Doc)this._registerDocsPlugin(e,n);else if(e.type===w.Slide)this._registerSlidesPlugin(e,n);else throw new Error(`Unimplemented plugin system for business: "${e.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),Yo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const e=this._univerPluginRegistry.getRegisterPlugins(w.Univer);if(e.length){this._univerPluginRegistry.clearPluginsOfType(w.Univer);const n=e.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Slide))}}_registerUniverPlugin(e,n){if(this._started)this._univerPluginRegistry.registerPlugin(e,n);else{const r=this._injector.createInstance(e,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerDocsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerSlidesPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}}function Xo(t,s=16){let e=0,n=null;return function(...i){const o=Date.now();o-e<s?(n&&clearTimeout(n),n=setTimeout(()=>{e=o,t.apply(this,i)},s)):(e=o,t.apply(this,i))}}function qo(t){const s=new MessageChannel;let e=!1;return s.port1.onmessage=()=>{e||t()},s.port2.postMessage(null),()=>{e=!0}}var Kn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(Kn||{});class De{constructor(s){_(this,"_index",0);_(this,"_offset",0);this._actions=s}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(s){s||(s=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const n=this._offset,r=e.len;return s>=r-n?(s=r-n,this._index+=1,this._offset=0):this._offset+=s,e.t===C.DELETE||e.t===C.RETAIN&&e.body==null?R.deepClone({...e,len:s}):R.deepClone({...e,len:s,body:_e(e.body,n,n+s)})}else return{t:C.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const s=this._actions[this._index];return s?s.t:C.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const s=this._offset,e=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=s,this._index=e,[n].concat(r)}}else return[]}}function Yn(t){return Object.keys(t).length===1}class jt{constructor(){_(this,"_actions",[])}static compose(s,e){const n=new De(s),r=new De(e),i=new jt;for(;n.hasNext()||r.hasNext();)if(r.peekType()===C.INSERT)i.push(r.next());else if(n.peekType()===C.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),c=n.next(o),a=r.next(o);c.t===C.INSERT&&a.t===C.RETAIN?a.body==null?i.push(c):i.push({...c,body:de(c.body,a.body,a.coverType)}):c.t===C.RETAIN&&a.t===C.RETAIN?c.body==null&&a.body==null?i.push(c.len!==Number.POSITIVE_INFINITY?c:a):c.body&&a.body?i.push({...c,body:de(c.body,a.body,a.coverType)}):i.push(c.body?c:a):c.t===C.RETAIN&&a.t===C.DELETE?i.push(a):c.t===C.INSERT&&(a.t,C.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(s,e,n=""){const r={t:C.INSERT,body:e,len:s,line:0,segmentId:n};return this.push(r),this}retain(s,e="",n,r){const i={t:C.RETAIN,len:s,segmentId:e};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(s,e=""){const n={t:C.DELETE,len:s,line:0,segmentId:e};return this.push(n),this}serialize(){return this._actions}push(...s){if(s.length>1){for(const i of s)this.push(i);return this}let e=this._actions.length,n=this._actions[e-1];const r=R.deepClone(s[0]);if(r.t===C.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===C.DELETE&&r.t===C.DELETE)return n.len+=r.len,this;if(n.t===C.DELETE&&r.t===C.INSERT&&(e-=1,n=this._actions[e-1],n==null))return this._actions.unshift(r),this;if(n.t===C.RETAIN&&r.t===C.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===C.INSERT&&Yn(n.body)&&r.t===C.INSERT&&Yn(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let s=this._actions[this._actions.length-1];for(;s&&s.t===C.RETAIN&&ji(s);)this._actions.pop(),s=this._actions[this._actions.length-1];return this}}function Qo(t,s,e){if(s==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new rt(n),i=s.length;let o;for(;(o=r.getBody().dataStream.indexOf(s))>=0;){const a=new jt;if(o>0&&a.retain(o),e.length>0){const u=r.sliceBody(o,o+i),d={dataStream:e};Array.isArray(u==null?void 0:u.textRuns)&&u.textRuns.length&&(d.textRuns=[{...u.textRuns[0],st:0,ed:e.length}]),a.insert(e.length,d)}a.delete(i);const h=a.serialize();r.apply(h)}const c=r.getBody();return r.dispose(),c}class Jo extends Ct{add(s){if(!s)return null;const e=new At(s,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Zo=O.createIdentifier("ILocalStorageService");function yo(t){return new A.Observable(s=>{const e=t((...n)=>s.next(n));return()=>e==null?void 0:e.dispose()})}const tc=t=>`sheet_interceptor_${t}`,zn=t=>function(s,e){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,e,r.bind(null,i+1))}return r(0,s)};class ec{constructor(s){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=s}fetchThroughInterceptors(s){const e=s,n=this._interceptorsByName.get(e);return zn(n||[])}intercept(s,e){const n=s;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(e),this._interceptorsByName.set(n,r.sort((i,o)=>{var c,a;return((c=o.priority)!=null?c:0)-((a=i.priority)!=null?a:0)})),()=>K(this._interceptorsByName.get(n),e)}getInterceptPoints(){return this._interceptorPoints}}const sc=O.createIdentifier("univer.snapshot-server-service");class nc{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(s,e){return Promise.resolve({snapshot:{unitID:"",type:j.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:k.OK,message:""}})}getSheetBlock(s,e){const n=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:n,error:{code:k.OK,message:""}})}fetchMissingChangesets(s,e){return Promise.resolve({changesets:[],error:{code:k.OK,message:""}})}getResourcesRequest(s,e){return Promise.resolve({resources:{},error:{code:k.OK,message:""}})}saveSnapshot(s,e){return Promise.resolve({error:{code:k.OK,message:""}})}saveSheetBlock(s,e){const{block:n}=e;return n?(this._sheetBlockCache.set(n.id,n),Promise.resolve({error:{code:k.OK,message:""},blockID:n.id})):Promise.resolve({error:{code:k.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(s,e){return Promise.resolve({error:{code:k.OK,message:""},concurrent:[]})}}function rc(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(s,e)=>String.fromCharCode(Number.parseInt(e,16))))}function Ue(t){return decodeURIComponent(Array.prototype.map.call(atob(t),s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ot=new TextEncoder,Kt=new TextDecoder;function Xn(t){const s=R.deepClone(t);return delete s.id,delete s.name,delete s.rowCount,delete s.columnCount,delete s.cellData,Ot.encode(JSON.stringify(s))}function qn(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.name,delete s.sheetOrder,delete s.sheets,Ot.encode(JSON.stringify(s))}function ic(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.title,delete s.resources,Ot.encode(JSON.stringify(s))}function Qn(t){return JSON.parse(Kt.decode(t))}function oc(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}function cc(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}const Me=256;function Jn(t,s){const e=new V(t),n=e.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+Me,n-1),c=e.getSlice(i,Math.min(i+Me,n-1),0,s),a=ac(c);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=Me}return r}function ac(t){const s=t.getData();return Ot.encode(JSON.stringify(s))}async function lc(t,s,e,n,r){const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([d,E])=>{const f={id:E.id,type:St.GRID,name:E.name,rowCount:E.rowCount,columnCount:E.columnCount,originalMeta:Xn(E)};if(o[d]=f,E.cellData){const g=Jn(E.cellData,E.rowCount),m=await Promise.all(g.map(N=>r.saveSheetBlock(t,{unitID:e,type:j.UNIVER_SHEET,block:N})));if(m.some(N=>{var S;return((S=N.error)==null?void 0:S.code)!==k.OK}))return!1;i[d]={sheetID:d,blocks:m.map(N=>N.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a};return{snapshotRes:{unitID:e,rev:h.rev,type:j.UNIVER_SHEET,workbook:h,doc:void 0}}}async function uc(t,s,e,n,r){var E,f;const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([g,m])=>{const N={id:m.id,type:St.GRID,name:m.name,rowCount:m.rowCount,columnCount:m.columnCount,originalMeta:Xn(m)};if(o[g]=N,m.cellData){const S=Jn(m.cellData,m.rowCount),F=await Promise.all(S.map(P=>r.saveSheetBlock(t,{unitID:e,type:j.UNIVER_SHEET,block:P})));if(F.some(P=>{var J;return((J=P.error)==null?void 0:J.code)!==k.OK}))return!1;i[g]={sheetID:g,blocks:F.map(P=>P.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a},u={unitID:e,rev:h.rev,type:j.UNIVER_SHEET,workbook:h,doc:void 0},d=await r.saveSnapshot(t,{unitID:e,type:j.UNIVER_SHEET,snapshot:u});if(Rn(d.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
+ ErrorCode: ${(E=d.error)==null?void 0:E.code}:${(f=d.error)==null?void 0:f.message}`);return{snapshot:u}}function hc(t,s,e){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([a,h])=>{const u=Qn(h.originalMeta);r[a]={id:h.id,name:h.name,rowCount:h.rowCount,columnCount:h.columnCount,...u}});const i=new Map;s.forEach(a=>{i.set(a.id,a)}),n.blockMeta&&Object.entries(n.blockMeta).forEach(([a,h])=>{var E;const u=r[a];u.cellData={};const d=[];(E=h.blocks)==null||E.forEach(f=>{const g=i.get(f);if(g)d.push(g);else throw new Error("")}),d.forEach(f=>{const g=oc(f.data);Object.entries(g).forEach(([m,N])=>{const S=u.cellData[+m]={};Object.entries(N).forEach(([F,P])=>{S[+F]=P})})})});const o=Qn(n.originalMeta);return{id:t.unitID,rev:n.rev,name:n.name,sheetOrder:n.sheetOrder,appVersion:"",locale:tt.EN_US,sheets:r,styles:{},resources:n.resources||[],...o}}function _c(t){const s=t.doc;if(s==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:n,name:r,originalMeta:i}=s,{body:o,documentStyle:c={},settings:a={}}=cc(i);return{id:e,rev:n,locale:tt.EN_US,title:r,body:o,documentStyle:c,settings:a}}async function dc(t,s,e,n,r){var a,h,u;const i={unitID:s.id,rev:n,creator:"",name:(a=s.title)!=null?a:"",resources:s.resources||[],originalMeta:ic(s)},o={unitID:e,rev:i.rev,type:j.UNIVER_DOC,workbook:void 0,doc:i},c=await r.saveSnapshot(t,{unitID:e,type:j.UNIVER_DOC,snapshot:o});if(Rn(c.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
+ ErrorCode: ${(h=c.error)==null?void 0:h.code}:${(u=c.error)==null?void 0:u.message}`);return{snapshot:o}}async function Ec(t,s){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const c=o.blocks.map(async a=>{const h={unitID:e.unitID,type:j.UNIVER_SHEET,blockID:a},{block:u}=await s.getSheetBlock({},h);if(u)n.push(u);else throw new Error("Block not found")});r.push(...c)}),await Promise.all(r),n}var Zn=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(Zn||{}),yn=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(yn||{}),tr=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(tr||{}),er=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(er||{}),sr=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(sr||{});rr(),l.ABCToNumber=mi,l.AbsoluteRefType=p,l.ActionIterator=De,l.AlignTypeH=hn,l.AlignTypeV=_n,l.AutoFillSeries=rs,l.BaselineOffset=bt,l.BlockType=Ys,l.BooleanNumber=I,l.BorderStyleTypes=v,l.BorderType=is,l.BulletAlignment=X,l.COLORS=Jt,l.CellValueType=dt,l.ClientSnapshotServerService=nc,l.Color=st,l.ColorBuilder=wt,l.ColorKit=$,l.ColorType=B,l.ColumnSeparatorType=qs,l.CommandType=Nt,l.CommonHideTypes=os,l.ConditionType=cs,l.ConfigService=Je,l.ContentAlignment=on,l.ContextService=Ke,l.CopyPasteType=as,l.CustomRangeType=Ks,l.DEFAULT_CELL=bi,l.DEFAULT_DOC=Ee,l.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Lr,l.DEFAULT_EMPTY_DOCUMENT_VALUE=Mo,l.DEFAULT_RANGE=Li,l.DEFAULT_RANGE_ARRAY=ft,l.DEFAULT_SELECTION=vi,l.DEFAULT_SLIDE=Ms,l.DEFAULT_STYLES=Wt,l.DEFAULT_WORKSHEET_COLUMN_COUNT=An,l.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=to,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ln,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=ro,l.DEFAULT_WORKSHEET_COLUMN_WIDTH=Nn,l.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=so,l.DEFAULT_WORKSHEET_ROW_COUNT=In,l.DEFAULT_WORKSHEET_ROW_COUNT_KEY=yi,l.DEFAULT_WORKSHEET_ROW_HEIGHT=Cn,l.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=eo,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Sn,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=no,l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Gn,l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=kn,l.DashStyleType=sn,l.DataStreamTreeNodeType=Hs,l.DataStreamTreeTokenType=ae,l.DataValidationErrorStyle=Zn,l.DataValidationImeMode=yn,l.DataValidationOperator=tr,l.DataValidationRenderMode=Kn,l.DataValidationStatus=sr,l.DataValidationType=er,l.DesktopLogService=ze,l.DeveloperMetadataVisibility=ls,l.Dimension=us,l.Direction=hs,l.Disposable=U,l.DisposableCollection=qt,l.DocStyleType=xs,l.DocumentDataModel=rt,l.EDITOR_ACTIVATED=Tn,l.EXTENSION_NAMES=Ps,l.Entry=se,l.EntryIterator=bs,l.ErrorService=Ze,l.EventState=xe,l.FOCUSING_DOC=me,l.FOCUSING_EDITOR_BUT_HIDDEN=Eo,l.FOCUSING_EDITOR_INPUT_FORMULA=fo,l.FOCUSING_EDITOR_STANDALONE=Ro,l.FOCUSING_FORMULA_EDITOR=wn,l.FOCUSING_SHEET=Gt,l.FOCUSING_SLIDE=Oe,l.FOCUSING_UNIVER_EDITOR=go,l.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=mo,l.FloatingObjectManagerService=ye,l.FollowNumberWithType=js,l.FontItalic=Lt,l.FontStyleType=cn,l.FontWeight=vt,l.FormatType=_s,l.GlyphType=gt,l.GridType=zs,l.HLSColor=Os,l.HorizontalAlign=et,l.ICommandService=ht,l.IConfigService=Qe,l.IContextService=it,l.IFloatingObjectManagerService=ts,l.ILocalStorageService=Zo,l.ILogService=y,l.IPermissionService=Se,l.IResourceManagerService=Ne,l.ISnapshotPersistenceService=Mn,l.ISnapshotServerService=sc,l.IUndoRedoService=pt,l.IUniverInstanceService=lt,l.InterceptorManager=ec,l.InterpolationPointType=ds,l.KeyIterator=Ls,l.LRUHelper=Et,l.LRUMap=Ts,l.LifecycleStages=T,l.LocaleService=mt,l.LocaleType=tt,l.LogLevel=Ye,l.MemoryCursor=es,l.NamedStyleType=tn,l.NilCommand=qe,l.NumberUnitType=un,l.ObjectMatrix=V,l.ObjectRelativeFromH=an,l.ObjectRelativeFromV=ln,l.Observable=Ct,l.ObservableHooks=Jo,l.Observer=At,l.OnLifecycle=Ie,l.PRESET_LIST_TYPE=Wi,l.PageElementType=mn,l.PageOrientType=En,l.PageType=ge,l.ParagraphElementType=Js,l.PermissionPoint=ws,l.PermissionStatus=oe,l.Plugin=Pe,l.PluginType=w,l.PositionedObjectLayoutType=ys,l.PresetListType=kt,l.ProtectionType=Es,l.RANGE_TYPE=W,l.RGBA_PAREN=Dr,l.RGB_PAREN=wr,l.Range=nt,l.Rectangle=Z,l.RedoCommand=jn,l.RedoCommandId=Vn,l.RefAlias=Ri,l.Registry=Yt,l.RegistryAsMap=zt,l.RelativeDate=fs,l.RelativeSlideLink=On,l.ResourceManagerService=Bn,l.RgbColor=Dt,l.RxDisposable=mr,l.SectionType=Xs,l.ShapeType=gs,l.SheetTypes=St,l.SheetViewModel=bn,l.SlideDataModel=Re,l.SpacingRule=en,l.Styles=gn,l.THEME_COLORS=ms,l.TabStopAlignment=nn,l.TextDecoration=Rs,l.TextDirection=_t,l.TextDirectionType=Qs,l.TextX=jt,l.TextXActionType=C,l.ThemeColor=Ut,l.ThemeColorType=H,l.ThemeColors=Tt,l.ThemeService=Le,l.Tools=R,l.UndoCommand=xn,l.UndoCommandId=pn,l.Univer=zo,l.UniverEditablePermission=Vt,l.UniverEditablePermissionPoint=Fn,l.UniverInstanceType=Dn,l.UpdateDocsAttributeType=M,l.ValueIterator=vs,l.VerticalAlign=ot,l.WidthType=rn,l.Worksheet=Rt,l.WrapStrategy=ct,l.WrapTextType=Zs,l.b64DecodeUnicode=Ue,l.b64EncodeUnicode=rc,l.binarySearchArray=ss,l.cellToRange=oi,l.characterSpacingControlType=dn,l.checkForSubstrings=ci,l.checkParagraphHasBullet=ai,l.checkParagraphHasIndent=li,l.checkParagraphHasIndentByStyle=Cs,l.codeToBlob=br,l.composeBody=de,l.composeInterceptors=zn,l.concatMatrixArray=_i,l.createInterceptorKey=tc,l.createRowColIter=ce,l.debounce=Si,l.dedupe=_r,l.deepCompare=te,l.deleteContent=Ss,l.extractPureTextFromCell=io,l.fromCallback=yo,l.fromObservable=Rr,l.generateTemporarySnap=lc,l.getArrayLength=z,l.getBodySlice=_e,l.getBorderStyleType=ri,l.getCellValueType=Xi,l.getColorStyle=x,l.getDocsUpdateBody=Ht,l.getReverseDirection=Tr,l.getSheetBlocksFromSnapshot=Ec,l.getTypeFromPermissionItemList=gi,l.getWorksheetUID=_o,l.groupBy=fr,l.handleJsonToDom=si,l.handleStyleToString=ni,l.hashAlgorithm=hi,l.horizontalLineSegmentsSubtraction=ee,l.insertMatrixArray=ne,l.insertTextToContent=Ns,l.isBlackColor=pr,l.isCellV=Qi,l.isEmptyCell=yr,l.isFormulaId=ei,l.isFormulaString=ti,l.isICellData=zi,l.isNullCell=qi,l.isObserver=je,l.isRangesEqual=cr,l.isRealNum=ui,l.isSameStyleTextRun=As,l.isUnitRangesEqual=ar,l.isValidRange=ii,l.isWhiteColor=xr,l.makeCellRangeToRangeData=Zr,l.makeCellToSelection=Jr,l.mergeWorksheetSnapshotWithDefault=vn,l.moveMatrixArray=ie,l.normalizeTextRuns=le,l.numberToABC=Ii,l.numberToListABC=Ai,l.orderSearchArray=ns,l.queryObjectMatrix=Ui,l.remove=K,l.repeatStringNumTimes=Us,l.replaceInDocumentBody=Qo,l.requestImmediateMacroTask=qo,l.rotate=Er,l.runOnLifecycle=Ae,l.searchArray=vr,l.selectionToArray=or,l.sequence=Fe,l.sequenceAsync=He,l.sequenceExecute=Qt,l.sequenceExecuteAsync=Sr,l.shallowEqual=lr,l.sliceMatrixArray=di,l.sortRules=Ci,l.sortRulesByDesc=Ni,l.sortRulesFactory=at,l.spliceArray=re,l.textDecoder=Kt,l.textEncoder=Ot,l.throttle=Xo,l.toDisposable=b,l.transformDocumentDataToSnapshot=dc,l.transformSnapshotToDocumentData=_c,l.transformSnapshotToWorkbookData=hc,l.transformWorkbookDataToSnapshot=uc,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});